diff options
41 files changed, 320 insertions, 275 deletions
diff --git a/src/declarative/qml/qmlcompiledbindings.cpp b/src/declarative/qml/qmlcompiledbindings.cpp index d09f7eb..cdea96f 100644 --- a/src/declarative/qml/qmlcompiledbindings.cpp +++ b/src/declarative/qml/qmlcompiledbindings.cpp @@ -807,36 +807,6 @@ static QObject *variantToQObject(const QVariant &value, bool *ok) } } -QmlPropertyCache::Data * -QmlCompiledBindingsPrivate::findproperty(QObject *obj, - const QScriptDeclarativeClass::Identifier &name, - QmlEnginePrivate *enginePriv, - QmlPropertyCache::Data &local) -{ - QmlPropertyCache *cache = 0; - QmlDeclarativeData *ddata = QmlDeclarativeData::get(obj); - if (ddata) - cache = ddata->propertyCache; - if (!cache) { - cache = enginePriv->cache(obj); - if (cache && ddata) { cache->addref(); ddata->propertyCache = cache; } - } - - QmlPropertyCache::Data *property = 0; - - if (cache) { - property = cache->property(name); - } else { - qWarning() << "QmlBindingVME: Slow search" << enginePriv->objectClass->toString(name); - local = QmlPropertyCache::create(obj->metaObject(), - enginePriv->objectClass->toString(name)); - if (local.isValid()) - property = &local; - } - - return property; -} - bool QmlCompiledBindingsPrivate::findproperty(QObject *obj, Register *output, QmlEnginePrivate *enginePriv, int subIdx, const QScriptDeclarativeClass::Identifier &name, @@ -848,7 +818,8 @@ bool QmlCompiledBindingsPrivate::findproperty(QObject *obj, Register *output, } QmlPropertyCache::Data local; - QmlPropertyCache::Data *property = findproperty(obj, name, enginePriv, local); + QmlPropertyCache::Data *property = + QmlPropertyCache::property(QmlEnginePrivate::get(enginePriv), obj, name, local); if (property) { if (subIdx != -1) diff --git a/src/declarative/qml/qmlcontext.cpp b/src/declarative/qml/qmlcontext.cpp index 0eb497d..4c6dc6f 100644 --- a/src/declarative/qml/qmlcontext.cpp +++ b/src/declarative/qml/qmlcontext.cpp @@ -461,16 +461,13 @@ QVariant QmlContext::contextProperty(const QString &name) const QByteArray utf8Name = name.toUtf8(); for (int ii = d->defaultObjects.count() - 1; ii >= 0; --ii) { QObject *obj = d->defaultObjects.at(ii); - QmlDeclarativeData *data = QmlDeclarativeData::get(obj); - if (data && data->propertyCache) { - QmlPropertyCache::Data *property = data->propertyCache->property(name); - if (property) - value = obj->metaObject()->property(property->coreIndex).read(obj); - } else { - value = obj->property(utf8Name); - } - if (value.isValid()) + QmlPropertyCache::Data local; + QmlPropertyCache::Data *property = QmlPropertyCache::property(d->engine, obj, name, local); + + if (property) { + value = obj->metaObject()->property(property->coreIndex).read(obj); break; + } } if (!value.isValid() && parentContext()) value = parentContext()->contextProperty(name); diff --git a/src/declarative/qml/qmlengine_p.h b/src/declarative/qml/qmlengine_p.h index 6aa5d69..8349090 100644 --- a/src/declarative/qml/qmlengine_p.h +++ b/src/declarative/qml/qmlengine_p.h @@ -309,6 +309,7 @@ public: static QmlEngine *getEngine(QScriptEngine *e) { return static_cast<QmlScriptEngine*>(e)->p->q_func(); } static QmlEnginePrivate *get(QmlEngine *e) { return e->d_func(); } static QmlEnginePrivate *get(QScriptEngine *e) { return static_cast<QmlScriptEngine*>(e)->p; } + static QmlEngine *get(QmlEnginePrivate *p) { return p->q_func(); } QmlContext *getContext(QScriptContext *); }; diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp index 0603a9c..09c936e 100644 --- a/src/declarative/qml/qmlmetaproperty.cpp +++ b/src/declarative/qml/qmlmetaproperty.cpp @@ -188,24 +188,11 @@ void QmlMetaPropertyPrivate::initProperty(QObject *obj, const QString &name) } // Property - QmlPropertyCache *cache = 0; - QmlDeclarativeData *ddata = QmlDeclarativeData::get(obj); - if (ddata) - cache = ddata->propertyCache; - if (!cache) - cache = enginePrivate?enginePrivate->cache(obj):0; - - if (cache) { - QmlPropertyCache::Data *data = cache->property(name); - - if (data && !(data->flags & QmlPropertyCache::Data::IsFunction)) - core = *data; - - } else { - // No cache available - QMetaProperty p = QmlMetaType::property(obj, name.toUtf8().constData()); - core.load(p); - } + QmlPropertyCache::Data local; + QmlPropertyCache::Data *property = + QmlPropertyCache::property(context?context->engine():0, obj, name, local); + if (property && !(property->flags & QmlPropertyCache::Data::IsFunction)) + core = *property; } /*! diff --git a/src/declarative/qml/qmlobjectscriptclass.cpp b/src/declarative/qml/qmlobjectscriptclass.cpp index 4ff4746..7bbb7df 100644 --- a/src/declarative/qml/qmlobjectscriptclass.cpp +++ b/src/declarative/qml/qmlobjectscriptclass.cpp @@ -144,23 +144,7 @@ QmlObjectScriptClass::queryProperty(QObject *obj, const Identifier &name, return 0; QmlEnginePrivate *enginePrivate = QmlEnginePrivate::get(engine); - - QmlPropertyCache *cache = 0; - QmlDeclarativeData *ddata = QmlDeclarativeData::get(obj); - if (ddata) - cache = ddata->propertyCache; - if (!cache) { - cache = enginePrivate->cache(obj); - if (cache && ddata) { cache->addref(); ddata->propertyCache = cache; } - } - - if (cache) { - lastData = cache->property(name); - } else { - local = QmlPropertyCache::create(obj->metaObject(), toString(name)); - if (local.isValid()) - lastData = &local; - } + lastData = QmlPropertyCache::property(engine, obj, name, local); if (lastData) return QScriptClass::HandlesReadAccess | QScriptClass::HandlesWriteAccess; diff --git a/src/declarative/qml/qmlpropertycache.cpp b/src/declarative/qml/qmlpropertycache.cpp index 51753b8..04cffe1 100644 --- a/src/declarative/qml/qmlpropertycache.cpp +++ b/src/declarative/qml/qmlpropertycache.cpp @@ -352,4 +352,64 @@ QStringList QmlPropertyCache::propertyNames() const return stringCache.keys(); } +QmlPropertyCache::Data *QmlPropertyCache::property(QmlEngine *engine, QObject *obj, + const QScriptDeclarativeClass::Identifier &name, Data &local) +{ + QmlPropertyCache::Data *rv = 0; + + QmlEnginePrivate *enginePrivate = QmlEnginePrivate::get(engine); + + QmlPropertyCache *cache = 0; + QmlDeclarativeData *ddata = QmlDeclarativeData::get(obj); + if (ddata && ddata->propertyCache && ddata->propertyCache->qmlEngine() == engine) + cache = ddata->propertyCache; + if (!cache) { + cache = enginePrivate->cache(obj); + if (cache && ddata && !ddata->propertyCache) { cache->addref(); ddata->propertyCache = cache; } + } + + if (cache) { + rv = cache->property(name); + } else { + local = QmlPropertyCache::create(obj->metaObject(), enginePrivate->objectClass->toString(name)); + if (local.isValid()) + rv = &local; + } + + return rv; +} + +QmlPropertyCache::Data *QmlPropertyCache::property(QmlEngine *engine, QObject *obj, + const QString &name, Data &local) +{ + QmlPropertyCache::Data *rv = 0; + + if (!engine) { + local = QmlPropertyCache::create(obj->metaObject(), name); + if (local.isValid()) + rv = &local; + } else { + QmlEnginePrivate *enginePrivate = QmlEnginePrivate::get(engine); + + QmlPropertyCache *cache = 0; + QmlDeclarativeData *ddata = QmlDeclarativeData::get(obj); + if (ddata && ddata->propertyCache && ddata->propertyCache->qmlEngine() == engine) + cache = ddata->propertyCache; + if (!cache) { + cache = enginePrivate->cache(obj); + if (cache && ddata && !ddata->propertyCache) { cache->addref(); ddata->propertyCache = cache; } + } + + if (cache) { + rv = cache->property(name); + } else { + local = QmlPropertyCache::create(obj->metaObject(), name); + if (local.isValid()) + rv = &local; + } + } + + return rv; +} + QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlpropertycache_p.h b/src/declarative/qml/qmlpropertycache_p.h index 8d54e35..efc4643 100644 --- a/src/declarative/qml/qmlpropertycache_p.h +++ b/src/declarative/qml/qmlpropertycache_p.h @@ -132,6 +132,9 @@ public: Data *property(int) const; QStringList propertyNames() const; + inline QmlEngine *qmlEngine() const; + static Data *property(QmlEngine *, QObject *, const QScriptDeclarativeClass::Identifier &, Data &); + static Data *property(QmlEngine *, QObject *, const QString &, Data &); protected: virtual void clear(); @@ -181,6 +184,11 @@ bool QmlPropertyCache::ValueTypeData::operator==(const ValueTypeData &o) valueTypePropType == o.valueTypePropType; } +QmlEngine *QmlPropertyCache::qmlEngine() const +{ + return engine; +} + QT_END_NAMESPACE #endif // QMLPROPERTYCACHE_P_H diff --git a/tests/auto/declarative/anchors/tst_anchors.cpp b/tests/auto/declarative/anchors/tst_anchors.cpp index 9e8024b..4cbfc94 100644 --- a/tests/auto/declarative/anchors/tst_anchors.cpp +++ b/tests/auto/declarative/anchors/tst_anchors.cpp @@ -102,7 +102,7 @@ T *tst_anchors::findItem(QmlGraphicsItem *parent, const QString &objectName) void tst_anchors::basicAnchors() { QmlView *view = new QmlView; - view->setUrl(QUrl("file://" SRCDIR "/data/anchors.qml")); + view->setUrl(QUrl::fromLocalFile(SRCDIR "/data/anchors.qml")); view->execute(); qApp->processEvents(); @@ -173,7 +173,7 @@ void tst_anchors::loops() { QmlView *view = new QmlView; - view->setUrl(QUrl("file://" SRCDIR "/data/loop1.qml")); + view->setUrl(QUrl::fromLocalFile(SRCDIR "/data/loop1.qml")); QString expect = "QML Text (" + view->url().toString() + ":6:5" + ") Possible anchor loop detected on horizontal anchor."; QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); @@ -188,7 +188,7 @@ void tst_anchors::loops() { QmlView *view = new QmlView; - view->setUrl(QUrl("file://" SRCDIR "/data/loop2.qml")); + view->setUrl(QUrl::fromLocalFile(SRCDIR "/data/loop2.qml")); QString expect = "QML Image (" + view->url().toString() + ":8:3" + ") Possible anchor loop detected on horizontal anchor."; QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); @@ -208,7 +208,7 @@ void tst_anchors::illegalSets() QmlEngine engine; QmlComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\n" + qml.toUtf8()), QUrl("file://")); + component.setData(QByteArray("import Qt 4.6\n" + qml.toUtf8()), QUrl::fromLocalFile("")); if (!component.isReady()) qWarning() << "Test errors:" << component.errors(); QVERIFY(component.isReady()); @@ -372,7 +372,7 @@ void tst_anchors::crash1() { QmlView *view = new QmlView; - view->setUrl(QUrl("file://" SRCDIR "/data/crash1.qml")); + view->setUrl(QUrl::fromLocalFile(SRCDIR "/data/crash1.qml")); QString expect = "QML Text (" + view->url().toString() + ":4:5" + ") Possible anchor loop detected on fill."; QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); @@ -387,7 +387,7 @@ void tst_anchors::fill() { QmlView *view = new QmlView; - view->setUrl(QUrl("file://" SRCDIR "/data/fill.qml")); + view->setUrl(QUrl::fromLocalFile(SRCDIR "/data/fill.qml")); view->execute(); qApp->processEvents(); @@ -413,7 +413,7 @@ void tst_anchors::centerIn() { QmlView *view = new QmlView; - view->setUrl(QUrl("file://" SRCDIR "/data/centerin.qml")); + view->setUrl(QUrl::fromLocalFile(SRCDIR "/data/centerin.qml")); view->execute(); qApp->processEvents(); @@ -433,7 +433,7 @@ void tst_anchors::margins() { QmlView *view = new QmlView; - view->setUrl(QUrl("file://" SRCDIR "/data/margins.qml")); + view->setUrl(QUrl::fromLocalFile(SRCDIR "/data/margins.qml")); view->execute(); qApp->processEvents(); diff --git a/tests/auto/declarative/animatedimage/tst_animatedimage.cpp b/tests/auto/declarative/animatedimage/tst_animatedimage.cpp index 20b344d..c4865d2 100644 --- a/tests/auto/declarative/animatedimage/tst_animatedimage.cpp +++ b/tests/auto/declarative/animatedimage/tst_animatedimage.cpp @@ -78,7 +78,7 @@ private slots: void tst_animatedimage::play() { QmlEngine engine; - QmlComponent component(&engine, QUrl("file://" SRCDIR "/data/stickman.qml")); + QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/stickman.qml")); QmlGraphicsAnimatedImage *anim = qobject_cast<QmlGraphicsAnimatedImage *>(component.create()); QVERIFY(anim); QVERIFY(anim->isPlaying()); @@ -89,7 +89,7 @@ void tst_animatedimage::play() void tst_animatedimage::pause() { QmlEngine engine; - QmlComponent component(&engine, QUrl("file://" SRCDIR "/data/stickmanpause.qml")); + QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/stickmanpause.qml")); QmlGraphicsAnimatedImage *anim = qobject_cast<QmlGraphicsAnimatedImage *>(component.create()); QVERIFY(anim); QVERIFY(anim->isPlaying()); @@ -101,7 +101,7 @@ void tst_animatedimage::pause() void tst_animatedimage::stopped() { QmlEngine engine; - QmlComponent component(&engine, QUrl("file://" SRCDIR "/data/stickmanstopped.qml")); + QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/stickmanstopped.qml")); QmlGraphicsAnimatedImage *anim = qobject_cast<QmlGraphicsAnimatedImage *>(component.create()); QVERIFY(anim); QVERIFY(!anim->isPlaying()); @@ -113,7 +113,7 @@ void tst_animatedimage::stopped() void tst_animatedimage::setFrame() { QmlEngine engine; - QmlComponent component(&engine, QUrl("file://" SRCDIR "/data/stickmanpause.qml")); + QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/stickmanpause.qml")); QmlGraphicsAnimatedImage *anim = qobject_cast<QmlGraphicsAnimatedImage *>(component.create()); QVERIFY(anim); QVERIFY(anim->isPlaying()); @@ -125,7 +125,7 @@ void tst_animatedimage::setFrame() void tst_animatedimage::frameCount() { QmlEngine engine; - QmlComponent component(&engine, QUrl("file://" SRCDIR "/data/colors.qml")); + QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/colors.qml")); QmlGraphicsAnimatedImage *anim = qobject_cast<QmlGraphicsAnimatedImage *>(component.create()); QVERIFY(anim); QVERIFY(anim->isPlaying()); @@ -174,7 +174,7 @@ void tst_animatedimage::invalidSource() { QmlEngine engine; QmlComponent component(&engine); - component.setData("import Qt 4.6\n AnimatedImage { source: \"no-such-file.gif\" }", QUrl("file://")); + component.setData("import Qt 4.6\n AnimatedImage { source: \"no-such-file.gif\" }", QUrl::fromLocalFile("")); QVERIFY(component.isReady()); QTest::ignoreMessage(QtWarningMsg, "Error Reading Animated Image File QUrl( \"file:no-such-file.gif\" ) "); diff --git a/tests/auto/declarative/animations/tst_animations.cpp b/tests/auto/declarative/animations/tst_animations.cpp index 7f043ba..239c344 100644 --- a/tests/auto/declarative/animations/tst_animations.cpp +++ b/tests/auto/declarative/animations/tst_animations.cpp @@ -255,7 +255,7 @@ void tst_animations::badTypes() //don't crash { QmlView *view = new QmlView; - view->setUrl(QUrl("file://" SRCDIR "/data/badtype1.qml")); + view->setUrl(QUrl::fromLocalFile(SRCDIR "/data/badtype1.qml")); view->execute(); qApp->processEvents(); @@ -266,7 +266,7 @@ void tst_animations::badTypes() //make sure we get a compiler error { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/badtype2.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/badtype2.qml")); QTest::ignoreMessage(QtWarningMsg, "QmlComponent: Component is not ready"); c.create(); @@ -277,7 +277,7 @@ void tst_animations::badTypes() //make sure we get a compiler error { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/badtype3.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/badtype3.qml")); QTest::ignoreMessage(QtWarningMsg, "QmlComponent: Component is not ready"); c.create(); @@ -288,7 +288,7 @@ void tst_animations::badTypes() //don't crash { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/badtype4.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/badtype4.qml")); QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect); @@ -306,15 +306,15 @@ void tst_animations::badProperties() { QmlEngine engine; - QmlComponent c1(&engine, QUrl("file://" SRCDIR "/data/badproperty1.qml")); - QByteArray message = "QML ColorAnimation (file://" SRCDIR "/data/badproperty1.qml:18:9) Cannot animate non-existant property \"border.colr\""; + QmlComponent c1(&engine, QUrl::fromLocalFile(SRCDIR "/data/badproperty1.qml")); + QByteArray message = "QML ColorAnimation (" + QUrl::fromLocalFile(SRCDIR "/data/badproperty1.qml").toString().toUtf8() + ":18:9) Cannot animate non-existant property \"border.colr\""; QTest::ignoreMessage(QtWarningMsg, message); QTest::ignoreMessage(QtWarningMsg, message); // why twice? QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c1.create()); QVERIFY(rect); - QmlComponent c2(&engine, QUrl("file://" SRCDIR "/data/badproperty2.qml")); - message = "QML ColorAnimation (file://" SRCDIR "/data/badproperty2.qml:18:9) Cannot animate read-only property \"border\""; + QmlComponent c2(&engine, QUrl::fromLocalFile(SRCDIR "/data/badproperty2.qml")); + message = "QML ColorAnimation (" + QUrl::fromLocalFile(SRCDIR "/data/badproperty2.qml").toString().toUtf8() + ":18:9) Cannot animate read-only property \"border\""; QTest::ignoreMessage(QtWarningMsg, message); QTest::ignoreMessage(QtWarningMsg, message); // why twice? rect = qobject_cast<QmlGraphicsRectangle*>(c2.create()); @@ -332,7 +332,7 @@ void tst_animations::mixedTypes() //assumes border.width stats a real -- not real robust { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/mixedtype1.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/mixedtype1.qml")); QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect); @@ -348,7 +348,7 @@ void tst_animations::mixedTypes() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/mixedtype2.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/mixedtype2.qml")); QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect); @@ -368,7 +368,7 @@ void tst_animations::properties() const int waitDuration = 300; { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/properties.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/properties.qml")); QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect); @@ -380,7 +380,7 @@ void tst_animations::properties() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/properties2.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/properties2.qml")); QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect); @@ -392,7 +392,7 @@ void tst_animations::properties() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/properties3.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/properties3.qml")); QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect); @@ -404,7 +404,7 @@ void tst_animations::properties() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/properties4.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/properties4.qml")); QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect); @@ -417,7 +417,7 @@ void tst_animations::properties() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/properties5.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/properties5.qml")); QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect); @@ -434,7 +434,7 @@ void tst_animations::propertiesTransition() const int waitDuration = 300; { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/propertiesTransition.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertiesTransition.qml")); QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect); @@ -447,7 +447,7 @@ void tst_animations::propertiesTransition() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/propertiesTransition2.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertiesTransition2.qml")); QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect); @@ -462,33 +462,33 @@ void tst_animations::propertiesTransition() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/propertiesTransition3.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertiesTransition3.qml")); QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect); QmlGraphicsRectangle *myRect = rect->findChild<QmlGraphicsRectangle*>("TheRect"); QVERIFY(myRect); - QTest::ignoreMessage(QtWarningMsg, "QML NumberAnimation (file://" SRCDIR "/data/propertiesTransition4.qml:22:9) matchTargets/matchProperties/exclude and target/property are mutually exclusive."); + QTest::ignoreMessage(QtWarningMsg, "QML NumberAnimation (" + QUrl::fromLocalFile(SRCDIR "/data/propertiesTransition4.qml").toString().toUtf8() + ":22:9) matchTargets/matchProperties/exclude and target/property are mutually exclusive."); rect->setState("moved"); QCOMPARE(myRect->x(),qreal(200)); } { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/propertiesTransition4.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertiesTransition4.qml")); QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect); QmlGraphicsRectangle *myRect = rect->findChild<QmlGraphicsRectangle*>("TheRect"); QVERIFY(myRect); - QTest::ignoreMessage(QtWarningMsg, "QML NumberAnimation (file://" SRCDIR "/data/propertiesTransition5.qml:22:9) matchTargets/matchProperties/exclude and target/property are mutually exclusive."); + QTest::ignoreMessage(QtWarningMsg, "QML NumberAnimation (" + QUrl::fromLocalFile(SRCDIR "/data/propertiesTransition5.qml").toString().toUtf8() + ":22:9) matchTargets/matchProperties/exclude and target/property are mutually exclusive."); rect->setState("moved"); QCOMPARE(myRect->x(),qreal(200)); } { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/propertiesTransition5.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertiesTransition5.qml")); QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect); @@ -568,7 +568,7 @@ void tst_animations::attached() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/attached.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/attached.qml")); QTest::ignoreMessage(QtDebugMsg, "off"); QTest::ignoreMessage(QtDebugMsg, "on"); QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); diff --git a/tests/auto/declarative/behaviors/tst_behaviors.cpp b/tests/auto/declarative/behaviors/tst_behaviors.cpp index ae1af0e..fd84596 100644 --- a/tests/auto/declarative/behaviors/tst_behaviors.cpp +++ b/tests/auto/declarative/behaviors/tst_behaviors.cpp @@ -71,7 +71,7 @@ private slots: void tst_behaviors::simpleBehavior() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/simple.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/simple.qml")); QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect); QVERIFY(qobject_cast<QmlBehavior*>(rect->findChild<QmlBehavior*>("MyBehavior"))->animation()); @@ -85,7 +85,7 @@ void tst_behaviors::simpleBehavior() void tst_behaviors::scriptTriggered() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/scripttrigger.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/scripttrigger.qml")); QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect); @@ -98,7 +98,7 @@ void tst_behaviors::scriptTriggered() void tst_behaviors::cppTriggered() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/cpptrigger.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/cpptrigger.qml")); QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect); @@ -114,7 +114,7 @@ void tst_behaviors::cppTriggered() void tst_behaviors::loop() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/loop.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/loop.qml")); QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect); @@ -125,7 +125,7 @@ void tst_behaviors::loop() void tst_behaviors::colorBehavior() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/color.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/color.qml")); QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect); @@ -138,7 +138,7 @@ void tst_behaviors::colorBehavior() void tst_behaviors::parentBehavior() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/parent.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/parent.qml")); QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect); @@ -155,7 +155,7 @@ void tst_behaviors::parentBehavior() void tst_behaviors::replaceBinding() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/binding.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/binding.qml")); QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect); @@ -190,7 +190,7 @@ void tst_behaviors::group() { { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/groupProperty.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/groupProperty.qml")); QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect); @@ -202,7 +202,7 @@ void tst_behaviors::group() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/groupProperty2.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/groupProperty2.qml")); QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect); @@ -216,7 +216,7 @@ void tst_behaviors::group() void tst_behaviors::emptyBehavior() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/empty.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/empty.qml")); QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect); @@ -229,7 +229,7 @@ void tst_behaviors::nonSelectingBehavior() { { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/nonSelecting.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/nonSelecting.qml")); QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect); @@ -240,7 +240,7 @@ void tst_behaviors::nonSelectingBehavior() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/nonSelecting2.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/nonSelecting2.qml")); QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect); @@ -253,8 +253,8 @@ void tst_behaviors::nonSelectingBehavior() void tst_behaviors::reassignedAnimation() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/reassignedAnimation.qml")); - QTest::ignoreMessage(QtWarningMsg, "QML Behavior (file://" SRCDIR "/data/reassignedAnimation.qml:9:12) Can't change the animation assigned to a Behavior."); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/reassignedAnimation.qml")); + QTest::ignoreMessage(QtWarningMsg, QString("QML Behavior (" + QUrl::fromLocalFile(SRCDIR "/data/reassignedAnimation.qml").toString() + ":9:12) Can't change the animation assigned to a Behavior.").toUtf8().constData()); QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect); QCOMPARE(qobject_cast<QmlNumberAnimation*>( @@ -265,7 +265,7 @@ void tst_behaviors::reassignedAnimation() void tst_behaviors::disabled() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/disabled.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/disabled.qml")); QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect); QCOMPARE(rect->findChild<QmlBehavior*>("MyBehavior")->enabled(), false); diff --git a/tests/auto/declarative/datetimeformatter/tst_datetimeformatter.cpp b/tests/auto/declarative/datetimeformatter/tst_datetimeformatter.cpp index b5437b9..3302cfa 100644 --- a/tests/auto/declarative/datetimeformatter/tst_datetimeformatter.cpp +++ b/tests/auto/declarative/datetimeformatter/tst_datetimeformatter.cpp @@ -61,7 +61,7 @@ void tst_datetimeformatter::date() QmlEngine engine; QmlComponent formatterComponent(&engine); formatterComponent.setData(QByteArray("import Qt 4.6\n DateTimeFormatter { date: \"2008-12-24\" }"), - QUrl("file://")); + QUrl::fromLocalFile("")); QmlDateTimeFormatter *formatter = qobject_cast<QmlDateTimeFormatter*>(formatterComponent.create()); if(formatterComponent.isError()) qDebug() << formatterComponent.errors(); @@ -90,7 +90,7 @@ void tst_datetimeformatter::time() { QmlEngine engine; QmlComponent formatterComponent(&engine); - formatterComponent.setData("import Qt 4.6\n DateTimeFormatter { time: \"14:15:38.200\" }", QUrl("file://")); + formatterComponent.setData("import Qt 4.6\n DateTimeFormatter { time: \"14:15:38.200\" }", QUrl::fromLocalFile("")); QmlDateTimeFormatter *formatter = qobject_cast<QmlDateTimeFormatter*>(formatterComponent.create()); if(formatterComponent.isError()) qDebug() << formatterComponent.errors(); @@ -123,7 +123,7 @@ void tst_datetimeformatter::dateTime() { QmlEngine engine; QmlComponent formatterComponent(&engine); - formatterComponent.setData("import Qt 4.6\n DateTimeFormatter { dateTime: \"1978-03-04T09:13:54\" }", QUrl("file://")); + formatterComponent.setData("import Qt 4.6\n DateTimeFormatter { dateTime: \"1978-03-04T09:13:54\" }", QUrl::fromLocalFile("")); QmlDateTimeFormatter *formatter = qobject_cast<QmlDateTimeFormatter*>(formatterComponent.create()); if(formatterComponent.isError()) qDebug() << formatterComponent.errors(); diff --git a/tests/auto/declarative/graphicswidgets/tst_graphicswidgets.cpp b/tests/auto/declarative/graphicswidgets/tst_graphicswidgets.cpp index 783094b..1bb8c14 100644 --- a/tests/auto/declarative/graphicswidgets/tst_graphicswidgets.cpp +++ b/tests/auto/declarative/graphicswidgets/tst_graphicswidgets.cpp @@ -62,7 +62,7 @@ tst_graphicswidgets::tst_graphicswidgets() void tst_graphicswidgets::widgets() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/graphicswidgets.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/graphicswidgets.qml")); QGraphicsView *obj = qobject_cast<QGraphicsView*>(c.create()); QVERIFY(obj != 0); diff --git a/tests/auto/declarative/numberformatter/tst_numberformatter.cpp b/tests/auto/declarative/numberformatter/tst_numberformatter.cpp index e297961..b00e08a 100644 --- a/tests/auto/declarative/numberformatter/tst_numberformatter.cpp +++ b/tests/auto/declarative/numberformatter/tst_numberformatter.cpp @@ -204,7 +204,7 @@ void tst_numberformat::text() QmlEngine engine; QmlComponent formatterComponent(&engine); - formatterComponent.setData(componentStr.toUtf8(), QUrl("file:///")); + formatterComponent.setData(componentStr.toUtf8(), QUrl::fromLocalFile("")); if(formatterComponent.isError()) qDebug() << formatterComponent.errors(); QVERIFY(formatterComponent.isReady()); diff --git a/tests/auto/declarative/qmlbinding/tst_qmlbinding.cpp b/tests/auto/declarative/qmlbinding/tst_qmlbinding.cpp index 0a8508a..19f4d77 100644 --- a/tests/auto/declarative/qmlbinding/tst_qmlbinding.cpp +++ b/tests/auto/declarative/qmlbinding/tst_qmlbinding.cpp @@ -67,7 +67,7 @@ tst_qmlbinding::tst_qmlbinding() void tst_qmlbinding::binding() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/test-binding.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-binding.qml")); QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect != 0); @@ -89,7 +89,7 @@ void tst_qmlbinding::binding() void tst_qmlbinding::whenAfterValue() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/test-binding2.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-binding2.qml")); QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); QVERIFY(rect != 0); diff --git a/tests/auto/declarative/qmlconnection/tst_qmlconnection.cpp b/tests/auto/declarative/qmlconnection/tst_qmlconnection.cpp index 3d9ee46..b3c04f1 100644 --- a/tests/auto/declarative/qmlconnection/tst_qmlconnection.cpp +++ b/tests/auto/declarative/qmlconnection/tst_qmlconnection.cpp @@ -70,7 +70,7 @@ tst_qmlconnection::tst_qmlconnection() void tst_qmlconnection::defaultValues() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/test-connection3.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-connection3.qml")); QmlConnection *item = qobject_cast<QmlConnection*>(c.create()); QVERIFY(item != 0); @@ -84,7 +84,7 @@ void tst_qmlconnection::defaultValues() void tst_qmlconnection::properties() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/test-connection2.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-connection2.qml")); QmlConnection *item = qobject_cast<QmlConnection*>(c.create()); QVERIFY(item != 0); @@ -100,7 +100,7 @@ void tst_qmlconnection::properties() void tst_qmlconnection::connection() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/test-connection.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-connection.qml")); QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem*>(c.create()); QVERIFY(item != 0); @@ -117,7 +117,7 @@ void tst_qmlconnection::connection() void tst_qmlconnection::trimming() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/trimming.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/trimming.qml")); QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem*>(c.create()); QVERIFY(item != 0); diff --git a/tests/auto/declarative/qmldebug/tst_qmldebug.cpp b/tests/auto/declarative/qmldebug/tst_qmldebug.cpp index 785d55f..7615f9b 100644 --- a/tests/auto/declarative/qmldebug/tst_qmldebug.cpp +++ b/tests/auto/declarative/qmldebug/tst_qmldebug.cpp @@ -580,7 +580,7 @@ void tst_QmlDebug::queryObject() // check source as defined in main() QmlDebugFileReference source = obj.source(); - QCOMPARE(source.url(), QUrl("file://")); + QCOMPARE(source.url(), QUrl::fromLocalFile("")); QCOMPARE(source.lineNumber(), 2); QCOMPARE(source.columnNumber(), 1); diff --git a/tests/auto/declarative/qmleasefollow/tst_qmleasefollow.cpp b/tests/auto/declarative/qmleasefollow/tst_qmleasefollow.cpp index 2e2050e..384ce25b 100644 --- a/tests/auto/declarative/qmleasefollow/tst_qmleasefollow.cpp +++ b/tests/auto/declarative/qmleasefollow/tst_qmleasefollow.cpp @@ -67,7 +67,7 @@ tst_qmleasefollow::tst_qmleasefollow() void tst_qmleasefollow::defaultValues() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/easefollow1.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/easefollow1.qml")); QmlEaseFollow *obj = qobject_cast<QmlEaseFollow*>(c.create()); QVERIFY(obj != 0); @@ -85,7 +85,7 @@ void tst_qmleasefollow::defaultValues() void tst_qmleasefollow::values() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/easefollow2.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/easefollow2.qml")); QmlEaseFollow *obj = qobject_cast<QmlEaseFollow*>(c.create()); QVERIFY(obj != 0); @@ -103,7 +103,7 @@ void tst_qmleasefollow::values() void tst_qmleasefollow::disabled() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/easefollow3.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/easefollow3.qml")); QmlEaseFollow *obj = qobject_cast<QmlEaseFollow*>(c.create()); QVERIFY(obj != 0); diff --git a/tests/auto/declarative/qmlecmascript/data/multiEngineObject.qml b/tests/auto/declarative/qmlecmascript/data/multiEngineObject.qml new file mode 100644 index 0000000..7da09e4 --- /dev/null +++ b/tests/auto/declarative/qmlecmascript/data/multiEngineObject.qml @@ -0,0 +1,5 @@ +import Qt 4.6 + +QtObject { + property string test: thing.stringProperty +} diff --git a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp index c41e248..1ba9a52 100644 --- a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp +++ b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp @@ -119,6 +119,7 @@ private slots: void jsObject(); void undefinedResetsProperty(); void listToVariant(); + void multiEngineObject(); void bug1(); @@ -1610,7 +1611,30 @@ void tst_qmlecmascript::listToVariant() QCOMPARE(object->property("test"), QVariant::fromValue(container.children())); delete object; +} + +// QTBUG-7957 +void tst_qmlecmascript::multiEngineObject() +{ + MyQmlObject obj; + obj.setStringProperty("Howdy planet"); + + QmlEngine e1; + e1.rootContext()->setContextProperty("thing", &obj); + QmlComponent c1(&e1, TEST_FILE("multiEngineObject.qml")); + + QmlEngine e2; + e2.rootContext()->setContextProperty("thing", &obj); + QmlComponent c2(&e2, TEST_FILE("multiEngineObject.qml")); + + QObject *o1 = c1.create(); + QObject *o2 = c2.create(); + + QCOMPARE(o1->property("test").toString(), QString("Howdy planet")); + QCOMPARE(o2->property("test").toString(), QString("Howdy planet")); + delete o2; + delete o1; } QTEST_MAIN(tst_qmlecmascript) diff --git a/tests/auto/declarative/qmlfontloader/tst_qmlfontloader.cpp b/tests/auto/declarative/qmlfontloader/tst_qmlfontloader.cpp index 25bb935..3f85633 100644 --- a/tests/auto/declarative/qmlfontloader/tst_qmlfontloader.cpp +++ b/tests/auto/declarative/qmlfontloader/tst_qmlfontloader.cpp @@ -73,7 +73,7 @@ void tst_qmlfontloader::noFont() { QString componentStr = "import Qt 4.6\nFontLoader { }"; QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl("file://")); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlFontLoader *fontObject = qobject_cast<QmlFontLoader*>(component.create()); QVERIFY(fontObject != 0); @@ -88,7 +88,7 @@ void tst_qmlfontloader::namedFont() { QString componentStr = "import Qt 4.6\nFontLoader { name: \"Helvetica\" }"; QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl("file://")); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlFontLoader *fontObject = qobject_cast<QmlFontLoader*>(component.create()); QVERIFY(fontObject != 0); @@ -101,7 +101,7 @@ void tst_qmlfontloader::localFont() { QString componentStr = "import Qt 4.6\nFontLoader { source: \"" SRCDIR "/data/tarzeau_ocr_a.ttf\" }"; QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl("file://")); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlFontLoader *fontObject = qobject_cast<QmlFontLoader*>(component.create()); QVERIFY(fontObject != 0); @@ -113,9 +113,9 @@ void tst_qmlfontloader::localFont() void tst_qmlfontloader::failLocalFont() { QString componentStr = "import Qt 4.6\nFontLoader { source: \"" SRCDIR "/data/dummy.ttf\" }"; - QTest::ignoreMessage(QtWarningMsg, "Cannot load font: QUrl( \"file://" SRCDIR "/data/dummy.ttf\" ) "); + QTest::ignoreMessage(QtWarningMsg, QString("Cannot load font: QUrl( \"" + QUrl::fromLocalFile(SRCDIR "/data/dummy.ttf").toString() + "\" ) ").toUtf8().constData()); QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl("file://")); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlFontLoader *fontObject = qobject_cast<QmlFontLoader*>(component.create()); QVERIFY(fontObject != 0); @@ -128,7 +128,7 @@ void tst_qmlfontloader::webFont() { QString componentStr = "import Qt 4.6\nFontLoader { source: \"http://www.princexml.com/fonts/steffmann/Starburst.ttf\" }"; QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl("file://")); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlFontLoader *fontObject = qobject_cast<QmlFontLoader*>(component.create()); QVERIFY(fontObject != 0); @@ -142,7 +142,7 @@ void tst_qmlfontloader::failWebFont() QString componentStr = "import Qt 4.6\nFontLoader { source: \"http://wrong.address.com/Starburst.ttf\" }"; QTest::ignoreMessage(QtWarningMsg, "Cannot load font: QUrl( \"http://wrong.address.com/Starburst.ttf\" ) "); QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl("file://")); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlFontLoader *fontObject = qobject_cast<QmlFontLoader*>(component.create()); QVERIFY(fontObject != 0); diff --git a/tests/auto/declarative/qmlgraphicsborderimage/tst_qmlgraphicsborderimage.cpp b/tests/auto/declarative/qmlgraphicsborderimage/tst_qmlgraphicsborderimage.cpp index 8ebdf19..b723c6b 100644 --- a/tests/auto/declarative/qmlgraphicsborderimage/tst_qmlgraphicsborderimage.cpp +++ b/tests/auto/declarative/qmlgraphicsborderimage/tst_qmlgraphicsborderimage.cpp @@ -101,7 +101,7 @@ void tst_qmlgraphicsborderimage::noSource() { QString componentStr = "import Qt 4.6\nBorderImage { source: \"\" }"; QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl("file://")); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsBorderImage *obj = qobject_cast<QmlGraphicsBorderImage*>(component.create()); QVERIFY(obj != 0); QCOMPARE(obj->source(), QUrl()); @@ -121,7 +121,7 @@ void tst_qmlgraphicsborderimage::imageSource_data() QTest::newRow("local") << SRCDIR "/data/colors.png" << false << ""; QTest::newRow("local not found") << SRCDIR "/data/no-such-file.png" << false - << "Cannot open QUrl( \"file://" SRCDIR "/data/no-such-file.png\" ) "; + << "Cannot open QUrl( \"" + QUrl::fromLocalFile(SRCDIR "/data/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 << "\"Error downloading " SERVER_ADDR "/no-such-file.png - server replied: Not found\" "; @@ -145,7 +145,7 @@ void tst_qmlgraphicsborderimage::imageSource() QString componentStr = "import Qt 4.6\nBorderImage { source: \"" + source + "\" }"; QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl("file://")); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsBorderImage *obj = qobject_cast<QmlGraphicsBorderImage*>(component.create()); QVERIFY(obj != 0); @@ -174,7 +174,7 @@ void tst_qmlgraphicsborderimage::clearSource() QmlContext *ctxt = engine.rootContext(); ctxt->setContextProperty("srcImage", SRCDIR "/data/colors.png"); QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl("file://")); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsBorderImage *obj = qobject_cast<QmlGraphicsBorderImage*>(component.create()); QVERIFY(obj != 0); QVERIFY(obj->status() == QmlGraphicsBorderImage::Ready); @@ -192,7 +192,7 @@ void tst_qmlgraphicsborderimage::resized() { QString componentStr = "import Qt 4.6\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; width: 300; height: 300 }"; QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl("file://")); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsBorderImage *obj = qobject_cast<QmlGraphicsBorderImage*>(component.create()); QVERIFY(obj != 0); QCOMPARE(obj->width(), 300.); @@ -207,7 +207,7 @@ void tst_qmlgraphicsborderimage::smooth() { QString componentStr = "import Qt 4.6\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; smooth: true; width: 300; height: 300 }"; QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl("file://")); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsBorderImage *obj = qobject_cast<QmlGraphicsBorderImage*>(component.create()); QVERIFY(obj != 0); QCOMPARE(obj->width(), 300.); @@ -224,7 +224,7 @@ void tst_qmlgraphicsborderimage::tileModes() { QString componentStr = "import Qt 4.6\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; width: 100; height: 300; horizontalTileMode: BorderImage.Repeat; verticalTileMode: BorderImage.Repeat }"; QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl("file://")); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsBorderImage *obj = qobject_cast<QmlGraphicsBorderImage*>(component.create()); QVERIFY(obj != 0); QCOMPARE(obj->width(), 100.); @@ -237,7 +237,7 @@ void tst_qmlgraphicsborderimage::tileModes() { QString componentStr = "import Qt 4.6\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; width: 300; height: 150; horizontalTileMode: BorderImage.Round; verticalTileMode: BorderImage.Round }"; QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl("file://")); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsBorderImage *obj = qobject_cast<QmlGraphicsBorderImage*>(component.create()); QVERIFY(obj != 0); QCOMPARE(obj->width(), 300.); @@ -264,7 +264,7 @@ void tst_qmlgraphicsborderimage::sciSource() QString componentStr = "import Qt 4.6\nBorderImage { source: \"" + source + "\"; width: 300; height: 300 }"; QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl("file://")); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsBorderImage *obj = qobject_cast<QmlGraphicsBorderImage*>(component.create()); QVERIFY(obj != 0); @@ -309,7 +309,7 @@ void tst_qmlgraphicsborderimage::invalidSciFile() QString componentStr = "import Qt 4.6\nBorderImage { source: \"" SRCDIR "/data/invalid.sci\"; width: 300; height: 300 }"; QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl("file://")); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsBorderImage *obj = qobject_cast<QmlGraphicsBorderImage*>(component.create()); QVERIFY(obj != 0); QCOMPARE(obj->width(), 300.); @@ -327,7 +327,7 @@ void tst_qmlgraphicsborderimage::pendingRemoteRequest() QString componentStr = "import Qt 4.6\nBorderImage { source: \"" + source + "\" }"; QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl("file://")); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsBorderImage *obj = qobject_cast<QmlGraphicsBorderImage*>(component.create()); QVERIFY(obj != 0); QCOMPARE(obj->status(), QmlGraphicsBorderImage::Loading); diff --git a/tests/auto/declarative/qmlgraphicsflickable/tst_qmlgraphicsflickable.cpp b/tests/auto/declarative/qmlgraphicsflickable/tst_qmlgraphicsflickable.cpp index ddeb584..c0ffeb7 100644 --- a/tests/auto/declarative/qmlgraphicsflickable/tst_qmlgraphicsflickable.cpp +++ b/tests/auto/declarative/qmlgraphicsflickable/tst_qmlgraphicsflickable.cpp @@ -68,7 +68,7 @@ tst_qmlgraphicsflickable::tst_qmlgraphicsflickable() void tst_qmlgraphicsflickable::create() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/flickable01.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/flickable01.qml")); QmlGraphicsFlickable *obj = qobject_cast<QmlGraphicsFlickable*>(c.create()); QVERIFY(obj != 0); @@ -94,7 +94,7 @@ void tst_qmlgraphicsflickable::create() void tst_qmlgraphicsflickable::horizontalViewportSize() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/flickable02.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/flickable02.qml")); QmlGraphicsFlickable *obj = qobject_cast<QmlGraphicsFlickable*>(c.create()); QVERIFY(obj != 0); @@ -111,7 +111,7 @@ void tst_qmlgraphicsflickable::horizontalViewportSize() void tst_qmlgraphicsflickable::verticalViewportSize() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/flickable03.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/flickable03.qml")); QmlGraphicsFlickable *obj = qobject_cast<QmlGraphicsFlickable*>(c.create()); QVERIFY(obj != 0); @@ -128,7 +128,7 @@ void tst_qmlgraphicsflickable::verticalViewportSize() void tst_qmlgraphicsflickable::properties() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/flickable04.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/flickable04.qml")); QmlGraphicsFlickable *obj = qobject_cast<QmlGraphicsFlickable*>(c.create()); QVERIFY(obj != 0); diff --git a/tests/auto/declarative/qmlgraphicsflipable/tst_qmlgraphicsflipable.cpp b/tests/auto/declarative/qmlgraphicsflipable/tst_qmlgraphicsflipable.cpp index d4177a7..e571e4e 100644 --- a/tests/auto/declarative/qmlgraphicsflipable/tst_qmlgraphicsflipable.cpp +++ b/tests/auto/declarative/qmlgraphicsflipable/tst_qmlgraphicsflipable.cpp @@ -69,7 +69,7 @@ tst_qmlgraphicsflipable::tst_qmlgraphicsflipable() void tst_qmlgraphicsflipable::create() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/test-flipable.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-flipable.qml")); QmlGraphicsFlipable *obj = qobject_cast<QmlGraphicsFlipable*>(c.create()); QVERIFY(obj != 0); @@ -79,7 +79,7 @@ void tst_qmlgraphicsflipable::create() void tst_qmlgraphicsflipable::checkFrontAndBack() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/test-flipable.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-flipable.qml")); QmlGraphicsFlipable *obj = qobject_cast<QmlGraphicsFlipable*>(c.create()); QVERIFY(obj != 0); @@ -91,7 +91,7 @@ void tst_qmlgraphicsflipable::checkFrontAndBack() void tst_qmlgraphicsflipable::setFrontAndBack() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/test-flipable.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-flipable.qml")); QmlGraphicsFlipable *obj = qobject_cast<QmlGraphicsFlipable*>(c.create()); QVERIFY(obj != 0); diff --git a/tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp b/tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp index 9d79407..c157e62 100644 --- a/tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp +++ b/tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp @@ -769,7 +769,7 @@ void tst_QmlGraphicsGridView::changeFlow() void tst_QmlGraphicsGridView::defaultValues() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/gridview3.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/gridview3.qml")); QmlGraphicsGridView *obj = qobject_cast<QmlGraphicsGridView*>(c.create()); QVERIFY(obj != 0); @@ -792,7 +792,7 @@ void tst_QmlGraphicsGridView::defaultValues() void tst_QmlGraphicsGridView::properties() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/gridview2.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/gridview2.qml")); QmlGraphicsGridView *obj = qobject_cast<QmlGraphicsGridView*>(c.create()); QVERIFY(obj != 0); diff --git a/tests/auto/declarative/qmlgraphicsimage/tst_qmlgraphicsimage.cpp b/tests/auto/declarative/qmlgraphicsimage/tst_qmlgraphicsimage.cpp index 99fafe8..92c779a 100644 --- a/tests/auto/declarative/qmlgraphicsimage/tst_qmlgraphicsimage.cpp +++ b/tests/auto/declarative/qmlgraphicsimage/tst_qmlgraphicsimage.cpp @@ -95,7 +95,7 @@ void tst_qmlgraphicsimage::noSource() { QString componentStr = "import Qt 4.6\nImage { source: \"\" }"; QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl("file://")); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsImage *obj = qobject_cast<QmlGraphicsImage*>(component.create()); QVERIFY(obj != 0); QCOMPARE(obj->source(), QUrl()); @@ -116,7 +116,7 @@ void tst_qmlgraphicsimage::imageSource_data() QTest::newRow("local") << SRCDIR "/data/colors.png" << false << ""; QTest::newRow("local not found") << SRCDIR "/data/no-such-file.png" << false - << "Cannot open QUrl( \"file://" SRCDIR "/data/no-such-file.png\" ) "; + << "Cannot open QUrl( \"" + QUrl::fromLocalFile(SRCDIR "/data/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 << "\"Error downloading " SERVER_ADDR "/no-such-file.png - server replied: Not found\" "; @@ -139,7 +139,7 @@ void tst_qmlgraphicsimage::imageSource() QString componentStr = "import Qt 4.6\nImage { source: \"" + source + "\" }"; QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl("file://")); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsImage *obj = qobject_cast<QmlGraphicsImage*>(component.create()); QVERIFY(obj != 0); @@ -167,7 +167,7 @@ void tst_qmlgraphicsimage::clearSource() QmlContext *ctxt = engine.rootContext(); ctxt->setContextProperty("srcImage", SRCDIR "/data/colors.png"); QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl("file://")); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsImage *obj = qobject_cast<QmlGraphicsImage*>(component.create()); QVERIFY(obj != 0); QVERIFY(obj->status() == QmlGraphicsImage::Ready); @@ -187,7 +187,7 @@ void tst_qmlgraphicsimage::resized() { QString componentStr = "import Qt 4.6\nImage { source: \"" SRCDIR "/data/colors.png\"; width: 300; height: 300 }"; QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl("file://")); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsImage *obj = qobject_cast<QmlGraphicsImage*>(component.create()); QVERIFY(obj != 0); QCOMPARE(obj->width(), 300.); @@ -201,7 +201,7 @@ void tst_qmlgraphicsimage::smooth() { QString componentStr = "import Qt 4.6\nImage { source: \"" SRCDIR "/data/colors.png\"; smooth: true; width: 300; height: 300 }"; QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl("file://")); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsImage *obj = qobject_cast<QmlGraphicsImage*>(component.create()); QVERIFY(obj != 0); QCOMPARE(obj->width(), 300.); @@ -221,7 +221,7 @@ void tst_qmlgraphicsimage::pixmap() ctxt->setContextProperty("testPixmap", pixmap); QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl("file://")); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsImage *obj = qobject_cast<QmlGraphicsImage*>(component.create()); QVERIFY(obj != 0); diff --git a/tests/auto/declarative/qmlgraphicsitem/tst_qmlgraphicsitem.cpp b/tests/auto/declarative/qmlgraphicsitem/tst_qmlgraphicsitem.cpp index 66ef982..c671dae 100644 --- a/tests/auto/declarative/qmlgraphicsitem/tst_qmlgraphicsitem.cpp +++ b/tests/auto/declarative/qmlgraphicsitem/tst_qmlgraphicsitem.cpp @@ -108,7 +108,7 @@ void tst_QmlGraphicsItem::keys() QmlView *canvas = new QmlView(0); canvas->setFixedSize(240,320); - canvas->setUrl(QUrl("file://" SRCDIR "/data/keys.qml")); + canvas->setUrl(QUrl::fromLocalFile(SRCDIR "/data/keys.qml")); KeysTestObject *testObject = new KeysTestObject; canvas->rootContext()->setContextProperty("keysTestObject", testObject); @@ -190,7 +190,7 @@ void tst_QmlGraphicsItem::keyNavigation() QmlView *canvas = new QmlView(0); canvas->setFixedSize(240,320); - canvas->setUrl(QUrl("file://" SRCDIR "/data/keynavigation.qml")); + canvas->setUrl(QUrl::fromLocalFile(SRCDIR "/data/keynavigation.qml")); canvas->execute(); canvas->show(); qApp->processEvents(); diff --git a/tests/auto/declarative/qmlgraphicsloader/tst_qmlgraphicsloader.cpp b/tests/auto/declarative/qmlgraphicsloader/tst_qmlgraphicsloader.cpp index ffd46a9..25543a9 100644 --- a/tests/auto/declarative/qmlgraphicsloader/tst_qmlgraphicsloader.cpp +++ b/tests/auto/declarative/qmlgraphicsloader/tst_qmlgraphicsloader.cpp @@ -97,7 +97,7 @@ void tst_QmlGraphicsLoader::url() QmlGraphicsLoader *loader = qobject_cast<QmlGraphicsLoader*>(component.create()); QVERIFY(loader != 0); QVERIFY(loader->item()); - QVERIFY(loader->source() == QUrl("file://" SRCDIR "/data/Rect120x60.qml")); + QVERIFY(loader->source() == QUrl::fromLocalFile(SRCDIR "/data/Rect120x60.qml")); QCOMPARE(loader->progress(), 1.0); QCOMPARE(loader->status(), QmlGraphicsLoader::Ready); QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 1); @@ -123,7 +123,7 @@ void tst_QmlGraphicsLoader::component() void tst_QmlGraphicsLoader::invalidUrl() { - QTest::ignoreMessage(QtWarningMsg, "(:-1: File error for URL file://" SRCDIR "/data/IDontExist.qml) "); + QTest::ignoreMessage(QtWarningMsg, QString("(:-1: File error for URL " + QUrl::fromLocalFile(SRCDIR "/data/IDontExist.qml").toString() + ") ").toUtf8().constData()); QmlComponent component(&engine); component.setData(QByteArray("import Qt 4.6\nLoader { source: \"IDontExist.qml\" }"), TEST_FILE("")); diff --git a/tests/auto/declarative/qmlgraphicsparticles/tst_qmlgraphicsparticles.cpp b/tests/auto/declarative/qmlgraphicsparticles/tst_qmlgraphicsparticles.cpp index ed68eaf..5458d68 100644 --- a/tests/auto/declarative/qmlgraphicsparticles/tst_qmlgraphicsparticles.cpp +++ b/tests/auto/declarative/qmlgraphicsparticles/tst_qmlgraphicsparticles.cpp @@ -67,8 +67,8 @@ void tst_QmlGraphicsParticles::properties() QmlGraphicsParticles* particles = canvas->root()->findChild<QmlGraphicsParticles*>("particles"); QVERIFY(particles); - particles->setSource(QUrl("file://" SRCDIR "/data/particle.png")); - QCOMPARE(particles->source(), QUrl("file://" SRCDIR "/data/particle.png")); + particles->setSource(QUrl::fromLocalFile(SRCDIR "/data/particle.png")); + QCOMPARE(particles->source(), QUrl::fromLocalFile(SRCDIR "/data/particle.png")); particles->setLifeSpanDeviation(1000); QCOMPARE(particles->lifeSpanDeviation(), 1000); diff --git a/tests/auto/declarative/qmlgraphicspathview/tst_qmlgraphicspathview.cpp b/tests/auto/declarative/qmlgraphicspathview/tst_qmlgraphicspathview.cpp index 8aa2691..c5a0e05 100644 --- a/tests/auto/declarative/qmlgraphicspathview/tst_qmlgraphicspathview.cpp +++ b/tests/auto/declarative/qmlgraphicspathview/tst_qmlgraphicspathview.cpp @@ -171,7 +171,7 @@ tst_QmlGraphicsPathView::tst_QmlGraphicsPathView() void tst_QmlGraphicsPathView::initValues() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/pathview1.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/pathview1.qml")); QmlGraphicsPathView *obj = qobject_cast<QmlGraphicsPathView*>(c.create()); QVERIFY(obj != 0); @@ -189,7 +189,7 @@ void tst_QmlGraphicsPathView::initValues() void tst_QmlGraphicsPathView::pathview2() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/pathview2.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/pathview2.qml")); QmlGraphicsPathView *obj = qobject_cast<QmlGraphicsPathView*>(c.create()); QVERIFY(obj != 0); @@ -207,7 +207,7 @@ void tst_QmlGraphicsPathView::pathview2() void tst_QmlGraphicsPathView::pathview3() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/pathview3.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/pathview3.qml")); QmlGraphicsPathView *obj = qobject_cast<QmlGraphicsPathView*>(c.create()); QVERIFY(obj != 0); @@ -225,7 +225,7 @@ void tst_QmlGraphicsPathView::pathview3() void tst_QmlGraphicsPathView::path() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/path.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/path.qml")); QmlGraphicsPath *obj = qobject_cast<QmlGraphicsPath*>(c.create()); QVERIFY(obj != 0); diff --git a/tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp b/tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp index 72ec5ec..eed84ea 100644 --- a/tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp +++ b/tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp @@ -156,7 +156,7 @@ void tst_qmlgraphicstext::text() { { QmlComponent textComponent(&engine); - textComponent.setData("import Qt 4.6\nText { text: \"\" }", QUrl("file://")); + textComponent.setData("import Qt 4.6\nText { text: \"\" }", QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QVERIFY(textObject != 0); @@ -170,7 +170,7 @@ void tst_qmlgraphicstext::text() { QString componentStr = "import Qt 4.6\nText { text: \"" + standard.at(i) + "\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); @@ -183,7 +183,7 @@ void tst_qmlgraphicstext::text() { QString componentStr = "import Qt 4.6\nText { text: \"" + richText.at(i) + "\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QVERIFY(textObject != 0); @@ -198,7 +198,7 @@ void tst_qmlgraphicstext::width() // uses Font metrics to find the width for standard and document to find the width for rich { QmlComponent textComponent(&engine); - textComponent.setData("import Qt 4.6\nText { text: \"\" }", QUrl("file://")); + textComponent.setData("import Qt 4.6\nText { text: \"\" }", QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QVERIFY(textObject != 0); @@ -216,7 +216,7 @@ void tst_qmlgraphicstext::width() QString componentStr = "import Qt 4.6\nText { text: \"" + standard.at(i) + "\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QVERIFY(textObject != 0); @@ -236,7 +236,7 @@ void tst_qmlgraphicstext::width() QString componentStr = "import Qt 4.6\nText { text: \"" + richText.at(i) + "\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QVERIFY(textObject != 0); @@ -251,7 +251,7 @@ void tst_qmlgraphicstext::wrap() // for specified width and wrap set true { QmlComponent textComponent(&engine); - textComponent.setData("import Qt 4.6\nText { text: \"Hello\"; wrap: true; width: 300 }", QUrl("file://")); + textComponent.setData("import Qt 4.6\nText { text: \"Hello\"; wrap: true; width: 300 }", QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); textHeight = textObject->height(); @@ -264,7 +264,7 @@ void tst_qmlgraphicstext::wrap() { QString componentStr = "import Qt 4.6\nText { wrap: true; width: 30; text: \"" + standard.at(i) + "\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QVERIFY(textObject != 0); @@ -280,7 +280,7 @@ void tst_qmlgraphicstext::wrap() { QString componentStr = "import Qt 4.6\nText { wrap: true; width: 30; text: \"" + richText.at(i) + "\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QVERIFY(textObject != 0); @@ -300,7 +300,7 @@ void tst_qmlgraphicstext::elide() { QmlComponent textComponent(&engine); - textComponent.setData(("import Qt 4.6\nText { text: \"\"; "+elide+" width: 100 }").toLatin1(), QUrl("file://")); + textComponent.setData(("import Qt 4.6\nText { text: \"\"; "+elide+" width: 100 }").toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QCOMPARE(textObject->elideMode(), m); @@ -311,7 +311,7 @@ void tst_qmlgraphicstext::elide() { QString componentStr = "import Qt 4.6\nText { "+elide+" width: 100; text: \"" + standard.at(i) + "\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QCOMPARE(textObject->elideMode(), m); @@ -323,7 +323,7 @@ void tst_qmlgraphicstext::elide() { QString componentStr = "import Qt 4.6\nText { "+elide+" width: 100; text: \"" + richText.at(i) + "\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QCOMPARE(textObject->elideMode(), m); @@ -336,7 +336,7 @@ void tst_qmlgraphicstext::textFormat() { { QmlComponent textComponent(&engine); - textComponent.setData("import Qt 4.6\nText { text: \"Hello\"; textFormat: Text.RichText }", QUrl("file://")); + textComponent.setData("import Qt 4.6\nText { text: \"Hello\"; textFormat: Text.RichText }", QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QVERIFY(textObject != 0); @@ -344,7 +344,7 @@ void tst_qmlgraphicstext::textFormat() } { QmlComponent textComponent(&engine); - textComponent.setData("import Qt 4.6\nText { text: \"<b>Hello</b>\"; textFormat: Text.PlainText }", QUrl("file://")); + textComponent.setData("import Qt 4.6\nText { text: \"<b>Hello</b>\"; textFormat: Text.PlainText }", QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QVERIFY(textObject != 0); @@ -363,7 +363,7 @@ void tst_qmlgraphicstext::horizontalAlignment() { QString componentStr = "import Qt 4.6\nText { horizontalAlignment: \"" + horizontalAlignmentmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QCOMPARE((int)textObject->hAlign(), (int)horizontalAlignmentments.at(j)); @@ -376,7 +376,7 @@ void tst_qmlgraphicstext::horizontalAlignment() { QString componentStr = "import Qt 4.6\nText { horizontalAlignment: \"" + horizontalAlignmentmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QCOMPARE((int)textObject->hAlign(), (int)horizontalAlignmentments.at(j)); @@ -395,7 +395,7 @@ void tst_qmlgraphicstext::verticalAlignment() { QString componentStr = "import Qt 4.6\nText { verticalAlignment: \"" + verticalAlignmentmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QVERIFY(textObject != 0); @@ -409,7 +409,7 @@ void tst_qmlgraphicstext::verticalAlignment() { QString componentStr = "import Qt 4.6\nText { verticalAlignment: \"" + verticalAlignmentmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QVERIFY(textObject != 0); @@ -425,7 +425,7 @@ void tst_qmlgraphicstext::font() { QString componentStr = "import Qt 4.6\nText { font.pointSize: 40; text: \"Hello World\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QCOMPARE(textObject->font().pointSize(), 40); @@ -436,7 +436,7 @@ void tst_qmlgraphicstext::font() { QString componentStr = "import Qt 4.6\nText { font.pixelSize: 40; text: \"Hello World\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QCOMPARE(textObject->font().pixelSize(), 40); @@ -447,7 +447,7 @@ void tst_qmlgraphicstext::font() { QString componentStr = "import Qt 4.6\nText { font.bold: true; text: \"Hello World\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QCOMPARE(textObject->font().bold(), true); @@ -457,7 +457,7 @@ void tst_qmlgraphicstext::font() { QString componentStr = "import Qt 4.6\nText { font.italic: true; text: \"Hello World\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QCOMPARE(textObject->font().italic(), true); @@ -467,7 +467,7 @@ void tst_qmlgraphicstext::font() { QString componentStr = "import Qt 4.6\nText { font.family: \"Helvetica\"; text: \"Hello World\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QCOMPARE(textObject->font().family(), QString("Helvetica")); @@ -478,7 +478,7 @@ void tst_qmlgraphicstext::font() { QString componentStr = "import Qt 4.6\nText { font.family: \"\"; text: \"Hello World\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QCOMPARE(textObject->font().family(), QString("")); @@ -492,7 +492,7 @@ void tst_qmlgraphicstext::style() { QString componentStr = "import Qt 4.6\nText { style: \"" + styleStrings.at(i) + "\"; styleColor: \"white\"; text: \"Hello World\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QCOMPARE((int)textObject->style(), (int)styles.at(i)); @@ -507,7 +507,7 @@ void tst_qmlgraphicstext::color() { QString componentStr = "import Qt 4.6\nText { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QCOMPARE(textObject->color(), QColor(colorStrings.at(i))); @@ -518,7 +518,7 @@ void tst_qmlgraphicstext::color() { QString componentStr = "import Qt 4.6\nText { styleColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QCOMPARE(textObject->styleColor(), QColor(colorStrings.at(i))); @@ -532,7 +532,7 @@ void tst_qmlgraphicstext::color() { QString componentStr = "import Qt 4.6\nText { color: \"" + colorStrings.at(i) + "\"; styleColor: \"" + colorStrings.at(j) + "\"; text: \"Hello World\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QCOMPARE(textObject->color(), QColor(colorStrings.at(i))); @@ -546,7 +546,7 @@ void tst_qmlgraphicstext::color() QString componentStr = "import Qt 4.6\nText { color: \"" + colorStr + "\"; text: \"Hello World\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QCOMPARE(textObject->color(), testColor); @@ -560,14 +560,14 @@ void tst_qmlgraphicstext::smooth() { QString componentStr = "import Qt 4.6\nText { smooth: true; text: \"" + standard.at(i) + "\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QCOMPARE(textObject->smooth(), true); } { QString componentStr = "import Qt 4.6\nText { text: \"" + standard.at(i) + "\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QCOMPARE(textObject->smooth(), false); } @@ -577,14 +577,14 @@ void tst_qmlgraphicstext::smooth() { QString componentStr = "import Qt 4.6\nText { smooth: true; text: \"" + richText.at(i) + "\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QCOMPARE(textObject->smooth(), true); } { QString componentStr = "import Qt 4.6\nText { text: \"" + richText.at(i) + "\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QCOMPARE(textObject->smooth(), false); } @@ -596,7 +596,7 @@ void tst_qmlgraphicstext::weight() { QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QVERIFY(textObject != 0); @@ -605,7 +605,7 @@ void tst_qmlgraphicstext::weight() { QString componentStr = "import Qt 4.6\nText { font.weight: \"Bold\"; text: \"Hello world!\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QVERIFY(textObject != 0); @@ -618,7 +618,7 @@ void tst_qmlgraphicstext::underline() { QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QVERIFY(textObject != 0); @@ -627,7 +627,7 @@ void tst_qmlgraphicstext::underline() { QString componentStr = "import Qt 4.6\nText { font.underline: true; text: \"Hello world!\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QVERIFY(textObject != 0); @@ -640,7 +640,7 @@ void tst_qmlgraphicstext::overline() { QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QVERIFY(textObject != 0); @@ -649,7 +649,7 @@ void tst_qmlgraphicstext::overline() { QString componentStr = "import Qt 4.6\nText { font.overline: true; text: \"Hello world!\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QVERIFY(textObject != 0); @@ -662,7 +662,7 @@ void tst_qmlgraphicstext::strikeout() { QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QVERIFY(textObject != 0); @@ -671,7 +671,7 @@ void tst_qmlgraphicstext::strikeout() { QString componentStr = "import Qt 4.6\nText { font.strikeout: true; text: \"Hello world!\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QVERIFY(textObject != 0); @@ -684,7 +684,7 @@ void tst_qmlgraphicstext::capitalization() { QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QVERIFY(textObject != 0); @@ -693,7 +693,7 @@ void tst_qmlgraphicstext::capitalization() { QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.capitalization: \"AllUppercase\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QVERIFY(textObject != 0); @@ -702,7 +702,7 @@ void tst_qmlgraphicstext::capitalization() { QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.capitalization: \"AllLowercase\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QVERIFY(textObject != 0); @@ -711,7 +711,7 @@ void tst_qmlgraphicstext::capitalization() { QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.capitalization: \"SmallCaps\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QVERIFY(textObject != 0); @@ -720,7 +720,7 @@ void tst_qmlgraphicstext::capitalization() { QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.capitalization: \"Capitalize\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QVERIFY(textObject != 0); @@ -733,7 +733,7 @@ void tst_qmlgraphicstext::letterSpacing() { QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QVERIFY(textObject != 0); @@ -742,7 +742,7 @@ void tst_qmlgraphicstext::letterSpacing() { QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.letterSpacing: -50 }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QVERIFY(textObject != 0); @@ -751,7 +751,7 @@ void tst_qmlgraphicstext::letterSpacing() { QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.letterSpacing: 200 }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QVERIFY(textObject != 0); @@ -764,7 +764,7 @@ void tst_qmlgraphicstext::wordSpacing() { QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QVERIFY(textObject != 0); @@ -773,7 +773,7 @@ void tst_qmlgraphicstext::wordSpacing() { QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.wordSpacing: -50 }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QVERIFY(textObject != 0); @@ -782,7 +782,7 @@ void tst_qmlgraphicstext::wordSpacing() { QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.wordSpacing: 200 }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QVERIFY(textObject != 0); @@ -813,7 +813,7 @@ void tst_qmlgraphicstext::clickLink() { QString componentStr = "import Qt 4.6\nText { text: \"<a href=\\\"http://qt.nokia.com\\\">Hello world!</a>\" }"; QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); QVERIFY(textObject != 0); diff --git a/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp b/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp index ab03713..b684a43 100644 --- a/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp +++ b/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp @@ -266,7 +266,7 @@ void tst_qmlgraphicstextedit::textFormat() { { QmlComponent textComponent(&engine); - textComponent.setData("import Qt 4.6\nTextEdit { text: \"Hello\"; textFormat: Text.RichText }", QUrl("file://")); + textComponent.setData("import Qt 4.6\nTextEdit { text: \"Hello\"; textFormat: Text.RichText }", QUrl::fromLocalFile("")); QmlGraphicsTextEdit *textObject = qobject_cast<QmlGraphicsTextEdit*>(textComponent.create()); QVERIFY(textObject != 0); @@ -274,7 +274,7 @@ void tst_qmlgraphicstextedit::textFormat() } { QmlComponent textComponent(&engine); - textComponent.setData("import Qt 4.6\nTextEdit { text: \"<b>Hello</b>\"; textFormat: Text.PlainText }", QUrl("file://")); + textComponent.setData("import Qt 4.6\nTextEdit { text: \"<b>Hello</b>\"; textFormat: Text.PlainText }", QUrl::fromLocalFile("")); QmlGraphicsTextEdit *textObject = qobject_cast<QmlGraphicsTextEdit*>(textComponent.create()); QVERIFY(textObject != 0); diff --git a/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp b/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp index a36541e..1b05c0a 100644 --- a/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp +++ b/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp @@ -66,7 +66,7 @@ void tst_QmlListModel::static_i18n() QString componentStr = "import Qt 4.6\nListModel { ListElement { prop1: \""+expect+"\" } }"; QmlEngine engine; QmlComponent component(&engine); - component.setData(componentStr.toUtf8(), QUrl("file://")); + component.setData(componentStr.toUtf8(), QUrl::fromLocalFile("")); QmlListModel *obj = qobject_cast<QmlListModel*>(component.create()); QVERIFY(obj != 0); QString prop = obj->get(0).property(QLatin1String("prop1")).toString(); @@ -96,7 +96,7 @@ void tst_QmlListModel::static_nestedElements() QmlEngine engine; QmlComponent component(&engine); - component.setData(componentStr.toUtf8(), QUrl("file://")); + component.setData(componentStr.toUtf8(), QUrl::fromLocalFile("")); QmlListModel *obj = qobject_cast<QmlListModel*>(component.create()); QVERIFY(obj != 0); diff --git a/tests/auto/declarative/qmlpixmapcache/tst_qmlpixmapcache.cpp b/tests/auto/declarative/qmlpixmapcache/tst_qmlpixmapcache.cpp index 1951833..7fd6780 100644 --- a/tests/auto/declarative/qmlpixmapcache/tst_qmlpixmapcache.cpp +++ b/tests/auto/declarative/qmlpixmapcache/tst_qmlpixmapcache.cpp @@ -52,7 +52,7 @@ class tst_qmlpixmapcache : public QObject Q_OBJECT public: tst_qmlpixmapcache() : - thisfile("file://" __FILE__) + thisfile(QUrl::fromLocalFile(__FILE__)) { } diff --git a/tests/auto/declarative/qmlpropertymap/tst_qmlpropertymap.cpp b/tests/auto/declarative/qmlpropertymap/tst_qmlpropertymap.cpp index ba3bdd2..8c457e6 100644 --- a/tests/auto/declarative/qmlpropertymap/tst_qmlpropertymap.cpp +++ b/tests/auto/declarative/qmlpropertymap/tst_qmlpropertymap.cpp @@ -137,7 +137,7 @@ void tst_QmlPropertyMap::changed() ctxt->setContextProperty(QLatin1String("testdata"), &map); QmlComponent component(&engine); component.setData("import Qt 4.6\nText { text: { testdata.key1 = 'Hello World'; 'X' } }", - QUrl("file://")); + QUrl::fromLocalFile("")); QVERIFY(component.isReady()); QmlGraphicsText *txt = qobject_cast<QmlGraphicsText*>(component.create()); QVERIFY(txt); diff --git a/tests/auto/declarative/qmlspringfollow/tst_qmlspringfollow.cpp b/tests/auto/declarative/qmlspringfollow/tst_qmlspringfollow.cpp index fe3a53a..f17b5d4 100644 --- a/tests/auto/declarative/qmlspringfollow/tst_qmlspringfollow.cpp +++ b/tests/auto/declarative/qmlspringfollow/tst_qmlspringfollow.cpp @@ -67,7 +67,7 @@ tst_qmlspringfollow::tst_qmlspringfollow() void tst_qmlspringfollow::defaultValues() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/springfollow1.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/springfollow1.qml")); QmlSpringFollow *obj = qobject_cast<QmlSpringFollow*>(c.create()); QVERIFY(obj != 0); @@ -89,7 +89,7 @@ void tst_qmlspringfollow::defaultValues() void tst_qmlspringfollow::values() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/springfollow2.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/springfollow2.qml")); QmlSpringFollow *obj = qobject_cast<QmlSpringFollow*>(c.create()); QVERIFY(obj != 0); @@ -112,7 +112,7 @@ void tst_qmlspringfollow::values() void tst_qmlspringfollow::disabled() { QmlEngine engine; - QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/springfollow3.qml")); + QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/springfollow3.qml")); QmlSpringFollow *obj = qobject_cast<QmlSpringFollow*>(c.create()); QVERIFY(obj != 0); diff --git a/tests/auto/declarative/qmlsystempalette/tst_qmlsystempalette.cpp b/tests/auto/declarative/qmlsystempalette/tst_qmlsystempalette.cpp index 12e3a70..7da7f68 100644 --- a/tests/auto/declarative/qmlsystempalette/tst_qmlsystempalette.cpp +++ b/tests/auto/declarative/qmlsystempalette/tst_qmlsystempalette.cpp @@ -72,7 +72,7 @@ void tst_qmlsystempalette::activePalette() { QString componentStr = "import Qt 4.6\nSystemPalette { }"; QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl("file://")); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlSystemPalette *object = qobject_cast<QmlSystemPalette*>(component.create()); QVERIFY(object != 0); @@ -101,7 +101,7 @@ void tst_qmlsystempalette::inactivePalette() { QString componentStr = "import Qt 4.6\nSystemPalette { colorGroup: SystemPalette.Inactive }"; QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl("file://")); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlSystemPalette *object = qobject_cast<QmlSystemPalette*>(component.create()); QVERIFY(object != 0); @@ -131,7 +131,7 @@ void tst_qmlsystempalette::disabledPalette() { QString componentStr = "import Qt 4.6\nSystemPalette { colorGroup: SystemPalette.Disabled }"; QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl("file://")); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlSystemPalette *object = qobject_cast<QmlSystemPalette*>(component.create()); QVERIFY(object != 0); @@ -161,7 +161,7 @@ void tst_qmlsystempalette::paletteChanged() { QString componentStr = "import Qt 4.6\nSystemPalette { }"; QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl("file://")); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QmlSystemPalette *object = qobject_cast<QmlSystemPalette*>(component.create()); QVERIFY(object != 0); diff --git a/tests/auto/declarative/qmltimer/tst_qmltimer.cpp b/tests/auto/declarative/qmltimer/tst_qmltimer.cpp index 7191e85..83094d2 100644 --- a/tests/auto/declarative/qmltimer/tst_qmltimer.cpp +++ b/tests/auto/declarative/qmltimer/tst_qmltimer.cpp @@ -92,7 +92,7 @@ void tst_qmltimer::notRepeating() { QmlEngine engine; QmlComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nTimer { interval: 100; running: true }"), QUrl("file://")); + component.setData(QByteArray("import Qt 4.6\nTimer { interval: 100; running: true }"), QUrl::fromLocalFile("")); QmlTimer *timer = qobject_cast<QmlTimer*>(component.create()); QVERIFY(timer != 0); QVERIFY(timer->isRunning()); @@ -113,7 +113,7 @@ void tst_qmltimer::notRepeatingStart() { QmlEngine engine; QmlComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nTimer { interval: 100 }"), QUrl("file://")); + component.setData(QByteArray("import Qt 4.6\nTimer { interval: 100 }"), QUrl::fromLocalFile("")); QmlTimer *timer = qobject_cast<QmlTimer*>(component.create()); QVERIFY(timer != 0); QVERIFY(!timer->isRunning()); @@ -138,7 +138,7 @@ void tst_qmltimer::repeat() { QmlEngine engine; QmlComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nTimer { interval: 100; repeat: true; running: true }"), QUrl("file://")); + component.setData(QByteArray("import Qt 4.6\nTimer { interval: 100; repeat: true; running: true }"), QUrl::fromLocalFile("")); QmlTimer *timer = qobject_cast<QmlTimer*>(component.create()); QVERIFY(timer != 0); @@ -168,7 +168,7 @@ void tst_qmltimer::triggeredOnStart() { QmlEngine engine; QmlComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nTimer { interval: 100; running: true; triggeredOnStart: true }"), QUrl("file://")); + component.setData(QByteArray("import Qt 4.6\nTimer { interval: 100; running: true; triggeredOnStart: true }"), QUrl::fromLocalFile("")); QmlTimer *timer = qobject_cast<QmlTimer*>(component.create()); QVERIFY(timer != 0); QVERIFY(timer->triggeredOnStart()); @@ -191,7 +191,7 @@ void tst_qmltimer::triggeredOnStartRepeat() { QmlEngine engine; QmlComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nTimer { interval: 100; running: true; triggeredOnStart: true; repeat: true }"), QUrl("file://")); + component.setData(QByteArray("import Qt 4.6\nTimer { interval: 100; running: true; triggeredOnStart: true; repeat: true }"), QUrl::fromLocalFile("")); QmlTimer *timer = qobject_cast<QmlTimer*>(component.create()); QVERIFY(timer != 0); @@ -220,7 +220,7 @@ void tst_qmltimer::noTriggerIfNotRunning() "Timer { id: t1; interval: 100; repeat: true; running: true; onTriggered: if (!running) ok=false }" "Timer { interval: 10; running: true; onTriggered: t1.running=false }" "}" - ), QUrl("file://")); + ), QUrl::fromLocalFile("")); QObject *item = component.create(); QVERIFY(item != 0); QTest::qWait(TIMEOUT_TIMEOUT); @@ -233,7 +233,7 @@ void tst_qmltimer::changeDuration() { QmlEngine engine; QmlComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nTimer { interval: 200; repeat: true; running: true }"), QUrl("file://")); + component.setData(QByteArray("import Qt 4.6\nTimer { interval: 200; repeat: true; running: true }"), QUrl::fromLocalFile("")); QmlTimer *timer = qobject_cast<QmlTimer*>(component.create()); QVERIFY(timer != 0); @@ -257,7 +257,7 @@ void tst_qmltimer::restart() { QmlEngine engine; QmlComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nTimer { interval: 500; repeat: true; running: true }"), QUrl("file://")); + component.setData(QByteArray("import Qt 4.6\nTimer { interval: 500; repeat: true; running: true }"), QUrl::fromLocalFile("")); QmlTimer *timer = qobject_cast<QmlTimer*>(component.create()); QVERIFY(timer != 0); diff --git a/tests/auto/declarative/qmlxmllistmodel/tst_qmlxmllistmodel.cpp b/tests/auto/declarative/qmlxmllistmodel/tst_qmlxmllistmodel.cpp index 039cbf4..966d7de 100644 --- a/tests/auto/declarative/qmlxmllistmodel/tst_qmlxmllistmodel.cpp +++ b/tests/auto/declarative/qmlxmllistmodel/tst_qmlxmllistmodel.cpp @@ -68,7 +68,7 @@ private: void tst_qmlxmllistmodel::buildModel() { - QmlComponent component(&engine, QUrl("file://" SRCDIR "/data/model.qml")); + QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/model.qml")); QmlXmlListModel *listModel = qobject_cast<QmlXmlListModel*>(component.create()); QVERIFY(listModel != 0); QTRY_COMPARE(listModel->count(), 9); @@ -87,7 +87,7 @@ void tst_qmlxmllistmodel::buildModel() void tst_qmlxmllistmodel::missingFields() { - QmlComponent component(&engine, QUrl("file://" SRCDIR "/data/model2.qml")); + QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/model2.qml")); QmlXmlListModel *listModel = qobject_cast<QmlXmlListModel*>(component.create()); QVERIFY(listModel != 0); QTRY_COMPARE(listModel->count(), 9); @@ -108,7 +108,7 @@ void tst_qmlxmllistmodel::missingFields() void tst_qmlxmllistmodel::cdata() { - QmlComponent component(&engine, QUrl("file://" SRCDIR "/data/recipes.qml")); + QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/recipes.qml")); QmlXmlListModel *listModel = qobject_cast<QmlXmlListModel*>(component.create()); QVERIFY(listModel != 0); QTRY_COMPARE(listModel->count(), 5); @@ -124,7 +124,7 @@ void tst_qmlxmllistmodel::cdata() void tst_qmlxmllistmodel::attributes() { - QmlComponent component(&engine, QUrl("file://" SRCDIR "/data/recipes.qml")); + QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/recipes.qml")); QmlXmlListModel *listModel = qobject_cast<QmlXmlListModel*>(component.create()); QVERIFY(listModel != 0); QTRY_COMPARE(listModel->count(), 5); @@ -140,7 +140,7 @@ void tst_qmlxmllistmodel::attributes() void tst_qmlxmllistmodel::roles() { - QmlComponent component(&engine, QUrl("file://" SRCDIR "/data/model.qml")); + QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/model.qml")); QmlXmlListModel *listModel = qobject_cast<QmlXmlListModel*>(component.create()); QVERIFY(listModel != 0); QTRY_COMPARE(listModel->count(), 9); @@ -157,8 +157,8 @@ void tst_qmlxmllistmodel::roles() void tst_qmlxmllistmodel::roleErrors() { - QmlComponent component(&engine, QUrl("file://" SRCDIR "/data/roleErrors.qml")); - QTest::ignoreMessage(QtWarningMsg, "QML XmlRole (file://" SRCDIR "/data/roleErrors.qml:6:5) An XmlRole query must not start with '/'"); + QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/roleErrors.qml")); + QTest::ignoreMessage(QtWarningMsg, QString("QML XmlRole (" + QUrl::fromLocalFile(SRCDIR "/data/roleErrors.qml").toString() + ":6:5) An XmlRole query must not start with '/'").toUtf8().constData()); //### make sure we receive all expected warning messages. QmlXmlListModel *listModel = qobject_cast<QmlXmlListModel*>(component.create()); QVERIFY(listModel != 0); @@ -182,8 +182,8 @@ void tst_qmlxmllistmodel::roleErrors() void tst_qmlxmllistmodel::uniqueRoleNames() { - QmlComponent component(&engine, QUrl("file://" SRCDIR "/data/unique.qml")); - QTest::ignoreMessage(QtWarningMsg, "QML XmlRole (file://" SRCDIR "/data/unique.qml:7:5) \"name\" duplicates a previous role name and will be disabled."); + QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/unique.qml")); + QTest::ignoreMessage(QtWarningMsg, QString("QML XmlRole (" + QUrl::fromLocalFile(SRCDIR "/data/unique.qml").toString() + ":7:5) \"name\" duplicates a previous role name and will be disabled.").toUtf8().constData()); QmlXmlListModel *listModel = qobject_cast<QmlXmlListModel*>(component.create()); QVERIFY(listModel != 0); QTRY_COMPARE(listModel->count(), 9); diff --git a/tests/auto/declarative/shared/debugutil.cpp b/tests/auto/declarative/shared/debugutil.cpp index b8245b5..936adda 100644 --- a/tests/auto/declarative/shared/debugutil.cpp +++ b/tests/auto/declarative/shared/debugutil.cpp @@ -158,7 +158,7 @@ int QmlDebugTest::runTests(QmlTestFactory *factory, const QList<QByteArray> &qml foreach (const QByteArray &code, qml) { QmlComponent c(&engine); - c.setData(code, QUrl("file://")); + c.setData(code, QUrl::fromLocalFile("")); Q_ASSERT(c.isReady()); // fails if bad syntax data.items << qobject_cast<QmlGraphicsItem*>(c.create()); } diff --git a/tests/auto/declarative/states/tst_states.cpp b/tests/auto/declarative/states/tst_states.cpp index bf8948a..30dd2c9 100644 --- a/tests/auto/declarative/states/tst_states.cpp +++ b/tests/auto/declarative/states/tst_states.cpp @@ -52,6 +52,9 @@ class tst_states : public QObject public: tst_states() {} +private: + static QByteArray fullDataPath(const QString &path); + private slots: void basicChanges(); void basicExtension(); @@ -78,6 +81,11 @@ private slots: void nonExistantProperty(); }; +QByteArray tst_states::fullDataPath(const QString &path) +{ + return QUrl::fromLocalFile(SRCDIR + path).toString().toUtf8(); +} + void tst_states::basicChanges() { QmlEngine engine; @@ -463,7 +471,7 @@ void tst_states::parentChangeErrors() QmlGraphicsRectangle *innerRect = qobject_cast<QmlGraphicsRectangle*>(rect->findChild<QmlGraphicsRectangle*>("MyRect")); QVERIFY(innerRect != 0); - QTest::ignoreMessage(QtWarningMsg, "QML ParentChange (file://" SRCDIR "/data/parentChange4.qml:25:9) Unable to preserve appearance under non-uniform scale"); + QTest::ignoreMessage(QtWarningMsg, QByteArray("QML ParentChange (" + fullDataPath("/data/parentChange4.qml") + ":25:9) Unable to preserve appearance under non-uniform scale").constData()); rect->setState("reparented"); QCOMPARE(innerRect->rotation(), qreal(0)); QCOMPARE(innerRect->scale(), qreal(1)); @@ -479,7 +487,7 @@ void tst_states::parentChangeErrors() QmlGraphicsRectangle *innerRect = qobject_cast<QmlGraphicsRectangle*>(rect->findChild<QmlGraphicsRectangle*>("MyRect")); QVERIFY(innerRect != 0); - QTest::ignoreMessage(QtWarningMsg, "QML ParentChange (file://" SRCDIR "/data/parentChange5.qml:25:9) Unable to preserve appearance under complex transform"); + QTest::ignoreMessage(QtWarningMsg, QByteArray("QML ParentChange (" + fullDataPath("/data/parentChange5.qml") + ":25:9) Unable to preserve appearance under complex transform").constData()); rect->setState("reparented"); QCOMPARE(innerRect->rotation(), qreal(0)); QCOMPARE(innerRect->scale(), qreal(1)); @@ -720,8 +728,8 @@ void tst_states::propertyErrors() QCOMPARE(rect->color(),QColor("red")); - QTest::ignoreMessage(QtWarningMsg, "QML PropertyChanges (file://" SRCDIR "/data/propertyErrors.qml:8:9) Cannot assign to non-existant property \"colr\""); - QTest::ignoreMessage(QtWarningMsg, "QML PropertyChanges (file://" SRCDIR "/data/propertyErrors.qml:8:9) Cannot assign to read-only property \"wantsFocus\""); + QTest::ignoreMessage(QtWarningMsg, QByteArray("QML PropertyChanges (" + fullDataPath("/data/propertyErrors.qml") + ":8:9) Cannot assign to non-existant property \"colr\"").constData()); + QTest::ignoreMessage(QtWarningMsg, QByteArray("QML PropertyChanges (" + fullDataPath("/data/propertyErrors.qml") + ":8:9) Cannot assign to read-only property \"wantsFocus\"").constData()); rect->setState("blue"); } @@ -866,7 +874,7 @@ void tst_states::nonExistantProperty() QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); QVERIFY(rect != 0); - QTest::ignoreMessage(QtWarningMsg, "QML PropertyChanges (file://" SRCDIR "/data/nonExistantProp.qml:9:9) Cannot assign to non-existant property \"colr\""); + QTest::ignoreMessage(QtWarningMsg, QByteArray("QML PropertyChanges (" + fullDataPath("/data/nonExistantProp.qml") + ":9:9) Cannot assign to non-existant property \"colr\"").constData()); rect->setState("blue"); QCOMPARE(rect->state(), QLatin1String("blue")); } |