From bc2260ab29c3ca0491a63790af106000faa1f53a Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Fri, 5 Oct 2018 09:14:47 +0200 Subject: [PATCH] QmlProfiler: Make the tool test more robust Apparently there is a different message box that commonly pops up while we are waiting for the attach dialog. Just close it and try again. Also, stop the timer once we have seen the dialog. Otherwise we might fail on extra message boxes that pop up afterwards. Change-Id: I06ae16eb3ad89c9a022ac6fae781f8465425d96f Reviewed-by: Christian Stenger --- src/plugins/qmlprofiler/tests/qmlprofilertool_test.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/plugins/qmlprofiler/tests/qmlprofilertool_test.cpp b/src/plugins/qmlprofiler/tests/qmlprofilertool_test.cpp index ea27c3cb505..a519f6a775a 100644 --- a/src/plugins/qmlprofiler/tests/qmlprofilertool_test.cpp +++ b/src/plugins/qmlprofiler/tests/qmlprofilertool_test.cpp @@ -71,8 +71,6 @@ void QmlProfilerToolTest::testAttachToWaitingApplication() timer.setInterval(100); bool modalSeen = false; - bool dialogAccepted = false; - connect(&timer, &QTimer::timeout, this, [&]() { if (QWidget *activeModal = QApplication::activeModalWidget()) { modalSeen = true; @@ -80,10 +78,10 @@ void QmlProfilerToolTest::testAttachToWaitingApplication() if (dialog) { dialog->setPort(serverUrl.port()); dialog->accept(); - dialogAccepted = true; + timer.stop(); } else { qWarning() << "Some other modal widget popped up:" << activeModal; - QFAIL("Interference from unrelated code."); + activeModal->close(); } } }); @@ -95,7 +93,7 @@ void QmlProfilerToolTest::testAttachToWaitingApplication() QTRY_VERIFY(connection); QTRY_VERIFY(runControl->isRunning()); QTRY_VERIFY(modalSeen); - QTRY_VERIFY(dialogAccepted); + QTRY_VERIFY(!timer.isActive()); QTRY_VERIFY(profilerTool.clientManager()->isConnected()); connection.reset();