Beispiel #1
0
 def test_RI_Basic(self):
     """Reverse index moves the cursor up one line."""
     esccmd.CUP(Point(5, 3))
     esccmd.RI()
     position = GetCursorPosition()
     AssertEQ(position.x(), 5)
     AssertEQ(position.y(), 2)
Beispiel #2
0
 def test_HVP_ZeroIsTreatedAsOne(self):
   """Zero args are treated as 1."""
   esccmd.HVP(Point(6, 3))
   esccmd.HVP(col=0, row=0)
   position = GetCursorPosition()
   AssertEQ(position.x(), 1)
   AssertEQ(position.y(), 1)
Beispiel #3
0
 def test_CUU_DefaultParam(self):
     """CUU moves the cursor up 1 with no parameter given."""
     esccmd.CUP(Point(5, 3))
     esccmd.CUU()
     position = GetCursorPosition()
     AssertEQ(position.x(), 5)
     AssertEQ(position.y(), 2)
Beispiel #4
0
 def test_CHA_ZeroParam(self):
     """CHA moves as far left as possible when given a zero parameter."""
     esccmd.CUP(Point(5, 3))
     esccmd.CHA(0)
     position = GetCursorPosition()
     AssertEQ(position.x(), 1)
     AssertEQ(position.y(), 3)
Beispiel #5
0
 def test_CHA_DefaultParam(self):
     """CHA moves to first column of active line by default."""
     esccmd.CUP(Point(5, 3))
     esccmd.CHA()
     position = GetCursorPosition()
     AssertEQ(position.x(), 1)
     AssertEQ(position.y(), 3)
Beispiel #6
0
  def test_HPR_DefaultParams(self):
    """With no params, HPR moves right by 1."""
    esccmd.CUP(Point(6, 1))
    esccmd.HPR()

    position = GetCursorPosition()
    AssertEQ(position.x(), 7)
Beispiel #7
0
 def test_CHA_ExplicitParam(self):
     """CHA moves to specified column of active line."""
     esccmd.CUP(Point(5, 3))
     esccmd.CHA(10)
     position = GetCursorPosition()
     AssertEQ(position.x(), 10)
     AssertEQ(position.y(), 3)
Beispiel #8
0
 def test_BS_StopsAtLeftMargin(self):
     esccmd.DECSET(esccmd.DECLRMM)
     esccmd.DECSLRM(5, 10)
     esccmd.CUP(Point(5, 1))
     escio.Write(esc.BS)
     esccmd.DECRESET(esccmd.DECLRMM)
     AssertEQ(GetCursorPosition(), Point(5, 1))
Beispiel #9
0
 def test_BS_MovesLeftWhenLeftOfLeftMargin(self):
     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))
Beispiel #10
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), [ NUL ])

    # 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" ])
Beispiel #11
0
 def test_BS_WrapsInWraparoundMode(self):
     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))
Beispiel #12
0
  def test_SaveRestoreCursor_WorksInLRM(self, shouldWork=True):
    """Subclasses may cause shouldWork to be set to false."""
    esccmd.CUP(Point(2, 3))
    self.saveCursor()
    esccmd.DECSET(esccmd.DECLRMM)
    esccmd.DECSLRM(1, 10)
    esccmd.CUP(Point(5, 6))
    self.saveCursor()

    esccmd.CUP(Point(4, 5))
    self.restoreCursor()

    if shouldWork:
      AssertEQ(GetCursorPosition(), Point(5, 6))
    else:
      AssertEQ(GetCursorPosition(), Point(2, 3))
Beispiel #13
0
    def test_DECSET_DECAWM_NoLineWrapOnTabWithLeftRightMargin(self):
        esccmd.DECSET(esccmd.DECAWM)
        esccmd.XTERM_WINOPS(esccmd.WINOP_RESIZE_CHARS, 24, 80)
        esccmd.DECSET(esccmd.DECLRMM)
        esccmd.DECSLRM(10, 20)

        # Move to origin and tab thrice. Should stop at right margin.
        AssertEQ(GetCursorPosition(), Point(1, 1))
        escio.Write(TAB)
        AssertEQ(GetCursorPosition(), Point(9, 1))
        escio.Write(TAB)
        AssertEQ(GetCursorPosition(), Point(17, 1))
        escio.Write(TAB)
        AssertEQ(GetCursorPosition(), Point(20, 1))
        escio.Write(TAB)
        AssertEQ(GetCursorPosition(), Point(20, 1))
Beispiel #14
0
 def test_BS_ReverseWrapWontPassTop(self):
     esccmd.DECSET(esccmd.DECAWM)
     esccmd.DECSET(esccmd.ReverseWraparound)
     esccmd.DECSTBM(2, 5)
     esccmd.CUP(Point(1, 2))
     escio.Write(esc.BS)
     AssertEQ(GetCursorPosition(), Point(1, 2))
Beispiel #15
0
 def test_CR_StaysPutWhenAtLeftMargin(self):
     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))
Beispiel #16
0
    def test_VPR_DefaultParams(self):
        """With no params, VPR moves right by 1."""
        esccmd.CUP(Point(1, 6))
        esccmd.VPR()

        position = GetCursorPosition()
        AssertEQ(position.y(), 7)