コード例 #1
0
    def test_DECSCL_RISOnChange(self):
        """DECSCL should do an RIS. RIS does a lot, so we'll just test a few
    things. This may not be true for VT220's, though, to quote the xterm code:

      VT300, VT420, VT520 manuals claim that DECSCL does a
      hard reset (RIS).  VT220 manual states that it is a soft
      reset.  Perhaps both are right (unlikely).  Kermit says
      it's soft.

    So that's why this test is for vt level 3 and up."""
        escio.Write("x")

        # Set saved cursor position
        esccmd.CUP(Point(5, 6))
        esccmd.DECSC()

        # Turn on insert mode
        esccmd.SM(esccmd.IRM)

        esccmd.DECSCL(61)
        AssertScreenCharsInRectEqual(Rect(1, 1, 1, 1), [empty()])

        # Ensure saved cursor position is the origin
        esccmd.DECRC()
        AssertEQ(GetCursorPosition(), Point(1, 1))

        # Ensure replace mode is on
        esccmd.CUP(Point(1, 1))
        escio.Write("a")
        esccmd.CUP(Point(1, 1))
        escio.Write("b")
        AssertScreenCharsInRectEqual(Rect(1, 1, 1, 1), ["b"])
コード例 #2
0
  def test_FF_MovesDoesNotScrollOutsideLeftRight(self):
    """Cursor moves down but won't scroll when outside left-right region."""
    esccmd.DECSTBM(2, 5)
    esccmd.DECSET(esccmd.DECLRMM)
    esccmd.DECSLRM(2, 5)
    esccmd.CUP(Point(3, 5))
    escio.Write("x")

    # Move past bottom margin but to the right of the left-right region
    esccmd.CUP(Point(6, 5))
    escio.Write(FF)
    # Cursor won't pass bottom or scroll.
    AssertEQ(GetCursorPosition(), Point(6, 5))
    AssertScreenCharsInRectEqual(Rect(3, 5, 3, 5), [ "x" ])

    # Try to move past the bottom of the screen but to the right of the left-right region
    height = GetScreenSize().height()
    esccmd.CUP(Point(6, height))
    escio.Write(FF)
    AssertEQ(GetCursorPosition(), Point(6, height))
    AssertScreenCharsInRectEqual(Rect(3, 5, 3, 5), [ "x" ])

    # Move past bottom margin but to the left of the left-right region
    esccmd.CUP(Point(1, 5))
    escio.Write(FF)
    AssertEQ(GetCursorPosition(), Point(1, 5))
    AssertScreenCharsInRectEqual(Rect(3, 5, 3, 5), [ "x" ])

    # Try to move past the bottom of the screen but to the left of the left-right region
    height = GetScreenSize().height()
    esccmd.CUP(Point(1, height))
    escio.Write(FF)
    AssertEQ(GetCursorPosition(), Point(1, height))
    AssertScreenCharsInRectEqual(Rect(3, 5, 3, 5), [ "x" ])
コード例 #3
0
 def test_DECSTBM_ScrollsOnNewline(self):
     """Define a top-bottom margin, put text in it, and have newline scroll it."""
     esccmd.DECSTBM(2, 3)
     esccmd.CUP(Point(1, 2))
     escio.Write("1" + CR + LF)
     escio.Write("2")
     AssertScreenCharsInRectEqual(Rect(1, 2, 1, 3), ["1", "2"])
     escio.Write(CR + LF)
     AssertScreenCharsInRectEqual(Rect(1, 2, 1, 3), ["2", NUL])
     AssertEQ(GetCursorPosition().y(), 3)
コード例 #4
0
ファイル: ris.py プロジェクト: ThomasDickey/esctest
    def test_RIS_ExitAltScreen(self):
        escio.Write("m")
        esccmd.DECSET(esccmd.ALTBUF)
        esccmd.CUP(Point(1, 1))
        escio.Write("a")

        esccmd.RIS()

        AssertScreenCharsInRectEqual(Rect(1, 1, 1, 1), [empty()])
        esccmd.DECSET(esccmd.ALTBUF)
        AssertScreenCharsInRectEqual(Rect(1, 1, 1, 1), ["a"])
