Add setCursorPosition.
When source is updated we need to update their values. Also renamed
mX/YCursorPosition to mRawX/YCursorPosition to indicate it stores raw
values (w/o applying offset).
Bug: 134788085
Test: atest libinput_tests
Change-Id: I1533d79a7542291974ff572d3aeaf9924e3f0751
diff --git a/libs/input/tests/InputEvent_test.cpp b/libs/input/tests/InputEvent_test.cpp
index b879de6..b90857c 100644
--- a/libs/input/tests/InputEvent_test.cpp
+++ b/libs/input/tests/InputEvent_test.cpp
@@ -665,4 +665,14 @@
ASSERT_EQ(600, event.getYCursorPosition());
}
+TEST_F(MotionEventTest, SetCursorPosition) {
+ MotionEvent event;
+ initializeEventWithHistory(&event);
+ event.setSource(AINPUT_SOURCE_MOUSE);
+
+ event.setCursorPosition(3, 4);
+ ASSERT_EQ(3, event.getXCursorPosition());
+ ASSERT_EQ(4, event.getYCursorPosition());
+}
+
} // namespace android