diff --git a/QGCApplication.pro b/QGCApplication.pro index 5a7857e526182dd74570a6be542aa3d2743ccd7c..acc9756e1ed0f7f330248c2c82467b881089f252 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 6e629ff4ad9842d5c5959bbcfae467d4f231f0d7..c3b264b8a1866729cefe8cc7d5cbc1631d030235 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 5e974f30af0602e66240e3ce6fd265b30c9f65ca..2b793a4ffe95e383a4127a47b7802a898954e5b0 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 dd836e73db9ecd87016fc4814b690e762265ba06..8f8f6009cd794ee10186a8e2a99346d7f62ccaa1 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 10b5af4e48099ce518e8d306c88925f47b41dad0..a48e902ca04808c7fdf56937ec380f567686335c 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 3fdca2ab4ff0247fb944fc1f1746ef74a4baef3e..4cbab25798f3473cd620e1ce65bd0f166ff0870e 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 b6339a83cf34a48c19bdb99b1584ef592b5c6fe4..39e118c227c264b2d917b1807a656e8b876a7f27 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 380d9b8d35d46b2549e61cde305ba7103e2300e9..5e9cf1944b46a03b0c46b7db732641f103efd1f4 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 fab86ed11137cbdeccf0f22bb4dc83c9d1f98246..47459da18b415ccf988adae00d14935af8aa70d2 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"));