コード例 #5
0
ファイル: decset.py プロジェクト: ThomasDickey/esctest2
  def doAltBuftest(self, code, altGetsClearedBeforeToMain, cursorSaved, movesCursorOnEnter=False):
    """|code| is the code to test with, either 47 or 1047."""
    # Scribble in main screen
    escio.Write("abc" + CR + LF + "abc")

    # Switch from main to alt. Cursor should not move. If |cursorSaved| is set,
    # record the position first to verify that it's restored after DECRESET.
    if cursorSaved:
      mainCursorPosition = GetCursorPosition()

    before = GetCursorPosition()
    esccmd.DECSET(code)
    after = GetCursorPosition()
    if not movesCursorOnEnter:
      # 1049 moves the cursor on enter
      AssertEQ(before.x(), after.x())
      AssertEQ(before.y(), after.y())

    # Scribble in alt screen, clearing it first since who knows what might have
    # been there.
    esccmd.ED(2)
    esccmd.CUP(Point(1, 2))
    escio.Write("def" + CR +LF + "def")

    # Make sure abc is gone
    AssertScreenCharsInRectEqual(Rect(1, 1, 3, 3), [empty() * 3, "def", "def"])

    # Switch to main. Cursor should not move.
    before = GetCursorPosition()
    esccmd.DECRESET(code)
    after = GetCursorPosition()
    if cursorSaved:
      AssertEQ(mainCursorPosition.x(), after.x())
      AssertEQ(mainCursorPosition.y(), after.y())
    else:
      AssertEQ(before.x(), after.x())
      AssertEQ(before.y(), after.y())

    # def should be gone, abc should be back.
    AssertScreenCharsInRectEqual(Rect(1, 1, 3, 3), ["abc", "abc", empty() * 3])

    # Switch to alt
    before = GetCursorPosition()
    esccmd.DECSET(code)
    after = GetCursorPosition()
    if not movesCursorOnEnter:
      # 1049 moves the cursor on enter
      AssertEQ(before.x(), after.x())
      AssertEQ(before.y(), after.y())

    if altGetsClearedBeforeToMain:
      AssertScreenCharsInRectEqual(Rect(1, 1, 3, 3), [empty() * 3, empty() * 3, empty() * 3])
    else:
      AssertScreenCharsInRectEqual(Rect(1, 1, 3, 3), [empty() * 3, "def", "def"])
コード例 #6
0
    def test_DECSTR_DECRLM(self):
        # Set right-to-left mode
        esccmd.DECSET(esccmd.DECRLM)

        # Perform soft reset
        esccmd.DECSTR()

        # Ensure text goes left to right
        esccmd.CUP(Point(2, 1))
        escio.Write("a")
        escio.Write("b")
        AssertScreenCharsInRectEqual(Rect(2, 1, 2, 1), ["a"])
        AssertScreenCharsInRectEqual(Rect(3, 1, 3, 1), ["b"])
コード例 #7
0
 def test_SM_IRM_DoesNotWrapUnlessCursorAtMargin(self):
   """Insert mode does not cause wrapping."""
   size = GetScreenSize()
   escio.Write("a" * (size.width() - 1))
   escio.Write("b")
   esccmd.CUP(Point(1, 1))
   esccmd.SM(esccmd.IRM)
   AssertScreenCharsInRectEqual(Rect(1, 2, 1, 2), [empty()])
   escio.Write("X")
   AssertScreenCharsInRectEqual(Rect(1, 2, 1, 2), [empty()])
   esccmd.CUP(Point(size.width(), 1))
   escio.Write("YZ")
   AssertScreenCharsInRectEqual(Rect(1, 2, 1, 2), ["Z"])
コード例 #8
0
 def test_DECSTBM_DefaultRestores(self):
     """Default args restore to full screen scrolling."""
     esccmd.DECSTBM(2, 3)
     esccmd.CUP(Point(1, 2))
     escio.Write("1" + CR + LF)
     escio.Write("2")
     AssertScreenCharsInRectEqual(Rect(1, 2, 1, 3), ["1", "2"])
     position = GetCursorPosition()
     esccmd.DECSTBM()
     esccmd.CUP(position)
     escio.Write(CR + LF)
     AssertScreenCharsInRectEqual(Rect(1, 2, 1, 3), ["1", "2"])
     AssertEQ(GetCursorPosition().y(), 4)
