summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-01-12 09:49:44 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-01-12 09:49:44 (GMT)
commitbc08102443fa484053320196ba3e19b98b9f62b4 (patch)
tree81369b02604009d98be9f88870e00b7c7ddd9515 /tests
parent2b58621aebf345593f9a277b2ae8dad5aebe0ac1 (diff)
parentc68b263f1ed0446ec8695c947fd43e302fabf8bd (diff)
downloadQt-bc08102443fa484053320196ba3e19b98b9f62b4.zip
Qt-bc08102443fa484053320196ba3e19b98b9f62b4.tar.gz
Qt-bc08102443fa484053320196ba3e19b98b9f62b4.tar.bz2
Merge branch 'kinetic-declarativeui' of scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/states/tst_states.cpp7
-rw-r--r--tests/auto/declarative/xmlhttprequest/tst_xmlhttprequest.cpp35
2 files changed, 33 insertions, 9 deletions
diff --git a/tests/auto/declarative/states/tst_states.cpp b/tests/auto/declarative/states/tst_states.cpp
index 3301048..3c89747 100644
--- a/tests/auto/declarative/states/tst_states.cpp
+++ b/tests/auto/declarative/states/tst_states.cpp
@@ -398,6 +398,7 @@ void tst_states::parentChange()
QmlGraphicsRectangle *innerRect = qobject_cast<QmlGraphicsRectangle*>(rect->findChild<QmlGraphicsRectangle*>("MyRect"));
QVERIFY(innerRect != 0);
+ qmlExecuteDeferred(rect->states()->at(0));
QmlParentChange *pChange = qobject_cast<QmlParentChange*>(rect->states()->at(0)->changes()->at(0));
QVERIFY(pChange != 0);
QmlGraphicsItem *nParent = qobject_cast<QmlGraphicsItem*>(rect->findChild<QmlGraphicsItem*>("NewParent"));
@@ -497,6 +498,7 @@ void tst_states::anchorChanges()
QmlGraphicsRectangle *innerRect = qobject_cast<QmlGraphicsRectangle*>(rect->findChild<QmlGraphicsRectangle*>("MyRect"));
QVERIFY(innerRect != 0);
+ qmlExecuteDeferred(rect->states()->at(0));
QmlAnchorChanges *aChanges = qobject_cast<QmlAnchorChanges*>(rect->states()->at(0)->changes()->at(0));
QVERIFY(aChanges != 0);
@@ -551,6 +553,7 @@ void tst_states::anchorChanges3()
QmlGraphicsItem *bottomGuideline = qobject_cast<QmlGraphicsItem*>(rect->findChild<QmlGraphicsItem*>("BottomGuideline"));
QVERIFY(bottomGuideline != 0);
+ qmlExecuteDeferred(rect->states()->at(0));
QmlAnchorChanges *aChanges = qobject_cast<QmlAnchorChanges*>(rect->states()->at(0)->changes()->at(0));
QVERIFY(aChanges != 0);
@@ -596,6 +599,7 @@ void tst_states::anchorChanges4()
QmlGraphicsItem *bottomGuideline = qobject_cast<QmlGraphicsItem*>(rect->findChild<QmlGraphicsItem*>("BottomGuideline"));
QVERIFY(bottomGuideline != 0);
+ qmlExecuteDeferred(rect->states()->at(0));
QmlAnchorChanges *aChanges = qobject_cast<QmlAnchorChanges*>(rect->states()->at(0)->changes()->at(0));
QVERIFY(aChanges != 0);
@@ -626,6 +630,7 @@ void tst_states::anchorChanges5()
QmlGraphicsItem *bottomGuideline = qobject_cast<QmlGraphicsItem*>(rect->findChild<QmlGraphicsItem*>("BottomGuideline"));
QVERIFY(bottomGuideline != 0);
+ qmlExecuteDeferred(rect->states()->at(0));
QmlAnchorChanges *aChanges = qobject_cast<QmlAnchorChanges*>(rect->states()->at(0)->changes()->at(0));
QVERIFY(aChanges != 0);
@@ -683,6 +688,7 @@ void tst_states::explicitChanges()
QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create());
QVERIFY(rect != 0);
+ qmlExecuteDeferred(rect->states()->at(0));
QmlPropertyChanges *changes = qobject_cast<QmlPropertyChanges*>(rect->findChild<QmlPropertyChanges*>("changes"));
QVERIFY(changes != 0);
QVERIFY(changes->isExplicit());
@@ -783,6 +789,7 @@ void tst_states::deletingChange()
QmlState *state = rect->findChild<QmlState*>();
QVERIFY(state != 0);
+ qmlExecuteDeferred(state);
QCOMPARE(state->changes()->count(), 1);
rect->setState("blue");
diff --git a/tests/auto/declarative/xmlhttprequest/tst_xmlhttprequest.cpp b/tests/auto/declarative/xmlhttprequest/tst_xmlhttprequest.cpp
index dc48195..f952099 100644
--- a/tests/auto/declarative/xmlhttprequest/tst_xmlhttprequest.cpp
+++ b/tests/auto/declarative/xmlhttprequest/tst_xmlhttprequest.cpp
@@ -64,6 +64,7 @@ private slots:
}
void domExceptionCodes();
+ void callbackException();
void staticStateValues();
void instanceStateValues();
void constructor();
@@ -157,6 +158,31 @@ void tst_xmlhttprequest::domExceptionCodes()
delete object;
}
+#define TRY_WAIT(expr) \
+ do { \
+ for (int ii = 0; ii < 6; ++ii) { \
+ if ((expr)) break; \
+ QTest::qWait(50); \
+ } \
+ QVERIFY((expr)); \
+ } while (false)
+
+void tst_xmlhttprequest::callbackException()
+{
+ QString expect = TEST_FILE("callbackException.qml").toString() + ":16: Error: Exception from Callback";
+ QTest::ignoreMessage(QtWarningMsg, expect.toLatin1());
+
+ QmlComponent component(&engine, TEST_FILE("callbackException.qml"));
+ QObject *object = component.beginCreate(engine.rootContext());
+ QVERIFY(object != 0);
+ object->setProperty("url", "testdocument.html");
+ component.completeCreate();
+
+ TRY_WAIT(object->property("threw").toBool() == true);
+
+ delete object;
+}
+
// Test that the state value properties on the XMLHttpRequest constructor have the correct values.
// ### WebKit does not do this, but it seems to fit the standard and QML better
void tst_xmlhttprequest::staticStateValues()
@@ -219,15 +245,6 @@ void tst_xmlhttprequest::defaultState()
delete object;
}
-#define TRY_WAIT(expr) \
- do { \
- for (int ii = 0; ii < 6; ++ii) { \
- if ((expr)) break; \
- QTest::qWait(50); \
- } \
- QVERIFY((expr)); \
- } while (false)
-
// Test valid XMLHttpRequest.open() calls
void tst_xmlhttprequest::open()
{