diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2010-01-12 04:04:14 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2010-01-12 04:04:14 (GMT) |
commit | 5f185497a1f7272d4e79c3e3959d75c6f3277572 (patch) | |
tree | 7bec7ee7223353de4578ffe45a5eae08650a8dd7 | |
parent | dea7b0ba88871cb4b572b014a20a9918c4b3a8cf (diff) | |
download | Qt-5f185497a1f7272d4e79c3e3959d75c6f3277572.zip Qt-5f185497a1f7272d4e79c3e3959d75c6f3277572.tar.gz Qt-5f185497a1f7272d4e79c3e3959d75c6f3277572.tar.bz2 |
Test that exceptions are passed.
Task-number: QTBUG-6507
-rw-r--r-- | tests/auto/declarative/xmlhttprequest/tst_xmlhttprequest.cpp | 35 |
1 files changed, 26 insertions, 9 deletions
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() { |