diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-02-14 01:00:08 +0100 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-02-14 01:00:09 +0100 |
commit | e6199a8357cb9a97a3de0e86af387ddbe15a18ea (patch) | |
tree | c33fdae61742736ad47a33ddc2458aed07d53b1b /tests/auto/quick | |
parent | 57604562db870f7b05d4349761d73e054dbe04c6 (diff) | |
parent | 68d0377736a541fa29d1aaba6b7aa4a4cf8781ef (diff) |
Merge remote-tracking branch 'origin/5.12' into 5.13
Change-Id: I2842f4a8096c4555e29f08e65b88b77b841441cb
Diffstat (limited to 'tests/auto/quick')
-rw-r--r-- | tests/auto/quick/pointerhandlers/flickableinterop/tst_flickableinterop.cpp | 2 | ||||
-rw-r--r-- | tests/auto/quick/pointerhandlers/qquickpointerhandler/tst_qquickpointerhandler.cpp | 16 | ||||
-rw-r--r-- | tests/auto/quick/qquickanimations/BLACKLIST | 6 | ||||
-rw-r--r-- | tests/auto/quick/qquickbehaviors/BLACKLIST | 2 | ||||
-rw-r--r-- | tests/auto/quick/qquickflickable/BLACKLIST | 7 | ||||
-rw-r--r-- | tests/auto/quick/qquickgridview/BLACKLIST | 2 | ||||
-rw-r--r-- | tests/auto/quick/qquickimage/BLACKLIST | 4 | ||||
-rw-r--r-- | tests/auto/quick/qquicklistview/BLACKLIST | 2 | ||||
-rw-r--r-- | tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp | 109 | ||||
-rw-r--r-- | tests/auto/quick/qquicktextinput/BLACKLIST | 3 | ||||
-rw-r--r-- | tests/auto/quick/shared/viewtestutil.cpp | 27 | ||||
-rw-r--r-- | tests/auto/quick/shared/viewtestutil.h | 4 |
12 files changed, 84 insertions, 100 deletions
diff --git a/tests/auto/quick/pointerhandlers/flickableinterop/tst_flickableinterop.cpp b/tests/auto/quick/pointerhandlers/flickableinterop/tst_flickableinterop.cpp index cf2ac4a830..f4ed051e1f 100644 --- a/tests/auto/quick/pointerhandlers/flickableinterop/tst_flickableinterop.cpp +++ b/tests/auto/quick/pointerhandlers/flickableinterop/tst_flickableinterop.cpp @@ -741,7 +741,7 @@ void tst_FlickableInterop::touchAndDragHandlerOnFlickable() QQuickTouchUtils::flush(window); } if (!(buttonDragHandler && !pressDelay)) - QVERIFY(flickable->contentY() >= dragThreshold); + QTRY_VERIFY(flickable->contentY() >= dragThreshold); if (buttonTapHandler) QCOMPARE(buttonTapHandler->isPressed(), false); touchSeq.release(1, p1, window).commit(); diff --git a/tests/auto/quick/pointerhandlers/qquickpointerhandler/tst_qquickpointerhandler.cpp b/tests/auto/quick/pointerhandlers/qquickpointerhandler/tst_qquickpointerhandler.cpp index feb356a7d5..2b6482465c 100644 --- a/tests/auto/quick/pointerhandlers/qquickpointerhandler/tst_qquickpointerhandler.cpp +++ b/tests/auto/quick/pointerhandlers/qquickpointerhandler/tst_qquickpointerhandler.cpp @@ -188,7 +188,10 @@ public: QQuickPointerHandler::handlePointerEventImpl(event); if (!enabled()) return; - ++eventCount; + if (event->isPressEvent()) + ++pressEventCount; + if (event->isReleaseEvent()) + ++releaseEventCount; EventItem *item = qmlobject_cast<EventItem *>(target()); if (!item) { event->point(0)->setGrabberPointerHandler(this); @@ -218,7 +221,8 @@ public: static_cast<Qt::TouchPointState>(point->state()), stateChange, eventPos(point), point->scenePosition())); } - int eventCount = 0; + int pressEventCount = 0; + int releaseEventCount = 0; }; class tst_PointerHandlers : public QQmlDataTest @@ -646,9 +650,9 @@ void tst_PointerHandlers::handlerInWindow() QPoint p1(20, 20); QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, p1); - QTRY_COMPARE(handler->eventCount, 1); + QTRY_COMPARE(handler->pressEventCount, 1); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, p1); - QTRY_COMPARE(handler->eventCount, 2); + QTRY_COMPARE(handler->releaseEventCount, 1); } void tst_PointerHandlers::dynamicCreationInWindow() @@ -670,9 +674,9 @@ void tst_PointerHandlers::dynamicCreationInWindow() QPoint p1(20, 20); QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, p1); - QTRY_COMPARE(handler->eventCount, 1); + QTRY_COMPARE(handler->pressEventCount, 1); QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, p1); - QTRY_COMPARE(handler->eventCount, 2); + QTRY_COMPARE(handler->releaseEventCount, 1); } QTEST_MAIN(tst_PointerHandlers) diff --git a/tests/auto/quick/qquickanimations/BLACKLIST b/tests/auto/quick/qquickanimations/BLACKLIST deleted file mode 100644 index e011db46b7..0000000000 --- a/tests/auto/quick/qquickanimations/BLACKLIST +++ /dev/null @@ -1,6 +0,0 @@ -# QTBUG-45466 QTBUG-29062 -[simpleProperty] -osx-10.9 developer-build -[simplePath] -windows gcc developer-build - diff --git a/tests/auto/quick/qquickbehaviors/BLACKLIST b/tests/auto/quick/qquickbehaviors/BLACKLIST deleted file mode 100644 index 9be4da176d..0000000000 --- a/tests/auto/quick/qquickbehaviors/BLACKLIST +++ /dev/null @@ -1,2 +0,0 @@ -[currentValue] -windows diff --git a/tests/auto/quick/qquickflickable/BLACKLIST b/tests/auto/quick/qquickflickable/BLACKLIST deleted file mode 100644 index cc91754e68..0000000000 --- a/tests/auto/quick/qquickflickable/BLACKLIST +++ /dev/null @@ -1,7 +0,0 @@ -# QTBUG-26696 -[rebound] -osx -[stopAtBounds] -windows developer-build -[returnToBounds] -osx diff --git a/tests/auto/quick/qquickgridview/BLACKLIST b/tests/auto/quick/qquickgridview/BLACKLIST deleted file mode 100644 index 9eb9940aa5..0000000000 --- a/tests/auto/quick/qquickgridview/BLACKLIST +++ /dev/null @@ -1,2 +0,0 @@ -[snapOneRow:horizontal, right to left] -windows diff --git a/tests/auto/quick/qquickimage/BLACKLIST b/tests/auto/quick/qquickimage/BLACKLIST deleted file mode 100644 index d15fae1b67..0000000000 --- a/tests/auto/quick/qquickimage/BLACKLIST +++ /dev/null @@ -1,4 +0,0 @@ -# QTBUG-65978 -[nullPixmapPaint] -b2qt - diff --git a/tests/auto/quick/qquicklistview/BLACKLIST b/tests/auto/quick/qquicklistview/BLACKLIST index 15aea4be19..e22d52294f 100644 --- a/tests/auto/quick/qquicklistview/BLACKLIST +++ b/tests/auto/quick/qquicklistview/BLACKLIST @@ -1,5 +1,3 @@ -[QTBUG_38209] -* [enforceRange_withoutHighlight] osx #QTBUG-53863 diff --git a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp index 558ca2e759..52d1458a53 100644 --- a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp +++ b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp @@ -43,31 +43,6 @@ #include <QtGui/QScreen> #include <qpa/qwindowsysteminterface.h> -// Initialize view, set Url, center in available geometry, move mouse away if desired -static bool initView(QQuickView &v, const QUrl &url, bool moveMouseOut, QByteArray *errorMessage) -{ - v.setBaseSize(QSize(240,320)); - v.setSource(url); - while (v.status() == QQuickView::Loading) - QTest::qWait(10); - if (v.status() != QQuickView::Ready) { - foreach (const QQmlError &e, v.errors()) - errorMessage->append(e.toString().toLocal8Bit() + '\n'); - return false; - } - const QRect screenGeometry = v.screen()->availableGeometry(); - const QSize size = v.size(); - const QPoint offset = QPoint(size.width() / 2, size.height() / 2); - v.setFramePosition(screenGeometry.center() - offset); -#if QT_CONFIG(cursor) // Get the cursor out of the way. - if (moveMouseOut) - QCursor::setPos(v.geometry().topRight() + QPoint(100, 100)); -#else - Q_UNUSED(moveMouseOut) -#endif - return true; -} - class CircleMask : public QObject { Q_OBJECT @@ -235,7 +210,7 @@ void tst_QQuickMouseArea::dragProperties() QQuickView window; QByteArray errorMessage; - QVERIFY2(initView(window, testFileUrl("dragproperties.qml"), true, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(window, testFileUrl("dragproperties.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); QVERIFY(window.rootObject() != nullptr); @@ -333,7 +308,7 @@ void tst_QQuickMouseArea::resetDrag() QQuickView window; QByteArray errorMessage; window.rootContext()->setContextProperty("haveTarget", QVariant(true)); - QVERIFY2(initView(window, testFileUrl("dragreset.qml"), true, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(window, testFileUrl("dragreset.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); QVERIFY(window.rootObject() != nullptr); @@ -363,7 +338,7 @@ void tst_QQuickMouseArea::dragging() QQuickView window; QByteArray errorMessage; - QVERIFY2(initView(window, testFileUrl("dragging.qml"), true, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(window, testFileUrl("dragging.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); @@ -428,7 +403,7 @@ void tst_QQuickMouseArea::dragSmoothed() { QQuickView window; QByteArray errorMessage; - QVERIFY2(initView(window, testFileUrl("dragging.qml"), true, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(window, testFileUrl("dragging.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); @@ -482,7 +457,7 @@ void tst_QQuickMouseArea::dragThreshold() QQuickView window; QByteArray errorMessage; - QVERIFY2(initView(window, testFileUrl("dragging.qml"), true, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(window, testFileUrl("dragging.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); @@ -540,7 +515,7 @@ void tst_QQuickMouseArea::invalidDrag() QQuickView window; QByteArray errorMessage; - QVERIFY2(initView(window, testFileUrl("dragging.qml"), true, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(window, testFileUrl("dragging.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); QVERIFY(window.rootObject() != nullptr); @@ -589,7 +564,7 @@ void tst_QQuickMouseArea::cancelDragging() { QQuickView window; QByteArray errorMessage; - QVERIFY2(initView(window, testFileUrl("dragging.qml"), true, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(window, testFileUrl("dragging.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); @@ -644,7 +619,7 @@ void tst_QQuickMouseArea::availableDistanceLessThanDragThreshold() { QQuickView view; QByteArray errorMessage; - QVERIFY2(initView(view, testFileUrl("availableDistanceLessThanDragThreshold.qml"), true, &errorMessage), + QVERIFY2(QQuickTest::initView(view, testFileUrl("availableDistanceLessThanDragThreshold.qml"), true, &errorMessage), errorMessage.constData()); view.show(); view.requestActivate(); @@ -672,7 +647,7 @@ void tst_QQuickMouseArea::setDragOnPressed() { QQuickView window; QByteArray errorMessage; - QVERIFY2(initView(window, testFileUrl("setDragOnPressed.qml"), true, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(window, testFileUrl("setDragOnPressed.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); QVERIFY(window.rootObject() != nullptr); @@ -716,7 +691,7 @@ void tst_QQuickMouseArea::updateMouseAreaPosOnClick() { QQuickView window; QByteArray errorMessage; - QVERIFY2(initView(window, testFileUrl("updateMousePosOnClick.qml"), true, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(window, testFileUrl("updateMousePosOnClick.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); QVERIFY(window.rootObject() != nullptr); @@ -744,7 +719,7 @@ void tst_QQuickMouseArea::updateMouseAreaPosOnResize() { QQuickView window; QByteArray errorMessage; - QVERIFY2(initView(window, testFileUrl("updateMousePosOnResize.qml"), true, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(window, testFileUrl("updateMousePosOnResize.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); QVERIFY(window.rootObject() != nullptr); @@ -780,7 +755,7 @@ void tst_QQuickMouseArea::noOnClickedWithPressAndHold() // We handle onPressAndHold, therefore no onClicked QQuickView window; QByteArray errorMessage; - QVERIFY2(initView(window, testFileUrl("clickandhold.qml"), true, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(window, testFileUrl("clickandhold.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); QVERIFY(window.rootObject() != nullptr); @@ -812,7 +787,7 @@ void tst_QQuickMouseArea::noOnClickedWithPressAndHold() // We do not handle onPressAndHold, therefore we get onClicked QQuickView window; QByteArray errorMessage; - QVERIFY2(initView(window, testFileUrl("noclickandhold.qml"), true, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(window, testFileUrl("noclickandhold.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); QVERIFY(window.rootObject() != nullptr); @@ -835,7 +810,7 @@ void tst_QQuickMouseArea::onMousePressRejected() { QQuickView window; QByteArray errorMessage; - QVERIFY2(initView(window, testFileUrl("rejectEvent.qml"), true, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(window, testFileUrl("rejectEvent.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); QVERIFY(window.rootObject() != nullptr); @@ -882,7 +857,7 @@ void tst_QQuickMouseArea::pressedCanceledOnWindowDeactivate() QQuickView window; QByteArray errorMessage; - QVERIFY2(initView(window, testFileUrl("pressedCanceled.qml"), true, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(window, testFileUrl("pressedCanceled.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); QVERIFY(window.rootObject() != nullptr); @@ -955,7 +930,7 @@ void tst_QQuickMouseArea::doubleClick() QQuickView window; QByteArray errorMessage; - QVERIFY2(initView(window, testFileUrl("doubleclick.qml"), true, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(window, testFileUrl("doubleclick.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); QVERIFY(window.rootObject() != nullptr); @@ -992,7 +967,7 @@ void tst_QQuickMouseArea::clickTwice() QQuickView window; QByteArray errorMessage; - QVERIFY2(initView(window, testFileUrl("clicktwice.qml"), true, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(window, testFileUrl("clicktwice.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); QVERIFY(window.rootObject() != nullptr); @@ -1028,7 +1003,7 @@ void tst_QQuickMouseArea::invalidClick() QQuickView window; QByteArray errorMessage; - QVERIFY2(initView(window, testFileUrl("doubleclick.qml"), true, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(window, testFileUrl("doubleclick.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); QVERIFY(window.rootObject() != nullptr); @@ -1061,7 +1036,7 @@ void tst_QQuickMouseArea::pressedOrdering() { QQuickView window; QByteArray errorMessage; - QVERIFY2(initView(window, testFileUrl("pressedOrdering.qml"), true, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(window, testFileUrl("pressedOrdering.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); QVERIFY(window.rootObject() != nullptr); @@ -1087,7 +1062,7 @@ void tst_QQuickMouseArea::preventStealing() { QQuickView window; QByteArray errorMessage; - QVERIFY2(initView(window, testFileUrl("preventstealing.qml"), true, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(window, testFileUrl("preventstealing.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); QVERIFY(window.rootObject() != nullptr); @@ -1161,7 +1136,7 @@ void tst_QQuickMouseArea::clickThrough() //With no handlers defined click, doubleClick and PressAndHold should propagate to those with handlers QScopedPointer<QQuickView> window(new QQuickView); QByteArray errorMessage; - QVERIFY2(initView(*window.data(), testFileUrl("clickThrough.qml"), true, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(*window.data(), testFileUrl("clickThrough.qml"), true, &errorMessage), errorMessage.constData()); window->show(); QVERIFY(QTest::qWaitForWindowExposed(window.data())); QVERIFY(window->rootObject() != nullptr); @@ -1195,7 +1170,7 @@ void tst_QQuickMouseArea::clickThrough() window.reset(new QQuickView); //With handlers defined click, doubleClick and PressAndHold should propagate only when explicitly ignored - QVERIFY2(initView(*window.data(), testFileUrl("clickThrough2.qml"), true, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(*window.data(), testFileUrl("clickThrough2.qml"), true, &errorMessage), errorMessage.constData()); window->show(); QVERIFY(QTest::qWaitForWindowExposed(window.data())); QVERIFY(window->rootObject() != nullptr); @@ -1269,7 +1244,7 @@ void tst_QQuickMouseArea::clickThrough() window.reset(new QQuickView); //QTBUG-34368 - Shouldn't propagate to disabled mouse areas - QVERIFY2(initView(*window.data(), testFileUrl("qtbug34368.qml"), true, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(*window.data(), testFileUrl("qtbug34368.qml"), true, &errorMessage), errorMessage.constData()); window->show(); QVERIFY(QTest::qWaitForWindowExposed(window.data())); QVERIFY(window->rootObject() != nullptr); @@ -1291,7 +1266,7 @@ void tst_QQuickMouseArea::clickThrough() window.reset(new QQuickView); //QTBUG-49100 - QVERIFY2(initView(*window.data(), testFileUrl("qtbug49100.qml"), true, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(*window.data(), testFileUrl("qtbug49100.qml"), true, &errorMessage), errorMessage.constData()); window->show(); QVERIFY(QTest::qWaitForWindowExposed(window.data())); QVERIFY(window->rootObject() != nullptr); @@ -1306,7 +1281,7 @@ void tst_QQuickMouseArea::hoverPosition() { QQuickView window; QByteArray errorMessage; - QVERIFY2(initView(window, testFileUrl("hoverPosition.qml"), true, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(window, testFileUrl("hoverPosition.qml"), true, &errorMessage), errorMessage.constData()); QQuickItem *root = window.rootObject(); QVERIFY(root != nullptr); @@ -1325,7 +1300,7 @@ void tst_QQuickMouseArea::hoverPropagation() //QTBUG-18175, to behave like GV did. QQuickView window; QByteArray errorMessage; - QVERIFY2(initView(window, testFileUrl("hoverPropagation.qml"), true, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(window, testFileUrl("hoverPropagation.qml"), true, &errorMessage), errorMessage.constData()); QQuickItem *root = window.rootObject(); QVERIFY(root != nullptr); @@ -1352,7 +1327,7 @@ void tst_QQuickMouseArea::hoverVisible() QQuickView window; QByteArray errorMessage; - QVERIFY2(initView(window, testFileUrl("hoverVisible.qml"), true, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(window, testFileUrl("hoverVisible.qml"), true, &errorMessage), errorMessage.constData()); QQuickItem *root = window.rootObject(); QVERIFY(root != nullptr); @@ -1380,7 +1355,7 @@ void tst_QQuickMouseArea::hoverAfterPress() { QQuickView window; QByteArray errorMessage; - QVERIFY2(initView(window, testFileUrl("hoverAfterPress.qml"), true, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(window, testFileUrl("hoverAfterPress.qml"), true, &errorMessage), errorMessage.constData()); QQuickItem *root = window.rootObject(); QVERIFY(root != nullptr); @@ -1406,7 +1381,7 @@ void tst_QQuickMouseArea::subtreeHoverEnabled() { QQuickView window; QByteArray errorMessage; - QVERIFY2(initView(window, testFileUrl("qtbug54019.qml"), true, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(window, testFileUrl("qtbug54019.qml"), true, &errorMessage), errorMessage.constData()); QQuickItem *root = window.rootObject(); QVERIFY(root != nullptr); @@ -1426,7 +1401,7 @@ void tst_QQuickMouseArea::disableAfterPress() { QQuickView window; QByteArray errorMessage; - QVERIFY2(initView(window, testFileUrl("dragging.qml"), true, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(window, testFileUrl("dragging.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); QVERIFY(window.rootObject() != nullptr); @@ -1529,7 +1504,7 @@ void tst_QQuickMouseArea::onWheel() { QQuickView window; QByteArray errorMessage; - QVERIFY2(initView(window, testFileUrl("wheel.qml"), true, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(window, testFileUrl("wheel.qml"), true, &errorMessage), errorMessage.constData()); QQuickItem *root = window.rootObject(); QVERIFY(root != nullptr); @@ -1573,7 +1548,7 @@ void tst_QQuickMouseArea::transformedMouseArea() QQuickView window; QByteArray errorMessage; - QVERIFY2(initView(window, testFileUrl("transformedMouseArea.qml"), true, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(window, testFileUrl("transformedMouseArea.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); QVERIFY(window.rootObject() != nullptr); @@ -1681,7 +1656,7 @@ void tst_QQuickMouseArea::pressedMultipleButtons() QQuickView view; QByteArray errorMessage; - QVERIFY2(initView(view, testFileUrl("simple.qml"), true, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(view, testFileUrl("simple.qml"), true, &errorMessage), errorMessage.constData()); view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); QVERIFY(view.rootObject() != nullptr); @@ -1712,7 +1687,7 @@ void tst_QQuickMouseArea::changeAxis() { QQuickView view; QByteArray errorMessage; - QVERIFY2(initView(view, testFileUrl("changeAxis.qml"), true, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(view, testFileUrl("changeAxis.qml"), true, &errorMessage), errorMessage.constData()); view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); QTRY_VERIFY(view.rootObject() != nullptr); @@ -1805,7 +1780,7 @@ void tst_QQuickMouseArea::moveAndReleaseWithoutPress() { QQuickView window; QByteArray errorMessage; - QVERIFY2(initView(window, testFileUrl("moveAndReleaseWithoutPress.qml"), true, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(window, testFileUrl("moveAndReleaseWithoutPress.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); @@ -1845,7 +1820,7 @@ void tst_QQuickMouseArea::nestedStopAtBounds() QQuickView view; QByteArray errorMessage; - QVERIFY2(initView(view, testFileUrl("nestedStopAtBounds.qml"), true, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(view, testFileUrl("nestedStopAtBounds.qml"), true, &errorMessage), errorMessage.constData()); view.show(); view.requestActivate(); QVERIFY(QTest::qWaitForWindowExposed(&view)); @@ -1898,7 +1873,7 @@ void tst_QQuickMouseArea::nestedFlickableStopAtBounds() { QQuickView view; QByteArray errorMessage; - QVERIFY2(initView(view, testFileUrl("nestedFlickableStopAtBounds.qml"), false, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(view, testFileUrl("nestedFlickableStopAtBounds.qml"), false, &errorMessage), errorMessage.constData()); view.show(); view.requestActivate(); QVERIFY(QTest::qWaitForWindowExposed(&view)); @@ -2000,7 +1975,7 @@ void tst_QQuickMouseArea::containsPress() QQuickView window; QByteArray errorMessage; - QVERIFY2(initView(window, testFileUrl("containsPress.qml"), true, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(window, testFileUrl("containsPress.qml"), true, &errorMessage), errorMessage.constData()); window.show(); window.requestActivate(); QVERIFY(QTest::qWaitForWindowExposed(&window)); @@ -2053,7 +2028,7 @@ void tst_QQuickMouseArea::ignoreBySource() { QQuickView window; QByteArray errorMessage; - QVERIFY2(initView(window, testFileUrl("ignoreBySource.qml"), true, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(window, testFileUrl("ignoreBySource.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); QVERIFY(window.rootObject()); @@ -2194,7 +2169,7 @@ void tst_QQuickMouseArea::pressAndHold() QQuickView window; QByteArray errorMessage; - QVERIFY2(initView(window, testFileUrl("pressAndHold.qml"), true, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(window, testFileUrl("pressAndHold.qml"), true, &errorMessage), errorMessage.constData()); window.show(); window.requestActivate(); QVERIFY(QTest::qWaitForWindowExposed(&window)); @@ -2239,7 +2214,7 @@ void tst_QQuickMouseArea::pressOneAndTapAnother() QQuickView window; QByteArray errorMessage; - QVERIFY2(initView(window, testFileUrl("twoMouseAreas.qml"), true, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(window, testFileUrl("twoMouseAreas.qml"), true, &errorMessage), errorMessage.constData()); window.show(); window.requestActivate(); QVERIFY(QTest::qWaitForWindowExposed(&window)); @@ -2292,7 +2267,7 @@ void tst_QQuickMouseArea::mask() { QQuickView window; QByteArray errorMessage; - QVERIFY2(initView(window, testFileUrl("mask.qml"), true, &errorMessage), errorMessage.constData()); + QVERIFY2(QQuickTest::initView(window, testFileUrl("mask.qml"), true, &errorMessage), errorMessage.constData()); window.show(); window.requestActivate(); QVERIFY(QTest::qWaitForWindowExposed(&window)); diff --git a/tests/auto/quick/qquicktextinput/BLACKLIST b/tests/auto/quick/qquicktextinput/BLACKLIST deleted file mode 100644 index e9f4f11c58..0000000000 --- a/tests/auto/quick/qquicktextinput/BLACKLIST +++ /dev/null @@ -1,3 +0,0 @@ -# QTBUG-41895 -[tripleClickSelectsAll] -windows diff --git a/tests/auto/quick/shared/viewtestutil.cpp b/tests/auto/quick/shared/viewtestutil.cpp index 3bfa23173e..12d54c4bbe 100644 --- a/tests/auto/quick/shared/viewtestutil.cpp +++ b/tests/auto/quick/shared/viewtestutil.cpp @@ -451,3 +451,30 @@ namespace QQuickTouchUtils { } } + +namespace QQuickTest { + // Initialize view, set Url, center in available geometry, move mouse away if desired + bool initView(QQuickView &v, const QUrl &url, bool moveMouseOut, QByteArray *errorMessage) + { + v.setBaseSize(QSize(240,320)); + v.setSource(url); + while (v.status() == QQuickView::Loading) + QTest::qWait(10); + if (v.status() != QQuickView::Ready) { + foreach (const QQmlError &e, v.errors()) + errorMessage->append(e.toString().toLocal8Bit() + '\n'); + return false; + } + const QRect screenGeometry = v.screen()->availableGeometry(); + const QSize size = v.size(); + const QPoint offset = QPoint(size.width() / 2, size.height() / 2); + v.setFramePosition(screenGeometry.center() - offset); + #if QT_CONFIG(cursor) // Get the cursor out of the way. + if (moveMouseOut) + QCursor::setPos(v.geometry().topRight() + QPoint(100, 100)); + #else + Q_UNUSED(moveMouseOut) + #endif + return true; + } +} diff --git a/tests/auto/quick/shared/viewtestutil.h b/tests/auto/quick/shared/viewtestutil.h index 04e1771ef8..3b57a29777 100644 --- a/tests/auto/quick/shared/viewtestutil.h +++ b/tests/auto/quick/shared/viewtestutil.h @@ -185,6 +185,10 @@ namespace QQuickTouchUtils { void flush(QQuickWindow *window); } +namespace QQuickTest { + bool initView(QQuickView &v, const QUrl &url, bool moveMouseOut, QByteArray *errorMessage); +} + Q_DECLARE_METATYPE(QQuickViewTestUtil::QaimModel*) Q_DECLARE_METATYPE(QQuickViewTestUtil::ListChange) Q_DECLARE_METATYPE(QList<QQuickViewTestUtil::ListChange>) |