[PATCH v2 3/3] Add test for XIQueryPointer button mask when physical touch is active
Peter Hutterer
peter.hutterer at who-t.net
Tue May 15 16:36:46 PDT 2012
On Tue, May 15, 2012 at 11:05:27AM -0700, Chase Douglas wrote:
> Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
> ---
> Changes since v1:
> * Split out from XInput 2.x test framework
> * Fixed indentation in test assertions
> * Move recordings to touch_1_begin.record and touch_1_end.record
>
> .../recordings/ntrig_dell_xt2/device.prop | 32 +++++++++
> .../recordings/ntrig_dell_xt2/touch_1_begin.record | 11 +++
> .../recordings/ntrig_dell_xt2/touch_1_end.record | 3 +
> test/integration/xi2.cpp | 76 ++++++++++++++++++++
> 4 files changed, 122 insertions(+)
> create mode 100644 test/integration/recordings/ntrig_dell_xt2/device.prop
> create mode 100644 test/integration/recordings/ntrig_dell_xt2/touch_1_begin.record
> create mode 100644 test/integration/recordings/ntrig_dell_xt2/touch_1_end.record
>
> diff --git a/test/integration/recordings/ntrig_dell_xt2/device.prop b/test/integration/recordings/ntrig_dell_xt2/device.prop
> new file mode 100644
> index 0000000..2738c04
> --- /dev/null
> +++ b/test/integration/recordings/ntrig_dell_xt2/device.prop
> @@ -0,0 +1,32 @@
> +N: N-Trig MultiTouch (Virtual Test Device)
> +I: 0003 1b96 0001 0110
> +P: 00 00 00 00 00 00 00 00
> +B: 00 0b 00 00 00 00 00 00 00
> +B: 01 00 00 00 00 00 00 00 00
> +B: 01 00 00 00 00 00 00 00 00
> +B: 01 00 00 00 00 00 00 00 00
> +B: 01 00 00 00 00 00 00 00 00
> +B: 01 00 00 00 00 00 00 00 00
> +B: 01 00 04 00 00 00 00 00 00
> +B: 01 00 00 00 00 00 00 00 00
> +B: 01 00 00 00 00 00 00 00 00
> +B: 01 00 00 00 00 00 00 00 00
> +B: 01 00 00 00 00 00 00 00 00
> +B: 01 00 00 00 00 00 00 00 00
> +B: 01 00 00 00 00 00 00 00 00
> +B: 02 00 00 00 00 00 00 00 00
> +B: 03 03 00 00 00 00 01 73 00
> +B: 04 00 00 00 00 00 00 00 00
> +B: 05 00 00 00 00 00 00 00 00
> +B: 11 00 00 00 00 00 00 00 00
> +B: 12 00 00 00 00 00 00 00 00
> +B: 15 00 00 00 00 00 00 00 00
> +B: 15 00 00 00 00 00 00 00 00
> +A: 00 0 9600 75 0
> +A: 01 0 7200 78 0
> +A: 28 0 255 0 0
> +A: 30 0 9600 200 0
> +A: 31 0 7200 150 0
> +A: 34 0 1 0 0
> +A: 35 0 9600 75 0
> +A: 36 0 7200 78 0
> diff --git a/test/integration/recordings/ntrig_dell_xt2/touch_1_begin.record b/test/integration/recordings/ntrig_dell_xt2/touch_1_begin.record
> new file mode 100644
> index 0000000..28a849b
> --- /dev/null
> +++ b/test/integration/recordings/ntrig_dell_xt2/touch_1_begin.record
> @@ -0,0 +1,11 @@
> +E: 1327542640.244087 0003 0000 2745
> +E: 1327542640.244089 0003 0001 1639
> +E: 1327542640.244090 0003 0035 2745
> +E: 1327542640.244091 0003 0036 1639
> +E: 1327542640.244092 0003 0034 0
> +E: 1327542640.244093 0003 0030 468
> +E: 1327542640.244094 0003 0031 306
> +E: 1327542640.244095 0000 0002 0
> +E: 1327542640.244251 0001 014d 1
> +E: 1327542640.244251 0001 014a 1
> +E: 1327542640.244253 0000 0000 0
we need comment suspport in evemu so we can describe what events a file
describes
> diff --git a/test/integration/recordings/ntrig_dell_xt2/touch_1_end.record b/test/integration/recordings/ntrig_dell_xt2/touch_1_end.record
> new file mode 100644
> index 0000000..cd6a9d9
> --- /dev/null
> +++ b/test/integration/recordings/ntrig_dell_xt2/touch_1_end.record
> @@ -0,0 +1,3 @@
> +E: 1327542642.244253 0001 014d 0
> +E: 1327542642.244253 0001 014a 0
> +E: 1327542642.244253 0000 0000 0
> diff --git a/test/integration/xi2.cpp b/test/integration/xi2.cpp
> index 68974a9..21305d3 100644
> --- a/test/integration/xi2.cpp
> +++ b/test/integration/xi2.cpp
> @@ -192,3 +192,79 @@ protected:
>
> int xi2_opcode_;
> };
> +
> +/**
> + * XIQueryPointer for XInput 2.1 and earlier should report the first button
> + * pressed if a touch is physically active. For XInput 2.2 and later clients,
> + * the first button should not be reported.
> + */
> +TEST_P(XInput2Test, XIQueryPointerTouchscreen)
> +{
> + XIEventMask mask;
> + mask.deviceid = XIAllDevices;
> + mask.mask_len = XIMaskLen(XI_HierarchyChanged);
> + mask.mask = reinterpret_cast<unsigned char*>(
> + calloc(XIMaskLen(XI_HierarchyChanged), 1));
> + XISetMask(mask.mask, XI_HierarchyChanged);
> +
> + ASSERT_EQ(Success,
> + XISelectEvents(Display(), DefaultRootWindow(Display()), &mask,
> + 1));
> +
> + mask.deviceid = XIAllMasterDevices;
> + XIClearMask(mask.mask, XI_HierarchyChanged);
> + XISetMask(mask.mask, XI_ButtonPress);
> +
> + ASSERT_EQ(Success,
> + XISelectEvents(Display(), DefaultRootWindow(Display()), &mask,
> + 1));
> +
> + free(mask.mask);
> +
> + XFlush(Display());
> +
> + xorg::testing::evemu::Device device(
> + TEST_ROOT_DIR "recordings/ntrig_dell_xt2/device.prop");
> +
> + ASSERT_TRUE(wait_for_device(Display(),
> + "N-Trig MultiTouch (Virtual Test Device)"));
> +
> + device.Play(TEST_ROOT_DIR "recordings/ntrig_dell_xt2/touch_1_begin.record");
having the coding style mix between wait_for_device() and device.Play() makes
me sad. can we agree on one style for xorg-gtest related stuff?
reset looks good though, Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
More information about the xorg-devel
mailing list