コード例 #1
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)
コード例 #2
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)
コード例 #3
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)
コード例 #4
0
    def prepare(self):
        """Sets the screen up as
    abcde
    fghij
    klmno
    pqrst
    uvwxy

    With the cursor on the 'h'."""
        lines = ["abcde", "fghij", "klmno", "pqrst", "uvwxy"]
        for i in xrange(len(lines)):
            y = i + 1
            line = lines[i]
            esccmd.CUP(Point(1, y))
            escio.Write(line)
        esccmd.CUP(Point(3, 2))
コード例 #5
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))
コード例 #6
0
 def test_IND_Basic(self):
     """Index moves the cursor down one line."""
     esccmd.CUP(Point(5, 3))
     esccmd.IND()
     position = GetCursorPosition()
     AssertEQ(position.x(), 5)
     AssertEQ(position.y(), 4)
コード例 #7
0
ファイル: cha.py プロジェクト: migueldeicaza/esctest
 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)
コード例 #8
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"])
コード例 #9
0
ファイル: hpr.py プロジェクト: migueldeicaza/esctest
  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)
コード例 #10
0
ファイル: cha.py プロジェクト: migueldeicaza/esctest
 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)
コード例 #11
0
ファイル: hpr.py プロジェクト: migueldeicaza/esctest
  def test_HPR_IgnoresOriginMode(self):
    """HPR 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 right by 2
    esccmd.HPR(2)
    escio.Write('Y')

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

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

    # See what happened
    AssertScreenCharsInRectEqual(Rect(5, 7, 9, 7), [empty() + "X" + empty() * 2 + "Y"])
コード例 #12
0
ファイル: decset.py プロジェクト: lb/iTerm2-no-title-bar
    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))
コード例 #13
0
ファイル: decset.py プロジェクト: lb/iTerm2-no-title-bar
    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
ファイル: vpr.py プロジェクト: unixfreaxjp/Therm
    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)
コード例 #15
0
ファイル: cha.py プロジェクト: migueldeicaza/esctest
 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)
コード例 #16
0
ファイル: decset.py プロジェクト: unixfreaxjp/Therm
 def test_DECSET_DECLRMM_ModeNotResetByDECSTR(self):
   esccmd.DECSET(esccmd.DECLRMM)
   esccmd.DECSTR()
   esccmd.DECSLRM(2, 4)
   esccmd.CUP(Point(3, 3))
   escio.Write("abc")
   AssertEQ(GetCursorPosition().x(), 3)
コード例 #17
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)
コード例 #18
0
ファイル: cub.py プロジェクト: sbuzonas/iTerm2
 def test_CUB_DefaultParam(self):
     """CUB moves the cursor left 1 with no parameter given."""
     esccmd.CUP(Point(5, 3))
     esccmd.CUB()
     position = GetCursorPosition()
     AssertEQ(position.x(), 4)
     AssertEQ(position.y(), 3)
コード例 #19
0
ファイル: escutil.py プロジェクト: sbuzonas/iTerm2
def GetWindowPosition():
    """Returns a Point giving the window's origin in screen pixels."""
    esccmd.XTERM_WINOPS(esccmd.WINOP_REPORT_WINDOW_POSITION)
    params = escio.ReadCSI("t")
    AssertTrue(params[0] == 3)
    AssertTrue(len(params) >= 3)
    return Point(params[1], params[2])
コード例 #20
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])
コード例 #21
0
ファイル: decdc.py プロジェクト: migueldeicaza/esctest
    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" + empty() * 6, "A" + empty() * 6])
        # Ensure there is no wrap-around.
        AssertScreenCharsInRectEqual(Rect(1, 2, 1, 3), [empty(), empty()])
コード例 #22
0
ファイル: ri.py プロジェクト: unixfreaxjp/Therm
 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)
コード例 #23
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)
コード例 #24
0
ファイル: ff.py プロジェクト: unixfreaxjp/Therm
 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)
コード例 #25
0
    def prepare_wide(self):
        """Sets up the display as:
    abcde
    fghij
    klmno

    With the cursor on the 'h'.
    """
        esccmd.CUP(Point(1, 1))
        escio.Write("abcde")
        esccmd.CUP(Point(1, 2))
        escio.Write("fghij")
        esccmd.CUP(Point(1, 3))
        escio.Write("klmno")

        esccmd.CUP(Point(2, 3))
コード例 #26
0
ファイル: vpr.py プロジェクト: unixfreaxjp/Therm
    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' + NUL, NUL * 2, NUL + 'Y'])
コード例 #27
0
ファイル: decset.py プロジェクト: ThomasDickey/esctest2
 def test_DECSET_DECLRMM_ModeResetByDECSTR(self):
   """ DEC STD 070 says DECSTR resets left/right mode."""
   esccmd.DECSET(esccmd.DECLRMM)
   esccmd.DECSTR()
   esccmd.DECSLRM(2, 4)
   esccmd.CUP(Point(3, 3))
   escio.Write("abc")
   AssertEQ(GetCursorPosition().x(), 6)
コード例 #28
0
ファイル: decset.py プロジェクト: ThomasDickey/esctest2
 def test_DECSET_ReverseWraparound_Multi(self):
   size = GetScreenSize()
   esccmd.CUP(Point(size.width() - 1, 1))
   escio.Write("abcd")
   esccmd.DECSET(esccmd.ReverseWraparound)
   esccmd.DECSET(esccmd.DECAWM)
   esccmd.CUB(4)
   AssertEQ(GetCursorPosition().x(), size.width() - 1)
コード例 #29
0
ファイル: decset.py プロジェクト: ThomasDickey/esctest2
 def test_DECSET_ReverseWraparound_RequiresDECAWM(self):
   """Reverse wraparound only works if DECAWM is set."""
   # iTerm2 turns reverse wraparound on by default, while xterm does not.
   esccmd.CUP(Point(1, 2))
   esccmd.DECSET(esccmd.ReverseWraparound)
   esccmd.DECRESET(esccmd.DECAWM)
   escio.Write(BS)
   AssertEQ(GetCursorPosition().x(), 1)
コード例 #30
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)