本文整理汇总了C++中MotionEvent::getHistoricalTouchMinor方法的典型用法代码示例。如果您正苦于以下问题:C++ MotionEvent::getHistoricalTouchMinor方法的具体用法?C++ MotionEvent::getHistoricalTouchMinor怎么用?C++ MotionEvent::getHistoricalTouchMinor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MotionEvent
的用法示例。
在下文中一共展示了MotionEvent::getHistoricalTouchMinor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PublishAndConsumeMotionEvent
//.........这里部分代码省略.........
<< "publisher appendMotionEvent should return OK";
}
status = mConsumer->receiveDispatchSignal();
ASSERT_EQ(OK, status)
<< "consumer receiveDispatchSignal should return OK";
InputEvent* event;
status = mConsumer->consume(& mEventFactory, & event);
ASSERT_EQ(OK, status)
<< "consumer consume should return OK";
ASSERT_TRUE(event != NULL)
<< "consumer should have returned non-NULL event";
ASSERT_EQ(AINPUT_EVENT_TYPE_MOTION, event->getType())
<< "consumer should have returned a motion event";
size_t lastSampleIndex = samplesToAppendBeforeDispatch + samplesToAppendAfterDispatch;
MotionEvent* motionEvent = static_cast<MotionEvent*>(event);
EXPECT_EQ(deviceId, motionEvent->getDeviceId());
EXPECT_EQ(source, motionEvent->getSource());
EXPECT_EQ(action, motionEvent->getAction());
EXPECT_EQ(flags, motionEvent->getFlags());
EXPECT_EQ(edgeFlags, motionEvent->getEdgeFlags());
EXPECT_EQ(metaState, motionEvent->getMetaState());
EXPECT_EQ(xPrecision, motionEvent->getXPrecision());
EXPECT_EQ(yPrecision, motionEvent->getYPrecision());
EXPECT_EQ(downTime, motionEvent->getDownTime());
EXPECT_EQ(sampleEventTimes[lastSampleIndex], motionEvent->getEventTime());
EXPECT_EQ(pointerCount, motionEvent->getPointerCount());
EXPECT_EQ(lastSampleIndex, motionEvent->getHistorySize());
for (size_t i = 0; i < pointerCount; i++) {
SCOPED_TRACE(i);
EXPECT_EQ(pointerIds[i], motionEvent->getPointerId(i));
}
for (size_t sampleIndex = 0; sampleIndex < lastSampleIndex; sampleIndex++) {
SCOPED_TRACE(sampleIndex);
EXPECT_EQ(sampleEventTimes[sampleIndex],
motionEvent->getHistoricalEventTime(sampleIndex));
for (size_t i = 0; i < pointerCount; i++) {
SCOPED_TRACE(i);
size_t offset = sampleIndex * pointerCount + i;
EXPECT_EQ(samplePointerCoords[offset].x,
motionEvent->getHistoricalRawX(i, sampleIndex));
EXPECT_EQ(samplePointerCoords[offset].y,
motionEvent->getHistoricalRawY(i, sampleIndex));
EXPECT_EQ(samplePointerCoords[offset].x + xOffset,
motionEvent->getHistoricalX(i, sampleIndex));
EXPECT_EQ(samplePointerCoords[offset].y + yOffset,
motionEvent->getHistoricalY(i, sampleIndex));
EXPECT_EQ(samplePointerCoords[offset].pressure,
motionEvent->getHistoricalPressure(i, sampleIndex));
EXPECT_EQ(samplePointerCoords[offset].size,
motionEvent->getHistoricalSize(i, sampleIndex));
EXPECT_EQ(samplePointerCoords[offset].touchMajor,
motionEvent->getHistoricalTouchMajor(i, sampleIndex));
EXPECT_EQ(samplePointerCoords[offset].touchMinor,
motionEvent->getHistoricalTouchMinor(i, sampleIndex));
EXPECT_EQ(samplePointerCoords[offset].toolMajor,
motionEvent->getHistoricalToolMajor(i, sampleIndex));
EXPECT_EQ(samplePointerCoords[offset].toolMinor,
motionEvent->getHistoricalToolMinor(i, sampleIndex));
EXPECT_EQ(samplePointerCoords[offset].orientation,
motionEvent->getHistoricalOrientation(i, sampleIndex));
}
}
SCOPED_TRACE(lastSampleIndex);
EXPECT_EQ(sampleEventTimes[lastSampleIndex], motionEvent->getEventTime());
for (size_t i = 0; i < pointerCount; i++) {
SCOPED_TRACE(i);
size_t offset = lastSampleIndex * pointerCount + i;
EXPECT_EQ(samplePointerCoords[offset].x, motionEvent->getRawX(i));
EXPECT_EQ(samplePointerCoords[offset].y, motionEvent->getRawY(i));
EXPECT_EQ(samplePointerCoords[offset].x + xOffset, motionEvent->getX(i));
EXPECT_EQ(samplePointerCoords[offset].y + yOffset, motionEvent->getY(i));
EXPECT_EQ(samplePointerCoords[offset].pressure, motionEvent->getPressure(i));
EXPECT_EQ(samplePointerCoords[offset].size, motionEvent->getSize(i));
EXPECT_EQ(samplePointerCoords[offset].touchMajor, motionEvent->getTouchMajor(i));
EXPECT_EQ(samplePointerCoords[offset].touchMinor, motionEvent->getTouchMinor(i));
EXPECT_EQ(samplePointerCoords[offset].toolMajor, motionEvent->getToolMajor(i));
EXPECT_EQ(samplePointerCoords[offset].toolMinor, motionEvent->getToolMinor(i));
EXPECT_EQ(samplePointerCoords[offset].orientation, motionEvent->getOrientation(i));
}
status = mConsumer->sendFinishedSignal();
ASSERT_EQ(OK, status)
<< "consumer sendFinishedSignal should return OK";
status = mPublisher->receiveFinishedSignal();
ASSERT_EQ(OK, status)
<< "publisher receiveFinishedSignal should return OK";
status = mPublisher->reset();
ASSERT_EQ(OK, status)
<< "publisher reset should return OK";
}