Use TESTDATA macro in ListModel tests.
authorMichael Brasser <michael.brasser@nokia.com>
Wed, 26 Oct 2011 05:46:33 +0000 (15:46 +1000)
committerQt by Nokia <qt-info@nokia.com>
Wed, 26 Oct 2011 22:04:09 +0000 (00:04 +0200)
Task-number: QTBUG-21721
Change-Id: I5fa4359f3042552896676a4183a70bf91df97724
Reviewed-by: Glenn Watson <glenn.watson@nokia.com>
tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro
tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp

index 1586e68..fc8a317 100644 (file)
@@ -4,7 +4,9 @@ macx:CONFIG -= app_bundle
 
 SOURCES += tst_qdeclarativelistmodel.cpp
 
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+testDataFiles.files = data
+testDataFiles.path = .
+DEPLOYMENT += testDataFiles
 
 CONFIG += parallel_test
 
index 23e9fc4..3ce3d5f 100644 (file)
@@ -51,6 +51,8 @@
 #include <QtCore/qtranslator.h>
 #include <QSignalSpy>
 
+#include "../shared/util.h"
+
 Q_DECLARE_METATYPE(QList<int>)
 Q_DECLARE_METATYPE(QList<QVariantHash>)
 
@@ -545,7 +547,7 @@ void tst_qdeclarativelistmodel::dynamic_worker()
 
     QDeclarativeListModel model;
     QDeclarativeEngine eng;
-    QDeclarativeComponent component(&eng, QUrl::fromLocalFile(SRCDIR "/data/model.qml"));
+    QDeclarativeComponent component(&eng, QUrl::fromLocalFile(TESTDATA("model.qml")));
     QQuickItem *item = createWorkerTest(&eng, &component, &model);
     QVERIFY(item != 0);
 
@@ -591,7 +593,7 @@ void tst_qdeclarativelistmodel::dynamic_worker_sync()
 
     QDeclarativeListModel model;
     QDeclarativeEngine eng;
-    QDeclarativeComponent component(&eng, QUrl::fromLocalFile(SRCDIR "/data/model.qml"));
+    QDeclarativeComponent component(&eng, QUrl::fromLocalFile(TESTDATA("model.qml")));
     QQuickItem *item = createWorkerTest(&eng, &component, &model);
     QVERIFY(item != 0);
 
@@ -622,7 +624,7 @@ void tst_qdeclarativelistmodel::dynamic_worker_sync()
 void tst_qdeclarativelistmodel::enumerate()
 {
     QDeclarativeEngine eng;
-    QDeclarativeComponent component(&eng, QUrl::fromLocalFile(SRCDIR "/data/enumerate.qml"));
+    QDeclarativeComponent component(&eng, QUrl::fromLocalFile(TESTDATA("enumerate.qml")));
     QVERIFY(!component.isError());
     QQuickItem *item = qobject_cast<QQuickItem*>(component.create());
     QVERIFY(item != 0);
@@ -846,7 +848,7 @@ void tst_qdeclarativelistmodel::get_worker()
 
     QDeclarativeListModel model;
     QDeclarativeEngine eng;
-    QDeclarativeComponent component(&eng, QUrl::fromLocalFile(SRCDIR "/data/model.qml"));
+    QDeclarativeComponent component(&eng, QUrl::fromLocalFile(TESTDATA("model.qml")));
     QQuickItem *item = createWorkerTest(&eng, &component, &model);
     QVERIFY(item != 0);
 
@@ -996,7 +998,7 @@ void tst_qdeclarativelistmodel::get_nested_data()
 void tst_qdeclarativelistmodel::crash_model_with_multiple_roles()
 {
     QDeclarativeEngine eng;
-    QDeclarativeComponent component(&eng, QUrl::fromLocalFile(SRCDIR "/data/multipleroles.qml"));
+    QDeclarativeComponent component(&eng, QUrl::fromLocalFile(TESTDATA("multipleroles.qml")));
     QObject *rootItem = component.create();
     QVERIFY(component.errorString().isEmpty());
     QVERIFY(rootItem != 0);
@@ -1013,7 +1015,7 @@ void tst_qdeclarativelistmodel::crash_model_with_multiple_roles()
 void tst_qdeclarativelistmodel::set_model_cache()
 {
     QDeclarativeEngine eng;
-    QDeclarativeComponent component(&eng, QUrl::fromLocalFile(SRCDIR "/data/setmodelcachelist.qml"));
+    QDeclarativeComponent component(&eng, QUrl::fromLocalFile(TESTDATA("setmodelcachelist.qml")));
     QObject *model = component.create();
     QVERIFY2(component.errorString().isEmpty(), QTest::toString(component.errorString()));
     QVERIFY(model != 0);
@@ -1156,7 +1158,7 @@ void tst_qdeclarativelistmodel::property_changes_worker()
 
     QDeclarativeListModel model;
     QDeclarativeEngine engine;
-    QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/model.qml"));
+    QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("model.qml")));
     QVERIFY2(component.errorString().isEmpty(), component.errorString().toUtf8());
     QQuickItem *item = createWorkerTest(&engine, &component, &model);
     QVERIFY(item != 0);
@@ -1226,7 +1228,7 @@ void tst_qdeclarativelistmodel::clear()
 void tst_qdeclarativelistmodel::signal_handlers()
 {
     QDeclarativeEngine eng;
-    QDeclarativeComponent component(&eng, QUrl::fromLocalFile(SRCDIR "/data/signalhandlers.qml"));
+    QDeclarativeComponent component(&eng, QUrl::fromLocalFile(TESTDATA("signalhandlers.qml")));
     QObject *model = component.create();
     QVERIFY2(component.errorString().isEmpty(), QTest::toString(component.errorString()));
     QVERIFY(model != 0);
@@ -1239,7 +1241,7 @@ void tst_qdeclarativelistmodel::worker_sync()
 {
     QDeclarativeListModel model;
     QDeclarativeEngine eng;
-    QDeclarativeComponent component(&eng, QUrl::fromLocalFile(SRCDIR "/data/workersync.qml"));
+    QDeclarativeComponent component(&eng, QUrl::fromLocalFile(TESTDATA("workersync.qml")));
     QQuickItem *item = createWorkerTest(&eng, &component, &model);
     QVERIFY(item != 0);
 
@@ -1296,7 +1298,7 @@ void tst_qdeclarativelistmodel::worker_remove_element()
 {
     QDeclarativeListModel model;
     QDeclarativeEngine eng;
-    QDeclarativeComponent component(&eng, QUrl::fromLocalFile(SRCDIR "/data/workerremoveelement.qml"));
+    QDeclarativeComponent component(&eng, QUrl::fromLocalFile(TESTDATA("workerremoveelement.qml")));
     QQuickItem *item = createWorkerTest(&eng, &component, &model);
     QVERIFY(item != 0);
 
@@ -1329,7 +1331,7 @@ void tst_qdeclarativelistmodel::worker_remove_list()
 {
     QDeclarativeListModel model;
     QDeclarativeEngine eng;
-    QDeclarativeComponent component(&eng, QUrl::fromLocalFile(SRCDIR "/data/workerremovelist.qml"));
+    QDeclarativeComponent component(&eng, QUrl::fromLocalFile(TESTDATA("workerremovelist.qml")));
     QQuickItem *item = createWorkerTest(&eng, &component, &model);
     QVERIFY(item != 0);