コード例 #9
0
ファイル: ich.py プロジェクト: unixfreaxjp/Therm
    def test_ICH_ScrollEntirelyOffRightEdge(self):
        """Test ICH behavior when pushing text off the right edge. """
        width = GetScreenSize().width()
        esccmd.CUP(Point(1, 1))
        escio.Write("x" * width)
        esccmd.CUP(Point(1, 1))
        esccmd.ICH(width)

        expectedLine = blank() * width

        AssertScreenCharsInRectEqual(Rect(1, 1, width, 1), [expectedLine])
        # Ensure there is no wrap-around.
        AssertScreenCharsInRectEqual(Rect(1, 2, 1, 2), [NUL])
コード例 #10
0
ファイル: decstbm.py プロジェクト: unixfreaxjp/Therm
  def test_DECSTBM_CursorBelowRegionAtBottomTriesToScroll(self):
    """You cannot perform scrolling outside the margins."""
    esccmd.DECSTBM(2, 3)
    esccmd.CUP(Point(1, 2))
    escio.Write("1" + CR + LF)
    escio.Write("2")
    size = GetScreenSize()
    esccmd.CUP(Point(1, size.height()))
    escio.Write("3" + CR + LF)

    AssertScreenCharsInRectEqual(Rect(1, 2, 1, 3), [ "1", "2" ])
    AssertScreenCharsInRectEqual(Rect(1, size.height(), 1, size.height()), [ "3" ])
    AssertEQ(GetCursorPosition().y(), size.height())
コード例 #11
0
ファイル: decset.py プロジェクト: ThomasDickey/esctest2
  def test_DECSET_DECLRMM(self):
    """Left-right margin. This is tested extensively in many other places as well."""
    # Turn on margins and write.
    esccmd.DECSET(esccmd.DECLRMM)
    esccmd.DECSLRM(2, 4)
    escio.Write("abcdefgh")
    esccmd.DECRESET(esccmd.DECLRMM)

    AssertScreenCharsInRectEqual(Rect(1, 1, 4, 3), ["abcd", empty() + "efg", empty() + "h" + empty() * 2])

    # Turn off margins.
    esccmd.CUP(Point(1, 1))
    escio.Write("ABCDEFGH")
    AssertScreenCharsInRectEqual(Rect(1, 1, 8, 1), ["ABCDEFGH"])
コード例 #12
0
ファイル: ich.py プロジェクト: unixfreaxjp/Therm
    def test_ICH_ScrollOffRightEdge(self):
        """Test ICH behavior when pushing text off the right edge. """
        width = GetScreenSize().width()
        s = "abcdefg"
        startX = width - len(s) + 1
        esccmd.CUP(Point(startX, 1))
        escio.Write(s)
        esccmd.CUP(Point(startX + 1, 1))
        esccmd.ICH()

        AssertScreenCharsInRectEqual(Rect(startX, 1, width, 1),
                                     ["a" + blank() + "bcdef"])
        # Ensure there is no wrap-around.
        AssertScreenCharsInRectEqual(Rect(1, 2, 1, 2), [NUL])
コード例 #13
0
ファイル: decset.py プロジェクト: ThomasDickey/esctest2
  def test_DECSET_DECAWM(self):
    """Auto-wrap mode."""
    size = GetScreenSize()
    esccmd.CUP(Point(size.width() - 1, 1))
    esccmd.DECSET(esccmd.DECAWM)
    escio.Write("abc")

    AssertScreenCharsInRectEqual(Rect(1, 2, 1, 2), ["c"])

    esccmd.CUP(Point(size.width() - 1, 1))
    esccmd.DECRESET(esccmd.DECAWM)
    escio.Write("ABC")

    AssertScreenCharsInRectEqual(Rect(size.width() - 1, 1, size.width(), 1), ["AC"])
    AssertScreenCharsInRectEqual(Rect(1, 2, 1, 2), ["c"])
コード例 #14
0
ファイル: ed.py プロジェクト: unixfreaxjp/Therm
 def test_ED_Default(self):
     """Should be the same as ED_0."""
     self.prepare()
     esccmd.ED()
     AssertScreenCharsInRectEqual(
         Rect(1, 1, 3,
              5), ["a" + NUL * 2, NUL * 3, "b" + NUL * 2, NUL * 3, NUL * 3])
