Make HardwareStates in tests with a utility function
Currently, adding a new field to `struct HardwareState` requires
modifying struct literals on over 600 lines of unit tests to add its
default value, which I believe would take roughly an hour (assuming a
good knowledge of Vim). Since I have a CL adding one field already, and
intend to add another sometime soon, this CL refactors most of those
places to use the `make_hwstate` function, which provides default values
for the fields not relevant to touch tests. This removes the need to
update touch-related unit tests when adding an irrelevant field.
Much of this CL was created using the following macro in Neovim (saved
as `b`):
$F}%dWimake_hwstate(^[$F}d5F,cs)^[
Executed with a command something like this:
:g/, 0, 0, 0, 0, 0.0 },\?\( \+\/\/\|\n\)/norm! @b
TEST=run all unit tests
BUG=none
Change-Id: I29ee56628e87d3ca9bec27e6a914d0cacd158905
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/gestures/+/2029924
Commit-Queue: Harry Cutts <hcutts@chromium.org>
Tested-by: Harry Cutts <hcutts@chromium.org>
Reviewed-by: Sean O'Brien <seobrien@chromium.org>
diff --git a/include/unittest_util.h b/include/unittest_util.h
index 552a413..290256e 100644
--- a/include/unittest_util.h
+++ b/include/unittest_util.h
@@ -37,6 +37,12 @@
};
+// A utility method for making a HardwareState struct with just the fields
+// necessary for touchpads. The remaining fields are set to sensible defaults.
+HardwareState make_hwstate(stime_t timestamp, int buttons_down,
+ unsigned short finger_cnt, unsigned short touch_cnt,
+ struct FingerState* fingers);
+
} // namespace gestures
#endif // GESTURES_UNITTEST_UTIL_H_
diff --git a/src/activity_log_unittest.cc b/src/activity_log_unittest.cc
index bb37e06..3d11c49 100644
--- a/src/activity_log_unittest.cc
+++ b/src/activity_log_unittest.cc
@@ -9,6 +9,7 @@
#include "gestures/include/activity_log.h"
#include "gestures/include/macros.h"
#include "gestures/include/prop_registry.h"
+#include "gestures/include/unittest_util.h"
using std::string;
@@ -64,7 +65,7 @@
EXPECT_GT(log.MaxSize(), 10);
FingerState fs = { 0.0, 0.0, 0.0, 0.0, 9.0, 0.0, 3.0, 4.0, 22, 0 };
- HardwareState hs = { 1.0, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 };
+ HardwareState hs = make_hwstate(1.0, 0, 1, 1, &fs);
log.LogHardwareState(hs);
EXPECT_EQ(1, log.size());
EXPECT_TRUE(strstr(log.Encode().c_str(), "22"));
diff --git a/src/box_filter_interpreter_unittest.cc b/src/box_filter_interpreter_unittest.cc
index 75f94ac..e829b2b 100644
--- a/src/box_filter_interpreter_unittest.cc
+++ b/src/box_filter_interpreter_unittest.cc
@@ -72,7 +72,7 @@
EXPECT_TRUE(base_interpreter->handle_timer_called_);
FingerState fs = { 0, 0, 0, 0, 1, 0, 3.0, 0.0, 1, 0 };
- HardwareState hs = { 0.0, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 };
+ HardwareState hs = make_hwstate(0.0, 0, 1, 1, &fs);
InputAndExpectedOutput data[] = {
{ 3.0, 3.0 },
diff --git a/src/click_wiggle_filter_interpreter_unittest.cc b/src/click_wiggle_filter_interpreter_unittest.cc
index 784f18e..3526131 100644
--- a/src/click_wiggle_filter_interpreter_unittest.cc
+++ b/src/click_wiggle_filter_interpreter_unittest.cc
@@ -89,25 +89,25 @@
};
HardwareState hardware_state[] = {
// time, buttons, finger count, touch count, finger states pointer
- { 1319735240.654559, 1, 1, 1, &finger_states[0], 0, 0, 0, 0, 0.0 },
- { 1319735240.667746, 1, 1, 1, &finger_states[1], 0, 0, 0, 0, 0.0 },
- { 1319735240.680153, 1, 1, 1, &finger_states[2], 0, 0, 0, 0, 0.0 },
- { 1319735240.693717, 1, 1, 1, &finger_states[3], 0, 0, 0, 0, 0.0 },
- { 1319735240.707821, 1, 1, 1, &finger_states[4], 0, 0, 0, 0, 0.0 },
- { 1319735240.720633, 1, 1, 1, &finger_states[5], 0, 0, 0, 0, 0.0 },
- { 1319735240.733183, 1, 1, 1, &finger_states[6], 0, 0, 0, 0, 0.0 },
- { 1319735240.746131, 1, 1, 1, &finger_states[7], 0, 0, 0, 0, 0.0 },
- { 1319735240.758622, 1, 1, 1, &finger_states[8], 0, 0, 0, 0, 0.0 },
- { 1319735240.772690, 1, 1, 1, &finger_states[9], 0, 0, 0, 0, 0.0 },
- { 1319735240.785556, 1, 1, 1, &finger_states[10], 0, 0, 0, 0, 0.0 },
- { 1319735240.798524, 1, 1, 1, &finger_states[11], 0, 0, 0, 0, 0.0 },
- { 1319735240.811093, 1, 1, 1, &finger_states[12], 0, 0, 0, 0, 0.0 },
- { 1319735240.824775, 1, 1, 1, &finger_states[13], 0, 0, 0, 0, 0.0 },
- { 1319735240.837738, 0, 1, 1, &finger_states[14], 0, 0, 0, 0, 0.0 },
- { 1319735240.850482, 0, 1, 1, &finger_states[15], 0, 0, 0, 0, 0.0 },
- { 1319735240.862749, 0, 1, 1, &finger_states[16], 0, 0, 0, 0, 0.0 },
- { 1319735240.876571, 0, 1, 1, &finger_states[17], 0, 0, 0, 0, 0.0 },
- { 1319735240.888128, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 }
+ make_hwstate(1319735240.654559, 1, 1, 1, &finger_states[0]),
+ make_hwstate(1319735240.667746, 1, 1, 1, &finger_states[1]),
+ make_hwstate(1319735240.680153, 1, 1, 1, &finger_states[2]),
+ make_hwstate(1319735240.693717, 1, 1, 1, &finger_states[3]),
+ make_hwstate(1319735240.707821, 1, 1, 1, &finger_states[4]),
+ make_hwstate(1319735240.720633, 1, 1, 1, &finger_states[5]),
+ make_hwstate(1319735240.733183, 1, 1, 1, &finger_states[6]),
+ make_hwstate(1319735240.746131, 1, 1, 1, &finger_states[7]),
+ make_hwstate(1319735240.758622, 1, 1, 1, &finger_states[8]),
+ make_hwstate(1319735240.772690, 1, 1, 1, &finger_states[9]),
+ make_hwstate(1319735240.785556, 1, 1, 1, &finger_states[10]),
+ make_hwstate(1319735240.798524, 1, 1, 1, &finger_states[11]),
+ make_hwstate(1319735240.811093, 1, 1, 1, &finger_states[12]),
+ make_hwstate(1319735240.824775, 1, 1, 1, &finger_states[13]),
+ make_hwstate(1319735240.837738, 0, 1, 1, &finger_states[14]),
+ make_hwstate(1319735240.850482, 0, 1, 1, &finger_states[15]),
+ make_hwstate(1319735240.862749, 0, 1, 1, &finger_states[16]),
+ make_hwstate(1319735240.876571, 0, 1, 1, &finger_states[17]),
+ make_hwstate(1319735240.888128, 0, 0, 0, NULL),
};
for (size_t i = 0; i < arraysize(hardware_state); ++i)
@@ -153,15 +153,15 @@
};
HardwareState hardware_state[] = {
// time, buttons, finger count, touch count, finger states pointer
- { 1.0, 1, 1, 1, &finger_states[0], 0, 0, 0, 0, 0.0 }, // 0
- { 1.1, 1, 1, 1, &finger_states[1], 0, 0, 0, 0, 0.0 }, // 1
- { 1.11, 1, 1, 1, &finger_states[2], 0, 0, 0, 0, 0.0 }, // 2
- { 1.25, 1, 1, 1, &finger_states[3], 0, 0, 0, 0, 0.0 },
+ make_hwstate(1.0, 1, 1, 1, &finger_states[0]), // 0
+ make_hwstate(1.1, 1, 1, 1, &finger_states[1]), // 1
+ make_hwstate(1.11, 1, 1, 1, &finger_states[2]), // 2
+ make_hwstate(1.25, 1, 1, 1, &finger_states[3]),
// 3, stable & > Timeout => no warp
- { 1.5, 0, 1, 1, &finger_states[4], 0, 0, 0, 0, 0.0 }, // 4 button up
- { 1.6, 0, 1, 1, &finger_states[5], 0, 0, 0, 0, 0.0 }, // 5
- { 1.61, 0, 1, 1, &finger_states[6], 0, 0, 0, 0, 0.0 }, // 6
- { 1.85, 0, 1, 1, &finger_states[7], 0, 0, 0, 0, 0.0 },
+ make_hwstate(1.5, 0, 1, 1, &finger_states[4]), // 4 button up
+ make_hwstate(1.6, 0, 1, 1, &finger_states[5]), // 5
+ make_hwstate(1.61, 0, 1, 1, &finger_states[6]), // 6
+ make_hwstate(1.85, 0, 1, 1, &finger_states[7]),
// 7, stable & > Timeout => no warp
};
@@ -229,8 +229,8 @@
1, // tracking id
0 // flags
};
- HardwareState hs = {
- input.timestamp_, input.buttons_down_, 1, 1, &fs, 0, 0, 0, 0, 0.0 };
+ HardwareState hs =
+ make_hwstate(input.timestamp_, input.buttons_down_, 1, 1, &fs);
wrapper.SyncInterpret(&hs, NULL);
// Assertions tested in base interpreter
}
@@ -268,12 +268,12 @@
HardwareState hs[] = {
// click
- { 9.00, 1, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
- { 9.01, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
+ make_hwstate(9.00, 1, 1, 1, &fs),
+ make_hwstate(9.01, 0, 1, 1, &fs),
// time goes backwards
- { 1.00, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
+ make_hwstate(1.00, 0, 1, 1, &fs),
// long time passes, shouldn't be wobbling anymore
- { 2.01, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
+ make_hwstate(2.01, 0, 1, 1, &fs),
};
for (size_t i = 0; i < arraysize(hs); i++) {
@@ -382,10 +382,9 @@
{ 0, 0, 0, 0, input.p1, 0, input.x1, input.y1, 2, input.flags1 }
};
unsigned short finger_count = (input.p0 == 0.0 || input.p1 == 0.0) ? 1 : 2;
- HardwareState hs = {
- input.now, input.buttons_down, finger_count, finger_count,
- input.p0 == 0.0 ? &fs[1] : &fs[0], 0, 0, 0, 0, 0.0
- };
+ HardwareState hs = make_hwstate(input.now, input.buttons_down, finger_count,
+ finger_count,
+ input.p0 == 0.0 ? &fs[1] : &fs[0]);
base_interpreter->expect_warp_ = !!input.buttons_down;
base_interpreter->expected_fingers_ = finger_count;
wrapper.SyncInterpret(&hs, NULL);
diff --git a/src/fling_stop_filter_interpreter_unittest.cc b/src/fling_stop_filter_interpreter_unittest.cc
index 1a5d0e3..b9d455f 100644
--- a/src/fling_stop_filter_interpreter_unittest.cc
+++ b/src/fling_stop_filter_interpreter_unittest.cc
@@ -115,9 +115,7 @@
FingerState fs[5];
memset(fs, 0, sizeof(fs));
unsigned short touch_cnt = static_cast<unsigned short>(input.touch_cnt);
- HardwareState hs = {
- input.now, 0, touch_cnt, touch_cnt, fs, 0, 0, 0, 0, 0.0
- };
+ HardwareState hs = make_hwstate(input.now, 0, touch_cnt, touch_cnt, fs);
ret = wrapper.SyncInterpret(&hs, &timeout);
diff --git a/src/gestures_unittest.cc b/src/gestures_unittest.cc
index 1a2eb0f..315bb02 100644
--- a/src/gestures_unittest.cc
+++ b/src/gestures_unittest.cc
@@ -8,6 +8,7 @@
#include "gestures/include/macros.h"
#include "gestures/include/gestures.h"
+#include "gestures/include/unittest_util.h"
namespace gestures {
@@ -27,10 +28,10 @@
};
HardwareState hardware_state[] = {
// time, buttons, finger count, finger states pointer
- { 200000, 0, 1, 1, &finger_states[0], 0, 0, 0, 0, 0.0 },
- { 200001, 0, 1, 1, &finger_states[1], 0, 0, 0, 0, 0.0 },
- { 200001, 0, 2, 2, &finger_states[1], 0, 0, 0, 0, 0.0 },
- { 200001, 0, 2, 2, &finger_states[2], 0, 0, 0, 0, 0.0 },
+ make_hwstate(200000, 0, 1, 1, &finger_states[0]),
+ make_hwstate(200001, 0, 1, 1, &finger_states[1]),
+ make_hwstate(200001, 0, 2, 2, &finger_states[1]),
+ make_hwstate(200001, 0, 2, 2, &finger_states[2]),
};
EXPECT_TRUE(hardware_state[0].SameFingersAs(hardware_state[1]));
@@ -230,7 +231,7 @@
{ 0, 0, 0, 0, 1, 0, 550, 2000, 2, 0 },
{ 0, 0, 0, 0, 1, 0, 250, 3000, 7, 0 }
};
- HardwareState hs = { 10000, 0, 3, 3, &fs[0], 0, 0, 0, 0, 0.0 };
+ HardwareState hs = make_hwstate(10000, 0, 3, 3, &fs[0]);
EXPECT_EQ(&fs[0], hs.GetFingerState(4));
EXPECT_EQ(&fs[1], hs.GetFingerState(2));
EXPECT_EQ(&fs[2], hs.GetFingerState(7));
@@ -290,8 +291,8 @@
};
HardwareState hs[] = {
- { 1.123, 1, 2, 2, fs, 0, 0, 0, 0, 0.0 },
- { 2.123, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 }
+ make_hwstate(1.123, 1, 2, 2, fs),
+ make_hwstate(2.123, 0, 0, 0, NULL)
};
const char* expected[] = {
diff --git a/src/iir_filter_interpreter_unittest.cc b/src/iir_filter_interpreter_unittest.cc
index c49d9db..b874af9 100644
--- a/src/iir_filter_interpreter_unittest.cc
+++ b/src/iir_filter_interpreter_unittest.cc
@@ -51,10 +51,10 @@
{ 0, 0, 0, 0, 30, 0, 5, 5, 1, 0 }
};
HardwareState hs[] = {
- { 0.000, 0, 1, 1, &fs[0], 0, 0, 0, 0, 0.0 },
- { 0.010, 0, 1, 1, &fs[1], 0, 0, 0, 0, 0.0 },
- { 0.020, 0, 1, 1, &fs[2], 0, 0, 0, 0, 0.0 },
- { 0.030, 0, 1, 1, &fs[3], 0, 0, 0, 0, 0.0 }
+ make_hwstate(0.000, 0, 1, 1, &fs[0]),
+ make_hwstate(0.010, 0, 1, 1, &fs[1]),
+ make_hwstate(0.020, 0, 1, 1, &fs[2]),
+ make_hwstate(0.030, 0, 1, 1, &fs[3])
};
for (size_t i = 0; i < arraysize(hs); i++) {
@@ -81,12 +81,12 @@
{ 0, 0, 0, 0, 30, 0, 14, 32, 1, 0 },
};
HardwareState hs[] = {
- { 0.000, 0, 1, 1, &fs[0], 0, 0, 0, 0, 0.0 },
- { 0.010, 0, 1, 1, &fs[1], 0, 0, 0, 0, 0.0 },
- { 0.020, 0, 1, 1, &fs[2], 0, 0, 0, 0, 0.0 },
- { 0.030, 0, 1, 1, &fs[3], 0, 0, 0, 0, 0.0 },
- { 0.040, 0, 1, 1, &fs[4], 0, 0, 0, 0, 0.0 },
- { 0.050, 0, 1, 1, &fs[5], 0, 0, 0, 0, 0.0 },
+ make_hwstate(0.000, 0, 1, 1, &fs[0]),
+ make_hwstate(0.010, 0, 1, 1, &fs[1]),
+ make_hwstate(0.020, 0, 1, 1, &fs[2]),
+ make_hwstate(0.030, 0, 1, 1, &fs[3]),
+ make_hwstate(0.040, 0, 1, 1, &fs[4]),
+ make_hwstate(0.050, 0, 1, 1, &fs[5]),
};
for (size_t i = 0; i < arraysize(hs); i++) {
@@ -125,8 +125,8 @@
};
HardwareState hs_normal[] = {
- { 0.000, 0, 1, 1, &fs_normal[0], 0, 0, 0, 0, 0.0 },
- { 0.010, 0, 1, 1, &fs_normal[1], 0, 0, 0, 0, 0.0 },
+ make_hwstate(0.000, 0, 1, 1, &fs_normal[0]),
+ make_hwstate(0.010, 0, 1, 1, &fs_normal[1]),
};
// For Non-SemiMT, the pressure of the finger will be different from the
@@ -144,8 +144,8 @@
{ 0, 0, 0, 0, kTestPressure, 0, 6, 6, 1, 0 },
};
HardwareState hs_semi_mt[] = {
- { 0.000, 0, 1, 1, &fs_semi_mt[0], 0, 0, 0, 0, 0.0 },
- { 0.010, 0, 1, 1, &fs_semi_mt[1], 0, 0, 0, 0, 0.0 },
+ make_hwstate(0.000, 0, 1, 1, &fs_semi_mt[0]),
+ make_hwstate(0.010, 0, 1, 1, &fs_semi_mt[1]),
};
hwprops.support_semi_mt = true;
wrapper.Reset(&interpreter, &hwprops);
diff --git a/src/immediate_interpreter_unittest.cc b/src/immediate_interpreter_unittest.cc
index 66d482b..1b6b918 100644
--- a/src/immediate_interpreter_unittest.cc
+++ b/src/immediate_interpreter_unittest.cc
@@ -50,11 +50,11 @@
};
HardwareState hardware_states[] = {
// time, buttons down, finger count, finger states pointer
- { 200000, 0, 1, 1, &finger_states[0], 0, 0, 0, 0, 0.0 },
- { 210000, 0, 1, 1, &finger_states[1], 0, 0, 0, 0, 0.0 },
- { 220000, 0, 1, 1, &finger_states[2], 0, 0, 0, 0, 0.0 },
- { 230000, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 },
- { 240000, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 }
+ make_hwstate(200000, 0, 1, 1, &finger_states[0]),
+ make_hwstate(210000, 0, 1, 1, &finger_states[1]),
+ make_hwstate(220000, 0, 1, 1, &finger_states[2]),
+ make_hwstate(230000, 0, 0, 0, NULL),
+ make_hwstate(240000, 0, 0, 0, NULL),
};
EXPECT_EQ(NULL, wrapper.SyncInterpret(&hardware_states[0], NULL));
@@ -115,11 +115,11 @@
};
HardwareState hardware_states[] = {
// time, buttons down, finger count, finger states pointer
- { 200000, 0, 2, 2, &finger_states[0], 0, 0, 0, 0, 0.0 },
- { 210000, 0, 2, 2, &finger_states[2], 0, 0, 0, 0, 0.0 },
- { 220000, 0, 2, 2, &finger_states[4], 0, 0, 0, 0, 0.0 },
- { 230000, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 },
- { 240000, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 }
+ make_hwstate(200000, 0, 2, 2, &finger_states[0]),
+ make_hwstate(210000, 0, 2, 2, &finger_states[2]),
+ make_hwstate(220000, 0, 2, 2, &finger_states[4]),
+ make_hwstate(230000, 0, 0, 0, NULL),
+ make_hwstate(240000, 0, 0, 0, NULL),
};
EXPECT_EQ(NULL, wrapper.SyncInterpret(&hardware_states[0], NULL));
@@ -181,9 +181,9 @@
};
HardwareState hardware_states[] = {
// time, buttons, finger count, touch count, finger states pointer
- { 0.200000, 0, 2, 3, &finger_states[0], 0, 0, 0, 0, 0.0 },
- { 0.250000, 0, 2, 3, &finger_states[2], 0, 0, 0, 0, 0.0 },
- { 0.300000, 0, 2, 3, &finger_states[4], 0, 0, 0, 0, 0.0 }
+ make_hwstate(0.200000, 0, 2, 3, &finger_states[0]),
+ make_hwstate(0.250000, 0, 2, 3, &finger_states[2]),
+ make_hwstate(0.300000, 0, 2, 3, &finger_states[4]),
};
EXPECT_EQ(NULL, wrapper.SyncInterpret(&hardware_states[0], NULL));
@@ -243,9 +243,9 @@
};
HardwareState hardware_states[] = {
// time, buttons, finger count, touch count, finger states pointer
- { 0.200000, 0, 2, 2, &finger_states[0], 0, 0, 0, 0, 0.0 },
- { 0.250000, 0, 2, 2, &finger_states[2], 0, 0, 0, 0, 0.0 },
- { 0.300000, 0, 2, 2, &finger_states[4], 0, 0, 0, 0, 0.0 }
+ make_hwstate(0.200000, 0, 2, 2, &finger_states[0]),
+ make_hwstate(0.250000, 0, 2, 2, &finger_states[2]),
+ make_hwstate(0.300000, 0, 2, 2, &finger_states[4]),
};
EXPECT_EQ(NULL, wrapper.SyncInterpret(&hardware_states[0], NULL));
@@ -314,12 +314,12 @@
};
HardwareState hardware_states[] = {
// time, buttons, finger count, touch count, finger states pointer
- { 0.200000, 0, 2, 2, &finger_states[0], 0, 0, 0, 0, 0.0 },
- { 0.250000, 0, 2, 2, &finger_states[2], 0, 0, 0, 0, 0.0 },
- { 0.300000, 0, 2, 2, &finger_states[4], 0, 0, 0, 0, 0.0 },
- { 0.310000, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 },
- { 0.320000, 0, 1, 1, &finger_states[6], 0, 0, 0, 0, 0.0 },
- { 0.330000, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 }
+ make_hwstate(0.200000, 0, 2, 2, &finger_states[0]),
+ make_hwstate(0.250000, 0, 2, 2, &finger_states[2]),
+ make_hwstate(0.300000, 0, 2, 2, &finger_states[4]),
+ make_hwstate(0.310000, 0, 0, 0, NULL),
+ make_hwstate(0.320000, 0, 1, 1, &finger_states[6]),
+ make_hwstate(0.330000, 0, 0, 0, NULL),
};
ii.tap_enable_.val_ = 1;
@@ -398,19 +398,19 @@
};
HardwareState hardware_states[] = {
// time, buttons, finger count, touch count, finger states pointer
- { 0.00, 0, 2, 2, &finger_states[0], 0, 0, 0, 0, 0.0 },
- { 1.00, 0, 2, 2, &finger_states[0], 0, 0, 0, 0, 0.0 },
- { 1.01, 0, 2, 2, &finger_states[2], 0, 0, 0, 0, 0.0 },
- { 1.02, 0, 2, 2, &finger_states[4], 0, 0, 0, 0, 0.0 },
- { 1.03, 0, 2, 2, &finger_states[6], 0, 0, 0, 0, 0.0 },
- { 1.04, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 },
+ make_hwstate(0.00, 0, 2, 2, &finger_states[0]),
+ make_hwstate(1.00, 0, 2, 2, &finger_states[0]),
+ make_hwstate(1.01, 0, 2, 2, &finger_states[2]),
+ make_hwstate(1.02, 0, 2, 2, &finger_states[4]),
+ make_hwstate(1.03, 0, 2, 2, &finger_states[6]),
+ make_hwstate(1.04, 0, 0, 0, NULL),
- { 3.00, 0, 2, 2, &finger_states[8], 0, 0, 0, 0, 0.0 },
- { 4.00, 0, 2, 2, &finger_states[8], 0, 0, 0, 0, 0.0 },
- { 4.01, 0, 2, 2, &finger_states[10], 0, 0, 0, 0, 0.0 },
- { 4.02, 0, 2, 2, &finger_states[12], 0, 0, 0, 0, 0.0 },
- { 4.03, 0, 2, 2, &finger_states[14], 0, 0, 0, 0, 0.0 },
- { 4.04, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 },
+ make_hwstate(3.00, 0, 2, 2, &finger_states[8]),
+ make_hwstate(4.00, 0, 2, 2, &finger_states[8]),
+ make_hwstate(4.01, 0, 2, 2, &finger_states[10]),
+ make_hwstate(4.02, 0, 2, 2, &finger_states[12]),
+ make_hwstate(4.03, 0, 2, 2, &finger_states[14]),
+ make_hwstate(4.04, 0, 0, 0, NULL),
};
size_t idx = 0;
@@ -494,11 +494,11 @@
};
HardwareState hardware_states[] = {
// time, buttons, finger count, touch count, finger states pointer
- { 1.00, 0, 2, 2, &finger_states[0], 0, 0, 0, 0, 0.0 },
- { 2.00, 0, 2, 2, &finger_states[0], 0, 0, 0, 0, 0.0 },
- { 2.01, 0, 2, 2, &finger_states[2], 0, 0, 0, 0, 0.0 },
- { 2.02, 0, 2, 2, &finger_states[4], 0, 0, 0, 0, 0.0 },
- { 2.03, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 },
+ make_hwstate(1.00, 0, 2, 2, &finger_states[0]),
+ make_hwstate(2.00, 0, 2, 2, &finger_states[0]),
+ make_hwstate(2.01, 0, 2, 2, &finger_states[2]),
+ make_hwstate(2.02, 0, 2, 2, &finger_states[4]),
+ make_hwstate(2.03, 0, 0, 0, NULL),
};
size_t idx = 0;
@@ -556,11 +556,11 @@
};
HardwareState hardware_states[] = {
// time, buttons, finger count, touch count, finger states pointer
- { 1.00, 0, 2, 2, &finger_states[0], 0, 0, 0, 0, 0.0 },
- { 2.00, 0, 2, 2, &finger_states[0], 0, 0, 0, 0, 0.0 },
- { 2.01, 0, 2, 2, &finger_states[2], 0, 0, 0, 0, 0.0 },
- { 2.02, 0, 2, 2, &finger_states[4], 0, 0, 0, 0, 0.0 },
- { 2.03, 0, 2, 2, &finger_states[6], 0, 0, 0, 0, 0.0 },
+ make_hwstate(1.00, 0, 2, 2, &finger_states[0]),
+ make_hwstate(2.00, 0, 2, 2, &finger_states[0]),
+ make_hwstate(2.01, 0, 2, 2, &finger_states[2]),
+ make_hwstate(2.02, 0, 2, 2, &finger_states[4]),
+ make_hwstate(2.03, 0, 2, 2, &finger_states[6]),
};
TestInterpreterWrapper wrapper(&ii, &hwprops);
@@ -625,11 +625,11 @@
};
HardwareState hardware_states[] = {
// time, buttons, finger count, touch count, finger states pointer
- { 1.00, 0, 1, 1, &finger_states[0], 0, 0, 0, 0, 0.0 },
- { 1.20, 0, 2, 2, &finger_states[1], 0, 0, 0, 0, 0.0 },
- { 2.00, 0, 2, 2, &finger_states[1], 0, 0, 0, 0, 0.0 },
- { 2.01, 0, 2, 2, &finger_states[3], 0, 0, 0, 0, 0.0 },
- { 2.03, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 },
+ make_hwstate(1.00, 0, 1, 1, &finger_states[0]),
+ make_hwstate(1.20, 0, 2, 2, &finger_states[1]),
+ make_hwstate(2.00, 0, 2, 2, &finger_states[1]),
+ make_hwstate(2.01, 0, 2, 2, &finger_states[3]),
+ make_hwstate(2.03, 0, 0, 0, NULL),
};
TestInterpreterWrapper wrapper(&ii, &hwprops);
@@ -811,9 +811,8 @@
{ 0, 0, 0, 0, inputs[i].p1, 0.0, inputs[i].x1, inputs[i].y1, 2, 0 },
};
unsigned short finger_cnt = inputs[i].p1 == 0.0 ? 1 : 2;
- HardwareState hs = {
- inputs[i].now, 0, finger_cnt, finger_cnt, fs, 0, 0, 0, 0, 0.0
- };
+ HardwareState hs =
+ make_hwstate(inputs[i].now, 0, finger_cnt, finger_cnt, fs);
stime_t timeout = -1.0;
Gesture* gs = wrapper.SyncInterpret(&hs, &timeout);
@@ -958,7 +957,7 @@
{ 0, 0, 0, 0, inputs[i].p0, 0.0, inputs[i].x0, inputs[i].y0, 1, 0 },
{ 0, 0, 0, 0, inputs[i].p1, 0.0, inputs[i].x1, inputs[i].y1, 2, 0 },
};
- HardwareState hs = { inputs[i].now, 0, 2, 2, fs, 0, 0, 0, 0, 0.0 };
+ HardwareState hs = make_hwstate(inputs[i].now, 0, 2, 2, fs);
stime_t timeout = -1.0;
Gesture* gs = wrapper.SyncInterpret(&hs, &timeout);
@@ -1040,32 +1039,32 @@
ssize_t idx = 0;
HardwareStateAnScrollExpectations hardware_states[] = {
// time, buttons, finger count, touch count, finger states pointer
- { { 0.000, 0, 2, 2, &finger_states[idx * 4 ], 0, 0, 0, 0, 0.0 },
+ { make_hwstate(0.000, 0, 2, 2, &finger_states[idx * 4 ]),
0, 0 },
- { { 1.000, 0, 2, 2, &finger_states[idx * 4 ], 0, 0, 0, 0, 0.0 },
+ { make_hwstate(1.000, 0, 2, 2, &finger_states[idx * 4 ]),
0, 0 },
- { { 1.010, 0, 2, 2, &finger_states[idx++ * 4 + 2], 0, 0, 0, 0, 0.0 },
+ { make_hwstate(1.010, 0, 2, 2, &finger_states[idx++ * 4 + 2]),
kBig, kBig },
- { { 0.000, 0, 2, 2, &finger_states[idx * 4 ], 0, 0, 0, 0, 0.0 },
+ { make_hwstate(0.000, 0, 2, 2, &finger_states[idx * 4 ]),
0, 0 },
- { { 1.000, 0, 2, 2, &finger_states[idx * 4 ], 0, 0, 0, 0, 0.0 },
+ { make_hwstate(1.000, 0, 2, 2, &finger_states[idx * 4 ]),
0, 0 },
- { { 1.010, 0, 2, 2, &finger_states[idx++ * 4 + 2], 0, 0, 0, 0, 0.0 },
+ { make_hwstate(1.010, 0, 2, 2, &finger_states[idx++ * 4 + 2]),
0, kBig },
- { { 0.000, 0, 2, 2, &finger_states[idx * 4 ], 0, 0, 0, 0, 0.0 },
+ { make_hwstate(0.000, 0, 2, 2, &finger_states[idx * 4 ]),
0, 0 },
- { { 1.000, 0, 2, 2, &finger_states[idx * 4 ], 0, 0, 0, 0, 0.0 },
+ { make_hwstate(1.000, 0, 2, 2, &finger_states[idx * 4 ]),
0, 0 },
- { { 1.010, 0, 2, 2, &finger_states[idx++ * 4 + 2], 0, 0, 0, 0, 0.0 },
+ { make_hwstate(1.010, 0, 2, 2, &finger_states[idx++ * 4 + 2]),
kBig, 0 },
- { { 0.000, 0, 2, 2, &finger_states[idx * 4 ], 0, 0, 0, 0, 0.0 },
+ { make_hwstate(0.000, 0, 2, 2, &finger_states[idx * 4 ]),
0, 0 },
- { { 1.000, 0, 2, 2, &finger_states[idx * 4 ], 0, 0, 0, 0, 0.0 },
+ { make_hwstate(1.000, 0, 2, 2, &finger_states[idx * 4 ]),
0, 0 },
- { { 1.010, 0, 2, 2, &finger_states[idx++ * 4 + 2], 0, 0, 0, 0, 0.0 },
+ { make_hwstate(1.010, 0, 2, 2, &finger_states[idx++ * 4 + 2]),
0, 0 },
};
@@ -1132,9 +1131,7 @@
ii.reset(new ImmediateInterpreter(NULL, NULL));
wrapper.Reset(ii.get());
for (size_t i = 0; i < 4; i++) {
- HardwareState hs = {
- kTO + 0.01 * i, 0, 2, 2, finger_states, 0, 0, 0, 0, 0.0
- };
+ HardwareState hs = make_hwstate(kTO + 0.01 * i, 0, 2, 2, finger_states);
if (i == 0) {
hs.timestamp -= kTO;
Gesture* gs = wrapper.SyncInterpret(&hs, NULL);
@@ -1189,11 +1186,11 @@
};
HardwareState hardware_states[] = {
// time, buttons, finger count, touch count, finger states pointer
- { 0.000, 0, 2, 2, &finger_states[0], 0, 0, 0, 0, 0.0 },
- { 0.100, 0, 2, 2, &finger_states[0], 0, 0, 0, 0, 0.0 },
- { 0.110, 0, 1, 1, &finger_states[1], 0, 0, 0, 0, 0.0 }, // finger goes away
- { 0.210, 0, 1, 1, &finger_states[1], 0, 0, 0, 0, 0.0 },
- { 0.220, 0, 1, 1, &finger_states[2], 0, 0, 0, 0, 0.0 }, // thumb moves
+ make_hwstate(0.000, 0, 2, 2, &finger_states[0]),
+ make_hwstate(0.100, 0, 2, 2, &finger_states[0]),
+ make_hwstate(0.110, 0, 1, 1, &finger_states[1]), // finger goes away
+ make_hwstate(0.210, 0, 1, 1, &finger_states[1]),
+ make_hwstate(0.220, 0, 1, 1, &finger_states[2]), // thumb moves
};
TestInterpreterWrapper wrapper(&ii, &hwprops);
@@ -1244,9 +1241,9 @@
};
HardwareState hardware_states[] = {
// time, buttons, finger count, touch count, finger states pointer
- { 1.000, 0, 2, 2, &finger_states[0], 0, 0, 0, 0, 0.0 }, // 2 fingers arrive
- { 1.010, 0, 2, 2, &finger_states[2], 0, 0, 0, 0, 0.0 }, // pressures fix
- { 1.100, 0, 2, 2, &finger_states[4], 0, 0, 0, 0, 0.0 }, // they move
+ make_hwstate(1.000, 0, 2, 2, &finger_states[0]), // 2 fingers arrive
+ make_hwstate(1.010, 0, 2, 2, &finger_states[2]), // pressures fix
+ make_hwstate(1.100, 0, 2, 2, &finger_states[4]), // they move
};
TestInterpreterWrapper wrapper(&ii, &hwprops);
@@ -1348,12 +1345,12 @@
};
HardwareState hardware_state[] = {
// time, buttons, finger count, touch count, finger states pointer
- { 0.0, 0, 2, 2, &finger_states[0], 0, 0, 0, 0, 0.0 },
- { 0.1, 0, 2, 2, &finger_states[2], 0, 0, 0, 0, 0.0 },
- { 0.2, 0, 2, 2, &finger_states[4], 0, 0, 0, 0, 0.0 },
- { 3.0, 0, 2, 2, &finger_states[6], 0, 0, 0, 0, 0.0 },
- { 3.1, 0, 2, 2, &finger_states[8], 0, 0, 0, 0, 0.0 },
- { 3.2, 0, 2, 2, &finger_states[10], 0, 0, 0, 0, 0.0 },
+ make_hwstate(0.0, 0, 2, 2, &finger_states[0]),
+ make_hwstate(0.1, 0, 2, 2, &finger_states[2]),
+ make_hwstate(0.2, 0, 2, 2, &finger_states[4]),
+ make_hwstate(3.0, 0, 2, 2, &finger_states[6]),
+ make_hwstate(3.1, 0, 2, 2, &finger_states[8]),
+ make_hwstate(3.2, 0, 2, 2, &finger_states[10]),
};
GestureType expected_gs[] = {
kGestureTypeNull,
@@ -1415,10 +1412,10 @@
};
HardwareState hardware_state[] = {
// time, buttons, finger count, touch count, finger states pointer
- { 2000.00, 0, 1, 1, &finger_states[0], 0, 0, 0, 0, 0.0 },
- { 2000.01, 0, 1, 1, &finger_states[1], 0, 0, 0, 0, 0.0 },
- { 2000.02, 0, 1, 1, &finger_states[2], 0, 0, 0, 0, 0.0 },
- { 2000.03, 0, 1, 1, &finger_states[3], 0, 0, 0, 0, 0.0 },
+ make_hwstate(2000.00, 0, 1, 1, &finger_states[0]),
+ make_hwstate(2000.01, 0, 1, 1, &finger_states[1]),
+ make_hwstate(2000.02, 0, 1, 1, &finger_states[2]),
+ make_hwstate(2000.03, 0, 1, 1, &finger_states[3]),
};
for (size_t i = 0; i < arraysize(hardware_state); ++i) {
@@ -1473,11 +1470,11 @@
};
HardwareState hardware_state[] = {
// time, buttons, finger count, finger states pointer
- { 200000, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 },
- { 200001, 0, 1, 1, &finger_states[0], 0, 0, 0, 0, 0.0 },
- { 200002, 0, 2, 2, &finger_states[0], 0, 0, 0, 0, 0.0 },
- { 200002, 0, 3, 3, &finger_states[0], 0, 0, 0, 0, 0.0 },
- { 200002, 0, 4, 4, &finger_states[0], 0, 0, 0, 0, 0.0 }
+ make_hwstate(200000, 0, 0, 0, NULL),
+ make_hwstate(200001, 0, 1, 1, &finger_states[0]),
+ make_hwstate(200002, 0, 2, 2, &finger_states[0]),
+ make_hwstate(200002, 0, 3, 3, &finger_states[0]),
+ make_hwstate(200002, 0, 4, 4, &finger_states[0]),
};
// few pointing fingers
ii.ResetSameFingersState(hardware_state[0]);
@@ -1566,15 +1563,15 @@
{0, 0, 0, 0, 75, 0, 4, 9, kF2, 0},
{0, 0, 0, 0, 50, 0, 7, 4, kF1, 0}
};
- HardwareState nullstate = { 0.0, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 };
+ HardwareState nullstate = make_hwstate(0.0, 0, 0, 0, NULL);
HardwareState hw[] = {
// time, buttons, finger count, finger states pointer
- { 0.0, 0, 1, 1, &fs[0], 0, 0, 0, 0, 0.0 },
- { 0.1, 0, 2, 2, &fs[0], 0, 0, 0, 0, 0.0 },
- { 0.2, 0, 1, 1, &fs[1], 0, 0, 0, 0, 0.0 },
- { 0.3, 0, 2, 2, &fs[0], 0, 0, 0, 0, 0.0 },
- { 0.4, 0, 1, 1, &fs[1], 0, 0, 0, 0, 0.0 },
- { 0.5, 0, 1, 1, &fs[2], 0, 0, 0, 0, 0.0 }
+ make_hwstate(0.0, 0, 1, 1, &fs[0]),
+ make_hwstate(0.1, 0, 2, 2, &fs[0]),
+ make_hwstate(0.2, 0, 1, 1, &fs[1]),
+ make_hwstate(0.3, 0, 2, 2, &fs[0]),
+ make_hwstate(0.4, 0, 1, 1, &fs[1]),
+ make_hwstate(0.5, 0, 1, 1, &fs[2]),
};
tr.Update(hw[0], nullstate, MkSet(kF1), MkSet(), MkSet());
@@ -1745,274 +1742,274 @@
};
HWStateGs hwsgs[] = {
// Simple 1-finger tap
- {S,{0.00,0,1,1,&fs[0],0,0,0,0,0.0},-1,MkSet(91),0,0,kFTB,false},
- {C,{0.01,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kTpC,true},
- {C,{0.07,0,0,0,NULL,0,0,0,0,0.0},.07,MkSet(),kBL,kBL,kIdl,false},
+ {S,make_hwstate(0.00,0,1,1,&fs[0]),-1,MkSet(91),0,0,kFTB,false},
+ {C,make_hwstate(0.01,0,0,0,NULL),-1,MkSet(),0,0,kTpC,true},
+ {C,make_hwstate(0.07,0,0,0,NULL),.07,MkSet(),kBL,kBL,kIdl,false},
// Simple 1-finger tap w/o dragging enabled
- {N,{0.00,0,1,1,&fs[0],0,0,0,0,0.0},-1,MkSet(91),0,0,kFTB,false},
- {C,{0.01,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),kBL,kBL,kIdl,false},
+ {N,make_hwstate(0.00,0,1,1,&fs[0]),-1,MkSet(91),0,0,kFTB,false},
+ {C,make_hwstate(0.01,0,0,0,NULL),-1,MkSet(),kBL,kBL,kIdl,false},
// 1-finger tap with click
- {S,{0.00,kBL,1,1,&fs[0],0,0,0,0,0.0},-1,MkSet(91),0,0,kIdl,false},
- {C,{0.01,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kIdl,false},
- {C,{0.07,0,0,0,NULL,0,0,0,0,0.0},.07,MkSet(),0,0,kIdl,false},
+ {S,make_hwstate(0.00,kBL,1,1,&fs[0]),-1,MkSet(91),0,0,kIdl,false},
+ {C,make_hwstate(0.01,0,0,0,NULL),-1,MkSet(),0,0,kIdl,false},
+ {C,make_hwstate(0.07,0,0,0,NULL),.07,MkSet(),0,0,kIdl,false},
// 1-finger swipe
- {S,{0.00,0,1,1,&fs[4],0,0,0,0,0.0},-1,MkSet(95),0,0,kFTB,false},
- {C,{0.01,0,1,1,&fs[5],0,0,0,0,0.0},-1,MkSet(95),0,0,kIdl,false},
- {C,{0.02,0,1,1,&fs[6],0,0,0,0,0.0},-1,MkSet(95),0,0,kIdl,false},
- {C,{0.03,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kIdl,false},
+ {S,make_hwstate(0.00,0,1,1,&fs[4]),-1,MkSet(95),0,0,kFTB,false},
+ {C,make_hwstate(0.01,0,1,1,&fs[5]),-1,MkSet(95),0,0,kIdl,false},
+ {C,make_hwstate(0.02,0,1,1,&fs[6]),-1,MkSet(95),0,0,kIdl,false},
+ {C,make_hwstate(0.03,0,0,0,NULL),-1,MkSet(),0,0,kIdl,false},
// Double 1-finger tap
- {S,{0.00,0,1,1,&fs[0],0,0,0,0,0.0},-1,MkSet(91),0,0,kFTB,false},
- {C,{0.01,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kTpC,true},
- {C,{0.02,0,1,1,&fs[2],0,0,0,0,0.0},-1,MkSet(93),0,0,kSTB,false},
- {C,{0.03,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),kBL,kBL,kTpC,true},
- {C,{0.09,0,0,0,NULL,0,0,0,0,0.0},.09,MkSet(),kBL,kBL,kIdl,false},
+ {S,make_hwstate(0.00,0,1,1,&fs[0]),-1,MkSet(91),0,0,kFTB,false},
+ {C,make_hwstate(0.01,0,0,0,NULL),-1,MkSet(),0,0,kTpC,true},
+ {C,make_hwstate(0.02,0,1,1,&fs[2]),-1,MkSet(93),0,0,kSTB,false},
+ {C,make_hwstate(0.03,0,0,0,NULL),-1,MkSet(),kBL,kBL,kTpC,true},
+ {C,make_hwstate(0.09,0,0,0,NULL),.09,MkSet(),kBL,kBL,kIdl,false},
// Triple 1-finger tap
- {S,{0.00,0,1,1,&fs[0],0,0,0,0,0.0},-1,MkSet(91),0,0,kFTB,false},
- {C,{0.01,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kTpC,true},
- {C,{0.02,0,1,1,&fs[2],0,0,0,0,0.0},-1,MkSet(93),0,0,kSTB,false},
- {C,{0.03,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),kBL,kBL,kTpC,true},
- {C,{0.04,0,1,1,&fs[3],0,0,0,0,0.0},-1,MkSet(94),0,0,kSTB,false},
- {C,{0.05,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),kBL,kBL,kTpC,true},
- {C,{0.11,0,0,0,NULL,0,0,0,0,0.0},.11,MkSet(),kBL,kBL,kIdl,false},
+ {S,make_hwstate(0.00,0,1,1,&fs[0]),-1,MkSet(91),0,0,kFTB,false},
+ {C,make_hwstate(0.01,0,0,0,NULL),-1,MkSet(),0,0,kTpC,true},
+ {C,make_hwstate(0.02,0,1,1,&fs[2]),-1,MkSet(93),0,0,kSTB,false},
+ {C,make_hwstate(0.03,0,0,0,NULL),-1,MkSet(),kBL,kBL,kTpC,true},
+ {C,make_hwstate(0.04,0,1,1,&fs[3]),-1,MkSet(94),0,0,kSTB,false},
+ {C,make_hwstate(0.05,0,0,0,NULL),-1,MkSet(),kBL,kBL,kTpC,true},
+ {C,make_hwstate(0.11,0,0,0,NULL),.11,MkSet(),kBL,kBL,kIdl,false},
// 1-finger tap + drag
- {S,{0.00,0,1,1,&fs[0],0,0,0,0,0.0},-1,MkSet(91),0,0,kFTB,false},
- {C,{0.01,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kTpC,true},
- {C,{0.02,0,1,1,&fs[4],0,0,0,0,0.0},-1,MkSet(95),0,0,kSTB,false},
- {C,{0.13,0,1,1,&fs[5],0,0,0,0,0.0},-1,MkSet(95),kBL,0,kDrg,false},
- {C,{0.14,0,1,1,&fs[6],0,0,0,0,0.0},-1,MkSet(95),0,0,kDrg,false},
- {C,{0.15,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kDRl,true},
- {C,{0.99,0,0,0,NULL,0,0,0,0,0.0},.99,MkSet(),0,kBL,kIdl,false},
+ {S,make_hwstate(0.00,0,1,1,&fs[0]),-1,MkSet(91),0,0,kFTB,false},
+ {C,make_hwstate(0.01,0,0,0,NULL),-1,MkSet(),0,0,kTpC,true},
+ {C,make_hwstate(0.02,0,1,1,&fs[4]),-1,MkSet(95),0,0,kSTB,false},
+ {C,make_hwstate(0.13,0,1,1,&fs[5]),-1,MkSet(95),kBL,0,kDrg,false},
+ {C,make_hwstate(0.14,0,1,1,&fs[6]),-1,MkSet(95),0,0,kDrg,false},
+ {C,make_hwstate(0.15,0,0,0,NULL),-1,MkSet(),0,0,kDRl,true},
+ {C,make_hwstate(0.99,0,0,0,NULL),.99,MkSet(),0,kBL,kIdl,false},
// 1-finger tap + move
- {S,{0.00,0,1,1,&fs[0],0,0,0,0,0.0},-1,MkSet(91),0,0,kFTB,false},
- {C,{0.01,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kTpC,true},
- {C,{0.02,0,1,1,&fs[4],0,0,0,0,0.0},-1,MkSet(95),0,0,kSTB,false},
- {C,{0.03,0,1,1,&fs[5],0,0,0,0,0.0},-1,MkSet(95),kBL,kBL,kIdl,false},
- {C,{0.04,0,1,1,&fs[6],0,0,0,0,0.0},-1,MkSet(95),0,0,kIdl,false},
- {C,{0.05,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kIdl,false},
+ {S,make_hwstate(0.00,0,1,1,&fs[0]),-1,MkSet(91),0,0,kFTB,false},
+ {C,make_hwstate(0.01,0,0,0,NULL),-1,MkSet(),0,0,kTpC,true},
+ {C,make_hwstate(0.02,0,1,1,&fs[4]),-1,MkSet(95),0,0,kSTB,false},
+ {C,make_hwstate(0.03,0,1,1,&fs[5]),-1,MkSet(95),kBL,kBL,kIdl,false},
+ {C,make_hwstate(0.04,0,1,1,&fs[6]),-1,MkSet(95),0,0,kIdl,false},
+ {C,make_hwstate(0.05,0,0,0,NULL),-1,MkSet(),0,0,kIdl,false},
// 1-finger tap, move, release, move again (drag lock)
- {S,{0.00,0,1,1,&fs[0],0,0,0,0,0.0},-1,MkSet(91),0,0,kFTB,false},
- {C,{0.01,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kTpC,true},
- {C,{0.02,0,1,1,&fs[4],0,0,0,0,0.0},-1,MkSet(95),0,0,kSTB,false},
- {C,{0.08,0,1,1,&fs[5],0,0,0,0,0.0},-1,MkSet(95),kBL,0,kDrg,false},
- {C,{0.09,0,1,1,&fs[6],0,0,0,0,0.0},-1,MkSet(95),0,0,kDrg,false},
- {C,{0.10,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kDRl,true},
- {C,{0.11,0,1,1,&fs[7],0,0,0,0,0.0},-1,MkSet(96),0,0,kDRt,false},
- {C,{0.12,0,1,1,&fs[8],0,0,0,0,0.0},-1,MkSet(96),0,0,kDrg,false},
- {C,{0.13,0,1,1,&fs[9],0,0,0,0,0.0},-1,MkSet(96),0,0,kDrg,false},
- {C,{0.14,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kDRl,true},
- {C,{0.99,0,0,0,NULL,0,0,0,0,0.0},.99,MkSet(),0,kBL,kIdl,false},
+ {S,make_hwstate(0.00,0,1,1,&fs[0]),-1,MkSet(91),0,0,kFTB,false},
+ {C,make_hwstate(0.01,0,0,0,NULL),-1,MkSet(),0,0,kTpC,true},
+ {C,make_hwstate(0.02,0,1,1,&fs[4]),-1,MkSet(95),0,0,kSTB,false},
+ {C,make_hwstate(0.08,0,1,1,&fs[5]),-1,MkSet(95),kBL,0,kDrg,false},
+ {C,make_hwstate(0.09,0,1,1,&fs[6]),-1,MkSet(95),0,0,kDrg,false},
+ {C,make_hwstate(0.10,0,0,0,NULL),-1,MkSet(),0,0,kDRl,true},
+ {C,make_hwstate(0.11,0,1,1,&fs[7]),-1,MkSet(96),0,0,kDRt,false},
+ {C,make_hwstate(0.12,0,1,1,&fs[8]),-1,MkSet(96),0,0,kDrg,false},
+ {C,make_hwstate(0.13,0,1,1,&fs[9]),-1,MkSet(96),0,0,kDrg,false},
+ {C,make_hwstate(0.14,0,0,0,NULL),-1,MkSet(),0,0,kDRl,true},
+ {C,make_hwstate(0.99,0,0,0,NULL),.99,MkSet(),0,kBL,kIdl,false},
// 1-finger long press
- {S,{0.00,0,1,1,&fs[0],0,0,0,0,0.0},-1,MkSet(91),0,0,kFTB,false},
- {C,{0.02,0,1,1,&fs[0],0,0,0,0,0.0},-1,MkSet(91),0,0,kFTB,false},
- {C,{0.04,0,1,1,&fs[0],0,0,0,0,0.0},-1,MkSet(91),0,0,kFTB,false},
- {C,{0.06,0,1,1,&fs[0],0,0,0,0,0.0},-1,MkSet(91),0,0,kIdl,false},
- {C,{0.07,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kIdl,false},
+ {S,make_hwstate(0.00,0,1,1,&fs[0]),-1,MkSet(91),0,0,kFTB,false},
+ {C,make_hwstate(0.02,0,1,1,&fs[0]),-1,MkSet(91),0,0,kFTB,false},
+ {C,make_hwstate(0.04,0,1,1,&fs[0]),-1,MkSet(91),0,0,kFTB,false},
+ {C,make_hwstate(0.06,0,1,1,&fs[0]),-1,MkSet(91),0,0,kIdl,false},
+ {C,make_hwstate(0.07,0,0,0,NULL),-1,MkSet(),0,0,kIdl,false},
// 1-finger tap then long press
- {S,{0.00,0,1,1,&fs[0],0,0,0,0,0.0},-1,MkSet(91),0,0,kFTB,false},
- {C,{0.01,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kTpC,true},
- {C,{0.02,0,1,1,&fs[4],0,0,0,0,0.0},-1,MkSet(95),0,0,kSTB,false},
- {C,{0.14,0,1,1,&fs[4],0,0,0,0,0.0},-1,MkSet(95),kBL,0,kDrg,false},
- {C,{0.16,0,1,1,&fs[4],0,0,0,0,0.0},-1,MkSet(95),0,0,kDrg,false},
- {C,{0.18,0,1,1,&fs[4],0,0,0,0,0.0},-1,MkSet(95),0,0,kDrg,false},
- {C,{0.19,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kDRl,true},
- {C,{0.99,0,0,0,NULL,0,0,0,0,0.0},.99,MkSet(),0,kBL,kIdl,false},
+ {S,make_hwstate(0.00,0,1,1,&fs[0]),-1,MkSet(91),0,0,kFTB,false},
+ {C,make_hwstate(0.01,0,0,0,NULL),-1,MkSet(),0,0,kTpC,true},
+ {C,make_hwstate(0.02,0,1,1,&fs[4]),-1,MkSet(95),0,0,kSTB,false},
+ {C,make_hwstate(0.14,0,1,1,&fs[4]),-1,MkSet(95),kBL,0,kDrg,false},
+ {C,make_hwstate(0.16,0,1,1,&fs[4]),-1,MkSet(95),0,0,kDrg,false},
+ {C,make_hwstate(0.18,0,1,1,&fs[4]),-1,MkSet(95),0,0,kDrg,false},
+ {C,make_hwstate(0.19,0,0,0,NULL),-1,MkSet(),0,0,kDRl,true},
+ {C,make_hwstate(0.99,0,0,0,NULL),.99,MkSet(),0,kBL,kIdl,false},
// 2-finger tap (right click)
- {S,{0.00,0,2,2,&fs[10],0,0,0,0,0.0},-1,MkSet(97,98),0,0,kFTB,false},
- {C,{0.01,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),kBR,kBR,kIdl,false},
- {C,{0.07,0,0,0,NULL,0,0,0,0,0.0},.07,MkSet(),0,0,kIdl,false},
+ {S,make_hwstate(0.00,0,2,2,&fs[10]),-1,MkSet(97,98),0,0,kFTB,false},
+ {C,make_hwstate(0.01,0,0,0,NULL),-1,MkSet(),kBR,kBR,kIdl,false},
+ {C,make_hwstate(0.07,0,0,0,NULL),.07,MkSet(),0,0,kIdl,false},
// 3-finger tap (middle click)
- {S,{0.00,0,3,3,&fs[29],0,0,0,0,0.0},-1,MkSet(97,98,99),0,0,kFTB,false},
- {C,{0.01,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),kBM,kBM,kIdl,false},
- {C,{0.07,0,0,0,NULL,0,0,0,0,0.0},.07,MkSet(),0,0,kIdl,false},
+ {S,make_hwstate(0.00,0,3,3,&fs[29]),-1,MkSet(97,98,99),0,0,kFTB,false},
+ {C,make_hwstate(0.01,0,0,0,NULL),-1,MkSet(),kBM,kBM,kIdl,false},
+ {C,make_hwstate(0.07,0,0,0,NULL),.07,MkSet(),0,0,kIdl,false},
// 2-finger tap, but one finger is very very light, so left tap
- {S,{0.00,0,2,2,&fs[27],0,0,0,0,0.0},-1,MkSet(97,98),0,0,kFTB,false},
- {C,{0.01,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kTpC,true},
- {C,{0.07,0,0,0,NULL,0,0,0,0,0.0},.07,MkSet(),kBL,kBL,kIdl,false},
+ {S,make_hwstate(0.00,0,2,2,&fs[27]),-1,MkSet(97,98),0,0,kFTB,false},
+ {C,make_hwstate(0.01,0,0,0,NULL),-1,MkSet(),0,0,kTpC,true},
+ {C,make_hwstate(0.07,0,0,0,NULL),.07,MkSet(),kBL,kBL,kIdl,false},
// 2-finger scroll
- {S,{0.00,0,2,2,&fs[10],0,0,0,0,0.0},-1,MkSet(97,98),0,0,kFTB,false},
- {C,{0.01,0,2,2,&fs[12],0,0,0,0,0.0},-1,MkSet(97,98),0,0,kIdl,false},
- {C,{0.02,0,2,2,&fs[14],0,0,0,0,0.0},-1,MkSet(97,98),0,0,kIdl,false},
- {C,{0.03,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kIdl,false},
+ {S,make_hwstate(0.00,0,2,2,&fs[10]),-1,MkSet(97,98),0,0,kFTB,false},
+ {C,make_hwstate(0.01,0,2,2,&fs[12]),-1,MkSet(97,98),0,0,kIdl,false},
+ {C,make_hwstate(0.02,0,2,2,&fs[14]),-1,MkSet(97,98),0,0,kIdl,false},
+ {C,make_hwstate(0.03,0,0,0,NULL),-1,MkSet(),0,0,kIdl,false},
// left tap, right tap
- {S,{0.00,0,1,1,&fs[0],0,0,0,0,0.0},-1,MkSet(91),0,0,kFTB,false},
- {C,{0.01,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kTpC,true},
- {C,{0.02,0,2,2,&fs[10],0,0,0,0,0.0},-1,MkSet(97,98),kBL,kBL,kFTB,false},
- {C,{0.03,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),kBR,kBR,kIdl,false},
- {C,{0.09,0,0,0,NULL,0,0,0,0,0.0},.09,MkSet(),0,0,kIdl,false},
+ {S,make_hwstate(0.00,0,1,1,&fs[0]),-1,MkSet(91),0,0,kFTB,false},
+ {C,make_hwstate(0.01,0,0,0,NULL),-1,MkSet(),0,0,kTpC,true},
+ {C,make_hwstate(0.02,0,2,2,&fs[10]),-1,MkSet(97,98),kBL,kBL,kFTB,false},
+ {C,make_hwstate(0.03,0,0,0,NULL),-1,MkSet(),kBR,kBR,kIdl,false},
+ {C,make_hwstate(0.09,0,0,0,NULL),.09,MkSet(),0,0,kIdl,false},
// left tap, multi-frame right tap
- {S,{0.00,0,1,1,&fs[0],0,0,0,0,0.0},-1,MkSet(91),0,0,kFTB,false},
- {C,{0.01,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kTpC,true},
- {C,{0.02,0,1,1,&fs[10],0,0,0,0,0.0},-1,MkSet(97),0,0,kSTB,false},
- {C,{0.03,0,1,1,&fs[11],0,0,0,0,0.0},-1,MkSet(98),kBL,kBL,kFTB,false},
- {C,{0.04,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),kBR,kBR,kIdl,false},
+ {S,make_hwstate(0.00,0,1,1,&fs[0]),-1,MkSet(91),0,0,kFTB,false},
+ {C,make_hwstate(0.01,0,0,0,NULL),-1,MkSet(),0,0,kTpC,true},
+ {C,make_hwstate(0.02,0,1,1,&fs[10]),-1,MkSet(97),0,0,kSTB,false},
+ {C,make_hwstate(0.03,0,1,1,&fs[11]),-1,MkSet(98),kBL,kBL,kFTB,false},
+ {C,make_hwstate(0.04,0,0,0,NULL),-1,MkSet(),kBR,kBR,kIdl,false},
// right tap, left tap
- {S,{0.00,0,2,2,&fs[10],0,0,0,0,0.0},-1,MkSet(97,98),0,0,kFTB,false},
- {C,{0.01,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),kBR,kBR,kIdl,false},
- {C,{0.02,0,1,1,&fs[0],0,0,0,0,0.0},-1,MkSet(91),0,0,kFTB,false},
- {C,{0.03,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kTpC,true},
- {C,{0.09,0,0,0,NULL,0,0,0,0,0.0},.09,MkSet(),kBL,kBL,kIdl,false},
+ {S,make_hwstate(0.00,0,2,2,&fs[10]),-1,MkSet(97,98),0,0,kFTB,false},
+ {C,make_hwstate(0.01,0,0,0,NULL),-1,MkSet(),kBR,kBR,kIdl,false},
+ {C,make_hwstate(0.02,0,1,1,&fs[0]),-1,MkSet(91),0,0,kFTB,false},
+ {C,make_hwstate(0.03,0,0,0,NULL),-1,MkSet(),0,0,kTpC,true},
+ {C,make_hwstate(0.09,0,0,0,NULL),.09,MkSet(),kBL,kBL,kIdl,false},
// middle tap, left tap
- {S,{0.00,0,3,3,&fs[29],0,0,0,0,0.0},-1,MkSet(97,98,99),0,0,kFTB,false},
- {C,{0.01,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),kBM,kBM,kIdl,false},
- {C,{0.02,0,1,1,&fs[0],0,0,0,0,0.0},-1,MkSet(91),0,0,kFTB,false},
- {C,{0.03,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kTpC,true},
- {C,{0.09,0,0,0,NULL,0,0,0,0,0.0},.09,MkSet(),kBL,kBL,kIdl,false},
+ {S,make_hwstate(0.00,0,3,3,&fs[29]),-1,MkSet(97,98,99),0,0,kFTB,false},
+ {C,make_hwstate(0.01,0,0,0,NULL),-1,MkSet(),kBM,kBM,kIdl,false},
+ {C,make_hwstate(0.02,0,1,1,&fs[0]),-1,MkSet(91),0,0,kFTB,false},
+ {C,make_hwstate(0.03,0,0,0,NULL),-1,MkSet(),0,0,kTpC,true},
+ {C,make_hwstate(0.09,0,0,0,NULL),.09,MkSet(),kBL,kBL,kIdl,false},
// right double-tap
- {S,{0.00,0,2,2,&fs[6],0,0,0,0,0.0},-1,MkSet(95,96),0,0,kFTB,false},
- {C,{0.01,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),kBR,kBR,kIdl,false},
- {C,{0.02,0,2,2,&fs[10],0,0,0,0,0.0},-1,MkSet(97,98),0,0,kFTB,false},
- {C,{0.03,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),kBR,kBR,kIdl,false},
- {C,{0.09,0,0,0,NULL,0,0,0,0,0.0},.09,MkSet(),0,0,kIdl,false},
+ {S,make_hwstate(0.00,0,2,2,&fs[6]),-1,MkSet(95,96),0,0,kFTB,false},
+ {C,make_hwstate(0.01,0,0,0,NULL),-1,MkSet(),kBR,kBR,kIdl,false},
+ {C,make_hwstate(0.02,0,2,2,&fs[10]),-1,MkSet(97,98),0,0,kFTB,false},
+ {C,make_hwstate(0.03,0,0,0,NULL),-1,MkSet(),kBR,kBR,kIdl,false},
+ {C,make_hwstate(0.09,0,0,0,NULL),.09,MkSet(),0,0,kIdl,false},
// left drumroll separation on fast swipe
- {S,{0.00,0,1,1,&fs[32],0,0,0,0,0.0},-1,MkSet(95),0,0,kFTB,false},
- {C,{0.01,0,1,1,&fs[33],0,0,0,0,0.0},-1,MkSet(96),0,0,kIdl,false},
- {C,{0.02,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kIdl,false},
+ {S,make_hwstate(0.00,0,1,1,&fs[32]),-1,MkSet(95),0,0,kFTB,false},
+ {C,make_hwstate(0.01,0,1,1,&fs[33]),-1,MkSet(96),0,0,kIdl,false},
+ {C,make_hwstate(0.02,0,0,0,NULL),-1,MkSet(),0,0,kIdl,false},
// left tap, right-drag
- {S,{0.00,0,1,1,&fs[0],0,0,0,0,0.0},-1,MkSet(91),0,0,kFTB,false},
- {C,{0.01,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kTpC,true},
- {C,{0.02,0,2,2,&fs[10],0,0,0,0,0.0},-1,MkSet(97,98),kBL,kBL,kFTB,false},
- {C,{0.03,0,2,2,&fs[12],0,0,0,0,0.0},-1,MkSet(97,98),0,0,kIdl,false},
- {C,{0.04,0,2,2,&fs[14],0,0,0,0,0.0},-1,MkSet(97,98),0,0,kIdl,false},
- {C,{0.05,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kIdl,false},
+ {S,make_hwstate(0.00,0,1,1,&fs[0]),-1,MkSet(91),0,0,kFTB,false},
+ {C,make_hwstate(0.01,0,0,0,NULL),-1,MkSet(),0,0,kTpC,true},
+ {C,make_hwstate(0.02,0,2,2,&fs[10]),-1,MkSet(97,98),kBL,kBL,kFTB,false},
+ {C,make_hwstate(0.03,0,2,2,&fs[12]),-1,MkSet(97,98),0,0,kIdl,false},
+ {C,make_hwstate(0.04,0,2,2,&fs[14]),-1,MkSet(97,98),0,0,kIdl,false},
+ {C,make_hwstate(0.05,0,0,0,NULL),-1,MkSet(),0,0,kIdl,false},
// left tap, right multi-frame drag
- {S,{0.00,0,1,1,&fs[0],0,0,0,0,0.0},-1,MkSet(91),0,0,kFTB,false},
- {C,{0.01,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kTpC,true},
- {C,{0.02,0,1,1,&fs[10],0,0,0,0,0.0},-1,MkSet(97),0,0,kSTB,false},
- {C,{0.03,0,2,2,&fs[12],0,0,0,0,0.0},-1,MkSet(97,98),kBL,kBL,kIdl,false},
- {C,{0.04,0,2,2,&fs[14],0,0,0,0,0.0},-1,MkSet(97,98),0,0,kIdl,false},
- {C,{0.05,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kIdl,false},
+ {S,make_hwstate(0.00,0,1,1,&fs[0]),-1,MkSet(91),0,0,kFTB,false},
+ {C,make_hwstate(0.01,0,0,0,NULL),-1,MkSet(),0,0,kTpC,true},
+ {C,make_hwstate(0.02,0,1,1,&fs[10]),-1,MkSet(97),0,0,kSTB,false},
+ {C,make_hwstate(0.03,0,2,2,&fs[12]),-1,MkSet(97,98),kBL,kBL,kIdl,false},
+ {C,make_hwstate(0.04,0,2,2,&fs[14]),-1,MkSet(97,98),0,0,kIdl,false},
+ {C,make_hwstate(0.05,0,0,0,NULL),-1,MkSet(),0,0,kIdl,false},
// left tap, drag + finger joined later
- {S,{0.00,0,1,1,&fs[0],0,0,0,0,0.0},-1,MkSet(91),0,0,kFTB,false},
- {C,{0.01,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kTpC,true},
- {C,{0.02,0,1,1,&fs[10],0,0,0,0,0.0},-1,MkSet(97),0,0,kSTB,false},
- {C,{0.13,0,1,1,&fs[10],0,0,0,0,0.0},-1,MkSet(97),kBL,0,kDrg,false},
- {C,{0.14,0,2,2,&fs[12],0,0,0,0,0.0},-1,MkSet(97,98),0,kBL,kIdl,false},
- {C,{0.15,0,2,2,&fs[14],0,0,0,0,0.0},-1,MkSet(97,98),0,0,kIdl,false},
- {C,{0.16,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kIdl,false},
+ {S,make_hwstate(0.00,0,1,1,&fs[0]),-1,MkSet(91),0,0,kFTB,false},
+ {C,make_hwstate(0.01,0,0,0,NULL),-1,MkSet(),0,0,kTpC,true},
+ {C,make_hwstate(0.02,0,1,1,&fs[10]),-1,MkSet(97),0,0,kSTB,false},
+ {C,make_hwstate(0.13,0,1,1,&fs[10]),-1,MkSet(97),kBL,0,kDrg,false},
+ {C,make_hwstate(0.14,0,2,2,&fs[12]),-1,MkSet(97,98),0,kBL,kIdl,false},
+ {C,make_hwstate(0.15,0,2,2,&fs[14]),-1,MkSet(97,98),0,0,kIdl,false},
+ {C,make_hwstate(0.16,0,0,0,NULL),-1,MkSet(),0,0,kIdl,false},
// right tap, left-drag
- {S,{0.00,0,2,2,&fs[14],0,0,0,0,0.0},-1,MkSet(97,98),0,0,kFTB,false},
- {C,{0.01,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),kBR,kBR,kIdl,false},
- {C,{0.02,0,1,1,&fs[4],0,0,0,0,0.0},-1,MkSet(95),0,0,kFTB,false},
- {C,{0.03,0,1,1,&fs[5],0,0,0,0,0.0},-1,MkSet(95),0,0,kIdl,false},
- {C,{0.04,0,1,1,&fs[6],0,0,0,0,0.0},-1,MkSet(95),0,0,kIdl,false},
- {C,{0.05,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kIdl,false},
+ {S,make_hwstate(0.00,0,2,2,&fs[14]),-1,MkSet(97,98),0,0,kFTB,false},
+ {C,make_hwstate(0.01,0,0,0,NULL),-1,MkSet(),kBR,kBR,kIdl,false},
+ {C,make_hwstate(0.02,0,1,1,&fs[4]),-1,MkSet(95),0,0,kFTB,false},
+ {C,make_hwstate(0.03,0,1,1,&fs[5]),-1,MkSet(95),0,0,kIdl,false},
+ {C,make_hwstate(0.04,0,1,1,&fs[6]),-1,MkSet(95),0,0,kIdl,false},
+ {C,make_hwstate(0.05,0,0,0,NULL),-1,MkSet(),0,0,kIdl,false},
// right tap, right-drag
- {S,{0.00,0,2,2,&fs[6],0,0,0,0,0.0},-1,MkSet(95,96),0,0,kFTB,false},
- {C,{0.01,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),kBR,kBR,kIdl,false},
- {C,{0.02,0,2,2,&fs[10],0,0,0,0,0.0},-1,MkSet(97,98),0,0,kFTB,false},
- {C,{0.03,0,2,2,&fs[12],0,0,0,0,0.0},-1,MkSet(97,98),0,0,kIdl,false},
- {C,{0.04,0,2,2,&fs[14],0,0,0,0,0.0},-1,MkSet(97,98),0,0,kIdl,false},
- {C,{0.05,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kIdl,false},
+ {S,make_hwstate(0.00,0,2,2,&fs[6]),-1,MkSet(95,96),0,0,kFTB,false},
+ {C,make_hwstate(0.01,0,0,0,NULL),-1,MkSet(),kBR,kBR,kIdl,false},
+ {C,make_hwstate(0.02,0,2,2,&fs[10]),-1,MkSet(97,98),0,0,kFTB,false},
+ {C,make_hwstate(0.03,0,2,2,&fs[12]),-1,MkSet(97,98),0,0,kIdl,false},
+ {C,make_hwstate(0.04,0,2,2,&fs[14]),-1,MkSet(97,98),0,0,kIdl,false},
+ {C,make_hwstate(0.05,0,0,0,NULL),-1,MkSet(),0,0,kIdl,false},
// drag then right-tap
- {S,{0.00,0,1,1,&fs[0],0,0,0,0,0.0},-1,MkSet(91),0,0,kFTB,false},
- {C,{0.01,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kTpC,true},
- {C,{0.02,0,1,1,&fs[4],0,0,0,0,0.0},-1,MkSet(95),0,0,kSTB,false},
- {C,{0.10,0,1,1,&fs[5],0,0,0,0,0.0},-1,MkSet(95),kBL,0,kDrg,false},
- {C,{0.11,0,1,1,&fs[6],0,0,0,0,0.0},-1,MkSet(95),0,0,kDrg,false},
- {C,{0.12,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kDRl,true},
- {C,{0.13,0,2,2,&fs[10],0,0,0,0,0.0},-1,MkSet(97,98),0,0,kDRt,false},
- {C,{0.14,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,kBL,kTpC,true},
- {C,{0.99,0,0,0,NULL,0,0,0,0,0.0},.99,MkSet(),kBR,kBR,kIdl,false},
+ {S,make_hwstate(0.00,0,1,1,&fs[0]),-1,MkSet(91),0,0,kFTB,false},
+ {C,make_hwstate(0.01,0,0,0,NULL),-1,MkSet(),0,0,kTpC,true},
+ {C,make_hwstate(0.02,0,1,1,&fs[4]),-1,MkSet(95),0,0,kSTB,false},
+ {C,make_hwstate(0.10,0,1,1,&fs[5]),-1,MkSet(95),kBL,0,kDrg,false},
+ {C,make_hwstate(0.11,0,1,1,&fs[6]),-1,MkSet(95),0,0,kDrg,false},
+ {C,make_hwstate(0.12,0,0,0,NULL),-1,MkSet(),0,0,kDRl,true},
+ {C,make_hwstate(0.13,0,2,2,&fs[10]),-1,MkSet(97,98),0,0,kDRt,false},
+ {C,make_hwstate(0.14,0,0,0,NULL),-1,MkSet(),0,kBL,kTpC,true},
+ {C,make_hwstate(0.99,0,0,0,NULL),.99,MkSet(),kBR,kBR,kIdl,false},
// slow double tap
- {D,{0.00,0,1,1,&fs[0],0,0,0,0,0.0},-1,MkSet(91),0,0,kFTB,false},
- {C,{0.10,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kTpC,true},
- {C,{0.12,0,1,1,&fs[2],0,0,0,0,0.0},-1,MkSet(93),0,0,kSTB,false},
- {C,{0.22,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),kBL,kBL,kTpC,true},
- {C,{0.90,0,0,0,NULL,0,0,0,0,0.0},.9,MkSet(),kBL,kBL,kIdl,false},
+ {D,make_hwstate(0.00,0,1,1,&fs[0]),-1,MkSet(91),0,0,kFTB,false},
+ {C,make_hwstate(0.10,0,0,0,NULL),-1,MkSet(),0,0,kTpC,true},
+ {C,make_hwstate(0.12,0,1,1,&fs[2]),-1,MkSet(93),0,0,kSTB,false},
+ {C,make_hwstate(0.22,0,0,0,NULL),-1,MkSet(),kBL,kBL,kTpC,true},
+ {C,make_hwstate(0.90,0,0,0,NULL),.9,MkSet(),kBL,kBL,kIdl,false},
// right tap, very close fingers - shouldn't tap
- {S,{0.00,0,2,2,&fs[19],0,0,0,0,0.0},-1,MkSet(95,96),0,0,kIdl,false},
- {C,{0.01,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kIdl,false},
+ {S,make_hwstate(0.00,0,2,2,&fs[19]),-1,MkSet(95,96),0,0,kIdl,false},
+ {C,make_hwstate(0.01,0,0,0,NULL),-1,MkSet(),0,0,kIdl,false},
// very light left tap - shouldn't tap
- {S,{0.00,0,1,1,&fs[21],0,0,0,0,0.0},-1,MkSet(95),0,0,kFTB,false},
- {C,{0.01,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kIdl,false},
+ {S,make_hwstate(0.00,0,1,1,&fs[21]),-1,MkSet(95),0,0,kFTB,false},
+ {C,make_hwstate(0.01,0,0,0,NULL),-1,MkSet(),0,0,kIdl,false},
// very light right tap - shouldn't tap
- {S,{0.00,0,2,2,&fs[21],0,0,0,0,0.0},-1,MkSet(95,96),0,0,kFTB,false},
- {C,{0.01,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kIdl,false},
+ {S,make_hwstate(0.00,0,2,2,&fs[21]),-1,MkSet(95,96),0,0,kFTB,false},
+ {C,make_hwstate(0.01,0,0,0,NULL),-1,MkSet(),0,0,kIdl,false},
// half very light right tap - should tap
- {S,{0.00,0,2,2,&fs[20],0,0,0,0,0.0},-1,MkSet(95,96),0,0,kFTB,false},
- {C,{0.01,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),kBR,kBR,kIdl,false},
+ {S,make_hwstate(0.00,0,2,2,&fs[20]),-1,MkSet(95,96),0,0,kFTB,false},
+ {C,make_hwstate(0.01,0,0,0,NULL),-1,MkSet(),kBR,kBR,kIdl,false},
// Right tap, w/ fingers too far apart - shouldn't right tap
- {S,{0.00,0,2,2,&fs[23],0,0,0,0,0.0},-1,MkSet(95,96),0,0,kFTB,false},
- {C,{0.01,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kTpC,true},
- {C,{0.07,0,0,0,NULL,0,0,0,0,0.0},.07,MkSet(),kBL,kBL,kIdl,false},
+ {S,make_hwstate(0.00,0,2,2,&fs[23]),-1,MkSet(95,96),0,0,kFTB,false},
+ {C,make_hwstate(0.01,0,0,0,NULL),-1,MkSet(),0,0,kTpC,true},
+ {C,make_hwstate(0.07,0,0,0,NULL),.07,MkSet(),kBL,kBL,kIdl,false},
// Two fingers merge into one, then leave - shouldn't tap
- {S,{0.00,0,2,2,&fs[6],0,0,0,0,0.0},-1,MkSet(95,96),0,0,kFTB,false},
- {C,{1.00,0,2,2,&fs[6],0,0,0,0,0.0},-1,MkSet(95,96),0,0,kIdl,false},
- {C,{1.01,0,1,1,&fs[17],0,0,0,0,0.0},-1,MkSet(91),0,0,kIdl,false},
- {C,{1.02,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kIdl,false},
+ {S,make_hwstate(0.00,0,2,2,&fs[6]),-1,MkSet(95,96),0,0,kFTB,false},
+ {C,make_hwstate(1.00,0,2,2,&fs[6]),-1,MkSet(95,96),0,0,kIdl,false},
+ {C,make_hwstate(1.01,0,1,1,&fs[17]),-1,MkSet(91),0,0,kIdl,false},
+ {C,make_hwstate(1.02,0,0,0,NULL),-1,MkSet(),0,0,kIdl,false},
// 1-finger marked as palm for a long time then unmarked - shouldn't tap
- {S,{0.00,0,1,1,&fs[34],0,0,0,0,0.0},-1,MkSet(),0,0,kIdl,false},
- {C,{1.50,0,1,1,&fs[0],0,0,0,0,0.0},-1,MkSet(91),0,0,kIdl,false},
- {C,{1.51,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kIdl,false},
+ {S,make_hwstate(0.00,0,1,1,&fs[34]),-1,MkSet(),0,0,kIdl,false},
+ {C,make_hwstate(1.50,0,1,1,&fs[0]),-1,MkSet(91),0,0,kIdl,false},
+ {C,make_hwstate(1.51,0,0,0,NULL),-1,MkSet(),0,0,kIdl,false},
- //{C,{0.08,0,0,0,NULL,0,0,0,0,0.0},.07,MkSet(),0,0,kIdl,false},
+ //{C,make_hwstate(0.08,0,0,0,NULL),.07,MkSet(),0,0,kIdl,false},
// Two fingers seem to tap, the bigger of which is the only one that
// meets the minimum pressure threshold. Then that higher pressure finger
// is no longer gesturing (e.g., it gets classified as a thumb).
// There should be no tap b/c the one remaining finger didn't meet the
// minimum pressure threshold.
- {S,{0.00,0,2,2,&fs[25],0,0,0,0,0.0},-1,MkSet(95,96),0,0,kFTB,false},
- {C,{0.01,0,2,2,&fs[25],0,0,0,0,0.0},-1,MkSet(96),0,0,kFTB,false},
- {C,{0.02,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kIdl,false},
+ {S,make_hwstate(0.00,0,2,2,&fs[25]),-1,MkSet(95,96),0,0,kFTB,false},
+ {C,make_hwstate(0.01,0,2,2,&fs[25]),-1,MkSet(96),0,0,kFTB,false},
+ {C,make_hwstate(0.02,0,0,0,NULL),-1,MkSet(),0,0,kIdl,false},
// 2f click - shouldn't tap
- {S,{0.00,0,2,2,&fs[0],0,0,0,0,0.0},-1,MkSet(91,92),0,0,kFTB,false},
- {C,{0.01,1,2,2,&fs[0],0,0,0,0,0.0},-1,MkSet(91,92),0,0,kIdl,false},
- {C,{0.02,0,2,2,&fs[0],0,0,0,0,0.0},-1,MkSet(91,92),0,0,kIdl,false},
- {C,{0.03,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kIdl,false},
+ {S,make_hwstate(0.00,0,2,2,&fs[0]),-1,MkSet(91,92),0,0,kFTB,false},
+ {C,make_hwstate(0.01,1,2,2,&fs[0]),-1,MkSet(91,92),0,0,kIdl,false},
+ {C,make_hwstate(0.02,0,2,2,&fs[0]),-1,MkSet(91,92),0,0,kIdl,false},
+ {C,make_hwstate(0.03,0,0,0,NULL),-1,MkSet(),0,0,kIdl,false},
// T5R2 tap tests:
// (1f and 2f tap w/o resting thumb and 1f w/ resting thumb are the same as
// above)
// 2f tap w/ resting thumb
- {T,{0.00,0,1,1,&fs[16],0,0,0,0,0.0},-1,MkSet(70),0,0,kFTB,false},
- {C,{1.00,0,1,1,&fs[16],0,0,0,0,0.0},-1,MkSet(70),0,0,kIdl,false},
- {C,{1.01,0,1,3,&fs[16],0,0,0,0,0.0},-1,MkSet(70),0,0,kFTB,false},
- {C,{1.02,0,2,3,&fs[16],0,0,0,0,0.0},-1,MkSet(70,91),0,0,kFTB,false},
- {C,{1.03,0,0,2,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kFTB,false},
- {C,{1.04,0,1,1,&fs[18],0,0,0,0,0.0},-1,MkSet(71),kBR,kBR,kIdl,false},
+ {T,make_hwstate(0.00,0,1,1,&fs[16]),-1,MkSet(70),0,0,kFTB,false},
+ {C,make_hwstate(1.00,0,1,1,&fs[16]),-1,MkSet(70),0,0,kIdl,false},
+ {C,make_hwstate(1.01,0,1,3,&fs[16]),-1,MkSet(70),0,0,kFTB,false},
+ {C,make_hwstate(1.02,0,2,3,&fs[16]),-1,MkSet(70,91),0,0,kFTB,false},
+ {C,make_hwstate(1.03,0,0,2,NULL),-1,MkSet(),0,0,kFTB,false},
+ {C,make_hwstate(1.04,0,1,1,&fs[18]),-1,MkSet(71),kBR,kBR,kIdl,false},
// 3f tap w/o resting thumb
- {S,{0.00,0,2,3,&fs[0],0,0,0,0,0.0},-1,MkSet(91,92),0,0,kFTB,false},
- {C,{0.01,0,0,1,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kFTB,false},
- {C,{0.02,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),kBM,kBM,kIdl,false},
+ {S,make_hwstate(0.00,0,2,3,&fs[0]),-1,MkSet(91,92),0,0,kFTB,false},
+ {C,make_hwstate(0.01,0,0,1,NULL),-1,MkSet(),0,0,kFTB,false},
+ {C,make_hwstate(0.02,0,0,0,NULL),-1,MkSet(),kBM,kBM,kIdl,false},
// 3f tap w/o resting thumb (slightly different)
- {S,{0.00,0,2,3,&fs[0],0,0,0,0,0.0},-1,MkSet(91,92),0,0,kFTB,false},
- {C,{0.01,0,2,3,&fs[0],0,0,0,0,0.0},-1,MkSet(91,92),0,0,kFTB,false},
- {C,{0.02,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),kBM,kBM,kIdl,false},
+ {S,make_hwstate(0.00,0,2,3,&fs[0]),-1,MkSet(91,92),0,0,kFTB,false},
+ {C,make_hwstate(0.01,0,2,3,&fs[0]),-1,MkSet(91,92),0,0,kFTB,false},
+ {C,make_hwstate(0.02,0,0,0,NULL),-1,MkSet(),kBM,kBM,kIdl,false},
// 3f tap w/ resting thumb
- {S,{0.00,0,1,1,&fs[16],0,0,0,0,0.0},-1,MkSet(70),0,0,kFTB,false},
- {C,{1.00,0,1,1,&fs[16],0,0,0,0,0.0},-1,MkSet(70),0,0,kIdl,false},
- {C,{1.01,0,1,4,&fs[16],0,0,0,0,0.0},-1,MkSet(70),0,0,kFTB,false},
- {C,{1.02,0,2,4,&fs[16],0,0,0,0,0.0},-1,MkSet(70,91),0,0,kFTB,false},
- {C,{1.03,0,1,1,&fs[16],0,0,0,0,0.0},-1,MkSet(70),kBM,kBM,kIdl,false},
+ {S,make_hwstate(0.00,0,1,1,&fs[16]),-1,MkSet(70),0,0,kFTB,false},
+ {C,make_hwstate(1.00,0,1,1,&fs[16]),-1,MkSet(70),0,0,kIdl,false},
+ {C,make_hwstate(1.01,0,1,4,&fs[16]),-1,MkSet(70),0,0,kFTB,false},
+ {C,make_hwstate(1.02,0,2,4,&fs[16]),-1,MkSet(70,91),0,0,kFTB,false},
+ {C,make_hwstate(1.03,0,1,1,&fs[16]),-1,MkSet(70),kBM,kBM,kIdl,false},
// 4f tap w/o resting thumb
- {S,{0.00,0,2,3,&fs[0],0,0,0,0,0.0},-1,MkSet(91,92),0,0,kFTB,false},
- {C,{0.01,0,1,4,&fs[0],0,0,0,0,0.0},-1,MkSet(91),0,0,kFTB,false},
- {C,{0.02,0,2,4,&fs[0],0,0,0,0,0.0},-1,MkSet(91,92),0,0,kFTB,false},
- {C,{0.03,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),kBR,kBR,kIdl,false},
+ {S,make_hwstate(0.00,0,2,3,&fs[0]),-1,MkSet(91,92),0,0,kFTB,false},
+ {C,make_hwstate(0.01,0,1,4,&fs[0]),-1,MkSet(91),0,0,kFTB,false},
+ {C,make_hwstate(0.02,0,2,4,&fs[0]),-1,MkSet(91,92),0,0,kFTB,false},
+ {C,make_hwstate(0.03,0,0,0,NULL),-1,MkSet(),kBR,kBR,kIdl,false},
// 4f tap w/ resting thumb
- {S,{0.00,0,1,1,&fs[16],0,0,0,0,0.0},-1,MkSet(70),0,0,kFTB,false},
- {C,{1.00,0,1,1,&fs[16],0,0,0,0,0.0},-1,MkSet(70),0,0,kIdl,false},
- {C,{1.01,0,1,5,&fs[16],0,0,0,0,0.0},-1,MkSet(70),0,0,kFTB,false},
- {C,{1.02,0,1,1,&fs[16],0,0,0,0,0.0},-1,MkSet(70),kBR,kBR,kIdl,false},
+ {S,make_hwstate(0.00,0,1,1,&fs[16]),-1,MkSet(70),0,0,kFTB,false},
+ {C,make_hwstate(1.00,0,1,1,&fs[16]),-1,MkSet(70),0,0,kIdl,false},
+ {C,make_hwstate(1.01,0,1,5,&fs[16]),-1,MkSet(70),0,0,kFTB,false},
+ {C,make_hwstate(1.02,0,1,1,&fs[16]),-1,MkSet(70),kBR,kBR,kIdl,false},
// 4f tap w/ resting thumb (slightly different)
- {S,{0.00,0,1,1,&fs[16],0,0,0,0,0.0},-1,MkSet(70),0,0,kFTB,false},
- {C,{1.00,0,1,1,&fs[16],0,0,0,0,0.0},-1,MkSet(70),0,0,kIdl,false},
- {C,{1.01,0,1,5,&fs[16],0,0,0,0,0.0},-1,MkSet(70),0,0,kFTB,false},
- {C,{1.02,0,2,5,&fs[16],0,0,0,0,0.0},-1,MkSet(70,91),0,0,kFTB,false},
- {C,{1.03,0,1,1,&fs[16],0,0,0,0,0.0},-1,MkSet(70),kBR,kBR,kIdl,false},
+ {S,make_hwstate(0.00,0,1,1,&fs[16]),-1,MkSet(70),0,0,kFTB,false},
+ {C,make_hwstate(1.00,0,1,1,&fs[16]),-1,MkSet(70),0,0,kIdl,false},
+ {C,make_hwstate(1.01,0,1,5,&fs[16]),-1,MkSet(70),0,0,kFTB,false},
+ {C,make_hwstate(1.02,0,2,5,&fs[16]),-1,MkSet(70,91),0,0,kFTB,false},
+ {C,make_hwstate(1.03,0,1,1,&fs[16]),-1,MkSet(70),kBR,kBR,kIdl,false},
// 3f letting go, shouldn't tap at all
- {S,{0.00,0,2,3,&fs[0],0,0,0,0,0.0},-1,MkSet(91,92),0,0,kFTB,false},
- {C,{1.01,0,2,3,&fs[0],0,0,0,0,0.0},-1,MkSet(91,92),0,0,kIdl,false},
- {C,{1.02,0,0,2,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kIdl,false},
- {C,{1.03,0,2,2,&fs[10],0,0,0,0,0.0},-1,MkSet(97,98),0,0,kIdl,false},
- {C,{1.04,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kIdl,false},
+ {S,make_hwstate(0.00,0,2,3,&fs[0]),-1,MkSet(91,92),0,0,kFTB,false},
+ {C,make_hwstate(1.01,0,2,3,&fs[0]),-1,MkSet(91,92),0,0,kIdl,false},
+ {C,make_hwstate(1.02,0,0,2,NULL),-1,MkSet(),0,0,kIdl,false},
+ {C,make_hwstate(1.03,0,2,2,&fs[10]),-1,MkSet(97,98),0,0,kIdl,false},
+ {C,make_hwstate(1.04,0,0,0,NULL),-1,MkSet(),0,0,kIdl,false},
// tap then move. no drag expected
- {S,{0.00,0,1,1,&fs[0],0,0,0,0,0.0},-1,MkSet(91),0,0,kFTB,false},
- {C,{0.01,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kTpC,true},
- {C,{0.02,0,1,1,&fs[4],0,0,0,0,0.0},-1,MkSet(95),0,0,kSTB,false},
- {C,{0.03,0,1,1,&fs[5],0,0,0,0,0.0},-1,MkSet(95),kBL,kBL,kIdl,false},
- {C,{0.05,0,1,1,&fs[6],0,0,0,0,0.0},-1,MkSet(95),0,0,kIdl,false},
- {C,{0.06,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kIdl,false},
- {C,{0.99,0,0,0,NULL,0,0,0,0,0.0},.99,MkSet(),0,0,kIdl,false},
+ {S,make_hwstate(0.00,0,1,1,&fs[0]),-1,MkSet(91),0,0,kFTB,false},
+ {C,make_hwstate(0.01,0,0,0,NULL),-1,MkSet(),0,0,kTpC,true},
+ {C,make_hwstate(0.02,0,1,1,&fs[4]),-1,MkSet(95),0,0,kSTB,false},
+ {C,make_hwstate(0.03,0,1,1,&fs[5]),-1,MkSet(95),kBL,kBL,kIdl,false},
+ {C,make_hwstate(0.05,0,1,1,&fs[6]),-1,MkSet(95),0,0,kIdl,false},
+ {C,make_hwstate(0.06,0,0,0,NULL),-1,MkSet(),0,0,kIdl,false},
+ {C,make_hwstate(0.99,0,0,0,NULL),.99,MkSet(),0,0,kIdl,false},
};
const size_t kT5R2TestFirstIndex = NonT5R2States(hwsgs, arraysize(hwsgs));
@@ -2193,9 +2190,7 @@
};
unsigned short finger_cnt = fs[0].tracking_id == -1 ? 0 :
(fs[1].tracking_id == -1 ? 1 : 2);
- HardwareState hs = {
- input.now, 0, finger_cnt, finger_cnt, fs, 0, 0, 0, 0, 0.0
- };
+ HardwareState hs = make_hwstate(input.now, 0, finger_cnt, finger_cnt, fs);
stime_t timeout = -1;
Gesture* gs = wrapper.SyncInterpret(&hs, &timeout);
if (finger_cnt > 0) {
@@ -2242,9 +2237,9 @@
};
HardwareState hwstates[] = {
// Simple 1-finger tap
- { 0.01, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
- { 0.02, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 },
- { 0.30, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 }
+ make_hwstate(0.01, 0, 1, 1, &fs),
+ make_hwstate(0.02, 0, 0, 0, NULL),
+ make_hwstate(0.30, 0, 0, 0, NULL),
};
enum {
@@ -2323,17 +2318,17 @@
HWStateGs hwsgs_list[] = {
// 1-finger tap, move, release, move again (drag lock)
- {S,{0.00,0,1,1,&fs[0],0,0,0,0,0.0},-1,MkSet(91),0,0,kFTB,false},
- {C,{0.01,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kTpC,true},
- {C,{0.02,0,1,1,&fs[1],0,0,0,0,0.0},-1,MkSet(92),0,0,kSTB,false},
- {C,{0.08,0,1,1,&fs[2],0,0,0,0,0.0},-1,MkSet(92),kBL,0,kDrg,false},
- {C,{0.09,0,1,1,&fs[3],0,0,0,0,0.0},-1,MkSet(92),0,0,kDrg,false},
- {C,{0.10,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kDRl,true},
- {C,{0.11,0,1,1,&fs[4],0,0,0,0,0.0},-1,MkSet(93),0,0,kDRt,false},
- {C,{0.12,0,1,1,&fs[5],0,0,0,0,0.0},-1,MkSet(93),0,0,kDrg,false},
- {C,{0.13,0,1,1,&fs[6],0,0,0,0,0.0},-1,MkSet(93),0,0,kDrg,false},
- {C,{0.14,0,0,0,NULL,0,0,0,0,0.0},-1,MkSet(),0,0,kDRl,true},
- {C,{0.99,0,0,0,NULL,0,0,0,0,0.0},.99,MkSet(),0,kBL,kIdl,false}
+ {S,make_hwstate(0.00,0,1,1,&fs[0]),-1,MkSet(91),0,0,kFTB,false},
+ {C,make_hwstate(0.01,0,0,0,NULL),-1,MkSet(),0,0,kTpC,true},
+ {C,make_hwstate(0.02,0,1,1,&fs[1]),-1,MkSet(92),0,0,kSTB,false},
+ {C,make_hwstate(0.08,0,1,1,&fs[2]),-1,MkSet(92),kBL,0,kDrg,false},
+ {C,make_hwstate(0.09,0,1,1,&fs[3]),-1,MkSet(92),0,0,kDrg,false},
+ {C,make_hwstate(0.10,0,0,0,NULL),-1,MkSet(),0,0,kDRl,true},
+ {C,make_hwstate(0.11,0,1,1,&fs[4]),-1,MkSet(93),0,0,kDRt,false},
+ {C,make_hwstate(0.12,0,1,1,&fs[5]),-1,MkSet(93),0,0,kDrg,false},
+ {C,make_hwstate(0.13,0,1,1,&fs[6]),-1,MkSet(93),0,0,kDrg,false},
+ {C,make_hwstate(0.14,0,0,0,NULL),-1,MkSet(),0,0,kDRl,true},
+ {C,make_hwstate(0.99,0,0,0,NULL),.99,MkSet(),0,kBL,kIdl,false}
};
for (int iter = 0; iter < 5; ++iter) {
@@ -2480,35 +2475,34 @@
};
ClickTestHardwareStateAndExpectations records[] = {
// reset
- {{0,0,0,0,NULL,0,0,0,0,0.0},-1,0,0},
+ {make_hwstate(0,0,0,0,NULL),-1,0,0},
// button down, 2 fingers touch, button up, 2 fingers lift
- {{1,1,0,0,NULL,0,0,0,0,0.0},-1,0,0},
- {{1.01,1,2,2,&finger_states[0],0,0,0,0,0.0},-1,0,0},
- {{2,0,2,2,&finger_states[0],0,0,0,0,0.0},
+ {make_hwstate(1,1,0,0,NULL),-1,0,0},
+ {make_hwstate(1.01,1,2,2,&finger_states[0]),-1,0,0},
+ {make_hwstate(2,0,2,2,&finger_states[0]),
-1,GESTURES_BUTTON_RIGHT,GESTURES_BUTTON_RIGHT},
- {{3,0,0,0,NULL,0,0,0,0,0.0},-1,0,0},
+ {make_hwstate(3,0,0,0,NULL),-1,0,0},
// button down, 2 close fingers touch, fingers lift
- {{7,1,0,0,NULL,0,0,0,0,0.0},-1,0,0},
- {{7.01,1,2,2,&finger_states[2],0,0,0,0,0.0},-1,0,0},
- {{7.02,0,2,2,&finger_states[2],0,0,0,0,0.0},
+ {make_hwstate(7,1,0,0,NULL),-1,0,0},
+ {make_hwstate(7.01,1,2,2,&finger_states[2]),-1,0,0},
+ {make_hwstate(7.02,0,2,2,&finger_states[2]),
-1,GESTURES_BUTTON_LEFT,GESTURES_BUTTON_LEFT},
- {{8,0,0,0,NULL,0,0,0,0,0.0},-1,0,0},
+ {make_hwstate(8,0,0,0,NULL),-1,0,0},
// button down with 2 fingers, button up, fingers lift
- {{9.01,1,2,2,&finger_states[4],0,0,0,0,0.0},-1,0,0},
- {{9.02,1,2,2,&finger_states[4],0,0,0,0,0.0},-1,0,0},
- {{9.5,0,2,2,&finger_states[4],0,0,0,0,0.0},
+ {make_hwstate(9.01,1,2,2,&finger_states[4]),-1,0,0},
+ {make_hwstate(9.02,1,2,2,&finger_states[4]),-1,0,0},
+ {make_hwstate(9.5,0,2,2,&finger_states[4]),
-1,GESTURES_BUTTON_RIGHT,GESTURES_BUTTON_RIGHT},
- {{10,0,0,0,NULL,0,0,0,0,0.0},-1,0,0},
+ {make_hwstate(10,0,0,0,NULL),-1,0,0},
// button down with 2 fingers, timeout, button up, fingers lift
- {{11,1,2,2,&finger_states[4],0,0,0,0,0.0},-1,0,0},
- {{0,0,0,0,NULL,0,0,0,0,0.0},11.5,GESTURES_BUTTON_RIGHT,0},
- {{12,0,2,2,&finger_states[4],0,0,0,0,0.0},
- -1,0,GESTURES_BUTTON_RIGHT},
- {{10,0,0,0,NULL,0,0,0,0,0.0},-1,0,0}
+ {make_hwstate(11,1,2,2,&finger_states[4]),-1,0,0},
+ {make_hwstate(0,0,0,0,NULL),11.5,GESTURES_BUTTON_RIGHT,0},
+ {make_hwstate(12,0,2,2,&finger_states[4]),-1,0,GESTURES_BUTTON_RIGHT},
+ {make_hwstate(10,0,0,0,NULL),-1,0,0}
};
for (size_t i = 0; i < arraysize(records); ++i) {
@@ -2557,112 +2551,112 @@
0 // has_wheel
};
BigHandsRightClickInputAndExpectations records[] = {
- { { 1329527921.327647, 0, 2, 2, NULL, 0, 0, 0, 0, 0.0 }, 0, 0,
+ { make_hwstate(1329527921.327647, 0, 2, 2, NULL), 0, 0,
{ { 0, 0, 0, 0, 50.013428, 0, 20.250002, 59.400002, 130, 0 },
{ 0, 0, 0, 0, 41.862095, 0, 57.458694, 43.700001, 131, 0 } } },
- { { 1329527921.344421, 0, 2, 2, NULL, 0, 0, 0, 0, 0.0 }, 0, 0,
+ { make_hwstate(1329527921.344421, 0, 2, 2, NULL), 0, 0,
{ { 0, 0, 0, 0, 50.301102, 0, 20.250002, 59.400002, 130, 0 },
{ 0, 0, 0, 0, 42.007469, 0, 57.479977, 43.700001, 131, 0 } } },
- { { 1329527921.361196, 1, 2, 2, NULL, 0, 0, 0, 0, 0.0 }, 0, 0,
+ { make_hwstate(1329527921.361196, 1, 2, 2, NULL), 0, 0,
{ { 0, 0, 0, 0, 50.608433, 0, 20.250002, 59.400002, 130, 0 },
{ 0, 0, 0, 0, 42.065464, 0, 57.494164, 43.700001, 131, 0 } } },
- { { 1329527921.372364, 1, 2, 2, NULL, 0, 0, 0, 0, 0.0 }, 0, 0,
+ { make_hwstate(1329527921.372364, 1, 2, 2, NULL), 0, 0,
{ { 0, 0, 0, 0, 50.840954, 0, 20.250002, 59.400002, 130, 0 },
{ 0, 0, 0, 0, 42.071739, 0, 57.507217, 43.700001, 131, 0 } } },
- { { 1329527921.383517, 1, 2, 2, NULL, 0, 0, 0, 0, 0.0 }, 0, 0,
+ { make_hwstate(1329527921.383517, 1, 2, 2, NULL), 0, 0,
{ { 0, 0, 0, 0, 51.047310, 0, 20.250002, 59.400002, 130, 0 },
{ 0, 0, 0, 0, 42.054974, 0, 57.527523, 43.700001, 131, 0 } } },
- { { 1329527921.394680, 1, 2, 2, NULL, 0, 0, 0, 0, 0.0 }, 0, 0,
+ { make_hwstate(1329527921.394680, 1, 2, 2, NULL), 0, 0,
{ { 0, 0, 0, 0, 51.355824, 0, 20.250002, 59.400002, 130, 0 },
{ 0, 0, 0, 0, 42.066948, 0, 57.550964, 43.700001, 131, 0 } } },
- { { 1329527921.405842, 1, 2, 2, NULL, 0, 0, 0, 0, 0.0 }, 0, 0,
+ { make_hwstate(1329527921.405842, 1, 2, 2, NULL), 0, 0,
{ { 0, 0, 0, 0, 51.791901, 0, 20.250002, 59.400002, 130, 0 },
{ 0, 0, 0, 0, 42.188736, 0, 57.569374, 43.700001, 131, 0 } } },
- { { 1329527921.416791,1,2,2,NULL,0,0,0,0,0.0 },GESTURES_BUTTON_RIGHT,0,
+ { make_hwstate(1329527921.416791, 1, 2, 2, NULL), GESTURES_BUTTON_RIGHT, 0,
{ { 0, 0, 0, 0, 52.264156, 0, 20.250002, 59.400002, 130, 0 },
{ 0, 0, 0, 0, 42.424179, 0, 57.586361, 43.700001, 131, 0 } } },
- { { 1329527921.427937, 1, 2, 2, NULL, 0, 0, 0, 0, 0.0 }, 0, 0,
+ { make_hwstate(1329527921.427937, 1, 2, 2, NULL), 0, 0,
{ { 0, 0, 0, 0, 52.725105, 0, 20.250002, 59.400002, 130, 0 },
{ 0, 0, 0, 0, 42.676739, 0, 57.609421, 43.700001, 131, 0 } } },
- { { 1329527921.439094, 1, 2, 2, NULL, 0, 0, 0, 0, 0.0 }, 0, 0,
+ { make_hwstate(1329527921.439094, 1, 2, 2, NULL), 0, 0,
{ { 0, 0, 0, 0, 53.191925, 0, 20.250002, 59.400002, 130, 0 },
{ 0, 0, 0, 0, 42.868217, 0, 57.640007, 43.700001, 131, 0 } } },
- { { 1329527921.461392, 1, 2, 2, NULL, 0, 0, 0, 0, 0.0 }, 0, 0,
+ { make_hwstate(1329527921.461392, 1, 2, 2, NULL), 0, 0,
{ { 0, 0, 0, 0, 53.602665, 0, 20.250002, 59.400002, 130, 0 },
{ 0, 0, 0, 0, 43.016544, 0, 57.676689, 43.700001, 131, 0 } } },
- { { 1329527921.483690, 1, 2, 2, NULL, 0, 0, 0, 0, 0.0 }, 0, 0,
+ { make_hwstate(1329527921.483690, 1, 2, 2, NULL), 0, 0,
{ { 0, 0, 0, 0, 53.879429, 0, 20.250002, 59.400002, 130, 0 },
{ 0, 0, 0, 0, 43.208221, 0, 57.711613, 43.700001, 131, 0 } } },
- { { 1329527921.511815, 1, 2, 2, NULL, 0, 0, 0, 0, 0.0 }, 0, 0,
+ { make_hwstate(1329527921.511815, 1, 2, 2, NULL), 0, 0,
{ { 0, 0, 0, 0, 54.059937, 0, 20.250002, 59.400002, 130, 0 },
{ 0, 0, 0, 0, 43.467258, 0, 57.736385, 43.700001, 131, 0 } } },
- { { 1329527921.539940, 1, 2, 2, NULL, 0, 0, 0, 0, 0.0 }, 0, 0,
+ { make_hwstate(1329527921.539940, 1, 2, 2, NULL), 0, 0,
{ { 0, 0, 0, 0, 54.253189, 0, 20.250002, 59.400002, 130, 0 },
{ 0, 0, 0, 0, 43.717934, 0, 57.750286, 43.700001, 131, 0 } } },
- { { 1329527921.556732, 1, 2, 2, NULL, 0, 0, 0, 0, 0.0 }, 0, 0,
+ { make_hwstate(1329527921.556732, 1, 2, 2, NULL), 0, 0,
{ { 0, 0, 0, 0, 54.500740, 0, 20.250002, 59.400002, 130, 0 },
{ 0, 0, 0, 0, 43.863792, 0, 57.758759, 43.700001, 131, 0 } } },
- { { 1329527921.573523, 1, 2, 2, NULL, 0, 0, 0, 0, 0.0 }, 0, 0,
+ { make_hwstate(1329527921.573523, 1, 2, 2, NULL), 0, 0,
{ { 0, 0, 0, 0, 54.737640, 0, 20.250002, 59.400002, 130, 0 },
{ 0, 0, 0, 0, 43.825844, 0, 57.771137, 43.700001, 131, 0 } } },
- { { 1329527921.584697, 1, 2, 2, NULL, 0, 0, 0, 0, 0.0 }, 0, 0,
+ { make_hwstate(1329527921.584697, 1, 2, 2, NULL), 0, 0,
{ { 0, 0, 0, 0, 54.906223, 0, 20.250002, 59.400002, 130, 0 },
{ 0, 0, 0, 0, 43.654804, 0, 57.790218, 43.700001, 131, 0 } } },
- { { 1329527921.595872, 1, 2, 2, NULL, 0, 0, 0, 0, 0.0 }, 0, 0,
+ { make_hwstate(1329527921.595872, 1, 2, 2, NULL), 0, 0,
{ { 0, 0, 0, 0, 55.001118, 0, 20.250002, 59.400002, 130, 0 },
{ 0, 0, 0, 0, 43.542431, 0, 57.809731, 43.700001, 131, 0 } } },
- { { 1329527921.618320, 1, 2, 2, NULL, 0, 0, 0, 0, 0.0 }, 0, 0,
+ { make_hwstate(1329527921.618320, 1, 2, 2, NULL), 0, 0,
{ { 0, 0, 0, 0, 55.039989, 0, 20.252811, 59.400002, 130, 0 },
{ 0, 0, 0, 0, 43.585777, 0, 57.824154, 43.700001, 131, 0 } } },
- { { 1329527921.640768, 1, 2, 2, NULL, 0, 0, 0, 0, 0.0 }, 0, 0,
+ { make_hwstate(1329527921.640768, 1, 2, 2, NULL), 0, 0,
{ { 0, 0, 0, 0, 55.045246, 0, 20.264456, 59.400002, 130, 0 },
{ 0, 0, 0, 0, 43.715435, 0, 57.832584, 43.700001, 131, 0 } } },
- { { 1329527921.691161, 1, 2, 2, NULL, 0, 0, 0, 0, 0.0 }, 0, 0,
+ { make_hwstate(1329527921.691161, 1, 2, 2, NULL), 0, 0,
{ { 0, 0, 0, 0, 55.068935, 0, 20.285036, 59.400002, 130, 0 },
{ 0, 0, 0, 0, 43.845741, 0, 57.836266, 43.700001, 131, 0 } } },
- { { 1329527921.741554, 1, 2, 2, NULL, 0, 0, 0, 0, 0.0 }, 0, 0,
+ { make_hwstate(1329527921.741554, 1, 2, 2, NULL), 0, 0,
{ { 0, 0, 0, 0, 55.195026, 0, 20.306564, 59.400002, 130, 0 },
{ 0, 0, 0, 0, 43.941154, 0, 57.836994, 43.700001, 131, 0 } } },
- { { 1329527921.758389, 1, 2, 2, NULL, 0, 0, 0, 0, 0.0 }, 0, 0,
+ { make_hwstate(1329527921.758389, 1, 2, 2, NULL), 0, 0,
{ { 0, 0, 0, 0, 55.430550, 0, 20.322674, 59.400002, 130, 0 },
{ 0, 0, 0, 0, 43.962692, 0, 57.836308, 43.700001, 131, 0 } } },
- { { 1329527921.775225, 1, 2, 2, NULL, 0, 0, 0, 0, 0.0 }, 0, 0,
+ { make_hwstate(1329527921.775225, 1, 2, 2, NULL), 0, 0,
{ { 0, 0, 0, 0, 55.681423, 0, 20.332201, 59.400002, 130, 0 },
{ 0, 0, 0, 0, 43.846741, 0, 57.835224, 43.700001, 131, 0 } } },
- { { 1329527921.786418, 1, 2, 2, NULL, 0, 0, 0, 0, 0.0 }, 0, 0,
+ { make_hwstate(1329527921.786418, 1, 2, 2, NULL), 0, 0,
{ { 0, 0, 0, 0, 55.803486, 0, 20.336439, 59.400002, 130, 0 },
{ 0, 0, 0, 0, 43.604134, 0, 57.834267, 43.700001, 131, 0 } } },
- { { 1329527921.803205, 1, 2, 2, NULL, 0, 0, 0, 0, 0.0 }, 0, 0,
+ { make_hwstate(1329527921.803205, 1, 2, 2, NULL), 0, 0,
{ { 0, 0, 0, 0, 55.738258, 0, 20.337351, 59.396629, 130, 0 },
{ 0, 0, 0, 0, 43.340977, 0, 57.833622, 43.700001, 131, 0 } } },
- { { 1329527921.819993, 1, 2, 2, NULL, 0, 0, 0, 0, 0.0 }, 0, 0,
+ { make_hwstate(1329527921.819993, 1, 2, 2, NULL), 0, 0,
{ { 0, 0, 0, 0, 55.647045, 0, 20.336643, 59.382656, 130, 0 },
{ 0, 0, 0, 0, 43.140343, 0, 57.833279, 43.700001, 131, 0 } } },
- { { 1329527921.831121, 1, 2, 2, NULL, 0, 0, 0, 0, 0.0 }, 0, 0,
+ { make_hwstate(1329527921.831121, 1, 2, 2, NULL), 0, 0,
{ { 0, 0, 0, 0, 55.670898, 0, 20.335459, 59.357960, 130, 0 },
{ 0, 0, 0, 0, 43.019653, 0, 57.827530, 43.700001, 131, 0 } } },
- { { 1329527921.842232, 1, 2, 2, NULL, 0, 0, 0, 0, 0.0 }, 0, 0,
+ { make_hwstate(1329527921.842232, 1, 2, 2, NULL), 0, 0,
{ { 0, 0, 0, 0, 55.769543, 0, 20.334396, 59.332127, 130, 0 },
{ 0, 0, 0, 0, 42.964531, 0, 57.807049, 43.700001, 131, 0 } } },
- { { 1329527921.853342, 1, 2, 2, NULL, 0, 0, 0, 0, 0.0 }, 0, 0,
+ { make_hwstate(1329527921.853342, 1, 2, 2, NULL), 0, 0,
{ { 0, 0, 0, 0, 55.872444, 0, 20.333672, 59.312794, 130, 0 },
{ 0, 0, 0, 0, 42.951347, 0, 57.771957, 43.700001, 131, 0 } } },
- { { 1329527921.864522, 1, 2, 2, NULL, 0, 0, 0, 0, 0.0 }, 0, 0,
+ { make_hwstate(1329527921.864522, 1, 2, 2, NULL), 0, 0,
{ { 0, 0, 0, 0, 55.949341, 0, 20.333281, 59.301361, 130, 0 },
{ 0, 0, 0, 0, 42.959034, 0, 57.729061, 43.700001, 131, 0 } } },
- { { 1329527921.875702, 1, 2, 2, NULL, 0, 0, 0, 0, 0.0 }, 0, 0,
+ { make_hwstate(1329527921.875702, 1, 2, 2, NULL), 0, 0,
{ { 0, 0, 0, 0, 55.994751, 0, 20.333134, 59.296276, 130, 0 },
{ 0, 0, 0, 0, 42.973259, 0, 57.683277, 43.700001, 131, 0 } } },
- { { 1329527921.886840, 1, 2, 2, NULL, 0, 0, 0, 0, 0.0 }, 0, 0,
+ { make_hwstate(1329527921.886840, 1, 2, 2, NULL), 0, 0,
{ { 0, 0, 0, 0, 56.014912, 0, 20.333128, 59.295181, 130, 0 },
{ 0, 0, 0, 0, 42.918892, 0, 57.640221, 43.700001, 131, 0 } } },
- { { 1329527921.898031, 1, 2, 2, NULL, 0, 0, 0, 0, 0.0 }, 0, 0,
+ { make_hwstate(1329527921.898031, 1, 2, 2, NULL), 0, 0,
{ { 0, 0, 0, 0, 55.951756, 0, 20.333181, 59.296028, 130, 0 },
{ 0, 0, 0, 0, 42.715969, 0, 57.601479, 43.700001, 131, 0 } } },
- { { 1329527921.909149, 1, 2, 2, NULL, 0, 0, 0, 0, 0.0 }, 0, 0,
+ { make_hwstate(1329527921.909149, 1, 2, 2, NULL), 0, 0,
{ { 0, 0, 0, 0, 55.736336, 0, 20.333244, 59.297451, 130, 0 },
{ 0, 0, 0, 0, 42.304108, 0, 57.563725, 43.700001, 131, 0 } } },
- { { 1329527921.920301,0,2,2,NULL,0,0,0,0,0.0 },0,GESTURES_BUTTON_RIGHT,
+ { make_hwstate(1329527921.920301, 0, 2, 2, NULL), 0, GESTURES_BUTTON_RIGHT,
{ { 0, 0, 0, 0, 55.448730, 0, 20.333294, 59.298725, 130, 0 },
{ 0, 0, 0, 0, 41.444939, 0, 57.525326, 43.700001, 131, 0 } } }
};
@@ -2718,16 +2712,16 @@
HardwareState hardware_states[] = {
// time, buttons down, finger count, finger states pointer
// One finger moves
- { 0.10, 0, 1, 1, &finger_states[1], 0, 0, 0, 0, 0.0 },
- { 0.12, 0, 1, 1, &finger_states[2], 0, 0, 0, 0, 0.0 },
- { 0.16, 0, 1, 1, &finger_states[3], 0, 0, 0, 0, 0.0 },
- { 0.5, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 },
+ make_hwstate(0.10, 0, 1, 1, &finger_states[1]),
+ make_hwstate(0.12, 0, 1, 1, &finger_states[2]),
+ make_hwstate(0.16, 0, 1, 1, &finger_states[3]),
+ make_hwstate(0.5, 0, 0, 0, NULL),
// One finger moves after another finger leaves
- { 1.09, 0, 2, 2, &finger_states[0], 0, 0, 0, 0, 0.0 },
- { 1.10, 0, 1, 1, &finger_states[1], 0, 0, 0, 0, 0.0 },
- { 1.12, 0, 1, 1, &finger_states[2], 0, 0, 0, 0, 0.0 },
- { 1.36, 0, 1, 1, &finger_states[3], 0, 0, 0, 0, 0.0 },
- { 1.5, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 },
+ make_hwstate(1.09, 0, 2, 2, &finger_states[0]),
+ make_hwstate(1.10, 0, 1, 1, &finger_states[1]),
+ make_hwstate(1.12, 0, 1, 1, &finger_states[2]),
+ make_hwstate(1.36, 0, 1, 1, &finger_states[3]),
+ make_hwstate(1.5, 0, 0, 0, NULL),
};
TestInterpreterWrapper wrapper(&ii, &hwprops);
@@ -2857,52 +2851,52 @@
PinchTestInput input_states[] = {
// time, buttons, finger count, touch count, finger states pointer
- {{ 0.00, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 }, kAny},
+ {make_hwstate(0.00, 0, 0, 0, NULL), kAny},
// fast pinch outwards
- {{ 0.11, 0, 2, 2, &finger_states[0], 0, 0, 0, 0, 0.0 }, kAny},
- {{ 0.12, 0, 2, 2, &finger_states[4], 0, 0, 0, 0, 0.0 }, kAny},
- {{ 0.13, 0, 2, 2, &finger_states[8], 0, 0, 0, 0, 0.0 }, kAny},
- {{ 0.14, 0, 2, 2, &finger_states[10], 0, 0, 0, 0, 0.0 }, kPinch},
- {{ 0.15, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 }, kAny},
+ {make_hwstate(0.11, 0, 2, 2, &finger_states[0]), kAny},
+ {make_hwstate(0.12, 0, 2, 2, &finger_states[4]), kAny},
+ {make_hwstate(0.13, 0, 2, 2, &finger_states[8]), kAny},
+ {make_hwstate(0.14, 0, 2, 2, &finger_states[10]), kPinch},
+ {make_hwstate(0.15, 0, 0, 0, NULL), kAny},
// slow pinch
- {{ 1.01, 0, 2, 2, &finger_states[0], 0, 0, 0, 0, 0.0 }, kAny},
- {{ 1.02, 0, 2, 2, &finger_states[0], 0, 0, 0, 0, 0.0 }, kAny},
- {{ 1.03, 0, 2, 2, &finger_states[2], 0, 0, 0, 0, 0.0 }, kAny},
- {{ 1.04, 0, 2, 2, &finger_states[2], 0, 0, 0, 0, 0.0 }, kAny},
- {{ 1.05, 0, 2, 2, &finger_states[4], 0, 0, 0, 0, 0.0 }, kAny},
- {{ 1.06, 0, 2, 2, &finger_states[4], 0, 0, 0, 0, 0.0 }, kAny},
- {{ 1.07, 0, 2, 2, &finger_states[6], 0, 0, 0, 0, 0.0 }, kAny},
- {{ 1.08, 0, 2, 2, &finger_states[6], 0, 0, 0, 0, 0.0 }, kAny},
- {{ 1.09, 0, 2, 2, &finger_states[8], 0, 0, 0, 0, 0.0 }, kAny},
- {{ 1.10, 0, 2, 2, &finger_states[8], 0, 0, 0, 0, 0.0 }, kAny},
- {{ 1.11, 0, 2, 2, &finger_states[10], 0, 0, 0, 0, 0.0 }, kAny},
- {{ 1.12, 0, 2, 2, &finger_states[10], 0, 0, 0, 0, 0.0 }, kPinch},
- {{ 1.13, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 }, kAny},
+ {make_hwstate(1.01, 0, 2, 2, &finger_states[0]), kAny},
+ {make_hwstate(1.02, 0, 2, 2, &finger_states[0]), kAny},
+ {make_hwstate(1.03, 0, 2, 2, &finger_states[2]), kAny},
+ {make_hwstate(1.04, 0, 2, 2, &finger_states[2]), kAny},
+ {make_hwstate(1.05, 0, 2, 2, &finger_states[4]), kAny},
+ {make_hwstate(1.06, 0, 2, 2, &finger_states[4]), kAny},
+ {make_hwstate(1.07, 0, 2, 2, &finger_states[6]), kAny},
+ {make_hwstate(1.08, 0, 2, 2, &finger_states[6]), kAny},
+ {make_hwstate(1.09, 0, 2, 2, &finger_states[8]), kAny},
+ {make_hwstate(1.10, 0, 2, 2, &finger_states[8]), kAny},
+ {make_hwstate(1.11, 0, 2, 2, &finger_states[10]), kAny},
+ {make_hwstate(1.12, 0, 2, 2, &finger_states[10]), kPinch},
+ {make_hwstate(1.13, 0, 0, 0, NULL), kAny},
// single finger pinch
- {{ 2.01, 0, 2, 2, &finger_states[22], 0, 0, 0, 0, 0.0 }, kAny},
- {{ 2.02, 0, 2, 2, &finger_states[26], 0, 0, 0, 0, 0.0 }, kAny},
- {{ 2.03, 0, 2, 2, &finger_states[30], 0, 0, 0, 0, 0.0 }, kAny},
- {{ 2.04, 0, 2, 2, &finger_states[32], 0, 0, 0, 0, 0.0 }, kNoPinch},
- {{ 2.05, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 }, kAny},
+ {make_hwstate(2.01, 0, 2, 2, &finger_states[22]), kAny},
+ {make_hwstate(2.02, 0, 2, 2, &finger_states[26]), kAny},
+ {make_hwstate(2.03, 0, 2, 2, &finger_states[30]), kAny},
+ {make_hwstate(2.04, 0, 2, 2, &finger_states[32]), kNoPinch},
+ {make_hwstate(2.05, 0, 0, 0, NULL), kAny},
// first single finger pinch, then second moves too.
- {{ 3.01, 0, 2, 2, &finger_states[22], 0, 0, 0, 0, 0.0 }, kAny},
- {{ 3.02, 0, 2, 2, &finger_states[24], 0, 0, 0, 0, 0.0 }, kAny},
- {{ 3.03, 0, 2, 2, &finger_states[6], 0, 0, 0, 0, 0.0 }, kAny},
- {{ 3.04, 0, 2, 2, &finger_states[8], 0, 0, 0, 0, 0.0 }, kAny},
- {{ 3.05, 0, 2, 2, &finger_states[10], 0, 0, 0, 0, 0.0 }, kPinch},
- {{ 3.06, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 }, kAny},
+ {make_hwstate(3.01, 0, 2, 2, &finger_states[22]), kAny},
+ {make_hwstate(3.02, 0, 2, 2, &finger_states[24]), kAny},
+ {make_hwstate(3.03, 0, 2, 2, &finger_states[6]), kAny},
+ {make_hwstate(3.04, 0, 2, 2, &finger_states[8]), kAny},
+ {make_hwstate(3.05, 0, 2, 2, &finger_states[10]), kPinch},
+ {make_hwstate(3.06, 0, 0, 0, NULL), kAny},
// fast pinch inwards
- {{ 4.01, 0, 2, 2, &finger_states[10], 0, 0, 0, 0, 0.0 }, kAny},
- {{ 4.02, 0, 2, 2, &finger_states[8], 0, 0, 0, 0, 0.0 }, kAny},
- {{ 4.03, 0, 2, 2, &finger_states[4], 0, 0, 0, 0, 0.0 }, kAny},
- {{ 4.04, 0, 2, 2, &finger_states[0], 0, 0, 0, 0, 0.0 }, kPinch},
- {{ 4.05, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 }, kAny},
+ {make_hwstate(4.01, 0, 2, 2, &finger_states[10]), kAny},
+ {make_hwstate(4.02, 0, 2, 2, &finger_states[8]), kAny},
+ {make_hwstate(4.03, 0, 2, 2, &finger_states[4]), kAny},
+ {make_hwstate(4.04, 0, 2, 2, &finger_states[0]), kPinch},
+ {make_hwstate(4.05, 0, 0, 0, NULL), kAny},
};
TestInterpreterWrapper wrapper(&ii, &hwprops);
@@ -3075,7 +3069,7 @@
{ 0, 0, 0, 0, input.p0, 0, input.x0, input.y0, 1, 0 },
{ 0, 0, 0, 0, input.p1, 0, input.x1, input.y1, 2, 0 },
};
- HardwareState hs = { input.now, 0, 2, 2, fs, 0, 0, 0, 0, 0.0 };
+ HardwareState hs = make_hwstate(input.now, 0, 2, 2, fs);
stime_t timeout = -1;
Gesture* gs = wrapper.SyncInterpret(&hs, &timeout);
if (input.expected_gesture != kAny) {
@@ -3121,10 +3115,10 @@
HardwareState old_hardware_states[] = {
// time, buttons down, finger count, touch count, finger states pointer
- { 0.05, 0, 1, 1, &old_finger_states[0], 0, 0, 0, 0, 0.0 },
- { 0.10, 0, 1, 1, &old_finger_states[1], 0, 0, 0, 0, 0.0 },
- { 0.15, 0, 1, 1, &old_finger_states[2], 0, 0, 0, 0, 0.0 },
- { 0.20, 0, 1, 1, &old_finger_states[3], 0, 0, 0, 0, 0.0 },
+ make_hwstate(0.05, 0, 1, 1, &old_finger_states[0]),
+ make_hwstate(0.10, 0, 1, 1, &old_finger_states[1]),
+ make_hwstate(0.15, 0, 1, 1, &old_finger_states[2]),
+ make_hwstate(0.20, 0, 1, 1, &old_finger_states[3]),
};
TestInterpreterWrapper wrapper(&ii, &old_hwprops);
@@ -3165,10 +3159,10 @@
HardwareState new_hardware_states[] = {
// time, buttons down, finger count, touch count, finger states pointer
- { 0.05, 0, 1, 1, &new_finger_states[0], 0, 0, 0, 0, 0.0 },
- { 0.10, 0, 1, 1, &new_finger_states[1], 0, 0, 0, 0, 0.0 },
- { 0.15, 0, 1, 1, &new_finger_states[2], 0, 0, 0, 0, 0.0 },
- { 0.20, 0, 1, 1, &new_finger_states[3], 0, 0, 0, 0, 0.0 },
+ make_hwstate(0.05, 0, 1, 1, &new_finger_states[0]),
+ make_hwstate(0.10, 0, 1, 1, &new_finger_states[1]),
+ make_hwstate(0.15, 0, 1, 1, &new_finger_states[2]),
+ make_hwstate(0.20, 0, 1, 1, &new_finger_states[3]),
};
wrapper.Reset(&ii, &new_hwprops);
@@ -3224,12 +3218,12 @@
HardwareState hardware_states[] = {
// time, buttons down, finger count, touch count, finger states pointer
- { 2106.273252, 0, 1, 1, &finger_state[0], 0, 0, 0, 0, 0.0 },
- { 2106.285466, 0, 1, 1, &finger_state[1], 0, 0, 0, 0, 0.0 },
- { 2106.298021, 0, 1, 1, &finger_state[2], 0, 0, 0, 0, 0.0 },
- { 2106.325599, 0, 2, 2, &finger_state[3], 0, 0, 0, 0, 0.0 },
- { 2106.648152, 0, 2, 2, &finger_state[5], 0, 0, 0, 0, 0.0 },
- { 2106.660447, 0, 2, 2, &finger_state[7], 0, 0, 0, 0, 0.0 },
+ make_hwstate(2106.273252, 0, 1, 1, &finger_state[0]),
+ make_hwstate(2106.285466, 0, 1, 1, &finger_state[1]),
+ make_hwstate(2106.298021, 0, 1, 1, &finger_state[2]),
+ make_hwstate(2106.325599, 0, 2, 2, &finger_state[3]),
+ make_hwstate(2106.648152, 0, 2, 2, &finger_state[5]),
+ make_hwstate(2106.660447, 0, 2, 2, &finger_state[7]),
// pinch if not semi_mt device
};
@@ -3301,10 +3295,10 @@
HardwareState hardware_states[] = {
// time, buttons down, finger count, touch count, finger states pointer
- { 3897.124791, 0, 2, 2, &finger_state[0], 0, 0, 0, 0, 0.0 },
- { 3897.136733, 0, 2, 2, &finger_state[2], 0, 0, 0, 0, 0.0 },
- { 3897.148675, 0, 1, 1, &finger_state[4], 0, 0, 0, 0, 0.0 },
- { 3897.160675, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 },
+ make_hwstate(3897.124791, 0, 2, 2, &finger_state[0]),
+ make_hwstate(3897.136733, 0, 2, 2, &finger_state[2]),
+ make_hwstate(3897.148675, 0, 1, 1, &finger_state[4]),
+ make_hwstate(3897.160675, 0, 0, 0, NULL),
};
ii.tap_enable_.val_ = 1;
@@ -3370,14 +3364,14 @@
};
HardwareState hardware_states[] = {
// time, buttons, finger count, touch count, finger states pointer
- { 1.00, 0, 2, 2, &finger_states[0], 0, 0, 0, 0, 0.0 },
- { 1.01, 0, 2, 2, &finger_states[2], 0, 0, 0, 0, 0.0 },
- { 1.02, 0, 2, 2, &finger_states[4], 0, 0, 0, 0, 0.0 },
- { 1.03, 0, 2, 2, &finger_states[6], 0, 0, 0, 0, 0.0 },
- { 1.04, 0, 2, 2, &finger_states[8], 0, 0, 0, 0, 0.0 },
- { 1.05, 0, 2, 2, &finger_states[10], 0, 0, 0, 0, 0.0 },
- { 1.06, 0, 2, 2, &finger_states[12], 0, 0, 0, 0, 0.0 },
- { 1.07, 0, 2, 2, &finger_states[14], 0, 0, 0, 0, 0.0 },
+ make_hwstate(1.00, 0, 2, 2, &finger_states[0]),
+ make_hwstate(1.01, 0, 2, 2, &finger_states[2]),
+ make_hwstate(1.02, 0, 2, 2, &finger_states[4]),
+ make_hwstate(1.03, 0, 2, 2, &finger_states[6]),
+ make_hwstate(1.04, 0, 2, 2, &finger_states[8]),
+ make_hwstate(1.05, 0, 2, 2, &finger_states[10]),
+ make_hwstate(1.06, 0, 2, 2, &finger_states[12]),
+ make_hwstate(1.07, 0, 2, 2, &finger_states[14]),
};
TestInterpreterWrapper wrapper(&ii, &hwprops);
@@ -3459,11 +3453,11 @@
HardwareState hardware_states[] = {
// time, buttons down, finger count, touch count, finger states pointer
- { 1296.498245, 0, 2, 2, &finger_state[0], 0, 0, 0, 0, 0.0 },
- { 1296.510735, 0, 2, 2, &finger_state[2], 0, 0, 0, 0, 0.0 },
- { 1296.523224, 0, 2, 2, &finger_state[4], 0, 0, 0, 0, 0.0 },
- { 1296.535753, 0, 2, 2, &finger_state[6], 0, 0, 0, 0, 0.0 },
- { 1296.548282, 0, 1, 1, &finger_state[8], 0, 0, 0, 0, 0.0 },
+ make_hwstate(1296.498245, 0, 2, 2, &finger_state[0]),
+ make_hwstate(1296.510735, 0, 2, 2, &finger_state[2]),
+ make_hwstate(1296.523224, 0, 2, 2, &finger_state[4]),
+ make_hwstate(1296.535753, 0, 2, 2, &finger_state[6]),
+ make_hwstate(1296.548282, 0, 1, 1, &finger_state[8]),
};
// SemiMt-specific properties
@@ -3509,17 +3503,17 @@
HardwareState hardware_states[] = {
// time, buttons down, finger count, touch count, finger states pointer
- { 0.1, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 },
- { 0.3, GESTURES_BUTTON_LEFT, 0, 0, NULL, 0, 0, 0, 0, 0.0 }, // delay left
+ make_hwstate(0.1, 0, 0, 0, NULL),
+ make_hwstate(0.3, GESTURES_BUTTON_LEFT, 0, 0, NULL), // delay left
// button down
- { 0.5, GESTURES_BUTTON_LEFT, 0, 0, NULL, 0, 0, 0, 0, 0.0 },
- { 0.9, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 }, // left up
- { 1.1, GESTURES_BUTTON_RIGHT, 0, 0, NULL, 0, 0, 0, 0, 0.0 }, // delay right
+ make_hwstate(0.5, GESTURES_BUTTON_LEFT, 0, 0, NULL),
+ make_hwstate(0.9, 0, 0, 0, NULL), // left up
+ make_hwstate(1.1, GESTURES_BUTTON_RIGHT, 0, 0, NULL), // delay right
// button down
- { 1.3, GESTURES_BUTTON_RIGHT, 0, 0, NULL, 0, 0, 0, 0, 0.0 },
- { 1.5, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 }, // right up
- { 1.6, GESTURES_BUTTON_LEFT, 0, 0, NULL, 0, 0, 0, 0, 0.0 }, // left down
- { 1.7, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 }, // short left button up (<.3s)
+ make_hwstate(1.3, GESTURES_BUTTON_RIGHT, 0, 0, NULL),
+ make_hwstate(1.5, 0, 0, 0, NULL), // right up
+ make_hwstate(1.6, GESTURES_BUTTON_LEFT, 0, 0, NULL), // left down
+ make_hwstate(1.7, 0, 0, 0, NULL), // short left button up (<.3s)
};
TestInterpreterWrapper wrapper(&ii, &hwprops);
diff --git a/src/integral_gesture_filter_interpreter_unittest.cc b/src/integral_gesture_filter_interpreter_unittest.cc
index e494588..77c19db 100644
--- a/src/integral_gesture_filter_interpreter_unittest.cc
+++ b/src/integral_gesture_filter_interpreter_unittest.cc
@@ -68,7 +68,7 @@
1].details.scroll.stop_fling = 1;
FingerState fs = { 0, 0, 0, 0, 1, 0, 0, 0, 1, 0 };
- HardwareState hs = { 10000, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 };
+ HardwareState hs = make_hwstate(10000, 0, 1, 1, &fs);
GestureType expected_types[] = {
kGestureTypeScroll,
@@ -124,9 +124,9 @@
FingerState fs = { 0, 0, 0, 0, 1, 0, 0, 0, 1, 0 };
HardwareState hs[] = {
- { 10000.00, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
- { 10000.01, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 },
- { 10000.02, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
+ make_hwstate(10000.00, 0, 1, 1, &fs),
+ make_hwstate(10000.01, 0, 0, 0, NULL),
+ make_hwstate(10000.02, 0, 1, 1, &fs),
};
size_t iter = 0;
@@ -154,8 +154,8 @@
Gesture(kGestureScroll, 0, 0, 0.0, 0.0));
HardwareState hs[] = {
- { 10000.00, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 },
- { 10000.01, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 },
+ make_hwstate(10000.00, 0, 0, 0, NULL),
+ make_hwstate(10000.01, 0, 0, 0, NULL),
};
size_t iter = 0;
diff --git a/src/interpreter_unittest.cc b/src/interpreter_unittest.cc
index 8ecef41..3f67d91 100644
--- a/src/interpreter_unittest.cc
+++ b/src/interpreter_unittest.cc
@@ -110,10 +110,7 @@
// TM, Tm, WM, Wm, Press, Orientation, X, Y, TrID
0, 0, 0, 0, 10, 0, 50, 50, 1, 0
};
- HardwareState hardware_state = {
- // time, buttons, finger count, touch count, finger states pointer
- 200000, 0, 1, 1, &finger_state, 0, 0, 0, 0, 0.0
- };
+ HardwareState hardware_state = make_hwstate(200000, 0, 1, 1, &finger_state);
stime_t timeout = -1.0;
base_interpreter->expected_hwstate_ = &hardware_state;
@@ -172,10 +169,7 @@
// TM, Tm, WM, Wm, Press, Orientation, X, Y, TrID
0, 0, 0, 0, 10, 0, 50, 50, 1, 0
};
- HardwareState hardware_state = {
- // time, buttons, finger count, touch count, finger states pointer
- 200000, 0, 1, 1, &finger_state, 0, 0, 0, 0, 0.0
- };
+ HardwareState hardware_state = make_hwstate(200000, 0, 1, 1, &finger_state);
stime_t timeout = -1.0;
wrapper.SyncInterpret(&hardware_state, &timeout);
EXPECT_EQ(base_interpreter->log_->size(), 1);
diff --git a/src/logging_filter_interpreter_unittest.cc b/src/logging_filter_interpreter_unittest.cc
index c09bb4b..3413a0a 100644
--- a/src/logging_filter_interpreter_unittest.cc
+++ b/src/logging_filter_interpreter_unittest.cc
@@ -52,10 +52,7 @@
// TM, Tm, WM, Wm, Press, Orientation, X, Y, TrID
0, 0, 0, 0, 10, 0, 50, 50, 1, 0
};
- HardwareState hardware_state = {
- // time, buttons, finger count, touch count, finger states pointer
- 200000, 0, 1, 1, &finger_state, 0, 0, 0, 0, 0.0
- };
+ HardwareState hardware_state = make_hwstate(200000, 0, 1, 1, &finger_state);
stime_t timeout = -1.0;
wrapper.SyncInterpret(&hardware_state, &timeout);
EXPECT_EQ(interpreter.log_->size(), 1);
diff --git a/src/lookahead_filter_interpreter_unittest.cc b/src/lookahead_filter_interpreter_unittest.cc
index f131391..d40cc68 100644
--- a/src/lookahead_filter_interpreter_unittest.cc
+++ b/src/lookahead_filter_interpreter_unittest.cc
@@ -118,19 +118,19 @@
};
HardwareState hs[] = {
// Expect movement to take
- { 1.01, 0, 1, 1, &fs[0], 0, 0, 0, 0, 0.0 },
- { 1.02, 0, 1, 1, &fs[1], 0, 0, 0, 0, 0.0 },
- { 1.03, 0, 1, 1, &fs[2], 0, 0, 0, 0, 0.0 },
+ make_hwstate(1.01, 0, 1, 1, &fs[0]),
+ make_hwstate(1.02, 0, 1, 1, &fs[1]),
+ make_hwstate(1.03, 0, 1, 1, &fs[2]),
// Expect no movement
- { 2.010, 0, 1, 1, &fs[3], 0, 0, 0, 0, 0.0 },
- { 2.030, 0, 1, 1, &fs[4], 0, 0, 0, 0, 0.0 },
- { 2.031, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 },
+ make_hwstate(2.010, 0, 1, 1, &fs[3]),
+ make_hwstate(2.030, 0, 1, 1, &fs[4]),
+ make_hwstate(2.031, 0, 0, 0, NULL),
// Expect movement b/c it's moving really fast
- { 3.010, 0, 1, 1, &fs[5], 0, 0, 0, 0, 0.0 },
- { 3.011, 0, 1, 1, &fs[6], 0, 0, 0, 0, 0.0 },
- { 3.030, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 }
+ make_hwstate(3.010, 0, 1, 1, &fs[5]),
+ make_hwstate(3.011, 0, 1, 1, &fs[6]),
+ make_hwstate(3.030, 0, 0, 0, NULL),
};
stime_t expected_timeout = 0.0;
@@ -250,9 +250,9 @@
};
HardwareState hs[] = {
// Expect movement to take
- { 1.01, 0, 1, 1, &fs[0], 0, 0, 0, 0, 0.0 },
- { 1.02, 0, 1, 1, &fs[1], 0, 0, 0, 0, 0.0 },
- { 1.03, 0, 1, 1, &fs[2], 0, 0, 0, 0, 0.0 },
+ make_hwstate(1.01, 0, 1, 1, &fs[0]),
+ make_hwstate(1.02, 0, 1, 1, &fs[1]),
+ make_hwstate(1.03, 0, 1, 1, &fs[2]),
};
interpreter.min_delay_.val_ = 0.0;
@@ -325,11 +325,11 @@
};
HardwareState hs[] = {
// Expect movement to take
- { 0.01, 0, 1, 1, &fs[0], 0, 0, 0, 0, 0.0 },
- { 0.01, 0, 1, 1, &fs[1], 0, 0, 0, 0, 0.0 },
- { 0.03, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 },
- { 1.01, 0, 1, 1, &fs[2], 0, 0, 0, 0, 0.0 },
- { 1.02, 0, 1, 1, &fs[3], 0, 0, 0, 0, 0.0 },
+ make_hwstate(0.01, 0, 1, 1, &fs[0]),
+ make_hwstate(0.01, 0, 1, 1, &fs[1]),
+ make_hwstate(0.03, 0, 0, 0, NULL),
+ make_hwstate(1.01, 0, 1, 1, &fs[2]),
+ make_hwstate(1.02, 0, 1, 1, &fs[3]),
};
TestInterpreterWrapper wrapper(&interpreter, &initial_hwprops);
@@ -370,7 +370,7 @@
};
TestInterpreterWrapper wrapper(interpreter.get(), &initial_hwprops);
- HardwareState hs = {1, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0};
+ HardwareState hs = make_hwstate(1, 0, 0, 0, NULL);
base_interpreter = new LookaheadFilterInterpreterTestInterpreter;
base_interpreter->timer_return_ = 1.0;
@@ -428,28 +428,28 @@
};
HardwareState hs[] = {
// Initial state
- { 9.00, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
+ make_hwstate(9.00, 0, 1, 1, &fs),
// Time jumps backwards, then goes forwards
- { 0.01, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
- { 0.02, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
- { 0.03, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
- { 0.04, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
- { 0.05, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
- { 0.06, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
- { 0.07, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
- { 0.08, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
- { 0.09, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
- { 0.10, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
- { 0.11, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
- { 0.12, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
- { 0.13, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
- { 0.14, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
- { 0.15, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
- { 0.16, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
- { 0.17, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
- { 0.18, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
- { 0.19, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
- { 0.20, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 }
+ make_hwstate(0.01, 0, 1, 1, &fs),
+ make_hwstate(0.02, 0, 1, 1, &fs),
+ make_hwstate(0.03, 0, 1, 1, &fs),
+ make_hwstate(0.04, 0, 1, 1, &fs),
+ make_hwstate(0.05, 0, 1, 1, &fs),
+ make_hwstate(0.06, 0, 1, 1, &fs),
+ make_hwstate(0.07, 0, 1, 1, &fs),
+ make_hwstate(0.08, 0, 1, 1, &fs),
+ make_hwstate(0.09, 0, 1, 1, &fs),
+ make_hwstate(0.10, 0, 1, 1, &fs),
+ make_hwstate(0.11, 0, 1, 1, &fs),
+ make_hwstate(0.12, 0, 1, 1, &fs),
+ make_hwstate(0.13, 0, 1, 1, &fs),
+ make_hwstate(0.14, 0, 1, 1, &fs),
+ make_hwstate(0.15, 0, 1, 1, &fs),
+ make_hwstate(0.16, 0, 1, 1, &fs),
+ make_hwstate(0.17, 0, 1, 1, &fs),
+ make_hwstate(0.18, 0, 1, 1, &fs),
+ make_hwstate(0.19, 0, 1, 1, &fs),
+ make_hwstate(0.20, 0, 1, 1, &fs),
};
for (size_t i = 0; i < arraysize(hs); ++i) {
stime_t timeout_requested = -1.0;
@@ -483,10 +483,10 @@
};
HardwareState hs[] = {
// Expect movement to take
- { 1.011, 2, 3, 3, &fs[0], 0, 0, 0, 0, 0.0 },
- { 1.022, 2, 3, 3, &fs[3], 0, 0, 0, 0, 0.0 },
- { 1.0165, 2, 3, 3, &fs[6], 0, 0, 0, 0, 0.0 },
- { 0, 0, 0, 0, &fs[9], 0, 0, 0, 0, 0.0 },
+ make_hwstate(1.011, 2, 3, 3, &fs[0]),
+ make_hwstate(1.022, 2, 3, 3, &fs[3]),
+ make_hwstate(1.0165, 2, 3, 3, &fs[6]),
+ make_hwstate(0, 0, 0, 0, &fs[9]),
};
LookaheadFilterInterpreter::Interpolate(hs[0], hs[1], &hs[3]);
@@ -520,9 +520,9 @@
};
HardwareState hs[] = {
// Expect movement to take
- { 1.01, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
- { 1.02, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
- { 1.04, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
+ make_hwstate(1.01, 0, 1, 1, &fs),
+ make_hwstate(1.02, 0, 1, 1, &fs),
+ make_hwstate(1.04, 0, 1, 1, &fs),
};
// Tests that we can properly decide when to interpolate two events.
@@ -601,8 +601,8 @@
// and so this tests that an overdue interpolated event is handled correctly.
HardwareState hs[] = {
// Expect movement to take
- { 1.456, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
- { 1.495, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
+ make_hwstate(1.456, 0, 1, 1, &fs),
+ make_hwstate(1.495, 0, 1, 1, &fs),
};
base_interpreter = new LookaheadFilterInterpreterTestInterpreter;
@@ -685,20 +685,20 @@
// and so this tests that an overdue interpolated event is handled correctly.
HardwareStateLastId hsid[] = {
// Expect movement to take
- { { 1.000, 0, 1, 1, &fs[0], 0, 0, 0, 0, 0.0 }, 1 },
- { { 1.001, 0, 1, 1, &fs[0], 0, 0, 0, 0, 0.0 }, 1 },
- { { 1.002, 0, 1, 1, &fs[1], 0, 0, 0, 0, 0.0 }, 2 },
- { { 1.003, 0, 1, 1, &fs[1], 0, 0, 0, 0, 0.0 }, 2 },
- { { 1.004, 0, 1, 1, &fs[2], 0, 0, 0, 0, 0.0 }, 3 },
- { { 1.005, 0, 1, 1, &fs[3], 0, 0, 0, 0, 0.0 }, 4 },
- { { 1.006, 0, 1, 1, &fs[2], 0, 0, 0, 0, 0.0 }, 5 },
+ { make_hwstate(1.000, 0, 1, 1, &fs[0]), 1 },
+ { make_hwstate(1.001, 0, 1, 1, &fs[0]), 1 },
+ { make_hwstate(1.002, 0, 1, 1, &fs[1]), 2 },
+ { make_hwstate(1.003, 0, 1, 1, &fs[1]), 2 },
+ { make_hwstate(1.004, 0, 1, 1, &fs[2]), 3 },
+ { make_hwstate(1.005, 0, 1, 1, &fs[3]), 4 },
+ { make_hwstate(1.006, 0, 1, 1, &fs[2]), 5 },
// Warp cases:
- { { 1.007, 0, 1, 1, &fs[4], 0, 0, 0, 0, 0.0 }, 6 },
- { { 1.008, 0, 1, 1, &fs[5], 0, 0, 0, 0, 0.0 }, 6 },
- { { 1.009, 0, 1, 1, &fs[6], 0, 0, 0, 0, 0.0 }, 7 },
- { { 1.010, 0, 1, 1, &fs[7], 0, 0, 0, 0, 0.0 }, 7 },
- { { 1.011, 0, 1, 1, &fs[8], 0, 0, 0, 0, 0.0 }, 8 },
- { { 1.012, 0, 1, 1, &fs[9], 0, 0, 0, 0, 0.0 }, 8 },
+ { make_hwstate(1.007, 0, 1, 1, &fs[4]), 6 },
+ { make_hwstate(1.008, 0, 1, 1, &fs[5]), 6 },
+ { make_hwstate(1.009, 0, 1, 1, &fs[6]), 7 },
+ { make_hwstate(1.010, 0, 1, 1, &fs[7]), 7 },
+ { make_hwstate(1.011, 0, 1, 1, &fs[8]), 8 },
+ { make_hwstate(1.012, 0, 1, 1, &fs[9]), 8 },
};
base_interpreter = new LookaheadFilterInterpreterTestInterpreter;
@@ -753,15 +753,15 @@
HardwareState hs[] = {
// Drumroll
- { 1.000, 0, 1, 1, &fs[0], 0, 0, 0, 0, 0.0 },
- { 1.001, 0, 1, 1, &fs[1], 0, 0, 0, 0, 0.0 },
- { 1.002, 0, 1, 1, &fs[2], 0, 0, 0, 0, 0.0 },
+ make_hwstate(1.000, 0, 1, 1, &fs[0]),
+ make_hwstate(1.001, 0, 1, 1, &fs[1]),
+ make_hwstate(1.002, 0, 1, 1, &fs[2]),
// No touch
- { 1.003, 0, 0, 0, &fs[0], 0, 0, 0, 0, 0.0 },
+ make_hwstate(1.003, 0, 0, 0, &fs[0]),
// Quick movement
- { 1.034, 0, 1, 1, &fs[3], 0, 0, 0, 0, 0.0 },
- { 1.035, 0, 1, 1, &fs[4], 0, 0, 0, 0, 0.0 },
- { 1.036, 0, 1, 1, &fs[5], 0, 0, 0, 0, 0.0 },
+ make_hwstate(1.034, 0, 1, 1, &fs[3]),
+ make_hwstate(1.035, 0, 1, 1, &fs[4]),
+ make_hwstate(1.036, 0, 1, 1, &fs[5]),
};
base_interpreter = new LookaheadFilterInterpreterTestInterpreter;
@@ -866,7 +866,7 @@
// Prime it w/ a dummy hardware state
stime_t timeout = -1.0;
- HardwareState temp_hs = { 0.000001, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 };
+ HardwareState temp_hs = make_hwstate(0.000001, 0, 0, 0, NULL);
wrapper.SyncInterpret(&temp_hs, &timeout);
wrapper.HandleTimer(temp_hs.timestamp + timeout, NULL);
@@ -880,9 +880,7 @@
{ 0, 0, 0, 0, in.pressure1, 0, in.x1, in.y1, in.id1, 0 },
};
unsigned short finger_cnt = in.id0 < 0 ? 0 : (in.id1 < 0 ? 1 : 2);
- HardwareState hs = {
- in.now, 0, finger_cnt, finger_cnt, fs, 0, 0, 0, 0, 0.0
- };
+ HardwareState hs = make_hwstate(in.now, 0, finger_cnt, finger_cnt, fs);
for (size_t idx = 0; idx < finger_cnt; idx++)
input_ids.insert(fs[idx].tracking_id);
@@ -1077,7 +1075,7 @@
// TM, Tm, WM, Wm, pr, orient, x, y, id, flags
0, 0, 0, 0, input.pressure_, 0, input.x_, input.y_, 1, input.flags_
};
- HardwareState hs = { input.now_, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 };
+ HardwareState hs = make_hwstate(input.now_, 0, 1, 1, &fs);
if (input.reset_) {
if (base_interpreter) {
EXPECT_TRUE(base_interpreter->expected_flags_at_occurred_);
@@ -1154,7 +1152,7 @@
};
// Prime it w/ a dummy hardware state
stime_t timeout = -1.0;
- HardwareState temp_hs = { 0.000001, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 };
+ HardwareState temp_hs = make_hwstate(0.000001, 0, 0, 0, NULL);
interpreter.SyncInterpret(&temp_hs, &timeout);
base_interpreter->expected_ids_.insert(1);
@@ -1167,9 +1165,8 @@
{ 0, 0, 0, 0, input.pressure1, 0, input.x1, input.y1, 2, 0 },
{ 0, 0, 0, 0, input.pressure2, 0, input.x2, input.y2, 3, 0 }
};
- HardwareState hs = {
- input.now, 0, arraysize(fs), arraysize(fs), fs, 0, 0, 0, 0, 0.0
- };
+ HardwareState hs =
+ make_hwstate(input.now, 0, arraysize(fs), arraysize(fs), fs);
timeout = -1.0;
interpreter.SyncInterpret(&hs, &timeout);
if (timeout >= 0) {
@@ -1226,12 +1223,12 @@
};
HardwareState hs[] = {
- { 328.989039, 0, 1, 1, &fs[0], 0, 0, 0, 0, 0.0 },
- { 329.013853, 0, 2, 2, &fs[1], 0, 0, 0, 0, 0.0 },
- { 329.036266, 0, 2, 2, &fs[3], 0, 0, 0, 0, 0.0 },
- { 329.061772, 0, 2, 2, &fs[5], 0, 0, 0, 0, 0.0 },
- { 329.086734, 0, 2, 2, &fs[7], 0, 0, 0, 0, 0.0 },
- { 329.110350, 0, 2, 2, &fs[9], 0, 0, 0, 0, 0.0 },
+ make_hwstate(328.989039, 0, 1, 1, &fs[0]),
+ make_hwstate(329.013853, 0, 2, 2, &fs[1]),
+ make_hwstate(329.036266, 0, 2, 2, &fs[3]),
+ make_hwstate(329.061772, 0, 2, 2, &fs[5]),
+ make_hwstate(329.086734, 0, 2, 2, &fs[7]),
+ make_hwstate(329.110350, 0, 2, 2, &fs[9]),
};
base_interpreter = new LookaheadFilterInterpreterTestInterpreter;
diff --git a/src/non_linearity_filter_interpreter_unittest.cc b/src/non_linearity_filter_interpreter_unittest.cc
index a27150d..6416762 100644
--- a/src/non_linearity_filter_interpreter_unittest.cc
+++ b/src/non_linearity_filter_interpreter_unittest.cc
@@ -26,7 +26,7 @@
TEST(NonLinearityFilterInterpreterTest, DisablingTest) {
FingerState finger_state = { 0, 0, 0, 0, 35, 0, 999, 500, 1, 0 };
- HardwareState hwstate = { 200000, 0, 2, 2, &finger_state, 0, 0, 0, 0, 0.0 };
+ HardwareState hwstate = make_hwstate(200000, 0, 2, 2, &finger_state);
NonLinearityFilterInterpreterTestInterpreter* base =
new NonLinearityFilterInterpreterTestInterpreter;
@@ -55,7 +55,7 @@
TEST(NonLinearityFilterInterpreterTest, HWstateModificationTest) {
FingerState finger_state = { 0, 0, 0, 0, 0.2, 0, 0.1, 0.3, 1, 0 };
- HardwareState hwstate = { 200000, 0, 1, 1, &finger_state, 0, 0, 0, 0, 0.0 };
+ HardwareState hwstate = make_hwstate(200000, 0, 1, 1, &finger_state);
NonLinearityFilterInterpreterTestInterpreter* base =
new NonLinearityFilterInterpreterTestInterpreter;
@@ -79,8 +79,8 @@
};
HardwareState hwstates[] = {
- { 200000, 0, 2, 2, finger_states, 0, 0, 0, 0, 0.0 },
- { 200100, 0, 1, 1, finger_states, 0, 0, 0, 0, 0.0 },
+ make_hwstate(200000, 0, 2, 2, finger_states),
+ make_hwstate(200100, 0, 1, 1, finger_states),
};
NonLinearityFilterInterpreterTestInterpreter* base =
diff --git a/src/palm_classifying_filter_interpreter_unittest.cc b/src/palm_classifying_filter_interpreter_unittest.cc
index a433cc0..323eccb 100644
--- a/src/palm_classifying_filter_interpreter_unittest.cc
+++ b/src/palm_classifying_filter_interpreter_unittest.cc
@@ -86,11 +86,11 @@
};
HardwareState hardware_state[] = {
// time, buttons, finger count, touch count, finger states pointer
- { 200000, 0, 2, 2, &finger_states[0], 0, 0, 0, 0, 0.0 },
- { 200001, 0, 2, 2, &finger_states[2], 0, 0, 0, 0, 0.0 },
- { 200002, 0, 2, 2, &finger_states[4], 0, 0, 0, 0, 0.0 },
- { 200003, 0, 2, 2, &finger_states[6], 0, 0, 0, 0, 0.0 },
- { 200004, 0, 2, 2, &finger_states[8], 0, 0, 0, 0, 0.0 },
+ make_hwstate(200000, 0, 2, 2, &finger_states[0]),
+ make_hwstate(200001, 0, 2, 2, &finger_states[2]),
+ make_hwstate(200002, 0, 2, 2, &finger_states[4]),
+ make_hwstate(200003, 0, 2, 2, &finger_states[6]),
+ make_hwstate(200004, 0, 2, 2, &finger_states[8]),
};
for (size_t i = 0; i < 5; ++i) {
@@ -158,10 +158,10 @@
};
HardwareState hardware_state[] = {
// time, buttons, finger count, touch count, finger states pointer
- { 0.00, 0, 1, 1, &finger_states[0], 0, 0, 0, 0, 0.0 },
- { 4.00, 0, 2, 2, &finger_states[0], 0, 0, 0, 0, 0.0 },
- { 5.00, 0, 2, 2, &finger_states[2], 0, 0, 0, 0, 0.0 },
- { 5.01, 0, 2, 2, &finger_states[4], 0, 0, 0, 0, 0.0 },
+ make_hwstate(0.00, 0, 1, 1, &finger_states[0]),
+ make_hwstate(4.00, 0, 2, 2, &finger_states[0]),
+ make_hwstate(5.00, 0, 2, 2, &finger_states[2]),
+ make_hwstate(5.01, 0, 2, 2, &finger_states[4]),
};
for (size_t i = 0; i < arraysize(hardware_state); ++i) {
@@ -237,26 +237,26 @@
HardwareState hardware_state[] = {
// time, buttons, finger count, touch count, finger states pointer
// slow movement at edge with small movement
- { 0.0, 0, 1, 1, &finger_states[0], 0, 0, 0, 0, 0.0 },
- { 1.0, 0, 1, 1, &finger_states[1], 0, 0, 0, 0, 0.0 },
+ make_hwstate(0.0, 0, 1, 1, &finger_states[0]),
+ make_hwstate(1.0, 0, 1, 1, &finger_states[1]),
// slow small contact movement in middle
- { 0.0, 0, 1, 1, &finger_states[2], 0, 0, 0, 0, 0.0 },
- { 1.0, 0, 1, 1, &finger_states[3], 0, 0, 0, 0, 0.0 },
+ make_hwstate(0.0, 0, 1, 1, &finger_states[2]),
+ make_hwstate(1.0, 0, 1, 1, &finger_states[3]),
// slow large contact movement in middle
- { 0.0, 0, 1, 1, &finger_states[4], 0, 0, 0, 0, 0.0 },
- { 1.0, 0, 1, 1, &finger_states[5], 0, 0, 0, 0, 0.0 },
+ make_hwstate(0.0, 0, 1, 1, &finger_states[4]),
+ make_hwstate(1.0, 0, 1, 1, &finger_states[5]),
// under mid-pressure at mid-width
- { 0.0, 0, 1, 1, &finger_states[6], 0, 0, 0, 0, 0.0 },
- { 1.0, 0, 1, 1, &finger_states[7], 0, 0, 0, 0, 0.0 },
+ make_hwstate(0.0, 0, 1, 1, &finger_states[6]),
+ make_hwstate(1.0, 0, 1, 1, &finger_states[7]),
// over mid-pressure at mid-width
- { 0.0, 0, 1, 1, &finger_states[8], 0, 0, 0, 0, 0.0 },
- { 1.0, 0, 1, 1, &finger_states[9], 0, 0, 0, 0, 0.0 },
+ make_hwstate(0.0, 0, 1, 1, &finger_states[8]),
+ make_hwstate(1.0, 0, 1, 1, &finger_states[9]),
// large movement at edge
- { 0.0, 0, 1, 1, &finger_states[10], 0, 0, 0, 0, 0.0 },
- { 1.0, 0, 1, 1, &finger_states[11], 0, 0, 0, 0, 0.0 },
+ make_hwstate(0.0, 0, 1, 1, &finger_states[10]),
+ make_hwstate(1.0, 0, 1, 1, &finger_states[11]),
// over mid-pressure at mid-width with large movement
- { 0.0, 0, 1, 1, &finger_states[12], 0, 0, 0, 0, 0.0 },
- { 1.0, 0, 1, 1, &finger_states[13], 0, 0, 0, 0, 0.0 },
+ make_hwstate(0.0, 0, 1, 1, &finger_states[12]),
+ make_hwstate(1.0, 0, 1, 1, &finger_states[13]),
};
for (size_t i = 0; i < arraysize(hardware_state); ++i) {
@@ -371,7 +371,7 @@
FingerState fs =
{ 0, 0, 0, 0, inputs[i].pressure_, 0.0,
inputs[i].x_, inputs[i].y_, 1, 0 };
- HardwareState hs = { inputs[i].now_, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 };
+ HardwareState hs = make_hwstate(inputs[i].now_, 0, 1, 1, &fs);
stime_t timeout = -1.0;
wrapper.SyncInterpret(&hs, &timeout);
@@ -647,7 +647,7 @@
FingerState fs = {
input.touch_major_, 0, 0, 0, input.pressure_, 0, input.x_, input.y_, 1, 0
};
- HardwareState hs = { input.now_, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 };
+ HardwareState hs = make_hwstate(input.now_, 0, 1, 1, &fs);
base_interpreter->expected_flags_ = GESTURES_FINGER_PALM;
wrapper.SyncInterpret(&hs, NULL);
}
diff --git a/src/scaling_filter_interpreter_unittest.cc b/src/scaling_filter_interpreter_unittest.cc
index cd3aa38..5bd4b4e 100644
--- a/src/scaling_filter_interpreter_unittest.cc
+++ b/src/scaling_filter_interpreter_unittest.cc
@@ -167,10 +167,10 @@
{ 0, 0, 0, 0, 3, 0, 250, 3000, 1, 0 }
};
HardwareState hs[] = {
- { 10000, 0, 1, 1, &fs[0], 0, 0, 0, 0, 0.0 },
- { 54000, 0, 1, 1, &fs[1], 0, 0, 0, 0, 0.0 },
- { 98000, 0, 1, 1, &fs[2], 0, 0, 0, 0, 0.0 },
- { 99000, 0, 1, 1, &fs[3], 0, 0, 0, 0, 0.0 },
+ make_hwstate(10000, 0, 1, 1, &fs[0]),
+ make_hwstate(54000, 0, 1, 1, &fs[1]),
+ make_hwstate(98000, 0, 1, 1, &fs[2]),
+ make_hwstate(99000, 0, 1, 1, &fs[3]),
};
// Set up expected translated coordinates
@@ -250,9 +250,9 @@
{ 0, 0, 0, 0, 1, 0, 560, 2000, 2, 0 },
};
HardwareState hs2[] = {
- { 110000, 0, 1, 2, &fs2[0], 0, 0, 0, 0, 0.0 },
- { 154000, 0, 1, 1, &fs2[1], 0, 0, 0, 0, 0.0 },
- { 184000, 0, 1, 0, &fs2[2], 0, 0, 0, 0, 0.0 }
+ make_hwstate(110000, 0, 1, 2, &fs2[0]),
+ make_hwstate(154000, 0, 1, 1, &fs2[1]),
+ make_hwstate(184000, 0, 1, 0, &fs2[2]),
};
interpreter.pressure_threshold_.val_ = kPressureThreshold;
base_interpreter->expected_finger_cnt_.push_back(0);
diff --git a/src/sensor_jump_filter_interpreter_unittest.cc b/src/sensor_jump_filter_interpreter_unittest.cc
index f92d4ea..4237f00 100644
--- a/src/sensor_jump_filter_interpreter_unittest.cc
+++ b/src/sensor_jump_filter_interpreter_unittest.cc
@@ -75,7 +75,7 @@
EXPECT_TRUE(base_interpreter->handle_timer_called_);
FingerState fs = { 0, 0, 0, 0, 1, 0, 3.0, 0.0, 1, 0 };
- HardwareState hs = { 0.0, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 };
+ HardwareState hs = make_hwstate(0.0, 0, 1, 1, &fs);
InputAndExpectedWarp data[] = {
{ 3.0, false },
@@ -229,7 +229,7 @@
{ 0, 0, 0, 0, 1, 0, 3.0, 0.0, 1, 0 },
{ 0, 0, 0, 0, 1, 0, 3.0, 0.0, 1, 0 },
};
- HardwareState hs = { 0.0, 0, 2, 2, &fs[0], 0, 0, 0, 0, 0.0 };
+ HardwareState hs = make_hwstate(0.0, 0, 2, 2, &fs[0]);
float prev_y_out[] = { 0.0, 0.0 };
diff --git a/src/split_correcting_filter_interpreter_unittest.cc b/src/split_correcting_filter_interpreter_unittest.cc
index db132e3..b5dbd3f 100644
--- a/src/split_correcting_filter_interpreter_unittest.cc
+++ b/src/split_correcting_filter_interpreter_unittest.cc
@@ -93,9 +93,7 @@
fidx++)
finger_cnt += 1;
// Set up hardware state
- HardwareState hs = {
- 0.0, 0, finger_cnt, finger_cnt, event->fs, 0, 0, 0, 0, 0.0
- };
+ HardwareState hs = make_hwstate(0.0, 0, finger_cnt, finger_cnt, event->fs);
// Set up expectations
base_interpreter->expected_ids_.clear();
for (size_t outidx = 0;
@@ -197,9 +195,8 @@
fs[fidx].pressure = input.in[fidx].pressure_;
fs[fidx].tracking_id = input.in[fidx].id_;
}
- HardwareState hs = {
- input.timestamp, 0, finger_cnt, finger_cnt, &fs[0], 0, 0, 0, 0, 0.0
- };
+ HardwareState hs =
+ make_hwstate(input.timestamp, 0, finger_cnt, finger_cnt, &fs[0]);
// Set up expectations
base_interpreter->expect_finger_ids_ = false;
if (i == 1) {
@@ -369,9 +366,8 @@
{ 0, 0, 0, 0, input.pressure1, 0, input.x1, input.y1, input.id1, 0 },
};
unsigned short finger_cnt = input.id1 ? 2 : 1;
- HardwareState hs = {
- input.now, input.buttons_down, finger_cnt, finger_cnt, fs, 0, 0, 0, 0, 0.0
- };
+ HardwareState hs =
+ make_hwstate(input.now, input.buttons_down, finger_cnt, finger_cnt, fs);
stime_t timeout = -1;
wrapper.SyncInterpret(&hs, &timeout);
}
diff --git a/src/stuck_button_inhibitor_filter_interpreter_unittest.cc b/src/stuck_button_inhibitor_filter_interpreter_unittest.cc
index 99ca445..c23dbb6 100644
--- a/src/stuck_button_inhibitor_filter_interpreter_unittest.cc
+++ b/src/stuck_button_inhibitor_filter_interpreter_unittest.cc
@@ -130,44 +130,27 @@
FingerState fs = { 0, 0, 0, 0, 1, 0, 150, 4000, 1, 0 };
Record recs[] = {
// Simple move. Nothing button related
- { -1.0, { 1.0, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
- true, -1.0, null, -1.0, null },
- { -1.0, { 1.1, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
- true, -1.0, move, -1.0, move },
+ { -1.0, make_hwstate(1.0, 0, 1, 1, &fs), true, -1.0, null, -1.0, null },
+ { -1.0, make_hwstate(1.1, 0, 1, 1, &fs), true, -1.0, move, -1.0, move },
// Button down, followed by nothing, so we timeout and send button up
- { -1.0, { 1.2, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
- true, -1.0, down, -1.0, down },
- { -1.0, { 1.3, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 },
- true, 1.0, null, -1.0, null },
- { 2.3, { 0.0, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 },
- false, -1.0, up, -1.0, null },
+ { -1.0, make_hwstate(1.2, 0, 1, 1, &fs), true, -1.0, down, -1.0, down },
+ { -1.0, make_hwstate(1.3, 0, 0, 0, NULL), true, 1.0, null, -1.0, null },
+ { 2.3, make_hwstate(0.0, 0, 0, 0, NULL), false, -1.0, up, -1.0, null },
// Next sends button up in timeout
- { -1.0, { 3.2, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
- true, -1.0, down, -1.0, down },
- { -1.0, { 3.3, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 },
- true, 0.5, null, 0.5, null },
- { 3.8, { 0.0, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 },
- true, -1.0, up, -1.0, up },
+ { -1.0, make_hwstate(3.2, 0, 1, 1, &fs), true, -1.0, down, -1.0, down },
+ { -1.0, make_hwstate(3.3, 0, 0, 0, NULL), true, 0.5, null, 0.5, null },
+ { 3.8, make_hwstate(0.0, 0, 0, 0, NULL), true, -1.0, up, -1.0, up },
// Double down/up squash
- { -1.0, { 4.2, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
- true, -1.0, down, -1.0, down },
- { -1.0, { 4.3, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
- true, -1.0, null, -1.0, down },
- { -1.0, { 4.4, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 },
- true, -1.0, up, -1.0, up },
- { -1.0, { 4.5, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 },
- true, -1.0, null, -1.0, up },
+ { -1.0, make_hwstate(4.2, 0, 1, 1, &fs), true, -1.0, down, -1.0, down },
+ { -1.0, make_hwstate(4.3, 0, 1, 1, &fs), true, -1.0, null, -1.0, down },
+ { -1.0, make_hwstate(4.4, 0, 0, 0, NULL), true, -1.0, up, -1.0, up },
+ { -1.0, make_hwstate(4.5, 0, 0, 0, NULL), true, -1.0, null, -1.0, up },
// Right down, left double up/down squash
- { -1.0, { 5.1, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
- true, -1.0, rdwn, -1.0, rdwn },
- { -1.0, { 5.2, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
- true, -1.0, down, -1.0, rldn },
- { -1.0, { 5.3, 0, 1, 1, &fs, 0, 0, 0, 0, 0.0 },
- true, -1.0, null, -1.0, down },
- { -1.0, { 5.4, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 },
- true, 1.0, rup, -1.0, rup },
- { -1.0, { 5.5, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 },
- true, -1.0, up, -1.0, rlup },
+ { -1.0, make_hwstate(5.1, 0, 1, 1, &fs), true, -1.0, rdwn, -1.0, rdwn },
+ { -1.0, make_hwstate(5.2, 0, 1, 1, &fs), true, -1.0, down, -1.0, rldn },
+ { -1.0, make_hwstate(5.3, 0, 1, 1, &fs), true, -1.0, null, -1.0, down },
+ { -1.0, make_hwstate(5.4, 0, 0, 0, NULL), true, 1.0, rup, -1.0, rup },
+ { -1.0, make_hwstate(5.5, 0, 0, 0, NULL), true, -1.0, up, -1.0, rlup },
};
for (size_t i = 0; i < arraysize(recs); ++i) {
diff --git a/src/t5r2_correcting_filter_interpreter_unittest.cc b/src/t5r2_correcting_filter_interpreter_unittest.cc
index 5f95107..6f294b8 100644
--- a/src/t5r2_correcting_filter_interpreter_unittest.cc
+++ b/src/t5r2_correcting_filter_interpreter_unittest.cc
@@ -85,21 +85,21 @@
};
HardwareStateAndExpectations hse[] = {
// normal case -- no change expected
- { { 0.01, 0, 1, 1, &fs[0], 0, 0, 0, 0, 0.0 }, false },
- { { 0.02, 0, 1, 3, &fs[0], 0, 0, 0, 0, 0.0 }, false },
- { { 0.03, 0, 2, 3, &fs[0], 0, 0, 0, 0, 0.0 }, false },
- { { 0.04, 0, 0, 0, NULL, 0, 0, 0, 0, 0.0 }, false },
+ { make_hwstate(0.01, 0, 1, 1, &fs[0]), false },
+ { make_hwstate(0.02, 0, 1, 3, &fs[0]), false },
+ { make_hwstate(0.03, 0, 2, 3, &fs[0]), false },
+ { make_hwstate(0.04, 0, 0, 0, NULL), false },
// problem -- change expected at end
- { { 0.01, 0, 2, 3, &fs[0], 0, 0, 0, 0, 0.0 }, false },
- { { 0.02, 0, 2, 3, &fs[0], 0, 0, 0, 0, 0.0 }, false },
- { { 0.03, 0, 0, 1, NULL, 0, 0, 0, 0, 0.0 }, false },
- { { 0.04, 0, 0, 1, NULL, 0, 0, 0, 0, 0.0 }, true },
+ { make_hwstate(0.01, 0, 2, 3, &fs[0]), false },
+ { make_hwstate(0.02, 0, 2, 3, &fs[0]), false },
+ { make_hwstate(0.03, 0, 0, 1, NULL), false },
+ { make_hwstate(0.04, 0, 0, 1, NULL), true },
// problem -- change expected at end
- { { 0.01, 0, 1, 1, &fs[0], 0, 0, 0, 0, 0.0 }, false },
- { { 0.02, 0, 1, 3, &fs[0], 0, 0, 0, 0, 0.0 }, false },
- { { 0.03, 0, 2, 3, &fs[0], 0, 0, 0, 0, 0.0 }, false },
- { { 0.04, 0, 0, 2, NULL, 0, 0, 0, 0, 0.0 }, false },
- { { 0.05, 0, 0, 2, NULL, 0, 0, 0, 0, 0.0 }, true }
+ { make_hwstate(0.01, 0, 1, 1, &fs[0]), false },
+ { make_hwstate(0.02, 0, 1, 3, &fs[0]), false },
+ { make_hwstate(0.03, 0, 2, 3, &fs[0]), false },
+ { make_hwstate(0.04, 0, 0, 2, NULL), false },
+ { make_hwstate(0.05, 0, 0, 2, NULL), true }
};
for (size_t i = 0; i < arraysize(hse); i++) {
diff --git a/src/timestamp_filter_interpreter_unittest.cc b/src/timestamp_filter_interpreter_unittest.cc
index 1d2995c..600087c 100644
--- a/src/timestamp_filter_interpreter_unittest.cc
+++ b/src/timestamp_filter_interpreter_unittest.cc
@@ -19,6 +19,11 @@
: Interpreter(NULL, NULL, false) {}
};
+static HardwareState make_hwstate_times(stime_t timestamp,
+ stime_t msc_timestamp) {
+ return { timestamp, 0, 1, 1, NULL, 0, 0, 0, 0, msc_timestamp };
+}
+
TEST(TimestampFilterInterpreterTest, SimpleTest) {
TimestampFilterInterpreterTestInterpreter* base_interpreter =
new TimestampFilterInterpreterTestInterpreter;
@@ -26,10 +31,10 @@
TestInterpreterWrapper wrapper(&interpreter);
HardwareState hs[] = {
- { 1.000, 0, 1, 1, NULL, 0, 0, 0, 0, 0.000 },
- { 1.010, 0, 1, 1, NULL, 0, 0, 0, 0, 0.012 },
- { 1.020, 0, 1, 1, NULL, 0, 0, 0, 0, 0.018 },
- { 1.030, 0, 1, 1, NULL, 0, 0, 0, 0, 0.031 }
+ make_hwstate_times(1.000, 0.000),
+ make_hwstate_times(1.010, 0.012),
+ make_hwstate_times(1.020, 0.018),
+ make_hwstate_times(1.030, 0.031),
};
stime_t expected_timestamps[] = { 1.000, 1.012, 1.018, 1.031 };
@@ -47,10 +52,10 @@
TestInterpreterWrapper wrapper(&interpreter);
HardwareState hs[] = {
- { 1.000, 0, 1, 1, NULL, 0, 0, 0, 0, 0.000 },
- { 1.010, 0, 1, 1, NULL, 0, 0, 0, 0, 0.000 },
- { 1.020, 0, 1, 1, NULL, 0, 0, 0, 0, 0.000 },
- { 1.030, 0, 1, 1, NULL, 0, 0, 0, 0, 0.000 }
+ make_hwstate_times(1.000, 0.000),
+ make_hwstate_times(1.010, 0.000),
+ make_hwstate_times(1.020, 0.000),
+ make_hwstate_times(1.030, 0.000),
};
for (size_t i = 0; i < arraysize(hs); i++) {
@@ -67,14 +72,14 @@
TestInterpreterWrapper wrapper(&interpreter);
HardwareState hs[] = {
- { 1.000, 0, 1, 1, NULL, 0, 0, 0, 0, 0.000 },
- { 1.010, 0, 1, 1, NULL, 0, 0, 0, 0, 0.012 },
- { 1.020, 0, 1, 1, NULL, 0, 0, 0, 0, 0.018 },
- { 1.030, 0, 1, 1, NULL, 0, 0, 0, 0, 0.031 },
- { 3.000, 0, 1, 1, NULL, 0, 0, 0, 0, 0.000 }, //msc_timestamp reset to 0
- { 3.010, 0, 1, 1, NULL, 0, 0, 0, 0, 0.008 },
- { 3.020, 0, 1, 1, NULL, 0, 0, 0, 0, 0.020 },
- { 3.030, 0, 1, 1, NULL, 0, 0, 0, 0, 0.035 }
+ make_hwstate_times(1.000, 0.000),
+ make_hwstate_times(1.010, 0.012),
+ make_hwstate_times(1.020, 0.018),
+ make_hwstate_times(1.030, 0.031),
+ make_hwstate_times(3.000, 0.000), // msc_timestamp reset to 0
+ make_hwstate_times(3.010, 0.008),
+ make_hwstate_times(3.020, 0.020),
+ make_hwstate_times(3.030, 0.035),
};
stime_t expected_timestamps[] = {
@@ -97,10 +102,10 @@
interpreter.fake_timestamp_delta_.val_ = 0.010;
HardwareState hs[] = {
- { 1.000, 0, 1, 1, NULL, 0, 0, 0, 0, 0.002 },
- { 1.002, 0, 1, 1, NULL, 0, 0, 0, 0, 6.553 },
- { 1.008, 0, 1, 1, NULL, 0, 0, 0, 0, 0.001 },
- { 1.031, 0, 1, 1, NULL, 0, 0, 0, 0, 0.001 }
+ make_hwstate_times(1.000, 0.002),
+ make_hwstate_times(1.002, 6.553),
+ make_hwstate_times(1.008, 0.001),
+ make_hwstate_times(1.031, 0.001),
};
stime_t expected_timestamps[] = { 1.000, 1.010, 1.020, 1.030 };
@@ -120,14 +125,14 @@
interpreter.fake_timestamp_delta_.val_ = 0.010;
HardwareState hs[] = {
- { 1.000, 0, 1, 1, NULL, 0, 0, 0, 0, 0.002 },
- { 1.002, 0, 1, 1, NULL, 0, 0, 0, 0, 6.553 },
- { 1.008, 0, 1, 1, NULL, 0, 0, 0, 0, 0.001 },
- { 1.031, 0, 1, 1, NULL, 0, 0, 0, 0, 0.001 },
- { 2.000, 0, 1, 1, NULL, 0, 0, 0, 0, 6.552 },
- { 2.002, 0, 1, 1, NULL, 0, 0, 0, 0, 6.553 },
- { 2.008, 0, 1, 1, NULL, 0, 0, 0, 0, 0.002 },
- { 2.031, 0, 1, 1, NULL, 0, 0, 0, 0, 0.001 }
+ make_hwstate_times(1.000, 0.002),
+ make_hwstate_times(1.002, 6.553),
+ make_hwstate_times(1.008, 0.001),
+ make_hwstate_times(1.031, 0.001),
+ make_hwstate_times(2.000, 6.552),
+ make_hwstate_times(2.002, 6.553),
+ make_hwstate_times(2.008, 0.002),
+ make_hwstate_times(2.031, 0.001),
};
stime_t expected_timestamps[] = {
@@ -151,14 +156,14 @@
interpreter.fake_timestamp_max_divergence_ = 0.030;
HardwareState hs[] = {
- { 1.000, 0, 1, 1, NULL, 0, 0, 0, 0, 0.002 },
- { 1.001, 0, 1, 1, NULL, 0, 0, 0, 0, 6.553 },
- { 1.002, 0, 1, 1, NULL, 0, 0, 0, 0, 0.001 },
- { 1.003, 0, 1, 1, NULL, 0, 0, 0, 0, 0.001 },
- { 1.004, 0, 1, 1, NULL, 0, 0, 0, 0, 6.552 },
- { 1.005, 0, 1, 1, NULL, 0, 0, 0, 0, 6.553 },
- { 1.006, 0, 1, 1, NULL, 0, 0, 0, 0, 0.002 },
- { 1.007, 0, 1, 1, NULL, 0, 0, 0, 0, 6.552 }
+ make_hwstate_times(1.000, 0.002),
+ make_hwstate_times(1.001, 6.553),
+ make_hwstate_times(1.002, 0.001),
+ make_hwstate_times(1.003, 0.001),
+ make_hwstate_times(1.004, 6.552),
+ make_hwstate_times(1.005, 6.553),
+ make_hwstate_times(1.006, 0.002),
+ make_hwstate_times(1.007, 6.552),
};
stime_t expected_timestamps[] = {
diff --git a/src/unittest_util.cc b/src/unittest_util.cc
index 6973a98..e80541d 100644
--- a/src/unittest_util.cc
+++ b/src/unittest_util.cc
@@ -76,4 +76,21 @@
}
+HardwareState make_hwstate(stime_t timestamp, int buttons_down,
+ unsigned short finger_cnt, unsigned short touch_cnt,
+ struct FingerState* fingers) {
+ return {
+ timestamp,
+ buttons_down,
+ finger_cnt,
+ touch_cnt,
+ fingers,
+ 0, // rel_x
+ 0, // rel_y
+ 0, // rel_wheel
+ 0, // rel_hwheel
+ 0.0, // msc_timestamp
+ };
+}
+
} // namespace gestures