Stabilize Test
authorAlan Alpert <aalpert@blackberry.com>
Wed, 10 Apr 2013 21:18:46 +0000 (14:18 -0700)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Wed, 10 Apr 2013 21:52:00 +0000 (23:52 +0200)
Use QProcess::waitForFinished over a signal spy. Has a
chance of stabilizing the test, but also cleans up the code.

Change-Id: I888c3b9da6d44d11516227c085bcc12a5ccb5e8a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp

index 1c11fcb..4780ee0 100644 (file)
@@ -110,13 +110,11 @@ void tst_qqmlapplicationengine::application()
    */
     QDir::setCurrent(buildDir);
     QProcess *testProcess = new QProcess(this);
-    QTest::ignoreMessage(QtWarningMsg, "Don't know how to handle 'QProcess::ExitStatus', use qRegisterMetaType to register it.");
-    QSignalSpy processFinished(testProcess, SIGNAL(finished(int,QProcess::ExitStatus)));
     QStringList args;
     args << QLatin1String("testData");
     testProcess->start(QLatin1String("testapp/testapp"), args);
-    QTRY_VERIFY(processFinished.count());//Application should immediately exit
-    QCOMPARE(processFinished[0][0].toInt(), 0);
+    QVERIFY(testProcess->waitForFinished(5000));
+    QCOMPARE(testProcess->exitCode(), 0);
     QByteArray test_stdout = testProcess->readAllStandardOutput();
     QByteArray test_stderr = testProcess->readAllStandardError();
     QByteArray test_stderr_target("Start: testData\nEnd\n");