Commit 027e9675 authored by Don Gagne's avatar Don Gagne

Test all views on the toolbar

Simple starting point to view testing
parent 54fc0c39
......@@ -27,7 +27,7 @@
/// @author Don Gagne <don@thegagnes.com>
#include "MainWindowTest.h"
#include "MainWindow.h"
#include "QGCToolBar.h"
UT_REGISTER_TEST(MainWindowTest)
......@@ -39,19 +39,30 @@ MainWindowTest::MainWindowTest(void)
void MainWindowTest::init(void)
{
UnitTest::init();
_mainWindow = MainWindow::_create(NULL, MainWindow::CUSTOM_MODE_PX4);
Q_CHECK_PTR(_mainWindow);
}
void MainWindowTest::cleanup(void)
{
_mainWindow->close();
delete _mainWindow;
UnitTest::cleanup();
}
void MainWindowTest::_simpleDisplay_test(void)
void MainWindowTest::_clickThrough_test(void)
{
MainWindow* mainWindow = MainWindow::_create(NULL, MainWindow::CUSTOM_MODE_PX4);
Q_CHECK_PTR(mainWindow);
QGCToolBar* toolbar = _mainWindow->findChild<QGCToolBar*>();
Q_ASSERT(toolbar);
mainWindow->close();
QList<QToolButton*> buttons = toolbar->findChildren<QToolButton*>();
foreach(QToolButton* button, buttons) {
if (!button->menu()) {
QTest::mouseClick(button, Qt::LeftButton);
QTest::qWait(1000);
}
}
delete mainWindow;
}
......@@ -30,6 +30,7 @@
#define MAINWINDOWTEST_H
#include "UnitTest.h"
#include "MainWindow.h"
class MainWindowTest : public UnitTest
{
......@@ -42,7 +43,10 @@ private slots:
void init(void);
void cleanup(void);
void _simpleDisplay_test(void);
void _clickThrough_test(void);
private:
MainWindow* _mainWindow;
};
#endif
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