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/declarative/qdeclarativebinding | |
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/declarative/qdeclarativebinding')
-rw-r--r-- | tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro | 4 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp | 12 |
2 files changed, 9 insertions, 7 deletions
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); |