summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativeproperty
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2012-02-08 12:42:12 +0100
committerAndrew den Exter <andrew.den-exter@nokia.com>2012-02-09 05:58:14 +0100
commitb05039d5efcaec69d01d3737ccb5f0199765632b (patch)
tree162ad7dc2965087dc38e75e03e25031707309881 /tests/auto/declarative/qdeclarativeproperty
parent5217eddc405565f09340d5ff4a881d833c03a201 (diff)
Add QDeclarativeDataTest base class to locate test data.
- Remove TEST_FILE and TEST_DATA macros in favour of base class that uses QFINDTESTDATA to locate the data. This avoids repeated searching and handles Windows correctly (executables in release/debug subfolders). - Modeled after an existing class in the QtQuick2 tests (see qtdeclarative\tests\auto\shared\util.*). Change-Id: I9e595953328fb552648cef4c7f712d9000f53832 Reviewed-by: Matthew Vogt <matthew.vogt@nokia.com>
Diffstat (limited to 'tests/auto/declarative/qdeclarativeproperty')
-rw-r--r--tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro8
-rw-r--r--tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp25
2 files changed, 9 insertions, 24 deletions
diff --git a/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro b/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro
index 6c4d5604..09f93288 100644
--- a/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro
+++ b/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro
@@ -7,13 +7,7 @@ macx:CONFIG -= app_bundle
SOURCES += tst_qdeclarativeproperty.cpp
-symbian: {
- importFiles.files = data
- importFiles.path = .
- DEPLOYMENT += importFiles
-} else {
- DEFINES += SRCDIR=\\\"$$PWD\\\"
-}
+include(../shared/qdeclarativedatatest.pri)
CONFIG += parallel_test
diff --git a/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp b/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp
index 4fb519f5..e906dfb0 100644
--- a/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp
+++ b/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp
@@ -39,6 +39,7 @@
**
****************************************************************************/
#include <qtest.h>
+#include <qdeclarativedatatest.h>
#include <QtQuick1/qdeclarativeengine.h>
#include <QtQuick1/qdeclarativecomponent.h>
#include <QtQuick1/qdeclarativeproperty.h>
@@ -48,17 +49,6 @@
#include <QtCore/qfileinfo.h>
#include <QtCore/qdir.h>
-#ifdef Q_OS_SYMBIAN
-// In Symbian OS test data is located in applications private dir
-#define SRCDIR "."
-#endif
-
-inline QUrl TEST_FILE(const QString &filename)
-{
- QFileInfo fileInfo(__FILE__);
- return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath(QLatin1String("data/") + filename));
-}
-
class MyQmlObject : public QObject
{
Q_OBJECT
@@ -66,7 +56,7 @@ public:
MyQmlObject() {}
};
-QML_DECLARE_TYPE(MyQmlObject);
+QML_DECLARE_TYPE(MyQmlObject)
class MyAttached : public QObject
{
@@ -99,10 +89,10 @@ private:
QList<MyQmlObject*> m_children;
};
-QML_DECLARE_TYPE(MyContainer);
+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:
@@ -1004,7 +994,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);
@@ -1019,7 +1009,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);
@@ -1374,7 +1364,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);
@@ -1483,6 +1473,7 @@ void tst_qdeclarativeproperty::copy()
void tst_qdeclarativeproperty::initTestCase()
{
+ QDeclarativeDataTest::initTestCase();
qmlRegisterType<MyQmlObject>("Test",1,0,"MyQmlObject");
qmlRegisterType<PropertyObject>("Test",1,0,"PropertyObject");
qmlRegisterType<MyContainer>("Test",1,0,"MyContainer");