Skip to content

Commit

Permalink
test: update control touch test for scrcpy v2.4
Browse files Browse the repository at this point in the history
See #57
  • Loading branch information
aentwist authored and leng-yue committed Sep 27, 2024
1 parent 6b6b82c commit 7e01b6b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions tests/test_control.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
"""Tests adapted from https://github.com/Genymobile/scrcpy/blob/v2.4/app/tests/test_control_msg_serialize.c
make sure to compare to the version we are targeting ^^^^
See https://github.com/Genymobile/scrcpy/issues/673#issuecomment-516360374
"""


import threading

import scrcpy
Expand Down Expand Up @@ -34,12 +42,13 @@ def test_control_touch():
assert control.touch(100, 200, scrcpy.ACTION_DOWN) == (
b"\x02" # TYPE_INJECT_TOUCH_EVENT
+ b"\x00" # ACTION_DOWN
+ b"\xff\xff\xff\xff\xff\xff\xff\xff" # Virtual touch id
+ b"\x12\x34\x56\x78\x87\x65\x43\x21" # pointer id
+ b"\x00\x00\x00\x64" # X: 100
+ b"\x00\x00\x00\xc8" # Y: 200
+ b"\x07\x80\x04\x38" # Resolution: (1920, 1080)
+ b"\xff\xff" # Pressure: 100%
+ b"\x00\x00\x00\x01" # Primary button
+ b"\x00\x00\x00\x01" # AMOTION_EVENT_BUTTON_PRIMARY (action button)
+ b"\x00\x00\x00\x01" # AMOTION_EVENT_BUTTON_PRIMARY (buttons)
)


Expand Down

0 comments on commit 7e01b6b

Please sign in to comment.