From e4d70460e2ad1123cd9e7c15951d1e30b6bc7f6e Mon Sep 17 00:00:00 2001 From: dogmaphobic Date: Fri, 15 Jan 2016 04:53:22 -0500 Subject: [PATCH] Don't look for the ESP8266 if running unit tests. Fact* espVersion = getFact(FactSystem::ParameterProvider, MAV_COMP_ID_UDP_BRIDGE, "SW_VER"); crashes unit test if the parameter does not exist (which is exactly what the call is trying to establish). --- src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc b/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc index 09d4a63e8..009155223 100644 --- a/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc +++ b/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc @@ -104,12 +104,24 @@ const QVariantList& PX4AutoPilotPlugin::vehicleComponents(void) _components.append(QVariant::fromValue((VehicleComponent*)_radioComponent)); //-- Is there an ESP8266 Connected? +#ifdef QT_DEBUG +#ifndef __mobile__ + //-- Unit test barfs if I ask for a parameter that does not exists. The whole poing of the + // test below is to behave differently if ESP8266 is present or not. + if (!qgcApp()->runningUnitTests()) { +#endif +#endif Fact* espVersion = getFact(FactSystem::ParameterProvider, MAV_COMP_ID_UDP_BRIDGE, "SW_VER"); if(espVersion && espVersion->componentId() == MAV_COMP_ID_UDP_BRIDGE) { _esp8266Component = new PX4ESP8266Component(_vehicle, this); _esp8266Component->setupTriggerSignals(); _components.append(QVariant::fromValue((VehicleComponent*)_esp8266Component)); } +#ifdef QT_DEBUG +#ifndef __mobile__ + } +#endif +#endif _flightModesComponent = new FlightModesComponent(_vehicle, this); _flightModesComponent->setupTriggerSignals(); -- 2.22.0