From 7e01b6be12b032e77854c003dcf7c6321cfe043c Mon Sep 17 00:00:00 2001 From: Anderson Entwistle <46688047+aentwist@users.noreply.github.com> Date: Sat, 7 Sep 2024 00:42:39 -0600 Subject: [PATCH] test: update control touch test for scrcpy v2.4 See https://github.com/leng-yue/py-scrcpy-client/pull/57 --- tests/test_control.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/test_control.py b/tests/test_control.py index 1ef3369..8cad263 100644 --- a/tests/test_control.py +++ b/tests/test_control.py @@ -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 @@ -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) )