diff options
Diffstat (limited to 'tests/auto/qml')
9 files changed, 62 insertions, 4 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)); |