aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativebehaviors
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2011-10-12 13:46:02 +1000
committerQt by Nokia <qt-info@nokia.com>2011-10-14 02:39:59 +0200
commit6b497734df0c4f13f6b7185801fc69ce680c698c (patch)
tree66b0b8cd32a91f8c7e753a3ef124050188035c3c /tests/auto/declarative/qdeclarativebehaviors
parent5f7c22001163eb4bce25be1cfee4e84c5a25ff09 (diff)
Use TESTDATA macro in declarative tests.
Includes a few other minor cleanups as well. Task-number: QTBUG-21721 Change-Id: I5b1c2c116e63748c6b4199183212de8a00037af1 Reviewed-on: http://codereview.qt-project.org/6473 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'tests/auto/declarative/qdeclarativebehaviors')
-rw-r--r--tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro4
-rw-r--r--tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp45
2 files changed, 26 insertions, 23 deletions
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);