Example #1
0
        public void MoveCaret_UnwrappedEmptyLastLine_CorrectResults()
        {
            var sut = new ConControls.Controls.Text.ConsoleTextController
            {
                Text     = "Hello\nWorld!\n",
                WrapMode = WrapMode.NoWrap,
                Width    = 5
            };

            sut.MoveCaretHome(new Point(1, 1)).Should().Be(Point.Empty);
            sut.MoveCaretEnd(new Point(1, 1)).Should().Be(new Point(0, 2));
            sut.MoveCaretToBeginOfLine(new Point(1, 1)).Should().Be(new Point(0, 1));
            sut.MoveCaretToEndOfLIne(Point.Empty).Should().Be(new Point(5, 0));
            sut.MoveCaretToEndOfLIne(new Point(1, 2)).Should().Be(new Point(0, 2));
            sut.MoveCaretLeft(Point.Empty).Should().Be(Point.Empty);
            sut.MoveCaretLeft(new Point(1, 1)).Should().Be(new Point(0, 1));
            sut.MoveCaretLeft(new Point(0, 2)).Should().Be(new Point(6, 1));
            sut.MoveCaretUp(Point.Empty).Should().Be(Point.Empty);
            sut.MoveCaretUp(new Point(6, 1)).Should().Be(new Point(5, 0));
            sut.MoveCaretRight(Point.Empty).Should().Be(new Point(1, 0));
            sut.MoveCaretRight(new Point(5, 0)).Should().Be(new Point(0, 1));
            sut.MoveCaretRight(new Point(0, 2)).Should().Be(new Point(0, 2));
            sut.MoveCaretDown(Point.Empty).Should().Be(new Point(0, 1));
            sut.MoveCaretDown(new Point(3, 1)).Should().Be(new Point(0, 2));
        }
Example #2
0
        public void MoveCaret_WrappedEmpty_CorrectResults()
        {
            var sut = new ConControls.Controls.Text.ConsoleTextController
            {
                WrapMode = WrapMode.SimpleWrap,
                Width    = 5
            };

            sut.MoveCaretHome(new Point(1, 1)).Should().Be(Point.Empty);
            sut.MoveCaretEnd(new Point(1, 1)).Should().Be(Point.Empty);
            sut.MoveCaretToBeginOfLine(new Point(1, 0)).Should().Be(Point.Empty);
            sut.MoveCaretToEndOfLIne(Point.Empty).Should().Be(Point.Empty);
            sut.MoveCaretLeft(Point.Empty).Should().Be(Point.Empty);
            sut.MoveCaretUp(Point.Empty).Should().Be(Point.Empty);
            sut.MoveCaretRight(Point.Empty).Should().Be(Point.Empty);
            sut.MoveCaretDown(Point.Empty).Should().Be(Point.Empty);
        }