Skip to content

Commit

Permalink
test: Implement "contextmenu" mouse event for BiDi
Browse files Browse the repository at this point in the history
cockpit-podman uses this. Conceptually this is strange, as mouses don't
have a "context menu" button -- they have a right button (aka `btn=2`).
But this does not work with `ph_mouse()`, so translate it to a right
click.
  • Loading branch information
martinpitt committed Aug 20, 2024
1 parent 5e866fc commit a1835c8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/common/testlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,12 @@ def mouse(
# sidestep the browser
element = self.call_js_func('ph_find_scroll_into_view', selector)

# btn=2 for context menus doesn't work with ph_mouse(); so translate the old ph_mouse() API
if event == "contextmenu":
assert btn == 0, "contextmenu event can only be done with default 'btn' value"
btn = 2
event = "click"

actions = [{"type": "pointerMove", "x": 0, "y": 0, "origin": {"type": "element", "element": element}}]
down = {"type": "pointerDown", "button": btn}
up = {"type": "pointerUp", "button": btn}
Expand Down

0 comments on commit a1835c8

Please sign in to comment.