Beispiel #1
0
    def test_DECALN_ClearsMargins(self):
        esccmd.DECSET(esccmd.DECLRMM)
        esccmd.DECSLRM(2, 3)
        esccmd.DECSTBM(4, 5)
        esccmd.DECALN()

        # Verify we can pass the top margin
        esccmd.CUP(Point(2, 4))
        esccmd.CUU()
        AssertEQ(GetCursorPosition(), Point(2, 3))

        # Verify we can pass the bottom margin
        esccmd.CUP(Point(2, 5))
        esccmd.CUD()
        AssertEQ(GetCursorPosition(), Point(2, 6))

        # Verify we can pass the left margin
        esccmd.CUP(Point(2, 4))
        esccmd.CUB()
        AssertEQ(GetCursorPosition(), Point(1, 4))

        # Verify we can pass the right margin
        esccmd.CUP(Point(3, 4))
        esccmd.CUF()
        AssertEQ(GetCursorPosition(), Point(4, 4))
Beispiel #2
0
 def test_CUD_DefaultParam(self):
     """CUD moves the cursor down 1 with no parameter given."""
     esccmd.CUP(Point(5, 3))
     esccmd.CUD()
     position = GetCursorPosition()
     AssertEQ(position.x(), 5)
     AssertEQ(position.y(), 4)
Beispiel #3
0
    def test_CUD_StopsAtBottomMarginInScrollRegion(self):
        """When the cursor starts within the scroll region, CUD moves it down to the
    bottom margin but no farther."""
        # Set a scroll region. This must be done first because DECSTBM moves the cursor to the origin.
        esccmd.DECSTBM(2, 4)

        # Position the cursor within the scroll region
        esccmd.CUP(Point(1, 3))

        # Move it up by more than the height of the scroll region
        esccmd.CUD(99)

        # Ensure it stopped at the bottom of the scroll region.
        AssertEQ(GetCursorPosition().y(), 4)
Beispiel #4
0
    def test_CUD_StopsAtBottomLineWhenBegunBelowScrollRegion(self):
        """When the cursor starts below the scroll region, CUD moves it down to the
    bottom of the screen."""
        # Set a scroll region. This must be done first because DECSTBM moves the cursor to the origin.
        esccmd.DECSTBM(4, 5)

        # Position the cursor below the scroll region
        esccmd.CUP(Point(1, 6))

        # Move it down by a lot
        height = GetScreenSize().height()
        esccmd.CUD(height)

        # Ensure it stopped at the bottom of the screen
        AssertEQ(GetCursorPosition().y(), height)
Beispiel #5
0
    def test_RIS_RemoveMargins(self):
        esccmd.DECSET(esccmd.DECLRMM)
        esccmd.DECSLRM(3, 5)
        esccmd.DECSTBM(4, 6)

        esccmd.RIS()

        esccmd.CUP(Point(3, 4))
        esccmd.CUB()
        AssertEQ(GetCursorPosition(), Point(2, 4))
        esccmd.CUU()
        AssertEQ(GetCursorPosition(), Point(2, 3))

        esccmd.CUP(Point(5, 6))
        esccmd.CUF()
        AssertEQ(GetCursorPosition(), Point(6, 6))
        esccmd.CUD()
        AssertEQ(GetCursorPosition(), Point(6, 7))
Beispiel #6
0
        tb = traceback.format_exc()
        try:
            reset()
        except:
            print "reset() failed with traceback:"
            print traceback.format_exc().replace("\n", "\r\n")

        print "RunTests failed:\r\n"
        print tb.replace("\n", "\r\n")
        esclog.LogError("Failed with traceback:")
        esclog.LogError(tb)
    finally:
        if escargs.args.no_print_logs:
            # Hackily move the cursor to the bottom of the screen.
            esccmd.CUP(esctypes.Point(1, 1))
            esccmd.CUD(999)
        else:
            try:
                reset()
            except:
                print "reset() failed with traceback:"
                print traceback.format_exc().replace("\n", "\r\n")

            print "\r\nLogs:\r\n"
            esclog.Print()

    shutdown()


main()
Beispiel #7
0
 def test_CUD_StopsAtBottomLine(self):
     """CUD moves the cursor down, stopping at the last line."""
     esccmd.CUP(Point(1, 3))
     height = GetScreenSize().height()
     esccmd.CUD(height)
     AssertEQ(GetCursorPosition().y(), height)
Beispiel #8
0
 def test_CUD_ExplicitParam(self):
     """CUD moves the cursor down by the passed-in number of lines."""
     esccmd.CUP(Point(1, 3))
     esccmd.CUD(2)
     AssertEQ(GetCursorPosition().y(), 5)