示例#1
0
        static void Test_GetCharIndexFromLineColumnIndex()
        {
            TextBuffer                  text;
            SplitArray <int>            lhi;
            SplitArray <LineDirtyState> lds;

            MakeTestData(out text, out lhi, out lds);

            TestUtl.AssertEquals(0, LineLogic.GetCharIndexFromLineColumnIndex(text, lhi, 0, 0));
            TestUtl.AssertEquals(34, LineLogic.GetCharIndexFromLineColumnIndex(text, lhi, 2, 1));
            TestUtl.AssertEquals(71, LineLogic.GetCharIndexFromLineColumnIndex(text, lhi, 6, 18));

            try
            {
                LineLogic.GetCharIndexFromLineColumnIndex(text, lhi, 6, 19);
                TestUtl.Fail("exception must be thrown here.");
            }
            catch (Exception ex)
            {
                TestUtl.AssertType <AssertException>(ex);
            }

            try
            {
                LineLogic.GetCharIndexFromLineColumnIndex(text, lhi, 0, 100);
                TestUtl.Fail("exception must be thrown here.");
            }
            catch (Exception ex)
            {
                TestUtl.AssertType <AssertException>(ex);
            }
        }