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)
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())
def test_XtermWinops_MaximizeWindow_Vertically(self): display_size = GetDisplaySize() original_size = GetScreenSize() expected_size = Size(width=original_size.width(), height=display_size.height()) esccmd.XTERM_WINOPS(esccmd.WINOP_MAXIMIZE, esccmd.WINOP_MAXIMIZE_V) AssertEQ(GetScreenSize(), expected_size)
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())
def test_XtermWinops_ResizeChars_ZeroHeight(self): """Resize the window to a character size, setting one param to 0 (max size in that direction).""" maximum_size = GetDisplaySize() original_size = GetScreenSize() if escargs.args.expected_terminal == "xterm": desired_size = Size(original_size.width(), maximum_size.height()) else: desired_size = Size(20, maximum_size.height()) esccmd.XTERM_WINOPS(esccmd.WINOP_RESIZE_CHARS, 0, desired_size.width()) self.DelayAfterResize() limit = self.GetCharErrorLimit() limit = Size(0, limit.height()) self.CheckActualSizeChars(desired_size, limit)
def test_XtermWinops_ResizeChars_ZeroHeight(self): """Resize the window to a character size, setting one param to 0 (max size in that direction).""" max_size = GetDisplaySize() desired_size = Size(20, max_size.height()) esccmd.XTERM_WINOPS(esccmd.WINOP_RESIZE_CHARS, 0, desired_size.width()) AssertEQ(GetScreenSize(), desired_size)