diff options
author | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2016-07-08 10:57:25 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@qt.io> | 2016-07-08 20:27:25 +0000 |
commit | 6349a08f39c48c9786d82b7e6bd2249aa8bc8b80 (patch) | |
tree | 9c8085527d91a950f6de54c430ea66ebf9459ae9 /tests/auto/quick/qquickmousearea | |
parent | 9ae9d5500c733692f3eb858a9f2a4082dcb975dd (diff) |
Add explanation to tst_QQuickMouseArea::moveAndReleaseWithoutPress
The test makes sure that no events are delivered after the initial press
is released. In this context QTRY_* makes little sense, since we are
confirming that the defaults have not changed.
Thus rather spin the event loop 11 times and hope that if we would
accidentally deliver events that we shouldn't, it will be caught in that
time.
Change-Id: Iadeed07a81978aa6679e5513c1fe0aebcaeeb997
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'tests/auto/quick/qquickmousearea')
-rw-r--r-- | tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp index 46ccb8f80c..9c627ad69c 100644 --- a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp +++ b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp @@ -1740,11 +1740,17 @@ void tst_QQuickMouseArea::moveAndReleaseWithoutPress() QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(100,100)); + // the press was not accepted, make sure there is no move or release event QTest::mouseMove(&window, QPoint(110,110), 50); - QTRY_COMPARE(root->property("hadMove").toBool(), false); + + // use qwait here because we want to make sure an event does NOT happen + // the test fails if the default state changes, while it shouldn't + QTest::qWait(100); + QCOMPARE(root->property("hadMove").toBool(), false); QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(110,110)); - QTRY_COMPARE(root->property("hadRelease").toBool(), false); + QTest::qWait(100); + QCOMPARE(root->property("hadRelease").toBool(), false); } void tst_QQuickMouseArea::nestedStopAtBounds_data() |