Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
        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));
        }
Ejemplo n.º 4
0
        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));
        }
Ejemplo n.º 5
0
        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));
        }
Ejemplo n.º 6
0
        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));
        }
Ejemplo n.º 7
0
        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));
        }
Ejemplo n.º 8
0
        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));
        }
Ejemplo n.º 9
0
        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));
        }
Ejemplo n.º 10
0
        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));
        }