A press with the middle (or any other non-left) mouse button never reaches the Studio's drag, place or select handlers: dragging pans the view even on a selected object or while placing, and a click selects nothing. A middle click no longer starts the browser's autoscroll. check_studio covers a middle-drag on the selected truck (it stays put, the view moves), a middle click on another object (the selection is kept), and a middle-drag while placing (nothing is placed).
This commit is contained in:
1 parent
95ea4a8512
commit
7962249191
3 files changed
+48
-4
No files matched your search
@@ -198,6 +198,43 @@ with sync_playwright() as p:
|
||||
pg.evaluate("__studio.select(null)")
|
||||
pg.wait_for_timeout(400)
|
||||
|
||||
# the middle mouse button only moves the camera: it never drags, selects or places anything
|
||||
pg.locator('#objects li[data-id="truck"]').click()
|
||||
pg.evaluate("__studio.view.focus('truck', 3)")
|
||||
pg.wait_for_timeout(400)
|
||||
t0 = obj("truck")
|
||||
p0 = at(t0["x"], t0["y"])
|
||||
tb = pg.locator('.iso-svg g[data-obj="truck"] path.iso-t').first.bounding_box()
|
||||
mx, my = tb["x"] + tb["width"] / 2, tb["y"] + tb["height"] / 2
|
||||
pg.mouse.move(mx, my)
|
||||
pg.mouse.down(button="middle")
|
||||
for i in range(1, 11):
|
||||
pg.mouse.move(mx + 8 * i, my + 5 * i)
|
||||
pg.wait_for_timeout(15)
|
||||
pg.mouse.up(button="middle")
|
||||
pg.wait_for_timeout(600)
|
||||
t1, p1 = obj("truck"), at(t0["x"], t0["y"])
|
||||
check((t1["x"], t1["y"]) == (t0["x"], t0["y"]) and abs(p1[0] - p0[0] - 80) < 3 and abs(p1[1] - p0[1] - 50) < 3,
|
||||
f"a middle-drag on the selected truck pans the view and leaves the truck where it was (moved {p1[0] - p0[0]:.0f}, {p1[1] - p0[1]:.0f} px)")
|
||||
gb = pg.locator('.iso-svg g[data-obj="genset"] path.iso-t').first.bounding_box()
|
||||
pg.mouse.click(gb["x"] + gb["width"] / 2, gb["y"] + gb["height"] / 2, button="middle")
|
||||
pg.wait_for_timeout(400)
|
||||
check(pg.evaluate("__studio.S.sel") == "truck", "a middle click on another object does not select it")
|
||||
n2 = len(doc()["objects"])
|
||||
pg.locator('.st-tile[data-type="tree"]').click()
|
||||
pg.mouse.move(mx, my)
|
||||
pg.mouse.down(button="middle")
|
||||
for i in range(1, 11):
|
||||
pg.mouse.move(mx - 8 * i, my - 5 * i)
|
||||
pg.wait_for_timeout(15)
|
||||
pg.mouse.up(button="middle")
|
||||
pg.wait_for_timeout(600)
|
||||
check(len(doc()["objects"]) == n2 and pg.evaluate("__studio.S.placing") == "tree",
|
||||
"while placing, a middle-drag pans and places nothing")
|
||||
pg.keyboard.press("Escape")
|
||||
pg.evaluate("__studio.select(null)")
|
||||
pg.wait_for_timeout(300)
|
||||
|
||||
# an agent edits over MCP: the open Studio follows
|
||||
init = mcp({"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {"protocolVersion": "2025-06-18", "capabilities": {}, "clientInfo": {"name": "test", "version": "0"}}})
|
||||
check(init["result"]["serverInfo"]["name"] == "isokit", "MCP initialize")
|
||||
|
||||
Reference in new issue
Block a user