예제 #1
0
파일: cuu.py 프로젝트: unixfreaxjp/Therm
 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)
예제 #2
0
 def test_NEL_Basic(self):
   """Next Line moves the cursor down one line and to the start of the next line."""
   esccmd.CUP(Point(5, 3))
   esccmd.NEL()
   position = GetCursorPosition()
   AssertEQ(position.x(), 1)
   AssertEQ(position.y(), 4)
예제 #3
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)
예제 #4
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)
예제 #5
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)
예제 #6
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)
예제 #7
0
    def test_XtermWinops_PushMultiplePopMultiple_Window(self):
        """Push two titles and pop twice."""
        # Generate a uniqueish string
        string1 = "a" + str(time.time())
        string2 = "b" + str(time.time())

        for title in [string1, string2]:
            # Set title
            esccmd.ChangeWindowTitle(title)

            # Push
            esccmd.XTERM_WINOPS(esccmd.WINOP_PUSH_TITLE,
                                esccmd.WINOP_PUSH_TITLE_WINDOW)

        # Change to known values.
        esccmd.ChangeWindowTitle("z")

        # Pop
        esccmd.XTERM_WINOPS(esccmd.WINOP_POP_TITLE,
                            esccmd.WINOP_POP_TITLE_WINDOW)
        AssertEQ(GetWindowTitle(), string2)

        # Pop
        esccmd.XTERM_WINOPS(esccmd.WINOP_POP_TITLE,
                            esccmd.WINOP_POP_TITLE_WINDOW)
        AssertEQ(GetWindowTitle(), string1)
예제 #8
0
    def test_XtermWinops_PushIconThenWindowThenPopBoth(self):
        """Push icon, then push window, then pop both."""
        # Generate a uniqueish string
        string1 = "a" + str(time.time())
        string2 = "b" + str(time.time())

        # Set titles
        esccmd.ChangeWindowTitle(string1)
        esccmd.ChangeIconTitle(string2)

        # Push icon then window
        esccmd.XTERM_WINOPS(esccmd.WINOP_PUSH_TITLE,
                            esccmd.WINOP_PUSH_TITLE_ICON)
        esccmd.XTERM_WINOPS(esccmd.WINOP_PUSH_TITLE,
                            esccmd.WINOP_PUSH_TITLE_WINDOW)

        # Change both to known values.
        esccmd.ChangeWindowTitle("y")
        esccmd.ChangeIconTitle("z")

        # Pop both titles.
        esccmd.XTERM_WINOPS(esccmd.WINOP_POP_TITLE,
                            esccmd.WINOP_POP_TITLE_ICON_AND_WINDOW)
        AssertEQ(GetWindowTitle(), string1)
        AssertEQ(GetIconTitle(), string2)
예제 #9
0
 def test_XtermWinops_MoveToXY(self):
     esccmd.XTERM_WINOPS(esccmd.WINOP_MOVE, 0, 0)
     self.DelayAfterMove()
     AssertEQ(GetWindowPosition(), Point(0, 0))
     esccmd.XTERM_WINOPS(esccmd.WINOP_MOVE, 1, 1)
     self.DelayAfterMove()
     AssertEQ(GetWindowPosition(), Point(1, 1))
예제 #10
0
파일: ri.py 프로젝트: sbuzonas/iTerm2
 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)
예제 #11
0
 def test_CNL_DefaultParam(self):
     """CNL moves the cursor down 1 with no parameter given."""
     esccmd.CUP(Point(5, 3))
     esccmd.CNL()
     position = GetCursorPosition()
     AssertEQ(position.x(), 1)
     AssertEQ(position.y(), 4)
예제 #12
0
파일: cup.py 프로젝트: unixfreaxjp/Therm
    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"])
예제 #13
0
 def test_CNL_ExplicitParam(self):
     """CNL moves the cursor down by the passed-in number of lines."""
     esccmd.CUP(Point(6, 3))
     esccmd.CNL(2)
     position = GetCursorPosition()
     AssertEQ(position.x(), 1)
     AssertEQ(position.y(), 5)
예제 #14
0
    def test_IND_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))
        esccmd.IND()
        # 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))
        esccmd.IND()
        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))
        esccmd.IND()
        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))
        esccmd.IND()
        AssertEQ(GetCursorPosition(), Point(1, height))
        AssertScreenCharsInRectEqual(Rect(3, 5, 3, 5), ["x"])
예제 #15
0
파일: ff.py 프로젝트: ThomasDickey/esctest2
 def test_FF_Basic(self):
   """FF moves the cursor down one line."""
   esccmd.CUP(Point(5, 3))
   escio.Write(FF)
   position = GetCursorPosition()
   AssertEQ(position.x(), 5)
   AssertEQ(position.y(), 4)
예제 #16
0
 def test_TBC_Default(self):
   """No param clears the tab stop at the cursor."""
   escio.Write(TAB)
   AssertEQ(GetCursorPosition().x(), 9)
   esccmd.TBC()
   esccmd.CUP(Point(1, 1))
   escio.Write(TAB)
   AssertEQ(GetCursorPosition().x(), 17)
예제 #17
0
    def test_HPA_DoesNotChangeRow(self):
        """HPA moves the specified column and does not change the row."""
        esccmd.CUP(Point(5, 6))
        esccmd.HPA(2)

        position = GetCursorPosition()
        AssertEQ(position.x(), 2)
        AssertEQ(position.y(), 6)
