forked from qt-creator/qt-creator
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 <christian.stenger@qt.io>
This commit is contained in:
@@ -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();
|
||||
|
Reference in New Issue
Block a user