コード例 #15
0
ファイル: decfi.py プロジェクト: unixfreaxjp/Therm
  def test_DECFI_Scrolls(self):
    strings = [ "abcde",
                "fghij",
                "klmno",
                "pqrst",
                "uvwxy" ]
    y = 3
    for s in strings:
      esccmd.CUP(Point(2, y))
      escio.Write(s)
      y += 1

    esccmd.DECSET(esccmd.DECLRMM)
    esccmd.DECSLRM(3, 5)
    esccmd.DECSTBM(4, 6)

    esccmd.CUP(Point(5, 5))
    esccmd.DECFI()

    # It is out of character for xterm to use NUL in the middle of the line,
    # but not terribly important, and not worth marking as a bug. I mentioned
    # it to TED.
    AssertScreenCharsInRectEqual(Rect(2, 3, 6, 7),
                                 [ "abcde",
                                   "fhi" + NUL + "j",
                                   "kmn" + NUL + "o",
                                   "prs" + NUL + "t",
                                   "uvwxy" ])
コード例 #16
0
ファイル: deccra.py プロジェクト: migueldeicaza/esctest
    def test_DECCRA_ignoresMargins(self):
        self.prepare()

        # Set margins
        esccmd.DECSET(esccmd.DECLRMM)
        esccmd.DECSLRM(3, 6)
        esccmd.DECSTBM(3, 6)

        esccmd.DECCRA(source_top=2,
                      source_left=2,
                      source_bottom=4,
                      source_right=4,
                      source_page=1,
                      dest_top=5,
                      dest_left=5,
                      dest_page=1)

        # Remove margins
        esccmd.DECRESET(esccmd.DECLRMM)
        esccmd.DECSTBM()

        # Did it ignore the margins?
        AssertScreenCharsInRectEqual(Rect(1, 1, 8, 8), [
            "abcdefgh", "ijklmnop", "qrstuvwx", "yz012345", "ABCDjklH",
            "IJKLrstP", "QRSTz01X", "YZ6789!@"
        ])
コード例 #17
0
ファイル: deccra.py プロジェクト: migueldeicaza/esctest
    def test_DECCRA_respectsOriginMode(self):
        self.prepare()

        # Set margins at 2, 2
        esccmd.DECSET(esccmd.DECLRMM)
        esccmd.DECSLRM(2, 9)
        esccmd.DECSTBM(2, 9)

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

        # Copy from 1,1 to 4,4 - with origin mode, that's 2,2 to 5,5
        esccmd.DECCRA(source_top=1,
                      source_left=1,
                      source_bottom=3,
                      source_right=3,
                      source_page=1,
                      dest_top=4,
                      dest_left=4,
                      dest_page=1)

        # Turn off margins and origin mode
        esccmd.DECRESET(esccmd.DECLRMM)
        esccmd.DECSTBM()
        esccmd.DECRESET(esccmd.DECOM)

        # See what happened.
        AssertScreenCharsInRectEqual(Rect(1, 1, 8, 8), [
            "abcdefgh", "ijklmnop", "qrstuvwx", "yz012345", "ABCDjklH",
            "IJKLrstP", "QRSTz01X", "YZ6789!@"
        ])
コード例 #18
0
ファイル: ed.py プロジェクト: unixfreaxjp/Therm
 def test_ED_0(self):
     """Erase after cursor."""
     self.prepare()
     esccmd.ED(0)
     AssertScreenCharsInRectEqual(
         Rect(1, 1, 3,
              5), ["a" + NUL * 2, NUL * 3, "b" + NUL * 2, NUL * 3, NUL * 3])
