diff options
Diffstat (limited to 'tests')
89 files changed, 601 insertions, 2248 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 7e96205743..627347df06 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 4b0cbfa1aa..fea5c836e3 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 4d4056ba3f..7e053a027d 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(); @@ -5538,6 +5539,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/data/formatting.qml b/tests/auto/qml/qqmlqt/data/formatting.qml index f2d1e1b5c8..14af9ba88b 100644 --- a/tests/auto/qml/qqmlqt/data/formatting.qml +++ b/tests/auto/qml/qqmlqt/data/formatting.qml @@ -1,4 +1,4 @@ -import QtQuick 2.0 +import QtQuick 2.15 QtObject { property date dateFromString: "2008-12-24" @@ -8,7 +8,7 @@ QtObject { var v = eval(prop) return [ Qt.formatDate(v), - Qt.formatDate(v, Qt.DefaultLocaleLongDate), + Qt.formatDate(v, Qt.locale(), Locale.LongFormat), Qt.formatDate(v, "ddd MMMM d yy") ] } @@ -17,7 +17,7 @@ QtObject { var v = eval(prop) return [ Qt.formatTime(v), - Qt.formatTime(v, Qt.DefaultLocaleLongDate), + Qt.formatTime(v, Qt.locale(), Locale.LongFormat), Qt.formatTime(v, "H:m:s a"), Qt.formatTime(v, "hh:mm:ss.zzz") ] @@ -27,7 +27,7 @@ QtObject { var v = eval(prop) return [ Qt.formatDateTime(v), - Qt.formatDateTime(v, Qt.DefaultLocaleLongDate), + Qt.formatDateTime(v, Qt.locale(), Locale.LongFormat), Qt.formatDateTime(v, "M/d/yy H:m:s a") ] } diff --git a/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp b/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp index 1a54397f1a..60ee2a4d1c 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); @@ -816,8 +774,6 @@ void tst_qqmlqt::dateTimeFormatting() void tst_qqmlqt::dateTimeFormatting_data() { - QT_WARNING_PUSH QT_WARNING_DISABLE_DEPRECATED - // Test intentionally uses deprecated enumerators from Qt::DateFormat QTest::addColumn<QString>("method"); QTest::addColumn<QStringList>("inputProperties"); QTest::addColumn<QStringList>("expectedResults"); @@ -829,25 +785,24 @@ void tst_qqmlqt::dateTimeFormatting_data() QTest::newRow("formatDate") << "formatDate" << (QStringList() << "dateFromString" << "jsdate" << "qdate" << "qdatetime") - << (QStringList() << date.toString(Qt::DefaultLocaleShortDate) - << date.toString(Qt::DefaultLocaleLongDate) + << (QStringList() << QLocale().toString(date, QLocale::ShortFormat) + << QLocale().toString(date, QLocale::LongFormat) << date.toString("ddd MMMM d yy")); QTest::newRow("formatTime") << "formatTime" << (QStringList() << "jsdate" << "qtime" << "qdatetime") - << (QStringList() << time.toString(Qt::DefaultLocaleShortDate) - << time.toString(Qt::DefaultLocaleLongDate) + << (QStringList() << QLocale().toString(time, QLocale::ShortFormat) + << QLocale().toString(time, QLocale::LongFormat) << time.toString("H:m:s a") << time.toString("hh:mm:ss.zzz")); QTest::newRow("formatDateTime") << "formatDateTime" << (QStringList() << "jsdate" << "qdatetime") - << (QStringList() << dateTime.toString(Qt::DefaultLocaleShortDate) - << dateTime.toString(Qt::DefaultLocaleLongDate) + << (QStringList() << QLocale().toString(dateTime, QLocale::ShortFormat) + << QLocale().toString(dateTime, QLocale::LongFormat) << dateTime.toString("M/d/yy H:m:s a")); - QT_WARNING_POP } void tst_qqmlqt::dateTimeFormattingVariants() @@ -886,8 +841,6 @@ void tst_qqmlqt::dateTimeFormattingVariants() void tst_qqmlqt::dateTimeFormattingVariants_data() { - QT_WARNING_PUSH QT_WARNING_DISABLE_DEPRECATED - // Test intentionally uses deprecated enumerators from Qt::DateFormat QTest::addColumn<QString>("method"); QTest::addColumn<QVariant>("variant"); QTest::addColumn<QStringList>("expectedResults"); @@ -896,39 +849,124 @@ void tst_qqmlqt::dateTimeFormattingVariants_data() QTime time(11, 16, 39, 755); temporary = QDateTime(QDate(1970,1,1), time); - QTest::newRow("formatTime, qtime") << "formatTime" << QVariant::fromValue(time) << (QStringList() << temporary.time().toString(Qt::DefaultLocaleShortDate) << temporary.time().toString(Qt::DefaultLocaleLongDate) << temporary.time().toString("H:m:s a") << temporary.time().toString("hh:mm:ss.zzz")); + QTest::newRow("formatTime, qtime") + << "formatTime" << QVariant::fromValue(time) + << (QStringList() + << QLocale().toString(temporary.time(), QLocale::ShortFormat) + << QLocale().toString(temporary.time(), QLocale::LongFormat) + << temporary.time().toString("H:m:s a") + << temporary.time().toString("hh:mm:ss.zzz")); QDate date(2011,5,31); // V4 reads the date in UTC but DateObject::toQDateTime() gives it back in local time: temporary = QDateTime(date, QTime(0, 0, 0), Qt::UTC).toLocalTime(); - QTest::newRow("formatDate, qdate") << "formatDate" << QVariant::fromValue(date) << (QStringList() << temporary.date().toString(Qt::DefaultLocaleShortDate) << temporary.date().toString(Qt::DefaultLocaleLongDate) << temporary.date().toString("ddd MMMM d yy")); - QTest::newRow("formatDateTime, qdate") << "formatDateTime" << QVariant::fromValue(date) << (QStringList() << temporary.toString(Qt::DefaultLocaleShortDate) << temporary.toString(Qt::DefaultLocaleLongDate) << temporary.toString("M/d/yy H:m:s a")); - QTest::newRow("formatTime, qdate") << "formatTime" << QVariant::fromValue(date) << (QStringList() << temporary.time().toString(Qt::DefaultLocaleShortDate) << temporary.time().toString(Qt::DefaultLocaleLongDate) << temporary.time().toString("H:m:s a") << temporary.time().toString("hh:mm:ss.zzz")); + QTest::newRow("formatDate, qdate") + << "formatDate" << QVariant::fromValue(date) + << (QStringList() + << QLocale().toString(temporary.date(), QLocale::ShortFormat) + << QLocale().toString(temporary.date(), QLocale::LongFormat) + << temporary.date().toString("ddd MMMM d yy")); + QTest::newRow("formatDateTime, qdate") + << "formatDateTime" << QVariant::fromValue(date) + << (QStringList() + << QLocale().toString(temporary, QLocale::ShortFormat) + << QLocale().toString(temporary, QLocale::LongFormat) + << temporary.toString("M/d/yy H:m:s a")); + QTest::newRow("formatTime, qdate") + << "formatTime" << QVariant::fromValue(date) + << (QStringList() + << QLocale().toString(temporary.time(), QLocale::ShortFormat) + << QLocale().toString(temporary.time(), QLocale::LongFormat) + << temporary + .time().toString("H:m:s a") << temporary.time().toString("hh:mm:ss.zzz")); QDateTime dateTime(date, time); temporary = dateTime; - QTest::newRow("formatDate, qdatetime") << "formatDate" << QVariant::fromValue(dateTime) << (QStringList() << temporary.date().toString(Qt::DefaultLocaleShortDate) << temporary.date().toString(Qt::DefaultLocaleLongDate) << temporary.date().toString("ddd MMMM d yy")); - QTest::newRow("formatDateTime, qdatetime") << "formatDateTime" << QVariant::fromValue(dateTime) << (QStringList() << temporary.toString(Qt::DefaultLocaleShortDate) << temporary.toString(Qt::DefaultLocaleLongDate) << temporary.toString("M/d/yy H:m:s a")); - QTest::newRow("formatTime, qdatetime") << "formatTime" << QVariant::fromValue(dateTime) << (QStringList() << temporary.time().toString(Qt::DefaultLocaleShortDate) << temporary.time().toString(Qt::DefaultLocaleLongDate) << temporary.time().toString("H:m:s a") << temporary.time().toString("hh:mm:ss.zzz")); + QTest::newRow("formatDate, qdatetime") + << "formatDate" << QVariant::fromValue(dateTime) + << (QStringList() + << QLocale().toString(temporary.date(), QLocale::ShortFormat) + << QLocale().toString(temporary.date(), QLocale::LongFormat) + << temporary.date().toString("ddd MMMM d yy")); + QTest::newRow("formatDateTime, qdatetime") + << "formatDateTime" << QVariant::fromValue(dateTime) + << (QStringList() + << QLocale().toString(temporary, QLocale::ShortFormat) + << QLocale().toString(temporary, QLocale::LongFormat) + << temporary.toString("M/d/yy H:m:s a")); + QTest::newRow("formatTime, qdatetime") + << "formatTime" << QVariant::fromValue(dateTime) + << (QStringList() + << QLocale().toString(temporary.time(), QLocale::ShortFormat) + << QLocale().toString(temporary.time(), QLocale::LongFormat) + << temporary.time().toString("H:m:s a") + << temporary.time().toString("hh:mm:ss.zzz")); QString string(QLatin1String("2011/05/31 11:16:39.755")); temporary = QDateTime::fromString(string, "yyyy/MM/dd HH:mm:ss.zzz"); - QTest::newRow("formatDate, qstring") << "formatDate" << QVariant::fromValue(string) << (QStringList() << temporary.date().toString(Qt::DefaultLocaleShortDate) << temporary.date().toString(Qt::DefaultLocaleLongDate) << temporary.date().toString("ddd MMMM d yy")); - QTest::newRow("formatDateTime, qstring") << "formatDateTime" << QVariant::fromValue(string) << (QStringList() << temporary.toString(Qt::DefaultLocaleShortDate) << temporary.toString(Qt::DefaultLocaleLongDate) << temporary.toString("M/d/yy H:m:s a")); - QTest::newRow("formatTime, qstring") << "formatTime" << QVariant::fromValue(string) << (QStringList() << temporary.time().toString(Qt::DefaultLocaleShortDate) << temporary.time().toString(Qt::DefaultLocaleLongDate) << temporary.time().toString("H:m:s a") << temporary.time().toString("hh:mm:ss.zzz")); + QTest::newRow("formatDate, qstring") + << "formatDate" << QVariant::fromValue(string) + << (QStringList() + << QLocale().toString(temporary.date(), QLocale::ShortFormat) + << QLocale().toString(temporary.date(), QLocale::LongFormat) + << temporary.date().toString("ddd MMMM d yy")); + QTest::newRow("formatDateTime, qstring") + << "formatDateTime" << QVariant::fromValue(string) + << (QStringList() + << QLocale().toString(temporary, QLocale::ShortFormat) + << QLocale().toString(temporary, QLocale::LongFormat) + << temporary.toString("M/d/yy H:m:s a")); + QTest::newRow("formatTime, qstring") + << "formatTime" << QVariant::fromValue(string) + << (QStringList() + << QLocale().toString(temporary.time(), QLocale::ShortFormat) + << QLocale().toString(temporary.time(), QLocale::LongFormat) + << temporary.time().toString("H:m:s a") + << temporary.time().toString("hh:mm:ss.zzz")); QColor color(Qt::red); temporary = QVariant::fromValue(color).toDateTime(); - QTest::newRow("formatDate, qcolor") << "formatDate" << QVariant::fromValue(color) << (QStringList() << temporary.date().toString(Qt::DefaultLocaleShortDate) << temporary.date().toString(Qt::DefaultLocaleLongDate) << temporary.date().toString("ddd MMMM d yy")); - QTest::newRow("formatDateTime, qcolor") << "formatDateTime" << QVariant::fromValue(color) << (QStringList() << temporary.toString(Qt::DefaultLocaleShortDate) << temporary.toString(Qt::DefaultLocaleLongDate) << temporary.toString("M/d/yy H:m:s a")); - QTest::newRow("formatTime, qcolor") << "formatTime" << QVariant::fromValue(color) << (QStringList() << temporary.time().toString(Qt::DefaultLocaleShortDate) << temporary.time().toString(Qt::DefaultLocaleLongDate) << temporary.time().toString("H:m:s a") << temporary.time().toString("hh:mm:ss.zzz")); + QTest::newRow("formatDate, qcolor") + << "formatDate" << QVariant::fromValue(color) + << (QStringList() + << QLocale().toString(temporary.date(), QLocale::ShortFormat) + << QLocale().toString(temporary.date(), QLocale::LongFormat) + << temporary.date().toString("ddd MMMM d yy")); + QTest::newRow("formatDateTime, qcolor") + << "formatDateTime" << QVariant::fromValue(color) + << (QStringList() + << QLocale().toString(temporary, QLocale::ShortFormat) + << QLocale().toString(temporary, QLocale::LongFormat) + << temporary.toString("M/d/yy H:m:s a")); + QTest::newRow("formatTime, qcolor") + << "formatTime" << QVariant::fromValue(color) + << (QStringList() + << QLocale().toString(temporary.time(), QLocale::ShortFormat) + << QLocale().toString(temporary.time(), QLocale::LongFormat) + << temporary.time().toString("H:m:s a") + << temporary.time().toString("hh:mm:ss.zzz")); int integer(4); temporary = QVariant::fromValue(integer).toDateTime(); - QTest::newRow("formatDate, int") << "formatDate" << QVariant::fromValue(integer) << (QStringList() << temporary.date().toString(Qt::DefaultLocaleShortDate) << temporary.date().toString(Qt::DefaultLocaleLongDate) << temporary.date().toString("ddd MMMM d yy")); - QTest::newRow("formatDateTime, int") << "formatDateTime" << QVariant::fromValue(integer) << (QStringList() << temporary.toString(Qt::DefaultLocaleShortDate) << temporary.toString(Qt::DefaultLocaleLongDate) << temporary.toString("M/d/yy H:m:s a")); - QTest::newRow("formatTime, int") << "formatTime" << QVariant::fromValue(integer) << (QStringList() << temporary.time().toString(Qt::DefaultLocaleShortDate) << temporary.time().toString(Qt::DefaultLocaleLongDate) << temporary.time().toString("H:m:s a") << temporary.time().toString("hh:mm:ss.zzz")); - QT_WARNING_POP + QTest::newRow("formatDate, int") + << "formatDate" << QVariant::fromValue(integer) + << (QStringList() + << QLocale().toString(temporary.date(), QLocale::ShortFormat) + << QLocale().toString(temporary.date(), QLocale::LongFormat) + << temporary.date().toString("ddd MMMM d yy")); + QTest::newRow("formatDateTime, int") + << "formatDateTime" << QVariant::fromValue(integer) + << (QStringList() + << QLocale().toString(temporary, QLocale::ShortFormat) + << QLocale().toString(temporary, QLocale::LongFormat) + << temporary.toString("M/d/yy H:m:s a")); + QTest::newRow("formatTime, int") + << "formatTime" << QVariant::fromValue(integer) + << (QStringList() + << QLocale().toString(temporary.time(), QLocale::ShortFormat) + << QLocale().toString(temporary.time(), QLocale::LongFormat) + << temporary.time().toString("H:m:s a") + << temporary.time().toString("hh:mm:ss.zzz")); } void tst_qqmlqt::dateTimeFormattingWithLocale() @@ -955,7 +993,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 +1001,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 +1010,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 +1023,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 +1036,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 +1048,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 +1058,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 +1157,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 +1173,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 +1187,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 +1210,6 @@ void tst_qqmlqt::qtObjectContents() QCOMPARE(values.value("Synchronous").toInt(), 1); ++uniqueKeys; QCOMPARE(values.count(), uniqueKeys); - - delete object; } class TimeProvider: public QObject @@ -1289,7 +1303,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 diff --git a/tests/auto/qmltest/fontloader/daniel.ttf b/tests/auto/qmltest/fontloader/daniel.ttf Binary files differnew file mode 100644 index 0000000000..aae50d5035 --- /dev/null +++ b/tests/auto/qmltest/fontloader/daniel.ttf diff --git a/tests/auto/qmltest/fontloader/tst_fontloader.qml b/tests/auto/qmltest/fontloader/tst_fontloader.qml index 0d1831230e..48b92e02ba 100644 --- a/tests/auto/qmltest/fontloader/tst_fontloader.qml +++ b/tests/auto/qmltest/fontloader/tst_fontloader.qml @@ -81,10 +81,6 @@ Item { fontloader.source = "dummy.ttf"; tryCompare(fontloader, 'status', FontLoader.Error) compare(testinput.font.family, "") - fontloader.source = ""; - fontloader.name = "Courier"; - tryCompare(fontloader, 'status', FontLoader.Ready) - compare(testinput.font.family, "Courier") } function test_fontswitching() { @@ -92,10 +88,9 @@ Item { fontswitch.source = "tarzeau_ocr_a.ttf"; tryCompare(fontswitch, 'status', FontLoader.Ready) compare(fontswitch.name, "OCRA") - fontswitch.source = ""; - fontswitch.name = "Courier"; + fontswitch.source = "daniel.ttf"; tryCompare(fontswitch, 'status', FontLoader.Ready) - compare(fontswitch.name, "Courier") + compare(fontswitch.name, "Daniel") fontswitch.source = "tarzeau_ocr_a.ttf"; tryCompare(fontswitch, 'status', FontLoader.Ready) compare(fontswitch.name, "OCRA") diff --git a/tests/auto/quick/drawingmodes/tst_drawingmodes.cpp b/tests/auto/quick/drawingmodes/tst_drawingmodes.cpp index 9bcc21c77d..39f4c3c70a 100644 --- a/tests/auto/quick/drawingmodes/tst_drawingmodes.cpp +++ b/tests/auto/quick/drawingmodes/tst_drawingmodes.cpp @@ -34,7 +34,7 @@ #include <QtQuick/qsggeometry.h> #include <QtQuick/qsgflatcolormaterial.h> #include <QtGui/qscreen.h> -#include <QtGui/qopenglcontext.h> +#include <qopenglcontext.h> #include "../../shared/util.h" diff --git a/tests/auto/quick/nodes/tst_nodestest.cpp b/tests/auto/quick/nodes/tst_nodestest.cpp index 249ecd5aa5..1b2b355596 100644 --- a/tests/auto/quick/nodes/tst_nodestest.cpp +++ b/tests/auto/quick/nodes/tst_nodestest.cpp @@ -30,7 +30,7 @@ #include <QtTest/QtTest> #include <QtGui/QOffscreenSurface> -#include <QtGui/QOpenGLContext> +#include <QOpenGLContext> #include <QtQuick/qsgnode.h> #include <QtQuick/private/qsgbatchrenderer_p.h> #include <QtQuick/private/qsgnodeupdater_p.h> diff --git a/tests/auto/quick/nokeywords/nokeywords.pro b/tests/auto/quick/nokeywords/nokeywords.pro index 6872dac22a..69e1abe43e 100644 --- a/tests/auto/quick/nokeywords/nokeywords.pro +++ b/tests/auto/quick/nokeywords/nokeywords.pro @@ -7,3 +7,5 @@ SOURCES += tst_nokeywords.cpp CONFIG+=parallel_test QT += quick core-private gui-private qml-private quick-private testlib +qtConfig(opengl): \ + QT_PRIVATE += opengl-private diff --git a/tests/auto/quick/pointerhandlers/qquickhoverhandler/BLACKLIST b/tests/auto/quick/pointerhandlers/qquickhoverhandler/BLACKLIST new file mode 100644 index 0000000000..9bb35c4770 --- /dev/null +++ b/tests/auto/quick/pointerhandlers/qquickhoverhandler/BLACKLIST @@ -0,0 +1,3 @@ +[movingItemWithHoverHandler] +macos # Can't move cursor (QTBUG-76312) + diff --git a/tests/auto/quick/pointerhandlers/qquickwheelhandler/BLACKLIST b/tests/auto/quick/pointerhandlers/qquickwheelhandler/BLACKLIST new file mode 100644 index 0000000000..2949d3371f --- /dev/null +++ b/tests/auto/quick/pointerhandlers/qquickwheelhandler/BLACKLIST @@ -0,0 +1,3 @@ +# QTBUG-81993 +[singleHandler] +macos ci diff --git a/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp b/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp index 9f616c56e2..47d6008c28 100644 --- a/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp +++ b/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp @@ -34,8 +34,8 @@ #include <private/qquickitem_p.h> #include <QtCore/qscopedpointer.h> #include <QtGui/qpainter.h> -#include <QtGui/qopenglcontext.h> -#include <QtGui/qopenglfunctions.h> +#include <qopenglcontext.h> +#include <qopenglfunctions.h> #include <QtGui/qoffscreensurface.h> #include <QtQml/qqmlproperty.h> diff --git a/tests/auto/quick/qquickanimations/BLACKLIST b/tests/auto/quick/qquickanimations/BLACKLIST new file mode 100644 index 0000000000..a1b8557128 --- /dev/null +++ b/tests/auto/quick/qquickanimations/BLACKLIST @@ -0,0 +1,2 @@ +[simplePath] +macos ci diff --git a/tests/auto/quick/qquickdesignersupport/tst_qquickdesignersupport.cpp b/tests/auto/quick/qquickdesignersupport/tst_qquickdesignersupport.cpp index b44977bd5a..062a8b5c9a 100644 --- a/tests/auto/quick/qquickdesignersupport/tst_qquickdesignersupport.cpp +++ b/tests/auto/quick/qquickdesignersupport/tst_qquickdesignersupport.cpp @@ -76,7 +76,10 @@ void tst_qquickdesignersupport::customData() QVERIFY(rootItem); - QScopedPointer<QObject> newItemScopedPointer(QQuickDesignerSupportItems::createPrimitive(QLatin1String("QtQuick/Item"), 2, 6, view->rootContext())); + QScopedPointer<QObject> newItemScopedPointer(QQuickDesignerSupportItems::createPrimitive( + QLatin1String("QtQuick/Item"), + QTypeRevision::fromVersion(2, 6), + view->rootContext())); QObject *newItem = newItemScopedPointer.data(); QVERIFY(newItem); diff --git a/tests/auto/quick/qquickfontloader/data/qtbug-20268.qml b/tests/auto/quick/qquickfontloader/data/qtbug-20268.qml index 0eafdfa17b..e9282bf2c7 100644 --- a/tests/auto/quick/qquickfontloader/data/qtbug-20268.qml +++ b/tests/auto/quick/qquickfontloader/data/qtbug-20268.qml @@ -4,7 +4,7 @@ Rectangle { id: test property variant fontloader: fontloaderelement height: 100; width: 100 - property bool usename: false + property bool useotherfont: false property int statenum: 1 property alias name: fontloaderelement.name property alias source: fontloaderelement.source @@ -15,11 +15,11 @@ Rectangle { } states: [ - State { name: "start"; when: !usename + State { name: "start"; when: !useotherfont PropertyChanges { target: fontloaderelement; source: "tarzeau_ocr_a.ttf" } }, - State { name: "changefont"; when: usename - PropertyChanges { target: fontloaderelement; name: "Tahoma" } + State { name: "changefont"; when: useotherfont + PropertyChanges { target: fontloaderelement; source: "daniel.ttf" } } ] diff --git a/tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp b/tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp index 87a5bd469a..8f6910bee4 100644 --- a/tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp +++ b/tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp @@ -45,7 +45,6 @@ public: private slots: void initTestCase(); void noFont(); - void namedFont(); void localFont(); void failLocalFont(); void webFont(); @@ -85,19 +84,6 @@ void tst_qquickfontloader::noFont() delete fontObject; } -void tst_qquickfontloader::namedFont() -{ - QString componentStr = "import QtQuick 2.0\nFontLoader { name: \"Helvetica\" }"; - QQmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QQuickFontLoader *fontObject = qobject_cast<QQuickFontLoader*>(component.create()); - - QVERIFY(fontObject != nullptr); - QCOMPARE(fontObject->source(), QUrl("")); - QCOMPARE(fontObject->name(), QString("Helvetica")); - QTRY_COMPARE(fontObject->status(), QQuickFontLoader::Ready); -} - void tst_qquickfontloader::localFont() { QString componentStr = "import QtQuick 2.0\nFontLoader { source: \"" + testFileUrl("tarzeau_ocr_a.ttf").toString() + "\" }"; @@ -223,16 +209,10 @@ void tst_qquickfontloader::changeFontSourceViaState() QVERIFY(fontObject->source() != QUrl("")); QTRY_COMPARE(fontObject->name(), QString("OCRA")); - window.rootObject()->setProperty("usename", true); - - // This warning should probably not be printed once QTBUG-20268 is fixed - QString warning = QString(testFileUrl("qtbug-20268.qml").toString()) + - QLatin1String(":13:5: QML FontLoader: Cannot load font: \"\""); - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning)); + window.rootObject()->setProperty("useotherfont", true); - QEXPECT_FAIL("", "QTBUG-20268", Abort); QTRY_COMPARE(fontObject->status(), QQuickFontLoader::Ready); - QCOMPARE(window.rootObject()->property("name").toString(), QString("Tahoma")); + QCOMPARE(window.rootObject()->property("name").toString(), QString("Daniel")); } QTEST_MAIN(tst_qquickfontloader) diff --git a/tests/auto/quick/qquickframebufferobject/tst_qquickframebufferobject.cpp b/tests/auto/quick/qquickframebufferobject/tst_qquickframebufferobject.cpp index 6aff66d61e..2327270b0f 100644 --- a/tests/auto/quick/qquickframebufferobject/tst_qquickframebufferobject.cpp +++ b/tests/auto/quick/qquickframebufferobject/tst_qquickframebufferobject.cpp @@ -30,9 +30,9 @@ #include <QtQuick/qquickitem.h> #include <QtQuick/qquickview.h> -#include <QtGui/qopenglcontext.h> -#include <QtGui/qopenglframebufferobject.h> -#include <QtGui/qopenglfunctions.h> +#include <qopenglcontext.h> +#include <qopenglframebufferobject.h> +#include <qopenglfunctions.h> #include <QtQuick/QQuickFramebufferObject> diff --git a/tests/auto/quick/qquickgraphicsinfo/tst_qquickgraphicsinfo.cpp b/tests/auto/quick/qquickgraphicsinfo/tst_qquickgraphicsinfo.cpp index 4da6da6043..aff081c4a8 100644 --- a/tests/auto/quick/qquickgraphicsinfo/tst_qquickgraphicsinfo.cpp +++ b/tests/auto/quick/qquickgraphicsinfo/tst_qquickgraphicsinfo.cpp @@ -36,7 +36,7 @@ #include "../../shared/util.h" #if QT_CONFIG(opengl) -#include <QtGui/qopenglcontext.h> +#include <qopenglcontext.h> #include <QtGui/qsurfaceformat.h> #endif diff --git a/tests/auto/quick/qquickitem/tst_qquickitem.cpp b/tests/auto/quick/qquickitem/tst_qquickitem.cpp index b5e001a2b7..137162099f 100644 --- a/tests/auto/quick/qquickitem/tst_qquickitem.cpp +++ b/tests/auto/quick/qquickitem/tst_qquickitem.cpp @@ -34,6 +34,9 @@ #include "private/qquickfocusscope_p.h" #include "private/qquickitem_p.h" #include <qpa/qwindowsysteminterface.h> +#ifdef Q_OS_WIN +#include <QOpenGLContext> +#endif #include <QDebug> #include <QTimer> #include <QQmlEngine> diff --git a/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp b/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp index 2f90632841..b45aa5d61c 100644 --- a/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp +++ b/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp @@ -31,8 +31,8 @@ #include <QtQuick/qquickitem.h> #include <QtQuick/qquickview.h> #include <QtQuick/qsgrendererinterface.h> -#include <QtGui/qopenglcontext.h> -#include <QtGui/qopenglfunctions.h> +#include <qopenglcontext.h> +#include <qopenglfunctions.h> #include "../../shared/util.h" diff --git a/tests/auto/quick/qquickmousearea/BLACKLIST b/tests/auto/quick/qquickmousearea/BLACKLIST index 6e0665271c..089bb3a873 100644 --- a/tests/auto/quick/qquickmousearea/BLACKLIST +++ b/tests/auto/quick/qquickmousearea/BLACKLIST @@ -1,3 +1,6 @@ +[pressAndHold] +macos ci + # QTBUG-78153 [nestedStopAtBounds] opensuse-leap @@ -5,4 +8,3 @@ opensuse-leap # QTBUG-82282 [pressOneAndTapAnother] opensuse-leap - diff --git a/tests/auto/quick/qquickopenglinfo/tst_qquickopenglinfo.cpp b/tests/auto/quick/qquickopenglinfo/tst_qquickopenglinfo.cpp index 3bf61e8f17..a4cbaa453d 100644 --- a/tests/auto/quick/qquickopenglinfo/tst_qquickopenglinfo.cpp +++ b/tests/auto/quick/qquickopenglinfo/tst_qquickopenglinfo.cpp @@ -32,7 +32,7 @@ #include <QtQuick/qquickitem.h> #include <QtQuick/qquickview.h> -#include <QtGui/qopenglcontext.h> +#include <qopenglcontext.h> #include <QtGui/qsurfaceformat.h> #include "../../shared/util.h" diff --git a/tests/auto/quick/qquicktext/BLACKLIST b/tests/auto/quick/qquicktext/BLACKLIST index 08a5249e2e..b551575e9d 100644 --- a/tests/auto/quick/qquicktext/BLACKLIST +++ b/tests/auto/quick/qquicktext/BLACKLIST @@ -4,3 +4,5 @@ qemu macos [fontSizeMode] opensuse-42.1 +[contentSize] +windows gcc diff --git a/tests/auto/quick/qquicktext/tst_qquicktext.cpp b/tests/auto/quick/qquicktext/tst_qquicktext.cpp index a64c9372da..19a33f1861 100644 --- a/tests/auto/quick/qquicktext/tst_qquicktext.cpp +++ b/tests/auto/quick/qquicktext/tst_qquicktext.cpp @@ -1506,7 +1506,7 @@ void tst_qquicktext::weight() delete textObject; } { - QString componentStr = "import QtQuick 2.0\nText { font.weight: \"Bold\"; text: \"Hello world!\" }"; + QString componentStr = "import QtQuick 2.0\nText { font.weight: Font.Bold; text: \"Hello world!\" }"; QQmlComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); diff --git a/tests/auto/quick/qquicktextedit/BLACKLIST b/tests/auto/quick/qquicktextedit/BLACKLIST index 36c7f0042f..b8147a0ef9 100644 --- a/tests/auto/quick/qquicktextedit/BLACKLIST +++ b/tests/auto/quick/qquicktextedit/BLACKLIST @@ -4,3 +4,7 @@ opensuse-leap # QTBUG-78846 [mouseSelectionMode] opensuse-leap + +# QTBUG-82052 +[linkHover] +macos ci diff --git a/tests/auto/quick/qquicktextinput/BLACKLIST b/tests/auto/quick/qquicktextinput/BLACKLIST index ada7c57c75..6cd24de9a9 100644 --- a/tests/auto/quick/qquicktextinput/BLACKLIST +++ b/tests/auto/quick/qquicktextinput/BLACKLIST @@ -1,3 +1,7 @@ # QTBUG-78162 [mouseSelectionMode] opensuse-leap + +# QTBUG-82058 +[setInputMask] +macos ci diff --git a/tests/auto/quick/rendernode/tst_rendernode.cpp b/tests/auto/quick/rendernode/tst_rendernode.cpp index 6ca5231343..961531db6d 100644 --- a/tests/auto/quick/rendernode/tst_rendernode.cpp +++ b/tests/auto/quick/rendernode/tst_rendernode.cpp @@ -30,8 +30,8 @@ #include <QtQuick/qquickitem.h> #include <QtQuick/qquickview.h> -#include <QtGui/qopenglcontext.h> -#include <QtGui/qopenglfunctions.h> +#include <qopenglcontext.h> +#include <qopenglfunctions.h> #include <QtGui/qscreen.h> #include <private/qsgrendernode_p.h> @@ -194,7 +194,7 @@ static bool fuzzyCompareColor(QRgb x, QRgb y, QByteArray *errorMessage) enum { fuzz = 4 }; if (qAbs(qRed(x) - qRed(y)) >= fuzz || qAbs(qGreen(x) - qGreen(y)) >= fuzz || qAbs(qBlue(x) - qBlue(y)) >= fuzz) { QString s; - QDebug(&s).nospace() << hex << "Color mismatch 0x" << x << " 0x" << y << dec << " (fuzz=" << fuzz << ")."; + QDebug(&s).nospace() << Qt::hex << "Color mismatch 0x" << x << " 0x" << y << Qt::dec << " (fuzz=" << fuzz << ")."; *errorMessage = s.toLocal8Bit(); return false; } diff --git a/tests/auto/quick/shared/visualtestutil.cpp b/tests/auto/quick/shared/visualtestutil.cpp index de2cf2bd5b..06f7386902 100644 --- a/tests/auto/quick/shared/visualtestutil.cpp +++ b/tests/auto/quick/shared/visualtestutil.cpp @@ -95,7 +95,7 @@ bool QQuickVisualTestUtil::compareImages(const QImage &ia, const QImage &ib, QSt || qAbs(qRed(a) - qRed(b)) > tolerance || qAbs(qRed(a) - qRed(b)) > tolerance) { QDebug(errorMessage) << "Mismatch at:" << x << y << ':' - << hex << showbase << a << b; + << Qt::hex << Qt::showbase << a << b; return false; } } diff --git a/tests/auto/shared/qqmljsastdumper.cpp b/tests/auto/shared/qqmljsastdumper.cpp index 5da6be6bd0..1292be8d5b 100644 --- a/tests/auto/shared/qqmljsastdumper.cpp +++ b/tests/auto/shared/qqmljsastdumper.cpp @@ -347,7 +347,9 @@ bool AstDumper::visit(AST::UiEnumMemberList *el) { bool AstDumper::visit(AST::UiVersionSpecifier *el) { start(QLatin1String("UiVersionSpecifier majorVersion=%1 minorVersion=%2 majorToken=%3 minorToken=%4") - .arg(qs(QString::number(el->majorVersion)), qs(QString::number(el->minorVersion)), loc(el->majorToken), loc(el->minorToken))); + .arg(qs(QString::number(el->version.majorVersion())), + qs(QString::number(el->version.minorVersion())), + loc(el->majorToken), loc(el->minorToken))); return true; } diff --git a/tests/auto/toolsupport/tst_toolsupport.cpp b/tests/auto/toolsupport/tst_toolsupport.cpp index f743a6f5c6..0c87d1a00c 100644 --- a/tests/auto/toolsupport/tst_toolsupport.cpp +++ b/tests/auto/toolsupport/tst_toolsupport.cpp @@ -87,7 +87,7 @@ void tst_toolsupport::offsets_data() { QTestData &data = QTest::newRow("sizeof(QObjectData)") << sizeof(QObjectData); - data << 28 << 48; // vptr + 3 ptr + 2 int + ptr + data << 36 << 64; // vptr + 4 ptr + 3 int + (padding) + ptr } { @@ -115,8 +115,8 @@ void tst_toolsupport::offsets_data() { QTestData &data - = QTest::newRow("Heap::String::text") - << pmm_to_offsetof(&QV4::Heap::String::text); + = QTest::newRow("Heap::String::textStorage") + << pmm_to_offsetof(&QV4::Heap::String::textStorage); data << 4 << 8; } diff --git a/tests/benchmarks/qml/creation/tst_creation.cpp b/tests/benchmarks/qml/creation/tst_creation.cpp index ed2e52f869..2044360b3d 100644 --- a/tests/benchmarks/qml/creation/tst_creation.cpp +++ b/tests/benchmarks/qml/creation/tst_creation.cpp @@ -196,7 +196,7 @@ void tst_creation::qobject_10tree_cpp() void tst_creation::qobject_qmltype() { - QQmlType t = QQmlMetaType::qmlType("QtQuick/QtObject", 2, 0); + QQmlType t = QQmlMetaType::qmlType("QtQuick/QtObject", QTypeRevision::fromVersion(2, 0)); QBENCHMARK { QObject *obj = t.create(); diff --git a/tests/benchmarks/qml/painting/paintbenchmark.cpp b/tests/benchmarks/qml/painting/paintbenchmark.cpp index 1500f39c9a..e1659d6837 100644 --- a/tests/benchmarks/qml/painting/paintbenchmark.cpp +++ b/tests/benchmarks/qml/painting/paintbenchmark.cpp @@ -31,7 +31,7 @@ #include <QImage> #include <QPainter> #include <QPainterPath> -#include <QGLWidget> +#include <QOpenGLWidget> #include <QTextLayout> #include <QVBoxLayout> #include <QElapsedTimer> @@ -46,7 +46,7 @@ const int spacing = 36; QSizeF size(1000, 800); const qreal lineWidth = 1000; QString strings[lines]; -QGLWidget *testWidget = 0; +QOpenGLWidget *testWidget = 0; void paint_QTextLayout(QPainter &p, bool useCache) { @@ -151,8 +151,8 @@ void paint_RoundedRect(QPainter &p) static bool first = true; if (first) { if (testWidget) { - QGLFormat format = testWidget->format(); - if (!format.sampleBuffers()) + QSurfaceFormat format = testWidget->format(); + if (format.samples() == -1) qWarning() << "Cannot paint antialiased rounded rect without sampleBuffers"; } first = false; @@ -314,10 +314,11 @@ struct { PaintFunc testFunc = 0; -class MyGLWidget : public QGLWidget +class MyGLWidget : public QOpenGLWidget { public: - MyGLWidget(const QGLFormat &format) : QGLWidget(format), frames(0) { + MyGLWidget(const QSurfaceFormat &format) : frames(0) { + setFormat(format); const char chars[] = "abcd efgh ijkl mnop qrst uvwx yz!$. ABCD 1234"; int len = strlen(chars); for (int i = 0; i < lines; ++i) { @@ -394,8 +395,11 @@ int main(int argc, char *argv[]) } QWidget w; - QGLFormat format = QGLFormat::defaultFormat(); - format.setSampleBuffers(sampleBuffers); + QSurfaceFormat format = QSurfaceFormat::defaultFormat(); + if (!sampleBuffers) + format.setSamples(-1); + else if (format.samples() == -1) + format.setSamples(4); testWidget = new MyGLWidget(format); testWidget->setAutoFillBackground(false); QVBoxLayout *layout = new QVBoxLayout(&w); diff --git a/tests/benchmarks/qml/painting/painting.pro b/tests/benchmarks/qml/painting/painting.pro index 7e97915f43..633be76e30 100644 --- a/tests/benchmarks/qml/painting/painting.pro +++ b/tests/benchmarks/qml/painting/painting.pro @@ -1,6 +1,7 @@ requires(qtHaveModule(opengl)) +requires(qtHaveModule(widgets)) -QT += opengl +QT += opengl widgets CONFIG += console macx:CONFIG -= app_bundle diff --git a/tests/manual/nodetypes/Animators.qml b/tests/manual/nodetypes/Animators.qml deleted file mode 100644 index c582106c5d..0000000000 --- a/tests/manual/nodetypes/Animators.qml +++ /dev/null @@ -1,190 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.5 - -Item { - id: window - - Rectangle { - anchors.fill: parent - gradient: Gradient { - GradientStop { position: 0.0; color: "#14148c" } - GradientStop { position: 0.499; color: "#14aaff" } - GradientStop { position: 0.5; color: "#80c342" } - GradientStop { position: 1.0; color: "#006325" } - } - } - - SequentialAnimation { - id: plainAnim - SequentialAnimation { - ParallelAnimation { - PropertyAnimation { - property: "y" - target: smiley - from: smiley.minHeight - to: smiley.maxHeight - easing.type: Easing.OutExpo - duration: 300 - } - PropertyAnimation { - property: "scale" - target: shadow - from: 1 - to: 0.5 - easing.type: Easing.OutExpo - duration: 300 - } - } - ParallelAnimation { - PropertyAnimation { - property: "y" - target: smiley - from: smiley.maxHeight - to: smiley.minHeight - easing.type: Easing.OutBounce - duration: 1000 - } - PropertyAnimation { - property: "scale" - target: shadow - from: 0.5 - to: 1 - easing.type: Easing.OutBounce - duration: 1000 - } - } - } - running: false - } - - SequentialAnimation { - id: renderThreadAnim - SequentialAnimation { - ParallelAnimation { - YAnimator { - target: smiley - from: smiley.minHeight - to: smiley.maxHeight - easing.type: Easing.OutExpo - duration: 300 - } - ScaleAnimator { - target: shadow - from: 1 - to: 0.5 - easing.type: Easing.OutExpo - duration: 300 - } - } - ParallelAnimation { - YAnimator { - target: smiley - from: smiley.maxHeight - to: smiley.minHeight - easing.type: Easing.OutBounce - duration: 1000 - } - ScaleAnimator { - target: shadow - from: 0.5 - to: 1 - easing.type: Easing.OutBounce - duration: 1000 - } - } - } - running: false - } - - Image { - id: shadow - anchors.horizontalCenter: parent.horizontalCenter - y: smiley.minHeight + smiley.height - source: "qrc:/shadow.png" - } - - Image { - id: smiley - property int maxHeight: window.height / 3 - property int minHeight: 2 * window.height / 3 - - anchors.horizontalCenter: parent.horizontalCenter - y: minHeight - source: "qrc:/face-smile.png" - } - - Text { - text: "click left for plain animation, right for render thread Animators, middle to sleep for 2 sec on the main (gui) thread" - color: "white" - } - - Text { - text: plainAnim.running ? "NORMAL ANIMATION" : (renderThreadAnim.running ? "RENDER THREAD ANIMATION" : "NO ANIMATION") - color: "red" - font.pointSize: 20 - anchors.bottom: parent.bottom - } - - MouseArea { - anchors.fill: parent - acceptedButtons: Qt.AllButtons - onClicked: if (mouse.button === Qt.LeftButton) { - renderThreadAnim.running = false; - plainAnim.running = true; - } else if (mouse.button === Qt.RightButton) { - plainAnim.running = false; - renderThreadAnim.running = true; - } else if (mouse.button === Qt.MiddleButton) { - helper.sleep(2000); - } - } -} diff --git a/tests/manual/nodetypes/Effects.qml b/tests/manual/nodetypes/Effects.qml deleted file mode 100644 index 90a30c40d3..0000000000 --- a/tests/manual/nodetypes/Effects.qml +++ /dev/null @@ -1,231 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -// Use QtQuick 2.8 to get GraphicsInfo and the other new properties -import QtQuick 2.8 - -Item { - Rectangle { - color: "gray" - anchors.margins: 10 - anchors.fill: parent - Image { - id: image1 - source: "qrc:/qt.png" - } - ShaderEffectSource { - id: effectSource1 - sourceItem: image1 - hideSource: true - } - ShaderEffect { // wobble - id: eff - width: image1.width - height: image1.height - anchors.centerIn: parent - - property variant source: effectSource1 - property real amplitude: 0.04 * 0.2 - property real frequency: 20 - property real time: 0 - - NumberAnimation on time { loops: Animation.Infinite; from: 0; to: Math.PI * 2; duration: 600 } - - property bool customVertexShader: false // the effect is fine with the default vs, but toggle this to test - property bool useHLSLSourceString: false // toggle to provide HLSL shaders as strings instead of bytecode in files - - property string glslVertexShader: - "uniform highp mat4 qt_Matrix;" + - "attribute highp vec4 qt_Vertex;" + - "attribute highp vec2 qt_MultiTexCoord0;" + - "varying highp vec2 qt_TexCoord0;" + - "void main() {" + - " qt_TexCoord0 = qt_MultiTexCoord0;" + - " gl_Position = qt_Matrix * qt_Vertex;" + - "}" - - property string glslFragmentShader: - "uniform sampler2D source;" + - "uniform highp float amplitude;" + - "uniform highp float frequency;" + - "uniform highp float time;" + - "uniform lowp float qt_Opacity;" + - "varying highp vec2 qt_TexCoord0;" + - "void main() {" + - " highp vec2 p = sin(time + frequency * qt_TexCoord0);" + - " gl_FragColor = texture2D(source, qt_TexCoord0 + amplitude * vec2(p.y, -p.x)) * qt_Opacity;" + - "}" - - property string hlslVertexShader: "cbuffer ConstantBuffer : register(b0) {" + - " float4x4 qt_Matrix;" + - " float qt_Opacity; }" + - "struct PSInput {" + - " float4 position : SV_POSITION;" + - " float2 coord : TEXCOORD0; };" + - "PSInput main(float4 position : POSITION, float2 coord : TEXCOORD0) {" + - " PSInput result;" + - " result.position = mul(qt_Matrix, position);" + - " result.coord = coord;" + - " return result;" + - "}"; - - property string hlslPixelShader:"cbuffer ConstantBuffer : register(b0) {" + - " float4x4 qt_Matrix;" + - " float qt_Opacity;" + - " float amplitude;" + - " float frequency;" + - " float time; }" + - "Texture2D source : register(t0);" + - "SamplerState sourceSampler : register(s0);" + - "float4 main(float4 position : SV_POSITION, float2 coord : TEXCOORD0) : SV_TARGET" + - "{" + - " float2 p = sin(time + frequency * coord);" + - " return source.Sample(sourceSampler, coord + amplitude * float2(p.y, -p.x)) * qt_Opacity;" + - "}"; - - property string hlslVertexShaderByteCode: "qrc:/vs_wobble.cso" - property string hlslPixelShaderByteCode: "qrc:/ps_wobble.cso" - - vertexShader: customVertexShader ? (GraphicsInfo.shaderType === GraphicsInfo.HLSL - ? (useHLSLSourceString ? hlslVertexShader : hlslVertexShaderByteCode) - : (GraphicsInfo.shaderType === GraphicsInfo.GLSL ? glslVertexShader : "")) : "" - - fragmentShader: GraphicsInfo.shaderType === GraphicsInfo.HLSL - ? (useHLSLSourceString ? hlslPixelShader : hlslPixelShaderByteCode) - : (GraphicsInfo.shaderType === GraphicsInfo.GLSL ? glslFragmentShader : "") - } - - Image { - id: image2 - source: "qrc:/face-smile.png" - } - ShaderEffectSource { - id: effectSource2 - sourceItem: image2 - hideSource: true - } - ShaderEffect { // dropshadow - id: eff2 - width: image2.width - height: image2.height - scale: 2 - x: 40 - y: 40 - - property variant source: effectSource2 - - property string glslShaderPass1: " - uniform lowp float qt_Opacity; - uniform sampler2D source; - uniform highp vec2 delta; - varying highp vec2 qt_TexCoord0; - void main() { - gl_FragColor = (0.0538 * texture2D(source, qt_TexCoord0 - 3.182 * delta) - + 0.3229 * texture2D(source, qt_TexCoord0 - 1.364 * delta) - + 0.2466 * texture2D(source, qt_TexCoord0) - + 0.3229 * texture2D(source, qt_TexCoord0 + 1.364 * delta) - + 0.0538 * texture2D(source, qt_TexCoord0 + 3.182 * delta)) * qt_Opacity; - }" - property string glslShaderPass2: " - uniform lowp float qt_Opacity; - uniform highp vec2 offset; - uniform sampler2D source; - uniform sampler2D shadow; - uniform highp float darkness; - uniform highp vec2 delta; - varying highp vec2 qt_TexCoord0; - void main() { - lowp vec4 fg = texture2D(source, qt_TexCoord0); - lowp vec4 bg = texture2D(shadow, qt_TexCoord0 + delta); - gl_FragColor = (fg + vec4(0., 0., 0., darkness * bg.a) * (1. - fg.a)) * qt_Opacity; - }" - - property variant shadow: ShaderEffectSource { - sourceItem: ShaderEffect { - width: eff2.width - height: eff2.height - property variant delta: Qt.size(0.0, 1.0 / height) - property variant source: ShaderEffectSource { - sourceItem: ShaderEffect { - id: innerEff - width: eff2.width - height: eff2.height - property variant delta: Qt.size(1.0 / width, 0.0) - property variant source: effectSource2 - fragmentShader: GraphicsInfo.shaderType === GraphicsInfo.HLSL ? "qrc:/ps_shadow1.cso" : (GraphicsInfo.shaderType === GraphicsInfo.GLSL ? eff2.glslShaderPass1 : "") - } - } - fragmentShader: GraphicsInfo.shaderType === GraphicsInfo.HLSL ? "qrc:/ps_shadow1.cso" : (GraphicsInfo.shaderType === GraphicsInfo.GLSL ? eff2.glslShaderPass1: "") - } - } - property real angle: 0 - property variant offset: Qt.point(5.0 * Math.cos(angle), 5.0 * Math.sin(angle)) - NumberAnimation on angle { loops: Animation.Infinite; from: 0; to: Math.PI * 2; duration: 6000 } - property variant delta: Qt.size(offset.x / width, offset.y / height) - property real darkness: 0.5 - fragmentShader: GraphicsInfo.shaderType === GraphicsInfo.HLSL ? "qrc:/ps_shadow2.cso" : (GraphicsInfo.shaderType === GraphicsInfo.GLSL ? glslShaderPass2 : "") - } - - Column { - anchors.bottom: parent.bottom - Text { - color: "yellow" - font.pointSize: 24 - text: "Shader effect is " + (GraphicsInfo.shaderType === GraphicsInfo.HLSL ? "HLSL" : (GraphicsInfo.shaderType === GraphicsInfo.GLSL ? "GLSL" : "UNKNOWN")) + " based"; - } - Text { - text: GraphicsInfo.shaderType + " " + GraphicsInfo.shaderCompilationType + " " + GraphicsInfo.shaderSourceType - } - Text { - text: eff.status + " " + eff.log - } - } - } -} diff --git a/tests/manual/nodetypes/Images.qml b/tests/manual/nodetypes/Images.qml deleted file mode 100644 index 95e8442690..0000000000 --- a/tests/manual/nodetypes/Images.qml +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.3 - -Item { - Rectangle { - width: 100 - height: 100 - anchors.centerIn: parent - color: "red" - NumberAnimation on rotation { from: 0; to: 360; duration: 2000; loops: Animation.Infinite; } - } - - Image { - id: im - source: "qrc:/qt.png" - mipmap: true - - // changing the mipmap property results in the creation of a brand new - // texture resource. enable the following to test. -// Timer { -// interval: 2000 -// onTriggered: im.mipmap = false -// running: true -// } - - SequentialAnimation on scale { - loops: Animation.Infinite - NumberAnimation { - from: 1.0 - to: 4.0 - duration: 2000 - } - NumberAnimation { - from: 4.0 - to: 0.1 - duration: 3000 - } - NumberAnimation { - from: 0.1 - to: 1.0 - duration: 1000 - } - } - - Image { - anchors.centerIn: parent - source: "qrc:/face-smile.png" - } - } - - Image { - source: "qrc:/face-smile.png" - anchors.bottom: parent.bottom - anchors.right: parent.right - antialiasing: true - NumberAnimation on rotation { from: 0; to: 360; duration: 2000; loops: Animation.Infinite; } - } -} diff --git a/tests/manual/nodetypes/Layers.qml b/tests/manual/nodetypes/Layers.qml deleted file mode 100644 index 755d00d41a..0000000000 --- a/tests/manual/nodetypes/Layers.qml +++ /dev/null @@ -1,116 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Item { - Rectangle { - color: "lightGray" - anchors.fill: parent - anchors.margins: 10 - - Row { - anchors.fill: parent - anchors.margins: 10 - Rectangle { - color: "red" -// ColorAnimation on color { -// from: "black" -// to: "white" -// duration: 2000 -// loops: Animation.Infinite -// } - width: 300 - height: 100 - layer.enabled: true - Text { text: "this is in a layer, going through an offscreen render target" } - clip: true - Rectangle { - color: "lightGreen" - width: 50 - height: 50 - x: 275 - y: 75 - } - } - Rectangle { - color: "white" - width: 300 - height: 100 - Text { text: "this is not a layer" } - } - Rectangle { - color: "green" - width: 300 - height: 100 - layer.enabled: true - Text { text: "this is another layer" } - Rectangle { - border.width: 4 - border.color: "black" - anchors.centerIn: parent - width: 150 - height: 50 - layer.enabled: true - Text { - anchors.centerIn: parent - text: "layer in a layer" - } - } - Image { - source: "qrc:/face-smile.png" - anchors.bottom: parent.bottom - anchors.right: parent.right - NumberAnimation on rotation { from: 0; to: 360; duration: 2000; loops: Animation.Infinite; } - } - } - } - } -} diff --git a/tests/manual/nodetypes/LotsOfImages.qml b/tests/manual/nodetypes/LotsOfImages.qml deleted file mode 100644 index 72c36aba01..0000000000 --- a/tests/manual/nodetypes/LotsOfImages.qml +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.3 - -Item { - Grid { - columns: 20 - spacing: 4 - anchors.centerIn: parent - - Repeater { - model: 500 - - Image { - source: "qrc:/qt.png" - - // async true, cache false -> there is a separate, new texture for each and every image - // and the pixel data reading is done over and over again on a separate thread. - asynchronous: true - cache: false - - width: 20 - height: 20 - } - } - } - - Rectangle { - width: 100 - height: 100 - anchors.centerIn: parent - color: "red" - NumberAnimation on rotation { from: 0; to: 360; duration: 2000; loops: Animation.Infinite; } - } -} diff --git a/tests/manual/nodetypes/LotsOfRects.qml b/tests/manual/nodetypes/LotsOfRects.qml deleted file mode 100644 index e54174f10c..0000000000 --- a/tests/manual/nodetypes/LotsOfRects.qml +++ /dev/null @@ -1,260 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Item { - Rectangle { - anchors.margins: 4 - anchors.fill: parent - - // Background - gradient: Gradient { - GradientStop { position: 0; color: "steelblue" } - GradientStop { position: 1; color: "black" } - } - - // Animated gradient stops. - // NB! Causes a full buffer rebuild on every animated change due to the geometry change! - Row { - spacing: 10 - Repeater { - model: 20 - Rectangle { - width: 20 - height: 20 - gradient: Gradient { - GradientStop { position: 0.0; color: "red" } - GradientStop { NumberAnimation on position { from: 0.01; to: 0.99; duration: 5000; loops: Animation.Infinite } color: "yellow" } - GradientStop { position: 1.0; color: "green" } - } - } - } - } - - // Rounded rects with border (smooth material) - Row { - spacing: 10 - Repeater { - model: 5 - Rectangle { - color: "blue" - width: 100 - height: 50 - y: 50 - radius: 16 - border.color: "red" - border.width: 4 - - SequentialAnimation on y { - loops: Animation.Infinite - NumberAnimation { - from: 50 - to: 150 - duration: 7000 - } - NumberAnimation { - from: 150 - to: 50 - duration: 3000 - } - } - } - } - } - - // Clip using scissor - Row { - spacing: 10 - Repeater { - model: 5 - Rectangle { - color: "green" - width: 100 - height: 100 - y: 150 - NumberAnimation on y { - from: 150 - to: 200 - duration: 2000 - loops: Animation.Infinite - } - clip: true - Rectangle { - color: "lightGreen" - width: 50 - height: 50 - x: 75 - y: 75 - } - } - } - } - - // Clip using scissor - Row { - spacing: 10 - Repeater { - model: 5 - Rectangle { - color: "green" - width: 100 - height: 100 - y: 300 - NumberAnimation on y { - from: 300 - to: 400 - duration: 2000 - loops: Animation.Infinite - } - clip: true - Rectangle { - color: "lightGreen" - width: 50 - height: 50 - x: 75 - y: 75 - NumberAnimation on rotation { from: 0; to: 360; duration: 2000; loops: Animation.Infinite; } - } - } - } - } - - // Clip using stencil - Row { - spacing: 10 - Repeater { - model: 5 - Rectangle { - color: "green" - width: 100 - height: 100 - y: 450 - NumberAnimation on y { - from: 450 - to: 550 - duration: 2000 - loops: Animation.Infinite - } - NumberAnimation on rotation { from: 0; to: 360; duration: 2000; loops: Animation.Infinite; } - clip: true - Rectangle { - color: "lightGreen" - width: 50 - height: 50 - x: 75 - y: 75 - } - } - } - } - - // The signature red square with another item with animated opacity blended on top - Rectangle { - width: 100 - height: 100 - anchors.centerIn: parent - color: "red" - NumberAnimation on rotation { from: 0; to: 360; duration: 2000; loops: Animation.Infinite; } - - Rectangle { - color: "gray" - width: 50 - height: 50 - anchors.centerIn: parent - - SequentialAnimation on opacity { - loops: Animation.Infinite - NumberAnimation { - from: 1.0 - to: 0.0 - duration: 4000 - } - NumberAnimation { - from: 0.0 - to: 1.0 - duration: 4000 - easing.type: Easing.InOutQuad - } - } - } - } - - // Animated size and color. - // NB! Causes a full buffer rebuild on every animated change due to the geometry change! - Rectangle { - anchors.right: parent.right - anchors.bottom: parent.bottom - width: 10 - height: 100 - ColorAnimation on color { - from: "blue" - to: "purple" - duration: 5000 - loops: Animation.Infinite - } - NumberAnimation on width { - from: 10 - to: 300 - duration: 5000 - loops: Animation.Infinite - } - } - - // Semi-transparent rect on top. - Rectangle { - anchors.centerIn: parent - opacity: 0.2 - color: "black" - anchors.fill: parent - anchors.margins: 10 - } - } -} diff --git a/tests/manual/nodetypes/Painter.qml b/tests/manual/nodetypes/Painter.qml deleted file mode 100644 index c5db3496f8..0000000000 --- a/tests/manual/nodetypes/Painter.qml +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import Stuff 1.0 - -Item { - ListModel { - id: balloonModel - ListElement { - balloonWidth: 200 - } - ListElement { - balloonWidth: 120 - } - ListElement { - balloonWidth: 120 - } - ListElement { - balloonWidth: 120 - } - ListElement { - balloonWidth: 120 - } - } - - ListView { - anchors.fill: parent - anchors.margins: 10 - id: balloonView - model: balloonModel - spacing: 5 - delegate: TextBalloon { - anchors.right: index % 2 == 0 ? undefined : parent.right - height: 60 - rightAligned: index % 2 == 0 ? false : true - width: balloonWidth - innerAnim: model.index === 1 - NumberAnimation on width { - from: 200 - to: 300 - duration: 5000 - running: model.index === 0 - } - } - } -} diff --git a/tests/manual/nodetypes/Rects.qml b/tests/manual/nodetypes/Rects.qml deleted file mode 100644 index 7f12d118dd..0000000000 --- a/tests/manual/nodetypes/Rects.qml +++ /dev/null @@ -1,147 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Item { - Rectangle { - width: 100 - height: 100 - anchors.centerIn: parent - color: "red" - NumberAnimation on rotation { from: 0; to: 360; duration: 2000; loops: Animation.Infinite; } - - Rectangle { - color: "gray" - width: 50 - height: 50 - anchors.centerIn: parent - - SequentialAnimation on opacity { - loops: Animation.Infinite - NumberAnimation { - from: 1.0 - to: 0.0 - duration: 4000 - } - NumberAnimation { - from: 0.0 - to: 1.0 - duration: 4000 - easing.type: Easing.InOutQuad - } - } - } - } - - Rectangle { - color: "green" - width: 100 - height: 200 - x: 0 - y: 0 - - NumberAnimation on x { - from: 0 - to: 300 - duration: 5000 - } - NumberAnimation on y { - from: 0 - to: 50 - duration: 2000 - } - - clip: true - Rectangle { - color: "lightGreen" - width: 50 - height: 50 - x: 75 - y: 175 - } - } - - Rectangle { - color: "blue" - width: 200 - height: 100 - x: 100 - y: 300 - radius: 16 - border.color: "red" - border.width: 4 - - SequentialAnimation on y { - loops: Animation.Infinite - NumberAnimation { - from: 300 - to: 500 - duration: 7000 - } - NumberAnimation { - from: 500 - to: 300 - duration: 3000 - } - } - } - - Rectangle { - anchors.right: parent.right - width: 100 - height: 100 - gradient: Gradient { - GradientStop { position: 0.0; color: "red" } - GradientStop { position: 0.33; color: "yellow" } - GradientStop { position: 1.0; color: "green" } - } - } -} diff --git a/tests/manual/nodetypes/Text.qml b/tests/manual/nodetypes/Text.qml deleted file mode 100644 index 58befe8c49..0000000000 --- a/tests/manual/nodetypes/Text.qml +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Item { - Text { - id: text1 - anchors.top: parent.top - text: "árvíztűrő tükörfúrógép\nÁRVÍZTŰRŐ TÜKÖRFÚRÓGÉP" - } - Text { - anchors.bottom: parent.bottom - text: "the quick brown fox jumps over the lazy dog\nTHE QUICK BROWN FOX JUMPS OVER THE LAZY DOG" - color: "red" - } - Text { - anchors.centerIn: parent - text: "rotate rotate rotate" - font.bold: true - font.pointSize: 20 - color: "green" - NumberAnimation on rotation { from: 0; to: 360; duration: 2000; loops: Animation.Infinite; } - } - - Row { - anchors.top: text1.bottom - anchors.margins: 10 - Text { font.pointSize: 24; text: "Normal" } - Text { font.pointSize: 24; text: "Raised"; style: Text.Raised; styleColor: "#AAAAAA" } - Text { font.pointSize: 24; text: "Outline"; style: Text.Outline; styleColor: "red" } - Text { font.pointSize: 24; text: "Sunken"; style: Text.Sunken; styleColor: "#AAAAAA" } - } -} diff --git a/tests/manual/nodetypes/face-smile.png b/tests/manual/nodetypes/face-smile.png Binary files differdeleted file mode 100644 index 3d66d72578..0000000000 --- a/tests/manual/nodetypes/face-smile.png +++ /dev/null diff --git a/tests/manual/nodetypes/hlslcompile.bat b/tests/manual/nodetypes/hlslcompile.bat deleted file mode 100644 index b24824e324..0000000000 --- a/tests/manual/nodetypes/hlslcompile.bat +++ /dev/null @@ -1,4 +0,0 @@ -fxc /E VS_Wobble /T vs_5_0 /Fo vs_wobble.cso wobble.hlsl -fxc /E PS_Wobble /T ps_5_0 /Fo ps_wobble.cso wobble.hlsl -fxc /E PS_Shadow1 /T ps_5_0 /Fo ps_shadow1.cso shadow1.hlsl -fxc /E PS_Shadow2 /T ps_5_0 /Fo ps_shadow2.cso shadow2.hlsl diff --git a/tests/manual/nodetypes/main.qml b/tests/manual/nodetypes/main.qml deleted file mode 100644 index 9f1a5c5e9c..0000000000 --- a/tests/manual/nodetypes/main.qml +++ /dev/null @@ -1,93 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 - -Item { - focus: true - - Loader { - anchors.fill: parent - id: loader - } - - Keys.onPressed: { - if (event.key === Qt.Key_S) - loader.source = ""; - - if (event.key === Qt.Key_R) - loader.source = "qrc:/Rects.qml"; - if (event.key === Qt.Key_4) - loader.source = "qrc:/LotsOfRects.qml"; - - if (event.key === Qt.Key_I) - loader.source = "qrc:/Images.qml"; - if (event.key === Qt.Key_5) - loader.source = "qrc:/LotsOfImages.qml"; - - if (event.key === Qt.Key_T) - loader.source = "qrc:/Text.qml"; - - if (event.key === Qt.Key_A) - loader.source = "qrc:/Animators.qml"; - - if (event.key === Qt.Key_L) - loader.source = "qrc:/Layers.qml"; - - if (event.key === Qt.Key_E) - loader.source = "qrc:/Effects.qml"; - - if (event.key === Qt.Key_P) - loader.source = "qrc:/Painter.qml"; - - if (event.key === Qt.Key_G) - helper.testGrab() - } -} diff --git a/tests/manual/nodetypes/nodetypes.cpp b/tests/manual/nodetypes/nodetypes.cpp deleted file mode 100644 index 287574f25c..0000000000 --- a/tests/manual/nodetypes/nodetypes.cpp +++ /dev/null @@ -1,216 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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. -** -** BSD License Usage -** Alternatively, you may use this file under the terms of the BSD license -** as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QGuiApplication> -#include <QThread> -#include <QQuickView> -#include <QQmlEngine> -#include <QQmlContext> -#include <QQuickPaintedItem> -#include <QPainter> -#include <QTimer> - -class TextBalloon : public QQuickPaintedItem -{ - Q_OBJECT - Q_PROPERTY(bool rightAligned READ isRightAligned WRITE setRightAligned NOTIFY rightAlignedChanged) - Q_PROPERTY(bool innerAnim READ innerAnimEnabled WRITE setInnerAnimEnabled NOTIFY innerAnimChanged) - -public: - TextBalloon(QQuickItem *parent = nullptr) : QQuickPaintedItem(parent) { - connect(&m_timer, &QTimer::timeout, this, &TextBalloon::onAnim); - m_timer.setInterval(500); - } - void paint(QPainter *painter); - - bool isRightAligned() { return m_rightAligned; } - void setRightAligned(bool rightAligned); - - bool innerAnimEnabled() const { return m_innerAnim; } - void setInnerAnimEnabled(bool b); - -signals: - void rightAlignedChanged(); - void innerAnimChanged(); - -private slots: - void onAnim(); - -private: - bool m_rightAligned = false; - bool m_innerAnim = false; - QTimer m_timer; - QRect m_animRect = QRect(10, 10, 50, 20); - int m_anim = 0; -}; - -void TextBalloon::paint(QPainter *painter) -{ - QBrush brush(QColor("#007430")); - - painter->setBrush(brush); - painter->setPen(Qt::NoPen); - painter->setRenderHint(QPainter::Antialiasing); - - painter->drawRoundedRect(0, 0, boundingRect().width(), boundingRect().height() - 10, 10, 10); - - if (m_rightAligned) { - const QPointF points[3] = { - QPointF(boundingRect().width() - 10.0, boundingRect().height() - 10.0), - QPointF(boundingRect().width() - 20.0, boundingRect().height()), - QPointF(boundingRect().width() - 30.0, boundingRect().height() - 10.0), - }; - painter->drawConvexPolygon(points, 3); - } else { - const QPointF points[3] = { - QPointF(10.0, boundingRect().height() - 10.0), - QPointF(20.0, boundingRect().height()), - QPointF(30.0, boundingRect().height() - 10.0), - }; - painter->drawConvexPolygon(points, 3); - } - - if (m_innerAnim) { - painter->fillRect(m_animRect, Qt::lightGray); - const int x = m_animRect.x() + m_anim; - const int y = m_animRect.y() + m_animRect.height() / 2; - painter->setPen(QPen(QBrush(Qt::SolidLine), 4)); - painter->drawLine(x + 4, y, x + 10, y); - m_anim += 10; - if (m_anim > m_animRect.width()) - m_anim = 0; - } -} - -void TextBalloon::setRightAligned(bool rightAligned) -{ - if (m_rightAligned == rightAligned) - return; - - m_rightAligned = rightAligned; - emit rightAlignedChanged(); -} - -void TextBalloon::setInnerAnimEnabled(bool b) -{ - if (m_innerAnim == b) - return; - - m_innerAnim = b; - if (!b) - m_timer.stop(); - else - m_timer.start(); - emit innerAnimChanged(); -} - -void TextBalloon::onAnim() -{ - update(m_animRect); -} - -class Helper : public QObject -{ - Q_OBJECT - -public: - Helper(QQuickWindow *w) : m_window(w) { } - - Q_INVOKABLE void sleep(int ms) { - QThread::msleep(ms); - } - - Q_INVOKABLE void testGrab() { - QImage img = m_window->grabWindow(); - qDebug() << "Saving image to grab_result.png" << img; - img.save("grab_result.png"); - } - - QQuickWindow *m_window; -}; - -int main(int argc, char **argv) -{ - qputenv("QT_QUICK_BACKEND", "d3d12"); - - QGuiApplication app(argc, argv); - - qDebug("Available tests:"); - qDebug(" [R] - Rectangles"); - qDebug(" [4] - A lot of rectangles"); - qDebug(" [I] - Images"); - qDebug(" [5] - A lot of async images"); - qDebug(" [T] - Text"); - qDebug(" [A] - Render thread Animator"); - qDebug(" [L] - Layers"); - qDebug(" [E] - Effects"); - qDebug(" [P] - QQuickPaintedItem"); - qDebug(" [G] - Grab current window"); - qDebug("\nPress S to stop the currently running test\n"); - - QQuickView view; - Helper helper(&view); - if (app.arguments().contains(QLatin1String("--multisample"))) { - qDebug("Requesting sample count 4"); - QSurfaceFormat fmt; - fmt.setSamples(4); - view.setFormat(fmt); - } - view.engine()->rootContext()->setContextProperty(QLatin1String("helper"), &helper); - qmlRegisterType<TextBalloon>("Stuff", 1, 0, "TextBalloon"); - view.setResizeMode(QQuickView::SizeRootObjectToView); - view.resize(1024, 768); - view.setSource(QUrl("qrc:/main.qml")); - view.show(); - - return app.exec(); -} - -#include "nodetypes.moc" diff --git a/tests/manual/nodetypes/nodetypes.pro b/tests/manual/nodetypes/nodetypes.pro deleted file mode 100644 index 959b43cf18..0000000000 --- a/tests/manual/nodetypes/nodetypes.pro +++ /dev/null @@ -1,9 +0,0 @@ -QT += qml quick - -SOURCES += nodetypes.cpp - -RESOURCES += nodetypes.qrc - -OTHER_FILES += main.qml Rects.qml LotsOfRects.qml \ - Images.qml LotsOfImages.qml Text.qml Animators.qml Layers.qml Effects.qml Painter.qml \ - wobble.hlsl shadow1.hlsl shadow2.hlsl diff --git a/tests/manual/nodetypes/nodetypes.qrc b/tests/manual/nodetypes/nodetypes.qrc deleted file mode 100644 index 78c0d085a1..0000000000 --- a/tests/manual/nodetypes/nodetypes.qrc +++ /dev/null @@ -1,21 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>main.qml</file> - <file>Rects.qml</file> - <file>LotsOfRects.qml</file> - <file>Images.qml</file> - <file>LotsOfImages.qml</file> - <file>Text.qml</file> - <file>Animators.qml</file> - <file>Layers.qml</file> - <file>Effects.qml</file> - <file>Painter.qml</file> - <file>qt.png</file> - <file>face-smile.png</file> - <file>shadow.png</file> - <file>vs_wobble.cso</file> - <file>ps_wobble.cso</file> - <file>ps_shadow1.cso</file> - <file>ps_shadow2.cso</file> - </qresource> -</RCC> diff --git a/tests/manual/nodetypes/ps_shadow1.cso b/tests/manual/nodetypes/ps_shadow1.cso Binary files differdeleted file mode 100644 index b6fbe3f3c2..0000000000 --- a/tests/manual/nodetypes/ps_shadow1.cso +++ /dev/null diff --git a/tests/manual/nodetypes/ps_shadow2.cso b/tests/manual/nodetypes/ps_shadow2.cso Binary files differdeleted file mode 100644 index ab8cb63f34..0000000000 --- a/tests/manual/nodetypes/ps_shadow2.cso +++ /dev/null diff --git a/tests/manual/nodetypes/ps_wobble.cso b/tests/manual/nodetypes/ps_wobble.cso Binary files differdeleted file mode 100644 index 4e5b6a27f4..0000000000 --- a/tests/manual/nodetypes/ps_wobble.cso +++ /dev/null diff --git a/tests/manual/nodetypes/qt.png b/tests/manual/nodetypes/qt.png Binary files differdeleted file mode 100644 index f30eec0d4d..0000000000 --- a/tests/manual/nodetypes/qt.png +++ /dev/null diff --git a/tests/manual/nodetypes/shadow.png b/tests/manual/nodetypes/shadow.png Binary files differdeleted file mode 100644 index 8270565e87..0000000000 --- a/tests/manual/nodetypes/shadow.png +++ /dev/null diff --git a/tests/manual/nodetypes/shadow1.hlsl b/tests/manual/nodetypes/shadow1.hlsl deleted file mode 100644 index ff3f4b6fd5..0000000000 --- a/tests/manual/nodetypes/shadow1.hlsl +++ /dev/null @@ -1,18 +0,0 @@ -cbuffer ConstantBuffer : register(b0) -{ - float4x4 qt_Matrix; - float qt_Opacity; - float2 delta; -}; - -Texture2D source : register(t0); -SamplerState sourceSampler : register(s0); - -float4 PS_Shadow1(float4 position : SV_POSITION, float2 coord : TEXCOORD0) : SV_TARGET -{ - return (0.0538 * source.Sample(sourceSampler, coord - 3.182 * delta) - + 0.3229 * source.Sample(sourceSampler, coord - 1.364 * delta) - + 0.2466 * source.Sample(sourceSampler, coord) - + 0.3229 * source.Sample(sourceSampler, coord + 1.364 * delta) - + 0.0538 * source.Sample(sourceSampler, coord + 3.182 * delta)) * qt_Opacity; -} diff --git a/tests/manual/nodetypes/shadow2.hlsl b/tests/manual/nodetypes/shadow2.hlsl deleted file mode 100644 index eaa30cd988..0000000000 --- a/tests/manual/nodetypes/shadow2.hlsl +++ /dev/null @@ -1,22 +0,0 @@ -cbuffer ConstantBuffer : register(b0) -{ - float4x4 qt_Matrix; - float qt_Opacity; - float2 offset; - float darkness; - float2 delta; -}; - -Texture2D source : register(t0); -Texture2D shadow : register(t1); -SamplerState samp : register(s0); -// Use the same sampler for both textures. In fact the engine will create an extra static sampler -// in any case (to match the number of textures) due to some internals, but that won't hurt, the -// shader works either way. - -float4 PS_Shadow2(float4 position : SV_POSITION, float2 coord : TEXCOORD0) : SV_TARGET -{ - float4 fg = source.Sample(samp, coord); - float4 bg = shadow.Sample(samp, coord + delta); - return (fg + float4(0.0, 0.0, 0.0, darkness * bg.a) * (1.0 - fg.a)) * qt_Opacity; -} diff --git a/tests/manual/nodetypes/vs_wobble.cso b/tests/manual/nodetypes/vs_wobble.cso Binary files differdeleted file mode 100644 index f3a2596457..0000000000 --- a/tests/manual/nodetypes/vs_wobble.cso +++ /dev/null diff --git a/tests/manual/nodetypes/wobble.hlsl b/tests/manual/nodetypes/wobble.hlsl deleted file mode 100644 index 203dbda7f2..0000000000 --- a/tests/manual/nodetypes/wobble.hlsl +++ /dev/null @@ -1,32 +0,0 @@ -cbuffer ConstantBuffer : register(b0) -{ - float4x4 qt_Matrix; - float qt_Opacity; - - float amplitude; - float frequency; - float time; -}; - -struct PSInput -{ - float4 position : SV_POSITION; - float2 coord : TEXCOORD0; -}; - -PSInput VS_Wobble(float4 position : POSITION, float2 coord : TEXCOORD0) -{ - PSInput result; - result.position = mul(qt_Matrix, position); - result.coord = coord; - return result; -} - -Texture2D source : register(t0); -SamplerState sourceSampler : register(s0); - -float4 PS_Wobble(PSInput input) : SV_TARGET -{ - float2 p = sin(time + frequency * input.coord); - return source.Sample(sourceSampler, input.coord + amplitude * float2(p.y, -p.x)) * qt_Opacity; -} |