From 4c8b3f0fcc2b9bf43568720355214f1a159b304b Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Thu, 9 Apr 2015 11:24:24 -0700 Subject: [PATCH] Click through all setup buttons --- src/VehicleSetup/SetupViewTest.cc | 29 +++++++++++++++++++++++++++-- src/ui/MainWindow.h | 2 ++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/VehicleSetup/SetupViewTest.cc b/src/VehicleSetup/SetupViewTest.cc index 7a1ef75c2..93d6b2396 100644 --- a/src/VehicleSetup/SetupViewTest.cc +++ b/src/VehicleSetup/SetupViewTest.cc @@ -27,6 +27,9 @@ #include "SetupViewTest.h" #include "MockLink.h" #include "QGCMessageBox.h" +#include "SetupView.h" +#include "UASManager.h" +#include "AutoPilotPluginManager.h" UT_REGISTER_TEST(SetupViewTest) @@ -72,9 +75,31 @@ void SetupViewTest::_clickThrough_test(void) _mainToolBar->onSetupView(); QTest::qWait(1000); - // Click through all the setup buttons - // FIXME: NYI + MainWindow* mainWindow = MainWindow::instance(); + Q_ASSERT(mainWindow); + QWidget* setupViewWidget = mainWindow->getCurrentViewWidget(); + Q_ASSERT(setupViewWidget); + SetupView* setupView = qobject_cast(setupViewWidget); + Q_ASSERT(setupView); + + // Click through fixed buttons + setupView->firmwareButtonClicked(); + QTest::qWait(1000); + setupView->parametersButtonClicked(); + QTest::qWait(1000); + setupView->summaryButtonClicked(); + QTest::qWait(1000); + // Click through component buttons + UASInterface* uas = UASManager::instance()->getActiveUAS(); + Q_ASSERT(uas); + AutoPilotPlugin* autopilot = AutoPilotPluginManager::instance()->getInstanceForAutoPilotPlugin(uas); + Q_ASSERT(autopilot); + const QVariantList& components = autopilot->vehicleComponents(); + foreach(QVariant varComponent, components) { + setupView->setupButtonClicked(varComponent); + } + // On MainWindow close we should get a message box telling the user to disconnect first. Disconnect will then pop // the log file save dialog. diff --git a/src/ui/MainWindow.h b/src/ui/MainWindow.h index 4e9e38f54..5421579fc 100644 --- a/src/ui/MainWindow.h +++ b/src/ui/MainWindow.h @@ -124,6 +124,8 @@ public: /// @brief Gets a pointer to the Main Tool Bar MainToolBar* getMainToolBar(void) { return _mainToolBar; } + + QWidget* getCurrentViewWidget(void) { return _currentViewWidget; } public slots: /** @brief Show the application settings */ -- 2.22.0