From ba0b0faf73f55bdbe48481c2fca8cca2567dfeae Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Mon, 27 Apr 2015 22:48:11 -0700 Subject: [PATCH] MockLink is part of all debug builds --- QGCApplication.pro | 16 ++++++++++++---- qgroundcontrol.qrc | 2 +- src/comm/LinkConfiguration.cc | 12 +++--------- src/comm/LinkConfiguration.h | 2 +- src/comm/LinkManager.cc | 8 ++------ src/comm/LinkManager.h | 4 +--- src/{qgcunittest => comm}/MockLink.cc | 0 src/{qgcunittest => comm}/MockLink.h | 0 src/{qgcunittest => comm}/MockLink.params | 0 .../MockLinkMissionItemHandler.cc | 0 .../MockLinkMissionItemHandler.h | 0 src/ui/QGCCommConfiguration.cc | 4 ++-- src/ui/QGCCommConfiguration.h | 2 +- src/ui/QGCLinkConfiguration.cc | 2 +- 14 files changed, 24 insertions(+), 28 deletions(-) rename src/{qgcunittest => comm}/MockLink.cc (100%) rename src/{qgcunittest => comm}/MockLink.h (100%) rename src/{qgcunittest => comm}/MockLink.params (100%) rename src/{qgcunittest => comm}/MockLinkMissionItemHandler.cc (100%) rename src/{qgcunittest => comm}/MockLinkMissionItemHandler.h (100%) diff --git a/QGCApplication.pro b/QGCApplication.pro index 5a7857e52..acc9756e1 100644 --- a/QGCApplication.pro +++ b/QGCApplication.pro @@ -357,6 +357,12 @@ HEADERS += \ src/ViewWidgets/ViewWidgetController.h \ src/Waypoint.h \ +DebugBuild { +HEADERS += \ + src/comm/MockLink.h \ + src/comm/MockLinkMissionItemHandler.h +} + !AndroidBuild { HEADERS += \ src/input/JoystickInput.h \ @@ -486,6 +492,12 @@ SOURCES += \ src/ViewWidgets/ViewWidgetController.cc \ src/Waypoint.cc \ +DebugBuild { +SOURCES += \ + src/comm/MockLink.cc \ + src/comm/MockLinkMissionItemHandler.cc +} + !AndroidBuild { SOURCES += \ src/input/JoystickInput.cc \ @@ -529,8 +541,6 @@ HEADERS += \ src/qgcunittest/MainWindowTest.h \ src/qgcunittest/MavlinkLogTest.h \ src/qgcunittest/MessageBoxTest.h \ - src/qgcunittest/MockLink.h \ - src/qgcunittest/MockLinkMissionItemHandler.h \ src/qgcunittest/PX4RCCalibrationTest.h \ src/qgcunittest/UnitTest.h \ src/VehicleSetup/SetupViewTest.h \ @@ -549,8 +559,6 @@ SOURCES += \ src/qgcunittest/MainWindowTest.cc \ src/qgcunittest/MavlinkLogTest.cc \ src/qgcunittest/MessageBoxTest.cc \ - src/qgcunittest/MockLink.cc \ - src/qgcunittest/MockLinkMissionItemHandler.cc \ src/qgcunittest/PX4RCCalibrationTest.cc \ src/qgcunittest/UnitTest.cc \ src/VehicleSetup/SetupViewTest.cc \ diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc index 6e629ff4a..c3b264b8a 100644 --- a/qgroundcontrol.qrc +++ b/qgroundcontrol.qrc @@ -1,6 +1,6 @@ - src/qgcunittest/MockLink.params + src/comm/MockLink.params src/FactSystem/FactSystemTest.qml diff --git a/src/comm/LinkConfiguration.cc b/src/comm/LinkConfiguration.cc index 5e974f30a..2b793a4ff 100644 --- a/src/comm/LinkConfiguration.cc +++ b/src/comm/LinkConfiguration.cc @@ -32,11 +32,9 @@ This file is part of the QGROUNDCONTROL project #include "UDPLink.h" #include "TCPLink.h" -#ifdef UNITTEST_BUILD -#ifndef __android__ +#ifdef QT_DEBUG #include "MockLink.h" #endif -#endif #define LINK_SETTING_ROOT "LinkConfigurations" @@ -93,12 +91,10 @@ LinkConfiguration* LinkConfiguration::createSettings(int type, const QString& na case LinkConfiguration::TypeTcp: config = new TCPConfiguration(name); break; -#ifdef UNITTEST_BUILD -#ifndef __android__ +#ifdef QT_DEBUG case LinkConfiguration::TypeMock: config = new MockConfiguration(name); break; -#endif #endif } return config; @@ -121,12 +117,10 @@ LinkConfiguration* LinkConfiguration::duplicateSettings(LinkConfiguration* sourc case TypeTcp: dupe = new TCPConfiguration(dynamic_cast(source)); break; -#ifdef UNITTEST_BUILD -#ifndef __android__ +#ifdef QT_DEBUG case TypeMock: dupe = new MockConfiguration(dynamic_cast(source)); break; -#endif #endif } return dupe; diff --git a/src/comm/LinkConfiguration.h b/src/comm/LinkConfiguration.h index dd836e73d..8f8f6009c 100644 --- a/src/comm/LinkConfiguration.h +++ b/src/comm/LinkConfiguration.h @@ -49,7 +49,7 @@ public: TypeXbee, ///< XBee Proprietary Link TypeOpal, ///< Opal-RT Link #endif -#ifdef UNITTEST_BUILD +#ifdef QT_DEBUG TypeMock, ///< Mock Link for Unitesting #endif TypeLast // Last type value (type >= TypeLast == invalid) diff --git a/src/comm/LinkManager.cc b/src/comm/LinkManager.cc index 10b5af4e4..a48e902ca 100644 --- a/src/comm/LinkManager.cc +++ b/src/comm/LinkManager.cc @@ -88,12 +88,10 @@ LinkInterface* LinkManager::createConnectedLink(LinkConfiguration* config) case LinkConfiguration::TypeTcp: pLink = new TCPLink(dynamic_cast(config)); break; -#ifdef UNITTEST_BUILD -#ifndef __android__ +#ifdef QT_DEBUG case LinkConfiguration::TypeMock: pLink = new MockLink(dynamic_cast(config)); break; -#endif #endif } if(pLink) { @@ -384,13 +382,11 @@ void LinkManager::loadLinkConfigurationList() pLink = (LinkConfiguration*)new TCPConfiguration(name); pLink->setPreferred(preferred); break; -#ifdef UNITTEST_BUILD -#ifndef __android__ +#ifdef QT_DEBUG case LinkConfiguration::TypeMock: pLink = (LinkConfiguration*)new MockConfiguration(name); pLink->setPreferred(false); break; -#endif #endif } if(pLink) { diff --git a/src/comm/LinkManager.h b/src/comm/LinkManager.h index 3fdca2ab4..4cbab2579 100644 --- a/src/comm/LinkManager.h +++ b/src/comm/LinkManager.h @@ -39,11 +39,9 @@ This file is part of the PIXHAWK project #include "UDPLink.h" #include "TCPLink.h" -#ifdef UNITTEST_BUILD -#ifndef __android__ +#ifdef QT_DEBUG #include "MockLink.h" #endif -#endif #include "ProtocolInterface.h" #include "QGCSingleton.h" diff --git a/src/qgcunittest/MockLink.cc b/src/comm/MockLink.cc similarity index 100% rename from src/qgcunittest/MockLink.cc rename to src/comm/MockLink.cc diff --git a/src/qgcunittest/MockLink.h b/src/comm/MockLink.h similarity index 100% rename from src/qgcunittest/MockLink.h rename to src/comm/MockLink.h diff --git a/src/qgcunittest/MockLink.params b/src/comm/MockLink.params similarity index 100% rename from src/qgcunittest/MockLink.params rename to src/comm/MockLink.params diff --git a/src/qgcunittest/MockLinkMissionItemHandler.cc b/src/comm/MockLinkMissionItemHandler.cc similarity index 100% rename from src/qgcunittest/MockLinkMissionItemHandler.cc rename to src/comm/MockLinkMissionItemHandler.cc diff --git a/src/qgcunittest/MockLinkMissionItemHandler.h b/src/comm/MockLinkMissionItemHandler.h similarity index 100% rename from src/qgcunittest/MockLinkMissionItemHandler.h rename to src/comm/MockLinkMissionItemHandler.h diff --git a/src/ui/QGCCommConfiguration.cc b/src/ui/QGCCommConfiguration.cc index b6339a83c..39e118c22 100644 --- a/src/ui/QGCCommConfiguration.cc +++ b/src/ui/QGCCommConfiguration.cc @@ -48,7 +48,7 @@ QGCCommConfiguration::QGCCommConfiguration(QWidget *parent, LinkConfiguration *c _ui->typeCombo->addItem(tr("Serial"), LinkConfiguration::TypeSerial); _ui->typeCombo->addItem(tr("UDP"), LinkConfiguration::TypeUdp); _ui->typeCombo->addItem(tr("TCP"), LinkConfiguration::TypeTcp); -#ifdef UNITTEST_BUILD +#ifdef QT_DEBUG _ui->typeCombo->addItem(tr("Mock"), LinkConfiguration::TypeMock); #endif @@ -134,7 +134,7 @@ void QGCCommConfiguration::_loadTypeConfigWidget(int type) _ui->typeCombo->setCurrentIndex(_ui->typeCombo->findData(LinkConfiguration::TypeTcp)); } break; -#ifdef UNITTEST_BUILD +#ifdef QT_DEBUG case LinkConfiguration::TypeMock: { _ui->linkScrollArea->setWidget(NULL); _ui->linkGroupBox->setTitle(tr("Mock Link")); diff --git a/src/ui/QGCCommConfiguration.h b/src/ui/QGCCommConfiguration.h index 380d9b8d3..5e9cf1944 100644 --- a/src/ui/QGCCommConfiguration.h +++ b/src/ui/QGCCommConfiguration.h @@ -54,7 +54,7 @@ public: QGC_LINK_TCP, QGC_LINK_SIMULATION, QGC_LINK_FORWARDING, -#ifdef UNITTEST_BUILD +#ifdef QT_DEBUG QGC_LINK_MOCK, #endif #ifdef QGC_XBEE_ENABLED diff --git a/src/ui/QGCLinkConfiguration.cc b/src/ui/QGCLinkConfiguration.cc index fab86ed11..47459da18 100644 --- a/src/ui/QGCLinkConfiguration.cc +++ b/src/ui/QGCLinkConfiguration.cc @@ -158,7 +158,7 @@ void QGCLinkConfiguration::_fixUnnamed(LinkConfiguration* config) } } break; -#ifdef UNITTEST_BUILD +#ifdef QT_DEBUG case LinkConfiguration::TypeMock: config->setName( QString("Mock Link")); -- 2.22.0