aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp')
-rw-r--r--tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp35
1 files changed, 34 insertions, 1 deletions
diff --git a/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp b/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp
index fe947fd201..89148812c5 100644
--- a/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp
+++ b/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp
@@ -45,22 +45,42 @@
#include <QtDeclarative/qdeclarativecomponent.h>
#include <QtDeclarative/qsgitem.h>
#include <QtDeclarative/qdeclarativeproperty.h>
+#include <QtDeclarative/qdeclarativeincubator.h>
#include <qcolor.h>
+#include "../../../shared/util.h"
+
+#ifdef Q_OS_SYMBIAN
+// In Symbian OS test data is located in applications private dir
+#define SRCDIR "."
+#endif
+
+class MyIC : public QObject, public QDeclarativeIncubationController
+{
+ Q_OBJECT
+public:
+ MyIC() { startTimer(5); }
+protected:
+ virtual void timerEvent(QTimerEvent*) {
+ incubateFor(5);
+ }
+};
class tst_qdeclarativecomponent : public QObject
{
Q_OBJECT
public:
- tst_qdeclarativecomponent() { }
+ tst_qdeclarativecomponent() { engine.setIncubationController(&ic); }
private slots:
void null();
void loadEmptyUrl();
void qmlCreateObject();
void qmlCreateObjectWithProperties();
+ void qmlIncubateObject();
private:
QDeclarativeEngine engine;
+ MyIC ic;
};
void tst_qdeclarativecomponent::null()
@@ -91,6 +111,19 @@ void tst_qdeclarativecomponent::loadEmptyUrl()
QCOMPARE(error.description(), QLatin1String("Invalid empty URL"));
}
+void tst_qdeclarativecomponent::qmlIncubateObject()
+{
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/incubateObject.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("test1").toBool(), true);
+ QCOMPARE(object->property("test2").toBool(), false);
+
+ QTRY_VERIFY(object->property("test2").toBool() == true);
+
+ delete object;
+}
+
void tst_qdeclarativecomponent::qmlCreateObject()
{
QDeclarativeEngine engine;