コード例 #19
0
  def fillRectangle_ignoresMargins(self):
    self.prepare()

    # Set margins
    esccmd.DECSET(esccmd.DECLRMM)
    esccmd.DECSLRM(3, 6)
    esccmd.DECSTBM(3, 6)

    # Fill!
    self.fill(top=5,
              left=5,
              bottom=7,
              right=7)

    # Remove margins
    esccmd.DECRESET(esccmd.DECLRMM)
    esccmd.DECSTBM()

    # Did it ignore the margins?
    AssertScreenCharsInRectEqual(Rect(1, 1, 8, 8),
                                 ["abcdefgh",
                                  "ijklmnop",
                                  "qrstuvwx",
                                  "yz012345",
                                  "ABCD" + self.characters(Point(5, 5), 3) + "H",
                                  "IJKL" + self.characters(Point(5, 6), 3) + "P",
                                  "QRST" + self.characters(Point(5, 7), 3) + "X",
                                  "YZ6789!@"])
コード例 #20
0
    def test_DECSED_1_WithScrollRegion_Protection(self):
        """Erase after cursor with a scroll region present. The scroll region is ignored."""
        esccmd.DECSCA(1)
        self.prepare_wide()

        # Write an X at 1,1 without protection
        esccmd.DECSCA(0)
        esccmd.CUP(Point(1, 1))
        escio.Write("X")

        # Set margins
        esccmd.DECSET(esccmd.DECLRMM)
        esccmd.DECSLRM(2, 4)
        esccmd.DECSTBM(2, 3)

        # Position cursor and do DECSED 1
        esccmd.CUP(Point(3, 2))
        esccmd.DECSED(1)

        # Remove margins
        esccmd.DECRESET(esccmd.DECLRMM)
        esccmd.DECSTBM()

        AssertScreenCharsInRectEqual(Rect(1, 1, 5, 3),
                                     [blank() + "bcde", "fghij", "klmno"])
コード例 #21
0
    def test_SaveRestoreCursor_ResetsOriginMode(self):
        esccmd.CUP(Point(5, 6))
        self.saveCursor()

        # Set up margins.
        esccmd.DECSTBM(5, 7)
        esccmd.DECSET(esccmd.DECLRMM)
        esccmd.DECSLRM(5, 7)

        # Enter origin mode.
        esccmd.DECSET(esccmd.DECOM)

        # Do DECRC, which should reset origin mode.
        self.restoreCursor()

        # Move home
        esccmd.CUP(Point(1, 1))

        # Place an X at cursor, which should be at (1, 1) if DECOM was reset.
        escio.Write("X")

        # Remove margins and ensure origin mode is off for valid test.
        esccmd.DECRESET(esccmd.DECLRMM)
        esccmd.DECSTBM()
        esccmd.DECRESET(esccmd.DECOM)

        # Ensure the X was placed at the true origin
        AssertScreenCharsInRectEqual(Rect(1, 1, 1, 1), ["X"])
コード例 #22
0
    def test_DECSTR_DECOM(self):
        # Define a scroll region
        esccmd.DECSTBM(3, 4)

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

        # Perform soft reset
        esccmd.DECSTR()

        # Define scroll region again
        esccmd.DECSET(esccmd.DECLRMM)
        esccmd.DECSLRM(3, 4)
        esccmd.DECSTBM(4, 5)

        # Move to 1,1 (or 3,4 if origin mode is still on) and write an X
        esccmd.CUP(Point(1, 1))
        escio.Write("X")

        # Turn off origin mode
        esccmd.DECRESET(esccmd.DECOM)

        # Make sure the X was at 1, 1, implying origin mode was off.
        esccmd.DECSTBM()
        esccmd.DECRESET(esccmd.DECLRMM)
        AssertScreenCharsInRectEqual(Rect(
            1, 1, 3, 4), ["X" + NUL * 2, NUL * 3, NUL * 3, NUL * 3])
コード例 #23
0
    def test_PM_Basic(self):
        esccmd.PM()
        escio.Write("xyz")
        escio.Write(ST)
        escio.Write("A")

        AssertScreenCharsInRectEqual(Rect(1, 1, 3, 1), ["A" + empty() * 2])
