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 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_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 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 SetIntPropValues_TwoRunBldrRangeOverlapsBothRemoveProperty_UpdatesProperties() { TsStrBldr tsb = CreateMixedWSBldr(); tsb.SetIntPropValues(6, 27, (int)FwTextPropType.ktptWs, -1, -1); Assert.That(tsb.RunCount, Is.EqualTo(3)); Assert.That(tsb.get_RunText(1), Is.EqualTo("s a test! ¡Esto es un")); Assert.That(GetWS(tsb, 1), Is.EqualTo(-1)); 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(27)); tsb.GetBoundsOfRun(2, out ichMin, out ichLim); Assert.That(ichMin, Is.EqualTo(27)); Assert.That(ichLim, Is.EqualTo(tsb.Length)); }
public void SetIntPropValues_IchMinGreaterThanIchLim_Throws() { TsStrBldr tsb = CreateMixedWSBldr(); Assert.That(() => tsb.SetIntPropValues(25, 24, (int)FwTextPropType.ktptWs, (int)FwTextPropVar.ktpvDefault, FrenchWS), Throws.InstanceOf <ArgumentOutOfRangeException>()); }
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()); }
private TsString CreateStackedDiacriticsInput(bool singleRun) { var temp = new TsString(stackedDiacriticsInput, EnglishWS); 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()); }