Fix autotest
authorLars Knoll <lars.knoll@theqtcompany.com>
Thu, 13 Aug 2015 20:08:49 +0000 (22:08 +0200)
committerSimon Hausmann <simon.hausmann@theqtcompany.com>
Tue, 25 Aug 2015 03:45:36 +0000 (03:45 +0000)
The test was not getting a new warning as assumed, but still
reading the old warning from a few lines before. This mirrors
the intended behavior.

Change-Id: I7211923e378db34cdc5f8c1c78f3cfb1bea548d2
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp

index f4765d0e8da181eb93fc43b64fe4a9f19a504e51..8ad2b6ba2b3e0b1f122eb431ee8e51babd226271 100644 (file)
@@ -338,19 +338,17 @@ void tst_QQuickWorkerScript::script_global()
         delete worker;
     }
 
+    qquickworkerscript_lastWarning = QString();
+
     {
+        QtMessageHandler previousMsgHandler = qInstallMessageHandler(qquickworkerscript_warningsHandler);
+
         QQmlComponent component(&m_engine, testFileUrl("worker_global2.qml"));
         QQuickWorkerScript *worker = qobject_cast<QQuickWorkerScript*>(component.create());
         QVERIFY(worker != 0);
 
-        QString value("Hello");
-
-        QtMessageHandler previousMsgHandler = qInstallMessageHandler(qquickworkerscript_warningsHandler);
-
-        QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, value)));
-
         QTRY_COMPARE(qquickworkerscript_lastWarning,
-                testFileUrl("script_global.js").toString() + QLatin1String(":2: Invalid write to global property \"world\""));
+                testFileUrl("script_global2.js").toString() + QLatin1String(":1: Invalid write to global property \"world\""));
 
         qInstallMessageHandler(previousMsgHandler);