diff options
Diffstat (limited to 'tests')
101 files changed, 796 insertions, 726 deletions
diff --git a/tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro b/tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro index f4231b5679..5870d74ab2 100644 --- a/tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro +++ b/tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro @@ -3,7 +3,9 @@ TARGET = tst_qdeclarativeanimations SOURCES += tst_qdeclarativeanimations.cpp macx:CONFIG -= app_bundle -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp index 5650394735..76d832626d 100644 --- a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp +++ b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp @@ -53,6 +53,7 @@ #include <limits.h> #include <math.h> +#include "../shared/util.h" #include "../../../shared/util.h" class tst_qdeclarativeanimations : public QObject @@ -222,7 +223,7 @@ void tst_qdeclarativeanimations::simplePath() { { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/pathAnimation.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("pathAnimation.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect); @@ -258,7 +259,7 @@ void tst_qdeclarativeanimations::simplePath() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/pathAnimation2.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("pathAnimation2.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect); @@ -290,7 +291,7 @@ void tst_qdeclarativeanimations::simplePath() void tst_qdeclarativeanimations::pathInterpolator() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/pathInterpolator.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("pathInterpolator.qml"))); QDeclarativePathInterpolator *interpolator = qobject_cast<QDeclarativePathInterpolator*>(c.create()); QVERIFY(interpolator); @@ -315,7 +316,7 @@ void tst_qdeclarativeanimations::pathInterpolator() void tst_qdeclarativeanimations::pathInterpolatorBackwardJump() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/pathInterpolatorBack.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("pathInterpolatorBack.qml"))); QDeclarativePathInterpolator *interpolator = qobject_cast<QDeclarativePathInterpolator*>(c.create()); QVERIFY(interpolator); @@ -347,7 +348,7 @@ void tst_qdeclarativeanimations::pathInterpolatorBackwardJump() void tst_qdeclarativeanimations::pathWithNoStart() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/pathAnimationNoStart.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("pathAnimationNoStart.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect); @@ -470,7 +471,7 @@ void tst_qdeclarativeanimations::badTypes() //don't crash { QSGView *view = new QSGView; - view->setSource(QUrl::fromLocalFile(SRCDIR "/data/badtype1.qml")); + view->setSource(QUrl::fromLocalFile(TESTDATA("badtype1.qml"))); qApp->processEvents(); @@ -480,7 +481,7 @@ void tst_qdeclarativeanimations::badTypes() //make sure we get a compiler error { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/badtype2.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("badtype2.qml"))); QTest::ignoreMessage(QtWarningMsg, "QDeclarativeComponent: Component is not ready"); c.create(); @@ -491,7 +492,7 @@ void tst_qdeclarativeanimations::badTypes() //make sure we get a compiler error { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/badtype3.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("badtype3.qml"))); QTest::ignoreMessage(QtWarningMsg, "QDeclarativeComponent: Component is not ready"); c.create(); @@ -502,7 +503,7 @@ void tst_qdeclarativeanimations::badTypes() //don't crash { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/badtype4.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("badtype4.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect); @@ -520,14 +521,14 @@ void tst_qdeclarativeanimations::badProperties() { QDeclarativeEngine engine; - QDeclarativeComponent c1(&engine, QUrl::fromLocalFile(SRCDIR "/data/badproperty1.qml")); - QByteArray message = QUrl::fromLocalFile(SRCDIR "/data/badproperty1.qml").toString().toUtf8() + ":18:9: QML ColorAnimation: Cannot animate non-existent property \"border.colr\""; + QDeclarativeComponent c1(&engine, QUrl::fromLocalFile(TESTDATA("badproperty1.qml"))); + QByteArray message = QUrl::fromLocalFile(TESTDATA("badproperty1.qml")).toString().toUtf8() + ":18:9: QML ColorAnimation: Cannot animate non-existent property \"border.colr\""; QTest::ignoreMessage(QtWarningMsg, message); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c1.create()); QVERIFY(rect); - QDeclarativeComponent c2(&engine, QUrl::fromLocalFile(SRCDIR "/data/badproperty2.qml")); - message = QUrl::fromLocalFile(SRCDIR "/data/badproperty2.qml").toString().toUtf8() + ":18:9: QML ColorAnimation: Cannot animate read-only property \"border\""; + QDeclarativeComponent c2(&engine, QUrl::fromLocalFile(TESTDATA("badproperty2.qml"))); + message = QUrl::fromLocalFile(TESTDATA("badproperty2.qml")).toString().toUtf8() + ":18:9: QML ColorAnimation: Cannot animate read-only property \"border\""; QTest::ignoreMessage(QtWarningMsg, message); rect = qobject_cast<QSGRectangle*>(c2.create()); QVERIFY(rect); @@ -544,7 +545,7 @@ void tst_qdeclarativeanimations::mixedTypes() //assumes border.width stays a real -- not real robust { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/mixedtype1.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("mixedtype1.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect); @@ -560,7 +561,7 @@ void tst_qdeclarativeanimations::mixedTypes() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/mixedtype2.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("mixedtype2.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect); @@ -580,7 +581,7 @@ void tst_qdeclarativeanimations::properties() const int waitDuration = 300; { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/properties.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("properties.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect); @@ -592,7 +593,7 @@ void tst_qdeclarativeanimations::properties() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/properties2.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("properties2.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect); @@ -604,7 +605,7 @@ void tst_qdeclarativeanimations::properties() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/properties3.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("properties3.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect); @@ -616,7 +617,7 @@ void tst_qdeclarativeanimations::properties() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/properties4.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("properties4.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect); @@ -629,7 +630,7 @@ void tst_qdeclarativeanimations::properties() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/properties5.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("properties5.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect); @@ -646,7 +647,7 @@ void tst_qdeclarativeanimations::propertiesTransition() const int waitDuration = 300; { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertiesTransition.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("propertiesTransition.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect); @@ -659,7 +660,7 @@ void tst_qdeclarativeanimations::propertiesTransition() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertiesTransition2.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("propertiesTransition2.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect); @@ -674,7 +675,7 @@ void tst_qdeclarativeanimations::propertiesTransition() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertiesTransition3.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("propertiesTransition3.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect); @@ -687,7 +688,7 @@ void tst_qdeclarativeanimations::propertiesTransition() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertiesTransition4.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("propertiesTransition4.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect); @@ -701,7 +702,7 @@ void tst_qdeclarativeanimations::propertiesTransition() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertiesTransition5.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("propertiesTransition5.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect); @@ -715,7 +716,7 @@ void tst_qdeclarativeanimations::propertiesTransition() /*{ QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertiesTransition6.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("propertiesTransition6.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect); @@ -729,7 +730,7 @@ void tst_qdeclarativeanimations::propertiesTransition() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertiesTransition7.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("propertiesTransition7.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect); @@ -745,7 +746,7 @@ void tst_qdeclarativeanimations::propertiesTransition() void tst_qdeclarativeanimations::pathTransition() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/pathTransition.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("pathTransition.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect); @@ -765,7 +766,7 @@ void tst_qdeclarativeanimations::pathTransition() void tst_qdeclarativeanimations::disabledTransition() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/disabledTransition.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("disabledTransition.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect); @@ -805,7 +806,7 @@ void tst_qdeclarativeanimations::attached() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/attached.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("attached.qml"))); QTest::ignoreMessage(QtDebugMsg, "off"); QTest::ignoreMessage(QtDebugMsg, "on"); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); @@ -817,7 +818,7 @@ void tst_qdeclarativeanimations::propertyValueSourceDefaultStart() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/valuesource.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("valuesource.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect); @@ -830,7 +831,7 @@ void tst_qdeclarativeanimations::propertyValueSourceDefaultStart() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/valuesource2.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("valuesource2.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect); @@ -843,7 +844,7 @@ void tst_qdeclarativeanimations::propertyValueSourceDefaultStart() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/dontAutoStart.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("dontAutoStart.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect); @@ -860,7 +861,7 @@ void tst_qdeclarativeanimations::dontStart() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/dontStart.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("dontStart.qml"))); QString warning = c.url().toString() + ":14:13: QML NumberAnimation: setRunning() cannot be used on non-root animation nodes."; QTest::ignoreMessage(QtWarningMsg, qPrintable(warning)); @@ -875,7 +876,7 @@ void tst_qdeclarativeanimations::dontStart() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/dontStart2.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("dontStart2.qml"))); QString warning = c.url().toString() + ":15:17: QML NumberAnimation: setRunning() cannot be used on non-root animation nodes."; QTest::ignoreMessage(QtWarningMsg, qPrintable(warning)); @@ -942,7 +943,7 @@ void tst_qdeclarativeanimations::easingProperties() void tst_qdeclarativeanimations::rotation() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/rotation.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("rotation.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect); @@ -973,7 +974,7 @@ void tst_qdeclarativeanimations::runningTrueBug() { //ensure we start correctly when "running: true" is explicitly set QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/runningTrueBug.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("runningTrueBug.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect); @@ -990,7 +991,7 @@ void tst_qdeclarativeanimations::nonTransitionBug() //in the case where an animation in the transition doesn't match anything (but previously did) QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, SRCDIR "/data/nonTransitionBug.qml"); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("nonTransitionBug.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect != 0); QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect); @@ -1016,7 +1017,7 @@ void tst_qdeclarativeanimations::registrationBug() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, SRCDIR "/data/registrationBug.qml"); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("registrationBug.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect != 0); QTRY_COMPARE(rect->property("value"), QVariant(int(100))); @@ -1026,7 +1027,7 @@ void tst_qdeclarativeanimations::doubleRegistrationBug() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, SRCDIR "/data/doubleRegistrationBug.qml"); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("doubleRegistrationBug.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect != 0); @@ -1064,7 +1065,7 @@ void tst_qdeclarativeanimations::transitionAssignmentBug() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, SRCDIR "/data/transitionAssignmentBug.qml"); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("transitionAssignmentBug.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect != 0); @@ -1076,7 +1077,7 @@ void tst_qdeclarativeanimations::pauseBindingBug() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, SRCDIR "/data/pauseBindingBug.qml"); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("pauseBindingBug.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect != 0); QDeclarativeAbstractAnimation *anim = rect->findChild<QDeclarativeAbstractAnimation*>("animation"); @@ -1090,7 +1091,7 @@ void tst_qdeclarativeanimations::pauseBug() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, SRCDIR "/data/pauseBug.qml"); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("pauseBug.qml"))); QDeclarativeAbstractAnimation *anim = qobject_cast<QDeclarativeAbstractAnimation*>(c.create()); QVERIFY(anim != 0); QCOMPARE(anim->qtAnimation()->state(), QAbstractAnimation::Paused); diff --git a/tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro b/tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro index 454b86ca53..0e7c73ab90 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro +++ b/tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro @@ -3,7 +3,9 @@ TARGET = tst_qdeclarativebehaviors SOURCES += tst_qdeclarativebehaviors.cpp macx:CONFIG -= app_bundle -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp index 693ccccec9..8eb29073c6 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp +++ b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp @@ -48,6 +48,7 @@ #include <private/qdeclarativebehavior_p.h> #include <private/qdeclarativeanimation_p.h> #include <private/qsgitem_p.h> +#include "../shared/util.h" #include "../../../shared/util.h" class tst_qdeclarativebehaviors : public QObject @@ -82,7 +83,7 @@ private slots: void tst_qdeclarativebehaviors::simpleBehavior() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/simple.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("simple.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QTRY_VERIFY(rect); QTRY_VERIFY(qobject_cast<QDeclarativeBehavior*>(rect->findChild<QDeclarativeBehavior*>("MyBehavior"))->animation()); @@ -98,7 +99,7 @@ void tst_qdeclarativebehaviors::simpleBehavior() void tst_qdeclarativebehaviors::scriptTriggered() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/scripttrigger.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("scripttrigger.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QTRY_VERIFY(rect); @@ -113,7 +114,7 @@ void tst_qdeclarativebehaviors::scriptTriggered() void tst_qdeclarativebehaviors::cppTriggered() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/cpptrigger.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("cpptrigger.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QTRY_VERIFY(rect); @@ -131,7 +132,7 @@ void tst_qdeclarativebehaviors::cppTriggered() void tst_qdeclarativebehaviors::loop() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/loop.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("loop.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QTRY_VERIFY(rect); @@ -144,7 +145,7 @@ void tst_qdeclarativebehaviors::loop() void tst_qdeclarativebehaviors::colorBehavior() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/color.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("color.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QTRY_VERIFY(rect); @@ -159,7 +160,7 @@ void tst_qdeclarativebehaviors::colorBehavior() void tst_qdeclarativebehaviors::parentBehavior() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/parent.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("parent.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QTRY_VERIFY(rect); @@ -173,7 +174,7 @@ void tst_qdeclarativebehaviors::parentBehavior() void tst_qdeclarativebehaviors::replaceBinding() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/binding.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("binding.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QTRY_VERIFY(rect); @@ -206,7 +207,7 @@ void tst_qdeclarativebehaviors::group() /* XXX TODO Create a test element for this case. { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/groupProperty.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("groupProperty.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); qDebug() << c.errorString(); QTRY_VERIFY(rect); @@ -223,7 +224,7 @@ void tst_qdeclarativebehaviors::group() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/groupProperty2.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("groupProperty2.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QTRY_VERIFY(rect); @@ -239,7 +240,7 @@ void tst_qdeclarativebehaviors::group() void tst_qdeclarativebehaviors::emptyBehavior() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/empty.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("empty.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect); @@ -253,7 +254,7 @@ void tst_qdeclarativebehaviors::emptyBehavior() void tst_qdeclarativebehaviors::explicitSelection() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/explicit.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("explicit.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect); @@ -268,7 +269,7 @@ void tst_qdeclarativebehaviors::explicitSelection() void tst_qdeclarativebehaviors::nonSelectingBehavior() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/nonSelecting2.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("nonSelecting2.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect); @@ -282,8 +283,8 @@ void tst_qdeclarativebehaviors::nonSelectingBehavior() void tst_qdeclarativebehaviors::reassignedAnimation() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/reassignedAnimation.qml")); - QString warning = QUrl::fromLocalFile(SRCDIR "/data/reassignedAnimation.qml").toString() + ":9:9: QML Behavior: Cannot change the animation assigned to a Behavior."; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("reassignedAnimation.qml"))); + QString warning = QUrl::fromLocalFile(TESTDATA("reassignedAnimation.qml")).toString() + ":9:9: QML Behavior: Cannot change the animation assigned to a Behavior."; QTest::ignoreMessage(QtWarningMsg, qPrintable(warning)); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect); @@ -296,7 +297,7 @@ void tst_qdeclarativebehaviors::reassignedAnimation() void tst_qdeclarativebehaviors::disabled() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/disabled.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("disabled.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect); QCOMPARE(rect->findChild<QDeclarativeBehavior*>("MyBehavior")->enabled(), false); @@ -312,7 +313,7 @@ void tst_qdeclarativebehaviors::dontStart() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/dontStart.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("dontStart.qml"))); QString warning = c.url().toString() + ":13:13: QML NumberAnimation: setRunning() cannot be used on non-root animation nodes."; QTest::ignoreMessage(QtWarningMsg, qPrintable(warning)); @@ -330,7 +331,7 @@ void tst_qdeclarativebehaviors::startup() { { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/startup.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("startup.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect); @@ -344,7 +345,7 @@ void tst_qdeclarativebehaviors::startup() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/startup2.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("startup2.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect); @@ -364,7 +365,7 @@ void tst_qdeclarativebehaviors::startup() void tst_qdeclarativebehaviors::groupedPropertyCrash() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/groupedPropertyCrash.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("groupedPropertyCrash.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect); //don't crash } @@ -373,7 +374,7 @@ void tst_qdeclarativebehaviors::groupedPropertyCrash() void tst_qdeclarativebehaviors::runningTrue() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/runningTrue.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("runningTrue.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect); @@ -389,7 +390,7 @@ void tst_qdeclarativebehaviors::runningTrue() void tst_qdeclarativebehaviors::sameValue() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/qtbug12295.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("qtbug12295.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect); @@ -420,7 +421,7 @@ void tst_qdeclarativebehaviors::delayedRegistration() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, SRCDIR "/data/delayedRegistration.qml"); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("delayedRegistration.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect != 0); diff --git a/tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro b/tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro index f2fd7ae1fa..d0bbfe6faa 100644 --- a/tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro +++ b/tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro @@ -4,7 +4,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativebinding.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp b/tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp index 1109e53c3e..92b3c2b72c 100644 --- a/tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp +++ b/tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp @@ -43,6 +43,7 @@ #include <QtDeclarative/qdeclarativecomponent.h> #include <private/qdeclarativebind_p.h> #include <private/qsgrectangle_p.h> +#include "../shared/util.h" #include "../../../shared/util.h" class tst_qdeclarativebinding : public QObject @@ -69,7 +70,7 @@ tst_qdeclarativebinding::tst_qdeclarativebinding() void tst_qdeclarativebinding::binding() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-binding.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("test-binding.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect != 0); @@ -97,7 +98,7 @@ void tst_qdeclarativebinding::binding() void tst_qdeclarativebinding::whenAfterValue() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-binding2.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("test-binding2.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect != 0); @@ -113,7 +114,7 @@ void tst_qdeclarativebinding::whenAfterValue() void tst_qdeclarativebinding::restoreBinding() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/restoreBinding.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("restoreBinding.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect != 0); @@ -143,7 +144,7 @@ void tst_qdeclarativebinding::restoreBinding() void tst_qdeclarativebinding::restoreBindingWithLoop() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/restoreBindingWithLoop.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("restoreBindingWithLoop.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect != 0); @@ -178,7 +179,7 @@ void tst_qdeclarativebinding::restoreBindingWithLoop() void tst_qdeclarativebinding::deletedObject() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/deletedObject.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("deletedObject.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect != 0); diff --git a/tests/auto/declarative/qdeclarativechangeset/qdeclarativechangeset.pro b/tests/auto/declarative/qdeclarativechangeset/qdeclarativechangeset.pro index f5ab4c6d70..b2f88b630b 100644 --- a/tests/auto/declarative/qdeclarativechangeset/qdeclarativechangeset.pro +++ b/tests/auto/declarative/qdeclarativechangeset/qdeclarativechangeset.pro @@ -4,8 +4,6 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativechangeset.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" - CONFIG += parallel_test QT += core-private gui-private declarative-private testlib diff --git a/tests/auto/declarative/qdeclarativecomponent/qdeclarativecomponent.pro b/tests/auto/declarative/qdeclarativecomponent/qdeclarativecomponent.pro index 156512efee..155d615721 100644 --- a/tests/auto/declarative/qdeclarativecomponent/qdeclarativecomponent.pro +++ b/tests/auto/declarative/qdeclarativecomponent/qdeclarativecomponent.pro @@ -4,7 +4,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativecomponent.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp b/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp index 89148812c5..78beee6f59 100644 --- a/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp +++ b/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp @@ -47,13 +47,9 @@ #include <QtDeclarative/qdeclarativeproperty.h> #include <QtDeclarative/qdeclarativeincubator.h> #include <qcolor.h> +#include "../shared/util.h" #include "../../../shared/util.h" -#ifdef Q_OS_SYMBIAN -// In Symbian OS test data is located in applications private dir -#define SRCDIR "." -#endif - class MyIC : public QObject, public QDeclarativeIncubationController { Q_OBJECT @@ -113,7 +109,7 @@ void tst_qdeclarativecomponent::loadEmptyUrl() void tst_qdeclarativecomponent::qmlIncubateObject() { - QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/incubateObject.qml")); + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("incubateObject.qml"))); QObject *object = component.create(); QVERIFY(object != 0); QCOMPARE(object->property("test1").toBool(), true); @@ -127,7 +123,7 @@ void tst_qdeclarativecomponent::qmlIncubateObject() void tst_qdeclarativecomponent::qmlCreateObject() { QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/createObject.qml")); + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("createObject.qml"))); QObject *object = component.create(); QVERIFY(object != 0); @@ -144,7 +140,7 @@ void tst_qdeclarativecomponent::qmlCreateObject() void tst_qdeclarativecomponent::qmlCreateObjectWithProperties() { QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/createObjectWithScript.qml")); + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("createObjectWithScript.qml"))); QVERIFY2(component.errorString().isEmpty(), component.errorString().toUtf8()); QObject *object = component.create(); QVERIFY(object != 0); diff --git a/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro b/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro index e2b814d5c1..ef3ef536f0 100644 --- a/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro +++ b/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro @@ -4,7 +4,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeconnection.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeconnection/tst_qdeclarativeconnection.cpp b/tests/auto/declarative/qdeclarativeconnection/tst_qdeclarativeconnection.cpp index fb0728c816..31c0db6eb2 100644 --- a/tests/auto/declarative/qdeclarativeconnection/tst_qdeclarativeconnection.cpp +++ b/tests/auto/declarative/qdeclarativeconnection/tst_qdeclarativeconnection.cpp @@ -43,6 +43,7 @@ #include <QtDeclarative/qdeclarativecomponent.h> #include <private/qdeclarativeconnections_p.h> #include <private/qsgitem_p.h> +#include "../shared/util.h" #include "../../../shared/util.h" #include <QtDeclarative/qdeclarativescriptstring.h> @@ -75,7 +76,7 @@ tst_qdeclarativeconnection::tst_qdeclarativeconnection() void tst_qdeclarativeconnection::defaultValues() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-connection3.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("test-connection3.qml"))); QDeclarativeConnections *item = qobject_cast<QDeclarativeConnections*>(c.create()); QVERIFY(item != 0); @@ -87,7 +88,7 @@ void tst_qdeclarativeconnection::defaultValues() void tst_qdeclarativeconnection::properties() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-connection2.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("test-connection2.qml"))); QDeclarativeConnections *item = qobject_cast<QDeclarativeConnections*>(c.create()); QVERIFY(item != 0); @@ -101,7 +102,7 @@ void tst_qdeclarativeconnection::properties() void tst_qdeclarativeconnection::connection() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-connection.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("test-connection.qml"))); QSGItem *item = qobject_cast<QSGItem*>(c.create()); QVERIFY(item != 0); @@ -118,7 +119,7 @@ void tst_qdeclarativeconnection::connection() void tst_qdeclarativeconnection::trimming() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/trimming.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("trimming.qml"))); QSGItem *item = qobject_cast<QSGItem*>(c.create()); QVERIFY(item != 0); @@ -139,7 +140,7 @@ void tst_qdeclarativeconnection::trimming() void tst_qdeclarativeconnection::targetChanged() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/connection-targetchange.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("connection-targetchange.qml"))); QSGItem *item = qobject_cast<QSGItem*>(c.create()); QVERIFY(item != 0); @@ -176,7 +177,7 @@ void tst_qdeclarativeconnection::unknownSignals() QFETCH(QString, file); QFETCH(QString, error); - QUrl url = QUrl::fromLocalFile(SRCDIR "/data/" + file); + QUrl url = QUrl::fromLocalFile(TESTDATA(file)); if (!error.isEmpty()) { QTest::ignoreMessage(QtWarningMsg, (url.toString() + error).toLatin1()); } else { @@ -214,7 +215,7 @@ void tst_qdeclarativeconnection::errors() QFETCH(QString, file); QFETCH(QString, error); - QUrl url = QUrl::fromLocalFile(SRCDIR "/data/" + file); + QUrl url = QUrl::fromLocalFile(TESTDATA(file)); QDeclarativeEngine engine; QDeclarativeComponent c(&engine, url); @@ -264,7 +265,7 @@ static QObject *module_api_factory(QDeclarativeEngine *engine, QJSEngine *script void tst_qdeclarativeconnection::moduleApiTarget() { qmlRegisterModuleApi("MyTestModuleApi", 1, 0, module_api_factory); - QDeclarativeComponent component(&engine, QUrl(SRCDIR "/data/moduleapi-target.qml")); + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("moduleapi-target.qml"))); QObject *object = component.create(); QVERIFY(object != 0); diff --git a/tests/auto/declarative/qdeclarativecontext/qdeclarativecontext.pro b/tests/auto/declarative/qdeclarativecontext/qdeclarativecontext.pro index 86bec2fabd..65af53a45d 100644 --- a/tests/auto/declarative/qdeclarativecontext/qdeclarativecontext.pro +++ b/tests/auto/declarative/qdeclarativecontext/qdeclarativecontext.pro @@ -3,8 +3,6 @@ TARGET = tst_qdeclarativecontext SOURCES += tst_qdeclarativecontext.cpp macx:CONFIG -= app_bundle -DEFINES += SRCDIR=\\\"$$PWD\\\" - CONFIG += parallel_test QT += core-private gui-private declarative-private testlib diff --git a/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro b/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro index 77254c0bb6..7fde5390bf 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro +++ b/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro @@ -12,7 +12,9 @@ INCLUDEPATH += ../shared # QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage # LIBS += -lgcov -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles CONFIG += parallel_test #temporary diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index d6a2f0a5bd..c30e9c5bd5 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -53,6 +53,7 @@ #include <private/qdeclarativevmemetaobject_p.h> #include "testtypes.h" #include "testhttpserver.h" +#include "../shared/util.h" #include "../../../shared/util.h" /* @@ -63,8 +64,7 @@ Static QML language issues are covered in qmllanguage */ inline QUrl TEST_FILE(const QString &filename) { - QFileInfo fileInfo(__FILE__); - return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath("data/" + filename)); + return QUrl::fromLocalFile(TESTDATA(filename)); } inline QUrl TEST_FILE(const char *filename) @@ -4380,7 +4380,7 @@ void tst_qdeclarativeecmascript::include() { TestHTTPServer server(8111); QVERIFY(server.isValid()); - server.serveDirectory(SRCDIR "/data"); + server.serveDirectory(TESTDATA("")); QDeclarativeComponent component(&engine, TEST_FILE("include_remote.qml")); QObject *o = component.create(); @@ -4408,7 +4408,7 @@ void tst_qdeclarativeecmascript::include() { TestHTTPServer server(8111); QVERIFY(server.isValid()); - server.serveDirectory(SRCDIR "/data"); + server.serveDirectory(TESTDATA("")); QDeclarativeComponent component(&engine, TEST_FILE("include_remote_missing.qml")); QObject *o = component.create(); diff --git a/tests/auto/declarative/qdeclarativeengine/qdeclarativeengine.pro b/tests/auto/declarative/qdeclarativeengine/qdeclarativeengine.pro index 6e65716637..547d56b3ad 100644 --- a/tests/auto/declarative/qdeclarativeengine/qdeclarativeengine.pro +++ b/tests/auto/declarative/qdeclarativeengine/qdeclarativeengine.pro @@ -4,8 +4,6 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeengine.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" - CONFIG += parallel_test QT += core-private gui-private declarative-private network testlib diff --git a/tests/auto/declarative/qdeclarativeexpression/qdeclarativeexpression.pro b/tests/auto/declarative/qdeclarativeexpression/qdeclarativeexpression.pro index b4a9394a7a..8807e7a2e2 100644 --- a/tests/auto/declarative/qdeclarativeexpression/qdeclarativeexpression.pro +++ b/tests/auto/declarative/qdeclarativeexpression/qdeclarativeexpression.pro @@ -4,7 +4,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeexpression.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeexpression/tst_qdeclarativeexpression.cpp b/tests/auto/declarative/qdeclarativeexpression/tst_qdeclarativeexpression.cpp index 200bf1ae09..a05c06f23f 100644 --- a/tests/auto/declarative/qdeclarativeexpression/tst_qdeclarativeexpression.cpp +++ b/tests/auto/declarative/qdeclarativeexpression/tst_qdeclarativeexpression.cpp @@ -44,6 +44,7 @@ #include <QtDeclarative/qdeclarativecomponent.h> #include <QtDeclarative/qdeclarativeexpression.h> #include <QtDeclarative/qdeclarativescriptstring.h> +#include "../shared/util.h" class tst_qdeclarativeexpression : public QObject { @@ -81,7 +82,7 @@ void tst_qdeclarativeexpression::scriptString() qmlRegisterType<TestObject>("Test", 1, 0, "TestObject"); QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/scriptString.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("scriptString.qml"))); TestObject *testObj = qobject_cast<TestObject*>(c.create()); QVERIFY(testObj != 0); diff --git a/tests/auto/declarative/qdeclarativefolderlistmodel/qdeclarativefolderlistmodel.pro b/tests/auto/declarative/qdeclarativefolderlistmodel/qdeclarativefolderlistmodel.pro index 38ce205670..b59d39f629 100644 --- a/tests/auto/declarative/qdeclarativefolderlistmodel/qdeclarativefolderlistmodel.pro +++ b/tests/auto/declarative/qdeclarativefolderlistmodel/qdeclarativefolderlistmodel.pro @@ -4,7 +4,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativefolderlistmodel.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles CONFIG += parallel_test QT += core-private gui-private declarative-private testlib diff --git a/tests/auto/declarative/qdeclarativefolderlistmodel/tst_qdeclarativefolderlistmodel.cpp b/tests/auto/declarative/qdeclarativefolderlistmodel/tst_qdeclarativefolderlistmodel.cpp index 045b77d0b8..f80928f4b8 100644 --- a/tests/auto/declarative/qdeclarativefolderlistmodel/tst_qdeclarativefolderlistmodel.cpp +++ b/tests/auto/declarative/qdeclarativefolderlistmodel/tst_qdeclarativefolderlistmodel.cpp @@ -47,6 +47,7 @@ #include <QtCore/qfile.h> #include <QtCore/qabstractitemmodel.h> #include <QDebug> +#include "../shared/util.h" // From qdeclarastivefolderlistmodel.h const int FileNameRole = Qt::UserRole+1; @@ -98,16 +99,16 @@ void tst_qdeclarativefolderlistmodel::checkNoErrors(const QDeclarativeComponent& void tst_qdeclarativefolderlistmodel::basicProperties() { - QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/basic.qml")); + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("basic.qml"))); checkNoErrors(component); QAbstractListModel *flm = qobject_cast<QAbstractListModel*>(component.create()); QVERIFY(flm != 0); - flm->setProperty("folder",QUrl::fromLocalFile(SRCDIR "/data")); + flm->setProperty("folder",QUrl::fromLocalFile(TESTDATA(""))); QTRY_COMPARE(flm->property("count").toInt(),4); // wait for refresh - QCOMPARE(flm->property("folder").toUrl(), QUrl::fromLocalFile(SRCDIR "/data")); - QCOMPARE(flm->property("parentFolder").toUrl(), QUrl::fromLocalFile(SRCDIR)); + QCOMPARE(flm->property("folder").toUrl(), QUrl::fromLocalFile(TESTDATA(""))); + QCOMPARE(flm->property("parentFolder").toUrl(), QUrl::fromLocalFile(QDir(TESTDATA("..")).canonicalPath())); QCOMPARE(flm->property("sortField").toInt(), int(Name)); QCOMPARE(flm->property("nameFilters").toStringList(), QStringList() << "*.qml"); QCOMPARE(flm->property("sortReversed").toBool(), false); @@ -124,7 +125,7 @@ void tst_qdeclarativefolderlistmodel::basicProperties() void tst_qdeclarativefolderlistmodel::resetFiltering() { // see QTBUG-17837 - QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/resetFiltering.qml")); + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("resetFiltering.qml"))); checkNoErrors(component); QAbstractListModel *flm = qobject_cast<QAbstractListModel*>(component.create()); @@ -133,19 +134,19 @@ void tst_qdeclarativefolderlistmodel::resetFiltering() connect(flm, SIGNAL(rowsRemoved(const QModelIndex&,int,int)), this, SLOT(removed(const QModelIndex&,int,int))); - flm->setProperty("folder",QUrl::fromLocalFile(SRCDIR "/data/resetfiltering")); + flm->setProperty("folder",QUrl::fromLocalFile(TESTDATA("resetfiltering"))); QTRY_COMPARE(flm->property("count").toInt(),1); // should just be "test.txt" visible int count = flm->rowCount(); QCOMPARE(removeStart, 0); QCOMPARE(removeEnd, count-1); - flm->setProperty("folder",QUrl::fromLocalFile(SRCDIR "/data/resetfiltering/innerdir")); + flm->setProperty("folder",QUrl::fromLocalFile(TESTDATA("resetfiltering/innerdir"))); QTRY_COMPARE(flm->property("count").toInt(),1); // should just be "test2.txt" visible count = flm->rowCount(); QCOMPARE(removeStart, 0); QCOMPARE(removeEnd, count-1); - flm->setProperty("folder",QUrl::fromLocalFile(SRCDIR "/data/resetfiltering")); + flm->setProperty("folder",QUrl::fromLocalFile(TESTDATA("resetfiltering"))); QTRY_COMPARE(flm->property("count").toInt(),1); // should just be "test.txt" visible count = flm->rowCount(); QCOMPARE(removeStart, 0); @@ -154,13 +155,13 @@ void tst_qdeclarativefolderlistmodel::resetFiltering() void tst_qdeclarativefolderlistmodel::refresh() { - QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/basic.qml")); + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("basic.qml"))); checkNoErrors(component); QAbstractListModel *flm = qobject_cast<QAbstractListModel*>(component.create()); QVERIFY(flm != 0); - flm->setProperty("folder",QUrl::fromLocalFile(SRCDIR "/data")); + flm->setProperty("folder",QUrl::fromLocalFile(TESTDATA(""))); QTRY_COMPARE(flm->property("count").toInt(),4); // wait for refresh int count = flm->rowCount(); diff --git a/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro b/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro index c0cf19a994..3efde621b2 100644 --- a/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro +++ b/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro @@ -5,7 +5,9 @@ macx:CONFIG -= app_bundle HEADERS += ../../declarative/shared/testhttpserver.h SOURCES += tst_qdeclarativefontloader.cpp ../../declarative/shared/testhttpserver.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp b/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp index 6d17c970b8..cd67f14667 100644 --- a/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp +++ b/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp @@ -44,6 +44,7 @@ #include <QtDeclarative/qdeclarativecomponent.h> #include <QtDeclarative/qdeclarativecontext.h> #include <QtDeclarative/private/qdeclarativefontloader_p.h> +#include "../shared/util.h" #include "../../../shared/util.h" #include "../../declarative/shared/testhttpserver.h" @@ -74,7 +75,7 @@ private: tst_qdeclarativefontloader::tst_qdeclarativefontloader() : server(SERVER_PORT) { - server.serveDirectory(SRCDIR "/data"); + server.serveDirectory(TESTDATA("")); } void tst_qdeclarativefontloader::init() @@ -112,7 +113,7 @@ void tst_qdeclarativefontloader::namedFont() void tst_qdeclarativefontloader::localFont() { - QString componentStr = "import QtQuick 2.0\nFontLoader { source: \"" SRCDIR "/data/tarzeau_ocr_a.ttf\" }"; + QString componentStr = "import QtQuick 2.0\nFontLoader { source: \"" + TESTDATA("tarzeau_ocr_a.ttf") + "\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeFontLoader *fontObject = qobject_cast<QDeclarativeFontLoader*>(component.create()); @@ -125,8 +126,8 @@ void tst_qdeclarativefontloader::localFont() void tst_qdeclarativefontloader::failLocalFont() { - QString componentStr = "import QtQuick 2.0\nFontLoader { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/dummy.ttf").toString() + "\" }"; - QTest::ignoreMessage(QtWarningMsg, QString("file::2:1: QML FontLoader: Cannot load font: \"" + QUrl::fromLocalFile(SRCDIR "/data/dummy.ttf").toString() + "\"").toUtf8().constData()); + QString componentStr = "import QtQuick 2.0\nFontLoader { source: \"" + QUrl::fromLocalFile(TESTDATA("dummy.ttf")).toString() + "\" }"; + QTest::ignoreMessage(QtWarningMsg, QString("file::2:1: QML FontLoader: Cannot load font: \"" + QUrl::fromLocalFile(TESTDATA("dummy.ttf")).toString() + "\"").toUtf8().constData()); QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeFontLoader *fontObject = qobject_cast<QDeclarativeFontLoader*>(component.create()); @@ -185,7 +186,7 @@ void tst_qdeclarativefontloader::changeFont() { QString componentStr = "import QtQuick 2.0\nFontLoader { source: font }"; QDeclarativeContext *ctxt = engine.rootContext(); - ctxt->setContextProperty("font", QUrl::fromLocalFile(SRCDIR "/data/tarzeau_ocr_a.ttf")); + ctxt->setContextProperty("font", QUrl::fromLocalFile(TESTDATA("tarzeau_ocr_a.ttf"))); QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeFontLoader *fontObject = qobject_cast<QDeclarativeFontLoader*>(component.create()); @@ -207,7 +208,7 @@ void tst_qdeclarativefontloader::changeFont() QCOMPARE(statusSpy.count(), 2); QTRY_COMPARE(fontObject->name(), QString("Daniel")); - ctxt->setContextProperty("font", QUrl::fromLocalFile(SRCDIR "/data/tarzeau_ocr_a.ttf")); + ctxt->setContextProperty("font", QUrl::fromLocalFile(TESTDATA("tarzeau_ocr_a.ttf"))); QTRY_VERIFY(fontObject->status() == QDeclarativeFontLoader::Ready); QCOMPARE(nameSpy.count(), 2); QCOMPARE(statusSpy.count(), 2); diff --git a/tests/auto/declarative/qdeclarativeimageprovider/qdeclarativeimageprovider.pro b/tests/auto/declarative/qdeclarativeimageprovider/qdeclarativeimageprovider.pro index 8c13e1ca9e..dda2595956 100644 --- a/tests/auto/declarative/qdeclarativeimageprovider/qdeclarativeimageprovider.pro +++ b/tests/auto/declarative/qdeclarativeimageprovider/qdeclarativeimageprovider.pro @@ -4,11 +4,6 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeimageprovider.cpp -# QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage -# LIBS += -lgcov - -DEFINES += SRCDIR=\\\"$$PWD\\\" - CONFIG += parallel_test QT += core-private gui-private declarative-private network testlib diff --git a/tests/auto/declarative/qdeclarativeincubator/qdeclarativeincubator.pro b/tests/auto/declarative/qdeclarativeincubator/qdeclarativeincubator.pro index a95c8c4226..11725b40bc 100644 --- a/tests/auto/declarative/qdeclarativeincubator/qdeclarativeincubator.pro +++ b/tests/auto/declarative/qdeclarativeincubator/qdeclarativeincubator.pro @@ -6,7 +6,9 @@ SOURCES += tst_qdeclarativeincubator.cpp \ testtypes.cpp HEADERS += testtypes.h -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeincubator/tst_qdeclarativeincubator.cpp b/tests/auto/declarative/qdeclarativeincubator/tst_qdeclarativeincubator.cpp index 7e27146609..224426e2ec 100644 --- a/tests/auto/declarative/qdeclarativeincubator/tst_qdeclarativeincubator.cpp +++ b/tests/auto/declarative/qdeclarativeincubator/tst_qdeclarativeincubator.cpp @@ -50,11 +50,11 @@ #include <QDeclarativeProperty> #include <QDeclarativeComponent> #include <QDeclarativeIncubator> +#include "../shared/util.h" inline QUrl TEST_FILE(const QString &filename) { - QFileInfo fileInfo(__FILE__); - return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath("data/" + filename)); + return QUrl::fromLocalFile(TESTDATA(filename)); } inline QUrl TEST_FILE(const char *filename) @@ -95,7 +95,7 @@ private: QVERIFY(!component.isError()); \ QVERIFY(component.errors().isEmpty()); \ } else { \ - QFile file(QLatin1String(SRCDIR) + QLatin1String("/data/") + QLatin1String(errorfile)); \ + QFile file(TESTDATA(errorfile)); \ QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text)); \ QByteArray data = file.readAll(); \ file.close(); \ diff --git a/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro b/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro index 2ae2ca09d6..bd8d963f3f 100644 --- a/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro +++ b/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro @@ -4,7 +4,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeinfo.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles CONFIG += parallel_test QT += core-private gui-private declarative-private widgets testlib diff --git a/tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp b/tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp index 960b042b95..ec04a83102 100644 --- a/tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp +++ b/tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp @@ -45,6 +45,7 @@ #include <QTimer> #include <QDeclarativeContext> #include <qdeclarativeinfo.h> +#include "../shared/util.h" class tst_qdeclarativeinfo : public QObject { @@ -68,7 +69,7 @@ private: inline QUrl TEST_FILE(const QString &filename) { - return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename); + return QUrl::fromLocalFile(TESTDATA(filename)); } void tst_qdeclarativeinfo::qmlObject() diff --git a/tests/auto/declarative/qdeclarativeinstruction/qdeclarativeinstruction.pro b/tests/auto/declarative/qdeclarativeinstruction/qdeclarativeinstruction.pro index 771f27cd3f..437b0869d1 100644 --- a/tests/auto/declarative/qdeclarativeinstruction/qdeclarativeinstruction.pro +++ b/tests/auto/declarative/qdeclarativeinstruction/qdeclarativeinstruction.pro @@ -3,8 +3,6 @@ TARGET = tst_qdeclarativeinstruction SOURCES += tst_qdeclarativeinstruction.cpp macx:CONFIG -= app_bundle -DEFINES += SRCDIR=\\\"$$PWD\\\" - CONFIG += parallel_test QT += core-private gui-private v8-private declarative-private testlib diff --git a/tests/auto/declarative/qdeclarativelistcompositor/qdeclarativelistcompositor.pro b/tests/auto/declarative/qdeclarativelistcompositor/qdeclarativelistcompositor.pro index e3e83d184e..e8dd7dd83a 100644 --- a/tests/auto/declarative/qdeclarativelistcompositor/qdeclarativelistcompositor.pro +++ b/tests/auto/declarative/qdeclarativelistcompositor/qdeclarativelistcompositor.pro @@ -4,14 +4,6 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativelistcompositor.cpp -symbian: { - importFiles.files = data - importFiles.path = . - DEPLOYMENT += importFiles -} else { - DEFINES += SRCDIR=\\\"$$PWD\\\" -} - CONFIG += parallel_test QT += core-private gui-private declarative-private testlib diff --git a/tests/auto/declarative/qdeclarativelistreference/qdeclarativelistreference.pro b/tests/auto/declarative/qdeclarativelistreference/qdeclarativelistreference.pro index 683ea7bf5e..5020c02f43 100644 --- a/tests/auto/declarative/qdeclarativelistreference/qdeclarativelistreference.pro +++ b/tests/auto/declarative/qdeclarativelistreference/qdeclarativelistreference.pro @@ -4,6 +4,10 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativelistreference.cpp +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles + CONFIG += parallel_test QT += core-private gui-private declarative-private testlib diff --git a/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp b/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp index f60c5c4be0..a86e66de45 100644 --- a/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp +++ b/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp @@ -49,11 +49,11 @@ #include <QtDeclarative/qdeclarativeprivate.h> #include <QtDeclarative/qdeclarativeproperty.h> #include <QDebug> +#include "../shared/util.h" inline QUrl TEST_FILE(const QString &filename) { - QFileInfo fileInfo(__FILE__); - return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath("data/" + filename)); + return QUrl::fromLocalFile(TESTDATA(filename)); } inline QUrl TEST_FILE(const char *filename) diff --git a/tests/auto/declarative/qdeclarativemetatype/qdeclarativemetatype.pro b/tests/auto/declarative/qdeclarativemetatype/qdeclarativemetatype.pro index 2889c191f4..8261f6d930 100644 --- a/tests/auto/declarative/qdeclarativemetatype/qdeclarativemetatype.pro +++ b/tests/auto/declarative/qdeclarativemetatype/qdeclarativemetatype.pro @@ -3,7 +3,5 @@ TARGET = tst_qdeclarativemetatype SOURCES += tst_qdeclarativemetatype.cpp macx:CONFIG -= app_bundle -DEFINES += SRCDIR=\\\"$$PWD\\\" - CONFIG += parallel_test QT += core-private gui-private declarative-private widgets testlib diff --git a/tests/auto/declarative/qdeclarativepath/qdeclarativepath.pro b/tests/auto/declarative/qdeclarativepath/qdeclarativepath.pro index 4c2e3a8466..212117165d 100644 --- a/tests/auto/declarative/qdeclarativepath/qdeclarativepath.pro +++ b/tests/auto/declarative/qdeclarativepath/qdeclarativepath.pro @@ -4,7 +4,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativepath.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativepath/tst_qdeclarativepath.cpp b/tests/auto/declarative/qdeclarativepath/tst_qdeclarativepath.cpp index 97bffcbefa..c390b7b672 100644 --- a/tests/auto/declarative/qdeclarativepath/tst_qdeclarativepath.cpp +++ b/tests/auto/declarative/qdeclarativepath/tst_qdeclarativepath.cpp @@ -44,6 +44,7 @@ #include <QtDeclarative/qdeclarativecomponent.h> #include <QtDeclarative/private/qdeclarativepath_p.h> +#include "../shared/util.h" #include "../../../shared/util.h" class tst_QDeclarativePath : public QObject @@ -61,7 +62,7 @@ private slots: void tst_QDeclarativePath::arc() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/arc.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("arc.qml"))); QDeclarativePath *obj = qobject_cast<QDeclarativePath*>(c.create()); QVERIFY(obj != 0); @@ -96,7 +97,7 @@ void tst_QDeclarativePath::arc() void tst_QDeclarativePath::catmullromCurve() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/curve.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("curve.qml"))); QDeclarativePath *obj = qobject_cast<QDeclarativePath*>(c.create()); QVERIFY(obj != 0); @@ -131,7 +132,7 @@ void tst_QDeclarativePath::catmullromCurve() void tst_QDeclarativePath::svg() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/svg.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("svg.qml"))); QDeclarativePath *obj = qobject_cast<QDeclarativePath*>(c.create()); QVERIFY(obj != 0); diff --git a/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro b/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro index a12c057d2f..310fa94214 100644 --- a/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro +++ b/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro @@ -4,7 +4,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeproperty.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp b/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp index bc4053512e..411eeeacc7 100644 --- a/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp +++ b/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp @@ -47,11 +47,11 @@ #include <QtWidgets/QLineEdit> #include <QtCore/qfileinfo.h> #include <QtCore/qdir.h> +#include "../shared/util.h" inline QUrl TEST_FILE(const QString &filename) { - QFileInfo fileInfo(__FILE__); - return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath(QLatin1String("data/") + filename)); + return QUrl::fromLocalFile(TESTDATA(filename)); } class MyQmlObject : public QObject diff --git a/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro b/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro index 1b8bf3f790..18fb8b2027 100644 --- a/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro +++ b/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro @@ -3,10 +3,9 @@ TARGET = tst_qdeclarativeqt SOURCES += tst_qdeclarativeqt.cpp macx:CONFIG -= app_bundle -DEFINES += SRCDIR=\\\"$$PWD\\\" - -# QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage -# LIBS += -lgcov +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp index 9359030ff8..dbf5373599 100644 --- a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp +++ b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp @@ -52,6 +52,7 @@ #include <QCryptographicHash> #include <QSGItem> #include <QSignalSpy> +#include "../shared/util.h" class tst_qdeclarativeqt : public QObject { @@ -95,7 +96,7 @@ private: inline QUrl TEST_FILE(const QString &filename) { - return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename); + return QUrl::fromLocalFile(TESTDATA(filename)); } void tst_qdeclarativeqt::enums() diff --git a/tests/auto/declarative/qdeclarativescriptdebugging/qdeclarativescriptdebugging.pro b/tests/auto/declarative/qdeclarativescriptdebugging/qdeclarativescriptdebugging.pro index 14891a6751..9e2657ec33 100644 --- a/tests/auto/declarative/qdeclarativescriptdebugging/qdeclarativescriptdebugging.pro +++ b/tests/auto/declarative/qdeclarativescriptdebugging/qdeclarativescriptdebugging.pro @@ -5,10 +5,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativescriptdebugging.cpp INCLUDEPATH += ../shared -# QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage -# LIBS += -lgcov - -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativescriptdebugging/tst_qdeclarativescriptdebugging.cpp b/tests/auto/declarative/qdeclarativescriptdebugging/tst_qdeclarativescriptdebugging.cpp index 4301174184..2b65f119d9 100644 --- a/tests/auto/declarative/qdeclarativescriptdebugging/tst_qdeclarativescriptdebugging.cpp +++ b/tests/auto/declarative/qdeclarativescriptdebugging/tst_qdeclarativescriptdebugging.cpp @@ -46,6 +46,7 @@ #include <QtCore/QDir> #include <QtScript/QScriptEngineAgent> #include <private/qdeclarativeengine_p.h> +#include "../shared/util.h" class MyTestObject : public QObject { Q_OBJECT @@ -91,8 +92,7 @@ Static QML language issues are covered in qmllanguage */ inline QUrl TEST_FILE(const QString &filename) { - QFileInfo fileInfo(__FILE__); - return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath("data/" + filename)); + return QUrl::fromLocalFile(TESTDATA(filename)); } inline QUrl TEST_FILE(const char *filename) diff --git a/tests/auto/declarative/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro b/tests/auto/declarative/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro index f6d2c6aab3..05d31be39d 100644 --- a/tests/auto/declarative/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro +++ b/tests/auto/declarative/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro @@ -4,7 +4,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativesmoothedanimation.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativesmoothedanimation/tst_qdeclarativesmoothedanimation.cpp b/tests/auto/declarative/qdeclarativesmoothedanimation/tst_qdeclarativesmoothedanimation.cpp index 6c851f0304..17a4f0e071 100644 --- a/tests/auto/declarative/qdeclarativesmoothedanimation/tst_qdeclarativesmoothedanimation.cpp +++ b/tests/auto/declarative/qdeclarativesmoothedanimation/tst_qdeclarativesmoothedanimation.cpp @@ -44,6 +44,7 @@ #include <private/qdeclarativesmoothedanimation_p.h> #include <private/qsgrectangle_p.h> #include <private/qdeclarativevaluetype_p.h> +#include "../shared/util.h" #include "../../../shared/util.h" class tst_qdeclarativesmoothedanimation : public QObject @@ -71,7 +72,7 @@ tst_qdeclarativesmoothedanimation::tst_qdeclarativesmoothedanimation() void tst_qdeclarativesmoothedanimation::defaultValues() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/smoothedanimation1.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("smoothedanimation1.qml"))); QDeclarativeSmoothedAnimation *obj = qobject_cast<QDeclarativeSmoothedAnimation*>(c.create()); QVERIFY(obj != 0); @@ -88,7 +89,7 @@ void tst_qdeclarativesmoothedanimation::defaultValues() void tst_qdeclarativesmoothedanimation::values() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/smoothedanimation2.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("smoothedanimation2.qml"))); QDeclarativeSmoothedAnimation *obj = qobject_cast<QDeclarativeSmoothedAnimation*>(c.create()); QVERIFY(obj != 0); @@ -105,7 +106,7 @@ void tst_qdeclarativesmoothedanimation::values() void tst_qdeclarativesmoothedanimation::disabled() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/smoothedanimation3.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("smoothedanimation3.qml"))); QDeclarativeSmoothedAnimation *obj = qobject_cast<QDeclarativeSmoothedAnimation*>(c.create()); QVERIFY(obj != 0); @@ -148,7 +149,7 @@ void tst_qdeclarativesmoothedanimation::valueSource() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/smoothedanimationValueSource.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("smoothedanimationValueSource.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect); @@ -180,7 +181,7 @@ void tst_qdeclarativesmoothedanimation::behavior() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/smoothedanimationBehavior.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("smoothedanimationBehavior.qml"))); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect); diff --git a/tests/auto/declarative/qdeclarativespringanimation/qdeclarativespringanimation.pro b/tests/auto/declarative/qdeclarativespringanimation/qdeclarativespringanimation.pro index 63087660d1..7153327829 100644 --- a/tests/auto/declarative/qdeclarativespringanimation/qdeclarativespringanimation.pro +++ b/tests/auto/declarative/qdeclarativespringanimation/qdeclarativespringanimation.pro @@ -4,7 +4,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativespringanimation.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativespringanimation/tst_qdeclarativespringanimation.cpp b/tests/auto/declarative/qdeclarativespringanimation/tst_qdeclarativespringanimation.cpp index 03d6ca44bb..2432509bd2 100644 --- a/tests/auto/declarative/qdeclarativespringanimation/tst_qdeclarativespringanimation.cpp +++ b/tests/auto/declarative/qdeclarativespringanimation/tst_qdeclarativespringanimation.cpp @@ -43,6 +43,7 @@ #include <QtDeclarative/qdeclarativecomponent.h> #include <private/qdeclarativespringanimation_p.h> #include <private/qdeclarativevaluetype_p.h> +#include "../shared/util.h" #include "../../../shared/util.h" class tst_qdeclarativespringanimation : public QObject @@ -67,7 +68,7 @@ tst_qdeclarativespringanimation::tst_qdeclarativespringanimation() void tst_qdeclarativespringanimation::defaultValues() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/springanimation1.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("springanimation1.qml"))); QDeclarativeSpringAnimation *obj = qobject_cast<QDeclarativeSpringAnimation*>(c.create()); QVERIFY(obj != 0); @@ -87,7 +88,7 @@ void tst_qdeclarativespringanimation::defaultValues() void tst_qdeclarativespringanimation::values() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/springanimation2.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("springanimation2.qml"))); QDeclarativeSpringAnimation *obj = qobject_cast<QDeclarativeSpringAnimation*>(c.create()); QVERIFY(obj != 0); @@ -109,7 +110,7 @@ void tst_qdeclarativespringanimation::values() void tst_qdeclarativespringanimation::disabled() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/springanimation3.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("springanimation3.qml"))); QDeclarativeSpringAnimation *obj = qobject_cast<QDeclarativeSpringAnimation*>(c.create()); QVERIFY(obj != 0); diff --git a/tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro b/tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro index d98d7d367d..c0ffda7828 100644 --- a/tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro +++ b/tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro @@ -4,7 +4,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativestates.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles CONFIG += parallel_test QT += core-private gui-private v8-private declarative-private opengl-private testlib diff --git a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp index 39dac6f50e..cbf4814725 100644 --- a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp +++ b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp @@ -50,6 +50,7 @@ #include <private/qdeclarativestategroup_p.h> #include <private/qsgitem_p.h> #include <private/qdeclarativeproperty_p.h> +#include "../shared/util.h" #include "../../../shared/util.h" class MyAttached : public QObject @@ -154,7 +155,7 @@ void tst_qdeclarativestates::initTestCase() QByteArray tst_qdeclarativestates::fullDataPath(const QString &path) { - return QUrl::fromLocalFile(SRCDIR + path).toString().toUtf8(); + return QUrl::fromLocalFile(TESTDATA(path)).toString().toUtf8(); } void tst_qdeclarativestates::basicChanges() @@ -162,7 +163,7 @@ void tst_qdeclarativestates::basicChanges() QDeclarativeEngine engine; { - QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicChanges.qml"); + QDeclarativeComponent rectComponent(&engine, TESTDATA("basicChanges.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create()); QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect); QVERIFY(rect != 0); @@ -177,7 +178,7 @@ void tst_qdeclarativestates::basicChanges() } { - QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicChanges2.qml"); + QDeclarativeComponent rectComponent(&engine, TESTDATA("basicChanges2.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create()); QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect); QVERIFY(rect != 0); @@ -198,7 +199,7 @@ void tst_qdeclarativestates::basicChanges() } { - QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicChanges3.qml"); + QDeclarativeComponent rectComponent(&engine, TESTDATA("basicChanges3.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create()); QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect); QVERIFY(rect != 0); @@ -234,7 +235,7 @@ void tst_qdeclarativestates::basicChanges() // signal using 'onPropertyWithNotifyChanged' even though the signal name is // actually 'oddlyNamedNotifySignal' - QDeclarativeComponent component(&engine, SRCDIR "/data/basicChanges4.qml"); + QDeclarativeComponent component(&engine, TESTDATA("basicChanges4.qml")); QVERIFY(component.isReady()); MyRect *rect = qobject_cast<MyRect*>(component.create()); @@ -256,7 +257,7 @@ void tst_qdeclarativestates::attachedPropertyChanges() { QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, SRCDIR "/data/attachedPropertyChanges.qml"); + QDeclarativeComponent component(&engine, TESTDATA("attachedPropertyChanges.qml")); QVERIFY(component.isReady()); QSGItem *item = qobject_cast<QSGItem*>(component.create()); @@ -278,7 +279,7 @@ void tst_qdeclarativestates::basicExtension() QDeclarativeEngine engine; { - QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicExtension.qml"); + QDeclarativeComponent rectComponent(&engine, TESTDATA("basicExtension.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create()); QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect); QVERIFY(rect != 0); @@ -312,7 +313,7 @@ void tst_qdeclarativestates::basicExtension() } { - QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/fakeExtension.qml"); + QDeclarativeComponent rectComponent(&engine, TESTDATA("fakeExtension.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create()); QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect); QVERIFY(rect != 0); @@ -344,7 +345,7 @@ void tst_qdeclarativestates::basicBinding() QDeclarativeEngine engine; { - QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicBinding.qml"); + QDeclarativeComponent rectComponent(&engine, TESTDATA("basicBinding.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create()); QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect); QVERIFY(rect != 0); @@ -372,7 +373,7 @@ void tst_qdeclarativestates::basicBinding() } { - QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicBinding2.qml"); + QDeclarativeComponent rectComponent(&engine, TESTDATA("basicBinding2.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create()); QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect); QVERIFY(rect != 0); @@ -403,7 +404,7 @@ void tst_qdeclarativestates::basicBinding() } { - QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicBinding3.qml"); + QDeclarativeComponent rectComponent(&engine, TESTDATA("basicBinding3.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create()); QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect); QVERIFY(rect != 0); @@ -428,7 +429,7 @@ void tst_qdeclarativestates::basicBinding() } { - QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicBinding4.qml"); + QDeclarativeComponent rectComponent(&engine, TESTDATA("basicBinding4.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create()); QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect); QVERIFY(rect != 0); @@ -461,7 +462,7 @@ void tst_qdeclarativestates::signalOverride() QDeclarativeEngine engine; { - QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/signalOverride.qml"); + QDeclarativeComponent rectComponent(&engine, TESTDATA("signalOverride.qml")); MyRect *rect = qobject_cast<MyRect*>(rectComponent.create()); QVERIFY(rect != 0); @@ -475,7 +476,7 @@ void tst_qdeclarativestates::signalOverride() } { - QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/signalOverride2.qml"); + QDeclarativeComponent rectComponent(&engine, TESTDATA("signalOverride2.qml")); MyRect *rect = qobject_cast<MyRect*>(rectComponent.create()); QVERIFY(rect != 0); @@ -496,7 +497,7 @@ void tst_qdeclarativestates::signalOverrideCrash() { QDeclarativeEngine engine; - QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/signalOverrideCrash.qml"); + QDeclarativeComponent rectComponent(&engine, TESTDATA("signalOverrideCrash.qml")); MyRect *rect = qobject_cast<MyRect*>(rectComponent.create()); QVERIFY(rect != 0); @@ -508,7 +509,7 @@ void tst_qdeclarativestates::signalOverrideCrash2() { QDeclarativeEngine engine; - QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/signalOverrideCrash2.qml"); + QDeclarativeComponent rectComponent(&engine, TESTDATA("signalOverrideCrash2.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create()); QVERIFY(rect != 0); @@ -524,7 +525,7 @@ void tst_qdeclarativestates::parentChange() QDeclarativeEngine engine; { - QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/parentChange1.qml"); + QDeclarativeComponent rectComponent(&engine, TESTDATA("parentChange1.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create()); QVERIFY(rect != 0); @@ -551,7 +552,7 @@ void tst_qdeclarativestates::parentChange() } { - QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/parentChange2.qml"); + QDeclarativeComponent rectComponent(&engine, TESTDATA("parentChange2.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create()); QVERIFY(rect != 0); QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect); @@ -566,7 +567,7 @@ void tst_qdeclarativestates::parentChange() } { - QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/parentChange3.qml"); + QDeclarativeComponent rectComponent(&engine, TESTDATA("parentChange3.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create()); QVERIFY(rect != 0); QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect); @@ -588,7 +589,7 @@ void tst_qdeclarativestates::parentChange() } { - QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/parentChange6.qml"); + QDeclarativeComponent rectComponent(&engine, TESTDATA("parentChange6.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create()); QVERIFY(rect != 0); @@ -608,14 +609,14 @@ void tst_qdeclarativestates::parentChangeErrors() QDeclarativeEngine engine; { - QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/parentChange4.qml"); + QDeclarativeComponent rectComponent(&engine, TESTDATA("parentChange4.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create()); QVERIFY(rect != 0); QSGRectangle *innerRect = qobject_cast<QSGRectangle*>(rect->findChild<QSGRectangle*>("MyRect")); QVERIFY(innerRect != 0); - QTest::ignoreMessage(QtWarningMsg, fullDataPath("/data/parentChange4.qml") + ":25:9: QML ParentChange: Unable to preserve appearance under non-uniform scale"); + QTest::ignoreMessage(QtWarningMsg, fullDataPath("parentChange4.qml") + ":25:9: QML ParentChange: Unable to preserve appearance under non-uniform scale"); QSGItemPrivate::get(rect)->setState("reparented"); QCOMPARE(innerRect->rotation(), qreal(0)); QCOMPARE(innerRect->scale(), qreal(1)); @@ -624,14 +625,14 @@ void tst_qdeclarativestates::parentChangeErrors() } { - QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/parentChange5.qml"); + QDeclarativeComponent rectComponent(&engine, TESTDATA("parentChange5.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create()); QVERIFY(rect != 0); QSGRectangle *innerRect = qobject_cast<QSGRectangle*>(rect->findChild<QSGRectangle*>("MyRect")); QVERIFY(innerRect != 0); - QTest::ignoreMessage(QtWarningMsg, fullDataPath("/data/parentChange5.qml") + ":25:9: QML ParentChange: Unable to preserve appearance under complex transform"); + QTest::ignoreMessage(QtWarningMsg, fullDataPath("parentChange5.qml") + ":25:9: QML ParentChange: Unable to preserve appearance under complex transform"); QSGItemPrivate::get(rect)->setState("reparented"); QCOMPARE(innerRect->rotation(), qreal(0)); QCOMPARE(innerRect->scale(), qreal(1)); @@ -644,7 +645,7 @@ void tst_qdeclarativestates::anchorChanges() { QDeclarativeEngine engine; - QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorChanges1.qml"); + QDeclarativeComponent rectComponent(&engine, TESTDATA("anchorChanges1.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create()); QVERIFY(rect != 0); QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect); @@ -677,7 +678,7 @@ void tst_qdeclarativestates::anchorChanges2() { QDeclarativeEngine engine; - QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorChanges2.qml"); + QDeclarativeComponent rectComponent(&engine, TESTDATA("anchorChanges2.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create()); QVERIFY(rect != 0); QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect); @@ -698,7 +699,7 @@ void tst_qdeclarativestates::anchorChanges3() { QDeclarativeEngine engine; - QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorChanges3.qml"); + QDeclarativeComponent rectComponent(&engine, TESTDATA("anchorChanges3.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create()); QVERIFY(rect != 0); QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect); @@ -749,7 +750,7 @@ void tst_qdeclarativestates::anchorChanges4() { QDeclarativeEngine engine; - QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorChanges4.qml"); + QDeclarativeComponent rectComponent(&engine, TESTDATA("anchorChanges4.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create()); QVERIFY(rect != 0); @@ -784,7 +785,7 @@ void tst_qdeclarativestates::anchorChanges5() { QDeclarativeEngine engine; - QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorChanges5.qml"); + QDeclarativeComponent rectComponent(&engine, TESTDATA("anchorChanges5.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create()); QVERIFY(rect != 0); @@ -828,7 +829,7 @@ void tst_qdeclarativestates::anchorChangesRTL() { QDeclarativeEngine engine; - QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorChanges1.qml"); + QDeclarativeComponent rectComponent(&engine, TESTDATA("anchorChanges1.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create()); QVERIFY(rect != 0); QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect); @@ -862,7 +863,7 @@ void tst_qdeclarativestates::anchorChangesRTL2() { QDeclarativeEngine engine; - QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorChanges2.qml"); + QDeclarativeComponent rectComponent(&engine, TESTDATA("anchorChanges2.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create()); QVERIFY(rect != 0); QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect); @@ -884,7 +885,7 @@ void tst_qdeclarativestates::anchorChangesRTL3() { QDeclarativeEngine engine; - QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorChanges3.qml"); + QDeclarativeComponent rectComponent(&engine, TESTDATA("anchorChanges3.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create()); QVERIFY(rect != 0); QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect); @@ -939,7 +940,7 @@ void tst_qdeclarativestates::anchorChangesCrash() { QDeclarativeEngine engine; - QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorChangesCrash.qml"); + QDeclarativeComponent rectComponent(&engine, TESTDATA("anchorChangesCrash.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create()); QVERIFY(rect != 0); @@ -952,7 +953,7 @@ void tst_qdeclarativestates::anchorChangesCrash() void tst_qdeclarativestates::anchorRewindBug() { QSGView *view = new QSGView; - view->setSource(QUrl::fromLocalFile(SRCDIR "/data/anchorRewindBug.qml")); + view->setSource(QUrl::fromLocalFile(TESTDATA("anchorRewindBug.qml"))); view->show(); view->requestActivateWindow(); @@ -992,7 +993,7 @@ void tst_qdeclarativestates::anchorRewindBug2() { QDeclarativeEngine engine; - QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorRewindBug2.qml"); + QDeclarativeComponent rectComponent(&engine, TESTDATA("anchorRewindBug2.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create()); QVERIFY(rect != 0); @@ -1018,7 +1019,7 @@ void tst_qdeclarativestates::script() QDeclarativeEngine engine; { - QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/script.qml"); + QDeclarativeComponent rectComponent(&engine, TESTDATA("script.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create()); QVERIFY(rect != 0); QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect); @@ -1036,7 +1037,7 @@ void tst_qdeclarativestates::restoreEntryValues() { QDeclarativeEngine engine; - QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/restoreEntryValues.qml"); + QDeclarativeComponent rectComponent(&engine, TESTDATA("restoreEntryValues.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create()); QVERIFY(rect != 0); QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect); @@ -1053,7 +1054,7 @@ void tst_qdeclarativestates::explicitChanges() { QDeclarativeEngine engine; - QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/explicit.qml"); + QDeclarativeComponent rectComponent(&engine, TESTDATA("explicit.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create()); QVERIFY(rect != 0); QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect); @@ -1086,14 +1087,14 @@ void tst_qdeclarativestates::explicitChanges() void tst_qdeclarativestates::propertyErrors() { QDeclarativeEngine engine; - QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/propertyErrors.qml"); + QDeclarativeComponent rectComponent(&engine, TESTDATA("propertyErrors.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create()); QVERIFY(rect != 0); QCOMPARE(rect->color(),QColor("red")); - QTest::ignoreMessage(QtWarningMsg, fullDataPath("/data/propertyErrors.qml") + ":8:9: QML PropertyChanges: Cannot assign to non-existent property \"colr\""); - QTest::ignoreMessage(QtWarningMsg, fullDataPath("/data/propertyErrors.qml") + ":8:9: QML PropertyChanges: Cannot assign to read-only property \"activeFocus\""); + QTest::ignoreMessage(QtWarningMsg, fullDataPath("propertyErrors.qml") + ":8:9: QML PropertyChanges: Cannot assign to non-existent property \"colr\""); + QTest::ignoreMessage(QtWarningMsg, fullDataPath("propertyErrors.qml") + ":8:9: QML PropertyChanges: Cannot assign to read-only property \"activeFocus\""); QSGItemPrivate::get(rect)->setState("blue"); } @@ -1101,7 +1102,7 @@ void tst_qdeclarativestates::incorrectRestoreBug() { QDeclarativeEngine engine; - QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicChanges.qml"); + QDeclarativeComponent rectComponent(&engine, TESTDATA("basicChanges.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create()); QVERIFY(rect != 0); QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect); @@ -1127,7 +1128,7 @@ void tst_qdeclarativestates::autoStateAtStartupRestoreBug() { QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, SRCDIR "/data/autoStateAtStartupRestoreBug.qml"); + QDeclarativeComponent component(&engine, TESTDATA("autoStateAtStartupRestoreBug.qml")); QObject *obj = component.create(); QVERIFY(obj != 0); @@ -1144,7 +1145,7 @@ void tst_qdeclarativestates::deletingChange() { QDeclarativeEngine engine; - QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/deleting.qml"); + QDeclarativeComponent rectComponent(&engine, TESTDATA("deleting.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create()); QVERIFY(rect != 0); QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect); @@ -1176,7 +1177,7 @@ void tst_qdeclarativestates::deletingState() { QDeclarativeEngine engine; - QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/deletingState.qml"); + QDeclarativeComponent rectComponent(&engine, TESTDATA("deletingState.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create()); QVERIFY(rect != 0); @@ -1207,7 +1208,7 @@ void tst_qdeclarativestates::tempState() { QDeclarativeEngine engine; - QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/legalTempState.qml"); + QDeclarativeComponent rectComponent(&engine, TESTDATA("legalTempState.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create()); QVERIFY(rect != 0); QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect); @@ -1221,7 +1222,7 @@ void tst_qdeclarativestates::illegalTempState() { QDeclarativeEngine engine; - QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/illegalTempState.qml"); + QDeclarativeComponent rectComponent(&engine, TESTDATA("illegalTempState.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create()); QVERIFY(rect != 0); QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect); @@ -1234,11 +1235,11 @@ void tst_qdeclarativestates::nonExistantProperty() { QDeclarativeEngine engine; - QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/nonExistantProp.qml"); + QDeclarativeComponent rectComponent(&engine, TESTDATA("nonExistantProp.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(rectComponent.create()); QVERIFY(rect != 0); QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect); - QTest::ignoreMessage(QtWarningMsg, fullDataPath("/data/nonExistantProp.qml") + ":9:9: QML PropertyChanges: Cannot assign to non-existent property \"colr\""); + QTest::ignoreMessage(QtWarningMsg, fullDataPath("nonExistantProp.qml") + ":9:9: QML PropertyChanges: Cannot assign to non-existent property \"colr\""); rectPrivate->setState("blue"); QCOMPARE(rectPrivate->state(), QLatin1String("blue")); } @@ -1247,7 +1248,7 @@ void tst_qdeclarativestates::reset() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, SRCDIR "/data/reset.qml"); + QDeclarativeComponent c(&engine, TESTDATA("reset.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect != 0); @@ -1266,7 +1267,7 @@ void tst_qdeclarativestates::illegalObjectCreation() { QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, SRCDIR "/data/illegalObj.qml"); + QDeclarativeComponent component(&engine, TESTDATA("illegalObj.qml")); QList<QDeclarativeError> errors = component.errors(); QVERIFY(errors.count() == 1); const QDeclarativeError &error = errors.at(0); @@ -1279,7 +1280,7 @@ void tst_qdeclarativestates::whenOrdering() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, SRCDIR "/data/whenOrdering.qml"); + QDeclarativeComponent c(&engine, TESTDATA("whenOrdering.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect != 0); QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect); @@ -1302,7 +1303,7 @@ void tst_qdeclarativestates::urlResolution() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, SRCDIR "/data/urlResolution.qml"); + QDeclarativeComponent c(&engine, TESTDATA("urlResolution.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect != 0); @@ -1313,7 +1314,7 @@ void tst_qdeclarativestates::urlResolution() QVERIFY(myType != 0 && image1 != 0 && image2 != 0 && image3 != 0); QSGItemPrivate::get(myType)->setState("SetImageState"); - QUrl resolved = QUrl::fromLocalFile(SRCDIR "/data/Implementation/images/qt-logo.png"); + QUrl resolved = QUrl::fromLocalFile(TESTDATA("Implementation/images/qt-logo.png")); QCOMPARE(image1->source(), resolved); QCOMPARE(image2->source(), resolved); QCOMPARE(image3->source(), resolved); @@ -1323,7 +1324,7 @@ void tst_qdeclarativestates::unnamedWhen() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, SRCDIR "/data/unnamedWhen.qml"); + QDeclarativeComponent c(&engine, TESTDATA("unnamedWhen.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect != 0); QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect); @@ -1342,7 +1343,7 @@ void tst_qdeclarativestates::returnToBase() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, SRCDIR "/data/returnToBase.qml"); + QDeclarativeComponent c(&engine, TESTDATA("returnToBase.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect != 0); QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect); @@ -1362,7 +1363,7 @@ void tst_qdeclarativestates::extendsBug() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, SRCDIR "/data/extendsBug.qml"); + QDeclarativeComponent c(&engine, TESTDATA("extendsBug.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect != 0); QSGItemPrivate *rectPrivate = QSGItemPrivate::get(rect); @@ -1377,7 +1378,7 @@ void tst_qdeclarativestates::editProperties() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, SRCDIR "/data/editProperties.qml"); + QDeclarativeComponent c(&engine, TESTDATA("editProperties.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect != 0); @@ -1505,7 +1506,7 @@ void tst_qdeclarativestates::QTBUG_14830() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, SRCDIR "/data/QTBUG-14830.qml"); + QDeclarativeComponent c(&engine, TESTDATA("QTBUG-14830.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect != 0); QSGItem *item = rect->findChild<QSGItem*>("area"); @@ -1518,7 +1519,7 @@ void tst_qdeclarativestates::avoidFastForward() QDeclarativeEngine engine; //shouldn't fast forward if there isn't a transition - QDeclarativeComponent c(&engine, SRCDIR "/data/avoidFastForward.qml"); + QDeclarativeComponent c(&engine, TESTDATA("avoidFastForward.qml")); QSGRectangle *rect = qobject_cast<QSGRectangle*>(c.create()); QVERIFY(rect != 0); diff --git a/tests/auto/declarative/qdeclarativestyledtext/qdeclarativestyledtext.pro b/tests/auto/declarative/qdeclarativestyledtext/qdeclarativestyledtext.pro index f329897e0c..70e6fafe59 100644 --- a/tests/auto/declarative/qdeclarativestyledtext/qdeclarativestyledtext.pro +++ b/tests/auto/declarative/qdeclarativestyledtext/qdeclarativestyledtext.pro @@ -4,8 +4,5 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativestyledtext.cpp -# QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage -# LIBS += -lgcov - CONFIG += parallel_test QT += core-private gui-private declarative-private network testlib diff --git a/tests/auto/declarative/qdeclarativesystempalette/qdeclarativesystempalette.pro b/tests/auto/declarative/qdeclarativesystempalette/qdeclarativesystempalette.pro index 00f775a00e..4eee37678f 100644 --- a/tests/auto/declarative/qdeclarativesystempalette/qdeclarativesystempalette.pro +++ b/tests/auto/declarative/qdeclarativesystempalette/qdeclarativesystempalette.pro @@ -4,7 +4,5 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativesystempalette.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" - CONFIG += parallel_test QT += core-private gui-private declarative-private widgets testlib diff --git a/tests/auto/declarative/qdeclarativetimer/qdeclarativetimer.pro b/tests/auto/declarative/qdeclarativetimer/qdeclarativetimer.pro index 93f73abf16..60e59f01f6 100644 --- a/tests/auto/declarative/qdeclarativetimer/qdeclarativetimer.pro +++ b/tests/auto/declarative/qdeclarativetimer/qdeclarativetimer.pro @@ -4,7 +4,5 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativetimer.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" - CONFIG += parallel_test QT += core-private gui-private declarative-private gui testlib diff --git a/tests/auto/declarative/qdeclarativetranslation/qdeclarativetranslation.pro b/tests/auto/declarative/qdeclarativetranslation/qdeclarativetranslation.pro index edccaaecc4..488395ea52 100644 --- a/tests/auto/declarative/qdeclarativetranslation/qdeclarativetranslation.pro +++ b/tests/auto/declarative/qdeclarativetranslation/qdeclarativetranslation.pro @@ -5,7 +5,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativetranslation.cpp RESOURCES += data/translation.qrc -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativetranslation/tst_qdeclarativetranslation.cpp b/tests/auto/declarative/qdeclarativetranslation/tst_qdeclarativetranslation.cpp index 5fbfd47b0b..be257fdc41 100644 --- a/tests/auto/declarative/qdeclarativetranslation/tst_qdeclarativetranslation.cpp +++ b/tests/auto/declarative/qdeclarativetranslation/tst_qdeclarativetranslation.cpp @@ -43,6 +43,7 @@ #include <QDeclarativeEngine> #include <QDeclarativeComponent> #include <QTranslator> +#include "../shared/util.h" class tst_qdeclarativetranslation : public QObject { @@ -58,13 +59,13 @@ private slots: inline QUrl TEST_FILE(const QString &filename) { - return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename); + return QUrl::fromLocalFile(TESTDATA(filename)); } void tst_qdeclarativetranslation::translation() { QTranslator translator; - translator.load(QLatin1String("qml_fr"), QLatin1String(SRCDIR) + QLatin1String("/data")); + translator.load(QLatin1String("qml_fr"), TESTDATA("")); QCoreApplication::installTranslator(&translator); QDeclarativeEngine engine; @@ -88,7 +89,7 @@ void tst_qdeclarativetranslation::translation() void tst_qdeclarativetranslation::idTranslation() { QTranslator translator; - translator.load(QLatin1String("qmlid_fr"), QLatin1String(SRCDIR) + QLatin1String("/data")); + translator.load(QLatin1String("qmlid_fr"),TESTDATA("")); QCoreApplication::installTranslator(&translator); QDeclarativeEngine engine; diff --git a/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro b/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro index 92c5dfa014..d7097de835 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro +++ b/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro @@ -7,7 +7,9 @@ HEADERS += testtypes.h SOURCES += tst_qdeclarativevaluetypes.cpp \ testtypes.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp index d0e997ec47..db0e05bcf2 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp +++ b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp @@ -44,6 +44,7 @@ #include <QDeclarativeComponent> #include <QDebug> #include <private/qdeclarativevaluetype_p.h> +#include "../shared/util.h" #include "testtypes.h" QT_BEGIN_NAMESPACE @@ -104,7 +105,7 @@ void tst_qdeclarativevaluetypes::initTestCase() inline QUrl TEST_FILE(const QString &filename) { - return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename); + return QUrl::fromLocalFile(TESTDATA(filename)); } void tst_qdeclarativevaluetypes::point() diff --git a/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro b/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro index 721c4191f9..6eaaf577b4 100644 --- a/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro +++ b/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro @@ -4,7 +4,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeworkerscript.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp index 6a0586e5eb..8b7f6b6054 100644 --- a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp +++ b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp @@ -50,12 +50,12 @@ #include <private/qdeclarativeworkerscript_p.h> #include <private/qdeclarativeengine_p.h> +#include "../shared/util.h" #include "../../../shared/util.h" inline QUrl TEST_FILE(const QString &filename) { - QFileInfo fileInfo(__FILE__); - return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath(filename)); + return QUrl::fromLocalFile(TESTDATA(filename)); } @@ -93,7 +93,7 @@ private: void tst_QDeclarativeWorkerScript::source() { - QDeclarativeComponent component(&m_engine, SRCDIR "/data/worker.qml"); + QDeclarativeComponent component(&m_engine, TESTDATA("worker.qml")); QDeclarativeWorkerScript *worker = qobject_cast<QDeclarativeWorkerScript*>(component.create()); QVERIFY(worker != 0); const QMetaObject *mo = worker->metaObject(); @@ -103,7 +103,7 @@ void tst_QDeclarativeWorkerScript::source() waitForEchoMessage(worker); QCOMPARE(mo->property(mo->indexOfProperty("response")).read(worker).value<QVariant>(), value); - QUrl source = QUrl::fromLocalFile(SRCDIR "/data/script_fixed_return.js"); + QUrl source = QUrl::fromLocalFile(TESTDATA("script_fixed_return.js")); worker->setSource(source); QCOMPARE(worker->source(), source); QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, value))); @@ -118,7 +118,7 @@ void tst_QDeclarativeWorkerScript::messaging() { QFETCH(QVariant, value); - QDeclarativeComponent component(&m_engine, SRCDIR "/data/worker.qml"); + QDeclarativeComponent component(&m_engine, TESTDATA("worker.qml")); QDeclarativeWorkerScript *worker = qobject_cast<QDeclarativeWorkerScript*>(component.create()); QVERIFY(worker != 0); @@ -155,7 +155,7 @@ void tst_QDeclarativeWorkerScript::messaging_sendQObjectList() // instances. If objects are sent in a list, they will be sent as 'undefined' // js values. - QDeclarativeComponent component(&m_engine, SRCDIR "/data/worker.qml"); + QDeclarativeComponent component(&m_engine, TESTDATA("worker.qml")); QDeclarativeWorkerScript *worker = qobject_cast<QDeclarativeWorkerScript*>(component.create()); QVERIFY(worker != 0); @@ -176,7 +176,7 @@ void tst_QDeclarativeWorkerScript::messaging_sendQObjectList() void tst_QDeclarativeWorkerScript::messaging_sendJsObject() { - QDeclarativeComponent component(&m_engine, SRCDIR "/data/worker.qml"); + QDeclarativeComponent component(&m_engine, TESTDATA("worker.qml")); QDeclarativeWorkerScript *worker = qobject_cast<QDeclarativeWorkerScript*>(component.create()); QVERIFY(worker != 0); @@ -205,7 +205,7 @@ void tst_QDeclarativeWorkerScript::script_with_pragma() { QVariant value(100); - QDeclarativeComponent component(&m_engine, SRCDIR "/data/worker_pragma.qml"); + QDeclarativeComponent component(&m_engine, TESTDATA("worker_pragma.qml")); QDeclarativeWorkerScript *worker = qobject_cast<QDeclarativeWorkerScript*>(component.create()); QVERIFY(worker != 0); @@ -221,7 +221,7 @@ void tst_QDeclarativeWorkerScript::script_with_pragma() void tst_QDeclarativeWorkerScript::script_included() { - QDeclarativeComponent component(&m_engine, SRCDIR "/data/worker_include.qml"); + QDeclarativeComponent component(&m_engine, TESTDATA("worker_include.qml")); QDeclarativeWorkerScript *worker = qobject_cast<QDeclarativeWorkerScript*>(component.create()); QVERIFY(worker != 0); @@ -246,14 +246,14 @@ static void qdeclarativeworkerscript_warningsHandler(QtMsgType type, const char void tst_QDeclarativeWorkerScript::scriptError_onLoad() { - QDeclarativeComponent component(&m_engine, SRCDIR "/data/worker_error_onLoad.qml"); + QDeclarativeComponent component(&m_engine, TESTDATA("worker_error_onLoad.qml")); QtMsgHandler previousMsgHandler = qInstallMsgHandler(qdeclarativeworkerscript_warningsHandler); QDeclarativeWorkerScript *worker = qobject_cast<QDeclarativeWorkerScript*>(component.create()); QVERIFY(worker != 0); QTRY_COMPARE(qdeclarativeworkerscript_lastWarning, - TEST_FILE("data/script_error_onLoad.js").toString() + QLatin1String(":3: SyntaxError: Unexpected identifier")); + TEST_FILE("script_error_onLoad.js").toString() + QLatin1String(":3: SyntaxError: Unexpected identifier")); qInstallMsgHandler(previousMsgHandler); qApp->processEvents(); @@ -262,7 +262,7 @@ void tst_QDeclarativeWorkerScript::scriptError_onLoad() void tst_QDeclarativeWorkerScript::scriptError_onCall() { - QDeclarativeComponent component(&m_engine, SRCDIR "/data/worker_error_onCall.qml"); + QDeclarativeComponent component(&m_engine, TESTDATA("worker_error_onCall.qml")); QDeclarativeWorkerScript *worker = qobject_cast<QDeclarativeWorkerScript*>(component.create()); QVERIFY(worker != 0); @@ -271,7 +271,7 @@ void tst_QDeclarativeWorkerScript::scriptError_onCall() QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, value))); QTRY_COMPARE(qdeclarativeworkerscript_lastWarning, - TEST_FILE("data/script_error_onCall.js").toString() + QLatin1String(":4: ReferenceError: Can't find variable: getData")); + TEST_FILE("script_error_onCall.js").toString() + QLatin1String(":4: ReferenceError: Can't find variable: getData")); qInstallMsgHandler(previousMsgHandler); qApp->processEvents(); @@ -284,7 +284,7 @@ void tst_QDeclarativeWorkerScript::stressDispose() { for (int ii = 0; ii < 100; ++ii) { QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, SRCDIR "/data/stressDispose.qml"); + QDeclarativeComponent component(&engine, TESTDATA("stressDispose.qml")); QObject *o = component.create(); QVERIFY(o); delete o; diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro b/tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro index d8a59a103c..0e6073b503 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro @@ -8,7 +8,9 @@ HEADERS += ../shared/testhttpserver.h SOURCES += tst_qdeclarativexmlhttprequest.cpp \ ../shared/testhttpserver.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp b/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp index 2c9bcc0c44..a035b4e870 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp @@ -45,6 +45,7 @@ #include <QDebug> #include <QNetworkCookieJar> #include "testhttpserver.h" +#include "../shared/util.h" #include "../../../shared/util.h" #define SERVER_PORT 14445 @@ -122,7 +123,7 @@ private: inline QUrl TEST_FILE(const QString &filename) { - return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename); + return QUrl::fromLocalFile(TESTDATA(filename)); } // Test that the dom exception codes are correct @@ -1018,7 +1019,7 @@ void tst_qdeclarativexmlhttprequest::redirects() TestHTTPServer server(SERVER_PORT); QVERIFY(server.isValid()); server.addRedirect("redirect.html", "http://127.0.0.1:14445/redirecttarget.html"); - server.serveDirectory(SRCDIR "/data"); + server.serveDirectory(TESTDATA("")); QDeclarativeComponent component(&engine, TEST_FILE("redirects.qml")); QObject *object = component.beginCreate(engine.rootContext()); @@ -1037,7 +1038,7 @@ void tst_qdeclarativexmlhttprequest::redirects() TestHTTPServer server(SERVER_PORT); QVERIFY(server.isValid()); server.addRedirect("redirect.html", "http://127.0.0.1:14445/redirectmissing.html"); - server.serveDirectory(SRCDIR "/data"); + server.serveDirectory(TESTDATA("")); QDeclarativeComponent component(&engine, TEST_FILE("redirectError.qml")); QObject *object = component.beginCreate(engine.rootContext()); @@ -1056,7 +1057,7 @@ void tst_qdeclarativexmlhttprequest::redirects() TestHTTPServer server(SERVER_PORT); QVERIFY(server.isValid()); server.addRedirect("redirect.html", "http://127.0.0.1:14445/redirect.html"); - server.serveDirectory(SRCDIR "/data"); + server.serveDirectory(TESTDATA("")); QDeclarativeComponent component(&engine, TEST_FILE("redirectRecur.qml")); QObject *object = component.beginCreate(engine.rootContext()); diff --git a/tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro b/tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro index 4366c316fd..ae5523711c 100644 --- a/tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro +++ b/tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro @@ -4,7 +4,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativexmllistmodel.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp b/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp index 04eb7c6b47..3328232236 100644 --- a/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp +++ b/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp @@ -52,6 +52,7 @@ #include <QtCore/qtimer.h> #include <QtCore/qfile.h> #include <QtCore/qtemporaryfile.h> +#include "../shared/util.h" #include <QtDeclarative/qdeclarativeengine.h> #include <QtDeclarative/qdeclarativecomponent.h> @@ -187,7 +188,7 @@ QNetworkAccessManager *CustomNetworkAccessManagerFactory::create(QObject *parent void tst_qdeclarativexmllistmodel::buildModel() { - QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/model.qml")); + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("model.qml"))); QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create()); QVERIFY(model != 0); QTRY_COMPARE(model->count(), 9); @@ -210,7 +211,7 @@ void tst_qdeclarativexmllistmodel::testTypes() QFETCH(QString, roleName); QFETCH(QVariant, expectedValue); - QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/testtypes.qml")); + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("testtypes.qml"))); QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create()); QVERIFY(model != 0); model->setXml(xml.toUtf8()); @@ -270,7 +271,7 @@ void tst_qdeclarativexmllistmodel::testTypes_data() void tst_qdeclarativexmllistmodel::cdata() { - QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/recipes.qml")); + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("recipes.qml"))); QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create()); QVERIFY(model != 0); QTRY_COMPARE(model->count(), 5); @@ -286,7 +287,7 @@ void tst_qdeclarativexmllistmodel::cdata() void tst_qdeclarativexmllistmodel::attributes() { - QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/recipes.qml")); + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("recipes.qml"))); QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create()); QVERIFY(model != 0); QTRY_COMPARE(model->count(), 5); @@ -301,7 +302,7 @@ void tst_qdeclarativexmllistmodel::attributes() void tst_qdeclarativexmllistmodel::roles() { - QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/model.qml")); + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("model.qml"))); QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create()); QVERIFY(model != 0); QTRY_COMPARE(model->count(), 9); @@ -318,9 +319,9 @@ void tst_qdeclarativexmllistmodel::roles() void tst_qdeclarativexmllistmodel::roleErrors() { - QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/roleErrors.qml")); - QTest::ignoreMessage(QtWarningMsg, (QUrl::fromLocalFile(SRCDIR "/data/roleErrors.qml").toString() + ":6:5: QML XmlRole: An XmlRole query must not start with '/'").toUtf8().constData()); - QTest::ignoreMessage(QtWarningMsg, (QUrl::fromLocalFile(SRCDIR "/data/roleErrors.qml").toString() + ":9:5: QML XmlRole: invalid query: \"age/\"").toUtf8().constData()); + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("roleErrors.qml"))); + QTest::ignoreMessage(QtWarningMsg, (QUrl::fromLocalFile(TESTDATA("roleErrors.qml")).toString() + ":6:5: QML XmlRole: An XmlRole query must not start with '/'").toUtf8().constData()); + QTest::ignoreMessage(QtWarningMsg, (QUrl::fromLocalFile(TESTDATA("roleErrors.qml")).toString() + ":9:5: QML XmlRole: invalid query: \"age/\"").toUtf8().constData()); //### make sure we receive all expected warning messages. QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create()); @@ -345,8 +346,8 @@ void tst_qdeclarativexmllistmodel::roleErrors() void tst_qdeclarativexmllistmodel::uniqueRoleNames() { - QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/unique.qml")); - QTest::ignoreMessage(QtWarningMsg, (QUrl::fromLocalFile(SRCDIR "/data/unique.qml").toString() + ":7:5: QML XmlRole: \"name\" duplicates a previous role name and will be disabled.").toUtf8().constData()); + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("unique.qml"))); + QTest::ignoreMessage(QtWarningMsg, (QUrl::fromLocalFile(TESTDATA("unique.qml")).toString() + ":7:5: QML XmlRole: \"name\" duplicates a previous role name and will be disabled.").toUtf8().constData()); QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create()); QVERIFY(model != 0); QTRY_COMPARE(model->count(), 9); @@ -363,7 +364,7 @@ void tst_qdeclarativexmllistmodel::xml() QFETCH(QString, xml); QFETCH(int, count); - QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/model.qml")); + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("model.qml"))); QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create()); QSignalSpy spy(model, SIGNAL(statusChanged(QDeclarativeXmlListModel::Status))); @@ -412,7 +413,7 @@ void tst_qdeclarativexmllistmodel::headers() CustomNetworkAccessManagerFactory factory; qmlEng.setNetworkAccessManagerFactory(&factory); - QDeclarativeComponent component(&qmlEng, QUrl::fromLocalFile(SRCDIR "/data/model.qml")); + QDeclarativeComponent component(&qmlEng, QUrl::fromLocalFile(TESTDATA("model.qml"))); QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create()); QVERIFY(model != 0); QTRY_COMPARE(model->status(), QDeclarativeXmlListModel::Ready); @@ -435,7 +436,7 @@ void tst_qdeclarativexmllistmodel::source() QFETCH(int, count); QFETCH(QDeclarativeXmlListModel::Status, status); - QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/model.qml")); + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("model.qml"))); QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create()); QSignalSpy spy(model, SIGNAL(statusChanged(QDeclarativeXmlListModel::Status))); @@ -487,7 +488,7 @@ void tst_qdeclarativexmllistmodel::source_data() QTest::addColumn<int>("count"); QTest::addColumn<QDeclarativeXmlListModel::Status>("status"); - QTest::newRow("valid") << QUrl::fromLocalFile(SRCDIR "/data/model2.xml") << 2 << QDeclarativeXmlListModel::Ready; + QTest::newRow("valid") << QUrl::fromLocalFile(TESTDATA("model2.xml")) << 2 << QDeclarativeXmlListModel::Ready; QTest::newRow("invalid") << QUrl("http://blah.blah/blah.xml") << 0 << QDeclarativeXmlListModel::Error; // empty file @@ -499,7 +500,7 @@ void tst_qdeclarativexmllistmodel::source_data() void tst_qdeclarativexmllistmodel::data() { - QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/model.qml")); + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("model.qml"))); QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create()); QVERIFY(model != 0); @@ -519,7 +520,7 @@ void tst_qdeclarativexmllistmodel::data() void tst_qdeclarativexmllistmodel::get() { - QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/get.qml")); + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("get.qml"))); QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create()); QVERIFY(model != 0); @@ -540,7 +541,7 @@ void tst_qdeclarativexmllistmodel::reload() // If no keys are used, the model should be rebuilt from scratch when // reload() is called. - QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/model.qml")); + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("model.qml"))); QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create()); QVERIFY(model != 0); QTRY_COMPARE(model->count(), 9); @@ -581,7 +582,7 @@ void tst_qdeclarativexmllistmodel::useKeys() QFETCH(QList<QDeclarativeXmlListRange>, insertRanges); QFETCH(QList<QDeclarativeXmlListRange>, removeRanges); - QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/roleKeys.qml")); + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("roleKeys.qml"))); QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create()); QVERIFY(model != 0); @@ -732,7 +733,7 @@ void tst_qdeclarativexmllistmodel::noKeysValueChanges() // If a 'sport' value is changed, the model should not be reloaded, // since 'sport' is not marked as a key. - QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/roleKeys.qml")); + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("roleKeys.qml"))); QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create()); QVERIFY(model != 0); @@ -770,7 +771,7 @@ void tst_qdeclarativexmllistmodel::keysChanged() // delete all its data and build a clean model (i.e. same behaviour as // if no keys are set). - QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/roleKeys.qml")); + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("roleKeys.qml"))); QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create()); QVERIFY(model != 0); @@ -806,7 +807,7 @@ void tst_qdeclarativexmllistmodel::threading() { QFETCH(int, xmlDataCount); - QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/roleKeys.qml")); + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("roleKeys.qml"))); QDeclarativeXmlListModel *m1 = qobject_cast<QDeclarativeXmlListModel*>(component.create()); QVERIFY(m1 != 0); @@ -879,7 +880,7 @@ void tst_qdeclarativexmllistmodel::threading_data() void tst_qdeclarativexmllistmodel::propertyChanges() { - QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml")); + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("propertychanges.qml"))); QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create()); QVERIFY(model != 0); QTRY_COMPARE(model->count(), 9); @@ -950,7 +951,7 @@ void tst_qdeclarativexmllistmodel::propertyChanges() void tst_qdeclarativexmllistmodel::roleCrash() { // don't crash - QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/roleCrash.qml")); + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("roleCrash.qml"))); QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create()); QVERIFY(model != 0); delete model; diff --git a/tests/auto/declarative/qsganimatedimage/qsganimatedimage.pro b/tests/auto/declarative/qsganimatedimage/qsganimatedimage.pro index 213d7efdb5..eaf83ccfef 100644 --- a/tests/auto/declarative/qsganimatedimage/qsganimatedimage.pro +++ b/tests/auto/declarative/qsganimatedimage/qsganimatedimage.pro @@ -4,7 +4,9 @@ HEADERS += ../shared/testhttpserver.h SOURCES += tst_qsganimatedimage.cpp ../shared/testhttpserver.cpp macx:CONFIG -= app_bundle -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles CONFIG += parallel_test diff --git a/tests/auto/declarative/qsganimatedimage/tst_qsganimatedimage.cpp b/tests/auto/declarative/qsganimatedimage/tst_qsganimatedimage.cpp index 4f2e90b49b..8e63773104 100644 --- a/tests/auto/declarative/qsganimatedimage/tst_qsganimatedimage.cpp +++ b/tests/auto/declarative/qsganimatedimage/tst_qsganimatedimage.cpp @@ -49,6 +49,7 @@ #include <QtDeclarative/qdeclarativecontext.h> #include "../shared/testhttpserver.h" +#include "../shared/util.h" #include "../../../shared/util.h" class tst_qsganimatedimage : public QObject @@ -79,7 +80,7 @@ private slots: void tst_qsganimatedimage::play() { QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/stickman.qml")); + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("stickman.qml"))); QSGAnimatedImage *anim = qobject_cast<QSGAnimatedImage *>(component.create()); QVERIFY(anim); QVERIFY(anim->isPlaying()); @@ -90,7 +91,7 @@ void tst_qsganimatedimage::play() void tst_qsganimatedimage::pause() { QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/stickmanpause.qml")); + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("stickmanpause.qml"))); QSGAnimatedImage *anim = qobject_cast<QSGAnimatedImage *>(component.create()); QVERIFY(anim); QVERIFY(anim->isPlaying()); @@ -102,7 +103,7 @@ void tst_qsganimatedimage::pause() void tst_qsganimatedimage::stopped() { QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/stickmanstopped.qml")); + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("stickmanstopped.qml"))); QSGAnimatedImage *anim = qobject_cast<QSGAnimatedImage *>(component.create()); QVERIFY(anim); QVERIFY(!anim->isPlaying()); @@ -114,7 +115,7 @@ void tst_qsganimatedimage::stopped() void tst_qsganimatedimage::setFrame() { QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/stickmanpause.qml")); + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("stickmanpause.qml"))); QSGAnimatedImage *anim = qobject_cast<QSGAnimatedImage *>(component.create()); QVERIFY(anim); QVERIFY(anim->isPlaying()); @@ -126,7 +127,7 @@ void tst_qsganimatedimage::setFrame() void tst_qsganimatedimage::frameCount() { QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/colors.qml")); + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("colors.qml"))); QSGAnimatedImage *anim = qobject_cast<QSGAnimatedImage *>(component.create()); QVERIFY(anim); QVERIFY(anim->isPlaying()); @@ -142,7 +143,7 @@ void tst_qsganimatedimage::mirror_running() QSGView *canvas = new QSGView; canvas->show(); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/hearts.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("hearts.qml"))); QSGAnimatedImage *anim = qobject_cast<QSGAnimatedImage *>(canvas->rootObject()); QVERIFY(anim); @@ -222,8 +223,8 @@ void tst_qsganimatedimage::mirror_notRunning_data() { QTest::addColumn<QUrl>("fileUrl"); - QTest::newRow("paused") << QUrl::fromLocalFile(SRCDIR "/data/stickmanpause.qml"); - QTest::newRow("stopped") << QUrl::fromLocalFile(SRCDIR "/data/stickmanstopped.qml"); + QTest::newRow("paused") << QUrl::fromLocalFile(TESTDATA("stickmanpause.qml")); + QTest::newRow("stopped") << QUrl::fromLocalFile(TESTDATA("stickmanstopped.qml")); } void tst_qsganimatedimage::remote() @@ -233,7 +234,7 @@ void tst_qsganimatedimage::remote() TestHTTPServer server(14449); QVERIFY(server.isValid()); - server.serveDirectory(SRCDIR "/data"); + server.serveDirectory(TESTDATA("")); QDeclarativeEngine engine; QDeclarativeComponent component(&engine, QUrl("http://127.0.0.1:14449/" + fileName)); @@ -255,7 +256,7 @@ void tst_qsganimatedimage::remote() void tst_qsganimatedimage::sourceSize() { QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/stickmanscaled.qml")); + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("stickmanscaled.qml"))); QSGAnimatedImage *anim = qobject_cast<QSGAnimatedImage *>(component.create()); QVERIFY(anim); QCOMPARE(anim->width(),240.0); @@ -268,7 +269,7 @@ void tst_qsganimatedimage::sourceSize() void tst_qsganimatedimage::sourceSizeReadOnly() { QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/stickmanerror1.qml")); + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("stickmanerror1.qml"))); QVERIFY(component.isError()); QCOMPARE(component.errors().at(0).description(), QString("Invalid property assignment: \"sourceSize\" is a read-only property")); } @@ -305,10 +306,10 @@ void tst_qsganimatedimage::qtbug_16520() { TestHTTPServer server(14449); QVERIFY(server.isValid()); - server.serveDirectory(SRCDIR "/data"); + server.serveDirectory(TESTDATA("")); QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/qtbug-16520.qml")); + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(TESTDATA("qtbug-16520.qml"))); QTRY_VERIFY(component.isReady()); QSGRectangle *root = qobject_cast<QSGRectangle *>(component.create()); @@ -327,12 +328,12 @@ void tst_qsganimatedimage::progressAndStatusChanges() { TestHTTPServer server(14449); QVERIFY(server.isValid()); - server.serveDirectory(SRCDIR "/data"); + server.serveDirectory(TESTDATA("")); QDeclarativeEngine engine; QString componentStr = "import QtQuick 2.0\nAnimatedImage { source: srcImage }"; QDeclarativeContext *ctxt = engine.rootContext(); - ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/stickman.gif")); + ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(TESTDATA("stickman.gif"))); QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QSGImage *obj = qobject_cast<QSGImage*>(component.create()); @@ -345,7 +346,7 @@ void tst_qsganimatedimage::progressAndStatusChanges() QSignalSpy statusSpy(obj, SIGNAL(statusChanged(QSGImageBase::Status))); // Loading local file - ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/colors.gif")); + ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(TESTDATA("colors.gif"))); QTRY_VERIFY(obj->status() == QSGImage::Ready); QTRY_VERIFY(obj->progress() == 1.0); QTRY_COMPARE(sourceSpy.count(), 1); diff --git a/tests/auto/declarative/qsgborderimage/qsgborderimage.pro b/tests/auto/declarative/qsgborderimage/qsgborderimage.pro index 115227487e..5ce2efd528 100644 --- a/tests/auto/declarative/qsgborderimage/qsgborderimage.pro +++ b/tests/auto/declarative/qsgborderimage/qsgborderimage.pro @@ -5,7 +5,9 @@ macx:CONFIG -= app_bundle HEADERS += ../shared/testhttpserver.h SOURCES += tst_qsgborderimage.cpp ../shared/testhttpserver.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles CONFIG += parallel_test diff --git a/tests/auto/declarative/qsgborderimage/tst_qsgborderimage.cpp b/tests/auto/declarative/qsgborderimage/tst_qsgborderimage.cpp index 9f390aeed9..a96ea4b68a 100644 --- a/tests/auto/declarative/qsgborderimage/tst_qsgborderimage.cpp +++ b/tests/auto/declarative/qsgborderimage/tst_qsgborderimage.cpp @@ -56,6 +56,7 @@ #include <QtDeclarative/qdeclarativecontext.h> #include "../shared/testhttpserver.h" +#include "../shared/util.h" #include "../../../shared/util.h" #define SERVER_PORT 14446 @@ -113,9 +114,9 @@ void tst_qsgborderimage::imageSource_data() QTest::addColumn<bool>("remote"); QTest::addColumn<QString>("error"); - QTest::newRow("local") << QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() << false << ""; - QTest::newRow("local not found") << QUrl::fromLocalFile(SRCDIR "/data/no-such-file.png").toString() << false - << "file::2:1: QML BorderImage: Cannot open: " + QUrl::fromLocalFile(SRCDIR "/data/no-such-file.png").toString(); + QTest::newRow("local") << QUrl::fromLocalFile(TESTDATA("colors.png")).toString() << false << ""; + QTest::newRow("local not found") << QUrl::fromLocalFile(TESTDATA("no-such-file.png")).toString() << false + << "file::2:1: QML BorderImage: Cannot open: " + QUrl::fromLocalFile(TESTDATA("no-such-file.png")).toString(); QTest::newRow("remote") << SERVER_ADDR "/colors.png" << true << ""; QTest::newRow("remote not found") << SERVER_ADDR "/no-such-file.png" << true << "file::2:1: QML BorderImage: Error downloading " SERVER_ADDR "/no-such-file.png - server replied: Not found"; @@ -131,7 +132,7 @@ void tst_qsgborderimage::imageSource() if (remote) { server = new TestHTTPServer(SERVER_PORT); QVERIFY(server->isValid()); - server->serveDirectory(SRCDIR "/data"); + server->serveDirectory(TESTDATA("")); } if (!error.isEmpty()) @@ -168,7 +169,7 @@ void tst_qsgborderimage::clearSource() { QString componentStr = "import QtQuick 2.0\nBorderImage { source: srcImage }"; QDeclarativeContext *ctxt = engine.rootContext(); - ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/colors.png")); + ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(TESTDATA("colors.png"))); QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QSGBorderImage *obj = qobject_cast<QSGBorderImage*>(component.create()); @@ -186,7 +187,7 @@ void tst_qsgborderimage::clearSource() void tst_qsgborderimage::resized() { - QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() + "\"; width: 300; height: 300 }"; + QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + QUrl::fromLocalFile(TESTDATA("colors.png")).toString() + "\"; width: 300; height: 300 }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QSGBorderImage *obj = qobject_cast<QSGBorderImage*>(component.create()); @@ -203,7 +204,7 @@ void tst_qsgborderimage::resized() void tst_qsgborderimage::smooth() { - QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; smooth: true; width: 300; height: 300 }"; + QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + TESTDATA("colors.png") + "\"; smooth: true; width: 300; height: 300 }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QSGBorderImage *obj = qobject_cast<QSGBorderImage*>(component.create()); @@ -222,7 +223,7 @@ void tst_qsgborderimage::mirror() QSGView *canvas = new QSGView; canvas->show(); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/mirror.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("mirror.qml"))); QSGBorderImage *image = qobject_cast<QSGBorderImage*>(canvas->rootObject()); QVERIFY(image != 0); canvas->show(); @@ -244,7 +245,7 @@ void tst_qsgborderimage::mirror() void tst_qsgborderimage::tileModes() { { - QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; width: 100; height: 300; horizontalTileMode: BorderImage.Repeat; verticalTileMode: BorderImage.Repeat }"; + QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + TESTDATA("colors.png") + "\"; width: 100; height: 300; horizontalTileMode: BorderImage.Repeat; verticalTileMode: BorderImage.Repeat }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QSGBorderImage *obj = qobject_cast<QSGBorderImage*>(component.create()); @@ -257,7 +258,7 @@ void tst_qsgborderimage::tileModes() delete obj; } { - QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; width: 300; height: 150; horizontalTileMode: BorderImage.Round; verticalTileMode: BorderImage.Round }"; + QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + TESTDATA("colors.png") + "\"; width: 300; height: 150; horizontalTileMode: BorderImage.Round; verticalTileMode: BorderImage.Round }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QSGBorderImage *obj = qobject_cast<QSGBorderImage*>(component.create()); @@ -281,7 +282,7 @@ void tst_qsgborderimage::sciSource() if (remote) { server = new TestHTTPServer(SERVER_PORT); QVERIFY(server->isValid()); - server->serveDirectory(SRCDIR "/data"); + server->serveDirectory(TESTDATA("")); } QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + source + "\"; width: 300; height: 300 }"; @@ -318,9 +319,9 @@ void tst_qsgborderimage::sciSource_data() QTest::addColumn<QString>("source"); QTest::addColumn<bool>("valid"); - QTest::newRow("local") << QUrl::fromLocalFile(SRCDIR "/data/colors-round.sci").toString() << true; - QTest::newRow("local quoted filename") << QUrl::fromLocalFile(SRCDIR "/data/colors-round-quotes.sci").toString() << true; - QTest::newRow("local not found") << QUrl::fromLocalFile(SRCDIR "/data/no-such-file.sci").toString() << false; + QTest::newRow("local") << QUrl::fromLocalFile(TESTDATA("colors-round.sci")).toString() << true; + QTest::newRow("local quoted filename") << QUrl::fromLocalFile(TESTDATA("colors-round-quotes.sci")).toString() << true; + QTest::newRow("local not found") << QUrl::fromLocalFile(TESTDATA("no-such-file.sci")).toString() << false; QTest::newRow("remote") << SERVER_ADDR "/colors-round.sci" << true; QTest::newRow("remote filename quoted") << SERVER_ADDR "/colors-round-quotes.sci" << true; QTest::newRow("remote image") << SERVER_ADDR "/colors-round-remote.sci" << true; @@ -332,7 +333,7 @@ void tst_qsgborderimage::invalidSciFile() QTest::ignoreMessage(QtWarningMsg, "QSGGridScaledImage: Invalid tile rule specified. Using Stretch."); // for "Roun" QTest::ignoreMessage(QtWarningMsg, "QSGGridScaledImage: Invalid tile rule specified. Using Stretch."); // for "Repea" - QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/invalid.sci").toString() +"\"; width: 300; height: 300 }"; + QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + QUrl::fromLocalFile(TESTDATA("invalid.sci")).toString() +"\"; width: 300; height: 300 }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QSGBorderImage *obj = qobject_cast<QSGBorderImage*>(component.create()); diff --git a/tests/auto/declarative/qsgdrag/qsgdrag.pro b/tests/auto/declarative/qsgdrag/qsgdrag.pro index 213385cd1f..c12d97d14e 100644 --- a/tests/auto/declarative/qsgdrag/qsgdrag.pro +++ b/tests/auto/declarative/qsgdrag/qsgdrag.pro @@ -4,8 +4,6 @@ macx:CONFIG -= app_bundle SOURCES += tst_qsgdrag.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" - CONFIG += parallel_test QT += core-private gui-private declarative-private diff --git a/tests/auto/declarative/qsgdroparea/qsgdroparea.pro b/tests/auto/declarative/qsgdroparea/qsgdroparea.pro index 2f4be247b0..d98314f53e 100644 --- a/tests/auto/declarative/qsgdroparea/qsgdroparea.pro +++ b/tests/auto/declarative/qsgdroparea/qsgdroparea.pro @@ -4,8 +4,6 @@ macx:CONFIG -= app_bundle SOURCES += tst_qsgdroparea.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" - CONFIG += parallel_test QT += core-private gui-private declarative-private diff --git a/tests/auto/declarative/qsgflickable/qsgflickable.pro b/tests/auto/declarative/qsgflickable/qsgflickable.pro index 15656d200a..c2629c8c1b 100644 --- a/tests/auto/declarative/qsgflickable/qsgflickable.pro +++ b/tests/auto/declarative/qsgflickable/qsgflickable.pro @@ -4,7 +4,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qsgflickable.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles CONFIG += parallel_test #temporary diff --git a/tests/auto/declarative/qsgflickable/tst_qsgflickable.cpp b/tests/auto/declarative/qsgflickable/tst_qsgflickable.cpp index 12c2e9c7d9..7777b5c3b5 100644 --- a/tests/auto/declarative/qsgflickable/tst_qsgflickable.cpp +++ b/tests/auto/declarative/qsgflickable/tst_qsgflickable.cpp @@ -46,6 +46,7 @@ #include <private/qsgflickable_p.h> #include <private/qdeclarativevaluetype_p.h> #include <math.h> +#include "../shared/util.h" #include "../../../shared/util.h" #include <QtOpenGL/QGLShaderProgram> @@ -102,7 +103,7 @@ void tst_qsgflickable::cleanupTestCase() void tst_qsgflickable::create() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/flickable01.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("flickable01.qml"))); QSGFlickable *obj = qobject_cast<QSGFlickable*>(c.create()); QVERIFY(obj != 0); @@ -127,7 +128,7 @@ void tst_qsgflickable::create() void tst_qsgflickable::horizontalViewportSize() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/flickable02.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("flickable02.qml"))); QSGFlickable *obj = qobject_cast<QSGFlickable*>(c.create()); QVERIFY(obj != 0); @@ -144,7 +145,7 @@ void tst_qsgflickable::horizontalViewportSize() void tst_qsgflickable::verticalViewportSize() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/flickable03.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("flickable03.qml"))); QSGFlickable *obj = qobject_cast<QSGFlickable*>(c.create()); QVERIFY(obj != 0); @@ -161,7 +162,7 @@ void tst_qsgflickable::verticalViewportSize() void tst_qsgflickable::properties() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/flickable04.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("flickable04.qml"))); QSGFlickable *obj = qobject_cast<QSGFlickable*>(c.create()); QVERIFY(obj != 0); @@ -261,7 +262,7 @@ void tst_qsgflickable::pressDelay() void tst_qsgflickable::nestedPressDelay() { QSGView *canvas = new QSGView; - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/nestedPressDelay.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("nestedPressDelay.qml"))); canvas->show(); canvas->requestActivateWindow(); QVERIFY(canvas->rootObject() != 0); @@ -316,7 +317,7 @@ void tst_qsgflickable::flickableDirection() void tst_qsgflickable::resizeContent() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/resize.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("resize.qml"))); QSGItem *root = qobject_cast<QSGItem*>(c.create()); QSGFlickable *obj = findItem<QSGFlickable>(root, "flick"); @@ -340,7 +341,7 @@ void tst_qsgflickable::resizeContent() void tst_qsgflickable::returnToBounds() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/resize.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("resize.qml"))); QSGItem *root = qobject_cast<QSGItem*>(c.create()); QSGFlickable *obj = findItem<QSGFlickable>(root, "flick"); @@ -366,7 +367,7 @@ void tst_qsgflickable::returnToBounds() void tst_qsgflickable::wheel() { QSGView *canvas = new QSGView; - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/wheel.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("wheel.qml"))); canvas->show(); canvas->requestActivateWindow(); QVERIFY(canvas->rootObject() != 0); @@ -401,7 +402,7 @@ void tst_qsgflickable::wheel() void tst_qsgflickable::movingAndDragging() { QSGView *canvas = new QSGView; - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/flickable03.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("flickable03.qml"))); canvas->show(); canvas->requestActivateWindow(); QTest::qWaitForWindowShown(canvas); @@ -506,7 +507,7 @@ void tst_qsgflickable::movingAndDragging() void tst_qsgflickable::disabled() { QSGView *canvas = new QSGView; - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/disabled.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("disabled.qml"))); canvas->show(); canvas->requestActivateWindow(); QVERIFY(canvas->rootObject() != 0); @@ -538,7 +539,7 @@ void tst_qsgflickable::flickVelocity() #endif QSGView *canvas = new QSGView; - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/flickable03.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("flickable03.qml"))); canvas->show(); canvas->requestActivateWindow(); QVERIFY(canvas->rootObject() != 0); @@ -562,7 +563,7 @@ void tst_qsgflickable::flickVelocity() void tst_qsgflickable::margins() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/margins.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("margins.qml"))); QSGItem *root = qobject_cast<QSGItem*>(c.create()); QSGFlickable *obj = qobject_cast<QSGFlickable*>(root); QVERIFY(obj != 0); diff --git a/tests/auto/declarative/qsgflipable/qsgflipable.pro b/tests/auto/declarative/qsgflipable/qsgflipable.pro index 82816bf832..806aeb28e7 100644 --- a/tests/auto/declarative/qsgflipable/qsgflipable.pro +++ b/tests/auto/declarative/qsgflipable/qsgflipable.pro @@ -4,7 +4,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qsgflipable.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles CONFIG += parallel_test diff --git a/tests/auto/declarative/qsgflipable/tst_qsgflipable.cpp b/tests/auto/declarative/qsgflipable/tst_qsgflipable.cpp index 3d53f12095..2fc1924c9a 100644 --- a/tests/auto/declarative/qsgflipable/tst_qsgflipable.cpp +++ b/tests/auto/declarative/qsgflipable/tst_qsgflipable.cpp @@ -48,6 +48,7 @@ #include <private/qsgrectangle_p.h> #include <math.h> #include <QtOpenGL/QGLShaderProgram> +#include "../shared/util.h" class tst_qsgflipable : public QObject { @@ -85,7 +86,7 @@ void tst_qsgflipable::cleanupTestCase() void tst_qsgflipable::create() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-flipable.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("test-flipable.qml"))); QSGFlipable *obj = qobject_cast<QSGFlipable*>(c.create()); QVERIFY(obj != 0); @@ -95,7 +96,7 @@ void tst_qsgflipable::create() void tst_qsgflipable::checkFrontAndBack() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-flipable.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("test-flipable.qml"))); QSGFlipable *obj = qobject_cast<QSGFlipable*>(c.create()); QVERIFY(obj != 0); @@ -107,7 +108,7 @@ void tst_qsgflipable::checkFrontAndBack() void tst_qsgflipable::setFrontAndBack() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-flipable.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("test-flipable.qml"))); QSGFlipable *obj = qobject_cast<QSGFlipable*>(c.create()); QVERIFY(obj != 0); @@ -127,7 +128,7 @@ void tst_qsgflipable::setFrontAndBack() void tst_qsgflipable::QTBUG_9161_crash() { QSGView *canvas = new QSGView; - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/crash.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("crash.qml"))); QSGItem *root = canvas->rootObject(); QVERIFY(root != 0); canvas->show(); @@ -137,7 +138,7 @@ void tst_qsgflipable::QTBUG_9161_crash() void tst_qsgflipable::QTBUG_8474_qgv_abort() { QSGView *canvas = new QSGView; - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/flipable-abort.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("flipable-abort.qml"))); QSGItem *root = canvas->rootObject(); QVERIFY(root != 0); canvas->show(); diff --git a/tests/auto/declarative/qsgfocusscope/qsgfocusscope.pro b/tests/auto/declarative/qsgfocusscope/qsgfocusscope.pro index 279e11b0a9..0772829b2a 100644 --- a/tests/auto/declarative/qsgfocusscope/qsgfocusscope.pro +++ b/tests/auto/declarative/qsgfocusscope/qsgfocusscope.pro @@ -3,7 +3,9 @@ TARGET = tst_qsgfocusscope SOURCES += tst_qsgfocusscope.cpp macx:CONFIG -= app_bundle -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles QT += core-private gui-private declarative-private testlib diff --git a/tests/auto/declarative/qsgfocusscope/tst_qsgfocusscope.cpp b/tests/auto/declarative/qsgfocusscope/tst_qsgfocusscope.cpp index 32c23152fc..0d43d110af 100644 --- a/tests/auto/declarative/qsgfocusscope/tst_qsgfocusscope.cpp +++ b/tests/auto/declarative/qsgfocusscope/tst_qsgfocusscope.cpp @@ -47,8 +47,8 @@ #include <private/qsgtextedit_p.h> #include <private/qsgtext_p.h> #include <QtDeclarative/private/qsgfocusscope_p.h> +#include "../shared/util.h" #include "../../../shared/util.h" -#include <QtOpenGL/QGLShaderProgram> class tst_qsgfocusscope : public QObject { @@ -107,7 +107,7 @@ T *tst_qsgfocusscope::findItem(QSGItem *parent, const QString &objectName) void tst_qsgfocusscope::basic() { QSGView *view = new QSGView; - view->setSource(QUrl::fromLocalFile(SRCDIR "/data/test.qml")); + view->setSource(QUrl::fromLocalFile(TESTDATA("test.qml"))); QSGFocusScope *item0 = findItem<QSGFocusScope>(view->rootObject(), QLatin1String("item0")); QSGRectangle *item1 = findItem<QSGRectangle>(view->rootObject(), QLatin1String("item1")); @@ -149,7 +149,7 @@ void tst_qsgfocusscope::basic() void tst_qsgfocusscope::nested() { QSGView *view = new QSGView; - view->setSource(QUrl::fromLocalFile(SRCDIR "/data/test2.qml")); + view->setSource(QUrl::fromLocalFile(TESTDATA("test2.qml"))); QSGFocusScope *item1 = findItem<QSGFocusScope>(view->rootObject(), QLatin1String("item1")); QSGFocusScope *item2 = findItem<QSGFocusScope>(view->rootObject(), QLatin1String("item2")); @@ -178,7 +178,7 @@ void tst_qsgfocusscope::nested() void tst_qsgfocusscope::noFocus() { QSGView *view = new QSGView; - view->setSource(QUrl::fromLocalFile(SRCDIR "/data/test4.qml")); + view->setSource(QUrl::fromLocalFile(TESTDATA("test4.qml"))); QSGRectangle *item0 = findItem<QSGRectangle>(view->rootObject(), QLatin1String("item0")); QSGRectangle *item1 = findItem<QSGRectangle>(view->rootObject(), QLatin1String("item1")); @@ -216,7 +216,7 @@ void tst_qsgfocusscope::noFocus() void tst_qsgfocusscope::textEdit() { QSGView *view = new QSGView; - view->setSource(QUrl::fromLocalFile(SRCDIR "/data/test5.qml")); + view->setSource(QUrl::fromLocalFile(TESTDATA("test5.qml"))); QSGFocusScope *item0 = findItem<QSGFocusScope>(view->rootObject(), QLatin1String("item0")); QSGTextEdit *item1 = findItem<QSGTextEdit>(view->rootObject(), QLatin1String("item1")); @@ -266,7 +266,7 @@ void tst_qsgfocusscope::textEdit() void tst_qsgfocusscope::forceFocus() { QSGView *view = new QSGView; - view->setSource(QUrl::fromLocalFile(SRCDIR "/data/forcefocus.qml")); + view->setSource(QUrl::fromLocalFile(TESTDATA("forcefocus.qml"))); QSGFocusScope *item0 = findItem<QSGFocusScope>(view->rootObject(), QLatin1String("item0")); QSGRectangle *item1 = findItem<QSGRectangle>(view->rootObject(), QLatin1String("item1")); @@ -314,7 +314,7 @@ void tst_qsgfocusscope::forceFocus() void tst_qsgfocusscope::noParentFocus() { QSGView *view = new QSGView; - view->setSource(QUrl::fromLocalFile(SRCDIR "/data/chain.qml")); + view->setSource(QUrl::fromLocalFile(TESTDATA("chain.qml"))); QVERIFY(view->rootObject()); view->show(); @@ -338,7 +338,7 @@ void tst_qsgfocusscope::noParentFocus() void tst_qsgfocusscope::signalEmission() { QSGView *view = new QSGView; - view->setSource(QUrl::fromLocalFile(SRCDIR "/data/signalEmission.qml")); + view->setSource(QUrl::fromLocalFile(TESTDATA("signalEmission.qml"))); QSGRectangle *item1 = findItem<QSGRectangle>(view->rootObject(), QLatin1String("item1")); QSGRectangle *item2 = findItem<QSGRectangle>(view->rootObject(), QLatin1String("item2")); @@ -393,7 +393,7 @@ void tst_qsgfocusscope::signalEmission() void tst_qsgfocusscope::qtBug13380() { QSGView *view = new QSGView; - view->setSource(QUrl::fromLocalFile(SRCDIR "/data/qtBug13380.qml")); + view->setSource(QUrl::fromLocalFile(TESTDATA("qtBug13380.qml"))); view->show(); QVERIFY(view->rootObject()); @@ -414,7 +414,7 @@ void tst_qsgfocusscope::qtBug13380() void tst_qsgfocusscope::forceActiveFocus() { QSGView *view = new QSGView; - view->setSource(QUrl::fromLocalFile(SRCDIR "/data/forceActiveFocus.qml")); + view->setSource(QUrl::fromLocalFile(TESTDATA("forceActiveFocus.qml"))); view->show(); view->requestActivateWindow(); @@ -532,7 +532,7 @@ void tst_qsgfocusscope::forceActiveFocus() void tst_qsgfocusscope::canvasFocus() { QSGView *view = new QSGView; - view->setSource(QUrl::fromLocalFile(SRCDIR "/data/canvasFocus.qml")); + view->setSource(QUrl::fromLocalFile(TESTDATA("canvasFocus.qml"))); QSGItem *rootObject = view->rootObject(); QVERIFY(rootObject); diff --git a/tests/auto/declarative/qsggridview/qsggridview.pro b/tests/auto/declarative/qsggridview/qsggridview.pro index 182b553e22..6588472779 100644 --- a/tests/auto/declarative/qsggridview/qsggridview.pro +++ b/tests/auto/declarative/qsggridview/qsggridview.pro @@ -4,7 +4,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qsggridview.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles CONFIG += parallel_test #temporary diff --git a/tests/auto/declarative/qsggridview/tst_qsggridview.cpp b/tests/auto/declarative/qsggridview/tst_qsggridview.cpp index 5fa407889a..42bd6193bd 100644 --- a/tests/auto/declarative/qsggridview/tst_qsggridview.cpp +++ b/tests/auto/declarative/qsggridview/tst_qsggridview.cpp @@ -51,8 +51,8 @@ #include <QtDeclarative/private/qsggridview_p.h> #include <QtDeclarative/private/qsgtext_p.h> #include <QtDeclarative/private/qdeclarativelistmodel_p.h> +#include "../shared/util.h" #include "../../../shared/util.h" -#include <QtOpenGL/QGLShaderProgram> #include <QtGui/qguiapplication.h> Q_DECLARE_METATYPE(Qt::LayoutDirection) @@ -267,7 +267,7 @@ void tst_QSGGridView::items() ctxt->setContextProperty("testRightToLeft", QVariant(false)); ctxt->setContextProperty("testTopToBottom", QVariant(false)); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview1.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("gridview1.qml"))); qApp->processEvents(); QSGGridView *gridview = findItem<QSGGridView>(canvas->rootObject(), "grid"); @@ -317,7 +317,7 @@ void tst_QSGGridView::changed() ctxt->setContextProperty("testRightToLeft", QVariant(false)); ctxt->setContextProperty("testTopToBottom", QVariant(false)); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview1.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("gridview1.qml"))); qApp->processEvents(); QSGFlickable *gridview = findItem<QSGFlickable>(canvas->rootObject(), "grid"); @@ -352,7 +352,7 @@ void tst_QSGGridView::inserted() ctxt->setContextProperty("testRightToLeft", QVariant(false)); ctxt->setContextProperty("testTopToBottom", QVariant(false)); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview1.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("gridview1.qml"))); qApp->processEvents(); QSGGridView *gridview = findItem<QSGGridView>(canvas->rootObject(), "grid"); @@ -431,7 +431,7 @@ void tst_QSGGridView::removed() ctxt->setContextProperty("testRightToLeft", QVariant(false)); ctxt->setContextProperty("testTopToBottom", QVariant(false)); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview1.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("gridview1.qml"))); qApp->processEvents(); QSGGridView *gridview = findItem<QSGGridView>(canvas->rootObject(), "grid"); @@ -576,7 +576,7 @@ void tst_QSGGridView::clear() ctxt->setContextProperty("testRightToLeft", QVariant(false)); ctxt->setContextProperty("testTopToBottom", QVariant(false)); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview1.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("gridview1.qml"))); qApp->processEvents(); QSGGridView *gridview = findItem<QSGGridView>(canvas->rootObject(), "grid"); @@ -623,7 +623,7 @@ void tst_QSGGridView::moved() ctxt->setContextProperty("testRightToLeft", QVariant(false)); ctxt->setContextProperty("testTopToBottom", QVariant(false)); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview1.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("gridview1.qml"))); qApp->processEvents(); QSGGridView *gridview = findItem<QSGGridView>(canvas->rootObject(), "grid"); @@ -825,7 +825,7 @@ void tst_QSGGridView::multipleChanges() ctxt->setContextProperty("testRightToLeft", QVariant(false)); ctxt->setContextProperty("testTopToBottom", QVariant(false)); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview1.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("gridview1.qml"))); qApp->processEvents(); QSGGridView *gridview = findItem<QSGGridView>(canvas->rootObject(), "grid"); @@ -1042,7 +1042,7 @@ void tst_QSGGridView::swapWithFirstItem() ctxt->setContextProperty("testRightToLeft", QVariant(false)); ctxt->setContextProperty("testTopToBottom", QVariant(false)); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview1.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("gridview1.qml"))); qApp->processEvents(); QSGGridView *gridview = findItem<QSGGridView>(canvas->rootObject(), "grid"); @@ -1069,7 +1069,7 @@ void tst_QSGGridView::currentIndex() QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); - QString filename(SRCDIR "/data/gridview-initCurrent.qml"); + QString filename(TESTDATA("gridview-initCurrent.qml")); canvas->setSource(QUrl::fromLocalFile(filename)); qApp->processEvents(); @@ -1310,7 +1310,7 @@ void tst_QSGGridView::noCurrentIndex() QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); - QString filename(SRCDIR "/data/gridview-noCurrent.qml"); + QString filename(TESTDATA("gridview-noCurrent.qml")); canvas->setSource(QUrl::fromLocalFile(filename)); qApp->processEvents(); @@ -1348,7 +1348,7 @@ void tst_QSGGridView::changeFlow() ctxt->setContextProperty("testRightToLeft", QVariant(false)); ctxt->setContextProperty("testTopToBottom", QVariant(false)); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview1.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("gridview1.qml"))); qApp->processEvents(); QSGGridView *gridview = findItem<QSGGridView>(canvas->rootObject(), "grid"); @@ -1435,7 +1435,7 @@ void tst_QSGGridView::changeFlow() void tst_QSGGridView::defaultValues() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/gridview3.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("gridview3.qml"))); QSGGridView *obj = qobject_cast<QSGGridView*>(c.create()); QTRY_VERIFY(obj != 0); @@ -1458,7 +1458,7 @@ void tst_QSGGridView::defaultValues() void tst_QSGGridView::properties() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/gridview2.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("gridview2.qml"))); QSGGridView *obj = qobject_cast<QSGGridView*>(c.create()); QTRY_VERIFY(obj != 0); @@ -1482,7 +1482,7 @@ void tst_QSGGridView::propertyChanges() { QSGView *canvas = createView(); QTRY_VERIFY(canvas); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychangestest.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("propertychangestest.qml"))); QSGGridView *gridView = canvas->rootObject()->findChild<QSGGridView*>("gridView"); QTRY_VERIFY(gridView); @@ -1555,7 +1555,7 @@ void tst_QSGGridView::componentChanges() { QSGView *canvas = createView(); QTRY_VERIFY(canvas); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychangestest.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("propertychangestest.qml"))); QSGGridView *gridView = canvas->rootObject()->findChild<QSGGridView*>("gridView"); QTRY_VERIFY(gridView); @@ -1603,7 +1603,7 @@ void tst_QSGGridView::modelChanges() { QSGView *canvas = createView(); QTRY_VERIFY(canvas); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychangestest.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("propertychangestest.qml"))); QSGGridView *gridView = canvas->rootObject()->findChild<QSGGridView*>("gridView"); QTRY_VERIFY(gridView); @@ -1638,7 +1638,7 @@ void tst_QSGGridView::positionViewAtIndex() ctxt->setContextProperty("testRightToLeft", QVariant(false)); ctxt->setContextProperty("testTopToBottom", QVariant(false)); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview1.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("gridview1.qml"))); qApp->processEvents(); QSGGridView *gridview = findItem<QSGGridView>(canvas->rootObject(), "grid"); @@ -1839,7 +1839,7 @@ void tst_QSGGridView::snapping() ctxt->setContextProperty("testTopToBottom", QVariant(false)); ctxt->setContextProperty("testRightToLeft", QVariant(false)); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview1.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("gridview1.qml"))); qApp->processEvents(); QSGGridView *gridview = findItem<QSGGridView>(canvas->rootObject(), "grid"); @@ -1870,12 +1870,12 @@ void tst_QSGGridView::snapping() void tst_QSGGridView::mirroring() { QSGView *canvasA = createView(); - canvasA->setSource(QUrl::fromLocalFile(SRCDIR "/data/mirroring.qml")); + canvasA->setSource(QUrl::fromLocalFile(TESTDATA("mirroring.qml"))); QSGGridView *gridviewA = findItem<QSGGridView>(canvasA->rootObject(), "view"); QTRY_VERIFY(gridviewA != 0); QSGView *canvasB = createView(); - canvasB->setSource(QUrl::fromLocalFile(SRCDIR "/data/mirroring.qml")); + canvasB->setSource(QUrl::fromLocalFile(TESTDATA("mirroring.qml"))); QSGGridView *gridviewB = findItem<QSGGridView>(canvasB->rootObject(), "view"); QTRY_VERIFY(gridviewA != 0); qApp->processEvents(); @@ -1941,7 +1941,7 @@ void tst_QSGGridView::positionViewAtIndex_rightToLeft() ctxt->setContextProperty("testTopToBottom", QVariant(true)); ctxt->setContextProperty("testRightToLeft", QVariant(true)); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview1.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("gridview1.qml"))); qApp->processEvents(); QSGGridView *gridview = findItem<QSGGridView>(canvas->rootObject(), "grid"); @@ -2071,7 +2071,7 @@ void tst_QSGGridView::resetModel() QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/displaygrid.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("displaygrid.qml"))); qApp->processEvents(); QSGGridView *gridview = findItem<QSGGridView>(canvas->rootObject(), "grid"); @@ -2116,7 +2116,7 @@ void tst_QSGGridView::enforceRange() ctxt->setContextProperty("testRightToLeft", QVariant(false)); ctxt->setContextProperty("testTopToBottom", QVariant(false)); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview-enforcerange.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("gridview-enforcerange.qml"))); qApp->processEvents(); QVERIFY(canvas->rootObject() != 0); @@ -2172,7 +2172,7 @@ void tst_QSGGridView::enforceRange_rightToLeft() ctxt->setContextProperty("testRightToLeft", QVariant(true)); ctxt->setContextProperty("testTopToBottom", QVariant(true)); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview-enforcerange.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("gridview-enforcerange.qml"))); qApp->processEvents(); QVERIFY(canvas->rootObject() != 0); @@ -2221,7 +2221,7 @@ void tst_QSGGridView::QTBUG_8456() { QSGView *canvas = createView(); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/setindex.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("setindex.qml"))); qApp->processEvents(); QSGGridView *gridview = findItem<QSGGridView>(canvas->rootObject(), "grid"); @@ -2236,7 +2236,7 @@ void tst_QSGGridView::manualHighlight() { QSGView *canvas = createView(); - QString filename(SRCDIR "/data/manual-highlight.qml"); + QString filename(TESTDATA("manual-highlight.qml")); canvas->setSource(QUrl::fromLocalFile(filename)); qApp->processEvents(); @@ -2300,7 +2300,7 @@ void tst_QSGGridView::footer() QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/footer.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("footer.qml"))); qApp->processEvents(); QSGGridView *gridview = findItem<QSGGridView>(canvas->rootObject(), "grid"); @@ -2459,7 +2459,7 @@ void tst_QSGGridView::header() canvas->rootContext()->setContextProperty("testModel", &model); canvas->rootContext()->setContextProperty("initialViewWidth", 240); canvas->rootContext()->setContextProperty("initialViewHeight", 320); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/header.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("header.qml"))); QSGGridView *gridview = findItem<QSGGridView>(canvas->rootObject(), "grid"); QTRY_VERIFY(gridview != 0); @@ -2523,7 +2523,7 @@ void tst_QSGGridView::header() canvas->rootContext()->setContextProperty("testModel", &model); canvas->rootContext()->setContextProperty("initialViewWidth", 240); canvas->rootContext()->setContextProperty("initialViewHeight", 320); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/header.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("header.qml"))); gridview = findItem<QSGGridView>(canvas->rootObject(), "grid"); QTRY_VERIFY(gridview != 0); @@ -2609,7 +2609,7 @@ void tst_QSGGridView::indexAt() ctxt->setContextProperty("testRightToLeft", QVariant(false)); ctxt->setContextProperty("testTopToBottom", QVariant(false)); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview1.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("gridview1.qml"))); qApp->processEvents(); QSGGridView *gridview = findItem<QSGGridView>(canvas->rootObject(), "grid"); @@ -2648,7 +2648,7 @@ void tst_QSGGridView::onAdd() ctxt->setContextProperty("testModel", &model); ctxt->setContextProperty("delegateWidth", delegateWidth); ctxt->setContextProperty("delegateHeight", delegateHeight); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/attachedSignals.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("attachedSignals.qml"))); QObject *object = canvas->rootObject(); object->setProperty("width", canvas->width()); @@ -2706,7 +2706,7 @@ void tst_QSGGridView::onRemove() ctxt->setContextProperty("testModel", &model); ctxt->setContextProperty("delegateWidth", delegateWidth); ctxt->setContextProperty("delegateHeight", delegateHeight); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/attachedSignals.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("attachedSignals.qml"))); QObject *object = canvas->rootObject(); model.removeItems(indexToRemove, removeCount); @@ -2781,7 +2781,7 @@ void tst_QSGGridView::testQtQuick11Attributes_data() void tst_QSGGridView::columnCount() { QSGView canvas; - canvas.setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview4.qml")); + canvas.setSource(QUrl::fromLocalFile(TESTDATA("gridview4.qml"))); canvas.show(); canvas.requestActivateWindow(); QTest::qWaitForWindowShown(&canvas); @@ -2811,7 +2811,7 @@ void tst_QSGGridView::margins() ctxt->setContextProperty("testModel", &model); ctxt->setContextProperty("testRightToLeft", QVariant(false)); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/margins.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("margins.qml"))); qApp->processEvents(); QSGGridView *gridview = findItem<QSGGridView>(canvas->rootObject(), "grid"); @@ -2874,7 +2874,7 @@ void tst_QSGGridView::margins() ctxt->setContextProperty("testModel", &model); ctxt->setContextProperty("testRightToLeft", QVariant(true)); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/margins.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("margins.qml"))); qApp->processEvents(); QSGGridView *gridview = findItem<QSGGridView>(canvas->rootObject(), "grid"); @@ -2931,7 +2931,7 @@ void tst_QSGGridView::creationContext() { QSGView canvas; canvas.setGeometry(0,0,240,320); - canvas.setSource(QUrl::fromLocalFile(SRCDIR "/data/creationContext.qml")); + canvas.setSource(QUrl::fromLocalFile(TESTDATA("creationContext.qml"))); qApp->processEvents(); QSGItem *rootItem = qobject_cast<QSGItem *>(canvas.rootObject()); diff --git a/tests/auto/declarative/qsgimage/qsgimage.pro b/tests/auto/declarative/qsgimage/qsgimage.pro index 4127fe48be..b1ca1dbbf6 100644 --- a/tests/auto/declarative/qsgimage/qsgimage.pro +++ b/tests/auto/declarative/qsgimage/qsgimage.pro @@ -5,7 +5,9 @@ macx:CONFIG -= app_bundle HEADERS += ../shared/testhttpserver.h SOURCES += tst_qsgimage.cpp ../shared/testhttpserver.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles CONFIG += parallel_test #temporary diff --git a/tests/auto/declarative/qsgimage/tst_qsgimage.cpp b/tests/auto/declarative/qsgimage/tst_qsgimage.cpp index 181ad0e71e..81f00e8aa4 100644 --- a/tests/auto/declarative/qsgimage/tst_qsgimage.cpp +++ b/tests/auto/declarative/qsgimage/tst_qsgimage.cpp @@ -56,6 +56,7 @@ #include <QtGui/QPainter> #include <QtGui/QImageReader> +#include "../shared/util.h" #include "../../../shared/util.h" #include "../shared/testhttpserver.h" @@ -127,13 +128,13 @@ void tst_qsgimage::imageSource_data() QTest::addColumn<bool>("cache"); QTest::addColumn<QString>("error"); - QTest::newRow("local") << QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() << 120.0 << 120.0 << false << false << true << ""; - QTest::newRow("local no cache") << QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() << 120.0 << 120.0 << false << false << false << ""; - QTest::newRow("local async") << QUrl::fromLocalFile(SRCDIR "/data/colors1.png").toString() << 120.0 << 120.0 << false << true << true << ""; - QTest::newRow("local not found") << QUrl::fromLocalFile(SRCDIR "/data/no-such-file.png").toString() << 0.0 << 0.0 << false - << false << true << "file::2:1: QML Image: Cannot open: " + QUrl::fromLocalFile(SRCDIR "/data/no-such-file.png").toString(); - QTest::newRow("local async not found") << QUrl::fromLocalFile(SRCDIR "/data/no-such-file-1.png").toString() << 0.0 << 0.0 << false - << true << true << "file::2:1: QML Image: Cannot open: " + QUrl::fromLocalFile(SRCDIR "/data/no-such-file-1.png").toString(); + QTest::newRow("local") << QUrl::fromLocalFile(TESTDATA("colors.png")).toString() << 120.0 << 120.0 << false << false << true << ""; + QTest::newRow("local no cache") << QUrl::fromLocalFile(TESTDATA("colors.png")).toString() << 120.0 << 120.0 << false << false << false << ""; + QTest::newRow("local async") << QUrl::fromLocalFile(TESTDATA("colors1.png")).toString() << 120.0 << 120.0 << false << true << true << ""; + QTest::newRow("local not found") << QUrl::fromLocalFile(TESTDATA("no-such-file.png")).toString() << 0.0 << 0.0 << false + << false << true << "file::2:1: QML Image: Cannot open: " + QUrl::fromLocalFile(TESTDATA("no-such-file.png")).toString(); + QTest::newRow("local async not found") << QUrl::fromLocalFile(TESTDATA("no-such-file-1.png")).toString() << 0.0 << 0.0 << false + << true << true << "file::2:1: QML Image: Cannot open: " + QUrl::fromLocalFile(TESTDATA("no-such-file-1.png")).toString(); QTest::newRow("remote") << SERVER_ADDR "/colors.png" << 120.0 << 120.0 << true << false << true << ""; QTest::newRow("remote redirected") << SERVER_ADDR "/oldcolors.png" << 120.0 << 120.0 << true << false << false << ""; if (QImageReader::supportedImageFormats().contains("svg")) @@ -157,7 +158,7 @@ void tst_qsgimage::imageSource() TestHTTPServer server(SERVER_PORT); if (remote) { QVERIFY(server.isValid()); - server.serveDirectory(SRCDIR "/data"); + server.serveDirectory(TESTDATA("")); server.addRedirect("oldcolors.png", SERVER_ADDR "/colors.png"); } @@ -204,7 +205,7 @@ void tst_qsgimage::clearSource() { QString componentStr = "import QtQuick 2.0\nImage { source: srcImage }"; QDeclarativeContext *ctxt = engine.rootContext(); - ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/colors.png")); + ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(TESTDATA("colors.png"))); QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QSGImage *obj = qobject_cast<QSGImage*>(component.create()); @@ -226,7 +227,7 @@ void tst_qsgimage::clearSource() void tst_qsgimage::resized() { - QString componentStr = "import QtQuick 2.0\nImage { source: \"" SRCDIR "/data/colors.png\"; width: 300; height: 300 }"; + QString componentStr = "import QtQuick 2.0\nImage { source: \"" + TESTDATA("colors.png") + "\"; width: 300; height: 300 }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QSGImage *obj = qobject_cast<QSGImage*>(component.create()); @@ -243,14 +244,14 @@ void tst_qsgimage::preserveAspectRatio() QSGView *canvas = new QSGView(0); canvas->show(); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/aspectratio.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("aspectratio.qml"))); QSGImage *image = qobject_cast<QSGImage*>(canvas->rootObject()); QVERIFY(image != 0); image->setWidth(80.0); QCOMPARE(image->width(), 80.); QCOMPARE(image->height(), 80.); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/aspectratio.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("aspectratio.qml"))); image = qobject_cast<QSGImage*>(canvas->rootObject()); image->setHeight(60.0); QVERIFY(image != 0); @@ -261,7 +262,7 @@ void tst_qsgimage::preserveAspectRatio() void tst_qsgimage::smooth() { - QString componentStr = "import QtQuick 2.0\nImage { source: \"" SRCDIR "/data/colors.png\"; smooth: true; width: 300; height: 300 }"; + QString componentStr = "import QtQuick 2.0\nImage { source: \"" + TESTDATA("colors.png") + "\"; smooth: true; width: 300; height: 300 }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QSGImage *obj = qobject_cast<QSGImage*>(component.create()); @@ -286,7 +287,7 @@ void tst_qsgimage::mirror() foreach (QSGImage::FillMode fillMode, fillModes) { QSGView *canvas = new QSGView; - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/mirror.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("mirror.qml"))); QSGImage *obj = canvas->rootObject()->findChild<QSGImage*>("image"); QVERIFY(obj != 0); @@ -302,7 +303,7 @@ void tst_qsgimage::mirror() foreach (QSGImage::FillMode fillMode, fillModes) { QPixmap srcPixmap; - QVERIFY(srcPixmap.load(SRCDIR "/data/pattern.png")); + QVERIFY(srcPixmap.load(TESTDATA("pattern.png"))); QPixmap expected(width, height); expected.fill(); @@ -354,7 +355,7 @@ void tst_qsgimage::svg() if (!QImageReader::supportedImageFormats().contains("svg")) QSKIP("svg support not available", SkipAll); - QString src = QUrl::fromLocalFile(SRCDIR "/data/heart.svg").toString(); + QString src = QUrl::fromLocalFile(TESTDATA("heart.svg")).toString(); QString componentStr = "import QtQuick 2.0\nImage { source: \"" + src + "\"; sourceSize.width: 300; sourceSize.height: 300 }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); @@ -418,7 +419,7 @@ void tst_qsgimage::geometry() QFETCH(double, boundingWidth); QFETCH(double, boundingHeight); - QString src = QUrl::fromLocalFile(SRCDIR "/data/rect.png").toString(); + QString src = QUrl::fromLocalFile(TESTDATA("rect.png")).toString(); QString componentStr = "import QtQuick 2.0\nImage { source: \"" + src + "\"; fillMode: Image." + fillMode + "; "; if (explicitWidth) @@ -446,7 +447,7 @@ void tst_qsgimage::big() // If the JPEG loader does not implement scaling efficiently, it would // have to build a 400 MB image. That would be a bug in the JPEG loader. - QString src = QUrl::fromLocalFile(SRCDIR "/data/big.jpeg").toString(); + QString src = QUrl::fromLocalFile(TESTDATA("big.jpeg")).toString(); QString componentStr = "import QtQuick 2.0\nImage { source: \"" + src + "\"; width: 100; sourceSize.height: 256 }"; QDeclarativeComponent component(&engine); @@ -464,7 +465,7 @@ void tst_qsgimage::tiling_QTBUG_6716() QFETCH(QString, source); QSGView *canvas = new QSGView(0); - canvas->setSource(QUrl::fromLocalFile(SRCDIR + source)); + canvas->setSource(QUrl::fromLocalFile(TESTDATA(source))); canvas->show(); qApp->processEvents(); @@ -487,21 +488,21 @@ void tst_qsgimage::tiling_QTBUG_6716_data() { QTest::addColumn<QString>("source"); #ifdef QT_BUILD_INTERNAL // QTBUG-21688 - unstable test on developer build - QTest::newRow("vertical_tiling") << "/data/vtiling.qml"; + QTest::newRow("vertical_tiling") << "vtiling.qml"; #endif - QTest::newRow("horizontal_tiling") << "/data/htiling.qml"; + QTest::newRow("horizontal_tiling") << "htiling.qml"; } void tst_qsgimage::noLoading() { TestHTTPServer server(SERVER_PORT); QVERIFY(server.isValid()); - server.serveDirectory(SRCDIR "/data"); + server.serveDirectory(TESTDATA("")); server.addRedirect("oldcolors.png", SERVER_ADDR "/colors.png"); QString componentStr = "import QtQuick 2.0\nImage { source: srcImage; cache: true }"; QDeclarativeContext *ctxt = engine.rootContext(); - ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/heart.png")); + ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(TESTDATA("heart.png"))); QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QSGImage *obj = qobject_cast<QSGImage*>(component.create()); @@ -513,7 +514,7 @@ void tst_qsgimage::noLoading() QSignalSpy statusSpy(obj, SIGNAL(statusChanged(QSGImageBase::Status))); // Loading local file - ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/green.png")); + ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(TESTDATA("green.png"))); QTRY_VERIFY(obj->status() == QSGImage::Ready); QTRY_VERIFY(obj->progress() == 1.0); QTRY_COMPARE(sourceSpy.count(), 1); @@ -531,7 +532,7 @@ void tst_qsgimage::noLoading() QTRY_COMPARE(statusSpy.count(), 2); // Loading remote file again - should not go through 'Loading' state. - ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/green.png")); + ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(TESTDATA("green.png"))); ctxt->setContextProperty("srcImage", QString(SERVER_ADDR) + "/rect.png"); QTRY_VERIFY(obj->status() == QSGImage::Ready); QTRY_VERIFY(obj->progress() == 1.0); @@ -545,7 +546,7 @@ void tst_qsgimage::noLoading() void tst_qsgimage::paintedWidthHeight() { { - QString src = QUrl::fromLocalFile(SRCDIR "/data/heart.png").toString(); + QString src = QUrl::fromLocalFile(TESTDATA("heart.png")).toString(); QString componentStr = "import QtQuick 2.0\nImage { source: \"" + src + "\"; width: 200; height: 25; fillMode: Image.PreserveAspectFit }"; QDeclarativeComponent component(&engine); @@ -561,7 +562,7 @@ void tst_qsgimage::paintedWidthHeight() } { - QString src = QUrl::fromLocalFile(SRCDIR "/data/heart.png").toString(); + QString src = QUrl::fromLocalFile(TESTDATA("heart.png")).toString(); QString componentStr = "import QtQuick 2.0\nImage { source: \"" + src + "\"; width: 26; height: 175; fillMode: Image.PreserveAspectFit }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); @@ -580,7 +581,7 @@ void tst_qsgimage::sourceSize_QTBUG_14303() { QString componentStr = "import QtQuick 2.0\nImage { source: srcImage }"; QDeclarativeContext *ctxt = engine.rootContext(); - ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/heart200.png")); + ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(TESTDATA("heart200.png"))); QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QSGImage *obj = qobject_cast<QSGImage*>(component.create()); @@ -594,12 +595,12 @@ void tst_qsgimage::sourceSize_QTBUG_14303() QTRY_COMPARE(obj->sourceSize().height(), 200); QTRY_COMPARE(sourceSizeSpy.count(), 0); - ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/colors.png")); + ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(TESTDATA("colors.png"))); QTRY_COMPARE(obj->sourceSize().width(), 120); QTRY_COMPARE(obj->sourceSize().height(), 120); QTRY_COMPARE(sourceSizeSpy.count(), 1); - ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/heart200.png")); + ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(TESTDATA("heart200.png"))); QTRY_COMPARE(obj->sourceSize().width(), 200); QTRY_COMPARE(obj->sourceSize().height(), 200); QTRY_COMPARE(sourceSizeSpy.count(), 2); @@ -610,7 +611,7 @@ void tst_qsgimage::sourceSize_QTBUG_14303() void tst_qsgimage::sourceSize_QTBUG_16389() { QSGView *canvas = new QSGView(0); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/qtbug_16389.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("qtbug_16389.qml"))); canvas->show(); qApp->processEvents(); @@ -641,7 +642,7 @@ static void checkWarnings(QtMsgType, const char *msg) void tst_qsgimage::nullPixmapPaint() { QSGView *canvas = new QSGView(0); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/nullpixmap.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("nullpixmap.qml"))); canvas->show(); QSGImage *image = qobject_cast<QSGImage*>(canvas->rootObject()); diff --git a/tests/auto/declarative/qsgitem2/qsgitem.pro b/tests/auto/declarative/qsgitem2/qsgitem.pro index dd7fc38c48..517e67619b 100644 --- a/tests/auto/declarative/qsgitem2/qsgitem.pro +++ b/tests/auto/declarative/qsgitem2/qsgitem.pro @@ -4,7 +4,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qsgitem.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles CONFIG += parallel_test diff --git a/tests/auto/declarative/qsgitem2/tst_qsgitem.cpp b/tests/auto/declarative/qsgitem2/tst_qsgitem.cpp index c4b25a43fe..bd437dff41 100644 --- a/tests/auto/declarative/qsgitem2/tst_qsgitem.cpp +++ b/tests/auto/declarative/qsgitem2/tst_qsgitem.cpp @@ -46,6 +46,7 @@ #include <QtDeclarative/qsgview.h> #include <private/qsgrectangle_p.h> #include <private/qsgitem_p.h> +#include "../shared/util.h" #include "../../../shared/util.h" class tst_QSGItem : public QObject @@ -211,7 +212,7 @@ void tst_QSGItem::keys() canvas->rootContext()->setContextProperty("enableKeyHanding", QVariant(true)); canvas->rootContext()->setContextProperty("forwardeeVisible", QVariant(true)); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/keystest.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("keystest.qml"))); canvas->show(); qApp->processEvents(); @@ -332,7 +333,7 @@ void tst_QSGItem::keysProcessingOrder() KeysTestObject *testObject = new KeysTestObject; canvas->rootContext()->setContextProperty("keysTestObject", testObject); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/keyspriority.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("keyspriority.qml"))); canvas->show(); qApp->processEvents(); @@ -403,7 +404,7 @@ bool anchorsMirrored(QSGItem *rootItem, const char * itemString) void tst_QSGItem::layoutMirroring() { QSGView *canvas = new QSGView(0); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/layoutmirroring.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("layoutmirroring.qml"))); canvas->show(); QSGItem *rootItem = qobject_cast<QSGItem*>(canvas->rootObject()); @@ -544,7 +545,7 @@ void tst_QSGItem::keyNavigation() QSGView *canvas = new QSGView(0); canvas->setFixedSize(240,320); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/keynavigationtest.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("keynavigationtest.qml"))); canvas->show(); qApp->processEvents(); @@ -624,7 +625,7 @@ void tst_QSGItem::keyNavigation_RightToLeft() QSGView *canvas = new QSGView(0); canvas->setFixedSize(240,320); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/keynavigationtest.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("keynavigationtest.qml"))); canvas->show(); qApp->processEvents(); @@ -677,7 +678,7 @@ void tst_QSGItem::keyNavigation_skipNotVisible() QSGView *canvas = new QSGView(0); canvas->setFixedSize(240,320); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/keynavigationtest.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("keynavigationtest.qml"))); canvas->show(); qApp->processEvents(); @@ -755,7 +756,7 @@ void tst_QSGItem::keyNavigation_implicitSetting() QSGView *canvas = new QSGView(0); canvas->setFixedSize(240,320); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/keynavigationtest_implicit.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("keynavigationtest_implicit.qml"))); canvas->show(); qApp->processEvents(); @@ -941,7 +942,7 @@ void tst_QSGItem::mapCoordinates() QSGView *canvas = new QSGView(0); canvas->setFixedSize(300, 300); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/mapCoordinates.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("mapCoordinates.qml"))); canvas->show(); qApp->processEvents(); @@ -970,8 +971,8 @@ void tst_QSGItem::mapCoordinates() Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, x), Q_ARG(QVariant, y))); QCOMPARE(result.value<QPointF>(), qobject_cast<QSGItem*>(a)->mapFromScene(QPointF(x, y))); - QString warning1 = QUrl::fromLocalFile(SRCDIR "/data/mapCoordinates.qml").toString() + ":7:5: QML Item: mapToItem() given argument \"1122\" which is neither null nor an Item"; - QString warning2 = QUrl::fromLocalFile(SRCDIR "/data/mapCoordinates.qml").toString() + ":7:5: QML Item: mapFromItem() given argument \"1122\" which is neither null nor an Item"; + QString warning1 = QUrl::fromLocalFile(TESTDATA("mapCoordinates.qml")).toString() + ":7:5: QML Item: mapToItem() given argument \"1122\" which is neither null nor an Item"; + QString warning2 = QUrl::fromLocalFile(TESTDATA("mapCoordinates.qml")).toString() + ":7:5: QML Item: mapFromItem() given argument \"1122\" which is neither null nor an Item"; QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1)); QVERIFY(QMetaObject::invokeMethod(root, "checkMapAToInvalid", @@ -1022,7 +1023,7 @@ void tst_QSGItem::transforms() void tst_QSGItem::childrenProperty() { - QDeclarativeComponent component(&engine, SRCDIR "/data/childrenProperty.qml"); + QDeclarativeComponent component(&engine, TESTDATA("childrenProperty.qml")); QObject *o = component.create(); QVERIFY(o != 0); @@ -1037,7 +1038,7 @@ void tst_QSGItem::childrenProperty() void tst_QSGItem::resourcesProperty() { - QDeclarativeComponent component(&engine, SRCDIR "/data/resourcesProperty.qml"); + QDeclarativeComponent component(&engine, TESTDATA("resourcesProperty.qml")); QObject *o = component.create(); QVERIFY(o != 0); @@ -1054,7 +1055,7 @@ void tst_QSGItem::propertyChanges() { QSGView *canvas = new QSGView(0); canvas->setFixedSize(240,320); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("propertychanges.qml"))); canvas->show(); QApplication::setActiveWindow(canvas); @@ -1137,7 +1138,7 @@ void tst_QSGItem::childrenRect() { QSGView *canvas = new QSGView(0); canvas->setFixedSize(240,320); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/childrenRect.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("childrenRect.qml"))); canvas->show(); QSGItem *o = canvas->rootObject(); @@ -1165,7 +1166,7 @@ void tst_QSGItem::childrenRect() void tst_QSGItem::childrenRectBug() { QSGView *canvas = new QSGView(0); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/childrenRectBug.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("childrenRectBug.qml"))); canvas->show(); QSGItem *o = canvas->rootObject(); @@ -1181,7 +1182,7 @@ void tst_QSGItem::childrenRectBug() void tst_QSGItem::childrenRectBug2() { QSGView *canvas = new QSGView(0); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/childrenRectBug2.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("childrenRectBug2.qml"))); canvas->show(); QSGRectangle *rect = qobject_cast<QSGRectangle*>(canvas->rootObject()); @@ -1204,7 +1205,7 @@ void tst_QSGItem::childrenRectBug2() void tst_QSGItem::childrenRectBug3() { QSGView *canvas = new QSGView(0); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/childrenRectBug3.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("childrenRectBug3.qml"))); canvas->show(); //don't crash on delete @@ -1215,7 +1216,7 @@ void tst_QSGItem::childrenRectBug3() void tst_QSGItem::transformCrash() { QSGView *canvas = new QSGView(0); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/transformCrash.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("transformCrash.qml"))); canvas->show(); delete canvas; @@ -1224,7 +1225,7 @@ void tst_QSGItem::transformCrash() void tst_QSGItem::implicitSize() { QSGView *canvas = new QSGView(0); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/implicitsize.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("implicitsize.qml"))); canvas->show(); QSGItem *item = qobject_cast<QSGItem*>(canvas->rootObject()); @@ -1252,7 +1253,7 @@ void tst_QSGItem::implicitSize() void tst_QSGItem::qtbug_16871() { - QDeclarativeComponent component(&engine, SRCDIR "/data/qtbug_16871.qml"); + QDeclarativeComponent component(&engine, TESTDATA("qtbug_16871.qml")); QObject *o = component.create(); QVERIFY(o != 0); delete o; diff --git a/tests/auto/declarative/qsglistview/qsglistview.pro b/tests/auto/declarative/qsglistview/qsglistview.pro index 3c19a8d88f..3322f30dd9 100644 --- a/tests/auto/declarative/qsglistview/qsglistview.pro +++ b/tests/auto/declarative/qsglistview/qsglistview.pro @@ -5,7 +5,9 @@ macx:CONFIG -= app_bundle HEADERS += incrementalmodel.h SOURCES += tst_qsglistview.cpp incrementalmodel.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles CONFIG += insignificant_test parallel_test QT += core-private gui-private declarative-private widgets widgets-private v8-private opengl-private testlib diff --git a/tests/auto/declarative/qsglistview/tst_qsglistview.cpp b/tests/auto/declarative/qsglistview/tst_qsglistview.cpp index cca6cd30c2..2b6705ff10 100644 --- a/tests/auto/declarative/qsglistview/tst_qsglistview.cpp +++ b/tests/auto/declarative/qsglistview/tst_qsglistview.cpp @@ -52,9 +52,9 @@ #include <QtDeclarative/private/qdeclarativelistmodel_p.h> #include <QtDeclarative/private/qlistmodelinterface_p.h> #include <QtDeclarative/private/qdeclarativechangeset_p.h> +#include "../shared/util.h" #include "../../../shared/util.h" #include "incrementalmodel.h" -#include <QtOpenGL/QGLShaderProgram> Q_DECLARE_METATYPE(Qt::LayoutDirection) Q_DECLARE_METATYPE(QSGListView::Orientation) @@ -454,7 +454,7 @@ void tst_QSGListView::items() TestObject *testObject = new TestObject; ctxt->setContextProperty("testObject", testObject); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listviewtest.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("listviewtest.qml"))); qApp->processEvents(); QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list"); @@ -534,7 +534,7 @@ void tst_QSGListView::changed() TestObject *testObject = new TestObject; ctxt->setContextProperty("testObject", testObject); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listviewtest.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("listviewtest.qml"))); qApp->processEvents(); QSGFlickable *listview = findItem<QSGFlickable>(canvas->rootObject(), "list"); @@ -572,7 +572,7 @@ void tst_QSGListView::inserted() TestObject *testObject = new TestObject; ctxt->setContextProperty("testObject", testObject); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listviewtest.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("listviewtest.qml"))); qApp->processEvents(); QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list"); @@ -668,7 +668,7 @@ void tst_QSGListView::removed(bool animated) TestObject *testObject = new TestObject; ctxt->setContextProperty("testObject", testObject); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listviewtest.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("listviewtest.qml"))); canvas->show(); qApp->processEvents(); @@ -846,7 +846,7 @@ void tst_QSGListView::clear() TestObject *testObject = new TestObject; ctxt->setContextProperty("testObject", testObject); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listviewtest.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("listviewtest.qml"))); qApp->processEvents(); QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list"); @@ -896,7 +896,7 @@ void tst_QSGListView::moved() TestObject *testObject = new TestObject; ctxt->setContextProperty("testObject", testObject); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listviewtest.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("listviewtest.qml"))); qApp->processEvents(); QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list"); @@ -1109,7 +1109,7 @@ void tst_QSGListView::multipleChanges() TestObject *testObject = new TestObject; ctxt->setContextProperty("testObject", testObject); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listviewtest.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("listviewtest.qml"))); qApp->processEvents(); QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list"); @@ -1326,7 +1326,7 @@ void tst_QSGListView::swapWithFirstItem() TestObject *testObject = new TestObject; ctxt->setContextProperty("testObject", testObject); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listviewtest.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("listviewtest.qml"))); qApp->processEvents(); QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list"); @@ -1352,7 +1352,7 @@ void tst_QSGListView::enforceRange() QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview-enforcerange.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("listview-enforcerange.qml"))); qApp->processEvents(); QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list"); @@ -1413,7 +1413,7 @@ void tst_QSGListView::enforceRange_withoutHighlight() QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview-enforcerange-nohighlight.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("listview-enforcerange-nohighlight.qml"))); qApp->processEvents(); QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list"); @@ -1455,7 +1455,7 @@ void tst_QSGListView::spacing() TestObject *testObject = new TestObject; ctxt->setContextProperty("testObject", testObject); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listviewtest.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("listviewtest.qml"))); qApp->processEvents(); QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list"); @@ -1512,7 +1512,7 @@ void tst_QSGListView::sections() QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview-sections.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("listview-sections.qml"))); qApp->processEvents(); QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list"); @@ -1606,7 +1606,7 @@ void tst_QSGListView::sectionsDelegate() QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview-sections_delegate.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("listview-sections_delegate.qml"))); qApp->processEvents(); QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list"); @@ -1719,7 +1719,7 @@ void tst_QSGListView::sectionsPositioning() QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview-sections_delegate.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("listview-sections_delegate.qml"))); qApp->processEvents(); canvas->rootObject()->setProperty("sectionPositioning", QVariant(int(QSGViewSection::InlineLabels | QSGViewSection::CurrentLabelAtStart | QSGViewSection::NextLabelAtEnd))); @@ -1848,7 +1848,7 @@ void tst_QSGListView::currentIndex_delayedItemCreation() // (since the currentItem will have changed and that shares the same index) canvas->rootContext()->setContextProperty("setCurrentToZero", setCurrentToZero); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/fillModelOnComponentCompleted.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("fillModelOnComponentCompleted.qml"))); qApp->processEvents(); QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list"); @@ -1885,7 +1885,7 @@ void tst_QSGListView::currentIndex() ctxt->setContextProperty("testModel", &model); ctxt->setContextProperty("testWrap", QVariant(false)); - QString filename(SRCDIR "/data/listview-initCurrent.qml"); + QString filename(TESTDATA("listview-initCurrent.qml")); canvas->setSource(QUrl::fromLocalFile(filename)); qApp->processEvents(); @@ -2021,7 +2021,7 @@ void tst_QSGListView::noCurrentIndex() QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); - QString filename(SRCDIR "/data/listview-noCurrent.qml"); + QString filename(TESTDATA("listview-noCurrent.qml")); canvas->setSource(QUrl::fromLocalFile(filename)); qApp->processEvents(); @@ -2051,7 +2051,7 @@ void tst_QSGListView::itemList() { QSGView *canvas = createView(); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/itemlist.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("itemlist.qml"))); qApp->processEvents(); QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "view"); @@ -2102,7 +2102,7 @@ void tst_QSGListView::cacheBuffer() TestObject *testObject = new TestObject; ctxt->setContextProperty("testObject", testObject); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listviewtest.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("listviewtest.qml"))); qApp->processEvents(); QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list"); @@ -2155,7 +2155,7 @@ void tst_QSGListView::positionViewAtIndex() TestObject *testObject = new TestObject; ctxt->setContextProperty("testObject", testObject); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listviewtest.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("listviewtest.qml"))); qApp->processEvents(); QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list"); @@ -2320,7 +2320,7 @@ void tst_QSGListView::resetModel() QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/displaylist.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("displaylist.qml"))); qApp->processEvents(); QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list"); @@ -2356,7 +2356,7 @@ void tst_QSGListView::propertyChanges() { QSGView *canvas = createView(); QTRY_VERIFY(canvas); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychangestest.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("propertychangestest.qml"))); QSGListView *listView = canvas->rootObject()->findChild<QSGListView*>("listView"); QTRY_VERIFY(listView); @@ -2424,7 +2424,7 @@ void tst_QSGListView::componentChanges() { QSGView *canvas = createView(); QTRY_VERIFY(canvas); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychangestest.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("propertychangestest.qml"))); QSGListView *listView = canvas->rootObject()->findChild<QSGListView*>("listView"); QTRY_VERIFY(listView); @@ -2472,7 +2472,7 @@ void tst_QSGListView::modelChanges() { QSGView *canvas = createView(); QTRY_VERIFY(canvas); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychangestest.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("propertychangestest.qml"))); QSGListView *listView = canvas->rootObject()->findChild<QSGListView*>("listView"); QTRY_VERIFY(listView); @@ -2499,7 +2499,7 @@ void tst_QSGListView::QTBUG_9791() { QSGView *canvas = createView(); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/strictlyenforcerange.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("strictlyenforcerange.qml"))); qApp->processEvents(); QSGListView *listview = qobject_cast<QSGListView*>(canvas->rootObject()); @@ -2535,7 +2535,7 @@ void tst_QSGListView::manualHighlight() QSGView *canvas = new QSGView(0); canvas->setGeometry(0,0,240,320); - QString filename(SRCDIR "/data/manual-highlight.qml"); + QString filename(TESTDATA("manual-highlight.qml")); canvas->setSource(QUrl::fromLocalFile(filename)); qApp->processEvents(); @@ -2580,7 +2580,7 @@ void tst_QSGListView::QTBUG_11105() TestObject *testObject = new TestObject; ctxt->setContextProperty("testObject", testObject); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listviewtest.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("listviewtest.qml"))); qApp->processEvents(); QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list"); @@ -2633,7 +2633,7 @@ void tst_QSGListView::header() canvas->rootContext()->setContextProperty("testModel", &model); canvas->rootContext()->setContextProperty("initialViewWidth", 240); canvas->rootContext()->setContextProperty("initialViewHeight", 320); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/header.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("header.qml"))); QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list"); QTRY_VERIFY(listview != 0); @@ -2690,7 +2690,7 @@ void tst_QSGListView::header() canvas->rootContext()->setContextProperty("testModel", &model); canvas->rootContext()->setContextProperty("initialViewWidth", 0.0); canvas->rootContext()->setContextProperty("initialViewHeight", 0.0); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/header.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("header.qml"))); listview = findItem<QSGListView>(canvas->rootObject(), "list"); QTRY_VERIFY(listview != 0); @@ -2766,7 +2766,7 @@ void tst_QSGListView::header_delayItemCreation() TestModel model; canvas->rootContext()->setContextProperty("setCurrentToZero", false); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/fillModelOnComponentCompleted.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("fillModelOnComponentCompleted.qml"))); qApp->processEvents(); QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list"); @@ -2807,7 +2807,7 @@ void tst_QSGListView::footer() QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/footer.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("footer.qml"))); canvas->show(); qApp->processEvents(); @@ -2962,7 +2962,7 @@ void tst_QSGListView::headerFooter() QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/headerfooter.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("headerfooter.qml"))); qApp->processEvents(); QSGListView *listview = qobject_cast<QSGListView*>(canvas->rootObject()); @@ -2992,7 +2992,7 @@ void tst_QSGListView::headerFooter() QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/headerfooter.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("headerfooter.qml"))); canvas->rootObject()->setProperty("horizontal", true); qApp->processEvents(); @@ -3023,7 +3023,7 @@ void tst_QSGListView::headerFooter() QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/headerfooter.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("headerfooter.qml"))); canvas->rootObject()->setProperty("horizontal", true); canvas->rootObject()->setProperty("rtl", true); qApp->processEvents(); @@ -3063,7 +3063,7 @@ void tst_QSGListView::resizeView() TestObject *testObject = new TestObject; ctxt->setContextProperty("testObject", testObject); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listviewtest.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("listviewtest.qml"))); qApp->processEvents(); QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list"); @@ -3108,7 +3108,7 @@ void tst_QSGListView::sizeLessThan1() TestObject *testObject = new TestObject; ctxt->setContextProperty("testObject", testObject); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/sizelessthan1.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("sizelessthan1.qml"))); qApp->processEvents(); QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list"); @@ -3134,7 +3134,7 @@ void tst_QSGListView::QTBUG_14821() { QSGView *canvas = createView(); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/qtbug14821.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("qtbug14821.qml"))); qApp->processEvents(); QSGListView *listview = qobject_cast<QSGListView*>(canvas->rootObject()); @@ -3165,7 +3165,7 @@ void tst_QSGListView::resizeDelegate() QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/displaylist.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("displaylist.qml"))); qApp->processEvents(); QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list"); @@ -3248,7 +3248,7 @@ void tst_QSGListView::resizeFirstDelegate() TestObject *testObject = new TestObject; ctxt->setContextProperty("testObject", testObject); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listviewtest.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("listviewtest.qml"))); qApp->processEvents(); QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list"); @@ -3288,7 +3288,7 @@ void tst_QSGListView::QTBUG_16037() QSGView *canvas = createView(); canvas->show(); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/qtbug16037.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("qtbug16037.qml"))); qApp->processEvents(); QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "listview"); @@ -3317,7 +3317,7 @@ void tst_QSGListView::indexAt() TestObject *testObject = new TestObject; ctxt->setContextProperty("testObject", testObject); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listviewtest.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("listviewtest.qml"))); qApp->processEvents(); QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list"); @@ -3344,7 +3344,7 @@ void tst_QSGListView::incrementalModel() QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/displaylist.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("displaylist.qml"))); qApp->processEvents(); QSGListView *listview = findItem<QSGListView>(canvas->rootObject(), "list"); @@ -3379,7 +3379,7 @@ void tst_QSGListView::onAdd() QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); ctxt->setContextProperty("delegateHeight", delegateHeight); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/attachedSignals.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("attachedSignals.qml"))); QObject *object = canvas->rootObject(); object->setProperty("width", canvas->width()); @@ -3433,7 +3433,7 @@ void tst_QSGListView::onRemove() QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); ctxt->setContextProperty("delegateHeight", delegateHeight); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/attachedSignals.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("attachedSignals.qml"))); QObject *object = canvas->rootObject(); model.removeItems(indexToRemove, removeCount); @@ -3471,7 +3471,7 @@ void tst_QSGListView::rightToLeft() { QSGView *canvas = createView(); canvas->setGeometry(0,0,640,320); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/rightToLeft.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("rightToLeft.qml"))); qApp->processEvents(); QVERIFY(canvas->rootObject() != 0); @@ -3521,12 +3521,12 @@ void tst_QSGListView::rightToLeft() void tst_QSGListView::test_mirroring() { QSGView *canvasA = createView(); - canvasA->setSource(QUrl::fromLocalFile(SRCDIR "/data/rightToLeft.qml")); + canvasA->setSource(QUrl::fromLocalFile(TESTDATA("rightToLeft.qml"))); QSGListView *listviewA = findItem<QSGListView>(canvasA->rootObject(), "view"); QTRY_VERIFY(listviewA != 0); QSGView *canvasB = createView(); - canvasB->setSource(QUrl::fromLocalFile(SRCDIR "/data/rightToLeft.qml")); + canvasB->setSource(QUrl::fromLocalFile(TESTDATA("rightToLeft.qml"))); QSGListView *listviewB = findItem<QSGListView>(canvasB->rootObject(), "view"); QTRY_VERIFY(listviewA != 0); qApp->processEvents(); @@ -3590,7 +3590,7 @@ void tst_QSGListView::margins() QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/margins.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("margins.qml"))); canvas->show(); qApp->processEvents(); @@ -3717,7 +3717,7 @@ void tst_QSGListView::creationContext() { QSGView canvas; canvas.setGeometry(0,0,240,320); - canvas.setSource(QUrl::fromLocalFile(SRCDIR "/data/creationContext.qml")); + canvas.setSource(QUrl::fromLocalFile(TESTDATA("creationContext.qml"))); qApp->processEvents(); QSGItem *rootItem = qobject_cast<QSGItem *>(canvas.rootObject()); diff --git a/tests/auto/declarative/qsgloader/qsgloader.pro b/tests/auto/declarative/qsgloader/qsgloader.pro index fd18bef181..01e942e926 100644 --- a/tests/auto/declarative/qsgloader/qsgloader.pro +++ b/tests/auto/declarative/qsgloader/qsgloader.pro @@ -7,7 +7,9 @@ HEADERS += ../shared/testhttpserver.h SOURCES += tst_qsgloader.cpp \ ../shared/testhttpserver.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles CONFIG += parallel_test diff --git a/tests/auto/declarative/qsgloader/tst_qsgloader.cpp b/tests/auto/declarative/qsgloader/tst_qsgloader.cpp index 3cf1bbbe2d..4b0921f526 100644 --- a/tests/auto/declarative/qsgloader/tst_qsgloader.cpp +++ b/tests/auto/declarative/qsgloader/tst_qsgloader.cpp @@ -47,13 +47,14 @@ #include <QtDeclarative/qdeclarativeincubator.h> #include <private/qsgloader_p.h> #include "testhttpserver.h" +#include "../shared/util.h" #include "../../../shared/util.h" #define SERVER_PORT 14450 inline QUrl TEST_FILE(const QString &filename) { - return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename); + return QUrl::fromLocalFile(TESTDATA(filename)); } class PeriodicIncubationController : public QObject, @@ -192,10 +193,10 @@ void tst_QSGLoader::sourceOrComponent_data() QTest::addColumn<QUrl>("sourceUrl"); QTest::addColumn<QString>("errorString"); - QTest::newRow("source") << "source" << "source: 'Rect120x60.qml'\n" << QUrl::fromLocalFile(SRCDIR "/data/Rect120x60.qml") << ""; + QTest::newRow("source") << "source" << "source: 'Rect120x60.qml'\n" << QUrl::fromLocalFile(TESTDATA("Rect120x60.qml")) << ""; QTest::newRow("sourceComponent") << "component" << "Component { id: comp; Rectangle { width: 100; height: 50 } }\n sourceComponent: comp\n" << QUrl() << ""; - QTest::newRow("invalid source") << "source" << "source: 'IDontExist.qml'\n" << QUrl::fromLocalFile(SRCDIR "/data/IDontExist.qml") - << QString(QUrl::fromLocalFile(SRCDIR "/data/IDontExist.qml").toString() + ": File not found"); + QTest::newRow("invalid source") << "source" << "source: 'IDontExist.qml'\n" << QUrl::fromLocalFile(TESTDATA("IDontExist.qml")) + << QString(QUrl::fromLocalFile(TESTDATA("IDontExist.qml")).toString() + ": File not found"); } void tst_QSGLoader::clear() @@ -416,10 +417,10 @@ void tst_QSGLoader::networkRequestUrl() { TestHTTPServer server(SERVER_PORT); QVERIFY(server.isValid()); - server.serveDirectory(SRCDIR "/data"); + server.serveDirectory(TESTDATA("")); QDeclarativeComponent component(&engine); - component.setData(QByteArray("import QtQuick 2.0\nLoader { property int signalCount : 0; source: \"http://127.0.0.1:14450/Rect120x60.qml\"; onLoaded: signalCount += 1 }"), QUrl::fromLocalFile(SRCDIR "/dummy.qml")); + component.setData(QByteArray("import QtQuick 2.0\nLoader { property int signalCount : 0; source: \"http://127.0.0.1:14450/Rect120x60.qml\"; onLoaded: signalCount += 1 }"), QUrl::fromLocalFile(TESTDATA("../dummy.qml"))); if (component.isError()) qDebug() << component.errors(); QSGLoader *loader = qobject_cast<QSGLoader*>(component.create()); @@ -471,7 +472,7 @@ void tst_QSGLoader::failNetworkRequest() { TestHTTPServer server(SERVER_PORT); QVERIFY(server.isValid()); - server.serveDirectory(SRCDIR "/data"); + server.serveDirectory(TESTDATA("")); QTest::ignoreMessage(QtWarningMsg, "http://127.0.0.1:14450/IDontExist.qml: File not found"); @@ -685,7 +686,7 @@ void tst_QSGLoader::initialPropertyValues() TestHTTPServer server(SERVER_PORT); QVERIFY(server.isValid()); - server.serveDirectory(SRCDIR "/data"); + server.serveDirectory(TESTDATA("")); foreach (const QString &warning, expectedWarnings) QTest::ignoreMessage(QtWarningMsg, warning.toAscii().constData()); @@ -767,7 +768,7 @@ void tst_QSGLoader::deleteComponentCrash() QCOMPARE(loader->status(), QSGLoader::Ready); qApp->processEvents(QEventLoop::DeferredDeletion); QTRY_COMPARE(static_cast<QSGItem*>(loader)->childItems().count(), 1); - QVERIFY(loader->source() == QUrl::fromLocalFile(SRCDIR "/data/BlueRect.qml")); + QVERIFY(loader->source() == QUrl::fromLocalFile(TESTDATA("BlueRect.qml"))); delete item; } @@ -775,7 +776,7 @@ void tst_QSGLoader::deleteComponentCrash() void tst_QSGLoader::nonItem() { QDeclarativeComponent component(&engine, TEST_FILE("nonItem.qml")); - QString err = QUrl::fromLocalFile(SRCDIR).toString() + "/data/nonItem.qml:3:1: QML Loader: Loader does not support loading non-visual elements."; + QString err = QUrl::fromLocalFile(TESTDATA("nonItem.qml")).toString() + ":3:1: QML Loader: Loader does not support loading non-visual elements."; QTest::ignoreMessage(QtWarningMsg, err.toLatin1().constData()); QSGLoader *loader = qobject_cast<QSGLoader*>(component.create()); @@ -788,7 +789,7 @@ void tst_QSGLoader::nonItem() void tst_QSGLoader::vmeErrors() { QDeclarativeComponent component(&engine, TEST_FILE("vmeErrors.qml")); - QString err = QUrl::fromLocalFile(SRCDIR).toString() + "/data/VmeError.qml:6: Cannot assign object type QObject with no default method"; + QString err = QUrl::fromLocalFile(TESTDATA("VmeError.qml")).toString() + ":6: Cannot assign object type QObject with no default method"; QTest::ignoreMessage(QtWarningMsg, err.toLatin1().constData()); QSGLoader *loader = qobject_cast<QSGLoader*>(component.create()); QVERIFY(loader); diff --git a/tests/auto/declarative/qsgmousearea/qsgmousearea.pro b/tests/auto/declarative/qsgmousearea/qsgmousearea.pro index 47536ad6c5..39abd5a75d 100644 --- a/tests/auto/declarative/qsgmousearea/qsgmousearea.pro +++ b/tests/auto/declarative/qsgmousearea/qsgmousearea.pro @@ -5,7 +5,9 @@ macx:CONFIG -= app_bundle HEADERS += ../shared/testhttpserver.h SOURCES += tst_qsgmousearea.cpp ../shared/testhttpserver.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles CONFIG += parallel_test diff --git a/tests/auto/declarative/qsgmousearea/tst_qsgmousearea.cpp b/tests/auto/declarative/qsgmousearea/tst_qsgmousearea.cpp index 20bf5d9a48..0ac2fa9829 100644 --- a/tests/auto/declarative/qsgmousearea/tst_qsgmousearea.cpp +++ b/tests/auto/declarative/qsgmousearea/tst_qsgmousearea.cpp @@ -48,6 +48,7 @@ #include <QtDeclarative/qdeclarativecontext.h> #include <QtDeclarative/qdeclarativeengine.h> #include <QtOpenGL/QGLShaderProgram> +#include "../shared/util.h" #include "../../../shared/util.h" //#define OLDWAY @@ -94,7 +95,7 @@ void tst_QSGMouseArea::dragProperties() { QSGView *canvas = createView(); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/dragproperties.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("dragproperties.qml"))); canvas->show(); canvas->requestActivateWindow(); QVERIFY(canvas->rootObject() != 0); @@ -180,7 +181,7 @@ void tst_QSGMouseArea::resetDrag() QSGView *canvas = createView(); canvas->rootContext()->setContextProperty("haveTarget", QVariant(true)); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/dragreset.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("dragreset.qml"))); canvas->show(); canvas->requestActivateWindow(); QVERIFY(canvas->rootObject() != 0); @@ -210,7 +211,7 @@ void tst_QSGMouseArea::dragging() { QSGView *canvas = createView(); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/dragging.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("dragging.qml"))); canvas->show(); canvas->requestActivateWindow(); QTest::qWait(20); @@ -277,7 +278,7 @@ QSGView *tst_QSGMouseArea::createView() void tst_QSGMouseArea::updateMouseAreaPosOnClick() { QSGView *canvas = createView(); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/updateMousePosOnClick.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("updateMousePosOnClick.qml"))); canvas->show(); canvas->requestActivateWindow(); QVERIFY(canvas->rootObject() != 0); @@ -306,7 +307,7 @@ void tst_QSGMouseArea::updateMouseAreaPosOnClick() void tst_QSGMouseArea::updateMouseAreaPosOnResize() { QSGView *canvas = createView(); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/updateMousePosOnResize.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("updateMousePosOnResize.qml"))); canvas->show(); canvas->requestActivateWindow(); QVERIFY(canvas->rootObject() != 0); @@ -344,7 +345,7 @@ void tst_QSGMouseArea::noOnClickedWithPressAndHold() { // We handle onPressAndHold, therefore no onClicked QSGView *canvas = createView(); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/clickandhold.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("clickandhold.qml"))); canvas->show(); canvas->requestActivateWindow(); QVERIFY(canvas->rootObject() != 0); @@ -369,7 +370,7 @@ void tst_QSGMouseArea::noOnClickedWithPressAndHold() { // We do not handle onPressAndHold, therefore we get onClicked QSGView *canvas = createView(); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/noclickandhold.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("noclickandhold.qml"))); canvas->show(); canvas->requestActivateWindow(); QVERIFY(canvas->rootObject() != 0); @@ -393,7 +394,7 @@ void tst_QSGMouseArea::noOnClickedWithPressAndHold() void tst_QSGMouseArea::onMousePressRejected() { QSGView *canvas = createView(); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/rejectEvent.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("rejectEvent.qml"))); canvas->show(); canvas->requestActivateWindow(); QVERIFY(canvas->rootObject() != 0); @@ -430,7 +431,7 @@ void tst_QSGMouseArea::onMousePressRejected() void tst_QSGMouseArea::pressedCanceledOnWindowDeactivate() { QSGView *canvas = createView(); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pressedCanceled.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("pressedCanceled.qml"))); canvas->show(); canvas->requestActivateWindow(); QVERIFY(canvas->rootObject() != 0); @@ -475,7 +476,7 @@ void tst_QSGMouseArea::pressedCanceledOnWindowDeactivate() void tst_QSGMouseArea::doubleClick() { QSGView *canvas = createView(); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/doubleclick.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("doubleclick.qml"))); canvas->show(); canvas->requestActivateWindow(); QVERIFY(canvas->rootObject() != 0); @@ -504,7 +505,7 @@ void tst_QSGMouseArea::doubleClick() void tst_QSGMouseArea::clickTwice() { QSGView *canvas = createView(); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/clicktwice.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("clicktwice.qml"))); canvas->show(); canvas->requestActivateWindow(); QVERIFY(canvas->rootObject() != 0); @@ -535,7 +536,7 @@ void tst_QSGMouseArea::clickTwice() void tst_QSGMouseArea::pressedOrdering() { QSGView *canvas = createView(); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pressedOrdering.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("pressedOrdering.qml"))); canvas->show(); canvas->requestActivateWindow(); QVERIFY(canvas->rootObject() != 0); @@ -563,7 +564,7 @@ void tst_QSGMouseArea::preventStealing() { QSGView *canvas = createView(); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/preventstealing.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("preventstealing.qml"))); canvas->show(); canvas->requestActivateWindow(); QVERIFY(canvas->rootObject() != 0); @@ -626,7 +627,7 @@ void tst_QSGMouseArea::clickThrough() { //With no handlers defined click, doubleClick and PressAndHold should propagate to those with handlers QSGView *canvas = createView(); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/clickThrough.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("clickThrough.qml"))); canvas->show(); canvas->requestActivateWindow(); QVERIFY(canvas->rootObject() != 0); @@ -659,7 +660,7 @@ void tst_QSGMouseArea::clickThrough() //With handlers defined click, doubleClick and PressAndHold should propagate only when explicitly ignored canvas = createView(); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/clickThrough2.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("clickThrough2.qml"))); canvas->show(); canvas->requestActivateWindow(); QVERIFY(canvas->rootObject() != 0); @@ -757,7 +758,7 @@ void tst_QSGMouseArea::testQtQuick11Attributes_data() void tst_QSGMouseArea::hoverPosition() { QSGView *canvas = createView(); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/hoverPosition.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("hoverPosition.qml"))); QSGItem *root = canvas->rootObject(); QVERIFY(root != 0); @@ -778,7 +779,7 @@ void tst_QSGMouseArea::hoverPropagation() { //QTBUG-18175, to behave like GV did. QSGView *canvas = createView(); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/hoverPropagation.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("hoverPropagation.qml"))); QSGItem *root = canvas->rootObject(); QVERIFY(root != 0); diff --git a/tests/auto/declarative/qsgpathview/qsgpathview.pro b/tests/auto/declarative/qsgpathview/qsgpathview.pro index 902d624417..06f8142f84 100644 --- a/tests/auto/declarative/qsgpathview/qsgpathview.pro +++ b/tests/auto/declarative/qsgpathview/qsgpathview.pro @@ -4,7 +4,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qsgpathview.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles CONFIG += parallel_test #temporary diff --git a/tests/auto/declarative/qsgpathview/tst_qsgpathview.cpp b/tests/auto/declarative/qsgpathview/tst_qsgpathview.cpp index 6dd2a57be6..691a115cf5 100644 --- a/tests/auto/declarative/qsgpathview/tst_qsgpathview.cpp +++ b/tests/auto/declarative/qsgpathview/tst_qsgpathview.cpp @@ -55,8 +55,8 @@ #include <QStringListModel> #include <QStandardItemModel> #include <QFile> -#include <QtOpenGL/QGLShaderProgram> +#include "../shared/util.h" #include "../../../shared/util.h" static void initStandardTreeModel(QStandardItemModel *model) @@ -228,7 +228,7 @@ tst_QSGPathView::tst_QSGPathView() void tst_QSGPathView::initValues() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/pathview1.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("pathview1.qml"))); QSGPathView *obj = qobject_cast<QSGPathView*>(c.create()); QVERIFY(obj != 0); @@ -256,7 +256,7 @@ void tst_QSGPathView::items() QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pathview0.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("pathview0.qml"))); qApp->processEvents(); QSGPathView *pathview = findItem<QSGPathView>(canvas->rootObject(), "view"); @@ -291,7 +291,7 @@ void tst_QSGPathView::items() void tst_QSGPathView::pathview2() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/pathview2.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("pathview2.qml"))); QSGPathView *obj = qobject_cast<QSGPathView*>(c.create()); QVERIFY(obj != 0); @@ -309,7 +309,7 @@ void tst_QSGPathView::pathview2() void tst_QSGPathView::pathview3() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/pathview3.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("pathview3.qml"))); QSGPathView *obj = qobject_cast<QSGPathView*>(c.create()); QVERIFY(obj != 0); @@ -327,7 +327,7 @@ void tst_QSGPathView::pathview3() void tst_QSGPathView::path() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/pathtest.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("pathtest.qml"))); QDeclarativePath *obj = qobject_cast<QDeclarativePath*>(c.create()); QVERIFY(obj != 0); @@ -395,7 +395,7 @@ void tst_QSGPathView::dataModel() ctxt->setContextProperty("testData", &model); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/datamodel.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("datamodel.qml"))); qApp->processEvents(); QSGPathView *pathview = qobject_cast<QSGPathView*>(canvas->rootObject()); @@ -497,7 +497,7 @@ void tst_QSGPathView::pathMoved() QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pathview0.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("pathview0.qml"))); qApp->processEvents(); QSGPathView *pathview = findItem<QSGPathView>(canvas->rootObject(), "view"); @@ -554,7 +554,7 @@ void tst_QSGPathView::setCurrentIndex() QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pathview0.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("pathview0.qml"))); qApp->processEvents(); QSGPathView *pathview = findItem<QSGPathView>(canvas->rootObject(), "view"); @@ -668,7 +668,7 @@ void tst_QSGPathView::resetModel() QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/displaypath.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("displaypath.qml"))); qApp->processEvents(); QSGPathView *pathview = findItem<QSGPathView>(canvas->rootObject(), "view"); @@ -701,7 +701,7 @@ void tst_QSGPathView::propertyChanges() { QSGView *canvas = createView(); QVERIFY(canvas); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("propertychanges.qml"))); QSGPathView *pathView = canvas->rootObject()->findChild<QSGPathView*>("pathView"); QVERIFY(pathView); @@ -736,7 +736,7 @@ void tst_QSGPathView::pathChanges() { QSGView *canvas = createView(); QVERIFY(canvas); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("propertychanges.qml"))); QSGPathView *pathView = canvas->rootObject()->findChild<QSGPathView*>("pathView"); QVERIFY(pathView); @@ -798,7 +798,7 @@ void tst_QSGPathView::componentChanges() { QSGView *canvas = createView(); QVERIFY(canvas); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("propertychanges.qml"))); QSGPathView *pathView = canvas->rootObject()->findChild<QSGPathView*>("pathView"); QVERIFY(pathView); @@ -821,7 +821,7 @@ void tst_QSGPathView::modelChanges() { QSGView *canvas = createView(); QVERIFY(canvas); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("propertychanges.qml"))); QSGPathView *pathView = canvas->rootObject()->findChild<QSGPathView*>("pathView"); QVERIFY(pathView); @@ -848,7 +848,7 @@ void tst_QSGPathView::pathUpdateOnStartChanged() { QSGView *canvas = createView(); QVERIFY(canvas); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pathUpdateOnStartChanged.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("pathUpdateOnStartChanged.qml"))); QSGPathView *pathView = canvas->rootObject()->findChild<QSGPathView*>("pathView"); QVERIFY(pathView); @@ -870,7 +870,7 @@ void tst_QSGPathView::package() { QSGView *canvas = createView(); QVERIFY(canvas); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pathview_package.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("pathview_package.qml"))); QSGPathView *pathView = canvas->rootObject()->findChild<QSGPathView*>("photoPathView"); QVERIFY(pathView); @@ -892,7 +892,7 @@ void tst_QSGPathView::emptyModel() QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("emptyModel", &model); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/emptymodel.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("emptymodel.qml"))); qApp->processEvents(); QSGPathView *pathview = qobject_cast<QSGPathView*>(canvas->rootObject()); @@ -908,7 +908,7 @@ void tst_QSGPathView::closed() QDeclarativeEngine engine; { - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/openPath.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("openPath.qml"))); QDeclarativePath *obj = qobject_cast<QDeclarativePath*>(c.create()); QVERIFY(obj); QCOMPARE(obj->isClosed(), false); @@ -916,7 +916,7 @@ void tst_QSGPathView::closed() } { - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/closedPath.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("closedPath.qml"))); QDeclarativePath *obj = qobject_cast<QDeclarativePath*>(c.create()); QVERIFY(obj); QCOMPARE(obj->isClosed(), true); @@ -929,7 +929,7 @@ void tst_QSGPathView::pathUpdate() { QSGView *canvas = createView(); QVERIFY(canvas); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pathUpdate.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("pathUpdate.qml"))); QSGPathView *pathView = canvas->rootObject()->findChild<QSGPathView*>("pathView"); QVERIFY(pathView); @@ -944,7 +944,7 @@ void tst_QSGPathView::pathUpdate() void tst_QSGPathView::visualDataModel() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/vdm.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("vdm.qml"))); QSGPathView *obj = qobject_cast<QSGPathView*>(c.create()); QVERIFY(obj != 0); @@ -957,7 +957,7 @@ void tst_QSGPathView::visualDataModel() void tst_QSGPathView::undefinedPath() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/undefinedpath.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("undefinedpath.qml"))); QSGPathView *obj = qobject_cast<QSGPathView*>(c.create()); QVERIFY(obj != 0); @@ -970,7 +970,7 @@ void tst_QSGPathView::undefinedPath() void tst_QSGPathView::mouseDrag() { QSGView *canvas = createView(); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/dragpath.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("dragpath.qml"))); canvas->show(); canvas->requestActivateWindow(); QTest::qWaitForWindowShown(canvas); @@ -1009,7 +1009,7 @@ void tst_QSGPathView::treeModel() initStandardTreeModel(&model); canvas->engine()->rootContext()->setContextProperty("myModel", &model); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/treemodel.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("treemodel.qml"))); QSGPathView *pathview = qobject_cast<QSGPathView*>(canvas->rootObject()); QVERIFY(pathview != 0); @@ -1032,7 +1032,7 @@ void tst_QSGPathView::changePreferredHighlight() { QSGView *canvas = createView(); canvas->setGeometry(0,0,400,200); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/dragpath.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("dragpath.qml"))); canvas->show(); canvas->requestActivateWindow(); QTest::qWaitForWindowShown(canvas); @@ -1071,7 +1071,7 @@ void tst_QSGPathView::creationContext() { QSGView canvas; canvas.setGeometry(0,0,240,320); - canvas.setSource(QUrl::fromLocalFile(SRCDIR "/data/creationContext.qml")); + canvas.setSource(QUrl::fromLocalFile(TESTDATA("creationContext.qml"))); QSGItem *rootItem = qobject_cast<QSGItem *>(canvas.rootObject()); QVERIFY(rootItem); @@ -1143,7 +1143,7 @@ QList<T*> tst_QSGPathView::findItems(QSGItem *parent, const QString &objectName) void tst_QSGPathView::missingPercent() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/missingPercent.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("missingPercent.qml"))); QDeclarativePath *obj = qobject_cast<QDeclarativePath*>(c.create()); QVERIFY(obj); QCOMPARE(obj->attributeAt("_qfx_percent", 1.0), qreal(1.0)); diff --git a/tests/auto/declarative/qsgpincharea/qsgpincharea.pro b/tests/auto/declarative/qsgpincharea/qsgpincharea.pro index 86b1110909..628bbc7a88 100644 --- a/tests/auto/declarative/qsgpincharea/qsgpincharea.pro +++ b/tests/auto/declarative/qsgpincharea/qsgpincharea.pro @@ -4,7 +4,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qsgpincharea.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles CONFIG += parallel_test diff --git a/tests/auto/declarative/qsgpincharea/tst_qsgpincharea.cpp b/tests/auto/declarative/qsgpincharea/tst_qsgpincharea.cpp index 6411fa669e..24cdf90657 100644 --- a/tests/auto/declarative/qsgpincharea/tst_qsgpincharea.cpp +++ b/tests/auto/declarative/qsgpincharea/tst_qsgpincharea.cpp @@ -45,7 +45,7 @@ #include <private/qsgrectangle_p.h> #include <QtDeclarative/qsgview.h> #include <QtDeclarative/qdeclarativecontext.h> -#include <QtOpenGL/QGLShaderProgram> +#include "../shared/util.h" class tst_QSGPinchArea: public QObject { @@ -72,7 +72,7 @@ void tst_QSGPinchArea::cleanupTestCase() void tst_QSGPinchArea::pinchProperties() { QSGView *canvas = createView(); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pinchproperties.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("pinchproperties.qml"))); canvas->show(); canvas->requestActivateWindow(); QVERIFY(canvas->rootObject() != 0); @@ -198,7 +198,7 @@ QTouchEvent::TouchPoint makeTouchPoint(int id, QPoint p, QSGView *v, QSGItem *i) void tst_QSGPinchArea::scale() { QSGView *canvas = createView(); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pinchproperties.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("pinchproperties.qml"))); canvas->show(); canvas->requestActivateWindow(); QTest::qWaitForWindowShown(canvas); @@ -251,7 +251,7 @@ void tst_QSGPinchArea::scale() void tst_QSGPinchArea::pan() { QSGView *canvas = createView(); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pinchproperties.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("pinchproperties.qml"))); canvas->show(); canvas->requestActivateWindow(); QTest::qWaitForWindowShown(canvas); @@ -307,7 +307,7 @@ void tst_QSGPinchArea::pan() void tst_QSGPinchArea::retouch() { QSGView *canvas = createView(); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pinchproperties.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("pinchproperties.qml"))); canvas->show(); canvas->requestActivateWindow(); QTest::qWaitForWindowShown(canvas); diff --git a/tests/auto/declarative/qsgpositioners/qsgpositioners.pro b/tests/auto/declarative/qsgpositioners/qsgpositioners.pro index cd9e7a0094..e7e30c7576 100644 --- a/tests/auto/declarative/qsgpositioners/qsgpositioners.pro +++ b/tests/auto/declarative/qsgpositioners/qsgpositioners.pro @@ -3,7 +3,9 @@ TARGET = tst_qsgpositioners SOURCES += tst_qsgpositioners.cpp macx:CONFIG -= app_bundle -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles CONFIG += parallel_test #temporary diff --git a/tests/auto/declarative/qsgpositioners/tst_qsgpositioners.cpp b/tests/auto/declarative/qsgpositioners/tst_qsgpositioners.cpp index 657190cb8b..84225ca02a 100644 --- a/tests/auto/declarative/qsgpositioners/tst_qsgpositioners.cpp +++ b/tests/auto/declarative/qsgpositioners/tst_qsgpositioners.cpp @@ -47,7 +47,7 @@ #include <private/qdeclarativetransition_p.h> #include <private/qsgitem_p.h> #include <qdeclarativeexpression.h> -#include <QtWidgets/qgraphicswidget.h> +#include "../shared/util.h" #include "../../../shared/util.h" class tst_qsgpositioners : public QObject @@ -100,7 +100,7 @@ tst_qsgpositioners::tst_qsgpositioners() void tst_qsgpositioners::test_horizontal() { - QSGView *canvas = createView(SRCDIR "/data/horizontal.qml"); + QSGView *canvas = createView(TESTDATA("horizontal.qml")); canvas->rootObject()->setProperty("testRightToLeft", false); @@ -129,7 +129,7 @@ void tst_qsgpositioners::test_horizontal() void tst_qsgpositioners::test_horizontal_rtl() { - QSGView *canvas = createView(SRCDIR "/data/horizontal.qml"); + QSGView *canvas = createView(TESTDATA("horizontal.qml")); canvas->rootObject()->setProperty("testRightToLeft", true); @@ -167,7 +167,7 @@ void tst_qsgpositioners::test_horizontal_rtl() void tst_qsgpositioners::test_horizontal_spacing() { - QSGView *canvas = createView(SRCDIR "/data/horizontal-spacing.qml"); + QSGView *canvas = createView(TESTDATA("horizontal-spacing.qml")); canvas->rootObject()->setProperty("testRightToLeft", false); @@ -196,7 +196,7 @@ void tst_qsgpositioners::test_horizontal_spacing() void tst_qsgpositioners::test_horizontal_spacing_rightToLeft() { - QSGView *canvas = createView(SRCDIR "/data/horizontal-spacing.qml"); + QSGView *canvas = createView(TESTDATA("horizontal-spacing.qml")); canvas->rootObject()->setProperty("testRightToLeft", true); @@ -225,7 +225,7 @@ void tst_qsgpositioners::test_horizontal_spacing_rightToLeft() void tst_qsgpositioners::test_horizontal_animated() { - QSGView *canvas = createView(SRCDIR "/data/horizontal-animated.qml", false); + QSGView *canvas = createView(TESTDATA("horizontal-animated.qml"), false); canvas->rootObject()->setProperty("testRightToLeft", false); @@ -279,7 +279,7 @@ void tst_qsgpositioners::test_horizontal_animated() void tst_qsgpositioners::test_horizontal_animated_rightToLeft() { - QSGView *canvas = createView(SRCDIR "/data/horizontal-animated.qml", false); + QSGView *canvas = createView(TESTDATA("horizontal-animated.qml"), false); canvas->rootObject()->setProperty("testRightToLeft", true); @@ -335,7 +335,7 @@ void tst_qsgpositioners::test_horizontal_animated_rightToLeft() void tst_qsgpositioners::test_horizontal_animated_disabled() { - QSGView *canvas = createView(SRCDIR "/data/horizontal-animated-disabled.qml"); + QSGView *canvas = createView(TESTDATA("horizontal-animated-disabled.qml")); QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one"); QVERIFY(one != 0); @@ -375,7 +375,7 @@ void tst_qsgpositioners::test_horizontal_animated_disabled() void tst_qsgpositioners::test_vertical() { - QSGView *canvas = createView(SRCDIR "/data/vertical.qml"); + QSGView *canvas = createView(TESTDATA("vertical.qml")); QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one"); QVERIFY(one != 0); @@ -403,7 +403,7 @@ void tst_qsgpositioners::test_vertical() void tst_qsgpositioners::test_vertical_spacing() { - QSGView *canvas = createView(SRCDIR "/data/vertical-spacing.qml"); + QSGView *canvas = createView(TESTDATA("vertical-spacing.qml")); QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one"); QVERIFY(one != 0); @@ -430,7 +430,7 @@ void tst_qsgpositioners::test_vertical_spacing() void tst_qsgpositioners::test_vertical_animated() { - QSGView *canvas = createView(SRCDIR "/data/vertical-animated.qml", false); + QSGView *canvas = createView(TESTDATA("vertical-animated.qml"), false); //Note that they animate in QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one"); @@ -480,7 +480,7 @@ void tst_qsgpositioners::test_vertical_animated() void tst_qsgpositioners::test_grid() { - QSGView *canvas = createView(SRCDIR "/data/gridtest.qml"); + QSGView *canvas = createView(TESTDATA("gridtest.qml")); QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one"); QVERIFY(one != 0); @@ -514,7 +514,7 @@ void tst_qsgpositioners::test_grid() void tst_qsgpositioners::test_grid_topToBottom() { - QSGView *canvas = createView(SRCDIR "/data/grid-toptobottom.qml"); + QSGView *canvas = createView(TESTDATA("grid-toptobottom.qml")); QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one"); QVERIFY(one != 0); @@ -548,7 +548,7 @@ void tst_qsgpositioners::test_grid_topToBottom() void tst_qsgpositioners::test_grid_rightToLeft() { - QSGView *canvas = createView(SRCDIR "/data/gridtest.qml"); + QSGView *canvas = createView(TESTDATA("gridtest.qml")); canvas->rootObject()->setProperty("testRightToLeft", true); @@ -597,7 +597,7 @@ void tst_qsgpositioners::test_grid_rightToLeft() void tst_qsgpositioners::test_grid_spacing() { - QSGView *canvas = createView(SRCDIR "/data/grid-spacing.qml"); + QSGView *canvas = createView(TESTDATA("grid-spacing.qml")); QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one"); QVERIFY(one != 0); @@ -630,7 +630,7 @@ void tst_qsgpositioners::test_grid_spacing() void tst_qsgpositioners::test_grid_row_column_spacing() { - QSGView *canvas = createView(SRCDIR "/data/grid-row-column-spacing.qml"); + QSGView *canvas = createView(TESTDATA("grid-row-column-spacing.qml")); QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one"); QVERIFY(one != 0); @@ -663,7 +663,7 @@ void tst_qsgpositioners::test_grid_row_column_spacing() void tst_qsgpositioners::test_grid_animated() { - QSGView *canvas = createView(SRCDIR "/data/grid-animated.qml", false); + QSGView *canvas = createView(TESTDATA("grid-animated.qml"), false); canvas->rootObject()->setProperty("testRightToLeft", false); @@ -748,7 +748,7 @@ void tst_qsgpositioners::test_grid_animated() void tst_qsgpositioners::test_grid_animated_rightToLeft() { - QSGView *canvas = createView(SRCDIR "/data/grid-animated.qml", false); + QSGView *canvas = createView(TESTDATA("grid-animated.qml"), false); canvas->rootObject()->setProperty("testRightToLeft", true); @@ -833,7 +833,7 @@ void tst_qsgpositioners::test_grid_animated_rightToLeft() void tst_qsgpositioners::test_grid_zero_columns() { - QSGView *canvas = createView(SRCDIR "/data/gridzerocolumns.qml"); + QSGView *canvas = createView(TESTDATA("gridzerocolumns.qml")); QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one"); QVERIFY(one != 0); @@ -866,7 +866,7 @@ void tst_qsgpositioners::test_grid_zero_columns() void tst_qsgpositioners::test_propertychanges() { - QSGView *canvas = createView(SRCDIR "/data/propertychangestest.qml"); + QSGView *canvas = createView(TESTDATA("propertychangestest.qml")); QSGGrid *grid = qobject_cast<QSGGrid*>(canvas->rootObject()); QVERIFY(grid != 0); @@ -925,7 +925,7 @@ void tst_qsgpositioners::test_propertychanges() void tst_qsgpositioners::test_repeater() { - QSGView *canvas = createView(SRCDIR "/data/repeatertest.qml"); + QSGView *canvas = createView(TESTDATA("repeatertest.qml")); QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one"); QVERIFY(one != 0); @@ -948,7 +948,7 @@ void tst_qsgpositioners::test_repeater() void tst_qsgpositioners::test_flow() { - QSGView *canvas = createView(SRCDIR "/data/flowtest.qml"); + QSGView *canvas = createView(TESTDATA("flowtest.qml")); canvas->rootObject()->setProperty("testRightToLeft", false); @@ -984,7 +984,7 @@ void tst_qsgpositioners::test_flow() void tst_qsgpositioners::test_flow_rightToLeft() { - QSGView *canvas = createView(SRCDIR "/data/flowtest.qml"); + QSGView *canvas = createView(TESTDATA("flowtest.qml")); canvas->rootObject()->setProperty("testRightToLeft", true); @@ -1020,7 +1020,7 @@ void tst_qsgpositioners::test_flow_rightToLeft() void tst_qsgpositioners::test_flow_topToBottom() { - QSGView *canvas = createView(SRCDIR "/data/flowtest-toptobottom.qml"); + QSGView *canvas = createView(TESTDATA("flowtest-toptobottom.qml")); canvas->rootObject()->setProperty("testRightToLeft", false); @@ -1073,7 +1073,7 @@ void tst_qsgpositioners::test_flow_topToBottom() void tst_qsgpositioners::test_flow_resize() { - QSGView *canvas = createView(SRCDIR "/data/flowtest.qml"); + QSGView *canvas = createView(TESTDATA("flowtest.qml")); QSGItem *root = qobject_cast<QSGItem*>(canvas->rootObject()); QVERIFY(root); @@ -1107,7 +1107,7 @@ void tst_qsgpositioners::test_flow_resize() void tst_qsgpositioners::test_flow_resize_rightToLeft() { - QSGView *canvas = createView(SRCDIR "/data/flowtest.qml"); + QSGView *canvas = createView(TESTDATA("flowtest.qml")); QSGItem *root = qobject_cast<QSGItem*>(canvas->rootObject()); QVERIFY(root); @@ -1141,7 +1141,7 @@ void tst_qsgpositioners::test_flow_resize_rightToLeft() void tst_qsgpositioners::test_flow_implicit_resize() { - QSGView *canvas = createView(SRCDIR "/data/flow-testimplicitsize.qml"); + QSGView *canvas = createView(TESTDATA("flow-testimplicitsize.qml")); QVERIFY(canvas->rootObject() != 0); QSGFlow *flow = canvas->rootObject()->findChild<QSGFlow*>("flow"); @@ -1284,10 +1284,10 @@ void tst_qsgpositioners::test_mirroring() objectNames << "one" << "two" << "three" << "four" << "five"; foreach(const QString qmlFile, qmlFiles) { - QSGView *canvasA = createView(QString(SRCDIR) + "/data/" + qmlFile); + QSGView *canvasA = createView(TESTDATA(qmlFile)); QSGItem *rootA = qobject_cast<QSGItem*>(canvasA->rootObject()); - QSGView *canvasB = createView(QString(SRCDIR) + "/data/" + qmlFile); + QSGView *canvasB = createView(TESTDATA(qmlFile)); QSGItem *rootB = qobject_cast<QSGItem*>(canvasB->rootObject()); rootA->setProperty("testRightToLeft", true); // layoutDirection: Qt.RightToLeft @@ -1339,7 +1339,7 @@ void tst_qsgpositioners::test_mirroring() void tst_qsgpositioners::test_allInvisible() { //QTBUG-19361 - QSGView *canvas = createView(SRCDIR "/data/allInvisible.qml"); + QSGView *canvas = createView(TESTDATA("allInvisible.qml")); QSGItem *root = qobject_cast<QSGItem*>(canvas->rootObject()); QVERIFY(root); @@ -1397,15 +1397,15 @@ void tst_qsgpositioners::test_attachedproperties_data() { QTest::addColumn<QString>("filename"); - QTest::newRow("column") << SRCDIR "/data/attachedproperties-column.qml"; - QTest::newRow("row") << SRCDIR "/data/attachedproperties-row.qml"; - QTest::newRow("grid") << SRCDIR "/data/attachedproperties-grid.qml"; - QTest::newRow("flow") << SRCDIR "/data/attachedproperties-flow.qml"; + QTest::newRow("column") << TESTDATA("attachedproperties-column.qml"); + QTest::newRow("row") << TESTDATA("attachedproperties-row.qml"); + QTest::newRow("grid") << TESTDATA("attachedproperties-grid.qml"); + QTest::newRow("flow") << TESTDATA("attachedproperties-flow.qml"); } void tst_qsgpositioners::test_attachedproperties_dynamic() { - QSGView *canvas = createView(SRCDIR "/data/attachedproperties-dynamic.qml"); + QSGView *canvas = createView(TESTDATA("attachedproperties-dynamic.qml")); QVERIFY(canvas->rootObject() != 0); QSGRow *row = canvas->rootObject()->findChild<QSGRow *>("pos"); diff --git a/tests/auto/declarative/qsgtext/qsgtext.pro b/tests/auto/declarative/qsgtext/qsgtext.pro index b60df65e74..45ba723863 100644 --- a/tests/auto/declarative/qsgtext/qsgtext.pro +++ b/tests/auto/declarative/qsgtext/qsgtext.pro @@ -8,7 +8,9 @@ INCLUDEPATH += ../shared/ HEADERS += ../shared/testhttpserver.h SOURCES += ../shared/testhttpserver.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles CONFIG += insignificant_test parallel_test diff --git a/tests/auto/declarative/qsgtext/tst_qsgtext.cpp b/tests/auto/declarative/qsgtext/tst_qsgtext.cpp index 1428f32712..a59b00072a 100644 --- a/tests/auto/declarative/qsgtext/tst_qsgtext.cpp +++ b/tests/auto/declarative/qsgtext/tst_qsgtext.cpp @@ -53,9 +53,9 @@ #include <private/qapplication_p.h> #include <limits.h> #include <QtGui/QMouseEvent> +#include "../shared/util.h" #include "../../../shared/util.h" #include "testhttpserver.h" -#include <QtOpenGL/QGLShaderProgram> DEFINE_BOOL_CONFIG_OPTION(qmlDisableDistanceField, QML_DISABLE_DISTANCEFIELD) @@ -499,17 +499,17 @@ void tst_qsgtext::alignments_data() QTest::addColumn<int>("vAlign"); QTest::addColumn<QString>("expectfile"); - QTest::newRow("LT") << int(Qt::AlignLeft) << int(Qt::AlignTop) << SRCDIR "/data/alignments_lt.png"; - QTest::newRow("RT") << int(Qt::AlignRight) << int(Qt::AlignTop) << SRCDIR "/data/alignments_rt.png"; - QTest::newRow("CT") << int(Qt::AlignHCenter) << int(Qt::AlignTop) << SRCDIR "/data/alignments_ct.png"; + QTest::newRow("LT") << int(Qt::AlignLeft) << int(Qt::AlignTop) << TESTDATA("alignments_lt.png"); + QTest::newRow("RT") << int(Qt::AlignRight) << int(Qt::AlignTop) << TESTDATA("alignments_rt.png"); + QTest::newRow("CT") << int(Qt::AlignHCenter) << int(Qt::AlignTop) << TESTDATA("alignments_ct.png"); - QTest::newRow("LB") << int(Qt::AlignLeft) << int(Qt::AlignBottom) << SRCDIR "/data/alignments_lb.png"; - QTest::newRow("RB") << int(Qt::AlignRight) << int(Qt::AlignBottom) << SRCDIR "/data/alignments_rb.png"; - QTest::newRow("CB") << int(Qt::AlignHCenter) << int(Qt::AlignBottom) << SRCDIR "/data/alignments_cb.png"; + QTest::newRow("LB") << int(Qt::AlignLeft) << int(Qt::AlignBottom) << TESTDATA("alignments_lb.png"); + QTest::newRow("RB") << int(Qt::AlignRight) << int(Qt::AlignBottom) << TESTDATA("alignments_rb.png"); + QTest::newRow("CB") << int(Qt::AlignHCenter) << int(Qt::AlignBottom) << TESTDATA("alignments_cb.png"); - QTest::newRow("LC") << int(Qt::AlignLeft) << int(Qt::AlignVCenter) << SRCDIR "/data/alignments_lc.png"; - QTest::newRow("RC") << int(Qt::AlignRight) << int(Qt::AlignVCenter) << SRCDIR "/data/alignments_rc.png"; - QTest::newRow("CC") << int(Qt::AlignHCenter) << int(Qt::AlignVCenter) << SRCDIR "/data/alignments_cc.png"; + QTest::newRow("LC") << int(Qt::AlignLeft) << int(Qt::AlignVCenter) << TESTDATA("alignments_lc.png"); + QTest::newRow("RC") << int(Qt::AlignRight) << int(Qt::AlignVCenter) << TESTDATA("alignments_rc.png"); + QTest::newRow("CC") << int(Qt::AlignHCenter) << int(Qt::AlignVCenter) << TESTDATA("alignments_cc.png"); } @@ -529,7 +529,7 @@ void tst_qsgtext::alignments() QApplication::setFont(fn); #endif - QSGView *canvas = createView(SRCDIR "/data/alignments.qml"); + QSGView *canvas = createView(TESTDATA("alignments.qml")); canvas->show(); canvas->requestActivateWindow(); @@ -598,7 +598,7 @@ void tst_qsgtext::horizontalAlignment() void tst_qsgtext::horizontalAlignment_RightToLeft() { - QSGView *canvas = createView(SRCDIR "/data/horizontalAlignment_RightToLeft.qml"); + QSGView *canvas = createView(TESTDATA("horizontalAlignment_RightToLeft.qml")); QSGText *text = canvas->rootObject()->findChild<QSGText*>("text"); QVERIFY(text != 0); canvas->show(); @@ -1268,12 +1268,12 @@ void tst_qsgtext::embeddedImages_data() { QTest::addColumn<QUrl>("qmlfile"); QTest::addColumn<QString>("error"); - QTest::newRow("local") << QUrl::fromLocalFile(SRCDIR "/data/embeddedImagesLocal.qml") << ""; - QTest::newRow("local-error") << QUrl::fromLocalFile(SRCDIR "/data/embeddedImagesLocalError.qml") - << QUrl::fromLocalFile(SRCDIR "/data/embeddedImagesLocalError.qml").toString()+":3:1: QML Text: Cannot open: " + QUrl::fromLocalFile(SRCDIR "/data/http/notexists.png").toString(); - QTest::newRow("remote") << QUrl::fromLocalFile(SRCDIR "/data/embeddedImagesRemote.qml") << ""; - QTest::newRow("remote-error") << QUrl::fromLocalFile(SRCDIR "/data/embeddedImagesRemoteError.qml") - << QUrl::fromLocalFile(SRCDIR "/data/embeddedImagesRemoteError.qml").toString()+":3:1: QML Text: Error downloading http://127.0.0.1:14453/notexists.png - server replied: Not found"; + QTest::newRow("local") << QUrl::fromLocalFile(TESTDATA("embeddedImagesLocal.qml")) << ""; + QTest::newRow("local-error") << QUrl::fromLocalFile(TESTDATA("embeddedImagesLocalError.qml")) + << QUrl::fromLocalFile(TESTDATA("embeddedImagesLocalError.qml")).toString()+":3:1: QML Text: Cannot open: " + QUrl::fromLocalFile(TESTDATA("http/notexists.png")).toString(); + QTest::newRow("remote") << QUrl::fromLocalFile(TESTDATA("embeddedImagesRemote.qml")) << ""; + QTest::newRow("remote-error") << QUrl::fromLocalFile(TESTDATA("embeddedImagesRemoteError.qml")) + << QUrl::fromLocalFile(TESTDATA("embeddedImagesRemoteError.qml")).toString()+":3:1: QML Text: Error downloading http://127.0.0.1:14453/notexists.png - server replied: Not found"; } void tst_qsgtext::embeddedImages() @@ -1284,7 +1284,7 @@ void tst_qsgtext::embeddedImages() QFETCH(QString, error); TestHTTPServer server(14453); - server.serveDirectory(SRCDIR "/data/http"); + server.serveDirectory(TESTDATA("http")); if (!error.isEmpty()) QTest::ignoreMessage(QtWarningMsg, error.toLatin1()); @@ -1296,7 +1296,7 @@ void tst_qsgtext::embeddedImages() QTRY_COMPARE(textObject->resourcesLoading(), 0); - QPixmap pm(SRCDIR "/data/http/exists.png"); + QPixmap pm(TESTDATA("http/exists.png")); if (error.isEmpty()) { QCOMPARE(textObject->width(), double(pm.width())); QCOMPARE(textObject->height(), double(pm.height())); @@ -1311,7 +1311,7 @@ void tst_qsgtext::embeddedImages() void tst_qsgtext::lineCount() { - QSGView *canvas = createView(SRCDIR "/data/lineCount.qml"); + QSGView *canvas = createView(TESTDATA("lineCount.qml")); QSGText *myText = canvas->rootObject()->findChild<QSGText*>("myText"); QVERIFY(myText != 0); @@ -1340,7 +1340,7 @@ void tst_qsgtext::lineCount() void tst_qsgtext::lineHeight() { - QSGView *canvas = createView(SRCDIR "/data/lineHeight.qml"); + QSGView *canvas = createView(TESTDATA("lineHeight.qml")); QSGText *myText = canvas->rootObject()->findChild<QSGText*>("myText"); QVERIFY(myText != 0); @@ -1405,7 +1405,7 @@ void tst_qsgtext::implicitSize() void tst_qsgtext::lineLaidOut() { - QSGView *canvas = createView(SRCDIR "/data/lineLayout.qml"); + QSGView *canvas = createView(TESTDATA("lineLayout.qml")); QSGText *myText = canvas->rootObject()->findChild<QSGText*>("myText"); QVERIFY(myText != 0); diff --git a/tests/auto/declarative/qsgtextedit/qsgtextedit.pro b/tests/auto/declarative/qsgtextedit/qsgtextedit.pro index 0434d76d9f..41c7b65b56 100644 --- a/tests/auto/declarative/qsgtextedit/qsgtextedit.pro +++ b/tests/auto/declarative/qsgtextedit/qsgtextedit.pro @@ -5,6 +5,8 @@ macx:CONFIG -= app_bundle SOURCES += tst_qsgtextedit.cpp ../shared/testhttpserver.cpp HEADERS += ../shared/testhttpserver.h -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles QT += core-private gui-private v8-private declarative-private opengl-private network widgets-private testlib diff --git a/tests/auto/declarative/qsgtextedit/tst_qsgtextedit.cpp b/tests/auto/declarative/qsgtextedit/tst_qsgtextedit.cpp index 874522941d..6ab4b93a23 100644 --- a/tests/auto/declarative/qsgtextedit/tst_qsgtextedit.cpp +++ b/tests/auto/declarative/qsgtextedit/tst_qsgtextedit.cpp @@ -62,7 +62,7 @@ #include <QClipboard> #include <QMimeData> #include <private/qtextcontrol_p.h> -#include <QtOpenGL/QGLShaderProgram> +#include "../shared/util.h" #ifdef Q_WS_MAC #include <Carbon/Carbon.h> @@ -77,7 +77,7 @@ DEFINE_BOOL_CONFIG_OPTION(qmlDisableDistanceField, QML_DISABLE_DISTANCEFIELD) QString createExpectedFileIfNotFound(const QString& filebasename, const QImage& actual) { // XXX This will be replaced by some clever persistent platform image store. - QString persistent_dir = SRCDIR "/data"; + QString persistent_dir = TESTDATA(""); QString arch = "unknown-architecture"; // QTest needs to help with this. QString expectfile = persistent_dir + QDir::separator() + filebasename + "-" + arch + ".png"; @@ -425,7 +425,7 @@ void tst_qsgtextedit::alignments() QFETCH(int, vAlign); QFETCH(QString, expectfile); - QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/alignments.qml")); + QSGView canvas(QUrl::fromLocalFile(TESTDATA("alignments.qml"))); canvas.show(); canvas.requestActivateWindow(); @@ -484,7 +484,7 @@ void tst_qsgtextedit::hAlign() void tst_qsgtextedit::hAlign_RightToLeft() { - QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/horizontalAlignment_RightToLeft.qml")); + QSGView canvas(QUrl::fromLocalFile(TESTDATA("horizontalAlignment_RightToLeft.qml"))); QSGTextEdit *textEdit = canvas.rootObject()->findChild<QSGTextEdit*>("text"); QVERIFY(textEdit != 0); canvas.show(); @@ -964,7 +964,7 @@ void tst_qsgtextedit::isRightToLeft() void tst_qsgtextedit::keySelection() { - QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/navigation.qml")); + QSGView canvas(QUrl::fromLocalFile(TESTDATA("navigation.qml"))); canvas.show(); canvas.requestActivateWindow(); QTest::qWaitForWindowShown(&canvas); @@ -1354,19 +1354,19 @@ void tst_qsgtextedit::mouseSelection_data() QTest::addColumn<QString>("selectedText"); // import installed - QTest::newRow("on") << SRCDIR "/data/mouseselection_true.qml" << 4 << 9 << "45678"; - QTest::newRow("off") << SRCDIR "/data/mouseselection_false.qml" << 4 << 9 << QString(); - QTest::newRow("default") << SRCDIR "/data/mouseselection_default.qml" << 4 << 9 << QString(); - QTest::newRow("off word selection") << SRCDIR "/data/mouseselection_false_words.qml" << 4 << 9 << QString(); - QTest::newRow("on word selection (4,9)") << SRCDIR "/data/mouseselection_true_words.qml" << 4 << 9 << "0123456789"; - QTest::newRow("on word selection (2,13)") << SRCDIR "/data/mouseselection_true_words.qml" << 2 << 13 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - QTest::newRow("on word selection (2,30)") << SRCDIR "/data/mouseselection_true_words.qml" << 2 << 30 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - QTest::newRow("on word selection (9,13)") << SRCDIR "/data/mouseselection_true_words.qml" << 9 << 13 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - QTest::newRow("on word selection (9,30)") << SRCDIR "/data/mouseselection_true_words.qml" << 9 << 30 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - QTest::newRow("on word selection (13,2)") << SRCDIR "/data/mouseselection_true_words.qml" << 13 << 2 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - QTest::newRow("on word selection (20,2)") << SRCDIR "/data/mouseselection_true_words.qml" << 20 << 2 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - QTest::newRow("on word selection (12,9)") << SRCDIR "/data/mouseselection_true_words.qml" << 12 << 9 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - QTest::newRow("on word selection (30,9)") << SRCDIR "/data/mouseselection_true_words.qml" << 30 << 9 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + QTest::newRow("on") << TESTDATA("mouseselection_true.qml") << 4 << 9 << "45678"; + QTest::newRow("off") << TESTDATA("mouseselection_false.qml") << 4 << 9 << QString(); + QTest::newRow("default") << TESTDATA("mouseselection_default.qml") << 4 << 9 << QString(); + QTest::newRow("off word selection") << TESTDATA("mouseselection_false_words.qml") << 4 << 9 << QString(); + QTest::newRow("on word selection (4,9)") << TESTDATA("mouseselection_true_words.qml") << 4 << 9 << "0123456789"; + QTest::newRow("on word selection (2,13)") << TESTDATA("mouseselection_true_words.qml") << 2 << 13 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + QTest::newRow("on word selection (2,30)") << TESTDATA("mouseselection_true_words.qml") << 2 << 30 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + QTest::newRow("on word selection (9,13)") << TESTDATA("mouseselection_true_words.qml") << 9 << 13 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + QTest::newRow("on word selection (9,30)") << TESTDATA("mouseselection_true_words.qml") << 9 << 30 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + QTest::newRow("on word selection (13,2)") << TESTDATA("mouseselection_true_words.qml") << 13 << 2 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + QTest::newRow("on word selection (20,2)") << TESTDATA("mouseselection_true_words.qml") << 20 << 2 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + QTest::newRow("on word selection (12,9)") << TESTDATA("mouseselection_true_words.qml") << 12 << 9 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + QTest::newRow("on word selection (30,9)") << TESTDATA("mouseselection_true_words.qml") << 30 << 9 << "0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ"; } void tst_qsgtextedit::mouseSelection() @@ -1408,7 +1408,7 @@ void tst_qsgtextedit::mouseSelection() void tst_qsgtextedit::dragMouseSelection() { - QString qmlfile = SRCDIR "/data/mouseselection_true.qml"; + QString qmlfile = TESTDATA("mouseselection_true.qml"); QSGView canvas(QUrl::fromLocalFile(qmlfile)); @@ -1451,9 +1451,9 @@ void tst_qsgtextedit::mouseSelectionMode_data() QTest::addColumn<bool>("selectWords"); // import installed - QTest::newRow("SelectWords") << SRCDIR "/data/mouseselectionmode_words.qml" << true; - QTest::newRow("SelectCharacters") << SRCDIR "/data/mouseselectionmode_characters.qml" << false; - QTest::newRow("default") << SRCDIR "/data/mouseselectionmode_default.qml" << false; + QTest::newRow("SelectWords") << TESTDATA("mouseselectionmode_words.qml") << true; + QTest::newRow("SelectCharacters") << TESTDATA("mouseselectionmode_characters.qml") << false; + QTest::newRow("default") << TESTDATA("mouseselectionmode_default.qml") << false; } void tst_qsgtextedit::mouseSelectionMode() @@ -1495,7 +1495,7 @@ void tst_qsgtextedit::mouseSelectionMode() void tst_qsgtextedit::inputMethodHints() { - QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/inputmethodhints.qml")); + QSGView canvas(QUrl::fromLocalFile(TESTDATA("inputmethodhints.qml"))); canvas.show(); canvas.requestActivateWindow(); @@ -1509,7 +1509,7 @@ void tst_qsgtextedit::inputMethodHints() void tst_qsgtextedit::positionAt() { - QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/positionAt.qml")); + QSGView canvas(QUrl::fromLocalFile(TESTDATA("positionAt.qml"))); QVERIFY(canvas.rootObject() != 0); canvas.show(); canvas.requestActivateWindow(); @@ -1579,7 +1579,7 @@ void tst_qsgtextedit::positionAt() void tst_qsgtextedit::cursorDelegate() { - QSGView view(QUrl::fromLocalFile(SRCDIR "/data/cursorTest.qml")); + QSGView view(QUrl::fromLocalFile(TESTDATA("cursorTest.qml"))); view.show(); view.requestActivateWindow(); QSGTextEdit *textEditObject = view.rootObject()->findChild<QSGTextEdit*>("textEditObject"); @@ -1647,7 +1647,7 @@ void tst_qsgtextedit::cursorDelegate() void tst_qsgtextedit::cursorVisible() { - QSGView view(QUrl::fromLocalFile(SRCDIR "/data/cursorVisible.qml")); + QSGView view(QUrl::fromLocalFile(TESTDATA("cursorVisible.qml"))); view.show(); view.requestActivateWindow(); QTest::qWaitForWindowShown(&view); @@ -1726,9 +1726,9 @@ void tst_qsgtextedit::delegateLoading() QFETCH(QString, error); TestHTTPServer server(42332); - server.serveDirectory(SRCDIR "/data/httpfail", TestHTTPServer::Disconnect); - server.serveDirectory(SRCDIR "/data/httpslow", TestHTTPServer::Delay); - server.serveDirectory(SRCDIR "/data/http"); + server.serveDirectory(TESTDATA("httpfail"), TestHTTPServer::Disconnect); + server.serveDirectory(TESTDATA("httpslow"), TestHTTPServer::Delay); + server.serveDirectory(TESTDATA("http")); QSGView view(QUrl(QLatin1String("http://localhost:42332/") + qmlfile)); view.show(); @@ -1767,7 +1767,7 @@ the extent of the text, then they should ignore the keys. */ void tst_qsgtextedit::navigation() { - QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/navigation.qml")); + QSGView canvas(QUrl::fromLocalFile(TESTDATA("navigation.qml"))); canvas.show(); canvas.requestActivateWindow(); @@ -1887,7 +1887,7 @@ void tst_qsgtextedit::canPasteEmpty() { void tst_qsgtextedit::readOnly() { - QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/readOnly.qml")); + QSGView canvas(QUrl::fromLocalFile(TESTDATA("readOnly.qml"))); canvas.show(); canvas.requestActivateWindow(); @@ -1972,7 +1972,7 @@ public: void tst_qsgtextedit::textInput() { - QSGView view(QUrl::fromLocalFile(SRCDIR "/data/inputMethodEvent.qml")); + QSGView view(QUrl::fromLocalFile(TESTDATA("inputMethodEvent.qml"))); view.show(); view.requestActivateWindow(); QTest::qWaitForWindowShown(&view); @@ -1996,7 +1996,7 @@ void tst_qsgtextedit::textInput() void tst_qsgtextedit::openInputPanel() { - QSGView view(QUrl::fromLocalFile(SRCDIR "/data/openInputPanel.qml")); + QSGView view(QUrl::fromLocalFile(TESTDATA("openInputPanel.qml"))); view.show(); view.requestActivateWindow(); QTest::qWaitForWindowShown(&view); @@ -2084,7 +2084,7 @@ void tst_qsgtextedit::openInputPanel() void tst_qsgtextedit::geometrySignals() { - QDeclarativeComponent component(&engine, SRCDIR "/data/geometrySignals.qml"); + QDeclarativeComponent component(&engine, TESTDATA("geometrySignals.qml")); QObject *o = component.create(); QVERIFY(o); QCOMPARE(o->property("bindingWidth").toInt(), 400); @@ -2199,7 +2199,7 @@ void tst_qsgtextedit::preeditMicroFocus() #else QString preeditText = "super"; - QSGView view(QUrl::fromLocalFile(SRCDIR "/data/inputMethodEvent.qml")); + QSGView view(QUrl::fromLocalFile(TESTDATA("inputMethodEvent.qml"))); view.show(); view.requestActivateWindow(); QTest::qWaitForWindowShown(&view); @@ -2262,7 +2262,7 @@ void tst_qsgtextedit::inputContextMouseHandler() #else QString text = "supercalifragisiticexpialidocious!"; - QSGView view(QUrl::fromLocalFile(SRCDIR "/data/inputContext.qml")); + QSGView view(QUrl::fromLocalFile(TESTDATA("inputContext.qml"))); MyInputContext ic; // QSGCanvas won't set the Qt::WA_InputMethodEnabled flag unless a suitable item has focus // and QWidget won't allow an input context to be set when the flag is not set. @@ -2381,7 +2381,7 @@ void tst_qsgtextedit::inputMethodComposing() { QString text = "supercalifragisiticexpialidocious!"; - QSGView view(QUrl::fromLocalFile(SRCDIR "/data/inputContext.qml")); + QSGView view(QUrl::fromLocalFile(TESTDATA("inputContext.qml"))); view.show(); view.requestActivateWindow(); QTest::qWaitForWindowShown(&view); @@ -2417,7 +2417,7 @@ void tst_qsgtextedit::inputMethodComposing() void tst_qsgtextedit::cursorRectangleSize() { - QSGView *canvas = new QSGView(QUrl::fromLocalFile(SRCDIR "/data/CursorRect.qml")); + QSGView *canvas = new QSGView(QUrl::fromLocalFile(TESTDATA("CursorRect.qml"))); QVERIFY(canvas->rootObject() != 0); canvas->show(); canvas->requestActivateWindow(); diff --git a/tests/auto/declarative/qsgtextinput/qsgtextinput.pro b/tests/auto/declarative/qsgtextinput/qsgtextinput.pro index 8c7d67cc1e..1c988be880 100644 --- a/tests/auto/declarative/qsgtextinput/qsgtextinput.pro +++ b/tests/auto/declarative/qsgtextinput/qsgtextinput.pro @@ -4,6 +4,8 @@ macx:CONFIG -= app_bundle SOURCES += tst_qsgtextinput.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles QT += core-private gui-private v8-private declarative-private opengl-private testlib diff --git a/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp b/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp index b2960dd4c4..5cc0f8ee62 100644 --- a/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp +++ b/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include <qtest.h> #include <QtTest/QSignalSpy> +#include "../shared/util.h" #include "../../../shared/util.h" #include <QtDeclarative/qdeclarativeengine.h> #include <QFile> @@ -68,7 +69,7 @@ DEFINE_BOOL_CONFIG_OPTION(qmlDisableDistanceField, QML_DISABLE_DISTANCEFIELD) QString createExpectedFileIfNotFound(const QString& filebasename, const QImage& actual) { // XXX This will be replaced by some clever persistent platform image store. - QString persistent_dir = SRCDIR "/data"; + QString persistent_dir = TESTDATA(""); QString arch = "unknown-architecture"; // QTest needs to help with this. QString expectfile = persistent_dir + QDir::separator() + filebasename + "-" + arch + ".png"; @@ -956,7 +957,7 @@ void tst_qsgtextinput::moveCursorSelectionSequence() void tst_qsgtextinput::dragMouseSelection() { - QString qmlfile = SRCDIR "/data/mouseselection_true.qml"; + QString qmlfile = TESTDATA("mouseselection_true.qml"); QSGView canvas(QUrl::fromLocalFile(qmlfile)); @@ -1001,9 +1002,9 @@ void tst_qsgtextinput::mouseSelectionMode_data() QTest::addColumn<bool>("selectWords"); // import installed - QTest::newRow("SelectWords") << SRCDIR "/data/mouseselectionmode_words.qml" << true; - QTest::newRow("SelectCharacters") << SRCDIR "/data/mouseselectionmode_characters.qml" << false; - QTest::newRow("default") << SRCDIR "/data/mouseselectionmode_default.qml" << false; + QTest::newRow("SelectWords") << TESTDATA("mouseselectionmode_words.qml") << true; + QTest::newRow("SelectCharacters") << TESTDATA("mouseselectionmode_characters.qml") << false; + QTest::newRow("default") << TESTDATA("mouseselectionmode_default.qml") << false; } void tst_qsgtextinput::mouseSelectionMode() @@ -1057,7 +1058,7 @@ void tst_qsgtextinput::horizontalAlignment() QFETCH(int, hAlign); QFETCH(QString, expectfile); - QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/horizontalAlignment.qml")); + QSGView canvas(QUrl::fromLocalFile(TESTDATA("horizontalAlignment.qml"))); canvas.show(); canvas.requestActivateWindow(); @@ -1077,7 +1078,7 @@ void tst_qsgtextinput::horizontalAlignment() void tst_qsgtextinput::horizontalAlignment_RightToLeft() { - QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/horizontalAlignment_RightToLeft.qml")); + QSGView canvas(QUrl::fromLocalFile(TESTDATA("horizontalAlignment_RightToLeft.qml"))); QSGTextInput *textInput = canvas.rootObject()->findChild<QSGTextInput*>("text"); QVERIFY(textInput != 0); canvas.show(); @@ -1189,7 +1190,7 @@ void tst_qsgtextinput::horizontalAlignment_RightToLeft() void tst_qsgtextinput::positionAt() { - QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/positionAt.qml")); + QSGView canvas(QUrl::fromLocalFile(TESTDATA("positionAt.qml"))); QVERIFY(canvas.rootObject() != 0); canvas.show(); canvas.requestActivateWindow(); @@ -1313,7 +1314,7 @@ void tst_qsgtextinput::positionAt() void tst_qsgtextinput::maxLength() { - QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/maxLength.qml")); + QSGView canvas(QUrl::fromLocalFile(TESTDATA("maxLength.qml"))); QVERIFY(canvas.rootObject() != 0); canvas.show(); canvas.requestActivateWindow(); @@ -1344,7 +1345,7 @@ void tst_qsgtextinput::masks() { //Not a comprehensive test of the possible masks, that's done elsewhere (QLineEdit) //QString componentStr = "import QtQuick 2.0\nTextInput { inputMask: 'HHHHhhhh'; }"; - QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/masks.qml")); + QSGView canvas(QUrl::fromLocalFile(TESTDATA("masks.qml"))); canvas.show(); canvas.requestActivateWindow(); QVERIFY(canvas.rootObject() != 0); @@ -1369,7 +1370,7 @@ void tst_qsgtextinput::validators() // so you may need to run their tests first. All validators are checked // here to ensure that their exposure to QML is working. - QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/validators.qml")); + QSGView canvas(QUrl::fromLocalFile(TESTDATA("validators.qml"))); canvas.show(); canvas.requestActivateWindow(); @@ -1473,7 +1474,7 @@ void tst_qsgtextinput::validators() void tst_qsgtextinput::inputMethods() { - QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/inputmethods.qml")); + QSGView canvas(QUrl::fromLocalFile(TESTDATA("inputmethods.qml"))); canvas.show(); canvas.requestActivateWindow(); QTest::qWaitForWindowShown(&canvas); @@ -1521,7 +1522,7 @@ the extent of the text, then they should ignore the keys. */ void tst_qsgtextinput::navigation() { - QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/navigation.qml")); + QSGView canvas(QUrl::fromLocalFile(TESTDATA("navigation.qml"))); canvas.show(); canvas.requestActivateWindow(); @@ -1560,7 +1561,7 @@ void tst_qsgtextinput::navigation() void tst_qsgtextinput::navigation_RTL() { - QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/navigation.qml")); + QSGView canvas(QUrl::fromLocalFile(TESTDATA("navigation.qml"))); canvas.show(); canvas.requestActivateWindow(); @@ -1732,7 +1733,7 @@ void tst_qsgtextinput::passwordCharacter() void tst_qsgtextinput::cursorDelegate() { - QSGView view(QUrl::fromLocalFile(SRCDIR "/data/cursorTest.qml")); + QSGView view(QUrl::fromLocalFile(TESTDATA("cursorTest.qml"))); view.show(); view.requestActivateWindow(); QSGTextInput *textInputObject = view.rootObject()->findChild<QSGTextInput*>("textInputObject"); @@ -1759,7 +1760,7 @@ void tst_qsgtextinput::cursorDelegate() void tst_qsgtextinput::cursorVisible() { - QSGView view(QUrl::fromLocalFile(SRCDIR "/data/cursorVisible.qml")); + QSGView view(QUrl::fromLocalFile(TESTDATA("cursorVisible.qml"))); view.show(); view.requestActivateWindow(); QTest::qWaitForWindowShown(&view); @@ -1877,7 +1878,7 @@ void tst_qsgtextinput::cursorRectangle() void tst_qsgtextinput::readOnly() { - QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/readOnly.qml")); + QSGView canvas(QUrl::fromLocalFile(TESTDATA("readOnly.qml"))); canvas.show(); canvas.requestActivateWindow(); @@ -1904,7 +1905,7 @@ void tst_qsgtextinput::readOnly() void tst_qsgtextinput::echoMode() { - QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/echoMode.qml")); + QSGView canvas(QUrl::fromLocalFile(TESTDATA("echoMode.qml"))); canvas.show(); canvas.requestActivateWindow(); QTest::qWaitForWindowShown(&canvas); @@ -1974,7 +1975,7 @@ void tst_qsgtextinput::echoMode() #ifdef QT_GUI_PASSWORD_ECHO_DELAY void tst_qdeclarativetextinput::passwordEchoDelay() { - QSGView canvas(QUrl::fromLocalFile(SRCDIR "/data/echoMode.qml")); + QSGView canvas(QUrl::fromLocalFile(TESTDATA("echoMode.qml"))); canvas.show(); canvas.setFocus(); QGuiApplication::setActiveWindow(&canvas); @@ -2083,7 +2084,7 @@ public: void tst_qsgtextinput::openInputPanel() { - QSGView view(QUrl::fromLocalFile(SRCDIR "/data/openInputPanel.qml")); + QSGView view(QUrl::fromLocalFile(TESTDATA("openInputPanel.qml"))); view.show(); view.requestActivateWindow(); QTest::qWaitForWindowShown(&view); @@ -2222,7 +2223,7 @@ void tst_qsgtextinput::focusOutClearSelection() void tst_qsgtextinput::geometrySignals() { - QDeclarativeComponent component(&engine, SRCDIR "/data/geometrySignals.qml"); + QDeclarativeComponent component(&engine, TESTDATA("geometrySignals.qml")); QObject *o = component.create(); QVERIFY(o); QCOMPARE(o->property("bindingWidth").toInt(), 400); @@ -2281,7 +2282,7 @@ void tst_qsgtextinput::preeditAutoScroll() #else QString preeditText = "califragisiticexpialidocious!"; - QSGView view(QUrl::fromLocalFile(SRCDIR "/data/preeditAutoScroll.qml")); + QSGView view(QUrl::fromLocalFile(TESTDATA("preeditAutoScroll.qml"))); MyInputContext ic; // QSGCanvas won't set the Qt::WA_InputMethodEnabled flag unless a suitable item has active focus // and QWidget won't allow an input context to be set when the flag is not set. @@ -2372,7 +2373,7 @@ void tst_qsgtextinput::preeditMicroFocus() #else QString preeditText = "super"; - QSGView view(QUrl::fromLocalFile(SRCDIR "/data/inputMethodEvent.qml")); + QSGView view(QUrl::fromLocalFile(TESTDATA("inputMethodEvent.qml"))); MyInputContext ic; // QSGCanvas won't set the Qt::WA_InputMethodEnabled flag unless a suitable item has active focus // and QWidget won't allow an input context to be set when the flag is not set. @@ -2433,7 +2434,7 @@ void tst_qsgtextinput::inputContextMouseHandler() #else QString text = "supercalifragisiticexpialidocious!"; - QSGView view(QUrl::fromLocalFile(SRCDIR "/data/inputContext.qml")); + QSGView view(QUrl::fromLocalFile(TESTDATA("inputContext.qml"))); MyInputContext ic; // QSGCanvas won't set the Qt::WA_InputMethodEnabled flag unless a suitable item has active focus // and QWidget won't allow an input context to be set when the flag is not set. @@ -2550,7 +2551,7 @@ void tst_qsgtextinput::inputMethodComposing() { QString text = "supercalifragisiticexpialidocious!"; - QSGView view(QUrl::fromLocalFile(SRCDIR "/data/inputContext.qml")); + QSGView view(QUrl::fromLocalFile(TESTDATA("inputContext.qml"))); view.show(); view.requestActivateWindow(); QTest::qWaitForWindowShown(&view); @@ -2583,7 +2584,7 @@ void tst_qsgtextinput::inputMethodComposing() void tst_qsgtextinput::cursorRectangleSize() { - QSGView *canvas = new QSGView(QUrl::fromLocalFile(SRCDIR "/data/positionAt.qml")); + QSGView *canvas = new QSGView(QUrl::fromLocalFile(TESTDATA("positionAt.qml"))); QVERIFY(canvas->rootObject() != 0); canvas->show(); canvas->requestActivateWindow(); @@ -2607,7 +2608,7 @@ void tst_qsgtextinput::cursorRectangleSize() void tst_qsgtextinput::tripleClickSelectsAll() { - QString qmlfile = SRCDIR "/data/positionAt.qml"; + QString qmlfile = TESTDATA("positionAt.qml"); QSGView view(QUrl::fromLocalFile(qmlfile)); view.show(); view.requestActivateWindow(); diff --git a/tests/auto/declarative/qsgview/qsgview.pro b/tests/auto/declarative/qsgview/qsgview.pro index cd6a70fef6..dd67cff632 100644 --- a/tests/auto/declarative/qsgview/qsgview.pro +++ b/tests/auto/declarative/qsgview/qsgview.pro @@ -4,6 +4,8 @@ macx:CONFIG -= app_bundle SOURCES += tst_qsgview.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles QT += core-private gui-private declarative-private testlib diff --git a/tests/auto/declarative/qsgview/tst_qsgview.cpp b/tests/auto/declarative/qsgview/tst_qsgview.cpp index e315d9ec2e..58594f01bf 100644 --- a/tests/auto/declarative/qsgview/tst_qsgview.cpp +++ b/tests/auto/declarative/qsgview/tst_qsgview.cpp @@ -44,6 +44,7 @@ #include <QtDeclarative/qdeclarativecontext.h> #include <QtDeclarative/qsgview.h> #include <QtDeclarative/qsgitem.h> +#include "../shared/util.h" #include "../../../shared/util.h" #include <QtGui/QWindow> #include <QtCore/QDebug> @@ -73,7 +74,7 @@ void tst_QSGView::resizemodeitem() QVERIFY(canvas); canvas->setResizeMode(QSGView::SizeRootObjectToView); QCOMPARE(QSize(0,0), canvas->initialSize()); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/resizemodeitem.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("resizemodeitem.qml"))); QSGItem* item = qobject_cast<QSGItem*>(canvas->rootObject()); QVERIFY(item); window.show(); @@ -87,13 +88,9 @@ void tst_QSGView::resizemodeitem() QCOMPARE(canvas->size(), canvas->sizeHint()); QCOMPARE(canvas->size(), canvas->initialSize()); - qDebug() << window.size(); - qDebug() << "canvas size:" << canvas->size(); // size update from view canvas->resize(QSize(80,100)); QTest::qWait(50); - qDebug() << window.size(); - qDebug() << "canvas size:" << canvas->size(); QCOMPARE(item->width(), 80.0); QCOMPARE(item->height(), 100.0); @@ -124,7 +121,7 @@ void tst_QSGView::resizemodeitem() canvas = new QSGView(&window); QVERIFY(canvas); canvas->setResizeMode(QSGView::SizeViewToRootObject); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/resizemodeitem.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("resizemodeitem.qml"))); item = qobject_cast<QSGItem*>(canvas->rootObject()); QVERIFY(item); window.show(); @@ -171,7 +168,7 @@ void tst_QSGView::resizemodeitem() canvas->resize(300, 300); canvas->setResizeMode(QSGView::SizeRootObjectToView); QCOMPARE(QSize(0,0), canvas->initialSize()); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/resizemodeitem.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("resizemodeitem.qml"))); canvas->resize(300, 300); item = qobject_cast<QSGItem*>(canvas->rootObject()); QVERIFY(item); @@ -199,7 +196,7 @@ void tst_QSGView::errors() QSGView *canvas = new QSGView; QVERIFY(canvas); QtMsgHandler old = qInstallMsgHandler(silentErrorsMsgHandler); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/error1.qml")); + canvas->setSource(QUrl::fromLocalFile(TESTDATA("error1.qml"))); qInstallMsgHandler(old); QVERIFY(canvas->status() == QSGView::Error); QVERIFY(canvas->errors().count() == 1); diff --git a/tests/auto/declarative/qsgvisualdatamodel/qsgvisualdatamodel.pro b/tests/auto/declarative/qsgvisualdatamodel/qsgvisualdatamodel.pro index ad5f4f32de..1e8b8a29d3 100644 --- a/tests/auto/declarative/qsgvisualdatamodel/qsgvisualdatamodel.pro +++ b/tests/auto/declarative/qsgvisualdatamodel/qsgvisualdatamodel.pro @@ -4,7 +4,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_qsgvisualdatamodel.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles CONFIG += parallel_test diff --git a/tests/auto/declarative/qsgvisualdatamodel/tst_qsgvisualdatamodel.cpp b/tests/auto/declarative/qsgvisualdatamodel/tst_qsgvisualdatamodel.cpp index 63e40cdb60..33558fe8a2 100644 --- a/tests/auto/declarative/qsgvisualdatamodel/tst_qsgvisualdatamodel.cpp +++ b/tests/auto/declarative/qsgvisualdatamodel/tst_qsgvisualdatamodel.cpp @@ -38,6 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +#include "../shared/util.h" #include "../../../shared/util.h" #include <qtest.h> #include <QtTest/QSignalSpy> @@ -54,7 +55,6 @@ #include <private/qdeclarativechangeset_p.h> #include <private/qdeclarativeengine_p.h> #include <math.h> -#include <QtOpenGL/QGLShaderProgram> template <typename T, int N> int lengthOf(const T (&)[N]) { return N; } @@ -239,7 +239,7 @@ tst_qsgvisualdatamodel::tst_qsgvisualdatamodel() void tst_qsgvisualdatamodel::rootIndex() { QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/visualdatamodel.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("visualdatamodel.qml"))); QStandardItemModel model; initStandardTreeModel(&model); @@ -272,7 +272,7 @@ void tst_qsgvisualdatamodel::updateLayout() view.rootContext()->setContextProperty("myModel", &model); - view.setSource(QUrl::fromLocalFile(SRCDIR "/data/datalist.qml")); + view.setSource(QUrl::fromLocalFile(TESTDATA("datalist.qml"))); QSGListView *listview = qobject_cast<QSGListView*>(view.rootObject()); QVERIFY(listview != 0); @@ -312,7 +312,7 @@ void tst_qsgvisualdatamodel::childChanged() view.rootContext()->setContextProperty("myModel", &model); - view.setSource(QUrl::fromLocalFile(SRCDIR "/data/datalist.qml")); + view.setSource(QUrl::fromLocalFile(TESTDATA("datalist.qml"))); QSGListView *listview = qobject_cast<QSGListView*>(view.rootObject()); QVERIFY(listview != 0); @@ -371,7 +371,7 @@ void tst_qsgvisualdatamodel::objectListModel() QDeclarativeContext *ctxt = view.rootContext(); ctxt->setContextProperty("myModel", QVariant::fromValue(dataList)); - view.setSource(QUrl::fromLocalFile(SRCDIR "/data/objectlist.qml")); + view.setSource(QUrl::fromLocalFile(TESTDATA("objectlist.qml"))); QSGListView *listview = qobject_cast<QSGListView*>(view.rootObject()); QVERIFY(listview != 0); @@ -399,7 +399,7 @@ void tst_qsgvisualdatamodel::singleRole() QDeclarativeContext *ctxt = view.rootContext(); ctxt->setContextProperty("myModel", &model); - view.setSource(QUrl::fromLocalFile(SRCDIR "/data/singlerole1.qml")); + view.setSource(QUrl::fromLocalFile(TESTDATA("singlerole1.qml"))); QSGListView *listview = qobject_cast<QSGListView*>(view.rootObject()); QVERIFY(listview != 0); @@ -421,7 +421,7 @@ void tst_qsgvisualdatamodel::singleRole() QDeclarativeContext *ctxt = view.rootContext(); ctxt->setContextProperty("myModel", &model); - view.setSource(QUrl::fromLocalFile(SRCDIR "/data/singlerole2.qml")); + view.setSource(QUrl::fromLocalFile(TESTDATA("singlerole2.qml"))); QSGListView *listview = qobject_cast<QSGListView*>(view.rootObject()); QVERIFY(listview != 0); @@ -443,7 +443,7 @@ void tst_qsgvisualdatamodel::singleRole() QDeclarativeContext *ctxt = view.rootContext(); ctxt->setContextProperty("myModel", &model); - view.setSource(QUrl::fromLocalFile(SRCDIR "/data/singlerole2.qml")); + view.setSource(QUrl::fromLocalFile(TESTDATA("singlerole2.qml"))); QSGListView *listview = qobject_cast<QSGListView*>(view.rootObject()); QVERIFY(listview != 0); @@ -469,7 +469,7 @@ void tst_qsgvisualdatamodel::modelProperties() QDeclarativeContext *ctxt = view.rootContext(); ctxt->setContextProperty("myModel", &model); - view.setSource(QUrl::fromLocalFile(SRCDIR "/data/modelproperties.qml")); + view.setSource(QUrl::fromLocalFile(TESTDATA("modelproperties.qml"))); QSGListView *listview = qobject_cast<QSGListView*>(view.rootObject()); QVERIFY(listview != 0); @@ -502,7 +502,7 @@ void tst_qsgvisualdatamodel::modelProperties() QDeclarativeContext *ctxt = view.rootContext(); ctxt->setContextProperty("myModel", QVariant::fromValue(dataList)); - view.setSource(QUrl::fromLocalFile(SRCDIR "/data/modelproperties.qml")); + view.setSource(QUrl::fromLocalFile(TESTDATA("modelproperties.qml"))); QSGListView *listview = qobject_cast<QSGListView*>(view.rootObject()); QVERIFY(listview != 0); @@ -531,7 +531,7 @@ void tst_qsgvisualdatamodel::modelProperties() view.rootContext()->setContextProperty("myModel", &model); - QUrl source(QUrl::fromLocalFile(SRCDIR "/data/modelproperties2.qml")); + QUrl source(QUrl::fromLocalFile(TESTDATA("modelproperties2.qml"))); //3 items, 3 warnings each QTest::ignoreMessage(QtWarningMsg, source.toString().toLatin1() + ":13: ReferenceError: Can't find variable: modelData"); @@ -577,7 +577,7 @@ void tst_qsgvisualdatamodel::noDelegate() view.rootContext()->setContextProperty("myModel", &model); - view.setSource(QUrl::fromLocalFile(SRCDIR "/data/datalist.qml")); + view.setSource(QUrl::fromLocalFile(TESTDATA("datalist.qml"))); QSGListView *listview = qobject_cast<QSGListView*>(view.rootObject()); QVERIFY(listview != 0); @@ -603,7 +603,7 @@ void tst_qsgvisualdatamodel::qaimRowsMoved() QFETCH(int, expectCount); QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/visualdatamodel.qml")); + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("visualdatamodel.qml"))); SingleRoleModel model; model.list.clear(); @@ -692,7 +692,7 @@ void tst_qsgvisualdatamodel::remove() QDeclarativeContext *ctxt = view.rootContext(); ctxt->setContextProperty("myModel", &model); - view.setSource(QUrl::fromLocalFile(SRCDIR "/data/groups.qml")); + view.setSource(QUrl::fromLocalFile(TESTDATA("groups.qml"))); QSGListView *listview = qobject_cast<QSGListView*>(view.rootObject()); QVERIFY(listview != 0); @@ -789,7 +789,7 @@ void tst_qsgvisualdatamodel::move() QDeclarativeContext *ctxt = view.rootContext(); ctxt->setContextProperty("myModel", &model); - view.setSource(QUrl::fromLocalFile(SRCDIR "/data/groups.qml")); + view.setSource(QUrl::fromLocalFile(TESTDATA("groups.qml"))); QSGListView *listview = qobject_cast<QSGListView*>(view.rootObject()); QVERIFY(listview != 0); @@ -964,7 +964,7 @@ void tst_qsgvisualdatamodel::groups() QDeclarativeContext *ctxt = view.rootContext(); ctxt->setContextProperty("myModel", &model); - view.setSource(QUrl::fromLocalFile(SRCDIR "/data/groups.qml")); + view.setSource(QUrl::fromLocalFile(TESTDATA("groups.qml"))); QSGListView *listview = qobject_cast<QSGListView*>(view.rootObject()); QVERIFY(listview != 0); @@ -1282,7 +1282,7 @@ void tst_qsgvisualdatamodel::get() QDeclarativeContext *ctxt = view.rootContext(); ctxt->setContextProperty("myModel", &model); - view.setSource(QUrl::fromLocalFile(SRCDIR "/data/groups.qml")); + view.setSource(QUrl::fromLocalFile(TESTDATA("groups.qml"))); QSGListView *listview = qobject_cast<QSGListView*>(view.rootObject()); QVERIFY(listview != 0); @@ -1441,7 +1441,7 @@ void tst_qsgvisualdatamodel::create() QDeclarativeContext *ctxt = view.rootContext(); ctxt->setContextProperty("myModel", &model); - view.setSource(QUrl::fromLocalFile(SRCDIR "/data/create.qml")); + view.setSource(QUrl::fromLocalFile(TESTDATA("create.qml"))); QSGListView *listview = qobject_cast<QSGListView*>(view.rootObject()); QVERIFY(listview != 0); diff --git a/tests/auto/declarative/shared/util.h b/tests/auto/declarative/shared/util.h index f353eabf76..eac2c4ec12 100644 --- a/tests/auto/declarative/shared/util.h +++ b/tests/auto/declarative/shared/util.h @@ -43,6 +43,7 @@ #define QDECLARATIVETESTUTILS_H #include <QtCore/qdir.h> +#include <QtCore/qcoreapplication.h> namespace QDeclarativeTestUtils { diff --git a/tests/auto/declarative/v4/tst_v4.cpp b/tests/auto/declarative/v4/tst_v4.cpp index 4c04e155bf..0b6b2c24f7 100644 --- a/tests/auto/declarative/v4/tst_v4.cpp +++ b/tests/auto/declarative/v4/tst_v4.cpp @@ -48,12 +48,12 @@ #include <private/qv4compiler_p.h> +#include "../shared/util.h" #include "testtypes.h" inline QUrl TEST_FILE(const QString &filename) { - QFileInfo fileInfo(__FILE__); - return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath("data/" + filename)); + return QUrl::fromLocalFile(TESTDATA(filename)); } inline QUrl TEST_FILE(const char *filename) diff --git a/tests/auto/declarative/v4/v4.pro b/tests/auto/declarative/v4/v4.pro index 6a9574d8ed..04d20f0fc3 100644 --- a/tests/auto/declarative/v4/v4.pro +++ b/tests/auto/declarative/v4/v4.pro @@ -6,7 +6,9 @@ SOURCES += tst_v4.cpp \ testtypes.cpp HEADERS += testtypes.h -DEFINES += SRCDIR=\\\"$$PWD\\\" +testDataFiles.files = data +testDataFiles.path = . +DEPLOYMENT += testDataFiles CONFIG += parallel_test |