aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp3
-rw-r--r--tests/auto/qml/qqmlecmascript/BLACKLIST2
-rw-r--r--tests/auto/qml/qqmlecmascript/data/functionAsDefaultArgument.qml8
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp10
-rw-r--r--tests/auto/qml/qqmllanguage/data/ambiguousBinding/TestCase.qml6
-rw-r--r--tests/auto/qml/qqmllanguage/data/ambiguousBinding/ambiguousContainingType.qml3
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp16
-rw-r--r--tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp15
-rw-r--r--tests/auto/qml/qv4assembler/tst_qv4assembler.cpp3
-rw-r--r--tests/auto/qmltest/events/tst_wheel.qml2
-rw-r--r--tests/auto/quick/pointerhandlers/qquickhoverhandler/data/windowCursorShape.qml13
-rw-r--r--tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp23
-rw-r--r--tests/auto/quick/qquickanimations/data/cleanupWhenRenderThreadStops.qml32
-rw-r--r--tests/auto/quick/qquickanimations/tst_qquickanimations.cpp14
-rw-r--r--tests/auto/quick/qquickflickable/tst_qquickflickable.cpp9
-rw-r--r--tests/auto/quick/qquicklistview/data/qtbug86744.qml21
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp15
17 files changed, 153 insertions, 42 deletions
diff --git a/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp b/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp
index 2610402455..b3e6ffd79e 100644
--- a/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp
+++ b/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp
@@ -358,9 +358,8 @@ void tst_qqmlbinding::delayed()
// doesn't update immediately
QCOMPARE(item->property("changeCount").toInt(), 1);
- QCoreApplication::processEvents();
// only updates once (non-delayed would update twice)
- QCOMPARE(item->property("changeCount").toInt(), 2);
+ QTRY_COMPARE(item->property("changeCount").toInt(), 2);
}
void tst_qqmlbinding::bindingOverwriting()
diff --git a/tests/auto/qml/qqmlecmascript/BLACKLIST b/tests/auto/qml/qqmlecmascript/BLACKLIST
new file mode 100644
index 0000000000..bd25566eef
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/BLACKLIST
@@ -0,0 +1,2 @@
+[gcCrashRegressionTest]
+macos arm
diff --git a/tests/auto/qml/qqmlecmascript/data/functionAsDefaultArgument.qml b/tests/auto/qml/qqmlecmascript/data/functionAsDefaultArgument.qml
new file mode 100644
index 0000000000..9f576d1af8
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/functionAsDefaultArgument.qml
@@ -0,0 +1,8 @@
+import QtQml 2.15
+
+QtObject {
+ id: root
+
+ function f(inner=function(){ root.objectName = "didRun" } ){ inner() }
+ Component.onCompleted: f()
+}
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index 7da1b2c500..696566d987 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -387,6 +387,7 @@ private slots:
void proxyIteration();
void proxyHandlerTraps();
void gcCrashRegressionTest();
+ void functionAsDefaultArgument();
private:
// static void propertyVarWeakRefCallback(v8::Persistent<v8::Value> object, void* parameter);
@@ -9371,6 +9372,15 @@ void tst_qqmlecmascript::proxyHandlerTraps()
QVERIFY(value.isString() && value.toString() == QStringLiteral("SUCCESS"));
}
+void tst_qqmlecmascript::functionAsDefaultArgument()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("functionAsDefaultArgument.qml"));
+ QScopedPointer<QObject> root(component.create());
+ QVERIFY(root);
+ QCOMPARE(root->objectName(), "didRun");
+}
+
QTEST_MAIN(tst_qqmlecmascript)
#include "tst_qqmlecmascript.moc"
diff --git a/tests/auto/qml/qqmllanguage/data/ambiguousBinding/TestCase.qml b/tests/auto/qml/qqmllanguage/data/ambiguousBinding/TestCase.qml
new file mode 100644
index 0000000000..c76d2b679e
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/ambiguousBinding/TestCase.qml
@@ -0,0 +1,6 @@
+import QtQml 2.15
+import QtTest 1.0
+
+QtObject {
+ component Comp: QtObject {}
+}
diff --git a/tests/auto/qml/qqmllanguage/data/ambiguousBinding/ambiguousContainingType.qml b/tests/auto/qml/qqmllanguage/data/ambiguousBinding/ambiguousContainingType.qml
new file mode 100644
index 0000000000..765dc91fe1
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/ambiguousBinding/ambiguousContainingType.qml
@@ -0,0 +1,3 @@
+import QtQml 2.15
+
+TestCase {}
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index 31bf30c57c..bffb62c59e 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -337,6 +337,8 @@ private slots:
void hangOnWarning();
+ void ambiguousContainingType();
+
private:
QQmlEngine engine;
QStringList defaultImportPathList;
@@ -5860,6 +5862,20 @@ void tst_qqmllanguage::hangOnWarning()
QVERIFY(object != nullptr);
}
+void tst_qqmllanguage::ambiguousContainingType()
+{
+ // Need to do it twice, so that we load from disk cache the second time.
+ for (int i = 0; i < 2; ++i) {
+ QQmlEngine engine;
+
+ // Should not crash when loading the type
+ QQmlComponent c(&engine, testFileUrl("ambiguousBinding/ambiguousContainingType.qml"));
+ QVERIFY2(c.isReady(), qPrintable(c.errorString()));
+ QScopedPointer<QObject> o(c.create());
+ QVERIFY(!o.isNull());
+ }
+}
+
QTEST_MAIN(tst_qqmllanguage)
#include "tst_qqmllanguage.moc"
diff --git a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
index 5363cc8fcb..4032a4448d 100644
--- a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
+++ b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
@@ -1943,7 +1943,8 @@ void tst_qqmlproperty::copy()
{
PropertyObject object;
- QQmlProperty *property = new QQmlProperty(&object, QLatin1String("defaultProperty"));
+ QScopedPointer<QQmlProperty> property(
+ new QQmlProperty(&object, QLatin1String("defaultProperty")));
QCOMPARE(property->name(), QString("defaultProperty"));
QCOMPARE(property->read(), QVariant(10));
QCOMPARE(property->type(), QQmlProperty::Property);
@@ -1966,7 +1967,7 @@ void tst_qqmlproperty::copy()
QCOMPARE(p2.propertyTypeCategory(), QQmlProperty::Normal);
QCOMPARE(p2.propertyType(), (int)QVariant::Int);
- delete property; property = nullptr;
+ property.reset();
QCOMPARE(p1.name(), QString("defaultProperty"));
QCOMPARE(p1.read(), QVariant(10));
@@ -1979,6 +1980,16 @@ void tst_qqmlproperty::copy()
QCOMPARE(p2.type(), QQmlProperty::Property);
QCOMPARE(p2.propertyTypeCategory(), QQmlProperty::Normal);
QCOMPARE(p2.propertyType(), (int)QVariant::Int);
+
+ p1 = QQmlProperty();
+ QQmlPropertyPrivate *p2d = QQmlPropertyPrivate::get(p2);
+ QCOMPARE(p2d->count(), 1);
+
+ // Use a pointer to avoid compiler warning about self-assignment.
+ QQmlProperty *p2p = &p2;
+ *p2p = p2;
+
+ QCOMPARE(p2d->count(), 1);
}
void tst_qqmlproperty::noContext()
diff --git a/tests/auto/qml/qv4assembler/tst_qv4assembler.cpp b/tests/auto/qml/qv4assembler/tst_qv4assembler.cpp
index 5dd8e9dcc0..5d9be077fe 100644
--- a/tests/auto/qml/qv4assembler/tst_qv4assembler.cpp
+++ b/tests/auto/qml/qv4assembler/tst_qv4assembler.cpp
@@ -148,6 +148,9 @@ void tst_QV4Assembler::jitEnabled()
#elif defined(Q_OS_WIN) && defined(Q_PROCESSOR_ARM)
/* JIT should be disabled Windows on ARM/ARM64 for now. */
QVERIFY(!QT_CONFIG(qml_jit));
+#elif defined(Q_OS_MACOS) && defined(Q_PROCESSOR_ARM)
+ /* JIT should be disabled on macOS on ARM/ARM64 for now. */
+ QVERIFY(!QT_CONFIG(qml_jit));
#else
/* JIT should be enabled on all other architectures/OSes tested in CI. */
QVERIFY(QT_CONFIG(qml_jit));
diff --git a/tests/auto/qmltest/events/tst_wheel.qml b/tests/auto/qmltest/events/tst_wheel.qml
index 96338a51ec..fc38141971 100644
--- a/tests/auto/qmltest/events/tst_wheel.qml
+++ b/tests/auto/qmltest/events/tst_wheel.qml
@@ -64,7 +64,7 @@ Rectangle {
verify(flick.contentX == 0);
flick.contentY = 0;
verify(flick.contentY == 0);
- mouseWheel(flick, 200, 200, -120, 0, Qt.NoButton, Qt.NoModifier, -1);
+ mouseWheel(flick, 200, 200, -120, 0, Qt.NoButton, Qt.NoModifier, 100);
wait(1000);
verify(flick.contentX > 0);
verify(flick.contentY == 0);
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"