aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp')
-rw-r--r--tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp26
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"