diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-02-21 01:00:50 +0100 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-02-21 01:00:50 +0100 |
commit | 573afc9fdd093724dd58f818b965f42fca8bd1a8 (patch) | |
tree | c1d743037b6887fa6d0df99e1ecd89f8da61788b /tests/auto/qml | |
parent | 7d80264fa7fc71bc68ed091ff8ba97bdd7970dc4 (diff) | |
parent | 03097d5038fe6331df97182a38fac3a9a84fe195 (diff) |
Merge remote-tracking branch 'origin/5.13' into dev
Change-Id: Ie33d1c736992abcbde6568131374a7a7891f965c
Diffstat (limited to 'tests/auto/qml')
-rw-r--r-- | tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 42 | ||||
-rw-r--r-- | tests/auto/qml/qqmllanguage/data/SignalEmitter.qml | 14 | ||||
-rw-r--r-- | tests/auto/qml/qqmlparser/tst_qqmlparser.cpp | 10 | ||||
-rw-r--r-- | tests/auto/qml/qqmltypeloader/data/implicitcomponent.qml | 10 | ||||
-rw-r--r-- | tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp | 53 |
5 files changed, 86 insertions, 43 deletions
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 63bca255c2..e6d5ab7cae 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -2762,32 +2762,28 @@ void tst_qqmlecmascript::callQtInvokables() QCOMPARE(o->actuals().at(0), QVariant(QString())); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_QPointF(0)", QV4::Primitive::undefinedValue())); + QVERIFY(!EVALUATE_VALUE("object.method_QPointF(0)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); - QCOMPARE(o->invoked(), 12); - QCOMPARE(o->actuals().count(), 1); - QCOMPARE(o->actuals().at(0), QVariant(QPointF())); + QCOMPARE(o->invoked(), -1); + QCOMPARE(o->actuals().count(), 0); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_QPointF(null)", QV4::Primitive::undefinedValue())); + QVERIFY(!EVALUATE_VALUE("object.method_QPointF(null)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); - QCOMPARE(o->invoked(), 12); - QCOMPARE(o->actuals().count(), 1); - QCOMPARE(o->actuals().at(0), QVariant(QPointF())); + QCOMPARE(o->invoked(), -1); + QCOMPARE(o->actuals().count(), 0); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_QPointF(undefined)", QV4::Primitive::undefinedValue())); + QVERIFY(!EVALUATE_VALUE("object.method_QPointF(undefined)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); - QCOMPARE(o->invoked(), 12); - QCOMPARE(o->actuals().count(), 1); - QCOMPARE(o->actuals().at(0), QVariant(QPointF())); + QCOMPARE(o->invoked(), -1); + QCOMPARE(o->actuals().count(), 0); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_QPointF(object)", QV4::Primitive::undefinedValue())); + QVERIFY(!EVALUATE_VALUE("object.method_QPointF(object)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); - QCOMPARE(o->invoked(), 12); - QCOMPARE(o->actuals().count(), 1); - QCOMPARE(o->actuals().at(0), QVariant(QPointF())); + QCOMPARE(o->invoked(), -1); + QCOMPARE(o->actuals().count(), 0); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QPointF(object.method_get_QPointF())", QV4::Primitive::undefinedValue())); @@ -2804,18 +2800,16 @@ void tst_qqmlecmascript::callQtInvokables() QCOMPARE(o->actuals().at(0), QVariant(QPointF(9, 12))); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_QObject(0)", QV4::Primitive::undefinedValue())); + QVERIFY(!EVALUATE_VALUE("object.method_QObject(0)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); - QCOMPARE(o->invoked(), 13); - QCOMPARE(o->actuals().count(), 1); - QCOMPARE(o->actuals().at(0), qVariantFromValue((QObject *)nullptr)); + QCOMPARE(o->invoked(), -1); + QCOMPARE(o->actuals().count(), 0); o->reset(); - QVERIFY(EVALUATE_VALUE("object.method_QObject(\"Hello world\")", QV4::Primitive::undefinedValue())); + QVERIFY(!EVALUATE_VALUE("object.method_QObject(\"Hello world\")", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); - QCOMPARE(o->invoked(), 13); - QCOMPARE(o->actuals().count(), 1); - QCOMPARE(o->actuals().at(0), qVariantFromValue((QObject *)nullptr)); + QCOMPARE(o->invoked(), -1); + QCOMPARE(o->actuals().count(), 0); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QObject(null)", QV4::Primitive::undefinedValue())); diff --git a/tests/auto/qml/qqmllanguage/data/SignalEmitter.qml b/tests/auto/qml/qqmllanguage/data/SignalEmitter.qml index 259f45b7d2..31fe5e4a5e 100644 --- a/tests/auto/qml/qqmllanguage/data/SignalEmitter.qml +++ b/tests/auto/qml/qqmllanguage/data/SignalEmitter.qml @@ -10,8 +10,18 @@ QtObject { signal testSignal(SignalParam spp); function emitTestSignal() { - testObject.expectNull = true; - testSignal(op); + var caught = false; + try { + testObject.expectNull = true; + testSignal(op); + } catch(e) { + // good: We want a type error here + caught = true; + if (handleSignal) + testObject.determineSuccess(null); + } + if (!caught && handleSignal) + testObject.determineSuccess("fail"); testObject.expectNull = false; testSignal(p); diff --git a/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp b/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp index ce9d0ac894..c2c73935c0 100644 --- a/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp +++ b/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp @@ -53,6 +53,7 @@ private slots: void stringLiteral(); void noSubstitutionTemplateLiteral(); void templateLiteral(); + void leadingSemicolonInClass(); private: QStringList excludedDirs; @@ -274,6 +275,15 @@ void tst_qqmlparser::templateLiteral() QVERIFY(e); } +void tst_qqmlparser::leadingSemicolonInClass() +{ + QQmlJS::Engine engine; + QQmlJS::Lexer lexer(&engine); + lexer.setCode(QLatin1String("class X{;n(){}}"), 1); + QQmlJS::Parser parser(&engine); + QVERIFY(parser.parseProgram()); +} + QTEST_MAIN(tst_qqmlparser) #include "tst_qqmlparser.moc" diff --git a/tests/auto/qml/qqmltypeloader/data/implicitcomponent.qml b/tests/auto/qml/qqmltypeloader/data/implicitcomponent.qml new file mode 100644 index 0000000000..9cebc88c8b --- /dev/null +++ b/tests/auto/qml/qqmltypeloader/data/implicitcomponent.qml @@ -0,0 +1,10 @@ +import QtQml 2.2 + +QtObject { + property Component some: QtObject { + property int rrr: 2 + property Component onemore: QtObject { + property int brrrr: -1 + } + } +} diff --git a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp index 3745fad470..0c4abf19f4 100644 --- a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp +++ b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp @@ -55,6 +55,7 @@ private slots: void redirect(); void qmlSingletonWithinModule(); void multiSingletonModule(); + void implicitComponentModule(); }; void tst_QQMLTypeLoader::testLoadComplete() @@ -446,23 +447,8 @@ void tst_QQMLTypeLoader::qmlSingletonWithinModule() QVERIFY(obj->property("ok").toBool()); } -void tst_QQMLTypeLoader::multiSingletonModule() +static void checkCleanCacheLoad(const QString &testCase) { - qmlClearTypeRegistrations(); - QQmlEngine engine; - engine.addImportPath(testFile("imports")); - - qmlRegisterSingletonType(testFileUrl("CppRegisteredSingleton1.qml"), "cppsingletonmodule", - 1, 0, "CppRegisteredSingleton1"); - qmlRegisterSingletonType(testFileUrl("CppRegisteredSingleton2.qml"), "cppsingletonmodule", - 1, 0, "CppRegisteredSingleton2"); - - QQmlComponent component(&engine, testFileUrl("multisingletonuser.qml")); - QCOMPARE(component.status(), QQmlComponent::Ready); - QScopedPointer<QObject> obj(component.create()); - QVERIFY(!obj.isNull()); - QVERIFY(obj->property("ok").toBool()); - #if QT_CONFIG(process) const char *skipKey = "QT_TST_QQMLTYPELOADER_SKIP_MISMATCH"; if (qEnvironmentVariableIsSet(skipKey)) @@ -470,7 +456,7 @@ void tst_QQMLTypeLoader::multiSingletonModule() for (int i = 0; i < 5; ++i) { QProcess child; child.setProgram(QCoreApplication::applicationFilePath()); - child.setArguments(QStringList(QLatin1String("multiSingletonModule"))); + child.setArguments(QStringList(testCase)); QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); env.insert(QLatin1String("QT_LOGGING_RULES"), QLatin1String("qt.qml.diskcache.debug=true")); env.insert(QLatin1String(skipKey), QLatin1String("1")); @@ -481,9 +467,42 @@ void tst_QQMLTypeLoader::multiSingletonModule() QVERIFY(!child.readAllStandardOutput().contains("Checksum mismatch for cached version")); QVERIFY(!child.readAllStandardError().contains("Checksum mismatch for cached version")); } +#else + Q_UNUSED(testCase); #endif } +void tst_QQMLTypeLoader::multiSingletonModule() +{ + qmlClearTypeRegistrations(); + QQmlEngine engine; + engine.addImportPath(testFile("imports")); + + qmlRegisterSingletonType(testFileUrl("CppRegisteredSingleton1.qml"), "cppsingletonmodule", + 1, 0, "CppRegisteredSingleton1"); + qmlRegisterSingletonType(testFileUrl("CppRegisteredSingleton2.qml"), "cppsingletonmodule", + 1, 0, "CppRegisteredSingleton2"); + + QQmlComponent component(&engine, testFileUrl("multisingletonuser.qml")); + QCOMPARE(component.status(), QQmlComponent::Ready); + QScopedPointer<QObject> obj(component.create()); + QVERIFY(!obj.isNull()); + QVERIFY(obj->property("ok").toBool()); + + checkCleanCacheLoad(QLatin1String("multiSingletonModule")); +} + +void tst_QQMLTypeLoader::implicitComponentModule() +{ + QQmlEngine engine; + QQmlComponent component(&engine, testFileUrl("implicitcomponent.qml")); + QCOMPARE(component.status(), QQmlComponent::Ready); + QScopedPointer<QObject> obj(component.create()); + QVERIFY(!obj.isNull()); + + checkCleanCacheLoad(QLatin1String("implicitComponentModule")); +} + QTEST_MAIN(tst_QQMLTypeLoader) #include "tst_qqmltypeloader.moc" |