aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml')
-rw-r--r--tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp3
-rw-r--r--tests/auto/qml/animation/qpauseanimationjob/BLACKLIST3
-rw-r--r--tests/auto/qml/ecmascripttests/qjstest/qjstest.pro2
-rw-r--r--tests/auto/qml/ecmascripttests/testcase.pro2
-rw-r--r--tests/auto/qml/qml.pro1
-rw-r--r--tests/auto/qml/qmlformat/data/largeBindings.formatted.qml9
-rw-r--r--tests/auto/qml/qmlformat/data/largeBindings.qml11
-rw-r--r--tests/auto/qml/qmlformat/data/statesAndTransitions.formatted.qml16
-rw-r--r--tests/auto/qml/qmlformat/data/statesAndTransitions.qml10
-rw-r--r--tests/auto/qml/qmlformat/tst_qmlformat.cpp12
-rw-r--r--tests/auto/qml/qmlmin/qmlmin.pro12
-rw-r--r--tests/auto/qml/qmlmin/tst_qmlmin.cpp224
-rw-r--r--tests/auto/qml/qmlplugindump/data/dumper/ExtendedType/plugins.qmltypes6
-rw-r--r--tests/auto/qml/qmlplugindump/data/dumper/Versions/plugins.qmltypes6
-rw-r--r--tests/auto/qml/qqmldirparser/tst_qqmldirparser.cpp8
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp6
-rw-r--r--tests/auto/qml/qqmlengine/data/qtqmlModule.10.qml4
-rw-r--r--tests/auto/qml/qqmlengine/tst_qqmlengine.cpp9
-rw-r--r--tests/auto/qml/qqmlenginecleanup/tst_qqmlenginecleanup.cpp3
-rw-r--r--tests/auto/qml/qqmlimport/tst_qqmlimport.cpp4
-rw-r--r--tests/auto/qml/qqmlitemmodels/qtestmodel.h2
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp80
-rw-r--r--tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp50
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/importsMixedQmlCppPlugin.2.qml1
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/data/importsMixedQmlCppPlugin.qml1
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp23
-rw-r--r--tests/auto/qml/qqmlparser/tst_qqmlparser.cpp44
-rw-r--r--tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp41
-rw-r--r--tests/auto/qml/qqmlqt/tst_qqmlqt.cpp167
-rw-r--r--tests/auto/qml/qqmltimer/tst_qqmltimer.cpp10
-rw-r--r--tests/auto/qml/qqmltypeloader/dummy_imports.qml9
-rw-r--r--tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp20
-rw-r--r--tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.pro2
-rw-r--r--tests/auto/qml/qqmlvaluetypes/data/font_write.qml2
-rw-r--r--tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp38
35 files changed, 414 insertions, 427 deletions
diff --git a/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp b/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp
index a8bcadbc84..8c4c461813 100644
--- a/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp
+++ b/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp
@@ -432,8 +432,7 @@ void tst_QParallelAnimationGroupJob::deleteChildrenWithRunningGroup()
QCOMPARE(group.state(), QAnimationGroupJob::Running);
QCOMPARE(anim1->state(), QAnimationGroupJob::Running);
- QTest::qWait(80);
- QVERIFY(group.currentLoopTime() > 0);
+ QTRY_VERIFY(group.currentLoopTime() > 0);
delete anim1;
QVERIFY(!group.firstChild());
diff --git a/tests/auto/qml/animation/qpauseanimationjob/BLACKLIST b/tests/auto/qml/animation/qpauseanimationjob/BLACKLIST
new file mode 100644
index 0000000000..33799b6528
--- /dev/null
+++ b/tests/auto/qml/animation/qpauseanimationjob/BLACKLIST
@@ -0,0 +1,3 @@
+[multipleSequentialGroups]
+macos ci
+
diff --git a/tests/auto/qml/ecmascripttests/qjstest/qjstest.pro b/tests/auto/qml/ecmascripttests/qjstest/qjstest.pro
index 6dec5f8f23..adead821e4 100644
--- a/tests/auto/qml/ecmascripttests/qjstest/qjstest.pro
+++ b/tests/auto/qml/ecmascripttests/qjstest/qjstest.pro
@@ -3,6 +3,8 @@ TARGET = qjstest
QT += qml-private
INCLUDEPATH += .
+CONFIG += c++14
+
DEFINES += QT_DEPRECATED_WARNINGS
HEADERS += test262runner.h
diff --git a/tests/auto/qml/ecmascripttests/testcase.pro b/tests/auto/qml/ecmascripttests/testcase.pro
index 5bf7ecd696..9405095050 100644
--- a/tests/auto/qml/ecmascripttests/testcase.pro
+++ b/tests/auto/qml/ecmascripttests/testcase.pro
@@ -6,6 +6,8 @@ SOURCES += tst_ecmascripttests.cpp qjstest/test262runner.cpp
HEADERS += qjstest/test262runner.h
DEFINES += SRCDIR=\\\"$$PWD\\\"
+CONFIG += c++14
+
# The ES test suite takes approximately 5 mins to run, on a fairly
# vanilla developer machine, so the default watchdog timer kills the
# test some of the time. Fix by raising time-out to 400s when
diff --git a/tests/auto/qml/qml.pro b/tests/auto/qml/qml.pro
index 7a08cc805c..7a2ba10096 100644
--- a/tests/auto/qml/qml.pro
+++ b/tests/auto/qml/qml.pro
@@ -12,7 +12,6 @@ PUBLICTESTS += \
qqmlfileselector
PUBLICTESTS += \
- qmlmin \
qqmlcomponent \
qqmlconsole \
qqmlengine \
diff --git a/tests/auto/qml/qmlformat/data/largeBindings.formatted.qml b/tests/auto/qml/qmlformat/data/largeBindings.formatted.qml
new file mode 100644
index 0000000000..d8e4ffb087
--- /dev/null
+++ b/tests/auto/qml/qmlformat/data/largeBindings.formatted.qml
@@ -0,0 +1,9 @@
+QtObject {
+ small1: 3
+ small2: foo
+ // THIS NEEDS TO BE LAST
+ largeBinding: {
+ var x = 300;
+ console.log(x);
+ }
+}
diff --git a/tests/auto/qml/qmlformat/data/largeBindings.qml b/tests/auto/qml/qmlformat/data/largeBindings.qml
new file mode 100644
index 0000000000..a2249f6815
--- /dev/null
+++ b/tests/auto/qml/qmlformat/data/largeBindings.qml
@@ -0,0 +1,11 @@
+QtObject
+{
+ // THIS NEEDS TO BE LAST
+ largeBinding: {
+ var x = 300;
+ console.log(x);
+ }
+
+ small1: 3
+ small2: foo
+}
diff --git a/tests/auto/qml/qmlformat/data/statesAndTransitions.formatted.qml b/tests/auto/qml/qmlformat/data/statesAndTransitions.formatted.qml
new file mode 100644
index 0000000000..bd063ac498
--- /dev/null
+++ b/tests/auto/qml/qmlformat/data/statesAndTransitions.formatted.qml
@@ -0,0 +1,16 @@
+QtObject {
+ id: foo
+
+ // This needs to be *before* states and transitions after formatting
+ Item {
+ }
+
+ states: [
+ State {
+ }
+ ]
+ transitions: [
+ Transition {
+ }
+ ]
+}
diff --git a/tests/auto/qml/qmlformat/data/statesAndTransitions.qml b/tests/auto/qml/qmlformat/data/statesAndTransitions.qml
new file mode 100644
index 0000000000..648bdce6b9
--- /dev/null
+++ b/tests/auto/qml/qmlformat/data/statesAndTransitions.qml
@@ -0,0 +1,10 @@
+QtObject {
+ id: foo
+
+ states: [ State {} ]
+ transitions: [ Transition {} ]
+
+ // This needs to be *before* states and transitions after formatting
+ Item {}
+
+}
diff --git a/tests/auto/qml/qmlformat/tst_qmlformat.cpp b/tests/auto/qml/qmlformat/tst_qmlformat.cpp
index 47255d7745..21d5ae46a9 100644
--- a/tests/auto/qml/qmlformat/tst_qmlformat.cpp
+++ b/tests/auto/qml/qmlformat/tst_qmlformat.cpp
@@ -45,6 +45,8 @@ private Q_SLOTS:
void testAnnotationsNoSort();
void testReadOnlyProps();
+ void testStatesAndTransitions();
+ void testLargeBindings();
#if !defined(QTEST_CROSS_COMPILED) // sources not available when cross compiled
void testExample();
@@ -200,6 +202,16 @@ void TestQmlformat::testReadOnlyProps()
QCOMPARE(runQmlformat(testFile("readOnlyProps.qml"), false, true), readTestFile("readOnlyProps.formatted.qml"));
}
+void TestQmlformat::testStatesAndTransitions()
+{
+ QCOMPARE(runQmlformat(testFile("statesAndTransitions.qml"), false, true), readTestFile("statesAndTransitions.formatted.qml"));
+}
+
+void TestQmlformat::testLargeBindings()
+{
+ QCOMPARE(runQmlformat(testFile("largeBindings.qml"), false, true), readTestFile("largeBindings.formatted.qml"));
+}
+
#if !defined(QTEST_CROSS_COMPILED) // sources not available when cross compiled
void TestQmlformat::testExample_data()
{
diff --git a/tests/auto/qml/qmlmin/qmlmin.pro b/tests/auto/qml/qmlmin/qmlmin.pro
deleted file mode 100644
index 93e5caabcf..0000000000
--- a/tests/auto/qml/qmlmin/qmlmin.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qmlmin
-QT += qml testlib gui-private
-macx:CONFIG -= app_bundle
-
-SOURCES += tst_qmlmin.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
-
-# Boot2qt is cross compiled but it has sources available
-!boot2qt {
- cross_compile: DEFINES += QTEST_CROSS_COMPILED
-}
diff --git a/tests/auto/qml/qmlmin/tst_qmlmin.cpp b/tests/auto/qml/qmlmin/tst_qmlmin.cpp
deleted file mode 100644
index 0501a8112a..0000000000
--- a/tests/auto/qml/qmlmin/tst_qmlmin.cpp
+++ /dev/null
@@ -1,224 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qtest.h>
-#include <QLibraryInfo>
-#include <QDir>
-#if QT_CONFIG(process)
-#include <QProcess>
-#endif
-#include <QDebug>
-#include <QQmlError>
-#include <cstdlib>
-
-class tst_qmlmin : public QObject
-{
- Q_OBJECT
-public:
- tst_qmlmin();
-
-private slots:
- void initTestCase();
-#if QT_CONFIG(process) && !defined(QTEST_CROSS_COMPILED) // sources not available when cross compiled
- void qmlMinify_data();
- void qmlMinify();
-#endif
-
-private:
- QString qmlminPath;
- QStringList excludedDirs;
- QStringList invalidFiles;
-
- QStringList findFiles(const QDir &);
- bool isInvalidFile(const QFileInfo &fileName) const;
-};
-
-tst_qmlmin::tst_qmlmin()
-{
-}
-
-void tst_qmlmin::initTestCase()
-{
-#if QT_CONFIG(process) && !defined(QTEST_CROSS_COMPILED) // sources not available when cross compiled
- qmlminPath = QLibraryInfo::location(QLibraryInfo::BinariesPath) + QLatin1String("/qmlmin");
-#ifdef Q_OS_WIN
- qmlminPath += QLatin1String(".exe");
-#endif
- if (!QFileInfo(qmlminPath).exists()) {
- QString message = QString::fromLatin1("qmlmin executable not found (looked for %0)")
- .arg(qmlminPath);
- QFAIL(qPrintable(message));
- }
-
- // Add directories you want excluded here
-
- // These snippets are not expected to run on their own.
- excludedDirs << "doc/src/snippets/qml/visualdatamodel_rootindex";
- excludedDirs << "doc/src/snippets/qml/qtbinding";
- excludedDirs << "doc/src/snippets/qml/imports";
- excludedDirs << "doc/src/snippets/qtquick1/visualdatamodel_rootindex";
- excludedDirs << "doc/src/snippets/qtquick1/qtbinding";
- excludedDirs << "doc/src/snippets/qtquick1/imports";
- excludedDirs << "tests/manual/v4";
- excludedDirs << "tests/auto/qml/ecmascripttests";
- excludedDirs << "tests/auto/qml/qmllint";
-
- // Add invalid files (i.e. files with syntax errors)
- invalidFiles << "tests/auto/quick/qquickloader/data/InvalidSourceComponent.qml";
- invalidFiles << "tests/auto/qml/qqmllanguage/data/signal.2.qml";
- invalidFiles << "tests/auto/qml/qqmllanguage/data/signal.3.qml";
- invalidFiles << "tests/auto/qml/qqmllanguage/data/signal.5.qml";
- invalidFiles << "tests/auto/qml/qqmllanguage/data/property.4.qml";
- invalidFiles << "tests/auto/qml/qqmllanguage/data/empty.qml";
- invalidFiles << "tests/auto/qml/qqmllanguage/data/missingObject.qml";
- invalidFiles << "tests/auto/qml/qqmllanguage/data/insertedSemicolon.1.qml";
- invalidFiles << "tests/auto/qml/qqmllanguage/data/nonexistantProperty.5.qml";
- invalidFiles << "tests/auto/qml/qqmllanguage/data/invalidRoot.1.qml";
- invalidFiles << "tests/auto/qml/qqmllanguage/data/invalidQmlEnumValue.1.qml";
- invalidFiles << "tests/auto/qml/qqmllanguage/data/invalidQmlEnumValue.2.qml";
- invalidFiles << "tests/auto/qml/qquickfolderlistmodel/data/dummy.qml";
- invalidFiles << "tests/auto/qml/qqmlecmascript/data/qtbug_22843.js";
- invalidFiles << "tests/auto/qml/qqmlecmascript/data/qtbug_22843.library.js";
- invalidFiles << "tests/auto/qml/qquickworkerscript/data/script_error_onLoad.js";
- invalidFiles << "tests/auto/qml/parserstress/tests/ecma_3/Unicode/regress-352044-02-n.js";
- invalidFiles << "tests/auto/qml/qqmlecmascript/data/incrDecrSemicolon_error1.qml";
- invalidFiles << "tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedFileQualifier.js";
- invalidFiles << "tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedFileQualifier.2.js";
- invalidFiles << "tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedImport.js";
- invalidFiles << "tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedModule.js";
- invalidFiles << "tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedFile.js";
- invalidFiles << "tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedModuleQualifier.js";
- invalidFiles << "tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedModuleQualifier.2.js";
- invalidFiles << "tests/auto/qml/qqmlecmascript/data/jsimportfail/malformedModuleVersion.js";
- invalidFiles << "tests/auto/qml/qqmlecmascript/data/jsimportfail/missingFileQualifier.js";
- invalidFiles << "tests/auto/qml/qqmlecmascript/data/jsimportfail/missingModuleQualifier.js";
- invalidFiles << "tests/auto/qml/qqmlecmascript/data/jsimportfail/missingModuleVersion.js";
- invalidFiles << "tests/auto/qml/qqmlecmascript/data/stringParsing_error.1.qml";
- invalidFiles << "tests/auto/qml/qqmlecmascript/data/stringParsing_error.2.qml";
- invalidFiles << "tests/auto/qml/qqmlecmascript/data/stringParsing_error.3.qml";
- invalidFiles << "tests/auto/qml/qqmlecmascript/data/stringParsing_error.4.qml";
- invalidFiles << "tests/auto/qml/qqmlecmascript/data/stringParsing_error.5.qml";
- invalidFiles << "tests/auto/qml/qqmlecmascript/data/stringParsing_error.6.qml";
- invalidFiles << "tests/auto/qml/qqmlecmascript/data/numberParsing_error.1.qml";
- invalidFiles << "tests/auto/qml/qqmlecmascript/data/numberParsing_error.2.qml";
- invalidFiles << "tests/auto/qml/parserstress/tests/ecma_3/FunExpr/fe-001.js";
- invalidFiles << "tests/auto/qml/qjsengine/script/com/trolltech/syntaxerror/__init__.js";
- invalidFiles << "tests/auto/qml/debugger/qqmlpreview/data/broken.qml";
- invalidFiles << "tests/auto/qml/qqmllanguage/data/fuzzed.2.qml";
- invalidFiles << "tests/auto/qml/qqmllanguage/data/fuzzed.3.qml";
- invalidFiles << "tests/auto/qml/qqmllanguage/data/requiredProperties.2.qml";
- // generatorFunction.qml is not invalid per se, but the minifier cannot handle yield statements
- invalidFiles << "tests/auto/qml/qqmlecmascript/data/generatorFunction.qml";
-#endif
-}
-
-QStringList tst_qmlmin::findFiles(const QDir &d)
-{
- for (int ii = 0; ii < excludedDirs.count(); ++ii) {
- QString s = excludedDirs.at(ii);
- if (d.absolutePath().endsWith(s))
- return QStringList();
- }
-
- QStringList rv;
-
- QStringList files = d.entryList(QStringList() << QLatin1String("*.qml") << QLatin1String("*.js"),
- QDir::Files);
- foreach (const QString &file, files) {
- rv << d.absoluteFilePath(file);
- }
-
- QStringList dirs = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot |
- QDir::NoSymLinks);
- foreach (const QString &dir, dirs) {
- QDir sub = d;
- sub.cd(dir);
- rv << findFiles(sub);
- }
-
- return rv;
-}
-
-bool tst_qmlmin::isInvalidFile(const QFileInfo &fileName) const
-{
- foreach (const QString &invalidFile, invalidFiles) {
- if (fileName.absoluteFilePath().endsWith(invalidFile))
- return true;
- }
- return false;
-}
-
-/*
-This test runs all the examples in the Qt QML UI source tree and ensures
-that they start and exit cleanly.
-
-Examples are any .qml files under the examples/ directory that start
-with a lower case letter.
-*/
-
-#if QT_CONFIG(process) && !defined(QTEST_CROSS_COMPILED) // sources not available when cross compiled
-void tst_qmlmin::qmlMinify_data()
-{
- QTest::addColumn<QString>("file");
-
- QString examples = QLatin1String(SRCDIR) + "/../../../../examples/";
- QString tests = QLatin1String(SRCDIR) + "/../../../../tests/";
-
- QStringList files;
- files << findFiles(QDir(examples));
- files << findFiles(QDir(tests));
-
- foreach (const QString &file, files)
- QTest::newRow(qPrintable(file)) << file;
-}
-#endif
-
-#if QT_CONFIG(process) && !defined(QTEST_CROSS_COMPILED) // sources not available when cross compiled
-void tst_qmlmin::qmlMinify()
-{
- QFETCH(QString, file);
-
- QProcess qmlminify;
-
- // Restrict line width to 100 characters
- qmlminify.start(qmlminPath, QStringList() << QLatin1String("--verify-only") << QLatin1String("-w100") << file);
- qmlminify.waitForFinished();
-
- QCOMPARE(qmlminify.error(), QProcess::UnknownError);
- QCOMPARE(qmlminify.exitStatus(), QProcess::NormalExit);
-
- if (isInvalidFile(file))
- QCOMPARE(qmlminify.exitCode(), EXIT_FAILURE); // cannot minify files with syntax errors
- else
- QCOMPARE(qmlminify.exitCode(), 0);
-}
-#endif
-
-QTEST_MAIN(tst_qmlmin)
-
-#include "tst_qmlmin.moc"
diff --git a/tests/auto/qml/qmlplugindump/data/dumper/ExtendedType/plugins.qmltypes b/tests/auto/qml/qmlplugindump/data/dumper/ExtendedType/plugins.qmltypes
index d84eb0011a..5c5ae73ca5 100644
--- a/tests/auto/qml/qmlplugindump/data/dumper/ExtendedType/plugins.qmltypes
+++ b/tests/auto/qml/qmlplugindump/data/dumper/ExtendedType/plugins.qmltypes
@@ -27,9 +27,9 @@ Module {
"dumper.ExtendedType/Type 1.0",
"dumper.ExtendedType/Type 1.1"
]
- exportMetaObjectRevisions: [0, 101]
+ exportMetaObjectRevisions: [0, 257]
Property { name: "baseProperty"; type: "int" }
- Property { name: "extendedProperty"; revision: 101; type: "int" }
- Property { name: "data"; revision: 101; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "extendedProperty"; revision: 257; type: "int" }
+ Property { name: "data"; revision: 257; type: "QObject"; isList: true; isReadonly: true }
}
}
diff --git a/tests/auto/qml/qmlplugindump/data/dumper/Versions/plugins.qmltypes b/tests/auto/qml/qmlplugindump/data/dumper/Versions/plugins.qmltypes
index 3a33590139..ce003fc535 100644
--- a/tests/auto/qml/qmlplugindump/data/dumper/Versions/plugins.qmltypes
+++ b/tests/auto/qml/qmlplugindump/data/dumper/Versions/plugins.qmltypes
@@ -15,9 +15,9 @@ Module {
"dumper.Versions/Versions 1.0",
"dumper.Versions/Versions 1.1"
]
- exportMetaObjectRevisions: [0, 1]
+ exportMetaObjectRevisions: [0, 65281]
Property { name: "foo"; type: "int" }
- Property { name: "bar"; revision: 1; type: "int" }
- Property { name: "baz"; revision: 2; type: "int" }
+ Property { name: "bar"; revision: 65281; type: "int" }
+ Property { name: "baz"; revision: 65282; type: "int" }
}
}
diff --git a/tests/auto/qml/qqmldirparser/tst_qqmldirparser.cpp b/tests/auto/qml/qqmldirparser/tst_qqmldirparser.cpp
index bc4ba9437c..db79adac6c 100644
--- a/tests/auto/qml/qqmldirparser/tst_qqmldirparser.cpp
+++ b/tests/auto/qml/qqmldirparser/tst_qqmldirparser.cpp
@@ -94,7 +94,8 @@ namespace {
QString toString(const QQmlDirParser::Component &c)
{
return c.typeName + QLatin1Char('|') + c.fileName + QLatin1Char('|')
- + QString::number(c.majorVersion) + QLatin1Char('|') + QString::number(c.minorVersion)
+ + QString::number(c.version.majorVersion()) + QLatin1Char('|')
+ + QString::number(c.version.minorVersion())
+ QLatin1Char('|') + (c.internal ? "true" : "false");
}
@@ -112,7 +113,8 @@ namespace {
QString toString(const QQmlDirParser::Script &s)
{
return s.nameSpace + QLatin1Char('|') + s.fileName + QLatin1Char('|')
- + QString::number(s.majorVersion) + '|' + QString::number(s.minorVersion);
+ + QString::number(s.version.majorVersion()) + '|'
+ + QString::number(s.version.minorVersion());
}
QStringList toStringList(const QList<QQmlDirParser::Script> &scripts)
@@ -248,7 +250,7 @@ void tst_qqmldirparser::parse_data()
<< "unversioned-component/qmldir"
<< QStringList()
<< QStringList()
- << (QStringList() << "foo|bar|-1|-1|false")
+ << (QStringList() << "foo|bar|255|255|false")
<< QStringList()
<< QStringList()
<< false;
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index 2a1457d818..61dc393998 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -5771,7 +5771,7 @@ void tst_qqmlecmascript::sequenceConversionRead()
QVERIFY(seq != nullptr);
// we haven't registered QList<NonRegisteredType> as a sequence type.
- QString warningOne = QLatin1String("QMetaProperty::read: Unable to handle unregistered datatype 'QList<NonRegisteredType>' for property 'MySequenceConversionObject::typeListProperty'");
+ QString warningOne = QLatin1String("QMetaProperty::read: Unable to handle unregistered datatype 'QVector<NonRegisteredType>' for property 'MySequenceConversionObject::typeListProperty'");
QString warningTwo = qmlFile.toString() + QLatin1String(":18: TypeError: Cannot read property 'length' of undefined");
QTest::ignoreMessage(QtWarningMsg, warningOne.toLatin1().constData());
QTest::ignoreMessage(QtWarningMsg, warningTwo.toLatin1().constData());
@@ -5781,7 +5781,7 @@ void tst_qqmlecmascript::sequenceConversionRead()
// QList<NonRegisteredType> has not been registered as a sequence type.
QCOMPARE(object->property("pointListLength").toInt(), 0);
QVERIFY(!object->property("pointList").isValid());
- QTest::ignoreMessage(QtWarningMsg, "QMetaProperty::read: Unable to handle unregistered datatype 'QList<NonRegisteredType>' for property 'MySequenceConversionObject::typeListProperty'");
+ QTest::ignoreMessage(QtWarningMsg, "QMetaProperty::read: Unable to handle unregistered datatype 'QVector<NonRegisteredType>' for property 'MySequenceConversionObject::typeListProperty'");
QQmlProperty seqProp(seq, "typeListProperty", &engine);
QVERIFY(!seqProp.read().isValid()); // not a valid/known sequence type
@@ -5937,7 +5937,7 @@ void tst_qqmlecmascript::sequenceConversionBindings()
{
QUrl qmlFile = testFileUrl("sequenceConversion.bindings.error.qml");
- QString warning = QString(QLatin1String("%1:17:9: Unable to assign QList<int> to QList<bool>")).arg(qmlFile.toString());
+ QString warning = QString(QLatin1String("%1:17:9: Unable to assign QVector<int> to QVector<bool>")).arg(qmlFile.toString());
QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData());
QQmlComponent component(&engine, qmlFile);
QObject *object = component.create();
diff --git a/tests/auto/qml/qqmlengine/data/qtqmlModule.10.qml b/tests/auto/qml/qqmlengine/data/qtqmlModule.10.qml
new file mode 100644
index 0000000000..3fc0cc217d
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/qtqmlModule.10.qml
@@ -0,0 +1,4 @@
+import QtQml 6.50
+
+QtObject {
+}
diff --git a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp
index cfbbd2a94c..0081243a88 100644
--- a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp
+++ b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp
@@ -687,9 +687,9 @@ void tst_qqmlengine::qtqmlModule_data()
<< QString(testFileUrl("qtqmlModule.3.qml").toString() + QLatin1String(":1 module \"QtQml\" version 1.0 is not installed\n"))
<< QStringList();
- QTest::newRow("import QtQml of incorrect version (2.50)")
+ QTest::newRow("import QtQml of old version (2.50)")
<< testFileUrl("qtqmlModule.4.qml")
- << QString(testFileUrl("qtqmlModule.4.qml").toString() + QLatin1String(":1 module \"QtQml\" version 2.50 is not installed\n"))
+ << QString()
<< QStringList();
QTest::newRow("QtQml 2.0 module provides Component, QtObject, Connections, Binding and Timer")
@@ -716,6 +716,11 @@ void tst_qqmlengine::qtqmlModule_data()
<< testFileUrl("qtqmlModule.9.qml")
<< QString(testFileUrl("qtqmlModule.9.qml").toString() + QLatin1String(":4 Item is not a type\n"))
<< QStringList();
+
+ QTest::newRow("import QtQml of incorrect version (6.50)")
+ << testFileUrl("qtqmlModule.10.qml")
+ << QString(testFileUrl("qtqmlModule.10.qml").toString() + QLatin1String(":1 module \"QtQml\" version 6.50 is not installed\n"))
+ << QStringList();
}
// Test that the engine registers the QtQml module
diff --git a/tests/auto/qml/qqmlenginecleanup/tst_qqmlenginecleanup.cpp b/tests/auto/qml/qqmlenginecleanup/tst_qqmlenginecleanup.cpp
index 846ac842db..26b2b839ea 100644
--- a/tests/auto/qml/qqmlenginecleanup/tst_qqmlenginecleanup.cpp
+++ b/tests/auto/qml/qqmlenginecleanup/tst_qqmlenginecleanup.cpp
@@ -78,7 +78,8 @@ void tst_qqmlenginecleanup::test_qmlClearTypeRegistrations()
QUrl testFile = testFileUrl("types.qml");
const auto qmlTypeForTestType = []() {
- return QQmlMetaType::qmlType(QStringLiteral("TestTypeCpp"), QStringLiteral("Test"), 2, 0);
+ return QQmlMetaType::qmlType(QStringLiteral("TestTypeCpp"), QStringLiteral("Test"),
+ QTypeRevision::fromVersion(2, 0));
};
QVERIFY(!qmlTypeForTestType().isValid());
diff --git a/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp b/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp
index 9c865b3f73..6e95ddfdea 100644
--- a/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp
+++ b/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp
@@ -190,7 +190,9 @@ void tst_QQmlImport::completeQmldirPaths()
QFETCH(int, minorVersion);
QFETCH(QStringList, expectedPaths);
- QCOMPARE(QQmlImports::completeQmldirPaths(uri, basePaths, majorVersion, minorVersion), expectedPaths);
+ QCOMPARE(QQmlImports::completeQmldirPaths(
+ uri, basePaths, QTypeRevision::fromVersion(majorVersion, minorVersion)),
+ expectedPaths);
}
class QmldirUrlInterceptor : public QQmlAbstractUrlInterceptor {
diff --git a/tests/auto/qml/qqmlitemmodels/qtestmodel.h b/tests/auto/qml/qqmlitemmodels/qtestmodel.h
index 6a022b3135..de42253708 100644
--- a/tests/auto/qml/qqmlitemmodels/qtestmodel.h
+++ b/tests/auto/qml/qqmlitemmodels/qtestmodel.h
@@ -31,6 +31,8 @@
#include <QtCore/qabstractitemmodel.h>
+#include <limits.h>
+
class TestModel: public QAbstractItemModel
{
Q_OBJECT
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index bd23806e3a..9440fcaad4 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -324,6 +324,7 @@ private slots:
void listContainingDeletedObject();
void overrideSingleton();
+ void revisionedPropertyOfAttachedObjectProperty();
void arrayToContainer();
void qualifiedScopeInCustomParser();
@@ -5529,6 +5530,85 @@ void tst_qqmllanguage::overrideSingleton()
check("uncreatable", "UncreatableSingleton");
}
+class AttachedObject;
+class InnerObject : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(bool revisionedProperty READ revisionedProperty WRITE setRevisionedProperty
+ NOTIFY revisionedPropertyChanged REVISION 2)
+
+public:
+ InnerObject(QObject *parent = nullptr) : QObject(parent) {}
+
+ bool revisionedProperty() const { return m_revisionedProperty; }
+ void setRevisionedProperty(bool revisionedProperty)
+ {
+ if (revisionedProperty != m_revisionedProperty) {
+ m_revisionedProperty = revisionedProperty;
+ emit revisionedPropertyChanged();
+ }
+ }
+
+ static AttachedObject *qmlAttachedProperties(QObject *object);
+
+signals:
+ Q_REVISION(2) void revisionedPropertyChanged();
+
+private:
+ bool m_revisionedProperty = false;
+};
+
+class AttachedObject : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(InnerObject *attached READ attached CONSTANT)
+
+public:
+ explicit AttachedObject(QObject *parent = nullptr) :
+ QObject(parent),
+ m_attached(new InnerObject(this))
+ {}
+
+ InnerObject *attached() const { return m_attached; }
+
+private:
+ InnerObject *m_attached;
+};
+
+class OuterObject : public QObject
+{
+ Q_OBJECT
+public:
+ explicit OuterObject(QObject *parent = nullptr) : QObject(parent) {}
+};
+
+AttachedObject *InnerObject::qmlAttachedProperties(QObject *object)
+{
+ return new AttachedObject(object);
+}
+
+QML_DECLARE_TYPE(InnerObject)
+QML_DECLARE_TYPEINFO(InnerObject, QML_HAS_ATTACHED_PROPERTIES)
+
+void tst_qqmllanguage::revisionedPropertyOfAttachedObjectProperty()
+{
+ qmlRegisterAnonymousType<AttachedObject>("foo", 2);
+ qmlRegisterType<InnerObject>("foo", 2, 0, "InnerObject");
+ qmlRegisterType<InnerObject, 2>("foo", 2, 2, "InnerObject");
+ qmlRegisterType<OuterObject>("foo", 2, 2, "OuterObject");
+
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData("import foo 2.2\n"
+ "OuterObject {\n"
+ " InnerObject.attached.revisionedProperty: true\n"
+ "}", QUrl());
+
+ QVERIFY(component.isReady());
+ QScopedPointer<QObject> obj(component.create());
+ QVERIFY(!obj.isNull());
+}
+
void tst_qqmllanguage::inlineComponent()
{
QFETCH(QUrl, componentUrl);
diff --git a/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp b/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp
index 296d1b14e0..c8e6e9c935 100644
--- a/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp
+++ b/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp
@@ -217,13 +217,14 @@ void tst_qqmlmetatype::qmlPropertyValueInterceptorCast()
void tst_qqmlmetatype::qmlType()
{
- QQmlType type = QQmlMetaType::qmlType(QString("ParserStatusTestType"), QString("Test"), 1, 0);
+ QQmlType type = QQmlMetaType::qmlType(QString("ParserStatusTestType"), QString("Test"),
+ QTypeRevision::fromVersion(1, 0));
QVERIFY(type.isValid());
QVERIFY(type.module() == QLatin1String("Test"));
QVERIFY(type.elementName() == QLatin1String("ParserStatusTestType"));
QCOMPARE(type.qmlTypeName(), QLatin1String("Test/ParserStatusTestType"));
- type = QQmlMetaType::qmlType("Test/ParserStatusTestType", 1, 0);
+ type = QQmlMetaType::qmlType("Test/ParserStatusTestType", QTypeRevision::fromVersion(1, 0));
QVERIFY(type.isValid());
QVERIFY(type.module() == QLatin1String("Test"));
QVERIFY(type.elementName() == QLatin1String("ParserStatusTestType"));
@@ -282,19 +283,22 @@ void tst_qqmlmetatype::defaultObject()
void tst_qqmlmetatype::registrationType()
{
- QQmlType type = QQmlMetaType::qmlType(QString("TestType"), QString("Test"), 1, 0);
+ QQmlType type = QQmlMetaType::qmlType(QString("TestType"), QString("Test"),
+ QTypeRevision::fromVersion(1, 0));
QVERIFY(type.isValid());
QVERIFY(!type.isInterface());
QVERIFY(!type.isSingleton());
QVERIFY(!type.isComposite());
- type = QQmlMetaType::qmlType(QString("TestTypeSingleton"), QString("Test"), 1, 0);
+ type = QQmlMetaType::qmlType(QString("TestTypeSingleton"), QString("Test"),
+ QTypeRevision::fromVersion(1, 0));
QVERIFY(type.isValid());
QVERIFY(!type.isInterface());
QVERIFY(type.isSingleton());
QVERIFY(!type.isComposite());
- type = QQmlMetaType::qmlType(QString("TestTypeComposite"), QString("Test"), 1, 0);
+ type = QQmlMetaType::qmlType(QString("TestTypeComposite"), QString("Test"),
+ QTypeRevision::fromVersion(1, 0));
QVERIFY(type.isValid());
QVERIFY(!type.isInterface());
QVERIFY(!type.isSingleton());
@@ -310,7 +314,8 @@ void tst_qqmlmetatype::compositeType()
QScopedPointer<QObject> obj(c.create());
QVERIFY(obj);
- QQmlType type = QQmlMetaType::qmlType(QString("ImplicitType"), QString(""), 1, 0);
+ QQmlType type = QQmlMetaType::qmlType(QString("ImplicitType"), QString(""),
+ QTypeRevision::fromVersion(1, 0));
QVERIFY(type.isValid());
QVERIFY(type.module().isEmpty());
QCOMPARE(type.elementName(), QLatin1String("ImplicitType"));
@@ -380,10 +385,12 @@ void tst_qqmlmetatype::unregisterCustomType()
int controllerId = 0;
{
QQmlEngine engine;
- QQmlType type = QQmlMetaType::qmlType(QString("Controller"), QString("mytypes"), 1, 0);
+ QQmlType type = QQmlMetaType::qmlType(QString("Controller"), QString("mytypes"),
+ QTypeRevision::fromVersion(1, 0));
QVERIFY(!type.isValid());
controllerId = qmlRegisterType<Controller1>("mytypes", 1, 0, "Controller");
- type = QQmlMetaType::qmlType(QString("Controller"), QString("mytypes"), 1, 0);
+ type = QQmlMetaType::qmlType(QString("Controller"), QString("mytypes"),
+ QTypeRevision::fromVersion(1, 0));
QVERIFY(type.isValid());
QVERIFY(!type.isInterface());
QVERIFY(!type.isSingleton());
@@ -403,10 +410,12 @@ void tst_qqmlmetatype::unregisterCustomType()
QQmlMetaType::unregisterType(controllerId);
{
QQmlEngine engine;
- QQmlType type = QQmlMetaType::qmlType(QString("Controller"), QString("mytypes"), 1, 0);
+ QQmlType type = QQmlMetaType::qmlType(QString("Controller"), QString("mytypes"),
+ QTypeRevision::fromVersion(1, 0));
QVERIFY(!type.isValid());
controllerId = qmlRegisterType<Controller2>("mytypes", 1, 0, "Controller");
- type = QQmlMetaType::qmlType(QString("Controller"), QString("mytypes"), 1, 0);
+ type = QQmlMetaType::qmlType(QString("Controller"), QString("mytypes"),
+ QTypeRevision::fromVersion(1, 0));
QVERIFY(type.isValid());
QVERIFY(!type.isInterface());
QVERIFY(!type.isSingleton());
@@ -426,10 +435,12 @@ void tst_qqmlmetatype::unregisterCustomType()
QQmlMetaType::unregisterType(controllerId);
{
QQmlEngine engine;
- QQmlType type = QQmlMetaType::qmlType(QString("Controller"), QString("mytypes"), 1, 0);
+ QQmlType type = QQmlMetaType::qmlType(QString("Controller"), QString("mytypes"),
+ QTypeRevision::fromVersion(1, 0));
QVERIFY(!type.isValid());
controllerId = qmlRegisterType<Controller1>("mytypes", 1, 0, "Controller");
- type = QQmlMetaType::qmlType(QString("Controller"), QString("mytypes"), 1, 0);
+ type = QQmlMetaType::qmlType(QString("Controller"), QString("mytypes"),
+ QTypeRevision::fromVersion(1, 0));
QVERIFY(type.isValid());
QVERIFY(!type.isInterface());
QVERIFY(!type.isSingleton());
@@ -480,7 +491,8 @@ void tst_qqmlmetatype::unregisterCustomSingletonType()
{
QQmlEngine engine;
staticProviderId = qmlRegisterSingletonType<StaticProvider1>("mytypes", 1, 0, "StaticProvider", createStaticProvider1);
- QQmlType type = QQmlMetaType::qmlType(QString("StaticProvider"), QString("mytypes"), 1, 0);
+ QQmlType type = QQmlMetaType::qmlType(QString("StaticProvider"), QString("mytypes"),
+ QTypeRevision::fromVersion(1, 0));
QVERIFY(type.isValid());
QVERIFY(!type.isInterface());
QVERIFY(type.isSingleton());
@@ -496,7 +508,8 @@ void tst_qqmlmetatype::unregisterCustomSingletonType()
{
QQmlEngine engine;
staticProviderId = qmlRegisterSingletonType<StaticProvider2>("mytypes", 1, 0, "StaticProvider", createStaticProvider2);
- QQmlType type = QQmlMetaType::qmlType(QString("StaticProvider"), QString("mytypes"), 1, 0);
+ QQmlType type = QQmlMetaType::qmlType(QString("StaticProvider"), QString("mytypes"),
+ QTypeRevision::fromVersion(1, 0));
QVERIFY(type.isValid());
QVERIFY(!type.isInterface());
QVERIFY(type.isSingleton());
@@ -512,7 +525,8 @@ void tst_qqmlmetatype::unregisterCustomSingletonType()
{
QQmlEngine engine;
staticProviderId = qmlRegisterSingletonType<StaticProvider1>("mytypes", 1, 0, "StaticProvider", createStaticProvider1);
- QQmlType type = QQmlMetaType::qmlType(QString("StaticProvider"), QString("mytypes"), 1, 0);
+ QQmlType type = QQmlMetaType::qmlType(QString("StaticProvider"), QString("mytypes"),
+ QTypeRevision::fromVersion(1, 0));
QVERIFY(type.isValid());
QVERIFY(!type.isInterface());
QVERIFY(type.isSingleton());
@@ -548,7 +562,8 @@ void tst_qqmlmetatype::unregisterAttachedProperties()
QQmlComponent c(&e);
c.setData("import QtQuick 2.2\n Item { }", dummy);
- const QQmlType attachedType = QQmlMetaType::qmlType("QtQuick/KeyNavigation", 2, 2);
+ const QQmlType attachedType = QQmlMetaType::qmlType("QtQuick/KeyNavigation",
+ QTypeRevision::fromVersion(2, 2));
QCOMPARE(attachedType.attachedPropertiesType(QQmlEnginePrivate::get(&e)),
attachedType.metaObject());
@@ -568,7 +583,8 @@ void tst_qqmlmetatype::unregisterAttachedProperties()
"import QtQuick 2.2 \n"
"Item { KeyNavigation.up: null }", dummy);
- const QQmlType attachedType = QQmlMetaType::qmlType("QtQuick/KeyNavigation", 2, 2);
+ const QQmlType attachedType = QQmlMetaType::qmlType("QtQuick/KeyNavigation",
+ QTypeRevision::fromVersion(2, 2));
QCOMPARE(attachedType.attachedPropertiesType(QQmlEnginePrivate::get(&e)),
attachedType.metaObject());
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/importsMixedQmlCppPlugin.2.qml b/tests/auto/qml/qqmlmoduleplugin/data/importsMixedQmlCppPlugin.2.qml
index b13b2004c2..ba6bb3d7ac 100644
--- a/tests/auto/qml/qqmlmoduleplugin/data/importsMixedQmlCppPlugin.2.qml
+++ b/tests/auto/qml/qqmlmoduleplugin/data/importsMixedQmlCppPlugin.2.qml
@@ -1,5 +1,6 @@
import org.qtproject.AutoTestQmlMixedPluginType 1.5
import QtQuick 2.0
+import QtQml 2.0
Item {
property bool test: false
diff --git a/tests/auto/qml/qqmlmoduleplugin/data/importsMixedQmlCppPlugin.qml b/tests/auto/qml/qqmlmoduleplugin/data/importsMixedQmlCppPlugin.qml
index 563c0b28e3..f1268075c1 100644
--- a/tests/auto/qml/qqmlmoduleplugin/data/importsMixedQmlCppPlugin.qml
+++ b/tests/auto/qml/qqmlmoduleplugin/data/importsMixedQmlCppPlugin.qml
@@ -1,5 +1,6 @@
import org.qtproject.AutoTestQmlMixedPluginType 1.0
import QtQuick 2.0
+import QtQml 2.0
Item {
property bool test: false
diff --git a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp
index 75885bc84a..f15d53d022 100644
--- a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp
@@ -34,6 +34,10 @@
#include <QtCore/qjsondocument.h>
#include <QtCore/qjsonarray.h>
#include <QDebug>
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+#include <QCborMap>
+#include <QCborValue>
+#endif
#if defined(Q_OS_MAC)
// For _PC_CASE_SENSITIVE
@@ -131,8 +135,7 @@ QByteArray SecondStaticPlugin::metaData;
template <typename PluginType>
void registerStaticPlugin(const char *uri)
{
- QStaticPlugin plugin;
- plugin.instance = []() {
+ auto instanceFunctor = []() {
static PluginType plugin;
return static_cast<QObject*>(&plugin);
};
@@ -143,12 +146,28 @@ void registerStaticPlugin(const char *uri)
uris.append(uri);
md.insert(QStringLiteral("uri"), uris);
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+ PluginType::metaData.append(QLatin1String("QTMETADATA !"));
+ PluginType::metaData.append(char(0)); // current version
+ PluginType::metaData.append(char(QT_VERSION_MAJOR));
+ PluginType::metaData.append(char(QT_VERSION_MINOR));
+ PluginType::metaData.append(char(qPluginArchRequirements()));
+ PluginType::metaData.append(QCborValue(QCborMap::fromJsonObject(md)).toCbor());
+
+ auto rawMetaDataFunctor = []() -> QPluginMetaData {
+ return {reinterpret_cast<const uchar *>(PluginType::metaData.constData()), size_t(PluginType::metaData.length())};
+ };
+ QStaticPlugin plugin(instanceFunctor, rawMetaDataFunctor);
+#else
PluginType::metaData.append(QLatin1String("QTMETADATA "));
PluginType::metaData.append(QJsonDocument(md).toBinaryData());
+ QStaticPlugin plugin;
+ plugin.instance = instanceFunctor;
plugin.rawMetaData = []() {
return PluginType::metaData.constData();
};
+#endif
qRegisterStaticPluginFunction(plugin);
};
diff --git a/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp b/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp
index c7d09f9d6e..8483bd1f95 100644
--- a/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp
+++ b/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp
@@ -38,6 +38,7 @@
#include <qtest.h>
#include <QDir>
#include <QDebug>
+#include <QRegularExpression>
#include <cstdlib>
class tst_qqmlparser : public QQmlDataTest
@@ -68,6 +69,8 @@ private slots:
void typeAssertion();
void annotations_data();
void annotations();
+ void invalidImportVersion_data();
+ void invalidImportVersion();
private:
QStringList excludedDirs;
@@ -585,6 +588,47 @@ void tst_qqmlparser::annotations()
}
}
+void tst_qqmlparser::invalidImportVersion_data()
+{
+ QTest::addColumn<QString>("expression");
+
+ const QStringList segments = {
+ "0", "255", "500", "3030303030303030303030303"
+ };
+
+ for (const QString &major : segments) {
+ if (major != "0") {
+ QTest::addRow("%s", qPrintable(major))
+ << QString::fromLatin1("import Foo %1").arg(major);
+ }
+
+ for (const QString &minor : segments) {
+ if (major == "0" && minor == "0")
+ continue;
+
+ QTest::addRow("%s.%s", qPrintable(major), qPrintable(minor))
+ << QString::fromLatin1("import Foo %1.%2").arg(major).arg(minor);
+ }
+ }
+
+
+}
+
+void tst_qqmlparser::invalidImportVersion()
+{
+ QFETCH(QString, expression);
+
+ QQmlJS::Engine engine;
+ QQmlJS::Lexer lexer(&engine);
+ lexer.setCode(expression, 1);
+ QQmlJS::Parser parser(&engine);
+ QVERIFY(!parser.parse());
+
+ QRegularExpression regexp(
+ "^Invalid (major )?version. Version numbers must be >= 0 and < 255\\.$");
+ QVERIFY(regexp.match(parser.errorMessage()).hasMatch());
+}
+
QTEST_MAIN(tst_qqmlparser)
#include "tst_qqmlparser.moc"
diff --git a/tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp b/tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp
index c9e92cd3c9..2e040eec18 100644
--- a/tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp
+++ b/tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp
@@ -114,7 +114,8 @@ void tst_qqmlpropertycache::properties()
DerivedObject object;
const QMetaObject *metaObject = object.metaObject();
- QQmlRefPointer<QQmlPropertyCache> cache(new QQmlPropertyCache(metaObject));
+ QQmlRefPointer<QQmlPropertyCache> cache(new QQmlPropertyCache(metaObject),
+ QQmlRefPointer<QQmlPropertyCache>::Adopt);
QQmlPropertyData *data;
QVERIFY((data = cacheProperty(cache, "propertyA")));
@@ -136,8 +137,11 @@ void tst_qqmlpropertycache::propertiesDerived()
DerivedObject object;
const QMetaObject *metaObject = object.metaObject();
- QQmlRefPointer<QQmlPropertyCache> parentCache(new QQmlPropertyCache(&BaseObject::staticMetaObject));
- QQmlRefPointer<QQmlPropertyCache> cache(parentCache->copyAndAppend(object.metaObject()));
+ QQmlRefPointer<QQmlPropertyCache> parentCache(
+ new QQmlPropertyCache(&BaseObject::staticMetaObject),
+ QQmlRefPointer<QQmlPropertyCache>::Adopt);
+ QQmlRefPointer<QQmlPropertyCache> cache(parentCache->copyAndAppend(object.metaObject()),
+ QQmlRefPointer<QQmlPropertyCache>::Adopt);
QQmlPropertyData *data;
QVERIFY((data = cacheProperty(cache, "propertyA")));
@@ -161,8 +165,11 @@ void tst_qqmlpropertycache::revisionedProperties()
DerivedObject object;
const QMetaObject *metaObject = object.metaObject();
- QQmlRefPointer<QQmlPropertyCache> cacheWithoutVersion(new QQmlPropertyCache(metaObject));
- QQmlRefPointer<QQmlPropertyCache> cacheWithVersion(new QQmlPropertyCache(metaObject, 1));
+ QQmlRefPointer<QQmlPropertyCache> cacheWithoutVersion(new QQmlPropertyCache(metaObject),
+ QQmlRefPointer<QQmlPropertyCache>::Adopt);
+ QQmlRefPointer<QQmlPropertyCache> cacheWithVersion(
+ new QQmlPropertyCache(metaObject, QTypeRevision::fromMinorVersion(1)),
+ QQmlRefPointer<QQmlPropertyCache>::Adopt);
QQmlPropertyData *data;
QVERIFY((data = cacheProperty(cacheWithoutVersion, "propertyE")));
@@ -176,7 +183,8 @@ void tst_qqmlpropertycache::methods()
DerivedObject object;
const QMetaObject *metaObject = object.metaObject();
- QQmlRefPointer<QQmlPropertyCache> cache(new QQmlPropertyCache(metaObject));
+ QQmlRefPointer<QQmlPropertyCache> cache(new QQmlPropertyCache(metaObject),
+ QQmlRefPointer<QQmlPropertyCache>::Adopt);
QQmlPropertyData *data;
QVERIFY((data = cacheProperty(cache, "slotA")));
@@ -210,8 +218,11 @@ void tst_qqmlpropertycache::methodsDerived()
DerivedObject object;
const QMetaObject *metaObject = object.metaObject();
- QQmlRefPointer<QQmlPropertyCache> parentCache(new QQmlPropertyCache(&BaseObject::staticMetaObject));
- QQmlRefPointer<QQmlPropertyCache> cache(parentCache->copyAndAppend(object.metaObject()));
+ QQmlRefPointer<QQmlPropertyCache> parentCache(
+ new QQmlPropertyCache(&BaseObject::staticMetaObject),
+ QQmlRefPointer<QQmlPropertyCache>::Adopt);
+ QQmlRefPointer<QQmlPropertyCache> cache(parentCache->copyAndAppend(object.metaObject()),
+ QQmlRefPointer<QQmlPropertyCache>::Adopt);
QQmlPropertyData *data;
QVERIFY((data = cacheProperty(cache, "slotA")));
@@ -245,7 +256,8 @@ void tst_qqmlpropertycache::signalHandlers()
DerivedObject object;
const QMetaObject *metaObject = object.metaObject();
- QQmlRefPointer<QQmlPropertyCache> cache(new QQmlPropertyCache(metaObject));
+ QQmlRefPointer<QQmlPropertyCache> cache(new QQmlPropertyCache(metaObject),
+ QQmlRefPointer<QQmlPropertyCache>::Adopt);
QQmlPropertyData *data;
QVERIFY((data = cacheProperty(cache, "onSignalA")));
@@ -273,8 +285,11 @@ void tst_qqmlpropertycache::signalHandlersDerived()
DerivedObject object;
const QMetaObject *metaObject = object.metaObject();
- QQmlRefPointer<QQmlPropertyCache> parentCache(new QQmlPropertyCache(&BaseObject::staticMetaObject));
- QQmlRefPointer<QQmlPropertyCache> cache(parentCache->copyAndAppend(object.metaObject()));
+ QQmlRefPointer<QQmlPropertyCache> parentCache(
+ new QQmlPropertyCache(&BaseObject::staticMetaObject),
+ QQmlRefPointer<QQmlPropertyCache>::Adopt);
+ QQmlRefPointer<QQmlPropertyCache> cache(parentCache->copyAndAppend(object.metaObject()),
+ QQmlRefPointer<QQmlPropertyCache>::Adopt);
QQmlPropertyData *data;
QVERIFY((data = cacheProperty(cache, "onSignalA")));
@@ -478,7 +493,9 @@ class TestClassWithClassInfo : public QObject
int(sizeof(arr) / sizeof(arr[0]))
#define TEST_CLASS(Class) \
- QTest::newRow(#Class) << &Class::staticMetaObject << ARRAY_SIZE(qt_meta_data_##Class) << ARRAY_SIZE(qt_meta_stringdata_##Class.data)
+ QTest::newRow(#Class) \
+ << &Class::staticMetaObject << ARRAY_SIZE(qt_meta_data_##Class) \
+ << int(sizeof(qt_meta_stringdata_##Class.offsetsAndSize) / (sizeof(uint) * 2))
Q_DECLARE_METATYPE(const QMetaObject*);
diff --git a/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp b/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp
index 1a54397f1a..4a2e6841e7 100644
--- a/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp
+++ b/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp
@@ -168,15 +168,13 @@ void tst_qqmlqt::initTestCase()
void tst_qqmlqt::enums()
{
QQmlComponent component(&engine, testFileUrl("enums.qml"));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
QCOMPARE(object->property("test1").toInt(), (int)Qt::Key_Escape);
QCOMPARE(object->property("test2").toInt(), (int)Qt::DescendingOrder);
QCOMPARE(object->property("test3").toInt(), (int)Qt::ElideMiddle);
QCOMPARE(object->property("test4").toInt(), (int)Qt::AlignRight);
-
- delete object;
}
void tst_qqmlqt::rgba()
@@ -188,7 +186,7 @@ void tst_qqmlqt::rgba()
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
@@ -198,8 +196,6 @@ void tst_qqmlqt::rgba()
QCOMPARE(qvariant_cast<QColor>(object->property("test4")), QColor());
QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor::fromRgbF(1, 1, 1, 1));
QCOMPARE(qvariant_cast<QColor>(object->property("test6")), QColor::fromRgbF(0, 0, 0, 0));
-
- delete object;
}
void tst_qqmlqt::hsla()
@@ -211,7 +207,7 @@ void tst_qqmlqt::hsla()
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromHslF(1, 0, 0, 0.8));
@@ -220,8 +216,6 @@ void tst_qqmlqt::hsla()
QCOMPARE(qvariant_cast<QColor>(object->property("test4")), QColor());
QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor::fromHslF(1, 1, 1, 1));
QCOMPARE(qvariant_cast<QColor>(object->property("test6")), QColor::fromHslF(0, 0, 0, 0));
-
- delete object;
}
void tst_qqmlqt::hsva()
@@ -233,7 +227,7 @@ void tst_qqmlqt::hsva()
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromHsvF(1, 0, 0, 0.8));
@@ -242,8 +236,6 @@ void tst_qqmlqt::hsva()
QCOMPARE(qvariant_cast<QColor>(object->property("test4")), QColor());
QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor::fromHsvF(1, 1, 1, 1));
QCOMPARE(qvariant_cast<QColor>(object->property("test6")), QColor::fromHsvF(0, 0, 0, 0));
-
- delete object;
}
void tst_qqmlqt::colorEqual()
@@ -261,7 +253,7 @@ void tst_qqmlqt::colorEqual()
QTest::ignoreMessage(QtWarningMsg, qPrintable(component.url().toString() + ":34: Error: Qt.colorEqual(): Invalid color name"));
QTest::ignoreMessage(QtWarningMsg, qPrintable(component.url().toString() + ":35: Error: Qt.colorEqual(): Invalid color name"));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
QCOMPARE(object->property("test1a").toBool(), false);
@@ -325,8 +317,6 @@ void tst_qqmlqt::colorEqual()
QCOMPARE(object->property("test6c").toBool(), true);
QCOMPARE(object->property("test6d").toBool(), false);
QCOMPARE(object->property("test6e").toBool(), false);
-
- delete object;
}
void tst_qqmlqt::rect()
@@ -338,7 +328,7 @@ void tst_qqmlqt::rect()
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
QCOMPARE(qvariant_cast<QRectF>(object->property("test1")), QRectF(10, 13, 100, 109));
@@ -346,8 +336,6 @@ void tst_qqmlqt::rect()
QCOMPARE(qvariant_cast<QRectF>(object->property("test3")), QRectF());
QCOMPARE(qvariant_cast<QRectF>(object->property("test4")), QRectF());
QCOMPARE(qvariant_cast<QRectF>(object->property("test5")), QRectF(10, 13, 100, -109));
-
- delete object;
}
void tst_qqmlqt::point()
@@ -359,15 +347,13 @@ void tst_qqmlqt::point()
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
QCOMPARE(qvariant_cast<QPointF>(object->property("test1")), QPointF(19, 34));
QCOMPARE(qvariant_cast<QPointF>(object->property("test2")), QPointF(-3, 109.2));
QCOMPARE(qvariant_cast<QPointF>(object->property("test3")), QPointF());
QCOMPARE(qvariant_cast<QPointF>(object->property("test4")), QPointF());
-
- delete object;
}
void tst_qqmlqt::size()
@@ -379,7 +365,7 @@ void tst_qqmlqt::size()
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
QCOMPARE(qvariant_cast<QSizeF>(object->property("test1")), QSizeF(19, 34));
@@ -387,8 +373,6 @@ void tst_qqmlqt::size()
QCOMPARE(qvariant_cast<QSizeF>(object->property("test3")), QSizeF(-3, 10));
QCOMPARE(qvariant_cast<QSizeF>(object->property("test4")), QSizeF());
QCOMPARE(qvariant_cast<QSizeF>(object->property("test5")), QSizeF());
-
- delete object;
}
void tst_qqmlqt::vector2d()
@@ -400,15 +384,13 @@ void tst_qqmlqt::vector2d()
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
QCOMPARE(qvariant_cast<QVector2D>(object->property("test1")), QVector2D(1, 0.9f));
QCOMPARE(qvariant_cast<QVector2D>(object->property("test2")), QVector2D(102, -982.1f));
QCOMPARE(qvariant_cast<QVector2D>(object->property("test3")), QVector2D());
QCOMPARE(qvariant_cast<QVector2D>(object->property("test4")), QVector2D());
-
- delete object;
}
void tst_qqmlqt::vector3d()
@@ -420,15 +402,13 @@ void tst_qqmlqt::vector3d()
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
QCOMPARE(qvariant_cast<QVector3D>(object->property("test1")), QVector3D(1, 0, 0.9f));
QCOMPARE(qvariant_cast<QVector3D>(object->property("test2")), QVector3D(102, -10, -982.1f));
QCOMPARE(qvariant_cast<QVector3D>(object->property("test3")), QVector3D());
QCOMPARE(qvariant_cast<QVector3D>(object->property("test4")), QVector3D());
-
- delete object;
}
void tst_qqmlqt::vector4d()
@@ -440,15 +420,13 @@ void tst_qqmlqt::vector4d()
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
QCOMPARE(qvariant_cast<QVector4D>(object->property("test1")), QVector4D(1, 0, 0.9f, 0.6f));
QCOMPARE(qvariant_cast<QVector4D>(object->property("test2")), QVector4D(102, -10, -982.1f, 10));
QCOMPARE(qvariant_cast<QVector4D>(object->property("test3")), QVector4D());
QCOMPARE(qvariant_cast<QVector4D>(object->property("test4")), QVector4D());
-
- delete object;
}
void tst_qqmlqt::quaternion()
@@ -460,15 +438,13 @@ void tst_qqmlqt::quaternion()
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
QCOMPARE(qvariant_cast<QQuaternion>(object->property("test1")), QQuaternion(2, 17, 0.9f, 0.6f));
QCOMPARE(qvariant_cast<QQuaternion>(object->property("test2")), QQuaternion(102, -10, -982.1f, 10));
QCOMPARE(qvariant_cast<QQuaternion>(object->property("test3")), QQuaternion());
QCOMPARE(qvariant_cast<QQuaternion>(object->property("test4")), QQuaternion());
-
- delete object;
}
void tst_qqmlqt::matrix4x4()
@@ -482,7 +458,7 @@ void tst_qqmlqt::matrix4x4()
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning3));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
QCOMPARE(qvariant_cast<QMatrix4x4>(object->property("test1")), QMatrix4x4(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16));
@@ -490,8 +466,6 @@ void tst_qqmlqt::matrix4x4()
QCOMPARE(qvariant_cast<QMatrix4x4>(object->property("test3")), QMatrix4x4());
QCOMPARE(qvariant_cast<QMatrix4x4>(object->property("test4")), QMatrix4x4());
QCOMPARE(qvariant_cast<QMatrix4x4>(object->property("test5")), QMatrix4x4());
-
- delete object;
}
void tst_qqmlqt::font()
@@ -503,7 +477,7 @@ void tst_qqmlqt::font()
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
QFont f;
@@ -516,8 +490,6 @@ void tst_qqmlqt::font()
QCOMPARE(qvariant_cast<QFont>(object->property("test2")), f);
QCOMPARE(qvariant_cast<QFont>(object->property("test3")), QFont());
QCOMPARE(qvariant_cast<QFont>(object->property("test4")), QFont());
-
- delete object;
}
void tst_qqmlqt::lighter()
@@ -529,7 +501,7 @@ void tst_qqmlqt::lighter()
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromRgbF(1, 0.8, 0.3).lighter());
@@ -538,8 +510,6 @@ void tst_qqmlqt::lighter()
QCOMPARE(qvariant_cast<QColor>(object->property("test4")), QColor("red").lighter());
QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor());
QCOMPARE(qvariant_cast<QColor>(object->property("test6")), QColor());
-
- delete object;
}
void tst_qqmlqt::darker()
@@ -551,7 +521,7 @@ void tst_qqmlqt::darker()
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromRgbF(1, 0.8, 0.3).darker());
@@ -560,8 +530,6 @@ void tst_qqmlqt::darker()
QCOMPARE(qvariant_cast<QColor>(object->property("test4")), QColor("red").darker());
QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor());
QCOMPARE(qvariant_cast<QColor>(object->property("test6")), QColor());
-
- delete object;
}
void tst_qqmlqt::tint()
@@ -574,7 +542,7 @@ void tst_qqmlqt::tint()
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromRgbF(0, 0, 1));
@@ -583,8 +551,6 @@ void tst_qqmlqt::tint()
QCOMPARE(test3.rgba(), 0xFF7F0080);
QCOMPARE(qvariant_cast<QColor>(object->property("test4")), QColor());
QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor());
-
- delete object;
}
class MyUrlHandler : public QObject
@@ -607,7 +573,7 @@ void tst_qqmlqt::openUrlExternally()
QDesktopServices::setUrlHandler("file", &handler, "noteCall");
QQmlComponent component(&engine, testFileUrl("openUrlExternally.qml"));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
QCOMPARE(handler.called,1);
QCOMPARE(handler.last, QUrl("test:url"));
@@ -629,7 +595,7 @@ void tst_qqmlqt::openUrlExternally_pragmaLibrary()
QDesktopServices::setUrlHandler("file", &handler, "noteCall");
QQmlComponent component(&engine, testFileUrl("openUrlExternally_lib.qml"));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
QCOMPARE(handler.called,1);
QCOMPARE(handler.last, QUrl("test:url"));
@@ -650,42 +616,37 @@ void tst_qqmlqt::md5()
QString warning1 = component.url().toString() + ":4: Error: Qt.md5(): Invalid arguments";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
QCOMPARE(object->property("test2").toString(), QLatin1String(QCryptographicHash::hash("Hello World", QCryptographicHash::Md5).toHex()));
-
- delete object;
}
void tst_qqmlqt::createComponent()
{
{
- QQmlComponent component(&engine, testFileUrl("createComponent.qml"));
-
- QString warning1 = component.url().toString() + ":9: Error: Qt.createComponent(): Invalid arguments";
- QString warning2 = component.url().toString() + ":10: Error: Qt.createComponent(): Invalid arguments";
- QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
- QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+ QQmlComponent component(&engine, testFileUrl("createComponent.qml"));
- QObject *object = component.create();
- QVERIFY(object != nullptr);
+ QString warning1 = component.url().toString() + ":9: Error: Qt.createComponent(): Invalid arguments";
+ QString warning2 = component.url().toString() + ":10: Error: Qt.createComponent(): Invalid arguments";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
- QCOMPARE(object->property("absoluteUrl").toString(), QString("http://www.example.com/test.qml"));
- QCOMPARE(object->property("relativeUrl").toString(), testFileUrl("createComponentData.qml").toString());
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(object != nullptr);
- QTRY_VERIFY(object->property("asyncResult").toBool());
+ QCOMPARE(object->property("absoluteUrl").toString(), QString("http://www.example.com/test.qml"));
+ QCOMPARE(object->property("relativeUrl").toString(), testFileUrl("createComponentData.qml").toString());
- delete object;
+ QTRY_VERIFY(object->property("asyncResult").toBool());
}
// simultaneous sync and async compilation
{
- QQmlComponent component(&engine, testFileUrl("createComponent.2.qml"));
- QObject *object = component.create();
- QVERIFY(object != nullptr);
- QTRY_VERIFY(object->property("success").toBool());
- delete object;
+ QQmlComponent component(&engine, testFileUrl("createComponent.2.qml"));
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(object != nullptr);
+ QTRY_VERIFY(object->property("success").toBool());
}
}
@@ -693,11 +654,10 @@ void tst_qqmlqt::createComponent_pragmaLibrary()
{
// Currently, just loading createComponent_lib.qml causes crash on some platforms
QQmlComponent component(&engine, testFileUrl("createComponent_lib.qml"));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
QCOMPARE(object->property("status").toInt(), int(QQmlComponent::Ready));
QCOMPARE(object->property("readValue").toInt(), int(1913));
- delete object;
}
void tst_qqmlqt::createQmlObject()
@@ -717,17 +677,15 @@ void tst_qqmlqt::createQmlObject()
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning5));
QTest::ignoreMessage(QtDebugMsg, qPrintable(warning6));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
QCOMPARE(object->property("emptyArg").toBool(), true);
QCOMPARE(object->property("success").toBool(), true);
- QQuickItem *item = qobject_cast<QQuickItem *>(object);
+ QQuickItem *item = qobject_cast<QQuickItem *>(object.data());
QVERIFY(item != nullptr);
QCOMPARE(item->childItems().count(), 1);
-
- delete object;
}
@@ -750,7 +708,7 @@ void tst_qqmlqt::dateTimeConversion()
QQmlEngine eng;
QQmlComponent component(&eng, testFileUrl("dateTimeConversion.qml"));
- QObject *obj = component.create();
+ QScopedPointer<QObject> obj(component.create());
QCOMPARE(obj->property("qdate").toDate(), date);
QCOMPARE(obj->property("qtime").toTime(), time);
@@ -955,7 +913,7 @@ void tst_qqmlqt::dateTimeFormattingWithLocale()
void tst_qqmlqt::isQtObject()
{
QQmlComponent component(&engine, testFileUrl("isQtObject.qml"));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
QCOMPARE(object->property("test1").toBool(), true);
@@ -963,8 +921,6 @@ void tst_qqmlqt::isQtObject()
QCOMPARE(object->property("test3").toBool(), false);
QCOMPARE(object->property("test4").toBool(), false);
QCOMPARE(object->property("test5").toBool(), false);
-
- delete object;
}
void tst_qqmlqt::btoa()
@@ -974,12 +930,10 @@ void tst_qqmlqt::btoa()
QString warning1 = component.url().toString() + ":4: Error: Qt.btoa(): Invalid arguments";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
QCOMPARE(object->property("test2").toString(), QString("SGVsbG8gd29ybGQh"));
-
- delete object;
}
void tst_qqmlqt::atob()
@@ -989,12 +943,10 @@ void tst_qqmlqt::atob()
QString warning1 = component.url().toString() + ":4: Error: Qt.atob(): Invalid arguments";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
QCOMPARE(object->property("test2").toString(), QString("Hello world!"));
-
- delete object;
}
void tst_qqmlqt::fontFamilies()
@@ -1004,13 +956,11 @@ void tst_qqmlqt::fontFamilies()
QString warning1 = component.url().toString() + ":4: Error: Qt.fontFamilies(): Invalid arguments";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
QFontDatabase database;
QCOMPARE(object->property("test2"), QVariant::fromValue(database.families()));
-
- delete object;
}
void tst_qqmlqt::quit()
@@ -1018,11 +968,9 @@ void tst_qqmlqt::quit()
QQmlComponent component(&engine, testFileUrl("quit.qml"));
QSignalSpy spy(&engine, SIGNAL(quit()));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
QCOMPARE(spy.count(), 1);
-
- delete object;
}
void tst_qqmlqt::exit()
@@ -1030,26 +978,22 @@ void tst_qqmlqt::exit()
QQmlComponent component(&engine, testFileUrl("exit.qml"));
QSignalSpy spy(&engine, &QQmlEngine::exit);
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
QCOMPARE(spy.count(), 1);
QList<QVariant> arguments = spy.takeFirst();
QVERIFY(arguments.at(0).toInt() == object->property("returnCode").toInt());
-
- delete object;
}
void tst_qqmlqt::resolvedUrl()
{
QQmlComponent component(&engine, testFileUrl("resolvedUrl.qml"));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
QCOMPARE(object->property("result").toString(), component.url().toString());
QCOMPARE(object->property("isString").toBool(), true);
-
- delete object;
}
void tst_qqmlqt::later_data()
@@ -1133,11 +1077,11 @@ void tst_qqmlqt::later()
QTest::ignoreMessage(QtWarningMsg, qPrintable(w));
QQmlComponent component(&engine, testFileUrl("later.qml"));
- QObject *root = component.create();
+ QScopedPointer<QObject> root(component.create());
QVERIFY(root != nullptr);
if (!function.isEmpty())
- QMetaObject::invokeMethod(root, qPrintable(function));
+ QMetaObject::invokeMethod(root.data(), qPrintable(function));
for (int i = 0; i < propNames.size(); ++i) {
if (propNames.at(i) == QLatin1String("processEvents")) {
@@ -1149,21 +1093,13 @@ void tst_qqmlqt::later()
QCOMPARE(root->property(qPrintable(propNames.at(i))), values.at(i));
}
}
-
- delete root;
}
void tst_qqmlqt::qtObjectContents()
{
- struct StaticQtMetaObject : public QObject
- {
- static const QMetaObject *get()
- { return &staticQtMetaObject; }
- };
-
QQmlComponent component(&engine, testFileUrl("qtObjectContents.qml"));
- QObject *object = component.create();
+ QScopedPointer<QObject> object(component.create());
QVERIFY(object != nullptr);
QVERIFY(object->property("values").canConvert<QJSValue>());
@@ -1171,7 +1107,7 @@ void tst_qqmlqt::qtObjectContents()
QSet<const char *> keys;
int uniqueKeys = 0;
- const QMetaObject *qtMetaObject = StaticQtMetaObject::get();
+ const QMetaObject *qtMetaObject = &Qt::staticMetaObject;
for (int ii = 0; ii < qtMetaObject->enumeratorCount(); ++ii) {
QMetaEnum enumerator = qtMetaObject->enumerator(ii);
for (int jj = 0; jj < enumerator.keyCount(); ++jj) {
@@ -1194,8 +1130,6 @@ void tst_qqmlqt::qtObjectContents()
QCOMPARE(values.value("Synchronous").toInt(), 1);
++uniqueKeys;
QCOMPARE(values.count(), uniqueKeys);
-
- delete object;
}
class TimeProvider: public QObject
@@ -1289,7 +1223,8 @@ void tst_qqmlqt::timeRoundtrip()
QQmlEngine eng;
//qmlRegisterSingletonInstance("Test", 1, 0, "TimeProvider", &tp);
QQmlComponent component(&eng, testFileUrl("timeRoundtrip.qml"));
- QObject *obj = component.createWithInitialProperties({{"tp", QVariant::fromValue(&tp)}});
+ QScopedPointer<QObject> obj(component.createWithInitialProperties(
+ {{"tp", QVariant::fromValue(&tp)}}));
QVERIFY(obj != nullptr);
// QML reads m_getTime and saves the result as m_putTime; this should come out the same, without
diff --git a/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp b/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp
index 4e42d02514..0168663cf2 100644
--- a/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp
+++ b/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp
@@ -311,7 +311,7 @@ void tst_qqmltimer::restart()
{
QQmlEngine engine;
QQmlComponent component(&engine);
- component.setData(QByteArray("import QtQml 2.0\nTimer { interval: 500; repeat: true; running: true }"), QUrl::fromLocalFile(""));
+ component.setData(QByteArray("import QtQml 2.0\nTimer { interval: 1000; repeat: true; running: true }"), QUrl::fromLocalFile(""));
QQmlTimer *timer = qobject_cast<QQmlTimer*>(component.create());
QVERIFY(timer != nullptr);
@@ -319,14 +319,16 @@ void tst_qqmltimer::restart()
connect(timer, SIGNAL(triggered()), &helper, SLOT(timeout()));
QCOMPARE(helper.count, 0);
- consistentWait(600);
+ consistentWait(1200);
QCOMPARE(helper.count, 1);
- consistentWait(300);
+ consistentWait(500);
+ QCOMPARE(helper.count, 1);
timer->restart();
+ QCOMPARE(helper.count, 1);
- consistentWait(700);
+ consistentWait(1400);
QCOMPARE(helper.count, 2);
QVERIFY(timer->isRunning());
diff --git a/tests/auto/qml/qqmltypeloader/dummy_imports.qml b/tests/auto/qml/qqmltypeloader/dummy_imports.qml
new file mode 100644
index 0000000000..a4684b2007
--- /dev/null
+++ b/tests/auto/qml/qqmltypeloader/dummy_imports.qml
@@ -0,0 +1,9 @@
+// This file exists for the sole purpose for qmlimportscanner to find
+// which modules it needs to extract for deployment.
+// Otherwise, it fails to find the imports that are expressed in the
+// C++ code belonging to the test.
+
+import QtQml 2.0
+import QtQuick 2.6
+
+QtObject { } // This is needed in order to keep importscanner happy
diff --git a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp
index 266a4e97d6..9ec3e9557b 100644
--- a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp
+++ b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp
@@ -63,10 +63,15 @@ private slots:
void implicitImport();
void compositeSingletonCycle();
void declarativeCppType();
+private:
+ void checkSingleton(const QString & dataDirectory);
};
void tst_QQMLTypeLoader::testLoadComplete()
{
+#ifdef Q_OS_ANDROID
+ QSKIP("Loading dynamic plugins does not work on Android");
+#endif
QQuickView *window = new QQuickView();
window->engine()->addImportPath(QT_TESTCASE_BUILDDIR);
qDebug() << window->engine()->importPathList();
@@ -170,7 +175,7 @@ void tst_QQMLTypeLoader::trimCache3()
QCOMPARE(loader.isTypeLoaded(testFileUrl("ComponentWithIncubator.qml")), false);
}
-static void checkSingleton(const QString &dataDirectory)
+void tst_QQMLTypeLoader::checkSingleton(const QString &dataDirectory)
{
QQmlEngine engine;
engine.addImportPath(dataDirectory);
@@ -179,8 +184,8 @@ static void checkSingleton(const QString &dataDirectory)
"import QtQuick 2.6\n"
"import \"..\"\n"
"Item { property int t: ValueSource.something }",
- QUrl::fromLocalFile(dataDirectory + "/abc/Xyz.qml"));
- QCOMPARE(component.status(), QQmlComponent::Ready);
+ testFileUrl("abc/Xyz.qml"));
+ QVERIFY2(component.status() == QQmlComponent::Ready, qPrintable(component.errorString()));
QScopedPointer<QObject> o(component.create());
QVERIFY(o.data());
QCOMPARE(o->property("t").toInt(), 10);
@@ -402,6 +407,9 @@ public:
void tst_QQMLTypeLoader::intercept()
{
+#ifdef Q_OS_ANDROID
+ QSKIP("Loading dynamic plugins does not work on Android");
+#endif
qmlClearTypeRegistrations();
QQmlEngine engine;
@@ -491,6 +499,9 @@ static void checkCleanCacheLoad(const QString &testCase)
void tst_QQMLTypeLoader::multiSingletonModule()
{
+#ifdef Q_OS_ANDROID
+ QSKIP("Android seems to have problems with QProcess");
+#endif
qmlClearTypeRegistrations();
QQmlEngine engine;
engine.addImportPath(testFile("imports"));
@@ -511,6 +522,9 @@ void tst_QQMLTypeLoader::multiSingletonModule()
void tst_QQMLTypeLoader::implicitComponentModule()
{
+#ifdef Q_OS_ANDROID
+ QSKIP("Android seems to have problems with QProcess");
+#endif
QQmlEngine engine;
QQmlComponent component(&engine, testFileUrl("implicitcomponent.qml"));
QCOMPARE(component.status(), QQmlComponent::Ready);
diff --git a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.pro b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.pro
index 19834ff537..c868474b5b 100644
--- a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.pro
+++ b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.pro
@@ -15,3 +15,5 @@ QML_IMPORT_VERSION = 3.2
QML_IMPORT_NAME = "declarative.import.for.typeloader.test"
include (../../shared/util.pri)
+
+TESTDATA = data/*
diff --git a/tests/auto/qml/qqmlvaluetypes/data/font_write.qml b/tests/auto/qml/qqmlvaluetypes/data/font_write.qml
index ff4d0a1004..4d3ae32025 100644
--- a/tests/auto/qml/qqmlvaluetypes/data/font_write.qml
+++ b/tests/auto/qml/qqmlvaluetypes/data/font_write.qml
@@ -3,7 +3,7 @@ import Test 1.0
MyTypeObject {
font.family: if(1) "Helvetica"
font.bold: if(1) false
- font.weight: "Normal"
+ font.weight: 50
font.italic: if(1) false
font.underline: if(1) false
font.overline: if(1) false
diff --git a/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp b/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp
index ae794e76a9..2c08c33fc8 100644
--- a/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp
+++ b/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp
@@ -1133,15 +1133,16 @@ void tst_qqmlxmlhttprequest::sendFileRequest()
#if QT_CONFIG(process)
void tst_qqmlxmlhttprequest::sendFileRequestNotSet() {
if (qEnvironmentVariableIsSet("TEST_CUSTOM_PERMISSIONS")) {
- // Test with no settings
- // Should just result in warnings in Qt 5
- doFileRequest([](QObject* object, QTemporaryFile &writeFile) {
- QTRY_COMPARE(object->property("readResult").toString(), testString);
+ // Test with no settings, neither reading nor writing should work
+ doFileRequest([](QObject *object, QTemporaryFile &writeFile) {
+ QTest::qWait(1000);
- QTRY_VERIFY(object->property("writeDone").toBool());
+ // Verify that the read has not yielded any value
+ QVERIFY(object->property("readResult").isNull());
+ // Check that the file stays empty
QVERIFY(writeFile.open());
- QCOMPARE(QString::fromUtf8(writeFile.readAll()), testString);
+ QCOMPARE(QString::fromUtf8(writeFile.readAll()), "");
writeFile.close();
});
return;
@@ -1161,22 +1162,25 @@ void tst_qqmlxmlhttprequest::sendFileRequestNotSet() {
// Check exit code
QCOMPARE(child.exitCode(), 0);
- // Check if all warnings were printed
+ // Check if all errors were printed
QString output = QString::fromUtf8(child.readAllStandardOutput());
+ // Due to differences in line endings on Windows, check for the error lines individually
+ const QStringList readingError = {
+ QLatin1String("XMLHttpRequest: Using GET on a local file is disabled by default."),
+ QLatin1String("Set QML_XHR_ALLOW_FILE_READ to 1 to enable this feature.")
+ };
- const QString readingWarning = QLatin1String(
- "XMLHttpRequest: Using GET on a local file is dangerous "
- "and will be disabled by default in a future Qt version."
- "Set QML_XHR_ALLOW_FILE_READ to 1 if you wish to continue using this feature.");
+ const QStringList writingError = {
+ QLatin1String("XMLHttpRequest: Using PUT on a local file is disabled by default."),
+ QLatin1String("Set QML_XHR_ALLOW_FILE_WRITE to 1 to enable this feature.")
+ };
- const QString writingWarning = QLatin1String(
- "XMLHttpRequest: Using PUT on a local file is dangerous "
- "and will be disabled by default in a future Qt version."
- "Set QML_XHR_ALLOW_FILE_WRITE to 1 if you wish to continue using this feature.");
+ for (const auto &readingErrorLine : readingError)
+ QVERIFY(output.contains(readingErrorLine));
- QVERIFY(output.contains(readingWarning));
- QVERIFY(output.contains(writingWarning));
+ for (const auto &writingErrorLine : writingError)
+ QVERIFY(output.contains(writingErrorLine));
}
#endif