diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-11-20 13:36:33 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-11-20 13:36:53 +0100 |
commit | 79ba800108e53b4012e66bbfa93ee12db4815c75 (patch) | |
tree | 3d7794ebbef03c86fb4619b7e514ad64230650a3 /tests | |
parent | c8a688a56da4404397cb0579715f9db5c53c3540 (diff) | |
parent | 8ae390e75bf589b1591cdf5caa77b254b9ac0d8a (diff) |
Merge remote-tracking branch 'origin/release' into stable
Change-Id: Id732233d56e8d1706f62ef7a153d4a471406c551
Diffstat (limited to 'tests')
33 files changed, 655 insertions, 29 deletions
diff --git a/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp b/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp index 9318372e2c..2fee7cfc92 100644 --- a/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp +++ b/tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp @@ -48,7 +48,6 @@ #include <QtCore/QString> #include <QtTest/QtTest> -const char *ENABLE_DEBUG= "-enable-debugger"; const char *NORMALMODE = "-qmljsdebugger=port:3777,3787,block"; const char *QMLFILE = "test.qml"; @@ -183,7 +182,7 @@ void tst_QDebugMessageService::init() m_process = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qml", this); m_client = new QQmlDebugMsgClient(m_connection); - m_process->start(QStringList() << QLatin1String(ENABLE_DEBUG) << QLatin1String(NORMALMODE) << QQmlDataTest::instance()->testFile(QMLFILE)); + m_process->start(QStringList() << QLatin1String(NORMALMODE) << QQmlDataTest::instance()->testFile(QMLFILE)); QVERIFY2(m_process->waitForSessionStart(), "Could not launch application, or did not get 'Waiting for connection'."); diff --git a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp index fb6b4eee65..2cf6ee958a 100644 --- a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp +++ b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp @@ -1454,9 +1454,9 @@ void tst_QQmlDebugJS::getScripts() QVERIFY(init()); + client->setBreakpoint(QLatin1String(SCRIPTREGEXP), QString(TEST_QMLFILE), 48, -1, true); client->connect(); - client->interrupt(); - QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(interruptRequested()))); + QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(stopped()))); client->scripts(); QVERIFY(QQmlDebugTest::waitForSignal(client, SIGNAL(scriptsResult()))); diff --git a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp index 231e37c6fb..efb130d789 100644 --- a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp +++ b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp @@ -110,7 +110,7 @@ void tst_QQmlEngineDebugInspectorIntegration::init() // ### Still using qmlscene because of QTBUG-33376 m_process = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene", this); - m_process->start(QStringList() << QLatin1String("-enable-debugger") << argument << testFile("qtquick2.qml")); + m_process->start(QStringList() << argument << testFile("qtquick2.qml")); QVERIFY2(m_process->waitForSessionStart(), "Could not launch application, or did not get 'Waiting for connection'."); diff --git a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp index 2eeb4ce5b2..6a9ecdfa73 100644 --- a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp +++ b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp @@ -91,7 +91,7 @@ void tst_QQmlInspector::startQmlsceneProcess(const char * /* qmlFile */) // ### This should be using qml instead of qmlscene, but can't because of QTBUG-33376 (same as the XFAIL testcase) m_process = new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene", this); - m_process->start(QStringList() << QLatin1String("-enable-debugger") << argument << testFile("qtquick2.qml")); + m_process->start(QStringList() << argument << testFile("qtquick2.qml")); QVERIFY2(m_process->waitForSessionStart(), "Could not launch application, or did not get 'Waiting for connection'."); diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp index 902e525dd6..f2b82db630 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp +++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp @@ -300,8 +300,6 @@ void tst_QQmlProfilerService::connect(bool block, const QString &testFile) // ### Still using qmlscene due to QTBUG-33377 const QString executable = QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene"; QStringList arguments; - arguments << QLatin1String("-enable-debugger"); - if (block) arguments << QString("-qmljsdebugger=port:" STR_PORT_FROM "," STR_PORT_TO ",block"); else @@ -450,8 +448,9 @@ void tst_QQmlProfilerService::scenegraphData() QTRY_COMPARE(m_client->state(), QQmlDebugClient::Enabled); m_client->setTraceState(true); - QVERIFY(QQmlDebugTest::waitForSignal(m_process, SIGNAL(readyReadStandardOutput()))); - QVERIFY(m_process->output().indexOf(QLatin1String("tick")) != -1); + + while (!m_process->output().contains(QLatin1String("tick"))) + QVERIFY(QQmlDebugTest::waitForSignal(m_process, SIGNAL(readyReadStandardOutput()))); m_client->setTraceState(false); QVERIFY2(QQmlDebugTest::waitForSignal(m_client, SIGNAL(complete())), "No trace received in time."); diff --git a/tests/auto/qml/debugger/qv8profilerservice/tst_qv8profilerservice.cpp b/tests/auto/qml/debugger/qv8profilerservice/tst_qv8profilerservice.cpp index f0485fb68a..a461519c75 100644 --- a/tests/auto/qml/debugger/qv8profilerservice/tst_qv8profilerservice.cpp +++ b/tests/auto/qml/debugger/qv8profilerservice/tst_qv8profilerservice.cpp @@ -206,7 +206,6 @@ bool tst_QV8ProfilerService::connect(bool block, const QString &testFile, { const QString executable = QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qml"; QStringList arguments; - arguments << QLatin1String("-enable-debugger"); if (block) arguments << QString("-qmljsdebugger=port:" STR_PORT_FROM "," STR_PORT_TO ",block"); diff --git a/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp b/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp index 2b8da26dc9..e73edc812a 100644 --- a/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp +++ b/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp @@ -2206,7 +2206,7 @@ void tst_QJSValue::strictlyEquals() { QJSValue var1 = eng.toScriptValue(QVariant(QPoint(1, 2))); QJSValue var2 = eng.toScriptValue(QVariant(QPoint(1, 2))); - QVERIFY(!var1.strictlyEquals(var2)); + QVERIFY(var1.strictlyEquals(var2)); } { QJSValue var1 = eng.toScriptValue(QVariant(QPoint(1, 2))); diff --git a/tests/auto/qml/qqmlecmascript/data/idAsLValue.qml b/tests/auto/qml/qqmlecmascript/data/idAsLValue.qml new file mode 100644 index 0000000000..1035f844b4 --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/idAsLValue.qml @@ -0,0 +1,7 @@ +import QtQml 2.0 +QtObject { + id: root + Component.onCompleted: { + root = "hello" + } +} diff --git a/tests/auto/qml/qqmlecmascript/data/misctypetest.qml b/tests/auto/qml/qqmlecmascript/data/misctypetest.qml new file mode 100644 index 0000000000..60ff53a2b4 --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/misctypetest.qml @@ -0,0 +1,28 @@ +import QtQuick 2.0 +import Qt.test 1.0 + +Item { + MiscTypeTest { + id: mtt + } + + function test_invalid_url_equal() + { + return mtt.invalidUrl() == mtt.invalidUrl(); + } + + function test_invalid_url_refequal() + { + return mtt.invalidUrl() === mtt.invalidUrl(); + } + + function test_valid_url_equal() + { + return mtt.validUrl() == mtt.validUrl(); + } + + function test_valid_url_refequal() + { + return mtt.validUrl() === mtt.validUrl(); + } +} diff --git a/tests/auto/qml/qqmlecmascript/data/qtbug34792.qml b/tests/auto/qml/qqmlecmascript/data/qtbug34792.qml new file mode 100644 index 0000000000..37c551b587 --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/qtbug34792.qml @@ -0,0 +1,14 @@ +import QtQuick 2.1 +Rectangle { + function foo() + { + for (var i = 0; i < 1; i++) + { + if (i >= 0) + break + + return + } + + } +} diff --git a/tests/auto/qml/qqmlecmascript/data/qtbug_33754.qml b/tests/auto/qml/qqmlecmascript/data/qtbug_33754.qml new file mode 100644 index 0000000000..705334fbfa --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/qtbug_33754.qml @@ -0,0 +1,12 @@ +import QtQuick 2.0 + +Item { + property int a: 0 + property int b: 0 + + Component.onCompleted: { + for (var i = ((a > b) ? b : a); i < ((a > b) ? a : b); i++) + { + } + } +} diff --git a/tests/auto/qml/qqmlecmascript/data/qtbug_34493.qml b/tests/auto/qml/qqmlecmascript/data/qtbug_34493.qml new file mode 100644 index 0000000000..7e7d350aae --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/qtbug_34493.qml @@ -0,0 +1,19 @@ +import Qt.test 1.0 +import QtQuick 2.0 + +MyQmlObject { + function doIt() { + d.hello("World") + } + + property QtObject subobject: QtObject { + id: d + function hello(input) { + var temp = "Hello " + input; + var input = temp + "!"; + prop = input + } + } + + property string prop +} diff --git a/tests/auto/qml/qqmlecmascript/data/sequenceConversion.indexes.qml b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.indexes.qml index 962e8dd474..a3f306f717 100644 --- a/tests/auto/qml/qqmlecmascript/data/sequenceConversion.indexes.qml +++ b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.indexes.qml @@ -72,4 +72,17 @@ Item { if (!verifyExpected(msco.intListProperty, 4)) success = false; } + + function indexOf() { + if (msco.qstringListProperty.length != 4) + success = false; + if (msco.qstringListProperty.indexOf("first") != 0) + success = false; + if (msco.qstringListProperty.indexOf("second") != 1) + success = false; + if (msco.qstringListProperty.indexOf("third") != 2) + success = false; + if (msco.qstringListProperty.indexOf("fourth") != 3) + success = false; + } } diff --git a/tests/auto/qml/qqmlecmascript/data/setPropertyOnNull.qml b/tests/auto/qml/qqmlecmascript/data/setPropertyOnNull.qml new file mode 100644 index 0000000000..a3288f47d7 --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/setPropertyOnNull.qml @@ -0,0 +1,5 @@ +import QtQuick 2.2 + +QtObject { + Component.onCompleted: null.bug = 0 +} diff --git a/tests/auto/qml/qqmlecmascript/data/setPropertyOnUndefined.qml b/tests/auto/qml/qqmlecmascript/data/setPropertyOnUndefined.qml new file mode 100644 index 0000000000..6655c47e5f --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/setPropertyOnUndefined.qml @@ -0,0 +1,5 @@ +import QtQuick 2.2 + +QtObject { + Component.onCompleted: undefined.bug = 0 +} diff --git a/tests/auto/qml/qqmlecmascript/data/singletonTest.qml b/tests/auto/qml/qqmlecmascript/data/singletonTest.qml new file mode 100644 index 0000000000..6d296cd613 --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/singletonTest.qml @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Canonical Limited and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import Test 1.0 + +Item { + property bool qobjectTest: MyInheritedQmlObjectSingleton.isItYouQObject(MyInheritedQmlObjectSingleton) + property bool myQmlObjectTest: MyInheritedQmlObjectSingleton.isItYouMyQmlObject(MyInheritedQmlObjectSingleton) + property bool myInheritedQmlObjectTest: MyInheritedQmlObjectSingleton.isItYouMyInheritedQmlObject(MyInheritedQmlObjectSingleton) +} diff --git a/tests/auto/qml/qqmlecmascript/data/singletonTest2.qml b/tests/auto/qml/qqmlecmascript/data/singletonTest2.qml new file mode 100644 index 0000000000..ec457589de --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/singletonTest2.qml @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Canonical Limited and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 +import Test 1.0 + +Item { + property bool myInheritedQmlObjectTest1: false + property bool myInheritedQmlObjectTest2: false + property bool myInheritedQmlObjectTest3: false + property bool myQmlObjectTest1: false + property bool myQmlObjectTest2: false + property bool myQmlObjectTest3: false + property bool qobjectTest1: false + property bool qobjectTest2: false + property bool qobjectTest3: false + property bool singletonEqualToItself: true + + Component.onCompleted: { + MyInheritedQmlObjectSingleton.myInheritedQmlObjectProperty = MyInheritedQmlObjectSingleton; + myInheritedQmlObjectTest1 = MyInheritedQmlObjectSingleton.myInheritedQmlObjectProperty == MyInheritedQmlObjectSingleton; + myInheritedQmlObjectTest2 = MyInheritedQmlObjectSingleton.myInheritedQmlObjectProperty == MyInheritedQmlObjectSingleton.myInheritedQmlObjectProperty; + myInheritedQmlObjectTest3 = MyInheritedQmlObjectSingleton == MyInheritedQmlObjectSingleton.myInheritedQmlObjectProperty; + + MyInheritedQmlObjectSingleton.myQmlObjectProperty = MyInheritedQmlObjectSingleton; + myQmlObjectTest1 = MyInheritedQmlObjectSingleton.myQmlObjectProperty == MyInheritedQmlObjectSingleton; + myQmlObjectTest2 = MyInheritedQmlObjectSingleton.myQmlObjectProperty == MyInheritedQmlObjectSingleton.myQmlObjectProperty; + myQmlObjectTest3 = MyInheritedQmlObjectSingleton == MyInheritedQmlObjectSingleton.myQmlObjectProperty; + + MyInheritedQmlObjectSingleton.qobjectProperty = MyInheritedQmlObjectSingleton; + qobjectTest1 = MyInheritedQmlObjectSingleton.qobjectProperty == MyInheritedQmlObjectSingleton; + qobjectTest2 = MyInheritedQmlObjectSingleton.qobjectProperty == MyInheritedQmlObjectSingleton.qobjectProperty; + qobjectTest3 = MyInheritedQmlObjectSingleton == MyInheritedQmlObjectSingleton.qobjectProperty; + + singletonEqualToItself = MyInheritedQmlObjectSingleton == MyInheritedQmlObjectSingleton; + } +} diff --git a/tests/auto/qml/qqmlecmascript/data/updateCall.qml b/tests/auto/qml/qqmlecmascript/data/updateCall.qml new file mode 100644 index 0000000000..341a360d25 --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/updateCall.qml @@ -0,0 +1,10 @@ +import QtQuick 2.1
+
+Rectangle {
+ MouseArea {
+ anchors.fill: parent;
+ Component.onCompleted: {
+ update();
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/testtypes.cpp b/tests/auto/qml/qqmlecmascript/testtypes.cpp index a09bd9f3c6..41fa3672bd 100644 --- a/tests/auto/qml/qqmlecmascript/testtypes.cpp +++ b/tests/auto/qml/qqmlecmascript/testtypes.cpp @@ -235,6 +235,21 @@ public: } }; +class MiscTypeTestClass : public QObject +{ + Q_OBJECT +public: + Q_INVOKABLE QUrl invalidUrl() + { + return QUrl(); + } + + Q_INVOKABLE QUrl validUrl() + { + return QUrl("http://wwww.qt-project.org"); + } +}; + class MyStringClass : public QObject { Q_OBJECT @@ -257,10 +272,34 @@ public: } }; +static MyInheritedQmlObject *theSingletonObject = 0; + +static QObject *inheritedQmlObject_provider(QQmlEngine* /* engine */, QJSEngine* /* scriptEngine */) +{ + theSingletonObject = new MyInheritedQmlObject(); + return theSingletonObject; +} + +bool MyInheritedQmlObject::isItYouQObject(QObject *o) +{ + return o && o == theSingletonObject; +} + +bool MyInheritedQmlObject::isItYouMyQmlObject(MyQmlObject *o) +{ + return o && o == theSingletonObject; +} + +bool MyInheritedQmlObject::isItYouMyInheritedQmlObject(MyInheritedQmlObject *o) +{ + return o && o == theSingletonObject; +} + void registerTypes() { qmlRegisterType<MyQmlObject>("Qt.test", 1,0, "MyQmlObjectAlias"); qmlRegisterType<MyQmlObject>("Qt.test", 1,0, "MyQmlObject"); + qmlRegisterSingletonType<MyInheritedQmlObject>("Test", 1, 0, "MyInheritedQmlObjectSingleton", inheritedQmlObject_provider); qmlRegisterType<MyDeferredObject>("Qt.test", 1,0, "MyDeferredObject"); qmlRegisterType<MyVeryDeferredObject>("Qt.test", 1,0, "MyVeryDeferredObject"); qmlRegisterType<MyQmlContainer>("Qt.test", 1,0, "MyQmlContainer"); @@ -329,6 +368,7 @@ void registerTypes() qmlRegisterType<MyDateClass>("Qt.test", 1, 0, "MyDateClass"); qmlRegisterType<MyStringClass>("Qt.test", 1, 0, "MyStringClass"); + qmlRegisterType<MiscTypeTestClass>("Qt.test", 1, 0, "MiscTypeTest"); qmlRegisterSingletonType<testImportOrderApi>("Qt.test.importOrderApi",1,0,"Data",testImportOrder_api); qmlRegisterSingletonType<testImportOrderApi>("NamespaceAndType",1,0,"NamespaceAndType",testImportOrder_api); diff --git a/tests/auto/qml/qqmlecmascript/testtypes.h b/tests/auto/qml/qqmlecmascript/testtypes.h index 52a619637c..556cc32fd3 100644 --- a/tests/auto/qml/qqmlecmascript/testtypes.h +++ b/tests/auto/qml/qqmlecmascript/testtypes.h @@ -291,6 +291,34 @@ Q_DECLARE_METATYPE(QQmlListProperty<MyQmlObject>) QML_DECLARE_TYPEINFO(MyQmlObject, QML_HAS_ATTACHED_PROPERTIES) +class MyInheritedQmlObject : public MyQmlObject +{ + Q_OBJECT + Q_PROPERTY(MyInheritedQmlObject *myInheritedQmlObjectProperty READ myInheritedQmlObject WRITE setMyInheritedQmlObject) + Q_PROPERTY(MyQmlObject *myQmlObjectProperty READ myQmlObject WRITE setMyQmlObject) + Q_PROPERTY(QObject *qobjectProperty READ qobject WRITE setQObject) +public: + MyInheritedQmlObject() : m_myInheritedQmlObject(0), m_myQmlObject(0), m_qobject(0) {} + + MyInheritedQmlObject *myInheritedQmlObject() const { return m_myInheritedQmlObject; } + void setMyInheritedQmlObject(MyInheritedQmlObject * o) { m_myInheritedQmlObject = o; } + + MyQmlObject *myQmlObject() const { return m_myQmlObject; } + void setMyQmlObject(MyQmlObject * o) { m_myQmlObject = o; } + + QObject *qobject() const { return m_qobject; } + void setQObject(QObject * o) { m_qobject = o; } + + Q_INVOKABLE bool isItYouQObject(QObject *o); + Q_INVOKABLE bool isItYouMyQmlObject(MyQmlObject *o); + Q_INVOKABLE bool isItYouMyInheritedQmlObject(MyInheritedQmlObject *o); +private: + MyInheritedQmlObject *m_myInheritedQmlObject; + MyQmlObject *m_myQmlObject; + QObject *m_qobject; +}; +QML_DECLARE_TYPE(MyInheritedQmlObject) + class MyQmlContainer : public QObject { Q_OBJECT diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index f4641145ab..6b19c13109 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -304,10 +304,21 @@ private slots: void propertyOverride(); void concatenatedStringPropertyAccess(); void jsOwnedObjectsDeletedOnEngineDestroy(); + void updateCall(); void numberParsing(); void stringParsing(); + void push_and_shift(); void qtbug_32801(); void thisObject(); + void qtbug_33754(); + void qtbug_34493(); + void singletonFromQMLToCpp(); + void singletonFromQMLAndBackAndCompare(); + void setPropertyOnInvalid(); + void miscTypeTest(); + void stackLimits(); + void idsAsLValues(); + void qtbug_34792(); private: // static void propertyVarWeakRefCallback(v8::Persistent<v8::Value> object, void* parameter); @@ -5422,6 +5433,8 @@ void tst_qqmlecmascript::sequenceConversionIndexes() QTest::ignoreMessage(QtWarningMsg, qPrintable(w3)); QMetaObject::invokeMethod(object, "indexedAccess"); QVERIFY(object->property("success").toBool()); + QMetaObject::invokeMethod(object, "indexOf"); + QVERIFY(object->property("success").toBool()); delete object; } @@ -7272,6 +7285,17 @@ void tst_qqmlecmascript::jsOwnedObjectsDeletedOnEngineDestroy() delete object; } +void tst_qqmlecmascript::updateCall() +{ + // update is a slot on QQuickItem. Even though it's not + // documented it can be called from within QML. Make sure + // we don't crash when calling it. + QString file("updateCall.qml"); + QQmlComponent component(&engine, testFileUrl(file)); + QObject *object = component.create(); + QVERIFY(object != 0); +} + void tst_qqmlecmascript::numberParsing() { for (int i = 1; i < 8; ++i) { @@ -7300,6 +7324,18 @@ void tst_qqmlecmascript::stringParsing() } } +void tst_qqmlecmascript::push_and_shift() +{ + QJSEngine e; + const QString program = + "var array = []; " + "for (var i = 0; i < 10000; i++) {" + " array.push(5); array.unshift(5); array.push(5);" + "}" + "array.length;"; + QVERIFY(e.evaluate(program).toNumber() == 30000); +} + void tst_qqmlecmascript::qtbug_32801() { QQmlComponent component(&engine, testFileUrl("qtbug_32801.qml")); @@ -7321,6 +7357,140 @@ void tst_qqmlecmascript::thisObject() delete object; } +void tst_qqmlecmascript::qtbug_33754() +{ + QQmlComponent component(&engine, testFileUrl("qtbug_33754.qml")); + + QScopedPointer<QObject> obj(component.create()); + QVERIFY(obj != 0); +} + +void tst_qqmlecmascript::qtbug_34493() +{ + QQmlComponent component(&engine, testFileUrl("qtbug_34493.qml")); + + QScopedPointer<QObject> obj(component.create()); + if (component.errors().size()) + qDebug() << component.errors(); + QVERIFY(component.errors().isEmpty()); + QVERIFY(obj != 0); + QVERIFY(QMetaObject::invokeMethod(obj.data(), "doIt")); + QTRY_VERIFY(obj->property("prop").toString() == QLatin1String("Hello World!")); +} + +// Check that a Singleton can be passed from QML to C++ +// as its type*, it's parent type* and as QObject* +void tst_qqmlecmascript::singletonFromQMLToCpp() +{ + QQmlComponent component(&engine, testFile("singletonTest.qml")); + QScopedPointer<QObject> obj(component.create()); + if (component.errors().size()) + qDebug() << component.errors(); + QVERIFY(component.errors().isEmpty()); + QVERIFY(obj != 0); + + QCOMPARE(obj->property("qobjectTest"), QVariant(true)); + QCOMPARE(obj->property("myQmlObjectTest"), QVariant(true)); + QCOMPARE(obj->property("myInheritedQmlObjectTest"), QVariant(true)); +} + +// Check that a Singleton can be passed from QML to C++ +// as its type*, it's parent type* and as QObject* +// and correctly compares to itself +void tst_qqmlecmascript::singletonFromQMLAndBackAndCompare() +{ + QQmlComponent component(&engine, testFile("singletonTest2.qml")); + QScopedPointer<QObject> o(component.create()); + if (component.errors().size()) + qDebug() << component.errors(); + QVERIFY(component.errors().isEmpty()); + QVERIFY(o != 0); + + QCOMPARE(o->property("myInheritedQmlObjectTest1"), QVariant(true)); + QCOMPARE(o->property("myInheritedQmlObjectTest2"), QVariant(true)); + QCOMPARE(o->property("myInheritedQmlObjectTest3"), QVariant(true)); + + QCOMPARE(o->property("myQmlObjectTest1"), QVariant(true)); + QCOMPARE(o->property("myQmlObjectTest2"), QVariant(true)); + QCOMPARE(o->property("myQmlObjectTest3"), QVariant(true)); + + QCOMPARE(o->property("qobjectTest1"), QVariant(true)); + QCOMPARE(o->property("qobjectTest2"), QVariant(true)); + QCOMPARE(o->property("qobjectTest3"), QVariant(true)); + + QCOMPARE(o->property("singletonEqualToItself"), QVariant(true)); +} + +void tst_qqmlecmascript::setPropertyOnInvalid() +{ + { + QQmlComponent component(&engine, testFileUrl("setPropertyOnNull.qml")); + QString warning = component.url().toString() + ":4: TypeError: Type error"; + QTest::ignoreMessage(QtWarningMsg, qPrintable(warning)); + QObject *object = component.create(); + QVERIFY(object); + delete object; + } + + { + QQmlComponent component(&engine, testFileUrl("setPropertyOnUndefined.qml")); + QString warning = component.url().toString() + ":4: TypeError: Type error"; + QTest::ignoreMessage(QtWarningMsg, qPrintable(warning)); + QObject *object = component.create(); + QVERIFY(object); + delete object; + } +} + +void tst_qqmlecmascript::miscTypeTest() +{ + QQmlComponent component(&engine, testFileUrl("misctypetest.qml")); + + QObject *object = component.create(); + if (object == 0) + qDebug() << component.errorString(); + QVERIFY(object != 0); + + QVariant q; + QMetaObject::invokeMethod(object, "test_invalid_url_equal", Q_RETURN_ARG(QVariant, q)); + QVERIFY(q.toBool() == true); + QMetaObject::invokeMethod(object, "test_invalid_url_strictequal", Q_RETURN_ARG(QVariant, q)); + QVERIFY(q.toBool() == true); + QMetaObject::invokeMethod(object, "test_valid_url_equal", Q_RETURN_ARG(QVariant, q)); + QVERIFY(q.toBool() == true); + QMetaObject::invokeMethod(object, "test_valid_url_strictequal", Q_RETURN_ARG(QVariant, q)); + QVERIFY(q.toBool() == true); + + delete object; +} + +void tst_qqmlecmascript::stackLimits() +{ + QJSEngine engine; + engine.evaluate(QStringLiteral("function foo() {foo();} try {foo()} catch(e) { }")); +} + +void tst_qqmlecmascript::idsAsLValues() +{ + QString err = QString(QLatin1String("%1:5 left-hand side of assignment operator is not an lvalue\n")).arg(testFileUrl("idAsLValue.qml").toString()); + QQmlComponent component(&engine, testFileUrl("idAsLValue.qml")); + QTest::ignoreMessage(QtWarningMsg, "QQmlComponent: Component is not ready"); + MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); + QVERIFY(!object); + QCOMPARE(component.errorString(), err); +} + +void tst_qqmlecmascript::qtbug_34792() +{ + QQmlComponent component(&engine, testFileUrl("qtbug34792.qml")); + + QObject *object = component.create(); + if (object == 0) + qDebug() << component.errorString(); + QVERIFY(object != 0); + delete object; +} + 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 004514d39c..382bfe4b73 100644 --- a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp +++ b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp @@ -54,7 +54,7 @@ #include <QQmlExpression> #include <QQmlIncubationController> #include <private/qqmlengine_p.h> -#include <QQmlAbstractUrlInterceptor> +#include <private/qqmlabstracturlinterceptor_p.h> class tst_qqmlengine : public QQmlDataTest { diff --git a/tests/auto/qml/qqmlfileselector/tst_qqmlfileselector.cpp b/tests/auto/qml/qqmlfileselector/tst_qqmlfileselector.cpp index a583fd0c4c..a9c1c11549 100644 --- a/tests/auto/qml/qqmlfileselector/tst_qqmlfileselector.cpp +++ b/tests/auto/qml/qqmlfileselector/tst_qqmlfileselector.cpp @@ -43,6 +43,7 @@ #include <QQmlEngine> #include <QQmlComponent> #include <QQmlFileSelector> +#include <QQmlApplicationEngine> #include <QFileSelector> #include <QQmlContext> #include <qqmlinfo.h> @@ -56,17 +57,30 @@ public: private slots: void basicTest(); + void applicationEngineTest(); }; void tst_qqmlfileselector::basicTest() { QQmlEngine engine; - QFileSelector selector; + QQmlFileSelector selector(&engine); selector.setExtraSelectors(QStringList() << "basic"); - QQmlFileSelector qmlSelector; - qmlSelector.setSelector(&selector); - engine.setUrlInterceptor(&qmlSelector); + + QQmlComponent component(&engine, testFileUrl("basicTest.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + QCOMPARE(object->property("value").toString(), QString("selected")); + + delete object; +} + +void tst_qqmlfileselector::applicationEngineTest() +{ + QQmlApplicationEngine engine; + QQmlFileSelector* selector = QQmlFileSelector::get(&engine); + QVERIFY(selector != 0); + selector->setExtraSelectors(QStringList() << "basic"); QQmlComponent component(&engine, testFileUrl("basicTest.qml")); QObject *object = component.create(); diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index f889036961..621061ab6a 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -3511,12 +3511,9 @@ void tst_qqmllanguage::compositeSingletonJavaScriptPragma() // Reads values from a Singleton accessed through selectors. void tst_qqmllanguage::compositeSingletonSelectors() { - QFileSelector selector; - selector.setExtraSelectors(QStringList() << "basicSelector"); - QQmlFileSelector qmlSelector; - qmlSelector.setSelector(&selector); QQmlEngine e2; - e2.setUrlInterceptor(&qmlSelector); + QQmlFileSelector qmlSelector(&e2); + qmlSelector.setExtraSelectors(QStringList() << "basicSelector"); QQmlComponent component(&e2, testFile("singletonTest1.qml")); VERIFY_ERRORS(0); QObject *o = component.create(); diff --git a/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp b/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp index fa3b190826..f1b48df437 100644 --- a/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp +++ b/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp @@ -98,6 +98,7 @@ public: void verifyReceiverCount() { + //Note: QTBUG-34829 means we can't call this from within disconnectNotify or it can lock QCOMPARE(receivers(SIGNAL(qmlObjectPropChanged())), qmlObjectPropConnections); QCOMPARE(receivers(SIGNAL(cppObjectPropChanged())), cppObjectPropConnections); QCOMPARE(receivers(SIGNAL(unboundPropChanged())), unboundPropConnections); @@ -134,7 +135,6 @@ protected: if (signal.name() == "scriptBindingPropChanged") scriptBindingPropConnections--; if (signal.name() == "boundSignal") boundSignalConnections--; if (signal.name() == "unusedSignal") unusedSignalConnections--; - verifyReceiverCount(); //qDebug() << Q_FUNC_INFO << this << signal.methodSignature(); } @@ -205,6 +205,7 @@ void tst_qqmlnotifier::createObjects() exportedClass = qobject_cast<ExportedClass *>( root->findChild<ExportedClass*>("exportedClass")); QVERIFY(exportedClass != 0); + exportedClass->verifyReceiverCount(); } void tst_qqmlnotifier::cleanupTestCase() diff --git a/tests/auto/quick/nodes/tst_nodestest.cpp b/tests/auto/quick/nodes/tst_nodestest.cpp index 9910729807..d07fd7177d 100644 --- a/tests/auto/quick/nodes/tst_nodestest.cpp +++ b/tests/auto/quick/nodes/tst_nodestest.cpp @@ -48,6 +48,8 @@ #include <QtQuick/qsgnode.h> #include <QtQuick/private/qsgbatchrenderer_p.h> #include <QtQuick/private/qsgnodeupdater_p.h> +#include <QtQuick/private/qsgrenderloop_p.h> +#include <QtQuick/private/qsgcontext_p.h> #include <QtQuick/qsgsimplerectnode.h> @@ -75,16 +77,22 @@ private Q_SLOTS: private: QOffscreenSurface *surface; QOpenGLContext *context; + QSGRenderContext *renderContext; }; void NodesTest::initTestCase() { + QSGRenderLoop *renderLoop = QSGRenderLoop::instance(); + surface = new QOffscreenSurface; surface->create(); context = new QOpenGLContext(); context->create(); context->makeCurrent(surface); + + renderContext = renderLoop->createRenderContext(renderLoop->sceneGraphContext()); + renderContext->initialize(context); } void NodesTest::cleanupTestCase() @@ -97,8 +105,8 @@ void NodesTest::cleanupTestCase() class DummyRenderer : public QSGBatchRenderer::Renderer { public: - DummyRenderer(QSGRootNode *root) - : QSGBatchRenderer::Renderer(new QSGRenderContext(0)) + DummyRenderer(QSGRootNode *root, QSGRenderContext *renderContext) + : QSGBatchRenderer::Renderer(renderContext) , changedNode(0) , changedState(0) , renderCount(0) @@ -138,7 +146,7 @@ void NodesTest::propegate() QSGNode child; child.setFlag(QSGNode::OwnedByParent, false); root.appendChildNode(&child); - DummyRenderer renderer(&root); + DummyRenderer renderer(&root, renderContext); child.markDirty(QSGNode::DirtyGeometry); @@ -158,8 +166,8 @@ void NodesTest::propegateWithMultipleRoots() child2.appendChildNode(&root3); root3.appendChildNode(&child4); - DummyRenderer ren1(&root1); - DummyRenderer ren2(&root3); + DummyRenderer ren1(&root1, renderContext); + DummyRenderer ren2(&root3, renderContext); child4.markDirty(QSGNode::DirtyGeometry); @@ -195,7 +203,7 @@ void NodesTest::opacityPropegation() QSGSimpleRectNode *geometry = new QSGSimpleRectNode; geometry->setRect(0, 0, 100, 100); - DummyRenderer renderer(&root); + DummyRenderer renderer(&root, renderContext); root.appendChildNode(a); a->appendChildNode(b); diff --git a/tests/auto/quick/qquickanimations/data/parallelAnimationNullChildBug.qml b/tests/auto/quick/qquickanimations/data/parallelAnimationNullChildBug.qml new file mode 100644 index 0000000000..8da3e8e1af --- /dev/null +++ b/tests/auto/quick/qquickanimations/data/parallelAnimationNullChildBug.qml @@ -0,0 +1,6 @@ +import QtQuick 2.2 + +Item { + id: root + Component.onCompleted: Qt.createQmlObject("import QtQuick 2.2; ParallelAnimation{animations: [null]}", root) +} diff --git a/tests/auto/quick/qquickanimations/data/sequentialAnimationNullChildBug.qml b/tests/auto/quick/qquickanimations/data/sequentialAnimationNullChildBug.qml new file mode 100644 index 0000000000..7a5c6063c4 --- /dev/null +++ b/tests/auto/quick/qquickanimations/data/sequentialAnimationNullChildBug.qml @@ -0,0 +1,6 @@ +import QtQuick 2.2 + +Item { + id: root + Component.onCompleted: Qt.createQmlObject("import QtQuick 2.2; SequentialAnimation{animations: [null]}", root) +} diff --git a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp index 94726aa5fe..c6f4779819 100644 --- a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp +++ b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp @@ -110,6 +110,7 @@ private slots: void anchorBug(); void pathAnimationInOutBackBug(); void scriptActionBug(); + void groupAnimationNullChildBug(); }; #define QTIMED_COMPARE(lhs, rhs) do { \ @@ -1450,6 +1451,31 @@ void tst_qquickanimations::scriptActionBug() QCOMPARE(obj->property("actionTriggered").toBool(), true); } +//QTBUG-34851 +void tst_qquickanimations::groupAnimationNullChildBug() +{ + { + QQmlEngine engine; + + QQmlComponent c(&engine, testFileUrl("sequentialAnimationNullChildBug.qml")); + QQuickItem *root = qobject_cast<QQuickItem*>(c.create()); + QVERIFY(root); + + delete root; + } + + { + QQmlEngine engine; + + QQmlComponent c(&engine, testFileUrl("parallelAnimationNullChildBug.qml")); + QQuickItem *root = qobject_cast<QQuickItem*>(c.create()); + QVERIFY(root); + + delete root; + } +} + + QTEST_MAIN(tst_qquickanimations) #include "tst_qquickanimations.moc" diff --git a/tests/auto/quick/qquickspringanimation/data/inTransition.qml b/tests/auto/quick/qquickspringanimation/data/inTransition.qml new file mode 100644 index 0000000000..68d3125e40 --- /dev/null +++ b/tests/auto/quick/qquickspringanimation/data/inTransition.qml @@ -0,0 +1,22 @@ +import QtQuick 2.0 + +Rectangle { + width: 250 + height: 250 + + ListView { + anchors.fill: parent + model: ListModel { + ListElement { text: "A" } + ListElement { text: "B" } + } + + populate: Transition { + SpringAnimation { properties: "x"; from: 0; to: 100; spring: 4; damping: 0.3 } + } + + delegate: Text { + text: "Test" + } + } +} diff --git a/tests/auto/quick/qquickspringanimation/tst_qquickspringanimation.cpp b/tests/auto/quick/qquickspringanimation/tst_qquickspringanimation.cpp index 78d114c904..137b5c08e4 100644 --- a/tests/auto/quick/qquickspringanimation/tst_qquickspringanimation.cpp +++ b/tests/auto/quick/qquickspringanimation/tst_qquickspringanimation.cpp @@ -41,6 +41,7 @@ #include <qtest.h> #include <QtQml/qqmlengine.h> #include <QtQml/qqmlcomponent.h> +#include <QtQuick/qquickview.h> #include <private/qquickspringanimation_p.h> #include <private/qqmlvaluetype_p.h> #include "../../shared/util.h" @@ -55,6 +56,7 @@ private slots: void defaultValues(); void values(); void disabled(); + void inTransition(); private: QQmlEngine engine; @@ -128,6 +130,14 @@ void tst_qquickspringanimation::disabled() delete obj; } +void tst_qquickspringanimation::inTransition() +{ + QQuickView view(testFileUrl("inTransition.qml")); + view.show(); + // this used to crash after ~1 sec, once the spring animation was done + QTest::qWait(2000); +} + QTEST_MAIN(tst_qquickspringanimation) #include "tst_qquickspringanimation.moc" diff --git a/tests/auto/quick/scenegraph/data/render_StackingOrder.qml b/tests/auto/quick/scenegraph/data/render_StackingOrder.qml new file mode 100644 index 0000000000..ab335004c2 --- /dev/null +++ b/tests/auto/quick/scenegraph/data/render_StackingOrder.qml @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt 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.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.2 + +/* + This test verifies that items that go from being batched because + of no overlap will be split into multiple batches because of an + overlap and that no rendering errors occur as a result of this. + + #samples: 3 + PixelPos R G B Error-tolerance + #final: 10 10 1.0 0.0 0.0 0.05 + #final: 10 110 0.0 1.0 0.0 0.05 + #final: 10 120 0.0 0.0 1.0 0.05 +*/ + +RenderTestBase { + Item { + opacity: 0.99; // Just to trigger alpha batches + Rectangle { color: "#ff0000"; x: 10; y: 10; width: 20; height: 20; } + Image { source: "logo-small.jpg"; x: 10; y: 50; width: 50; height: 51; } + Rectangle { color: "#00ff00"; x: 10; y: 100; width: 50; height: 50; } + Rectangle { color: "#0000ff"; x: 10; y: 120; width: 10; height: 10; } + } + onEnterFinalStage: finalStageComplete = true; +} diff --git a/tests/auto/quick/scenegraph/tst_scenegraph.cpp b/tests/auto/quick/scenegraph/tst_scenegraph.cpp index 755cec460d..3b79f01f12 100644 --- a/tests/auto/quick/scenegraph/tst_scenegraph.cpp +++ b/tests/auto/quick/scenegraph/tst_scenegraph.cpp @@ -323,6 +323,7 @@ void tst_SceneGraph::render_data() << "data/render_MovingOverlap.qml" << "data/render_BreakOpacityBatch.qml" << "data/render_OutOfFloatRange.qml" + << "data/render_StackingOrder.qml" ; QRegExp sampleCount("#samples: *(\\d+)"); |