diff --git a/src/qgcunittest/MainWindowTest.cc b/src/qgcunittest/MainWindowTest.cc index 6e43bf1fe57fe132d8f66b4eb26d852882d32c02..7529bb509bd170d117a4f3c034d12f6f16cc861b 100644 --- a/src/qgcunittest/MainWindowTest.cc +++ b/src/qgcunittest/MainWindowTest.cc @@ -68,18 +68,22 @@ void MainWindowTest::_connectWindowClose_test(MAV_AUTOPILOT autopilot) link->setAutopilotType(autopilot); LinkManager::instance()->_addLink(link); linkMgr->connectLink(link); - QTest::qWait(5000); // Give enough time for UI to settle and heartbeats to go through + + // Wait for the uas to work it's way through the various threads + + QSignalSpy spyUas(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*))); + QCOMPARE(spyUas.wait(5000), true); // Cycle through all the top level views _mainToolBar->onSetupView(); - QTest::qWait(1000); + QTest::qWait(2in00); _mainToolBar->onPlanView(); - QTest::qWait(1000); + QTest::qWait(200); _mainToolBar->onFlyView(); - QTest::qWait(1000); + QTest::qWait(200); _mainToolBar->onAnalyzeView(); - QTest::qWait(1000); + QTest::qWait(200); // On MainWindow close we should get a message box telling the user to disconnect first. Cancel should do nothing. setExpectedMessageBox(QGCMessageBox::Cancel);