diff options
Diffstat (limited to 'tests/auto/qtquick2/qquickborderimage/tst_qquickborderimage.cpp')
-rw-r--r-- | tests/auto/qtquick2/qquickborderimage/tst_qquickborderimage.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/tests/auto/qtquick2/qquickborderimage/tst_qquickborderimage.cpp b/tests/auto/qtquick2/qquickborderimage/tst_qquickborderimage.cpp index b9fd91d7fb..cd580dd78c 100644 --- a/tests/auto/qtquick2/qquickborderimage/tst_qquickborderimage.cpp +++ b/tests/auto/qtquick2/qquickborderimage/tst_qquickborderimage.cpp @@ -61,7 +61,7 @@ #define SERVER_PORT 14446 #define SERVER_ADDR "http://127.0.0.1:14446" -class tst_qquickborderimage : public QObject +class tst_qquickborderimage : public QDeclarativeDataTest { Q_OBJECT @@ -113,9 +113,9 @@ void tst_qquickborderimage::imageSource_data() QTest::addColumn<bool>("remote"); QTest::addColumn<QString>("error"); - 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("local") << testFileUrl("colors.png").toString() << false << ""; + QTest::newRow("local not found") << testFileUrl("no-such-file.png").toString() << false + << "file::2:1: QML BorderImage: Cannot open: " + testFileUrl("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 +131,7 @@ void tst_qquickborderimage::imageSource() if (remote) { server = new TestHTTPServer(SERVER_PORT); QVERIFY(server->isValid()); - server->serveDirectory(TESTDATA("")); + server->serveDirectory(dataDirectory()); } if (!error.isEmpty()) @@ -168,7 +168,7 @@ void tst_qquickborderimage::clearSource() { QString componentStr = "import QtQuick 2.0\nBorderImage { source: srcImage }"; QDeclarativeContext *ctxt = engine.rootContext(); - ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(TESTDATA("colors.png"))); + ctxt->setContextProperty("srcImage", testFileUrl("colors.png")); QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create()); @@ -186,7 +186,7 @@ void tst_qquickborderimage::clearSource() void tst_qquickborderimage::resized() { - QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + QUrl::fromLocalFile(TESTDATA("colors.png")).toString() + "\"; width: 300; height: 300 }"; + QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + testFileUrl("colors.png").toString() + "\"; width: 300; height: 300 }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create()); @@ -203,7 +203,7 @@ void tst_qquickborderimage::resized() void tst_qquickborderimage::smooth() { - QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + TESTDATA("colors.png") + "\"; smooth: true; width: 300; height: 300 }"; + QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + testFile("colors.png") + "\"; smooth: true; width: 300; height: 300 }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create()); @@ -222,7 +222,7 @@ void tst_qquickborderimage::mirror() QQuickView *canvas = new QQuickView; canvas->show(); - canvas->setSource(QUrl::fromLocalFile(TESTDATA("mirror.qml"))); + canvas->setSource(testFileUrl("mirror.qml")); QQuickBorderImage *image = qobject_cast<QQuickBorderImage*>(canvas->rootObject()); QVERIFY(image != 0); canvas->show(); @@ -244,7 +244,7 @@ void tst_qquickborderimage::mirror() void tst_qquickborderimage::tileModes() { { - QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + TESTDATA("colors.png") + "\"; width: 100; height: 300; horizontalTileMode: BorderImage.Repeat; verticalTileMode: BorderImage.Repeat }"; + QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + testFile("colors.png") + "\"; width: 100; height: 300; horizontalTileMode: BorderImage.Repeat; verticalTileMode: BorderImage.Repeat }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create()); @@ -257,7 +257,7 @@ void tst_qquickborderimage::tileModes() delete obj; } { - QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + TESTDATA("colors.png") + "\"; width: 300; height: 150; horizontalTileMode: BorderImage.Round; verticalTileMode: BorderImage.Round }"; + QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + testFile("colors.png") + "\"; width: 300; height: 150; horizontalTileMode: BorderImage.Round; verticalTileMode: BorderImage.Round }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create()); @@ -281,7 +281,7 @@ void tst_qquickborderimage::sciSource() if (remote) { server = new TestHTTPServer(SERVER_PORT); QVERIFY(server->isValid()); - server->serveDirectory(TESTDATA("")); + server->serveDirectory(dataDirectory()); } QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + source + "\"; width: 300; height: 300 }"; @@ -318,9 +318,9 @@ void tst_qquickborderimage::sciSource_data() QTest::addColumn<QString>("source"); QTest::addColumn<bool>("valid"); - 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("local") << testFileUrl("colors-round.sci").toString() << true; + QTest::newRow("local quoted filename") << testFileUrl("colors-round-quotes.sci").toString() << true; + QTest::newRow("local not found") << testFileUrl("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 +332,7 @@ void tst_qquickborderimage::invalidSciFile() QTest::ignoreMessage(QtWarningMsg, "QQuickGridScaledImage: Invalid tile rule specified. Using Stretch."); // for "Roun" QTest::ignoreMessage(QtWarningMsg, "QQuickGridScaledImage: Invalid tile rule specified. Using Stretch."); // for "Repea" - QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + QUrl::fromLocalFile(TESTDATA("invalid.sci")).toString() +"\"; width: 300; height: 300 }"; + QString componentStr = "import QtQuick 2.0\nBorderImage { source: \"" + testFileUrl("invalid.sci").toString() +"\"; width: 300; height: 300 }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create()); |