예제 #1
0
파일: BS_Tests.cs 프로젝트: sgmunn/xts-test
        public void BS_ReverseWrapRequiresDECAWM()
        {
            //esccmd.DECRESET (esccmd.DECAWM)
            //esccmd.DECSET (esccmd.ReverseWraparound)
            //esccmd.CUP (Point (1, 3))
            //escio.Write (esc.BS)
            //AssertEQ (GetCursorPosition (), Point (1, 3))

            //esccmd.DECSET (esccmd.DECAWM)
            //esccmd.DECRESET (esccmd.ReverseWraparound)
            //esccmd.CUP (Point (1, 3))
            //escio.Write (esc.BS)
            //AssertEQ (GetCursorPosition (), Point (1, 3))

            // TODO: DECSET wrappers
            Terminal.Wraparound = false;
            Terminal.csiDECSET(CsiCommandCodes.ReverseWraparound);

            Terminal.csiCUP((1, 3));
            Terminal.Backspace();
            Terminal.AssertCursorPosition(1, 3);

            Terminal.Wraparound        = true;
            Terminal.ReverseWraparound = false;
            Terminal.csiCUP((1, 3));
            Terminal.Backspace();
            Terminal.AssertCursorPosition(1, 3);
        }
예제 #2
0
        public void CUP_RespectsOriginMode()
        {
            //"""CUP is relative to margins in origin mode."""
            //# Set a scroll region.
            //esccmd.DECSTBM(6, 11)
            //esccmd.DECSET(esccmd.DECLRMM)
            //esccmd.DECSLRM(5, 10)

            //# Move to center of region
            //esccmd.CUP(Point(7, 9))
            //position = GetCursorPosition()
            //AssertEQ(position.x(), 7)
            //AssertEQ(position.y(), 9)

            //# Turn on origin mode.
            //esccmd.DECSET(esccmd.DECOM)

            //# Move to top-left
            //esccmd.CUP(Point(1, 1))

            //# Check relative position while still in origin mode.
            //position = GetCursorPosition()
            //AssertEQ(position.x(), 1)
            //AssertEQ(position.y(), 1)

            //escio.Write("X")

            //# Turn off origin mode. This moves the cursor.
            //esccmd.DECRESET(esccmd.DECOM)

            //# Turn off scroll regions so checksum can work.
            //esccmd.DECSTBM()
            //esccmd.DECRESET(esccmd.DECLRMM)

            //# Make sure there's an X at 5,6
            //AssertScreenCharsInRectEqual(Rect(5, 6, 5, 6),
            //                                ["X"])
            Terminal.csiDECSTBM(6, 11);
            Terminal.csiDECSET(CsiCommandCodes.DECLRMM);
            Terminal.csiDECSLRM(5, 10);

            Terminal.csiCUP((7, 9));
            Terminal.AssertCursorPosition(7, 9);

            Terminal.csiDECSET(CsiCommandCodes.DECOM);

            Terminal.csiCUP((1, 1));
            Terminal.AssertCursorPosition(1, 1);

            Terminal.Feed("X");

            Terminal.csiDECRESET(CsiCommandCodes.DECOM);

            Terminal.csiDECSTBM();
            Terminal.csiDECRESET(CsiCommandCodes.DECLRMM);

            AssertScreenCharsInRectEqual((5, 6, 5, 6), "X");
        }
예제 #3
0
파일: CR_Tests.cs 프로젝트: sgmunn/xts-test
 public void CR_Basic()
 {
     //esccmd.CUP(Point(3, 3))
     //escio.Write(esc.CR)
     //AssertEQ(GetCursorPosition(), Point(1, 3))
     Terminal.csiCUP((3, 3));
     Terminal.CarriageReturn();
     Terminal.AssertCursorPosition(1, 3);
 }
예제 #4
0
파일: BS_Tests.cs 프로젝트: sgmunn/xts-test
 public void BS_NoWrapByDefault()
 {
     //esccmd.CUP(Point(1, 3))
     //escio.Write(esc.BS)
     //AssertEQ(GetCursorPosition(), Point(1, 3))
     Terminal.csiCUP((1, 3));
     Terminal.Backspace();
     Terminal.AssertCursorPosition(1, 3);
 }
