aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2015-04-21 10:48:29 +0200
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2015-04-21 10:41:45 +0000
commit220f2cddad824e2ab41f056a120d01151d3cf9b4 (patch)
tree44ba830c9c4601706ddd6bfa8eb4c23ae96a3957 /tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
parentcdf59809bd836ff418c6310ecce38c6e354640c3 (diff)
Stabilize QQuickWindow test
Various test functions use QTest::touch* and QTest::mouse* to synthesize touch/mouse events. The synthetization relies on the QWindow to be globally positioned (with regards to the window manager), as it performs a translation of the supplied window coordinates to global coordinates. If this happens too early in the window mapping process, we end up with wrong global coordinates, that in turn mean that when the event is mapped back to the window coordinates later, it has the wrong coordinates and not what the test expects. qWaitForWindowActive tries to accommodate this case by waiting until the positioning of the window is "complete", as opposed to qWaitForWindowExposed, which returns as soon as we have a rendering surface. The symptom in the CI system was that when this race condition hit, the y coordinate of events was off by 28 pixels on Ubuntu machines, which appears to be the height of the title or menu bar. Therefore this patch changes test functions that synthesize events to use qWaitForWindowActive. Change-Id: Ia8ecff517f4eefb15068ca1c342ef6666681c362 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
Diffstat (limited to 'tests/auto/quick/qquickwindow/tst_qquickwindow.cpp')
-rw-r--r--tests/auto/quick/qquickwindow/tst_qquickwindow.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
index 09ee431422..15dab335f0 100644
--- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
+++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
@@ -492,7 +492,7 @@ void tst_qquickwindow::touchEvent_basic()
window->resize(250, 250);
window->setPosition(100, 100);
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowActive(window));
TestTouchItem *bottomItem = new TestTouchItem(window->contentItem());
bottomItem->setObjectName("Bottom Item");
@@ -622,7 +622,7 @@ void tst_qquickwindow::touchEvent_propagation()
window->resize(250, 250);
window->setPosition(100, 100);
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowActive(window));
TestTouchItem *bottomItem = new TestTouchItem(window->contentItem());
bottomItem->setObjectName("Bottom Item");
@@ -755,7 +755,7 @@ void tst_qquickwindow::touchEvent_cancel()
window->resize(250, 250);
window->setPosition(100, 100);
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowActive(window));
TestTouchItem *item = new TestTouchItem(window->contentItem());
item->setPosition(QPointF(50, 50));
@@ -788,7 +788,7 @@ void tst_qquickwindow::touchEvent_reentrant()
window->resize(250, 250);
window->setPosition(100, 100);
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowActive(window));
TestTouchItem *item = new TestTouchItem(window->contentItem());
@@ -974,7 +974,7 @@ void tst_qquickwindow::mouseFiltering()
window->resize(250, 250);
window->setPosition(100, 100);
window->show();
- QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(QTest::qWaitForWindowActive(window));
TestTouchItem *bottomItem = new TestTouchItem(window->contentItem());
bottomItem->setObjectName("Bottom Item");
@@ -1420,7 +1420,7 @@ void tst_qquickwindow::cursor()
clippedItem.setParentItem(&clippingItem);
window.show();
- QVERIFY(QTest::qWaitForWindowExposed(&window));
+ QVERIFY(QTest::qWaitForWindowActive(&window));
// Position the cursor over the parent and child item and the clipped section of clippedItem.
QTest::mouseMove(&window, QPoint(100, 100));
@@ -1774,7 +1774,7 @@ void tst_qquickwindow::crashWhenHoverItemDeleted()
QQuickWindow *window = qobject_cast<QQuickWindow *>(component.create());
QVERIFY(window);
window->show();
- QTest::qWaitForWindowExposed(window);
+ QTest::qWaitForWindowActive(window);
// Simulate a move from the first rectangle to the second. Crash will happen in here
// Moving instantaneously from (0, 99) to (0, 102) does not cause the crash
@@ -1811,7 +1811,7 @@ void tst_qquickwindow::qobjectEventFilter_touch()
window.resize(250, 250);
window.setPosition(100, 100);
window.show();
- QVERIFY(QTest::qWaitForWindowExposed(&window));
+ QVERIFY(QTest::qWaitForWindowActive(&window));
TestTouchItem *item = new TestTouchItem(window.contentItem());
item->setSize(QSizeF(150, 150));
@@ -1864,7 +1864,7 @@ void tst_qquickwindow::qobjectEventFilter_mouse()
window.resize(250, 250);
window.setPosition(100, 100);
window.show();
- QVERIFY(QTest::qWaitForWindowExposed(&window));
+ QVERIFY(QTest::qWaitForWindowActive(&window));
TestTouchItem *item = new TestTouchItem(window.contentItem());
item->setSize(QSizeF(150, 150));
@@ -2166,7 +2166,7 @@ void tst_qquickwindow::testHoverChildMouseEventFilter()
window.resize(250, 250);
window.setPosition(100, 100);
window.show();
- QVERIFY(QTest::qWaitForWindowExposed(&window));
+ QVERIFY(QTest::qWaitForWindowActive(&window));
EventCounter *bottomItem = new EventCounter(window.contentItem());
bottomItem->setObjectName("Bottom Item");