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."""
    if escargs.args.expected_terminal == "xterm":
      maximum_size = GetScreenSizePixels()
      original_size = GetWindowSizePixels()

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

      # 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())
      self.DelayAfterResize()
    else:
      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())
Exemple #2
0
    def test_XtermWinops_ResizePixels_OmittedHeight(self):
        """Resize the window to a pixel size, omitting one parameter. The size
    should not change in the direction of the omitted parameter."""
        maximum_size = GetScreenSizePixels()
        original_size = GetWindowSizePixels()

        if escargs.args.expected_terminal == "xterm":
            desired_size = Size(maximum_size.width(), original_size.height())
        else:
            desired_size = Size(400, original_size.height())

        esccmd.XTERM_WINOPS(esccmd.WINOP_RESIZE_PIXELS, None,
                            desired_size.width())
        self.DelayAfterResize()
        self.CheckActualSizePixels(desired_size)

        esccmd.XTERM_WINOPS(esccmd.WINOP_RESIZE_PIXELS, original_size.height(),
                            original_size.width())
        self.DelayAfterResize()
Exemple #3
0
    def test_XtermWinops_ResizePixels_BothParameters(self):
        """Resize the window to a pixel size, giving both parameters."""
        maximum_size = GetScreenSizePixels()
        original_size = GetWindowSizePixels()
        if escargs.args.expected_terminal == "xterm":
            desired_size = Size(
                self.AverageWidth(maximum_size, original_size),
                self.AverageHeight(maximum_size, original_size))
        else:
            desired_size = Size(400, 200)

        esccmd.XTERM_WINOPS(esccmd.WINOP_RESIZE_PIXELS, desired_size.height(),
                            desired_size.width())
        self.DelayAfterResize()
        self.CheckActualSizePixels(desired_size)

        esccmd.XTERM_WINOPS(esccmd.WINOP_RESIZE_PIXELS, original_size.height(),
                            original_size.width())
        self.DelayAfterResize()