예제 #5
0
파일: BS_Tests.cs 프로젝트: sgmunn/xts-test
 public void BS_StopsAtOrigin()
 {
     //esccmd.CUP(Point(1, 1))
     //escio.Write(esc.BS)
     //AssertEQ(GetCursorPosition(), Point(1, 1))
     Terminal.csiCUP((1, 1));
     Terminal.Backspace();
     Terminal.AssertCursorPosition(1, 1);
 }
예제 #6
0
파일: BS_Tests.cs 프로젝트: sgmunn/xts-test
 public void BS_Basic()
 {
     //esccmd.CUP(Point(3, 3))
     //escio.Write(esc.BS)
     //AssertEQ (GetCursorPosition(), Point(2, 3))
     Terminal.csiCUP((3, 3));
     Terminal.Backspace();
     Terminal.AssertCursorPosition(2, 3);
 }
예제 #7
0
 public void CBT_OneTabStopByDefault()
 {
     //esccmd.CUP(Point(17, 1))
     //esccmd.CBT()
     //position = GetCursorPosition()
     //AssertEQ(position.x(), 9)
     Terminal.csiCUP((17, 1));
     Terminal.csiCBT();
     Terminal.AssertCursorPosition(9, 1);
 }
예제 #8
0
 public void CBT_ExplicitParameter()
 {
     //esccmd.CUP(Point(25, 1))
     //esccmd.CBT(2)
     //position = GetCursorPosition()
     //AssertEQ(position.x(), 9)
     Terminal.csiCUP((25, 1));
     Terminal.csiCBT(2);
     Terminal.AssertCursorPosition(9, 1);
 }
예제 #9
0
 public void CBT_StopsAtLeftEdge()
 {
     //esccmd.CUP (Point (25, 2))
     //esccmd.CBT (5)
     //position = GetCursorPosition ()
     //AssertEQ (position.x (), 1)
     //AssertEQ (position.y (), 2)
     Terminal.csiCUP((25, 2));
     Terminal.csiCBT(5);
     Terminal.AssertCursorPosition(1, 2);
 }
예제 #10
0
 public void CUP_ZeroIsTreatedAsOne()
 {
     //"""Zero args are treated as 1."""
     //esccmd.CUP(Point(6, 3))
     //esccmd.CUP(col=0, row=0)
     //position = GetCursorPosition()
     //AssertEQ(position.x(), 1)
     //AssertEQ(position.y(), 1)
     Terminal.csiCUP((6, 3));
     Terminal.csiCUP(0, 0);
     Terminal.AssertCursorPosition(1, 1);
 }
예제 #11
0
        public void CUP_OutOfBoundsParams()
        {
            //"""With overly large parameters, CUP moves as far as possible down and right."""
            //size = GetScreenSize()
            //esccmd.CUP(Point(size.width() + 10, size.height() + 10))

            //position = GetCursorPosition()
            //AssertEQ(position.x(), size.width())
            //AssertEQ(position.y(), size.height())
            var sz = Terminal.GetScreenSize();

            Terminal.csiCUP((sz.cols + 10, sz.rows + 10));
            Terminal.AssertCursorPosition(sz.cols, sz.rows);
        }
예제 #12
0
파일: BS_Tests.cs 프로젝트: sgmunn/xts-test
 public void BS_MovesLeftWhenLeftOfLeftMargin()
 {
     //esccmd.DECSET(esccmd.DECLRMM)
     //esccmd.DECSLRM(5, 10)
     //esccmd.CUP(Point(4, 1))
     //escio.Write(esc.BS)
     //esccmd.DECRESET(esccmd.DECLRMM)
     //AssertEQ(GetCursorPosition(), Point(3, 1))
     Terminal.csiDECSET(CsiCommandCodes.DECLRMM);
     Terminal.csiDECSLRM(5, 10);
     Terminal.csiCUP((4, 1));
     Terminal.Backspace();
     Terminal.MarginMode = false;
     Terminal.AssertCursorPosition(3, 1);
 }
