forked from qt-creator/qt-creator
QmlProfiler: Add more fine grained checks to tool test
The test frequently fails for unknown reasons. Check if we actually see the attach dialog, or if some other dialog interfers. Change-Id: Id279b8aa0a822dbdb565fe4105bfcb28ad704e3c Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -69,11 +69,22 @@ void QmlProfilerToolTest::testAttachToWaitingApplication()
|
|||||||
|
|
||||||
QTimer timer;
|
QTimer timer;
|
||||||
timer.setInterval(100);
|
timer.setInterval(100);
|
||||||
|
|
||||||
|
bool modalSeen = false;
|
||||||
|
bool dialogAccepted = false;
|
||||||
|
|
||||||
connect(&timer, &QTimer::timeout, this, [&]() {
|
connect(&timer, &QTimer::timeout, this, [&]() {
|
||||||
if (auto activeModal
|
if (QWidget *activeModal = QApplication::activeModalWidget()) {
|
||||||
= qobject_cast<QmlProfilerAttachDialog *>(QApplication::activeModalWidget())) {
|
modalSeen = true;
|
||||||
activeModal->setPort(serverUrl.port());
|
auto dialog = qobject_cast<QmlProfilerAttachDialog *>(activeModal);
|
||||||
activeModal->accept();
|
if (dialog) {
|
||||||
|
dialog->setPort(serverUrl.port());
|
||||||
|
dialog->accept();
|
||||||
|
dialogAccepted = true;
|
||||||
|
} else {
|
||||||
|
qWarning() << "Some other modal widget popped up:" << activeModal;
|
||||||
|
QFAIL("Interference from unrelated code.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -83,6 +94,8 @@ void QmlProfilerToolTest::testAttachToWaitingApplication()
|
|||||||
|
|
||||||
QTRY_VERIFY(connection);
|
QTRY_VERIFY(connection);
|
||||||
QTRY_VERIFY(runControl->isRunning());
|
QTRY_VERIFY(runControl->isRunning());
|
||||||
|
QTRY_VERIFY(modalSeen);
|
||||||
|
QTRY_VERIFY(dialogAccepted);
|
||||||
QTRY_VERIFY(profilerTool.clientManager()->isConnected());
|
QTRY_VERIFY(profilerTool.clientManager()->isConnected());
|
||||||
|
|
||||||
connection.reset();
|
connection.reset();
|
||||||
|
Reference in New Issue
Block a user