Skip to content

Commit

Permalink
Use TESTDATA macro in declarative tests.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Michael Brasser authored and Qt by Nokia committed Oct 14, 2011
1 parent 5f7c220 commit 6b49773
Show file tree
Hide file tree
Showing 101 changed files with 796 additions and 726 deletions.
Expand Up @@ -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

Expand Down

Large diffs are not rendered by default.

Expand Up @@ -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

Expand Down
Expand Up @@ -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
Expand Down Expand Up @@ -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());
Expand All @@ -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);

Expand All @@ -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);

Expand All @@ -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);

Expand All @@ -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);

Expand All @@ -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);

Expand All @@ -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);

Expand Down Expand Up @@ -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);
Expand All @@ -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);

Expand All @@ -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);

Expand All @@ -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);

Expand All @@ -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);

Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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));
Expand All @@ -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);

Expand All @@ -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);

Expand All @@ -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
}
Expand All @@ -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);

Expand All @@ -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);

Expand Down Expand Up @@ -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);

Expand Down
Expand Up @@ -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

Expand Down
Expand Up @@ -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
Expand All @@ -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);

Expand Down Expand Up @@ -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);
Expand All @@ -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);

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);

Expand Down
Expand Up @@ -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
Expand Up @@ -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

Expand Down
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand All @@ -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);

Expand All @@ -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);
Expand Down
Expand Up @@ -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

Expand Down

0 comments on commit 6b49773

Please sign in to comment.