From c038ecf4b3de3e110f268234b862d14d18ba188c Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Sat, 23 Jul 2016 14:05:26 -0700 Subject: [PATCH] Fix RadioConfigTest for new SetupPage usage --- src/AutoPilotPlugins/Common/RadioComponent.qml | 3 +++ src/qgcunittest/RadioConfigTest.cc | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/AutoPilotPlugins/Common/RadioComponent.qml b/src/AutoPilotPlugins/Common/RadioComponent.qml index a6bef66e7..75e038a5e 100644 --- a/src/AutoPilotPlugins/Common/RadioComponent.qml +++ b/src/AutoPilotPlugins/Common/RadioComponent.qml @@ -18,6 +18,7 @@ import QGroundControl.FactControls 1.0 import QGroundControl.Controls 1.0 import QGroundControl.ScreenTools 1.0 import QGroundControl.Controllers 1.0 +import QGroundControl.Palette 1.0 SetupPage { id: radioPage @@ -48,6 +49,8 @@ SetupPage { { } + QGCPalette { id: qgcPal; colorGroupEnabled: radioPage.enabled } + RadioComponentController { id: controller factPanel: radioPage.viewPanel diff --git a/src/qgcunittest/RadioConfigTest.cc b/src/qgcunittest/RadioConfigTest.cc index e06e21e8c..edcf97fbe 100644 --- a/src/qgcunittest/RadioConfigTest.cc +++ b/src/qgcunittest/RadioConfigTest.cc @@ -12,6 +12,9 @@ #include "RadioComponentController.h" #include "MultiVehicleManager.h" #include "QGCApplication.h" +#include "PX4/PX4AutoPilotPlugin.h" +#include "APM/APMAutoPilotPlugin.h" +#include "APM/APMRadioComponent.h" /// @file /// @brief QRadioComponentController Widget unit test @@ -200,6 +203,13 @@ void RadioConfigTest::_init(MAV_AUTOPILOT firmwareType) _calWidget->resize(600, 600); Q_CHECK_PTR(_calWidget); _calWidget->setAutoPilot(_autopilot); + QObject* vehicleComponent; + if (firmwareType == MAV_AUTOPILOT_PX4) { + vehicleComponent = dynamic_cast(dynamic_cast(_autopilot)->radioComponent()); + } else { + vehicleComponent = dynamic_cast(dynamic_cast(_autopilot)->radioComponent()); + } + _calWidget->setContextPropertyObject("vehicleComponent", vehicleComponent); _calWidget->setSource(QUrl::fromUserInput("qrc:/qml/RadioComponent.qml")); // Nasty hack to get to controller -- 2.22.0