コード例 #24
0
ファイル: vpr.py プロジェクト: migueldeicaza/esctest
    def test_VPR_IgnoresOriginMode(self):
        """VPR continues to work in origin mode."""
        # Set a scroll region.
        esccmd.DECSTBM(6, 11)
        esccmd.DECSET(esccmd.DECLRMM)
        esccmd.DECSLRM(5, 10)

        # Enter origin mode
        esccmd.DECSET(esccmd.DECOM)

        # Move to center of region
        esccmd.CUP(Point(2, 2))
        escio.Write('X')

        # Move down by 2
        esccmd.VPR(2)
        escio.Write('Y')

        # Exit origin mode
        esccmd.DECRESET(esccmd.DECOM)

        # Reset margins
        esccmd.DECSET(esccmd.DECLRMM)
        esccmd.DECSTBM()

        # See what happened
        AssertScreenCharsInRectEqual(
            Rect(6, 7, 7,
                 9), ['X' + empty(), empty() * 2,
                      empty() + 'Y'])
コード例 #25
0
  def fillRectangle_respectsOriginMode(self):
    self.prepare()

    # Set margins starting at 2 and 2
    esccmd.DECSET(esccmd.DECLRMM)
    esccmd.DECSLRM(2, 9)
    esccmd.DECSTBM(2, 9)

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

    # Fill from 1,1 to 3,3 - with origin mode, that's 2,2 to 4,4
    self.fill(top=1,
              left=1,
              bottom=3,
              right=3)

    # Turn off margins and origin mode
    esccmd.DECRESET(esccmd.DECLRMM)
    esccmd.DECSTBM()
    esccmd.DECRESET(esccmd.DECOM)

    # See what happened.
    AssertScreenCharsInRectEqual(Rect(1, 1, 8, 8),
                                 ["abcdefgh",
                                  "i" + self.characters(Point(2, 2), 3) + "mnop",
                                  "q" + self.characters(Point(2, 3), 3) + "uvwx",
                                  "y" + self.characters(Point(2, 4), 3) + "2345",
                                  "ABCDEFGH",
                                  "IJKLMNOP",
                                  "QRSTUVWX",
                                  "YZ6789!@"])
コード例 #26
0
ファイル: decbi.py プロジェクト: unixfreaxjp/Therm
  def test_DECBI_Scrolls(self):
    strings = [ "abcde",
                "fghij",
                "klmno",
                "pqrst",
                "uvwxy" ]
    y = 3
    for s in strings:
      esccmd.CUP(Point(2, y))
      escio.Write(s)
      y += 1

    esccmd.DECSET(esccmd.DECLRMM)
    esccmd.DECSLRM(3, 5)
    esccmd.DECSTBM(4, 6)

    esccmd.CUP(Point(3, 5))
    esccmd.DECBI()

    AssertScreenCharsInRectEqual(Rect(2, 3, 6, 7),
                                 [ "abcde",
                                   "f" + blank() + "ghj",
                                   "k" + blank() + "lmo",
                                   "p" + blank() + "qrt",
                                   "uvwxy" ])
コード例 #27
0
ファイル: decdc.py プロジェクト: unixfreaxjp/Therm
    def test_DECDC_DeleteAll(self):
        """Test DECDC behavior when deleting more columns than are available."""
        width = GetScreenSize().width()
        s = "abcdefg"
        startX = width - len(s) + 1
        esccmd.CUP(Point(startX, 1))
        escio.Write(s)
        esccmd.CUP(Point(startX, 2))
        escio.Write(s.upper())
        esccmd.CUP(Point(startX + 1, 1))
        esccmd.DECDC(width + 10)

        AssertScreenCharsInRectEqual(Rect(startX, 1, width, 2),
                                     ["a" + NUL * 6, "A" + NUL * 6])
        # Ensure there is no wrap-around.
        AssertScreenCharsInRectEqual(Rect(1, 2, 1, 3), [NUL, NUL])
コード例 #28
0
 def test_SM_IRM(self):
   """Turn on insert mode."""
   escio.Write("abc")
   esccmd.CUP(Point(1, 1))
   esccmd.SM(esccmd.IRM)
   escio.Write("X")
   AssertScreenCharsInRectEqual(Rect(1, 1, 4, 1), ["Xabc"])
コード例 #29
0
    def test_APC_Basic(self):
        esccmd.APC()
        escio.Write("xyz")
        escio.Write(ST)
        escio.Write("A")

        AssertScreenCharsInRectEqual(Rect(1, 1, 3, 1), ["A" + NUL * 2])
コード例 #30
0
ファイル: cup.py プロジェクト: migueldeicaza/esctest
    def test_CUP_RespectsOriginMode(self):
        """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"])