public void Left() { var view = _Azuki.View as IViewInternal; // EOL _Azuki.Text = "a\rb\nc\r\nd"; _Azuki.SetSelection(8, 8); Assert.AreEqual(7, CaretMoveLogic.Calc_Left(view)); _Azuki.SetSelection(7, 7); Assert.AreEqual(5, CaretMoveLogic.Calc_Left(view)); _Azuki.SetSelection(5, 5); Assert.AreEqual(4, CaretMoveLogic.Calc_Left(view)); _Azuki.SetSelection(4, 4); Assert.AreEqual(3, CaretMoveLogic.Calc_Left(view)); _Azuki.SetSelection(3, 3); Assert.AreEqual(2, CaretMoveLogic.Calc_Left(view)); _Azuki.SetSelection(2, 2); Assert.AreEqual(1, CaretMoveLogic.Calc_Left(view)); _Azuki.SetSelection(1, 1); Assert.AreEqual(0, CaretMoveLogic.Calc_Left(view)); _Azuki.SetSelection(0, 0); Assert.AreEqual(0, CaretMoveLogic.Calc_Left(view)); // surrogate pair _Azuki.Text = "a\xd85a\xdd51b"; _Azuki.SetSelection(4, 4); Assert.AreEqual(3, CaretMoveLogic.Calc_Left(view)); _Azuki.SetSelection(3, 3); Assert.AreEqual(1, CaretMoveLogic.Calc_Left(view)); _Azuki.SetSelection(1, 1); Assert.AreEqual(0, CaretMoveLogic.Calc_Left(view)); _Azuki.SetSelection(0, 0); Assert.AreEqual(0, CaretMoveLogic.Calc_Left(view)); // combined character sequence _Azuki.Text = "_a\x0300_"; _Azuki.SetSelection(4, 4); Assert.AreEqual(3, CaretMoveLogic.Calc_Left(view)); _Azuki.SetSelection(3, 3); Assert.AreEqual(1, CaretMoveLogic.Calc_Left(view)); _Azuki.SetSelection(1, 1); Assert.AreEqual(0, CaretMoveLogic.Calc_Left(view)); _Azuki.SetSelection(0, 0); Assert.AreEqual(0, CaretMoveLogic.Calc_Left(view)); }
static void Test_Left() { // EOL _Azuki.Text = "a\rb\nc\r\nd"; _Azuki.SetSelection(8, 8); TestUtl.AssertEquals(7, CaretMoveLogic.Calc_Left(_Azuki.View)); _Azuki.SetSelection(7, 7); TestUtl.AssertEquals(5, CaretMoveLogic.Calc_Left(_Azuki.View)); _Azuki.SetSelection(5, 5); TestUtl.AssertEquals(4, CaretMoveLogic.Calc_Left(_Azuki.View)); _Azuki.SetSelection(4, 4); TestUtl.AssertEquals(3, CaretMoveLogic.Calc_Left(_Azuki.View)); _Azuki.SetSelection(3, 3); TestUtl.AssertEquals(2, CaretMoveLogic.Calc_Left(_Azuki.View)); _Azuki.SetSelection(2, 2); TestUtl.AssertEquals(1, CaretMoveLogic.Calc_Left(_Azuki.View)); _Azuki.SetSelection(1, 1); TestUtl.AssertEquals(0, CaretMoveLogic.Calc_Left(_Azuki.View)); _Azuki.SetSelection(0, 0); TestUtl.AssertEquals(0, CaretMoveLogic.Calc_Left(_Azuki.View)); // surrogate pair _Azuki.Text = "a\xd85a\xdd51b"; _Azuki.SetSelection(4, 4); TestUtl.AssertEquals(3, CaretMoveLogic.Calc_Left(_Azuki.View)); _Azuki.SetSelection(3, 3); TestUtl.AssertEquals(1, CaretMoveLogic.Calc_Left(_Azuki.View)); _Azuki.SetSelection(1, 1); TestUtl.AssertEquals(0, CaretMoveLogic.Calc_Left(_Azuki.View)); _Azuki.SetSelection(0, 0); TestUtl.AssertEquals(0, CaretMoveLogic.Calc_Left(_Azuki.View)); // combined character sequence _Azuki.Text = "_a\x0300_"; _Azuki.SetSelection(4, 4); TestUtl.AssertEquals(3, CaretMoveLogic.Calc_Left(_Azuki.View)); _Azuki.SetSelection(3, 3); TestUtl.AssertEquals(1, CaretMoveLogic.Calc_Left(_Azuki.View)); _Azuki.SetSelection(1, 1); TestUtl.AssertEquals(0, CaretMoveLogic.Calc_Left(_Azuki.View)); _Azuki.SetSelection(0, 0); TestUtl.AssertEquals(0, CaretMoveLogic.Calc_Left(_Azuki.View)); }