aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2011-12-21 09:06:26 +0100
committerQt by Nokia <qt-info@nokia.com>2011-12-21 15:35:22 +0100
commit8249c72213bc7d212c05aa086b3145a5742706a3 (patch)
tree4a34b97b0d57a05707c65b7328d5ab1bf4254920 /tests/auto/declarative
parent3c211558f6b571555558bd1fc59774e36a6da710 (diff)
QDeclarative tests: Introduce base class for data tests.
In tests/auto/shared/util.* replace macros/find functions by a base class QDeclarativeDataTest with accessors for the data directory helper functions to create URLs from it. The class relies on QFINDTESTDATA, which is the standard way of locating test data. Using the class should reduce the number of calls to QFileInfo.exists(), etc significantly. In addition, provide utility functions for messages. Reviewed-by: Michael Brasser <michael.brasser@nokia.com> Change-Id: Id2beacb157922ee9412f9e45cf9695cec1f8379a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'tests/auto/declarative')
-rw-r--r--tests/auto/declarative/debugger/qdeclarativedebugjs/qdeclarativedebugjs.pro7
-rw-r--r--tests/auto/declarative/debugger/qdeclarativedebugjs/tst_qdeclarativedebugjs.cpp7
-rw-r--r--tests/auto/declarative/debugger/qdeclarativedebugtrace/qdeclarativedebugtrace.pro6
-rw-r--r--tests/auto/declarative/debugger/qdeclarativedebugtrace/tst_qdeclarativedebugtrace.cpp4
-rw-r--r--tests/auto/declarative/debugger/qv8profilerservice/qv8profilerservice.pro6
-rw-r--r--tests/auto/declarative/debugger/qv8profilerservice/tst_qv8profilerservice.cpp4
-rw-r--r--tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro4
-rw-r--r--tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp12
-rw-r--r--tests/auto/declarative/qdeclarativecomponent/qdeclarativecomponent.pro4
-rw-r--r--tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp8
-rw-r--r--tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro4
-rw-r--r--tests/auto/declarative/qdeclarativeconnection/tst_qdeclarativeconnection.cpp18
-rw-r--r--tests/auto/declarative/qdeclarativeconsole/qdeclarativeconsole.pro4
-rw-r--r--tests/auto/declarative/qdeclarativeconsole/tst_qdeclarativeconsole.cpp32
-rw-r--r--tests/auto/declarative/qdeclarativecontext/qdeclarativecontext.pro4
-rw-r--r--tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp22
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro6
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp621
-rw-r--r--tests/auto/declarative/qdeclarativeerror/qdeclarativeerror.pro4
-rw-r--r--tests/auto/declarative/qdeclarativeerror/tst_qdeclarativeerror.cpp6
-rw-r--r--tests/auto/declarative/qdeclarativeexpression/qdeclarativeexpression.pro4
-rw-r--r--tests/auto/declarative/qdeclarativeexpression/tst_qdeclarativeexpression.cpp4
-rw-r--r--tests/auto/declarative/qdeclarativefolderlistmodel/qdeclarativefolderlistmodel.pro4
-rw-r--r--tests/auto/declarative/qdeclarativefolderlistmodel/tst_qdeclarativefolderlistmodel.cpp22
-rw-r--r--tests/auto/declarative/qdeclarativeincubator/qdeclarativeincubator.pro7
-rw-r--r--tests/auto/declarative/qdeclarativeincubator/tst_qdeclarativeincubator.cpp61
-rw-r--r--tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro4
-rw-r--r--tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp15
-rw-r--r--tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro4
-rw-r--r--tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp26
-rw-r--r--tests/auto/declarative/qdeclarativelistreference/qdeclarativelistreference.pro4
-rw-r--r--tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp17
-rw-r--r--tests/auto/declarative/qdeclarativelocale/qdeclarativelocale.pro4
-rw-r--r--tests/auto/declarative/qdeclarativelocale/tst_qdeclarativelocale.cpp50
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp97
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro6
-rw-r--r--tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro4
-rw-r--r--tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp18
-rw-r--r--tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro5
-rw-r--r--tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp79
-rw-r--r--tests/auto/declarative/qdeclarativesqldatabase/qdeclarativesqldatabase.pro4
-rw-r--r--tests/auto/declarative/qdeclarativesqldatabase/tst_qdeclarativesqldatabase.cpp5
-rw-r--r--tests/auto/declarative/qdeclarativetranslation/qdeclarativetranslation.pro4
-rw-r--r--tests/auto/declarative/qdeclarativetranslation/tst_qdeclarativetranslation.cpp15
-rw-r--r--tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro6
-rw-r--r--tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp162
-rw-r--r--tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro4
-rw-r--r--tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp34
-rw-r--r--tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro6
-rw-r--r--tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp215
-rw-r--r--tests/auto/declarative/v4/tst_v4.cpp31
-rw-r--r--tests/auto/declarative/v4/v4.pro6
52 files changed, 834 insertions, 876 deletions
diff --git a/tests/auto/declarative/debugger/qdeclarativedebugjs/qdeclarativedebugjs.pro b/tests/auto/declarative/debugger/qdeclarativedebugjs/qdeclarativedebugjs.pro
index 8f61aae8c6..f51b1f3b35 100644
--- a/tests/auto/declarative/debugger/qdeclarativedebugjs/qdeclarativedebugjs.pro
+++ b/tests/auto/declarative/debugger/qdeclarativedebugjs/qdeclarativedebugjs.pro
@@ -3,10 +3,11 @@ TARGET = tst_qdeclarativedebugjs
QT += declarative-private testlib
macx:CONFIG -= app_bundle
-HEADERS += ../shared/debugutil_p.h
-
+HEADERS += ../shared/debugutil_p.h \
+ ../../../shared/util.h
SOURCES += tst_qdeclarativedebugjs.cpp \
- ../shared/debugutil.cpp
+ ../shared/debugutil.cpp \
+ ../../../shared/util.cpp
INCLUDEPATH += ../shared
diff --git a/tests/auto/declarative/debugger/qdeclarativedebugjs/tst_qdeclarativedebugjs.cpp b/tests/auto/declarative/debugger/qdeclarativedebugjs/tst_qdeclarativedebugjs.cpp
index 0f9da032e8..4b6e863df9 100644
--- a/tests/auto/declarative/debugger/qdeclarativedebugjs/tst_qdeclarativedebugjs.cpp
+++ b/tests/auto/declarative/debugger/qdeclarativedebugjs/tst_qdeclarativedebugjs.cpp
@@ -159,7 +159,7 @@ do {\
class QJSDebugClient;
-class tst_QDeclarativeDebugJS : public QObject
+class tst_QDeclarativeDebugJS : public QDeclarativeDataTest
{
Q_OBJECT
@@ -982,6 +982,7 @@ QByteArray QJSDebugClient::packMessage(const QByteArray &type, const QByteArray
void tst_QDeclarativeDebugJS::initTestCase()
{
+ QDeclarativeDataTest::initTestCase();
t.start();
process = 0;
client = 0;
@@ -1014,9 +1015,9 @@ bool tst_QDeclarativeDebugJS::init(const QString &qmlFile, bool blockMode)
systemEnvironment << "QML_DISABLE_OPTIMIZER=1";
process->setEnvironment(systemEnvironment);
if (blockMode)
- process->start(QStringList() << QLatin1String(BLOCKMODE) << TESTDATA(qmlFile));
+ process->start(QStringList() << QLatin1String(BLOCKMODE) << testFile(qmlFile));
else
- process->start(QStringList() << QLatin1String(NORMALMODE) << TESTDATA(qmlFile));
+ process->start(QStringList() << QLatin1String(NORMALMODE) << testFile(qmlFile));
if (!process->waitForSessionStart()) {
return false;
diff --git a/tests/auto/declarative/debugger/qdeclarativedebugtrace/qdeclarativedebugtrace.pro b/tests/auto/declarative/debugger/qdeclarativedebugtrace/qdeclarativedebugtrace.pro
index fca909b261..112c8f015f 100644
--- a/tests/auto/declarative/debugger/qdeclarativedebugtrace/qdeclarativedebugtrace.pro
+++ b/tests/auto/declarative/debugger/qdeclarativedebugtrace/qdeclarativedebugtrace.pro
@@ -2,10 +2,12 @@ CONFIG += testcase
TARGET = tst_qdeclarativedebugtrace
macx:CONFIG -= app_bundle
-HEADERS += ../shared/debugutil_p.h
+HEADERS += ../shared/debugutil_p.h \
+ ../../../shared/util.h
SOURCES += tst_qdeclarativedebugtrace.cpp \
- ../shared/debugutil.cpp
+ ../shared/debugutil.cpp \
+ ../../../shared/util.cpp
OTHER_FILES += data/test.qml
diff --git a/tests/auto/declarative/debugger/qdeclarativedebugtrace/tst_qdeclarativedebugtrace.cpp b/tests/auto/declarative/debugger/qdeclarativedebugtrace/tst_qdeclarativedebugtrace.cpp
index 0a23a5b4a4..528d84ca98 100644
--- a/tests/auto/declarative/debugger/qdeclarativedebugtrace/tst_qdeclarativedebugtrace.cpp
+++ b/tests/auto/declarative/debugger/qdeclarativedebugtrace/tst_qdeclarativedebugtrace.cpp
@@ -75,7 +75,7 @@ protected:
void messageReceived(const QByteArray &message);
};
-class tst_QDeclarativeDebugTrace : public QObject
+class tst_QDeclarativeDebugTrace : public QDeclarativeDataTest
{
Q_OBJECT
@@ -190,7 +190,7 @@ void tst_QDeclarativeDebugTrace::connect(bool block)
else
arguments << QString("-qmljsdebugger=port:"STR_PORT);
- arguments << QString(TESTDATA(QLatin1String("test.qml")));
+ arguments << testFile("test.qml");
m_process = new QDeclarativeDebugProcess(executable);
m_process->start(QStringList() << arguments);
diff --git a/tests/auto/declarative/debugger/qv8profilerservice/qv8profilerservice.pro b/tests/auto/declarative/debugger/qv8profilerservice/qv8profilerservice.pro
index 12c8394645..6ef72350e9 100644
--- a/tests/auto/declarative/debugger/qv8profilerservice/qv8profilerservice.pro
+++ b/tests/auto/declarative/debugger/qv8profilerservice/qv8profilerservice.pro
@@ -2,10 +2,12 @@ CONFIG += testcase
TARGET = tst_qv8profilerservice
macx:CONFIG -= app_bundle
-HEADERS += ../shared/debugutil_p.h
+HEADERS += ../shared/debugutil_p.h \
+ ../../../shared/util.h
SOURCES += tst_qv8profilerservice.cpp \
- ../shared/debugutil.cpp
+ ../shared/debugutil.cpp \
+ ../../../shared/util.cpp
OTHER_FILES += data/test.qml
diff --git a/tests/auto/declarative/debugger/qv8profilerservice/tst_qv8profilerservice.cpp b/tests/auto/declarative/debugger/qv8profilerservice/tst_qv8profilerservice.cpp
index 46c587da83..2ddff64049 100644
--- a/tests/auto/declarative/debugger/qv8profilerservice/tst_qv8profilerservice.cpp
+++ b/tests/auto/declarative/debugger/qv8profilerservice/tst_qv8profilerservice.cpp
@@ -98,7 +98,7 @@ protected:
void messageReceived(const QByteArray &message);
};
-class tst_QV8ProfilerService : public QObject
+class tst_QV8ProfilerService : public QDeclarativeDataTest
{
Q_OBJECT
@@ -174,7 +174,7 @@ void tst_QV8ProfilerService::connect(bool block)
else
arguments << QString("-qmljsdebugger=port:"STR_PORT);
- arguments << QString(TESTDATA(QLatin1String("test.qml")));
+ arguments << QDeclarativeDataTest::instance()->testFile("test.qml");
m_process = new QDeclarativeDebugProcess(executable);
m_process->start(QStringList() << arguments);
diff --git a/tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro b/tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro
index 5f8ee634f4..83163cdcff 100644
--- a/tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro
+++ b/tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro
@@ -2,7 +2,9 @@ CONFIG += testcase
TARGET = tst_qdeclarativebinding
macx:CONFIG -= app_bundle
-SOURCES += tst_qdeclarativebinding.cpp
+SOURCES += tst_qdeclarativebinding.cpp \
+ ../../shared/util.cpp
+HEADERS += ../../shared/util.h
testDataFiles.files = data
testDataFiles.path = .
diff --git a/tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp b/tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp
index 80ed10cd25..b1bdcacf06 100644
--- a/tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp
+++ b/tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp
@@ -45,7 +45,7 @@
#include <QtQuick/private/qquickrectangle_p.h>
#include "../../shared/util.h"
-class tst_qdeclarativebinding : public QObject
+class tst_qdeclarativebinding : public QDeclarativeDataTest
{
Q_OBJECT
public:
@@ -69,7 +69,7 @@ tst_qdeclarativebinding::tst_qdeclarativebinding()
void tst_qdeclarativebinding::binding()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("test-binding.qml")));
+ QDeclarativeComponent c(&engine, testFileUrl("test-binding.qml"));
QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
QVERIFY(rect != 0);
@@ -97,7 +97,7 @@ void tst_qdeclarativebinding::binding()
void tst_qdeclarativebinding::whenAfterValue()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("test-binding2.qml")));
+ QDeclarativeComponent c(&engine, testFileUrl("test-binding2.qml"));
QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
QVERIFY(rect != 0);
@@ -113,7 +113,7 @@ void tst_qdeclarativebinding::whenAfterValue()
void tst_qdeclarativebinding::restoreBinding()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("restoreBinding.qml")));
+ QDeclarativeComponent c(&engine, testFileUrl("restoreBinding.qml"));
QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
QVERIFY(rect != 0);
@@ -143,7 +143,7 @@ void tst_qdeclarativebinding::restoreBinding()
void tst_qdeclarativebinding::restoreBindingWithLoop()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("restoreBindingWithLoop.qml")));
+ QDeclarativeComponent c(&engine, testFileUrl("restoreBindingWithLoop.qml"));
QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
QVERIFY(rect != 0);
@@ -180,7 +180,7 @@ void tst_qdeclarativebinding::restoreBindingWithLoop()
void tst_qdeclarativebinding::deletedObject()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("deletedObject.qml")));
+ QDeclarativeComponent c(&engine, testFileUrl("deletedObject.qml"));
QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
QVERIFY(rect != 0);
diff --git a/tests/auto/declarative/qdeclarativecomponent/qdeclarativecomponent.pro b/tests/auto/declarative/qdeclarativecomponent/qdeclarativecomponent.pro
index 155d615721..d04ef75f30 100644
--- a/tests/auto/declarative/qdeclarativecomponent/qdeclarativecomponent.pro
+++ b/tests/auto/declarative/qdeclarativecomponent/qdeclarativecomponent.pro
@@ -2,7 +2,9 @@ CONFIG += testcase
TARGET = tst_qdeclarativecomponent
macx:CONFIG -= app_bundle
-SOURCES += tst_qdeclarativecomponent.cpp
+SOURCES += tst_qdeclarativecomponent.cpp \
+ ../../shared/util.cpp
+HEADERS += ../../shared/util.h
testDataFiles.files = data
testDataFiles.path = .
diff --git a/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp b/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp
index da15458d27..00c874beef 100644
--- a/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp
+++ b/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp
@@ -59,7 +59,7 @@ protected:
}
};
-class tst_qdeclarativecomponent : public QObject
+class tst_qdeclarativecomponent : public QDeclarativeDataTest
{
Q_OBJECT
public:
@@ -107,7 +107,7 @@ void tst_qdeclarativecomponent::loadEmptyUrl()
void tst_qdeclarativecomponent::qmlIncubateObject()
{
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("incubateObject.qml")));
+ QDeclarativeComponent component(&engine, testFileUrl("incubateObject.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
QCOMPARE(object->property("test1").toBool(), true);
@@ -121,7 +121,7 @@ void tst_qdeclarativecomponent::qmlIncubateObject()
void tst_qdeclarativecomponent::qmlCreateObject()
{
QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("createObject.qml")));
+ QDeclarativeComponent component(&engine, testFileUrl("createObject.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -138,7 +138,7 @@ void tst_qdeclarativecomponent::qmlCreateObject()
void tst_qdeclarativecomponent::qmlCreateObjectWithProperties()
{
QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("createObjectWithScript.qml")));
+ QDeclarativeComponent component(&engine, testFileUrl("createObjectWithScript.qml"));
QVERIFY2(component.errorString().isEmpty(), component.errorString().toUtf8());
QObject *object = component.create();
QVERIFY(object != 0);
diff --git a/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro b/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro
index 702f3fc542..6e48be9937 100644
--- a/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro
+++ b/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro
@@ -2,7 +2,9 @@ CONFIG += testcase
TARGET = tst_qdeclarativeconnection
macx:CONFIG -= app_bundle
-SOURCES += tst_qdeclarativeconnection.cpp
+SOURCES += tst_qdeclarativeconnection.cpp \
+ ../../shared/util.cpp
+HEADERS += ../../shared/util.h
testDataFiles.files = data
testDataFiles.path = .
diff --git a/tests/auto/declarative/qdeclarativeconnection/tst_qdeclarativeconnection.cpp b/tests/auto/declarative/qdeclarativeconnection/tst_qdeclarativeconnection.cpp
index cd8f7b7b0c..5971649da0 100644
--- a/tests/auto/declarative/qdeclarativeconnection/tst_qdeclarativeconnection.cpp
+++ b/tests/auto/declarative/qdeclarativeconnection/tst_qdeclarativeconnection.cpp
@@ -46,7 +46,7 @@
#include "../../shared/util.h"
#include <QtDeclarative/qdeclarativescriptstring.h>
-class tst_qdeclarativeconnection : public QObject
+class tst_qdeclarativeconnection : public QDeclarativeDataTest
{
Q_OBJECT
public:
@@ -75,7 +75,7 @@ tst_qdeclarativeconnection::tst_qdeclarativeconnection()
void tst_qdeclarativeconnection::defaultValues()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("test-connection3.qml")));
+ QDeclarativeComponent c(&engine, testFileUrl("test-connection3.qml"));
QDeclarativeConnections *item = qobject_cast<QDeclarativeConnections*>(c.create());
QVERIFY(item != 0);
@@ -87,7 +87,7 @@ void tst_qdeclarativeconnection::defaultValues()
void tst_qdeclarativeconnection::properties()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("test-connection2.qml")));
+ QDeclarativeComponent c(&engine, testFileUrl("test-connection2.qml"));
QDeclarativeConnections *item = qobject_cast<QDeclarativeConnections*>(c.create());
QVERIFY(item != 0);
@@ -101,7 +101,7 @@ void tst_qdeclarativeconnection::properties()
void tst_qdeclarativeconnection::connection()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("test-connection.qml")));
+ QDeclarativeComponent c(&engine, testFileUrl("test-connection.qml"));
QQuickItem *item = qobject_cast<QQuickItem*>(c.create());
QVERIFY(item != 0);
@@ -118,7 +118,7 @@ void tst_qdeclarativeconnection::connection()
void tst_qdeclarativeconnection::trimming()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("trimming.qml")));
+ QDeclarativeComponent c(&engine, testFileUrl("trimming.qml"));
QQuickItem *item = qobject_cast<QQuickItem*>(c.create());
QVERIFY(item != 0);
@@ -139,7 +139,7 @@ void tst_qdeclarativeconnection::trimming()
void tst_qdeclarativeconnection::targetChanged()
{
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("connection-targetchange.qml")));
+ QDeclarativeComponent c(&engine, testFileUrl("connection-targetchange.qml"));
QQuickItem *item = qobject_cast<QQuickItem*>(c.create());
QVERIFY(item != 0);
@@ -176,7 +176,7 @@ void tst_qdeclarativeconnection::unknownSignals()
QFETCH(QString, file);
QFETCH(QString, error);
- QUrl url = QUrl::fromLocalFile(TESTDATA(file));
+ QUrl url = testFileUrl(file);
if (!error.isEmpty()) {
QTest::ignoreMessage(QtWarningMsg, (url.toString() + error).toLatin1());
} else {
@@ -214,7 +214,7 @@ void tst_qdeclarativeconnection::errors()
QFETCH(QString, file);
QFETCH(QString, error);
- QUrl url = QUrl::fromLocalFile(TESTDATA(file));
+ QUrl url = testFileUrl(file);
QDeclarativeEngine engine;
QDeclarativeComponent c(&engine, url);
@@ -264,7 +264,7 @@ static QObject *module_api_factory(QDeclarativeEngine *engine, QJSEngine *script
void tst_qdeclarativeconnection::moduleApiTarget()
{
qmlRegisterModuleApi("MyTestModuleApi", 1, 0, module_api_factory);
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("moduleapi-target.qml")));
+ QDeclarativeComponent component(&engine, testFileUrl("moduleapi-target.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
diff --git a/tests/auto/declarative/qdeclarativeconsole/qdeclarativeconsole.pro b/tests/auto/declarative/qdeclarativeconsole/qdeclarativeconsole.pro
index ed344d58b4..b66866e7cc 100644
--- a/tests/auto/declarative/qdeclarativeconsole/qdeclarativeconsole.pro
+++ b/tests/auto/declarative/qdeclarativeconsole/qdeclarativeconsole.pro
@@ -1,6 +1,8 @@
CONFIG += testcase
TARGET = tst_qdeclarativeconsole
-SOURCES += tst_qdeclarativeconsole.cpp
+SOURCES += tst_qdeclarativeconsole.cpp \
+ ../../shared/util.cpp
+HEADERS += ../../shared/util.h
macx:CONFIG -= app_bundle
testDataFiles.files = data
diff --git a/tests/auto/declarative/qdeclarativeconsole/tst_qdeclarativeconsole.cpp b/tests/auto/declarative/qdeclarativeconsole/tst_qdeclarativeconsole.cpp
index 0025798854..d79e1624ac 100644
--- a/tests/auto/declarative/qdeclarativeconsole/tst_qdeclarativeconsole.cpp
+++ b/tests/auto/declarative/qdeclarativeconsole/tst_qdeclarativeconsole.cpp
@@ -44,7 +44,7 @@
#include <QDeclarativeComponent>
#include "../../shared/util.h"
-class tst_qdeclarativeconsole : public QObject
+class tst_qdeclarativeconsole : public QDeclarativeDataTest
{
Q_OBJECT
public:
@@ -58,11 +58,6 @@ private:
QDeclarativeEngine engine;
};
-inline QUrl TEST_FILE(const QString &filename)
-{
- return QUrl::fromLocalFile(TESTDATA(filename));
-}
-
void tst_qdeclarativeconsole::init()
{
qputenv("QML_CONSOLE_EXTENDED", QByteArray("1"));
@@ -71,37 +66,38 @@ void tst_qdeclarativeconsole::init()
void tst_qdeclarativeconsole::consoleLogExtended()
{
int startLineNumber = 15;
- QUrl testFileUrl = TEST_FILE("consoleLog.qml");
- QString testString = QString(QLatin1String("completed ok (%1:%2)")).arg(testFileUrl.toString());
+ QUrl testUrl = testFileUrl("consoleLog.qml");
+ const QString testUrlString = testUrl.toString();
+ QString testString = QString(QLatin1String("completed ok (%1:%2)")).arg(testUrlString);
QTest::ignoreMessage(QtDebugMsg, qPrintable(testString.arg(startLineNumber++)));
QTest::ignoreMessage(QtDebugMsg, qPrintable(testString.arg(startLineNumber++)));
QTest::ignoreMessage(QtDebugMsg, qPrintable(testString.arg(startLineNumber++)));
QTest::ignoreMessage(QtWarningMsg, qPrintable(testString.arg(startLineNumber++)));
QTest::ignoreMessage(QtCriticalMsg, qPrintable(testString.arg(startLineNumber++)));
- QString testArray = QString(QLatin1String("[1,2] (%1:%2)")).arg(testFileUrl.toString());
+ QString testArray = QString(QLatin1String("[1,2] (%1:%2)")).arg(testUrlString);
QTest::ignoreMessage(QtDebugMsg, qPrintable(testArray.arg(startLineNumber++)));
- QString testObject = QString(QLatin1String("Object (%1:%2)")).arg(testFileUrl.toString());
+ QString testObject = QString(QLatin1String("Object (%1:%2)")).arg(testUrlString);
QTest::ignoreMessage(QtDebugMsg, qPrintable(testObject.arg(startLineNumber++)));
- QString testUndefined = QString(QLatin1String("undefined (%1:%2)")).arg(testFileUrl.toString());
+ QString testUndefined = QString(QLatin1String("undefined (%1:%2)")).arg(testUrlString);
QTest::ignoreMessage(QtDebugMsg, qPrintable(testUndefined.arg(startLineNumber++)));
- QString testNumber = QString(QLatin1String("12 (%1:%2)")).arg(testFileUrl.toString());
+ QString testNumber = QString(QLatin1String("12 (%1:%2)")).arg(testUrlString);
QTest::ignoreMessage(QtDebugMsg, qPrintable(testNumber.arg(startLineNumber++)));
- QString testFunction = QString(QLatin1String("function () { return 5;} (%1:%2)")).arg(testFileUrl.toString());
+ QString testFunction = QString(QLatin1String("function () { return 5;} (%1:%2)")).arg(testUrlString);
QTest::ignoreMessage(QtDebugMsg, qPrintable(testFunction.arg(startLineNumber++)));
- QString testBoolean = QString(QLatin1String("true (%1:%2)")).arg(testFileUrl.toString());
+ QString testBoolean = QString(QLatin1String("true (%1:%2)")).arg(testUrlString);
QTest::ignoreMessage(QtDebugMsg, qPrintable(testBoolean.arg(startLineNumber++)));
QTest::ignoreMessage(QtDebugMsg, qPrintable(testObject.arg(startLineNumber++)));
QTest::ignoreMessage(QtDebugMsg, qPrintable(testObject.arg(startLineNumber++)));
- QString testMix = QString::fromLatin1("1 pong! Object (%1:%2)").arg(testFileUrl.toString());
+ QString testMix = QString::fromLatin1("1 pong! Object (%1:%2)").arg(testUrlString);
QTest::ignoreMessage(QtDebugMsg, qPrintable(testMix.arg(startLineNumber++)));
- testMix = QString::fromLatin1("1 [ping,pong] Object 2 (%1:%2)").arg(testFileUrl.toString());
+ testMix = QString::fromLatin1("1 [ping,pong] Object 2 (%1:%2)").arg(testUrlString);
QTest::ignoreMessage(QtDebugMsg, qPrintable(testMix.arg(startLineNumber++)));
- QString testException = QString(QLatin1String("%1:%2: ReferenceError: Can't find variable: exception")).arg(testFileUrl.toString());
+ QString testException = QString(QLatin1String("%1:%2: ReferenceError: Can't find variable: exception")).arg(testUrlString);
QTest::ignoreMessage(QtWarningMsg, qPrintable(testException.arg(startLineNumber++)));
- QDeclarativeComponent component(&engine, testFileUrl);
+ QDeclarativeComponent component(&engine, testUrl);
QObject *object = component.create();
QVERIFY(object != 0);
delete object;
diff --git a/tests/auto/declarative/qdeclarativecontext/qdeclarativecontext.pro b/tests/auto/declarative/qdeclarativecontext/qdeclarativecontext.pro
index 5e48bec033..b1a0384af7 100644
--- a/tests/auto/declarative/qdeclarativecontext/qdeclarativecontext.pro
+++ b/tests/auto/declarative/qdeclarativecontext/qdeclarativecontext.pro
@@ -1,6 +1,8 @@
CONFIG += testcase
TARGET = tst_qdeclarativecontext
-SOURCES += tst_qdeclarativecontext.cpp
+SOURCES += tst_qdeclarativecontext.cpp \
+ ../../shared/util.cpp
+HEADERS += ../../shared/util.h
macx:CONFIG -= app_bundle
testDataFiles.files = data
diff --git a/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp b/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp
index c57cbeceba..e74f0b7f5d 100644
--- a/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp
+++ b/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp
@@ -48,17 +48,7 @@
#include <private/qdeclarativecontext_p.h>
#include "../../shared/util.h"
-inline QUrl TEST_FILE(const QString &filename)
-{
- return QUrl::fromLocalFile(TESTDATA(filename));
-}
-
-inline QUrl TEST_FILE(const char *filename)
-{
- return TEST_FILE(QLatin1String(filename));
-}
-
-class tst_qdeclarativecontext : public QObject
+class tst_qdeclarativecontext : public QDeclarativeDataTest
{
Q_OBJECT
public:
@@ -586,8 +576,8 @@ public slots:
void tst_qdeclarativecontext::refreshExpressions()
{
QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, TEST_FILE("refreshExpressions.qml"));
- QDeclarativeComponent component2(&engine, TEST_FILE("RefreshExpressionsType.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("refreshExpressions.qml"));
+ QDeclarativeComponent component2(&engine, testFileUrl("RefreshExpressionsType.qml"));
CountCommand command;
engine.rootContext()->setContextProperty("countCommand", &command);
@@ -621,8 +611,8 @@ void tst_qdeclarativecontext::refreshExpressionsRootContext()
CountCommand command;
engine.rootContext()->setContextProperty("countCommand", &command);
- QDeclarativeComponent component(&engine, TEST_FILE("refreshExpressions.qml"));
- QDeclarativeComponent component2(&engine, TEST_FILE("refreshExpressionsRootContext.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("refreshExpressions.qml"));
+ QDeclarativeComponent component2(&engine, testFileUrl("refreshExpressionsRootContext.qml"));
QDeclarativeContext context(engine.rootContext());
QDeclarativeContext context2(engine.rootContext());
@@ -648,7 +638,7 @@ void tst_qdeclarativecontext::refreshExpressionsRootContext()
void tst_qdeclarativecontext::qtbug_22535()
{
QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, TEST_FILE("qtbug_22535.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("qtbug_22535.qml"));
QDeclarativeContext context(engine.rootContext());
QObject *o = component.create(&context);
diff --git a/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro b/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro
index 1908e6bae1..a8c8508891 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro
+++ b/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro
@@ -4,9 +4,11 @@ macx:CONFIG -= app_bundle
SOURCES += tst_qdeclarativeecmascript.cpp \
testtypes.cpp \
- ../../shared/testhttpserver.cpp
+ ../../shared/testhttpserver.cpp \
+ ../../shared/util.cpp
HEADERS += testtypes.h \
- ../../shared/testhttpserver.h
+ ../../shared/testhttpserver.h \
+ ../../shared/util.h
INCLUDEPATH += ../../shared
# QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage
diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
index 251b89dd87..8a028ae039 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
+++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
@@ -61,17 +61,8 @@ QML. This does not include static QML language issues.
Static QML language issues are covered in qmllanguage
*/
-inline QUrl TEST_FILE(const QString &filename)
-{
- return QUrl::fromLocalFile(TESTDATA(filename));
-}
-inline QUrl TEST_FILE(const char *filename)
-{
- return TEST_FILE(QLatin1String(filename));
-}
-
-class tst_qdeclarativeecmascript : public QObject
+class tst_qdeclarativeecmascript : public QDeclarativeDataTest
{
Q_OBJECT
public:
@@ -249,12 +240,16 @@ private:
QDeclarativeEngine engine;
};
-void tst_qdeclarativeecmascript::initTestCase() { registerTypes(); }
+void tst_qdeclarativeecmascript::initTestCase()
+{
+ QDeclarativeDataTest::initTestCase();
+ registerTypes();
+}
void tst_qdeclarativeecmascript::assignBasicTypes()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("assignBasicTypes.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("assignBasicTypes.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
QCOMPARE(object->flagProperty(), MyTypeObject::FlagVal1 | MyTypeObject::FlagVal3);
@@ -282,7 +277,7 @@ void tst_qdeclarativeecmascript::assignBasicTypes()
delete object;
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("assignBasicTypes.2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("assignBasicTypes.2.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
QCOMPARE(object->flagProperty(), MyTypeObject::FlagVal1 | MyTypeObject::FlagVal3);
@@ -314,7 +309,7 @@ void tst_qdeclarativeecmascript::assignBasicTypes()
void tst_qdeclarativeecmascript::idShortcutInvalidates()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("idShortcutInvalidates.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("idShortcutInvalidates.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(object != 0);
QVERIFY(object->objectProperty() != 0);
@@ -324,7 +319,7 @@ void tst_qdeclarativeecmascript::idShortcutInvalidates()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("idShortcutInvalidates.1.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("idShortcutInvalidates.1.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(object != 0);
QVERIFY(object->objectProperty() != 0);
@@ -337,14 +332,14 @@ void tst_qdeclarativeecmascript::idShortcutInvalidates()
void tst_qdeclarativeecmascript::boolPropertiesEvaluateAsBool()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("boolPropertiesEvaluateAsBool.1.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("boolPropertiesEvaluateAsBool.1.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(object != 0);
QCOMPARE(object->stringProperty(), QLatin1String("pass"));
delete object;
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("boolPropertiesEvaluateAsBool.2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("boolPropertiesEvaluateAsBool.2.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(object != 0);
QCOMPARE(object->stringProperty(), QLatin1String("pass"));
@@ -355,7 +350,7 @@ void tst_qdeclarativeecmascript::boolPropertiesEvaluateAsBool()
void tst_qdeclarativeecmascript::signalAssignment()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("signalAssignment.1.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("signalAssignment.1.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(object != 0);
QCOMPARE(object->string(), QString());
@@ -365,7 +360,7 @@ void tst_qdeclarativeecmascript::signalAssignment()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("signalAssignment.2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("signalAssignment.2.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(object != 0);
QCOMPARE(object->string(), QString());
@@ -378,7 +373,7 @@ void tst_qdeclarativeecmascript::signalAssignment()
void tst_qdeclarativeecmascript::methods()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("methods.1.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("methods.1.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(object != 0);
QCOMPARE(object->methodCalled(), false);
@@ -390,7 +385,7 @@ void tst_qdeclarativeecmascript::methods()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("methods.2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("methods.2.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(object != 0);
QCOMPARE(object->methodCalled(), false);
@@ -402,7 +397,7 @@ void tst_qdeclarativeecmascript::methods()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("methods.3.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("methods.3.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
QCOMPARE(object->property("test").toInt(), 19);
@@ -410,7 +405,7 @@ void tst_qdeclarativeecmascript::methods()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("methods.4.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("methods.4.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
QCOMPARE(object->property("test").toInt(), 19);
@@ -420,7 +415,7 @@ void tst_qdeclarativeecmascript::methods()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("methods.5.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("methods.5.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
QCOMPARE(object->property("test").toInt(), 9);
@@ -430,7 +425,7 @@ void tst_qdeclarativeecmascript::methods()
void tst_qdeclarativeecmascript::bindingLoop()
{
- QDeclarativeComponent component(&engine, TEST_FILE("bindingLoop.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("bindingLoop.qml"));
QString warning = component.url().toString() + ":5:9: QML MyQmlObject: Binding loop detected for property \"stringProperty\"";
QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData());
QObject *object = component.create();
@@ -639,7 +634,7 @@ void tst_qdeclarativeecmascript::objectPropertiesTriggerReeval()
void tst_qdeclarativeecmascript::deferredProperties()
{
- QDeclarativeComponent component(&engine, TEST_FILE("deferredProperties.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("deferredProperties.qml"));
MyDeferredObject *object =
qobject_cast<MyDeferredObject *>(component.create());
QVERIFY(object != 0);
@@ -662,7 +657,7 @@ void tst_qdeclarativeecmascript::deferredProperties()
// Check errors on deferred properties are correctly emitted
void tst_qdeclarativeecmascript::deferredPropertiesErrors()
{
- QDeclarativeComponent component(&engine, TEST_FILE("deferredPropertiesErrors.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("deferredPropertiesErrors.qml"));
MyDeferredObject *object =
qobject_cast<MyDeferredObject *>(component.create());
QVERIFY(object != 0);
@@ -680,7 +675,7 @@ void tst_qdeclarativeecmascript::deferredPropertiesErrors()
void tst_qdeclarativeecmascript::extensionObjects()
{
- QDeclarativeComponent component(&engine, TEST_FILE("extensionObjects.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("extensionObjects.qml"));
MyExtendedObject *object =
qobject_cast<MyExtendedObject *>(component.create());
QVERIFY(object != 0);
@@ -705,7 +700,7 @@ void tst_qdeclarativeecmascript::extensionObjects()
void tst_qdeclarativeecmascript::overrideExtensionProperties()
{
- QDeclarativeComponent component(&engine, TEST_FILE("extensionObjectsPropertyOverride.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("extensionObjectsPropertyOverride.qml"));
OverrideDefaultPropertyObject *object =
qobject_cast<OverrideDefaultPropertyObject *>(component.create());
QVERIFY(object != 0);
@@ -718,7 +713,7 @@ void tst_qdeclarativeecmascript::overrideExtensionProperties()
void tst_qdeclarativeecmascript::attachedProperties()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("attachedProperty.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("attachedProperty.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
QCOMPARE(object->property("a").toInt(), 19);
@@ -729,7 +724,7 @@ void tst_qdeclarativeecmascript::attachedProperties()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("attachedProperty.2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("attachedProperty.2.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
QCOMPARE(object->property("a").toInt(), 26);
@@ -741,7 +736,7 @@ void tst_qdeclarativeecmascript::attachedProperties()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("writeAttachedProperty.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("writeAttachedProperty.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -760,7 +755,7 @@ void tst_qdeclarativeecmascript::enums()
{
// Existent enums
{
- QDeclarativeComponent component(&engine, TEST_FILE("enums.1.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("enums.1.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -779,7 +774,7 @@ void tst_qdeclarativeecmascript::enums()
}
// Non-existent enums
{
- QDeclarativeComponent component(&engine, TEST_FILE("enums.2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("enums.2.qml"));
QString warning1 = component.url().toString() + ":5: Unable to assign [undefined] to int";
QString warning2 = component.url().toString() + ":6: Unable to assign [undefined] to int";
@@ -797,7 +792,7 @@ void tst_qdeclarativeecmascript::enums()
void tst_qdeclarativeecmascript::valueTypeFunctions()
{
- QDeclarativeComponent component(&engine, TEST_FILE("valueTypeFunctions.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("valueTypeFunctions.qml"));
MyTypeObject *obj = qobject_cast<MyTypeObject*>(component.create());
QVERIFY(obj != 0);
QCOMPARE(obj->rectProperty(), QRect(0,0,100,100));
@@ -814,7 +809,7 @@ void tst_qdeclarativeecmascript::constantsOverrideBindings()
{
// From ECMAScript
{
- QDeclarativeComponent component(&engine, TEST_FILE("constantsOverrideBindings.1.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("constantsOverrideBindings.1.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(object != 0);
@@ -833,7 +828,7 @@ void tst_qdeclarativeecmascript::constantsOverrideBindings()
// During construction
{
- QDeclarativeComponent component(&engine, TEST_FILE("constantsOverrideBindings.2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("constantsOverrideBindings.2.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(object != 0);
@@ -849,7 +844,7 @@ void tst_qdeclarativeecmascript::constantsOverrideBindings()
#if 0
// From C++
{
- QDeclarativeComponent component(&engine, TEST_FILE("constantsOverrideBindings.3.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("constantsOverrideBindings.3.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(object != 0);
@@ -869,7 +864,7 @@ void tst_qdeclarativeecmascript::constantsOverrideBindings()
// Using an alias
{
- QDeclarativeComponent component(&engine, TEST_FILE("constantsOverrideBindings.4.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("constantsOverrideBindings.4.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(object != 0);
@@ -890,7 +885,7 @@ the original binding to be disabled.
void tst_qdeclarativeecmascript::outerBindingOverridesInnerBinding()
{
QDeclarativeComponent component(&engine,
- TEST_FILE("outerBindingOverridesInnerBinding.qml"));
+ testFileUrl("outerBindingOverridesInnerBinding.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(object != 0);
@@ -918,7 +913,7 @@ Tests for a regression where this used to crash.
*/
void tst_qdeclarativeecmascript::nonExistentAttachedObject()
{
- QDeclarativeComponent component(&engine, TEST_FILE("nonExistentAttachedObject.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("nonExistentAttachedObject.qml"));
QString warning = component.url().toString() + ":4: Unable to assign [undefined] to QString";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
@@ -932,7 +927,7 @@ void tst_qdeclarativeecmascript::nonExistentAttachedObject()
void tst_qdeclarativeecmascript::scope()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("scope.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("scope.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -951,7 +946,7 @@ void tst_qdeclarativeecmascript::scope()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("scope.2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("scope.2.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -966,7 +961,7 @@ void tst_qdeclarativeecmascript::scope()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("scope.3.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("scope.3.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -979,7 +974,7 @@ void tst_qdeclarativeecmascript::scope()
// Signal argument scope
{
- QDeclarativeComponent component(&engine, TEST_FILE("scope.4.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("scope.4.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(object != 0);
@@ -995,7 +990,7 @@ void tst_qdeclarativeecmascript::scope()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("scope.5.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("scope.5.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -1006,7 +1001,7 @@ void tst_qdeclarativeecmascript::scope()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("scope.6.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("scope.6.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -1020,7 +1015,7 @@ void tst_qdeclarativeecmascript::scope()
// importing context
void tst_qdeclarativeecmascript::importScope()
{
- QDeclarativeComponent component(&engine, TEST_FILE("importScope.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("importScope.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
@@ -1035,7 +1030,7 @@ is essentially a test of QDeclarativeMetaType::copy()
*/
void tst_qdeclarativeecmascript::signalParameterTypes()
{
- QDeclarativeComponent component(&engine, TEST_FILE("signalParameterTypes.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("signalParameterTypes.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(object != 0);
@@ -1056,7 +1051,7 @@ Test that two JS objects for the same QObject compare as equal.
*/
void tst_qdeclarativeecmascript::objectsCompareAsEqual()
{
- QDeclarativeComponent component(&engine, TEST_FILE("objectsCompareAsEqual.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("objectsCompareAsEqual.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -1076,7 +1071,7 @@ Tests for a regression where the binding would not reevaluate.
*/
void tst_qdeclarativeecmascript::aliasPropertyAndBinding()
{
- QDeclarativeComponent component(&engine, TEST_FILE("aliasPropertyAndBinding.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("aliasPropertyAndBinding.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -1100,7 +1095,7 @@ void tst_qdeclarativeecmascript::aliasPropertyReset()
QObject *object = 0;
// test that a manual write (of undefined) to a resettable aliased property succeeds
- QDeclarativeComponent c1(&engine, TEST_FILE("aliasreset/aliasPropertyReset.1.qml"));
+ QDeclarativeComponent c1(&engine, testFileUrl("aliasreset/aliasPropertyReset.1.qml"));
object = c1.create();
QVERIFY(object != 0);
QVERIFY(object->property("sourceComponentAlias").value<QDeclarativeComponent*>() != 0);
@@ -1111,7 +1106,7 @@ void tst_qdeclarativeecmascript::aliasPropertyReset()
delete object;
// test that a manual write (of undefined) to a resettable alias property succeeds
- QDeclarativeComponent c2(&engine, TEST_FILE("aliasreset/aliasPropertyReset.2.qml"));
+ QDeclarativeComponent c2(&engine, testFileUrl("aliasreset/aliasPropertyReset.2.qml"));
object = c2.create();
QVERIFY(object != 0);
QVERIFY(object->property("sourceComponentAlias").value<QDeclarativeComponent*>() != 0);
@@ -1122,7 +1117,7 @@ void tst_qdeclarativeecmascript::aliasPropertyReset()
delete object;
// test that an alias to a bound property works correctly
- QDeclarativeComponent c3(&engine, TEST_FILE("aliasreset/aliasPropertyReset.3.qml"));
+ QDeclarativeComponent c3(&engine, testFileUrl("aliasreset/aliasPropertyReset.3.qml"));
object = c3.create();
QVERIFY(object != 0);
QVERIFY(object->property("sourceComponentAlias").value<QDeclarativeComponent*>() != 0);
@@ -1136,7 +1131,7 @@ void tst_qdeclarativeecmascript::aliasPropertyReset()
// test that a manual write (of undefined) to a resettable alias property
// whose aliased property's object has been deleted, does not crash.
- QDeclarativeComponent c4(&engine, TEST_FILE("aliasreset/aliasPropertyReset.4.qml"));
+ QDeclarativeComponent c4(&engine, testFileUrl("aliasreset/aliasPropertyReset.4.qml"));
object = c4.create();
QVERIFY(object != 0);
QVERIFY(object->property("sourceComponentAlias").value<QDeclarativeComponent*>() != 0);
@@ -1151,14 +1146,14 @@ void tst_qdeclarativeecmascript::aliasPropertyReset()
delete object;
// test that binding an alias property to an undefined value works correctly
- QDeclarativeComponent c5(&engine, TEST_FILE("aliasreset/aliasPropertyReset.5.qml"));
+ QDeclarativeComponent c5(&engine, testFileUrl("aliasreset/aliasPropertyReset.5.qml"));
object = c5.create();
QVERIFY(object != 0);
QVERIFY(object->property("sourceComponentAlias").value<QDeclarativeComponent*>() == 0); // bound to undefined value.
delete object;
// test that a manual write (of undefined) to a non-resettable property fails properly
- QUrl url = TEST_FILE("aliasreset/aliasPropertyReset.error.1.qml");
+ QUrl url = testFileUrl("aliasreset/aliasPropertyReset.error.1.qml");
QString warning1 = url.toString() + QLatin1String(":15: Error: Cannot assign [undefined] to int");
QDeclarativeComponent e1(&engine, url);
object = e1.create();
@@ -1191,7 +1186,7 @@ void tst_qdeclarativeecmascript::dynamicCreation()
QFETCH(QString, method);
QFETCH(QString, createdName);
- QDeclarativeComponent component(&engine, TEST_FILE("dynamicCreation.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("dynamicCreation.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create());
QVERIFY(object != 0);
@@ -1209,7 +1204,7 @@ void tst_qdeclarativeecmascript::dynamicCreation()
void tst_qdeclarativeecmascript::dynamicDestruction()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("dynamicDeletion.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("dynamicDeletion.qml"));
QDeclarativeGuard<MyQmlObject> object = qobject_cast<MyQmlObject*>(component.create());
QVERIFY(object != 0);
QDeclarativeGuard<QObject> createdQmlObject = 0;
@@ -1240,7 +1235,7 @@ void tst_qdeclarativeecmascript::dynamicDestruction()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("dynamicDeletion.2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("dynamicDeletion.2.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
@@ -1265,7 +1260,7 @@ void tst_qdeclarativeecmascript::dynamicDestruction()
*/
void tst_qdeclarativeecmascript::objectToString()
{
- QDeclarativeComponent component(&engine, TEST_FILE("declarativeToString.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("declarativeToString.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create());
QVERIFY(object != 0);
QMetaObject::invokeMethod(object, "testToString");
@@ -1280,7 +1275,7 @@ void tst_qdeclarativeecmascript::objectToString()
*/
void tst_qdeclarativeecmascript::objectHasOwnProperty()
{
- QUrl url = TEST_FILE("declarativeHasOwnProperty.qml");
+ QUrl url = testFileUrl("declarativeHasOwnProperty.qml");
QString warning1 = url.toString() + ":59: TypeError: Cannot call method 'hasOwnProperty' of undefined";
QString warning2 = url.toString() + ":64: TypeError: Cannot call method 'hasOwnProperty' of undefined";
QString warning3 = url.toString() + ":69: TypeError: Cannot call method 'hasOwnProperty' of undefined";
@@ -1332,7 +1327,7 @@ This test is best run under valgrind to ensure no invalid memory access occur.
void tst_qdeclarativeecmascript::selfDeletingBinding()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("selfDeletingBinding.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("selfDeletingBinding.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
object->setProperty("triggerDelete", true);
@@ -1340,7 +1335,7 @@ void tst_qdeclarativeecmascript::selfDeletingBinding()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("selfDeletingBinding.2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("selfDeletingBinding.2.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
object->setProperty("triggerDelete", true);
@@ -1357,7 +1352,7 @@ and no synthesiszed properties).
*/
void tst_qdeclarativeecmascript::extendedObjectPropertyLookup()
{
- QDeclarativeComponent component(&engine, TEST_FILE("extendedObjectPropertyLookup.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("extendedObjectPropertyLookup.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
delete object;
@@ -1368,7 +1363,7 @@ Test that extended object properties can be accessed correctly.
*/
void tst_qdeclarativeecmascript::extendedObjectPropertyLookup2()
{
- QDeclarativeComponent component(&engine, TEST_FILE("extendedObjectPropertyLookup2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("extendedObjectPropertyLookup2.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -1383,7 +1378,7 @@ Test file/lineNumbers for binding/Script errors.
*/
void tst_qdeclarativeecmascript::scriptErrors()
{
- QDeclarativeComponent component(&engine, TEST_FILE("scriptErrors.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("scriptErrors.qml"));
QString url = component.url().toString();
QString warning1 = url.left(url.length() - 3) + "js:2: Error: Invalid write to global property \"a\"";
@@ -1420,7 +1415,7 @@ Test file/lineNumbers for inline functions.
*/
void tst_qdeclarativeecmascript::functionErrors()
{
- QDeclarativeComponent component(&engine, TEST_FILE("functionErrors.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("functionErrors.qml"));
QString url = component.url().toString();
QString warning = url + ":5: Error: Invalid write to global property \"a\"";
@@ -1432,7 +1427,7 @@ void tst_qdeclarativeecmascript::functionErrors()
delete object;
// test that if an exception occurs while invoking js function from cpp, it is reported as expected.
- QDeclarativeComponent componentTwo(&engine, TEST_FILE("scarceResourceFunctionFail.var.qml"));
+ QDeclarativeComponent componentTwo(&engine, testFileUrl("scarceResourceFunctionFail.var.qml"));
url = componentTwo.url().toString();
object = componentTwo.create();
QVERIFY(object != 0);
@@ -1451,7 +1446,7 @@ Test various errors that can occur when assigning a property from script
*/
void tst_qdeclarativeecmascript::propertyAssignmentErrors()
{
- QDeclarativeComponent component(&engine, TEST_FILE("propertyAssignmentErrors.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("propertyAssignmentErrors.qml"));
QString url = component.url().toString();
@@ -1470,7 +1465,7 @@ a signal script.
*/
void tst_qdeclarativeecmascript::signalTriggeredBindings()
{
- QDeclarativeComponent component(&engine, TEST_FILE("signalTriggeredBindings.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("signalTriggeredBindings.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create());
QVERIFY(object != 0);
@@ -1498,7 +1493,7 @@ Test that list properties can be iterated from ECMAScript
*/
void tst_qdeclarativeecmascript::listProperties()
{
- QDeclarativeComponent component(&engine, TEST_FILE("listProperties.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("listProperties.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create());
QVERIFY(object != 0);
@@ -1512,7 +1507,7 @@ void tst_qdeclarativeecmascript::listProperties()
void tst_qdeclarativeecmascript::exceptionClearsOnReeval()
{
- QDeclarativeComponent component(&engine, TEST_FILE("exceptionClearsOnReeval.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("exceptionClearsOnReeval.qml"));
QString url = component.url().toString();
QString warning = url + ":4: TypeError: Cannot read property 'objectProperty' of null";
@@ -1535,7 +1530,7 @@ void tst_qdeclarativeecmascript::exceptionClearsOnReeval()
void tst_qdeclarativeecmascript::exceptionSlotProducesWarning()
{
- QDeclarativeComponent component(&engine, TEST_FILE("exceptionProducesWarning.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("exceptionProducesWarning.qml"));
QString url = component.url().toString();
QString warning = component.url().toString() + ":6: Error: JS exception";
@@ -1548,7 +1543,7 @@ void tst_qdeclarativeecmascript::exceptionSlotProducesWarning()
void tst_qdeclarativeecmascript::exceptionBindingProducesWarning()
{
- QDeclarativeComponent component(&engine, TEST_FILE("exceptionProducesWarning2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("exceptionProducesWarning2.qml"));
QString url = component.url().toString();
QString warning = component.url().toString() + ":5: Error: JS exception";
@@ -1569,7 +1564,7 @@ static void transientErrorsMsgHandler(QtMsgType, const char *)
void tst_qdeclarativeecmascript::transientErrors()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("transientErrors.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("transientErrors.qml"));
transientErrorsMsgCount = 0;
QtMsgHandler old = qInstallMsgHandler(transientErrorsMsgHandler);
@@ -1586,7 +1581,7 @@ void tst_qdeclarativeecmascript::transientErrors()
// One binding erroring multiple times, but then resolving
{
- QDeclarativeComponent component(&engine, TEST_FILE("transientErrors.2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("transientErrors.2.qml"));
transientErrorsMsgCount = 0;
QtMsgHandler old = qInstallMsgHandler(transientErrorsMsgHandler);
@@ -1605,7 +1600,7 @@ void tst_qdeclarativeecmascript::transientErrors()
// Check that errors during shutdown are minimized
void tst_qdeclarativeecmascript::shutdownErrors()
{
- QDeclarativeComponent component(&engine, TEST_FILE("shutdownErrors.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("shutdownErrors.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -1620,7 +1615,7 @@ void tst_qdeclarativeecmascript::shutdownErrors()
void tst_qdeclarativeecmascript::compositePropertyType()
{
- QDeclarativeComponent component(&engine, TEST_FILE("compositePropertyType.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("compositePropertyType.qml"));
QTest::ignoreMessage(QtDebugMsg, "hello world");
QObject *object = qobject_cast<QObject *>(component.create());
@@ -1630,7 +1625,7 @@ void tst_qdeclarativeecmascript::compositePropertyType()
// QTBUG-5759
void tst_qdeclarativeecmascript::jsObject()
{
- QDeclarativeComponent component(&engine, TEST_FILE("jsObject.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("jsObject.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -1642,7 +1637,7 @@ void tst_qdeclarativeecmascript::jsObject()
void tst_qdeclarativeecmascript::undefinedResetsProperty()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("undefinedResetsProperty.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("undefinedResetsProperty.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -1659,7 +1654,7 @@ void tst_qdeclarativeecmascript::undefinedResetsProperty()
delete object;
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("undefinedResetsProperty.2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("undefinedResetsProperty.2.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -1676,7 +1671,7 @@ void tst_qdeclarativeecmascript::undefinedResetsProperty()
// Aliases to variant properties should work
void tst_qdeclarativeecmascript::qtbug_22464()
{
- QDeclarativeComponent component(&engine, TEST_FILE("qtbug_22464.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("qtbug_22464.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -1687,7 +1682,7 @@ void tst_qdeclarativeecmascript::qtbug_22464()
void tst_qdeclarativeecmascript::qtbug_21580()
{
- QDeclarativeComponent component(&engine, TEST_FILE("qtbug_21580.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("qtbug_21580.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -1700,7 +1695,7 @@ void tst_qdeclarativeecmascript::qtbug_21580()
// QTBUG-6781
void tst_qdeclarativeecmascript::bug1()
{
- QDeclarativeComponent component(&engine, TEST_FILE("bug.1.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("bug.1.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -1731,7 +1726,7 @@ void tst_qdeclarativeecmascript::bug2()
// Don't crash in createObject when the component has errors.
void tst_qdeclarativeecmascript::dynamicCreationCrash()
{
- QDeclarativeComponent component(&engine, TEST_FILE("dynamicCreation.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("dynamicCreation.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create());
QVERIFY(object != 0);
@@ -1752,7 +1747,7 @@ void tst_qdeclarativeecmascript::dynamicCreationOwnership()
// allow the engine to go out of scope too.
{
QDeclarativeEngine dcoEngine;
- QDeclarativeComponent component(&dcoEngine, TEST_FILE("dynamicCreationOwnership.qml"));
+ QDeclarativeComponent component(&dcoEngine, testFileUrl("dynamicCreationOwnership.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
MyDynamicCreationDestructionObject *mdcdo = object->findChild<MyDynamicCreationDestructionObject*>("mdcdo");
@@ -1780,7 +1775,7 @@ void tst_qdeclarativeecmascript::dynamicCreationOwnership()
//QTBUG-9367
void tst_qdeclarativeecmascript::regExpBug()
{
- QDeclarativeComponent component(&engine, TEST_FILE("regExp.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("regExp.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create());
QVERIFY(object != 0);
QCOMPARE(object->regExp().pattern(), QLatin1String("[a-zA-z]"));
@@ -2312,7 +2307,7 @@ void tst_qdeclarativeecmascript::callQtInvokables()
// QTBUG-13047 (check that you can pass registered object types as args)
void tst_qdeclarativeecmascript::invokableObjectArg()
{
- QDeclarativeComponent component(&engine, TEST_FILE("invokableObjectArg.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("invokableObjectArg.qml"));
QObject *o = component.create();
QVERIFY(o);
@@ -2326,7 +2321,7 @@ void tst_qdeclarativeecmascript::invokableObjectArg()
// QTBUG-13047 (check that you can return registered object types from methods)
void tst_qdeclarativeecmascript::invokableObjectRet()
{
- QDeclarativeComponent component(&engine, TEST_FILE("invokableObjectRet.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("invokableObjectRet.qml"));
QObject *o = component.create();
QVERIFY(o);
@@ -2337,7 +2332,7 @@ void tst_qdeclarativeecmascript::invokableObjectRet()
// QTBUG-5675
void tst_qdeclarativeecmascript::listToVariant()
{
- QDeclarativeComponent component(&engine, TEST_FILE("listToVariant.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("listToVariant.qml"));
MyQmlContainer container;
@@ -2358,7 +2353,7 @@ void tst_qdeclarativeecmascript::listToVariant()
Q_DECLARE_METATYPE(QDeclarativeListProperty<MyQmlObject>)
void tst_qdeclarativeecmascript::listAssignment()
{
- QDeclarativeComponent component(&engine, TEST_FILE("listAssignment.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("listAssignment.qml"));
QObject *obj = component.create();
QCOMPARE(obj->property("list1length").toInt(), 2);
QDeclarativeListProperty<MyQmlObject> list1 = obj->property("list1").value<QDeclarativeListProperty<MyQmlObject> >();
@@ -2377,11 +2372,11 @@ void tst_qdeclarativeecmascript::multiEngineObject()
QDeclarativeEngine e1;
e1.rootContext()->setContextProperty("thing", &obj);
- QDeclarativeComponent c1(&e1, TEST_FILE("multiEngineObject.qml"));
+ QDeclarativeComponent c1(&e1, testFileUrl("multiEngineObject.qml"));
QDeclarativeEngine e2;
e2.rootContext()->setContextProperty("thing", &obj);
- QDeclarativeComponent c2(&e2, TEST_FILE("multiEngineObject.qml"));
+ QDeclarativeComponent c2(&e2, testFileUrl("multiEngineObject.qml"));
QObject *o1 = c1.create();
QObject *o2 = c2.create();
@@ -2396,7 +2391,7 @@ void tst_qdeclarativeecmascript::multiEngineObject()
// Test that references to QObjects are cleanup when the object is destroyed
void tst_qdeclarativeecmascript::deletedObject()
{
- QDeclarativeComponent component(&engine, TEST_FILE("deletedObject.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("deletedObject.qml"));
QObject *object = component.create();
@@ -2410,7 +2405,7 @@ void tst_qdeclarativeecmascript::deletedObject()
void tst_qdeclarativeecmascript::attachedPropertyScope()
{
- QDeclarativeComponent component(&engine, TEST_FILE("attachedPropertyScope.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("attachedPropertyScope.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -2431,7 +2426,7 @@ void tst_qdeclarativeecmascript::attachedPropertyScope()
void tst_qdeclarativeecmascript::scriptConnect()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("scriptConnect.1.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("scriptConnect.1.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(object != 0);
@@ -2444,7 +2439,7 @@ void tst_qdeclarativeecmascript::scriptConnect()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("scriptConnect.2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("scriptConnect.2.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(object != 0);
@@ -2457,7 +2452,7 @@ void tst_qdeclarativeecmascript::scriptConnect()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("scriptConnect.3.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("scriptConnect.3.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(object != 0);
@@ -2470,7 +2465,7 @@ void tst_qdeclarativeecmascript::scriptConnect()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("scriptConnect.4.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("scriptConnect.4.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(object != 0);
@@ -2483,7 +2478,7 @@ void tst_qdeclarativeecmascript::scriptConnect()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("scriptConnect.5.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("scriptConnect.5.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(object != 0);
@@ -2496,7 +2491,7 @@ void tst_qdeclarativeecmascript::scriptConnect()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("scriptConnect.6.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("scriptConnect.6.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(object != 0);
@@ -2512,7 +2507,7 @@ void tst_qdeclarativeecmascript::scriptConnect()
void tst_qdeclarativeecmascript::scriptDisconnect()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("scriptDisconnect.1.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("scriptDisconnect.1.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(object != 0);
@@ -2531,7 +2526,7 @@ void tst_qdeclarativeecmascript::scriptDisconnect()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("scriptDisconnect.2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("scriptDisconnect.2.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(object != 0);
@@ -2550,7 +2545,7 @@ void tst_qdeclarativeecmascript::scriptDisconnect()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("scriptDisconnect.3.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("scriptDisconnect.3.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(object != 0);
@@ -2568,7 +2563,7 @@ void tst_qdeclarativeecmascript::scriptDisconnect()
delete object;
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("scriptDisconnect.4.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("scriptDisconnect.4.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(object != 0);
@@ -2606,7 +2601,7 @@ void tst_qdeclarativeecmascript::ownership()
context->setContextObject(&own);
{
- QDeclarativeComponent component(&engine, TEST_FILE("ownership.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("ownership.qml"));
QVERIFY(own.object != 0);
@@ -2624,7 +2619,7 @@ void tst_qdeclarativeecmascript::ownership()
own.object = new QObject(&own);
{
- QDeclarativeComponent component(&engine, TEST_FILE("ownership.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("ownership.qml"));
QVERIFY(own.object != 0);
@@ -2747,7 +2742,7 @@ void tst_qdeclarativeecmascript::qlistqobjectMethods()
QDeclarativeContext *context = new QDeclarativeContext(engine.rootContext());
context->setContextObject(&obj);
- QDeclarativeComponent component(&engine, TEST_FILE("qlistqobjectMethods.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("qlistqobjectMethods.qml"));
QObject *object = component.create(context);
@@ -2761,7 +2756,7 @@ void tst_qdeclarativeecmascript::qlistqobjectMethods()
// QTBUG-9205
void tst_qdeclarativeecmascript::strictlyEquals()
{
- QDeclarativeComponent component(&engine, TEST_FILE("strictlyEquals.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("strictlyEquals.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -2780,7 +2775,7 @@ void tst_qdeclarativeecmascript::strictlyEquals()
void tst_qdeclarativeecmascript::compiled()
{
- QDeclarativeComponent component(&engine, TEST_FILE("compiled.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("compiled.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -2820,7 +2815,7 @@ void tst_qdeclarativeecmascript::compiled()
// Test that numbers assigned in bindings as strings work consistently
void tst_qdeclarativeecmascript::numberAssignment()
{
- QDeclarativeComponent component(&engine, TEST_FILE("numberAssignment.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("numberAssignment.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -2846,7 +2841,7 @@ void tst_qdeclarativeecmascript::numberAssignment()
void tst_qdeclarativeecmascript::propertySplicing()
{
- QDeclarativeComponent component(&engine, TEST_FILE("propertySplicing.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("propertySplicing.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -2859,7 +2854,7 @@ void tst_qdeclarativeecmascript::propertySplicing()
// QTBUG-16683
void tst_qdeclarativeecmascript::signalWithUnknownTypes()
{
- QDeclarativeComponent component(&engine, TEST_FILE("signalWithUnknownTypes.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("signalWithUnknownTypes.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(object != 0);
@@ -2907,7 +2902,7 @@ void tst_qdeclarativeecmascript::signalWithJSValueInVariant()
QFETCH(QString, expression);
QFETCH(QString, compare);
- QDeclarativeComponent component(&engine, TEST_FILE("signalWithJSValueInVariant.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("signalWithJSValueInVariant.qml"));
QScopedPointer<MyQmlObject> object(qobject_cast<MyQmlObject *>(component.create()));
QVERIFY(object != 0);
@@ -2931,7 +2926,7 @@ void tst_qdeclarativeecmascript::signalWithJSValueInVariant_twoEngines()
QFETCH(QString, expression);
QFETCH(QString, compare);
- QDeclarativeComponent component(&engine, TEST_FILE("signalWithJSValueInVariant.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("signalWithJSValueInVariant.qml"));
QScopedPointer<MyQmlObject> object(qobject_cast<MyQmlObject *>(component.create()));
QVERIFY(object != 0);
@@ -2957,7 +2952,7 @@ void tst_qdeclarativeecmascript::signalWithQJSValue()
QFETCH(QString, expression);
QFETCH(QString, compare);
- QDeclarativeComponent component(&engine, TEST_FILE("signalWithQJSValue.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("signalWithQJSValue.qml"));
QScopedPointer<MyQmlObject> object(qobject_cast<MyQmlObject *>(component.create()));
QVERIFY(object != 0);
@@ -2986,7 +2981,7 @@ void tst_qdeclarativeecmascript::moduleApi_data()
QTest::addColumn<QVariantList>("readBackExpectedValues");
QTest::newRow("qobject, register + read + method")
- << TEST_FILE("moduleapi/qobjectModuleApi.qml")
+ << testFileUrl("moduleapi/qobjectModuleApi.qml")
<< QString()
<< QStringList()
<< (QStringList() << "existingUriTest" << "qobjectTest" << "qobjectMethodTest"
@@ -2998,7 +2993,7 @@ void tst_qdeclarativeecmascript::moduleApi_data()
<< QVariantList();
QTest::newRow("script, register + read")
- << TEST_FILE("moduleapi/scriptModuleApi.qml")
+ << testFileUrl("moduleapi/scriptModuleApi.qml")
<< QString()
<< QStringList()
<< (QStringList() << "scriptTest")
@@ -3009,7 +3004,7 @@ void tst_qdeclarativeecmascript::moduleApi_data()
<< QVariantList();
QTest::newRow("qobject, caching + read")
- << TEST_FILE("moduleapi/qobjectModuleApiCaching.qml")
+ << testFileUrl("moduleapi/qobjectModuleApiCaching.qml")
<< QString()
<< QStringList()
<< (QStringList() << "existingUriTest" << "qobjectParentedTest")
@@ -3020,7 +3015,7 @@ void tst_qdeclarativeecmascript::moduleApi_data()
<< QVariantList();
QTest::newRow("script, caching + read")
- << TEST_FILE("moduleapi/scriptModuleApiCaching.qml")
+ << testFileUrl("moduleapi/scriptModuleApiCaching.qml")
<< QString()
<< QStringList()
<< (QStringList() << "scriptTest")
@@ -3031,9 +3026,9 @@ void tst_qdeclarativeecmascript::moduleApi_data()
<< QVariantList();
QTest::newRow("qobject, writing + readonly constraints")
- << TEST_FILE("moduleapi/qobjectModuleApiWriting.qml")
+ << testFileUrl("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() << QString(QLatin1String("file://") + testFileUrl("moduleapi/qobjectModuleApiWriting.qml").toLocalFile() + QLatin1String(":14: Error: Cannot assign to read-only property \"qobjectTestProperty\"")))
<< (QStringList() << "readOnlyProperty" << "writableProperty")
<< (QVariantList() << 20 << 50)
<< (QStringList() << "firstProperty" << "writableProperty")
@@ -3042,9 +3037,9 @@ void tst_qdeclarativeecmascript::moduleApi_data()
<< (QVariantList() << 20 << 30);
QTest::newRow("script, writing + readonly constraints")
- << TEST_FILE("moduleapi/scriptModuleApiWriting.qml")
+ << testFileUrl("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() << QString(QLatin1String("file://") + testFileUrl("moduleapi/scriptModuleApiWriting.qml").toLocalFile() + QLatin1String(":21: Error: Cannot assign to read-only property \"scriptTestProperty\"")))
<< (QStringList() << "readBack" << "unchanged")
<< (QVariantList() << 13 << 42)
<< (QStringList() << "firstProperty" << "secondProperty")
@@ -3053,7 +3048,7 @@ void tst_qdeclarativeecmascript::moduleApi_data()
<< (QVariantList() << 30 << 42);
QTest::newRow("qobject module API enum values in JS")
- << TEST_FILE("moduleapi/qobjectModuleApiEnums.qml")
+ << testFileUrl("moduleapi/qobjectModuleApiEnums.qml")
<< QString()
<< QStringList()
<< (QStringList() << "enumValue" << "enumMethod")
@@ -3064,7 +3059,7 @@ void tst_qdeclarativeecmascript::moduleApi_data()
<< QVariantList();
QTest::newRow("qobject, invalid major version fail")
- << TEST_FILE("moduleapi/moduleApiMajorVersionFail.qml")
+ << testFileUrl("moduleapi/moduleApiMajorVersionFail.qml")
<< QString("QDeclarativeComponent: Component is not ready")
<< QStringList()
<< QStringList()
@@ -3075,7 +3070,7 @@ void tst_qdeclarativeecmascript::moduleApi_data()
<< QVariantList();
QTest::newRow("qobject, invalid minor version fail")
- << TEST_FILE("moduleapi/moduleApiMinorVersionFail.qml")
+ << testFileUrl("moduleapi/moduleApiMinorVersionFail.qml")
<< QString("QDeclarativeComponent: Component is not ready")
<< QStringList()
<< QStringList()
@@ -3131,7 +3126,7 @@ void tst_qdeclarativeecmascript::importScripts_data()
QTest::addColumn<QVariantList>("propertyValues");
QTest::newRow("basic functionality")
- << TEST_FILE("jsimport/testImport.qml")
+ << testFileUrl("jsimport/testImport.qml")
<< QString()
<< QStringList()
<< (QStringList() << QLatin1String("importedScriptStringValue")
@@ -3144,71 +3139,71 @@ void tst_qdeclarativeecmascript::importScripts_data()
<< QVariant(2));
QTest::newRow("import scoping")
- << TEST_FILE("jsimport/testImportScoping.qml")
+ << testFileUrl("jsimport/testImportScoping.qml")
<< QString()
<< QStringList()
<< (QStringList() << QLatin1String("componentError"))
<< (QVariantList() << QVariant(5));
QTest::newRow("parent scope shouldn't be inherited by import with imports")
- << TEST_FILE("jsimportfail/failOne.qml")
+ << testFileUrl("jsimportfail/failOne.qml")
<< QString()
- << (QStringList() << QString(QLatin1String("file://") + TEST_FILE("jsimportfail/failOne.qml").toLocalFile() + QLatin1String(":6: TypeError: Cannot call method 'greetingString' of undefined")))
+ << (QStringList() << QString(QLatin1String("file://") + testFileUrl("jsimportfail/failOne.qml").toLocalFile() + QLatin1String(":6: TypeError: Cannot call method 'greetingString' of undefined")))
<< (QStringList() << QLatin1String("importScriptFunctionValue"))
<< (QVariantList() << QVariant(QString()));
QTest::newRow("javascript imports in an import should be private to the import scope")
- << TEST_FILE("jsimportfail/failTwo.qml")
+ << testFileUrl("jsimportfail/failTwo.qml")
<< QString()
- << (QStringList() << QString(QLatin1String("file://") + TEST_FILE("jsimportfail/failTwo.qml").toLocalFile() + QLatin1String(":6: ReferenceError: Can't find variable: ImportOneJs")))
+ << (QStringList() << QString(QLatin1String("file://") + testFileUrl("jsimportfail/failTwo.qml").toLocalFile() + QLatin1String(":6: ReferenceError: Can't find variable: ImportOneJs")))
<< (QStringList() << QLatin1String("importScriptFunctionValue"))
<< (QVariantList() << QVariant(QString()));
QTest::newRow("module imports in an import should be private to the import scope")
- << TEST_FILE("jsimportfail/failThree.qml")
+ << testFileUrl("jsimportfail/failThree.qml")
<< QString()
- << (QStringList() << QString(QLatin1String("file://") + TEST_FILE("jsimportfail/failThree.qml").toLocalFile() + QLatin1String(":7: TypeError: Cannot read property 'JsQtTest' of undefined")))
+ << (QStringList() << QString(QLatin1String("file://") + testFileUrl("jsimportfail/failThree.qml").toLocalFile() + QLatin1String(":7: TypeError: Cannot read property 'JsQtTest' of undefined")))
<< (QStringList() << QLatin1String("importedModuleAttachedPropertyValue"))
<< (QVariantList() << QVariant(false));
QTest::newRow("typenames in an import should be private to the import scope")
- << TEST_FILE("jsimportfail/failFour.qml")
+ << testFileUrl("jsimportfail/failFour.qml")
<< QString()
- << (QStringList() << QString(QLatin1String("file://") + TEST_FILE("jsimportfail/failFour.qml").toLocalFile() + QLatin1String(":6: ReferenceError: Can't find variable: JsQtTest")))
+ << (QStringList() << QString(QLatin1String("file://") + testFileUrl("jsimportfail/failFour.qml").toLocalFile() + QLatin1String(":6: ReferenceError: Can't find variable: JsQtTest")))
<< (QStringList() << QLatin1String("importedModuleEnumValue"))
<< (QVariantList() << QVariant(0));
QTest::newRow("import with imports has it's own activation scope")
- << TEST_FILE("jsimportfail/failFive.qml")
+ << testFileUrl("jsimportfail/failFive.qml")
<< QString()
- << (QStringList() << QString(QLatin1String("file://") + TEST_FILE("jsimportfail/importWithImports.js").toLocalFile() + QLatin1String(":8: ReferenceError: Can't find variable: Component"))
- << QString(QLatin1String("file://") + TEST_FILE("jsimportfail/importPragmaLibrary.js").toLocalFile() + QLatin1String(":6: ReferenceError: Can't find variable: Component")))
+ << (QStringList() << QString(QLatin1String("file://") + testFileUrl("jsimportfail/importWithImports.js").toLocalFile() + QLatin1String(":8: ReferenceError: Can't find variable: Component"))
+ << QString(QLatin1String("file://") + testFileUrl("jsimportfail/importPragmaLibrary.js").toLocalFile() + QLatin1String(":6: ReferenceError: Can't find variable: Component")))
<< (QStringList() << QLatin1String("componentError"))
<< (QVariantList() << QVariant(0));
QTest::newRow("import pragma library script")
- << TEST_FILE("jsimport/testImportPragmaLibrary.qml")
+ << testFileUrl("jsimport/testImportPragmaLibrary.qml")
<< QString()
<< QStringList()
<< (QStringList() << QLatin1String("testValue"))
<< (QVariantList() << QVariant(31));
QTest::newRow("pragma library imports shouldn't inherit parent imports or scope")
- << TEST_FILE("jsimportfail/testImportPragmaLibrary.qml")
+ << testFileUrl("jsimportfail/testImportPragmaLibrary.qml")
<< QString()
<< QStringList()
<< (QStringList() << QLatin1String("testValue"))
<< (QVariantList() << QVariant(0));
QTest::newRow("import pragma library script which has an import")
- << TEST_FILE("jsimport/testImportPragmaLibraryWithImports.qml")
+ << testFileUrl("jsimport/testImportPragmaLibraryWithImports.qml")
<< QString()
<< QStringList()
<< (QStringList() << QLatin1String("testValue"))
<< (QVariantList() << QVariant(55));
QTest::newRow("import pragma library script which has a pragma library import")
- << TEST_FILE("jsimport/testImportPragmaLibraryWithPragmaLibraryImports.qml")
+ << testFileUrl("jsimport/testImportPragmaLibraryWithPragmaLibraryImports.qml")
<< QString()
<< QStringList()
<< (QStringList() << QLatin1String("testValue"))
@@ -3259,7 +3254,7 @@ void tst_qdeclarativeecmascript::scarceResources_other()
/* property var semantics */
// test that scarce resources are handled properly in signal invocation
- QDeclarativeComponent varComponentTen(&engine, TEST_FILE("scarceResourceSignal.var.qml"));
+ QDeclarativeComponent varComponentTen(&engine, testFileUrl("scarceResourceSignal.var.qml"));
object = varComponentTen.create();
srsc = object->findChild<QObject*>("srsc");
QVERIFY(srsc);
@@ -3281,7 +3276,7 @@ void tst_qdeclarativeecmascript::scarceResources_other()
delete object;
// test that scarce resources are handled properly from js functions in qml files
- QDeclarativeComponent varComponentEleven(&engine, TEST_FILE("scarceResourceFunction.var.qml"));
+ QDeclarativeComponent varComponentEleven(&engine, testFileUrl("scarceResourceFunction.var.qml"));
object = varComponentEleven.create();
QVERIFY(object != 0);
QVERIFY(!object->property("scarceResourceCopy").isValid()); // not yet assigned, so should not be valid
@@ -3300,7 +3295,7 @@ void tst_qdeclarativeecmascript::scarceResources_other()
delete object;
// test that if an exception occurs while invoking js function from cpp, that the resources are released.
- QDeclarativeComponent varComponentTwelve(&engine, TEST_FILE("scarceResourceFunctionFail.var.qml"));
+ QDeclarativeComponent varComponentTwelve(&engine, testFileUrl("scarceResourceFunctionFail.var.qml"));
object = varComponentTwelve.create();
QVERIFY(object != 0);
QVERIFY(!object->property("scarceResourceCopy").isValid()); // not yet assigned, so should not be valid
@@ -3318,7 +3313,7 @@ void tst_qdeclarativeecmascript::scarceResources_other()
// test that if an Item which has JS ownership but has a scarce resource property is garbage collected,
// that the scarce resource is removed from the engine's list of scarce resources to clean up.
- QDeclarativeComponent varComponentThirteen(&engine, TEST_FILE("scarceResourceObjectGc.var.qml"));
+ QDeclarativeComponent varComponentThirteen(&engine, testFileUrl("scarceResourceObjectGc.var.qml"));
object = varComponentThirteen.create();
QVERIFY(object != 0);
QVERIFY(!object->property("varProperty").isValid()); // not assigned yet
@@ -3331,7 +3326,7 @@ void tst_qdeclarativeecmascript::scarceResources_other()
/* property variant semantics */
// test that scarce resources are handled properly in signal invocation
- QDeclarativeComponent variantComponentTen(&engine, TEST_FILE("scarceResourceSignal.variant.qml"));
+ QDeclarativeComponent variantComponentTen(&engine, testFileUrl("scarceResourceSignal.variant.qml"));
object = variantComponentTen.create();
QVERIFY(object != 0);
srsc = object->findChild<QObject*>("srsc");
@@ -3354,7 +3349,7 @@ void tst_qdeclarativeecmascript::scarceResources_other()
delete object;
// test that scarce resources are handled properly from js functions in qml files
- QDeclarativeComponent variantComponentEleven(&engine, TEST_FILE("scarceResourceFunction.variant.qml"));
+ QDeclarativeComponent variantComponentEleven(&engine, testFileUrl("scarceResourceFunction.variant.qml"));
object = variantComponentEleven.create();
QVERIFY(object != 0);
QVERIFY(!object->property("scarceResourceCopy").isValid()); // not yet assigned, so should not be valid
@@ -3373,7 +3368,7 @@ void tst_qdeclarativeecmascript::scarceResources_other()
delete object;
// test that if an exception occurs while invoking js function from cpp, that the resources are released.
- QDeclarativeComponent variantComponentTwelve(&engine, TEST_FILE("scarceResourceFunctionFail.variant.qml"));
+ QDeclarativeComponent variantComponentTwelve(&engine, testFileUrl("scarceResourceFunctionFail.variant.qml"));
object = variantComponentTwelve.create();
QVERIFY(object != 0);
QVERIFY(!object->property("scarceResourceCopy").isValid()); // not yet assigned, so should not be valid
@@ -3410,7 +3405,7 @@ void tst_qdeclarativeecmascript::scarceResources_data()
// resource should NOT be detached prior to deletion of the object instance,
// unless the resource is destroyed explicitly.
QTest::newRow("var: import scarce resource copy directly")
- << TEST_FILE("scarceResourceCopy.var.qml")
+ << testFileUrl("scarceResourceCopy.var.qml")
<< true
<< false // won't be detached, because assigned to property and not explicitly released
<< (QStringList() << QLatin1String("scarceResourceCopy"))
@@ -3419,7 +3414,7 @@ void tst_qdeclarativeecmascript::scarceResources_data()
<< QStringList();
QTest::newRow("var: import scarce resource copy from JS")
- << TEST_FILE("scarceResourceCopyFromJs.var.qml")
+ << testFileUrl("scarceResourceCopyFromJs.var.qml")
<< true
<< false // won't be detached, because assigned to property and not explicitly released
<< (QStringList() << QLatin1String("scarceResourceCopy"))
@@ -3428,7 +3423,7 @@ void tst_qdeclarativeecmascript::scarceResources_data()
<< QStringList();
QTest::newRow("var: import released scarce resource copy from JS")
- << TEST_FILE("scarceResourceDestroyedCopy.var.qml")
+ << testFileUrl("scarceResourceDestroyedCopy.var.qml")
<< true
<< true // explicitly released, so it will be detached
<< (QStringList() << QLatin1String("scarceResourceCopy"))
@@ -3439,7 +3434,7 @@ void tst_qdeclarativeecmascript::scarceResources_data()
// in the following three cases, no other copy should exist in memory,
// and so it should be detached (unless explicitly preserved).
QTest::newRow("var: import auto-release SR from JS in binding side-effect")
- << TEST_FILE("scarceResourceTest.var.qml")
+ << testFileUrl("scarceResourceTest.var.qml")
<< true
<< true // auto released, so it will be detached
<< (QStringList() << QLatin1String("scarceResourceTest"))
@@ -3447,7 +3442,7 @@ void tst_qdeclarativeecmascript::scarceResources_data()
<< (QList<QVariant>() << QVariant(100))
<< QStringList();
QTest::newRow("var: import explicit-preserve SR from JS in binding side-effect")
- << TEST_FILE("scarceResourceTestPreserve.var.qml")
+ << testFileUrl("scarceResourceTestPreserve.var.qml")
<< true
<< false // won't be detached because we explicitly preserve it
<< (QStringList() << QLatin1String("scarceResourceTest"))
@@ -3455,7 +3450,7 @@ void tst_qdeclarativeecmascript::scarceResources_data()
<< (QList<QVariant>() << QVariant(100))
<< QStringList();
QTest::newRow("var: import explicit-preserve SR from JS in binding side-effect")
- << TEST_FILE("scarceResourceTestMultiple.var.qml")
+ << testFileUrl("scarceResourceTestMultiple.var.qml")
<< true
<< true // will be detached because all resources were released manually or automatically.
<< (QStringList() << QLatin1String("scarceResourceTest"))
@@ -3466,7 +3461,7 @@ void tst_qdeclarativeecmascript::scarceResources_data()
// In the following three cases, test that scarce resources are handled
// correctly for imports.
QTest::newRow("var: import with no binding")
- << TEST_FILE("scarceResourceCopyImportNoBinding.var.qml")
+ << testFileUrl("scarceResourceCopyImportNoBinding.var.qml")
<< false // cannot check detach status.
<< false
<< QStringList()
@@ -3474,7 +3469,7 @@ void tst_qdeclarativeecmascript::scarceResources_data()
<< QList<QVariant>()
<< QStringList();
QTest::newRow("var: import with binding without explicit preserve")
- << TEST_FILE("scarceResourceCopyImportNoBinding.var.qml")
+ << testFileUrl("scarceResourceCopyImportNoBinding.var.qml")
<< false
<< false
<< (QStringList() << QLatin1String("scarceResourceCopy"))
@@ -3482,7 +3477,7 @@ void tst_qdeclarativeecmascript::scarceResources_data()
<< (QList<QVariant>() << QVariant())
<< QStringList();
QTest::newRow("var: import with explicit release after binding evaluation")
- << TEST_FILE("scarceResourceCopyImport.var.qml")
+ << testFileUrl("scarceResourceCopyImport.var.qml")
<< false
<< false
<< (QStringList() << QLatin1String("scarceResourceImportedCopy") << QLatin1String("scarceResourceAssignedCopyOne") << QLatin1String("scarceResourceAssignedCopyTwo") << QLatin1String("arePropertiesEqual"))
@@ -3490,7 +3485,7 @@ void tst_qdeclarativeecmascript::scarceResources_data()
<< (QList<QVariant>() << QVariant() << QVariant() << QVariant() << QVariant(true))
<< QStringList();
QTest::newRow("var: import with different js objects")
- << TEST_FILE("scarceResourceCopyImportDifferent.var.qml")
+ << testFileUrl("scarceResourceCopyImportDifferent.var.qml")
<< false
<< false
<< (QStringList() << QLatin1String("scarceResourceAssignedCopyOne") << QLatin1String("scarceResourceAssignedCopyTwo") << QLatin1String("arePropertiesEqual"))
@@ -3498,7 +3493,7 @@ void tst_qdeclarativeecmascript::scarceResources_data()
<< (QList<QVariant>() << QVariant() << QVariant(origPixmap) << QVariant(false))
<< QStringList();
QTest::newRow("var: import with different js objects and explicit release")
- << TEST_FILE("scarceResourceMultipleDifferentNoBinding.var.qml")
+ << testFileUrl("scarceResourceMultipleDifferentNoBinding.var.qml")
<< false
<< false
<< (QStringList() << QLatin1String("resourceOne") << QLatin1String("resourceTwo"))
@@ -3506,7 +3501,7 @@ void tst_qdeclarativeecmascript::scarceResources_data()
<< (QList<QVariant>() << QVariant(origPixmap) << QVariant())
<< QStringList();
QTest::newRow("var: import with same js objects and explicit release")
- << TEST_FILE("scarceResourceMultipleSameNoBinding.var.qml")
+ << testFileUrl("scarceResourceMultipleSameNoBinding.var.qml")
<< false
<< false
<< (QStringList() << QLatin1String("resourceOne") << QLatin1String("resourceTwo"))
@@ -3514,7 +3509,7 @@ void tst_qdeclarativeecmascript::scarceResources_data()
<< (QList<QVariant>() << QVariant() << QVariant())
<< QStringList();
QTest::newRow("var: binding with same js objects and explicit release")
- << TEST_FILE("scarceResourceMultipleSameWithBinding.var.qml")
+ << testFileUrl("scarceResourceMultipleSameWithBinding.var.qml")
<< false
<< false
<< (QStringList() << QLatin1String("resourceOne") << QLatin1String("resourceTwo"))
@@ -3530,7 +3525,7 @@ void tst_qdeclarativeecmascript::scarceResources_data()
// resource should NOT be detached prior to deletion of the object instance,
// unless the resource is destroyed explicitly.
QTest::newRow("variant: import scarce resource copy directly")
- << TEST_FILE("scarceResourceCopy.variant.qml")
+ << testFileUrl("scarceResourceCopy.variant.qml")
<< true
<< false // won't be detached, because assigned to property and not explicitly released
<< (QStringList() << QLatin1String("scarceResourceCopy"))
@@ -3539,7 +3534,7 @@ void tst_qdeclarativeecmascript::scarceResources_data()
<< QStringList();
QTest::newRow("variant: import scarce resource copy from JS")
- << TEST_FILE("scarceResourceCopyFromJs.variant.qml")
+ << testFileUrl("scarceResourceCopyFromJs.variant.qml")
<< true
<< false // won't be detached, because assigned to property and not explicitly released
<< (QStringList() << QLatin1String("scarceResourceCopy"))
@@ -3548,7 +3543,7 @@ void tst_qdeclarativeecmascript::scarceResources_data()
<< QStringList();
QTest::newRow("variant: import released scarce resource copy from JS")
- << TEST_FILE("scarceResourceDestroyedCopy.variant.qml")
+ << testFileUrl("scarceResourceDestroyedCopy.variant.qml")
<< true
<< true // explicitly released, so it will be detached
<< (QStringList() << QLatin1String("scarceResourceCopy"))
@@ -3559,7 +3554,7 @@ void tst_qdeclarativeecmascript::scarceResources_data()
// in the following three cases, no other copy should exist in memory,
// and so it should be detached (unless explicitly preserved).
QTest::newRow("variant: import auto-release SR from JS in binding side-effect")
- << TEST_FILE("scarceResourceTest.variant.qml")
+ << testFileUrl("scarceResourceTest.variant.qml")
<< true
<< true // auto released, so it will be detached
<< (QStringList() << QLatin1String("scarceResourceTest"))
@@ -3567,7 +3562,7 @@ void tst_qdeclarativeecmascript::scarceResources_data()
<< (QList<QVariant>() << QVariant(100))
<< QStringList();
QTest::newRow("variant: import explicit-preserve SR from JS in binding side-effect")
- << TEST_FILE("scarceResourceTestPreserve.variant.qml")
+ << testFileUrl("scarceResourceTestPreserve.variant.qml")
<< true
<< false // won't be detached because we explicitly preserve it
<< (QStringList() << QLatin1String("scarceResourceTest"))
@@ -3575,7 +3570,7 @@ void tst_qdeclarativeecmascript::scarceResources_data()
<< (QList<QVariant>() << QVariant(100))
<< QStringList();
QTest::newRow("variant: import multiple scarce resources")
- << TEST_FILE("scarceResourceTestMultiple.variant.qml")
+ << testFileUrl("scarceResourceTestMultiple.variant.qml")
<< true
<< true // will be detached because all resources were released manually or automatically.
<< (QStringList() << QLatin1String("scarceResourceTest"))
@@ -3586,7 +3581,7 @@ void tst_qdeclarativeecmascript::scarceResources_data()
// In the following three cases, test that scarce resources are handled
// correctly for imports.
QTest::newRow("variant: import with no binding")
- << TEST_FILE("scarceResourceCopyImportNoBinding.variant.qml")
+ << testFileUrl("scarceResourceCopyImportNoBinding.variant.qml")
<< false // cannot check detach status.
<< false
<< QStringList()
@@ -3594,7 +3589,7 @@ void tst_qdeclarativeecmascript::scarceResources_data()
<< QList<QVariant>()
<< QStringList();
QTest::newRow("variant: import with binding without explicit preserve")
- << TEST_FILE("scarceResourceCopyImportNoBinding.variant.qml")
+ << testFileUrl("scarceResourceCopyImportNoBinding.variant.qml")
<< false
<< false
<< (QStringList() << QLatin1String("scarceResourceCopy"))
@@ -3602,7 +3597,7 @@ void tst_qdeclarativeecmascript::scarceResources_data()
<< (QList<QVariant>() << QVariant())
<< QStringList();
QTest::newRow("variant: import with explicit release after binding evaluation")
- << TEST_FILE("scarceResourceCopyImport.variant.qml")
+ << testFileUrl("scarceResourceCopyImport.variant.qml")
<< false
<< false
<< (QStringList() << QLatin1String("scarceResourceImportedCopy") << QLatin1String("scarceResourceAssignedCopyOne") << QLatin1String("scarceResourceAssignedCopyTwo"))
@@ -3653,14 +3648,14 @@ void tst_qdeclarativeecmascript::scarceResources()
void tst_qdeclarativeecmascript::propertyChangeSlots()
{
// ensure that allowable property names are allowed and onPropertyNameChanged slots are generated correctly.
- QDeclarativeComponent component(&engine, TEST_FILE("changeslots/propertyChangeSlots.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("changeslots/propertyChangeSlots.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
delete object;
// ensure that invalid property names fail properly.
QTest::ignoreMessage(QtWarningMsg, "QDeclarativeComponent: Component is not ready");
- QDeclarativeComponent e1(&engine, TEST_FILE("changeslots/propertyChangeSlotErrors.1.qml"));
+ QDeclarativeComponent e1(&engine, testFileUrl("changeslots/propertyChangeSlotErrors.1.qml"));
QString expectedErrorString = e1.url().toString() + QLatin1String(":9:5: Cannot assign to non-existent property \"on_nameWithUnderscoreChanged\"");
QCOMPARE(e1.errors().at(0).toString(), expectedErrorString);
object = e1.create();
@@ -3668,7 +3663,7 @@ void tst_qdeclarativeecmascript::propertyChangeSlots()
delete object;
QTest::ignoreMessage(QtWarningMsg, "QDeclarativeComponent: Component is not ready");
- QDeclarativeComponent e2(&engine, TEST_FILE("changeslots/propertyChangeSlotErrors.2.qml"));
+ QDeclarativeComponent e2(&engine, testFileUrl("changeslots/propertyChangeSlotErrors.2.qml"));
expectedErrorString = e2.url().toString() + QLatin1String(":9:5: Cannot assign to non-existent property \"on____nameWithUnderscoresChanged\"");
QCOMPARE(e2.errors().at(0).toString(), expectedErrorString);
object = e2.create();
@@ -3676,7 +3671,7 @@ void tst_qdeclarativeecmascript::propertyChangeSlots()
delete object;
QTest::ignoreMessage(QtWarningMsg, "QDeclarativeComponent: Component is not ready");
- QDeclarativeComponent e3(&engine, TEST_FILE("changeslots/propertyChangeSlotErrors.3.qml"));
+ QDeclarativeComponent e3(&engine, testFileUrl("changeslots/propertyChangeSlotErrors.3.qml"));
expectedErrorString = e3.url().toString() + QLatin1String(":9:5: Cannot assign to non-existent property \"on$NameWithDollarsignChanged\"");
QCOMPARE(e3.errors().at(0).toString(), expectedErrorString);
object = e3.create();
@@ -3684,7 +3679,7 @@ void tst_qdeclarativeecmascript::propertyChangeSlots()
delete object;
QTest::ignoreMessage(QtWarningMsg, "QDeclarativeComponent: Component is not ready");
- QDeclarativeComponent e4(&engine, TEST_FILE("changeslots/propertyChangeSlotErrors.4.qml"));
+ QDeclarativeComponent e4(&engine, testFileUrl("changeslots/propertyChangeSlotErrors.4.qml"));
expectedErrorString = e4.url().toString() + QLatin1String(":9:5: Cannot assign to non-existent property \"on_6NameWithUnderscoreNumberChanged\"");
QCOMPARE(e4.errors().at(0).toString(), expectedErrorString);
object = e4.create();
@@ -3697,15 +3692,15 @@ void tst_qdeclarativeecmascript::propertyVar_data()
QTest::addColumn<QUrl>("qmlFile");
// valid
- QTest::newRow("non-bindable object subproperty changed") << TEST_FILE("propertyVar.1.qml");
- QTest::newRow("non-bindable object changed") << TEST_FILE("propertyVar.2.qml");
- QTest::newRow("primitive changed") << TEST_FILE("propertyVar.3.qml");
- QTest::newRow("javascript array modification") << TEST_FILE("propertyVar.4.qml");
- QTest::newRow("javascript map modification") << TEST_FILE("propertyVar.5.qml");
- QTest::newRow("javascript array assignment") << TEST_FILE("propertyVar.6.qml");
- QTest::newRow("javascript map assignment") << TEST_FILE("propertyVar.7.qml");
- QTest::newRow("literal property assignment") << TEST_FILE("propertyVar.8.qml");
- QTest::newRow("qobject property assignment") << TEST_FILE("propertyVar.9.qml");
+ QTest::newRow("non-bindable object subproperty changed") << testFileUrl("propertyVar.1.qml");
+ QTest::newRow("non-bindable object changed") << testFileUrl("propertyVar.2.qml");
+ QTest::newRow("primitive changed") << testFileUrl("propertyVar.3.qml");
+ QTest::newRow("javascript array modification") << testFileUrl("propertyVar.4.qml");
+ QTest::newRow("javascript map modification") << testFileUrl("propertyVar.5.qml");
+ QTest::newRow("javascript array assignment") << testFileUrl("propertyVar.6.qml");
+ QTest::newRow("javascript map assignment") << testFileUrl("propertyVar.7.qml");
+ QTest::newRow("literal property assignment") << testFileUrl("propertyVar.8.qml");
+ QTest::newRow("qobject property assignment") << testFileUrl("propertyVar.9.qml");
}
void tst_qdeclarativeecmascript::propertyVar()
@@ -3729,7 +3724,7 @@ void tst_qdeclarativeecmascript::propertyVarCpp()
// ensure that writing to and reading from a var property from cpp works as required.
// Literal values stored in var properties can be read and written as QVariants
// of a specific type, whereas object values are read as QVariantMaps.
- QDeclarativeComponent component(&engine, TEST_FILE("propertyVarCpp.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("propertyVarCpp.qml"));
object = component.create();
QVERIFY(object != 0);
// assign int to property var that currently has int assigned
@@ -3758,7 +3753,7 @@ void tst_qdeclarativeecmascript::propertyVarOwnership()
{
// Referenced JS objects are not collected
{
- QDeclarativeComponent component(&engine, TEST_FILE("propertyVarOwnership.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("propertyVarOwnership.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
QCOMPARE(object->property("test").toBool(), false);
@@ -3768,7 +3763,7 @@ void tst_qdeclarativeecmascript::propertyVarOwnership()
}
// Referenced JS objects are not collected
{
- QDeclarativeComponent component(&engine, TEST_FILE("propertyVarOwnership.2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("propertyVarOwnership.2.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
QCOMPARE(object->property("test").toBool(), false);
@@ -3778,7 +3773,7 @@ void tst_qdeclarativeecmascript::propertyVarOwnership()
}
// Qt objects are not collected until they've been dereferenced
{
- QDeclarativeComponent component(&engine, TEST_FILE("propertyVarOwnership.3.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("propertyVarOwnership.3.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -3802,7 +3797,7 @@ void tst_qdeclarativeecmascript::propertyVarOwnership()
}
// Self reference does not prevent Qt object collection
{
- QDeclarativeComponent component(&engine, TEST_FILE("propertyVarOwnership.4.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("propertyVarOwnership.4.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -3826,7 +3821,7 @@ void tst_qdeclarativeecmascript::propertyVarImplicitOwnership()
// The childObject has a reference to a different QObject. We want to ensure
// that the different item will not be cleaned up until required. IE, the childObject
// has implicit ownership of the constructed QObject.
- QDeclarativeComponent component(&engine, TEST_FILE("propertyVarImplicitOwnership.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("propertyVarImplicitOwnership.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
QMetaObject::invokeMethod(object, "assignCircular");
@@ -3851,7 +3846,7 @@ void tst_qdeclarativeecmascript::propertyVarImplicitOwnership()
void tst_qdeclarativeecmascript::propertyVarReparent()
{
// ensure that nothing breaks if we re-parent objects
- QDeclarativeComponent component(&engine, TEST_FILE("propertyVar.reparent.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("propertyVar.reparent.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
QMetaObject::invokeMethod(object, "assignVarProp");
@@ -3892,7 +3887,7 @@ void tst_qdeclarativeecmascript::propertyVarReparentNullContext()
// sometimes reparenting can cause problems
// (eg, if the ctxt is collected, varproperties are no longer available)
// this test ensures that no crash occurs in that situation.
- QDeclarativeComponent component(&engine, TEST_FILE("propertyVar.reparent.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("propertyVar.reparent.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
QMetaObject::invokeMethod(object, "assignVarProp");
@@ -3927,7 +3922,7 @@ void tst_qdeclarativeecmascript::propertyVarReparentNullContext()
void tst_qdeclarativeecmascript::propertyVarCircular()
{
// enforce behaviour regarding circular references - ensure qdvmemo deletion.
- QDeclarativeComponent component(&engine, TEST_FILE("propertyVar.circular.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("propertyVar.circular.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
QMetaObject::invokeMethod(object, "assignCircular"); // cause assignment and gc
@@ -3952,7 +3947,7 @@ void tst_qdeclarativeecmascript::propertyVarCircular2()
{
// track deletion of JS-owned parent item with Cpp-owned child
// where the child has a var property referencing its parent.
- QDeclarativeComponent component(&engine, TEST_FILE("propertyVar.circular.2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("propertyVar.circular.2.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
QMetaObject::invokeMethod(object, "assignCircular");
@@ -3987,7 +3982,7 @@ void tst_qdeclarativeecmascript::propertyVarInheritance()
// enforce behaviour regarding element inheritance - ensure handle disposal.
// The particular component under test here has a chain of references.
- QDeclarativeComponent component(&engine, TEST_FILE("propertyVar.inherit.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("propertyVar.inherit.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
QMetaObject::invokeMethod(object, "assignCircular"); // cause assignment and gc
@@ -4029,7 +4024,7 @@ void tst_qdeclarativeecmascript::propertyVarInheritance2()
// The particular component under test here does NOT have a chain of references; the
// only link between rootObject and childObject is that rootObject is the parent of childObject.
- QDeclarativeComponent component(&engine, TEST_FILE("propertyVar.circular.2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("propertyVar.circular.2.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
QMetaObject::invokeMethod(object, "assignCircular");
@@ -4060,7 +4055,7 @@ void tst_qdeclarativeecmascript::propertyVarInheritance2()
// Ensure that QObject type conversion works on binding assignment
void tst_qdeclarativeecmascript::elementAssign()
{
- QDeclarativeComponent component(&engine, TEST_FILE("elementAssign.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("elementAssign.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -4073,7 +4068,7 @@ void tst_qdeclarativeecmascript::elementAssign()
// QTBUG-12457
void tst_qdeclarativeecmascript::objectPassThroughSignals()
{
- QDeclarativeComponent component(&engine, TEST_FILE("objectsPassThroughSignals.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("objectsPassThroughSignals.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -4086,7 +4081,7 @@ void tst_qdeclarativeecmascript::objectPassThroughSignals()
// QTBUG-21626
void tst_qdeclarativeecmascript::objectConversion()
{
- QDeclarativeComponent component(&engine, TEST_FILE("objectConversion.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("objectConversion.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -4101,7 +4096,7 @@ void tst_qdeclarativeecmascript::objectConversion()
// QTBUG-20242
void tst_qdeclarativeecmascript::booleanConversion()
{
- QDeclarativeComponent component(&engine, TEST_FILE("booleanConversion.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("booleanConversion.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -4126,7 +4121,7 @@ void tst_qdeclarativeecmascript::handleReferenceManagement()
{
// Linear QObject reference
QDeclarativeEngine hrmEngine;
- QDeclarativeComponent component(&hrmEngine, TEST_FILE("handleReferenceManagement.object.1.qml"));
+ QDeclarativeComponent component(&hrmEngine, testFileUrl("handleReferenceManagement.object.1.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
CircularReferenceObject *cro = object->findChild<CircularReferenceObject*>("cro");
@@ -4145,7 +4140,7 @@ void tst_qdeclarativeecmascript::handleReferenceManagement()
{
// Circular QObject reference
QDeclarativeEngine hrmEngine;
- QDeclarativeComponent component(&hrmEngine, TEST_FILE("handleReferenceManagement.object.2.qml"));
+ QDeclarativeComponent component(&hrmEngine, testFileUrl("handleReferenceManagement.object.2.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
CircularReferenceObject *cro = object->findChild<CircularReferenceObject*>("cro");
@@ -4164,7 +4159,7 @@ void tst_qdeclarativeecmascript::handleReferenceManagement()
{
// Linear handle reference
QDeclarativeEngine hrmEngine;
- QDeclarativeComponent component(&hrmEngine, TEST_FILE("handleReferenceManagement.handle.1.qml"));
+ QDeclarativeComponent component(&hrmEngine, testFileUrl("handleReferenceManagement.handle.1.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
CircularReferenceHandle *crh = object->findChild<CircularReferenceHandle*>("crh");
@@ -4192,7 +4187,7 @@ void tst_qdeclarativeecmascript::handleReferenceManagement()
{
// Circular handle reference
QDeclarativeEngine hrmEngine;
- QDeclarativeComponent component(&hrmEngine, TEST_FILE("handleReferenceManagement.handle.2.qml"));
+ QDeclarativeComponent component(&hrmEngine, testFileUrl("handleReferenceManagement.handle.2.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
CircularReferenceHandle *crh = object->findChild<CircularReferenceHandle*>("crh");
@@ -4224,8 +4219,8 @@ void tst_qdeclarativeecmascript::handleReferenceManagement()
// multiple engine interaction - linear reference
QDeclarativeEngine hrmEngine1;
QDeclarativeEngine hrmEngine2;
- QDeclarativeComponent component1(&hrmEngine1, TEST_FILE("handleReferenceManagement.handle.1.qml"));
- QDeclarativeComponent component2(&hrmEngine2, TEST_FILE("handleReferenceManagement.handle.1.qml"));
+ QDeclarativeComponent component1(&hrmEngine1, testFileUrl("handleReferenceManagement.handle.1.qml"));
+ QDeclarativeComponent component2(&hrmEngine2, testFileUrl("handleReferenceManagement.handle.1.qml"));
QObject *object1 = component1.create();
QObject *object2 = component2.create();
QVERIFY(object1 != 0);
@@ -4268,8 +4263,8 @@ void tst_qdeclarativeecmascript::handleReferenceManagement()
// multiple engine interaction - circular reference
QDeclarativeEngine hrmEngine1;
QDeclarativeEngine hrmEngine2;
- QDeclarativeComponent component1(&hrmEngine1, TEST_FILE("handleReferenceManagement.handle.1.qml"));
- QDeclarativeComponent component2(&hrmEngine2, TEST_FILE("handleReferenceManagement.handle.1.qml"));
+ QDeclarativeComponent component1(&hrmEngine1, testFileUrl("handleReferenceManagement.handle.1.qml"));
+ QDeclarativeComponent component2(&hrmEngine2, testFileUrl("handleReferenceManagement.handle.1.qml"));
QObject *object1 = component1.create();
QObject *object2 = component2.create();
QVERIFY(object1 != 0);
@@ -4321,8 +4316,8 @@ void tst_qdeclarativeecmascript::handleReferenceManagement()
// multiple engine interaction - linear reference with engine deletion
QDeclarativeEngine *hrmEngine1 = new QDeclarativeEngine;
QDeclarativeEngine *hrmEngine2 = new QDeclarativeEngine;
- QDeclarativeComponent component1(hrmEngine1, TEST_FILE("handleReferenceManagement.handle.1.qml"));
- QDeclarativeComponent component2(hrmEngine2, TEST_FILE("handleReferenceManagement.handle.1.qml"));
+ QDeclarativeComponent component1(hrmEngine1, testFileUrl("handleReferenceManagement.handle.1.qml"));
+ QDeclarativeComponent component2(hrmEngine2, testFileUrl("handleReferenceManagement.handle.1.qml"));
QObject *object1 = component1.create();
QObject *object2 = component2.create();
QVERIFY(object1 != 0);
@@ -4372,13 +4367,13 @@ void tst_qdeclarativeecmascript::handleReferenceManagement()
void tst_qdeclarativeecmascript::stringArg()
{
- QDeclarativeComponent component(&engine, TEST_FILE("stringArg.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("stringArg.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
QMetaObject::invokeMethod(object, "success");
QVERIFY(object->property("returnValue").toBool());
- QString w1 = TEST_FILE("stringArg.qml").toString() + QLatin1String(":45: Error: String.arg(): Invalid arguments");
+ QString w1 = testFileUrl("stringArg.qml").toString() + QLatin1String(":45: Error: String.arg(): Invalid arguments");
QTest::ignoreMessage(QtWarningMsg, w1.toAscii().constData());
QMetaObject::invokeMethod(object, "failure");
QVERIFY(object->property("returnValue").toBool());
@@ -4388,7 +4383,7 @@ void tst_qdeclarativeecmascript::stringArg()
void tst_qdeclarativeecmascript::readonlyDeclaration()
{
- QDeclarativeComponent component(&engine, TEST_FILE("readonlyDeclaration.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("readonlyDeclaration.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -4406,7 +4401,7 @@ Q_DECLARE_METATYPE(QList<QUrl>)
void tst_qdeclarativeecmascript::sequenceConversionRead()
{
{
- QUrl qmlFile = TEST_FILE("sequenceConversion.read.qml");
+ QUrl qmlFile = testFileUrl("sequenceConversion.read.qml");
QDeclarativeComponent component(&engine, qmlFile);
QObject *object = component.create();
QVERIFY(object != 0);
@@ -4457,7 +4452,7 @@ void tst_qdeclarativeecmascript::sequenceConversionRead()
}
{
- QUrl qmlFile = TEST_FILE("sequenceConversion.read.error.qml");
+ QUrl qmlFile = testFileUrl("sequenceConversion.read.error.qml");
QDeclarativeComponent component(&engine, qmlFile);
QObject *object = component.create();
QVERIFY(object != 0);
@@ -4486,7 +4481,7 @@ void tst_qdeclarativeecmascript::sequenceConversionRead()
void tst_qdeclarativeecmascript::sequenceConversionWrite()
{
{
- QUrl qmlFile = TEST_FILE("sequenceConversion.write.qml");
+ QUrl qmlFile = testFileUrl("sequenceConversion.write.qml");
QDeclarativeComponent component(&engine, qmlFile);
QObject *object = component.create();
QVERIFY(object != 0);
@@ -4509,7 +4504,7 @@ void tst_qdeclarativeecmascript::sequenceConversionWrite()
}
{
- QUrl qmlFile = TEST_FILE("sequenceConversion.write.error.qml");
+ QUrl qmlFile = testFileUrl("sequenceConversion.write.error.qml");
QDeclarativeComponent component(&engine, qmlFile);
QObject *object = component.create();
QVERIFY(object != 0);
@@ -4532,7 +4527,7 @@ void tst_qdeclarativeecmascript::sequenceConversionWrite()
void tst_qdeclarativeecmascript::sequenceConversionArray()
{
// ensure that in JS the returned sequences act just like normal JS Arrays.
- QUrl qmlFile = TEST_FILE("sequenceConversion.array.qml");
+ QUrl qmlFile = testFileUrl("sequenceConversion.array.qml");
QDeclarativeComponent component(&engine, qmlFile);
QObject *object = component.create();
QVERIFY(object != 0);
@@ -4551,7 +4546,7 @@ void tst_qdeclarativeecmascript::sequenceConversionThreads()
{
// ensure that sequence conversion operations work correctly in a worker thread
// and that serialisation between the main and worker thread succeeds.
- QUrl qmlFile = TEST_FILE("sequenceConversion.threads.qml");
+ QUrl qmlFile = testFileUrl("sequenceConversion.threads.qml");
QDeclarativeComponent component(&engine, qmlFile);
QObject *object = component.create();
QVERIFY(object != 0);
@@ -4590,7 +4585,7 @@ void tst_qdeclarativeecmascript::sequenceConversionThreads()
void tst_qdeclarativeecmascript::sequenceConversionBindings()
{
{
- QUrl qmlFile = TEST_FILE("sequenceConversion.bindings.qml");
+ QUrl qmlFile = testFileUrl("sequenceConversion.bindings.qml");
QDeclarativeComponent component(&engine, qmlFile);
QObject *object = component.create();
QVERIFY(object != 0);
@@ -4603,7 +4598,7 @@ void tst_qdeclarativeecmascript::sequenceConversionBindings()
}
{
- QUrl qmlFile = TEST_FILE("sequenceConversion.bindings.error.qml");
+ QUrl qmlFile = testFileUrl("sequenceConversion.bindings.error.qml");
QString warning = QString(QLatin1String("%1:17: Unable to assign QList<int> to QList<bool>")).arg(qmlFile.toString());
QTest::ignoreMessage(QtWarningMsg, warning.toAscii().constData());
QDeclarativeComponent component(&engine, qmlFile);
@@ -4615,7 +4610,7 @@ void tst_qdeclarativeecmascript::sequenceConversionBindings()
void tst_qdeclarativeecmascript::sequenceConversionCopy()
{
- QUrl qmlFile = TEST_FILE("sequenceConversion.copy.qml");
+ QUrl qmlFile = testFileUrl("sequenceConversion.copy.qml");
QDeclarativeComponent component(&engine, qmlFile);
QObject *object = component.create();
QVERIFY(object != 0);
@@ -4632,7 +4627,7 @@ void tst_qdeclarativeecmascript::assignSequenceTypes()
{
// test binding array to sequence type property
{
- QDeclarativeComponent component(&engine, TEST_FILE("assignSequenceTypes.1.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("assignSequenceTypes.1.qml"));
MySequenceConversionObject *object = qobject_cast<MySequenceConversionObject *>(component.create());
QVERIFY(object != 0);
QCOMPARE(object->intListProperty(), (QList<int>() << 1 << 2));
@@ -4646,7 +4641,7 @@ void tst_qdeclarativeecmascript::assignSequenceTypes()
// test binding literal to sequence type property
{
- QDeclarativeComponent component(&engine, TEST_FILE("assignSequenceTypes.2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("assignSequenceTypes.2.qml"));
MySequenceConversionObject *object = qobject_cast<MySequenceConversionObject *>(component.create());
QVERIFY(object != 0);
QCOMPARE(object->intListProperty(), (QList<int>() << 1));
@@ -4660,19 +4655,19 @@ void tst_qdeclarativeecmascript::assignSequenceTypes()
// test binding single value to sequence type property
{
- QDeclarativeComponent component(&engine, TEST_FILE("assignSequenceTypes.3.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("assignSequenceTypes.3.qml"));
MySequenceConversionObject *object = qobject_cast<MySequenceConversionObject *>(component.create());
QVERIFY(object != 0);
QCOMPARE(object->intListProperty(), (QList<int>() << 1));
QCOMPARE(object->qrealListProperty(), (QList<qreal>() << 1.1));
QCOMPARE(object->boolListProperty(), (QList<bool>() << false));
- QCOMPARE(object->urlListProperty(), (QList<QUrl>() << QUrl(TEST_FILE("example.html"))));
+ QCOMPARE(object->urlListProperty(), (QList<QUrl>() << QUrl(testFileUrl("example.html"))));
delete object;
}
// test assigning array to sequence type property in js function
{
- QDeclarativeComponent component(&engine, TEST_FILE("assignSequenceTypes.4.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("assignSequenceTypes.4.qml"));
MySequenceConversionObject *object = qobject_cast<MySequenceConversionObject *>(component.create());
QVERIFY(object != 0);
QCOMPARE(object->intListProperty(), (QList<int>() << 1 << 2));
@@ -4686,7 +4681,7 @@ void tst_qdeclarativeecmascript::assignSequenceTypes()
// test assigning literal to sequence type property in js function
{
- QDeclarativeComponent component(&engine, TEST_FILE("assignSequenceTypes.5.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("assignSequenceTypes.5.qml"));
MySequenceConversionObject *object = qobject_cast<MySequenceConversionObject *>(component.create());
QVERIFY(object != 0);
QCOMPARE(object->intListProperty(), (QList<int>() << 1));
@@ -4700,19 +4695,19 @@ void tst_qdeclarativeecmascript::assignSequenceTypes()
// test assigning single value to sequence type property in js function
{
- QDeclarativeComponent component(&engine, TEST_FILE("assignSequenceTypes.6.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("assignSequenceTypes.6.qml"));
MySequenceConversionObject *object = qobject_cast<MySequenceConversionObject *>(component.create());
QVERIFY(object != 0);
QCOMPARE(object->intListProperty(), (QList<int>() << 1));
QCOMPARE(object->qrealListProperty(), (QList<qreal>() << 1.1));
QCOMPARE(object->boolListProperty(), (QList<bool>() << false));
- QCOMPARE(object->urlListProperty(), (QList<QUrl>() << QUrl(TEST_FILE("example.html"))));
+ QCOMPARE(object->urlListProperty(), (QList<QUrl>() << QUrl(testFileUrl("example.html"))));
delete object;
}
// test QList<QUrl> literal assignment and binding assignment causes url resolution when required
{
- QDeclarativeComponent component(&engine, TEST_FILE("assignSequenceTypes.7.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("assignSequenceTypes.7.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
MySequenceConversionObject *msco1 = object->findChild<MySequenceConversionObject *>(QLatin1String("msco1"));
@@ -4721,11 +4716,11 @@ void tst_qdeclarativeecmascript::assignSequenceTypes()
MySequenceConversionObject *msco4 = object->findChild<MySequenceConversionObject *>(QLatin1String("msco4"));
MySequenceConversionObject *msco5 = object->findChild<MySequenceConversionObject *>(QLatin1String("msco5"));
QVERIFY(msco1 != 0 && msco2 != 0 && msco3 != 0 && msco4 != 0 && msco5 != 0);
- QCOMPARE(msco1->urlListProperty(), (QList<QUrl>() << QUrl(TEST_FILE("example.html"))));
- QCOMPARE(msco2->urlListProperty(), (QList<QUrl>() << QUrl(TEST_FILE("example.html"))));
- QCOMPARE(msco3->urlListProperty(), (QList<QUrl>() << QUrl(TEST_FILE("example.html")) << QUrl(TEST_FILE("example2.html"))));
- QCOMPARE(msco4->urlListProperty(), (QList<QUrl>() << QUrl(TEST_FILE("example.html")) << QUrl(TEST_FILE("example2.html"))));
- QCOMPARE(msco5->urlListProperty(), (QList<QUrl>() << QUrl(TEST_FILE("example.html")) << QUrl(TEST_FILE("example2.html"))));
+ QCOMPARE(msco1->urlListProperty(), (QList<QUrl>() << QUrl(testFileUrl("example.html"))));
+ QCOMPARE(msco2->urlListProperty(), (QList<QUrl>() << QUrl(testFileUrl("example.html"))));
+ QCOMPARE(msco3->urlListProperty(), (QList<QUrl>() << QUrl(testFileUrl("example.html")) << QUrl(testFileUrl("example2.html"))));
+ QCOMPARE(msco4->urlListProperty(), (QList<QUrl>() << QUrl(testFileUrl("example.html")) << QUrl(testFileUrl("example2.html"))));
+ QCOMPARE(msco5->urlListProperty(), (QList<QUrl>() << QUrl(testFileUrl("example.html")) << QUrl(testFileUrl("example2.html"))));
delete object;
}
}
@@ -4734,7 +4729,7 @@ void tst_qdeclarativeecmascript::assignSequenceTypes()
// Regressed with: df1788b4dbbb2826ae63f26bdf166342595343f4
void tst_qdeclarativeecmascript::nullObjectBinding()
{
- QDeclarativeComponent component(&engine, TEST_FILE("nullObjectBinding.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("nullObjectBinding.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -4748,7 +4743,7 @@ void tst_qdeclarativeecmascript::nullObjectBinding()
void tst_qdeclarativeecmascript::deletedEngine()
{
QDeclarativeEngine *engine = new QDeclarativeEngine;
- QDeclarativeComponent component(engine, TEST_FILE("deletedEngine.qml"));
+ QDeclarativeComponent component(engine, testFileUrl("deletedEngine.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -4769,7 +4764,7 @@ void tst_qdeclarativeecmascript::deletedEngine()
// Test the crashing part of QTBUG-9705
void tst_qdeclarativeecmascript::libraryScriptAssert()
{
- QDeclarativeComponent component(&engine, TEST_FILE("libraryScriptAssert.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("libraryScriptAssert.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -4779,7 +4774,7 @@ void tst_qdeclarativeecmascript::libraryScriptAssert()
void tst_qdeclarativeecmascript::variantsAssignedUndefined()
{
- QDeclarativeComponent component(&engine, TEST_FILE("variantsAssignedUndefined.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("variantsAssignedUndefined.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -4798,7 +4793,7 @@ void tst_qdeclarativeecmascript::variantsAssignedUndefined()
void tst_qdeclarativeecmascript::qtbug_9792()
{
- QDeclarativeComponent component(&engine, TEST_FILE("qtbug_9792.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("qtbug_9792.qml"));
QDeclarativeContext *context = new QDeclarativeContext(engine.rootContext());
@@ -4825,7 +4820,7 @@ void tst_qdeclarativeecmascript::qtbug_9792()
// Verifies that QDeclarativeGuard<>s used in the vmemetaobject are cleaned correctly
void tst_qdeclarativeecmascript::qtcreatorbug_1289()
{
- QDeclarativeComponent component(&engine, TEST_FILE("qtcreatorbug_1289.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("qtcreatorbug_1289.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
@@ -4847,7 +4842,7 @@ void tst_qdeclarativeecmascript::qtcreatorbug_1289()
void tst_qdeclarativeecmascript::noSpuriousWarningsAtShutdown()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("noSpuriousWarningsAtShutdown.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("noSpuriousWarningsAtShutdown.qml"));
QObject *o = component.create();
@@ -4863,7 +4858,7 @@ void tst_qdeclarativeecmascript::noSpuriousWarningsAtShutdown()
{
- QDeclarativeComponent component(&engine, TEST_FILE("noSpuriousWarningsAtShutdown.2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("noSpuriousWarningsAtShutdown.2.qml"));
QObject *o = component.create();
@@ -4881,7 +4876,7 @@ void tst_qdeclarativeecmascript::noSpuriousWarningsAtShutdown()
void tst_qdeclarativeecmascript::canAssignNullToQObject()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("canAssignNullToQObject.1.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("canAssignNullToQObject.1.qml"));
MyQmlObject *o = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(o != 0);
@@ -4896,7 +4891,7 @@ void tst_qdeclarativeecmascript::canAssignNullToQObject()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("canAssignNullToQObject.2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("canAssignNullToQObject.2.qml"));
MyQmlObject *o = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(o != 0);
@@ -4909,7 +4904,7 @@ void tst_qdeclarativeecmascript::canAssignNullToQObject()
void tst_qdeclarativeecmascript::functionAssignment_fromBinding()
{
- QDeclarativeComponent component(&engine, TEST_FILE("functionAssignment.1.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("functionAssignment.1.qml"));
QString url = component.url().toString();
QString warning = url + ":4: Unable to assign a function to a property.";
@@ -4927,7 +4922,7 @@ void tst_qdeclarativeecmascript::functionAssignment_fromJS()
{
QFETCH(QString, triggerProperty);
- QDeclarativeComponent component(&engine, TEST_FILE("functionAssignment.2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("functionAssignment.2.qml"));
QVERIFY2(component.errorString().isEmpty(), qPrintable(component.errorString()));
MyQmlObject *o = qobject_cast<MyQmlObject *>(component.create());
@@ -4959,7 +4954,7 @@ void tst_qdeclarativeecmascript::functionAssignment_fromJS_data()
void tst_qdeclarativeecmascript::functionAssignmentfromJS_invalid()
{
- QDeclarativeComponent component(&engine, TEST_FILE("functionAssignment.2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("functionAssignment.2.qml"));
QVERIFY2(component.errorString().isEmpty(), qPrintable(component.errorString()));
MyQmlObject *o = qobject_cast<MyQmlObject *>(component.create());
@@ -4983,7 +4978,7 @@ void tst_qdeclarativeecmascript::functionAssignmentfromJS_invalid()
void tst_qdeclarativeecmascript::eval()
{
- QDeclarativeComponent component(&engine, TEST_FILE("eval.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("eval.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
@@ -4999,7 +4994,7 @@ void tst_qdeclarativeecmascript::eval()
void tst_qdeclarativeecmascript::function()
{
- QDeclarativeComponent component(&engine, TEST_FILE("function.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("function.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
@@ -5016,7 +5011,7 @@ void tst_qdeclarativeecmascript::include()
{
// Non-library relative include
{
- QDeclarativeComponent component(&engine, TEST_FILE("include.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("include.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
@@ -5032,7 +5027,7 @@ void tst_qdeclarativeecmascript::include()
// Library relative include
{
- QDeclarativeComponent component(&engine, TEST_FILE("include_shared.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("include_shared.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
@@ -5048,7 +5043,7 @@ void tst_qdeclarativeecmascript::include()
// Callback
{
- QDeclarativeComponent component(&engine, TEST_FILE("include_callback.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("include_callback.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
@@ -5064,7 +5059,7 @@ void tst_qdeclarativeecmascript::include()
// Including file with ".pragma library"
{
- QDeclarativeComponent component(&engine, TEST_FILE("include_pragma.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("include_pragma.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
QCOMPARE(o->property("test1").toInt(), 100);
@@ -5076,9 +5071,9 @@ void tst_qdeclarativeecmascript::include()
{
TestHTTPServer server(8111);
QVERIFY(server.isValid());
- server.serveDirectory(TESTDATA(""));
+ server.serveDirectory(dataDirectory());
- QDeclarativeComponent component(&engine, TEST_FILE("include_remote.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("include_remote.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
@@ -5104,9 +5099,9 @@ void tst_qdeclarativeecmascript::include()
{
TestHTTPServer server(8111);
QVERIFY(server.isValid());
- server.serveDirectory(TESTDATA(""));
+ server.serveDirectory(dataDirectory());
- QDeclarativeComponent component(&engine, TEST_FILE("include_remote_missing.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("include_remote_missing.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
@@ -5122,7 +5117,7 @@ void tst_qdeclarativeecmascript::include()
void tst_qdeclarativeecmascript::signalHandlers()
{
- QDeclarativeComponent component(&engine, TEST_FILE("signalHandlers.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("signalHandlers.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
@@ -5152,7 +5147,7 @@ void tst_qdeclarativeecmascript::signalHandlers()
void tst_qdeclarativeecmascript::qtbug_10696()
{
- QDeclarativeComponent component(&engine, TEST_FILE("qtbug_10696.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("qtbug_10696.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
delete o;
@@ -5160,7 +5155,7 @@ void tst_qdeclarativeecmascript::qtbug_10696()
void tst_qdeclarativeecmascript::qtbug_11606()
{
- QDeclarativeComponent component(&engine, TEST_FILE("qtbug_11606.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("qtbug_11606.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
QCOMPARE(o->property("test").toBool(), true);
@@ -5169,7 +5164,7 @@ void tst_qdeclarativeecmascript::qtbug_11606()
void tst_qdeclarativeecmascript::qtbug_11600()
{
- QDeclarativeComponent component(&engine, TEST_FILE("qtbug_11600.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("qtbug_11600.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
QCOMPARE(o->property("test").toBool(), true);
@@ -5178,7 +5173,7 @@ void tst_qdeclarativeecmascript::qtbug_11600()
void tst_qdeclarativeecmascript::qtbug_21864()
{
- QDeclarativeComponent component(&engine, TEST_FILE("qtbug_21864.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("qtbug_21864.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
QCOMPARE(o->property("test").toBool(), true);
@@ -5188,7 +5183,7 @@ void tst_qdeclarativeecmascript::qtbug_21864()
// Reading and writing non-scriptable properties should fail
void tst_qdeclarativeecmascript::nonscriptable()
{
- QDeclarativeComponent component(&engine, TEST_FILE("nonscriptable.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("nonscriptable.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
QCOMPARE(o->property("readOk").toBool(), true);
@@ -5199,7 +5194,7 @@ void tst_qdeclarativeecmascript::nonscriptable()
// deleteLater() should not be callable from QML
void tst_qdeclarativeecmascript::deleteLater()
{
- QDeclarativeComponent component(&engine, TEST_FILE("deleteLater.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("deleteLater.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
QCOMPARE(o->property("test").toBool(), true);
@@ -5208,7 +5203,7 @@ void tst_qdeclarativeecmascript::deleteLater()
void tst_qdeclarativeecmascript::in()
{
- QDeclarativeComponent component(&engine, TEST_FILE("in.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("in.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
QCOMPARE(o->property("test1").toBool(), true);
@@ -5218,7 +5213,7 @@ void tst_qdeclarativeecmascript::in()
void tst_qdeclarativeecmascript::typeOf()
{
- QDeclarativeComponent component(&engine, TEST_FILE("typeOf.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("typeOf.qml"));
// These warnings should not happen once QTBUG-21864 is fixed
QString warning1 = component.url().toString() + QLatin1String(":16: Error: Cannot assign [undefined] to QString");
@@ -5246,7 +5241,7 @@ void tst_qdeclarativeecmascript::typeOf()
void tst_qdeclarativeecmascript::sharedAttachedObject()
{
- QDeclarativeComponent component(&engine, TEST_FILE("sharedAttachedObject.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("sharedAttachedObject.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
QCOMPARE(o->property("test1").toBool(), true);
@@ -5257,7 +5252,7 @@ void tst_qdeclarativeecmascript::sharedAttachedObject()
// QTBUG-13999
void tst_qdeclarativeecmascript::objectName()
{
- QDeclarativeComponent component(&engine, TEST_FILE("objectName.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("objectName.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
@@ -5274,7 +5269,7 @@ void tst_qdeclarativeecmascript::objectName()
void tst_qdeclarativeecmascript::writeRemovesBinding()
{
- QDeclarativeComponent component(&engine, TEST_FILE("writeRemovesBinding.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("writeRemovesBinding.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
@@ -5286,7 +5281,7 @@ void tst_qdeclarativeecmascript::writeRemovesBinding()
// Test bindings assigned to alias properties actually assign to the alias' target
void tst_qdeclarativeecmascript::aliasBindingsAssignCorrectly()
{
- QDeclarativeComponent component(&engine, TEST_FILE("aliasBindingsAssignCorrectly.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("aliasBindingsAssignCorrectly.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
@@ -5299,7 +5294,7 @@ void tst_qdeclarativeecmascript::aliasBindingsAssignCorrectly()
void tst_qdeclarativeecmascript::aliasBindingsOverrideTarget()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("aliasBindingsOverrideTarget.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("aliasBindingsOverrideTarget.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
@@ -5309,7 +5304,7 @@ void tst_qdeclarativeecmascript::aliasBindingsOverrideTarget()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("aliasBindingsOverrideTarget.2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("aliasBindingsOverrideTarget.2.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
@@ -5319,7 +5314,7 @@ void tst_qdeclarativeecmascript::aliasBindingsOverrideTarget()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("aliasBindingsOverrideTarget.3.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("aliasBindingsOverrideTarget.3.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
@@ -5333,7 +5328,7 @@ void tst_qdeclarativeecmascript::aliasBindingsOverrideTarget()
void tst_qdeclarativeecmascript::aliasWritesOverrideBindings()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("aliasWritesOverrideBindings.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("aliasWritesOverrideBindings.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
@@ -5343,7 +5338,7 @@ void tst_qdeclarativeecmascript::aliasWritesOverrideBindings()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("aliasWritesOverrideBindings.2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("aliasWritesOverrideBindings.2.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
@@ -5353,7 +5348,7 @@ void tst_qdeclarativeecmascript::aliasWritesOverrideBindings()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("aliasWritesOverrideBindings.3.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("aliasWritesOverrideBindings.3.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
@@ -5367,7 +5362,7 @@ void tst_qdeclarativeecmascript::aliasWritesOverrideBindings()
// QTBUG-20200
void tst_qdeclarativeecmascript::aliasToCompositeElement()
{
- QDeclarativeComponent component(&engine, TEST_FILE("aliasToCompositeElement.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("aliasToCompositeElement.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -5377,7 +5372,7 @@ void tst_qdeclarativeecmascript::aliasToCompositeElement()
void tst_qdeclarativeecmascript::qtbug_20344()
{
- QDeclarativeComponent component(&engine, TEST_FILE("qtbug_20344.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("qtbug_20344.qml"));
QString warning = component.url().toString() + ":5: Error: Exception thrown from within QObject slot";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
@@ -5391,7 +5386,7 @@ void tst_qdeclarativeecmascript::qtbug_20344()
void tst_qdeclarativeecmascript::revisionErrors()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("metaobjectRevisionErrors.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("metaobjectRevisionErrors.qml"));
QString url = component.url().toString();
QString warning1 = url + ":8: ReferenceError: Can't find variable: prop2";
@@ -5406,7 +5401,7 @@ void tst_qdeclarativeecmascript::revisionErrors()
delete object;
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("metaobjectRevisionErrors2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("metaobjectRevisionErrors2.qml"));
QString url = component.url().toString();
// MyRevisionedSubclass 1.0 uses MyRevisionedClass revision 0
@@ -5428,7 +5423,7 @@ void tst_qdeclarativeecmascript::revisionErrors()
delete object;
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("metaobjectRevisionErrors3.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("metaobjectRevisionErrors3.qml"));
QString url = component.url().toString();
// MyRevisionedSubclass 1.1 uses MyRevisionedClass revision 1
@@ -5448,7 +5443,7 @@ void tst_qdeclarativeecmascript::revisionErrors()
void tst_qdeclarativeecmascript::revision()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("metaobjectRevision.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("metaobjectRevision.qml"));
QString url = component.url().toString();
MyRevisionedClass *object = qobject_cast<MyRevisionedClass *>(component.create());
@@ -5456,7 +5451,7 @@ void tst_qdeclarativeecmascript::revision()
delete object;
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("metaobjectRevision2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("metaobjectRevision2.qml"));
QString url = component.url().toString();
MyRevisionedClass *object = qobject_cast<MyRevisionedClass *>(component.create());
@@ -5464,7 +5459,7 @@ void tst_qdeclarativeecmascript::revision()
delete object;
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("metaobjectRevision3.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("metaobjectRevision3.qml"));
QString url = component.url().toString();
MyRevisionedClass *object = qobject_cast<MyRevisionedClass *>(component.create());
@@ -5473,7 +5468,7 @@ void tst_qdeclarativeecmascript::revision()
}
// Test that non-root classes can resolve revisioned methods
{
- QDeclarativeComponent component(&engine, TEST_FILE("metaobjectRevision4.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("metaobjectRevision4.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -5484,7 +5479,7 @@ void tst_qdeclarativeecmascript::revision()
void tst_qdeclarativeecmascript::realToInt()
{
- QDeclarativeComponent component(&engine, TEST_FILE("realToInt.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("realToInt.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create());
QVERIFY(object != 0);
@@ -5497,7 +5492,7 @@ void tst_qdeclarativeecmascript::realToInt()
void tst_qdeclarativeecmascript::urlProperty()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("urlProperty.1.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("urlProperty.1.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create());
QVERIFY(object != 0);
object->setStringProperty("http://qt-project.org");
@@ -5510,7 +5505,7 @@ void tst_qdeclarativeecmascript::urlProperty()
void tst_qdeclarativeecmascript::dynamicString()
{
- QDeclarativeComponent component(&engine, TEST_FILE("dynamicString.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("dynamicString.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
QCOMPARE(object->property("stringProperty").toString(),
@@ -5519,14 +5514,14 @@ void tst_qdeclarativeecmascript::dynamicString()
void tst_qdeclarativeecmascript::automaticSemicolon()
{
- QDeclarativeComponent component(&engine, TEST_FILE("automaticSemicolon.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("automaticSemicolon.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
}
void tst_qdeclarativeecmascript::unaryExpression()
{
- QDeclarativeComponent component(&engine, TEST_FILE("unaryExpression.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("unaryExpression.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
}
@@ -5534,7 +5529,7 @@ void tst_qdeclarativeecmascript::unaryExpression()
// Makes sure that a binding isn't double re-evaluated when it depends on the same variable twice
void tst_qdeclarativeecmascript::doubleEvaluate()
{
- QDeclarativeComponent component(&engine, TEST_FILE("doubleEvaluate.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("doubleEvaluate.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
WriteCounter *wc = qobject_cast<WriteCounter *>(object);
@@ -5557,7 +5552,7 @@ static void captureMsgHandler(QtMsgType, const char *msg)
void tst_qdeclarativeecmascript::nonNotifyable()
{
QV4Compiler::enableV4(false);
- QDeclarativeComponent component(&engine, TEST_FILE("nonNotifyable.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("nonNotifyable.qml"));
QV4Compiler::enableV4(true);
QtMsgHandler old = qInstallMsgHandler(captureMsgHandler);
@@ -5583,7 +5578,7 @@ void tst_qdeclarativeecmascript::nonNotifyable()
void tst_qdeclarativeecmascript::forInLoop()
{
- QDeclarativeComponent component(&engine, TEST_FILE("forInLoop.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("forInLoop.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -5603,7 +5598,7 @@ void tst_qdeclarativeecmascript::forInLoop()
// An object the binding depends on is deleted while the binding is still running
void tst_qdeclarativeecmascript::deleteWhileBindingRunning()
{
- QDeclarativeComponent component(&engine, TEST_FILE("deleteWhileBindingRunning.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("deleteWhileBindingRunning.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
delete object;
@@ -5615,7 +5610,7 @@ void tst_qdeclarativeecmascript::qtbug_22679()
object.setStringProperty(QLatin1String("Please work correctly"));
engine.rootContext()->setContextProperty("contextProp", &object);
- QDeclarativeComponent component(&engine, TEST_FILE("qtbug_22679.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("qtbug_22679.qml"));
qRegisterMetaType<QList<QDeclarativeError> >("QList<QDeclarativeError>");
QSignalSpy warningsSpy(&engine, SIGNAL(warnings(QList<QDeclarativeError>)));
@@ -5642,7 +5637,7 @@ void tst_qdeclarativeecmascript::qtbug_22843()
fileName += QLatin1String(".library");
fileName += QLatin1String(".qml");
- QDeclarativeComponent component(&engine, TEST_FILE(fileName));
+ QDeclarativeComponent component(&engine, testFileUrl(fileName));
QString url = component.url().toString();
QString warning1 = url.left(url.length()-3) + QLatin1String("js:4: SyntaxError: Unexpected token )");
QString warning2 = url + QLatin1String(":5: TypeError: Object [object Object] has no method 'func'");
@@ -5669,7 +5664,7 @@ void tst_qdeclarativeecmascript::qtbug_22843()
void tst_qdeclarativeecmascript::switchStatement()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("switchStatement.1.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("switchStatement.1.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(object != 0);
@@ -5692,7 +5687,7 @@ void tst_qdeclarativeecmascript::switchStatement()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("switchStatement.2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("switchStatement.2.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(object != 0);
@@ -5715,7 +5710,7 @@ void tst_qdeclarativeecmascript::switchStatement()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("switchStatement.3.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("switchStatement.3.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(object != 0);
@@ -5738,7 +5733,7 @@ void tst_qdeclarativeecmascript::switchStatement()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("switchStatement.4.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("switchStatement.4.qml"));
QString warning = component.url().toString() + ":4: Unable to assign [undefined] to int";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
@@ -5766,7 +5761,7 @@ void tst_qdeclarativeecmascript::switchStatement()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("switchStatement.5.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("switchStatement.5.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(object != 0);
@@ -5789,7 +5784,7 @@ void tst_qdeclarativeecmascript::switchStatement()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("switchStatement.6.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("switchStatement.6.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(object != 0);
@@ -5815,7 +5810,7 @@ void tst_qdeclarativeecmascript::switchStatement()
void tst_qdeclarativeecmascript::withStatement()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("withStatement.1.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("withStatement.1.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(object != 0);
@@ -5826,7 +5821,7 @@ void tst_qdeclarativeecmascript::withStatement()
void tst_qdeclarativeecmascript::tryStatement()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("tryStatement.1.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("tryStatement.1.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(object != 0);
@@ -5834,7 +5829,7 @@ void tst_qdeclarativeecmascript::tryStatement()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("tryStatement.2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("tryStatement.2.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(object != 0);
@@ -5842,7 +5837,7 @@ void tst_qdeclarativeecmascript::tryStatement()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("tryStatement.3.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("tryStatement.3.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(object != 0);
@@ -5850,7 +5845,7 @@ void tst_qdeclarativeecmascript::tryStatement()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("tryStatement.4.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("tryStatement.4.qml"));
MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
QVERIFY(object != 0);
diff --git a/tests/auto/declarative/qdeclarativeerror/qdeclarativeerror.pro b/tests/auto/declarative/qdeclarativeerror/qdeclarativeerror.pro
index 11f6beadf0..5d0bb98376 100644
--- a/tests/auto/declarative/qdeclarativeerror/qdeclarativeerror.pro
+++ b/tests/auto/declarative/qdeclarativeerror/qdeclarativeerror.pro
@@ -1,6 +1,8 @@
CONFIG += testcase
TARGET = tst_qdeclarativeerror
-SOURCES += tst_qdeclarativeerror.cpp
+SOURCES += tst_qdeclarativeerror.cpp \
+ ../../shared/util.cpp
+HEADERS += ../../shared/util.h
macx:CONFIG -= app_bundle
CONFIG += parallel_test
diff --git a/tests/auto/declarative/qdeclarativeerror/tst_qdeclarativeerror.cpp b/tests/auto/declarative/qdeclarativeerror/tst_qdeclarativeerror.cpp
index 8fab5e5e50..3f204de2bd 100644
--- a/tests/auto/declarative/qdeclarativeerror/tst_qdeclarativeerror.cpp
+++ b/tests/auto/declarative/qdeclarativeerror/tst_qdeclarativeerror.cpp
@@ -44,7 +44,7 @@
#include <QDebug>
#include "../../shared/util.h"
-class tst_qdeclarativeerror : public QObject
+class tst_qdeclarativeerror : public QDeclarativeDataTest
{
Q_OBJECT
private slots:
@@ -208,7 +208,7 @@ void tst_qdeclarativeerror::debug()
}
{
- QUrl url(QUrl::fromLocalFile(TESTDATA("")).resolved(QUrl("test.txt")));
+ QUrl url(dataDirectoryUrl().resolved(QUrl("test.txt")));
QDeclarativeError error;
error.setUrl(url);
error.setDescription("An Error");
@@ -222,7 +222,7 @@ void tst_qdeclarativeerror::debug()
}
{
- QUrl url(QUrl::fromLocalFile(TESTDATA("")).resolved(QUrl("foo.txt")));
+ QUrl url(dataDirectoryUrl().resolved(QUrl("foo.txt")));
QDeclarativeError error;
error.setUrl(url);
error.setDescription("An Error");
diff --git a/tests/auto/declarative/qdeclarativeexpression/qdeclarativeexpression.pro b/tests/auto/declarative/qdeclarativeexpression/qdeclarativeexpression.pro
index 8807e7a2e2..d9c2da603b 100644
--- a/tests/auto/declarative/qdeclarativeexpression/qdeclarativeexpression.pro
+++ b/tests/auto/declarative/qdeclarativeexpression/qdeclarativeexpression.pro
@@ -2,7 +2,9 @@ CONFIG += testcase
TARGET = tst_qdeclarativeexpression
macx:CONFIG -= app_bundle
-SOURCES += tst_qdeclarativeexpression.cpp
+SOURCES += tst_qdeclarativeexpression.cpp \
+ ../../shared/util.cpp
+HEADERS += ../../shared/util.h
testDataFiles.files = data
testDataFiles.path = .
diff --git a/tests/auto/declarative/qdeclarativeexpression/tst_qdeclarativeexpression.cpp b/tests/auto/declarative/qdeclarativeexpression/tst_qdeclarativeexpression.cpp
index f7699e2bac..9257885082 100644
--- a/tests/auto/declarative/qdeclarativeexpression/tst_qdeclarativeexpression.cpp
+++ b/tests/auto/declarative/qdeclarativeexpression/tst_qdeclarativeexpression.cpp
@@ -46,7 +46,7 @@
#include <QtDeclarative/qdeclarativescriptstring.h>
#include "../../shared/util.h"
-class tst_qdeclarativeexpression : public QObject
+class tst_qdeclarativeexpression : public QDeclarativeDataTest
{
Q_OBJECT
public:
@@ -83,7 +83,7 @@ void tst_qdeclarativeexpression::scriptString()
qmlRegisterType<TestObject>("Test", 1, 0, "TestObject");
QDeclarativeEngine engine;
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("scriptString.qml")));
+ QDeclarativeComponent c(&engine, testFileUrl("scriptString.qml"));
TestObject *testObj = qobject_cast<TestObject*>(c.create());
QVERIFY(testObj != 0);
diff --git a/tests/auto/declarative/qdeclarativefolderlistmodel/qdeclarativefolderlistmodel.pro b/tests/auto/declarative/qdeclarativefolderlistmodel/qdeclarativefolderlistmodel.pro
index b59d39f629..5f337161b9 100644
--- a/tests/auto/declarative/qdeclarativefolderlistmodel/qdeclarativefolderlistmodel.pro
+++ b/tests/auto/declarative/qdeclarativefolderlistmodel/qdeclarativefolderlistmodel.pro
@@ -2,7 +2,9 @@ CONFIG += testcase
TARGET = tst_qdeclarativefolderlistmodel
macx:CONFIG -= app_bundle
-SOURCES += tst_qdeclarativefolderlistmodel.cpp
+SOURCES += tst_qdeclarativefolderlistmodel.cpp \
+ ../../shared/util.cpp
+HEADERS += ../../shared/util.h
testDataFiles.files = data
testDataFiles.path = .
diff --git a/tests/auto/declarative/qdeclarativefolderlistmodel/tst_qdeclarativefolderlistmodel.cpp b/tests/auto/declarative/qdeclarativefolderlistmodel/tst_qdeclarativefolderlistmodel.cpp
index f85a6f14b6..41f15f91b3 100644
--- a/tests/auto/declarative/qdeclarativefolderlistmodel/tst_qdeclarativefolderlistmodel.cpp
+++ b/tests/auto/declarative/qdeclarativefolderlistmodel/tst_qdeclarativefolderlistmodel.cpp
@@ -53,7 +53,7 @@ const int FileNameRole = Qt::UserRole+1;
const int FilePathRole = Qt::UserRole+2;
enum SortField { Unsorted, Name, Time, Size, Type };
-class tst_qdeclarativefolderlistmodel : public QObject
+class tst_qdeclarativefolderlistmodel : public QDeclarativeDataTest
{
Q_OBJECT
public:
@@ -98,16 +98,16 @@ void tst_qdeclarativefolderlistmodel::checkNoErrors(const QDeclarativeComponent&
void tst_qdeclarativefolderlistmodel::basicProperties()
{
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("basic.qml")));
+ QDeclarativeComponent component(&engine, testFileUrl("basic.qml"));
checkNoErrors(component);
QAbstractListModel *flm = qobject_cast<QAbstractListModel*>(component.create());
QVERIFY(flm != 0);
- flm->setProperty("folder",QUrl::fromLocalFile(TESTDATA("")));
+ flm->setProperty("folder", dataDirectoryUrl());
QTRY_COMPARE(flm->property("count").toInt(),4); // wait for refresh
- QCOMPARE(flm->property("folder").toUrl(), QUrl::fromLocalFile(TESTDATA("")));
- QCOMPARE(flm->property("parentFolder").toUrl(), QUrl::fromLocalFile(QDir(TESTDATA("..")).canonicalPath()));
+ QCOMPARE(flm->property("folder").toUrl(), dataDirectoryUrl());
+ QCOMPARE(flm->property("parentFolder").toUrl(), QUrl::fromLocalFile(QDir(directory()).canonicalPath()));
QCOMPARE(flm->property("sortField").toInt(), int(Name));
QCOMPARE(flm->property("nameFilters").toStringList(), QStringList() << "*.qml");
QCOMPARE(flm->property("sortReversed").toBool(), false);
@@ -124,7 +124,7 @@ void tst_qdeclarativefolderlistmodel::basicProperties()
void tst_qdeclarativefolderlistmodel::resetFiltering()
{
// see QTBUG-17837
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("resetFiltering.qml")));
+ QDeclarativeComponent component(&engine, testFileUrl("resetFiltering.qml"));
checkNoErrors(component);
QAbstractListModel *flm = qobject_cast<QAbstractListModel*>(component.create());
@@ -133,19 +133,19 @@ void tst_qdeclarativefolderlistmodel::resetFiltering()
connect(flm, SIGNAL(rowsRemoved(const QModelIndex&,int,int)),
this, SLOT(removed(const QModelIndex&,int,int)));
- flm->setProperty("folder",QUrl::fromLocalFile(TESTDATA("resetfiltering")));
+ flm->setProperty("folder", testFileUrl("resetfiltering"));
QTRY_COMPARE(flm->property("count").toInt(),1); // should just be "test.txt" visible
int count = flm->rowCount();
QCOMPARE(removeStart, 0);
QCOMPARE(removeEnd, count-1);
- flm->setProperty("folder",QUrl::fromLocalFile(TESTDATA("resetfiltering/innerdir")));
+ flm->setProperty("folder", testFileUrl("resetfiltering/innerdir"));
QTRY_COMPARE(flm->property("count").toInt(),1); // should just be "test2.txt" visible
count = flm->rowCount();
QCOMPARE(removeStart, 0);
QCOMPARE(removeEnd, count-1);
- flm->setProperty("folder",QUrl::fromLocalFile(TESTDATA("resetfiltering")));
+ flm->setProperty("folder", testFileUrl("resetfiltering"));
QTRY_COMPARE(flm->property("count").toInt(),1); // should just be "test.txt" visible
count = flm->rowCount();
QCOMPARE(removeStart, 0);
@@ -154,13 +154,13 @@ void tst_qdeclarativefolderlistmodel::resetFiltering()
void tst_qdeclarativefolderlistmodel::refresh()
{
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("basic.qml")));
+ QDeclarativeComponent component(&engine, testFileUrl("basic.qml"));
checkNoErrors(component);
QAbstractListModel *flm = qobject_cast<QAbstractListModel*>(component.create());
QVERIFY(flm != 0);
- flm->setProperty("folder",QUrl::fromLocalFile(TESTDATA("")));
+ flm->setProperty("folder", dataDirectoryUrl());
QTRY_COMPARE(flm->property("count").toInt(),4); // wait for refresh
int count = flm->rowCount();
diff --git a/tests/auto/declarative/qdeclarativeincubator/qdeclarativeincubator.pro b/tests/auto/declarative/qdeclarativeincubator/qdeclarativeincubator.pro
index 11725b40bc..947b16010b 100644
--- a/tests/auto/declarative/qdeclarativeincubator/qdeclarativeincubator.pro
+++ b/tests/auto/declarative/qdeclarativeincubator/qdeclarativeincubator.pro
@@ -3,8 +3,11 @@ TARGET = tst_qdeclarativeincubator
macx:CONFIG -= app_bundle
SOURCES += tst_qdeclarativeincubator.cpp \
- testtypes.cpp
-HEADERS += testtypes.h
+ testtypes.cpp \
+ ../../shared/util.cpp
+
+HEADERS += testtypes.h \
+ ../../shared/util.h
testDataFiles.files = data
testDataFiles.path = .
diff --git a/tests/auto/declarative/qdeclarativeincubator/tst_qdeclarativeincubator.cpp b/tests/auto/declarative/qdeclarativeincubator/tst_qdeclarativeincubator.cpp
index 599b5d21b1..151f7880c8 100644
--- a/tests/auto/declarative/qdeclarativeincubator/tst_qdeclarativeincubator.cpp
+++ b/tests/auto/declarative/qdeclarativeincubator/tst_qdeclarativeincubator.cpp
@@ -53,17 +53,7 @@
#include <QDeclarativeIncubator>
#include "../../shared/util.h"
-inline QUrl TEST_FILE(const QString &filename)
-{
- return QUrl::fromLocalFile(TESTDATA(filename));
-}
-
-inline QUrl TEST_FILE(const char *filename)
-{
- return TEST_FILE(QLatin1String(filename));
-}
-
-class tst_qdeclarativeincubator : public QObject
+class tst_qdeclarativeincubator : public QDeclarativeDataTest
{
Q_OBJECT
public:
@@ -101,7 +91,7 @@ private:
QVERIFY(!component.isError()); \
QVERIFY(component.errors().isEmpty()); \
} else { \
- QFile file(TESTDATA(errorfile)); \
+ QFile file(QDeclarativeDataTest::instance()->testFile(errorfile)); \
QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text)); \
QByteArray data = file.readAll(); \
file.close(); \
@@ -123,6 +113,7 @@ private:
void tst_qdeclarativeincubator::initTestCase()
{
+ QDeclarativeDataTest::initTestCase();
registerTypes();
engine.setIncubationController(&controller);
}
@@ -151,7 +142,7 @@ void tst_qdeclarativeincubator::objectDeleted()
{
SelfRegisteringType::clearMe();
- QDeclarativeComponent component(&engine, TEST_FILE("objectDeleted.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("objectDeleted.qml"));
QVERIFY(component.isReady());
QDeclarativeIncubator incubator;
@@ -184,7 +175,7 @@ void tst_qdeclarativeincubator::clear()
{
SelfRegisteringType::clearMe();
- QDeclarativeComponent component(&engine, TEST_FILE("clear.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("clear.qml"));
QVERIFY(component.isReady());
// Clear in null state
@@ -252,7 +243,7 @@ void tst_qdeclarativeincubator::noIncubationController()
// All incubators should behave synchronously when there is no controller
QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, TEST_FILE("noIncubationController.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("noIncubationController.qml"));
QVERIFY(component.isReady());
@@ -286,7 +277,7 @@ void tst_qdeclarativeincubator::noIncubationController()
void tst_qdeclarativeincubator::forceCompletion()
{
- QDeclarativeComponent component(&engine, TEST_FILE("forceCompletion.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("forceCompletion.qml"));
QVERIFY(component.isReady());
{
@@ -364,7 +355,7 @@ void tst_qdeclarativeincubator::forceCompletion()
void tst_qdeclarativeincubator::setInitialState()
{
- QDeclarativeComponent component(&engine, TEST_FILE("setInitialState.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("setInitialState.qml"));
QVERIFY(component.isReady());
struct MyIncubator : public QDeclarativeIncubator
@@ -409,7 +400,7 @@ void tst_qdeclarativeincubator::clearDuringCompletion()
CompletionRegisteringType::clearMe();
SelfRegisteringType::clearMe();
- QDeclarativeComponent component(&engine, TEST_FILE("clearDuringCompletion.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("clearDuringCompletion.qml"));
QVERIFY(component.isReady());
QDeclarativeIncubator incubator;
@@ -437,7 +428,7 @@ void tst_qdeclarativeincubator::clearDuringCompletion()
void tst_qdeclarativeincubator::objectDeletionAfterInit()
{
- QDeclarativeComponent component(&engine, TEST_FILE("clear.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("clear.qml"));
QVERIFY(component.isReady());
struct MyIncubator : public QDeclarativeIncubator
@@ -493,7 +484,7 @@ public:
void start()
{
incubator = new MyIncubator(QDeclarativeIncubator::Synchronous, this);
- component = new QDeclarativeComponent(engine, TEST_FILE("recursiveClear.1.qml"));
+ component = new QDeclarativeComponent(engine, QDeclarativeDataTest::instance()->testFileUrl("recursiveClear.1.qml"));
component->create(*incubator);
}
@@ -505,7 +496,7 @@ public slots:
void switchIt() {
component->deleteLater();
incubator->clear();
- component = new QDeclarativeComponent(engine, TEST_FILE("recursiveClear.2.qml"));
+ component = new QDeclarativeComponent(engine, QDeclarativeDataTest::instance()->testFileUrl("recursiveClear.2.qml"));
component->create(*incubator);
}
};
@@ -531,7 +522,7 @@ void tst_qdeclarativeincubator::statusChanged()
};
{
- QDeclarativeComponent component(&engine, TEST_FILE("statusChanged.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("statusChanged.qml"));
QVERIFY(component.isReady());
MyIncubator incubator(QDeclarativeIncubator::Synchronous);
@@ -545,7 +536,7 @@ void tst_qdeclarativeincubator::statusChanged()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("statusChanged.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("statusChanged.qml"));
QVERIFY(component.isReady());
MyIncubator incubator(QDeclarativeIncubator::Asynchronous);
@@ -567,7 +558,7 @@ void tst_qdeclarativeincubator::statusChanged()
}
{
- QDeclarativeComponent component2(&engine, TEST_FILE("statusChanged.nested.qml"));
+ QDeclarativeComponent component2(&engine, testFileUrl("statusChanged.nested.qml"));
QVERIFY(component2.isReady());
MyIncubator incubator(QDeclarativeIncubator::Asynchronous);
@@ -594,7 +585,7 @@ void tst_qdeclarativeincubator::asynchronousIfNested()
{
// Asynchronous if nested within a finalized context behaves synchronously
{
- QDeclarativeComponent component(&engine, TEST_FILE("asynchronousIfNested.1.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("asynchronousIfNested.1.qml"));
QVERIFY(component.isReady());
QObject *object = component.create();
@@ -616,7 +607,7 @@ void tst_qdeclarativeincubator::asynchronousIfNested()
{
SelfRegisteringType::clearMe();
- QDeclarativeComponent component(&engine, TEST_FILE("asynchronousIfNested.2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("asynchronousIfNested.2.qml"));
QVERIFY(component.isReady());
QDeclarativeIncubator incubator;
@@ -661,7 +652,7 @@ void tst_qdeclarativeincubator::asynchronousIfNested()
{
SelfRegisteringType::clearMe();
- QDeclarativeComponent component(&engine, TEST_FILE("asynchronousIfNested.3.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("asynchronousIfNested.3.qml"));
QVERIFY(component.isReady());
struct CallbackData {
@@ -671,7 +662,7 @@ void tst_qdeclarativeincubator::asynchronousIfNested()
static void callback(CallbackRegisteringType *o, void *data) {
CallbackData *d = (CallbackData *)data;
- QDeclarativeComponent c(d->engine, TEST_FILE("asynchronousIfNested.1.qml"));
+ QDeclarativeComponent c(d->engine, QDeclarativeDataTest::instance()->testFileUrl("asynchronousIfNested.1.qml"));
if (!c.isReady()) return;
QDeclarativeIncubator incubator(QDeclarativeIncubator::AsynchronousIfNested);
@@ -700,7 +691,7 @@ void tst_qdeclarativeincubator::asynchronousIfNested()
void tst_qdeclarativeincubator::nestedComponent()
{
- QDeclarativeComponent component(&engine, TEST_FILE("nestedComponent.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("nestedComponent.qml"));
QVERIFY(component.isReady());
QObject *object = component.create();
@@ -735,7 +726,7 @@ void tst_qdeclarativeincubator::chainedAsynchronousIfNested()
{
SelfRegisteringType::clearMe();
- QDeclarativeComponent component(&engine, TEST_FILE("chainedAsynchronousIfNested.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("chainedAsynchronousIfNested.qml"));
QVERIFY(component.isReady());
QDeclarativeIncubator incubator(QDeclarativeIncubator::Asynchronous);
@@ -819,10 +810,10 @@ void tst_qdeclarativeincubator::chainedAsynchronousIfNestedOnCompleted()
{
SelfRegisteringType::clearMe();
- QDeclarativeComponent component(&engine, TEST_FILE("chainInCompletion.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("chainInCompletion.qml"));
QVERIFY(component.isReady());
- QDeclarativeComponent c1(&engine, TEST_FILE("chainedAsynchronousIfNested.qml"));
+ QDeclarativeComponent c1(&engine, testFileUrl("chainedAsynchronousIfNested.qml"));
QVERIFY(c1.isReady());
struct MyIncubator : public QDeclarativeIncubator {
@@ -962,7 +953,7 @@ void tst_qdeclarativeincubator::selfDelete()
};
{
- QDeclarativeComponent component(&engine, TEST_FILE("selfDelete.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("selfDelete.qml"));
#define DELETE_TEST(status, mode) { \
bool done = false; \
@@ -984,7 +975,7 @@ void tst_qdeclarativeincubator::selfDelete()
{
SelfRegisteringType::clearMe();
- QDeclarativeComponent component(&engine, TEST_FILE("objectDeleted.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("objectDeleted.qml"));
QVERIFY(component.isReady());
bool done = false;
@@ -1019,7 +1010,7 @@ void tst_qdeclarativeincubator::selfDelete()
void tst_qdeclarativeincubator::contextDelete()
{
QDeclarativeContext *context = new QDeclarativeContext(engine.rootContext());
- QDeclarativeComponent component(&engine, TEST_FILE("contextDelete.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("contextDelete.qml"));
QDeclarativeIncubator incubator;
component.create(incubator, context);
diff --git a/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro b/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro
index bd8d963f3f..8d09720670 100644
--- a/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro
+++ b/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro
@@ -2,7 +2,9 @@ CONFIG += testcase
TARGET = tst_qdeclarativeinfo
macx:CONFIG -= app_bundle
-SOURCES += tst_qdeclarativeinfo.cpp
+SOURCES += tst_qdeclarativeinfo.cpp \
+ ../../shared/util.cpp
+HEADERS += ../../shared/util.h
testDataFiles.files = data
testDataFiles.path = .
diff --git a/tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp b/tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp
index d4e3df2ffb..8fdd810037 100644
--- a/tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp
+++ b/tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp
@@ -47,7 +47,7 @@
#include <qdeclarativeinfo.h>
#include "../../shared/util.h"
-class tst_qdeclarativeinfo : public QObject
+class tst_qdeclarativeinfo : public QDeclarativeDataTest
{
Q_OBJECT
public:
@@ -67,14 +67,9 @@ private:
QDeclarativeEngine engine;
};
-inline QUrl TEST_FILE(const QString &filename)
-{
- return QUrl::fromLocalFile(TESTDATA(filename));
-}
-
void tst_qdeclarativeinfo::qmlObject()
{
- QDeclarativeComponent component(&engine, TEST_FILE("qmlObject.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("qmlObject.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -93,7 +88,7 @@ void tst_qdeclarativeinfo::qmlObject()
void tst_qdeclarativeinfo::nestedQmlObject()
{
- QDeclarativeComponent component(&engine, TEST_FILE("nestedQmlObject.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("nestedQmlObject.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -107,14 +102,14 @@ void tst_qdeclarativeinfo::nestedQmlObject()
QTest::ignoreMessage(QtWarningMsg, qPrintable(message));
qmlInfo(nested) << "Outer Object";
- message = TEST_FILE("NestedObject.qml").toString() + ":6:14: QML QtObject: Inner Object";
+ message = testFileUrl("NestedObject.qml").toString() + ":6:14: QML QtObject: Inner Object";
QTest::ignoreMessage(QtWarningMsg, qPrintable(message));
qmlInfo(nested2) << "Inner Object";
}
void tst_qdeclarativeinfo::nestedComponent()
{
- QDeclarativeComponent component(&engine, TEST_FILE("NestedComponent.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("NestedComponent.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
diff --git a/tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro b/tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro
index ae3aa9d287..460bbfea5e 100644
--- a/tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro
+++ b/tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro
@@ -2,7 +2,9 @@ CONFIG += testcase
TARGET = tst_qdeclarativelistmodel
macx:CONFIG -= app_bundle
-SOURCES += tst_qdeclarativelistmodel.cpp
+SOURCES += tst_qdeclarativelistmodel.cpp \
+ ../../shared/util.cpp
+HEADERS += ../../shared/util.h
testDataFiles.files = data
testDataFiles.path = .
diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
index 1de2a2868e..0455fdeadd 100644
--- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
+++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
@@ -81,7 +81,7 @@ static bool isValidErrorMessage(const QString &msg, bool dynamicRoleTest)
return valid;
}
-class tst_qdeclarativelistmodel : public QObject
+class tst_qdeclarativelistmodel : public QDeclarativeDataTest
{
Q_OBJECT
public:
@@ -622,7 +622,7 @@ void tst_qdeclarativelistmodel::dynamic_worker()
QDeclarativeListModel model;
model.setDynamicRoles(dynamicRoles);
QDeclarativeEngine eng;
- QDeclarativeComponent component(&eng, QUrl::fromLocalFile(TESTDATA("model.qml")));
+ QDeclarativeComponent component(&eng, testFileUrl("model.qml"));
QQuickItem *item = createWorkerTest(&eng, &component, &model);
QVERIFY(item != 0);
@@ -673,7 +673,7 @@ void tst_qdeclarativelistmodel::dynamic_worker_sync()
QDeclarativeListModel model;
model.setDynamicRoles(dynamicRoles);
QDeclarativeEngine eng;
- QDeclarativeComponent component(&eng, QUrl::fromLocalFile(TESTDATA("model.qml")));
+ QDeclarativeComponent component(&eng, testFileUrl("model.qml"));
QQuickItem *item = createWorkerTest(&eng, &component, &model);
QVERIFY(item != 0);
@@ -704,7 +704,7 @@ void tst_qdeclarativelistmodel::dynamic_worker_sync()
void tst_qdeclarativelistmodel::enumerate()
{
QDeclarativeEngine eng;
- QDeclarativeComponent component(&eng, QUrl::fromLocalFile(TESTDATA("enumerate.qml")));
+ QDeclarativeComponent component(&eng, testFileUrl("enumerate.qml"));
QVERIFY(!component.isError());
QQuickItem *item = qobject_cast<QQuickItem*>(component.create());
QVERIFY(item != 0);
@@ -950,7 +950,7 @@ void tst_qdeclarativelistmodel::get_worker()
QDeclarativeListModel model;
model.setDynamicRoles(dynamicRoles);
QDeclarativeEngine eng;
- QDeclarativeComponent component(&eng, QUrl::fromLocalFile(TESTDATA("model.qml")));
+ QDeclarativeComponent component(&eng, testFileUrl("model.qml"));
QQuickItem *item = createWorkerTest(&eng, &component, &model);
QVERIFY(item != 0);
@@ -1102,7 +1102,7 @@ void tst_qdeclarativelistmodel::get_nested_data()
void tst_qdeclarativelistmodel::crash_model_with_multiple_roles()
{
QDeclarativeEngine eng;
- QDeclarativeComponent component(&eng, QUrl::fromLocalFile(TESTDATA("multipleroles.qml")));
+ QDeclarativeComponent component(&eng, testFileUrl("multipleroles.qml"));
QObject *rootItem = component.create();
QVERIFY(component.errorString().isEmpty());
QVERIFY(rootItem != 0);
@@ -1119,7 +1119,7 @@ void tst_qdeclarativelistmodel::crash_model_with_multiple_roles()
void tst_qdeclarativelistmodel::set_model_cache()
{
QDeclarativeEngine eng;
- QDeclarativeComponent component(&eng, QUrl::fromLocalFile(TESTDATA("setmodelcachelist.qml")));
+ QDeclarativeComponent component(&eng, testFileUrl("setmodelcachelist.qml"));
QObject *model = component.create();
QVERIFY2(component.errorString().isEmpty(), QTest::toString(component.errorString()));
QVERIFY(model != 0);
@@ -1271,7 +1271,7 @@ void tst_qdeclarativelistmodel::property_changes_worker()
QDeclarativeListModel model;
model.setDynamicRoles(dynamicRoles);
QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("model.qml")));
+ QDeclarativeComponent component(&engine, testFileUrl("model.qml"));
QVERIFY2(component.errorString().isEmpty(), component.errorString().toUtf8());
QQuickItem *item = createWorkerTest(&engine, &component, &model);
QVERIFY(item != 0);
@@ -1362,7 +1362,7 @@ void tst_qdeclarativelistmodel::signal_handlers()
QFETCH(bool, dynamicRoles);
QDeclarativeEngine eng;
- QDeclarativeComponent component(&eng, QUrl::fromLocalFile(TESTDATA("signalhandlers.qml")));
+ QDeclarativeComponent component(&eng, testFileUrl("signalhandlers.qml"));
QObject *model = component.create();
QDeclarativeListModel *lm = qobject_cast<QDeclarativeListModel *>(model);
QVERIFY(lm != 0);
@@ -1389,7 +1389,7 @@ void tst_qdeclarativelistmodel::worker_sync()
QDeclarativeListModel model;
model.setDynamicRoles(dynamicRoles);
QDeclarativeEngine eng;
- QDeclarativeComponent component(&eng, QUrl::fromLocalFile(TESTDATA("workersync.qml")));
+ QDeclarativeComponent component(&eng, testFileUrl("workersync.qml"));
QQuickItem *item = createWorkerTest(&eng, &component, &model);
QVERIFY(item != 0);
@@ -1454,7 +1454,7 @@ void tst_qdeclarativelistmodel::worker_remove_element()
QDeclarativeListModel model;
model.setDynamicRoles(dynamicRoles);
QDeclarativeEngine eng;
- QDeclarativeComponent component(&eng, QUrl::fromLocalFile(TESTDATA("workerremoveelement.qml")));
+ QDeclarativeComponent component(&eng, testFileUrl("workerremoveelement.qml"));
QQuickItem *item = createWorkerTest(&eng, &component, &model);
QVERIFY(item != 0);
@@ -1495,7 +1495,7 @@ void tst_qdeclarativelistmodel::worker_remove_list()
QDeclarativeListModel model;
model.setDynamicRoles(dynamicRoles);
QDeclarativeEngine eng;
- QDeclarativeComponent component(&eng, QUrl::fromLocalFile(TESTDATA("workerremovelist.qml")));
+ QDeclarativeComponent component(&eng, testFileUrl("workerremovelist.qml"));
QQuickItem *item = createWorkerTest(&eng, &component, &model);
QVERIFY(item != 0);
@@ -1577,7 +1577,7 @@ void tst_qdeclarativelistmodel::dynamic_role()
QDeclarativeListModel model;
model.setDynamicRoles(true);
QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("model.qml")));
+ QDeclarativeComponent component(&engine, testFileUrl("model.qml"));
QQuickItem *item = createWorkerTest(&engine, &component, &model);
QVERIFY(item != 0);
diff --git a/tests/auto/declarative/qdeclarativelistreference/qdeclarativelistreference.pro b/tests/auto/declarative/qdeclarativelistreference/qdeclarativelistreference.pro
index 5020c02f43..37778aab5b 100644
--- a/tests/auto/declarative/qdeclarativelistreference/qdeclarativelistreference.pro
+++ b/tests/auto/declarative/qdeclarativelistreference/qdeclarativelistreference.pro
@@ -2,7 +2,9 @@ CONFIG += testcase
TARGET = tst_qdeclarativelistreference
macx:CONFIG -= app_bundle
-SOURCES += tst_qdeclarativelistreference.cpp
+SOURCES += tst_qdeclarativelistreference.cpp \
+ ../../shared/util.cpp
+HEADERS += ../../shared/util.h
testDataFiles.files = data
testDataFiles.path = .
diff --git a/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp b/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp
index e09db2c9c7..3031d68b42 100644
--- a/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp
+++ b/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp
@@ -51,17 +51,7 @@
#include <QDebug>
#include "../../shared/util.h"
-inline QUrl TEST_FILE(const QString &filename)
-{
- return QUrl::fromLocalFile(TESTDATA(filename));
-}
-
-inline QUrl TEST_FILE(const char *filename)
-{
- return TEST_FILE(QLatin1String(filename));
-}
-
-class tst_qdeclarativelistreference : public QObject
+class tst_qdeclarativelistreference : public QDeclarativeDataTest
{
Q_OBJECT
public:
@@ -105,6 +95,7 @@ public:
void tst_qdeclarativelistreference::initTestCase()
{
+ QDeclarativeDataTest::initTestCase();
qmlRegisterType<TestType>();
}
@@ -540,7 +531,7 @@ void tst_qdeclarativelistreference::qmlmetaproperty()
void tst_qdeclarativelistreference::engineTypes()
{
QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, TEST_FILE("engineTypes.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("engineTypes.qml"));
QObject *o = component.create();
QVERIFY(o);
@@ -563,7 +554,7 @@ void tst_qdeclarativelistreference::engineTypes()
void tst_qdeclarativelistreference::variantToList()
{
QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, TEST_FILE("variantToList.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("variantToList.qml"));
QObject *o = component.create();
QVERIFY(o);
diff --git a/tests/auto/declarative/qdeclarativelocale/qdeclarativelocale.pro b/tests/auto/declarative/qdeclarativelocale/qdeclarativelocale.pro
index 05ce0fec6a..c01bacf832 100644
--- a/tests/auto/declarative/qdeclarativelocale/qdeclarativelocale.pro
+++ b/tests/auto/declarative/qdeclarativelocale/qdeclarativelocale.pro
@@ -2,7 +2,9 @@ CONFIG += testcase
TARGET = tst_qdeclarativelocale
macx:CONFIG -= app_bundle
-SOURCES += tst_qdeclarativelocale.cpp
+SOURCES += tst_qdeclarativelocale.cpp \
+ ../../shared/util.cpp
+HEADERS += ../../shared/util.h
testDataFiles.files = data
testDataFiles.path = .
diff --git a/tests/auto/declarative/qdeclarativelocale/tst_qdeclarativelocale.cpp b/tests/auto/declarative/qdeclarativelocale/tst_qdeclarativelocale.cpp
index d49122c889..9495e57ee5 100644
--- a/tests/auto/declarative/qdeclarativelocale/tst_qdeclarativelocale.cpp
+++ b/tests/auto/declarative/qdeclarativelocale/tst_qdeclarativelocale.cpp
@@ -47,7 +47,7 @@
#include <qcolor.h>
#include "../../shared/util.h"
-class tst_qdeclarativelocale : public QObject
+class tst_qdeclarativelocale : public QDeclarativeDataTest
{
Q_OBJECT
public:
@@ -118,7 +118,7 @@ private:
void tst_qdeclarativelocale::defaultLocale()
{
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("properties.qml")));
+ QDeclarativeComponent c(&engine, testFileUrl("properties.qml"));
QObject *obj = c.create();
QVERIFY(obj);
@@ -183,7 +183,7 @@ void tst_qdeclarativelocale::properties()
QFETCH(QByteArray, property);
QFETCH(QVariant, value);
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("properties.qml")));
+ QDeclarativeComponent c(&engine, testFileUrl("properties.qml"));
QObject *obj = c.create();
QVERIFY(obj);
@@ -227,7 +227,7 @@ void tst_qdeclarativelocale::currencySymbol()
QFETCH(QString, locale);
QFETCH(int, param);
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("functions.qml")));
+ QDeclarativeComponent c(&engine, testFileUrl("functions.qml"));
QObject *obj = c.create();
QVERIFY(obj);
@@ -287,7 +287,7 @@ void tst_qdeclarativelocale::monthName()
QFETCH(QString, locale);
QFETCH(int, param);
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("functions.qml")));
+ QDeclarativeComponent c(&engine, testFileUrl("functions.qml"));
QObject *obj = c.create();
QVERIFY(obj);
@@ -324,7 +324,7 @@ void tst_qdeclarativelocale::standaloneMonthName()
QFETCH(QString, locale);
QFETCH(int, param);
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("functions.qml")));
+ QDeclarativeComponent c(&engine, testFileUrl("functions.qml"));
QObject *obj = c.create();
QVERIFY(obj);
@@ -361,7 +361,7 @@ void tst_qdeclarativelocale::dayName()
QFETCH(QString, locale);
QFETCH(int, param);
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("functions.qml")));
+ QDeclarativeComponent c(&engine, testFileUrl("functions.qml"));
QObject *obj = c.create();
QVERIFY(obj);
@@ -397,7 +397,7 @@ void tst_qdeclarativelocale::standaloneDayName()
QFETCH(QString, locale);
QFETCH(int, param);
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("functions.qml")));
+ QDeclarativeComponent c(&engine, testFileUrl("functions.qml"));
QObject *obj = c.create();
QVERIFY(obj);
@@ -437,7 +437,7 @@ void tst_qdeclarativelocale::weekDays()
{
QFETCH(QString, locale);
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("properties.qml")));
+ QDeclarativeComponent c(&engine, testFileUrl("properties.qml"));
QObject *obj = c.create();
QVERIFY(obj);
@@ -474,7 +474,7 @@ void tst_qdeclarativelocale::dateTimeFormat()
QFETCH(QString, locale);
QFETCH(int, param);
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("functions.qml")));
+ QDeclarativeComponent c(&engine, testFileUrl("functions.qml"));
QObject *obj = c.create();
QVERIFY(obj);
@@ -503,7 +503,7 @@ void tst_qdeclarativelocale::dateFormat()
QFETCH(QString, locale);
QFETCH(int, param);
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("functions.qml")));
+ QDeclarativeComponent c(&engine, testFileUrl("functions.qml"));
QObject *obj = c.create();
QVERIFY(obj);
@@ -532,7 +532,7 @@ void tst_qdeclarativelocale::timeFormat()
QFETCH(QString, locale);
QFETCH(int, param);
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("functions.qml")));
+ QDeclarativeComponent c(&engine, testFileUrl("functions.qml"));
QObject *obj = c.create();
QVERIFY(obj);
@@ -561,7 +561,7 @@ void tst_qdeclarativelocale::dateToLocaleString()
QFETCH(QString, locale);
QFETCH(int, param);
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("date.qml")));
+ QDeclarativeComponent c(&engine, testFileUrl("date.qml"));
QObject *obj = c.create();
QVERIFY(obj);
@@ -622,7 +622,7 @@ void tst_qdeclarativelocale::dateToLocaleStringFormatted()
QFETCH(QString, locale);
QFETCH(QString, format);
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("date.qml")));
+ QDeclarativeComponent c(&engine, testFileUrl("date.qml"));
QObject *obj = c.create();
QVERIFY(obj);
@@ -653,7 +653,7 @@ void tst_qdeclarativelocale::dateToLocaleDateString()
QFETCH(QString, locale);
QFETCH(int, param);
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("date.qml")));
+ QDeclarativeComponent c(&engine, testFileUrl("date.qml"));
QObject *obj = c.create();
QVERIFY(obj);
@@ -714,7 +714,7 @@ void tst_qdeclarativelocale::dateToLocaleDateStringFormatted()
QFETCH(QString, locale);
QFETCH(QString, format);
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("date.qml")));
+ QDeclarativeComponent c(&engine, testFileUrl("date.qml"));
QObject *obj = c.create();
QVERIFY(obj);
@@ -745,7 +745,7 @@ void tst_qdeclarativelocale::dateToLocaleTimeString()
QFETCH(QString, locale);
QFETCH(int, param);
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("date.qml")));
+ QDeclarativeComponent c(&engine, testFileUrl("date.qml"));
QObject *obj = c.create();
QVERIFY(obj);
@@ -806,7 +806,7 @@ void tst_qdeclarativelocale::dateToLocaleTimeStringFormatted()
QFETCH(QString, locale);
QFETCH(QString, format);
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("date.qml")));
+ QDeclarativeComponent c(&engine, testFileUrl("date.qml"));
QObject *obj = c.create();
QVERIFY(obj);
@@ -848,7 +848,7 @@ void tst_qdeclarativelocale::dateFromLocaleString()
QFETCH(QString, locale);
QFETCH(QString, format);
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("date.qml")));
+ QDeclarativeComponent c(&engine, testFileUrl("date.qml"));
QObject *obj = c.create();
QVERIFY(obj);
@@ -892,7 +892,7 @@ void tst_qdeclarativelocale::dateFromLocaleDateString()
QFETCH(QString, locale);
QFETCH(QString, format);
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("date.qml")));
+ QDeclarativeComponent c(&engine, testFileUrl("date.qml"));
QObject *obj = c.create();
QVERIFY(obj);
@@ -936,7 +936,7 @@ void tst_qdeclarativelocale::dateFromLocaleTimeString()
QFETCH(QString, locale);
QFETCH(QString, format);
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("date.qml")));
+ QDeclarativeComponent c(&engine, testFileUrl("date.qml"));
QObject *obj = c.create();
QVERIFY(obj);
@@ -981,7 +981,7 @@ void tst_qdeclarativelocale::numberToLocaleString()
QFETCH(char, format);
QFETCH(int, prec);
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("number.qml")));
+ QDeclarativeComponent c(&engine, testFileUrl("number.qml"));
QObject *obj = c.create();
QVERIFY(obj);
@@ -1022,7 +1022,7 @@ void tst_qdeclarativelocale::numberToLocaleCurrencyString()
QFETCH(QString, locale);
QFETCH(QString, symbol);
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("number.qml")));
+ QDeclarativeComponent c(&engine, testFileUrl("number.qml"));
QObject *obj = c.create();
QVERIFY(obj);
@@ -1062,7 +1062,7 @@ void tst_qdeclarativelocale::numberFromLocaleString()
QFETCH(QString, locale);
QFETCH(double, number);
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("number.qml")));
+ QDeclarativeComponent c(&engine, testFileUrl("number.qml"));
QObject *obj = c.create();
QVERIFY(obj);
@@ -1083,7 +1083,7 @@ void tst_qdeclarativelocale::numberFromLocaleString()
void tst_qdeclarativelocale::numberConstToLocaleString()
{
- QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("number.qml")));
+ QDeclarativeComponent c(&engine, testFileUrl("number.qml"));
QObject *obj = c.create();
QVERIFY(obj);
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp
index 1530eb9d36..c51918d13a 100644
--- a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp
@@ -51,15 +51,13 @@
#define SERVER_PORT 14450
-class tst_qdeclarativemoduleplugin : public QObject
+class tst_qdeclarativemoduleplugin : public QDeclarativeDataTest
{
Q_OBJECT
public:
- tst_qdeclarativemoduleplugin()
- {
- }
private slots:
+ virtual void initTestCase();
void importsPlugin();
void importsPlugin2();
void importsPlugin21();
@@ -72,8 +70,19 @@ private slots:
void versionNotInstalled_data();
void implicitQmldir();
void implicitQmldir_data();
+
+private:
+ QString m_importsDirectory;
};
+void tst_qdeclarativemoduleplugin::initTestCase()
+{
+ QDeclarativeDataTest::initTestCase();
+ m_importsDirectory = directory() + QStringLiteral("/imports");
+ QVERIFY2(QFileInfo(m_importsDirectory).isDir(),
+ qPrintable(QString::fromLatin1("Imports directory '%1' does not exist.").arg(m_importsDirectory)));
+}
+
#define VERIFY_ERRORS(errorfile) \
if (!errorfile) { \
if (qgetenv("DEBUG") != "" && !component.errors().isEmpty()) \
@@ -81,7 +90,7 @@ private slots:
QVERIFY(!component.isError()); \
QVERIFY(component.errors().isEmpty()); \
} else { \
- QString verify_errors_file_name = TESTDATA(errorfile); \
+ QString verify_errors_file_name = testFile(errorfile); \
QFile file(verify_errors_file_name); \
QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text)); \
QByteArray data = file.readAll(); \
@@ -101,7 +110,7 @@ private slots:
qWarning() << "Expected:" << expected << "Actual:" << actual; \
} \
if (qgetenv("QDECLARATIVELANGUAGE_UPDATEERRORS") != "" && expected != actual) {\
- QFile file(TESTDATA(errorfile)); \
+ QFile file(testFile(errorfile)); \
QVERIFY(file.open(QIODevice::WriteOnly)); \
for (int ii = 0; ii < actual.count(); ++ii) { \
file.write(actual.at(ii)); file.write("\n"); \
@@ -112,40 +121,13 @@ private slots:
} \
}
-inline QUrl TEST_FILE(const QString &filename)
-{
- return QUrl::fromLocalFile(TESTDATA(filename));
-}
-
-QString IMPORTSDIR()
-{
- // Try to find it relative to the binary.
- QDir appDir(QCoreApplication::applicationDirPath() + QDir::separator() + QLatin1String("imports"));
- if (appDir.exists()) {
- return appDir.absolutePath();
- }
-
- // Else try to find it in the source tree
- QDir sourceDir(QFileInfo(__FILE__).absoluteDir().filePath(QLatin1String("imports")));
- if (sourceDir.exists()) {
- return sourceDir.absolutePath();
- }
-
- qWarning("requested importsPath could not be found (looked at: %s, %s)",
- qPrintable(appDir.path()),
- qPrintable(sourceDir.path())
- );
-
- return QString();
-}
-
void tst_qdeclarativemoduleplugin::importsPlugin()
{
QDeclarativeEngine engine;
- engine.addImportPath(IMPORTSDIR());
+ engine.addImportPath(m_importsDirectory);
QTest::ignoreMessage(QtWarningMsg, "plugin created");
QTest::ignoreMessage(QtWarningMsg, "import worked");
- QDeclarativeComponent component(&engine, TEST_FILE("works.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl(QStringLiteral("works.qml")));
foreach (QDeclarativeError err, component.errors())
qWarning() << err;
VERIFY_ERRORS(0);
@@ -158,10 +140,10 @@ void tst_qdeclarativemoduleplugin::importsPlugin()
void tst_qdeclarativemoduleplugin::importsPlugin2()
{
QDeclarativeEngine engine;
- engine.addImportPath(IMPORTSDIR());
+ engine.addImportPath(m_importsDirectory);
QTest::ignoreMessage(QtWarningMsg, "plugin2 created");
QTest::ignoreMessage(QtWarningMsg, "import2 worked");
- QDeclarativeComponent component(&engine, TEST_FILE("works2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl(QStringLiteral("works2.qml")));
foreach (QDeclarativeError err, component.errors())
qWarning() << err;
VERIFY_ERRORS(0);
@@ -174,10 +156,10 @@ void tst_qdeclarativemoduleplugin::importsPlugin2()
void tst_qdeclarativemoduleplugin::importsPlugin21()
{
QDeclarativeEngine engine;
- engine.addImportPath(IMPORTSDIR());
+ engine.addImportPath(m_importsDirectory);
QTest::ignoreMessage(QtWarningMsg, "plugin2.1 created");
QTest::ignoreMessage(QtWarningMsg, "import2.1 worked");
- QDeclarativeComponent component(&engine, TEST_FILE("works21.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl(QStringLiteral("works21.qml")));
foreach (QDeclarativeError err, component.errors())
qWarning() << err;
VERIFY_ERRORS(0);
@@ -190,9 +172,9 @@ void tst_qdeclarativemoduleplugin::importsPlugin21()
void tst_qdeclarativemoduleplugin::incorrectPluginCase()
{
QDeclarativeEngine engine;
- engine.addImportPath(IMPORTSDIR());
+ engine.addImportPath(m_importsDirectory);
- QDeclarativeComponent component(&engine, TEST_FILE("incorrectCase.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl(QStringLiteral("incorrectCase.qml")));
QList<QDeclarativeError> errors = component.errors();
QCOMPARE(errors.count(), 1);
@@ -203,7 +185,7 @@ void tst_qdeclarativemoduleplugin::incorrectPluginCase()
#elif defined(Q_OS_WIN32)
QString libname = "PluGin.dll";
#endif
- QString expectedError = QLatin1String("plugin cannot be loaded for module \"com.nokia.WrongCase\": File name case mismatch for \"") + QDir(IMPORTSDIR()).filePath("com/nokia/WrongCase/" + libname) + QLatin1String("\"");
+ QString expectedError = QLatin1String("plugin cannot be loaded for module \"com.nokia.WrongCase\": File name case mismatch for \"") + QDir(m_importsDirectory).filePath("com/nokia/WrongCase/" + libname) + QLatin1String("\"");
#else
QString expectedError = QLatin1String("module \"com.nokia.WrongCase\" plugin \"PluGin\" not found");
#endif
@@ -213,7 +195,7 @@ void tst_qdeclarativemoduleplugin::incorrectPluginCase()
void tst_qdeclarativemoduleplugin::importPluginWithQmlFile()
{
- QString path = IMPORTSDIR();
+ QString path = m_importsDirectory;
// QTBUG-16885: adding an import path with a lower-case "c:" causes assert failure
// (this only happens if the plugin includes pure QML files)
@@ -225,7 +207,7 @@ void tst_qdeclarativemoduleplugin::importPluginWithQmlFile()
QDeclarativeEngine engine;
engine.addImportPath(path);
- QDeclarativeComponent component(&engine, TEST_FILE("pluginWithQmlFile.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl(QStringLiteral("pluginWithQmlFile.qml")));
foreach (QDeclarativeError err, component.errors())
qWarning() << err;
VERIFY_ERRORS(0);
@@ -238,7 +220,7 @@ void tst_qdeclarativemoduleplugin::remoteImportWithQuotedUrl()
{
TestHTTPServer server(SERVER_PORT);
QVERIFY(server.isValid());
- server.serveDirectory(IMPORTSDIR());
+ server.serveDirectory(m_importsDirectory);
QDeclarativeEngine engine;
QDeclarativeComponent component(&engine);
@@ -259,10 +241,10 @@ void tst_qdeclarativemoduleplugin::remoteImportWithUnquotedUri()
{
TestHTTPServer server(SERVER_PORT);
QVERIFY(server.isValid());
- server.serveDirectory(IMPORTSDIR());
+ server.serveDirectory(m_importsDirectory);
QDeclarativeEngine engine;
- engine.addImportPath(IMPORTSDIR());
+ engine.addImportPath(m_importsDirectory);
QDeclarativeComponent component(&engine);
component.setData("import com.nokia.PureQmlModule 1.0 \nComponentA { width: 300; ComponentB{} }", QUrl());
@@ -279,25 +261,26 @@ void tst_qdeclarativemoduleplugin::remoteImportWithUnquotedUri()
}
// QTBUG-17324
+
void tst_qdeclarativemoduleplugin::importsMixedQmlCppPlugin()
{
QDeclarativeEngine engine;
- engine.addImportPath(IMPORTSDIR());
+ engine.addImportPath(m_importsDirectory);
{
- QDeclarativeComponent component(&engine, TEST_FILE("importsMixedQmlCppPlugin.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl(QStringLiteral("importsMixedQmlCppPlugin.qml")));
QObject *o = component.create();
- QVERIFY(o != 0);
+ QVERIFY2(o != 0, QDeclarativeDataTest::msgComponentError(component, &engine));
QCOMPARE(o->property("test").toBool(), true);
delete o;
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("importsMixedQmlCppPlugin.2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl(QStringLiteral("importsMixedQmlCppPlugin.2.qml")));
QObject *o = component.create();
- QVERIFY(o != 0);
+ QVERIFY2(o != 0, QDeclarativeDataTest::msgComponentError(component, &engine));
QCOMPARE(o->property("test").toBool(), true);
QCOMPARE(o->property("test2").toBool(), true);
delete o;
@@ -321,9 +304,9 @@ void tst_qdeclarativemoduleplugin::versionNotInstalled()
QFETCH(QString, errorFile);
QDeclarativeEngine engine;
- engine.addImportPath(IMPORTSDIR());
+ engine.addImportPath(m_importsDirectory);
- QDeclarativeComponent component(&engine, TEST_FILE(file));
+ QDeclarativeComponent component(&engine, testFileUrl(file));
VERIFY_ERRORS(errorFile.toLatin1().constData());
}
@@ -347,15 +330,15 @@ void tst_qdeclarativemoduleplugin::implicitQmldir()
QFETCH(QString, file);
QFETCH(QString, errorFile);
- QString importPath = TESTDATA(directory);
+ QString importPath = testFile(directory);
QString fileName = directory + QDir::separator() + file;
QString errorFileName = directory + QDir::separator() + errorFile;
- QUrl testFileUrl = TEST_FILE(fileName);
+ QUrl testUrl = testFileUrl(fileName);
QDeclarativeEngine engine;
engine.addImportPath(importPath);
- QDeclarativeComponent component(&engine, testFileUrl);
+ QDeclarativeComponent component(&engine, testUrl);
QList<QDeclarativeError> errors = component.errors();
VERIFY_ERRORS(errorFileName.toLatin1().constData());
QTest::ignoreMessage(QtWarningMsg, "QDeclarativeComponent: Component is not ready");
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro
index bec727f05f..551d8eac5d 100644
--- a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro
@@ -1,9 +1,11 @@
CONFIG += testcase
TARGET = tst_qdeclarativemoduleplugin
-HEADERS = ../../shared/testhttpserver.h
+HEADERS = ../../shared/testhttpserver.h \
+ ../../shared/util.h
SOURCES = tst_qdeclarativemoduleplugin.cpp \
- ../../shared/testhttpserver.cpp
+ ../../shared/testhttpserver.cpp \
+ ../../shared/util.cpp
CONFIG -= app_bundle
testDataFiles.files = data
diff --git a/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro b/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro
index 310fa94214..bf81e1c357 100644
--- a/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro
+++ b/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro
@@ -2,7 +2,9 @@ CONFIG += testcase
TARGET = tst_qdeclarativeproperty
macx:CONFIG -= app_bundle
-SOURCES += tst_qdeclarativeproperty.cpp
+SOURCES += tst_qdeclarativeproperty.cpp \
+ ../../shared/util.cpp
+HEADERS += ../../shared/util.h
testDataFiles.files = data
testDataFiles.path = .
diff --git a/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp b/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp
index b1aad3a34b..0160b30b2a 100644
--- a/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp
+++ b/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp
@@ -49,11 +49,6 @@
#include <QtCore/qdir.h>
#include "../../shared/util.h"
-inline QUrl TEST_FILE(const QString &filename)
-{
- return QUrl::fromLocalFile(TESTDATA(filename));
-}
-
class MyQmlObject : public QObject
{
Q_OBJECT
@@ -97,7 +92,7 @@ private:
QML_DECLARE_TYPE(MyContainer);
QML_DECLARE_TYPEINFO(MyContainer, QML_HAS_ATTACHED_PROPERTIES)
-class tst_qdeclarativeproperty : public QObject
+class tst_qdeclarativeproperty : public QDeclarativeDataTest
{
Q_OBJECT
public:
@@ -1000,7 +995,7 @@ void tst_qdeclarativeproperty::read()
QVERIFY(qvariant_cast<QObject *>(v) == o.qmlObject());
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("readSynthesizedObject.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("readSynthesizedObject.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -1015,7 +1010,7 @@ void tst_qdeclarativeproperty::read()
QCOMPARE(qvariant_cast<QObject *>(v)->property("b").toInt(), 19);
}
{ // static
- QDeclarativeComponent component(&engine, TEST_FILE("readSynthesizedObject.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("readSynthesizedObject.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -1370,7 +1365,7 @@ void tst_qdeclarativeproperty::crashOnValueProperty()
// QTBUG-13719
void tst_qdeclarativeproperty::aliasPropertyBindings()
{
- QDeclarativeComponent component(&engine, TEST_FILE("aliasPropertyBindings.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("aliasPropertyBindings.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -1479,8 +1474,8 @@ void tst_qdeclarativeproperty::copy()
void tst_qdeclarativeproperty::noContext()
{
- QDeclarativeComponent compA(&engine, TEST_FILE("NoContextTypeA.qml"));
- QDeclarativeComponent compB(&engine, TEST_FILE("NoContextTypeB.qml"));
+ QDeclarativeComponent compA(&engine, testFileUrl("NoContextTypeA.qml"));
+ QDeclarativeComponent compB(&engine, testFileUrl("NoContextTypeB.qml"));
QObject *a = compA.create();
QVERIFY(a != 0);
@@ -1495,6 +1490,7 @@ void tst_qdeclarativeproperty::noContext()
void tst_qdeclarativeproperty::initTestCase()
{
+ QDeclarativeDataTest::initTestCase();
qmlRegisterType<MyQmlObject>("Test",1,0,"MyQmlObject");
qmlRegisterType<PropertyObject>("Test",1,0,"PropertyObject");
qmlRegisterType<MyContainer>("Test",1,0,"MyContainer");
diff --git a/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro b/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro
index 9428746dc1..8b40936d9b 100644
--- a/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro
+++ b/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro
@@ -1,6 +1,9 @@
CONFIG += testcase
TARGET = tst_qdeclarativeqt
-SOURCES += tst_qdeclarativeqt.cpp
+SOURCES += tst_qdeclarativeqt.cpp \
+ ../../shared/util.cpp
+HEADERS += ../../shared/util.h
+
macx:CONFIG -= app_bundle
testDataFiles.files = data
diff --git a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
index 6171800ade..dae2f90389 100644
--- a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
+++ b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
@@ -54,7 +54,7 @@
#include <QSignalSpy>
#include "../../shared/util.h"
-class tst_qdeclarativeqt : public QObject
+class tst_qdeclarativeqt : public QDeclarativeDataTest
{
Q_OBJECT
public:
@@ -95,14 +95,9 @@ private:
QDeclarativeEngine engine;
};
-inline QUrl TEST_FILE(const QString &filename)
-{
- return QUrl::fromLocalFile(TESTDATA(filename));
-}
-
void tst_qdeclarativeqt::enums()
{
- QDeclarativeComponent component(&engine, TEST_FILE("enums.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("enums.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -116,7 +111,7 @@ void tst_qdeclarativeqt::enums()
void tst_qdeclarativeqt::rgba()
{
- QDeclarativeComponent component(&engine, TEST_FILE("rgba.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("rgba.qml"));
QString warning1 = component.url().toString() + ":6: Error: Qt.rgba(): Invalid arguments";
QString warning2 = component.url().toString() + ":7: Error: Qt.rgba(): Invalid arguments";
@@ -139,7 +134,7 @@ void tst_qdeclarativeqt::rgba()
void tst_qdeclarativeqt::hsla()
{
- QDeclarativeComponent component(&engine, TEST_FILE("hsla.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("hsla.qml"));
QString warning1 = component.url().toString() + ":6: Error: Qt.hsla(): Invalid arguments";
QString warning2 = component.url().toString() + ":7: Error: Qt.hsla(): Invalid arguments";
@@ -161,7 +156,7 @@ void tst_qdeclarativeqt::hsla()
void tst_qdeclarativeqt::rect()
{
- QDeclarativeComponent component(&engine, TEST_FILE("rect.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("rect.qml"));
QString warning1 = component.url().toString() + ":6: Error: Qt.rect(): Invalid arguments";
QString warning2 = component.url().toString() + ":7: Error: Qt.rect(): Invalid arguments";
@@ -182,7 +177,7 @@ void tst_qdeclarativeqt::rect()
void tst_qdeclarativeqt::point()
{
- QDeclarativeComponent component(&engine, TEST_FILE("point.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("point.qml"));
QString warning1 = component.url().toString() + ":6: Error: Qt.point(): Invalid arguments";
QString warning2 = component.url().toString() + ":7: Error: Qt.point(): Invalid arguments";
@@ -202,7 +197,7 @@ void tst_qdeclarativeqt::point()
void tst_qdeclarativeqt::size()
{
- QDeclarativeComponent component(&engine, TEST_FILE("size.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("size.qml"));
QString warning1 = component.url().toString() + ":7: Error: Qt.size(): Invalid arguments";
QString warning2 = component.url().toString() + ":8: Error: Qt.size(): Invalid arguments";
@@ -223,7 +218,7 @@ void tst_qdeclarativeqt::size()
void tst_qdeclarativeqt::vector()
{
- QDeclarativeComponent component(&engine, TEST_FILE("vector.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("vector.qml"));
QString warning1 = component.url().toString() + ":6: Error: Qt.vector(): Invalid arguments";
QString warning2 = component.url().toString() + ":7: Error: Qt.vector(): Invalid arguments";
@@ -243,7 +238,7 @@ void tst_qdeclarativeqt::vector()
void tst_qdeclarativeqt::vector4d()
{
- QDeclarativeComponent component(&engine, TEST_FILE("vector4.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("vector4.qml"));
QString warning1 = component.url().toString() + ":6: Error: Qt.vector4d(): Invalid arguments";
QString warning2 = component.url().toString() + ":7: Error: Qt.vector4d(): Invalid arguments";
@@ -263,7 +258,7 @@ void tst_qdeclarativeqt::vector4d()
void tst_qdeclarativeqt::lighter()
{
- QDeclarativeComponent component(&engine, TEST_FILE("lighter.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("lighter.qml"));
QString warning1 = component.url().toString() + ":5: Error: Qt.lighter(): Invalid arguments";
QString warning2 = component.url().toString() + ":10: Error: Qt.lighter(): Invalid arguments";
@@ -285,7 +280,7 @@ void tst_qdeclarativeqt::lighter()
void tst_qdeclarativeqt::darker()
{
- QDeclarativeComponent component(&engine, TEST_FILE("darker.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("darker.qml"));
QString warning1 = component.url().toString() + ":5: Error: Qt.darker(): Invalid arguments";
QString warning2 = component.url().toString() + ":10: Error: Qt.darker(): Invalid arguments";
@@ -307,7 +302,7 @@ void tst_qdeclarativeqt::darker()
void tst_qdeclarativeqt::tint()
{
- QDeclarativeComponent component(&engine, TEST_FILE("tint.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("tint.qml"));
QString warning1 = component.url().toString() + ":7: Error: Qt.tint(): Invalid arguments";
QString warning2 = component.url().toString() + ":8: Error: Qt.tint(): Invalid arguments";
@@ -347,7 +342,7 @@ void tst_qdeclarativeqt::openUrlExternally()
QDesktopServices::setUrlHandler("test", &handler, "noteCall");
QDesktopServices::setUrlHandler("file", &handler, "noteCall");
- QDeclarativeComponent component(&engine, TEST_FILE("openUrlExternally.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("openUrlExternally.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
QCOMPARE(handler.called,1);
@@ -356,7 +351,7 @@ void tst_qdeclarativeqt::openUrlExternally()
object->setProperty("testFile", true);
QCOMPARE(handler.called,2);
- QCOMPARE(handler.last, TEST_FILE("test.html"));
+ QCOMPARE(handler.last, testFileUrl("test.html"));
QDesktopServices::unsetUrlHandler("test");
QDesktopServices::unsetUrlHandler("file");
@@ -369,7 +364,7 @@ void tst_qdeclarativeqt::openUrlExternally_pragmaLibrary()
QDesktopServices::setUrlHandler("test", &handler, "noteCall");
QDesktopServices::setUrlHandler("file", &handler, "noteCall");
- QDeclarativeComponent component(&engine, TEST_FILE("openUrlExternally_lib.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("openUrlExternally_lib.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
QCOMPARE(handler.called,1);
@@ -378,7 +373,7 @@ void tst_qdeclarativeqt::openUrlExternally_pragmaLibrary()
object->setProperty("testFile", true);
QCOMPARE(handler.called,2);
- QCOMPARE(handler.last, TEST_FILE("test.html"));
+ QCOMPARE(handler.last, testFileUrl("test.html"));
QDesktopServices::unsetUrlHandler("test");
QDesktopServices::unsetUrlHandler("file");
@@ -386,7 +381,7 @@ void tst_qdeclarativeqt::openUrlExternally_pragmaLibrary()
void tst_qdeclarativeqt::md5()
{
- QDeclarativeComponent component(&engine, TEST_FILE("md5.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("md5.qml"));
QString warning1 = component.url().toString() + ":4: Error: Qt.md5(): Invalid arguments";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
@@ -401,7 +396,7 @@ void tst_qdeclarativeqt::md5()
void tst_qdeclarativeqt::createComponent()
{
- QDeclarativeComponent component(&engine, TEST_FILE("createComponent.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("createComponent.qml"));
QString warning1 = component.url().toString() + ":9: Error: Qt.createComponent(): Invalid arguments";
QString warning2 = component.url().toString() + ":10: Error: Qt.createComponent(): Invalid arguments";
@@ -412,7 +407,7 @@ void tst_qdeclarativeqt::createComponent()
QVERIFY(object != 0);
QCOMPARE(object->property("absoluteUrl").toString(), QString("http://www.example.com/test.qml"));
- QCOMPARE(object->property("relativeUrl").toString(), TEST_FILE("createComponentData.qml").toString());
+ QCOMPARE(object->property("relativeUrl").toString(), testFileUrl("createComponentData.qml").toString());
delete object;
}
@@ -420,7 +415,7 @@ void tst_qdeclarativeqt::createComponent()
void tst_qdeclarativeqt::createComponent_pragmaLibrary()
{
// Currently, just loading createComponent_lib.qml causes crash on some platforms
- QDeclarativeComponent component(&engine, TEST_FILE("createComponent_lib.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("createComponent_lib.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
QCOMPARE(object->property("status").toInt(), int(QDeclarativeComponent::Ready));
@@ -430,14 +425,14 @@ void tst_qdeclarativeqt::createComponent_pragmaLibrary()
void tst_qdeclarativeqt::createQmlObject()
{
- QDeclarativeComponent component(&engine, TEST_FILE("createQmlObject.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("createQmlObject.qml"));
QString warning1 = component.url().toString() + ":7: Error: Qt.createQmlObject(): Invalid arguments";
- QString warning2 = component.url().toString()+ ":10: Error: Qt.createQmlObject(): failed to create object: \n " + TEST_FILE("inline").toString() + ":2:10: Blah is not a type";
- QString warning3 = component.url().toString()+ ":11: Error: Qt.createQmlObject(): failed to create object: \n " + TEST_FILE("main.qml").toString() + ":4:1: Duplicate property name";
+ QString warning2 = component.url().toString()+ ":10: Error: Qt.createQmlObject(): failed to create object: \n " + testFileUrl("inline").toString() + ":2:10: Blah is not a type";
+ QString warning3 = component.url().toString()+ ":11: Error: Qt.createQmlObject(): failed to create object: \n " + testFileUrl("main.qml").toString() + ":4:1: Duplicate property name";
QString warning4 = component.url().toString()+ ":9: Error: Qt.createQmlObject(): Missing parent object";
QString warning5 = component.url().toString()+ ":8: Error: Qt.createQmlObject(): Invalid arguments";
- QString warning6 = "RunTimeError: Qt.createQmlObject(): failed to create object: \n " + TEST_FILE("inline").toString() + ":3: Cannot assign object type QObject with no default method";
+ QString warning6 = "RunTimeError: Qt.createQmlObject(): failed to create object: \n " + testFileUrl("inline").toString() + ":3: Cannot assign object type QObject with no default method";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning3));
@@ -460,9 +455,9 @@ void tst_qdeclarativeqt::createQmlObject()
void tst_qdeclarativeqt::console()
{
- QUrl testFileUrl = TEST_FILE("console.qml");
- QString testException = QString(QLatin1String("%1:%2: ReferenceError: Can't find variable: exception")).arg(testFileUrl.toString()).arg(34);
- QString testTrace = QString(QLatin1String("onCompleted (%1:%2:%3)\n")).arg(testFileUrl.toString()).arg(31).arg(17);
+ QUrl testUrl = testFileUrl("console.qml");
+ QString testException = QString(QLatin1String("%1:%2: ReferenceError: Can't find variable: exception")).arg(testUrl.toString()).arg(34);
+ QString testTrace = QString(QLatin1String("onCompleted (%1:%2:%3)\n")).arg(testUrl.toString()).arg(31).arg(17);
QTest::ignoreMessage(QtDebugMsg, qPrintable(testTrace));
QTest::ignoreMessage(QtDebugMsg, "Profiling started.");
QTest::ignoreMessage(QtDebugMsg, "Profiling ended.");
@@ -487,7 +482,7 @@ void tst_qdeclarativeqt::console()
QTest::ignoreMessage(QtWarningMsg, qPrintable(testException));
- QDeclarativeComponent component(&engine, testFileUrl);
+ QDeclarativeComponent component(&engine, testUrl);
QObject *object = component.create();
QVERIFY(object != 0);
delete object;
@@ -507,7 +502,7 @@ void tst_qdeclarativeqt::dateTimeConversion()
QDateTime dateTime6(QDate(2008,2,24), QTime(14,15,38,200));
QDeclarativeEngine eng;
- QDeclarativeComponent component(&eng, TEST_FILE("dateTimeConversion.qml"));
+ QDeclarativeComponent component(&eng, testFileUrl("dateTimeConversion.qml"));
QObject *obj = component.create();
QCOMPARE(obj->property("qdate").toDate(), date);
@@ -536,7 +531,7 @@ void tst_qdeclarativeqt::dateTimeFormatting()
eng.rootContext()->setContextProperty("qtime", time);
eng.rootContext()->setContextProperty("qdatetime", dateTime);
- QDeclarativeComponent component(&eng, TEST_FILE("formatting.qml"));
+ QDeclarativeComponent component(&eng, testFileUrl("formatting.qml"));
QStringList warnings;
warnings << component.url().toString() + ":37: Error: Qt.formatDate(): Invalid date format"
@@ -609,7 +604,7 @@ void tst_qdeclarativeqt::dateTimeFormattingVariants()
QDeclarativeEngine eng;
eng.rootContext()->setContextProperty("qvariant", variant);
- QDeclarativeComponent component(&eng, TEST_FILE("formatting.qml"));
+ QDeclarativeComponent component(&eng, testFileUrl("formatting.qml"));
QStringList warnings;
warnings << component.url().toString() + ":37: Error: Qt.formatDate(): Invalid date format"
@@ -683,7 +678,7 @@ void tst_qdeclarativeqt::dateTimeFormattingVariants_data()
void tst_qdeclarativeqt::isQtObject()
{
- QDeclarativeComponent component(&engine, TEST_FILE("isQtObject.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("isQtObject.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -698,7 +693,7 @@ void tst_qdeclarativeqt::isQtObject()
void tst_qdeclarativeqt::btoa()
{
- QDeclarativeComponent component(&engine, TEST_FILE("btoa.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("btoa.qml"));
QString warning1 = component.url().toString() + ":4: Error: Qt.btoa(): Invalid arguments";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
@@ -713,7 +708,7 @@ void tst_qdeclarativeqt::btoa()
void tst_qdeclarativeqt::atob()
{
- QDeclarativeComponent component(&engine, TEST_FILE("atob.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("atob.qml"));
QString warning1 = component.url().toString() + ":4: Error: Qt.atob(): Invalid arguments";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
@@ -728,7 +723,7 @@ void tst_qdeclarativeqt::atob()
void tst_qdeclarativeqt::fontFamilies()
{
- QDeclarativeComponent component(&engine, TEST_FILE("fontFamilies.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("fontFamilies.qml"));
QString warning1 = component.url().toString() + ":4: Error: Qt.fontFamilies(): Invalid arguments";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
@@ -744,7 +739,7 @@ void tst_qdeclarativeqt::fontFamilies()
void tst_qdeclarativeqt::quit()
{
- QDeclarativeComponent component(&engine, TEST_FILE("quit.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("quit.qml"));
QSignalSpy spy(&engine, SIGNAL(quit()));
QObject *object = component.create();
@@ -756,7 +751,7 @@ void tst_qdeclarativeqt::quit()
void tst_qdeclarativeqt::resolvedUrl()
{
- QDeclarativeComponent component(&engine, TEST_FILE("resolvedUrl.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("resolvedUrl.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
diff --git a/tests/auto/declarative/qdeclarativesqldatabase/qdeclarativesqldatabase.pro b/tests/auto/declarative/qdeclarativesqldatabase/qdeclarativesqldatabase.pro
index 8b8c19c44c..d3195df074 100644
--- a/tests/auto/declarative/qdeclarativesqldatabase/qdeclarativesqldatabase.pro
+++ b/tests/auto/declarative/qdeclarativesqldatabase/qdeclarativesqldatabase.pro
@@ -2,7 +2,9 @@ CONFIG += testcase
TARGET = tst_qdeclarativesqldatabase
macx:CONFIG -= app_bundle
-SOURCES += tst_qdeclarativesqldatabase.cpp
+SOURCES += tst_qdeclarativesqldatabase.cpp \
+ ../../shared/util.cpp
+HEADERS += ../../shared/util.h
CONFIG += parallel_test
diff --git a/tests/auto/declarative/qdeclarativesqldatabase/tst_qdeclarativesqldatabase.cpp b/tests/auto/declarative/qdeclarativesqldatabase/tst_qdeclarativesqldatabase.cpp
index 1a6b08cb79..750d3ba715 100644
--- a/tests/auto/declarative/qdeclarativesqldatabase/tst_qdeclarativesqldatabase.cpp
+++ b/tests/auto/declarative/qdeclarativesqldatabase/tst_qdeclarativesqldatabase.cpp
@@ -55,7 +55,7 @@
#include <QtCore/qfile.h>
#include "../../shared/util.h"
-class tst_qdeclarativesqldatabase : public QObject
+class tst_qdeclarativesqldatabase : public QDeclarativeDataTest
{
Q_OBJECT
public:
@@ -104,6 +104,7 @@ void removeRecursive(const QString& dirname)
void tst_qdeclarativesqldatabase::initTestCase()
{
+ QDeclarativeDataTest::initTestCase();
removeRecursive(dbDir());
QDir().mkpath(dbDir());
}
@@ -204,7 +205,7 @@ void tst_qdeclarativesqldatabase::testQml()
engine->setOfflineStoragePath(dbDir());
QDeclarativeComponent component(engine);
- component.setData(qml.toUtf8(), QUrl::fromLocalFile(TESTDATA("empty.qml"))); // just a file for relative local imports
+ component.setData(qml.toUtf8(), testFileUrl("empty.qml")); // just a file for relative local imports
QVERIFY(!component.isError());
QQuickText *text = qobject_cast<QQuickText*>(component.create());
QVERIFY(text != 0);
diff --git a/tests/auto/declarative/qdeclarativetranslation/qdeclarativetranslation.pro b/tests/auto/declarative/qdeclarativetranslation/qdeclarativetranslation.pro
index 488395ea52..5b40df8898 100644
--- a/tests/auto/declarative/qdeclarativetranslation/qdeclarativetranslation.pro
+++ b/tests/auto/declarative/qdeclarativetranslation/qdeclarativetranslation.pro
@@ -2,7 +2,9 @@ CONFIG += testcase
TARGET = tst_qdeclarativetranslation
macx:CONFIG -= app_bundle
-SOURCES += tst_qdeclarativetranslation.cpp
+SOURCES += tst_qdeclarativetranslation.cpp \
+ ../../shared/util.cpp
+HEADERS += ../../shared/util.h
RESOURCES += data/translation.qrc
testDataFiles.files = data
diff --git a/tests/auto/declarative/qdeclarativetranslation/tst_qdeclarativetranslation.cpp b/tests/auto/declarative/qdeclarativetranslation/tst_qdeclarativetranslation.cpp
index da84167148..12079b1432 100644
--- a/tests/auto/declarative/qdeclarativetranslation/tst_qdeclarativetranslation.cpp
+++ b/tests/auto/declarative/qdeclarativetranslation/tst_qdeclarativetranslation.cpp
@@ -45,7 +45,7 @@
#include <QTranslator>
#include "../../shared/util.h"
-class tst_qdeclarativetranslation : public QObject
+class tst_qdeclarativetranslation : public QDeclarativeDataTest
{
Q_OBJECT
public:
@@ -57,19 +57,14 @@ private slots:
void translationInQrc();
};
-inline QUrl TEST_FILE(const QString &filename)
-{
- return QUrl::fromLocalFile(TESTDATA(filename));
-}
-
void tst_qdeclarativetranslation::translation()
{
QTranslator translator;
- translator.load(QLatin1String("qml_fr"), TESTDATA(""));
+ translator.load(QLatin1String("qml_fr"), dataDirectory());
QCoreApplication::installTranslator(&translator);
QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, TEST_FILE("translation.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("translation.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -89,11 +84,11 @@ void tst_qdeclarativetranslation::translation()
void tst_qdeclarativetranslation::idTranslation()
{
QTranslator translator;
- translator.load(QLatin1String("qmlid_fr"),TESTDATA(""));
+ translator.load(QLatin1String("qmlid_fr"), dataDirectory());
QCoreApplication::installTranslator(&translator);
QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, TEST_FILE("idtranslation.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("idtranslation.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro b/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro
index d7097de835..a240f30684 100644
--- a/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro
+++ b/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro
@@ -2,10 +2,12 @@ CONFIG += testcase
TARGET = tst_qdeclarativevaluetypes
macx:CONFIG -= app_bundle
-HEADERS += testtypes.h
+HEADERS += testtypes.h \
+ ../../shared/util.h
SOURCES += tst_qdeclarativevaluetypes.cpp \
- testtypes.cpp
+ testtypes.cpp \
+ ../../shared/util.cpp
testDataFiles.files = data
testDataFiles.path = .
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp
index c6880b96ce..aa96ffec11 100644
--- a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp
+++ b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp
@@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE
extern int qt_defaultDpi();
QT_END_NAMESPACE
-class tst_qdeclarativevaluetypes : public QObject
+class tst_qdeclarativevaluetypes : public QDeclarativeDataTest
{
Q_OBJECT
public:
@@ -100,18 +100,14 @@ private:
void tst_qdeclarativevaluetypes::initTestCase()
{
+ QDeclarativeDataTest::initTestCase();
registerTypes();
}
-inline QUrl TEST_FILE(const QString &filename)
-{
- return QUrl::fromLocalFile(TESTDATA(filename));
-}
-
void tst_qdeclarativevaluetypes::point()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("point_read.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("point_read.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -123,7 +119,7 @@ void tst_qdeclarativevaluetypes::point()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("point_write.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("point_write.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -133,7 +129,7 @@ void tst_qdeclarativevaluetypes::point()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("point_compare.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("point_compare.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -156,7 +152,7 @@ void tst_qdeclarativevaluetypes::point()
void tst_qdeclarativevaluetypes::pointf()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("pointf_read.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("pointf_read.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -168,7 +164,7 @@ void tst_qdeclarativevaluetypes::pointf()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("pointf_write.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("pointf_write.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -178,7 +174,7 @@ void tst_qdeclarativevaluetypes::pointf()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("pointf_compare.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("pointf_compare.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -201,7 +197,7 @@ void tst_qdeclarativevaluetypes::pointf()
void tst_qdeclarativevaluetypes::size()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("size_read.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("size_read.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -213,7 +209,7 @@ void tst_qdeclarativevaluetypes::size()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("size_write.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("size_write.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -223,7 +219,7 @@ void tst_qdeclarativevaluetypes::size()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("size_compare.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("size_compare.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -246,7 +242,7 @@ void tst_qdeclarativevaluetypes::size()
void tst_qdeclarativevaluetypes::sizef()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("sizef_read.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("sizef_read.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -258,7 +254,7 @@ void tst_qdeclarativevaluetypes::sizef()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("sizef_write.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("sizef_write.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -268,7 +264,7 @@ void tst_qdeclarativevaluetypes::sizef()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("sizef_compare.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("sizef_compare.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -290,7 +286,7 @@ void tst_qdeclarativevaluetypes::sizef()
void tst_qdeclarativevaluetypes::variant()
{
- QDeclarativeComponent component(&engine, TEST_FILE("variant_read.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("variant_read.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -304,7 +300,7 @@ void tst_qdeclarativevaluetypes::variant()
void tst_qdeclarativevaluetypes::sizereadonly()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("sizereadonly_read.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("sizereadonly_read.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -316,25 +312,25 @@ void tst_qdeclarativevaluetypes::sizereadonly()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("sizereadonly_writeerror.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("sizereadonly_writeerror.qml"));
QVERIFY(component.isError());
QCOMPARE(component.errors().at(0).description(), QLatin1String("Invalid property assignment: \"sizereadonly\" is a read-only property"));
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("sizereadonly_writeerror2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("sizereadonly_writeerror2.qml"));
QVERIFY(component.isError());
QCOMPARE(component.errors().at(0).description(), QLatin1String("Invalid property assignment: \"sizereadonly\" is a read-only property"));
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("sizereadonly_writeerror3.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("sizereadonly_writeerror3.qml"));
QVERIFY(component.isError());
QCOMPARE(component.errors().at(0).description(), QLatin1String("Invalid property assignment: \"sizereadonly\" is a read-only property"));
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("sizereadonly_writeerror4.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("sizereadonly_writeerror4.qml"));
QObject *object = component.create();
QVERIFY(object);
@@ -348,7 +344,7 @@ void tst_qdeclarativevaluetypes::sizereadonly()
void tst_qdeclarativevaluetypes::rect()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("rect_read.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("rect_read.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -362,7 +358,7 @@ void tst_qdeclarativevaluetypes::rect()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("rect_write.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("rect_write.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -372,7 +368,7 @@ void tst_qdeclarativevaluetypes::rect()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("rect_compare.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("rect_compare.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -395,7 +391,7 @@ void tst_qdeclarativevaluetypes::rect()
void tst_qdeclarativevaluetypes::rectf()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("rectf_read.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("rectf_read.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -409,7 +405,7 @@ void tst_qdeclarativevaluetypes::rectf()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("rectf_write.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("rectf_write.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -419,7 +415,7 @@ void tst_qdeclarativevaluetypes::rectf()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("rectf_compare.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("rectf_compare.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -442,7 +438,7 @@ void tst_qdeclarativevaluetypes::rectf()
void tst_qdeclarativevaluetypes::vector2d()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("vector2d_read.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("vector2d_read.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -454,7 +450,7 @@ void tst_qdeclarativevaluetypes::vector2d()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("vector2d_write.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("vector2d_write.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -464,7 +460,7 @@ void tst_qdeclarativevaluetypes::vector2d()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("vector2d_compare.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("vector2d_compare.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -485,7 +481,7 @@ void tst_qdeclarativevaluetypes::vector2d()
void tst_qdeclarativevaluetypes::vector3d()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("vector3d_read.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("vector3d_read.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -498,7 +494,7 @@ void tst_qdeclarativevaluetypes::vector3d()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("vector3d_write.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("vector3d_write.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -508,7 +504,7 @@ void tst_qdeclarativevaluetypes::vector3d()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("vector3d_compare.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("vector3d_compare.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -530,7 +526,7 @@ void tst_qdeclarativevaluetypes::vector3d()
void tst_qdeclarativevaluetypes::vector4d()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("vector4d_read.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("vector4d_read.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -544,7 +540,7 @@ void tst_qdeclarativevaluetypes::vector4d()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("vector4d_write.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("vector4d_write.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -554,7 +550,7 @@ void tst_qdeclarativevaluetypes::vector4d()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("vector4d_compare.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("vector4d_compare.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -575,7 +571,7 @@ void tst_qdeclarativevaluetypes::vector4d()
void tst_qdeclarativevaluetypes::quaternion()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("quaternion_read.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("quaternion_read.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -589,7 +585,7 @@ void tst_qdeclarativevaluetypes::quaternion()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("quaternion_write.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("quaternion_write.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -599,7 +595,7 @@ void tst_qdeclarativevaluetypes::quaternion()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("quaternion_compare.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("quaternion_compare.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -620,7 +616,7 @@ void tst_qdeclarativevaluetypes::quaternion()
void tst_qdeclarativevaluetypes::matrix4x4()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("matrix4x4_read.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("matrix4x4_read.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -650,7 +646,7 @@ void tst_qdeclarativevaluetypes::matrix4x4()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("matrix4x4_write.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("matrix4x4_write.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -663,7 +659,7 @@ void tst_qdeclarativevaluetypes::matrix4x4()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("matrix4x4_compare.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("matrix4x4_compare.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -684,7 +680,7 @@ void tst_qdeclarativevaluetypes::matrix4x4()
void tst_qdeclarativevaluetypes::font()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("font_read.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("font_read.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -707,7 +703,7 @@ void tst_qdeclarativevaluetypes::font()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("font_write.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("font_write.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -740,7 +736,7 @@ void tst_qdeclarativevaluetypes::font()
// Test pixelSize
{
- QDeclarativeComponent component(&engine, TEST_FILE("font_write.2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("font_write.2.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -751,7 +747,7 @@ void tst_qdeclarativevaluetypes::font()
// Test pixelSize and pointSize
{
- QDeclarativeComponent component(&engine, TEST_FILE("font_write.3.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("font_write.3.qml"));
QTest::ignoreMessage(QtWarningMsg, "Both point size and pixel size set. Using pixel size. ");
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -761,7 +757,7 @@ void tst_qdeclarativevaluetypes::font()
delete object;
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("font_write.4.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("font_write.4.qml"));
QTest::ignoreMessage(QtWarningMsg, "Both point size and pixel size set. Using pixel size. ");
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -771,7 +767,7 @@ void tst_qdeclarativevaluetypes::font()
delete object;
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("font_write.5.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("font_write.5.qml"));
QObject *object = qobject_cast<QObject *>(component.create());
QVERIFY(object != 0);
MyTypeObject *object1 = object->findChild<MyTypeObject *>("object1");
@@ -786,7 +782,7 @@ void tst_qdeclarativevaluetypes::font()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("font_compare.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("font_compare.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -807,7 +803,7 @@ void tst_qdeclarativevaluetypes::font()
void tst_qdeclarativevaluetypes::color()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("color_read.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("color_read.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -826,7 +822,7 @@ void tst_qdeclarativevaluetypes::color()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("color_write.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("color_write.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -841,7 +837,7 @@ void tst_qdeclarativevaluetypes::color()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("color_compare.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("color_compare.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
QString colorString("#33e199");
@@ -874,7 +870,7 @@ void tst_qdeclarativevaluetypes::color()
// Test bindings can write to value types
void tst_qdeclarativevaluetypes::bindingAssignment()
{
- QDeclarativeComponent component(&engine, TEST_FILE("bindingAssignment.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("bindingAssignment.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -890,7 +886,7 @@ void tst_qdeclarativevaluetypes::bindingAssignment()
// Test bindings can read from value types
void tst_qdeclarativevaluetypes::bindingRead()
{
- QDeclarativeComponent component(&engine, TEST_FILE("bindingRead.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("bindingRead.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -906,7 +902,7 @@ void tst_qdeclarativevaluetypes::bindingRead()
// Test static values can assign to value types
void tst_qdeclarativevaluetypes::staticAssignment()
{
- QDeclarativeComponent component(&engine, TEST_FILE("staticAssignment.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("staticAssignment.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -918,7 +914,7 @@ void tst_qdeclarativevaluetypes::staticAssignment()
// Test scripts can read/write value types
void tst_qdeclarativevaluetypes::scriptAccess()
{
- QDeclarativeComponent component(&engine, TEST_FILE("scriptAccess.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("scriptAccess.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -933,7 +929,7 @@ void tst_qdeclarativevaluetypes::scriptAccess()
void tst_qdeclarativevaluetypes::autoBindingRemoval()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("autoBindingRemoval.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("autoBindingRemoval.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -956,7 +952,7 @@ void tst_qdeclarativevaluetypes::autoBindingRemoval()
/*
{
- QDeclarativeComponent component(&engine, TEST_FILE("autoBindingRemoval.2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("autoBindingRemoval.2.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -978,7 +974,7 @@ void tst_qdeclarativevaluetypes::autoBindingRemoval()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("autoBindingRemoval.3.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("autoBindingRemoval.3.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -1002,7 +998,7 @@ void tst_qdeclarativevaluetypes::autoBindingRemoval()
// Test that property value sources assign to value types
void tst_qdeclarativevaluetypes::valueSources()
{
- QDeclarativeComponent component(&engine, TEST_FILE("valueSources.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("valueSources.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -1025,7 +1021,7 @@ static void checkNoErrors(QDeclarativeComponent& component)
// Test that property value interceptors can be applied to value types
void tst_qdeclarativevaluetypes::valueInterceptors()
{
- QDeclarativeComponent component(&engine, TEST_FILE("valueInterceptors.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("valueInterceptors.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
checkNoErrors(component);
QVERIFY(object != 0);
@@ -1042,7 +1038,7 @@ void tst_qdeclarativevaluetypes::valueInterceptors()
// Test that you can't assign a binding to the "root" value type, and a sub-property
void tst_qdeclarativevaluetypes::bindingConflict()
{
- QDeclarativeComponent component(&engine, TEST_FILE("bindingConflict.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("bindingConflict.qml"));
QCOMPARE(component.isError(), true);
}
@@ -1059,7 +1055,7 @@ void tst_qdeclarativevaluetypes::bindingConflict()
// doesn't crash
void tst_qdeclarativevaluetypes::deletedObject()
{
- QDeclarativeComponent component(&engine, TEST_FILE("deletedObject.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("deletedObject.qml"));
QTest::ignoreMessage(QtDebugMsg, "Test: 2");
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -1077,7 +1073,7 @@ void tst_qdeclarativevaluetypes::deletedObject()
// Test that value types can be assigned to another value type property in a binding
void tst_qdeclarativevaluetypes::bindingVariantCopy()
{
- QDeclarativeComponent component(&engine, TEST_FILE("bindingVariantCopy.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("bindingVariantCopy.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -1089,7 +1085,7 @@ void tst_qdeclarativevaluetypes::bindingVariantCopy()
// Test that value types can be assigned to another value type property in script
void tst_qdeclarativevaluetypes::scriptVariantCopy()
{
- QDeclarativeComponent component(&engine, TEST_FILE("scriptVariantCopy.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("scriptVariantCopy.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -1125,7 +1121,7 @@ void tst_qdeclarativevaluetypes::cppClasses()
void tst_qdeclarativevaluetypes::enums()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("enums.1.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("enums.1.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
QVERIFY(object->font().capitalization() == QFont::AllUppercase);
@@ -1133,7 +1129,7 @@ void tst_qdeclarativevaluetypes::enums()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("enums.2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("enums.2.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
QVERIFY(object->font().capitalization() == QFont::AllUppercase);
@@ -1141,7 +1137,7 @@ void tst_qdeclarativevaluetypes::enums()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("enums.3.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("enums.3.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
QVERIFY(object->font().capitalization() == QFont::AllUppercase);
@@ -1149,7 +1145,7 @@ void tst_qdeclarativevaluetypes::enums()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("enums.4.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("enums.4.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
QVERIFY(object->font().capitalization() == QFont::AllUppercase);
@@ -1157,7 +1153,7 @@ void tst_qdeclarativevaluetypes::enums()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("enums.5.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("enums.5.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
QVERIFY(object->font().capitalization() == QFont::AllUppercase);
@@ -1170,7 +1166,7 @@ void tst_qdeclarativevaluetypes::enums()
void tst_qdeclarativevaluetypes::conflictingBindings()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("conflicting.1.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("conflicting.1.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -1188,7 +1184,7 @@ void tst_qdeclarativevaluetypes::conflictingBindings()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("conflicting.2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("conflicting.2.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -1206,7 +1202,7 @@ void tst_qdeclarativevaluetypes::conflictingBindings()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("conflicting.3.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("conflicting.3.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -1226,7 +1222,7 @@ void tst_qdeclarativevaluetypes::conflictingBindings()
void tst_qdeclarativevaluetypes::returnValues()
{
- QDeclarativeComponent component(&engine, TEST_FILE("returnValues.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("returnValues.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -1239,7 +1235,7 @@ void tst_qdeclarativevaluetypes::returnValues()
void tst_qdeclarativevaluetypes::varAssignment()
{
- QDeclarativeComponent component(&engine, TEST_FILE("varAssignment.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("varAssignment.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -1254,7 +1250,7 @@ void tst_qdeclarativevaluetypes::varAssignment()
void tst_qdeclarativevaluetypes::bindingsSpliceCorrectly()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("bindingsSpliceCorrectly.1.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("bindingsSpliceCorrectly.1.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -1264,7 +1260,7 @@ void tst_qdeclarativevaluetypes::bindingsSpliceCorrectly()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("bindingsSpliceCorrectly.2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("bindingsSpliceCorrectly.2.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -1275,7 +1271,7 @@ void tst_qdeclarativevaluetypes::bindingsSpliceCorrectly()
{
- QDeclarativeComponent component(&engine, TEST_FILE("bindingsSpliceCorrectly.3.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("bindingsSpliceCorrectly.3.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -1285,7 +1281,7 @@ void tst_qdeclarativevaluetypes::bindingsSpliceCorrectly()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("bindingsSpliceCorrectly.4.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("bindingsSpliceCorrectly.4.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -1295,7 +1291,7 @@ void tst_qdeclarativevaluetypes::bindingsSpliceCorrectly()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("bindingsSpliceCorrectly.5.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("bindingsSpliceCorrectly.5.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
diff --git a/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro b/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro
index 6eaaf577b4..584bcd672f 100644
--- a/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro
+++ b/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro
@@ -2,7 +2,9 @@ CONFIG += testcase
TARGET = tst_qdeclarativeworkerscript
macx:CONFIG -= app_bundle
-SOURCES += tst_qdeclarativeworkerscript.cpp
+SOURCES += tst_qdeclarativeworkerscript.cpp \
+ ../../shared/util.cpp
+HEADERS += ../../shared/util.h
testDataFiles.files = data
testDataFiles.path = .
diff --git a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp
index 7dccbb35a0..1a9f10fe49 100644
--- a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp
+++ b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp
@@ -52,13 +52,7 @@
#include <private/qdeclarativeengine_p.h>
#include "../../shared/util.h"
-inline QUrl TEST_FILE(const QString &filename)
-{
- return QUrl::fromLocalFile(TESTDATA(filename));
-}
-
-
-class tst_QDeclarativeWorkerScript : public QObject
+class tst_QDeclarativeWorkerScript : public QDeclarativeDataTest
{
Q_OBJECT
public:
@@ -93,7 +87,7 @@ private:
void tst_QDeclarativeWorkerScript::source()
{
- QDeclarativeComponent component(&m_engine, TESTDATA("worker.qml"));
+ QDeclarativeComponent component(&m_engine, testFileUrl("worker.qml"));
QDeclarativeWorkerScript *worker = qobject_cast<QDeclarativeWorkerScript*>(component.create());
QVERIFY(worker != 0);
const QMetaObject *mo = worker->metaObject();
@@ -103,7 +97,7 @@ void tst_QDeclarativeWorkerScript::source()
waitForEchoMessage(worker);
QCOMPARE(mo->property(mo->indexOfProperty("response")).read(worker).value<QVariant>(), value);
- QUrl source = QUrl::fromLocalFile(TESTDATA("script_fixed_return.js"));
+ QUrl source = testFileUrl("script_fixed_return.js");
worker->setSource(source);
QCOMPARE(worker->source(), source);
QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, value)));
@@ -118,7 +112,7 @@ void tst_QDeclarativeWorkerScript::messaging()
{
QFETCH(QVariant, value);
- QDeclarativeComponent component(&m_engine, TESTDATA("worker.qml"));
+ QDeclarativeComponent component(&m_engine, testFileUrl("worker.qml"));
QDeclarativeWorkerScript *worker = qobject_cast<QDeclarativeWorkerScript*>(component.create());
QVERIFY(worker != 0);
@@ -155,7 +149,7 @@ void tst_QDeclarativeWorkerScript::messaging_sendQObjectList()
// instances. If objects are sent in a list, they will be sent as 'undefined'
// js values.
- QDeclarativeComponent component(&m_engine, TESTDATA("worker.qml"));
+ QDeclarativeComponent component(&m_engine, testFileUrl("worker.qml"));
QDeclarativeWorkerScript *worker = qobject_cast<QDeclarativeWorkerScript*>(component.create());
QVERIFY(worker != 0);
@@ -176,7 +170,7 @@ void tst_QDeclarativeWorkerScript::messaging_sendQObjectList()
void tst_QDeclarativeWorkerScript::messaging_sendJsObject()
{
- QDeclarativeComponent component(&m_engine, TESTDATA("worker.qml"));
+ QDeclarativeComponent component(&m_engine, testFileUrl("worker.qml"));
QDeclarativeWorkerScript *worker = qobject_cast<QDeclarativeWorkerScript*>(component.create());
QVERIFY(worker != 0);
@@ -203,7 +197,7 @@ void tst_QDeclarativeWorkerScript::messaging_sendJsObject()
void tst_QDeclarativeWorkerScript::messaging_sendExternalObject()
{
- QDeclarativeComponent component(&m_engine, TESTDATA("externalObjectWorker.qml"));
+ QDeclarativeComponent component(&m_engine, testFileUrl("externalObjectWorker.qml"));
QObject *obj = component.create();
QVERIFY(obj);
QMetaObject::invokeMethod(obj, "testExternalObject");
@@ -215,7 +209,7 @@ void tst_QDeclarativeWorkerScript::script_with_pragma()
{
QVariant value(100);
- QDeclarativeComponent component(&m_engine, TESTDATA("worker_pragma.qml"));
+ QDeclarativeComponent component(&m_engine, testFileUrl("worker_pragma.qml"));
QDeclarativeWorkerScript *worker = qobject_cast<QDeclarativeWorkerScript*>(component.create());
QVERIFY(worker != 0);
@@ -231,7 +225,7 @@ void tst_QDeclarativeWorkerScript::script_with_pragma()
void tst_QDeclarativeWorkerScript::script_included()
{
- QDeclarativeComponent component(&m_engine, TESTDATA("worker_include.qml"));
+ QDeclarativeComponent component(&m_engine, testFileUrl("worker_include.qml"));
QDeclarativeWorkerScript *worker = qobject_cast<QDeclarativeWorkerScript*>(component.create());
QVERIFY(worker != 0);
@@ -256,14 +250,14 @@ static void qdeclarativeworkerscript_warningsHandler(QtMsgType type, const char
void tst_QDeclarativeWorkerScript::scriptError_onLoad()
{
- QDeclarativeComponent component(&m_engine, TESTDATA("worker_error_onLoad.qml"));
+ QDeclarativeComponent component(&m_engine, testFileUrl("worker_error_onLoad.qml"));
QtMsgHandler previousMsgHandler = qInstallMsgHandler(qdeclarativeworkerscript_warningsHandler);
QDeclarativeWorkerScript *worker = qobject_cast<QDeclarativeWorkerScript*>(component.create());
QVERIFY(worker != 0);
QTRY_COMPARE(qdeclarativeworkerscript_lastWarning,
- TEST_FILE("script_error_onLoad.js").toString() + QLatin1String(":3: SyntaxError: Unexpected identifier"));
+ testFileUrl("script_error_onLoad.js").toString() + QLatin1String(":3: SyntaxError: Unexpected identifier"));
qInstallMsgHandler(previousMsgHandler);
qApp->processEvents();
@@ -272,7 +266,7 @@ void tst_QDeclarativeWorkerScript::scriptError_onLoad()
void tst_QDeclarativeWorkerScript::scriptError_onCall()
{
- QDeclarativeComponent component(&m_engine, TESTDATA("worker_error_onCall.qml"));
+ QDeclarativeComponent component(&m_engine, testFileUrl("worker_error_onCall.qml"));
QDeclarativeWorkerScript *worker = qobject_cast<QDeclarativeWorkerScript*>(component.create());
QVERIFY(worker != 0);
@@ -281,7 +275,7 @@ void tst_QDeclarativeWorkerScript::scriptError_onCall()
QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, value)));
QTRY_COMPARE(qdeclarativeworkerscript_lastWarning,
- TEST_FILE("script_error_onCall.js").toString() + QLatin1String(":4: ReferenceError: Can't find variable: getData"));
+ testFileUrl("script_error_onCall.js").toString() + QLatin1String(":4: ReferenceError: Can't find variable: getData"));
qInstallMsgHandler(previousMsgHandler);
qApp->processEvents();
@@ -294,7 +288,7 @@ void tst_QDeclarativeWorkerScript::stressDispose()
{
for (int ii = 0; ii < 100; ++ii) {
QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, TESTDATA("stressDispose.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("stressDispose.qml"));
QObject *o = component.create();
QVERIFY(o);
delete o;
diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro b/tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro
index 5715f3c114..fd6a19d6c2 100644
--- a/tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro
+++ b/tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro
@@ -3,10 +3,12 @@ TARGET = tst_qdeclarativexmlhttprequest
macx:CONFIG -= app_bundle
INCLUDEPATH += ../../shared/
-HEADERS += ../../shared/testhttpserver.h
+HEADERS += ../../shared/testhttpserver.h \
+ ../../shared/util.h
SOURCES += tst_qdeclarativexmlhttprequest.cpp \
- ../../shared/testhttpserver.cpp
+ ../../shared/testhttpserver.cpp \
+ ../../shared/util.cpp
testDataFiles.files = data
testDataFiles.path = .
diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp b/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp
index abefa30108..d93285eef7 100644
--- a/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp
+++ b/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp
@@ -50,7 +50,7 @@
#define SERVER_PORT 14445
-class tst_qdeclarativexmlhttprequest : public QObject
+class tst_qdeclarativexmlhttprequest : public QDeclarativeDataTest
{
Q_OBJECT
public:
@@ -121,15 +121,10 @@ private:
QDeclarativeEngine engine;
};
-inline QUrl TEST_FILE(const QString &filename)
-{
- return QUrl::fromLocalFile(TESTDATA(filename));
-}
-
// Test that the dom exception codes are correct
void tst_qdeclarativexmlhttprequest::domExceptionCodes()
{
- QDeclarativeComponent component(&engine, TEST_FILE("domExceptionCodes.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("domExceptionCodes.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -171,10 +166,10 @@ void tst_qdeclarativexmlhttprequest::callbackException()
QFETCH(QString, which);
QFETCH(int, line);
- QString expect = TEST_FILE("callbackException.qml").toString() + ":"+QString::number(line)+": Error: Exception from Callback";
+ QString expect = testFileUrl("callbackException.qml").toString() + ":"+QString::number(line)+": Error: Exception from Callback";
QTest::ignoreMessage(QtWarningMsg, expect.toLatin1());
- QDeclarativeComponent component(&engine, TEST_FILE("callbackException.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("callbackException.qml"));
QObject *object = component.beginCreate(engine.rootContext());
QVERIFY(object != 0);
object->setProperty("url", "testdocument.html");
@@ -190,7 +185,7 @@ void tst_qdeclarativexmlhttprequest::callbackException()
// ### WebKit does not do this, but it seems to fit the standard and QML better
void tst_qdeclarativexmlhttprequest::staticStateValues()
{
- QDeclarativeComponent component(&engine, TEST_FILE("staticStateValues.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("staticStateValues.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -206,7 +201,7 @@ void tst_qdeclarativexmlhttprequest::staticStateValues()
// Test that the state value properties on instances have the correct values.
void tst_qdeclarativexmlhttprequest::instanceStateValues()
{
- QDeclarativeComponent component(&engine, TEST_FILE("instanceStateValues.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("instanceStateValues.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -222,7 +217,7 @@ void tst_qdeclarativexmlhttprequest::instanceStateValues()
// Test calling constructor
void tst_qdeclarativexmlhttprequest::constructor()
{
- QDeclarativeComponent component(&engine, TEST_FILE("constructor.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("constructor.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -235,7 +230,7 @@ void tst_qdeclarativexmlhttprequest::constructor()
// Test that all the properties are set correctly before any request is sent
void tst_qdeclarativexmlhttprequest::defaultState()
{
- QDeclarativeComponent component(&engine, TEST_FILE("defaultState.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("defaultState.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -259,9 +254,9 @@ void tst_qdeclarativexmlhttprequest::open()
if (remote) {
server.reset(new TestHTTPServer(SERVER_PORT));
QVERIFY(server->isValid());
- QVERIFY(server->wait(TEST_FILE("open_network.expect"),
- TEST_FILE("open_network.reply"),
- TEST_FILE("testdocument.html")));
+ QVERIFY(server->wait(testFileUrl("open_network.expect"),
+ testFileUrl("open_network.reply"),
+ testFileUrl("testdocument.html")));
}
QDeclarativeComponent component(&engine, qmlFile);
@@ -288,18 +283,18 @@ void tst_qdeclarativexmlhttprequest::open_data()
QTest::addColumn<QString>("url");
QTest::addColumn<bool>("remote");
- QTest::newRow("Relative url)") << TEST_FILE("open.qml") << "testdocument.html" << false;
- QTest::newRow("Absolute url)") << TEST_FILE("open.qml") << TEST_FILE("testdocument.html").toString() << false;
- QTest::newRow("Absolute network url)") << TEST_FILE("open.qml") << "http://127.0.0.1:14445/testdocument.html" << true;
+ QTest::newRow("Relative url)") << testFileUrl("open.qml") << "testdocument.html" << false;
+ QTest::newRow("Absolute url)") << testFileUrl("open.qml") << testFileUrl("testdocument.html").toString() << false;
+ QTest::newRow("Absolute network url)") << testFileUrl("open.qml") << "http://127.0.0.1:14445/testdocument.html" << true;
// ### Check that the username/password were sent to the server
- QTest::newRow("User/pass") << TEST_FILE("open_user.qml") << "http://127.0.0.1:14445/testdocument.html" << true;
+ QTest::newRow("User/pass") << testFileUrl("open_user.qml") << "http://127.0.0.1:14445/testdocument.html" << true;
}
// Test that calling XMLHttpRequest.open() with an invalid method raises an exception
void tst_qdeclarativexmlhttprequest::open_invalid_method()
{
- QDeclarativeComponent component(&engine, TEST_FILE("open_invalid_method.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("open_invalid_method.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -311,7 +306,7 @@ void tst_qdeclarativexmlhttprequest::open_invalid_method()
// Test that calling XMLHttpRequest.open() with sync raises an exception
void tst_qdeclarativexmlhttprequest::open_sync()
{
- QDeclarativeComponent component(&engine, TEST_FILE("open_sync.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("open_sync.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -324,7 +319,7 @@ void tst_qdeclarativexmlhttprequest::open_sync()
void tst_qdeclarativexmlhttprequest::open_arg_count()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("open_arg_count.1.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("open_arg_count.1.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -334,7 +329,7 @@ void tst_qdeclarativexmlhttprequest::open_arg_count()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("open_arg_count.2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("open_arg_count.2.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -349,11 +344,11 @@ void tst_qdeclarativexmlhttprequest::setRequestHeader()
{
TestHTTPServer server(SERVER_PORT);
QVERIFY(server.isValid());
- QVERIFY(server.wait(TEST_FILE("setRequestHeader.expect"),
- TEST_FILE("setRequestHeader.reply"),
- TEST_FILE("testdocument.html")));
+ QVERIFY(server.wait(testFileUrl("setRequestHeader.expect"),
+ testFileUrl("setRequestHeader.reply"),
+ testFileUrl("testdocument.html")));
- QDeclarativeComponent component(&engine, TEST_FILE("setRequestHeader.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("setRequestHeader.qml"));
QObject *object = component.beginCreate(engine.rootContext());
QVERIFY(object != 0);
object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
@@ -369,11 +364,11 @@ void tst_qdeclarativexmlhttprequest::setRequestHeader_caseInsensitive()
{
TestHTTPServer server(SERVER_PORT);
QVERIFY(server.isValid());
- QVERIFY(server.wait(TEST_FILE("setRequestHeader.expect"),
- TEST_FILE("setRequestHeader.reply"),
- TEST_FILE("testdocument.html")));
+ QVERIFY(server.wait(testFileUrl("setRequestHeader.expect"),
+ testFileUrl("setRequestHeader.reply"),
+ testFileUrl("testdocument.html")));
- QDeclarativeComponent component(&engine, TEST_FILE("setRequestHeader_caseInsensitive.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("setRequestHeader_caseInsensitive.qml"));
QObject *object = component.beginCreate(engine.rootContext());
QVERIFY(object != 0);
object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
@@ -386,7 +381,7 @@ void tst_qdeclarativexmlhttprequest::setRequestHeader_caseInsensitive()
// Test setting headers before open() throws exception
void tst_qdeclarativexmlhttprequest::setRequestHeader_unsent()
{
- QDeclarativeComponent component(&engine, TEST_FILE("setRequestHeader_unsent.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("setRequestHeader_unsent.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -430,11 +425,11 @@ void tst_qdeclarativexmlhttprequest::setRequestHeader_illegalName()
TestHTTPServer server(SERVER_PORT);
QVERIFY(server.isValid());
- QVERIFY(server.wait(TEST_FILE("open_network.expect"),
- TEST_FILE("open_network.reply"),
- TEST_FILE("testdocument.html")));
+ QVERIFY(server.wait(testFileUrl("open_network.expect"),
+ testFileUrl("open_network.reply"),
+ testFileUrl("testdocument.html")));
- QDeclarativeComponent component(&engine, TEST_FILE("setRequestHeader_illegalName.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("setRequestHeader_illegalName.qml"));
QObject *object = component.beginCreate(engine.rootContext());
QVERIFY(object != 0);
object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
@@ -458,11 +453,11 @@ void tst_qdeclarativexmlhttprequest::setRequestHeader_sent()
{
TestHTTPServer server(SERVER_PORT);
QVERIFY(server.isValid());
- QVERIFY(server.wait(TEST_FILE("open_network.expect"),
- TEST_FILE("open_network.reply"),
- TEST_FILE("testdocument.html")));
+ QVERIFY(server.wait(testFileUrl("open_network.expect"),
+ testFileUrl("open_network.reply"),
+ testFileUrl("testdocument.html")));
- QDeclarativeComponent component(&engine, TEST_FILE("setRequestHeader_sent.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("setRequestHeader_sent.qml"));
QObject *object = component.beginCreate(engine.rootContext());
QVERIFY(object != 0);
object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
@@ -478,7 +473,7 @@ void tst_qdeclarativexmlhttprequest::setRequestHeader_sent()
// Invalid arg count throws exception
void tst_qdeclarativexmlhttprequest::setRequestHeader_args()
{
- QDeclarativeComponent component(&engine, TEST_FILE("setRequestHeader_args.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("setRequestHeader_args.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -490,7 +485,7 @@ void tst_qdeclarativexmlhttprequest::setRequestHeader_args()
// Test that calling send() in UNSENT state throws an exception
void tst_qdeclarativexmlhttprequest::send_unsent()
{
- QDeclarativeComponent component(&engine, TEST_FILE("send_unsent.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("send_unsent.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -502,7 +497,7 @@ void tst_qdeclarativexmlhttprequest::send_unsent()
// Test attempting to resend a sent request throws an exception
void tst_qdeclarativexmlhttprequest::send_alreadySent()
{
- QDeclarativeComponent component(&engine, TEST_FILE("send_alreadySent.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("send_alreadySent.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -518,11 +513,11 @@ void tst_qdeclarativexmlhttprequest::send_ignoreData()
{
TestHTTPServer server(SERVER_PORT);
QVERIFY(server.isValid());
- QVERIFY(server.wait(TEST_FILE("send_ignoreData_GET.expect"),
- TEST_FILE("send_ignoreData.reply"),
- TEST_FILE("testdocument.html")));
+ QVERIFY(server.wait(testFileUrl("send_ignoreData_GET.expect"),
+ testFileUrl("send_ignoreData.reply"),
+ testFileUrl("testdocument.html")));
- QDeclarativeComponent component(&engine, TEST_FILE("send_ignoreData.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("send_ignoreData.qml"));
QObject *object = component.beginCreate(engine.rootContext());
QVERIFY(object != 0);
object->setProperty("reqType", "GET");
@@ -537,11 +532,11 @@ void tst_qdeclarativexmlhttprequest::send_ignoreData()
{
TestHTTPServer server(SERVER_PORT);
QVERIFY(server.isValid());
- QVERIFY(server.wait(TEST_FILE("send_ignoreData_HEAD.expect"),
- TEST_FILE("send_ignoreData.reply"),
+ QVERIFY(server.wait(testFileUrl("send_ignoreData_HEAD.expect"),
+ testFileUrl("send_ignoreData.reply"),
QUrl()));
- QDeclarativeComponent component(&engine, TEST_FILE("send_ignoreData.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("send_ignoreData.qml"));
QObject *object = component.beginCreate(engine.rootContext());
QVERIFY(object != 0);
object->setProperty("reqType", "HEAD");
@@ -556,11 +551,11 @@ void tst_qdeclarativexmlhttprequest::send_ignoreData()
{
TestHTTPServer server(SERVER_PORT);
QVERIFY(server.isValid());
- QVERIFY(server.wait(TEST_FILE("send_ignoreData_DELETE.expect"),
- TEST_FILE("send_ignoreData.reply"),
+ QVERIFY(server.wait(testFileUrl("send_ignoreData_DELETE.expect"),
+ testFileUrl("send_ignoreData.reply"),
QUrl()));
- QDeclarativeComponent component(&engine, TEST_FILE("send_ignoreData.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("send_ignoreData.qml"));
QObject *object = component.beginCreate(engine.rootContext());
QVERIFY(object != 0);
object->setProperty("reqType", "DELETE");
@@ -581,11 +576,11 @@ void tst_qdeclarativexmlhttprequest::send_withdata()
TestHTTPServer server(SERVER_PORT);
QVERIFY(server.isValid());
- QVERIFY(server.wait(TEST_FILE(file_expected),
- TEST_FILE("send_data.reply"),
- TEST_FILE("testdocument.html")));
+ QVERIFY(server.wait(testFileUrl(file_expected),
+ testFileUrl("send_data.reply"),
+ testFileUrl("testdocument.html")));
- QDeclarativeComponent component(&engine, TEST_FILE(file_qml));
+ QDeclarativeComponent component(&engine, testFileUrl(file_qml));
QObject *object = component.beginCreate(engine.rootContext());
QVERIFY(object != 0);
object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
@@ -613,7 +608,7 @@ void tst_qdeclarativexmlhttprequest::send_withdata_data()
// Test abort() has no effect in unsent state
void tst_qdeclarativexmlhttprequest::abort_unsent()
{
- QDeclarativeComponent component(&engine, TEST_FILE("abort_unsent.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("abort_unsent.qml"));
QObject *object = component.beginCreate(engine.rootContext());
QVERIFY(object != 0);
object->setProperty("url", "testdocument.html");
@@ -634,7 +629,7 @@ void tst_qdeclarativexmlhttprequest::abort_unsent()
// Test abort() cancels an open (but unsent) request
void tst_qdeclarativexmlhttprequest::abort_opened()
{
- QDeclarativeComponent component(&engine, TEST_FILE("abort_opened.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("abort_opened.qml"));
QObject *object = component.beginCreate(engine.rootContext());
QVERIFY(object != 0);
object->setProperty("url", "testdocument.html");
@@ -657,11 +652,11 @@ void tst_qdeclarativexmlhttprequest::abort()
{
TestHTTPServer server(SERVER_PORT);
QVERIFY(server.isValid());
- QVERIFY(server.wait(TEST_FILE("abort.expect"),
- TEST_FILE("abort.reply"),
- TEST_FILE("testdocument.html")));
+ QVERIFY(server.wait(testFileUrl("abort.expect"),
+ testFileUrl("abort.reply"),
+ testFileUrl("testdocument.html")));
- QDeclarativeComponent component(&engine, TEST_FILE("abort.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("abort.qml"));
QObject *object = component.beginCreate(engine.rootContext());
QVERIFY(object != 0);
object->setProperty("urlDummy", "http://127.0.0.1:14449/testdocument.html");
@@ -683,12 +678,12 @@ void tst_qdeclarativexmlhttprequest::getResponseHeader()
TestHTTPServer server(SERVER_PORT);
QVERIFY(server.isValid());
- QVERIFY(server.wait(TEST_FILE("getResponseHeader.expect"),
- TEST_FILE("getResponseHeader.reply"),
- TEST_FILE("testdocument.html")));
+ QVERIFY(server.wait(testFileUrl("getResponseHeader.expect"),
+ testFileUrl("getResponseHeader.reply"),
+ testFileUrl("testdocument.html")));
- QDeclarativeComponent component(&engine, TEST_FILE("getResponseHeader.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("getResponseHeader.qml"));
QObject *object = component.beginCreate(engine.rootContext());
QVERIFY(object != 0);
object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
@@ -719,7 +714,7 @@ void tst_qdeclarativexmlhttprequest::getResponseHeader()
// Test getResponseHeader throws an exception in an invalid state
void tst_qdeclarativexmlhttprequest::getResponseHeader_unsent()
{
- QDeclarativeComponent component(&engine, TEST_FILE("getResponseHeader_unsent.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("getResponseHeader_unsent.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -731,7 +726,7 @@ void tst_qdeclarativexmlhttprequest::getResponseHeader_unsent()
// Test getResponseHeader throws an exception in an invalid state
void tst_qdeclarativexmlhttprequest::getResponseHeader_sent()
{
- QDeclarativeComponent component(&engine, TEST_FILE("getResponseHeader_sent.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("getResponseHeader_sent.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -743,7 +738,7 @@ void tst_qdeclarativexmlhttprequest::getResponseHeader_sent()
// Invalid arg count throws exception
void tst_qdeclarativexmlhttprequest::getResponseHeader_args()
{
- QDeclarativeComponent component(&engine, TEST_FILE("getResponseHeader_args.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("getResponseHeader_args.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -758,11 +753,11 @@ void tst_qdeclarativexmlhttprequest::getAllResponseHeaders()
TestHTTPServer server(SERVER_PORT);
QVERIFY(server.isValid());
- QVERIFY(server.wait(TEST_FILE("getResponseHeader.expect"),
- TEST_FILE("getResponseHeader.reply"),
- TEST_FILE("testdocument.html")));
+ QVERIFY(server.wait(testFileUrl("getResponseHeader.expect"),
+ testFileUrl("getResponseHeader.reply"),
+ testFileUrl("testdocument.html")));
- QDeclarativeComponent component(&engine, TEST_FILE("getAllResponseHeaders.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("getAllResponseHeaders.qml"));
QObject *object = component.beginCreate(engine.rootContext());
QVERIFY(object != 0);
object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
@@ -787,7 +782,7 @@ void tst_qdeclarativexmlhttprequest::getAllResponseHeaders()
// Test getAllResponseHeaders throws an exception in an invalid state
void tst_qdeclarativexmlhttprequest::getAllResponseHeaders_unsent()
{
- QDeclarativeComponent component(&engine, TEST_FILE("getAllResponseHeaders_unsent.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("getAllResponseHeaders_unsent.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -799,7 +794,7 @@ void tst_qdeclarativexmlhttprequest::getAllResponseHeaders_unsent()
// Test getAllResponseHeaders throws an exception in an invalid state
void tst_qdeclarativexmlhttprequest::getAllResponseHeaders_sent()
{
- QDeclarativeComponent component(&engine, TEST_FILE("getAllResponseHeaders_sent.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("getAllResponseHeaders_sent.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -811,7 +806,7 @@ void tst_qdeclarativexmlhttprequest::getAllResponseHeaders_sent()
// Invalid arg count throws exception
void tst_qdeclarativexmlhttprequest::getAllResponseHeaders_args()
{
- QDeclarativeComponent component(&engine, TEST_FILE("getAllResponseHeaders_args.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("getAllResponseHeaders_args.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -827,11 +822,11 @@ void tst_qdeclarativexmlhttprequest::status()
TestHTTPServer server(SERVER_PORT);
QVERIFY(server.isValid());
- QVERIFY(server.wait(TEST_FILE("status.expect"),
+ QVERIFY(server.wait(testFileUrl("status.expect"),
replyUrl,
- TEST_FILE("testdocument.html")));
+ testFileUrl("testdocument.html")));
- QDeclarativeComponent component(&engine, TEST_FILE("status.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("status.qml"));
QObject *object = component.beginCreate(engine.rootContext());
QVERIFY(object != 0);
object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
@@ -856,9 +851,9 @@ void tst_qdeclarativexmlhttprequest::status_data()
QTest::addColumn<QUrl>("replyUrl");
QTest::addColumn<int>("status");
- QTest::newRow("OK") << TEST_FILE("status.200.reply") << 200;
- QTest::newRow("Not Found") << TEST_FILE("status.404.reply") << 404;
- QTest::newRow("Bad Request") << TEST_FILE("status.400.reply") << 400;
+ QTest::newRow("OK") << testFileUrl("status.200.reply") << 200;
+ QTest::newRow("Not Found") << testFileUrl("status.404.reply") << 404;
+ QTest::newRow("Bad Request") << testFileUrl("status.400.reply") << 400;
}
void tst_qdeclarativexmlhttprequest::statusText()
@@ -868,11 +863,11 @@ void tst_qdeclarativexmlhttprequest::statusText()
TestHTTPServer server(SERVER_PORT);
QVERIFY(server.isValid());
- QVERIFY(server.wait(TEST_FILE("status.expect"),
+ QVERIFY(server.wait(testFileUrl("status.expect"),
replyUrl,
- TEST_FILE("testdocument.html")));
+ testFileUrl("testdocument.html")));
- QDeclarativeComponent component(&engine, TEST_FILE("statusText.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("statusText.qml"));
QObject *object = component.beginCreate(engine.rootContext());
QVERIFY(object != 0);
object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
@@ -897,9 +892,9 @@ void tst_qdeclarativexmlhttprequest::statusText_data()
QTest::addColumn<QUrl>("replyUrl");
QTest::addColumn<QString>("statusText");
- QTest::newRow("OK") << TEST_FILE("status.200.reply") << "OK";
- QTest::newRow("Not Found") << TEST_FILE("status.404.reply") << "Document not found";
- QTest::newRow("Bad Request") << TEST_FILE("status.400.reply") << "Bad request";
+ QTest::newRow("OK") << testFileUrl("status.200.reply") << "OK";
+ QTest::newRow("Not Found") << testFileUrl("status.404.reply") << "Document not found";
+ QTest::newRow("Bad Request") << testFileUrl("status.400.reply") << "Bad request";
}
void tst_qdeclarativexmlhttprequest::responseText()
@@ -910,11 +905,11 @@ void tst_qdeclarativexmlhttprequest::responseText()
TestHTTPServer server(SERVER_PORT);
QVERIFY(server.isValid());
- QVERIFY(server.wait(TEST_FILE("status.expect"),
+ QVERIFY(server.wait(testFileUrl("status.expect"),
replyUrl,
bodyUrl));
- QDeclarativeComponent component(&engine, TEST_FILE("responseText.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("responseText.qml"));
QObject *object = component.beginCreate(engine.rootContext());
QVERIFY(object != 0);
object->setProperty("url", "http://127.0.0.1:14445/testdocument.html");
@@ -940,10 +935,10 @@ void tst_qdeclarativexmlhttprequest::responseText_data()
QTest::addColumn<QUrl>("bodyUrl");
QTest::addColumn<QString>("responseText");
- QTest::newRow("OK") << TEST_FILE("status.200.reply") << TEST_FILE("testdocument.html") << "QML Rocks!\n";
- QTest::newRow("empty body") << TEST_FILE("status.200.reply") << QUrl() << "";
- QTest::newRow("Not Found") << TEST_FILE("status.404.reply") << TEST_FILE("testdocument.html") << "";
- QTest::newRow("Bad Request") << TEST_FILE("status.404.reply") << TEST_FILE("testdocument.html") << "";
+ QTest::newRow("OK") << testFileUrl("status.200.reply") << testFileUrl("testdocument.html") << "QML Rocks!\n";
+ QTest::newRow("empty body") << testFileUrl("status.200.reply") << QUrl() << "";
+ QTest::newRow("Not Found") << testFileUrl("status.404.reply") << testFileUrl("testdocument.html") << "";
+ QTest::newRow("Bad Request") << testFileUrl("status.404.reply") << testFileUrl("testdocument.html") << "";
}
void tst_qdeclarativexmlhttprequest::nonUtf8()
@@ -952,7 +947,7 @@ void tst_qdeclarativexmlhttprequest::nonUtf8()
QFETCH(QString, responseText);
QFETCH(QString, xmlRootNodeValue);
- QDeclarativeComponent component(&engine, TEST_FILE("utf16.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("utf16.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -991,7 +986,7 @@ void tst_qdeclarativexmlhttprequest::nonUtf8_data()
// throws an exception
void tst_qdeclarativexmlhttprequest::invalidMethodUsage()
{
- QDeclarativeComponent component(&engine, TEST_FILE("invalidMethodUsage.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("invalidMethodUsage.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -1018,9 +1013,9 @@ void tst_qdeclarativexmlhttprequest::redirects()
TestHTTPServer server(SERVER_PORT);
QVERIFY(server.isValid());
server.addRedirect("redirect.html", "http://127.0.0.1:14445/redirecttarget.html");
- server.serveDirectory(TESTDATA(""));
+ server.serveDirectory(dataDirectory());
- QDeclarativeComponent component(&engine, TEST_FILE("redirects.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("redirects.qml"));
QObject *object = component.beginCreate(engine.rootContext());
QVERIFY(object != 0);
object->setProperty("url", "http://127.0.0.1:14445/redirect.html");
@@ -1037,9 +1032,9 @@ void tst_qdeclarativexmlhttprequest::redirects()
TestHTTPServer server(SERVER_PORT);
QVERIFY(server.isValid());
server.addRedirect("redirect.html", "http://127.0.0.1:14445/redirectmissing.html");
- server.serveDirectory(TESTDATA(""));
+ server.serveDirectory(dataDirectory());
- QDeclarativeComponent component(&engine, TEST_FILE("redirectError.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("redirectError.qml"));
QObject *object = component.beginCreate(engine.rootContext());
QVERIFY(object != 0);
object->setProperty("url", "http://127.0.0.1:14445/redirect.html");
@@ -1056,9 +1051,9 @@ void tst_qdeclarativexmlhttprequest::redirects()
TestHTTPServer server(SERVER_PORT);
QVERIFY(server.isValid());
server.addRedirect("redirect.html", "http://127.0.0.1:14445/redirect.html");
- server.serveDirectory(TESTDATA(""));
+ server.serveDirectory(dataDirectory());
- QDeclarativeComponent component(&engine, TEST_FILE("redirectRecur.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("redirectRecur.qml"));
QObject *object = component.beginCreate(engine.rootContext());
QVERIFY(object != 0);
object->setProperty("url", "http://127.0.0.1:14445/redirect.html");
@@ -1079,7 +1074,7 @@ void tst_qdeclarativexmlhttprequest::redirects()
void tst_qdeclarativexmlhttprequest::responseXML_invalid()
{
- QDeclarativeComponent component(&engine, TEST_FILE("responseXML_invalid.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("responseXML_invalid.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -1093,7 +1088,7 @@ void tst_qdeclarativexmlhttprequest::responseXML_invalid()
// Test the Document DOM element
void tst_qdeclarativexmlhttprequest::document()
{
- QDeclarativeComponent component(&engine, TEST_FILE("document.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("document.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -1107,7 +1102,7 @@ void tst_qdeclarativexmlhttprequest::document()
// Test the Element DOM element
void tst_qdeclarativexmlhttprequest::element()
{
- QDeclarativeComponent component(&engine, TEST_FILE("element.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("element.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -1121,7 +1116,7 @@ void tst_qdeclarativexmlhttprequest::element()
// Test the Attr DOM element
void tst_qdeclarativexmlhttprequest::attr()
{
- QDeclarativeComponent component(&engine, TEST_FILE("attr.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("attr.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -1135,7 +1130,7 @@ void tst_qdeclarativexmlhttprequest::attr()
// Test the Text DOM element
void tst_qdeclarativexmlhttprequest::text()
{
- QDeclarativeComponent component(&engine, TEST_FILE("text.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("text.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -1149,7 +1144,7 @@ void tst_qdeclarativexmlhttprequest::text()
// Test the CDataSection DOM element
void tst_qdeclarativexmlhttprequest::cdata()
{
- QDeclarativeComponent component(&engine, TEST_FILE("cdata.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("cdata.qml"));
QObject *object = component.create();
QVERIFY(object != 0);
diff --git a/tests/auto/declarative/v4/tst_v4.cpp b/tests/auto/declarative/v4/tst_v4.cpp
index 791610d541..46b4488b4d 100644
--- a/tests/auto/declarative/v4/tst_v4.cpp
+++ b/tests/auto/declarative/v4/tst_v4.cpp
@@ -51,17 +51,7 @@
#include "../../shared/util.h"
#include "testtypes.h"
-inline QUrl TEST_FILE(const QString &filename)
-{
- return QUrl::fromLocalFile(TESTDATA(filename));
-}
-
-inline QUrl TEST_FILE(const char *filename)
-{
- return TEST_FILE(QLatin1String(filename));
-}
-
-class tst_v4 : public QObject
+class tst_v4 : public QDeclarativeDataTest
{
Q_OBJECT
public:
@@ -86,6 +76,7 @@ private:
void tst_v4::initTestCase()
{
+ QDeclarativeDataTest::initTestCase();
registerTypes();
}
@@ -102,7 +93,7 @@ void tst_v4::qtscript()
QFETCH(QString, file);
QV4Compiler::enableBindingsTest(true);
- QDeclarativeComponent component(&engine, TEST_FILE(file));
+ QDeclarativeComponent component(&engine, testFileUrl(file));
v4ErrorsMsgCount = 0;
QtMsgHandler old = qInstallMsgHandler(v4ErrorsMsgHandler);
@@ -132,7 +123,7 @@ void tst_v4::qtscript_data()
void tst_v4::unnecessaryReeval()
{
- QDeclarativeComponent component(&engine, TEST_FILE("unnecessaryReeval.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("unnecessaryReeval.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
@@ -166,7 +157,7 @@ void tst_v4::unnecessaryReeval()
void tst_v4::logicalOr()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("logicalOr.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("logicalOr.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
@@ -179,7 +170,7 @@ void tst_v4::logicalOr()
}
{
- QDeclarativeComponent component(&engine, TEST_FILE("logicalOr.2.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("logicalOr.2.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
@@ -195,7 +186,7 @@ void tst_v4::logicalOr()
void tst_v4::conditionalExpr()
{
{
- QDeclarativeComponent component(&engine, TEST_FILE("conditionalExpr.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("conditionalExpr.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
@@ -213,7 +204,7 @@ void tst_v4::conditionalExpr()
// NestedObject::result.
void tst_v4::nestedObjectAccess()
{
- QDeclarativeComponent component(&engine, TEST_FILE("nestedObjectAccess.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("nestedObjectAccess.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
@@ -228,7 +219,7 @@ void tst_v4::nestedObjectAccess()
void tst_v4::subscriptionsInConditionalExpressions()
{
- QDeclarativeComponent component(&engine, TEST_FILE("subscriptionsInConditionalExpressions.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("subscriptionsInConditionalExpressions.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
@@ -244,7 +235,7 @@ void tst_v4::subscriptionsInConditionalExpressions()
// Crash test
void tst_v4::qtbug_21883()
{
- QDeclarativeComponent component(&engine, TEST_FILE("qtbug_21883.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("qtbug_21883.qml"));
QString warning = component.url().toString() + ":4: Unable to assign null to ResultObject*";
QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData());
@@ -256,7 +247,7 @@ void tst_v4::qtbug_21883()
void tst_v4::qtbug_22816()
{
- QDeclarativeComponent component(&engine, TEST_FILE("qtbug_22816.qml"));
+ QDeclarativeComponent component(&engine, testFileUrl("qtbug_22816.qml"));
QObject *o = component.create();
QVERIFY(o != 0);
diff --git a/tests/auto/declarative/v4/v4.pro b/tests/auto/declarative/v4/v4.pro
index 04d20f0fc3..b14be36475 100644
--- a/tests/auto/declarative/v4/v4.pro
+++ b/tests/auto/declarative/v4/v4.pro
@@ -3,8 +3,10 @@ TARGET = tst_qdeclarativev4
macx:CONFIG -= app_bundle
SOURCES += tst_v4.cpp \
- testtypes.cpp
-HEADERS += testtypes.h
+ testtypes.cpp \
+ ../../shared/util.cpp
+HEADERS += testtypes.h \
+ ../../shared/util.h
testDataFiles.files = data
testDataFiles.path = .