Changeset View
Changeset View
Standalone View
Standalone View
autotests/client/test_fake_input.cpp
Show All 38 Lines | |||||
39 | { | 39 | { | ||
40 | Q_OBJECT | 40 | Q_OBJECT | ||
41 | private Q_SLOTS: | 41 | private Q_SLOTS: | ||
42 | void init(); | 42 | void init(); | ||
43 | void cleanup(); | 43 | void cleanup(); | ||
44 | 44 | | |||
45 | void testAuthenticate(); | 45 | void testAuthenticate(); | ||
46 | void testMotion(); | 46 | void testMotion(); | ||
47 | void testMotionAbsolute(); | ||||
47 | void testPointerButtonQt_data(); | 48 | void testPointerButtonQt_data(); | ||
48 | void testPointerButtonQt(); | 49 | void testPointerButtonQt(); | ||
49 | void testPointerButtonLinux_data(); | 50 | void testPointerButtonLinux_data(); | ||
50 | void testPointerButtonLinux(); | 51 | void testPointerButtonLinux(); | ||
51 | void testAxis_data(); | 52 | void testAxis_data(); | ||
52 | void testAxis(); | 53 | void testAxis(); | ||
53 | void testTouch(); | 54 | void testTouch(); | ||
54 | 55 | | |||
▲ Show 20 Lines • Show All 119 Lines • ▼ Show 20 Line(s) | 159 | { | |||
174 | 175 | | |||
175 | // just for the fun: once more | 176 | // just for the fun: once more | ||
176 | m_fakeInput->requestPointerMove(QSizeF(0, 0)); | 177 | m_fakeInput->requestPointerMove(QSizeF(0, 0)); | ||
177 | QVERIFY(motionSpy.wait()); | 178 | QVERIFY(motionSpy.wait()); | ||
178 | QCOMPARE(motionSpy.count(), 2); | 179 | QCOMPARE(motionSpy.count(), 2); | ||
179 | QCOMPARE(motionSpy.last().first().toSizeF(), QSizeF(0, 0)); | 180 | QCOMPARE(motionSpy.last().first().toSizeF(), QSizeF(0, 0)); | ||
180 | } | 181 | } | ||
181 | 182 | | |||
183 | void FakeInputTest::testMotionAbsolute() | ||||
184 | { | ||||
185 | // this test verifies that motion is properly passed to the server | ||||
186 | QVERIFY(!m_device->isAuthenticated()); | ||||
187 | QSignalSpy motionSpy(m_device, &FakeInputDevice::pointerMotionAbsoluteRequested); | ||||
188 | QVERIFY(motionSpy.isValid()); | ||||
189 | | ||||
190 | // without an authentication we shouldn't get the signals | ||||
191 | m_fakeInput->requestPointerMoveAbsolute(QPointF(1, 2)); | ||||
192 | QVERIFY(!motionSpy.wait(100)); | ||||
193 | | ||||
194 | // now let's authenticate the interface | ||||
195 | m_device->setAuthentication(true); | ||||
196 | m_fakeInput->requestPointerMoveAbsolute(QPointF(1, 2)); | ||||
197 | QVERIFY(motionSpy.wait()); | ||||
198 | QCOMPARE(motionSpy.count(), 1); | ||||
199 | QCOMPARE(motionSpy.last().first().toPointF(), QPointF(1, 2)); | ||||
200 | | ||||
201 | // just for the fun: once more | ||||
202 | m_fakeInput->requestPointerMoveAbsolute(QPointF(0, 0)); | ||||
203 | QVERIFY(motionSpy.wait()); | ||||
204 | QCOMPARE(motionSpy.count(), 2); | ||||
205 | QCOMPARE(motionSpy.last().first().toPointF(), QPointF(0, 0)); | ||||
206 | } | ||||
207 | | ||||
182 | void FakeInputTest::testPointerButtonQt_data() | 208 | void FakeInputTest::testPointerButtonQt_data() | ||
183 | { | 209 | { | ||
184 | QTest::addColumn<Qt::MouseButton>("qtButton"); | 210 | QTest::addColumn<Qt::MouseButton>("qtButton"); | ||
185 | QTest::addColumn<quint32>("linuxButton"); | 211 | QTest::addColumn<quint32>("linuxButton"); | ||
186 | 212 | | |||
187 | QTest::newRow("left") << Qt::LeftButton << quint32(BTN_LEFT); | 213 | QTest::newRow("left") << Qt::LeftButton << quint32(BTN_LEFT); | ||
188 | QTest::newRow("right") << Qt::RightButton << quint32(BTN_RIGHT); | 214 | QTest::newRow("right") << Qt::RightButton << quint32(BTN_RIGHT); | ||
189 | QTest::newRow("middle") << Qt::MiddleButton << quint32(BTN_MIDDLE); | 215 | QTest::newRow("middle") << Qt::MiddleButton << quint32(BTN_MIDDLE); | ||
▲ Show 20 Lines • Show All 213 Lines • Show Last 20 Lines |