Пример #1
0
  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" ])
Пример #2
0
  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" ])
Пример #3
0
 def test_DECFI_RightOfMargin(self):
     """DEC STD 070 says DECFI can move when outside the margins."""
     esccmd.DECSET(esccmd.DECLRMM)
     esccmd.DECSLRM(3, 5)
     esccmd.CUP(Point(6, 1))
     esccmd.DECFI()
     AssertEQ(GetCursorPosition(), Point(7, 1))
Пример #4
0
    def test_DECBI_LeftOfMargin(self):
        """Test DECBI (back-index) when the cursor is before the left-margin.

    DEC STD 070 says DECBI can move when outside the margins."""
        esccmd.DECSET(esccmd.DECLRMM)
        esccmd.DECSLRM(3, 5)
        esccmd.CUP(Point(2, 1))
        esccmd.DECBI()
        AssertEQ(GetCursorPosition(), Point(1, 1))
Пример #5
0
    def test_DECALN_ClearsMargins(self):
        esccmd.DECSET(esccmd.DECLRMM)
        esccmd.DECSLRM(2, 3)
        esccmd.DECSTBM(4, 5)
        esccmd.DECALN()

        # Verify we can pass the top margin
        esccmd.CUP(Point(2, 4))
        esccmd.CUU()
        AssertEQ(GetCursorPosition(), Point(2, 3))

        # Verify we can pass the bottom margin
        esccmd.CUP(Point(2, 5))
        esccmd.CUD()
        AssertEQ(GetCursorPosition(), Point(2, 6))

        # Verify we can pass the left margin
        esccmd.CUP(Point(2, 4))
        esccmd.CUB()
        AssertEQ(GetCursorPosition(), Point(1, 4))

        # Verify we can pass the right margin
        esccmd.CUP(Point(3, 4))
        esccmd.CUF()
        AssertEQ(GetCursorPosition(), Point(4, 4))
Пример #6
0
 def test_DECFI_WholeScreenScrolls(self):
     """Starting with the cursor at the right edge of the page (outside the
 margins), verify that DECFI is ignored."""
     size = GetScreenSize()
     esccmd.CUP(Point(size.width(), 1))
     escio.Write("x")
     esccmd.DECFI()
     AssertScreenCharsInRectEqual(
         Rect(size.width() - 1, 1, size.width(), 1), ["x" + empty()])
Пример #7
0
 def prepare(self):
     esccmd.CUP(Point(1, 1))
     i = 1
     for line in self.data():
         # Protect odd-numbered rows
         esccmd.DECSCA(i)
         escio.Write(line + esc.CR + esc.LF)
         i = 1 - i
     esccmd.DECSCA(0)
Пример #8
0
 def test_DECBI_WholeScreenScrolls(self):
   """The spec is confusing and contradictory. It first says "If the cursor is
   at the left margin, then all screen data within the margin moves one column
   to the right" and then says "DECBI is not affected by the margins." I don't
   know what they could mean by the second part."""
   escio.Write("x")
   esccmd.CUP(Point(1, 1))
   esccmd.DECBI()
   AssertScreenCharsInRectEqual(Rect(1, 1, 2, 1), [ blank() + "x" ])
Пример #9
0
 def characters(self, point, count):
   if self._always_return_blank:
     return esc.blank() * count
   s = ""
   data = self.data()
   for i in xrange(count):
     p = Point(point.x() + i, point.y())
     if p.y() >= len(data):
       s += esc.blank()
       continue
     line = data[p.y() - 1]
     if p.x() >= len(line):
       s += esc.blank()
       continue
     if point.y() % 2 == 1:
       s += line[p.x() - 1]
     else:
       s += esc.blank()
   return s
Пример #10
0
    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()

        AssertScreenCharsInRectEqual(Rect(2, 3, 6, 7), [
            "abcde", "fhi" + empty() + "j", "kmn" + empty() + "o",
            "prs" + empty() + "t", "uvwxy"
        ])
Пример #11
0
 def test_DECFI_WholeScreenScrolls(self):
   """The spec is confusing and contradictory. It first says "If the cursor is
   at the right margin, then all screen data within the margin moves one column
   to the left" and then says "DECFI is not affected by the margins." I don't
   know what they could mean by the second part."""
   size = GetScreenSize()
   esccmd.CUP(Point(size.width(), 1))
   escio.Write("x")
   esccmd.DECFI()
   AssertScreenCharsInRectEqual(Rect(size.width() - 1, 1, size.width(), 1), [ "x" + NUL ])
Пример #12
0
    def test_DECBI_WholeScreenScrolls(self):
        """Test DECBI (back-index) when the cursor is before the left-margin, but
    at the left edge of the screen.

    Refer to DEC STD 070, which says if the cursor is outside the margins,
    at the left edge of the page (which xterm equates with its screen),
    the command is ignored."""
        escio.Write("x")
        esccmd.CUP(Point(1, 1))
        esccmd.DECBI()
        AssertScreenCharsInRectEqual(Rect(1, 1, 2, 1), [blank() + "x"])
Пример #13
0
 def characters(self, point, count):
     if self._always_return_blank:
         return esc.blank() * count
     s = ""
     data = self.data()
     for i in xrange(count):
         p = Point(point.x() + i, point.y())
         if p.y() >= len(data):
             s += esc.blank()
             continue
         line = data[p.y() - 1]
         if p.x() >= len(line):
             s += esc.blank()
             continue
         if point.y() % 2 == 1:
             s += line[p.x() - 1]
         else:
             s += esc.blank()
     return s
Пример #14
0
 def test_DECFI_Basic(self):
   esccmd.CUP(Point(5, 6))
   esccmd.DECFI()
   AssertEQ(GetCursorPosition(), Point(6, 6))
Пример #15
0
 def test_DECFI_RightOfMargin(self):
   esccmd.DECSET(esccmd.DECLRMM)
   esccmd.DECSLRM(3, 5)
   esccmd.CUP(Point(6, 1))
   esccmd.DECFI()
   AssertEQ(GetCursorPosition(), Point(7, 1))
Пример #16
0
 def test_DECBI_NoWrapOnLeftEdge(self):
   esccmd.CUP(Point(1, 2))
   esccmd.DECBI()
   AssertEQ(GetCursorPosition(), Point(1, 2))
Пример #17
0
 def test_DECFI_NoWrapOnRightEdge(self):
   size = GetScreenSize()
   esccmd.CUP(Point(size.width(), 2))
   esccmd.DECFI()
   AssertEQ(GetCursorPosition(), Point(size.width(), 2))
Пример #18
0
 def test_DECBI_LeftOfMargin(self):
   esccmd.DECSET(esccmd.DECLRMM)
   esccmd.DECSLRM(3, 5)
   esccmd.CUP(Point(2, 1))
   esccmd.DECBI()
   AssertEQ(GetCursorPosition(), Point(1, 1))
Пример #19
0
 def test_DECALN_MovesCursorHome(self):
     esccmd.CUP(Point(5, 5))
     esccmd.DECALN()
     AssertEQ(GetCursorPosition(), Point(1, 1))