fix: test fix to change clicks to box drawing

This commit is contained in:
Zoe
2026-09-21 00:04:35 -05:00
parent d4b5ea0254
commit 4b08ce05a4
5 changed files with 37 additions and 8 deletions
+19 -1
View File
@@ -25,6 +25,20 @@ def integer(value, low, high):
def click_pixels(action, width, height, space):
if "ymin" in action or "xmin" in action or "ymax" in action or "xmax" in action:
if space == "normalized_1000":
ymin = integer(action.get("ymin"), 0, 1000)
xmin = integer(action.get("xmin"), 0, 1000)
ymax = integer(action.get("ymax"), 0, 1000)
xmax = integer(action.get("xmax"), 0, 1000)
x = (xmin + xmax) // 2
y = (ymin + ymax) // 2
return (x * (width - 1) + 500) // 1000, (y * (height - 1) + 500) // 1000
ymin = integer(action.get("ymin"), 0, height - 1)
xmin = integer(action.get("xmin"), 0, width - 1)
ymax = integer(action.get("ymax"), 0, height - 1)
xmax = integer(action.get("xmax"), 0, width - 1)
return (xmin + xmax) // 2, (ymin + ymax) // 2
if space == "normalized_1000":
x = integer(action.get("x"), 0, 1000)
y = integer(action.get("y"), 0, 1000)
@@ -150,7 +164,11 @@ def main():
button = {"left": "1", "middle": "2", "right": "3"}[action.get("button", "left")]
x, y = click_pixels(action, width, height, space)
run("xdotool", "mousemove", "--sync", str(x), str(y), "click", button)
clicks.append({"supplied": [action["x"], action["y"]], "pixels": [x, y]})
if "ymin" in action or "xmin" in action or "ymax" in action or "xmax" in action:
supplied = [action["ymin"], action["xmin"], action["ymax"], action["xmax"]]
else:
supplied = [action["x"], action["y"]]
clicks.append({"supplied": supplied, "pixels": [x, y]})
elif kind == "click_target":
saved = json.loads((STATE / "targets.json").read_text())
current = accessibility.collect(width, height)