diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2011-10-12 13:46:02 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-10-14 02:39:59 +0200 |
commit | 6b497734df0c4f13f6b7185801fc69ce680c698c (patch) | |
tree | 66b0b8cd32a91f8c7e753a3ef124050188035c3c /tests/auto/declarative/qsganimatedimage/tst_qsganimatedimage.cpp | |
parent | 5f7c22001163eb4bce25be1cfee4e84c5a25ff09 (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/qsganimatedimage/tst_qsganimatedimage.cpp')
-rw-r--r-- | tests/auto/declarative/qsganimatedimage/tst_qsganimatedimage.cpp | 33 |
1 files changed, 17 insertions, 16 deletions
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); |