예제 #13
0
파일: CR_Tests.cs 프로젝트: sgmunn/xts-test
 public void CR_StaysPutWhenAtLeftMargin()
 {
     //esccmd.DECSET(esccmd.DECLRMM)
     //esccmd.DECSLRM(5, 10)
     //esccmd.CUP(Point(5, 1))
     //escio.Write(esc.CR)
     //esccmd.DECRESET(esccmd.DECLRMM)
     //AssertEQ(GetCursorPosition(), Point(5, 1))
     Terminal.csiDECSET(CsiCommandCodes.DECLRMM);
     Terminal.csiDECSLRM(5, 10);
     Terminal.csiCUP((5, 1));
     Terminal.CarriageReturn();
     Terminal.csiDECRESET(CsiCommandCodes.DECLRMM);
     Terminal.AssertCursorPosition(5, 1);
 }
예제 #14
0
파일: CR_Tests.cs 프로젝트: sgmunn/xts-test
 public void CR_MovesToLeftOfScreenWhenLeftOfLeftMargin()
 {
     //"""Move the cursor to the left edge of the screen when it starts of left the margin."""
     //esccmd.DECSET(esccmd.DECLRMM)
     //esccmd.DECSLRM(5, 10)
     //esccmd.CUP(Point(4, 1))
     //escio.Write(esc.CR)
     //esccmd.DECRESET(esccmd.DECLRMM)
     //AssertEQ(GetCursorPosition(), Point(1, 1))
     Terminal.csiDECSET(CsiCommandCodes.DECLRMM);
     Terminal.csiDECSLRM(5, 10);
     Terminal.csiCUP((4, 1));
     Terminal.CarriageReturn();
     Terminal.csiDECRESET(CsiCommandCodes.DECLRMM);
     Terminal.AssertCursorPosition(1, 1);
 }
예제 #15
0
파일: BS_Tests.cs 프로젝트: sgmunn/xts-test
        public void BS_WrapsInWraparoundMode()
        {
            //esccmd.DECSET (esccmd.DECAWM)
            //esccmd.DECSET (esccmd.ReverseWraparound)
            //esccmd.CUP (Point (1, 3))
            //escio.Write (esc.BS)
            //size = GetScreenSize ()
            //AssertEQ (GetCursorPosition (), Point (size.width (), 2))
            Terminal.csiDECSET(CsiCommandCodes.DECAWM);
            Terminal.csiDECSET(CsiCommandCodes.ReverseWraparound);
            Terminal.csiCUP((1, 3));
            Terminal.Backspace();
            var sz = Terminal.GetScreenSize();

            Terminal.AssertCursorPosition(sz.cols, 2);
        }
예제 #16
0
파일: CR_Tests.cs 프로젝트: sgmunn/xts-test
 public void CR_MovesToLeftMarginWhenRightOfLeftMargin()
 {
     //"""Move the cursor to the left margin if it starts right of it."""
     //esccmd.DECSET(esccmd.DECLRMM)
     //esccmd.DECSLRM(5, 10)
     //esccmd.CUP(Point(6, 1))
     //escio.Write(esc.CR)
     //esccmd.DECRESET(esccmd.DECLRMM)
     //AssertEQ(GetCursorPosition(), Point(5, 1))
     Terminal.csiDECSET(CsiCommandCodes.DECLRMM);
     Terminal.csiDECSLRM(5, 10);
     Terminal.csiCUP((6, 1));
     Terminal.CarriageReturn();
     Terminal.csiDECRESET(CsiCommandCodes.DECLRMM);
     Terminal.AssertCursorPosition(5, 1);
 }
예제 #17
0
파일: BS_Tests.cs 프로젝트: sgmunn/xts-test
 public void BS_ReverseWrapWithLeftRight()
 {
     //esccmd.DECSET(esccmd.DECAWM)
     //esccmd.DECSET(esccmd.ReverseWraparound)
     //esccmd.DECSET(esccmd.DECLRMM)
     //esccmd.DECSLRM(5, 10)
     //esccmd.CUP(Point(5, 3))
     //escio.Write(esc.BS)
     //AssertEQ(GetCursorPosition(), Point(10, 2))
     Terminal.csiDECSET(CsiCommandCodes.DECAWM);
     Terminal.csiDECSET(CsiCommandCodes.ReverseWraparound);
     Terminal.csiDECSET(CsiCommandCodes.DECLRMM);
     Terminal.csiDECSLRM(5, 10);
     Terminal.csiCUP((5, 3));
     Terminal.Backspace();
     Terminal.AssertCursorPosition(10, 2);
 }
