diff options
Diffstat (limited to 'tests/auto/quick')
7 files changed, 90 insertions, 37 deletions
diff --git a/tests/auto/quick/pointerhandlers/qquickhoverhandler/data/windowCursorShape.qml b/tests/auto/quick/pointerhandlers/qquickhoverhandler/data/windowCursorShape.qml new file mode 100644 index 0000000000..b5c1f3d2ef --- /dev/null +++ b/tests/auto/quick/pointerhandlers/qquickhoverhandler/data/windowCursorShape.qml @@ -0,0 +1,13 @@ +import QtQuick 2.15 +import QtQuick.Window 2.15 + +Window { + width: 320 + height: 240 + visible: true + color: hh.hovered ? "lightsteelblue" : "beige" + HoverHandler { + id: hh + cursorShape: Qt.OpenHandCursor + } +} diff --git a/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp b/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp index 11a5393390..c3429456ae 100644 --- a/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp +++ b/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp @@ -62,6 +62,7 @@ private slots: void hoverHandlerAndUnderlyingMouseArea(); void movingItemWithHoverHandler(); void margin(); + void window(); private: void createView(QScopedPointer<QQuickView> &window, const char *fileName); @@ -363,6 +364,28 @@ void tst_HoverHandler::margin() // QTBUG-85303 #endif } +void tst_HoverHandler::window() // QTBUG-98717 +{ + QQmlEngine engine; + QQmlComponent component(&engine); + component.loadUrl(testFileUrl("windowCursorShape.qml")); + QScopedPointer<QQuickWindow> window(qobject_cast<QQuickWindow *>(component.create())); + QVERIFY(!window.isNull()); + window->show(); + QVERIFY(QTest::qWaitForWindowExposed(window.data())); +#if QT_CONFIG(cursor) + if (isPlatformWayland()) + QSKIP("Wayland: QCursor::setPos() doesn't work."); +#ifdef Q_OS_MACOS + QSKIP("macOS: QCursor::setPos() doesn't work (QTBUG-76312)."); +#endif + auto cursorPos = window->mapToGlobal(QPoint(100, 100)); + qCDebug(lcPointerTests) << "in window @" << window->position() << "setting cursor pos" << cursorPos; + QCursor::setPos(cursorPos); + QTRY_COMPARE(window->cursor().shape(), Qt::OpenHandCursor); +#endif +} + QTEST_MAIN(tst_HoverHandler) #include "tst_qquickhoverhandler.moc" diff --git a/tests/auto/quick/qquickanimations/data/cleanupWhenRenderThreadStops.qml b/tests/auto/quick/qquickanimations/data/cleanupWhenRenderThreadStops.qml new file mode 100644 index 0000000000..4cfb59aeab --- /dev/null +++ b/tests/auto/quick/qquickanimations/data/cleanupWhenRenderThreadStops.qml @@ -0,0 +1,32 @@ +//main.qml + +import QtQuick 2.12 +import QtQuick.Window 2.12 + +Item { + id: root + width: 640 + height: 480 + visible: true + property bool running : false + + Rectangle { + id: rect + anchors.fill: parent + color: "red" + + Component.onCompleted: { + anim.start() + running = true + } + } + + OpacityAnimator { + id: anim + + target: rect + from: 1 + to: 0 + duration: 20000 + } +} diff --git a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp index 9b5710bad4..95af4a0560 100644 --- a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp +++ b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp @@ -116,6 +116,7 @@ private slots: void fastFlickingBug(); void opacityAnimationFromZero(); void alwaysRunToEndInSequentialAnimationBug(); + void cleanupWhenRenderThreadStops(); }; #define QTIMED_COMPARE(lhs, rhs) do { \ @@ -1998,6 +1999,19 @@ void tst_qquickanimations::alwaysRunToEndInSequentialAnimationBug() QCOMPARE(whiteRect->property("opacity").value<qreal>(),1.0); } +void tst_qquickanimations::cleanupWhenRenderThreadStops() +{ + QQuickView view(QUrl::fromLocalFile("data/cleanupWhenRenderThreadStops.qml")); + view.show(); + view.setPersistentOpenGLContext(false); + view.setPersistentSceneGraph(false); + QVERIFY(QTest::qWaitForWindowExposed(&view)); + QTest::qWait(50); + view.hide(); + view.show(); + QVERIFY(QTest::qWaitForWindowExposed(&view)); +} + QTEST_MAIN(tst_qquickanimations) #include "tst_qquickanimations.moc" diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp index f3659290eb..9fa51da6f8 100644 --- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp +++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp @@ -870,6 +870,7 @@ void tst_qquickflickable::wheel() QVERIFY(flick != nullptr); QQuickFlickablePrivate *fp = QQuickFlickablePrivate::get(flick); QSignalSpy moveEndSpy(flick, SIGNAL(movementEnded())); + quint64 timestamp = 10; // test a vertical flick { @@ -877,6 +878,7 @@ void tst_qquickflickable::wheel() QWheelEvent event(pos, window->mapToGlobal(pos), QPoint(), QPoint(0,-120), Qt::NoButton, Qt::NoModifier, Qt::NoScrollPhase, false); event.setAccepted(false); + event.setTimestamp(timestamp); QGuiApplication::sendEvent(window.data(), &event); } @@ -887,6 +889,7 @@ void tst_qquickflickable::wheel() QCOMPARE(fp->velocityTimeline.isActive(), false); QCOMPARE(fp->timeline.isActive(), false); QTest::qWait(50); // make sure that onContentYChanged won't sneak in again + timestamp += 50; QCOMPARE(flick->property("movementsAfterEnd").value<int>(), 0); // QTBUG-55886 // get ready to test horizontal flick @@ -900,8 +903,8 @@ void tst_qquickflickable::wheel() QPoint pos(200, 200); QWheelEvent event(pos, window->mapToGlobal(pos), QPoint(), QPoint(-120,0), Qt::NoButton, Qt::NoModifier, Qt::NoScrollPhase, false); - event.setAccepted(false); + event.setTimestamp(timestamp); QGuiApplication::sendEvent(window.data(), &event); } @@ -926,11 +929,13 @@ void tst_qquickflickable::trackpad() QVERIFY(flick != nullptr); QSignalSpy moveEndSpy(flick, SIGNAL(movementEnded())); QPoint pos(200, 200); + quint64 timestamp = 10; { QWheelEvent event(pos, window->mapToGlobal(pos), QPoint(0,-100), QPoint(0,-120), Qt::NoButton, Qt::NoModifier, Qt::ScrollBegin, false); event.setAccepted(false); + event.setTimestamp(timestamp++); QGuiApplication::sendEvent(window.data(), &event); } @@ -944,6 +949,7 @@ void tst_qquickflickable::trackpad() QWheelEvent event(pos, window->mapToGlobal(pos), QPoint(-100,0), QPoint(-120,0), Qt::NoButton, Qt::NoModifier, Qt::ScrollUpdate, false); event.setAccepted(false); + event.setTimestamp(timestamp++); QGuiApplication::sendEvent(window.data(), &event); } @@ -954,6 +960,7 @@ void tst_qquickflickable::trackpad() QWheelEvent event(pos, window->mapToGlobal(pos), QPoint(0,0), QPoint(0,0), Qt::NoButton, Qt::NoModifier, Qt::ScrollEnd, false); event.setAccepted(false); + event.setTimestamp(timestamp++); QGuiApplication::sendEvent(window.data(), &event); } diff --git a/tests/auto/quick/qquicklistview/data/qtbug86744.qml b/tests/auto/quick/qquicklistview/data/qtbug86744.qml deleted file mode 100644 index 6dc82d57eb..0000000000 --- a/tests/auto/quick/qquicklistview/data/qtbug86744.qml +++ /dev/null @@ -1,21 +0,0 @@ -import QtQuick 2.15 -import QtQml.Models 2.15 - -Item { - height: 200 - width: 100 - DelegateModel { - id: dm - model: 2 - delegate: Item { - width: 100; height: 20 - property bool isCurrent: ListView.isCurrentItem - } - } - ListView { - objectName: "listView" - model: dm - currentIndex: 1 - anchors.fill: parent - } -} diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index df329f8318..d3deb513d0 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -301,7 +301,6 @@ private slots: void animatedDelegate(); void dragDelegateWithMouseArea(); void dragDelegateWithMouseArea_data(); - void isCurrentItem_DelegateModel(); private: template <class T> void items(const QUrl &source); @@ -10201,20 +10200,6 @@ void tst_QQuickListView::dragDelegateWithMouseArea_data() } } -void tst_QQuickListView::isCurrentItem_DelegateModel() -{ - QScopedPointer<QQuickView> window(createView()); - window->setSource(testFileUrl("qtbug86744.qml")); - window->resize(640, 480); - window->show(); - QVERIFY(QTest::qWaitForWindowExposed(window.data())); - - QQuickListView* listView = window->rootObject()->findChild<QQuickListView*>("listView"); - QVERIFY(listView); - QVariant value = listView->itemAtIndex(1)->property("isCurrent"); - QVERIFY(value.toBool() == true); -} - QTEST_MAIN(tst_QQuickListView) #include "tst_qquicklistview.moc" |