Exemplo n.º 1
0
        static void Test_GetLineLengthByCharIndex()
        {
            TextBuffer text = new TextBuffer(1, 32);
            int        i    = 0;

            text.Insert(0, TestData.ToCharArray());

            for ( ; i < 32; i++)
            {
                TestUtl.AssertEquals(32, LineLogic.GetLineLengthByCharIndex(text, i));
            }
            for ( ; i < 33; i++)
            {
                TestUtl.AssertEquals(1, LineLogic.GetLineLengthByCharIndex(text, i));
            }
            for ( ; i < 37; i++)
            {
                TestUtl.AssertEquals(4, LineLogic.GetLineLengthByCharIndex(text, i));
            }
            for ( ; i < 38; i++)
            {
                TestUtl.AssertEquals(1, LineLogic.GetLineLengthByCharIndex(text, i));
            }
            for ( ; i < 52; i++)
            {
                TestUtl.AssertEquals(14, LineLogic.GetLineLengthByCharIndex(text, i));
            }
            for ( ; i < 53; i++)
            {
                TestUtl.AssertEquals(1, LineLogic.GetLineLengthByCharIndex(text, i));
            }
            for ( ; i < 71; i++)
            {
                TestUtl.AssertEquals(17, LineLogic.GetLineLengthByCharIndex(text, i));
            }
            TestUtl.AssertEquals(17, LineLogic.GetLineLengthByCharIndex(text, i));               // EOF
        }