1 // Copyright 2011 The ChromiumOS Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include <deque>
6 #include <math.h>
7 #include <stdio.h>
8 #include <vector>
9 #include <utility>
10
11 #include <gtest/gtest.h>
12
13 #include "include/gestures.h"
14 #include "include/palm_classifying_filter_interpreter.h"
15 #include "include/string_util.h"
16 #include "include/unittest_util.h"
17 #include "include/util.h"
18
19 using std::deque;
20 using std::make_pair;
21 using std::pair;
22 using std::vector;
23
24 namespace gestures {
25
26 class PalmClassifyingFilterInterpreterTest : public ::testing::Test {};
27
28 class PalmClassifyingFilterInterpreterTestInterpreter : public Interpreter {
29 public:
PalmClassifyingFilterInterpreterTestInterpreter()30 PalmClassifyingFilterInterpreterTestInterpreter()
31 : Interpreter(nullptr, nullptr, false),
32 expected_flags_(0) {}
33
SyncInterpret(HardwareState & hwstate,stime_t * timeout)34 virtual void SyncInterpret(HardwareState& hwstate, stime_t* timeout) {
35 if (hwstate.finger_cnt > 0) {
36 EXPECT_EQ(expected_flags_, hwstate.fingers[0].flags);
37 }
38 }
39
HandleTimer(stime_t now,stime_t * timeout)40 virtual void HandleTimer(stime_t now, stime_t* timeout) {
41 EXPECT_TRUE(false);
42 }
43
44 unsigned expected_flags_;
45 };
46
TEST(PalmClassifyingFilterInterpreterTest,PalmTest)47 TEST(PalmClassifyingFilterInterpreterTest, PalmTest) {
48 PalmClassifyingFilterInterpreter pci(nullptr, nullptr, nullptr);
49 HardwareProperties hwprops = {
50 .right = 1000,
51 .bottom = 1000,
52 .res_x = 500,
53 .res_y = 500,
54 .orientation_minimum = -1,
55 .orientation_maximum = 2,
56 .max_finger_cnt = 2,
57 .max_touch_cnt = 5,
58 .supports_t5r2 = 0,
59 .support_semi_mt = 0,
60 .is_button_pad = 1,
61 .has_wheel = 0,
62 .wheel_is_hi_res = 0,
63 .is_haptic_pad = 0,
64 };
65 TestInterpreterWrapper wrapper(&pci, &hwprops);
66
67 const float kBig = pci.palm_pressure_.val_ + 1; // big (palm) pressure
68 const float kSml = pci.palm_pressure_.val_ - 1; // low pressure
69
70 FingerState finger_states[] = {
71 // TM, Tm, WM, Wm, Press, Orientation, X, Y, TrID
72 {0, 0, 0, 0, kSml, 0, 600, 500, 1, 0},
73 {0, 0, 0, 0, kSml, 0, 500, 500, 2, 0},
74
75 {0, 0, 0, 0, kSml, 0, 600, 500, 1, 0},
76 {0, 0, 0, 0, kBig, 0, 500, 500, 2, 0},
77
78 {0, 0, 0, 0, kSml, 0, 600, 500, 1, 0},
79 {0, 0, 0, 0, kSml, 0, 500, 500, 2, 0},
80
81 {0, 0, 0, 0, kSml, 0, 600, 500, 3, 0},
82 {0, 0, 0, 0, kBig, 0, 500, 500, 4, 0},
83
84 {0, 0, 0, 0, kSml, 0, 600, 500, 3, 0},
85 {0, 0, 0, 0, kSml, 0, 500, 500, 4, 0}
86 };
87 HardwareState hardware_state[] = {
88 // time, buttons, finger count, touch count, finger states pointer
89 make_hwstate(200000, 0, 2, 2, &finger_states[0]),
90 make_hwstate(200001, 0, 2, 2, &finger_states[2]),
91 make_hwstate(200002, 0, 2, 2, &finger_states[4]),
92 make_hwstate(200003, 0, 2, 2, &finger_states[6]),
93 make_hwstate(200004, 0, 2, 2, &finger_states[8]),
94 };
95
96 for (size_t i = 0; i < 5; ++i) {
97 wrapper.SyncInterpret(hardware_state[i], nullptr);
98 switch (i) {
99 case 0:
100 EXPECT_TRUE(SetContainsValue(pci.pointing_, 1));
101 EXPECT_FALSE(SetContainsValue(pci.palm_, 1));
102 EXPECT_TRUE(SetContainsValue(pci.pointing_, 2));
103 EXPECT_FALSE(SetContainsValue(pci.palm_, 2));
104 break;
105 case 1: // fallthrough
106 case 2:
107 EXPECT_TRUE(SetContainsValue(pci.pointing_, 1));
108 EXPECT_FALSE(SetContainsValue(pci.palm_, 1));
109 EXPECT_FALSE(SetContainsValue(pci.pointing_, 2));
110 EXPECT_TRUE(SetContainsValue(pci.palm_, 2));
111 break;
112 case 3: // fallthrough
113 case 4:
114 EXPECT_TRUE(SetContainsValue(pci.pointing_, 3)) << "i=" << i;
115 EXPECT_FALSE(SetContainsValue(pci.palm_, 3));
116 EXPECT_FALSE(SetContainsValue(pci.pointing_, 4));
117 EXPECT_TRUE(SetContainsValue(pci.palm_, 4));
118 break;
119 }
120 }
121 }
122
TEST(PalmClassifyingFilterInterpreterTest,ExternallyMarkedPalmTest)123 TEST(PalmClassifyingFilterInterpreterTest, ExternallyMarkedPalmTest) {
124 PalmClassifyingFilterInterpreterTestInterpreter* base_interpreter =
125 new PalmClassifyingFilterInterpreterTestInterpreter;
126 PalmClassifyingFilterInterpreter pci(nullptr, base_interpreter, nullptr);
127 HardwareProperties hwprops = {
128 .right = 1000,
129 .bottom = 1000,
130 .res_x = 500,
131 .res_y = 500,
132 .orientation_minimum = -1,
133 .orientation_maximum = 2,
134 .max_finger_cnt = 2,
135 .max_touch_cnt = 5,
136 .supports_t5r2 = 0,
137 .support_semi_mt = 0,
138 .is_button_pad = 1,
139 .has_wheel = 0,
140 .wheel_is_hi_res = 0,
141 .is_haptic_pad = 0,
142 };
143
144 TestInterpreterWrapper wrapper(&pci, &hwprops);
145
146 const float kPr = pci.palm_pressure_.val_ / 2;
147
148 FingerState finger_states[] = {
149 // TM, Tm, WM, Wm, Press, Orientation, X, Y, TrID, flags, ToolType
150 {0, 0, 0, 0, kPr, 0, 600, 500, 1, 0},
151 {0, 0, 0, 0, kPr, 0, 600, 500, 1, 0},
152 // mark the touch as palm
153 {0, 0, 0, 0, kPr, 0, 600, 500, 1, 0, FingerState::ToolType::kPalm},
154 {0, 0, 0, 0, kPr, 0, 600, 500, 1, 0, FingerState::ToolType::kPalm},
155 };
156 HardwareState hardware_state[] = {
157 // time, buttons, finger count, touch count, finger states pointer
158 make_hwstate(0.00, 0, 1, 1, &finger_states[0]),
159 make_hwstate(4.00, 0, 1, 1, &finger_states[1]),
160 make_hwstate(5.00, 0, 1, 1, &finger_states[2]),
161 make_hwstate(5.01, 0, 1, 1, &finger_states[3]),
162 };
163
164 for (size_t i = 0; i < arraysize(hardware_state); ++i) {
165 SCOPED_TRACE(StringPrintf("i = %zu", i));
166 if(i > 1) {
167 base_interpreter->expected_flags_ = GESTURES_FINGER_PALM;
168 }
169 else {
170 base_interpreter->expected_flags_ = 0;
171 }
172 wrapper.SyncInterpret(hardware_state[i], nullptr);
173 if (i > 1) {
174 // After the second frame finger is marked as palm
175 EXPECT_FALSE(SetContainsValue(pci.pointing_, 1));
176 EXPECT_TRUE(SetContainsValue(pci.palm_, 1));
177 }
178 else {
179 EXPECT_TRUE(SetContainsValue(pci.pointing_, 1));
180 EXPECT_FALSE(SetContainsValue(pci.palm_, 1));
181 }
182 }
183 }
184
TEST(PalmClassifyingFilterInterpreterTest,StationaryPalmTest)185 TEST(PalmClassifyingFilterInterpreterTest, StationaryPalmTest) {
186 PalmClassifyingFilterInterpreter pci(nullptr, nullptr, nullptr);
187 HardwareProperties hwprops = {
188 .right = 100,
189 .bottom = 100,
190 .res_x = 1,
191 .res_y = 1,
192 .orientation_minimum = -1,
193 .orientation_maximum = 2,
194 .max_finger_cnt = 5,
195 .max_touch_cnt = 5,
196 .supports_t5r2 = 0,
197 .support_semi_mt = 0,
198 .is_button_pad = 1,
199 .has_wheel = 0,
200 .wheel_is_hi_res = 0,
201 .is_haptic_pad = 0,
202 };
203 TestInterpreterWrapper wrapper(&pci, &hwprops);
204
205 const float kPr = pci.palm_pressure_.val_ / 2;
206
207 FingerState finger_states[] = {
208 // TM, Tm, WM, Wm, Press, Orientation, X, Y, TrID, flags
209 // Palm is id 1, finger id 2
210 {0, 0, 0, 0, kPr, 0, 0, 40, 1, 0},
211 {0, 0, 0, 0, kPr, 0, 60, 37, 2, 0},
212
213 {0, 0, 0, 0, kPr, 0, 0, 40, 1, 0},
214 {0, 0, 0, 0, kPr, 0, 60, 40, 2, 0},
215
216 {0, 0, 0, 0, kPr, 0, 0, 40, 1, 0},
217 {0, 0, 0, 0, kPr, 0, 60, 43, 2, 0},
218 };
219 HardwareState hardware_state[] = {
220 // time, buttons, finger count, touch count, finger states pointer
221 make_hwstate(0.00, 0, 1, 1, &finger_states[0]),
222 make_hwstate(4.00, 0, 2, 2, &finger_states[0]),
223 make_hwstate(5.00, 0, 2, 2, &finger_states[2]),
224 make_hwstate(5.01, 0, 2, 2, &finger_states[4]),
225 };
226
227 for (size_t i = 0; i < arraysize(hardware_state); ++i) {
228 wrapper.SyncInterpret(hardware_state[i], nullptr);
229 if (i > 0) {
230 // We expect after the second input frame is processed that the palm
231 // is classified
232 EXPECT_FALSE(SetContainsValue(pci.pointing_, 1));
233 EXPECT_TRUE(SetContainsValue(pci.palm_, 1));
234 }
235 if (hardware_state[i].finger_cnt > 1)
236 EXPECT_TRUE(SetContainsValue(pci.pointing_, 2)) << "i=" << i;
237 }
238 }
239
TEST(PalmClassifyingFilterInterpreterTest,PalmAtEdgeTest)240 TEST(PalmClassifyingFilterInterpreterTest, PalmAtEdgeTest) {
241 PalmClassifyingFilterInterpreterTestInterpreter* base_interpreter = nullptr;
242 std::unique_ptr<PalmClassifyingFilterInterpreter> pci(
243 new PalmClassifyingFilterInterpreter(nullptr, nullptr, nullptr));
244 HardwareProperties hwprops = {
245 .right = 100,
246 .bottom = 100,
247 .res_x = 1,
248 .res_y = 1,
249 .orientation_minimum = -1,
250 .orientation_maximum = 2,
251 .max_finger_cnt = 5,
252 .max_touch_cnt = 5,
253 .supports_t5r2 = 0,
254 .support_semi_mt = 0,
255 .is_button_pad = 1,
256 .has_wheel = 0,
257 .wheel_is_hi_res = 0,
258 .is_haptic_pad = 0,
259 };
260 TestInterpreterWrapper wrapper(pci.get(), &hwprops);
261
262 const float kBig = pci->palm_pressure_.val_ + 1.0; // palm pressure
263 const float kSml = pci->palm_pressure_.val_ - 1.0; // small, low pressure
264 const float kMid = pci->palm_pressure_.val_ / 2.0;
265 const float kMidWidth =
266 (pci->palm_edge_min_width_.val_ + pci->palm_edge_width_.val_) / 2.0;
267
268 const float kBigMove = pci->palm_pointing_min_dist_.val_ + 1.0;
269 const float kSmallMove = pci->palm_pointing_min_dist_.val_ - 1.0;
270
271 FingerState finger_states[] = {
272 // TM, Tm, WM, Wm, Press, Orientation, X, Y, TrID
273 // small contact with small movement in edge
274 {0, 0, 0, 0, kSml, 0, 1, 40, 1, 0},
275 {0, 0, 0, 0, kSml, 0, 1, 40 + kSmallMove, 1, 0},
276 // small contact movement in middle
277 {0, 0, 0, 0, kSml, 0, 50, 40, 1, 0},
278 {0, 0, 0, 0, kSml, 0, 50, 50, 1, 0},
279 // large contact movment in middle
280 {0, 0, 0, 0, kBig, 0, 50, 40, 1, 0},
281 {0, 0, 0, 0, kBig, 0, 50, 50, 1, 0},
282 // under mid-pressure contact move at mid-width
283 {0, 0, 0, 0, kMid - 1.0f, 0, kMidWidth, 40, 1, 0},
284 {0, 0, 0, 0, kMid - 1.0f, 0, kMidWidth, 50, 1, 0},
285 // over mid-pressure contact move at mid-width with small movement
286 {0, 0, 0, 0, kMid + 1.0f, 0, kMidWidth, 40, 1, 0},
287 {0, 0, 0, 0, kMid + 1.0f, 0, kMidWidth, 40 + kSmallMove, 1, 0},
288 // small contact with large movement in edge
289 {0, 0, 0, 0, kSml, 0, 1, 40, 1, 0},
290 {0, 0, 0, 0, kSml, 0, 1, 40 + kBigMove, 1, 0},
291 // over mid-pressure contact move at mid-width with large movement
292 {0, 0, 0, 0, kMid + 1.0f, 0, kMidWidth, 40, 1, 0},
293 {0, 0, 0, 0, kMid + 1.0f, 0, kMidWidth, 40 + kBigMove, 1, 0},
294 };
295 HardwareState hardware_state[] = {
296 // time, buttons, finger count, touch count, finger states pointer
297 // slow movement at edge with small movement
298 make_hwstate(0.0, 0, 1, 1, &finger_states[0]),
299 make_hwstate(1.0, 0, 1, 1, &finger_states[1]),
300 // slow small contact movement in middle
301 make_hwstate(0.0, 0, 1, 1, &finger_states[2]),
302 make_hwstate(1.0, 0, 1, 1, &finger_states[3]),
303 // slow large contact movement in middle
304 make_hwstate(0.0, 0, 1, 1, &finger_states[4]),
305 make_hwstate(1.0, 0, 1, 1, &finger_states[5]),
306 // under mid-pressure at mid-width
307 make_hwstate(0.0, 0, 1, 1, &finger_states[6]),
308 make_hwstate(1.0, 0, 1, 1, &finger_states[7]),
309 // over mid-pressure at mid-width
310 make_hwstate(0.0, 0, 1, 1, &finger_states[8]),
311 make_hwstate(1.0, 0, 1, 1, &finger_states[9]),
312 // large movement at edge
313 make_hwstate(0.0, 0, 1, 1, &finger_states[10]),
314 make_hwstate(1.0, 0, 1, 1, &finger_states[11]),
315 // over mid-pressure at mid-width with large movement
316 make_hwstate(0.0, 0, 1, 1, &finger_states[12]),
317 make_hwstate(1.0, 0, 1, 1, &finger_states[13]),
318 };
319
320 for (size_t i = 0; i < arraysize(hardware_state); ++i) {
321 if ((i % 2) == 0) {
322 base_interpreter = new PalmClassifyingFilterInterpreterTestInterpreter;
323 pci.reset(new PalmClassifyingFilterInterpreter(nullptr, base_interpreter,
324 nullptr));
325 wrapper.Reset(pci.get());
326 }
327 switch (i) {
328 case 2: // fallthough
329 case 3:
330 case 6:
331 case 7:
332 base_interpreter->expected_flags_ = 0;
333 break;
334 case 11:
335 case 13:
336 base_interpreter->expected_flags_ = GESTURES_FINGER_POSSIBLE_PALM;
337 break;
338 case 0: // fallthrough
339 case 1:
340 case 8:
341 case 9:
342 case 10:
343 case 12:
344 base_interpreter->expected_flags_ = GESTURES_FINGER_PALM;
345 break;
346 case 4:
347 case 5:
348 base_interpreter->expected_flags_ =
349 (GESTURES_FINGER_PALM | GESTURES_FINGER_LARGE_PALM);
350 break;
351 default:
352 ADD_FAILURE() << "Should be unreached.";
353 break;
354 }
355 fprintf(stderr, "iteration i = %zd\n", i);
356 wrapper.SyncInterpret(hardware_state[i], nullptr);
357 }
358 }
359
360 struct PalmReevaluateTestInputs {
361 stime_t now_;
362 float x_, y_, pressure_;
363 };
364
365 // This tests that a palm that doesn't start out as a palm, but actually is,
366 // and can be classified as one shortly after it starts, doesn't cause motion.
TEST(PalmClassifyingFilterInterpreterTest,PalmReevaluateTest)367 TEST(PalmClassifyingFilterInterpreterTest, PalmReevaluateTest) {
368 PalmClassifyingFilterInterpreter pci(nullptr, nullptr, nullptr);
369 HardwareProperties hwprops = {
370 .right = 106.666672,
371 .bottom = 68.000000,
372 .res_x = 1,
373 .res_y = 1,
374 .orientation_minimum = -1,
375 .orientation_maximum = 2,
376 .max_finger_cnt = 15,
377 .max_touch_cnt = 5,
378 .supports_t5r2 = 0,
379 .support_semi_mt = 0,
380 .is_button_pad = true,
381 .has_wheel = 0,
382 .wheel_is_hi_res = 0,
383 .is_haptic_pad = false,
384 };
385 TestInterpreterWrapper wrapper(&pci, &hwprops);
386
387 PalmReevaluateTestInputs inputs[] = {
388 { 5.8174, 10.25, 46.10, 15.36 },
389 { 5.8277, 10.25, 46.10, 21.18 },
390 { 5.8377, 10.25, 46.10, 19.24 },
391 { 5.8479, 9.91, 45.90, 15.36 },
392 { 5.8578, 9.08, 44.90, 19.24 },
393 { 5.8677, 9.08, 44.90, 28.94 },
394 { 5.8777, 8.66, 44.70, 61.93 },
395 { 5.8879, 8.41, 44.60, 58.04 },
396 { 5.8973, 8.08, 44.20, 73.57 },
397 { 5.9073, 7.83, 44.20, 87.15 },
398 { 5.9171, 7.50, 44.40, 89.09 },
399 { 5.9271, 7.25, 44.20, 87.15 },
400 { 5.9369, 7.00, 44.40, 83.27 },
401 { 5.9466, 6.33, 44.60, 89.09 },
402 { 5.9568, 6.00, 44.70, 85.21 },
403 { 5.9666, 5.75, 44.70, 87.15 },
404 { 5.9763, 5.41, 44.79, 75.51 },
405 { 5.9862, 5.08, 45.20, 75.51 },
406 { 5.9962, 4.50, 45.50, 75.51 },
407 { 6.0062, 4.41, 45.79, 81.33 },
408 { 6.0160, 4.08, 46.40, 77.45 },
409 { 6.0263, 3.83, 46.90, 91.03 },
410 { 6.0363, 3.58, 47.50, 98.79 },
411 { 6.0459, 3.25, 47.90, 114.32 },
412 { 6.0560, 3.25, 47.90, 149.24 },
413 { 6.0663, 3.33, 48.10, 170.59 },
414 { 6.0765, 3.50, 48.29, 180.29 },
415 { 6.0866, 3.66, 48.40, 188.05 },
416 { 6.0967, 3.83, 48.50, 188.05 },
417 { 6.1067, 3.91, 48.79, 182.23 },
418 { 6.1168, 4.00, 48.79, 180.29 },
419 { 6.1269, 4.08, 48.79, 180.29 },
420 { 6.1370, 4.16, 48.90, 176.41 },
421 { 6.1473, 4.25, 49.20, 162.82 },
422 { 6.1572, 4.58, 51.00, 135.66 },
423 { 6.1669, 4.66, 51.00, 114.32 },
424 { 6.1767, 4.66, 51.40, 73.57 },
425 { 6.1868, 4.66, 52.00, 40.58 },
426 { 6.1970, 4.66, 52.40, 21.18 },
427 { 6.2068, 6.25, 51.90, 13.42 },
428 };
429 for (size_t i = 0; i < arraysize(inputs); i++) {
430 FingerState fs =
431 { 0, 0, 0, 0, inputs[i].pressure_, 0.0,
432 inputs[i].x_, inputs[i].y_, 1, 0 };
433 HardwareState hs = make_hwstate(inputs[i].now_, 0, 1, 1, &fs);
434
435 stime_t timeout = NO_DEADLINE;
436 wrapper.SyncInterpret(hs, &timeout);
437 // Allow movement at first:
438 stime_t age = inputs[i].now_ - inputs[0].now_;
439 if (age < pci.palm_eval_timeout_.val_)
440 continue;
441 EXPECT_FALSE(SetContainsValue(pci.pointing_, 1));
442 }
443 }
444
445 namespace {
446 struct LargeTouchMajorTestInputs {
447 stime_t now_;
448 float touch_major_, x_, y_, pressure_;
449 };
450 } // namespace {}
451
TEST(PalmClassifyingFilterInterpreterTest,LargeTouchMajorTest)452 TEST(PalmClassifyingFilterInterpreterTest, LargeTouchMajorTest) {
453 PalmClassifyingFilterInterpreterTestInterpreter* base_interpreter =
454 new PalmClassifyingFilterInterpreterTestInterpreter;
455 PalmClassifyingFilterInterpreter pci(nullptr, base_interpreter, nullptr);
456 HardwareProperties hwprops = {
457 .right = 100,
458 .bottom = 100,
459 .res_x = 1,
460 .res_y = 1,
461 .orientation_minimum = -1,
462 .orientation_maximum = 2,
463 .max_finger_cnt = 5,
464 .max_touch_cnt = 5,
465 .supports_t5r2 = 0,
466 .support_semi_mt = 0,
467 .is_button_pad = 1,
468 .has_wheel = 0,
469 .wheel_is_hi_res = 0,
470 .is_haptic_pad = 0,
471 };
472 TestInterpreterWrapper wrapper(&pci, &hwprops);
473
474 LargeTouchMajorTestInputs inputs[] = {
475 { 658.0355, 22.73, 29.1, 29.1, 140.6 },
476 { 658.0475, 22.73, 29.1, 29.1, 140.6 },
477 { 658.0652, 23.51, 29.1, 29.1, 118.1 },
478 { 658.0827, 22.73, 29.1, 29.1, 161.7 },
479 { 658.1002, 20.20, 29.1, 29.1, 156.4 },
480 { 658.1171, 21.95, 29.2, 29.5, 144.5 },
481 { 658.1344, 25.06, 29.2, 29.9, 157.8 },
482 { 658.1513, 26.42, 28.9, 30.0, 144.5 },
483 { 658.1687, 22.73, 28.9, 29.8, 120.7 },
484 { 658.1856, 25.06, 28.9, 30.1, 159.1 },
485 { 658.2033, 23.51, 28.9, 30.3, 174.9 },
486 { 658.2204, 22.73, 28.9, 30.1, 161.7 },
487 { 658.2378, 17.28, 29.6, 30.1, 144.5 },
488 { 658.2561, 21.95, 29.9, 32.0, 144.5 },
489 { 658.2737, 20.20, 30.2, 30.7, 144.5 },
490 { 658.2907, 16.21, 31.4, 30.7, 145.9 },
491 { 658.3079, 22.73, 30.7, 32.6, 148.5 },
492 { 658.3259, 21.07, 30.8, 30.5, 124.7 },
493 { 658.3437, 22.73, 30.7, 30.4, 147.2 },
494 { 658.3613, 21.95, 30.6, 32.7, 141.9 },
495 { 658.3782, 25.74, 30.2, 32.6, 148.5 },
496 { 658.3954, 25.74, 29.3, 31.9, 151.2 },
497 { 658.4135, 25.06, 28.2, 34.9, 147.2 },
498 { 658.4307, 25.06, 28.9, 29.1, 141.9 },
499 { 658.4476, 25.74, 29.0, 31.7, 145.9 },
500 { 658.4642, 25.74, 29.0, 32.0, 151.2 },
501 { 658.4811, 29.15, 27.6, 32.7, 141.9 },
502 { 658.4984, 27.11, 27.5, 32.2, 148.5 },
503 { 658.5150, 25.06, 27.9, 32.3, 148.5 },
504 { 658.5322, 27.11, 27.8, 32.2, 147.2 },
505 { 658.5494, 27.79, 27.8, 32.1, 151.2 },
506 { 658.5667, 20.20, 28.5, 31.2, 123.4 },
507 { 658.5846, 25.06, 28.6, 31.4, 161.7 },
508 { 658.6022, 21.07, 29.3, 30.5, 126.0 },
509 { 658.6195, 25.74, 29.2, 30.9, 152.5 },
510 { 658.6372, 29.15, 27.8, 32.0, 151.2 },
511 { 658.6547, 29.73, 27.1, 32.6, 145.9 },
512 { 658.6724, 25.06, 27.5, 32.7, 176.3 },
513 { 658.6910, 27.79, 27.4, 32.4, 141.9 },
514 { 658.7081, 27.11, 27.5, 32.2, 141.9 },
515 { 658.7263, 27.79, 27.4, 32.2, 147.2 },
516 { 658.7428, 27.11, 27.3, 32.2, 145.9 },
517 { 658.7601, 25.74, 27.5, 32.2, 148.5 },
518 { 658.7780, 16.21, 29.0, 31.8, 147.2 },
519 { 658.7956, 25.74, 29.0, 31.9, 152.5 },
520 { 658.8132, 21.07, 29.4, 31.1, 145.9 },
521 { 658.8311, 27.79, 29.0, 31.1, 145.9 },
522 { 658.8493, 25.74, 28.9, 31.3, 147.2 },
523 { 658.8666, 24.28, 29.0, 31.3, 147.2 },
524 { 658.8840, 25.06, 29.0, 31.1, 147.2 },
525 { 658.9014, 29.15, 28.7, 31.0, 152.5 },
526 { 658.9138, 29.15, 28.7, 31.0, 152.5 },
527 { 658.9309, 27.79, 28.6, 31.0, 152.5 },
528 { 658.9491, 25.06, 28.6, 31.1, 148.5 },
529 { 658.9667, 27.79, 28.5, 31.1, 152.5 },
530 { 658.9847, 25.74, 28.5, 31.2, 143.2 },
531 { 659.0022, 25.74, 28.6, 31.3, 149.8 },
532 { 659.0193, 20.20, 28.8, 30.9, 122.1 },
533 { 659.0371, 29.73, 28.1, 31.6, 151.2 },
534 { 659.0550, 21.07, 29.2, 30.2, 145.9 },
535 { 659.0728, 16.21, 31.3, 30.5, 145.9 },
536 { 659.0911, 27.79, 27.2, 31.8, 127.4 },
537 { 659.1092, 26.42, 27.6, 31.4, 180.2 },
538 { 659.1275, 23.51, 29.8, 34.1, 148.5 },
539 { 659.1444, 25.74, 29.3, 33.4, 141.9 },
540 { 659.1631, 25.74, 29.2, 33.1, 152.5 },
541 { 659.1808, 25.74, 29.2, 33.0, 149.8 },
542 { 659.1986, 21.95, 28.1, 29.9, 165.7 },
543 { 659.2168, 27.11, 27.8, 30.4, 148.5 },
544 { 659.2346, 27.11, 27.8, 30.6, 149.8 },
545 { 659.2521, 29.73, 27.2, 31.5, 153.8 },
546 { 659.2699, 25.06, 27.6, 31.8, 152.5 },
547 { 659.2869, 25.74, 28.0, 32.0, 152.5 },
548 { 659.3041, 23.51, 28.4, 32.5, 143.2 },
549 { 659.3223, 25.74, 28.5, 32.5, 149.8 },
550 { 659.3402, 23.51, 28.5, 31.6, 147.2 },
551 { 659.3583, 24.28, 28.7, 31.6, 152.5 },
552 { 659.3756, 27.79, 28.6, 31.6, 149.8 },
553 { 659.3933, 29.15, 28.3, 31.7, 164.4 },
554 { 659.4100, 25.74, 28.4, 31.8, 152.5 },
555 { 659.4276, 29.73, 27.9, 32.2, 145.9 },
556 { 659.4449, 23.51, 28.8, 33.1, 148.5 },
557 { 659.4617, 25.74, 28.8, 33.0, 151.2 },
558 { 659.4785, 25.74, 28.9, 33.0, 152.5 },
559 { 659.4963, 29.15, 28.6, 33.0, 181.6 },
560 { 659.5135, 20.20, 29.7, 32.6, 149.8 },
561 { 659.5303, 29.15, 28.9, 32.6, 152.5 },
562 { 659.5482, 26.42, 28.5, 34.1, 126.0 },
563 { 659.5661, 25.74, 28.7, 33.7, 127.4 },
564 { 659.5839, 22.73, 29.1, 33.6, 151.2 },
565 { 659.6017, 25.74, 29.1, 33.5, 149.8 },
566 { 659.6198, 27.79, 28.8, 33.1, 143.2 },
567 { 659.6382, 26.42, 28.6, 32.6, 182.9 },
568 { 659.6548, 25.06, 28.7, 32.6, 163.0 },
569 { 659.6726, 25.74, 28.7, 32.6, 149.8 },
570 { 659.6898, 25.06, 28.7, 32.6, 143.2 },
571 { 659.7072, 25.74, 28.7, 32.6, 152.5 },
572 { 659.7248, 27.79, 28.7, 32.5, 156.4 },
573 { 659.7421, 25.74, 28.7, 32.5, 178.9 },
574 { 659.7586, 25.74, 28.7, 32.5, 153.8 },
575 { 659.7774, 27.79, 28.6, 32.5, 149.8 },
576 { 659.7950, 25.74, 28.7, 32.5, 143.2 },
577 { 659.8126, 25.74, 28.7, 32.5, 151.2 },
578 { 659.8304, 24.28, 28.8, 32.6, 153.8 },
579 { 659.8477, 29.15, 28.6, 32.6, 128.7 },
580 { 659.8655, 27.79, 28.5, 32.9, 130.0 },
581 { 659.8827, 25.74, 28.5, 32.9, 165.7 },
582 { 659.9001, 27.79, 28.4, 32.7, 149.8 },
583 { 659.9179, 27.79, 28.3, 32.5, 148.5 },
584 { 659.9351, 25.06, 28.5, 31.9, 149.8 },
585 { 659.9530, 25.74, 28.6, 31.9, 149.8 },
586 { 659.9701, 29.73, 28.1, 32.2, 151.2 },
587 { 659.9874, 27.79, 28.0, 32.1, 143.2 },
588 { 660.0051, 25.74, 28.1, 32.2, 141.9 },
589 { 660.0227, 25.74, 28.2, 32.2, 152.5 },
590 { 660.0403, 23.51, 28.7, 32.7, 151.2 },
591 { 660.0576, 27.79, 28.5, 32.5, 147.2 },
592 { 660.0755, 25.74, 28.5, 32.5, 178.9 },
593 { 660.0930, 22.73, 29.1, 31.9, 127.4 },
594 { 660.1101, 22.73, 29.5, 31.4, 149.8 },
595 { 660.1273, 27.79, 29.2, 31.3, 128.7 },
596 { 660.1449, 24.28, 29.2, 31.4, 151.2 },
597 { 660.1632, 28.47, 29.0, 31.5, 151.2 },
598 { 660.1803, 25.06, 29.0, 31.2, 149.8 },
599 { 660.1992, 23.51, 29.4, 32.2, 147.2 },
600 { 660.2168, 22.73, 29.6, 32.9, 149.8 },
601 { 660.2350, 22.73, 30.1, 31.8, 151.2 },
602 { 660.2524, 25.74, 29.9, 32.0, 145.9 },
603 { 660.2708, 29.73, 28.0, 32.7, 174.9 },
604 { 660.2883, 27.79, 27.9, 32.3, 151.2 },
605 { 660.3063, 25.74, 28.1, 32.3, 151.2 },
606 { 660.3232, 25.74, 28.2, 32.4, 153.8 },
607 { 660.3401, 25.74, 28.3, 32.4, 160.4 },
608 { 660.3576, 24.28, 28.5, 32.6, 153.8 },
609 { 660.3748, 27.79, 28.4, 32.5, 151.2 },
610 { 660.3920, 25.74, 28.5, 32.5, 155.1 },
611 { 660.4099, 23.51, 28.5, 31.8, 148.5 },
612 { 660.4280, 25.74, 28.6, 31.9, 151.2 },
613 { 660.4448, 25.74, 28.6, 32.0, 127.4 },
614 { 660.4612, 25.74, 28.7, 32.0, 151.2 },
615 { 660.4799, 25.06, 28.7, 32.1, 164.4 },
616 { 660.4971, 25.74, 28.7, 32.1, 148.5 },
617 { 660.5155, 29.15, 28.5, 32.1, 168.3 },
618 { 660.5334, 27.79, 28.5, 32.1, 151.2 },
619 { 660.5507, 25.74, 28.5, 32.1, 156.4 },
620 { 660.5690, 25.06, 28.5, 32.1, 145.9 },
621 { 660.5868, 23.51, 28.8, 32.5, 140.6 },
622 { 660.6049, 25.74, 28.8, 32.5, 155.1 },
623 { 660.6217, 25.74, 28.8, 32.6, 152.5 },
624 { 660.6394, 27.79, 28.8, 32.5, 141.9 },
625 { 660.6571, 23.51, 29.0, 32.8, 145.9 },
626 { 660.6749, 29.73, 28.4, 33.0, 145.9 },
627 { 660.6924, 25.06, 28.5, 32.9, 151.2 },
628 { 660.7088, 25.74, 28.6, 32.9, 153.8 },
629 { 660.7268, 24.28, 28.7, 32.7, 152.5 },
630 { 660.7443, 25.74, 28.7, 32.7, 152.5 },
631 { 660.7617, 25.74, 28.7, 32.7, 157.8 },
632 { 660.7790, 23.51, 28.9, 33.0, 152.5 },
633 { 660.7969, 25.74, 28.9, 33.0, 135.3 },
634 { 660.8136, 25.74, 29.0, 32.9, 128.7 },
635 { 660.8308, 25.74, 29.0, 32.9, 136.6 },
636 { 660.8489, 20.20, 29.4, 32.7, 151.2 },
637 { 660.8664, 25.06, 28.6, 31.3, 152.5 },
638 { 660.8837, 23.51, 29.2, 32.4, 153.8 },
639 { 660.9014, 25.74, 29.2, 32.5, 152.5 },
640 { 660.9190, 27.79, 28.9, 32.4, 148.5 },
641 { 660.9358, 24.28, 29.2, 32.7, 155.1 },
642 { 660.9523, 25.74, 29.2, 32.6, 149.8 },
643 { 660.9698, 25.74, 29.2, 32.6, 155.1 },
644 { 660.9872, 24.28, 29.3, 32.7, 152.5 },
645 { 661.0051, 25.74, 29.3, 32.7, 132.6 },
646 { 661.0233, 29.15, 28.9, 32.5, 147.2 },
647 { 661.0404, 22.73, 29.3, 32.0, 153.8 },
648 { 661.0584, 29.73, 28.3, 32.5, 152.5 },
649 { 661.0758, 25.74, 28.4, 32.5, 156.4 },
650 { 661.0940, 18.35, 30.9, 31.1, 155.1 },
651 { 661.1123, 18.35, 31.9, 30.5, 155.1 },
652 { 661.1302, 23.51, 29.9, 32.9, 193.5 },
653 { 661.1471, 24.28, 30.0, 33.4, 127.4 },
654 { 661.1657, 25.06, 29.6, 33.6, 151.2 },
655 { 661.1836, 26.42, 29.0, 32.4, 155.1 },
656 { 661.2009, 25.74, 29.1, 32.5, 156.4 },
657 { 661.2189, 25.74, 28.9, 32.1, 178.9 },
658 { 661.2368, 29.15, 28.4, 32.2, 151.2 },
659 { 661.2543, 23.51, 29.2, 33.1, 127.4 },
660 { 661.2720, 25.74, 29.1, 33.1, 151.2 },
661 { 661.2894, 27.79, 28.9, 32.7, 132.6 },
662 { 661.3069, 22.73, 29.4, 32.0, 152.5 },
663 { 661.3249, 23.51, 30.0, 33.2, 151.2 },
664 { 661.3432, 25.74, 29.3, 35.1, 153.8 },
665 { 661.3600, 25.74, 29.3, 34.2, 155.1 },
666 { 661.3775, 27.79, 28.6, 32.9, 156.4 },
667 { 661.3947, 25.74, 28.7, 32.9, 181.6 },
668 { 661.4111, 24.28, 29.0, 33.1, 130.0 },
669 { 661.4299, 27.79, 28.7, 32.7, 151.2 },
670 { 661.4471, 25.74, 28.7, 32.7, 153.8 },
671 { 661.4648, 25.74, 28.8, 32.6, 153.8 },
672 { 661.4820, 27.79, 28.7, 32.5, 147.2 },
673 { 661.4999, 27.79, 28.6, 32.4, 152.5 },
674 { 661.5167, 25.74, 28.6, 32.4, 167.0 },
675 { 661.5334, 25.74, 28.7, 32.4, 152.5 },
676 { 661.5498, 24.28, 28.8, 32.5, 151.2 },
677 { 661.5680, 25.06, 28.9, 32.1, 136.6 },
678 { 661.5863, 25.06, 29.0, 31.7, 151.2 },
679 { 661.6037, 25.74, 29.0, 31.8, 132.6 },
680 { 661.6218, 25.74, 29.0, 31.8, 155.1 },
681 { 661.6386, 25.74, 29.1, 31.9, 144.5 },
682 { 661.6562, 20.20, 29.5, 31.8, 151.2 },
683 { 661.6739, 25.74, 29.4, 31.9, 155.1 },
684 { 661.6907, 22.73, 29.5, 32.2, 155.1 },
685 { 661.7087, 20.20, 30.2, 32.1, 155.1 },
686 { 661.7256, 24.28, 30.2, 32.4, 152.5 },
687 { 661.7429, 24.28, 30.1, 32.3, 153.8 },
688 { 661.7605, 25.74, 30.1, 32.4, 156.4 },
689 { 661.7775, 25.74, 30.0, 32.4, 159.1 },
690 { 661.7956, 25.74, 30.0, 32.4, 151.2 },
691 { 661.8128, 24.28, 30.0, 32.5, 152.5 },
692 { 661.8301, 24.28, 29.3, 31.6, 151.2 },
693 { 661.8480, 22.73, 29.3, 31.6, 161.7 },
694 { 661.8634, 16.21, 29.3, 30.8, 151.2 },
695 { 661.8793, 18.35, 28.3, 29.6, 141.9 },
696 { 661.8893, 18.35, 28.3, 29.6, 141.9 },
697 { 661.8969, 18.35, 28.3, 29.6, 141.9 },
698 { 661.9044, 18.35, 28.3, 29.6, 141.9 },
699 { 661.9111, 18.35, 28.3, 29.6, 141.9 }
700 };
701
702 for (size_t i = 0; i < arraysize(inputs); i++) {
703 const LargeTouchMajorTestInputs& input = inputs[i];
704 FingerState fs = {
705 input.touch_major_, 0, 0, 0, input.pressure_, 0, input.x_, input.y_, 1, 0
706 };
707 HardwareState hs = make_hwstate(input.now_, 0, 1, 1, &fs);
708 base_interpreter->expected_flags_ =
709 (GESTURES_FINGER_PALM | GESTURES_FINGER_LARGE_PALM);
710 wrapper.SyncInterpret(hs, nullptr);
711 }
712 }
713
714 } // namespace gestures
715