From 583349de0339df9384f3b69c6cda760939399d2f Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 6 Mar 2013 12:34:44 +0100 Subject: Stabilize tst_qclipboard. If the process terminates while QApplication::processEvents() runs, the subsequent waitForFinished() returns false and the test fails. Task-number: QTBUG-29951 Change-Id: I41f461358920ad430951613dd919885f68ae212c Reviewed-by: Frederik Gladhorn --- tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp index 4470961f7b..89807f3747 100644 --- a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp +++ b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp @@ -208,11 +208,12 @@ static bool runHelper(const QString &program, const QStringList &arguments, QByt // Windows: Due to implementation changes, the event loop needs // to be spun since we ourselves also need to answer the // WM_DRAWCLIPBOARD message as we are in the chain of clipboard - // viewers. + // viewers. Check for running before waitForFinished() in case + // the process terminated while processEvents() was executed. bool running = true; for (int i = 0; i < 60 && running; ++i) { QGuiApplication::processEvents(QEventLoop::ExcludeUserInputEvents); - if (process.waitForFinished(500)) + if (process.state() != QProcess::Running || process.waitForFinished(500)) running = false; } if (running) { -- cgit v1.2.3