Browse Source

Test all views on the toolbar

Simple starting point to view testing
QGC4.4
Don Gagne 10 years ago
parent
commit
027e96757b
  1. 23
      src/qgcunittest/MainWindowTest.cc
  2. 6
      src/qgcunittest/MainWindowTest.h

23
src/qgcunittest/MainWindowTest.cc

@ -27,7 +27,7 @@ @@ -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) @@ -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;
}

6
src/qgcunittest/MainWindowTest.h

@ -30,6 +30,7 @@ @@ -30,6 +30,7 @@
#define MAINWINDOWTEST_H
#include "UnitTest.h"
#include "MainWindow.h"
class MainWindowTest : public UnitTest
{
@ -42,7 +43,10 @@ private slots: @@ -42,7 +43,10 @@ private slots:
void init(void);
void cleanup(void);
void _simpleDisplay_test(void);
void _clickThrough_test(void);
private:
MainWindow* _mainWindow;
};
#endif

Loading…
Cancel
Save