Changeset View
Changeset View
Standalone View
Standalone View
autotests/libinput/pointer_event_test.cpp
Show First 20 Lines • Show All 122 Lines • ▼ Show 20 Line(s) | 112 | { | |||
---|---|---|---|---|---|
123 | 123 | | |||
124 | QScopedPointer<Event> event(Event::create(pointerEvent)); | 124 | QScopedPointer<Event> event(Event::create(pointerEvent)); | ||
125 | auto pe = dynamic_cast<PointerEvent*>(event.data()); | 125 | auto pe = dynamic_cast<PointerEvent*>(event.data()); | ||
126 | QVERIFY(pe); | 126 | QVERIFY(pe); | ||
127 | QCOMPARE(pe->type(), LIBINPUT_EVENT_POINTER_BUTTON); | 127 | QCOMPARE(pe->type(), LIBINPUT_EVENT_POINTER_BUTTON); | ||
128 | QTEST(pe->buttonState(), "expectedButtonState"); | 128 | QTEST(pe->buttonState(), "expectedButtonState"); | ||
129 | QCOMPARE(pe->button(), button); | 129 | QCOMPARE(pe->button(), button); | ||
130 | QCOMPARE(pe->time(), time); | 130 | QCOMPARE(pe->time(), time); | ||
131 | QCOMPARE(pe->timeMicroseconds(), quint64(time * 1000)); | ||||
131 | } | 132 | } | ||
132 | 133 | | |||
133 | void TestLibinputPointerEvent::testAxis_data() | 134 | void TestLibinputPointerEvent::testAxis_data() | ||
134 | { | 135 | { | ||
135 | QTest::addColumn<bool>("horizontal"); | 136 | QTest::addColumn<bool>("horizontal"); | ||
136 | QTest::addColumn<bool>("vertical"); | 137 | QTest::addColumn<bool>("vertical"); | ||
137 | QTest::addColumn<QPointF>("value"); | 138 | QTest::addColumn<QPointF>("value"); | ||
138 | QTest::addColumn<quint32>("time"); | 139 | QTest::addColumn<quint32>("time"); | ||
Show All 39 Lines | 174 | { | |||
178 | pointerEvent->delta = QSizeF(2.1, 4.5); | 179 | pointerEvent->delta = QSizeF(2.1, 4.5); | ||
179 | pointerEvent->time = 500u; | 180 | pointerEvent->time = 500u; | ||
180 | 181 | | |||
181 | QScopedPointer<Event> event(Event::create(pointerEvent)); | 182 | QScopedPointer<Event> event(Event::create(pointerEvent)); | ||
182 | auto pe = dynamic_cast<PointerEvent*>(event.data()); | 183 | auto pe = dynamic_cast<PointerEvent*>(event.data()); | ||
183 | QVERIFY(pe); | 184 | QVERIFY(pe); | ||
184 | QCOMPARE(pe->type(), LIBINPUT_EVENT_POINTER_MOTION); | 185 | QCOMPARE(pe->type(), LIBINPUT_EVENT_POINTER_MOTION); | ||
185 | QCOMPARE(pe->time(), 500u); | 186 | QCOMPARE(pe->time(), 500u); | ||
186 | QCOMPARE(pe->delta(), QPointF(2.1, 4.5)); | 187 | QCOMPARE(pe->delta(), QSizeF(2.1, 4.5)); | ||
187 | } | 188 | } | ||
188 | 189 | | |||
189 | void TestLibinputPointerEvent::testAbsoluteMotion() | 190 | void TestLibinputPointerEvent::testAbsoluteMotion() | ||
190 | { | 191 | { | ||
191 | // this test verifies absolute pointer motion | 192 | // this test verifies absolute pointer motion | ||
192 | libinput_event_pointer *pointerEvent = new libinput_event_pointer; | 193 | libinput_event_pointer *pointerEvent = new libinput_event_pointer; | ||
193 | pointerEvent->device = m_nativeDevice; | 194 | pointerEvent->device = m_nativeDevice; | ||
194 | pointerEvent->type = LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE; | 195 | pointerEvent->type = LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE; | ||
Show All 14 Lines |