Target the rendered Tools grip in Wayland QA

This commit is contained in:
Codex
2026-12-01 18:50:39 +01:00
parent db98991784
commit a425be0334
+33 -5
View File
@@ -85,8 +85,13 @@ with connection, connection.makefile("rwb") as stream:
evidence = {"shell": matches[0]["shell"], "window": window, "client": client, "view_size": [width, height], "panels": {},
"scope": "physical pointer move; redock by command, not pointer"}
failures = []
for panel in ("tools", "layers"):
for panel in ("layers", "tools"):
try:
if panel == "tools":
# The single-column rail is almost as tall as the viewport and cannot
# travel vertically. Use the same two-column setting as the UI.
call("engine.execute", command="window.toolbarColumns", params={"double": True})
time.sleep(0.5)
call("engine.execute", command="window.panel.float", params={"panel": panel, "x": 400, "y": 180})
time.sleep(1)
before = floating(panel)
@@ -106,12 +111,18 @@ with connection, connection.makefile("rwb") as stream:
# use a point near the leading edge, not the centre of its possibly stale width.
bands = [n["rect"] for n in nodes if n.get("name") == "Move panel window" and n.get("rect")
and abs(n["rect"][0] - x) < 30 and abs(n["rect"][1] - y) < 40]
if bands:
grips = [n["rect"] for n in nodes if n.get("name") == "Tools" and n.get("role") == "Button" and n.get("rect")]
if panel == "tools":
if len(grips) != 1:
raise RuntimeError(f"expected one Tools dock grip, found {grips}")
gx, gy, gw, gh = grips[0]
point = (gx + gw / 2, gy + gh / 2)
elif bands:
bx, by, bw, bh = bands[0]
point = (bx + bw / 2, by + bh / 2)
else:
point = (x + min(20, w / 2), y + 15)
evidence["panels"][panel] = {"before": before, "attempt_point": point, "move_bands": bands}
evidence["panels"][panel] = {"before": before, "attempt_point": point, "move_bands": bands, "tools_grips": grips}
(out / "docking.json").write_text(json.dumps(evidence, indent=2))
seat_snapshot(f"{panel}-before")
drag(panel, *point, 110, 90)
@@ -119,11 +130,27 @@ with connection, connection.makefile("rwb") as stream:
after = floating(panel)
evidence["panels"][panel]["after"] = after
(out / "docking.json").write_text(json.dumps(evidence, indent=2))
if abs(after[0] - before[0]) < 30 or abs(after[1] - before[1]) < 30:
if panel == "tools":
after_nodes = []
for index in range(8):
try:
after_nodes.append(call("ui.find", name="Tools", index=index))
except RuntimeError:
break
after_grips = [n["rect"] for n in after_nodes if n.get("role") == "Button" and n.get("rect")]
evidence["panels"][panel]["after_tools_grips"] = after_grips
(out / "docking.json").write_text(json.dumps(evidence, indent=2))
if len(after_grips) != 1 or any(abs(after_grips[0][i] - grips[0][i]) < 30 for i in (0, 1)):
raise RuntimeError(f"Tools rendered grip did not move on both axes: {grips} -> {after_grips}")
elif abs(after[0] - before[0]) < 30 or abs(after[1] - before[1]) < 30:
raise RuntimeError(f"{panel} did not move from title/grip: {before} -> {after}")
if after[0] < 0 or after[1] < 0 or after[0] + after[2] > width or after[1] + after[3] > height:
raise RuntimeError(f"{panel} left the app window: {after}")
subprocess.run(["grim", str(out / f"{panel}.png")], check=True)
if panel == "tools":
# The panel command does not permit Tools redocking. The test stops
# with it floating; this is not a pointer-redock assertion.
continue
# No stable drop target geometry is exposed by this candidate. This verifies the
# command redock state; it is not evidence that a pointer drop redocks.
call("engine.execute", command="window.panel.dock", params={"panel": panel})
@@ -141,7 +168,8 @@ with connection, connection.makefile("rwb") as stream:
(out / "docking.json").write_text(json.dumps(evidence, indent=2))
try:
seat_snapshot(f"{panel}-failure")
call("engine.execute", command="window.panel.dock", params={"panel": panel})
if panel != "tools":
call("engine.execute", command="window.panel.dock", params={"panel": panel})
except Exception as cleanup_error:
failures.append(f"{panel} cleanup: {cleanup_error}")
(out / "docking.json").write_text(json.dumps(evidence, indent=2))