diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2016-08-17 15:05:24 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2016-08-17 13:37:36 +0000 |
commit | 9132b7731c5e2b418d240bac998a10112be50938 (patch) | |
tree | 2c944d533cbaae778129cf14864117a110b57e3a /tests/auto/quick/touchmouse | |
parent | 0bf89f3ce602ce2ecd3d21bc989aef6f8fb02207 (diff) |
stabilize tst_TouchMouse::hoverEnabled
The autotest does not generate the mouse movement that will occur
if you touch an actual touchscreen on X11.
QQuickWindowPrivate::flushFrameSynchronousEvents() will hover the
MouseArea as if the mouse had moved, but that doesn't update
QGuiApplicationPrivate::lastCursorPosition. The test checks that
the synth mouse move in QQuickWindowPrivate::deliverTouchAsMouse()
occurred in response to the touch release, but if
flushFrameSynchronousEvents occurs before these lines
QVERIFY(mouseArea1->hovered());
QVERIFY(!mouseArea2->hovered());
then it will fail because the touchpoint left mouseArea2 hovered.
Also replace QVERIFY with QCOMPARE where we are comparing a value,
so that when it fails we can see why.
Task-number: QTBUG-55350
Change-Id: I6c9c9ff1aa57c199cdc4be59156bd36e487cbd2b
Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
Diffstat (limited to 'tests/auto/quick/touchmouse')
-rw-r--r-- | tests/auto/quick/touchmouse/tst_touchmouse.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/tests/auto/quick/touchmouse/tst_touchmouse.cpp b/tests/auto/quick/touchmouse/tst_touchmouse.cpp index 1ec24e35d5..baa4bcb21c 100644 --- a/tests/auto/quick/touchmouse/tst_touchmouse.cpp +++ b/tests/auto/quick/touchmouse/tst_touchmouse.cpp @@ -1373,8 +1373,8 @@ void tst_TouchMouse::hoverEnabled() // ------------------------- Touch click on mouseArea1 QTest::touchEvent(window, device).press(0, p1, window); - QVERIFY(enterSpy1.count() == 1); - QVERIFY(enterSpy2.count() == 0); + QCOMPARE(enterSpy1.count(), 1); + QCOMPARE(enterSpy2.count(), 0); QVERIFY(mouseArea1->pressed()); QVERIFY(mouseArea1->hovered()); QVERIFY(!mouseArea2->hovered()); @@ -1385,33 +1385,36 @@ void tst_TouchMouse::hoverEnabled() QVERIFY(!mouseArea2->hovered()); // ------------------------- Touch click on mouseArea2 + if (QGuiApplication::platformName().compare(QLatin1String("xcb"), Qt::CaseInsensitive) == 0) + QSKIP("hover can be momentarily inconsistent on X11, depending on timing of flushFrameSynchronousEvents with touch and mouse movements (QTBUG-55350)"); + QTest::touchEvent(window, device).press(0, p2, window); QVERIFY(mouseArea1->hovered()); QVERIFY(mouseArea2->hovered()); QVERIFY(mouseArea2->pressed()); - QVERIFY(enterSpy1.count() == 1); - QVERIFY(enterSpy2.count() == 1); + QCOMPARE(enterSpy1.count(), 1); + QCOMPARE(enterSpy2.count(), 1); QTest::touchEvent(window, device).release(0, p2, window); QVERIFY(clickSpy2.count() == 1); QVERIFY(mouseArea1->hovered()); QVERIFY(!mouseArea2->hovered()); - QVERIFY(exitSpy1.count() == 0); - QVERIFY(exitSpy2.count() == 1); + QCOMPARE(exitSpy1.count(), 0); + QCOMPARE(exitSpy2.count(), 1); // ------------------------- Another touch click on mouseArea1 QTest::touchEvent(window, device).press(0, p1, window); - QVERIFY(enterSpy1.count() == 1); - QVERIFY(enterSpy2.count() == 1); + QCOMPARE(enterSpy1.count(), 1); + QCOMPARE(enterSpy2.count(), 1); QVERIFY(mouseArea1->pressed()); QVERIFY(mouseArea1->hovered()); QVERIFY(!mouseArea2->hovered()); QTest::touchEvent(window, device).release(0, p1, window); - QVERIFY(clickSpy1.count() == 2); + QCOMPARE(clickSpy1.count(), 2); QVERIFY(mouseArea1->hovered()); QVERIFY(!mouseArea1->pressed()); QVERIFY(!mouseArea2->hovered()); |