Commit ba0b0faf authored by Don Gagne's avatar Don Gagne

MockLink is part of all debug builds

parent 5c4d513d
......@@ -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 \
......
<RCC>
<qresource prefix="/unittest">
<file alias="MockLink.params">src/qgcunittest/MockLink.params</file>
<file alias="MockLink.params">src/comm/MockLink.params</file>
<file alias="FactSystemTest.qml">src/FactSystem/FactSystemTest.qml</file>
</qresource>
......
......@@ -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<TCPConfiguration*>(source));
break;
#ifdef UNITTEST_BUILD
#ifndef __android__
#ifdef QT_DEBUG
case TypeMock:
dupe = new MockConfiguration(dynamic_cast<MockConfiguration*>(source));
break;
#endif
#endif
}
return dupe;
......
......@@ -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)
......
......@@ -88,12 +88,10 @@ LinkInterface* LinkManager::createConnectedLink(LinkConfiguration* config)
case LinkConfiguration::TypeTcp:
pLink = new TCPLink(dynamic_cast<TCPConfiguration*>(config));
break;
#ifdef UNITTEST_BUILD
#ifndef __android__
#ifdef QT_DEBUG
case LinkConfiguration::TypeMock:
pLink = new MockLink(dynamic_cast<MockConfiguration*>(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) {
......
......@@ -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"
......
......@@ -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"));
......
......@@ -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
......
......@@ -158,7 +158,7 @@ void QGCLinkConfiguration::_fixUnnamed(LinkConfiguration* config)
}
}
break;
#ifdef UNITTEST_BUILD
#ifdef QT_DEBUG
case LinkConfiguration::TypeMock:
config->setName(
QString("Mock Link"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment