[PATCH v2 3/3] Add test for XIQueryPointer button mask when physical touch is active

Chase Douglas chase.douglas at canonical.com
Fri May 18 13:03:26 PDT 2012


On 05/15/2012 05:25 PM, Peter Hutterer wrote:
> On Tue, May 15, 2012 at 04:58:15PM -0700, Chase Douglas wrote:
>> On 05/15/2012 04:36 PM, Peter Hutterer wrote:
>>> On Tue, May 15, 2012 at 11:05:27AM -0700, Chase Douglas wrote:
>>
>> [snip]
>>
>>>> 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
>>
>> Yeah, that would be helpful.
>>
>>>> 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?
>>
>> Hmm? I don't understand how the style is different between the two.
> 
> under_line_lower_case vs. CamelCase

Right. So gtest uses the Google coding style, which is CamelCase.
xserver uses under_line_lower_case. xorg-gtest, being written on top of
gtest, is CamelCase (to be fair, it was before there was a clear,
unambiguous X.org coding style :).

I imagine if/when these helper functions move to xorg-gtest, they will
become CamelCase as well, so I'll update them to be CamelCase here too.
It's not perfect, but c'est la vie.

-- Chase


More information about the xorg-devel mailing list