Changeset View
Changeset View
Standalone View
Standalone View
autotests/client/test_fake_input.cpp
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Line(s) | 41 | private Q_SLOTS: | |||
---|---|---|---|---|---|
45 | void testAuthenticate(); | 45 | void testAuthenticate(); | ||
46 | void testMotion(); | 46 | void testMotion(); | ||
47 | void testPointerButtonQt_data(); | 47 | void testPointerButtonQt_data(); | ||
48 | void testPointerButtonQt(); | 48 | void testPointerButtonQt(); | ||
49 | void testPointerButtonLinux_data(); | 49 | void testPointerButtonLinux_data(); | ||
50 | void testPointerButtonLinux(); | 50 | void testPointerButtonLinux(); | ||
51 | void testAxis_data(); | 51 | void testAxis_data(); | ||
52 | void testAxis(); | 52 | void testAxis(); | ||
53 | void testTouch(); | ||||
53 | 54 | | |||
54 | private: | 55 | private: | ||
55 | Display *m_display = nullptr; | 56 | Display *m_display = nullptr; | ||
56 | FakeInputInterface *m_fakeInputInterface = nullptr; | 57 | FakeInputInterface *m_fakeInputInterface = nullptr; | ||
57 | FakeInputDevice *m_device = nullptr; | 58 | FakeInputDevice *m_device = nullptr; | ||
58 | ConnectionThread *m_connection = nullptr; | 59 | ConnectionThread *m_connection = nullptr; | ||
59 | QThread *m_thread = nullptr; | 60 | QThread *m_thread = nullptr; | ||
60 | EventQueue *m_queue = nullptr; | 61 | EventQueue *m_queue = nullptr; | ||
▲ Show 20 Lines • Show All 251 Lines • ▼ Show 20 Line(s) | 298 | { | |||
312 | // now we can properly test | 313 | // now we can properly test | ||
313 | m_fakeInput->requestPointerAxis(orientation, delta); | 314 | m_fakeInput->requestPointerAxis(orientation, delta); | ||
314 | QVERIFY(axisSpy.wait()); | 315 | QVERIFY(axisSpy.wait()); | ||
315 | QCOMPARE(axisSpy.count(), 1); | 316 | QCOMPARE(axisSpy.count(), 1); | ||
316 | QCOMPARE(axisSpy.first().at(0).value<Qt::Orientation>(), orientation); | 317 | QCOMPARE(axisSpy.first().at(0).value<Qt::Orientation>(), orientation); | ||
317 | QCOMPARE(axisSpy.first().at(1).value<qreal>(), delta); | 318 | QCOMPARE(axisSpy.first().at(1).value<qreal>(), delta); | ||
318 | } | 319 | } | ||
319 | 320 | | |||
321 | void FakeInputTest::testTouch() | ||||
322 | { | ||||
323 | QVERIFY(!m_device->isAuthenticated()); | ||||
324 | QSignalSpy touchDownSpy(m_device, &FakeInputDevice::touchDownRequested); | ||||
325 | QVERIFY(touchDownSpy.isValid()); | ||||
326 | | ||||
327 | // without an authentication we shouldn't get the signals | ||||
328 | m_fakeInput->requestTouchDown(0,QPointF(1, 2)); | ||||
bshah: In addition to what @graesslin said, one point about coding style,
KWayland is part of KF5… | |||||
329 | QVERIFY(!touchDownSpy.wait(100)); | ||||
330 | | ||||
331 | // now let's authenticate the interface | ||||
332 | m_device->setAuthentication(true); | ||||
333 | m_fakeInput->requestTouchDown(0,QPointF(1, 2)); | ||||
334 | QVERIFY(touchDownSpy.wait()); | ||||
335 | QCOMPARE(touchDownSpy.count(), 1); | ||||
336 | QCOMPARE(touchDownSpy.last().at(0).value<quint32>(), quint32(0)); | ||||
337 | QCOMPARE(touchDownSpy.last().at(1).toPointF(), QPointF(1, 2)); | ||||
338 | | ||||
339 | QSignalSpy touchMotionSpy(m_device, &FakeInputDevice::touchMotionRequested); | ||||
340 | QVERIFY(touchMotionSpy.isValid()); | ||||
341 | m_fakeInput->requestTouchMotion(0,QSizeF(3, 4)); | ||||
342 | QVERIFY(touchMotionSpy.wait()); | ||||
343 | QCOMPARE(touchMotionSpy.count(), 1); | ||||
344 | QCOMPARE(touchMotionSpy.last().at(0).value<quint32>(), quint32(0)); | ||||
345 | QCOMPARE(touchMotionSpy.last().at(1).toSizeF(), QSizeF(3, 4)); | ||||
346 | | ||||
347 | QSignalSpy touchUpSpy(m_device, &FakeInputDevice::touchUpRequested); | ||||
348 | QVERIFY(touchUpSpy.isValid()); | ||||
349 | m_fakeInput->requestTouchUp(0); | ||||
350 | QVERIFY(touchUpSpy.wait()); | ||||
351 | QCOMPARE(touchUpSpy.count() , 1); | ||||
352 | QCOMPARE(touchUpSpy.last().at(0).value<quint32>(), quint32(0)); | ||||
353 | } | ||||
354 | | ||||
355 | | ||||
320 | QTEST_GUILESS_MAIN(FakeInputTest) | 356 | QTEST_GUILESS_MAIN(FakeInputTest) | ||
321 | #include "test_fake_input.moc" | 357 | #include "test_fake_input.moc" |
In addition to what @graesslin said, one point about coding style,
KWayland is part of KF5 which follows KDE Frameworks 5 Coding style guide for its code.
You seem to have used inconsistent coding style for code here and as well other places. Please go over all the code you have added and correct it.