diff options
Diffstat (limited to 'tests')
64 files changed, 613 insertions, 665 deletions
diff --git a/tests/auto/particles/qquickparticlesystem/data/crashaffectors.qml b/tests/auto/particles/qquickparticlesystem/data/crashaffectors.qml index de105916a7..61599adc09 100644 --- a/tests/auto/particles/qquickparticlesystem/data/crashaffectors.qml +++ b/tests/auto/particles/qquickparticlesystem/data/crashaffectors.qml @@ -1,31 +1,26 @@ /**************************************************************************** ** ** Copyright (C) 2017 reMarkable A/S -** Contact: http://www.qt.io/licensing/ +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://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. +** 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$ ** diff --git a/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp b/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp index 584bd10151..441f8c113f 100644 --- a/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp +++ b/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp @@ -46,7 +46,7 @@ using namespace QV4; using namespace QV4::Debugging; -typedef QV4::ReturnedValue (*InjectedFunction)(QV4::CallContext*); +typedef void (*InjectedFunction)(const QV4::BuiltinFunction *, QV4::Scope &scope, QV4::CallData *callData); Q_DECLARE_METATYPE(InjectedFunction) static bool waitForSignal(QObject* obj, const char* signal, int timeout = 10000) @@ -438,11 +438,11 @@ void tst_qv4debugger::addBreakPointWhilePaused() QCOMPARE(state.lineNumber, 2); } -static QV4::ReturnedValue someCall(QV4::CallContext *ctx) +static void someCall(const QV4::BuiltinFunction *, QV4::Scope &scope, QV4::CallData *) { - static_cast<QV4Debugger *>(ctx->d()->engine->debugger()) + static_cast<QV4Debugger *>(scope.engine->debugger()) ->removeBreakPoint("removeBreakPointForNextInstruction", 2); - return QV4::Encode::undefined(); + RETURN_UNDEFINED(); } void tst_qv4debugger::removeBreakPointForNextInstruction() diff --git a/tests/auto/qml/ecmascripttests/test262.py b/tests/auto/qml/ecmascripttests/test262.py index 99f029cffd..9f0a7c1dee 100755 --- a/tests/auto/qml/ecmascripttests/test262.py +++ b/tests/auto/qml/ecmascripttests/test262.py @@ -569,6 +569,7 @@ def Main(): #logging.basicConfig(level=logging.DEBUG) os.environ["TZ"] = "PST8PDT" os.environ["LANG"] = "en_US.UTF-8" + os.environ["LC_TIME"] = "en_US.UTF-8" parser = BuildOptions() (options, args) = parser.parse_args() ValidateOptions(options) diff --git a/tests/auto/qml/qqmlconnections/data/disabled-at-start.qml b/tests/auto/qml/qqmlconnections/data/disabled-at-start.qml new file mode 100644 index 0000000000..1a823f87f6 --- /dev/null +++ b/tests/auto/qml/qqmlconnections/data/disabled-at-start.qml @@ -0,0 +1,14 @@ +import QtQuick 2.9 + +Item { + id: root + + property bool tested: false + signal testMe() + + Connections { + target: root + enabled: false + onTestMe: root.tested = true; + } +} diff --git a/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp b/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp index 1ed94fcb93..22e9724c61 100644 --- a/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp +++ b/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp @@ -52,6 +52,7 @@ private slots: void rewriteErrors(); void singletonTypeTarget(); void enableDisable_QTBUG_36350(); + void disabledAtStart(); void clearImplicitTarget(); void onWithoutASignal(); @@ -354,6 +355,23 @@ void tst_qqmlconnections::enableDisable_QTBUG_36350() delete item; } +void tst_qqmlconnections::disabledAtStart() +{ + QQmlEngine engine; + QQmlComponent c(&engine, testFileUrl("disabled-at-start.qml")); + QObject * const object = c.create(); + + QVERIFY(object != 0); + + QCOMPARE(object->property("tested").toBool(), false); + const int index = object->metaObject()->indexOfSignal("testMe()"); + const QMetaMethod method = object->metaObject()->method(index); + method.invoke(object, Qt::DirectConnection); + QCOMPARE(object->property("tested").toBool(), false); + + delete object; +} + //QTBUG-56499 void tst_qqmlconnections::clearImplicitTarget() { diff --git a/tests/auto/qml/qqmlecmascript/data/qtbug60547/TestObject.qml b/tests/auto/qml/qqmlecmascript/data/qtbug60547/TestObject.qml new file mode 100644 index 0000000000..5f022f605a --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/qtbug60547/TestObject.qml @@ -0,0 +1,11 @@ +import QtQuick 2.0 +import "components" + +QtObject { + id: root + property int counter + function increment() { + counter++ + return counter + } +} diff --git a/tests/auto/qml/qqmlecmascript/data/qtbug60547/components/Counter.qml b/tests/auto/qml/qqmlecmascript/data/qtbug60547/components/Counter.qml new file mode 100644 index 0000000000..3c5e65a340 --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/qtbug60547/components/Counter.qml @@ -0,0 +1,4 @@ +import QtQuick 2.0 + +QtObject {} + diff --git a/tests/auto/qml/qqmlecmascript/data/qtbug60547/main.qml b/tests/auto/qml/qqmlecmascript/data/qtbug60547/main.qml new file mode 100644 index 0000000000..b09366e9df --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/qtbug60547/main.qml @@ -0,0 +1,8 @@ +import QtQml 2.0 + +TestObject { + Component.onCompleted: { + increment() + } +} + diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 07ae9821e9..45f312e934 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -341,6 +341,7 @@ private slots: void redefineGlobalProp(); void freeze_empty_object(); void singleBlockLoops(); + void qtbug_60547(); private: // static void propertyVarWeakRefCallback(v8::Persistent<v8::Value> object, void* parameter); @@ -8358,6 +8359,16 @@ void tst_qqmlecmascript::singleBlockLoops() QVERIFY(!component.isError()); } +// 'counter' was incorrectly resolved as a type rather than a variable. +// This fix ensures it looks up the right thing. +void tst_qqmlecmascript::qtbug_60547() +{ + QQmlComponent component(&engine, testFileUrl("qtbug60547/main.qml")); + QScopedPointer<QObject> object(component.create()); + QVERIFY2(!object.isNull(), qPrintable(component.errorString())); + QCOMPARE(object->property("counter"), QVariant(int(1))); +} + QTEST_MAIN(tst_qqmlecmascript) #include "tst_qqmlecmascript.moc" diff --git a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp index 3f6107ab2b..07569efc72 100644 --- a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp +++ b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp @@ -36,6 +36,7 @@ #include <QSignalSpy> #include <QDebug> #include <QBuffer> +#include <QCryptographicHash> #include <QQmlComponent> #include <QQmlNetworkAccessManagerFactory> #include <QQmlExpression> diff --git a/tests/auto/qml/qqmlextensionplugin/tst_qqmlextensionplugin.cpp b/tests/auto/qml/qqmlextensionplugin/tst_qqmlextensionplugin.cpp index 124a107a37..268010ead8 100644 --- a/tests/auto/qml/qqmlextensionplugin/tst_qqmlextensionplugin.cpp +++ b/tests/auto/qml/qqmlextensionplugin/tst_qqmlextensionplugin.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 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$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://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. +** 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$ ** diff --git a/tests/auto/qml/qqmllanguage/data/ConcurrentLoadA.qml b/tests/auto/qml/qqmllanguage/data/ConcurrentLoadA.qml new file mode 100644 index 0000000000..3d538c7572 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/ConcurrentLoadA.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 +import testModule 1.0 + +Item { + Test {} +} + diff --git a/tests/auto/qml/qqmllanguage/data/ConcurrentLoadB.qml b/tests/auto/qml/qqmllanguage/data/ConcurrentLoadB.qml new file mode 100644 index 0000000000..3d538c7572 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/ConcurrentLoadB.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 +import testModule 1.0 + +Item { + Test {} +} + diff --git a/tests/auto/qml/qqmllanguage/data/concurrentLoad_main.qml b/tests/auto/qml/qqmllanguage/data/concurrentLoad_main.qml new file mode 100644 index 0000000000..8cfc90ac96 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/concurrentLoad_main.qml @@ -0,0 +1,5 @@ +import QtQuick 2.0 +Rectangle { +ConcurrentLoadA {} +ConcurrentLoadB {} +} diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index cc5b8cacbc..15f19d550b 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -267,6 +267,8 @@ private slots: void instanceof_data(); void instanceof(); + void concurrentLoadQmlDir(); + private: QQmlEngine engine; QStringList defaultImportPathList; @@ -4559,6 +4561,20 @@ void tst_qqmllanguage::instanceof() } } +void tst_qqmllanguage::concurrentLoadQmlDir() +{ + ThreadedTestHTTPServer server(dataDirectory()); + QString serverdir = server.urlString("/lib/"); + engine.setImportPathList(QStringList(defaultImportPathList) << serverdir); + + QQmlComponent component(&engine, testFileUrl("concurrentLoad_main.qml")); + QTRY_VERIFY(component.isReady()); + VERIFY_ERRORS(0); + QScopedPointer<QObject> o(component.create()); + QVERIFY(!o.isNull()); + engine.setImportPathList(defaultImportPathList); +} + QTEST_MAIN(tst_qqmllanguage) #include "tst_qqmllanguage.moc" diff --git a/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp b/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp index 357482b93f..ba2b836a6d 100644 --- a/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp +++ b/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp @@ -49,6 +49,7 @@ private slots: void qmlParser_data(); void qmlParser(); #endif + void invalidEscapeSequence(); private: QStringList excludedDirs; @@ -192,6 +193,17 @@ void tst_qqmlparser::qmlParser() } #endif +void tst_qqmlparser::invalidEscapeSequence() +{ + using namespace QQmlJS; + + Engine engine; + Lexer lexer(&engine); + lexer.setCode(QLatin1String("\"\\"), 1); + Parser parser(&engine); + parser.parse(); +} + QTEST_MAIN(tst_qqmlparser) #include "tst_qqmlparser.moc" diff --git a/tests/auto/qml/qqmlsettings/data/aliases.qml b/tests/auto/qml/qqmlsettings/data/aliases.qml index 18bd7a0e07..dd11147532 100644 --- a/tests/auto/qml/qqmlsettings/data/aliases.qml +++ b/tests/auto/qml/qqmlsettings/data/aliases.qml @@ -38,8 +38,10 @@ QtObject { property double doubleProperty: 3.45 property string stringProperty: "foo" property url urlProperty: "http://www.qt-project.org" + property var objectProperty: {"foo":"bar"} property var intListProperty: [1, 2, 3] property var stringListProperty: ["a", "b", "c"] + property var objectListProperty: [{"a":"b"}, {"c":"d"}] property date dateProperty: "2000-01-02" // QTBUG-32295: Expected property type //property time timeProperty: "12:34:56" @@ -58,8 +60,10 @@ QtObject { property alias doubleProperty: root.doubleProperty property alias stringProperty: root.stringProperty property alias urlProperty: root.urlProperty + property alias objectProperty: root.objectProperty property alias intListProperty: root.intListProperty property alias stringListProperty: root.stringListProperty + property alias objectListProperty: root.objectListProperty property alias dateProperty: root.dateProperty // QTBUG-32295: Expected property type //property alias timeProperty: root.timeProperty diff --git a/tests/auto/qml/qqmlsettings/data/cpp-aliases.qml b/tests/auto/qml/qqmlsettings/data/cpp-aliases.qml index 8540838fb9..f5b18d1825 100644 --- a/tests/auto/qml/qqmlsettings/data/cpp-aliases.qml +++ b/tests/auto/qml/qqmlsettings/data/cpp-aliases.qml @@ -40,8 +40,10 @@ CppObject { property alias doubleProperty: obj.doubleProperty property alias stringProperty: obj.stringProperty property alias urlProperty: obj.urlProperty + property alias objectProperty: obj.objectProperty property alias intListProperty: obj.intListProperty property alias stringListProperty: obj.stringListProperty + property alias objectListProperty: obj.objectListProperty property alias dateProperty: obj.dateProperty // QTBUG-32295: Expected property type //property alias timeProperty: obj.timeProperty diff --git a/tests/auto/qml/qqmlsettings/data/types.qml b/tests/auto/qml/qqmlsettings/data/types.qml index d1301af057..c4efa0be7c 100644 --- a/tests/auto/qml/qqmlsettings/data/types.qml +++ b/tests/auto/qml/qqmlsettings/data/types.qml @@ -38,8 +38,10 @@ QtObject { property double doubleProperty property string stringProperty property url urlProperty + property var objectProperty property var intListProperty property var stringListProperty + property var objectListProperty property date dateProperty // QTBUG-32295: Expected property type // property time timeProperty @@ -64,8 +66,10 @@ QtObject { to.doubleProperty = from.doubleProperty to.stringProperty = from.stringProperty to.urlProperty = from.urlProperty + to.objectProperty = from.objectProperty to.intListProperty = from.intListProperty to.stringListProperty = from.stringListProperty + to.objectListProperty = from.objectListProperty to.dateProperty = from.dateProperty //to.timeProperty = from.timeProperty to.sizeProperty = from.sizeProperty @@ -84,8 +88,10 @@ QtObject { property double doubleProperty: 3.45 property string stringProperty: "foo" property url urlProperty: "http://www.qt-project.org" + property var objectProperty: {"foo":"bar"} property var intListProperty: [1, 2, 3] property var stringListProperty: ["a", "b", "c"] + property var objectListProperty: [{"a":"b"}, {"c":"d"}] property date dateProperty: "2000-01-02" // QTBUG-32295: Expected property type //property time timeProperty: "12:34:56" diff --git a/tests/auto/qml/qqmlsettings/tst_qqmlsettings.cpp b/tests/auto/qml/qqmlsettings/tst_qqmlsettings.cpp index c2e20f8892..e08389045c 100644 --- a/tests/auto/qml/qqmlsettings/tst_qqmlsettings.cpp +++ b/tests/auto/qml/qqmlsettings/tst_qqmlsettings.cpp @@ -55,25 +55,36 @@ private slots: void initial(); }; +// ### Replace keyValueMap("foo", "bar") with QVariantMap({{"foo", "bar"}}) +// when C++11 uniform initialization can be used (not supported by MSVC 2013). +static QVariantMap keyValueMap(const QString &key, const QString &value) +{ + QVariantMap var; + var.insert(key, value); + return var; +} + class CppObject : public QObject { Q_OBJECT - Q_PROPERTY(int intProperty READ intProperty WRITE setIntProperty NOTIFY intPropertyChanged) - Q_PROPERTY(bool boolProperty READ boolProperty WRITE setBoolProperty NOTIFY boolPropertyChanged) - Q_PROPERTY(qreal realProperty READ realProperty WRITE setRealProperty NOTIFY realPropertyChanged) - Q_PROPERTY(double doubleProperty READ doubleProperty WRITE setDoubleProperty NOTIFY doublePropertyChanged) - Q_PROPERTY(QString stringProperty READ stringProperty WRITE setStringProperty NOTIFY stringPropertyChanged) - Q_PROPERTY(QUrl urlProperty READ urlProperty WRITE setUrlProperty NOTIFY urlPropertyChanged) - Q_PROPERTY(QVariant varProperty READ varProperty WRITE setVarProperty NOTIFY varPropertyChanged) - Q_PROPERTY(QVariantList intListProperty READ intListProperty WRITE setIntListProperty NOTIFY intListPropertyChanged) - Q_PROPERTY(QVariantList stringListProperty READ stringListProperty WRITE setStringListProperty NOTIFY stringListPropertyChanged) - Q_PROPERTY(QDate dateProperty READ dateProperty WRITE setDateProperty NOTIFY datePropertyChanged) - // QTBUG-32295: Q_PROPERTY(QTime timeProperty READ timeProperty WRITE setTimeProperty NOTIFY timePropertyChanged) - Q_PROPERTY(QSizeF sizeProperty READ sizeProperty WRITE setSizeProperty NOTIFY sizePropertyChanged) - Q_PROPERTY(QPointF pointProperty READ pointProperty WRITE setPointProperty NOTIFY pointPropertyChanged) - Q_PROPERTY(QRectF rectProperty READ rectProperty WRITE setRectProperty NOTIFY rectPropertyChanged) - Q_PROPERTY(QColor colorProperty READ colorProperty WRITE setColorProperty NOTIFY colorPropertyChanged) - Q_PROPERTY(QFont fontProperty READ fontProperty WRITE setFontProperty NOTIFY fontPropertyChanged) + Q_PROPERTY(int intProperty MEMBER m_intProperty NOTIFY intPropertyChanged) + Q_PROPERTY(bool boolProperty MEMBER m_boolProperty NOTIFY boolPropertyChanged) + Q_PROPERTY(qreal realProperty MEMBER m_realProperty NOTIFY realPropertyChanged) + Q_PROPERTY(double doubleProperty MEMBER m_doubleProperty NOTIFY doublePropertyChanged) + Q_PROPERTY(QString stringProperty MEMBER m_stringProperty NOTIFY stringPropertyChanged) + Q_PROPERTY(QUrl urlProperty MEMBER m_urlProperty NOTIFY urlPropertyChanged) + Q_PROPERTY(QVariant varProperty MEMBER m_varProperty NOTIFY varPropertyChanged) + Q_PROPERTY(QVariantMap objectProperty MEMBER m_objectProperty NOTIFY objectPropertyChanged) + Q_PROPERTY(QVariantList intListProperty MEMBER m_intListProperty NOTIFY intListPropertyChanged) + Q_PROPERTY(QVariantList stringListProperty MEMBER m_stringListProperty NOTIFY stringListPropertyChanged) + Q_PROPERTY(QVariantList objectListProperty MEMBER m_objectListProperty NOTIFY objectListPropertyChanged) + Q_PROPERTY(QDate dateProperty MEMBER m_dateProperty NOTIFY datePropertyChanged) + // QTBUG-32295: Q_PROPERTY(QTime timeProperty MEMBER m_timeProperty NOTIFY timePropertyChanged) + Q_PROPERTY(QSizeF sizeProperty MEMBER m_sizeProperty NOTIFY sizePropertyChanged) + Q_PROPERTY(QPointF pointProperty MEMBER m_pointProperty NOTIFY pointPropertyChanged) + Q_PROPERTY(QRectF rectProperty MEMBER m_rectProperty NOTIFY rectPropertyChanged) + Q_PROPERTY(QColor colorProperty MEMBER m_colorProperty NOTIFY colorPropertyChanged) + Q_PROPERTY(QFont fontProperty MEMBER m_fontProperty NOTIFY fontPropertyChanged) public: CppObject(QObject *parent = 0) : QObject(parent), @@ -83,8 +94,10 @@ public: m_doubleProperty(3.45), m_stringProperty("foo"), m_urlProperty("http://www.qt-project.org"), + m_objectProperty(keyValueMap("foo", "bar")), m_intListProperty(QVariantList() << 1 << 2 << 3), m_stringListProperty(QVariantList() << "a" << "b" << "c"), + m_objectListProperty(QVariantList() << keyValueMap("a", "b") << keyValueMap("c", "d")), m_dateProperty(2000, 1, 2), // QTBUG-32295: m_timeProperty(12, 34, 56), m_sizeProperty(12, 34), @@ -94,143 +107,6 @@ public: { } - int intProperty() const { return m_intProperty; } - bool boolProperty() const { return m_boolProperty; } - qreal realProperty() const { return m_realProperty; } - double doubleProperty() const { return m_doubleProperty; } - QString stringProperty() const { return m_stringProperty; } - QUrl urlProperty() const { return m_urlProperty; } - QVariant varProperty() const { return m_varProperty; } - QVariantList intListProperty() const { return m_intListProperty; } - QVariantList stringListProperty() const { return m_stringListProperty; } - QDate dateProperty() const { return m_dateProperty; } - QSizeF sizeProperty() const { return m_sizeProperty; } - QPointF pointProperty() const { return m_pointProperty; } - QRectF rectProperty() const { return m_rectProperty; } - QColor colorProperty() const { return m_colorProperty; } - QFont fontProperty() const { return m_fontProperty; } - -public slots: - void setIntProperty(int arg) - { - if (m_intProperty != arg) { - m_intProperty = arg; - emit intPropertyChanged(arg); - } - } - - void setBoolProperty(bool arg) - { - if (m_boolProperty != arg) { - m_boolProperty = arg; - emit boolPropertyChanged(arg); - } - } - - void setRealProperty(qreal arg) - { - if (m_realProperty != arg) { - m_realProperty = arg; - emit realPropertyChanged(arg); - } - } - - void setDoubleProperty(double arg) - { - if (m_doubleProperty != arg) { - m_doubleProperty = arg; - emit doublePropertyChanged(arg); - } - } - - void setStringProperty(const QString &arg) - { - if (m_stringProperty != arg) { - m_stringProperty = arg; - emit stringPropertyChanged(arg); - } - } - - void setUrlProperty(const QUrl &arg) - { - if (m_urlProperty != arg) { - m_urlProperty = arg; - emit urlPropertyChanged(arg); - } - } - - void setVarProperty(const QVariant &arg) - { - if (m_varProperty != arg) { - m_varProperty = arg; - emit varPropertyChanged(arg); - } - } - - void setIntListProperty(const QVariantList &arg) - { - if (m_intListProperty != arg) { - m_intListProperty = arg; - emit intListPropertyChanged(arg); - } - } - - void setStringListProperty(const QVariantList &arg) - { - if (m_stringListProperty != arg) { - m_stringListProperty = arg; - emit stringListPropertyChanged(arg); - } - } - - void setDateProperty(const QDate &arg) - { - if (m_dateProperty != arg) { - m_dateProperty = arg; - emit datePropertyChanged(arg); - } - } - - void setSizeProperty(const QSizeF &arg) - { - if (m_sizeProperty != arg) { - m_sizeProperty = arg; - emit sizePropertyChanged(arg); - } - } - - void setPointProperty(const QPointF &arg) - { - if (m_pointProperty != arg) { - m_pointProperty = arg; - emit pointPropertyChanged(arg); - } - } - - void setRectProperty(const QRectF &arg) - { - if (m_rectProperty != arg) { - m_rectProperty = arg; - emit rectPropertyChanged(arg); - } - } - - void setColorProperty(const QColor &arg) - { - if (m_colorProperty != arg) { - m_colorProperty = arg; - emit colorPropertyChanged(arg); - } - } - - void setFontProperty(const QFont &arg) - { - if (m_fontProperty != arg) { - m_fontProperty = arg; - emit fontPropertyChanged(arg); - } - } - signals: void intPropertyChanged(int arg); void boolPropertyChanged(bool arg); @@ -239,8 +115,10 @@ signals: void stringPropertyChanged(const QString &arg); void urlPropertyChanged(const QUrl &arg); void varPropertyChanged(const QVariant &arg); + void objectPropertyChanged(const QVariantMap &arg); void intListPropertyChanged(const QVariantList &arg); void stringListPropertyChanged(const QVariantList &arg); + void objectListPropertyChanged(const QVariantList &arg); void datePropertyChanged(const QDate &arg); void sizePropertyChanged(const QSizeF &arg); void pointPropertyChanged(const QPointF &arg); @@ -256,8 +134,10 @@ private: QString m_stringProperty; QUrl m_urlProperty; QVariant m_varProperty; + QVariantMap m_objectProperty; QVariantList m_intListProperty; QVariantList m_stringListProperty; + QVariantList m_objectListProperty; QDate m_dateProperty; QSizeF m_sizeProperty; QPointF m_pointProperty; @@ -316,8 +196,10 @@ void tst_QQmlSettings::types() QCOMPARE(root->property("doubleProperty").toDouble(), static_cast<double>(0.0)); QCOMPARE(root->property("stringProperty").toString(), QString()); QCOMPARE(root->property("urlProperty").toUrl(), QUrl()); + QCOMPARE(root->property("objectProperty").toMap(), QVariantMap()); QCOMPARE(root->property("intListProperty").toList(), QVariantList()); QCOMPARE(root->property("stringListProperty").toList(), QVariantList()); + QCOMPARE(root->property("objectListProperty").toList(), QVariantList()); QCOMPARE(root->property("dateProperty").toDate(), QDate()); // QTBUG-32295: QCOMPARE(root->property("timeProperty").toDate(), QTime()); QCOMPARE(root->property("sizeProperty").toSizeF(), QSizeF()); @@ -333,8 +215,10 @@ void tst_QQmlSettings::types() QCOMPARE(settings->property("doubleProperty").toDouble(), static_cast<double>(3.45)); QCOMPARE(settings->property("stringProperty").toString(), QStringLiteral("foo")); QCOMPARE(settings->property("urlProperty").toUrl(), QUrl("http://www.qt-project.org")); + QCOMPARE(settings->property("objectProperty").toMap(), keyValueMap("foo","bar")); QCOMPARE(settings->property("intListProperty").toList(), QVariantList() << 1 << 2 << 3); QCOMPARE(settings->property("stringListProperty").toList(), QVariantList() << QStringLiteral("a") << QStringLiteral("b") << QStringLiteral("c")); + QCOMPARE(settings->property("objectListProperty").toList(), QVariantList() << keyValueMap("a", "b") << keyValueMap("c","d")); QCOMPARE(settings->property("dateProperty").toDate(), QDate(2000, 01, 02)); // QTBUG-32295: QCOMPARE(settings->property("timeProperty").toDate(), QTime(12, 34, 56)); QCOMPARE(settings->property("sizeProperty").toSizeF(), QSizeF(12, 34)); @@ -351,9 +235,11 @@ void tst_QQmlSettings::types() QCOMPARE(root->property("doubleProperty").toDouble(), static_cast<double>(3.45)); QCOMPARE(root->property("stringProperty").toString(), QStringLiteral("foo")); QCOMPARE(root->property("urlProperty").toUrl(), QUrl("http://www.qt-project.org")); + QCOMPARE(root->property("objectProperty").toMap(), keyValueMap("foo","bar")); QCOMPARE(root->property("intListProperty").toList(), QVariantList() << 1 << 2 << 3); QCOMPARE(root->property("stringListProperty").toList(), QVariantList() << QStringLiteral("a") << QStringLiteral("b") << QStringLiteral("c")); QCOMPARE(root->property("dateProperty").toDate(), QDate(2000, 01, 02)); + QCOMPARE(root->property("objectListProperty").toList(), QVariantList() << keyValueMap("a", "b") << keyValueMap("c","d")); // QTBUG-32295: QCOMPARE(root->property("timeProperty").toDate(), QTime(12, 34, 56)); QCOMPARE(root->property("sizeProperty").toSizeF(), QSizeF(12, 34)); QCOMPARE(root->property("pointProperty").toPointF(), QPointF(12, 34)); @@ -368,8 +254,10 @@ void tst_QQmlSettings::types() QVERIFY(root->setProperty("doubleProperty", static_cast<double>(6.78))); QVERIFY(root->setProperty("stringProperty", QStringLiteral("bar"))); QVERIFY(root->setProperty("urlProperty", QUrl("https://codereview.qt-project.org"))); + QVERIFY(root->setProperty("objectProperty", keyValueMap("bar", "baz"))); QVERIFY(root->setProperty("intListProperty", QVariantList() << 4 << 5 << 6)); QVERIFY(root->setProperty("stringListProperty", QVariantList() << QStringLiteral("d") << QStringLiteral("e") << QStringLiteral("f"))); + QVERIFY(root->setProperty("objectListProperty", QVariantList() << keyValueMap("e", "f") << keyValueMap("g", "h"))); QVERIFY(root->setProperty("dateProperty", QDate(2010, 02, 01))); // QTBUG-32295: QVERIFY(root->setProperty("timeProperty", QTime(6, 56, 34))); QVERIFY(root->setProperty("sizeProperty", QSizeF(56, 78))); @@ -387,8 +275,10 @@ void tst_QQmlSettings::types() QTRY_COMPARE(settings->property("doubleProperty").toDouble(), static_cast<double>(6.78)); QTRY_COMPARE(settings->property("stringProperty").toString(), QStringLiteral("bar")); QTRY_COMPARE(settings->property("urlProperty").toUrl(), QUrl("https://codereview.qt-project.org")); + QTRY_COMPARE(settings->property("objectProperty").toMap(), keyValueMap("bar", "baz")); QTRY_COMPARE(settings->property("intListProperty").toList(), QVariantList() << 4 << 5 << 6); QTRY_COMPARE(settings->property("stringListProperty").toList(), QVariantList() << QStringLiteral("d") << QStringLiteral("e") << QStringLiteral("f")); + QTRY_COMPARE(settings->property("objectListProperty").toList(), QVariantList() << keyValueMap("e", "f") << keyValueMap("g", "h")); QTRY_COMPARE(settings->property("dateProperty").toDate(), QDate(2010, 02, 01)); // QTBUG-32295: QTRY_COMPARE(settings->property("timeProperty").toDate(), QTime(6, 56, 34)); QTRY_COMPARE(settings->property("sizeProperty").toSizeF(), QSizeF(56, 78)); @@ -404,8 +294,10 @@ void tst_QQmlSettings::types() QTRY_COMPARE(qs.value("doubleProperty").toDouble(), static_cast<double>(6.78)); QTRY_COMPARE(qs.value("stringProperty").toString(), QStringLiteral("bar")); QTRY_COMPARE(qs.value("urlProperty").toUrl(), QUrl("https://codereview.qt-project.org")); + QTRY_COMPARE(qs.value("objectProperty").toMap(), keyValueMap("bar", "baz")); QTRY_COMPARE(qs.value("intListProperty").toList(), QVariantList() << 4 << 5 << 6); QTRY_COMPARE(qs.value("stringListProperty").toList(), QVariantList() << QStringLiteral("d") << QStringLiteral("e") << QStringLiteral("f")); + QTRY_COMPARE(qs.value("objectListProperty").toList(), QVariantList() << keyValueMap("e", "f") << keyValueMap("g", "h")); QTRY_COMPARE(qs.value("dateProperty").toDate(), QDate(2010, 02, 01)); // QTBUG-32295: QTRY_COMPARE(qs.value("timeProperty").toDate(), QTime(6, 56, 34)); QTRY_COMPARE(qs.value("sizeProperty").toSizeF(), QSizeF(56, 78)); @@ -440,8 +332,10 @@ void tst_QQmlSettings::aliases() QCOMPARE(root->property("doubleProperty").toDouble(), static_cast<double>(3.45)); QCOMPARE(root->property("stringProperty").toString(), QStringLiteral("foo")); QCOMPARE(root->property("urlProperty").toUrl(), QUrl("http://www.qt-project.org")); + QCOMPARE(root->property("objectProperty").toMap(), keyValueMap("foo","bar")); QCOMPARE(root->property("intListProperty").toList(), QVariantList() << 1 << 2 << 3); QCOMPARE(root->property("stringListProperty").toList(), QVariantList() << QStringLiteral("a") << QStringLiteral("b") << QStringLiteral("c")); + QCOMPARE(root->property("objectListProperty").toList(), QVariantList() << keyValueMap("a", "b") << keyValueMap("c","d")); QCOMPARE(root->property("dateProperty").toDate(), QDate(2000, 01, 02)); // QTBUG-32295: QCOMPARE(root->property("timeProperty").toDate(), QTime(12, 34, 56)); QCOMPARE(root->property("sizeProperty").toSizeF(), QSizeF(12, 34)); @@ -457,8 +351,10 @@ void tst_QQmlSettings::aliases() QCOMPARE(settings->property("doubleProperty").toDouble(), static_cast<double>(3.45)); QCOMPARE(settings->property("stringProperty").toString(), QStringLiteral("foo")); QCOMPARE(settings->property("urlProperty").toUrl(), QUrl("http://www.qt-project.org")); + QCOMPARE(settings->property("objectProperty").toMap(), keyValueMap("foo","bar")); QCOMPARE(settings->property("intListProperty").toList(), QVariantList() << 1 << 2 << 3); QCOMPARE(settings->property("stringListProperty").toList(), QVariantList() << QStringLiteral("a") << QStringLiteral("b") << QStringLiteral("c")); + QCOMPARE(settings->property("objectListProperty").toList(), QVariantList() << keyValueMap("a", "b") << keyValueMap("c","d")); QCOMPARE(settings->property("dateProperty").toDate(), QDate(2000, 01, 02)); // QTBUG-32295: QCOMPARE(settings->property("timeProperty").toDate(), QTime(12, 34, 56)); QCOMPARE(settings->property("sizeProperty").toSizeF(), QSizeF(12, 34)); @@ -474,8 +370,10 @@ void tst_QQmlSettings::aliases() QVERIFY(settings->setProperty("doubleProperty", static_cast<double>(6.78))); QVERIFY(settings->setProperty("stringProperty", QStringLiteral("bar"))); QVERIFY(settings->setProperty("urlProperty", QUrl("https://codereview.qt-project.org"))); + QVERIFY(settings->setProperty("objectProperty", keyValueMap("bar", "baz"))); QVERIFY(settings->setProperty("intListProperty", QVariantList() << 4 << 5 << 6)); QVERIFY(settings->setProperty("stringListProperty", QVariantList() << QStringLiteral("d") << QStringLiteral("e") << QStringLiteral("f"))); + QVERIFY(settings->setProperty("objectListProperty", QVariantList() << keyValueMap("e", "f") << keyValueMap("g", "h"))); QVERIFY(settings->setProperty("dateProperty", QDate(2010, 02, 01))); // QTBUG-32295: QVERIFY(settings->setProperty("timeProperty", QTime(6, 56, 34))); QVERIFY(settings->setProperty("sizeProperty", QSizeF(56, 78))); @@ -492,8 +390,10 @@ void tst_QQmlSettings::aliases() QTRY_COMPARE(qs.value("doubleProperty").toDouble(), static_cast<double>(6.78)); QTRY_COMPARE(qs.value("stringProperty").toString(), QStringLiteral("bar")); QTRY_COMPARE(qs.value("urlProperty").toUrl(), QUrl("https://codereview.qt-project.org")); + QTRY_COMPARE(qs.value("objectProperty").toMap(), keyValueMap("bar", "baz")); QTRY_COMPARE(qs.value("intListProperty").toList(), QVariantList() << 4 << 5 << 6); QTRY_COMPARE(qs.value("stringListProperty").toList(), QVariantList() << QStringLiteral("d") << QStringLiteral("e") << QStringLiteral("f")); + QTRY_COMPARE(qs.value("objectListProperty").toList(), QVariantList() << keyValueMap("e", "f") << keyValueMap("g", "h")); QTRY_COMPARE(qs.value("dateProperty").toDate(), QDate(2010, 02, 01)); // QTBUG-32295: QTRY_COMPARE(qs.value("timeProperty").toDate(), QTime(6, 56, 34)); QTRY_COMPARE(qs.value("sizeProperty").toSizeF(), QSizeF(56, 78)); diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/send_patch.qml b/tests/auto/qml/qqmlxmlhttprequest/data/send_patch.qml index 2abf1c60a8..dd4dd435a5 100644 --- a/tests/auto/qml/qqmlxmlhttprequest/data/send_patch.qml +++ b/tests/auto/qml/qqmlxmlhttprequest/data/send_patch.qml @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 Canonical Limited and/or its subsidiary(-ies). -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 Canonical Limited and/or its subsidiary(-ies). +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://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. +** 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$ ** diff --git a/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp b/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp index 63da28b7ba..49135ca920 100644 --- a/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp +++ b/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp @@ -250,7 +250,7 @@ void tst_QQuickWorkerScript::scriptError_onLoad() QVERIFY(worker != 0); QTRY_COMPARE(qquickworkerscript_lastWarning, - testFileUrl("script_error_onLoad.js").toString() + QLatin1String(":3:10: Expected token `,'")); + testFileUrl("script_error_onLoad.js").toString() + QLatin1String(":3:10: SyntaxError: Expected token `,'")); qInstallMessageHandler(previousMsgHandler); qApp->processEvents(); diff --git a/tests/auto/qmltest/statemachine/tst_signaltransition.qml b/tests/auto/qmltest/statemachine/tst_signaltransition.qml index 0e35207670..a57826855a 100644 --- a/tests/auto/qmltest/statemachine/tst_signaltransition.qml +++ b/tests/auto/qmltest/statemachine/tst_signaltransition.qml @@ -1,32 +1,27 @@ /**************************************************************************** ** -** Copyright (C) 2014 Ford Motor Company -** Copyright (C) 2016 The Qt Company +** Copyright (C) 2017 Ford Motor Company +** Copyright (C) 2017 The Qt Company ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://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. +** 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$ ** diff --git a/tests/auto/qmltest/statemachine/tst_triggeredArguments1.qml b/tests/auto/qmltest/statemachine/tst_triggeredArguments1.qml index 5d2e867da4..34c172aded 100644 --- a/tests/auto/qmltest/statemachine/tst_triggeredArguments1.qml +++ b/tests/auto/qmltest/statemachine/tst_triggeredArguments1.qml @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2016 Ford Motor Company -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 Ford Motor Company +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://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. +** 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$ ** diff --git a/tests/auto/qmltest/statemachine/tst_triggeredArguments2.qml b/tests/auto/qmltest/statemachine/tst_triggeredArguments2.qml index f60f2ff78c..73bc653404 100644 --- a/tests/auto/qmltest/statemachine/tst_triggeredArguments2.qml +++ b/tests/auto/qmltest/statemachine/tst_triggeredArguments2.qml @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2016 Ford Motor Company -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 Ford Motor Company +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://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. +** 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$ ** diff --git a/tests/auto/quick/qquickanimatedsprite/data/sourceSwitch.qml b/tests/auto/quick/qquickanimatedsprite/data/sourceSwitch.qml index 18a8f52661..c81a765c7e 100644 --- a/tests/auto/quick/qquickanimatedsprite/data/sourceSwitch.qml +++ b/tests/auto/quick/qquickanimatedsprite/data/sourceSwitch.qml @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 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$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://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. +** 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$ ** diff --git a/tests/auto/quick/qquickanimators/data/positionerWithAnimator.qml b/tests/auto/quick/qquickanimators/data/positionerWithAnimator.qml index bfd475266e..bd3b42b397 100644 --- a/tests/auto/quick/qquickanimators/data/positionerWithAnimator.qml +++ b/tests/auto/quick/qquickanimators/data/positionerWithAnimator.qml @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 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$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://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. +** 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$ ** diff --git a/tests/auto/quick/qquickapplication/BLACKLIST b/tests/auto/quick/qquickapplication/BLACKLIST deleted file mode 100644 index 81592db56f..0000000000 --- a/tests/auto/quick/qquickapplication/BLACKLIST +++ /dev/null @@ -1,2 +0,0 @@ -[active] -osx-10.11 diff --git a/tests/auto/quick/qquickapplication/data/tst_platformname.qml b/tests/auto/quick/qquickapplication/data/tst_platformname.qml new file mode 100644 index 0000000000..1bcd66ac8d --- /dev/null +++ b/tests/auto/quick/qquickapplication/data/tst_platformname.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0; + +Item { + id: root; + property string platformName: Qt.platform.pluginName +} diff --git a/tests/auto/quick/qquickapplication/qquickapplication.pro b/tests/auto/quick/qquickapplication/qquickapplication.pro index c47f5472b7..00b5bb3a18 100644 --- a/tests/auto/quick/qquickapplication/qquickapplication.pro +++ b/tests/auto/quick/qquickapplication/qquickapplication.pro @@ -3,7 +3,8 @@ TARGET = tst_qquickapplication macx:CONFIG -= app_bundle SOURCES += tst_qquickapplication.cpp -OTHER_FILES += data/tst_displayname.qml +OTHER_FILES += data/tst_displayname.qml \ + data/tst_platformname.qml include (../../shared/util.pri) diff --git a/tests/auto/quick/qquickapplication/tst_qquickapplication.cpp b/tests/auto/quick/qquickapplication/tst_qquickapplication.cpp index d780b91260..e428a1fc6e 100644 --- a/tests/auto/quick/qquickapplication/tst_qquickapplication.cpp +++ b/tests/auto/quick/qquickapplication/tst_qquickapplication.cpp @@ -53,6 +53,7 @@ private slots: void styleHints(); void cleanup(); void displayName(); + void platformName(); private: QQmlEngine engine; @@ -264,6 +265,24 @@ void tst_qquickapplication::displayName() QCOMPARE(QGuiApplication::applicationDisplayName(), name[2]); } +void tst_qquickapplication::platformName() +{ + // Set up QML component + QQmlComponent component(&engine, testFileUrl("tst_platformname.qml")); + QQuickItem *item = qobject_cast<QQuickItem *>(component.create()); + QVERIFY(item); + QQuickView view; + item->setParentItem(view.rootObject()); + + // Get native platform name + QString guiApplicationPlatformName = QGuiApplication::platformName(); + QVERIFY(!guiApplicationPlatformName.isEmpty()); + + // Get platform name from QML component and verify it's same + QString qmlPlatformName = qvariant_cast<QString>(item->property("platformName")); + QCOMPARE(qmlPlatformName, guiApplicationPlatformName); +} + QTEST_MAIN(tst_qquickapplication) #include "tst_qquickapplication.moc" diff --git a/tests/auto/quick/qquickfocusscope/BLACKLIST b/tests/auto/quick/qquickfocusscope/BLACKLIST new file mode 100644 index 0000000000..cc3c8b6e8a --- /dev/null +++ b/tests/auto/quick/qquickfocusscope/BLACKLIST @@ -0,0 +1,2 @@ +[canvasFocus] +osx-10.11 diff --git a/tests/auto/quick/qquickitem/data/childAtRectangle.qml b/tests/auto/quick/qquickitem/data/childAtRectangle.qml index d459c2b3f1..2aaaedb06f 100644 --- a/tests/auto/quick/qquickitem/data/childAtRectangle.qml +++ b/tests/auto/quick/qquickitem/data/childAtRectangle.qml @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 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$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://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. +** 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$ ** diff --git a/tests/auto/quick/qquickitem/data/shortcutOverride.qml b/tests/auto/quick/qquickitem/data/shortcutOverride.qml index fab9175c17..247b5fea04 100644 --- a/tests/auto/quick/qquickitem/data/shortcutOverride.qml +++ b/tests/auto/quick/qquickitem/data/shortcutOverride.qml @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 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$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://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. +** 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$ ** diff --git a/tests/auto/quick/qquickitem2/data/nonexistentPropertyConnection.qml b/tests/auto/quick/qquickitem2/data/nonexistentPropertyConnection.qml new file mode 100644 index 0000000000..ed0632a68a --- /dev/null +++ b/tests/auto/quick/qquickitem2/data/nonexistentPropertyConnection.qml @@ -0,0 +1,11 @@ +import QtQuick 2.4 + +Item { + function hint() { + } + + Connections { + target: BlaBlaBla + onHint: hint(); + } +} diff --git a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp index cc74b7e07d..09e89ff85f 100644 --- a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp +++ b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp @@ -98,6 +98,7 @@ private slots: void mapCoordinatesRect(); void mapCoordinatesRect_data(); void propertyChanges(); + void nonexistentPropertyConnection(); void transforms(); void transforms_data(); void childrenRect(); @@ -2612,6 +2613,15 @@ void tst_QQuickItem::propertyChanges() delete window; } +void tst_QQuickItem::nonexistentPropertyConnection() +{ + // QTBUG-56551: don't crash + QQmlComponent component(&engine, testFileUrl("nonexistentPropertyConnection.qml")); + QObject *o = component.create(); + QVERIFY(o); + delete o; +} + void tst_QQuickItem::childrenRect() { QQuickView *window = new QQuickView(0); diff --git a/tests/auto/quick/qquickrectangle/data/gradient-multiple.qml b/tests/auto/quick/qquickrectangle/data/gradient-multiple.qml new file mode 100644 index 0000000000..d58c857008 --- /dev/null +++ b/tests/auto/quick/qquickrectangle/data/gradient-multiple.qml @@ -0,0 +1,30 @@ +import QtQuick 2.0 + +Item { + property alias firstRectangle: r1 + property alias secondRectangle: r2 + Rectangle { + id: r1 + gradient: someObject.someGradient + anchors.fill: parent + } + Rectangle { + id: r2 + gradient: someObject.someGradient + anchors.fill: parent + } + + function changeGradient() { + firstStop.color = "red" + secondStop.color = "blue" + } + + QtObject { + id: someObject + property Gradient someGradient: Gradient { + GradientStop { id: firstStop; position: 0.0; color: "gray" } + GradientStop { id: secondStop; position: 1.0; color: "white" } + } + } +} + diff --git a/tests/auto/quick/qquickrectangle/data/gradient-separate.qml b/tests/auto/quick/qquickrectangle/data/gradient-separate.qml new file mode 100644 index 0000000000..8ae3f3296b --- /dev/null +++ b/tests/auto/quick/qquickrectangle/data/gradient-separate.qml @@ -0,0 +1,20 @@ +import QtQuick 2.0 + +Rectangle { + + function changeGradient() { + firstStop.color = "red" + secondStop.color = "blue" + } + + QtObject { + id: someObject + property Gradient someGradient: Gradient { + GradientStop { id: firstStop; position: 0.0; color: "gray" } + GradientStop { id: secondStop; position: 1.0; color: "white" } + } + } + + gradient: someObject.someGradient +} + diff --git a/tests/auto/quick/qquickrectangle/tst_qquickrectangle.cpp b/tests/auto/quick/qquickrectangle/tst_qquickrectangle.cpp index 65c7e387a0..0d79592e37 100644 --- a/tests/auto/quick/qquickrectangle/tst_qquickrectangle.cpp +++ b/tests/auto/quick/qquickrectangle/tst_qquickrectangle.cpp @@ -32,6 +32,7 @@ #include <QtQml/qqmlengine.h> #include <QtQml/qqmlcomponent.h> #include <QtQuick/qquickview.h> +#include <private/qquickitem_p.h> #include <private/qquickrectangle_p.h> #include "../../shared/util.h" @@ -46,6 +47,8 @@ private slots: void color(); void gradient(); void gradient_border(); + void gradient_separate(); + void gradient_multiple(); void antialiasing(); private: @@ -111,6 +114,62 @@ void tst_qquickrectangle::gradient_border() QVERIFY(QTest::qWaitForWindowExposed(&view)); } +// A gradient not defined inline with the Rectangle using it should still change +// that Rectangle. +void tst_qquickrectangle::gradient_separate() +{ + QQuickView view; + view.setSource(testFileUrl("gradient-separate.qml")); + view.show(); + + QVERIFY(QTest::qWaitForWindowExposed(&view)); + + QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(view.rootObject()); + QVERIFY(rect); + + // Start off clean + QQuickItemPrivate *rectPriv = QQuickItemPrivate::get(rect); + bool isDirty = rectPriv->dirtyAttributes & QQuickItemPrivate::Content; + QVERIFY(!isDirty); + + QMetaObject::invokeMethod(rect, "changeGradient"); + + // Changing the gradient should have scheduled an update of the item. + isDirty = rectPriv->dirtyAttributes & QQuickItemPrivate::Content; + QVERIFY(isDirty); +} + +// When a gradient is changed, every Rectangle connected to it must update. +void tst_qquickrectangle::gradient_multiple() +{ + QQuickView view; + view.setSource(testFileUrl("gradient-multiple.qml")); + view.show(); + + QVERIFY(QTest::qWaitForWindowExposed(&view)); + + QQuickRectangle *firstRect = qobject_cast<QQuickRectangle*>(view.rootObject()->property("firstRectangle").value<QObject*>()); + QQuickRectangle *secondRect = qobject_cast<QQuickRectangle*>(view.rootObject()->property("secondRectangle").value<QObject*>()); + QVERIFY(firstRect); + QVERIFY(secondRect); + + // Start off clean + QQuickItemPrivate *firstRectPriv = QQuickItemPrivate::get(firstRect); + QQuickItemPrivate *secondRectPriv = QQuickItemPrivate::get(secondRect); + bool firstIsDirty = firstRectPriv->dirtyAttributes & QQuickItemPrivate::Content; + bool secondIsDirty = secondRectPriv->dirtyAttributes & QQuickItemPrivate::Content; + QVERIFY(!firstIsDirty); + QVERIFY(!secondIsDirty); + + QMetaObject::invokeMethod(view.rootObject(), "changeGradient"); + + // Changing the gradient should have scheduled an update of both items + firstIsDirty = firstRectPriv->dirtyAttributes & QQuickItemPrivate::Content; + secondIsDirty = secondRectPriv->dirtyAttributes & QQuickItemPrivate::Content; + QVERIFY(firstIsDirty); + QVERIFY(secondIsDirty); +} + void tst_qquickrectangle::antialiasing() { QQmlComponent component(&engine); diff --git a/tests/auto/quick/qquickview/data/findChild.qml b/tests/auto/quick/qquickview/data/findChild.qml new file mode 100644 index 0000000000..8cbc46abe2 --- /dev/null +++ b/tests/auto/quick/qquickview/data/findChild.qml @@ -0,0 +1,9 @@ +import QtQuick 2.0 +Item { + width: 200 + height: 200 + objectName: "rootObject" + Item { + objectName: "rootObjectChild" + } +} diff --git a/tests/auto/quick/qquickview/tst_qquickview.cpp b/tests/auto/quick/qquickview/tst_qquickview.cpp index fa9192edb4..04d21457e6 100644 --- a/tests/auto/quick/qquickview/tst_qquickview.cpp +++ b/tests/auto/quick/qquickview/tst_qquickview.cpp @@ -70,6 +70,7 @@ private slots: void resizemodeitem(); void errors(); void engine(); + void findChild(); }; @@ -265,6 +266,45 @@ void tst_QQuickView::engine() delete view4; } +void tst_QQuickView::findChild() +{ + QQuickView view; + view.setSource(testFileUrl("findChild.qml")); + + // QQuickView + // |_ QQuickWindow::contentItem + // | |_ QQuickView::rootObject: QML Item("rootObject") (findChild.qml) + // | | |_ QML Item("rootObjectChild") (findChild.qml) + // | |_ QObject("contentItemChild") + // |_ QObject("viewChild") + + QObject *viewChild = new QObject(&view); + viewChild->setObjectName("viewChild"); + + QObject *contentItemChild = new QObject(view.contentItem()); + contentItemChild->setObjectName("contentItemChild"); + + QObject *rootObject = view.rootObject(); + QVERIFY(rootObject); + + QObject *rootObjectChild = rootObject->findChild<QObject *>("rootObjectChild"); + QVERIFY(rootObjectChild); + + QCOMPARE(view.findChild<QObject *>("viewChild"), viewChild); + QCOMPARE(view.findChild<QObject *>("contentItemChild"), contentItemChild); + QCOMPARE(view.findChild<QObject *>("rootObject"), rootObject); + QCOMPARE(view.findChild<QObject *>("rootObjectChild"), rootObjectChild); + + QVERIFY(!view.contentItem()->findChild<QObject *>("viewChild")); // sibling + QCOMPARE(view.contentItem()->findChild<QObject *>("contentItemChild"), contentItemChild); + QCOMPARE(view.contentItem()->findChild<QObject *>("rootObject"), rootObject); + QCOMPARE(view.contentItem()->findChild<QObject *>("rootObjectChild"), rootObjectChild); + + QVERIFY(!view.rootObject()->findChild<QObject *>("viewChild")); // ancestor + QVERIFY(!view.rootObject()->findChild<QObject *>("contentItemChild")); // cousin + QVERIFY(!view.rootObject()->findChild<QObject *>("rootObject")); // self +} + QTEST_MAIN(tst_QQuickView) #include "tst_qquickview.moc" diff --git a/tests/auto/quick/qquickwindow/BLACKLIST b/tests/auto/quick/qquickwindow/BLACKLIST deleted file mode 100644 index 157808fdbf..0000000000 --- a/tests/auto/quick/qquickwindow/BLACKLIST +++ /dev/null @@ -1,4 +0,0 @@ -[requestActivate] -osx-10.11 -[attachedProperty] -osx-10.11 diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp index d454f9b7bc..91d577fb6f 100644 --- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp +++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp @@ -375,6 +375,8 @@ private slots: void testDragEventPropertyPropagation(); + void findChild(); + private: QTouchDevice *touchDevice; QTouchDevice *touchDeviceWithVelocity; @@ -2825,6 +2827,28 @@ void tst_qquickwindow::testDragEventPropertyPropagation() } } +void tst_qquickwindow::findChild() +{ + QQuickWindow window; + + // QQuickWindow + // |_ QQuickWindow::contentItem + // | |_ QObject("contentItemChild") + // |_ QObject("viewChild") + + QObject *windowChild = new QObject(&window); + windowChild->setObjectName("windowChild"); + + QObject *contentItemChild = new QObject(window.contentItem()); + contentItemChild->setObjectName("contentItemChild"); + + QCOMPARE(window.findChild<QObject *>("windowChild"), windowChild); + QCOMPARE(window.findChild<QObject *>("contentItemChild"), contentItemChild); + + QVERIFY(!window.contentItem()->findChild<QObject *>("viewChild")); // sibling + QCOMPARE(window.contentItem()->findChild<QObject *>("contentItemChild"), contentItemChild); +} + QTEST_MAIN(tst_qquickwindow) #include "tst_qquickwindow.moc" diff --git a/tests/auto/quick/touchmouse/tst_touchmouse.cpp b/tests/auto/quick/touchmouse/tst_touchmouse.cpp index 671cefd6f5..39f2961927 100644 --- a/tests/auto/quick/touchmouse/tst_touchmouse.cpp +++ b/tests/auto/quick/touchmouse/tst_touchmouse.cpp @@ -571,7 +571,7 @@ void tst_TouchMouse::buttonOnFlickable() QQuickWindowPrivate *windowPriv = QQuickWindowPrivate::get(window.data()); QVERIFY(windowPriv->touchMouseId != -1); - auto pointerEvent = QQuickPointerDevice::touchDevices().at(0)->pointerEvent(); + auto pointerEvent = windowPriv->pointerEventInstance(QQuickPointerDevice::touchDevices().at(0)); QCOMPARE(pointerEvent->point(0)->grabber(), eventItem1); QCOMPARE(window->mouseGrabberItem(), eventItem1); @@ -632,7 +632,7 @@ void tst_TouchMouse::touchButtonOnFlickable() QQuickWindowPrivate *windowPriv = QQuickWindowPrivate::get(window.data()); QVERIFY(windowPriv->touchMouseId == -1); - auto pointerEvent = QQuickPointerDevice::touchDevices().at(0)->pointerEvent(); + auto pointerEvent = windowPriv->pointerEventInstance(QQuickPointerDevice::touchDevices().at(0)); QCOMPARE(pointerEvent->point(0)->grabber(), eventItem2); QCOMPARE(window->mouseGrabberItem(), nullptr); @@ -758,7 +758,7 @@ void tst_TouchMouse::buttonOnDelayedPressFlickable() // for the touchMouseId to the new grabber. QCOMPARE(window->mouseGrabberItem(), flickable); QVERIFY(windowPriv->touchMouseId != -1); - auto pointerEvent = QQuickPointerDevice::touchDevices().at(0)->pointerEvent(); + auto pointerEvent = windowPriv->pointerEventInstance(QQuickPointerDevice::touchDevices().at(0)); QCOMPARE(pointerEvent->point(0)->grabber(), flickable); QTest::touchEvent(window.data(), device).release(0, p3, window.data()); @@ -1422,7 +1422,6 @@ void tst_TouchMouse::hoverEnabled() QSignalSpy exitSpy2(mouseArea2, SIGNAL(exited())); QSignalSpy clickSpy2(mouseArea2, SIGNAL(clicked(QQuickMouseEvent *))); - QPoint p0(50, 50); QPoint p1(150, 150); QPoint p2(150, 250); @@ -1448,9 +1447,6 @@ void tst_TouchMouse::hoverEnabled() QVERIFY(!mouseArea2->hovered()); // ------------------------- Touch click on mouseArea2 - if (QGuiApplication::platformName().compare(QLatin1String("xcb"), Qt::CaseInsensitive) == 0) - QSKIP("hover can be momentarily inconsistent on X11, depending on timing of flushFrameSynchronousEvents with touch and mouse movements (QTBUG-55350)"); - QTest::touchEvent(window.data(), device).press(0, p2, window.data()); QVERIFY(mouseArea1->hovered()); diff --git a/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp b/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp index bd051ec990..60495596d1 100644 --- a/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp +++ b/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp @@ -59,6 +59,7 @@ private slots: void reparentToNewWindow(); void nullEngine(); void keyEvents(); + void shortcuts(); }; @@ -365,6 +366,38 @@ void tst_qquickwidget::keyEvents() QTRY_VERIFY(widget.ok); } +class ShortcutEventFilter : public QObject +{ +public: + bool eventFilter(QObject *obj, QEvent *e) override { + if (e->type() == QEvent::ShortcutOverride) + shortcutOk = true; + + return QObject::eventFilter(obj, e); + } + + bool shortcutOk = false; +}; + +void tst_qquickwidget::shortcuts() +{ + // Verify that ShortcutOverride events do not get lost. (QTBUG-60988) + KeyHandlingWidget widget; + widget.setSource(testFileUrl("rectangle.qml")); + widget.show(); + QVERIFY(QTest::qWaitForWindowExposed(widget.window(), 5000)); + + // Send to the widget, verify that the QQuickWindow sees it. + + ShortcutEventFilter filter; + widget.quickWindow()->installEventFilter(&filter); + + QKeyEvent e(QEvent::ShortcutOverride, Qt::Key_A, Qt::ControlModifier); + QCoreApplication::sendEvent(&widget, &e); + + QTRY_VERIFY(filter.shortcutOk); +} + QTEST_MAIN(tst_qquickwidget) #include "tst_qquickwidget.moc" diff --git a/tests/benchmarks/benchmarks.pro b/tests/benchmarks/benchmarks.pro index 5e6bc65815..07a6d5ecaa 100644 --- a/tests/benchmarks/benchmarks.pro +++ b/tests/benchmarks/benchmarks.pro @@ -1,5 +1,5 @@ TEMPLATE = subdirs -SUBDIRS = qml script +SUBDIRS = qml qtConfig(private_tests) { qtConfig(opengl(es1|es2)?):SUBDIRS += particles } diff --git a/tests/benchmarks/particles/affectors/affectors.pro b/tests/benchmarks/particles/affectors/affectors.pro index 3351228a4b..35e1f514cc 100644 --- a/tests/benchmarks/particles/affectors/affectors.pro +++ b/tests/benchmarks/particles/affectors/affectors.pro @@ -1,10 +1,10 @@ -CONFIG += benchmark +# This benchmark is broken, see QTBUG-60621 +#CONFIG += benchmark +TEMPLATE = app TARGET = tst_affectors SOURCES += tst_affectors.cpp macx:CONFIG -= app_bundle -testDataFiles.files = data -testDataFiles.path = . -DEPLOYMENT += testDataFiles +DEFINES += SRCDIR=\\\"$$PWD\\\" QT += quickparticles-private testlib diff --git a/tests/benchmarks/particles/affectors/tst_affectors.cpp b/tests/benchmarks/particles/affectors/tst_affectors.cpp index 99d175564b..4c611c6faa 100644 --- a/tests/benchmarks/particles/affectors/tst_affectors.cpp +++ b/tests/benchmarks/particles/affectors/tst_affectors.cpp @@ -48,6 +48,11 @@ tst_affectors::tst_affectors() { } +inline QUrl TEST_FILE(const QString &filename) +{ + return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename); +} + void tst_affectors::test_basic_data() { QTest::addColumn<int> ("dt"); @@ -69,7 +74,7 @@ void tst_affectors::test_filtered_data() void tst_affectors::test_basic() { QFETCH(int, dt); - QQuickView* view = createView(QCoreApplication::applicationDirPath() + "/data/basic.qml"); + QQuickView* view = createView(TEST_FILE("basic.qml")); QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system"); //Pretend we're running, but we manually advance the simulation system->m_running = true; @@ -109,7 +114,7 @@ void tst_affectors::test_basic() void tst_affectors::test_filtered() { QFETCH(int, dt); - QQuickView* view = createView(QCoreApplication::applicationDirPath() + "/data/filtered.qml"); + QQuickView* view = createView(TEST_FILE("filtered.qml")); QQuickParticleSystem* system = view->rootObject()->findChild<QQuickParticleSystem*>("system"); //Pretend we're running, but we manually advance the simulation system->m_running = true; diff --git a/tests/benchmarks/particles/emission/emission.pro b/tests/benchmarks/particles/emission/emission.pro index f6730e60ff..963346ebdd 100644 --- a/tests/benchmarks/particles/emission/emission.pro +++ b/tests/benchmarks/particles/emission/emission.pro @@ -1,4 +1,5 @@ -CONFIG += benchmark +# This benchmark is broken, see QTBUG-60621 +#CONFIG += benchmark TARGET = tst_emission SOURCES += tst_emission.cpp macx:CONFIG -= app_bundle diff --git a/tests/benchmarks/qml/animation/tst_animation.cpp b/tests/benchmarks/qml/animation/tst_animation.cpp index 59f5a57f5c..27622ed013 100644 --- a/tests/benchmarks/qml/animation/tst_animation.cpp +++ b/tests/benchmarks/qml/animation/tst_animation.cpp @@ -41,8 +41,11 @@ public: private slots: void abstractAnimation(); + +#if defined(QT_BUILD_INTERNAL) void bulkValueAnimator(); void propertyUpdater(); +#endif void animationtree_qml(); @@ -75,6 +78,7 @@ void tst_animation::abstractAnimation() } } +#if defined(QT_BUILD_INTERNAL) void tst_animation::bulkValueAnimator() { QBENCHMARK { @@ -90,6 +94,7 @@ void tst_animation::propertyUpdater() delete updater; } } +#endif // QT_BUILD_INTERNAL void tst_animation::animationtree_qml() { diff --git a/tests/benchmarks/qml/js/js.pro b/tests/benchmarks/qml/js/js.pro index 7711e7130d..b1448d8eb8 100644 --- a/tests/benchmarks/qml/js/js.pro +++ b/tests/benchmarks/qml/js/js.pro @@ -1,7 +1,7 @@ TEMPLATE = subdirs SUBDIRS = \ qjsengine \ -# qjsvalue \ ### FIXME: doesn't build + qjsvalue \ qjsvalueiterator \ TRUSTED_BENCHMARKS += \ diff --git a/tests/benchmarks/qml/js/qjsengine/qjsengine.pro b/tests/benchmarks/qml/js/qjsengine/qjsengine.pro index e49a48f779..c4aba78756 100644 --- a/tests/benchmarks/qml/js/qjsengine/qjsengine.pro +++ b/tests/benchmarks/qml/js/qjsengine/qjsengine.pro @@ -1,6 +1,8 @@ +CONFIG += benchmark TEMPLATE = app TARGET = tst_bench_qjsengine SOURCES += tst_qjsengine.cpp QT += qml testlib +macos:CONFIG -= app_bundle diff --git a/tests/benchmarks/qml/js/qjsengine/tst_qjsengine.cpp b/tests/benchmarks/qml/js/qjsengine/tst_qjsengine.cpp index 9da310d976..d13751385c 100644 --- a/tests/benchmarks/qml/js/qjsengine/tst_qjsengine.cpp +++ b/tests/benchmarks/qml/js/qjsengine/tst_qjsengine.cpp @@ -324,7 +324,7 @@ void tst_QJSEngine::newQObject() { newEngine(); QBENCHMARK { - (void)m_engine->newQObject(QCoreApplication::instance()); + (void)m_engine->newQObject(new QObject); } } diff --git a/tests/benchmarks/qml/js/qjsvalue/qjsvalue.pro b/tests/benchmarks/qml/js/qjsvalue/qjsvalue.pro index c646613799..edfb619608 100644 --- a/tests/benchmarks/qml/js/qjsvalue/qjsvalue.pro +++ b/tests/benchmarks/qml/js/qjsvalue/qjsvalue.pro @@ -5,3 +5,4 @@ TARGET = tst_bench_qjsvalue SOURCES += tst_qjsvalue.cpp QT += qml testlib +macos:CONFIG -= app_bundle diff --git a/tests/benchmarks/qml/js/qjsvalue/tst_qjsvalue.cpp b/tests/benchmarks/qml/js/qjsvalue/tst_qjsvalue.cpp index 5cb0f2f44b..7488d613e5 100644 --- a/tests/benchmarks/qml/js/qjsvalue/tst_qjsvalue.cpp +++ b/tests/benchmarks/qml/js/qjsvalue/tst_qjsvalue.cpp @@ -943,7 +943,7 @@ void tst_QJSValue::defineStandardTestValues() QTest::newRow("regexp") << m_engine->evaluate("new RegExp('foo')"); QTest::newRow("error") << m_engine->evaluate("new Error"); - QTest::newRow("qobject") << m_engine->newQObject(this); + QTest::newRow("qobject") << m_engine->newQObject(new QObject); #if 0 // no qmetaobject QTest::newRow("qmetaobject") << m_engine->newQMetaObject(&QJSEngine::staticMetaObject); #endif diff --git a/tests/benchmarks/qml/qml.pro b/tests/benchmarks/qml/qml.pro index f1fe87e532..437d13c87e 100644 --- a/tests/benchmarks/qml/qml.pro +++ b/tests/benchmarks/qml/qml.pro @@ -9,7 +9,7 @@ SUBDIRS += \ qqmlcomponent \ qqmlmetaproperty \ librarymetrics_performance \ -# script \ ### FIXME: doesn't build + script \ js \ creation diff --git a/tests/benchmarks/qml/qqmlchangeset/tst_qqmlchangeset.cpp b/tests/benchmarks/qml/qqmlchangeset/tst_qqmlchangeset.cpp index bbfb52343c..cdbec699dc 100644 --- a/tests/benchmarks/qml/qqmlchangeset/tst_qqmlchangeset.cpp +++ b/tests/benchmarks/qml/qqmlchangeset/tst_qqmlchangeset.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Milian Wolff <milian.wolff@kdab.com> -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Milian Wolff <milian.wolff@kdab.com> +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://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. +** 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$ ** diff --git a/tests/benchmarks/qml/qqmldebugtrace/qqmldebugtrace.pro b/tests/benchmarks/qml/qqmldebugtrace/qqmldebugtrace.pro deleted file mode 100644 index 556842af80..0000000000 --- a/tests/benchmarks/qml/qqmldebugtrace/qqmldebugtrace.pro +++ /dev/null @@ -1,8 +0,0 @@ -CONFIG += benchmark -QT += qml testlib -TEMPLATE = app -TARGET = tst_qqmldebugtrace -macx:CONFIG -= app_bundle - -SOURCES += tst_qqmldebugtrace.cpp - diff --git a/tests/benchmarks/qml/qqmldebugtrace/tst_qqmldebugtrace.cpp b/tests/benchmarks/qml/qqmldebugtrace/tst_qqmldebugtrace.cpp deleted file mode 100644 index 68b34deb3a..0000000000 --- a/tests/benchmarks/qml/qqmldebugtrace/tst_qqmldebugtrace.cpp +++ /dev/null @@ -1,87 +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 <QtCore/QElapsedTimer> -#include <QObject> -#include <qtest.h> - -class tst_qqmldebugtrace : public QObject -{ - Q_OBJECT - -public: - tst_qqmldebugtrace() {} - -private slots: - void all(); - void startElapsed(); - void doubleElapsed(); - void trace(); -}; - -void tst_qqmldebugtrace::all() -{ - QBENCHMARK { - QElapsedTimer t; - t.start(); - t.nsecsElapsed(); - } -} - -void tst_qqmldebugtrace::startElapsed() -{ - QElapsedTimer t; - QBENCHMARK { - t.start(); - t.nsecsElapsed(); - } -} - -void tst_qqmldebugtrace::doubleElapsed() -{ - QElapsedTimer t; - t.start(); - QBENCHMARK { - t.nsecsElapsed(); - t.nsecsElapsed(); - } -} - -void tst_qqmldebugtrace::trace() -{ - QString s("A decent sized string of text here."); - QBENCHMARK { - QByteArray data; - QDataStream ds(&data, QIODevice::WriteOnly); - ds << (qint64)100 << (int)5 << (int)5 << s; - } -} - -QTEST_MAIN(tst_qqmldebugtrace) - -#include "tst_qqmldebugtrace.moc" diff --git a/tests/benchmarks/qml/script/tst_script.cpp b/tests/benchmarks/qml/script/tst_script.cpp index 3829f3df6a..a48d6bdec7 100644 --- a/tests/benchmarks/qml/script/tst_script.cpp +++ b/tests/benchmarks/qml/script/tst_script.cpp @@ -52,10 +52,8 @@ private slots: void property_getter_qmetaproperty(); #endif void property_qobject(); - void property_qmlobject(); void setproperty_js(); - void setproperty_qmlobject(); void function_js(); #if 0 @@ -63,7 +61,6 @@ private slots: void function_cpp(); #endif void function_qobject(); - void function_qmlobject(); void function_args_js(); #if 0 @@ -71,7 +68,6 @@ private slots: void function_args_cpp(); #endif void function_args_qobject(); - void function_args_qmlobject(); void signal_unconnected(); void signal_qml(); @@ -178,7 +174,7 @@ void tst_script::property_js() } } -#if 0 +#if 0 // This requires internal API access in V4 static QJSValue property_getter_method(QScriptContext *, QJSEngine *engine) { static int x = 0; @@ -305,26 +301,6 @@ void tst_script::property_qobject() } } -void tst_script::property_qmlobject() -{ - QQmlEngine qmlengine; - - TestObject to; - QV8Engine *engine = QQmlEnginePrivate::getV8Engine(&qmlengine); - v8::HandleScope handle_scope; - v8::Context::Scope scope(engine->context()); - QJSValue v = engine->scriptValueFromInternal(engine->qobjectWrapper()->newQObject(&to)); - - QJSValueList args; - args << v; - QJSValue prog = qmlengine.evaluate(PROPERTY_PROGRAM).call(args); - prog.call(); - - QBENCHMARK { - prog.call(); - } -} - #define SETPROPERTY_PROGRAM \ "(function(testObject) { return (function() { " \ " for (var ii = 0; ii < 10000; ++ii) { " \ @@ -349,27 +325,6 @@ void tst_script::setproperty_js() } } -void tst_script::setproperty_qmlobject() -{ - QQmlEngine qmlengine; - - TestObject to; - - QV8Engine *engine = QQmlEnginePrivate::getV8Engine(&qmlengine); - v8::HandleScope handle_scope; - v8::Context::Scope scope(engine->context()); - QJSValue v = engine->scriptValueFromInternal(engine->qobjectWrapper()->newQObject(&to)); - - QJSValueList args; - args << v; - QJSValue prog = qmlengine.evaluate(SETPROPERTY_PROGRAM).call(args); - prog.call(); - - QBENCHMARK { - prog.call(); - } -} - #define FUNCTION_PROGRAM \ "(function(testObject) { return (function() { " \ " var test = 0; " \ @@ -437,27 +392,6 @@ void tst_script::function_qobject() } } -void tst_script::function_qmlobject() -{ - QQmlEngine qmlengine; - - TestObject to; - - QV8Engine *engine = QQmlEnginePrivate::getV8Engine(&qmlengine); - v8::HandleScope handle_scope; - v8::Context::Scope scope(engine->context()); - QJSValue v = engine->scriptValueFromInternal(engine->qobjectWrapper()->newQObject(&to)); - - QJSValueList args; - args << v; - QJSValue prog = qmlengine.evaluate(FUNCTION_PROGRAM).call(args); - prog.call(); - - QBENCHMARK { - prog.call(); - } -} - #define FUNCTION_ARGS_PROGRAM \ "(function(testObject) { return (function() { " \ " var test = 0; " \ @@ -525,27 +459,6 @@ void tst_script::function_args_qobject() } } -void tst_script::function_args_qmlobject() -{ - QQmlEngine qmlengine; - - TestObject to; - - QV8Engine *engine = QQmlEnginePrivate::getV8Engine(&qmlengine); - v8::HandleScope handle_scope; - v8::Context::Scope scope(engine->context()); - QJSValue v = engine->scriptValueFromInternal(engine->qobjectWrapper()->newQObject(&to)); - - QJSValueList args; - args << v; - QJSValue prog = qmlengine.evaluate(FUNCTION_ARGS_PROGRAM).call(args); - prog.call(); - - QBENCHMARK { - prog.call(); - } -} - void tst_script::signal_unconnected() { QQmlEngine engine; diff --git a/tests/benchmarks/script/qjsvalue/qjsvalue.pro b/tests/benchmarks/script/qjsvalue/qjsvalue.pro deleted file mode 100644 index 1b39091dea..0000000000 --- a/tests/benchmarks/script/qjsvalue/qjsvalue.pro +++ /dev/null @@ -1,10 +0,0 @@ -CONFIG += benchmark -TEMPLATE = app -TARGET = tst_bench_qjsvalue -INCLUDEPATH += . -macx:CONFIG -= app_bundle -CONFIG += release - -SOURCES += tst_qjsvalue.cpp - -QT += core-private qml-private testlib diff --git a/tests/benchmarks/script/qjsvalue/tst_qjsvalue.cpp b/tests/benchmarks/script/qjsvalue/tst_qjsvalue.cpp deleted file mode 100644 index f1bdb78c7b..0000000000 --- a/tests/benchmarks/script/qjsvalue/tst_qjsvalue.cpp +++ /dev/null @@ -1,99 +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 <QJSEngine> -#include <QJSValue> - -class tst_QJSValue : public QObject -{ - Q_OBJECT -public: - tst_QJSValue() {} - -private slots: - void fillArray(); - - void property(); - - void setProperty(); - - void call(); -}; - -void tst_QJSValue::fillArray() -{ - QJSEngine eng; - static const int ArrayLength = 10000; - QJSValue array = eng.newArray(ArrayLength); - QBENCHMARK { - for (int i = 0; i < ArrayLength; ++i) - array.setProperty(i, i); - } -} - -void tst_QJSValue::property() -{ - QJSEngine eng; - QJSValue object = eng.newObject(); - QString propertyName = QString::fromLatin1("foo"); - object.setProperty(propertyName, 123); - QVERIFY(object.property(propertyName).isNumber()); - QBENCHMARK { - object.property(propertyName); - } -} - -void tst_QJSValue::setProperty() -{ - QJSEngine eng; - QJSValue object = eng.newObject(); - QString propertyName = QString::fromLatin1("foo"); - QJSValue value(123); - QBENCHMARK { - object.setProperty(propertyName, value); - } -} - -#define TEST_FUNCTION_SOURCE "(function() { return 123; })" - -void tst_QJSValue::call() -{ - QJSEngine eng; - QJSValue fun = eng.evaluate(TEST_FUNCTION_SOURCE); - QVERIFY(fun.isCallable()); - QJSValueList args; - QVERIFY(fun.call(args).isNumber()); - QBENCHMARK { - fun.call(args); - } -} - -QTEST_MAIN(tst_QJSValue) - -#include "tst_qjsvalue.moc" diff --git a/tests/benchmarks/script/script.pro b/tests/benchmarks/script/script.pro deleted file mode 100644 index 37dc03801d..0000000000 --- a/tests/benchmarks/script/script.pro +++ /dev/null @@ -1,4 +0,0 @@ -TEMPLATE = subdirs - -SUBDIRS += \ - qjsvalue diff --git a/tests/manual/v4/v8-bench.js b/tests/manual/v4/v8-bench.js index 41a04fa29a..bfce6231e4 100644 --- a/tests/manual/v4/v8-bench.js +++ b/tests/manual/v4/v8-bench.js @@ -202,6 +202,9 @@ BenchmarkSuite.prototype.NotifyError = function(error) { // Runs a single benchmark for at least a second and computes the // average time it takes to run a single iteration. BenchmarkSuite.prototype.RunSingleBenchmark = function(benchmark, data) { + // run the garbage collector, to give more reproducible conditions to each test + gc() + function Measure(data) { var elapsed = 0; var start = new Date(); |