예제 #18
0
        public void CBT_IgnoresRegion()
        {
            //# Set a scroll region.
            //esccmd.DECSET(esccmd.DECLRMM)
            //esccmd.DECSLRM(5, 30)
            Terminal.csiDECSET(CsiCommandCodes.DECLRMM);
            Terminal.csiDECSLRM(5, 30);

            //# Move to center of region
            //esccmd.CUP(Point(7, 9))
            Terminal.csiCUP((7, 2));

            //# Tab backwards out of the region.
            //esccmd.CBT(2)
            //position = GetCursorPosition()
            //AssertEQ(position.x(), 1)
            Terminal.csiCBT(2);
            Terminal.AssertCursorPosition(1, 2);
        }
예제 #19
0
        public void CUP_ColumnOnly()
        {
            //"""Default row is 1."""
            //esccmd.CUP(Point(6, 3))

            //position = GetCursorPosition()
            //AssertEQ(position.x(), 6)
            //AssertEQ(position.y(), 3)

            //esccmd.CUP(col=2)

            //position = GetCursorPosition()
            //AssertEQ(position.x(), 2)
            //AssertEQ(position.y(), 1)
            Terminal.csiCUP((6, 3));
            Terminal.AssertCursorPosition(6, 3);

            Terminal.csiCUP(0, 2);
            Terminal.AssertCursorPosition(2, 1);
        }
예제 #20
0
파일: BS_Tests.cs 프로젝트: sgmunn/xts-test
        public void BS_ReversewrapFromLeftEdgeToRightMargin()
        {
            //"""If cursor starts at left edge of screen, left of left margin, backspace
            //takes it to the right margin."""
            //esccmd.DECSET(esccmd.DECAWM)
            //esccmd.DECSET(esccmd.ReverseWraparound)
            //esccmd.DECSET(esccmd.DECLRMM)
            //esccmd.DECSLRM(5, 10)
            //esccmd.CUP(Point(1, 3))
            //escio.Write(esc.BS)
            //AssertEQ(GetCursorPosition(), Point(10, 2))

            Terminal.csiDECSET(CsiCommandCodes.DECAWM);
            Terminal.csiDECSET(CsiCommandCodes.ReverseWraparound);
            Terminal.csiDECSET(CsiCommandCodes.DECLRMM);
            Terminal.csiDECSLRM(5, 10);
            Terminal.csiCUP((1, 3));
            Terminal.Backspace();
            Terminal.AssertCursorPosition(10, 2);
        }
예제 #21
0
        public void CUP_DefaultParams()
        {
            //"""With no params, CUP moves to 1,1."""
            //esccmd.CUP(Point(6, 3))

            //position = GetCursorPosition()
            //AssertEQ(position.x(), 6)
            //AssertEQ(position.y(), 3)

            //esccmd.CUP()

            //position = GetCursorPosition()
            //AssertEQ(position.x(), 1)
            //AssertEQ(position.y(), 1)

            Terminal.csiCUP((6, 3));
            Terminal.AssertCursorPosition(6, 3);
            Terminal.csiCUP();
            Terminal.AssertCursorPosition(1, 1);
        }
예제 #22
0
        public void CUP_RowOnly()
        {
            //"""Default column is 1."""
            //esccmd.CUP(Point(6, 3))

            //position = GetCursorPosition()
            //AssertEQ(position.x(), 6)
            //AssertEQ(position.y(), 3)

            //esccmd.CUP(row=2)

            //position = GetCursorPosition()
            //AssertEQ(position.x(), 1)
            //AssertEQ(position.y(), 2)
            Terminal.csiCUP((6, 3));
            Terminal.AssertCursorPosition(6, 3);

            Terminal.csiCUP(2);
            Terminal.AssertCursorPosition(1, 2);
        }