equal
deleted
inserted
replaced
45 #include <QSignalSpy> |
45 #include <QSignalSpy> |
46 #include <QtDeclarative/qdeclarativeengine.h> |
46 #include <QtDeclarative/qdeclarativeengine.h> |
47 #include <QtDeclarative/qdeclarativecomponent.h> |
47 #include <QtDeclarative/qdeclarativecomponent.h> |
48 #include <private/qdeclarativeloader_p.h> |
48 #include <private/qdeclarativeloader_p.h> |
49 #include "testhttpserver.h" |
49 #include "testhttpserver.h" |
|
50 #include "../../../shared/util.h" |
50 |
51 |
51 #define SERVER_PORT 14450 |
52 #define SERVER_PORT 14450 |
|
53 |
|
54 #ifdef Q_OS_SYMBIAN |
|
55 // In Symbian OS test data is located in applications private dir |
|
56 #define SRCDIR "." |
|
57 #endif |
52 |
58 |
53 inline QUrl TEST_FILE(const QString &filename) |
59 inline QUrl TEST_FILE(const QString &filename) |
54 { |
60 { |
55 return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename); |
61 return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename); |
56 } |
62 } |
169 QVERIFY(loader != 0); |
175 QVERIFY(loader != 0); |
170 QVERIFY(loader->item()); |
176 QVERIFY(loader->item()); |
171 QCOMPARE(loader->progress(), 1.0); |
177 QCOMPARE(loader->progress(), 1.0); |
172 QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 1); |
178 QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 1); |
173 |
179 |
174 QTest::qWait(500); |
180 QTRY_VERIFY(loader->item() == 0); |
175 |
|
176 QVERIFY(loader->item() == 0); |
|
177 QCOMPARE(loader->progress(), 0.0); |
181 QCOMPARE(loader->progress(), 0.0); |
178 QCOMPARE(loader->status(), QDeclarativeLoader::Null); |
182 QCOMPARE(loader->status(), QDeclarativeLoader::Null); |
179 QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 0); |
183 QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 0); |
180 |
184 |
181 delete loader; |
185 delete loader; |
232 " source: \"Rect120x60.qml\"\n" |
236 " source: \"Rect120x60.qml\"\n" |
233 " Timer { interval: 100; running: true; onTriggered: loader.sourceComponent = myComp }\n" |
237 " Timer { interval: 100; running: true; onTriggered: loader.sourceComponent = myComp }\n" |
234 "}" ) |
238 "}" ) |
235 , TEST_FILE("")); |
239 , TEST_FILE("")); |
236 QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); |
240 QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); |
237 QTest::qWait(500); |
241 QTest::qWait(200); |
238 QVERIFY(loader != 0); |
242 QTRY_VERIFY(loader != 0); |
239 QVERIFY(loader->item()); |
243 QVERIFY(loader->item()); |
240 QCOMPARE(loader->progress(), 1.0); |
244 QCOMPARE(loader->progress(), 1.0); |
241 QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 1); |
245 QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 1); |
242 QCOMPARE(loader->width(), 10.0); |
246 QCOMPARE(loader->width(), 10.0); |
243 QCOMPARE(loader->height(), 10.0); |
247 QCOMPARE(loader->height(), 10.0); |