diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2011-12-21 09:06:26 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-12-21 15:35:22 +0100 |
commit | 8249c72213bc7d212c05aa086b3145a5742706a3 (patch) | |
tree | 4a34b97b0d57a05707c65b7328d5ab1bf4254920 /tests/auto/qtquick2/qdeclarativepath | |
parent | 3c211558f6b571555558bd1fc59774e36a6da710 (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/qtquick2/qdeclarativepath')
-rw-r--r-- | tests/auto/qtquick2/qdeclarativepath/qdeclarativepath.pro | 4 | ||||
-rw-r--r-- | tests/auto/qtquick2/qdeclarativepath/tst_qdeclarativepath.cpp | 8 |
2 files changed, 7 insertions, 5 deletions
diff --git a/tests/auto/qtquick2/qdeclarativepath/qdeclarativepath.pro b/tests/auto/qtquick2/qdeclarativepath/qdeclarativepath.pro index 9f4204efa3..caadcbd728 100644 --- a/tests/auto/qtquick2/qdeclarativepath/qdeclarativepath.pro +++ b/tests/auto/qtquick2/qdeclarativepath/qdeclarativepath.pro @@ -2,7 +2,9 @@ CONFIG += testcase TARGET = tst_qdeclarativepath macx:CONFIG -= app_bundle -SOURCES += tst_qdeclarativepath.cpp +SOURCES += tst_qdeclarativepath.cpp \ + ../../shared/util.cpp +HEADERS += ../../shared/util.h testDataFiles.files = data testDataFiles.path = . diff --git a/tests/auto/qtquick2/qdeclarativepath/tst_qdeclarativepath.cpp b/tests/auto/qtquick2/qdeclarativepath/tst_qdeclarativepath.cpp index bf4f70b292..9a21e56aab 100644 --- a/tests/auto/qtquick2/qdeclarativepath/tst_qdeclarativepath.cpp +++ b/tests/auto/qtquick2/qdeclarativepath/tst_qdeclarativepath.cpp @@ -46,7 +46,7 @@ #include "../../shared/util.h" -class tst_QDeclarativePath : public QObject +class tst_QDeclarativePath : public QDeclarativeDataTest { Q_OBJECT public: @@ -61,7 +61,7 @@ private slots: void tst_QDeclarativePath::arc() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("arc.qml"))); + QDeclarativeComponent c(&engine, testFileUrl("arc.qml")); QDeclarativePath *obj = qobject_cast<QDeclarativePath*>(c.create()); QVERIFY(obj != 0); @@ -96,7 +96,7 @@ void tst_QDeclarativePath::arc() void tst_QDeclarativePath::catmullromCurve() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("curve.qml"))); + QDeclarativeComponent c(&engine, testFileUrl("curve.qml")); QDeclarativePath *obj = qobject_cast<QDeclarativePath*>(c.create()); QVERIFY(obj != 0); @@ -131,7 +131,7 @@ void tst_QDeclarativePath::catmullromCurve() void tst_QDeclarativePath::svg() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("svg.qml"))); + QDeclarativeComponent c(&engine, testFileUrl("svg.qml")); QDeclarativePath *obj = qobject_cast<QDeclarativePath*>(c.create()); QVERIFY(obj != 0); |