diff options
author | Leander Beernaert <leander.beernaert@qt.io> | 2020-01-16 16:25:06 +0100 |
---|---|---|
committer | Leander Beernaert <leander.beernaert@qt.io> | 2020-01-16 16:25:06 +0100 |
commit | 1d333d3375874efb8d37df37dc5ef561573794ad (patch) | |
tree | 2d8c995f64c05c84c1fcceb2c5cb40fcae69855f /tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp | |
parent | b106d86c433706928b0b0c206a0d9f831681e1bf (diff) | |
parent | e79a2658cde899d6ee11ec3c0d0a3768eb2c864b (diff) |
Merge remote-tracking branch 'origin/dev' into wip/cmake
Change-Id: I0c5b939c70bdb91ccdf7068784308416dcaa5736
Diffstat (limited to 'tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp')
-rw-r--r-- | tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp b/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp index bea9978f0b..2f79f7157f 100644 --- a/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp +++ b/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp @@ -47,6 +47,7 @@ public: tst_QQuickWorkerScript() {} private slots: void source(); + void ready(); void messaging(); void messaging_data(); void messaging_sendQObjectList(); @@ -59,6 +60,7 @@ private slots: void script_function(); void script_var(); void stressDispose(); + void xmlHttpRequest(); private: void waitForEchoMessage(QQuickWorkerScript *worker) { @@ -104,6 +106,22 @@ void tst_QQuickWorkerScript::source() qApp->processEvents(); } +void tst_QQuickWorkerScript::ready() +{ + QQmlComponent component(&m_engine, testFileUrl("worker.qml")); + QScopedPointer<QQuickWorkerScript>worker(qobject_cast<QQuickWorkerScript*>(component.create())); + QVERIFY(worker != nullptr); + + const QMetaObject *mo = worker->metaObject(); + + QTRY_VERIFY(worker->ready()); + + QVariant readyChangedCalled = mo->property(mo->indexOfProperty("readyChangedCalled")).read(worker.data()).value<QVariant>(); + + QVERIFY(!readyChangedCalled.isNull()); + QVERIFY(readyChangedCalled.toBool()); +} + void tst_QQuickWorkerScript::messaging() { QFETCH(QVariant, value); @@ -151,6 +169,7 @@ void tst_QQuickWorkerScript::messaging_data() QRegExp::RegExp2)); QTest::newRow("regularexpression") << QVariant::fromValue(QRegularExpression( "^\\d\\d?$", QRegularExpression::CaseInsensitiveOption)); + QTest::newRow("url") << QVariant::fromValue(QUrl("http://example.com/foo/bar")); } void tst_QQuickWorkerScript::messaging_sendQObjectList() @@ -341,6 +360,13 @@ void tst_QQuickWorkerScript::stressDispose() } } +void tst_QQuickWorkerScript::xmlHttpRequest() +{ + QQmlComponent component(&m_engine, testFileUrl("xmlHttpRequest.qml")); + QScopedPointer<QObject> root{component.create()}; // should not crash + QVERIFY(root); +} + QTEST_MAIN(tst_QQuickWorkerScript) #include "tst_qquickworkerscript.moc" |