test(docks): assert that a dock receives the clicks at any edge
CI / check (pull_request) Successful in 5m44s
CI / check (pull_request) Successful in 5m44s
The mouse handling of the docked windows had no test: the existing dock tests only checked the regions the layout carves, and nothing checked which window the clicks are routed to, so a click lost on a right dock could not be caught by the test suite. The two windows of a tab are now hit tested with their own areas, in both orders, so the same point on a right dock and on a left dock must resolve to the dock. The layout tests also pin the position of a right dock, which previously only had its width and its containment checked. Refs #44
This commit is contained in:
3 files changed
+109
No files matched your search
@@ -126,6 +126,16 @@ class TestDocks(BaseTest):
|
||||
content, placements = carve_docks(Region((0, 0, -1, -1, 0, 0)), groups, CELL_WIDTH, CELL_HEIGHT)
|
||||
self.ae([r.height for g, r in placements], [0, 0])
|
||||
|
||||
# A dock at the right is placed against the right edge of what remains,
|
||||
# the same way a dock at the left is placed against the left edge
|
||||
groups = []
|
||||
left, right = dock('left', '10%'), dock('right', '5%')
|
||||
content, placements = carve_docks(VIEWPORT, groups, CELL_WIDTH, CELL_HEIGHT)
|
||||
regions = {g.id: rect(r) for g, r in placements}
|
||||
self.ae(regions[left.id], (0, 0, 100, 600))
|
||||
self.ae(regions[right.id], (950, 0, 1000, 600))
|
||||
self.ae(rect(content), (100, 0, 950, 600))
|
||||
|
||||
def test_tab_docks(self):
|
||||
q = make_layout(Tall)
|
||||
windows = make_windows(q, 2)
|
||||
@@ -183,6 +193,9 @@ class TestDocks(BaseTest):
|
||||
self.assertTrue(rect(r)[0] >= allocated.left and rect(r)[2] <= allocated.left + allocated.width)
|
||||
self.ae(rect(dock_regions[0])[1], allocated.top + allocated.height - 2 * CELL_HEIGHT - 2 * DECORATION)
|
||||
self.ae(dock_regions[1].width, allocated.width // 4)
|
||||
# The dock at the right sits past the content, at the right of the area
|
||||
self.assertGreaterEqual(rect(dock_regions[1])[0], rect(content)[2])
|
||||
self.assertLessEqual(rect(dock_regions[1])[2], allocated.left + allocated.width)
|
||||
self.check_no_overlaps(windows)
|
||||
# The decorations chosen by the layout for the owner are preserved
|
||||
self.ae(main.geometry.spaces.left - main.geometry.compensatory.left, DECORATION)
|
||||
|
||||
Reference in new issue
Block a user