public void ReplaceTsString_OneRunBldrStringNullEmptyRange_DoesNotUpdateText() { TsStrBldr tsb = CreateOneRunBldr(); tsb.ReplaceTsString(1, 1, null); Assert.That(tsb.Text, Is.EqualTo(EnglishFont1Text)); }
public void SetIntPropValues_OneRunBldrEmptyRange_DoesNotUpdateProperties() { TsStrBldr tsb = CreateOneRunBldr(); Assert.That(GetWS(tsb, 0), Is.EqualTo(EnglishWS)); tsb.SetIntPropValues(0, 0, (int)FwTextPropType.ktptWs, (int)FwTextPropVar.ktpvDefault, SpanishWS); Assert.That(GetWS(tsb, 0), Is.EqualTo(EnglishWS)); }
public void SetIntPropValues_OneRunBldrFullRange_UpdatesProperties() { TsStrBldr tsb = CreateOneRunBldr(); Assert.That(GetWS(tsb, 0), Is.EqualTo(EnglishWS)); tsb.SetIntPropValues(0, tsb.Length, (int)FwTextPropType.ktptWs, (int)FwTextPropVar.ktpvDefault, SpanishWS); Assert.That(GetWS(tsb, 0), Is.EqualTo(SpanishWS)); }
public void SetProperties_OneRunBldrFullRange_UpdatesProperties() { TsStrBldr tsb = CreateOneRunBldr(); Assert.That(GetWS(tsb, 0), Is.EqualTo(EnglishWS)); tsb.SetProperties(0, tsb.Length, new TsTextProps(SpanishWS)); Assert.That(GetWS(tsb, 0), Is.EqualTo(SpanishWS)); }
public void SetProperties_OneRunBldrEmptyRange_DoesNotUpdateProperties() { TsStrBldr tsb = CreateOneRunBldr(); Assert.That(GetWS(tsb, 0), Is.EqualTo(EnglishWS)); tsb.SetProperties(0, 0, new TsTextProps(SpanishWS)); Assert.That(GetWS(tsb, 0), Is.EqualTo(EnglishWS)); }
public void SetProperties_EmptyBldr_UpdatesProperties() { TsStrBldr tsb = CreateEmptyBldr(); Assert.That(GetWS(tsb, 0), Is.EqualTo(-1)); tsb.SetProperties(0, 0, new TsTextProps(EnglishWS)); Assert.That(GetWS(tsb, 0), Is.EqualTo(EnglishWS)); }
public void SetStrPropValue_EmptyBldr_UpdatesProperties() { TsStrBldr tsb = CreateEmptyBldr(); Assert.That(GetFont(tsb, 0), Is.Null); tsb.SetStrPropValue(0, 0, (int)FwTextPropType.ktptFontFamily, Font1); Assert.That(GetFont(tsb, 0), Is.EqualTo(Font1)); }
public void SetStrPropValue_OneRunBldrEmptyRange_DoesNotUpdateProperties() { TsStrBldr tsb = CreateOneRunBldr(); Assert.That(GetFont(tsb, 0), Is.EqualTo(Font1)); tsb.SetStrPropValue(0, 0, (int)FwTextPropType.ktptFontFamily, Font2); Assert.That(GetFont(tsb, 0), Is.EqualTo(Font1)); }
public void SetStrPropValue_OneRunBldrFullRange_UpdatesProperties() { TsStrBldr tsb = CreateOneRunBldr(); Assert.That(GetFont(tsb, 0), Is.EqualTo(Font1)); tsb.SetStrPropValue(0, tsb.Length, (int)FwTextPropType.ktptFontFamily, Font2); Assert.That(GetFont(tsb, 0), Is.EqualTo(Font2)); }
public void SetIntPropValues_EmptyBldr_UpdatesProperties() { TsStrBldr tsb = CreateEmptyBldr(); Assert.That(GetWS(tsb, 0), Is.EqualTo(-1)); tsb.SetIntPropValues(0, 0, (int)FwTextPropType.ktptWs, (int)FwTextPropVar.ktpvDefault, EnglishWS); Assert.That(GetWS(tsb, 0), Is.EqualTo(EnglishWS)); }
public void Replace_EmptyBldrEmptyText_UpdatesProperties() { TsStrBldr tsb = CreateEmptyBldr(); tsb.Replace(0, 0, string.Empty, new TsTextProps(FrenchWS)); Assert.That(tsb.Text, Is.Null); Assert.That(tsb.RunCount, Is.EqualTo(1)); Assert.That(GetWS(tsb, 0), Is.EqualTo(FrenchWS)); }
public void Replace_EmptyBldrNonEmptyText_InsertsText() { TsStrBldr tsb = CreateEmptyBldr(); tsb.Replace(0, 0, "text", new TsTextProps(FrenchWS)); Assert.That(tsb.Text, Is.EqualTo("text")); Assert.That(tsb.RunCount, Is.EqualTo(1)); Assert.That(GetWS(tsb, 0), Is.EqualTo(FrenchWS)); }
public void Clear_TwoRunBldr_ClearsState() { TsStrBldr tsb = CreateMixedWSBldr(); tsb.Clear(); Assert.That(tsb.Text, Is.Null); Assert.That(tsb.RunCount, Is.EqualTo(1)); Assert.That(GetWS(tsb, 0), Is.EqualTo(-1)); }
public void SetProperties_OneRunBldrPartialRangeFromMiddleToEnd_CreatesOneExtraRun() { TsStrBldr tsb = CreateOneRunBldr(); Assert.That(GetWS(tsb, 0), Is.EqualTo(EnglishWS)); Assert.That(tsb.RunCount, Is.EqualTo(1)); tsb.SetProperties(1, tsb.Length, new TsTextProps(SpanishWS)); Assert.That(tsb.RunCount, Is.EqualTo(2)); Assert.That(GetWS(tsb, 0), Is.EqualTo(EnglishWS)); Assert.That(GetWS(tsb, 1), Is.EqualTo(SpanishWS)); }
public void Replace_OneRunBldrEmptyTextEmptyRange_DoNotUpdateProperties() { TsStrBldr tsb = CreateOneRunBldr(); tsb.Replace(0, 0, string.Empty, new TsTextProps(FrenchWS)); Assert.That(tsb.Text, Is.EqualTo(EnglishFont1Text)); Assert.That(tsb.RunCount, Is.EqualTo(1)); int var; Assert.That(tsb.get_PropertiesAt(0).GetIntPropValues((int)FwTextPropType.ktptWs, out var), Is.EqualTo(EnglishWS)); }
private const string e_WITH_GRAVE = "\u00E8"; // composition of e + COMBINING_GRAVE_ACCENT private TsString CreateStackedDiacriticsInput(bool singleRun) { string stackedDiacriticsInput = "Stacked diacritics: W" + "e" + COMBINING_DOUBLE_ACUTE_ACCENT + COMBINING_RING_BELOW + COMBINING_GRAVE_ACCENT_BELOW + "lc" + COMBINING_LEFT_TACK_BELOW + COMBINING_MINUS_SIGN_BELOW + "o" + COMBINING_CIRCUMFLEX_ACCENT + "m" + COMBINING_SEAGULL_BELOW + COMBINING_GRAVE_ACCENT + COMBINING_DIAERESIS + COMBINING_MACRON + "e" + COMBINING_GRAVE_ACCENT + " to" + COMBINING_DIAERESIS + COMBINING_CIRCUMFLEX_ACCENT + " Wo" + COMBINING_DOT_ABOVE + COMBINING_INVERTED_BREVE + "r" + COMBINING_SQUARE_BELOW + "l" + COMBINING_TILDE + "d" + COMBINING_DOWN_TACK_BELOW + COMBINING_TILDE_BELOW + "Pa" + COMBINING_DOT_ABOVE + COMBINING_OVERLINE + COMBINING_DOUBLE_ACUTE_ACCENT + "d" + COMBINING_ACUTE_ACCENT_BELOW + "!"; var temp = new TsString(stackedDiacriticsInput, EnWS); var builder = new TsStrBldr(); builder.ReplaceTsString(0, 0, temp); builder.SetIntPropValues(0, stackedDiacriticsInput.Length, (int)FwTextPropType.ktptFontSize, (int)FwTextPropVar.ktpvMilliPoint, 20000); builder.SetIntPropValues(0, stackedDiacriticsInput.Length, (int)FwTextPropType.ktptForeColor, (int)FwTextPropVar.ktpvDefault, (int)FwTextColor.kclrGreen); if (singleRun) { return((TsString)builder.GetString()); } // green from 0-22 builder.SetIntPropValues(22, 23, (int)FwTextPropType.ktptForeColor, (int)FwTextPropVar.ktpvDefault, (int)FwTextColor.kclrRed); builder.SetIntPropValues(23, 24, (int)FwTextPropType.ktptForeColor, (int)FwTextPropVar.ktpvDefault, 0x00ff602f); // green from 24-30 builder.SetIntPropValues(30, 31, (int)FwTextPropType.ktptForeColor, (int)FwTextPropVar.ktpvDefault, (int)FwTextColor.kclrBlue); // green from 31-33 builder.SetIntPropValues(33, 34, (int)FwTextPropType.ktptForeColor, (int)FwTextPropVar.ktpvDefault, (int)FwTextColor.kclrRed); // green from 34-42 builder.SetIntPropValues(42, 43, (int)FwTextPropType.ktptForeColor, (int)FwTextPropVar.ktpvDefault, (int)FwTextColor.kclrBlack); // green from 43-47 builder.SetIntPropValues(47, 48, (int)FwTextPropType.ktptForeColor, (int)FwTextPropVar.ktpvDefault, (int)FwTextColor.kclrBlack); // green from 48-51 builder.SetIntPropValues(51, 52, (int)FwTextPropType.ktptForeColor, (int)FwTextPropVar.ktpvDefault, (int)FwTextColor.kclrBlue); // green from 52-53 builder.SetIntPropValues(53, 54, (int)FwTextPropType.ktptForeColor, (int)FwTextPropVar.ktpvDefault, (int)FwTextColor.kclrRed); // green from 54-58 builder.SetIntPropValues(58, 59, (int)FwTextPropType.ktptForeColor, (int)FwTextPropVar.ktpvDefault, (int)FwTextColor.kclrRed); builder.SetIntPropValues(59, 60, (int)FwTextPropType.ktptForeColor, (int)FwTextPropVar.ktpvDefault, (int)FwTextColor.kclrBlack); // green from 60-61 builder.SetIntPropValues(61, 62, (int)FwTextPropType.ktptForeColor, (int)FwTextPropVar.ktpvDefault, (int)FwTextColor.kclrBlack); // green from 62-63 return((TsString)builder.GetString()); }
public void Replace_OneRunBldrNonEmptyTextFullRange_ReplacesText() { TsStrBldr tsb = CreateOneRunBldr(); tsb.Replace(0, tsb.Length, "A new text.", new TsTextProps(FrenchWS)); Assert.That(tsb.Text, Is.EqualTo("A new text.")); Assert.That(tsb.RunCount, Is.EqualTo(1)); Assert.That(GetWS(tsb, 0), Is.EqualTo(FrenchWS)); int ichMin, ichLim; tsb.GetBoundsOfRun(0, out ichMin, out ichLim); Assert.That(ichMin, Is.EqualTo(0)); Assert.That(ichLim, Is.EqualTo(tsb.Length)); }
public void Replace_OneRunBldrEmptyTextPartialRange_RemovesText() { TsStrBldr tsb = CreateOneRunBldr(); tsb.Replace(5, 8, string.Empty, new TsTextProps(FrenchWS)); Assert.That(tsb.Text, Is.EqualTo("This a test!")); Assert.That(tsb.RunCount, Is.EqualTo(1)); Assert.That(GetWS(tsb, 0), Is.EqualTo(EnglishWS)); int ichMin, ichLim; tsb.GetBoundsOfRun(0, out ichMin, out ichLim); Assert.That(ichMin, Is.EqualTo(0)); Assert.That(ichLim, Is.EqualTo(tsb.Length)); }
public void SetProperties_TwoRunBldrReplacesFirstAndOverlapsSecondByOneCharacterSamePropertiesAsSecond_UpdatesProperties() { TsStrBldr tsb = CreateMixedWSBldr(); tsb.SetProperties(0, EnglishFont1Text.Length + 2, new TsTextProps(SpanishWS)); Assert.That(tsb.RunCount, Is.EqualTo(1)); Assert.That(tsb.get_RunText(0), Is.EqualTo("This is a test! ¡Esto es una prueba!")); Assert.That(GetWS(tsb, 0), Is.EqualTo(SpanishWS)); int ichMin, ichLim; tsb.GetBoundsOfRun(0, out ichMin, out ichLim); Assert.That(ichMin, Is.EqualTo(0)); Assert.That(ichLim, Is.EqualTo(tsb.Length)); }
public void Replace_OneRunBldrNonEmptyTextEmptyRangeNullProps_InsertsText() { TsStrBldr tsb = CreateOneRunBldr(); tsb.Replace(tsb.Length, tsb.Length, " text", null); Assert.That(tsb.Text, Is.EqualTo(EnglishFont1Text + " text")); Assert.That(tsb.RunCount, Is.EqualTo(1)); Assert.That(GetWS(tsb, 0), Is.EqualTo(EnglishWS)); int ichMin, ichLim; tsb.GetBoundsOfRun(0, out ichMin, out ichLim); Assert.That(ichMin, Is.EqualTo(0)); Assert.That(ichLim, Is.EqualTo(tsb.Length)); }
public void SetStrPropValue_TwoRunBldrRangeReplacesFirstOverlapsSecond_UpdatesProperties() { TsStrBldr tsb = CreateMixedFontBldr(); tsb.SetStrPropValue(0, 27, (int)FwTextPropType.ktptFontFamily, Font3); Assert.That(tsb.RunCount, Is.EqualTo(2)); Assert.That(tsb.get_RunText(0), Is.EqualTo("This is a test! How are you")); Assert.That(GetFont(tsb, 0), Is.EqualTo(Font3)); int ichMin, ichLim; tsb.GetBoundsOfRun(0, out ichMin, out ichLim); Assert.That(ichMin, Is.EqualTo(0)); Assert.That(ichLim, Is.EqualTo(27)); tsb.GetBoundsOfRun(1, out ichMin, out ichLim); Assert.That(ichMin, Is.EqualTo(27)); Assert.That(ichLim, Is.EqualTo(tsb.Length)); }
public void SetIntPropValues_TwoRunBldrRangeOverlapsBothSamePropertiesAsLast_UpdatesProperties() { TsStrBldr tsb = CreateMixedWSBldr(); tsb.SetIntPropValues(6, 27, (int)FwTextPropType.ktptWs, (int)FwTextPropVar.ktpvDefault, SpanishWS); Assert.That(tsb.RunCount, Is.EqualTo(2)); Assert.That(tsb.get_RunText(1), Is.EqualTo("s a test! ¡Esto es una prueba!")); Assert.That(GetWS(tsb, 1), Is.EqualTo(SpanishWS)); int ichMin, ichLim; tsb.GetBoundsOfRun(0, out ichMin, out ichLim); Assert.That(ichMin, Is.EqualTo(0)); Assert.That(ichLim, Is.EqualTo(6)); tsb.GetBoundsOfRun(1, out ichMin, out ichLim); Assert.That(ichMin, Is.EqualTo(6)); Assert.That(ichLim, Is.EqualTo(tsb.Length)); }
public void SetIntPropValues_TwoRunBldrRangeReplacesFirstOverlapsSecond_UpdatesProperties() { TsStrBldr tsb = CreateMixedWSBldr(); tsb.SetIntPropValues(0, 27, (int)FwTextPropType.ktptWs, (int)FwTextPropVar.ktpvDefault, FrenchWS); Assert.That(tsb.RunCount, Is.EqualTo(2)); Assert.That(tsb.get_RunText(0), Is.EqualTo("This is a test! ¡Esto es un")); Assert.That(GetWS(tsb, 0), Is.EqualTo(FrenchWS)); int ichMin, ichLim; tsb.GetBoundsOfRun(0, out ichMin, out ichLim); Assert.That(ichMin, Is.EqualTo(0)); Assert.That(ichLim, Is.EqualTo(27)); tsb.GetBoundsOfRun(1, out ichMin, out ichLim); Assert.That(ichMin, Is.EqualTo(27)); Assert.That(ichLim, Is.EqualTo(tsb.Length)); }
public void SetProperties_TwoRunBldrRangeOverlapsFirstReplacesSecond_UpdatesProperties() { TsStrBldr tsb = CreateMixedWSBldr(); tsb.SetProperties(6, tsb.Length, new TsTextProps(FrenchWS)); Assert.That(tsb.RunCount, Is.EqualTo(2)); Assert.That(tsb.get_RunText(1), Is.EqualTo("s a test! ¡Esto es una prueba!")); Assert.That(GetWS(tsb, 1), Is.EqualTo(FrenchWS)); int ichMin, ichLim; tsb.GetBoundsOfRun(0, out ichMin, out ichLim); Assert.That(ichMin, Is.EqualTo(0)); Assert.That(ichLim, Is.EqualTo(6)); tsb.GetBoundsOfRun(1, out ichMin, out ichLim); Assert.That(ichMin, Is.EqualTo(6)); Assert.That(ichLim, Is.EqualTo(tsb.Length)); }
public void SetProperties_TwoRunBldrRangeOverlapsBothSamePropertiesAsFirst_UpdatesProperties() { TsStrBldr tsb = CreateMixedWSBldr(); tsb.SetProperties(6, 27, new TsTextProps(EnglishWS)); Assert.That(tsb.RunCount, Is.EqualTo(2)); Assert.That(tsb.get_RunText(0), Is.EqualTo("This is a test! ¡Esto es un")); Assert.That(GetWS(tsb, 0), Is.EqualTo(EnglishWS)); int ichMin, ichLim; tsb.GetBoundsOfRun(0, out ichMin, out ichLim); Assert.That(ichMin, Is.EqualTo(0)); Assert.That(ichLim, Is.EqualTo(27)); tsb.GetBoundsOfRun(1, out ichMin, out ichLim); Assert.That(ichMin, Is.EqualTo(27)); Assert.That(ichLim, Is.EqualTo(tsb.Length)); }
public void SetStrPropValue_TwoRunBldrRangeOverlapsBothSamePropertiesAsLast_UpdatesProperties() { TsStrBldr tsb = CreateMixedFontBldr(); tsb.SetStrPropValue(6, 27, (int)FwTextPropType.ktptFontFamily, Font2); Assert.That(tsb.RunCount, Is.EqualTo(2)); Assert.That(tsb.get_RunText(1), Is.EqualTo("s a test! How are you today?")); Assert.That(GetFont(tsb, 1), Is.EqualTo(Font2)); int ichMin, ichLim; tsb.GetBoundsOfRun(0, out ichMin, out ichLim); Assert.That(ichMin, Is.EqualTo(0)); Assert.That(ichLim, Is.EqualTo(6)); tsb.GetBoundsOfRun(1, out ichMin, out ichLim); Assert.That(ichMin, Is.EqualTo(6)); Assert.That(ichLim, Is.EqualTo(tsb.Length)); }
public void Replace_TwoRunBldrNonEmptyTextOverlapsBothSamePropertiesSecond_ReplacesText() { TsStrBldr tsb = CreateMixedWSBldr(); tsb.Replace(5, 28, "was", new TsTextProps(SpanishWS)); Assert.That(tsb.Text, Is.EqualTo("This was prueba!")); Assert.That(tsb.RunCount, Is.EqualTo(2)); Assert.That(GetWS(tsb, 0), Is.EqualTo(EnglishWS)); Assert.That(GetWS(tsb, 1), Is.EqualTo(SpanishWS)); int ichMin, ichLim; tsb.GetBoundsOfRun(0, out ichMin, out ichLim); Assert.That(ichMin, Is.EqualTo(0)); Assert.That(ichLim, Is.EqualTo(5)); tsb.GetBoundsOfRun(1, out ichMin, out ichLim); Assert.That(ichMin, Is.EqualTo(5)); Assert.That(ichLim, Is.EqualTo(tsb.Length)); }
public void Replace_TwoRunBldrEmptyTextOverlapsBoth_RemovesText() { TsStrBldr tsb = CreateMixedWSBldr(); tsb.Replace(5, 29, String.Empty, null); Assert.That(tsb.Text, Is.EqualTo("This prueba!")); Assert.That(tsb.RunCount, Is.EqualTo(2)); Assert.That(GetWS(tsb, 0), Is.EqualTo(EnglishWS)); Assert.That(GetWS(tsb, 1), Is.EqualTo(SpanishWS)); int ichMin, ichLim; tsb.GetBoundsOfRun(0, out ichMin, out ichLim); Assert.That(ichMin, Is.EqualTo(0)); Assert.That(ichLim, Is.EqualTo(5)); tsb.GetBoundsOfRun(1, out ichMin, out ichLim); Assert.That(ichMin, Is.EqualTo(5)); Assert.That(ichLim, Is.EqualTo(tsb.Length)); }
public void SetProperties_TwoRunBldrReplacesFirstWithoutOverlappingSecond_UpdatesProperties() { TsStrBldr tsb = CreateMixedWSBldr(); tsb.SetProperties(0, EnglishFont1Text.Length + 1, new TsTextProps(FrenchWS)); Assert.That(tsb.RunCount, Is.EqualTo(2)); Assert.That(tsb.get_RunText(0), Is.EqualTo("This is a test! ")); Assert.That(GetWS(tsb, 0), Is.EqualTo(FrenchWS)); Assert.That(GetWS(tsb, 1), Is.EqualTo(SpanishWS)); int ichMin, ichLim; tsb.GetBoundsOfRun(0, out ichMin, out ichLim); Assert.That(ichMin, Is.EqualTo(0)); Assert.That(ichLim, Is.EqualTo(EnglishFont1Text.Length + 1)); tsb.GetBoundsOfRun(1, out ichMin, out ichLim); Assert.That(ichMin, Is.EqualTo(EnglishFont1Text.Length + 1)); Assert.That(ichLim, Is.EqualTo(tsb.Length)); }
public void SetProperties_TwoRunBldrAlmostReplacesFirstButLeavesJustOneCharacterSamePropertiesAsFirst_UpdatesProperties() { TsStrBldr tsb = CreateMixedWSBldr(); tsb.SetProperties(0, EnglishFont1Text.Length, new TsTextProps(EnglishWS)); Assert.That(tsb.RunCount, Is.EqualTo(2)); Assert.That(tsb.get_RunText(0), Is.EqualTo("This is a test! ")); Assert.That(GetWS(tsb, 0), Is.EqualTo(EnglishWS)); Assert.That(tsb.get_RunText(1), Is.EqualTo("¡Esto es una prueba!")); Assert.That(GetWS(tsb, 1), Is.EqualTo(SpanishWS)); int ichMin, ichLim; tsb.GetBoundsOfRun(0, out ichMin, out ichLim); Assert.That(ichMin, Is.EqualTo(0)); Assert.That(ichLim, Is.EqualTo(EnglishFont1Text.Length + 1)); tsb.GetBoundsOfRun(1, out ichMin, out ichLim); Assert.That(ichMin, Is.EqualTo(EnglishFont1Text.Length + 1)); Assert.That(ichLim, Is.EqualTo(tsb.Length)); }