示例#1
0
        public void Right()
        {
            var view = _Azuki.View as IViewInternal;

            // EOL
            _Azuki.Text = "a\rb\nc\r\nd";
            _Azuki.SetSelection(0, 0);
            Assert.AreEqual(1, CaretMoveLogic.Calc_Right(view));
            _Azuki.SetSelection(1, 1);
            Assert.AreEqual(2, CaretMoveLogic.Calc_Right(view));
            _Azuki.SetSelection(2, 2);
            Assert.AreEqual(3, CaretMoveLogic.Calc_Right(view));
            _Azuki.SetSelection(3, 3);
            Assert.AreEqual(4, CaretMoveLogic.Calc_Right(view));
            _Azuki.SetSelection(4, 4);
            Assert.AreEqual(5, CaretMoveLogic.Calc_Right(view));
            _Azuki.SetSelection(5, 5);
            Assert.AreEqual(7, CaretMoveLogic.Calc_Right(view));
            _Azuki.SetSelection(7, 7);
            Assert.AreEqual(8, CaretMoveLogic.Calc_Right(view));
            _Azuki.SetSelection(8, 8);
            Assert.AreEqual(8, CaretMoveLogic.Calc_Right(view));

            // surrogate pair
            _Azuki.Text = "_\xd85a\xdd51_";
            _Azuki.SetSelection(0, 0);
            Assert.AreEqual(1, CaretMoveLogic.Calc_Right(view));
            _Azuki.SetSelection(1, 1);
            Assert.AreEqual(3, CaretMoveLogic.Calc_Right(view));
            _Azuki.SetSelection(3, 3);
            Assert.AreEqual(4, CaretMoveLogic.Calc_Right(view));
            _Azuki.SetSelection(4, 4);
            Assert.AreEqual(4, CaretMoveLogic.Calc_Right(view));

            // combined character sequence
            _Azuki.Text = "_a\x0300_";
            _Azuki.SetSelection(0, 0);
            Assert.AreEqual(1, CaretMoveLogic.Calc_Right(view));
            _Azuki.SetSelection(1, 1);
            Assert.AreEqual(3, CaretMoveLogic.Calc_Right(view));
            _Azuki.SetSelection(3, 3);
            Assert.AreEqual(4, CaretMoveLogic.Calc_Right(view));
            _Azuki.SetSelection(4, 4);
            Assert.AreEqual(4, CaretMoveLogic.Calc_Right(view));
        }
        static void Test_Right()
        {
            // EOL
            _Azuki.Text = "a\rb\nc\r\nd";
            _Azuki.SetSelection(0, 0);
            TestUtl.AssertEquals(1, CaretMoveLogic.Calc_Right(_Azuki.View));
            _Azuki.SetSelection(1, 1);
            TestUtl.AssertEquals(2, CaretMoveLogic.Calc_Right(_Azuki.View));
            _Azuki.SetSelection(2, 2);
            TestUtl.AssertEquals(3, CaretMoveLogic.Calc_Right(_Azuki.View));
            _Azuki.SetSelection(3, 3);
            TestUtl.AssertEquals(4, CaretMoveLogic.Calc_Right(_Azuki.View));
            _Azuki.SetSelection(4, 4);
            TestUtl.AssertEquals(5, CaretMoveLogic.Calc_Right(_Azuki.View));
            _Azuki.SetSelection(5, 5);
            TestUtl.AssertEquals(7, CaretMoveLogic.Calc_Right(_Azuki.View));
            _Azuki.SetSelection(7, 7);
            TestUtl.AssertEquals(8, CaretMoveLogic.Calc_Right(_Azuki.View));
            _Azuki.SetSelection(8, 8);
            TestUtl.AssertEquals(8, CaretMoveLogic.Calc_Right(_Azuki.View));

            // surrogate pair
            _Azuki.Text = "_\xd85a\xdd51_";
            _Azuki.SetSelection(0, 0);
            TestUtl.AssertEquals(1, CaretMoveLogic.Calc_Right(_Azuki.View));
            _Azuki.SetSelection(1, 1);
            TestUtl.AssertEquals(3, CaretMoveLogic.Calc_Right(_Azuki.View));
            _Azuki.SetSelection(3, 3);
            TestUtl.AssertEquals(4, CaretMoveLogic.Calc_Right(_Azuki.View));
            _Azuki.SetSelection(4, 4);
            TestUtl.AssertEquals(4, CaretMoveLogic.Calc_Right(_Azuki.View));

            // combined character sequence
            _Azuki.Text = "_a\x0300_";
            _Azuki.SetSelection(0, 0);
            TestUtl.AssertEquals(1, CaretMoveLogic.Calc_Right(_Azuki.View));
            _Azuki.SetSelection(1, 1);
            TestUtl.AssertEquals(3, CaretMoveLogic.Calc_Right(_Azuki.View));
            _Azuki.SetSelection(3, 3);
            TestUtl.AssertEquals(4, CaretMoveLogic.Calc_Right(_Azuki.View));
            _Azuki.SetSelection(4, 4);
            TestUtl.AssertEquals(4, CaretMoveLogic.Calc_Right(_Azuki.View));
        }