Commit 21e228af authored by Miikka Heikkinen's avatar Miikka Heikkinen Committed by Qt by Nokia

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: default avatarFriedemann Kleint <Friedemann.Kleint@nokia.com>
parent 5adfdaf9
......@@ -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));
......
......@@ -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());
......
......@@ -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);
......
......@@ -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));
......
......@@ -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());
......
......@@ -6,4 +6,6 @@ SOURCES += tst_qquickmultipointtoucharea.cpp
TESTDATA = data/*
include(../../shared/util.pri)
QT += core-private gui-private qml-private quick-private testlib
......@@ -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);
......
......@@ -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();
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment