Commit cac402bb authored by Don Gagne's avatar Don Gagne

Test disallow of close if active connections

parent 125f125a
......@@ -28,6 +28,8 @@
#include "MainWindowTest.h"
#include "QGCToolBar.h"
#include "MockLink.h"
#include "QGCMessageBox.h"
UT_REGISTER_TEST(MainWindowTest)
......@@ -66,3 +68,28 @@ void MainWindowTest::_clickThrough_test(void)
}
}
void MainWindowTest::_connectWindowClose_test(void)
{
LinkManager* linkMgr = LinkManager::instance();
Q_CHECK_PTR(linkMgr);
MockLink* link = new MockLink();
Q_CHECK_PTR(link);
// FIXME: LinkManager/MainWindow needs to be re-architected so that you don't have to addLink to MainWindow to get things to work
_mainWindow->addLink(link);
linkMgr->connectLink(link);
QTest::qWait(5000); // Give enough time for UI to settle and heartbeats to go through
// On MainWindow close we should get a message box telling the user to disconnect first
setExpectedMessageBox(QGCMessageBox::Ok);
_mainWindow->close();
QTest::qWait(1000); // Need to allow signals to move between threads
checkExpectedMessageBox();
// We are going to disconnect the link which is going to pop a save file dialog
setExpectedFileDialog(getSaveFileName, QStringList());
linkMgr->disconnectLink(link);
QTest::qWait(1000); // Need to allow signals to move between threads
checkExpectedFileDialog();
}
......@@ -44,6 +44,7 @@ private slots:
void cleanup(void);
void _clickThrough_test(void);
void _connectWindowClose_test(void);
private:
MainWindow* _mainWindow;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment