コード例 #1
0
  def test_XtermWinops_ResizePixels_ZeroHeight(self):
    """Resize the window to a pixel size, setting one parameter to 0. The
    window should maximize in the direction of the 0 parameter."""
    original_size = GetWindowSizePixels()

    # Set height and maximize width.
    desired_width = 400
    esccmd.XTERM_WINOPS(esccmd.WINOP_RESIZE_PIXELS,
                            0,
                            desired_width)

    # Make sure the height changed as requested.
    max_error = 20
    actual_size = GetWindowSizePixels()
    AssertTrue(abs(actual_size.width() - desired_width) < max_error)

    # See if the height is about as big as the display (only measurable in
    # characters, not pixels).
    display_size = GetDisplaySize()  # In characters
    screen_size = GetScreenSize()  # In characters
    max_error = 5
    AssertTrue(abs(display_size.height() - screen_size.height()) < max_error)

    # Restore to original size.
    esccmd.XTERM_WINOPS(esccmd.WINOP_RESIZE_PIXELS,
                            original_size.height(),
                            original_size.width())
コード例 #2
0
    def CheckForShrinkage(self, original_size, actual_size):
        """After resizing the screen, check if it became smaller.

    The window could become smaller due to a miscomputation,
    since the requested size (perhaps in floating point)
    is truncated to integer values."""
        self.DebugSize("check shrink ", actual_size)
        AssertTrue(actual_size.width() >= original_size.width())
        AssertTrue(actual_size.height() >= original_size.height())
コード例 #3
0
ファイル: xterm_winops.py プロジェクト: migueldeicaza/esctest
 def CheckAnySize(self, desired_size, actual_size, limit):
   """After resizing a window, check if its actual size is within the test's
   limits of the desired size."""
   self.DebugSize("actual  size ", actual_size)
   self.DebugSize("desired size ", desired_size)
   error = Size(abs(actual_size.width() - desired_size.width()),
                abs(actual_size.height() - desired_size.height()))
   self.DebugSize("error limit  ", limit)
   self.DebugSize("actual error ", error)
   AssertTrue(error.width() <= (limit.width()))
   AssertTrue(error.height() <= (limit.height()), "actual size=%s, desired size=%s, error limit=%s, actual error=%s" % (str(actual_size), str(desired_size), str(limit), str(error)))
コード例 #4
0
ファイル: xterm_winops.py プロジェクト: migueldeicaza/esctest
  def test_XtermWinops_ResizePixels_ZeroWidth(self):
    """Resize the window to a pixel size, setting one parameter to 0. The
    window should maximize in the direction of the 0 parameter."""
    if escargs.args.expected_terminal == "xterm":
      maximum_size = GetScreenSizePixels()
      original_size = GetWindowSizePixels()

      # Set height and maximize width.
      desired_size = Size(maximum_size.width(),
                          self.AverageHeight(maximum_size, original_size))
      esccmd.XTERM_WINOPS(esccmd.WINOP_RESIZE_PIXELS,
                          desired_size.height(),
                          0)
      self.DelayAfterResize()
      self.CheckActualSizePixels(desired_size)

      # See if the width is about as big as the display (only measurable in
      # characters, not pixels).
      display_size = GetDisplaySize()  # In characters
      screen_size = GetScreenSize()  # In characters
      max_error = 5
      AssertTrue(abs(display_size.width() - screen_size.width()) < max_error)

      # Restore to original size.
      esccmd.XTERM_WINOPS(esccmd.WINOP_RESIZE_PIXELS,
                          original_size.height(),
                          original_size.width())
      self.DelayAfterResize()
    else:
      original_size = GetWindowSizePixels()

      # Set height and maximize width.
      desired_height = 200
      esccmd.XTERM_WINOPS(esccmd.WINOP_RESIZE_PIXELS,
                          desired_height,
                          0)

      # Make sure the height changed as requested.
      max_error = 20
      actual_size = GetWindowSizePixels()
      AssertTrue(abs(actual_size.height() - desired_height) < max_error)

      # See if the width is about as big as the display (only measurable in
      # characters, not pixels).
      display_size = GetDisplaySize()  # In characters
      screen_size = GetScreenSize()  # In characters
      max_error = 5
      AssertTrue(abs(display_size.width() - screen_size.width()) < max_error)

      # Restore to original size.
      esccmd.XTERM_WINOPS(esccmd.WINOP_RESIZE_PIXELS,
                          original_size.height(),
                          original_size.width())
コード例 #5
0
  def test_XtermWinops_Fullscreen(self):
    original_size = GetScreenSize()
    display_size = GetDisplaySize()

    # Enter fullscreen
    esccmd.XTERM_WINOPS(esccmd.WINOP_FULLSCREEN,
                            esccmd.WINOP_FULLSCREEN_ENTER)
    time.sleep(1)
    actual_size = GetScreenSize()
    AssertTrue(actual_size.width() >= display_size.width())
    AssertTrue(actual_size.height() >= display_size.height())

    AssertTrue(actual_size.width() >= original_size.width())
    AssertTrue(actual_size.height() >= original_size.height())

    # Exit fullscreen
    esccmd.XTERM_WINOPS(esccmd.WINOP_FULLSCREEN,
                            esccmd.WINOP_FULLSCREEN_EXIT)
    AssertEQ(GetScreenSize(), original_size)

    # Toggle in
    esccmd.XTERM_WINOPS(esccmd.WINOP_FULLSCREEN,
                            esccmd.WINOP_FULLSCREEN_TOGGLE)
    AssertTrue(actual_size.width() >= display_size.width())
    AssertTrue(actual_size.height() >= display_size.height())

    AssertTrue(actual_size.width() >= original_size.width())
    AssertTrue(actual_size.height() >= original_size.height())

    # Toggle out
    esccmd.XTERM_WINOPS(esccmd.WINOP_FULLSCREEN,
                            esccmd.WINOP_FULLSCREEN_TOGGLE)
    AssertEQ(GetScreenSize(), original_size)
コード例 #6
0
 def test_DECSCL_Level2DoesntSupportDECRQM(self):
     """VT level 2 does not support DECRQM."""
     escio.Write("Hello world.")
     GetScreenSize()
     esccmd.DECSCL(62, 1)
     GetScreenSize()
     # Make sure DECRQM fails.
     try:
         esccmd.DECRQM(esccmd.IRM, DEC=False)
         escio.ReadCSI('$y')
         # Should not get here.
         AssertTrue(False)
     except InternalError, e:
         # Assert something so the test infrastructure is happy.
         AssertTrue(True)
コード例 #7
0
    def test_ChangeSpecialColor_Multiple2(self):
        """OSC 5 ; c1 ; spec1 ; s2 ; spec2 ; ST"""
        esccmd.ChangeSpecialColor2("0", "rgb:f0f0/f0f0/f0f0", "1",
                                   "rgb:f0f0/0000/0000")
        esccmd.ChangeSpecialColor2("0", "?", "1", "?")
        AssertTrue(escio.ReadOSC("5") in [";0;rgb:f0f0/f0f0/f0f0"])
        AssertTrue(escio.ReadOSC("5") in [";1;rgb:f0f0/0000/0000"])

        esccmd.ChangeSpecialColor2("0", "rgb:8080/8080/8080", "1",
                                   "rgb:8080/0000/0000")
        esccmd.ChangeSpecialColor2("0", "?", "1", "?")
        AssertTrue(escio.ReadOSC("5") in [";0;rgb:8080/8080/8080"])
        s = escio.ReadOSC("5")
        LogInfo("Read: " + s)
        AssertTrue(s in [";1;rgb:8080/0000/0000"])
コード例 #8
0
ファイル: decdsr.py プロジェクト: migueldeicaza/esctest
    def test_DECDSR_DSRMultipleSessionStatus(self):
        """Checks on the status of multiple sessons. SSU refers to some proprietary
    DEC technology that multilexes multiple sessions over a single link using
    the "TDSMP" protocol. Lots of detail here:
    http://paperlined.org/apps/terminals/control_characters/TDSMP.html

    It's safe to assume TDSMP is dead and buried.

    CSI ? 80 ; Ps2 n
      Multiple sessions are operating using the session support utility (SSU)
      and the current SSU state is enabled. Ps2 indicates the maximum number of
      sessions available. Default: Ps2 = 2
    CSI ? 81 ; Ps2 n
      The terminal is currently configured for multiple sessions using SSU but
      the current SSU state is pending. Ps2 indicates the maximum number of
      sessions available. Default: Ps2 = 2
    CSI ? 83 n
      The terminal is not configured for multiple-session operation.
    CSI ? 87 n
      Multiple sessions are operating using a separate physical line for each
      session, not SSU."""
        esccmd.DECDSR(esccmd.DSRMultipleSessionStatus)
        params = escio.ReadCSI('n', expected_prefix='?')
        AssertEQ(len(params), 1)
        # 83 and 87 both seem like reasonable responses for a terminal that
        # supports tabs or windows.
        AssertTrue(params[0] in [83, 87])
コード例 #9
0
 def handleDAResponse(self):
   params = escio.ReadCSI('c', expected_prefix='?')
   if escargs.args.expected_terminal == "xterm":
     # This is for a default build. There are various options that could
     # change this, both compile-time and run-time.  XTerm's control sequences
     # document lists the ones it may return.  For a more comprehensive list,
     # see DEC STD 070, page 4.
     if escargs.args.max_vt_level == 5:
       expected = [65, 1, 2, 6, 9, 15, 16, 17, 18, 21, 22, 28, 29]
     elif escargs.args.max_vt_level == 4:
       expected = [64, 1, 2, 6, 9, 15, 16, 17, 18, 21, 22, 28, 29]
     elif escargs.args.max_vt_level == 3:
       expected = [63, 1, 2, 6, 9, 15, 22, 29]
     elif escargs.args.max_vt_level == 2:
       expected = [62, 1, 2, 6, 9, 15, 22, 29]
     elif escargs.args.max_vt_level == 1:
       expected = [1, 2] # xterm extension (VT100)
     else:
       expected = [0] # xterm extension
   elif escargs.args.expected_terminal == "iTerm2":
     # TODO:  Determine which VT levels are completely supported and add 6,
     # 62, 63, or 64.
     # I believe 18 means we support DECSTB and DECSLRM but I can't find any
     # evidence to substantiate this belief.
     expected = [1, 2, 18, 22]
   # Our interest in the primary device attributes is to ensure that the
   # terminal asserts that it supports the features we need.  It may support
   # other features; without a detailed analysis we cannot determine which
   # additional features are inappropriate, e.g, rectangular editing on VT320.
   AssertGE(len(params), len(expected))
   AssertEQ(params[0], expected[0])
   for param in expected:
     AssertTrue(param in params)
コード例 #10
0
ファイル: decdsr.py プロジェクト: migueldeicaza/esctest
    def doLocatorStatusTest(self, code):
        """I couldn't find docs on these codes outside xterm. 53 and 55 seem to be
    the same. Returns 50 if no locator, 53 if available."""
        esccmd.DECDSR(code)
        params = escio.ReadCSI('n', expected_prefix='?')

        AssertEQ(len(params), 1)
        AssertTrue(params[0] in [50, 53, 55])
コード例 #11
0
 def doChangeSpecialColorTest(self, c, value, rgb):
     esccmd.ChangeSpecialColor(c, value)
     esccmd.ChangeSpecialColor(c, "?")
     s = escio.ReadOSC("4")
     AssertTrue(s in [
         ";" + str(int(c) + 16) + ";rgb:" + rgb, ";" + str(int(c) + 256) +
         ";rgb:" + rgb
     ])
コード例 #12
0
ファイル: decdsr.py プロジェクト: migueldeicaza/esctest
    def test_DECDSR_LocatorType(self):
        """Get the type of the locator (pointing device.)
    0 - unknown (not documented)
    1 - mouse
    2 - tablet"""
        esccmd.DECDSR(esccmd.DSRLocatorId)
        params = escio.ReadCSI('n', expected_prefix='?')

        AssertEQ(params[0], 57)
        AssertTrue(params[1] in [0, 1, 2])
コード例 #13
0
ファイル: decid.py プロジェクト: unixfreaxjp/Therm
    def test_DECID_8bit(self):
        escio.use8BitControls = True
        escio.Write(S8C1T)

        esccmd.DECID()
        params = escio.ReadCSI("c", expected_prefix="?")
        AssertTrue(len(params) > 0)

        escio.Write(S7C1T)
        escio.use8BitControls = False
コード例 #14
0
ファイル: decdsr.py プロジェクト: migueldeicaza/esctest
 def test_DECDSR_DSRKeyboard(self):
     """Gets info about the keyboard. The response is:
   CSI ? 27; Pn; Pst; Ptyp n
 Where
   Pn - Keyboard language
     0 - Not known
     1 - North American
     2...19, 22, 28, 29...31, 33, 35, 36, 38...40 - Various other legal values
   Pst - Keyboard status - Per the VT 510 manual, this is level 4 only.
         However, it is documented in "VT330/VT340 Programmer Reference Manual
         Volume 1: Text Programming".
     0 - Ready
     3 - No keyboard
     8 - Keyboard busy in other session
   Ptyp - Keyboard type - VT level 4 only
     0 - LK201  # DEC 420
     1 - LK401  # DEC 420
     4 - LK450  # DEC 510
     5 - PCXAL  # DEC 510"""
     # First get the VT level with a DA2
     myLevel = self.getVTLevel()
     esccmd.DECDSR(esccmd.DSRKeyboard)
     params = escio.ReadCSI('n', expected_prefix='?')
     if myLevel <= 2:
         # VT240 or earlier
         AssertEQ(len(params), 2)
     elif myLevel == 3:
         # VT340 or earlier
         AssertEQ(len(params), 3)
     else:
         # VT420+
         AssertEQ(len(params), 4)
     AssertEQ(params[0], 27)
     if len(params) > 1:
         AssertTrue(params[1] in [
             0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
             18, 19, 22, 28, 29, 30, 31, 33, 35, 36, 38, 39, 40
         ])
     if len(params) > 2:
         AssertTrue(params[2] in [0, 3, 8])
     if len(params) > 3:
         AssertTrue(params[3] in [0, 1, 4, 5])
コード例 #15
0
  def test_XtermWinops_ResizePixels_BothParameters(self):
    """Resize the window to a pixel size, giving both parameters."""
    original_size = GetWindowSizePixels()
    desired_size = Size(400, 200)

    esccmd.XTERM_WINOPS(esccmd.WINOP_RESIZE_PIXELS,
                            desired_size.height(),
                            desired_size.width())
    # See if we're within 20px of the desired size on each dimension. It won't
    # be exact because most terminals snap to grid.
    actual_size = GetWindowSizePixels()
    error = Size(abs(actual_size.width() - desired_size.width()),
                 abs(actual_size.height() - desired_size.height()))
    max_error = 20
    AssertTrue(error.width() <= max_error)
    AssertTrue(error.height() <= max_error)

    esccmd.XTERM_WINOPS(esccmd.WINOP_RESIZE_PIXELS,
                            original_size.height(),
                            original_size.width())
コード例 #16
0
  def test_XtermWinops_ResizePixels_OmittedWidth(self):
    """Resize the window to a pixel size, omitting one parameter. The size
    should not change in the direction of the omitted parameter."""
    original_size = GetWindowSizePixels()
    desired_size = Size(original_size.width(), 200)

    esccmd.XTERM_WINOPS(esccmd.WINOP_RESIZE_PIXELS,
                            desired_size.height())
    # See if we're within 20px of the desired size. It won't be exact because
    # most terminals snap to grid.
    actual_size = GetWindowSizePixels()
    error = Size(abs(actual_size.width() - desired_size.width()),
                 abs(actual_size.height() - desired_size.height()))
    max_error = 20
    AssertTrue(error.width() <= max_error)
    AssertTrue(error.height() <= max_error)

    esccmd.XTERM_WINOPS(esccmd.WINOP_RESIZE_PIXELS,
                            original_size.height(),
                            original_size.width())
コード例 #17
0
ファイル: decdsr.py プロジェクト: migueldeicaza/esctest
 def test_DECDSR_DSRUDKLocked(self):
     """Tests if user-defined keys are locked or unlocked. The allowed repsonses are:
   CSI ? Pn n
 Where Pn is:
   20 - Unlocked
   21 - Locked
 This test simply ensures the value is legal. It should be extended to
 ensure that when locked UDKs are not settable, and when unlocked that UDKs
 are settable."""
     esccmd.DECDSR(esccmd.DSRUDKLocked)
     params = escio.ReadCSI('n', expected_prefix='?')
     AssertEQ(len(params), 1)
     AssertTrue(params[0] in [20, 21])
コード例 #18
0
ファイル: decdsr.py プロジェクト: migueldeicaza/esctest
 def test_DECDSR_DSRPrinterPort(self):
     """Requests printer status. The allowed responses are:
     CSI ? Pn n
   Where Pn is:
     10 - Ready
     11 - Not ready
     13 - No printer
     18 - Busy
     19 - Assigned to other session.
   There's no way for the test to know what the actual printer status is,
   but the response should be legal."""
     esccmd.DECDSR(esccmd.DSRPrinterPort)
     params = escio.ReadCSI('n', expected_prefix='?')
     AssertEQ(len(params), 1)
     AssertTrue(params[0] in [10, 11, 13, 18, 19])
コード例 #19
0
 def doChangeSpecialColorTest2(self, c, value, rgb):
     esccmd.ChangeSpecialColor2(c, value)
     esccmd.ChangeSpecialColor2(c, "?")
     s = escio.ReadOSC("5")
     AssertTrue(s in [";" + str(int(c)) + ";rgb:" + rgb])
コード例 #20
0
ファイル: decid.py プロジェクト: unixfreaxjp/Therm
 def test_DECID_Basic(self):
     esccmd.DECID()
     params = escio.ReadCSI("c", expected_prefix="?")
     AssertTrue(len(params) > 0)