예제 #1
0
    def doModifiableAnsiTest(self, mode):
        before = self.requestAnsiMode(mode)
        if before[1] == 2:
            esccmd.SM(mode)
            AssertEQ(self.requestAnsiMode(mode), [mode, 1])

            esccmd.RM(mode)
            AssertEQ(self.requestAnsiMode(mode), [mode, 2])
        else:
            esccmd.RM(mode)
            AssertEQ(self.requestAnsiMode(mode), [mode, 2])

            esccmd.SM(mode)
            AssertEQ(self.requestAnsiMode(mode), [mode, 1])
예제 #2
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"])
예제 #3
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"])
예제 #4
0
  def doLinefeedModeTest(self, code):
    esccmd.RM(esccmd.LNM)
    esccmd.CUP(Point(5, 1))
    escio.Write(code)
    AssertEQ(GetCursorPosition(), Point(5, 2))

    esccmd.SM(esccmd.LNM)
    esccmd.CUP(Point(5, 1))
    escio.Write(code)
    AssertEQ(GetCursorPosition(), Point(1, 2))
예제 #5
0
파일: rm.py 프로젝트: migueldeicaza/esctest
    def test_RM_IRM(self):
        # First turn on insert mode
        esccmd.SM(esccmd.IRM)
        esccmd.CUP(Point(1, 1))
        escio.Write("X")
        esccmd.CUP(Point(1, 1))
        escio.Write("W")

        # Now turn on replace mode
        esccmd.CUP(Point(1, 1))
        esccmd.RM(esccmd.IRM)
        escio.Write("YZ")
        AssertScreenCharsInRectEqual(Rect(1, 1, 2, 1), ["YZ"])
예제 #6
0
    def test_DECSTR_IRM(self):
        # Turn on insert mode
        esccmd.SM(esccmd.IRM)

        # Perform soft reset
        esccmd.DECSTR()

        # 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"])
예제 #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_SaveRestoreCursor_InsertNotAffected(self):
        # Turn on insert and save
        esccmd.SM(esccmd.IRM)
        self.saveCursor()

        # Turn off insert and restore. Restore should turn insert on.
        esccmd.RM(esccmd.IRM)
        self.restoreCursor()

        # See if insert is still off
        esccmd.CUP(Point(1, 1))
        escio.Write("a")
        esccmd.CUP(Point(1, 1))
        escio.Write("b")
        AssertScreenCharsInRectEqual(Rect(1, 1, 2, 1), ["b" + empty()])
예제 #9
0
  def test_SM_IRM_TruncatesAtRightMargin(self):
    """When a left-right margin is set, insert truncates the line at the right margin."""
    esccmd.CUP(Point(5, 1))

    escio.Write("abcdef")

    esccmd.DECSET(esccmd.DECLRMM)
    esccmd.DECSLRM(5, 10)

    esccmd.CUP(Point(7, 1))
    esccmd.SM(esccmd.IRM)
    escio.Write("X")
    esccmd.DECRESET(esccmd.DECLRMM)

    AssertScreenCharsInRectEqual(Rect(5, 1, 11, 1), ["abXcde" + empty()])