예제 #18
0
    def test_XtermWinops_IconifyDeiconfiy(self):
        esccmd.XTERM_WINOPS(esccmd.WINOP_ICONIFY)
        self.DelayAfterIcon()
        AssertEQ(GetIsIconified(), True)

        esccmd.XTERM_WINOPS(esccmd.WINOP_DEICONIFY)
        self.DelayAfterIcon()
        AssertEQ(GetIsIconified(), False)
예제 #19
0
    def test_VPA_DoesNotChangeColumn(self):
        """VPA moves the specified line and does not change the column."""
        esccmd.CUP(Point(6, 5))
        esccmd.VPA(2)

        position = GetCursorPosition()
        AssertEQ(position.x(), 6)
        AssertEQ(position.y(), 2)
예제 #20
0
    def test_CUP_OutOfBoundsParams(self):
        """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())
예제 #21
0
파일: decset.py 프로젝트: sbuzonas/iTerm2
 def test_DECSET_DECAWM_TabDoesNotWrapAround(self):
   """In auto-wrap mode, tabs to not wrap to the next line."""
   esccmd.DECSET(esccmd.DECAWM)
   size = GetScreenSize()
   for i in xrange(size.width() / 8 + 2):
     escio.Write(TAB)
   AssertEQ(GetCursorPosition().x(), size.width())
   AssertEQ(GetCursorPosition().y(), 1)
예제 #22
0
 def test_TBC_0(object):
     """0 param clears the tab stop at the cursor."""
     escio.Write(TAB)
     AssertEQ(GetCursorPosition().x(), 9)
     esccmd.TBC(0)
     esccmd.CUP(Point(1, 1))
     escio.Write(TAB)
     AssertEQ(GetCursorPosition().x(), 17)
예제 #23
0
 def test_CNL_StopsAtBottomLine(self):
     """CNL moves the cursor down, stopping at the last line."""
     esccmd.CUP(Point(6, 3))
     height = GetScreenSize().height()
     esccmd.CNL(height)
     position = GetCursorPosition()
     AssertEQ(position.x(), 1)
     AssertEQ(position.y(), height)
예제 #24
0
파일: cpl.py 프로젝트: unixfreaxjp/Therm
 def test_CPL_StopsAtTopLine(self):
   """CPL moves the cursor up, stopping at the last line."""
   esccmd.CUP(Point(6, 3))
   height = GetScreenSize().height()
   esccmd.CPL(height)
   position = GetCursorPosition()
   AssertEQ(position.x(), 1)
   AssertEQ(position.y(), 1)
예제 #25
0
    def test_VPR_DoesNotChangeColumn(self):
        """VPR moves the specified row and does not change the column."""
        esccmd.CUP(Point(5, 6))
        esccmd.VPR(2)

        position = GetCursorPosition()
        AssertEQ(position.x(), 5)
        AssertEQ(position.y(), 8)
예제 #26
0
파일: ris.py 프로젝트: unixfreaxjp/Therm
    def test_RIS_ResetDECCOLM(self):
        esccmd.DECSET(esccmd.Allow80To132)
        esccmd.DECSET(esccmd.DECCOLM)
        AssertEQ(GetScreenSize().width(), 132)

        esccmd.RIS()

        AssertEQ(GetScreenSize().width(), 80)
예제 #27
0
파일: cha.py 프로젝트: unixfreaxjp/Therm
 def test_CHA_OutOfBoundsLarge(self):
   """CHA moves as far as possible when given a too-large parameter."""
   esccmd.CUP(Point(5, 3))
   esccmd.CHA(9999)
   position = GetCursorPosition()
   width = GetScreenSize().width()
   AssertEQ(position.x(), width)
   AssertEQ(position.y(), 3)
예제 #28
0
 def test_DECSET_SaveRestoreCursor(self):
   """Set saves the cursor position. Reset restores it."""
   esccmd.CUP(Point(2, 3))
   esccmd.DECSET(esccmd.SaveRestoreCursor)
   esccmd.CUP(Point(5, 5))
   esccmd.DECRESET(esccmd.SaveRestoreCursor)
   cursor = GetCursorPosition()
   AssertEQ(cursor.x(), 2)
   AssertEQ(cursor.y(), 3)
예제 #29
0
    def test_DECDSR_DECMSR(self):
        """Get space available for macros. This test assumes it's always 0."""
        esccmd.DECDSR(esccmd.DECMSR)
        params = escio.ReadCSI('*{')

        # Assume the terminal being tested doesn't support macros. May need to add
        # code some day for a more capable terminal.
        AssertEQ(len(params), 1)
        AssertEQ(params[0], 0)
예제 #30
0
파일: cha.py 프로젝트: unixfreaxjp/Therm
 def test_CHA_IgnoresScrollRegion(self):
   """CHA ignores scroll regions."""
   # Set a scroll region.
   esccmd.DECSET(esccmd.DECLRMM)
   esccmd.DECSLRM(5, 10)
   esccmd.CUP(Point(5, 3))
   esccmd.CHA(1)
   position = GetCursorPosition()
   AssertEQ(position.x(), 1)
   AssertEQ(position.y(), 3)