diff options
Diffstat (limited to 'tests')
96 files changed, 828 insertions, 789 deletions
diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro index a99656a3ee..5c5e76d78a 100644 --- a/tests/auto/declarative/declarative.pro +++ b/tests/auto/declarative/declarative.pro @@ -33,7 +33,6 @@ PRIVATETESTS += \ qdeclarativeconnection \ qdeclarativedebug \ qdeclarativedebugclient \ - qdeclarativedebughelper \ qdeclarativedebugservice \ qdeclarativeecmascript \ qdeclarativeimageprovider \ @@ -54,8 +53,7 @@ PRIVATETESTS += \ qdeclarativeworkerscript \ qdeclarativexmllistmodel \ qpacketprotocol \ - qdeclarativev4 \ - v8 + qdeclarativev4 SGTESTS = \ qsganimatedimage \ diff --git a/tests/auto/declarative/examples/examples.pro b/tests/auto/declarative/examples/examples.pro index 297559ef97..75adbb53ba 100644 --- a/tests/auto/declarative/examples/examples.pro +++ b/tests/auto/declarative/examples/examples.pro @@ -18,6 +18,6 @@ symbian: { CONFIG += parallel_test -QT += core-private gui-private declarative-private qtquick1-private widgets-private +QT += core-private gui-private declarative-private qtquick1-private widgets-private v8-private qpa:CONFIG+=insignificant_test # QTBUG-20990, aborts diff --git a/tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro b/tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro index 2669e5a8e3..049e1b3acb 100644 --- a/tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro +++ b/tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro @@ -13,4 +13,4 @@ symbian: { CONFIG += parallel_test -QT += core-private gui-private declarative-private opengl-private +QT += core-private gui-private v8-private declarative-private opengl-private diff --git a/tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro b/tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro index e0720aa6fd..03ba50ad15 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro +++ b/tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro @@ -13,4 +13,4 @@ symbian: { CONFIG += parallel_test -QT += core-private gui-private declarative-private opengl-private +QT += core-private gui-private v8-private declarative-private opengl-private diff --git a/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro b/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro index 49150c8481..7cd78ab1fc 100644 --- a/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro +++ b/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro @@ -14,4 +14,4 @@ symbian: { CONFIG += parallel_test -QT += core-private gui-private declarative-private opengl-private +QT += core-private gui-private v8-private declarative-private opengl-private diff --git a/tests/auto/declarative/qdeclarativedebug/qdeclarativedebug.pro b/tests/auto/declarative/qdeclarativedebug/qdeclarativedebug.pro index cd5577219d..6187020a38 100644 --- a/tests/auto/declarative/qdeclarativedebug/qdeclarativedebug.pro +++ b/tests/auto/declarative/qdeclarativedebug/qdeclarativedebug.pro @@ -6,6 +6,6 @@ HEADERS += ../shared/debugutil_p.h SOURCES += tst_qdeclarativedebug.cpp \ ../shared/debugutil.cpp -CONFIG += parallel_test +CONFIG += parallel_test declarative_debug -QT += core-private gui-private declarative-private +QT += core-private gui-private v8-private declarative-private diff --git a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp index ade51c43f6..b47579ea6a 100644 --- a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp +++ b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp @@ -55,11 +55,9 @@ #include <private/qdeclarativebinding_p.h> #include <private/qdeclarativedebug_p.h> #include <private/qdeclarativeenginedebug_p.h> -#include <private/qdeclarativedebugclient_p.h> #include <private/qdeclarativedebugservice_p.h> #include <private/qdeclarativemetatype_p.h> #include <private/qdeclarativeproperty_p.h> -#include <private/qdeclarativedebughelper_p.h> #include "../../../shared/util.h" #include "../shared/debugutil_p.h" @@ -296,9 +294,6 @@ void tst_QDeclarativeDebug::initTestCase() qRegisterMetaType<QDeclarativeDebugWatch::State>(); qmlRegisterType<NonScriptProperty>("Test", 1, 0, "NonScriptPropertyElement"); - QTest::ignoreMessage(QtWarningMsg, "Qml debugging is enabled. Only use this in a safe environment!"); - QDeclarativeDebugHelper::enableDebugging(); - QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugServer: Waiting for connection on port 3768..."); m_engine = new QDeclarativeEngine(this); @@ -1089,7 +1084,7 @@ void tst_QDeclarativeDebug::setBindingInStates() // change the binding - QDeclarativeDebugObjectReference state = obj.children()[0]; + QDeclarativeDebugObjectReference state = obj.children()[1]; QCOMPARE(state.className(), QString("State")); QVERIFY(state.children().count() > 0); @@ -1173,7 +1168,7 @@ void tst_QDeclarativeDebug::queryObjectTree() // check state - QDeclarativeDebugObjectReference state = obj.children()[0]; + QDeclarativeDebugObjectReference state = obj.children()[1]; QCOMPARE(state.className(), QString("State")); QVERIFY(state.children().count() > 0); @@ -1189,7 +1184,7 @@ void tst_QDeclarativeDebug::queryObjectTree() // check transition - QDeclarativeDebugObjectReference transition = obj.children()[1]; + QDeclarativeDebugObjectReference transition = obj.children()[0]; QCOMPARE(transition.className(), QString("Transition")); QCOMPARE(findProperty(transition.properties(),"from").value().toString(), QString("*")); QCOMPARE(findProperty(transition.properties(),"to").value(), findProperty(state.properties(),"name").value()); diff --git a/tests/auto/declarative/qdeclarativedebugclient/qdeclarativedebugclient.pro b/tests/auto/declarative/qdeclarativedebugclient/qdeclarativedebugclient.pro index 189133a526..28e25e9450 100644 --- a/tests/auto/declarative/qdeclarativedebugclient/qdeclarativedebugclient.pro +++ b/tests/auto/declarative/qdeclarativedebugclient/qdeclarativedebugclient.pro @@ -5,4 +5,8 @@ macx:CONFIG -= app_bundle HEADERS += ../shared/debugutil_p.h SOURCES += tst_qdeclarativedebugclient.cpp \ ../shared/debugutil.cpp + +CONFIG += declarative_debug + QT += core-private gui-private declarative-private + diff --git a/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp b/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp index d41cfa3d4d..d7f53c9620 100644 --- a/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp +++ b/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp @@ -49,9 +49,7 @@ #include <private/qdeclarativedebug_p.h> #include <private/qdeclarativeenginedebug_p.h> -#include <private/qdeclarativedebugclient_p.h> #include <private/qdeclarativedebugservice_p.h> -#include <private/qdeclarativedebughelper_p.h> #include "../../../shared/util.h" #include "../shared/debugutil_p.h" @@ -73,9 +71,6 @@ private slots: void tst_QDeclarativeDebugClient::initTestCase() { - QTest::ignoreMessage(QtWarningMsg, "Qml debugging is enabled. Only use this in a safe environment!"); - QDeclarativeDebugHelper::enableDebugging(); - QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugServer: Waiting for connection on port 13770..."); new QDeclarativeEngine(this); diff --git a/tests/auto/declarative/qdeclarativedebughelper/private_headers/qdeclarativedebughelper_p.h b/tests/auto/declarative/qdeclarativedebughelper/private_headers/qdeclarativedebughelper_p.h deleted file mode 100644 index c08f6fd639..0000000000 --- a/tests/auto/declarative/qdeclarativedebughelper/private_headers/qdeclarativedebughelper_p.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECLARATIVEDEBUGHELPER_P_H -#define QDECLARATIVEDEBUGHELPER_P_H - -#include <QtCore/qglobal.h> - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QJSEngine; -class QDeclarativeEngine; - -// Helper methods to access private API through a stable interface -// This is used in the qmljsdebugger library of QtCreator. -class Q_DECLARATIVE_EXPORT QDeclarativeDebugHelper -{ -public: - static QJSEngine *getScriptEngine(QDeclarativeEngine *engine); - static void setAnimationSlowDownFactor(qreal factor); - - // Enables remote debugging functionality - // Only use this for debugging in a safe environment! - static void enableDebugging(); -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QDECLARATIVEDEBUGHELPER_P_H diff --git a/tests/auto/declarative/qdeclarativedebughelper/qdeclarativedebughelper.pro b/tests/auto/declarative/qdeclarativedebughelper/qdeclarativedebughelper.pro deleted file mode 100644 index 1e62c12363..0000000000 --- a/tests/auto/declarative/qdeclarativedebughelper/qdeclarativedebughelper.pro +++ /dev/null @@ -1,6 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += network declarative -macx:CONFIG -= app_bundle - -SOURCES += tst_qdeclarativedebughelper.cpp -QT += core-private gui-private declarative-private diff --git a/tests/auto/declarative/qdeclarativedebughelper/tst_qdeclarativedebughelper.cpp b/tests/auto/declarative/qdeclarativedebughelper/tst_qdeclarativedebughelper.cpp deleted file mode 100644 index f67d5c5a89..0000000000 --- a/tests/auto/declarative/qdeclarativedebughelper/tst_qdeclarativedebughelper.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include <qtest.h> - -#include <QDeclarativeEngine> -#include <private/qdeclarativeengine_p.h> -#include <QAbstractAnimation> -#include <private/qabstractanimation_p.h> - -// We have copied the header which is used in the qmljsdebugger (part of QtCreator) -// to catch BC changes. Don't update it unless you know what you are doing! -#include "private_headers/qdeclarativedebughelper_p.h" - -class tst_qdeclarativedebughelper : public QObject { - Q_OBJECT -private slots: - void setAnimationSlowDownFactor(); - void enableDebugging(); -}; - -class TestAnimation : public QAbstractAnimation { -public: - int updateCalled; - - TestAnimation() : updateCalled(0) {} - - virtual void updateCurrentTime(int /*currentTime*/) { - updateCalled++; - } - virtual int duration() const { - return 100; - } -}; - -void tst_qdeclarativedebughelper::setAnimationSlowDownFactor() -{ - TestAnimation animation; - - // first check whether setup works - QCOMPARE(animation.updateCalled, 0); - animation.start(); - QTest::qWait(animation.totalDuration() + 150); -#ifdef Q_OS_WIN - if (animation.state() != QAbstractAnimation::Stopped) - QEXPECT_FAIL("", "On windows, consistent timing is not working properly due to bad timer resolution", Abort); -#endif - QCOMPARE(animation.state(), QAbstractAnimation::Stopped); - QVERIFY(animation.updateCalled > 1); - - // check if we can pause all animations - animation.updateCalled = 0; - QDeclarativeDebugHelper::setAnimationSlowDownFactor(0.0); - animation.start(); - QTest::qWait(animation.totalDuration() + 150); - QVERIFY(animation.updateCalled <= 1); // updateCurrentTime seems to be called at least once - - // now run them again - animation.updateCalled = 0; - QDeclarativeDebugHelper::setAnimationSlowDownFactor(2.0); - animation.start(); - QTest::qWait(animation.totalDuration() + 150); - QVERIFY(animation.updateCalled > 1); -} - -void tst_qdeclarativedebughelper::enableDebugging() -{ - QTest::ignoreMessage(QtWarningMsg, "Qml debugging is enabled. Only use this in a safe environment!"); - QDeclarativeDebugHelper::enableDebugging(); -} - -QTEST_MAIN(tst_qdeclarativedebughelper) - -#include "tst_qdeclarativedebughelper.moc" - diff --git a/tests/auto/declarative/qdeclarativedebugservice/qdeclarativedebugservice.pro b/tests/auto/declarative/qdeclarativedebugservice/qdeclarativedebugservice.pro index 785e8a7bf1..999e19279b 100644 --- a/tests/auto/declarative/qdeclarativedebugservice/qdeclarativedebugservice.pro +++ b/tests/auto/declarative/qdeclarativedebugservice/qdeclarativedebugservice.pro @@ -6,6 +6,6 @@ HEADERS += ../shared/debugutil_p.h SOURCES += tst_qdeclarativedebugservice.cpp \ ../shared/debugutil.cpp -CONFIG += parallel_test +CONFIG += parallel_test declarative_debug QT += core-private gui-private declarative-private diff --git a/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp b/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp index 3fa8bba682..74f549c076 100644 --- a/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp +++ b/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp @@ -46,7 +46,6 @@ #include <QThread> #include <QtDeclarative/qdeclarativeengine.h> -#include <private/qdeclarativedebughelper_p.h> #include <private/qdeclarativedebug_p.h> #include <private/qdeclarativeenginedebug_p.h> @@ -76,9 +75,6 @@ private slots: void tst_QDeclarativeDebugService::initTestCase() { - QTest::ignoreMessage(QtWarningMsg, "Qml debugging is enabled. Only use this in a safe environment!"); - QDeclarativeDebugHelper::enableDebugging(); - QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugServer: Waiting for connection on port 13769..."); new QDeclarativeEngine(this); diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/moduleApiMajorVersionFail.qml b/tests/auto/declarative/qdeclarativeecmascript/data/moduleapi/moduleApiMajorVersionFail.qml index fb050f65bc..fb050f65bc 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/moduleApiMajorVersionFail.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/moduleapi/moduleApiMajorVersionFail.qml diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/moduleApiMinorVersionFail.qml b/tests/auto/declarative/qdeclarativeecmascript/data/moduleapi/moduleApiMinorVersionFail.qml index e06be667f7..e06be667f7 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/moduleApiMinorVersionFail.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/moduleapi/moduleApiMinorVersionFail.qml diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/moduleApi.qml b/tests/auto/declarative/qdeclarativeecmascript/data/moduleapi/qobjectModuleApi.qml index 67e8c1b08a..718a64652d 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/moduleApi.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/moduleapi/qobjectModuleApi.qml @@ -1,7 +1,6 @@ import QtQuick 2.0 import Qt.test 1.0 as QtTest // module API installed into existing uri -import Qt.test.scriptApi 1.0 as QtTestScriptApi // script module API installed into new uri import Qt.test.qobjectApi 1.0 as QtTestQObjectApi // qobject module API installed into new uri import Qt.test.qobjectApi 1.3 as QtTestMinorVersionQObjectApi // qobject module API installed into existing uri with new minor version import Qt.test.qobjectApi 2.0 as QtTestMajorVersionQObjectApi // qobject module API installed into existing uri with new major version @@ -9,7 +8,6 @@ import Qt.test.qobjectApiParented 1.0 as QtTestParentedQObjectApi // qobject (wi QtObject { property int existingUriTest: QtTest.qobjectTestProperty - property int scriptTest: QtTestScriptApi.scriptTestProperty property int qobjectTest: QtTestQObjectApi.qobjectTestProperty property int qobjectMethodTest: 2 property int qobjectMinorVersionTest: QtTestMinorVersionQObjectApi.qobjectTestProperty diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/moduleApiCaching.qml b/tests/auto/declarative/qdeclarativeecmascript/data/moduleapi/qobjectModuleApiCaching.qml index f6ce2058a7..56a55e4e9b 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/moduleApiCaching.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/moduleapi/qobjectModuleApiCaching.qml @@ -1,12 +1,10 @@ import QtQuick 2.0 import Qt.test 1.0 as QtTest // module API installed into existing uri -import Qt.test.scriptApi 1.0 as QtTestScriptApi // script module API installed into new uri import Qt.test.qobjectApiParented 1.0 as QtTestParentedQObjectApi // qobject (with parent) module API installed into a new uri QtObject { property int existingUriTest: QtTest.qobjectTestProperty - property int scriptTest: QtTestScriptApi.scriptTestProperty property int qobjectParentedTest: QtTestParentedQObjectApi.qobjectTestProperty } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/moduleapi/qobjectModuleApiEnums.qml b/tests/auto/declarative/qdeclarativeecmascript/data/moduleapi/qobjectModuleApiEnums.qml new file mode 100644 index 0000000000..da5ffd5e76 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/moduleapi/qobjectModuleApiEnums.qml @@ -0,0 +1,8 @@ +import QtQuick 2.0 +import Qt.test.qobjectApi 1.0 as QtTestQObjectApi // qobject module API installed into new uri + +QtObject { + property int enumValue: QtTestQObjectApi.EnumValue2; + property int enumMethod: QtTestQObjectApi.qobjectEnumTestMethod(QtTestQObjectApi.EnumValue1); +} + diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/moduleApiWriting.qml b/tests/auto/declarative/qdeclarativeecmascript/data/moduleapi/qobjectModuleApiWriting.qml index 500c35e211..be647ca57f 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/moduleApiWriting.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/moduleapi/qobjectModuleApiWriting.qml @@ -1,6 +1,5 @@ import QtQuick 2.0 - -import Qt.test 1.0 as QtTest // module API installed into existing uri +import Qt.test 1.0 as QtTest // qobject module API installed into existing uri QtObject { property int firstProperty: 1 diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/moduleapi/scriptModuleApi.qml b/tests/auto/declarative/qdeclarativeecmascript/data/moduleapi/scriptModuleApi.qml new file mode 100644 index 0000000000..7c4e20489d --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/moduleapi/scriptModuleApi.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 +import Qt.test.scriptApi 1.0 as QtTestScriptApi // script module API installed into new uri + +QtObject { + property int scriptTest: QtTestScriptApi.scriptTestProperty // script module api's only provide properties. +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/moduleapi/scriptModuleApiCaching.qml b/tests/auto/declarative/qdeclarativeecmascript/data/moduleapi/scriptModuleApiCaching.qml new file mode 100644 index 0000000000..90974b5969 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/moduleapi/scriptModuleApiCaching.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 +import Qt.test.scriptApi 1.0 as QtTestScriptApi // script module API installed into new uri + +QtObject { + property int scriptTest: QtTestScriptApi.scriptTestProperty +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/moduleapi/scriptModuleApiWriting.qml b/tests/auto/declarative/qdeclarativeecmascript/data/moduleapi/scriptModuleApiWriting.qml new file mode 100644 index 0000000000..02461d59ed --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/moduleapi/scriptModuleApiWriting.qml @@ -0,0 +1,32 @@ +import QtQuick 2.0 +import Qt.test.scriptApi 1.0 as QtTestScriptApi +import Qt.test.scriptApi 2.0 as QtTestScriptApi2 + +QtObject { + property int firstProperty + property int readBack + + property int secondProperty + property int unchanged + + onFirstPropertyChanged: { + if (QtTestScriptApi.scriptTestProperty != firstProperty) { + QtTestScriptApi.scriptTestProperty = firstProperty; + readBack = QtTestScriptApi.scriptTestProperty; + } + } + + onSecondPropertyChanged: { + if (QtTestScriptApi2.scriptTestProperty != secondProperty) { + QtTestScriptApi2.scriptTestProperty = secondProperty; + unchanged = QtTestScriptApi2.scriptTestProperty; + } + } + + Component.onCompleted: { + firstProperty = QtTestScriptApi.scriptTestProperty; + readBack = QtTestScriptApi.scriptTestProperty; + secondProperty = QtTestScriptApi2.scriptTestProperty; + unchanged = QtTestScriptApi2.scriptTestProperty; + } +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro b/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro index 4b7aff339c..5dfcfa6e1b 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro +++ b/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro @@ -22,4 +22,4 @@ symbian: { CONFIG += parallel_test -QT += core-private gui-private declarative-private +QT += core-private gui-private v8-private declarative-private diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp b/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp index 160a57215b..05d5510033 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp @@ -111,6 +111,21 @@ static QJSValue script_api(QDeclarativeEngine *engine, QJSEngine *scriptEngine) return v; } +static QJSValue readonly_script_api(QDeclarativeEngine *engine, QJSEngine *scriptEngine) +{ + Q_UNUSED(engine) + + static int testProperty = 42; + QJSValue v = scriptEngine->newObject(); + v.setProperty("scriptTestProperty", testProperty++); + + // now freeze it so that it's read-only + QJSValue freezeFunction = scriptEngine->evaluate("(function(obj) { return Object.freeze(obj); })"); + v = freezeFunction.call(QJSValue(), (QJSValueList() << v)); + + return v; +} + static QObject *qobject_api(QDeclarativeEngine *engine, QJSEngine *scriptEngine) { Q_UNUSED(engine) @@ -166,6 +181,7 @@ void registerTypes() qmlRegisterModuleApi("Qt.test",1,0,script_api); // register (script) module API for an existing uri which contains elements qmlRegisterModuleApi("Qt.test",1,0,qobject_api); // register (qobject) for an existing uri for which another module API was previously regd. Should replace! qmlRegisterModuleApi("Qt.test.scriptApi",1,0,script_api); // register (script) module API for a uri which doesn't contain elements + qmlRegisterModuleApi("Qt.test.scriptApi",2,0,readonly_script_api); // register (script) module API for a uri which doesn't contain elements - will be made read-only qmlRegisterModuleApi("Qt.test.qobjectApi",1,0,qobject_api); // register (qobject) module API for a uri which doesn't contain elements qmlRegisterModuleApi("Qt.test.qobjectApi",1,3,qobject_api); // register (qobject) module API for a uri which doesn't contain elements, minor version set qmlRegisterModuleApi("Qt.test.qobjectApi",2,0,qobject_api); // register (qobject) module API for a uri which doesn't contain elements, major version set diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h index afb361e2d7..2738ee3d60 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h @@ -934,6 +934,7 @@ private: class testQObjectApi : public QObject { Q_OBJECT + Q_ENUMS(MyEnum) Q_PROPERTY (int qobjectTestProperty READ qobjectTestProperty NOTIFY qobjectTestPropertyChanged) Q_PROPERTY (int qobjectTestWritableProperty READ qobjectTestWritableProperty WRITE setQObjectTestWritableProperty NOTIFY qobjectTestWritablePropertyChanged) @@ -945,7 +946,9 @@ public: ~testQObjectApi() {} - Q_INVOKABLE int qobjectTestMethod() { m_methodCallCount += 1; return m_methodCallCount; } + enum MyEnum { EnumValue1 = 25, EnumValue2 = 42 }; + Q_INVOKABLE int qobjectEnumTestMethod(MyEnum val) { return (static_cast<int>(val) + 5); } + Q_INVOKABLE int qobjectTestMethod(int increment = 1) { m_methodCallCount += increment; return m_methodCallCount; } int qobjectTestProperty() const { return m_testProperty; } void setQObjectTestProperty(int tp) { m_testProperty = tp; emit qobjectTestPropertyChanged(tp); } diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 3efe18909c..f14db0a330 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -145,6 +145,7 @@ private slots: void numberAssignment(); void propertySplicing(); void signalWithUnknownTypes(); + void moduleApi_data(); void moduleApi(); void importScripts(); void scarceResources(); @@ -2735,55 +2736,153 @@ void tst_qdeclarativeecmascript::signalWithUnknownTypes() delete object; } +void tst_qdeclarativeecmascript::moduleApi_data() +{ + QTest::addColumn<QUrl>("testfile"); + QTest::addColumn<QString>("errorMessage"); + QTest::addColumn<QStringList>("warningMessages"); + QTest::addColumn<QStringList>("readProperties"); + QTest::addColumn<QVariantList>("readExpectedValues"); + QTest::addColumn<QStringList>("writeProperties"); + QTest::addColumn<QVariantList>("writeValues"); + QTest::addColumn<QStringList>("readBackProperties"); + QTest::addColumn<QVariantList>("readBackExpectedValues"); + + QTest::newRow("qobject, register + read + method") + << TEST_FILE("moduleapi/qobjectModuleApi.qml") + << QString() + << QStringList() + << (QStringList() << "existingUriTest" << "qobjectTest" << "qobjectMethodTest" + << "qobjectMinorVersionTest" << "qobjectMajorVersionTest" << "qobjectParentedTest") + << (QVariantList() << 20 << 20 << 1 << 20 << 20 << 26) + << QStringList() + << QVariantList() + << QStringList() + << QVariantList(); + + QTest::newRow("script, register + read") + << TEST_FILE("moduleapi/scriptModuleApi.qml") + << QString() + << QStringList() + << (QStringList() << "scriptTest") + << (QVariantList() << 13) + << QStringList() + << QVariantList() + << QStringList() + << QVariantList(); + + QTest::newRow("qobject, caching + read") + << TEST_FILE("moduleapi/qobjectModuleApiCaching.qml") + << QString() + << QStringList() + << (QStringList() << "existingUriTest" << "qobjectParentedTest") + << (QVariantList() << 20 << 26) // 26, shouldn't have incremented to 27. + << QStringList() + << QVariantList() + << QStringList() + << QVariantList(); + + QTest::newRow("script, caching + read") + << TEST_FILE("moduleapi/scriptModuleApiCaching.qml") + << QString() + << QStringList() + << (QStringList() << "scriptTest") + << (QVariantList() << 13) // 13, shouldn't have incremented to 14. + << QStringList() + << QVariantList() + << QStringList() + << QVariantList(); + + QTest::newRow("qobject, writing + readonly constraints") + << TEST_FILE("moduleapi/qobjectModuleApiWriting.qml") + << QString() + << (QStringList() << QString(QLatin1String("file://") + TEST_FILE("moduleapi/qobjectModuleApiWriting.qml").toLocalFile() + QLatin1String(":14: Error: Cannot assign to read-only property \"qobjectTestProperty\""))) + << (QStringList() << "readOnlyProperty" << "writableProperty") + << (QVariantList() << 20 << 50) + << (QStringList() << "firstProperty" << "writableProperty") + << (QVariantList() << 30 << 30) + << (QStringList() << "readOnlyProperty" << "writableProperty") + << (QVariantList() << 20 << 30); + + QTest::newRow("script, writing + readonly constraints") + << TEST_FILE("moduleapi/scriptModuleApiWriting.qml") + << QString() + << (QStringList() << QString(QLatin1String("file://") + TEST_FILE("moduleapi/scriptModuleApiWriting.qml").toLocalFile() + QLatin1String(":21: Error: Cannot assign to read-only property \"scriptTestProperty\""))) + << (QStringList() << "readBack" << "unchanged") + << (QVariantList() << 13 << 42) + << (QStringList() << "firstProperty" << "secondProperty") + << (QVariantList() << 30 << 30) + << (QStringList() << "readBack" << "unchanged") + << (QVariantList() << 30 << 42); + + QTest::newRow("qobject module API enum values in JS") + << TEST_FILE("moduleapi/qobjectModuleApiEnums.qml") + << QString() + << QStringList() + << (QStringList() << "enumValue" << "enumMethod") + << (QVariantList() << 42 << 30) + << QStringList() + << QVariantList() + << QStringList() + << QVariantList(); + + QTest::newRow("qobject, invalid major version fail") + << TEST_FILE("moduleapi/moduleApiMajorVersionFail.qml") + << QString("QDeclarativeComponent: Component is not ready") + << QStringList() + << QStringList() + << QVariantList() + << QStringList() + << QVariantList() + << QStringList() + << QVariantList(); + + QTest::newRow("qobject, invalid minor version fail") + << TEST_FILE("moduleapi/moduleApiMinorVersionFail.qml") + << QString("QDeclarativeComponent: Component is not ready") + << QStringList() + << QStringList() + << QVariantList() + << QStringList() + << QVariantList() + << QStringList() + << QVariantList(); +} + void tst_qdeclarativeecmascript::moduleApi() { - QDeclarativeComponent component(&engine, TEST_FILE("moduleApi.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - QCOMPARE(object->property("existingUriTest").toInt(), 20); + QFETCH(QUrl, testfile); + QFETCH(QString, errorMessage); + QFETCH(QStringList, warningMessages); + QFETCH(QStringList, readProperties); + QFETCH(QVariantList, readExpectedValues); + QFETCH(QStringList, writeProperties); + QFETCH(QVariantList, writeValues); + QFETCH(QStringList, readBackProperties); + QFETCH(QVariantList, readBackExpectedValues); - QEXPECT_FAIL("", "QTBUG-17318", Continue); - QCOMPARE(object->property("scriptTest").toInt(), 13); - QCOMPARE(object->property("qobjectTest").toInt(), 20); - QCOMPARE(object->property("qobjectMethodTest").toInt(), 1); // first call of method, so count = 1. - QCOMPARE(object->property("qobjectMinorVersionTest").toInt(), 20); - QCOMPARE(object->property("qobjectMajorVersionTest").toInt(), 20); - QCOMPARE(object->property("qobjectParentedTest").toInt(), 26); - delete object; + QDeclarativeComponent component(&engine, testfile); - // test that caching of module apis works correctly. - QDeclarativeComponent componentTwo(&engine, TEST_FILE("moduleApiCaching.qml")); - object = componentTwo.create(); - QVERIFY(object != 0); - QCOMPARE(object->property("existingUriTest").toInt(), 20); - QEXPECT_FAIL("", "QTBUG-17318", Continue); - QCOMPARE(object->property("scriptTest").toInt(), 13); // shouldn't have incremented. - QCOMPARE(object->property("qobjectParentedTest").toInt(), 26); // shouldn't have incremented. - delete object; + if (!errorMessage.isEmpty()) + QTest::ignoreMessage(QtWarningMsg, errorMessage.toAscii().constData()); - // test that writing to a property of module apis works correctly. - QDeclarativeComponent componentThree(&engine, TEST_FILE("moduleApiWriting.qml")); - QString expectedWarning = QLatin1String("file://") + TEST_FILE("moduleApiWriting.qml").toLocalFile() + QLatin1String(":15: Error: Cannot assign to read-only property \"qobjectTestProperty\""); - QTest::ignoreMessage(QtWarningMsg, expectedWarning.toAscii().constData()); - object = componentThree.create(); - QVERIFY(object != 0); - QCOMPARE(object->property("readOnlyProperty").toInt(), 20); - QCOMPARE(object->property("writableProperty").toInt(), 50); - QVERIFY(object->setProperty("firstProperty", QVariant(30))); // shouldn't affect value of readOnlyProperty - QVERIFY(object->setProperty("writableProperty", QVariant(30))); // SHOULD affect value of writableProperty - QCOMPARE(object->property("readOnlyProperty").toInt(), 20); - QCOMPARE(object->property("writableProperty").toInt(), 30); - delete object; + if (warningMessages.size()) + foreach (const QString &warning, warningMessages) + QTest::ignoreMessage(QtWarningMsg, warning.toAscii().constData()); - QDeclarativeComponent failOne(&engine, TEST_FILE("moduleApiMajorVersionFail.qml")); - QTest::ignoreMessage(QtWarningMsg, "QDeclarativeComponent: Component is not ready"); - object = failOne.create(); - QVERIFY(object == 0); // should have failed: invalid major version - - QDeclarativeComponent failTwo(&engine, TEST_FILE("moduleApiMinorVersionFail.qml")); - QTest::ignoreMessage(QtWarningMsg, "QDeclarativeComponent: Component is not ready"); - object = failTwo.create(); - QVERIFY(object == 0); // should have failed: invalid minor version + QObject *object = component.create(); + if (!errorMessage.isEmpty()) { + QVERIFY(object == 0); + } else { + QVERIFY(object != 0); + for (int i = 0; i < readProperties.size(); ++i) + QCOMPARE(object->property(readProperties.at(i).toAscii().constData()), readExpectedValues.at(i)); + for (int i = 0; i < writeProperties.size(); ++i) + QVERIFY(object->setProperty(writeProperties.at(i).toAscii().constData(), writeValues.at(i))); + for (int i = 0; i < readBackProperties.size(); ++i) + QCOMPARE(object->property(readBackProperties.at(i).toAscii().constData()), readBackExpectedValues.at(i)); + delete object; + } } void tst_qdeclarativeecmascript::importScripts() diff --git a/tests/auto/declarative/qdeclarativefontloader/data/daniel.ttf b/tests/auto/declarative/qdeclarativefontloader/data/daniel.ttf Binary files differnew file mode 100644 index 0000000000..aae50d5035 --- /dev/null +++ b/tests/auto/declarative/qdeclarativefontloader/data/daniel.ttf diff --git a/tests/auto/declarative/qdeclarativefontloader/data/dummy.ttf b/tests/auto/declarative/qdeclarativefontloader/data/dummy.ttf new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/auto/declarative/qdeclarativefontloader/data/dummy.ttf diff --git a/tests/auto/declarative/qdeclarativefontloader/data/tarzeau_ocr_a.ttf b/tests/auto/declarative/qdeclarativefontloader/data/tarzeau_ocr_a.ttf Binary files differnew file mode 100644 index 0000000000..cf93f9651f --- /dev/null +++ b/tests/auto/declarative/qdeclarativefontloader/data/tarzeau_ocr_a.ttf diff --git a/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro b/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro new file mode 100644 index 0000000000..946e5a8a16 --- /dev/null +++ b/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro @@ -0,0 +1,18 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative gui network +macx:CONFIG -= app_bundle + +HEADERS += ../../declarative/shared/testhttpserver.h +SOURCES += tst_qdeclarativefontloader.cpp ../../declarative/shared/testhttpserver.cpp + +symbian: { + importFiles.files = data + importFiles.path = . + DEPLOYMENT += importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} + +CONFIG += parallel_test + +QT += core-private gui-private declarative-private diff --git a/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp b/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp new file mode 100644 index 0000000000..29fe0329bb --- /dev/null +++ b/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp @@ -0,0 +1,230 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** 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, Nokia gives you certain additional +** rights. These rights are described in the Nokia 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. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include <qtest.h> +#include <QtTest/QSignalSpy> +#include <QtDeclarative/qdeclarativeengine.h> +#include <QtDeclarative/qdeclarativecomponent.h> +#include <QtDeclarative/qdeclarativecontext.h> +#include <QtDeclarative/private/qdeclarativefontloader_p.h> +#include "../../../shared/util.h" +#include "../../declarative/shared/testhttpserver.h" + +#define SERVER_PORT 14448 + +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +#define SRCDIR "." +#endif + +class tst_qdeclarativefontloader : public QObject +{ + Q_OBJECT +public: + tst_qdeclarativefontloader(); + +private slots: + void init(); + void noFont(); + void namedFont(); + void localFont(); + void failLocalFont(); + void webFont(); + void redirWebFont(); + void failWebFont(); + void changeFont(); + +private: + QDeclarativeEngine engine; + TestHTTPServer server; +}; + +tst_qdeclarativefontloader::tst_qdeclarativefontloader() : + server(SERVER_PORT) +{ + server.serveDirectory(SRCDIR "/data"); +} + +void tst_qdeclarativefontloader::init() +{ + QVERIFY(server.isValid()); +} + +void tst_qdeclarativefontloader::noFont() +{ + QString componentStr = "import QtQuick 2.0\nFontLoader { }"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeFontLoader *fontObject = qobject_cast<QDeclarativeFontLoader*>(component.create()); + + QVERIFY(fontObject != 0); + QCOMPARE(fontObject->name(), QString("")); + QCOMPARE(fontObject->source(), QUrl("")); + QTRY_VERIFY(fontObject->status() == QDeclarativeFontLoader::Null); + + delete fontObject; +} + +void tst_qdeclarativefontloader::namedFont() +{ + QString componentStr = "import QtQuick 2.0\nFontLoader { name: \"Helvetica\" }"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeFontLoader *fontObject = qobject_cast<QDeclarativeFontLoader*>(component.create()); + + QVERIFY(fontObject != 0); + QCOMPARE(fontObject->source(), QUrl("")); + QCOMPARE(fontObject->name(), QString("Helvetica")); + QTRY_VERIFY(fontObject->status() == QDeclarativeFontLoader::Ready); +} + +void tst_qdeclarativefontloader::localFont() +{ + QString componentStr = "import QtQuick 2.0\nFontLoader { source: \"" SRCDIR "/data/tarzeau_ocr_a.ttf\" }"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeFontLoader *fontObject = qobject_cast<QDeclarativeFontLoader*>(component.create()); + + QVERIFY(fontObject != 0); + QVERIFY(fontObject->source() != QUrl("")); + QTRY_COMPARE(fontObject->name(), QString("OCRA")); + QTRY_VERIFY(fontObject->status() == QDeclarativeFontLoader::Ready); +} + +void tst_qdeclarativefontloader::failLocalFont() +{ + QString componentStr = "import QtQuick 2.0\nFontLoader { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/dummy.ttf").toString() + "\" }"; + QTest::ignoreMessage(QtWarningMsg, QString("file::2:1: QML FontLoader: Cannot load font: \"" + QUrl::fromLocalFile(SRCDIR "/data/dummy.ttf").toString() + "\"").toUtf8().constData()); + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeFontLoader *fontObject = qobject_cast<QDeclarativeFontLoader*>(component.create()); + + QVERIFY(fontObject != 0); + QVERIFY(fontObject->source() != QUrl("")); + QTRY_COMPARE(fontObject->name(), QString("")); + QTRY_VERIFY(fontObject->status() == QDeclarativeFontLoader::Error); +} + +void tst_qdeclarativefontloader::webFont() +{ + QString componentStr = "import QtQuick 2.0\nFontLoader { source: \"http://localhost:14448/tarzeau_ocr_a.ttf\" }"; + QDeclarativeComponent component(&engine); + + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeFontLoader *fontObject = qobject_cast<QDeclarativeFontLoader*>(component.create()); + + QVERIFY(fontObject != 0); + QVERIFY(fontObject->source() != QUrl("")); + QTRY_COMPARE(fontObject->name(), QString("OCRA")); + QTRY_VERIFY(fontObject->status() == QDeclarativeFontLoader::Ready); +} + +void tst_qdeclarativefontloader::redirWebFont() +{ + server.addRedirect("olddir/oldname.ttf","../tarzeau_ocr_a.ttf"); + + QString componentStr = "import QtQuick 2.0\nFontLoader { source: \"http://localhost:14448/olddir/oldname.ttf\" }"; + QDeclarativeComponent component(&engine); + + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeFontLoader *fontObject = qobject_cast<QDeclarativeFontLoader*>(component.create()); + + QVERIFY(fontObject != 0); + QVERIFY(fontObject->source() != QUrl("")); + QTRY_COMPARE(fontObject->name(), QString("OCRA")); + QTRY_VERIFY(fontObject->status() == QDeclarativeFontLoader::Ready); +} + +void tst_qdeclarativefontloader::failWebFont() +{ + QString componentStr = "import QtQuick 2.0\nFontLoader { source: \"http://localhost:14448/nonexist.ttf\" }"; + QTest::ignoreMessage(QtWarningMsg, "file::2:1: QML FontLoader: Cannot load font: \"http://localhost:14448/nonexist.ttf\""); + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeFontLoader *fontObject = qobject_cast<QDeclarativeFontLoader*>(component.create()); + + QVERIFY(fontObject != 0); + QVERIFY(fontObject->source() != QUrl("")); + QTRY_COMPARE(fontObject->name(), QString("")); + QTRY_VERIFY(fontObject->status() == QDeclarativeFontLoader::Error); +} + +void tst_qdeclarativefontloader::changeFont() +{ + QString componentStr = "import QtQuick 2.0\nFontLoader { source: font }"; + QDeclarativeContext *ctxt = engine.rootContext(); + ctxt->setContextProperty("font", QUrl::fromLocalFile(SRCDIR "/data/tarzeau_ocr_a.ttf")); + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeFontLoader *fontObject = qobject_cast<QDeclarativeFontLoader*>(component.create()); + + QVERIFY(fontObject != 0); + + QSignalSpy nameSpy(fontObject, SIGNAL(nameChanged())); + QSignalSpy statusSpy(fontObject, SIGNAL(statusChanged())); + + QTRY_VERIFY(fontObject->status() == QDeclarativeFontLoader::Ready); + QCOMPARE(nameSpy.count(), 0); + QCOMPARE(statusSpy.count(), 0); + QTRY_COMPARE(fontObject->name(), QString("OCRA")); + + ctxt->setContextProperty("font", "http://localhost:14448/daniel.ttf"); + QTRY_VERIFY(fontObject->status() == QDeclarativeFontLoader::Loading); + QTRY_VERIFY(fontObject->status() == QDeclarativeFontLoader::Ready); + QCOMPARE(nameSpy.count(), 1); + QCOMPARE(statusSpy.count(), 2); + QTRY_COMPARE(fontObject->name(), QString("Daniel")); + + ctxt->setContextProperty("font", QUrl::fromLocalFile(SRCDIR "/data/tarzeau_ocr_a.ttf")); + QTRY_VERIFY(fontObject->status() == QDeclarativeFontLoader::Ready); + QCOMPARE(nameSpy.count(), 2); + QCOMPARE(statusSpy.count(), 2); + QTRY_COMPARE(fontObject->name(), QString("OCRA")); + + ctxt->setContextProperty("font", "http://localhost:14448/daniel.ttf"); + QTRY_VERIFY(fontObject->status() == QDeclarativeFontLoader::Ready); + QCOMPARE(nameSpy.count(), 3); + QCOMPARE(statusSpy.count(), 2); + QTRY_COMPARE(fontObject->name(), QString("Daniel")); +} + +QTEST_MAIN(tst_qdeclarativefontloader) + +#include "tst_qdeclarativefontloader.moc" diff --git a/tests/auto/declarative/qdeclarativeinstruction/qdeclarativeinstruction.pro b/tests/auto/declarative/qdeclarativeinstruction/qdeclarativeinstruction.pro index a4cdd81266..7cff542838 100644 --- a/tests/auto/declarative/qdeclarativeinstruction/qdeclarativeinstruction.pro +++ b/tests/auto/declarative/qdeclarativeinstruction/qdeclarativeinstruction.pro @@ -9,4 +9,4 @@ macx:CONFIG -= app_bundle CONFIG += parallel_test -QT += core-private gui-private declarative-private +QT += core-private gui-private v8-private declarative-private diff --git a/tests/auto/declarative/qdeclarativelanguage/data/empty.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/empty.errors.txt index d416e76ae2..620db2bbba 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/empty.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/empty.errors.txt @@ -1,2 +1,2 @@ -0:0:Expected token `numeric literal' -0:0:Expected a qualified name id +1:1:Expected token `numeric literal' +1:1:Expected a qualified name id diff --git a/tests/auto/declarative/qdeclarativelanguage/data/signal.2.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/signal.2.errors.txt index fce89285ec..0d4c33d750 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/signal.2.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/signal.2.errors.txt @@ -1 +1 @@ -4:21:Unexpected token `;' +4:21:Unexpected token `,' diff --git a/tests/auto/declarative/qdeclarativelanguage/qdeclarativelanguage.pro b/tests/auto/declarative/qdeclarativelanguage/qdeclarativelanguage.pro index 71d2066608..e6006aed00 100644 --- a/tests/auto/declarative/qdeclarativelanguage/qdeclarativelanguage.pro +++ b/tests/auto/declarative/qdeclarativelanguage/qdeclarativelanguage.pro @@ -20,4 +20,4 @@ symbian: { } CONFIG += parallel_test -QT += core-private gui-private declarative-private +QT += core-private gui-private v8-private declarative-private diff --git a/tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro b/tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro index 83ea7992ed..4575c581ae 100644 --- a/tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro +++ b/tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro @@ -14,4 +14,4 @@ symbian: { CONFIG += parallel_test -QT += core-private gui-private declarative-private opengl-private +QT += core-private gui-private v8-private declarative-private opengl-private diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp index 946a3a5692..0c3b75ac98 100644 --- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp +++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp @@ -219,6 +219,11 @@ void tst_qdeclarativelistmodel::static_i18n_data() << QVariant(QString("hello")) << QString(); + QTest::newRow("QT_TRID_NOOP") + << QString::fromUtf8("ListElement { foo: QT_TRID_NOOP(\"qtn_1st_text\") }") + << QVariant(QString("qtn_1st_text")) + << QString(); + QTest::newRow("QT_TR_NOOP extra param") << QString::fromUtf8("ListElement { foo: QT_TR_NOOP(\"hello\",\"world\") }") << QVariant(QString()) @@ -228,6 +233,11 @@ void tst_qdeclarativelistmodel::static_i18n_data() << "ListElement { foo: QT_TRANSLATE_NOOP() }" << QVariant(QString()) << QString("ListElement: improperly specified QT_TRANSLATE_NOOP"); + + QTest::newRow("QT_TRID_NOOP missing param") + << QString::fromUtf8("ListElement { foo: QT_TRID_NOOP() }") + << QVariant(QString()) + << QString("ListElement: improperly specified QT_TRID_NOOP"); } void tst_qdeclarativelistmodel::static_i18n() diff --git a/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro b/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro index fd55ed5160..99291c1f2d 100644 --- a/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro +++ b/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro @@ -14,4 +14,4 @@ symbian: { CONFIG += parallel_test -QT += core-private gui-private declarative-private +QT += core-private gui-private v8-private declarative-private diff --git a/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro b/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro index 304e168e00..69ebb8e668 100644 --- a/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro +++ b/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro @@ -16,4 +16,4 @@ symbian: { CONFIG += parallel_test -QT += core-private gui-private declarative-private +QT += core-private gui-private v8-private declarative-private diff --git a/tests/auto/declarative/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro b/tests/auto/declarative/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro index c8f8e9139b..27d2c0c1b2 100644 --- a/tests/auto/declarative/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro +++ b/tests/auto/declarative/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro @@ -14,4 +14,4 @@ symbian: { CONFIG += parallel_test -QT += core-private gui-private declarative-private +QT += core-private gui-private v8-private declarative-private diff --git a/tests/auto/declarative/qdeclarativespringanimation/qdeclarativespringanimation.pro b/tests/auto/declarative/qdeclarativespringanimation/qdeclarativespringanimation.pro index f2b5928915..63944117d6 100644 --- a/tests/auto/declarative/qdeclarativespringanimation/qdeclarativespringanimation.pro +++ b/tests/auto/declarative/qdeclarativespringanimation/qdeclarativespringanimation.pro @@ -14,4 +14,4 @@ symbian: { CONFIG += parallel_test -QT += core-private gui-private declarative-private +QT += core-private gui-private v8-private declarative-private diff --git a/tests/auto/declarative/qdeclarativesqldatabase/qdeclarativesqldatabase.pro b/tests/auto/declarative/qdeclarativesqldatabase/qdeclarativesqldatabase.pro index a51eaf34de..c22e8cc9e7 100644 --- a/tests/auto/declarative/qdeclarativesqldatabase/qdeclarativesqldatabase.pro +++ b/tests/auto/declarative/qdeclarativesqldatabase/qdeclarativesqldatabase.pro @@ -15,4 +15,4 @@ symbian: { CONFIG += parallel_test -QT += core-private gui-private declarative-private +QT += core-private gui-private v8-private declarative-private diff --git a/tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro b/tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro index 9823c21836..d21c12ad42 100644 --- a/tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro +++ b/tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro @@ -13,4 +13,4 @@ symbian: { } CONFIG += parallel_test -QT += core-private gui-private declarative-private opengl-private +QT += core-private gui-private v8-private declarative-private opengl-private diff --git a/tests/auto/declarative/qdeclarativev4/qdeclarativev4.pro b/tests/auto/declarative/qdeclarativev4/qdeclarativev4.pro index 9b66edff41..0701d95902 100644 --- a/tests/auto/declarative/qdeclarativev4/qdeclarativev4.pro +++ b/tests/auto/declarative/qdeclarativev4/qdeclarativev4.pro @@ -16,4 +16,4 @@ symbian: { CONFIG += parallel_test -QT += core-private gui-private declarative-private +QT += core-private gui-private v8-private declarative-private diff --git a/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro b/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro index f1c64398e9..79bac3998e 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro +++ b/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro @@ -17,4 +17,4 @@ symbian: { CONFIG += parallel_test -QT += core-private gui-private declarative-private +QT += core-private gui-private v8-private declarative-private diff --git a/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro b/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro index d7dfe96c65..aae48ca14e 100644 --- a/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro +++ b/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro @@ -14,4 +14,4 @@ symbian: { CONFIG += parallel_test -QT += core-private gui-private declarative-private +QT += core-private gui-private v8-private declarative-private diff --git a/tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro b/tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro index 139d4b4e0b..6733d3595e 100644 --- a/tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro +++ b/tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro @@ -18,4 +18,4 @@ symbian: { CONFIG += parallel_test -QT += core-private gui-private declarative-private +QT += core-private gui-private v8-private declarative-private diff --git a/tests/auto/declarative/qjsengine/tst_qjsengine.cpp b/tests/auto/declarative/qjsengine/tst_qjsengine.cpp index d2f4b3b6ac..a6b4251c36 100644 --- a/tests/auto/declarative/qjsengine/tst_qjsengine.cpp +++ b/tests/auto/declarative/qjsengine/tst_qjsengine.cpp @@ -325,6 +325,7 @@ private slots: void dateRoundtripQtJSQt(); void dateConversionJSQt(); void dateConversionQtJS(); + void functionPrototypeExtensions(); }; tst_QJSEngine::tst_QJSEngine() @@ -6478,6 +6479,24 @@ void tst_QJSEngine::scriptValueFromQMetaObject() } #endif +void tst_QJSEngine::functionPrototypeExtensions() +{ + // QJS adds connect and disconnect properties to Function.prototype. + QJSEngine eng; + QJSValue funProto = eng.globalObject().property("Function").property("prototype"); + QVERIFY(funProto.isFunction()); + QVERIFY(funProto.property("connect").isFunction()); + QCOMPARE(funProto.propertyFlags("connect"), QJSValue::SkipInEnumeration); + QVERIFY(funProto.property("disconnect").isFunction()); + QCOMPARE(funProto.propertyFlags("disconnect"), QJSValue::SkipInEnumeration); + + // No properties should appear in for-in statements. + QJSValue props = eng.evaluate("props = []; for (var p in Function.prototype) props.push(p); props"); + QVERIFY(!eng.hasUncaughtException()); + QVERIFY(props.isArray()); + QCOMPARE(props.property("length").toInt32(), 0); +} + QTEST_MAIN(tst_QJSEngine) #include "tst_qjsengine.moc" diff --git a/tests/auto/declarative/qpacketprotocol/qpacketprotocol.pro b/tests/auto/declarative/qpacketprotocol/qpacketprotocol.pro index b32235aec0..1c2130d5cf 100644 --- a/tests/auto/declarative/qpacketprotocol/qpacketprotocol.pro +++ b/tests/auto/declarative/qpacketprotocol/qpacketprotocol.pro @@ -7,4 +7,4 @@ SOURCES += tst_qpacketprotocol.cpp \ ../shared/debugutil.cpp CONFIG += parallel_test -QT += core-private gui-private declarative-private +QT += core-private gui-private v8-private declarative-private diff --git a/tests/auto/declarative/qsgflickable/qsgflickable.pro b/tests/auto/declarative/qsgflickable/qsgflickable.pro index d5e5767e90..8aa66bacb8 100644 --- a/tests/auto/declarative/qsgflickable/qsgflickable.pro +++ b/tests/auto/declarative/qsgflickable/qsgflickable.pro @@ -14,4 +14,4 @@ symbian: { CONFIG += parallel_test -QT += core-private gui-private declarative-private +QT += core-private gui-private v8-private declarative-private diff --git a/tests/auto/declarative/qsgflipable/qsgflipable.pro b/tests/auto/declarative/qsgflipable/qsgflipable.pro index c3998c1f9c..e28de1b610 100644 --- a/tests/auto/declarative/qsgflipable/qsgflipable.pro +++ b/tests/auto/declarative/qsgflipable/qsgflipable.pro @@ -14,4 +14,4 @@ symbian: { CONFIG += parallel_test -QT += core-private gui-private declarative-private +QT += core-private gui-private v8-private declarative-private diff --git a/tests/auto/declarative/qsggridview/qsggridview.pro b/tests/auto/declarative/qsggridview/qsggridview.pro index a8b3484f0d..00c7d96529 100644 --- a/tests/auto/declarative/qsggridview/qsggridview.pro +++ b/tests/auto/declarative/qsggridview/qsggridview.pro @@ -14,5 +14,5 @@ symbian: { CONFIG += parallel_test -QT += core-private gui-private declarative-private +QT += core-private gui-private v8-private declarative-private QT += opengl-private diff --git a/tests/auto/declarative/qsgitem/tst_qsgitem.cpp b/tests/auto/declarative/qsgitem/tst_qsgitem.cpp index 7a612c433b..05e59a69f0 100644 --- a/tests/auto/declarative/qsgitem/tst_qsgitem.cpp +++ b/tests/auto/declarative/qsgitem/tst_qsgitem.cpp @@ -127,6 +127,9 @@ private slots: void wheelEvent_data(); void wheelEvent(); + void hoverEvent_data(); + void hoverEvent(); + void hoverEventInParent(); private: void ensureFocus(QWidget *w) { @@ -894,6 +897,151 @@ void tst_qsgitem::wheelEvent() delete canvas; } +class HoverItem : public QSGItem +{ +Q_OBJECT +public: + HoverItem(QSGItem *parent = 0) + : QSGItem(parent), hoverEnterCount(0), hoverMoveCount(0), hoverLeaveCount(0) + { } + void resetCounters() { + hoverEnterCount = 0; + hoverMoveCount = 0; + hoverLeaveCount = 0; + } + int hoverEnterCount; + int hoverMoveCount; + int hoverLeaveCount; +protected: + virtual void hoverEnterEvent(QHoverEvent *event) { + event->accept(); + ++hoverEnterCount; + } + virtual void hoverMoveEvent(QHoverEvent *event) { + event->accept(); + ++hoverMoveCount; + } + virtual void hoverLeaveEvent(QHoverEvent *event) { + event->accept(); + ++hoverLeaveCount; + } +}; + +void tst_qsgitem::hoverEvent_data() +{ + QTest::addColumn<bool>("visible"); + QTest::addColumn<bool>("enabled"); + QTest::addColumn<bool>("acceptHoverEvents"); + + QTest::newRow("visible, enabled, accept hover") << true << true << true; + QTest::newRow("visible, disabled, accept hover") << true << false << true; + QTest::newRow("invisible, enabled, accept hover") << false << true << true; + QTest::newRow("invisible, disabled, accept hover") << false << false << true; + + QTest::newRow("visible, enabled, not accept hover") << true << true << false; + QTest::newRow("visible, disabled, not accept hover") << true << false << false; + QTest::newRow("invisible, enabled, not accept hover") << false << true << false; + QTest::newRow("invisible, disabled, not accept hover") << false << false << false; +} + +// ### For some unknown reason QTest::mouseMove() isn't working correctly. +static void sendMouseMove(QObject *object, const QPoint &position) +{ + QMouseEvent moveEvent(QEvent::MouseMove, position, Qt::NoButton, Qt::NoButton, 0); + QApplication::sendEvent(object, &moveEvent); +} + +void tst_qsgitem::hoverEvent() +{ + QFETCH(bool, visible); + QFETCH(bool, enabled); + QFETCH(bool, acceptHoverEvents); + + QSGCanvas *canvas = new QSGCanvas(); + canvas->resize(200, 200); + canvas->show(); + + HoverItem *item = new HoverItem; + item->setSize(QSizeF(100, 100)); + item->setParentItem(canvas->rootItem()); + + item->setEnabled(enabled); + item->setVisible(visible); + item->setAcceptHoverEvents(acceptHoverEvents); + + const QPoint outside(150, 150); + const QPoint inside(50, 50); + const QPoint anotherInside(51, 51); + + sendMouseMove(canvas, outside); + item->resetCounters(); + + // Enter, then move twice inside, then leave. + sendMouseMove(canvas, inside); + sendMouseMove(canvas, anotherInside); + sendMouseMove(canvas, inside); + sendMouseMove(canvas, outside); + + const bool shouldReceiveHoverEvents = visible && enabled && acceptHoverEvents; + if (shouldReceiveHoverEvents) { + QCOMPARE(item->hoverEnterCount, 1); + QCOMPARE(item->hoverMoveCount, 2); + QCOMPARE(item->hoverLeaveCount, 1); + } else { + QCOMPARE(item->hoverEnterCount, 0); + QCOMPARE(item->hoverMoveCount, 0); + QCOMPARE(item->hoverLeaveCount, 0); + } + + delete canvas; +} + +void tst_qsgitem::hoverEventInParent() +{ + QSGCanvas *canvas = new QSGCanvas(); + canvas->resize(200, 200); + canvas->show(); + + HoverItem *parentItem = new HoverItem(canvas->rootItem()); + parentItem->setSize(QSizeF(200, 200)); + parentItem->setAcceptHoverEvents(true); + + HoverItem *leftItem = new HoverItem(parentItem); + leftItem->setSize(QSizeF(100, 200)); + leftItem->setAcceptHoverEvents(true); + + HoverItem *rightItem = new HoverItem(parentItem); + rightItem->setSize(QSizeF(100, 200)); + rightItem->setPos(QPointF(100, 0)); + rightItem->setAcceptHoverEvents(true); + + const QPoint insideLeft(50, 100); + const QPoint insideRight(150, 100); + + sendMouseMove(canvas, insideLeft); + parentItem->resetCounters(); + leftItem->resetCounters(); + rightItem->resetCounters(); + + sendMouseMove(canvas, insideRight); + QCOMPARE(parentItem->hoverEnterCount, 0); + QCOMPARE(parentItem->hoverLeaveCount, 0); + QCOMPARE(leftItem->hoverEnterCount, 0); + QCOMPARE(leftItem->hoverLeaveCount, 1); + QCOMPARE(rightItem->hoverEnterCount, 1); + QCOMPARE(rightItem->hoverLeaveCount, 0); + + sendMouseMove(canvas, insideLeft); + QCOMPARE(parentItem->hoverEnterCount, 0); + QCOMPARE(parentItem->hoverLeaveCount, 0); + QCOMPARE(leftItem->hoverEnterCount, 1); + QCOMPARE(leftItem->hoverLeaveCount, 1); + QCOMPARE(rightItem->hoverEnterCount, 1); + QCOMPARE(rightItem->hoverLeaveCount, 1); + + delete canvas; +} + QTEST_MAIN(tst_qsgitem) #include "tst_qsgitem.moc" diff --git a/tests/auto/declarative/qsglistview/qsglistview.pro b/tests/auto/declarative/qsglistview/qsglistview.pro index 3e18e9b467..4c781887ce 100644 --- a/tests/auto/declarative/qsglistview/qsglistview.pro +++ b/tests/auto/declarative/qsglistview/qsglistview.pro @@ -14,5 +14,5 @@ symbian: { } CONFIG += parallel_test -QT += core-private gui-private declarative-private widgets widgets-private +QT += core-private gui-private declarative-private widgets widgets-private v8-private QT += opengl-private diff --git a/tests/auto/declarative/qsglistview/tst_qsglistview.cpp b/tests/auto/declarative/qsglistview/tst_qsglistview.cpp index 94d6cf3d45..1eecd58278 100644 --- a/tests/auto/declarative/qsglistview/tst_qsglistview.cpp +++ b/tests/auto/declarative/qsglistview/tst_qsglistview.cpp @@ -1124,6 +1124,7 @@ void tst_QSGListView::enforceRange_withoutHighlight() QSGView *canvas = createView(); canvas->show(); + QTest::qWaitForWindowShown(canvas); TestModel model; model.addItem("Item 0", "a"); diff --git a/tests/auto/declarative/qsgpathview/qsgpathview.pro b/tests/auto/declarative/qsgpathview/qsgpathview.pro index eb188666bb..ae0b1ed630 100644 --- a/tests/auto/declarative/qsgpathview/qsgpathview.pro +++ b/tests/auto/declarative/qsgpathview/qsgpathview.pro @@ -14,4 +14,4 @@ symbian: { CONFIG += parallel_test -QT += core-private gui-private declarative-private +QT += core-private gui-private v8-private declarative-private diff --git a/tests/auto/declarative/qsgpositioners/qsgpositioners.pro b/tests/auto/declarative/qsgpositioners/qsgpositioners.pro index bf8110ffd4..ae470fa2fc 100644 --- a/tests/auto/declarative/qsgpositioners/qsgpositioners.pro +++ b/tests/auto/declarative/qsgpositioners/qsgpositioners.pro @@ -13,5 +13,5 @@ symbian: { CONFIG += parallel_test -QT += core-private gui-private declarative-private +QT += core-private gui-private v8-private declarative-private QT += opengl-private diff --git a/tests/auto/declarative/qsgpositioners/tst_qsgpositioners.cpp b/tests/auto/declarative/qsgpositioners/tst_qsgpositioners.cpp index 137e6acd77..0a1c4dff77 100644 --- a/tests/auto/declarative/qsgpositioners/tst_qsgpositioners.cpp +++ b/tests/auto/declarative/qsgpositioners/tst_qsgpositioners.cpp @@ -160,7 +160,7 @@ void tst_qsgpositioners::test_horizontal_rtl() // Change the width of the row and check that items stay to the right row->setWidth(200); - QCOMPARE(one->x(), 150.0); + QTRY_COMPARE(one->x(), 150.0); QCOMPARE(one->y(), 0.0); QCOMPARE(two->x(), 130.0); QCOMPARE(two->y(), 0.0); @@ -580,7 +580,7 @@ void tst_qsgpositioners::test_grid_rightToLeft() // Change the width of the grid and check that items stay to the right grid->setWidth(200); - QCOMPARE(one->x(), 150.0); + QTRY_COMPARE(one->x(), 150.0); QCOMPARE(one->y(), 0.0); QCOMPARE(two->x(), 130.0); QCOMPARE(two->y(), 0.0); @@ -1086,16 +1086,16 @@ void tst_qsgpositioners::test_flow_resize() QSGRectangle *five = canvas->rootObject()->findChild<QSGRectangle*>("five"); QVERIFY(five != 0); - QCOMPARE(one->x(), 0.0); - QCOMPARE(one->y(), 0.0); - QCOMPARE(two->x(), 50.0); - QCOMPARE(two->y(), 0.0); - QCOMPARE(three->x(), 70.0); - QCOMPARE(three->y(), 0.0); - QCOMPARE(four->x(), 0.0); - QCOMPARE(four->y(), 50.0); - QCOMPARE(five->x(), 50.0); - QCOMPARE(five->y(), 50.0); + QTRY_COMPARE(one->x(), 0.0); + QTRY_COMPARE(one->y(), 0.0); + QTRY_COMPARE(two->x(), 50.0); + QTRY_COMPARE(two->y(), 0.0); + QTRY_COMPARE(three->x(), 70.0); + QTRY_COMPARE(three->y(), 0.0); + QTRY_COMPARE(four->x(), 0.0); + QTRY_COMPARE(four->y(), 50.0); + QTRY_COMPARE(five->x(), 50.0); + QTRY_COMPARE(five->y(), 50.0); delete canvas; } @@ -1110,7 +1110,7 @@ void tst_qsgpositioners::test_flow_resize_rightToLeft() root->setProperty("testRightToLeft", true); QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one"); - QVERIFY(one != 0); + QTRY_VERIFY(one != 0); QSGRectangle *two = canvas->rootObject()->findChild<QSGRectangle*>("two"); QVERIFY(two != 0); QSGRectangle *three = canvas->rootObject()->findChild<QSGRectangle*>("three"); @@ -1294,7 +1294,7 @@ void tst_qsgpositioners::test_mirroring() break; QSGItem *itemA = rootA->findChild<QSGItem*>(objectName); QSGItem *itemB = rootB->findChild<QSGItem*>(objectName); - QVERIFY(itemA->x() != itemB->x()); + QTRY_VERIFY(itemA->x() != itemB->x()); } QSGItemPrivate* rootPrivateB = QSGItemPrivate::get(rootB); @@ -1311,7 +1311,7 @@ void tst_qsgpositioners::test_mirroring() break; QSGItem *itemA = rootA->findChild<QSGItem*>(objectName); QSGItem *itemB = rootB->findChild<QSGItem*>(objectName); - QCOMPARE(itemA->x(), itemB->x()); + QTRY_COMPARE(itemA->x(), itemB->x()); } rootA->setProperty("testRightToLeft", false); // layoutDirection: Qt.LeftToRight @@ -1324,7 +1324,7 @@ void tst_qsgpositioners::test_mirroring() break; QSGItem *itemA = rootA->findChild<QSGItem*>(objectName); QSGItem *itemB = rootB->findChild<QSGItem*>(objectName); - QCOMPARE(itemA->x(), itemB->x()); + QTRY_COMPARE(itemA->x(), itemB->x()); } delete canvasA; delete canvasB; @@ -1428,12 +1428,9 @@ void tst_qsgpositioners::test_attachedproperties_dynamic() row->metaObject()->invokeMethod(row, "createSubRect"); - posIndex = rect1->property("index").toInt(); - QVERIFY(posIndex == 1); - isFirst = rect1->property("firstItem").toBool(); - QVERIFY(isFirst == false); - isLast = rect1->property("lastItem").toBool(); - QVERIFY(isLast == false); + QTRY_VERIFY(rect1->property("index").toInt() == 1); + QTRY_VERIFY(rect1->property("firstItem").toBool() == false); + QTRY_VERIFY(rect1->property("lastItem").toBool() == false); QSGRectangle *rect2 = canvas->rootObject()->findChild<QSGRectangle *>("rect2"); QVERIFY(rect2 != 0); @@ -1449,12 +1446,9 @@ void tst_qsgpositioners::test_attachedproperties_dynamic() qApp->processEvents(QEventLoop::DeferredDeletion); - posIndex = rect1->property("index").toInt(); - QVERIFY(posIndex == 1); - isFirst = rect1->property("firstItem").toBool(); - QVERIFY(isFirst == false); - isLast = rect1->property("lastItem").toBool(); - QVERIFY(isLast == true); + QTRY_VERIFY(rect1->property("index").toInt() == 1); + QTRY_VERIFY(rect1->property("firstItem").toBool() == false); + QTRY_VERIFY(rect1->property("lastItem").toBool() == true); delete canvas; } @@ -1464,6 +1458,8 @@ QSGView *tst_qsgpositioners::createView(const QString &filename) QSGView *canvas = new QSGView(0); canvas->setSource(QUrl::fromLocalFile(filename)); + canvas->show(); + QTest::qWaitForWindowShown(canvas); //It may not relayout until the next frame, so it needs to be drawn return canvas; } diff --git a/tests/auto/declarative/qsgtext/qsgtext.pro b/tests/auto/declarative/qsgtext/qsgtext.pro index 5254d1ebeb..4aa90f459c 100644 --- a/tests/auto/declarative/qsgtext/qsgtext.pro +++ b/tests/auto/declarative/qsgtext/qsgtext.pro @@ -19,5 +19,5 @@ symbian: { CONFIG += parallel_test -QT += core-private gui-private declarative-private +QT += core-private gui-private v8-private declarative-private QT += opengl-private diff --git a/tests/auto/declarative/qsgtextedit/qsgtextedit.pro b/tests/auto/declarative/qsgtextedit/qsgtextedit.pro index 491bb2d3f3..4e233f3a10 100644 --- a/tests/auto/declarative/qsgtextedit/qsgtextedit.pro +++ b/tests/auto/declarative/qsgtextedit/qsgtextedit.pro @@ -12,7 +12,7 @@ symbian: { } else { DEFINES += SRCDIR=\\\"$$PWD\\\" } -QT += core-private gui-private declarative-private +QT += core-private gui-private v8-private declarative-private QT += opengl-private qpa:CONFIG+=insignificant_test # QTBUG-21010, fails unstably diff --git a/tests/auto/declarative/qsgtextinput/qsgtextinput.pro b/tests/auto/declarative/qsgtextinput/qsgtextinput.pro index 56a811fa6d..fceef18487 100644 --- a/tests/auto/declarative/qsgtextinput/qsgtextinput.pro +++ b/tests/auto/declarative/qsgtextinput/qsgtextinput.pro @@ -12,5 +12,5 @@ symbian: { DEFINES += SRCDIR=\\\"$$PWD\\\" } -QT += core-private gui-private declarative-private +QT += core-private gui-private v8-private declarative-private QT += opengl-private diff --git a/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp b/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp index 3cc0dc196b..32e59c2a6d 100644 --- a/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp +++ b/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp @@ -2197,7 +2197,7 @@ public: virtual QSGNode *updatePaintNode(QSGNode *node, UpdatePaintNodeData *data) { nbPaint++; - return QSGTextInput::updatePaintNode(node, data); +// return QSGTextInput::updatePaintNode(node, data); } int nbPaint; }; diff --git a/tests/auto/declarative/qsgvisualdatamodel/qsgvisualdatamodel.pro b/tests/auto/declarative/qsgvisualdatamodel/qsgvisualdatamodel.pro index 8f433c1208..7770f8ff0f 100644 --- a/tests/auto/declarative/qsgvisualdatamodel/qsgvisualdatamodel.pro +++ b/tests/auto/declarative/qsgvisualdatamodel/qsgvisualdatamodel.pro @@ -14,4 +14,4 @@ symbian: { CONFIG += parallel_test -QT += core-private gui-private declarative-private +QT += core-private gui-private v8-private declarative-private diff --git a/tests/auto/declarative/qsgvisualdatamodel/tst_qsgvisualdatamodel.cpp b/tests/auto/declarative/qsgvisualdatamodel/tst_qsgvisualdatamodel.cpp index 7470153933..40fddef21b 100644 --- a/tests/auto/declarative/qsgvisualdatamodel/tst_qsgvisualdatamodel.cpp +++ b/tests/auto/declarative/qsgvisualdatamodel/tst_qsgvisualdatamodel.cpp @@ -38,6 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +#include "../../../shared/util.h" #include <qtest.h> #include <QtTest/QSignalSpy> #include <QStandardItemModel> @@ -88,6 +89,13 @@ public: list << "one" << "two" << "three" << "four"; } + void emitMove(int sourceFirst, int sourceLast, int destinationChild) { + emit beginMoveRows(QModelIndex(), sourceFirst, sourceLast, QModelIndex(), destinationChild); + emit endMoveRows(); + } + + QStringList list; + public slots: void set(int idx, QString string) { list[idx] = string; @@ -103,9 +111,6 @@ protected: return list.at(index.row()); return QVariant(); } - -private: - QStringList list; }; @@ -125,6 +130,8 @@ private slots: void singleRole(); void modelProperties(); void noDelegate(); + void qaimRowsMoved(); + void qaimRowsMoved_data(); private: QDeclarativeEngine engine; @@ -538,6 +545,72 @@ void tst_qsgvisualdatamodel::noDelegate() } +void tst_qsgvisualdatamodel::qaimRowsMoved() +{ + // Test parameters passed in QAIM::rowsMoved() signal are converted correctly + // when translated and emitted as the QListModelInterface::itemsMoved() signal + QFETCH(int, sourceFirst); + QFETCH(int, sourceLast); + QFETCH(int, destinationChild); + QFETCH(int, expectFrom); + QFETCH(int, expectTo); + QFETCH(int, expectCount); + + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/visualdatamodel.qml")); + + SingleRoleModel model; + model.list.clear(); + for (int i=0; i<30; i++) + model.list << ("item " + i); + engine.rootContext()->setContextProperty("myModel", &model); + + QSGVisualDataModel *obj = qobject_cast<QSGVisualDataModel*>(c.create()); + QVERIFY(obj != 0); + + QSignalSpy spy(obj, SIGNAL(itemsMoved(int,int,int))); + model.emitMove(sourceFirst, sourceLast, destinationChild); + QTRY_COMPARE(spy.count(), 1); + + QCOMPARE(spy[0].count(), 3); + QCOMPARE(spy[0][0].toInt(), expectFrom); + QCOMPARE(spy[0][1].toInt(), expectTo); + QCOMPARE(spy[0][2].toInt(), expectCount); + + delete obj; +} + +void tst_qsgvisualdatamodel::qaimRowsMoved_data() +{ + QTest::addColumn<int>("sourceFirst"); + QTest::addColumn<int>("sourceLast"); + QTest::addColumn<int>("destinationChild"); + QTest::addColumn<int>("expectFrom"); + QTest::addColumn<int>("expectTo"); + QTest::addColumn<int>("expectCount"); + + QTest::newRow("move 1 forward") + << 1 << 1 << 6 + << 1 << 5 << 1; + + QTest::newRow("move 1 backwards") + << 4 << 4 << 1 + << 4 << 1 << 1; + + QTest::newRow("move multiple forwards") + << 0 << 2 << 13 + << 0 << 10 << 3; + + QTest::newRow("move multiple forwards, with same to") + << 0 << 1 << 3 + << 0 << 1 << 2; + + QTest::newRow("move multiple backwards") + << 10 << 14 << 1 + << 10 << 1 << 5; +} + + template<typename T> T *tst_qsgvisualdatamodel::findItem(QSGItem *parent, const QString &objectName, int index) { diff --git a/tests/auto/declarative/v8/Makefile.nonqt b/tests/auto/declarative/v8/Makefile.nonqt deleted file mode 100644 index 7ab695ba6a..0000000000 --- a/tests/auto/declarative/v8/Makefile.nonqt +++ /dev/null @@ -1,11 +0,0 @@ -release-m32: - g++ -o v8test_release_m32 -m32 -O2 v8main.cpp v8test.cpp -lpthread -L../../../../src/3rdparty/v8/ -lv8 - -debug-m32: - g++ -o v8test_debug_m32 -m32 -g v8main.cpp v8test.cpp -lpthread -L../../../../src/3rdparty/v8/ -lv8_g - -release: - g++ -o v8test_release -O2 v8main.cpp v8test.cpp -lpthread -L../../../../src/3rdparty/v8/ -lv8 - -debug: - g++ -o v8test_debug -g v8main.cpp v8test.cpp -lpthread -L../../../../src/3rdparty/v8/ -lv8_g diff --git a/tests/auto/declarative/v8/README.txt b/tests/auto/declarative/v8/README.txt deleted file mode 100644 index a5df6201be..0000000000 --- a/tests/auto/declarative/v8/README.txt +++ /dev/null @@ -1,13 +0,0 @@ -The v8 tests are actually implemented in v8test.[h|cpp]. There are also QtTest -(tst_v8.cpp) and non-Qt (v8main.cpp) stubs provided to run these tests. This -is done to allow the tests to be run both in the Qt CI system, and manually -without a build of Qt. The latter is necessary to run them against more exotic -build of V8, like the ARM simulator. - -To build the non-Qt version of the tests, first build a debug or release V8 -library under src/3rdparty/v8 using scons, and then use the Makefile.nonqt -makefile selecting one of the following targets: - release: Build the tests with -O2 and link against libv8 - debug: Build the tests with -g and link against libv8_g - release-m32: Build the tests with -O2 -m32 and link against libv8 - debug-m32: Build the tests with -g -m32 and link against libv8_g diff --git a/tests/auto/declarative/v8/tst_v8.cpp b/tests/auto/declarative/v8/tst_v8.cpp deleted file mode 100644 index 32d100e968..0000000000 --- a/tests/auto/declarative/v8/tst_v8.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include <qtest.h> -#include "v8test.h" - -using namespace v8; - -class tst_v8 : public QObject -{ - Q_OBJECT -public: - tst_v8() {} - -private slots: - void initTestCase() {} - void cleanupTestCase() {} - - void eval(); - void userobjectcompare(); -}; - -void tst_v8::eval() -{ - QVERIFY(v8test_eval()); -} - -void tst_v8::userobjectcompare() -{ - QVERIFY(v8test_userobjectcompare()); -} - -int main(int argc, char *argv[]) -{ - V8::SetFlagsFromCommandLine(&argc, argv, true); - - QCoreApplication app(argc, argv); - tst_v8 tc; - return QTest::qExec(&tc, argc, argv); -} - -#include "tst_v8.moc" diff --git a/tests/auto/declarative/v8/v8.pro b/tests/auto/declarative/v8/v8.pro deleted file mode 100644 index bd6dfa9d5c..0000000000 --- a/tests/auto/declarative/v8/v8.pro +++ /dev/null @@ -1,10 +0,0 @@ -load(qttest_p4) -macx:CONFIG -= app_bundle - -SOURCES += tst_v8.cpp v8test.cpp -HEADERS += v8test.h - -CONFIG += parallel_test - -QT += declarative -DEFINES += USING_V8_SHARED diff --git a/tests/auto/declarative/v8/v8main.cpp b/tests/auto/declarative/v8/v8main.cpp deleted file mode 100644 index 5930f53f90..0000000000 --- a/tests/auto/declarative/v8/v8main.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include "v8test.h" -#include <stdio.h> - -#define RUN_TEST(testname) { \ - if (!v8test_ ## testname()) \ - printf ("Test %s FAILED\n", # testname); \ -} - -int main(int argc, char *argv[]) -{ - v8::V8::SetFlagsFromCommandLine(&argc, argv, true); - - RUN_TEST(eval); - RUN_TEST(userobjectcompare); - - return -1; -} diff --git a/tests/auto/declarative/v8/v8test.cpp b/tests/auto/declarative/v8/v8test.cpp deleted file mode 100644 index 27d39c5970..0000000000 --- a/tests/auto/declarative/v8/v8test.cpp +++ /dev/null @@ -1,254 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "v8test.h" - -using namespace v8; - -#define BEGINTEST() bool _testPassed = true; -#define ENDTEST() return _testPassed; - -#define VERIFY(expr) { \ - if (!(expr)) { \ - fprintf(stderr, "FAIL: %s:%d %s\n", __FILE__, __LINE__, # expr); \ - _testPassed = false; \ - goto cleanup; \ - } \ -} - - -bool v8test_eval() -{ - BEGINTEST(); - - HandleScope handle_scope; - Persistent<Context> context = Context::New(); - Context::Scope context_scope(context); - - Local<Object> qmlglobal = Object::New(); - qmlglobal->Set(String::New("a"), Integer::New(1922)); - - Local<Script> script = Script::Compile(String::New("eval(\"a\")"), NULL, NULL, - Handle<String>(), Script::QmlMode); - - TryCatch tc; - Local<Value> result = script->Run(qmlglobal); - - VERIFY(!tc.HasCaught()); - VERIFY(result->Int32Value() == 1922); - -cleanup: - context.Dispose(); - - ENDTEST(); -} - -static int userObjectComparisonCalled = 0; -static bool userObjectComparisonReturn = false; -static Local<Object> expectedLhs; -static Local<Object> expectedRhs; -static bool expectedObjectsCompared = false; - -#define SET_EXPECTED(lhs, rhs) { \ - expectedObjectsCompared = false; \ - expectedLhs = lhs; \ - expectedRhs = rhs; \ -} - -static bool UserObjectComparison(Local<Object> lhs, Local<Object> rhs) -{ - userObjectComparisonCalled++; - - expectedObjectsCompared = (lhs == expectedLhs && rhs == expectedRhs); - - return userObjectComparisonReturn; -} - -inline bool runscript(const char *source) { - Local<Script> script = Script::Compile(String::New(source)); - Local<Value> result = script->Run(); - return result->BooleanValue(); -} - -bool v8test_userobjectcompare() -{ - BEGINTEST(); - - HandleScope handle_scope; - Persistent<Context> context = Context::New(); - Context::Scope context_scope(context); - - V8::SetUserObjectComparisonCallbackFunction(UserObjectComparison); - - Local<ObjectTemplate> ot = ObjectTemplate::New(); - ot->MarkAsUseUserObjectComparison(); - - Local<Object> uoc1 = ot->NewInstance(); - Local<Object> uoc2 = ot->NewInstance(); - context->Global()->Set(String::New("uoc1a"), uoc1); - context->Global()->Set(String::New("uoc1b"), uoc1); - context->Global()->Set(String::New("uoc2"), uoc2); - Local<Object> obj1 = Object::New(); - context->Global()->Set(String::New("obj1a"), obj1); - context->Global()->Set(String::New("obj1b"), obj1); - context->Global()->Set(String::New("obj2"), Object::New()); - Local<String> string1 = String::New("Hello World"); - context->Global()->Set(String::New("string1a"), string1); - context->Global()->Set(String::New("string1b"), string1); - context->Global()->Set(String::New("string2"), v8::String::New("Goodbye World")); - - // XXX Opportunity for optimization - don't invoke user callback if objects are - // equal. -#if 0 - userObjectComparisonCalled = 0; userObjectComparisonReturn = false; - VERIFY(true == runscript("uoc1a == uoc1b")); - VERIFY(userObjectComparisonCalled == 0); -#endif - - // Comparing two uoc objects invokes uoc - userObjectComparisonCalled = 0; - userObjectComparisonReturn = false; - VERIFY(false == runscript("uoc1a == uoc2")); - VERIFY(userObjectComparisonCalled == 1); - - VERIFY(false == runscript("uoc2 == uoc1a")); - VERIFY(userObjectComparisonCalled == 2); - userObjectComparisonReturn = true; - VERIFY(true == runscript("uoc1a == uoc2")); - VERIFY(userObjectComparisonCalled == 3); - VERIFY(true == runscript("uoc2 == uoc1a")); - VERIFY(userObjectComparisonCalled == 4); - - // != on two uoc object invokes uoc - userObjectComparisonCalled = 0; - userObjectComparisonReturn = false; - VERIFY(true == runscript("uoc1a != uoc2")); - VERIFY(userObjectComparisonCalled == 1); - VERIFY(true == runscript("uoc2 != uoc1a")); - VERIFY(userObjectComparisonCalled == 2); - userObjectComparisonReturn = true; - VERIFY(false == runscript("uoc1a != uoc2")); - VERIFY(userObjectComparisonCalled == 3); - VERIFY(false == runscript("uoc2 != uoc1a")); - VERIFY(userObjectComparisonCalled == 4); - - // Comparison against a non-object doesn't invoke uoc - userObjectComparisonCalled = 0; - userObjectComparisonReturn = false; - VERIFY(false == runscript("uoc1a == string1a")); - VERIFY(userObjectComparisonCalled == 0); - VERIFY(false == runscript("string1a == uoc1a")); - VERIFY(userObjectComparisonCalled == 0); - VERIFY(false == runscript("2 == uoc1a")); - VERIFY(userObjectComparisonCalled == 0); - VERIFY(true == runscript("uoc1a != string1a")); - VERIFY(userObjectComparisonCalled == 0); - VERIFY(true == runscript("string1a != uoc1a")); - VERIFY(userObjectComparisonCalled == 0); - VERIFY(true == runscript("2 != uoc1a")); - VERIFY(userObjectComparisonCalled == 0); - - // Comparison against a non-uoc-object still invokes uoc - userObjectComparisonCalled = 0; - userObjectComparisonReturn = false; - VERIFY(false == runscript("uoc1a == obj1a")); - VERIFY(userObjectComparisonCalled == 1); - VERIFY(false == runscript("obj1a == uoc1a")); - VERIFY(userObjectComparisonCalled == 2); - userObjectComparisonReturn = true; - VERIFY(true == runscript("uoc1a == obj1a")); - VERIFY(userObjectComparisonCalled == 3); - VERIFY(true == runscript("obj1a == uoc1a")); - VERIFY(userObjectComparisonCalled == 4); - - // != comparison against a non-uoc-object still invokes uoc - userObjectComparisonCalled = 0; - userObjectComparisonReturn = false; - VERIFY(true == runscript("uoc1a != obj1a")); - VERIFY(userObjectComparisonCalled == 1); - VERIFY(true == runscript("obj1a != uoc1a")); - VERIFY(userObjectComparisonCalled == 2); - userObjectComparisonReturn = true; - VERIFY(false == runscript("uoc1a != obj1a")); - VERIFY(userObjectComparisonCalled == 3); - VERIFY(false == runscript("obj1a != uoc1a")); - VERIFY(userObjectComparisonCalled == 4); - - // Comparing two non-uoc objects does not invoke uoc - userObjectComparisonCalled = 0; - userObjectComparisonReturn = false; - VERIFY(true == runscript("obj1a == obj1a")); - VERIFY(true == runscript("obj1a == obj1b")); - VERIFY(false == runscript("obj1a == obj2")); - VERIFY(false == runscript("obj1a == string1a")); - VERIFY(true == runscript("string1a == string1a")); - VERIFY(true == runscript("string1a == string1b")); - VERIFY(false == runscript("string1a == string2")); - VERIFY(userObjectComparisonCalled == 0); - - // Correct lhs and rhs passed to uoc - userObjectComparisonCalled = 0; - userObjectComparisonReturn = false; - SET_EXPECTED(uoc1, uoc2); - VERIFY(false == runscript("uoc1a == uoc2")); - VERIFY(true == expectedObjectsCompared); - SET_EXPECTED(uoc2, uoc1); - VERIFY(false == runscript("uoc2 == uoc1a")); - VERIFY(true == expectedObjectsCompared); - SET_EXPECTED(uoc1, uoc2); - VERIFY(true == runscript("uoc1a != uoc2")); - VERIFY(true == expectedObjectsCompared); - SET_EXPECTED(uoc2, uoc1); - VERIFY(true == runscript("uoc2 != uoc1a")); - VERIFY(true == expectedObjectsCompared); - SET_EXPECTED(uoc1, obj1); - VERIFY(false == runscript("uoc1a == obj1a")); - VERIFY(true == expectedObjectsCompared); - SET_EXPECTED(obj1, uoc1); - VERIFY(false == runscript("obj1a == uoc1a")); - VERIFY(true == expectedObjectsCompared); - -cleanup: - V8::SetUserObjectComparisonCallbackFunction(0); - context.Dispose(); - - ENDTEST(); -} diff --git a/tests/auto/declarative/v8/v8test.h b/tests/auto/declarative/v8/v8test.h deleted file mode 100644 index 31acefc8b3..0000000000 --- a/tests/auto/declarative/v8/v8test.h +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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, Nokia gives you certain additional -** rights. These rights are described in the Nokia 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. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef V8TEST_H -#define V8TEST_H - -#include "../../../../src/3rdparty/v8/include/v8.h" - -bool v8test_eval(); -bool v8test_userobjectcompare(); - -#endif // V8TEST_H - diff --git a/tests/auto/qtquick1/qdeclarativeanchors/qdeclarativeanchors.pro b/tests/auto/qtquick1/qdeclarativeanchors/qdeclarativeanchors.pro index 12b545811d..dc87f68769 100644 --- a/tests/auto/qtquick1/qdeclarativeanchors/qdeclarativeanchors.pro +++ b/tests/auto/qtquick1/qdeclarativeanchors/qdeclarativeanchors.pro @@ -13,4 +13,4 @@ symbian: { CONFIG += parallel_test -QT += core-private gui-private declarative-private qtquick1-private +QT += core-private gui-private v8-private declarative-private qtquick1-private diff --git a/tests/auto/qtquick1/qdeclarativeanimations/qdeclarativeanimations.pro b/tests/auto/qtquick1/qdeclarativeanimations/qdeclarativeanimations.pro index 2daebc7a54..c6e87ca9ca 100644 --- a/tests/auto/qtquick1/qdeclarativeanimations/qdeclarativeanimations.pro +++ b/tests/auto/qtquick1/qdeclarativeanimations/qdeclarativeanimations.pro @@ -13,4 +13,4 @@ symbian: { CONFIG += parallel_test -QT += core-private gui-private declarative-private qtquick1-private +QT += core-private gui-private v8-private declarative-private qtquick1-private diff --git a/tests/auto/qtquick1/qdeclarativebehaviors/qdeclarativebehaviors.pro b/tests/auto/qtquick1/qdeclarativebehaviors/qdeclarativebehaviors.pro index 4fd4ddd8b0..15512bd749 100644 --- a/tests/auto/qtquick1/qdeclarativebehaviors/qdeclarativebehaviors.pro +++ b/tests/auto/qtquick1/qdeclarativebehaviors/qdeclarativebehaviors.pro @@ -13,4 +13,4 @@ symbian: { CONFIG += parallel_test -QT += core-private gui-private declarative-private qtquick1-private +QT += core-private gui-private v8-private declarative-private qtquick1-private diff --git a/tests/auto/qtquick1/qdeclarativeconnection/qdeclarativeconnection.pro b/tests/auto/qtquick1/qdeclarativeconnection/qdeclarativeconnection.pro index 6c3bec845a..3dc73e622c 100644 --- a/tests/auto/qtquick1/qdeclarativeconnection/qdeclarativeconnection.pro +++ b/tests/auto/qtquick1/qdeclarativeconnection/qdeclarativeconnection.pro @@ -14,4 +14,4 @@ symbian: { CONFIG += parallel_test -QT += core-private gui-private declarative-private qtquick1-private +QT += core-private gui-private v8-private declarative-private qtquick1-private diff --git a/tests/auto/qtquick1/qdeclarativeflickable/qdeclarativeflickable.pro b/tests/auto/qtquick1/qdeclarativeflickable/qdeclarativeflickable.pro index c01478380b..8c9d1872db 100644 --- a/tests/auto/qtquick1/qdeclarativeflickable/qdeclarativeflickable.pro +++ b/tests/auto/qtquick1/qdeclarativeflickable/qdeclarativeflickable.pro @@ -14,4 +14,4 @@ symbian: { CONFIG += parallel_test -QT += core-private gui-private declarative-private qtquick1-private +QT += core-private gui-private v8-private declarative-private qtquick1-private diff --git a/tests/auto/qtquick1/qdeclarativeflipable/qdeclarativeflipable.pro b/tests/auto/qtquick1/qdeclarativeflipable/qdeclarativeflipable.pro index 22d015c798..6ec02c54b5 100644 --- a/tests/auto/qtquick1/qdeclarativeflipable/qdeclarativeflipable.pro +++ b/tests/auto/qtquick1/qdeclarativeflipable/qdeclarativeflipable.pro @@ -14,5 +14,5 @@ symbian: { CONFIG += parallel_test -QT += core-private gui-private declarative-private qtquick1-private +QT += core-private gui-private v8-private declarative-private qtquick1-private qpa:contains(QT_CONFIG,xcb):CONFIG+=insignificant_test # QTBUG-21012 fails on exit (X11-specific) diff --git a/tests/auto/qtquick1/qdeclarativegridview/qdeclarativegridview.pro b/tests/auto/qtquick1/qdeclarativegridview/qdeclarativegridview.pro index eb125599e1..48c4d21df7 100644 --- a/tests/auto/qtquick1/qdeclarativegridview/qdeclarativegridview.pro +++ b/tests/auto/qtquick1/qdeclarativegridview/qdeclarativegridview.pro @@ -14,4 +14,4 @@ symbian: { CONFIG += parallel_test -QT += core-private gui-private declarative-private qtquick1-private +QT += core-private gui-private v8-private declarative-private qtquick1-private diff --git a/tests/auto/qtquick1/qdeclarativeitem/qdeclarativeitem.pro b/tests/auto/qtquick1/qdeclarativeitem/qdeclarativeitem.pro index 459f80bec2..05bb55a4b2 100644 --- a/tests/auto/qtquick1/qdeclarativeitem/qdeclarativeitem.pro +++ b/tests/auto/qtquick1/qdeclarativeitem/qdeclarativeitem.pro @@ -14,5 +14,5 @@ symbian: { CONFIG += parallel_test -QT += core-private gui-private declarative-private qtquick1-private +QT += core-private gui-private v8-private declarative-private qtquick1-private qpa:contains(QT_CONFIG,xcb):CONFIG+=insignificant_test # QTBUG-21012 fails on exit (X11-specific) diff --git a/tests/auto/qtquick1/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/qtquick1/qdeclarativeitem/tst_qdeclarativeitem.cpp index b244a24613..5b71f23f36 100644 --- a/tests/auto/qtquick1/qdeclarativeitem/tst_qdeclarativeitem.cpp +++ b/tests/auto/qtquick1/qdeclarativeitem/tst_qdeclarativeitem.cpp @@ -91,6 +91,7 @@ private slots: void testQtQuick11Attributes(); void testQtQuick11Attributes_data(); void qtbug_16871(); + void qtbug_21045(); private: QDeclarativeEngine engine; }; @@ -1365,6 +1366,18 @@ void tst_QDeclarativeItem::qtbug_16871() delete o; } +void tst_QDeclarativeItem::qtbug_21045() +{ + QDeclarativeComponent component(&engine); + QGraphicsScene scene; + component.setData("import QtQuick 1.1\nItem{visible: false; focus: true}", QUrl::fromLocalFile("file:")); + QObject *o = component.create(); + QDeclarativeItem* i = qobject_cast<QDeclarativeItem*>(o); + QVERIFY(i); + scene.addItem(i); + QVERIFY(!i->hasActiveFocus()); +} + QTEST_MAIN(tst_QDeclarativeItem) #include "tst_qdeclarativeitem.moc" diff --git a/tests/auto/qtquick1/qdeclarativelistview/qdeclarativelistview.pro b/tests/auto/qtquick1/qdeclarativelistview/qdeclarativelistview.pro index 5eb154dad2..8b3f848ff6 100644 --- a/tests/auto/qtquick1/qdeclarativelistview/qdeclarativelistview.pro +++ b/tests/auto/qtquick1/qdeclarativelistview/qdeclarativelistview.pro @@ -14,4 +14,4 @@ symbian: { } CONFIG += parallel_test -QT += core-private gui-private declarative-private qtquick1-private +QT += core-private gui-private v8-private declarative-private qtquick1-private diff --git a/tests/auto/qtquick1/qdeclarativepathview/qdeclarativepathview.pro b/tests/auto/qtquick1/qdeclarativepathview/qdeclarativepathview.pro index 4233096a2d..e37ad5c493 100644 --- a/tests/auto/qtquick1/qdeclarativepathview/qdeclarativepathview.pro +++ b/tests/auto/qtquick1/qdeclarativepathview/qdeclarativepathview.pro @@ -14,4 +14,4 @@ symbian: { CONFIG += parallel_test -QT += core-private gui-private declarative-private qtquick1-private +QT += core-private gui-private v8-private declarative-private qtquick1-private diff --git a/tests/auto/qtquick1/qdeclarativepositioners/qdeclarativepositioners.pro b/tests/auto/qtquick1/qdeclarativepositioners/qdeclarativepositioners.pro index cf4ebfbf39..b01f8a31d4 100644 --- a/tests/auto/qtquick1/qdeclarativepositioners/qdeclarativepositioners.pro +++ b/tests/auto/qtquick1/qdeclarativepositioners/qdeclarativepositioners.pro @@ -13,4 +13,4 @@ symbian: { CONFIG += parallel_test -QT += core-private gui-private declarative-private qtquick1-private +QT += core-private gui-private v8-private declarative-private qtquick1-private diff --git a/tests/auto/qtquick1/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro b/tests/auto/qtquick1/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro index 99094cf101..1afe01ff4e 100644 --- a/tests/auto/qtquick1/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro +++ b/tests/auto/qtquick1/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro @@ -14,4 +14,4 @@ symbian: { CONFIG += parallel_test -QT += core-private gui-private declarative-private qtquick1-private +QT += core-private gui-private v8-private declarative-private qtquick1-private diff --git a/tests/auto/qtquick1/qdeclarativespringanimation/qdeclarativespringanimation.pro b/tests/auto/qtquick1/qdeclarativespringanimation/qdeclarativespringanimation.pro index 56f9c2df17..c3ceed0c84 100644 --- a/tests/auto/qtquick1/qdeclarativespringanimation/qdeclarativespringanimation.pro +++ b/tests/auto/qtquick1/qdeclarativespringanimation/qdeclarativespringanimation.pro @@ -14,4 +14,4 @@ symbian: { CONFIG += parallel_test -QT += core-private gui-private declarative-private qtquick1-private +QT += core-private gui-private v8-private declarative-private qtquick1-private diff --git a/tests/auto/qtquick1/qdeclarativestates/qdeclarativestates.pro b/tests/auto/qtquick1/qdeclarativestates/qdeclarativestates.pro index b80ab88f01..bdf151a849 100644 --- a/tests/auto/qtquick1/qdeclarativestates/qdeclarativestates.pro +++ b/tests/auto/qtquick1/qdeclarativestates/qdeclarativestates.pro @@ -13,4 +13,4 @@ symbian: { } CONFIG += parallel_test -QT += core-private gui-private declarative-private qtquick1-private +QT += core-private gui-private v8-private declarative-private qtquick1-private diff --git a/tests/auto/qtquick1/qdeclarativetext/qdeclarativetext.pro b/tests/auto/qtquick1/qdeclarativetext/qdeclarativetext.pro index ad9a667d57..6253806984 100644 --- a/tests/auto/qtquick1/qdeclarativetext/qdeclarativetext.pro +++ b/tests/auto/qtquick1/qdeclarativetext/qdeclarativetext.pro @@ -19,4 +19,4 @@ symbian: { CONFIG += parallel_test -QT += core-private gui-private declarative-private qtquick1-private +QT += core-private gui-private v8-private declarative-private qtquick1-private diff --git a/tests/auto/qtquick1/qdeclarativetextedit/qdeclarativetextedit.pro b/tests/auto/qtquick1/qdeclarativetextedit/qdeclarativetextedit.pro index 2d5461ffc1..4e18222663 100644 --- a/tests/auto/qtquick1/qdeclarativetextedit/qdeclarativetextedit.pro +++ b/tests/auto/qtquick1/qdeclarativetextedit/qdeclarativetextedit.pro @@ -12,4 +12,4 @@ symbian: { } else { DEFINES += SRCDIR=\\\"$$PWD\\\" } -QT += core-private gui-private declarative-private qtquick1-private +QT += core-private gui-private v8-private declarative-private qtquick1-private diff --git a/tests/auto/qtquick1/qdeclarativetextinput/qdeclarativetextinput.pro b/tests/auto/qtquick1/qdeclarativetextinput/qdeclarativetextinput.pro index d39da270a3..f18c054132 100644 --- a/tests/auto/qtquick1/qdeclarativetextinput/qdeclarativetextinput.pro +++ b/tests/auto/qtquick1/qdeclarativetextinput/qdeclarativetextinput.pro @@ -12,4 +12,4 @@ symbian: { DEFINES += SRCDIR=\\\"$$PWD\\\" } -QT += core-private gui-private declarative-private qtquick1-private +QT += core-private gui-private v8-private declarative-private qtquick1-private diff --git a/tests/auto/qtquick1/qdeclarativeviewer/qdeclarativeviewer.pro b/tests/auto/qtquick1/qdeclarativeviewer/qdeclarativeviewer.pro index ca214b1210..67be35f510 100644 --- a/tests/auto/qtquick1/qdeclarativeviewer/qdeclarativeviewer.pro +++ b/tests/auto/qtquick1/qdeclarativeviewer/qdeclarativeviewer.pro @@ -17,4 +17,4 @@ symbian: { } CONFIG += parallel_test -QT += core-private gui-private declarative-private qtquick1-private widgets-private +QT += core-private gui-private declarative-private qtquick1-private widgets-private v8-private diff --git a/tests/auto/qtquick1/qdeclarativevisualdatamodel/qdeclarativevisualdatamodel.pro b/tests/auto/qtquick1/qdeclarativevisualdatamodel/qdeclarativevisualdatamodel.pro index a5a0add30f..3f116e1f37 100644 --- a/tests/auto/qtquick1/qdeclarativevisualdatamodel/qdeclarativevisualdatamodel.pro +++ b/tests/auto/qtquick1/qdeclarativevisualdatamodel/qdeclarativevisualdatamodel.pro @@ -14,4 +14,4 @@ symbian: { CONFIG += parallel_test -QT += core-private gui-private declarative-private qtquick1-private +QT += core-private gui-private v8-private declarative-private qtquick1-private diff --git a/tests/auto/qtquick1/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro b/tests/auto/qtquick1/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro index 6acfe35dca..e8894a8564 100644 --- a/tests/auto/qtquick1/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro +++ b/tests/auto/qtquick1/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro @@ -18,4 +18,4 @@ symbian: { CONFIG += parallel_test -QT += core-private gui-private declarative-private qtquick1-private +QT += core-private gui-private v8-private declarative-private qtquick1-private diff --git a/tests/benchmarks/declarative/compilation/tst_compilation.cpp b/tests/benchmarks/declarative/compilation/tst_compilation.cpp index 98008d8bf8..9b4f9a70e8 100644 --- a/tests/benchmarks/declarative/compilation/tst_compilation.cpp +++ b/tests/benchmarks/declarative/compilation/tst_compilation.cpp @@ -44,10 +44,10 @@ #include <QtDeclarative/qdeclarativeengine.h> #include <QtDeclarative/qdeclarativecomponent.h> #include <QtDeclarative/private/qdeclarativejsengine_p.h> -#include <QtDeclarative/private/qdeclarativejsnodepool_p.h> +#include <QtDeclarative/private/qdeclarativejsmemorypool_p.h> #include <QtDeclarative/private/qdeclarativejsparser_p.h> #include <QtDeclarative/private/qdeclarativejslexer_p.h> -#include <QtDeclarative/private/qdeclarativescriptparser_p.h> +#include <QtDeclarative/private/qdeclarativescript_p.h> #include <QFile> #include <QDebug> @@ -154,7 +154,7 @@ void tst_compilation::scriptparser() QUrl url = QUrl::fromLocalFile(file); QBENCHMARK { - QDeclarativeScriptParser parser; + QDeclarativeScript::Parser parser; parser.parse(data, url); parser.tree(); } diff --git a/tests/benchmarks/declarative/creation/creation.pro b/tests/benchmarks/declarative/creation/creation.pro index 74cb47fb73..8241ace5a6 100644 --- a/tests/benchmarks/declarative/creation/creation.pro +++ b/tests/benchmarks/declarative/creation/creation.pro @@ -1,7 +1,7 @@ load(qttest_p4) TEMPLATE = app TARGET = tst_creation -QT += declarative +QT += declarative qtquick1 macx:CONFIG -= app_bundle SOURCES += tst_creation.cpp @@ -13,3 +13,5 @@ symbian { } else { DEFINES += SRCDIR=\\\"$$PWD\\\" } + +QT += core-private gui-private declarative-private qtquick1-private diff --git a/tests/benchmarks/declarative/creation/tst_creation.cpp b/tests/benchmarks/declarative/creation/tst_creation.cpp index 4085688845..6659eb5989 100644 --- a/tests/benchmarks/declarative/creation/tst_creation.cpp +++ b/tests/benchmarks/declarative/creation/tst_creation.cpp @@ -48,7 +48,7 @@ #include <QGraphicsItem> #include <QDeclarativeItem> #include <QDeclarativeContext> -#include <private/qdeclarativetextinput_p.h> +#include <QtQuick1/private/qdeclarativetextinput_p.h> #include <private/qobject_p.h> #ifdef Q_OS_SYMBIAN @@ -111,7 +111,7 @@ tst_creation::tst_creation() qmlRegisterType<TestType>("Qt.test", 1, 0, "TestType"); //get rid of initialization effects - QDeclarativeTextInput te; + QDeclarative1TextInput te; } inline QUrl TEST_FILE(const QString &filename) @@ -206,7 +206,7 @@ void tst_creation::qobject_10tree_cpp() void tst_creation::qobject_qmltype() { - QDeclarativeType *t = QDeclarativeMetaType::qmlType("Qt/QtObject", 4, 7); + QDeclarativeType *t = QDeclarativeMetaType::qmlType("QtQuick/QtObject", 2, 0); QBENCHMARK { QObject *obj = t->create(); @@ -350,7 +350,7 @@ void tst_creation::elements_data() void tst_creation::elements() { QFETCH(QByteArray, type); - QDeclarativeType *t = QDeclarativeMetaType::qmlType(type, 4, 7); + QDeclarativeType *t = QDeclarativeMetaType::qmlType(type, 2, 0); if (!t || !t->isCreatable()) QSKIP("Non-creatable type", SkipSingle); |