diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2010-04-09 03:42:22 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2010-04-09 03:44:56 (GMT) |
commit | da56d7c25ce344128d827cfa2ed26f9eea437e4d (patch) | |
tree | 863bb2873aa12213b38c824940f8f58dc776d250 /tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp | |
parent | 6e8342957d08d783c211fe0896c326aa44a13ee2 (diff) | |
download | Qt-da56d7c25ce344128d827cfa2ed26f9eea437e4d.zip Qt-da56d7c25ce344128d827cfa2ed26f9eea437e4d.tar.gz Qt-da56d7c25ce344128d827cfa2ed26f9eea437e4d.tar.bz2 |
Fix url resolution in PropertyChanges.
Make sure bindings in PropertyChanges resolve urls correctly. Also
refactor the code so that PropertyChanges will always use the
standard url resolution support provided by QDeclarativeProperty.
Task-number: QTBUG-9571
Diffstat (limited to 'tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp')
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp index f0b6759..578bcb4 100644 --- a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp +++ b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp @@ -43,6 +43,7 @@ #include <QtDeclarative/qdeclarativecomponent.h> #include <private/qdeclarativeanchors_p_p.h> #include <private/qdeclarativerectangle_p.h> +#include <private/qdeclarativeimage_p.h> #include <private/qdeclarativetext_p.h> #include <private/qdeclarativepropertychanges_p.h> #include <private/qdeclarativestategroup_p.h> @@ -109,6 +110,7 @@ private slots: void reset(); void illegalObjectCreation(); void whenOrdering(); + void urlResolution(); }; void tst_qdeclarativestates::initTestCase() @@ -1016,6 +1018,27 @@ void tst_qdeclarativestates::whenOrdering() QCOMPARE(rect->state(), QLatin1String("")); } +void tst_qdeclarativestates::urlResolution() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent c(&engine, SRCDIR "/data/urlResolution.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect != 0); + + QDeclarativeItem *myType = rect->findChild<QDeclarativeItem*>("MyType"); + QDeclarativeImage *image1 = rect->findChild<QDeclarativeImage*>("image1"); + QDeclarativeImage *image2 = rect->findChild<QDeclarativeImage*>("image2"); + QDeclarativeImage *image3 = rect->findChild<QDeclarativeImage*>("image3"); + QVERIFY(myType != 0 && image1 != 0 && image2 != 0 && image3 != 0); + + myType->setState("SetImageState"); + QUrl resolved = QUrl::fromLocalFile(SRCDIR "/data/Implementation/images/qt-logo.png"); + QCOMPARE(image1->source(), resolved); + QCOMPARE(image2->source(), resolved); + QCOMPARE(image3->source(), resolved); +} + QTEST_MAIN(tst_qdeclarativestates) #include "tst_qdeclarativestates.moc" |