mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-18 06:25:13 +02:00
Some tests for splits layout
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
from kitty.config import defaults
|
||||
from kitty.fast_data_types import pt_to_px
|
||||
from kitty.layout import Horizontal, Stack, Tall, Grid, idx_for_id
|
||||
from kitty.layout import Horizontal, Stack, Tall, Grid, idx_for_id, Splits
|
||||
from kitty.constants import WindowGeometry
|
||||
|
||||
from . import BaseTest
|
||||
@@ -183,3 +183,17 @@ class TestLayout(BaseTest):
|
||||
for layout_class in (Stack, Horizontal, Tall, Grid):
|
||||
q = create_layout(layout_class)
|
||||
self.do_overlay_test(q)
|
||||
|
||||
def test_splits(self):
|
||||
q = create_layout(Splits)
|
||||
all_windows = []
|
||||
self.ae(0, q.add_window(all_windows, Window(1), -1))
|
||||
self.ae(1, q.add_window(all_windows, Window(2), 0, location='vsplit'))
|
||||
self.ae(q.pairs_root.pair_for_window(2).horizontal, True)
|
||||
self.ae(2, q.add_window(all_windows, Window(3), 1, location='hsplit'))
|
||||
self.ae(q.pairs_root.pair_for_window(2).horizontal, False)
|
||||
self.ae(3, q.add_window(all_windows, Window(4), 2, location='vsplit'))
|
||||
self.ae(q.neighbors_for_window(all_windows[0], all_windows), {'left': [], 'right': [2, 3], 'top': [], 'bottom': []})
|
||||
self.ae(q.neighbors_for_window(all_windows[1], all_windows), {'left': [1], 'right': [], 'top': [], 'bottom': [3, 4]})
|
||||
self.ae(q.neighbors_for_window(all_windows[2], all_windows), {'left': [1], 'right': [4], 'top': [2], 'bottom': []})
|
||||
self.ae(q.neighbors_for_window(all_windows[3], all_windows), {'left': [3], 'right': [], 'top': [2], 'bottom': []})
|
||||
|
||||
Reference in New Issue
Block a user