diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2018-10-04 11:17:20 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2018-10-04 10:47:41 +0000 |
commit | 1bc3103ef2d2a3e43f6e3e07479678aadb8a738a (patch) | |
tree | 06ff89d3918f7de6cedafb0752fdd951242a52df /src/plugins/qmlprofiler | |
parent | f6e5202b80af2f910fc06f4b46537ec7a65f2394 (diff) |
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>
Diffstat (limited to 'src/plugins/qmlprofiler')
-rw-r--r-- | src/plugins/qmlprofiler/tests/qmlprofilertool_test.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/plugins/qmlprofiler/tests/qmlprofilertool_test.cpp b/src/plugins/qmlprofiler/tests/qmlprofilertool_test.cpp index 6a766b6aa86..ea27c3cb505 100644 --- a/src/plugins/qmlprofiler/tests/qmlprofilertool_test.cpp +++ b/src/plugins/qmlprofiler/tests/qmlprofilertool_test.cpp @@ -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(); |