diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-03-21 01:01:17 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2019-03-21 10:59:45 +0100 |
commit | 7a349710cc7bd63b52bb70e4d61a6489e083ceb2 (patch) | |
tree | 5b90a7fc6fb53d79ce16973ac8d316b746994a10 /tests | |
parent | 40e149f5fa67967e890b8f9d09cbb00cb2f62259 (diff) | |
parent | 937d8114e9ccf607462ab72a4b6e801756698473 (diff) |
Merge remote-tracking branch 'origin/5.12' into 5.13
Conflicts:
src/qml/compiler/qqmltypecompiler.cpp
src/qml/compiler/qv4bytecodehandler.cpp
src/qml/compiler/qv4codegen.cpp
src/qml/compiler/qv4compileddata_p.h
src/qml/compiler/qv4compiler.cpp
src/qml/compiler/qv4instr_moth.cpp
src/qml/compiler/qv4instr_moth_p.h
src/qml/jit/qv4baselinejit.cpp
src/qml/jit/qv4baselinejit_p.h
src/qml/jsruntime/qv4function.cpp
src/qml/jsruntime/qv4vme_moth.cpp
Change-Id: I8fb4d6f19677bcec0a4593b250f2eda5ae85e3d2
Diffstat (limited to 'tests')
17 files changed, 154 insertions, 8 deletions
diff --git a/tests/auto/qml/debugger/qqmlpreview/tst_qqmlpreview.cpp b/tests/auto/qml/debugger/qqmlpreview/tst_qqmlpreview.cpp index 4c4c514832..f713aa76c3 100644 --- a/tests/auto/qml/debugger/qqmlpreview/tst_qqmlpreview.cpp +++ b/tests/auto/qml/debugger/qqmlpreview/tst_qqmlpreview.cpp @@ -338,7 +338,7 @@ void tst_QQmlPreview::fps() QVERIFY(m_client); m_client->triggerLoad(testFileUrl(file)); if (QGuiApplication::platformName() != "offscreen") { - QTRY_VERIFY(m_frameStats.numSyncs > 10); + QTRY_VERIFY_WITH_TIMEOUT(m_frameStats.numSyncs > 10, 10000); QVERIFY(m_frameStats.minSync <= m_frameStats.maxSync); QVERIFY(m_frameStats.totalSync / m_frameStats.numSyncs >= m_frameStats.minSync - 1); QVERIFY(m_frameStats.totalSync / m_frameStats.numSyncs <= m_frameStats.maxSync); diff --git a/tests/auto/qml/qqmlecmascript/data/signalHandlers.qml b/tests/auto/qml/qqmlecmascript/data/signalHandlers.qml index 14326bb9e6..a924519f0f 100644 --- a/tests/auto/qml/qqmlecmascript/data/signalHandlers.qml +++ b/tests/auto/qml/qqmlecmascript/data/signalHandlers.qml @@ -8,6 +8,8 @@ QtObject { signal testSignal onTestSignal: count++ + readonly property string scopeObjectAsString: this.toString() + property int funcCount: 0 function testFunction() { funcCount++; diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index e6603a1a19..3cd70a0d1b 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -365,6 +365,7 @@ private slots: void numberToStringWithRadix(); void tailCallWithArguments(); void deleteSparseInIteration(); + void saveAccumulatorBeforeToInt32(); private: // static void propertyVarWeakRefCallback(v8::Persistent<v8::Value> object, void* parameter); @@ -1608,7 +1609,7 @@ void tst_qqmlecmascript::aliasPropertyReset() // test that a manual write (of undefined) to a non-resettable property fails properly QUrl url = testFileUrl("aliasreset/aliasPropertyReset.error.1.qml"); - QString warning1 = url.toString() + QLatin1String(": Error: Cannot assign [undefined] to int"); + QString warning1 = url.toString() + QLatin1String(":15: Error: Cannot assign [undefined] to int"); QQmlComponent e1(&engine, url); object = e1.create(); QVERIFY(object != nullptr); @@ -6474,7 +6475,8 @@ void tst_qqmlecmascript::signalHandlers() QMetaObject::invokeMethod(o.data(), "testSignalHandlerCall"); QCOMPARE(o->property("count").toInt(), 1); - QCOMPARE(o->property("errorString").toString(), QLatin1String("TypeError: Property 'onTestSignal' of object [object Object] is not a function")); + QString scopeObjectAsString = o->property("scopeObjectAsString").toString(); + QCOMPARE(o->property("errorString").toString(), QString("TypeError: Property 'onTestSignal' of object %1 is not a function").arg(scopeObjectAsString)); QCOMPARE(o->property("funcCount").toInt(), 0); QMetaObject::invokeMethod(o.data(), "testSignalConnection"); @@ -8169,12 +8171,11 @@ void tst_qqmlecmascript::stackLimits() void tst_qqmlecmascript::idsAsLValues() { QQmlEngine engine; - QString err = QString(QLatin1String("%1:5 left-hand side of assignment operator is not an lvalue\n")).arg(testFileUrl("idAsLValue.qml").toString()); + QString err = QString(QLatin1String("%1:5: Error: left-hand side of assignment operator is not an lvalue")).arg(testFileUrl("idAsLValue.qml").toString()); QQmlComponent component(&engine, testFileUrl("idAsLValue.qml")); - QTest::ignoreMessage(QtWarningMsg, "QQmlComponent: Component is not ready"); + QTest::ignoreMessage(QtWarningMsg, qPrintable(err)); MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); QVERIFY(!object); - QCOMPARE(component.errorString(), err); } void tst_qqmlecmascript::qtbug_34792() @@ -8936,6 +8937,17 @@ void tst_qqmlecmascript::deleteSparseInIteration() QCOMPARE(value.property("2").toInt(), 4096); } +void tst_qqmlecmascript::saveAccumulatorBeforeToInt32() +{ + QJSEngine engine; + + // Infinite recursion produces a range error, but should not crash. + // Also, any GC runs in between should not trash the temporary results of "a+a". + const QJSValue value = engine.evaluate("function a(){a(a&a+a)}a()"); + QVERIFY(value.isError()); + QCOMPARE(value.toString(), QLatin1String("RangeError: Maximum call stack size exceeded.")); +} + QTEST_MAIN(tst_qqmlecmascript) #include "tst_qqmlecmascript.moc" diff --git a/tests/auto/qml/qqmlimport/data/interceptQmldir.qml b/tests/auto/qml/qqmlimport/data/interceptQmldir.qml new file mode 100644 index 0000000000..bf485b2282 --- /dev/null +++ b/tests/auto/qml/qqmlimport/data/interceptQmldir.qml @@ -0,0 +1,7 @@ +import QtQml 2.2 + +import "$(INTERCEPT)" as Intercepted + +QtObject { + property QtObject view: Intercepted.View {} +} diff --git a/tests/auto/qml/qqmlimport/data/intercepted/View.qml b/tests/auto/qml/qqmlimport/data/intercepted/View.qml new file mode 100644 index 0000000000..92aa3af95a --- /dev/null +++ b/tests/auto/qml/qqmlimport/data/intercepted/View.qml @@ -0,0 +1,5 @@ +import QtQml 2.2 + +QtObject { + property int foo: 12 +} diff --git a/tests/auto/qml/qqmlimport/data/intercepted/qmldir b/tests/auto/qml/qqmlimport/data/intercepted/qmldir new file mode 100644 index 0000000000..ab31de73d8 --- /dev/null +++ b/tests/auto/qml/qqmlimport/data/intercepted/qmldir @@ -0,0 +1,2 @@ +module SomeModule +View 1.0 View.qml diff --git a/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp b/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp index 70aaa9678e..a3cb68fdcb 100644 --- a/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp +++ b/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp @@ -28,6 +28,7 @@ #include <QtTest/QtTest> #include <QQmlApplicationEngine> +#include <QQmlAbstractUrlInterceptor> #include <QtQuick/qquickview.h> #include <QtQuick/qquickitem.h> #include <private/qqmlimport_p.h> @@ -43,6 +44,7 @@ private slots: void uiFormatLoading(); void completeQmldirPaths_data(); void completeQmldirPaths(); + void interceptQmldir(); void cleanup(); }; @@ -185,6 +187,32 @@ void tst_QQmlImport::completeQmldirPaths() QCOMPARE(QQmlImports::completeQmldirPaths(uri, basePaths, majorVersion, minorVersion), expectedPaths); } +class QmldirUrlInterceptor : public QQmlAbstractUrlInterceptor { +public: + QUrl intercept(const QUrl &url, DataType type) override + { + if (type != UrlString && !url.isEmpty() && url.isValid()) { + QString str = url.toString(QUrl::None); + return str.replace(QStringLiteral("$(INTERCEPT)"), QStringLiteral("intercepted")); + } + return url; + } +}; + +void tst_QQmlImport::interceptQmldir() +{ + QQmlEngine engine; + QmldirUrlInterceptor interceptor; + engine.setUrlInterceptor(&interceptor); + + QQmlComponent component(&engine); + component.loadUrl(testFileUrl("interceptQmldir.qml")); + QVERIFY(component.isReady()); + QScopedPointer<QObject> obj(component.create()); + QVERIFY(!obj.isNull()); +} + + QTEST_MAIN(tst_QQmlImport) #include "tst_qqmlimport.moc" diff --git a/tests/auto/qml/qqmllanguage/data/EdgeObject.qml b/tests/auto/qml/qqmllanguage/data/EdgeObject.qml new file mode 100644 index 0000000000..b25dc29c49 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/EdgeObject.qml @@ -0,0 +1,20 @@ +import QtQuick 2.0 + +Item { + property int edgeWidth: bg.width + + Rectangle { + id: bg + } + + states: [ + State { + when: 1 === 1 + PropertyChanges { + target: bg + anchors.left: parent.left + anchors.right: parent.right + } + } + ] +} diff --git a/tests/auto/qml/qqmllanguage/data/anchorsToParentInPropertyChagnes.qml b/tests/auto/qml/qqmllanguage/data/anchorsToParentInPropertyChagnes.qml new file mode 100644 index 0000000000..8b1682da92 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/anchorsToParentInPropertyChagnes.qml @@ -0,0 +1,10 @@ +import QtQuick 2.9 + +Item { + width: 200 + property int edgeWidth: edge.edgeWidth + EdgeObject { + id: edge + anchors.fill: parent + } +} diff --git a/tests/auto/qml/qqmllanguage/data/thisInQmlScope.qml b/tests/auto/qml/qqmllanguage/data/thisInQmlScope.qml index e3c99e70e1..9ff758c33f 100644 --- a/tests/auto/qml/qqmllanguage/data/thisInQmlScope.qml +++ b/tests/auto/qml/qqmllanguage/data/thisInQmlScope.qml @@ -6,5 +6,18 @@ QtObject { y = this.x; } property var f: g + Component.onCompleted: f() + + property int a: 42 + property int b: 0 + function g_subobj(){ + b = this.a; + } + property var f_subobj: g_subobj + + property QtObject subObject: QtObject { + property int a: 100 + Component.onCompleted: f_subobj() + } } diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index 764a67a295..22ea3a89c3 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -299,6 +299,7 @@ private slots: void retrieveQmlTypeId(); void polymorphicFunctionLookup(); + void anchorsToParentInPropertyChanges(); private: QQmlEngine engine; @@ -5022,6 +5023,8 @@ void tst_qqmllanguage::thisInQmlScope() QVERIFY(!o.isNull()); QCOMPARE(o->property("x"), QVariant(42)); QCOMPARE(o->property("y"), QVariant(42)); + QCOMPARE(o->property("a"), QVariant(42)); + QCOMPARE(o->property("b"), QVariant(42)); } void tst_qqmllanguage::valueTypeGroupPropertiesInBehavior() @@ -5069,6 +5072,16 @@ void tst_qqmllanguage::polymorphicFunctionLookup() QVERIFY(o->property("ok").toBool()); } +void tst_qqmllanguage::anchorsToParentInPropertyChanges() +{ + QQmlEngine engine; + QQmlComponent component(&engine, testFileUrl("anchorsToParentInPropertyChagnes.qml")); + VERIFY_ERRORS(0); + QScopedPointer<QObject> o(component.create()); + QVERIFY(!o.isNull()); + QTRY_COMPARE(o->property("edgeWidth").toInt(), 200); +} + QTEST_MAIN(tst_qqmllanguage) #include "tst_qqmllanguage.moc" diff --git a/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp b/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp index 6e831eacc1..a5332c8860 100644 --- a/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp +++ b/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp @@ -349,7 +349,7 @@ void tst_qqmlnotifier::deleteFromHandler() QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("objectRenamer.qml")); QPointer<QObject> mess = component.create(); - QObject::connect(mess, &QObject::objectNameChanged, [&]() { delete mess; }); + QObject::connect(mess.data(), &QObject::objectNameChanged, [&]() { delete mess; }); QTRY_VERIFY(mess.isNull()); // BANG! } else { QProcess process; diff --git a/tests/auto/qml/qv4mm/tst_qv4mm.cpp b/tests/auto/qml/qv4mm/tst_qv4mm.cpp index 578a47d5fa..b57b716ed6 100644 --- a/tests/auto/qml/qv4mm/tst_qv4mm.cpp +++ b/tests/auto/qml/qv4mm/tst_qv4mm.cpp @@ -33,6 +33,7 @@ #include <private/qv4mm_p.h> #include <private/qv4qobjectwrapper_p.h> +#include <private/qjsvalue_p.h> #include "../../shared/util.h" @@ -46,6 +47,7 @@ private slots: void gcStats(); void multiWrappedQObjects(); void accessParentOnDestruction(); + void clearICParent(); }; void tst_qv4mm::gcStats() @@ -108,6 +110,30 @@ void tst_qv4mm::accessParentOnDestruction() QCOMPARE(obj->property("destructions").toInt(), 100); } +void tst_qv4mm::clearICParent() +{ + QJSEngine engine; + QJSValue value = engine.evaluate( + "(function() {\n" + " var test = Object.create(null);\n" + " for (var i = 0; i < 100; i++)\n" + " test[(\"key_\"+i)] = true;\n" + " for (var i = 0; i < 100; i++)\n" + " delete test[\"key_\" + i];\n" + " return test;\n" + "})();" + ); + engine.collectGarbage(); + QV4::Value *v4Value = QJSValuePrivate::getValue(&value); + QVERIFY(v4Value); + QV4::Heap::Object *v4Object = v4Value->toObject(engine.handle()); + QVERIFY(v4Object); + + // It should garbage collect the parents of the internalClass, + // as those aren't used anywhere else. + QCOMPARE(v4Object->internalClass->parent, nullptr); +} + QTEST_MAIN(tst_qv4mm) #include "tst_qv4mm.moc" diff --git a/tests/auto/qmltest/animatedimage/BLACKLIST b/tests/auto/qmltest/animatedimage/BLACKLIST new file mode 100644 index 0000000000..3a5ed393ea --- /dev/null +++ b/tests/auto/qmltest/animatedimage/BLACKLIST @@ -0,0 +1,2 @@ +[AnimatedImage::test_crashRaceCondition_replyFinished] +osx-10.13 diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp index 3b704d7fa4..448096720c 100644 --- a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp +++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp @@ -6637,7 +6637,7 @@ void tst_QQuickGridView::contentHeightWithDelayRemove() QCOMPARE(qRound(gridview->contentHeight()), qRound(initialContentHeight)); QTRY_COMPARE(qRound(gridview->contentHeight()), eventualContentHeight); } else { - QCOMPARE(qRound(gridview->contentHeight()), eventualContentHeight); + QTRY_COMPARE(qRound(gridview->contentHeight()), eventualContentHeight); } delete window; diff --git a/tests/auto/quick/qquicklistview/BLACKLIST b/tests/auto/quick/qquicklistview/BLACKLIST index e22d52294f..ecdf8f558e 100644 --- a/tests/auto/quick/qquicklistview/BLACKLIST +++ b/tests/auto/quick/qquicklistview/BLACKLIST @@ -1,5 +1,7 @@ [enforceRange_withoutHighlight] osx +opensuse-42.3 +opensuse-leap #QTBUG-53863 [populateTransitions] opensuse-42.1 diff --git a/tests/auto/quick/touchmouse/BLACKLIST b/tests/auto/quick/touchmouse/BLACKLIST index b2ba52eca9..0dfe28087a 100644 --- a/tests/auto/quick/touchmouse/BLACKLIST +++ b/tests/auto/quick/touchmouse/BLACKLIST @@ -1,2 +1,6 @@ [buttonOnDelayedPressFlickable] windows gcc developer-build + +# QTBUG-74517 +[buttonOnFlickable] +windows gcc developer-build |