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;
|
||||
timer.setInterval(100);
|
||||
|
||||
bool modalSeen = false;
|
||||
bool dialogAccepted = false;
|
||||
|
||||
connect(&timer, &QTimer::timeout, this, [&]() {
|
||||
if (auto activeModal
|
||||
= qobject_cast<QmlProfilerAttachDialog *>(QApplication::activeModalWidget())) {
|
||||
activeModal->setPort(serverUrl.port());
|
||||
activeModal->accept();
|
||||
if (QWidget *activeModal = QApplication::activeModalWidget()) {
|
||||
modalSeen = true;
|
||||
auto dialog = qobject_cast<QmlProfilerAttachDialog *>(activeModal);
|
||||
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(runControl->isRunning());
|
||||
QTRY_VERIFY(modalSeen);
|
||||
QTRY_VERIFY(dialogAccepted);
|
||||
QTRY_VERIFY(profilerTool.clientManager()->isConnected());
|
||||
|
||||
connection.reset();
|
||||
|
Reference in New Issue
Block a user