Browse Source

Test disallow of close if active connections

QGC4.4
Don Gagne 11 years ago
parent
commit
cac402bba6
  1. 27
      src/qgcunittest/MainWindowTest.cc
  2. 1
      src/qgcunittest/MainWindowTest.h

27
src/qgcunittest/MainWindowTest.cc

@ -28,6 +28,8 @@ @@ -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) @@ -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();
}

1
src/qgcunittest/MainWindowTest.h

@ -44,6 +44,7 @@ private slots: @@ -44,6 +44,7 @@ private slots:
void cleanup(void);
void _clickThrough_test(void);
void _connectWindowClose_test(void);
private:
MainWindow* _mainWindow;

Loading…
Cancel
Save