Fix input tests to work with new MotionEvent member

Change-Id: I0dde0f91f693903f26edc116b5dbcbf33bac2b93
This commit is contained in:
Michael Wright 2015-05-14 16:29:13 +01:00
parent 7b159c9a4f
commit b03f103fd4
4 changed files with 13 additions and 11 deletions

View File

@ -96,7 +96,7 @@ struct InputMessage {
float yPrecision;
uint32_t pointerCount;
// Note that PointerCoords requires 8 byte alignment.
struct Pointer{
struct Pointer {
PointerProperties properties;
PointerCoords coords;
} pointers[MAX_POINTERS];

View File

@ -248,7 +248,7 @@ void MotionEventTest::initializeEventWithHistory(MotionEvent* event) {
pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_TOOL_MAJOR, 26);
pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_TOOL_MINOR, 27);
pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_ORIENTATION, 28);
event->initialize(2, AINPUT_SOURCE_TOUCHSCREEN, AMOTION_EVENT_ACTION_MOVE,
event->initialize(2, AINPUT_SOURCE_TOUCHSCREEN, AMOTION_EVENT_ACTION_MOVE, 0,
AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED,
AMOTION_EVENT_EDGE_FLAG_TOP, AMETA_ALT_ON, AMOTION_EVENT_BUTTON_PRIMARY,
X_OFFSET, Y_OFFSET, 2.0f, 2.1f,
@ -557,7 +557,7 @@ TEST_F(MotionEventTest, Transform) {
pointerCoords[i].setAxisValue(AMOTION_EVENT_AXIS_ORIENTATION, angle);
}
MotionEvent event;
event.initialize(0, 0, AMOTION_EVENT_ACTION_MOVE, 0, 0, 0, 0,
event.initialize(0, 0, AMOTION_EVENT_ACTION_MOVE, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, pointerCount, pointerProperties, pointerCoords);
float originalRawX = 0 + 3;
float originalRawY = -RADIUS + 2;

View File

@ -133,6 +133,7 @@ void InputPublisherAndConsumerTest::PublishAndConsumeMotionEvent() {
const int32_t deviceId = 1;
const int32_t source = AINPUT_SOURCE_TOUCHSCREEN;
const int32_t action = AMOTION_EVENT_ACTION_MOVE;
const int32_t actionButton = 0;
const int32_t flags = AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED;
const int32_t edgeFlags = AMOTION_EVENT_EDGE_FLAG_TOP;
const int32_t metaState = AMETA_ALT_LEFT_ON | AMETA_ALT_ON;
@ -163,8 +164,8 @@ void InputPublisherAndConsumerTest::PublishAndConsumeMotionEvent() {
pointerCoords[i].setAxisValue(AMOTION_EVENT_AXIS_ORIENTATION, 3.5 * i);
}
status = mPublisher->publishMotionEvent(seq, deviceId, source, action, flags, edgeFlags,
metaState, buttonState, xOffset, yOffset, xPrecision, yPrecision,
status = mPublisher->publishMotionEvent(seq, deviceId, source, action, actionButton,
flags, edgeFlags, metaState, buttonState, xOffset, yOffset, xPrecision, yPrecision,
downTime, eventTime, pointerCount,
pointerProperties, pointerCoords);
ASSERT_EQ(OK, status)
@ -255,7 +256,7 @@ TEST_F(InputPublisherAndConsumerTest, PublishMotionEvent_WhenPointerCountLessTha
PointerProperties pointerProperties[pointerCount];
PointerCoords pointerCoords[pointerCount];
status = mPublisher->publishMotionEvent(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
status = mPublisher->publishMotionEvent(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
pointerCount, pointerProperties, pointerCoords);
ASSERT_EQ(BAD_VALUE, status)
<< "publisher publishMotionEvent should return BAD_VALUE";
@ -271,7 +272,7 @@ TEST_F(InputPublisherAndConsumerTest, PublishMotionEvent_WhenPointerCountGreater
pointerCoords[i].clear();
}
status = mPublisher->publishMotionEvent(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
status = mPublisher->publishMotionEvent(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
pointerCount, pointerProperties, pointerCoords);
ASSERT_EQ(BAD_VALUE, status)
<< "publisher publishMotionEvent should return BAD_VALUE";

View File

@ -51,10 +51,11 @@ void TestInputMessageAlignment() {
CHECK_OFFSET(InputMessage::Body::Motion, deviceId, 16);
CHECK_OFFSET(InputMessage::Body::Motion, source, 20);
CHECK_OFFSET(InputMessage::Body::Motion, action, 24);
CHECK_OFFSET(InputMessage::Body::Motion, flags, 28);
CHECK_OFFSET(InputMessage::Body::Motion, metaState, 32);
CHECK_OFFSET(InputMessage::Body::Motion, buttonState, 36);
CHECK_OFFSET(InputMessage::Body::Motion, edgeFlags, 40);
CHECK_OFFSET(InputMessage::Body::Motion, actionButton, 28);
CHECK_OFFSET(InputMessage::Body::Motion, flags, 32);
CHECK_OFFSET(InputMessage::Body::Motion, metaState, 36);
CHECK_OFFSET(InputMessage::Body::Motion, buttonState, 40);
CHECK_OFFSET(InputMessage::Body::Motion, edgeFlags, 44);
CHECK_OFFSET(InputMessage::Body::Motion, downTime, 48);
CHECK_OFFSET(InputMessage::Body::Motion, xOffset, 56);
CHECK_OFFSET(InputMessage::Body::Motion, yOffset, 60);