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/qquickpincharea | |
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/qquickpincharea')
-rw-r--r-- | tests/auto/qtquick2/qquickpincharea/qquickpincharea.pro | 4 | ||||
-rw-r--r-- | tests/auto/qtquick2/qquickpincharea/tst_qquickpincharea.cpp | 11 |
2 files changed, 9 insertions, 6 deletions
diff --git a/tests/auto/qtquick2/qquickpincharea/qquickpincharea.pro b/tests/auto/qtquick2/qquickpincharea/qquickpincharea.pro index 6e2ff59512..f5fb246ae8 100644 --- a/tests/auto/qtquick2/qquickpincharea/qquickpincharea.pro +++ b/tests/auto/qtquick2/qquickpincharea/qquickpincharea.pro @@ -2,7 +2,9 @@ CONFIG += testcase TARGET = tst_qquickpincharea macx:CONFIG -= app_bundle -SOURCES += tst_qquickpincharea.cpp +SOURCES += tst_qquickpincharea.cpp \ + ../../shared/util.cpp +HEADERS += ../../shared/util.h testDataFiles.files = data testDataFiles.path = . diff --git a/tests/auto/qtquick2/qquickpincharea/tst_qquickpincharea.cpp b/tests/auto/qtquick2/qquickpincharea/tst_qquickpincharea.cpp index c34565e953..53d7c2c2ce 100644 --- a/tests/auto/qtquick2/qquickpincharea/tst_qquickpincharea.cpp +++ b/tests/auto/qtquick2/qquickpincharea/tst_qquickpincharea.cpp @@ -47,7 +47,7 @@ #include <QtDeclarative/qdeclarativecontext.h> #include "../../shared/util.h" -class tst_QQuickPinchArea: public QObject +class tst_QQuickPinchArea: public QDeclarativeDataTest { Q_OBJECT public: @@ -66,6 +66,7 @@ private: }; void tst_QQuickPinchArea::initTestCase() { + QDeclarativeDataTest::initTestCase(); if (!device) { device = new QTouchDevice; device->setType(QTouchDevice::TouchScreen); @@ -80,7 +81,7 @@ void tst_QQuickPinchArea::cleanupTestCase() void tst_QQuickPinchArea::pinchProperties() { QQuickView *canvas = createView(); - canvas->setSource(QUrl::fromLocalFile(TESTDATA("pinchproperties.qml"))); + canvas->setSource(testFileUrl("pinchproperties.qml")); canvas->show(); canvas->requestActivateWindow(); QVERIFY(canvas->rootObject() != 0); @@ -206,7 +207,7 @@ QTouchEvent::TouchPoint makeTouchPoint(int id, QPoint p, QQuickView *v, QQuickIt void tst_QQuickPinchArea::scale() { QQuickView *canvas = createView(); - canvas->setSource(QUrl::fromLocalFile(TESTDATA("pinchproperties.qml"))); + canvas->setSource(testFileUrl("pinchproperties.qml")); canvas->show(); canvas->requestActivateWindow(); QTest::qWaitForWindowShown(canvas); @@ -259,7 +260,7 @@ void tst_QQuickPinchArea::scale() void tst_QQuickPinchArea::pan() { QQuickView *canvas = createView(); - canvas->setSource(QUrl::fromLocalFile(TESTDATA("pinchproperties.qml"))); + canvas->setSource(testFileUrl("pinchproperties.qml")); canvas->show(); canvas->requestActivateWindow(); QTest::qWaitForWindowShown(canvas); @@ -315,7 +316,7 @@ void tst_QQuickPinchArea::pan() void tst_QQuickPinchArea::retouch() { QQuickView *canvas = createView(); - canvas->setSource(QUrl::fromLocalFile(TESTDATA("pinchproperties.qml"))); + canvas->setSource(testFileUrl("pinchproperties.qml")); canvas->show(); canvas->requestActivateWindow(); QTest::qWaitForWindowShown(canvas); |