当前位置: 首页>>代码示例>>C++>>正文


C++ MotionEvent::getHistoricalToolMinor方法代码示例

本文整理汇总了C++中MotionEvent::getHistoricalToolMinor方法的典型用法代码示例。如果您正苦于以下问题:C++ MotionEvent::getHistoricalToolMinor方法的具体用法?C++ MotionEvent::getHistoricalToolMinor怎么用?C++ MotionEvent::getHistoricalToolMinor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MotionEvent的用法示例。


在下文中一共展示了MotionEvent::getHistoricalToolMinor方法的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";
}
开发者ID:Abhishekh-TEL,项目名称:pdroid,代码行数:101,代码来源:InputPublisherAndConsumer_test.cpp


注:本文中的MotionEvent::getHistoricalToolMinor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。