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