Add map like pointer lookup to LegacyResampler
Added map lookup operations to find pointers by ID when resampling them
inside LegacyResampler. The CL fixes the assumption that pointers should
appear in the same order between motion events. Moreover, tests from
LegacyResampler are updated to the new behavior.
Bug: 297226446
Flag: EXEMPT refactor
Test: TEST=libinput_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST
Change-Id: I59c83d2e55bf4ab3cb7958cab333428499f6fee8
diff --git a/libs/input/tests/Resampler_test.cpp b/libs/input/tests/Resampler_test.cpp
index fae8518..3162b77 100644
--- a/libs/input/tests/Resampler_test.cpp
+++ b/libs/input/tests/Resampler_test.cpp
@@ -648,7 +648,15 @@
mResampler->resampleMotionEvent(16ms, motionEvent, &futureSample);
- assertMotionEventIsNotResampled(originalMotionEvent, motionEvent);
+ assertMotionEventIsResampledAndCoordsNear(originalMotionEvent, motionEvent,
+ {Pointer{.id = 0,
+ .x = 1.4f,
+ .y = 1.4f,
+ .isResampled = true},
+ Pointer{.id = 1,
+ .x = 2.4f,
+ .y = 2.4f,
+ .isResampled = true}});
}
TEST_F(ResamplerTest, MultiplePointerDifferentIdOrderExtrapolation) {
@@ -670,7 +678,15 @@
mResampler->resampleMotionEvent(16ms, secondMotionEvent, /*futureSample=*/nullptr);
- assertMotionEventIsNotResampled(secondOriginalMotionEvent, secondMotionEvent);
+ assertMotionEventIsResampledAndCoordsNear(secondOriginalMotionEvent, secondMotionEvent,
+ {Pointer{.id = 1,
+ .x = 4.4f,
+ .y = 4.4f,
+ .isResampled = true},
+ Pointer{.id = 0,
+ .x = 3.4f,
+ .y = 3.4f,
+ .isResampled = true}});
}
TEST_F(ResamplerTest, MultiplePointerDifferentIdsInterpolation) {