summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp
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/qdeclarativeinfo/tst_qdeclarativeinfo.cpp
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/qdeclarativeinfo/tst_qdeclarativeinfo.cpp')
-rw-r--r--tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp b/tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp
index 7497417b..682d8513 100644
--- a/tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp
+++ b/tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#include <qtest.h>
+#include <qdeclarativedatatest.h>
#include <QDeclarativeEngine>
#include <QDeclarativeComponent>
#include <QPushButton>
@@ -51,7 +52,7 @@
#define SRCDIR "."
#endif
-class tst_qdeclarativeinfo : public QObject
+class tst_qdeclarativeinfo : public QDeclarativeDataTest
{
Q_OBJECT
public:
@@ -70,14 +71,9 @@ private:
QDeclarativeEngine engine;
};
-inline QUrl TEST_FILE(const QString &filename)
-{
- return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + 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);
@@ -96,7 +92,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);
@@ -110,7 +106,7 @@ 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";
}