mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-24 01:08:10 +02:00
A new remote control command to resize OS Windows
This commit is contained in:
@@ -12,6 +12,34 @@ is_macos = 'darwin' in _plat
|
||||
|
||||
class TestGLFW(BaseTest):
|
||||
|
||||
def test_os_window_size_calculation(self):
|
||||
from kitty.utils import get_new_os_window_size
|
||||
|
||||
def t(w, h, width=0, height=0, unit='cells', incremental=False):
|
||||
self.ae((w, h), get_new_os_window_size(metrics, width, height, unit, incremental, has_window_scaling))
|
||||
|
||||
with self.subTest(has_window_scaling=False):
|
||||
has_window_scaling = False
|
||||
metrics = {
|
||||
'width': 200, 'height': 100,
|
||||
'framebuffer_width': 200, 'framebuffer_height': 100,
|
||||
'xscale': 2.0, 'yscale': 2.0, 'xdpi': 192.0, 'ydpi': 192.0,
|
||||
'cell_width': 8, 'cell_height': 16
|
||||
}
|
||||
t(80 * metrics['cell_width'], 100, 80)
|
||||
t(80 * metrics['cell_width'] + metrics['width'], 100, 80, incremental=True)
|
||||
t(1217, 100, 1217, unit='pixels')
|
||||
t(1217 + metrics['width'], 100, 1217, unit='pixels', incremental=True)
|
||||
|
||||
with self.subTest(has_window_scaling=True):
|
||||
has_window_scaling = True
|
||||
metrics['framebuffer_width'] = metrics['width'] * 2
|
||||
metrics['framebuffer_height'] = metrics['height'] * 2
|
||||
t(80 * metrics['cell_width'] / metrics['xscale'], 100, 80)
|
||||
t(80 * metrics['cell_width'] / metrics['xscale'] + metrics['width'], 100, 80, incremental=True)
|
||||
t(1217, 100, 1217, unit='pixels')
|
||||
t(1217 + metrics['width'], 100, 1217, unit='pixels', incremental=True)
|
||||
|
||||
@unittest.skipIf(is_macos, 'Skipping test on macOS because glfw-cocoa.so is not built with backend_utils')
|
||||
def test_utf_8_strndup(self):
|
||||
import ctypes
|
||||
|
||||
Reference in New Issue
Block a user