diff options
author | 2023-03-10 17:15:07 +0000 | |
---|---|---|
committer | 2023-03-13 11:47:54 +0000 | |
commit | 82c791cdbb1101cf2c8b19be537368f28e2b1a0a (patch) | |
tree | 0a83163b32b1d0e6f79bd4ee7d0367d9766d3916 | |
parent | 849d782248b8c24fb538c84defc5b5d8f2a48bac (diff) |
libs/input: make parameter comment style consistent
The Google C++ style guide [0] suggests that parameter name comments
should be of the form `/*paramName=*/value`. This potentially allows
tooling to check that the parameter names are correct, too.
[0]: https://google.github.io/styleguide/cppguide.html#Function_Argument_Comments
Bug: 245989146
Test: atest inputflinger_tests
Change-Id: Id5207b5a621c9a1ac0a46a8b2ff2bbf9aa43e726
-rw-r--r-- | libs/input/TouchVideoFrame.cpp | 4 | ||||
-rw-r--r-- | libs/input/VelocityTracker.cpp | 12 | ||||
-rw-r--r-- | libs/input/tests/InputEvent_test.cpp | 28 | ||||
-rw-r--r-- | libs/input/tests/InputPublisherAndConsumer_test.cpp | 12 | ||||
-rw-r--r-- | libs/input/tests/TouchResampling_test.cpp | 14 | ||||
-rw-r--r-- | libs/input/tests/VelocityTracker_test.cpp | 58 | ||||
-rw-r--r-- | libs/input/tests/VerifiedInputEvent_test.cpp | 18 |
7 files changed, 73 insertions, 73 deletions
diff --git a/libs/input/TouchVideoFrame.cpp b/libs/input/TouchVideoFrame.cpp index c9393f4451..6d7d5614c6 100644 --- a/libs/input/TouchVideoFrame.cpp +++ b/libs/input/TouchVideoFrame.cpp @@ -43,13 +43,13 @@ const struct timeval& TouchVideoFrame::getTimestamp() const { return mTimestamp; void TouchVideoFrame::rotate(ui::Rotation orientation) { switch (orientation) { case ui::ROTATION_90: - rotateQuarterTurn(false /*clockwise*/); + rotateQuarterTurn(/*clockwise=*/false); break; case ui::ROTATION_180: rotate180(); break; case ui::ROTATION_270: - rotateQuarterTurn(true /*clockwise*/); + rotateQuarterTurn(/*clockwise=*/true); break; case ui::ROTATION_0: // No need to rotate if there's no rotation. diff --git a/libs/input/VelocityTracker.cpp b/libs/input/VelocityTracker.cpp index 3632914b93..8551e5fa1c 100644 --- a/libs/input/VelocityTracker.cpp +++ b/libs/input/VelocityTracker.cpp @@ -157,10 +157,10 @@ void VelocityTracker::configureStrategy(int32_t axis) { std::unique_ptr<VelocityTrackerStrategy> createdStrategy; if (mOverrideStrategy != VelocityTracker::Strategy::DEFAULT) { - createdStrategy = createStrategy(mOverrideStrategy, isDifferentialAxis /* deltaValues */); + createdStrategy = createStrategy(mOverrideStrategy, /*deltaValues=*/isDifferentialAxis); } else { createdStrategy = createStrategy(DEFAULT_STRATEGY_BY_AXIS.at(axis), - isDifferentialAxis /* deltaValues */); + /*deltaValues=*/isDifferentialAxis); } LOG_ALWAYS_FATAL_IF(createdStrategy == nullptr, @@ -495,7 +495,7 @@ static bool solveLeastSquares(const std::vector<float>& x, const std::vector<flo } ALOGD_IF(DEBUG_STRATEGY, " - a=%s", - matrixToString(&a[0][0], m, n, false /*rowMajor*/).c_str()); + matrixToString(&a[0][0], m, n, /*rowMajor=*/false).c_str()); // Apply the Gram-Schmidt process to A to obtain its QR decomposition. float q[n][m]; // orthonormal basis, column-major order @@ -527,8 +527,8 @@ static bool solveLeastSquares(const std::vector<float>& x, const std::vector<flo } } if (DEBUG_STRATEGY) { - ALOGD(" - q=%s", matrixToString(&q[0][0], m, n, false /*rowMajor*/).c_str()); - ALOGD(" - r=%s", matrixToString(&r[0][0], n, n, true /*rowMajor*/).c_str()); + ALOGD(" - q=%s", matrixToString(&q[0][0], m, n, /*rowMajor=*/false).c_str()); + ALOGD(" - r=%s", matrixToString(&r[0][0], n, n, /*rowMajor=*/true).c_str()); // calculate QR, if we factored A correctly then QR should equal A float qr[n][m]; @@ -540,7 +540,7 @@ static bool solveLeastSquares(const std::vector<float>& x, const std::vector<flo } } } - ALOGD(" - qr=%s", matrixToString(&qr[0][0], m, n, false /*rowMajor*/).c_str()); + ALOGD(" - qr=%s", matrixToString(&qr[0][0], m, n, /*rowMajor=*/false).c_str()); } // Solve R B = Qt W Y to find B. This is easy because R is upper triangular. diff --git a/libs/input/tests/InputEvent_test.cpp b/libs/input/tests/InputEvent_test.cpp index 8a6e983bb5..7f240f098b 100644 --- a/libs/input/tests/InputEvent_test.cpp +++ b/libs/input/tests/InputEvent_test.cpp @@ -507,7 +507,7 @@ TEST_F(MotionEventTest, CopyFrom_KeepHistory) { initializeEventWithHistory(&event); MotionEvent copy; - copy.copyFrom(&event, true /*keepHistory*/); + copy.copyFrom(&event, /*keepHistory=*/true); ASSERT_NO_FATAL_FAILURE(assertEqualsEventWithHistory(&event)); } @@ -517,7 +517,7 @@ TEST_F(MotionEventTest, CopyFrom_DoNotKeepHistory) { initializeEventWithHistory(&event); MotionEvent copy; - copy.copyFrom(&event, false /*keepHistory*/); + copy.copyFrom(&event, /*keepHistory=*/false); ASSERT_EQ(event.getPointerCount(), copy.getPointerCount()); ASSERT_EQ(0U, copy.getHistorySize()); @@ -618,12 +618,12 @@ TEST_F(MotionEventTest, Transform) { } MotionEvent event; ui::Transform identityTransform; - event.initialize(InputEvent::nextId(), 0 /*deviceId*/, AINPUT_SOURCE_TOUCHSCREEN, DISPLAY_ID, - INVALID_HMAC, AMOTION_EVENT_ACTION_MOVE, 0 /*actionButton*/, 0 /*flags*/, - AMOTION_EVENT_EDGE_FLAG_NONE, AMETA_NONE, 0 /*buttonState*/, - MotionClassification::NONE, identityTransform, 0 /*xPrecision*/, - 0 /*yPrecision*/, 3 + RADIUS /*xCursorPosition*/, 2 /*yCursorPosition*/, - identityTransform, 0 /*downTime*/, 0 /*eventTime*/, pointerCount, + event.initialize(InputEvent::nextId(), /*deviceId=*/0, AINPUT_SOURCE_TOUCHSCREEN, DISPLAY_ID, + INVALID_HMAC, AMOTION_EVENT_ACTION_MOVE, /*actionButton=*/0, /*flags=*/0, + AMOTION_EVENT_EDGE_FLAG_NONE, AMETA_NONE, /*buttonState=*/0, + MotionClassification::NONE, identityTransform, /*xPrecision=*/0, + /*yPrecision=*/0, /*xCursorPosition=*/3 + RADIUS, /*yCursorPosition=*/2, + identityTransform, /*downTime=*/0, /*eventTime=*/0, pointerCount, pointerProperties, pointerCoords); float originalRawX = 0 + 3; float originalRawY = -RADIUS + 2; @@ -824,12 +824,12 @@ TEST_F(MotionEventTest, Initialize_SetsClassification) { ui::Transform identityTransform; for (MotionClassification classification : classifications) { - event.initialize(InputEvent::nextId(), 0 /*deviceId*/, AINPUT_SOURCE_TOUCHSCREEN, + event.initialize(InputEvent::nextId(), /*deviceId=*/0, AINPUT_SOURCE_TOUCHSCREEN, DISPLAY_ID, INVALID_HMAC, AMOTION_EVENT_ACTION_DOWN, 0, 0, AMOTION_EVENT_EDGE_FLAG_NONE, AMETA_NONE, 0, classification, identityTransform, 0, 0, AMOTION_EVENT_INVALID_CURSOR_POSITION, - AMOTION_EVENT_INVALID_CURSOR_POSITION, identityTransform, 0 /*downTime*/, - 0 /*eventTime*/, pointerCount, pointerProperties, pointerCoords); + AMOTION_EVENT_INVALID_CURSOR_POSITION, identityTransform, /*downTime=*/0, + /*eventTime=*/0, pointerCount, pointerProperties, pointerCoords); ASSERT_EQ(classification, event.getClassification()); } } @@ -846,11 +846,11 @@ TEST_F(MotionEventTest, Initialize_SetsCursorPosition) { } ui::Transform identityTransform; - event.initialize(InputEvent::nextId(), 0 /*deviceId*/, AINPUT_SOURCE_MOUSE, DISPLAY_ID, + event.initialize(InputEvent::nextId(), /*deviceId=*/0, AINPUT_SOURCE_MOUSE, DISPLAY_ID, INVALID_HMAC, AMOTION_EVENT_ACTION_DOWN, 0, 0, AMOTION_EVENT_EDGE_FLAG_NONE, AMETA_NONE, 0, MotionClassification::NONE, identityTransform, 0, 0, - 280 /*xCursorPosition*/, 540 /*yCursorPosition*/, identityTransform, - 0 /*downTime*/, 0 /*eventTime*/, pointerCount, pointerProperties, + /*xCursorPosition=*/280, /*yCursorPosition=*/540, identityTransform, + /*downTime=*/0, /*eventTime=*/0, pointerCount, pointerProperties, pointerCoords); event.offsetLocation(20, 60); ASSERT_EQ(280, event.getRawXCursorPosition()); diff --git a/libs/input/tests/InputPublisherAndConsumer_test.cpp b/libs/input/tests/InputPublisherAndConsumer_test.cpp index 70e4fda662..75a01a16d8 100644 --- a/libs/input/tests/InputPublisherAndConsumer_test.cpp +++ b/libs/input/tests/InputPublisherAndConsumer_test.cpp @@ -90,7 +90,7 @@ void InputPublisherAndConsumerTest::PublishAndConsumeKeyEvent() { uint32_t consumeSeq; InputEvent* event; - status = mConsumer->consume(&mEventFactory, true /*consumeBatches*/, -1, &consumeSeq, &event); + status = mConsumer->consume(&mEventFactory, /*consumeBatches=*/true, -1, &consumeSeq, &event); ASSERT_EQ(OK, status) << "consumer consume should return OK"; @@ -199,7 +199,7 @@ void InputPublisherAndConsumerTest::PublishAndConsumeMotionEvent() { uint32_t consumeSeq; InputEvent* event; - status = mConsumer->consume(&mEventFactory, true /*consumeBatches*/, -1, &consumeSeq, &event); + status = mConsumer->consume(&mEventFactory, /*consumeBatches=*/true, -1, &consumeSeq, &event); ASSERT_EQ(OK, status) << "consumer consume should return OK"; @@ -290,7 +290,7 @@ void InputPublisherAndConsumerTest::PublishAndConsumeFocusEvent() { uint32_t consumeSeq; InputEvent* event; - status = mConsumer->consume(&mEventFactory, true /*consumeBatches*/, -1, &consumeSeq, &event); + status = mConsumer->consume(&mEventFactory, /*consumeBatches=*/true, -1, &consumeSeq, &event); ASSERT_EQ(OK, status) << "consumer consume should return OK"; ASSERT_TRUE(event != nullptr) << "consumer should have returned non-NULL event"; @@ -331,7 +331,7 @@ void InputPublisherAndConsumerTest::PublishAndConsumeCaptureEvent() { uint32_t consumeSeq; InputEvent* event; - status = mConsumer->consume(&mEventFactory, true /*consumeBatches*/, -1, &consumeSeq, &event); + status = mConsumer->consume(&mEventFactory, /*consumeBatches=*/true, -1, &consumeSeq, &event); ASSERT_EQ(OK, status) << "consumer consume should return OK"; ASSERT_TRUE(event != nullptr) << "consumer should have returned non-NULL event"; @@ -373,7 +373,7 @@ void InputPublisherAndConsumerTest::PublishAndConsumeDragEvent() { uint32_t consumeSeq; InputEvent* event; - status = mConsumer->consume(&mEventFactory, true /*consumeBatches*/, -1, &consumeSeq, &event); + status = mConsumer->consume(&mEventFactory, /*consumeBatches=*/true, -1, &consumeSeq, &event); ASSERT_EQ(OK, status) << "consumer consume should return OK"; ASSERT_TRUE(event != nullptr) << "consumer should have returned non-NULL event"; @@ -415,7 +415,7 @@ void InputPublisherAndConsumerTest::PublishAndConsumeTouchModeEvent() { uint32_t consumeSeq; InputEvent* event; - status = mConsumer->consume(&mEventFactory, true /*consumeBatches*/, -1, &consumeSeq, &event); + status = mConsumer->consume(&mEventFactory, /*consumeBatches=*/true, -1, &consumeSeq, &event); ASSERT_EQ(OK, status) << "consumer consume should return OK"; ASSERT_TRUE(event != nullptr) << "consumer should have returned non-NULL event"; diff --git a/libs/input/tests/TouchResampling_test.cpp b/libs/input/tests/TouchResampling_test.cpp index d01258c783..7cb9526af0 100644 --- a/libs/input/tests/TouchResampling_test.cpp +++ b/libs/input/tests/TouchResampling_test.cpp @@ -56,7 +56,7 @@ protected: mPublisher = std::make_unique<InputPublisher>(std::move(serverChannel)); mConsumer = std::make_unique<InputConsumer>(std::move(clientChannel), - true /* enableTouchResampling */); + /*enableTouchResampling=*/true); } status_t publishSimpleMotionEventWithCoords(int32_t action, nsecs_t eventTime, @@ -79,11 +79,11 @@ status_t TouchResamplingTest::publishSimpleMotionEventWithCoords( if (action == AMOTION_EVENT_ACTION_DOWN && eventTime != 0) { ADD_FAILURE() << "Downtime should be equal to 0 (hardcoded for convenience)"; } - return mPublisher->publishMotionEvent(mSeq++, InputEvent::nextId(), 1 /*deviceId*/, - AINPUT_SOURCE_TOUCHSCREEN, 0 /*displayId*/, INVALID_HMAC, - action, 0 /*actionButton*/, 0 /*flags*/, 0 /*edgeFlags*/, - AMETA_NONE, 0 /*buttonState*/, MotionClassification::NONE, - identityTransform, 0 /*xPrecision*/, 0 /*yPrecision*/, + return mPublisher->publishMotionEvent(mSeq++, InputEvent::nextId(), /*deviceId=*/1, + AINPUT_SOURCE_TOUCHSCREEN, /*displayId=*/0, INVALID_HMAC, + action, /*actionButton=*/0, /*flags=*/0, /*edgeFlags=*/0, + AMETA_NONE, /*buttonState=*/0, MotionClassification::NONE, + identityTransform, /*xPrecision=*/0, /*yPrecision=*/0, AMOTION_EVENT_INVALID_CURSOR_POSITION, AMOTION_EVENT_INVALID_CURSOR_POSITION, identityTransform, downTime, eventTime, properties.size(), properties.data(), @@ -161,7 +161,7 @@ void TouchResamplingTest::consumeInputEventEntries(const std::vector<InputEventE uint32_t consumeSeq; InputEvent* event; - status_t status = mConsumer->consume(&mEventFactory, true /*consumeBatches*/, frameTime.count(), + status_t status = mConsumer->consume(&mEventFactory, /*consumeBatches=*/true, frameTime.count(), &consumeSeq, &event); ASSERT_EQ(OK, status); MotionEvent* motionEvent = static_cast<MotionEvent*>(event); diff --git a/libs/input/tests/VelocityTracker_test.cpp b/libs/input/tests/VelocityTracker_test.cpp index c6ad3a2218..027757973b 100644 --- a/libs/input/tests/VelocityTracker_test.cpp +++ b/libs/input/tests/VelocityTracker_test.cpp @@ -159,13 +159,13 @@ static std::vector<MotionEvent> createAxisScrollMotionEventStream( MotionEvent event; ui::Transform identityTransform; - event.initialize(InputEvent::nextId(), 5 /*deviceId*/, AINPUT_SOURCE_ROTARY_ENCODER, + event.initialize(InputEvent::nextId(), /*deviceId=*/5, AINPUT_SOURCE_ROTARY_ENCODER, ADISPLAY_ID_NONE, INVALID_HMAC, AMOTION_EVENT_ACTION_SCROLL, - 0 /*actionButton*/, 0 /*flags*/, AMOTION_EVENT_EDGE_FLAG_NONE, AMETA_NONE, - 0 /*buttonState*/, MotionClassification::NONE, identityTransform, - 0 /*xPrecision*/, 0 /*yPrecision*/, AMOTION_EVENT_INVALID_CURSOR_POSITION, - AMOTION_EVENT_INVALID_CURSOR_POSITION, identityTransform, 0 /*downTime*/, - timeStamp.count(), 1 /*pointerCount*/, properties, coords); + /*actionButton=*/0, /*flags=*/0, AMOTION_EVENT_EDGE_FLAG_NONE, AMETA_NONE, + /*buttonState=*/0, MotionClassification::NONE, identityTransform, + /*xPrecision=*/0, /*yPrecision=*/0, AMOTION_EVENT_INVALID_CURSOR_POSITION, + AMOTION_EVENT_INVALID_CURSOR_POSITION, identityTransform, /*downTime=*/0, + timeStamp.count(), /*pointerCount=*/1, properties, coords); events.emplace_back(event); } @@ -219,12 +219,12 @@ static std::vector<MotionEvent> createTouchMotionEventStream( MotionEvent event; ui::Transform identityTransform; - event.initialize(InputEvent::nextId(), 0 /*deviceId*/, AINPUT_SOURCE_TOUCHSCREEN, - DISPLAY_ID, INVALID_HMAC, action, 0 /*actionButton*/, 0 /*flags*/, - AMOTION_EVENT_EDGE_FLAG_NONE, AMETA_NONE, 0 /*buttonState*/, - MotionClassification::NONE, identityTransform, 0 /*xPrecision*/, - 0 /*yPrecision*/, AMOTION_EVENT_INVALID_CURSOR_POSITION, - AMOTION_EVENT_INVALID_CURSOR_POSITION, identityTransform, 0 /*downTime*/, + event.initialize(InputEvent::nextId(), /*deviceId=*/0, AINPUT_SOURCE_TOUCHSCREEN, + DISPLAY_ID, INVALID_HMAC, action, /*actionButton=*/0, /*flags=*/0, + AMOTION_EVENT_EDGE_FLAG_NONE, AMETA_NONE, /*buttonState=*/0, + MotionClassification::NONE, identityTransform, /*xPrecision=*/0, + /*yPrecision=*/0, AMOTION_EVENT_INVALID_CURSOR_POSITION, + AMOTION_EVENT_INVALID_CURSOR_POSITION, identityTransform, /*downTime=*/0, entry.eventTime.count(), pointerCount, properties, coords); events.emplace_back(event); @@ -341,23 +341,23 @@ TEST_F(VelocityTrackerTest, TestDefaultStrategiesForPlanarAxes) { TEST_F(VelocityTrackerTest, TestComputedVelocity) { VelocityTracker::ComputedVelocity computedVelocity; - computedVelocity.addVelocity(AMOTION_EVENT_AXIS_X, 0 /*id*/, 200 /*velocity*/); - computedVelocity.addVelocity(AMOTION_EVENT_AXIS_X, 26U /*id*/, 400 /*velocity*/); - computedVelocity.addVelocity(AMOTION_EVENT_AXIS_X, 27U /*id*/, 650 /*velocity*/); - computedVelocity.addVelocity(AMOTION_EVENT_AXIS_X, MAX_POINTER_ID, 750 /*velocity*/); - computedVelocity.addVelocity(AMOTION_EVENT_AXIS_Y, 0 /*id*/, 1000 /*velocity*/); - computedVelocity.addVelocity(AMOTION_EVENT_AXIS_Y, 26U /*id*/, 2000 /*velocity*/); - computedVelocity.addVelocity(AMOTION_EVENT_AXIS_Y, 27U /*id*/, 3000 /*velocity*/); - computedVelocity.addVelocity(AMOTION_EVENT_AXIS_Y, MAX_POINTER_ID, 4000 /*velocity*/); + computedVelocity.addVelocity(AMOTION_EVENT_AXIS_X, /*id=*/0, /*velocity=*/200); + computedVelocity.addVelocity(AMOTION_EVENT_AXIS_X, /*id=*/26U, /*velocity=*/400); + computedVelocity.addVelocity(AMOTION_EVENT_AXIS_X, /*id=*/27U, /*velocity=*/650); + computedVelocity.addVelocity(AMOTION_EVENT_AXIS_X, MAX_POINTER_ID, /*velocity=*/750); + computedVelocity.addVelocity(AMOTION_EVENT_AXIS_Y, /*id=*/0, /*velocity=*/1000); + computedVelocity.addVelocity(AMOTION_EVENT_AXIS_Y, /*id=*/26U, /*velocity=*/2000); + computedVelocity.addVelocity(AMOTION_EVENT_AXIS_Y, /*id=*/27U, /*velocity=*/3000); + computedVelocity.addVelocity(AMOTION_EVENT_AXIS_Y, MAX_POINTER_ID, /*velocity=*/4000); // Check the axes/indices with velocity. - EXPECT_EQ(*(computedVelocity.getVelocity(AMOTION_EVENT_AXIS_X, 0U /*id*/)), 200); - EXPECT_EQ(*(computedVelocity.getVelocity(AMOTION_EVENT_AXIS_X, 26U /*id*/)), 400); - EXPECT_EQ(*(computedVelocity.getVelocity(AMOTION_EVENT_AXIS_X, 27U /*id*/)), 650); + EXPECT_EQ(*(computedVelocity.getVelocity(AMOTION_EVENT_AXIS_X, /*id=*/0U)), 200); + EXPECT_EQ(*(computedVelocity.getVelocity(AMOTION_EVENT_AXIS_X, /*id=*/26U)), 400); + EXPECT_EQ(*(computedVelocity.getVelocity(AMOTION_EVENT_AXIS_X, /*id=*/27U)), 650); EXPECT_EQ(*(computedVelocity.getVelocity(AMOTION_EVENT_AXIS_X, MAX_POINTER_ID)), 750); - EXPECT_EQ(*(computedVelocity.getVelocity(AMOTION_EVENT_AXIS_Y, 0U /*id*/)), 1000); - EXPECT_EQ(*(computedVelocity.getVelocity(AMOTION_EVENT_AXIS_Y, 26U /*id*/)), 2000); - EXPECT_EQ(*(computedVelocity.getVelocity(AMOTION_EVENT_AXIS_Y, 27U /*id*/)), 3000); + EXPECT_EQ(*(computedVelocity.getVelocity(AMOTION_EVENT_AXIS_Y, /*id=*/0U)), 1000); + EXPECT_EQ(*(computedVelocity.getVelocity(AMOTION_EVENT_AXIS_Y, /*id=*/26U)), 2000); + EXPECT_EQ(*(computedVelocity.getVelocity(AMOTION_EVENT_AXIS_Y, /*id=*/27U)), 3000); EXPECT_EQ(*(computedVelocity.getVelocity(AMOTION_EVENT_AXIS_Y, MAX_POINTER_ID)), 4000); for (uint32_t id = 0; id <= MAX_POINTER_ID; id++) { // Since no data was added for AXIS_SCROLL, expect empty value for the axis for any id. @@ -436,17 +436,17 @@ TEST_F(VelocityTrackerTest, TestGetComputedVelocity) { float maxFloat = std::numeric_limits<float>::max(); VelocityTracker::ComputedVelocity computedVelocity; - computedVelocity = vt.getComputedVelocity(1000 /* units */, maxFloat); + computedVelocity = vt.getComputedVelocity(/*units=*/1000, maxFloat); checkVelocity(*(computedVelocity.getVelocity(AMOTION_EVENT_AXIS_X, DEFAULT_POINTER_ID)), 764.345703); // Expect X velocity to be scaled with respective to provided units. - computedVelocity = vt.getComputedVelocity(1000000 /* units */, maxFloat); + computedVelocity = vt.getComputedVelocity(/*units=*/1000000, maxFloat); checkVelocity(*(computedVelocity.getVelocity(AMOTION_EVENT_AXIS_X, DEFAULT_POINTER_ID)), 764345.703); // Expect X velocity to be clamped by provided max velocity. - computedVelocity = vt.getComputedVelocity(1000000 /* units */, 1000); + computedVelocity = vt.getComputedVelocity(/*units=*/1000000, 1000); checkVelocity(*(computedVelocity.getVelocity(AMOTION_EVENT_AXIS_X, DEFAULT_POINTER_ID)), 1000); // All 0 data for Y; expect 0 velocity. diff --git a/libs/input/tests/VerifiedInputEvent_test.cpp b/libs/input/tests/VerifiedInputEvent_test.cpp index f2b59ea9ab..277d74dd1c 100644 --- a/libs/input/tests/VerifiedInputEvent_test.cpp +++ b/libs/input/tests/VerifiedInputEvent_test.cpp @@ -23,10 +23,10 @@ namespace android { static KeyEvent getKeyEventWithFlags(int32_t flags) { KeyEvent event; - event.initialize(InputEvent::nextId(), 2 /*deviceId*/, AINPUT_SOURCE_GAMEPAD, + event.initialize(InputEvent::nextId(), /*deviceId=*/2, AINPUT_SOURCE_GAMEPAD, ADISPLAY_ID_DEFAULT, INVALID_HMAC, AKEY_EVENT_ACTION_DOWN, flags, - AKEYCODE_BUTTON_X, 121 /*scanCode*/, AMETA_ALT_ON, 1 /*repeatCount*/, - 1000 /*downTime*/, 2000 /*eventTime*/); + AKEYCODE_BUTTON_X, /*scanCode=*/121, AMETA_ALT_ON, /*repeatCount=*/1, + /*downTime=*/1000, /*eventTime=*/2000); return event; } @@ -44,12 +44,12 @@ static MotionEvent getMotionEventWithFlags(int32_t flags) { ui::Transform transform; transform.set({2, 0, 4, 0, 3, 5, 0, 0, 1}); ui::Transform identity; - event.initialize(InputEvent::nextId(), 0 /*deviceId*/, AINPUT_SOURCE_MOUSE, ADISPLAY_ID_DEFAULT, - INVALID_HMAC, AMOTION_EVENT_ACTION_DOWN, 0 /*actionButton*/, flags, - AMOTION_EVENT_EDGE_FLAG_NONE, AMETA_NONE, 0 /*buttonState*/, - MotionClassification::NONE, transform, 0.1 /*xPrecision*/, 0.2 /*yPrecision*/, - 280 /*xCursorPosition*/, 540 /*yCursorPosition*/, identity, 100 /*downTime*/, - 200 /*eventTime*/, pointerCount, pointerProperties, pointerCoords); + event.initialize(InputEvent::nextId(), /*deviceId=*/0, AINPUT_SOURCE_MOUSE, ADISPLAY_ID_DEFAULT, + INVALID_HMAC, AMOTION_EVENT_ACTION_DOWN, /*actionButton=*/0, flags, + AMOTION_EVENT_EDGE_FLAG_NONE, AMETA_NONE, /*buttonState=*/0, + MotionClassification::NONE, transform, /*xPrecision=*/0.1, /*yPrecision=*/0.2, + /*xCursorPosition=*/280, /*yCursorPosition=*/540, identity, /*downTime=*/100, + /*eventTime=*/200, pointerCount, pointerProperties, pointerCoords); return event; } |