diff options
author | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2016-05-24 11:08:09 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2016-05-24 11:33:42 +0200 |
commit | 9ff09fb283cd130fb717769b44f54bfbb28efd8a (patch) | |
tree | 711f70b4b494bd996d54bdab5c44f3c89b37a6d1 /tests | |
parent | 592b5b49b6c0043fae5db7721689813ebd226032 (diff) | |
parent | ec2b2a5f5d804095b6b2b8575b1cd1b75a8335ff (diff) |
Merge remote-tracking branch 'origin/dev' into wip/scenegraphng
Conflicts:
src/quick/items/qquickopenglshadereffectnode.cpp
src/quick/items/qquickshadereffect.cpp
src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
src/quick/scenegraph/qsgdefaultglyphnode_p.h
Change-Id: I3d6874b4e4231a89d2836c04fe8e7f2ef2d698c4
Diffstat (limited to 'tests')
74 files changed, 1024 insertions, 86 deletions
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/data/controlFromJS.qml b/tests/auto/qml/debugger/qqmlprofilerservice/data/controlFromJS.qml index d1db2af367..dd7cb2055d 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/data/controlFromJS.qml +++ b/tests/auto/qml/debugger/qqmlprofilerservice/data/controlFromJS.qml @@ -26,10 +26,10 @@ ** ****************************************************************************/ -import QtQuick 2.0 +import QtQml 2.0 -Rectangle { - Timer { +QtObject { + property var timer: Timer { running: true interval: 1 onTriggered: { @@ -38,7 +38,7 @@ Rectangle { } } - Timer { + property var stopTimer: Timer { id: stopTimer interval: 1000 onTriggered: { @@ -47,7 +47,7 @@ Rectangle { } } - Timer { + property var endTimer: Timer { id: endTimer interval: 1000 onTriggered: Qt.quit(); diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/data/exit.qml b/tests/auto/qml/debugger/qqmlprofilerservice/data/exit.qml index b250524caa..4236d70ea3 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/data/exit.qml +++ b/tests/auto/qml/debugger/qqmlprofilerservice/data/exit.qml @@ -1,6 +1,6 @@ -import QtQuick 2.0 +import QtQml 2.0 -Item { +QtObject { Timer { running: true interval: 1 diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/data/javascript.qml b/tests/auto/qml/debugger/qqmlprofilerservice/data/javascript.qml index 0555d49652..e25c7524f4 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/data/javascript.qml +++ b/tests/auto/qml/debugger/qqmlprofilerservice/data/javascript.qml @@ -1,6 +1,6 @@ -import QtQuick 2.0 +import QtQml 2.0 -Rectangle { +QtObject { function something(i) { if (i > 10) { something(i / 4); @@ -9,8 +9,8 @@ Rectangle { } } - width: 400 - height: 400 + property int width: 400 + property int height: 400 onWidthChanged: something(width); Component.onCompleted: width = 500; diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/data/signalSourceLocation.qml b/tests/auto/qml/debugger/qqmlprofilerservice/data/signalSourceLocation.qml index 25e63669c4..0eff9e9030 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/data/signalSourceLocation.qml +++ b/tests/auto/qml/debugger/qqmlprofilerservice/data/signalSourceLocation.qml @@ -1,8 +1,8 @@ -import QtQuick 2.0 +import QtQml 2.0 -Rectangle { - width: 400 - height: 400 +QtObject { + property int width: 400 + property int height: 400 onWidthChanged: console.log(width); Component.onCompleted: width = 500; diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/data/test.qml b/tests/auto/qml/debugger/qqmlprofilerservice/data/test.qml index 9c36e13c5b..5dd5caf12f 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/data/test.qml +++ b/tests/auto/qml/debugger/qqmlprofilerservice/data/test.qml @@ -1,5 +1,5 @@ -import QtQuick 2.0 +import QtQml 2.0 -Item { +QtObject { } diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/data/timer.qml b/tests/auto/qml/debugger/qqmlprofilerservice/data/timer.qml index 18b8947172..4af555a27b 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/data/timer.qml +++ b/tests/auto/qml/debugger/qqmlprofilerservice/data/timer.qml @@ -1,10 +1,10 @@ -import QtQuick 2.0 +import QtQml 2.0 -Rectangle { - width: 100 - height: 62 +QtObject { + property int width: 100 + property int height: 62 - Timer { + property var timer: Timer { running: true repeat: true interval: 50 diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp index 2187383a31..c1de5ff594 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp +++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp @@ -663,11 +663,11 @@ void tst_QQmlProfilerService::signalSourceLocation() QLatin1String("signalSourceLocation.qml")); expected.line = 8; expected.column = 28; - VERIFY(MessageListQML, 13, expected, CheckAll); + VERIFY(MessageListQML, 9, expected, CheckAll); expected.line = 7; expected.column = 21; - VERIFY(MessageListQML, 15, expected, CheckAll); + VERIFY(MessageListQML, 11, expected, CheckAll); } void tst_QQmlProfilerService::javascript() diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp index adf944c7e1..99c18f91a1 100644 --- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp +++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp @@ -137,6 +137,7 @@ private slots: void functionDeclarationsInConditionals(); void arrayPop_QTBUG_35979(); + void array_unshift_QTBUG_52065(); void regexpLastMatch(); void indexedAccesses(); @@ -3045,6 +3046,20 @@ void tst_QJSEngine::arrayPop_QTBUG_35979() QCOMPARE(result.toString(), QString("1,3")); } +void tst_QJSEngine::array_unshift_QTBUG_52065() +{ + QJSEngine eng; + QJSValue result = eng.evaluate("[1, 2, 3, 4, 5, 6, 7, 8, 9]"); + QJSValue unshift = result.property(QStringLiteral("unshift")); + unshift.callWithInstance(result, QJSValueList() << QJSValue(0)); + + int len = result.property(QStringLiteral("length")).toInt(); + QCOMPARE(len, 10); + + for (int i = 0; i < len; ++i) + QCOMPARE(result.property(i).toInt(), i); +} + void tst_QJSEngine::regexpLastMatch() { QJSEngine eng; diff --git a/tests/auto/qml/qml.pro b/tests/auto/qml/qml.pro index 5e798f3b48..28f04be5d7 100644 --- a/tests/auto/qml/qml.pro +++ b/tests/auto/qml/qml.pro @@ -69,7 +69,8 @@ qtHaveModule(widgets) { qjsvalue } -SUBDIRS += $$PUBLICTESTS +SUBDIRS += $$PUBLICTESTS \ + qqmlextensionplugin SUBDIRS += $$METATYPETESTS !winrt { # no QProcess on winrt !contains(QT_CONFIG, no-qml-debug): SUBDIRS += debugger diff --git a/tests/auto/qml/qqmlecmascript/data/qtbug_52340.qml b/tests/auto/qml/qqmlecmascript/data/qtbug_52340.qml new file mode 100644 index 0000000000..03f90c15c8 --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/qtbug_52340.qml @@ -0,0 +1,13 @@ +import QtQml 2.0 + +QtObject { + property bool someProperty: true + function testCall() { + try { + someProperty(); // should throw + return false + } catch (e) { + return true + } + } +} diff --git a/tests/auto/qml/qqmlecmascript/data/sequenceSort.qml b/tests/auto/qml/qqmlecmascript/data/sequenceSort.qml index b130408c18..74c7cda9a3 100644 --- a/tests/auto/qml/qqmlecmascript/data/sequenceSort.qml +++ b/tests/auto/qml/qqmlecmascript/data/sequenceSort.qml @@ -64,6 +64,16 @@ Item { var actual = msc.reals(realList); return checkResults(expected, actual, fn); } + function doIntVectorTest(intList, fn) { + var expected = createExpected(intList, fn); + var actual = msc.integerVector(intList); + return checkResults(expected, actual, fn); + } + function doRealVectorTest(realList, fn) { + var expected = createExpected(realList, fn); + var actual = msc.realVector(realList); + return checkResults(expected, actual, fn); + } function test_qtbug_25269(useCustomCompare) { return doStringTest( [ "one", "two", "three" ], null ); @@ -92,4 +102,20 @@ Item { var fn = useCustomCompare ? compareNumbers : null; return doRealTest( [ -3.4, 1, 10, 4.23, -30.1, 4.24, 4.21, -1, -1, 12, -100, 87.4, 101.3, -8.88888, 7.76, 10.10, 1.1, -1.1, -0, 11, 12.8, 0.001, -11, -0.75, 99999.99, 11.12, 32.3, 3.333333, 9.876 ], fn ); } + function test_number_vector_insertionSort(useCustomCompare) { + var fn = useCustomCompare ? compareNumbers : null; + return doIntVectorTest( [ 7, 3, 9, 1, 0, -1, 20, -11 ], fn ); + } + function test_number_vector_quickSort(useCustomCompare) { + var fn = useCustomCompare ? compareNumbers : null; + return doIntVectorTest( [ 7, 3, 37, 9, 1, 0, -1, 20, -11, -300, -87, 1, 3, -2, 100, 108, 96, 9, 99999, 12, 11, 11, 12, 11, 13, -13, 10, 10, 10, 8, 12 ], fn ); + } + function test_real_vector_insertionSort(useCustomCompare) { + var fn = useCustomCompare ? compareNumbers : null; + return doRealVectorTest( [ -3.4, 1, 10, 4.23, -30.1, 4.24, 4.21, -1, -1 ], fn ); + } + function test_real_vector_quickSort(useCustomCompare) { + var fn = useCustomCompare ? compareNumbers : null; + return doRealVectorTest( [ -3.4, 1, 10, 4.23, -30.1, 4.24, 4.21, -1, -1, 12, -100, 87.4, 101.3, -8.88888, 7.76, 10.10, 1.1, -1.1, -0, 11, 12.8, 0.001, -11, -0.75, 99999.99, 11.12, 32.3, 3.333333, 9.876 ], fn ); + } } diff --git a/tests/auto/qml/qqmlecmascript/testtypes.cpp b/tests/auto/qml/qqmlecmascript/testtypes.cpp index 2afa21ddd6..d9ddcd71a7 100644 --- a/tests/auto/qml/qqmlecmascript/testtypes.cpp +++ b/tests/auto/qml/qqmlecmascript/testtypes.cpp @@ -295,6 +295,18 @@ public: { return v; } + Q_INVOKABLE QVector<int> integerVector(QVector<int> v) const + { + return v; + } + Q_INVOKABLE QVector<qreal> realVector(QVector<qreal> v) const + { + return v; + } + Q_INVOKABLE QVector<bool> boolVector(QVector<bool> v) const + { + return v; + } }; static MyInheritedQmlObject *theSingletonObject = 0; diff --git a/tests/auto/qml/qqmlecmascript/testtypes.h b/tests/auto/qml/qqmlecmascript/testtypes.h index 81b9b8d7bf..47fb2a56e7 100644 --- a/tests/auto/qml/qqmlecmascript/testtypes.h +++ b/tests/auto/qml/qqmlecmascript/testtypes.h @@ -791,6 +791,8 @@ public: Q_INVOKABLE void method_QScriptValue(QJSValue a) { invoke(14); m_actuals << qVariantFromValue(a); } Q_INVOKABLE void method_intQScriptValue(int a, QJSValue b) { invoke(15); m_actuals << a << qVariantFromValue(b); } Q_INVOKABLE void method_QByteArray(QByteArray value) { invoke(29); m_actuals << value; } + Q_INVOKABLE QJSValue method_intQJSValue(int a, QJSValue b) { invoke(30); m_actuals << a << qVariantFromValue(b); return b.call(); } + Q_INVOKABLE QJSValue method_intQJSValue(int a, int b) { m_actuals << a << b; return QJSValue();} // Should never be called. Q_INVOKABLE void method_overload(int a) { invoke(16); m_actuals << a; } Q_INVOKABLE void method_overload(int a, int b) { invoke(17); m_actuals << a << b; } diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index f71d7efe3a..2f78df1f11 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -322,6 +322,7 @@ private slots: void writeUnregisteredQObjectProperty(); void switchExpression(); void qtbug_46022(); + void qtbug_52340(); private: // static void propertyVarWeakRefCallback(v8::Persistent<v8::Value> object, void* parameter); @@ -2944,6 +2945,18 @@ void tst_qqmlecmascript::callQtInvokables() QCOMPARE(o->invoked(), 29); QCOMPARE(o->actuals().count(), 1); QCOMPARE(qvariant_cast<QByteArray>(o->actuals().at(0)), QByteArray("Hello")); + + o->reset(); + QV4::ScopedValue ret(scope, EVALUATE("object.method_intQJSValue(123, function() { return \"Hello world!\";})")); + QCOMPARE(o->error(), false); + QCOMPARE(o->invoked(), 30); + QVERIFY(ret->isString()); + QCOMPARE(ret->toQStringNoThrow(), QString("Hello world!")); + QCOMPARE(o->actuals().count(), 2); + QCOMPARE(o->actuals().at(0), QVariant(123)); + QJSValue callback = qvariant_cast<QJSValue>(o->actuals().at(1)); + QVERIFY(!callback.isNull()); + QVERIFY(callback.isCallable()); } // QTBUG-13047 (check that you can pass registered object types as args) @@ -7331,7 +7344,7 @@ void tst_qqmlecmascript::sequenceSort_data() QTest::newRow("qtbug_25269") << "test_qtbug_25269" << false; - const char *types[] = { "alphabet", "numbers", "reals" }; + const char *types[] = { "alphabet", "numbers", "reals", "number_vector", "real_vector" }; const char *sort[] = { "insertionSort", "quickSort" }; for (size_t t=0 ; t < sizeof(types)/sizeof(types[0]) ; ++t) { @@ -7898,6 +7911,17 @@ void tst_qqmlecmascript::qtbug_46022() QCOMPARE(obj->property("test2").toBool(), true); } +void tst_qqmlecmascript::qtbug_52340() +{ + QQmlComponent component(&engine, testFileUrl("qtbug_52340.qml")); + QScopedPointer<QObject> object(component.create()); + QVERIFY(!object.isNull()); + QVariant returnValue; + QVERIFY(QMetaObject::invokeMethod(object.data(), "testCall", Q_RETURN_ARG(QVariant, returnValue))); + QVERIFY(returnValue.isValid()); + QVERIFY(returnValue.toBool()); +} + QTEST_MAIN(tst_qqmlecmascript) #include "tst_qqmlecmascript.moc" diff --git a/tests/auto/qml/qqmlextensionplugin/qqmlextensionplugin.pro b/tests/auto/qml/qqmlextensionplugin/qqmlextensionplugin.pro new file mode 100644 index 0000000000..af74707c4a --- /dev/null +++ b/tests/auto/qml/qqmlextensionplugin/qqmlextensionplugin.pro @@ -0,0 +1,5 @@ +CONFIG += testcase +TARGET = tst_qqmlextensionplugin +SOURCES += tst_qqmlextensionplugin.cpp +osx:CONFIG -= app_bundle +QT += qml testlib diff --git a/tests/auto/qml/qqmlextensionplugin/tst_qqmlextensionplugin.cpp b/tests/auto/qml/qqmlextensionplugin/tst_qqmlextensionplugin.cpp new file mode 100644 index 0000000000..ab5e958323 --- /dev/null +++ b/tests/auto/qml/qqmlextensionplugin/tst_qqmlextensionplugin.cpp @@ -0,0 +1,119 @@ +/**************************************************************************** +** +** 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:LGPL21$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtCore> +#include <QtTest> +#include <QtQml> + +#if defined(Q_OS_WIN) +# define SUFFIX QLatin1String(".dll") +# define DEBUG_SUFFIX QLatin1String("d.dll") + +#elif defined(Q_OS_DARWIN) +# define SUFFIX QLatin1String(".dylib") +# define DEBUG_SUFFIX QLatin1String("_debug.dylib") + +# else // Unix +# define SUFFIX QLatin1String(".so") +#endif + + +class tst_qqmlextensionplugin : public QObject +{ + Q_OBJECT + + bool isDuplicate(QString file, const QList<QString> & files) { +#ifndef DEBUG_SUFFIX + Q_UNUSED(file) + Q_UNUSED(files) + return false; +#else +# ifdef QT_DEBUG + return !file.endsWith(DEBUG_SUFFIX) && files.contains(file.replace(SUFFIX, DEBUG_SUFFIX)); +# else + return file.endsWith(DEBUG_SUFFIX) && files.contains(file.replace(DEBUG_SUFFIX, SUFFIX)); +# endif +#endif + } + +public: + tst_qqmlextensionplugin() {} + +private Q_SLOTS: + void iidCheck_data(); + void iidCheck(); +}; + + +void tst_qqmlextensionplugin::iidCheck_data() +{ + QList<QString> files; + for (QDirIterator it(QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath), QDirIterator::Subdirectories); it.hasNext(); ) { + QString file = it.next(); + if (file.endsWith(SUFFIX)) { + files << file; + } + } + + for (QMutableListIterator<QString> it(files); it.hasNext(); ) { + QString file = it.next(); + if (isDuplicate(file, files)) { + it.remove(); + } + } + + QTest::addColumn<QString>("filePath"); + foreach (const QString &file, files) { + QFileInfo fileInfo(file); + QTest::newRow(fileInfo.baseName().toLatin1().data()) << fileInfo.absoluteFilePath(); + } +} + + +void tst_qqmlextensionplugin::iidCheck() +{ + QFETCH(QString, filePath); + + QPluginLoader loader(filePath); + QVERIFY(loader.load()); + QVERIFY(loader.instance() != Q_NULLPTR); + + if (qobject_cast<QQmlExtensionPlugin *>(loader.instance())) { + QString iid = loader.metaData().value(QStringLiteral("IID")).toString(); + QCOMPARE(iid, QLatin1String(QQmlExtensionInterface_iid)); + } +} + + +QTEST_APPLESS_MAIN(tst_qqmlextensionplugin) +#include "tst_qqmlextensionplugin.moc" diff --git a/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp b/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp index bfa7e2f13f..68739886c4 100644 --- a/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp +++ b/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp @@ -41,6 +41,8 @@ private slots: void importPathOrder(); void testDesignerSupported(); void uiFormatLoading(); + void completeQmldirPaths_data(); + void completeQmldirPaths(); void cleanup(); }; @@ -146,6 +148,43 @@ void tst_QQmlImport::importPathOrder() QCOMPARE(expectedImportPaths, engine.importPathList()); } +Q_DECLARE_METATYPE(QQmlImports::ImportVersion) + +void tst_QQmlImport::completeQmldirPaths_data() +{ + QTest::addColumn<QString>("uri"); + QTest::addColumn<QStringList>("basePaths"); + QTest::addColumn<int>("majorVersion"); + QTest::addColumn<int>("minorVersion"); + QTest::addColumn<QStringList>("expectedPaths"); + + QTest::newRow("QtQml") << "QtQml" << (QStringList() << "qtbase/qml/" << "path/to/qml") << 2 << 7 + << (QStringList() << "qtbase/qml/QtQml.2.7/qmldir" << "path/to/qml/QtQml.2.7/qmldir" + << "qtbase/qml/QtQml.2/qmldir" << "path/to/qml/QtQml.2/qmldir" + << "qtbase/qml/QtQml/qmldir" << "path/to/qml/QtQml/qmldir"); + + QTest::newRow("QtQml.Models") << "QtQml.Models" << QStringList("qtbase/qml/") << 2 << 2 + << (QStringList() << "qtbase/qml/QtQml/Models.2.2/qmldir" << "qtbase/qml/QtQml.2.2/Models/qmldir" + << "qtbase/qml/QtQml/Models.2/qmldir" << "qtbase/qml/QtQml.2/Models/qmldir" + << "qtbase/qml/QtQml/Models/qmldir"); + + QTest::newRow("org.qt-project.foo.bar") << "org.qt-project.foo.bar" << QStringList("qtbase/qml/") << 0 << 1 + << (QStringList() << "qtbase/qml/org/qt-project/foo/bar.0.1/qmldir" << "qtbase/qml/org/qt-project/foo.0.1/bar/qmldir" << "qtbase/qml/org/qt-project.0.1/foo/bar/qmldir" << "qtbase/qml/org.0.1/qt-project/foo/bar/qmldir" + << "qtbase/qml/org/qt-project/foo/bar.0/qmldir" << "qtbase/qml/org/qt-project/foo.0/bar/qmldir" << "qtbase/qml/org/qt-project.0/foo/bar/qmldir" << "qtbase/qml/org.0/qt-project/foo/bar/qmldir" + << "qtbase/qml/org/qt-project/foo/bar/qmldir"); +} + +void tst_QQmlImport::completeQmldirPaths() +{ + QFETCH(QString, uri); + QFETCH(QStringList, basePaths); + QFETCH(int, majorVersion); + QFETCH(int, minorVersion); + QFETCH(QStringList, expectedPaths); + + QCOMPARE(QQmlImports::completeQmldirPaths(uri, basePaths, majorVersion, minorVersion), expectedPaths); +} + QTEST_MAIN(tst_QQmlImport) #include "tst_qqmlimport.moc" diff --git a/tests/auto/qml/qqmllanguage/BLACKLIST b/tests/auto/qml/qqmllanguage/BLACKLIST deleted file mode 100644 index c1c7e56df9..0000000000 --- a/tests/auto/qml/qqmllanguage/BLACKLIST +++ /dev/null @@ -1,2 +0,0 @@ -[importsPath] -windows diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index 1ac1661ea8..98a97ebd66 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -4135,8 +4135,6 @@ void tst_qqmllanguage::dataAlignment() { QVERIFY(sizeof(QQmlVMEMetaData) % sizeof(int) == 0); QVERIFY(sizeof(QQmlVMEMetaData::AliasData) % sizeof(int) == 0); - QVERIFY(sizeof(QQmlVMEMetaData::PropertyData) % sizeof(int) == 0); - QVERIFY(sizeof(QQmlVMEMetaData::MethodData) % sizeof(int) == 0); } void tst_qqmllanguage::deleteSingletons() diff --git a/tests/auto/qml/qqmlmoduleplugin/data/child.qml b/tests/auto/qml/qqmlmoduleplugin/data/child.qml new file mode 100644 index 0000000000..a11ae297d7 --- /dev/null +++ b/tests/auto/qml/qqmlmoduleplugin/data/child.qml @@ -0,0 +1,3 @@ +import org.qtproject.AutoTestQmlPluginType.ChildPlugin 1.0 + +MyChildPluginType { value: 123 } diff --git a/tests/auto/qml/qqmlmoduleplugin/data/child2.qml b/tests/auto/qml/qqmlmoduleplugin/data/child2.qml new file mode 100644 index 0000000000..667164516a --- /dev/null +++ b/tests/auto/qml/qqmlmoduleplugin/data/child2.qml @@ -0,0 +1,3 @@ +import org.qtproject.AutoTestQmlPluginType.ChildPlugin 2.0 + +MyChildPluginType { valueOnlyIn2: 123 } diff --git a/tests/auto/qml/qqmlmoduleplugin/data/child21.qml b/tests/auto/qml/qqmlmoduleplugin/data/child21.qml new file mode 100644 index 0000000000..064d5474e0 --- /dev/null +++ b/tests/auto/qml/qqmlmoduleplugin/data/child21.qml @@ -0,0 +1,3 @@ +import org.qtproject.AutoTestQmlPluginType.ChildPlugin 2.1 + +MyChildPluginType { valueOnlyIn2: 123 } diff --git a/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/plugin.cpp index 82c3c926fd..fa9782f8c2 100644 --- a/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/plugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/plugin.cpp @@ -41,7 +41,7 @@ public: class MyPlugin : public QQmlExtensionPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: MyPlugin() {} diff --git a/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/plugin.cpp index bb2a344811..fe01507412 100644 --- a/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/plugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/plugin.cpp @@ -41,7 +41,7 @@ public: class MyPlugin : public QQmlExtensionPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: MyPlugin() {} diff --git a/tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/plugin.cpp index bb2a344811..fe01507412 100644 --- a/tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/plugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/plugin.cpp @@ -41,7 +41,7 @@ public: class MyPlugin : public QQmlExtensionPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: MyPlugin() {} diff --git a/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.cpp b/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.cpp index 4ca5eb5402..92d30351a7 100644 --- a/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.cpp @@ -56,7 +56,7 @@ public: class MyPlugin : public QQmlExtensionPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: MyPlugin() {} diff --git a/tests/auto/qml/qqmlmoduleplugin/nonstrictModule/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/nonstrictModule/plugin.cpp index f48ab16b03..5fc05b91bd 100644 --- a/tests/auto/qml/qqmlmoduleplugin/nonstrictModule/plugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/nonstrictModule/plugin.cpp @@ -41,7 +41,7 @@ public: class MyPlugin : public QQmlExtensionPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: MyPlugin() {} diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/childplugin/childplugin.cpp b/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/childplugin/childplugin.cpp new file mode 100644 index 0000000000..515d56a3c4 --- /dev/null +++ b/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/childplugin/childplugin.cpp @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** 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 <QStringList> +#include <QtQml/qqmlextensionplugin.h> +#include <QtQml/qqml.h> +#include <QDebug> + +class MyChildPluginType : public QObject +{ + Q_OBJECT + Q_PROPERTY(int value READ value WRITE setValue) + Q_PROPERTY(int valueOnlyIn2 READ value WRITE setValue) + +public: + MyChildPluginType(QObject *parent=0) : QObject(parent) + { + qWarning("child import2.1 worked"); + } + + int value() const { return v; } + void setValue(int i) { v = i; } + +private: + int v; +}; + + +class MyChildPlugin : public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) + +public: + MyChildPlugin() + { + qWarning("child plugin2.1 created"); + } + + void registerTypes(const char *uri) + { + Q_ASSERT(QLatin1String(uri) == "org.qtproject.AutoTestQmlPluginType.ChildPlugin"); + qmlRegisterType<MyChildPluginType>(uri, 2, 1, "MyChildPluginType"); + } +}; + +#include "childplugin.moc" diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/childplugin/childplugin.pro b/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/childplugin/childplugin.pro new file mode 100644 index 0000000000..7a0cd6f80f --- /dev/null +++ b/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/childplugin/childplugin.pro @@ -0,0 +1,12 @@ +TEMPLATE = lib +CONFIG += childplugin +SOURCES = childplugin.cpp +QT = core qml +DESTDIR = ../../imports/org/qtproject/AutoTestQmlPluginType.2.1/ChildPlugin + +QT += core-private gui-private qml-private + +IMPORT_FILES = \ + qmldir + +include (../../../../shared/imports.pri) diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/childplugin/qmldir b/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/childplugin/qmldir new file mode 100644 index 0000000000..c8d6488065 --- /dev/null +++ b/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/childplugin/qmldir @@ -0,0 +1 @@ +plugin childplugin diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/plugin.cpp index 2dc771fad1..6cae5254bc 100644 --- a/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/plugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/plugin.cpp @@ -53,7 +53,7 @@ private: class MyPlugin : public QQmlExtensionPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: MyPlugin() diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin.2/childplugin/childplugin.cpp b/tests/auto/qml/qqmlmoduleplugin/plugin.2/childplugin/childplugin.cpp new file mode 100644 index 0000000000..56545cfa3c --- /dev/null +++ b/tests/auto/qml/qqmlmoduleplugin/plugin.2/childplugin/childplugin.cpp @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** 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 <QStringList> +#include <QtQml/qqmlextensionplugin.h> +#include <QtQml/qqml.h> +#include <QDebug> + +class MyChildPluginType : public QObject +{ + Q_OBJECT + Q_PROPERTY(int value READ value WRITE setValue) + Q_PROPERTY(int valueOnlyIn2 READ value WRITE setValue) + +public: + MyChildPluginType(QObject *parent=0) : QObject(parent) + { + qWarning("child import2 worked"); + } + + int value() const { return v; } + void setValue(int i) { v = i; } + +private: + int v; +}; + + +class MyChildPlugin : public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) + +public: + MyChildPlugin() + { + qWarning("child plugin2 created"); + } + + void registerTypes(const char *uri) + { + Q_ASSERT(QLatin1String(uri) == "org.qtproject.AutoTestQmlPluginType.ChildPlugin"); + qmlRegisterType<MyChildPluginType>(uri, 2, 0, "MyChildPluginType"); + } +}; + +#include "childplugin.moc" diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin.2/childplugin/childplugin.pro b/tests/auto/qml/qqmlmoduleplugin/plugin.2/childplugin/childplugin.pro new file mode 100644 index 0000000000..c9283411f3 --- /dev/null +++ b/tests/auto/qml/qqmlmoduleplugin/plugin.2/childplugin/childplugin.pro @@ -0,0 +1,13 @@ +TEMPLATE = lib +CONFIG += childplugin +SOURCES = childplugin.cpp +QT = core qml +DESTDIR = ../../imports/org/qtproject/AutoTestQmlPluginType.2/ChildPlugin + +QT += core-private gui-private qml-private + +IMPORT_DIR = DESTDIR +IMPORT_FILES = \ + qmldir + +include (../../../../shared/imports.pri) diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin.2/childplugin/qmldir b/tests/auto/qml/qqmlmoduleplugin/plugin.2/childplugin/qmldir new file mode 100644 index 0000000000..c8d6488065 --- /dev/null +++ b/tests/auto/qml/qqmlmoduleplugin/plugin.2/childplugin/qmldir @@ -0,0 +1 @@ +plugin childplugin diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin.2/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/plugin.2/plugin.cpp index 4b25181a86..49a2a747a4 100644 --- a/tests/auto/qml/qqmlmoduleplugin/plugin.2/plugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/plugin.2/plugin.cpp @@ -53,7 +53,7 @@ private: class MyPlugin : public QQmlExtensionPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: MyPlugin() diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin/childplugin/childplugin.cpp b/tests/auto/qml/qqmlmoduleplugin/plugin/childplugin/childplugin.cpp new file mode 100644 index 0000000000..28490d3d98 --- /dev/null +++ b/tests/auto/qml/qqmlmoduleplugin/plugin/childplugin/childplugin.cpp @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** 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 <QStringList> +#include <QtQml/qqmlextensionplugin.h> +#include <QtQml/qqml.h> +#include <QDebug> + +class MyChildPluginType : public QObject +{ + Q_OBJECT + Q_PROPERTY(int value READ value WRITE setValue) + +public: + MyChildPluginType(QObject *parent=0) : QObject(parent) + { + qWarning("child import worked"); + } + + int value() const { return v; } + void setValue(int i) { v = i; } + +private: + int v; +}; + + +class MyChildPlugin : public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) + +public: + MyChildPlugin() + { + qWarning("child plugin created"); + } + + void registerTypes(const char *uri) + { + Q_ASSERT(QLatin1String(uri) == "org.qtproject.AutoTestQmlPluginType.ChildPlugin"); + qmlRegisterType<MyChildPluginType>(uri, 1, 0, "MyChildPluginType"); + } +}; + +#include "childplugin.moc" diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin/childplugin/childplugin.pro b/tests/auto/qml/qqmlmoduleplugin/plugin/childplugin/childplugin.pro new file mode 100644 index 0000000000..5f5c01f77e --- /dev/null +++ b/tests/auto/qml/qqmlmoduleplugin/plugin/childplugin/childplugin.pro @@ -0,0 +1,12 @@ +TEMPLATE = lib +CONFIG += childplugin +SOURCES = childplugin.cpp +QT = core qml +DESTDIR = ../../imports/org/qtproject/AutoTestQmlPluginType/ChildPlugin + +QT += core-private gui-private qml-private + +IMPORT_FILES = \ + qmldir + +include (../../../../shared/imports.pri) diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin/childplugin/qmldir b/tests/auto/qml/qqmlmoduleplugin/plugin/childplugin/qmldir new file mode 100644 index 0000000000..c8d6488065 --- /dev/null +++ b/tests/auto/qml/qqmlmoduleplugin/plugin/childplugin/qmldir @@ -0,0 +1 @@ +plugin childplugin diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/plugin/plugin.cpp index 7147769406..db51185de6 100644 --- a/tests/auto/qml/qqmlmoduleplugin/plugin/plugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/plugin/plugin.cpp @@ -52,7 +52,7 @@ private: class MyPlugin : public QQmlExtensionPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: MyPlugin() diff --git a/tests/auto/qml/qqmlmoduleplugin/pluginMixed/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/pluginMixed/plugin.cpp index 8ae091bc0f..e780d4a7fd 100644 --- a/tests/auto/qml/qqmlmoduleplugin/pluginMixed/plugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/pluginMixed/plugin.cpp @@ -43,7 +43,7 @@ public: class MyMixedPlugin : public QQmlExtensionPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: MyMixedPlugin() diff --git a/tests/auto/qml/qqmlmoduleplugin/pluginVersion/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/pluginVersion/plugin.cpp index 4be0ad4c66..470da6c35f 100644 --- a/tests/auto/qml/qqmlmoduleplugin/pluginVersion/plugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/pluginVersion/plugin.cpp @@ -43,7 +43,7 @@ public: class MyMixedPlugin : public QQmlExtensionPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: MyMixedPlugin() diff --git a/tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/plugin.cpp index 2c1047450a..60a0a4a3e2 100644 --- a/tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/plugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/pluginWithQmlFile/plugin.cpp @@ -33,7 +33,7 @@ class MyPlugin : public QQmlExtensionPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: void registerTypes(const char *uri) diff --git a/tests/auto/qml/qqmlmoduleplugin/pluginWrongCase/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/pluginWrongCase/plugin.cpp index 4eb875be43..7669d65568 100644 --- a/tests/auto/qml/qqmlmoduleplugin/pluginWrongCase/plugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/pluginWrongCase/plugin.cpp @@ -52,7 +52,7 @@ private: class MyPlugin : public QQmlExtensionPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: MyPlugin() diff --git a/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/plugin.cpp index bace4644b3..92211ebf9d 100644 --- a/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/plugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/plugin.cpp @@ -41,7 +41,7 @@ public: class MyPlugin : public QQmlExtensionPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: MyPlugin() {} diff --git a/tests/auto/qml/qqmlmoduleplugin/preemptiveModule/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/preemptiveModule/plugin.cpp index a98398ac94..3df3e9cc81 100644 --- a/tests/auto/qml/qqmlmoduleplugin/preemptiveModule/plugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/preemptiveModule/plugin.cpp @@ -41,7 +41,7 @@ public: class MyPlugin : public QQmlExtensionPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: MyPlugin() {} diff --git a/tests/auto/qml/qqmlmoduleplugin/protectedModule/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/protectedModule/plugin.cpp index df85d4a327..afdeea80f4 100644 --- a/tests/auto/qml/qqmlmoduleplugin/protectedModule/plugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/protectedModule/plugin.cpp @@ -40,7 +40,7 @@ public: class MyPlugin : public QQmlExtensionPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: MyPlugin() {} diff --git a/tests/auto/qml/qqmlmoduleplugin/qqmlmoduleplugin.pro b/tests/auto/qml/qqmlmoduleplugin/qqmlmoduleplugin.pro index 5c30d8cc00..889968f6cc 100644 --- a/tests/auto/qml/qqmlmoduleplugin/qqmlmoduleplugin.pro +++ b/tests/auto/qml/qqmlmoduleplugin/qqmlmoduleplugin.pro @@ -17,7 +17,10 @@ SUBDIRS =\ preemptedStrictModule\ invalidNamespaceModule\ invalidFirstCommandModule\ - protectedModule + protectedModule\ + plugin/childplugin\ + plugin.2/childplugin\ + plugin.2.1/childplugin tst_qqmlmoduleplugin_pro.depends += plugin SUBDIRS += tst_qqmlmoduleplugin.pro diff --git a/tests/auto/qml/qqmlmoduleplugin/strictModule.2/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/strictModule.2/plugin.cpp index 1e86c0da49..4f5176ae62 100644 --- a/tests/auto/qml/qqmlmoduleplugin/strictModule.2/plugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/strictModule.2/plugin.cpp @@ -41,7 +41,7 @@ public: class MyPlugin : public QQmlExtensionPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: MyPlugin() {} diff --git a/tests/auto/qml/qqmlmoduleplugin/strictModule/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/strictModule/plugin.cpp index ad53ac95f3..eaa9aeb1d0 100644 --- a/tests/auto/qml/qqmlmoduleplugin/strictModule/plugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/strictModule/plugin.cpp @@ -41,7 +41,7 @@ public: class MyPlugin : public QQmlExtensionPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: MyPlugin() {} diff --git a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp index 6ae1a6654f..265492b435 100644 --- a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp @@ -70,6 +70,9 @@ private slots: void importStrictModule(); void importStrictModule_data(); void importProtectedModule(); + void importsChildPlugin(); + void importsChildPlugin2(); + void importsChildPlugin21(); private: QString m_importsDirectory; @@ -575,6 +578,57 @@ void tst_qqmlmoduleplugin::importProtectedModule() QVERIFY(object != 0); } +void tst_qqmlmoduleplugin::importsChildPlugin() +{ + QQmlEngine engine; + engine.addImportPath(m_importsDirectory); + QTest::ignoreMessage(QtWarningMsg, "child plugin created"); + QTest::ignoreMessage(QtWarningMsg, "child import worked"); + QTest::ignoreMessage(QtWarningMsg, "Module 'org.qtproject.AutoTestQmlPluginType.ChildPlugin' does not contain a module identifier directive - it cannot be protected from external registrations."); + QQmlComponent component(&engine, testFileUrl(QStringLiteral("child.qml"))); + foreach (QQmlError err, component.errors()) + qWarning() << err; + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + QCOMPARE(object->property("value").toInt(),123); + delete object; +} + +void tst_qqmlmoduleplugin::importsChildPlugin2() +{ + QQmlEngine engine; + engine.addImportPath(m_importsDirectory); + QTest::ignoreMessage(QtWarningMsg, "child plugin2 created"); + QTest::ignoreMessage(QtWarningMsg, "child import2 worked"); + QTest::ignoreMessage(QtWarningMsg, "Module 'org.qtproject.AutoTestQmlPluginType.ChildPlugin' does not contain a module identifier directive - it cannot be protected from external registrations."); + QQmlComponent component(&engine, testFileUrl(QStringLiteral("child2.qml"))); + foreach (QQmlError err, component.errors()) + qWarning() << err; + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + QCOMPARE(object->property("value").toInt(),123); + delete object; +} + +void tst_qqmlmoduleplugin::importsChildPlugin21() +{ + QQmlEngine engine; + engine.addImportPath(m_importsDirectory); + QTest::ignoreMessage(QtWarningMsg, "child plugin2.1 created"); + QTest::ignoreMessage(QtWarningMsg, "child import2.1 worked"); + QTest::ignoreMessage(QtWarningMsg, "Module 'org.qtproject.AutoTestQmlPluginType.ChildPlugin' does not contain a module identifier directive - it cannot be protected from external registrations."); + QQmlComponent component(&engine, testFileUrl(QStringLiteral("child21.qml"))); + foreach (QQmlError err, component.errors()) + qWarning() << err; + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + QCOMPARE(object->property("value").toInt(),123); + delete object; +} + QTEST_MAIN(tst_qqmlmoduleplugin) #include "tst_qqmlmoduleplugin.moc" diff --git a/tests/auto/qml/qqmlqt/data/qtObjectContents.qml b/tests/auto/qml/qqmlqt/data/qtObjectContents.qml new file mode 100644 index 0000000000..c85e7986e9 --- /dev/null +++ b/tests/auto/qml/qqmlqt/data/qtObjectContents.qml @@ -0,0 +1,10 @@ +import QtQuick 2.0 + +QtObject { + property var values: Object() + Component.onCompleted: { + for (var key in Qt) { + values[key] = Qt[key] + } + } +} diff --git a/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp b/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp index 413feb0eb4..8150241e4a 100644 --- a/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp +++ b/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp @@ -90,6 +90,7 @@ private slots: void resolvedUrl(); void later_data(); void later(); + void qtObjectContents(); private: QQmlEngine engine; @@ -1093,6 +1094,51 @@ void tst_qqmlqt::later() 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(); + QVERIFY(object != 0); + + QVERIFY(object->property("values").canConvert<QJSValue>()); + QVariantMap values = object->property("values").value<QJSValue>().toVariant().toMap(); + + QSet<const char *> keys; + int uniqueKeys = 0; + const QMetaObject *qtMetaObject = StaticQtMetaObject::get(); + for (int ii = 0; ii < qtMetaObject->enumeratorCount(); ++ii) { + QMetaEnum enumerator = qtMetaObject->enumerator(ii); + for (int jj = 0; jj < enumerator.keyCount(); ++jj) { + auto key = enumerator.key(jj); +// qDebug() << "key:" << key; + if (!keys.contains(key)) { + ++uniqueKeys; + keys.insert(key); + } + QVERIFY(values.contains(key)); + QVariant value = values.value(key); + QVERIFY(value.canConvert<int>()); + QCOMPARE(value.toInt(), enumerator.value(jj)); + } + } + QVERIFY(values.contains("Asynchronous")); + QCOMPARE(values.value("Asynchronous").toInt(), 0); + ++uniqueKeys; + QVERIFY(values.contains("Synchronous")); + QCOMPARE(values.value("Synchronous").toInt(), 1); + ++uniqueKeys; + QCOMPARE(values.count(), uniqueKeys); + + delete object; +} + QTEST_MAIN(tst_qqmlqt) #include "tst_qqmlqt.moc" diff --git a/tests/auto/qml/qqmltypeloader/SlowImport/plugin.h b/tests/auto/qml/qqmltypeloader/SlowImport/plugin.h index d3a3b81832..34b3920a38 100644 --- a/tests/auto/qml/qqmltypeloader/SlowImport/plugin.h +++ b/tests/auto/qml/qqmltypeloader/SlowImport/plugin.h @@ -35,7 +35,7 @@ class SlowPlugin : public QQmlExtensionPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: void registerTypes(const char *uri); diff --git a/tests/auto/qml/qqmltypeloader/data/trim_cache.qml b/tests/auto/qml/qqmltypeloader/data/trim_cache.qml new file mode 100644 index 0000000000..74303977dd --- /dev/null +++ b/tests/auto/qml/qqmltypeloader/data/trim_cache.qml @@ -0,0 +1,8 @@ +import QtQuick 2.2 +Rectangle +{ + objectName: "dings" + width: 100 + height: 100 + color: "blue" +} diff --git a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp index 24358897f7..ef1ea3a897 100644 --- a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp +++ b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp @@ -30,6 +30,9 @@ #include <QtQml/qqmlengine.h> #include <QtQuick/qquickview.h> #include <QtQuick/qquickitem.h> +#include <QtQml/private/qqmlengine_p.h> +#include <QtQml/private/qqmltypeloader_p.h> +#include <QtQml/private/qqmlcompiler_p.h> #include "../../shared/util.h" class tst_QQMLTypeLoader : public QQmlDataTest @@ -39,6 +42,7 @@ class tst_QQMLTypeLoader : public QQmlDataTest private slots: void testLoadComplete(); void loadComponentSynchronously(); + void trimCache(); }; void tst_QQMLTypeLoader::testLoadComplete() @@ -68,6 +72,32 @@ void tst_QQMLTypeLoader::loadComponentSynchronously() QVERIFY(o); } +void tst_QQMLTypeLoader::trimCache() +{ + QQmlEngine engine; + QQmlTypeLoader &loader = QQmlEnginePrivate::get(&engine)->typeLoader; + for (int i = 0; i < 256; ++i) { + QUrl url = testFileUrl("trim_cache.qml"); + url.setQuery(QString::number(i)); + + QQmlTypeData *data = loader.getType(url); + if (i % 5 == 0) // keep references to some of them so that they aren't trimmed + data->compiledData()->addref(); + + data->release(); + } + + for (int i = 0; i < 256; ++i) { + QUrl url = testFileUrl("trim_cache.qml"); + url.setQuery(QString::number(i)); + if (i % 5 == 0) + QVERIFY(loader.isTypeLoaded(url)); + else if (i < 128) + QVERIFY(!loader.isTypeLoaded(url)); + // The cache is free to keep the others. + } +} + QTEST_MAIN(tst_QQMLTypeLoader) #include "tst_qqmltypeloader.moc" diff --git a/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp index 300f5b90e5..f506d0f53a 100644 --- a/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp +++ b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp @@ -30,6 +30,7 @@ #include <QQmlEngine> #include <QQmlComponent> #include <QDebug> +#include <QJSValueIterator> #include <private/qquickvaluetypes_p.h> #include <private/qqmlglobal_p.h> #include "../../shared/util.h" @@ -89,6 +90,7 @@ private slots: void customValueTypeInQml(); void gadgetInheritance(); void toStringConversion(); + void enumerableProperties(); private: QQmlEngine engine; @@ -1649,6 +1651,25 @@ void tst_qqmlvaluetypes::toStringConversion() QCOMPARE(stringConversion.toString(), StringLessGadget_to_QString(g)); } +void tst_qqmlvaluetypes::enumerableProperties() +{ + QJSEngine engine; + DerivedGadget g; + QJSValue value = engine.toScriptValue(g); + QSet<QString> names; + QJSValueIterator it(value); + while (it.hasNext()) { + it.next(); + const QString name = it.name(); + QVERIFY(!names.contains(name)); + names.insert(name); + } + + QCOMPARE(names.count(), 2); + QVERIFY(names.contains(QStringLiteral("baseProperty"))); + QVERIFY(names.contains(QStringLiteral("derivedProperty"))); +} + QTEST_MAIN(tst_qqmlvaluetypes) diff --git a/tests/auto/quick/qquickanchors/tst_qquickanchors.cpp b/tests/auto/quick/qquickanchors/tst_qquickanchors.cpp index ab111a6cd3..77fa1292c4 100644 --- a/tests/auto/quick/qquickanchors/tst_qquickanchors.cpp +++ b/tests/auto/quick/qquickanchors/tst_qquickanchors.cpp @@ -39,7 +39,6 @@ #include "../shared/visualtestutil.h" Q_DECLARE_METATYPE(QQuickAnchors::Anchor) -Q_DECLARE_METATYPE(QQuickAnchorLine::AnchorLine) using namespace QQuickVisualTestUtil; @@ -351,14 +350,13 @@ void tst_qquickanchors::illegalSets_data() void tst_qquickanchors::reset() { QFETCH(QString, side); - QFETCH(QQuickAnchorLine::AnchorLine, anchorLine); - QFETCH(QQuickAnchors::Anchor, usedAnchor); + QFETCH(QQuickAnchors::Anchor, anchor); QQuickItem *baseItem = new QQuickItem; - QQuickAnchorLine anchor; - anchor.item = baseItem; - anchor.anchorLine = anchorLine; + QQuickAnchorLine anchorLine; + anchorLine.item = baseItem; + anchorLine.anchorLine = anchor; QQuickItem *item = new QQuickItem; QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item); @@ -366,11 +364,11 @@ void tst_qquickanchors::reset() const QMetaObject *meta = itemPrivate->anchors()->metaObject(); QMetaProperty p = meta->property(meta->indexOfProperty(side.toUtf8().constData())); - QVERIFY(p.write(itemPrivate->anchors(), qVariantFromValue(anchor))); - QCOMPARE(itemPrivate->anchors()->usedAnchors().testFlag(usedAnchor), true); + QVERIFY(p.write(itemPrivate->anchors(), qVariantFromValue(anchorLine))); + QCOMPARE(itemPrivate->anchors()->usedAnchors().testFlag(anchor), true); QVERIFY(p.reset(itemPrivate->anchors())); - QCOMPARE(itemPrivate->anchors()->usedAnchors().testFlag(usedAnchor), false); + QCOMPARE(itemPrivate->anchors()->usedAnchors().testFlag(anchor), false); delete item; delete baseItem; @@ -379,17 +377,16 @@ void tst_qquickanchors::reset() void tst_qquickanchors::reset_data() { QTest::addColumn<QString>("side"); - QTest::addColumn<QQuickAnchorLine::AnchorLine>("anchorLine"); - QTest::addColumn<QQuickAnchors::Anchor>("usedAnchor"); + QTest::addColumn<QQuickAnchors::Anchor>("anchor"); - QTest::newRow("left") << "left" << QQuickAnchorLine::Left << QQuickAnchors::LeftAnchor; - QTest::newRow("top") << "top" << QQuickAnchorLine::Top << QQuickAnchors::TopAnchor; - QTest::newRow("right") << "right" << QQuickAnchorLine::Right << QQuickAnchors::RightAnchor; - QTest::newRow("bottom") << "bottom" << QQuickAnchorLine::Bottom << QQuickAnchors::BottomAnchor; + QTest::newRow("left") << "left" << QQuickAnchors::LeftAnchor; + QTest::newRow("top") << "top" << QQuickAnchors::TopAnchor; + QTest::newRow("right") << "right" << QQuickAnchors::RightAnchor; + QTest::newRow("bottom") << "bottom" << QQuickAnchors::BottomAnchor; - QTest::newRow("hcenter") << "horizontalCenter" << QQuickAnchorLine::HCenter << QQuickAnchors::HCenterAnchor; - QTest::newRow("vcenter") << "verticalCenter" << QQuickAnchorLine::VCenter << QQuickAnchors::VCenterAnchor; - QTest::newRow("baseline") << "baseline" << QQuickAnchorLine::Baseline << QQuickAnchors::BaselineAnchor; + QTest::newRow("hcenter") << "horizontalCenter" << QQuickAnchors::HCenterAnchor; + QTest::newRow("vcenter") << "verticalCenter" << QQuickAnchors::VCenterAnchor; + QTest::newRow("baseline") << "baseline" << QQuickAnchors::BaselineAnchor; } void tst_qquickanchors::resetConvenience() diff --git a/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp b/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp index b0f0f886a0..b34f58f7c4 100644 --- a/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp +++ b/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp @@ -60,6 +60,7 @@ private slots: void remote_data(); void sourceSize(); void sourceSizeChanges(); + void sourceSizeChanges_intermediate(); void sourceSizeReadOnly(); void invalidSource(); void qtbug_16520(); @@ -205,16 +206,12 @@ void tst_qquickanimatedimage::mirror_notRunning() int frame = anim->currentFrame(); bool playing = anim->isPlaying(); - bool paused = anim->isPlaying(); + bool paused = anim->isPaused(); anim->setProperty("mirror", true); screenshot = window.grabWindow(); screenshot.save("screen.png"); -#if defined(Q_OS_WIN) - // QTBUG-36717 - QSKIP("This test is failing in the CI system under mysterious circumstances"); -#endif QCOMPARE(screenshot, expected); // mirroring should not change the current frame or playing status @@ -374,6 +371,28 @@ void tst_qquickanimatedimage::sourceSizeChanges() delete anim; } +void tst_qquickanimatedimage::sourceSizeChanges_intermediate() +{ + QQmlEngine engine; + QQmlComponent component(&engine); + component.setData("import QtQuick 2.0\nAnimatedImage { readonly property int testWidth: status === AnimatedImage.Ready ? sourceSize.width : -1; source: srcImage }", QUrl::fromLocalFile("")); + QTRY_VERIFY(component.isReady()); + QQmlContext *ctxt = engine.rootContext(); + ctxt->setContextProperty("srcImage", ""); + + QScopedPointer<QQuickAnimatedImage> anim(qobject_cast<QQuickAnimatedImage*>(component.create())); + QVERIFY(anim != 0); + + ctxt->setContextProperty("srcImage", testFileUrl("hearts.gif")); + QTRY_COMPARE(anim->status(), QQuickAnimatedImage::Ready); + QTRY_COMPARE(anim->property("testWidth").toInt(), anim->sourceSize().width()); + + ctxt->setContextProperty("srcImage", testFileUrl("hearts_copy.gif")); + QTRY_COMPARE(anim->status(), QQuickAnimatedImage::Ready); + QTRY_COMPARE(anim->property("testWidth").toInt(), anim->sourceSize().width()); +} + + void tst_qquickanimatedimage::qtbug_16520() { TestHTTPServer server; diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_imagedata.qml b/tests/auto/quick/qquickcanvasitem/data/tst_imagedata.qml new file mode 100644 index 0000000000..7095602ea2 --- /dev/null +++ b/tests/auto/quick/qquickcanvasitem/data/tst_imagedata.qml @@ -0,0 +1,22 @@ +import QtQuick 2.0 +import QtTest 1.1 + +CanvasTestCase { + id:testCase + name: "imagedata" + function init_data() { return testData("2d"); } + function test_rounding(row) { + var canvas = createCanvasObject(row); + var ctx = canvas.getContext('2d'); + var size = 17 + ctx.reset(); + ctx.fillStyle = Qt.rgba(0.7, 0.8, 0.9, 1.0); + ctx.fillRect(0, 0, size, size); + + var center = size / 2; + var imageData = ctx.getImageData(center, center, center, center); + comparePixel(ctx, center, center, imageData.data[0], imageData.data[1], imageData.data[2], imageData.data[3]); + + canvas.destroy(); + } +} diff --git a/tests/auto/quick/qquickcanvasitem/qquickcanvasitem.pro b/tests/auto/quick/qquickcanvasitem/qquickcanvasitem.pro index 3c41d498e5..c6d2a69f8c 100644 --- a/tests/auto/quick/qquickcanvasitem/qquickcanvasitem.pro +++ b/tests/auto/quick/qquickcanvasitem/qquickcanvasitem.pro @@ -25,6 +25,7 @@ OTHER_FILES += \ data/tst_arcto.qml \ data/tst_arc.qml \ data/tst_context.qml \ + data/tst_imagedata.qml \ data/CanvasTestCase.qml \ data/CanvasComponent.qml \ data/tst_image.qml \ diff --git a/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp b/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp index a7b5f4943e..6a919d048e 100644 --- a/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp +++ b/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp @@ -139,6 +139,8 @@ private slots: void cleanupTestCase(); void active(); + void setActive_data(); + void setActive(); void drop(); void move(); void parentChange(); @@ -374,6 +376,50 @@ void tst_QQuickDrag::active() QCOMPARE(dropTarget.enterEvents, 0); QCOMPARE(dropTarget.leaveEvents, 0); QCOMPARE(dropTarget.moveEvents, 0); } +void tst_QQuickDrag::setActive_data() +{ + QTest::addColumn<QString>("dragType"); + + QTest::newRow("default") << ""; + QTest::newRow("internal") << "Drag.dragType: Drag.Internal"; + QTest::newRow("none") << "Drag.dragType: Drag.None"; + /* We don't test Drag.Automatic, because that causes QDrag::exec() to be + * invoked, and on some platforms tha's implemented by running a main loop + * until the drag has finished -- and at that point, the Drag.active will + * be false again. */ +} + +// QTBUG-52540 +void tst_QQuickDrag::setActive() +{ + QFETCH(QString, dragType); + + QQuickWindow window; + TestDropTarget dropTarget(window.contentItem()); + dropTarget.setSize(QSizeF(100, 100)); + QQmlComponent component(&engine); + component.setData( + "import QtQuick 2.0\n" + "Item {\n" + "property bool dragActive: Drag.active\n" + "property Item dragTarget: Drag.target\n" + + dragType.toUtf8() + "\n" + "x: 50; y: 50\n" + "width: 10; height: 10\n" + "}", QUrl()); + QScopedPointer<QObject> object(component.create()); + QQuickItem *item = qobject_cast<QQuickItem *>(object.data()); + QVERIFY(item); + item->setParentItem(&dropTarget); + + QCOMPARE(evaluate<bool>(item, "Drag.active"), false); + QCOMPARE(evaluate<bool>(item, "dragActive"), false); + + evaluate<void>(item, "Drag.active = true"); + QCOMPARE(evaluate<bool>(item, "Drag.active"), true); + QCOMPARE(evaluate<bool>(item, "dragActive"), true); +} + void tst_QQuickDrag::drop() { QQuickWindow window; diff --git a/tests/auto/quick/qquickpathview/data/movementDirection.qml b/tests/auto/quick/qquickpathview/data/movementDirection.qml new file mode 100644 index 0000000000..fce914dd68 --- /dev/null +++ b/tests/auto/quick/qquickpathview/data/movementDirection.qml @@ -0,0 +1,43 @@ +import QtQuick 2.0 + +Item { + id: root + width: 320; height: 480 + + PathView { + id: view + objectName: "view" + anchors.fill: parent + + model: ListModel { + ListElement { lColor: "red" } + ListElement { lColor: "green" } + ListElement { lColor: "yellow" } + ListElement { lColor: "blue" } + ListElement { lColor: "purple" } + ListElement { lColor: "gray" } + ListElement { lColor: "brown" } + ListElement { lColor: "thistle" } + } + + delegate: Component { + id: photoDelegate + Rectangle { + id: wrapper + objectName: "wrapper" + width: 40; height: 40; color: lColor + + Text { text: index } + } + } + + snapMode: PathView.SnapToItem + highlightMoveDuration: 1000 + path: Path { + startX: 0+20; startY: root.height/2 + PathLine { x: root.width*2; y: root.height/2 } + } + + Text { text: "Offset: " + view.offset } + } +} diff --git a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp index 51c772f540..6761313210 100644 --- a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp +++ b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp @@ -137,6 +137,8 @@ private slots: void jsArrayChange(); void qtbug42716(); void addCustomAttribute(); + void movementDirection_data(); + void movementDirection(); }; class TestObject : public QObject @@ -2383,6 +2385,72 @@ void tst_QQuickPathView::addCustomAttribute() window->show(); } +void tst_QQuickPathView::movementDirection_data() +{ + QTest::addColumn<QQuickPathView::MovementDirection>("movementdirection"); + QTest::addColumn<int>("toidx"); + QTest::addColumn<qreal>("fromoffset"); + QTest::addColumn<qreal>("tooffset"); + + QTest::newRow("default-shortest") << QQuickPathView::Shortest << 3 << 8.0 << 5.0; + QTest::newRow("negative") << QQuickPathView::Negative << 2 << 0.0 << 6.0; + QTest::newRow("positive") << QQuickPathView::Positive << 3 << 8.0 << 5.0; + +} + +static void verify_offsets(QQuickPathView *pathview, int toidx, qreal fromoffset, qreal tooffset) +{ + pathview->setCurrentIndex(toidx); + bool started = false; + qreal first, second; + QTest::qWait(100); + first = pathview->offset(); + while (1) { + QTest::qWait(10); // highlightMoveDuration: 1000 + second = pathview->offset(); + if (!started && second != first) { // animation started + started = true; + break; + } + } + + if (tooffset > fromoffset) { + QVERIFY(fromoffset <= first); + QVERIFY(first <= second); + QVERIFY(second <= tooffset); + } else { + QVERIFY(fromoffset >= first); + QVERIFY(first >= second); + QVERIFY(second >= tooffset); + } + QTRY_COMPARE(pathview->offset(), tooffset); +} + +void tst_QQuickPathView::movementDirection() +{ + QFETCH(QQuickPathView::MovementDirection, movementdirection); + QFETCH(int, toidx); + QFETCH(qreal, fromoffset); + QFETCH(qreal, tooffset); + + QScopedPointer<QQuickView> window(createView()); + QQuickViewTestUtil::moveMouseAway(window.data()); + window->setSource(testFileUrl("movementDirection.qml")); + window->show(); + window->requestActivate(); + QVERIFY(QTest::qWaitForWindowActive(window.data())); + QCOMPARE(window.data(), qGuiApp->focusWindow()); + + QQuickPathView *pathview = window->rootObject()->findChild<QQuickPathView*>("view"); + QVERIFY(pathview != 0); + QVERIFY(pathview->offset() == 0.0); + QVERIFY(pathview->currentIndex() == 0); + pathview->setMovementDirection(movementdirection); + QVERIFY(pathview->movementDirection() == movementdirection); + + verify_offsets(pathview, toidx, fromoffset, tooffset); +} + QTEST_MAIN(tst_QQuickPathView) #include "tst_qquickpathview.moc" diff --git a/tests/auto/quick/qquickstates/tst_qquickstates.cpp b/tests/auto/quick/qquickstates/tst_qquickstates.cpp index 562d53bceb..9b152b0676 100644 --- a/tests/auto/quick/qquickstates/tst_qquickstates.cpp +++ b/tests/auto/quick/qquickstates/tst_qquickstates.cpp @@ -698,7 +698,7 @@ void tst_qquickstates::anchorChanges() rectPrivate->setState("right"); QCOMPARE(innerRect->x(), qreal(150)); QCOMPARE(aChanges->object(), qobject_cast<QQuickItem*>(innerRect)); - QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->left().anchorLine, QQuickAnchorLine::Invalid); //### was reset (how do we distinguish from not set at all) + QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->left().anchorLine, QQuickAnchors::InvalidAnchor); //### was reset (how do we distinguish from not set at all) QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->right().item, rectPrivate->right().item); QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->right().anchorLine, rectPrivate->right().anchorLine); @@ -891,7 +891,7 @@ void tst_qquickstates::anchorChangesRTL() rectPrivate->setState("right"); QCOMPARE(innerRect->x(), offsetRTL(rect, innerRect) - qreal(150)); QCOMPARE(aChanges->object(), qobject_cast<QQuickItem*>(innerRect)); - QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->left().anchorLine, QQuickAnchorLine::Invalid); //### was reset (how do we distinguish from not set at all) + QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->left().anchorLine, QQuickAnchors::InvalidAnchor); //### was reset (how do we distinguish from not set at all) QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->right().item, rectPrivate->right().item); QCOMPARE(QQuickItemPrivate::get(aChanges->object())->anchors()->right().anchorLine, rectPrivate->right().anchorLine); diff --git a/tests/auto/quick/qquicktext/tst_qquicktext.cpp b/tests/auto/quick/qquicktext/tst_qquicktext.cpp index 7ea36bbafa..8b7d8c0711 100644 --- a/tests/auto/quick/qquicktext/tst_qquicktext.cpp +++ b/tests/auto/quick/qquicktext/tst_qquicktext.cpp @@ -701,7 +701,7 @@ void tst_qquicktext::textFormat() QQuickText *text = qobject_cast<QQuickText *>(object.data()); QVERIFY(text); - QSignalSpy spy(text, SIGNAL(textFormatChanged(TextFormat))); + QSignalSpy spy(text, &QQuickText::textFormatChanged); QCOMPARE(text->textFormat(), QQuickText::AutoText); @@ -915,8 +915,10 @@ void tst_qquicktext::hAlignImplicitWidth() // Try to check whether alignment works by checking the number of black // pixels in the thirds of the grabbed image. - const int windowWidth = 220; - const int textWidth = qCeil(text->implicitWidth()); + // QQuickWindow::grabWindow() scales the returned image by the devicePixelRatio of the screen. + const qreal devicePixelRatio = view.screen()->devicePixelRatio(); + const int windowWidth = 220 * devicePixelRatio; + const int textWidth = qCeil(text->implicitWidth()) * devicePixelRatio; QVERIFY2(textWidth < windowWidth, "System font too large."); const int sectionWidth = textWidth / 3; const int centeredSection1 = (windowWidth - textWidth) / 2; diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp index e26bf6f4e4..24cfadc2d3 100644 --- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp +++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp @@ -1390,7 +1390,7 @@ void tst_qquicktextinput::mouseSelectionMode_accessors() QQuickTextInput *input = qobject_cast<QQuickTextInput *>(object.data()); QVERIFY(input); - QSignalSpy spy(input, SIGNAL(mouseSelectionModeChanged(SelectionMode))); + QSignalSpy spy(input, &QQuickTextInput::mouseSelectionModeChanged); QCOMPARE(input->mouseSelectionMode(), QQuickTextInput::SelectCharacters); diff --git a/tests/auto/quick/quick.pro b/tests/auto/quick/quick.pro index a528810cae..fecd1aea58 100644 --- a/tests/auto/quick/quick.pro +++ b/tests/auto/quick/quick.pro @@ -81,6 +81,7 @@ QUICKTESTS = \ qquickvisualdatamodel \ qquickview \ qquickcanvasitem \ + qquickdesignersupport \ qquickscreen \ touchmouse \ scenegraph diff --git a/tests/benchmarks/qml/creation/tst_creation.cpp b/tests/benchmarks/qml/creation/tst_creation.cpp index 2c8aa04a6a..fa94fd4d46 100644 --- a/tests/benchmarks/qml/creation/tst_creation.cpp +++ b/tests/benchmarks/qml/creation/tst_creation.cpp @@ -74,6 +74,9 @@ private slots: void bindings_parent_qml(); + void anchors_creation(); + void anchors_heightChange(); + private: QQmlEngine engine; }; @@ -462,6 +465,38 @@ void tst_creation::bindings_parent_qml() delete obj; } +void tst_creation::anchors_creation() +{ + QQmlComponent component(&engine); + component.setData("import QtQuick 2.0\nItem { Item { anchors.bottom: parent.bottom } }", QUrl()); + + QObject *obj = component.create(); + delete obj; + + QBENCHMARK { + QObject *obj = component.create(); + delete obj; + } +} + +void tst_creation::anchors_heightChange() +{ + QQmlComponent component(&engine); + component.setData("import QtQuick 2.0\nItem { Item { anchors.bottom: parent.bottom } }", QUrl()); + + QObject *obj = component.create(); + auto item = qobject_cast<QQuickItem *>(obj); + Q_ASSERT(item); + int height = 1; + + QBENCHMARK { + item->setHeight(height); + height += 1; + } + + delete obj; +} + QTEST_MAIN(tst_creation) #include "tst_creation.moc" diff --git a/tests/manual/highdpi/imageprovider.cpp b/tests/manual/highdpi/imageprovider.cpp index 1856a1ea9a..33a69cb87e 100644 --- a/tests/manual/highdpi/imageprovider.cpp +++ b/tests/manual/highdpi/imageprovider.cpp @@ -79,7 +79,7 @@ public: class ImageProviderExtensionPlugin : public QQmlExtensionPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: void registerTypes(const char *uri) { @@ -95,7 +95,4 @@ public: }; -#define QQmlExtensionInterface_iid "org.qt-project.Qt.QQmlExtensionInterface" - - #include "imageprovider.moc" diff --git a/tests/manual/qmlplugindump/tests/dumper/Dummy/dummy_plugin.h b/tests/manual/qmlplugindump/tests/dumper/Dummy/dummy_plugin.h index 739eae0f8a..86e80e6a08 100644 --- a/tests/manual/qmlplugindump/tests/dumper/Dummy/dummy_plugin.h +++ b/tests/manual/qmlplugindump/tests/dumper/Dummy/dummy_plugin.h @@ -34,7 +34,7 @@ class DummyPlugin : public QQmlExtensionPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: void registerTypes(const char *uri); diff --git a/tests/manual/qmlplugindump/tests/dumper/Imports/imports_plugin.h b/tests/manual/qmlplugindump/tests/dumper/Imports/imports_plugin.h index 7c136dea30..fd09584d47 100644 --- a/tests/manual/qmlplugindump/tests/dumper/Imports/imports_plugin.h +++ b/tests/manual/qmlplugindump/tests/dumper/Imports/imports_plugin.h @@ -34,7 +34,7 @@ class ImportsPlugin : public QQmlExtensionPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: void registerTypes(const char *uri); diff --git a/tests/manual/qmlplugindump/tests/dumper/Versions/versions_plugin.h b/tests/manual/qmlplugindump/tests/dumper/Versions/versions_plugin.h index 91e9ce4174..4ba68a8125 100644 --- a/tests/manual/qmlplugindump/tests/dumper/Versions/versions_plugin.h +++ b/tests/manual/qmlplugindump/tests/dumper/Versions/versions_plugin.h @@ -34,7 +34,7 @@ class VersionsPlugin : public QQmlExtensionPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: void registerTypes(const char *uri); diff --git a/tests/manual/qmltypememory/TestPlugin/plugin.cpp b/tests/manual/qmltypememory/TestPlugin/plugin.cpp index ddc5430b43..d6cbf05a55 100644 --- a/tests/manual/qmltypememory/TestPlugin/plugin.cpp +++ b/tests/manual/qmltypememory/TestPlugin/plugin.cpp @@ -50,7 +50,7 @@ class TestType : public QObject class TestPlugin : public QQmlExtensionPlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: void registerTypes(const char *uri) diff --git a/tests/manual/scenegraph_lancelot/data/text/textedit_multiline_selected_linebreaks_and_linewraps2.qml b/tests/manual/scenegraph_lancelot/data/text/textedit_multiline_selected_linebreaks_and_linewraps2.qml new file mode 100644 index 0000000000..c16bc9cdf7 --- /dev/null +++ b/tests/manual/scenegraph_lancelot/data/text/textedit_multiline_selected_linebreaks_and_linewraps2.qml @@ -0,0 +1,22 @@ +import QtQuick 2.0 + +Item { + width: 550 + height: 480 + + TextEdit { + id: textEdit + anchors.centerIn: parent + width: 550 + textFormat: TextEdit.RichText + text: "A<br /> + This is a long message to demenostrate a text selection issue. I need to type some more text here. This is line 3<br /> + This is a long message to demenostrate a text selection issue. I need to type some more text here. This is line 4" + wrapMode: TextEdit.Wrap + + Component.onCompleted: { + textEdit.selectAll() + } + } + +} |