aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2012-03-14 16:42:58 +0200
committerQt by Nokia <qt-info@nokia.com>2012-03-15 11:25:36 +0100
commit21e228afa711ea040170445c649f725bedc394fe (patch)
tree09f21d51a63a43a871f27fd472dc10f742cae6f2 /tests
parent5adfdaf9b33923f4cd2137c055aa549915b120d1 (diff)
Windows: Fix file URL issues in declarative autotests
Fixed by using testFileUrl() shared utility function where appropriate instead of testFile() or various other ways file URLs were being incorrectly used. Task-number: QTBUG-24779 Change-Id: I48cbd297d419238f42ea45132344b7e5a487b6f1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp16
-rw-r--r--tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp2
-rw-r--r--tests/auto/quick/qquickgridview/tst_qquickgridview.cpp2
-rw-r--r--tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp32
-rw-r--r--tests/auto/quick/qquickloader/tst_qquickloader.cpp2
-rw-r--r--tests/auto/quick/qquickmultipointtoucharea/qquickmultipointtoucharea.pro2
-rw-r--r--tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp6
-rw-r--r--tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp4
-rw-r--r--tests/auto/quick/rendernode/tst_rendernode.cpp8
9 files changed, 39 insertions, 35 deletions
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index 3bbbc2c79c..79eaa3316f 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -3112,7 +3112,7 @@ void tst_qqmlecmascript::moduleApi_data()
QTest::newRow("qobject, writing + readonly constraints")
<< testFileUrl("moduleapi/qobjectModuleApiWriting.qml")
<< QString()
- << (QStringList() << QString(QLatin1String("file://") + testFileUrl("moduleapi/qobjectModuleApiWriting.qml").toLocalFile() + QLatin1String(":15: Error: Cannot assign to read-only property \"qobjectTestProperty\"")))
+ << (QStringList() << QString(testFileUrl("moduleapi/qobjectModuleApiWriting.qml").toString() + QLatin1String(":15: Error: Cannot assign to read-only property \"qobjectTestProperty\"")))
<< (QStringList() << "readOnlyProperty" << "writableProperty" << "writableFinalProperty")
<< (QVariantList() << 20 << 50 << 10)
<< (QStringList() << "firstProperty" << "secondProperty")
@@ -3123,7 +3123,7 @@ void tst_qqmlecmascript::moduleApi_data()
QTest::newRow("script, writing + readonly constraints")
<< testFileUrl("moduleapi/scriptModuleApiWriting.qml")
<< QString()
- << (QStringList() << QString(QLatin1String("file://") + testFileUrl("moduleapi/scriptModuleApiWriting.qml").toLocalFile() + QLatin1String(":21: Error: Cannot assign to read-only property \"scriptTestProperty\"")))
+ << (QStringList() << QString(testFileUrl("moduleapi/scriptModuleApiWriting.qml").toString() + QLatin1String(":21: Error: Cannot assign to read-only property \"scriptTestProperty\"")))
<< (QStringList() << "readBack" << "unchanged")
<< (QVariantList() << 13 << 42)
<< (QStringList() << "firstProperty" << "secondProperty")
@@ -3232,35 +3232,35 @@ void tst_qqmlecmascript::importScripts_data()
QTest::newRow("parent scope shouldn't be inherited by import with imports")
<< testFileUrl("jsimportfail/failOne.qml")
<< QString()
- << (QStringList() << QString(QLatin1String("file://") + testFileUrl("jsimportfail/failOne.qml").toLocalFile() + QLatin1String(":6: TypeError: Cannot call method 'greetingString' of undefined")))
+ << (QStringList() << QString(testFileUrl("jsimportfail/failOne.qml").toString() + QLatin1String(":6: TypeError: Cannot call method 'greetingString' of undefined")))
<< (QStringList() << QLatin1String("importScriptFunctionValue"))
<< (QVariantList() << QVariant(QString()));
QTest::newRow("javascript imports in an import should be private to the import scope")
<< testFileUrl("jsimportfail/failTwo.qml")
<< QString()
- << (QStringList() << QString(QLatin1String("file://") + testFileUrl("jsimportfail/failTwo.qml").toLocalFile() + QLatin1String(":6: ReferenceError: ImportOneJs is not defined")))
+ << (QStringList() << QString(testFileUrl("jsimportfail/failTwo.qml").toString() + QLatin1String(":6: ReferenceError: ImportOneJs is not defined")))
<< (QStringList() << QLatin1String("importScriptFunctionValue"))
<< (QVariantList() << QVariant(QString()));
QTest::newRow("module imports in an import should be private to the import scope")
<< testFileUrl("jsimportfail/failThree.qml")
<< QString()
- << (QStringList() << QString(QLatin1String("file://") + testFileUrl("jsimportfail/failThree.qml").toLocalFile() + QLatin1String(":7: TypeError: Cannot read property 'JsQtTest' of undefined")))
+ << (QStringList() << QString(testFileUrl("jsimportfail/failThree.qml").toString() + QLatin1String(":7: TypeError: Cannot read property 'JsQtTest' of undefined")))
<< (QStringList() << QLatin1String("importedModuleAttachedPropertyValue"))
<< (QVariantList() << QVariant(false));
QTest::newRow("typenames in an import should be private to the import scope")
<< testFileUrl("jsimportfail/failFour.qml")
<< QString()
- << (QStringList() << QString(QLatin1String("file://") + testFileUrl("jsimportfail/failFour.qml").toLocalFile() + QLatin1String(":6: ReferenceError: JsQtTest is not defined")))
+ << (QStringList() << QString(testFileUrl("jsimportfail/failFour.qml").toString() + QLatin1String(":6: ReferenceError: JsQtTest is not defined")))
<< (QStringList() << QLatin1String("importedModuleEnumValue"))
<< (QVariantList() << QVariant(0));
QTest::newRow("import with imports has it's own activation scope")
<< testFileUrl("jsimportfail/failFive.qml")
<< QString()
- << (QStringList() << QString(QLatin1String("file://") + testFileUrl("jsimportfail/importWithImports.js").toLocalFile() + QLatin1String(":8: ReferenceError: Component is not defined")))
+ << (QStringList() << QString(testFileUrl("jsimportfail/importWithImports.js").toString() + QLatin1String(":8: ReferenceError: Component is not defined")))
<< (QStringList() << QLatin1String("componentError"))
<< (QVariantList() << QVariant(0));
@@ -3274,7 +3274,7 @@ void tst_qqmlecmascript::importScripts_data()
QTest::newRow("pragma library imports shouldn't inherit parent imports or scope")
<< testFileUrl("jsimportfail/testImportPragmaLibrary.qml")
<< QString()
- << (QStringList() << QString(QLatin1String("file://") + testFileUrl("jsimportfail/importPragmaLibrary.js").toLocalFile() + QLatin1String(":6: ReferenceError: Component is not defined")))
+ << (QStringList() << QString(testFileUrl("jsimportfail/importPragmaLibrary.js").toString() + QLatin1String(":6: ReferenceError: Component is not defined")))
<< (QStringList() << QLatin1String("testValue"))
<< (QVariantList() << QVariant(0));
diff --git a/tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp b/tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp
index d8f368cf3e..f99c26803d 100644
--- a/tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp
+++ b/tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp
@@ -116,7 +116,7 @@ void tst_qquickfontloader::namedFont()
void tst_qquickfontloader::localFont()
{
- QString componentStr = "import QtQuick 2.0\nFontLoader { source: \"" + testFile("tarzeau_ocr_a.ttf") + "\" }";
+ QString componentStr = "import QtQuick 2.0\nFontLoader { source: \"" + testFileUrl("tarzeau_ocr_a.ttf").toString() + "\" }";
QQmlComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QQuickFontLoader *fontObject = qobject_cast<QQuickFontLoader*>(component.create());
diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
index 928151d59e..a282d55ac8 100644
--- a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
+++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
@@ -5186,7 +5186,7 @@ void tst_QQuickGridView::asynchronous()
QQmlIncubationController controller;
canvas->engine()->setIncubationController(&controller);
- canvas->setSource(testFile("asyncloader.qml"));
+ canvas->setSource(testFileUrl("asyncloader.qml"));
QQuickItem *rootObject = qobject_cast<QQuickItem*>(canvas->rootObject());
QVERIFY(rootObject);
diff --git a/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp b/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp
index 44d0d6d09c..4847dd3d1c 100644
--- a/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp
+++ b/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp
@@ -53,10 +53,10 @@ class tst_QQuickItemLayer: public QQmlDataTest
public:
tst_QQuickItemLayer();
- QImage runTest(const QString &url)
+ QImage runTest(const QString &fileName)
{
QQuickView view;
- view.setSource(QUrl(url));
+ view.setSource(testFileUrl(fileName));
view.show();
QTest::qWaitForWindowShown(&view);
@@ -135,7 +135,7 @@ void tst_QQuickItemLayer::layerSmooth()
{
if (m_isMesaSoftwareRasterizer && m_mesaVersion < QT_VERSION_CHECK(7, 11, 0))
QSKIP("Mesa Software Rasterizer below version 7.11 does not render this test correctly.");
- QImage fb = runTest(testFile("Smooth.qml"));
+ QImage fb = runTest("Smooth.qml");
QCOMPARE(fb.pixel(0, 0), qRgb(0xff, 0, 0));
QCOMPARE(fb.pixel(fb.width() - 1, 0), qRgb(0, 0, 0xff));
@@ -154,7 +154,7 @@ void tst_QQuickItemLayer::layerEnabled()
{
if (m_isMesaSoftwareRasterizer && m_mesaVersion < QT_VERSION_CHECK(7, 11, 0))
QSKIP("Mesa Software Rasterizer below version 7.11 does not render this test correctly.");
- QImage fb = runTest(testFile("Enabled.qml"));
+ QImage fb = runTest("Enabled.qml");
// Verify the banding
QCOMPARE(fb.pixel(0, 0), fb.pixel(0, 1));
// Verify the gradient
@@ -170,7 +170,7 @@ void tst_QQuickItemLayer::layerMipmap()
{
if (m_isMesaSoftwareRasterizer)
QSKIP("Mipmapping does not work with the Mesa Software Rasterizer.");
- QImage fb = runTest(testFile("Mipmap.qml"));
+ QImage fb = runTest("Mipmap.qml");
QVERIFY(fb.pixel(0, 0) != 0xff000000);
QVERIFY(fb.pixel(0, 0) != 0xffffffff);
}
@@ -184,7 +184,7 @@ void tst_QQuickItemLayer::layerEffect()
{
if (m_isMesaSoftwareRasterizer && m_mesaVersion < QT_VERSION_CHECK(7, 11, 0))
QSKIP("Mesa Software Rasterizer below version 7.11 does not render this test correctly.");
- QImage fb = runTest(testFile("Effect.qml"));
+ QImage fb = runTest("Effect.qml");
QCOMPARE(fb.pixel(0, 0), qRgb(0xff, 0, 0));
QCOMPARE(fb.pixel(fb.width() - 1, 0), qRgb(0, 0xff, 0));
}
@@ -199,7 +199,7 @@ void tst_QQuickItemLayer::layerSourceRect()
if (m_isMesaSoftwareRasterizer && m_mesaVersion < QT_VERSION_CHECK(7, 11, 0))
QSKIP("Mesa Software Rasterizer below version 7.11 does not render this test correctly.");
- QImage fb = runTest(testFile("SourceRect.qml"));
+ QImage fb = runTest("SourceRect.qml");
// Check that the edges are converted to blue
QCOMPARE(fb.pixel(0, 0), qRgb(0, 0, 0xff));
@@ -219,7 +219,7 @@ void tst_QQuickItemLayer::layerIsTextureProvider()
{
if (m_isMesaSoftwareRasterizer && m_mesaVersion < QT_VERSION_CHECK(7, 11, 0))
QSKIP("Mesa Software Rasterizer below version 7.11 does not render this test correctly.");
- QImage fb = runTest(testFile("TextureProvider.qml"));
+ QImage fb = runTest("TextureProvider.qml");
QCOMPARE(fb.pixel(0, 0), qRgb(0xff, 0, 0));
QCOMPARE(fb.pixel(fb.width() - 1, 0), qRgb(0, 0xff, 0));
}
@@ -257,7 +257,7 @@ void tst_QQuickItemLayer::layerVisibility()
QFETCH(qreal, opacity);
QQuickView view;
- view.setSource(testFile("Visible.qml"));
+ view.setSource(testFileUrl("Visible.qml"));
QQuickItem *child = view.rootItem()->childItems().at(0);
child->setProperty("layerVisible", visible);
@@ -303,7 +303,7 @@ void tst_QQuickItemLayer::layerZOrder()
QFETCH(bool, effect);
QQuickView view;
- view.setSource(testFile("ZOrder.qml"));
+ view.setSource(testFileUrl("ZOrder.qml"));
QQuickItem *child = view.rootItem()->childItems().at(0);
child->setProperty("layerEffect", effect);
@@ -338,7 +338,7 @@ void tst_QQuickItemLayer::changeZOrder()
QFETCH(bool, effect);
QQuickView view;
- view.setSource(testFile("ZOrderChange.qml"));
+ view.setSource(testFileUrl("ZOrderChange.qml"));
QQuickItem *child = view.rootItem()->childItems().at(0);
child->setProperty("layerEnabled", layered);
@@ -388,20 +388,20 @@ void tst_QQuickItemLayer::changeZOrder()
void tst_QQuickItemLayer::toggleLayerAndEffect()
{
// This test passes if it doesn't crash.
- runTest(testFile("ToggleLayerAndEffect.qml"));
+ runTest("ToggleLayerAndEffect.qml");
}
void tst_QQuickItemLayer::disableLayer()
{
// This test passes if it doesn't crash.
- runTest(testFile("DisableLayer.qml"));
+ runTest("DisableLayer.qml");
}
void tst_QQuickItemLayer::changeSamplerName()
{
if (m_isMesaSoftwareRasterizer && m_mesaVersion < QT_VERSION_CHECK(7, 11, 0))
QSKIP("Mesa Software Rasterizer below version 7.11 does not render this test correctly.");
- QImage fb = runTest(testFile("SamplerNameChange.qml"));
+ QImage fb = runTest("SamplerNameChange.qml");
QCOMPARE(fb.pixel(0, 0), qRgb(0, 0, 0xff));
}
@@ -409,7 +409,7 @@ void tst_QQuickItemLayer::itemEffect()
{
if (m_isMesaSoftwareRasterizer && m_mesaVersion < QT_VERSION_CHECK(7, 11, 0))
QSKIP("Mesa Software Rasterizer below version 7.11 does not render this test correctly.");
- QImage fb = runTest(testFile("ItemEffect.qml"));
+ QImage fb = runTest("ItemEffect.qml");
QCOMPARE(fb.pixel(0, 0), qRgb(0xff, 0, 0));
QCOMPARE(fb.pixel(199, 0), qRgb(0xff, 0, 0));
QCOMPARE(fb.pixel(0, 199), qRgb(0, 0, 0xff));
@@ -418,7 +418,7 @@ void tst_QQuickItemLayer::itemEffect()
void tst_QQuickItemLayer::rectangleEffect()
{
- QImage fb = runTest(testFile("RectangleEffect.qml"));
+ QImage fb = runTest("RectangleEffect.qml");
QCOMPARE(fb.pixel(0, 0), qRgb(0, 0xff, 0));
QCOMPARE(fb.pixel(199, 0), qRgb(0, 0xff, 0));
QCOMPARE(fb.pixel(0, 199), qRgb(0, 0xff, 0));
diff --git a/tests/auto/quick/qquickloader/tst_qquickloader.cpp b/tests/auto/quick/qquickloader/tst_qquickloader.cpp
index b388243a1d..bdf47fa9e9 100644
--- a/tests/auto/quick/qquickloader/tst_qquickloader.cpp
+++ b/tests/auto/quick/qquickloader/tst_qquickloader.cpp
@@ -653,7 +653,7 @@ void tst_QQuickLoader::initialPropertyValues_data()
<< (QVariantList() << 2 << 0);
QTest::newRow("set source with initial property values specified, active = false") << testFileUrl("initialPropertyValues.3.qml")
- << (QStringList() << QString(QLatin1String("file://") + testFileUrl("initialPropertyValues.3.qml").toLocalFile() + QLatin1String(":16: TypeError: Cannot read property 'canary' of null")))
+ << (QStringList() << QString(testFileUrl("initialPropertyValues.3.qml").toString() + QLatin1String(":16: TypeError: Cannot read property 'canary' of null")))
<< (QStringList())
<< (QVariantList());
diff --git a/tests/auto/quick/qquickmultipointtoucharea/qquickmultipointtoucharea.pro b/tests/auto/quick/qquickmultipointtoucharea/qquickmultipointtoucharea.pro
index 8181eb8c5f..6816566c25 100644
--- a/tests/auto/quick/qquickmultipointtoucharea/qquickmultipointtoucharea.pro
+++ b/tests/auto/quick/qquickmultipointtoucharea/qquickmultipointtoucharea.pro
@@ -6,4 +6,6 @@ SOURCES += tst_qquickmultipointtoucharea.cpp
TESTDATA = data/*
+include(../../shared/util.pri)
+
QT += core-private gui-private qml-private quick-private testlib
diff --git a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp
index 507612f8ce..1e0cd4eead 100644
--- a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp
+++ b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp
@@ -44,14 +44,16 @@
#include <private/qquickmultipointtoucharea_p.h>
#include <private/qquickflickable_p.h>
#include <QtQuick/qquickview.h>
+#include "../../shared/util.h"
-class tst_QQuickMultiPointTouchArea: public QObject
+class tst_QQuickMultiPointTouchArea : public QQmlDataTest
{
Q_OBJECT
public:
tst_QQuickMultiPointTouchArea() : device(0) { }
private slots:
void initTestCase() {
+ QQmlDataTest::initTestCase();
if (!device) {
device = new QTouchDevice;
device->setType(QTouchDevice::TouchScreen);
@@ -714,7 +716,7 @@ void tst_QQuickMultiPointTouchArea::invisible()
QQuickView *tst_QQuickMultiPointTouchArea::createAndShowView(const QString &file)
{
QQuickView *canvas = new QQuickView(0);
- canvas->setSource(QUrl::fromLocalFile(QCoreApplication::applicationDirPath() + QLatin1String("/data/") + file));
+ canvas->setSource(testFileUrl(file));
canvas->show();
canvas->requestActivateWindow();
QTest::qWaitForWindowShown(canvas);
diff --git a/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp b/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp
index 8f517a4fe3..ab24fbe995 100644
--- a/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp
+++ b/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp
@@ -532,7 +532,7 @@ void tst_qquickpositioners::addTransitions(const QString &positionerObjectName)
ctxt->setContextProperty("model_displacedItems_transitionVia", &model_displacedItems_transitionVia);
ctxt->setContextProperty("targetItems_transitionFrom", targetItems_transitionFrom);
ctxt->setContextProperty("displacedItems_transitionVia", displacedItems_transitionVia);
- canvas->setSource(testFile("transitions.qml"));
+ canvas->setSource(testFileUrl("transitions.qml"));
canvas->show();
qApp->processEvents();
@@ -641,7 +641,7 @@ void tst_qquickpositioners::moveTransitions(const QString &positionerObjectName)
ctxt->setContextProperty("model_displacedItems_transitionVia", &model_displacedItems_transitionVia);
ctxt->setContextProperty("targetItems_transitionFrom", targetItems_transitionFrom);
ctxt->setContextProperty("displacedItems_transitionVia", displacedItems_transitionVia);
- canvas->setSource(testFile("transitions.qml"));
+ canvas->setSource(testFileUrl("transitions.qml"));
canvas->show();
qApp->processEvents();
diff --git a/tests/auto/quick/rendernode/tst_rendernode.cpp b/tests/auto/quick/rendernode/tst_rendernode.cpp
index b456a5980e..f3832b436f 100644
--- a/tests/auto/quick/rendernode/tst_rendernode.cpp
+++ b/tests/auto/quick/rendernode/tst_rendernode.cpp
@@ -54,10 +54,10 @@ class tst_rendernode: public QQmlDataTest
public:
tst_rendernode();
- QImage runTest(const QString &url)
+ QImage runTest(const QString &fileName)
{
QQuickView view;
- view.setSource(QUrl(url));
+ view.setSource(testFileUrl(fileName));
view.show();
QTest::qWaitForWindowShown(&view);
@@ -194,7 +194,7 @@ static void fuzzyCompareColor(QRgb x, QRgb y)
void tst_rendernode::renderOrder()
{
- QImage fb = runTest(testFile("RenderOrder.qml"));
+ QImage fb = runTest("RenderOrder.qml");
int x1 = fb.width() / 8;
int x2 = fb.width() * 3 / 8;
int x3 = fb.width() * 5 / 8;
@@ -216,7 +216,7 @@ void tst_rendernode::renderOrder()
void tst_rendernode::messUpState()
{
- QImage fb = runTest(testFile("MessUpState.qml"));
+ QImage fb = runTest("MessUpState.qml");
int x1 = 0;
int x2 = fb.width() / 2;
int x3 = fb.width() - 1;