Commit 6e11fae8 authored by Gus Grubba's avatar Gus Grubba

Re-enable a subset of unittesting

parent 6331f7bc
......@@ -330,7 +330,7 @@ equals(QT_MAJOR_VERSION, 5):equals(QT_MINOR_VERSION, 9):AndroidBuild {
DebugBuild {
# Unit Test resources
#-- TODO: RESOURCES += UnitTest.qrc
RESOURCES += UnitTest.qrc
}
DEPENDPATH += \
......@@ -395,6 +395,103 @@ SOURCES += \
src/api/QmlComponentInfo.cc \
src/comm/MavlinkMessagesTimer.cc
#
# Unit Test specific configuration goes here (requires full debug build with all plugins)
#
DebugBuild { PX4FirmwarePlugin { PX4FirmwarePluginFactory { APMFirmwarePlugin { APMFirmwarePluginFactory { !MobileBuild {
DEFINES += UNITTEST_BUILD
INCLUDEPATH += \
src/qgcunittest
HEADERS += \
src/Audio/AudioOutputTest.h \
src/FactSystem/FactSystemTestBase.h \
src/FactSystem/FactSystemTestGeneric.h \
src/FactSystem/FactSystemTestPX4.h \
src/FactSystem/ParameterManagerTest.h \
src/MissionManager/CameraCalcTest.h \
src/MissionManager/CameraSectionTest.h \
src/MissionManager/CorridorScanComplexItemTest.h \
src/MissionManager/FWLandingPatternTest.h \
src/MissionManager/MissionCommandTreeTest.h \
src/MissionManager/MissionControllerManagerTest.h \
src/MissionManager/MissionControllerTest.h \
src/MissionManager/MissionItemTest.h \
src/MissionManager/MissionManagerTest.h \
src/MissionManager/MissionSettingsTest.h \
src/MissionManager/PlanMasterControllerTest.h \
src/MissionManager/QGCMapPolygonTest.h \
src/MissionManager/QGCMapPolylineTest.h \
src/MissionManager/SectionTest.h \
src/MissionManager/SimpleMissionItemTest.h \
src/MissionManager/SpeedSectionTest.h \
src/MissionManager/StructureScanComplexItemTest.h \
src/MissionManager/SurveyComplexItemTest.h \
src/MissionManager/TransectStyleComplexItemTest.h \
src/MissionManager/VisualMissionItemTest.h \
src/qgcunittest/GeoTest.h \
src/qgcunittest/LinkManagerTest.h \
src/qgcunittest/MavlinkLogTest.h \
src/qgcunittest/MultiSignalSpy.h \
src/qgcunittest/TCPLinkTest.h \
src/qgcunittest/TCPLoopBackServer.h \
src/qgcunittest/UnitTest.h \
src/Vehicle/SendMavCommandTest.h \
#src/qgcunittest/RadioConfigTest.h \
#src/AnalyzeView/LogDownloadTest.h \
#src/qgcunittest/FileDialogTest.h \
#src/qgcunittest/FileManagerTest.h \
#src/qgcunittest/FlightGearTest.h \
#src/qgcunittest/MainWindowTest.h \
#src/qgcunittest/MessageBoxTest.h \
SOURCES += \
src/Audio/AudioOutputTest.cc \
src/FactSystem/FactSystemTestBase.cc \
src/FactSystem/FactSystemTestGeneric.cc \
src/FactSystem/FactSystemTestPX4.cc \
src/FactSystem/ParameterManagerTest.cc \
src/MissionManager/CameraCalcTest.cc \
src/MissionManager/CameraSectionTest.cc \
src/MissionManager/CorridorScanComplexItemTest.cc \
src/MissionManager/FWLandingPatternTest.cc \
src/MissionManager/MissionCommandTreeTest.cc \
src/MissionManager/MissionControllerManagerTest.cc \
src/MissionManager/MissionControllerTest.cc \
src/MissionManager/MissionItemTest.cc \
src/MissionManager/MissionManagerTest.cc \
src/MissionManager/MissionSettingsTest.cc \
src/MissionManager/PlanMasterControllerTest.cc \
src/MissionManager/QGCMapPolygonTest.cc \
src/MissionManager/QGCMapPolylineTest.cc \
src/MissionManager/SectionTest.cc \
src/MissionManager/SimpleMissionItemTest.cc \
src/MissionManager/SpeedSectionTest.cc \
src/MissionManager/StructureScanComplexItemTest.cc \
src/MissionManager/SurveyComplexItemTest.cc \
src/MissionManager/TransectStyleComplexItemTest.cc \
src/MissionManager/VisualMissionItemTest.cc \
src/qgcunittest/GeoTest.cc \
src/qgcunittest/LinkManagerTest.cc \
src/qgcunittest/MavlinkLogTest.cc \
src/qgcunittest/MultiSignalSpy.cc \
src/qgcunittest/TCPLinkTest.cc \
src/qgcunittest/TCPLoopBackServer.cc \
src/qgcunittest/UnitTest.cc \
src/qgcunittest/UnitTestList.cc \
src/Vehicle/SendMavCommandTest.cc \
#src/qgcunittest/RadioConfigTest.cc \
#src/AnalyzeView/LogDownloadTest.cc \
#src/qgcunittest/FileDialogTest.cc \
#src/qgcunittest/FileManagerTest.cc \
#src/qgcunittest/FlightGearTest.cc \
#src/qgcunittest/MainWindowTest.cc \
#src/qgcunittest/MessageBoxTest.cc \
} } } } } }
# Main QGC Headers and Source files
HEADERS += \
......@@ -458,7 +555,6 @@ HEADERS += \
src/QGCApplication.h \
src/QGCComboBox.h \
src/QGCConfig.h \
src/QGCDockWidget.h \
src/QGCFileDownload.h \
src/QGCGeo.h \
src/QGCLoggingCategory.h \
......@@ -636,7 +732,6 @@ SOURCES += \
src/QGC.cc \
src/QGCApplication.cc \
src/QGCComboBox.cc \
src/QGCDockWidget.cc \
src/QGCFileDownload.cc \
src/QGCGeo.cc \
src/QGCLoggingCategory.cc \
......
......@@ -18,8 +18,6 @@
#include <QList>
#include <QGeoCoordinate>
//-- TODO: This is not even WIP yet. Just a skeleton of what's to come.
//-----------------------------------------------------------------------------
/// class to upload a flight
class AirMapFlightManager : public QObject, public LifetimeChecker
......
......@@ -37,7 +37,7 @@ class RadioComponentController : public FactPanelController
{
Q_OBJECT
friend class RadioConfigTest; ///< This allows our unit test to access internal information needed.
//friend class RadioConfigTest; ///< This allows our unit test to access internal information needed.
public:
RadioComponentController(void);
......
......@@ -18,7 +18,6 @@
#endif
#include "MultiVehicleManager.h"
#include "QGCApplication.h"
#include "QGCQuickWidget.h"
#include "ParameterManager.h"
#include <QQuickItem>
......@@ -69,6 +68,8 @@ void FactSystemTestBase::_parameter_specific_component_id_test(void)
/// Test that QML can reference a Fact
void FactSystemTestBase::_qml_test(void)
{
//-- TODO
#if 0
QGCQuickWidget* widget = new QGCQuickWidget;
widget->setAutoPilot(_plugin);
......@@ -83,11 +84,14 @@ void FactSystemTestBase::_qml_test(void)
QCOMPARE(qmlValue.toInt(), 3);
delete widget;
#endif
}
/// Test QML getting an updated Fact value
void FactSystemTestBase::_qmlUpdate_test(void)
{
//-- TODO
#if 0
QGCQuickWidget* widget = new QGCQuickWidget;
widget->setAutoPilot(_plugin);
......@@ -109,5 +113,6 @@ void FactSystemTestBase::_qmlUpdate_test(void)
QCOMPARE(control->property("text").toInt(), 12);
delete widget;
#endif
}
......@@ -36,7 +36,7 @@ class JoystickConfigController : public FactPanelController
{
Q_OBJECT
friend class RadioConfigTest; ///< This allows our unit test to access internal information needed.
//friend class RadioConfigTest; ///< This allows our unit test to access internal information needed.
public:
JoystickConfigController(void);
......
......@@ -203,7 +203,7 @@ int main(int argc, char *argv[])
CmdLineOpt_t rgCmdLineOptions[] = {
{ "--unittest", &runUnitTests, &unitTestOptions },
{ "--unittest-stress", &stressUnitTests, &unitTestOptions },
{ "--no-windows-assert-ui", &quietWindowsAsserts, NULL },
{ "--no-windows-assert-ui", &quietWindowsAsserts, nullptr },
// Add additional command line option flags here
};
......
......@@ -14,7 +14,6 @@
/// @author Don Gagne <don@thegagnes.com>
#include "MavlinkLogTest.h"
#include "MainWindow.h"
#include "MockLink.h"
#include "QGCTemporaryFile.h"
#include "QGCApplication.h"
......
......@@ -16,7 +16,6 @@
#include "UnitTest.h"
#include "QGCApplication.h"
#include "MAVLinkProtocol.h"
#include "MainWindow.h"
#include "Vehicle.h"
#include <QTemporaryFile>
......@@ -34,10 +33,10 @@ enum UnitTest::FileDialogType UnitTest::_fileDialogExpectedType = getOpenFileNam
int UnitTest::_missedFileDialogCount = 0;
UnitTest::UnitTest(void)
: _linkManager(NULL)
, _mockLink(NULL)
, _mainWindow(NULL)
, _vehicle(NULL)
: _linkManager(nullptr)
, _mockLink(nullptr)
, _mainWindow(nullptr)
, _vehicle(nullptr)
, _expectMissedFileDialog(false)
, _expectMissedMessageBox(false)
, _unitTestRun(false)
......@@ -146,6 +145,8 @@ void UnitTest::cleanup(void)
void UnitTest::setExpectedMessageBox(QMessageBox::StandardButton response)
{
//-- TODO
#if 0
// This means that there was an expected message box but no call to checkExpectedMessageBox
Q_ASSERT(!_messageBoxRespondedTo);
......@@ -154,14 +155,16 @@ void UnitTest::setExpectedMessageBox(QMessageBox::StandardButton response)
// Make sure we haven't missed any previous message boxes
int missedMessageBoxCount = _missedMessageBoxCount;
_missedMessageBoxCount = 0;
QCOMPARE(missedMessageBoxCount, 0);
#endif
_missedMessageBoxCount = 0;
_messageBoxResponseButton = response;
}
void UnitTest::setExpectedFileDialog(enum FileDialogType type, QStringList response)
{
//-- TODO
#if 0
// This means that there was an expected file dialog but no call to checkExpectedFileDialog
Q_ASSERT(!_fileDialogRespondedTo);
......@@ -172,7 +175,7 @@ void UnitTest::setExpectedFileDialog(enum FileDialogType type, QStringList respo
int missedFileDialogCount = _missedFileDialogCount;
_missedFileDialogCount = 0;
QCOMPARE(missedFileDialogCount, 0);
#endif
_fileDialogResponseSet = true;
_fileDialogResponse = response;
_fileDialogExpectedType = type;
......@@ -410,25 +413,30 @@ void UnitTest::_disconnectMockLink(void)
linkSpy.wait(1000);
QCOMPARE(linkSpy.count(), 1);
_vehicle = NULL;
_vehicle = nullptr;
}
}
void UnitTest::_linkDeleted(LinkInterface* link)
{
if (link == _mockLink) {
_mockLink = NULL;
_mockLink = nullptr;
}
}
void UnitTest::_createMainWindow(void)
{
//-- TODO
#if 0
_mainWindow = MainWindow::_create();
Q_CHECK_PTR(_mainWindow);
#endif
}
void UnitTest::_closeMainWindow(bool cancelExpected)
{
//-- TODO
#if 0
if (_mainWindow) {
QSignalSpy mainWindowSpy(_mainWindow, SIGNAL(mainWindowClosed()));
......@@ -441,6 +449,9 @@ void UnitTest::_closeMainWindow(bool cancelExpected)
// This prevents qWarning from bad references in Qml
QTest::qWait(1000);
}
#else
Q_UNUSED(cancelExpected);
#endif
}
QString UnitTest::createRandomFile(uint32_t byteCount)
......
......@@ -13,24 +13,24 @@
#include "FactSystemTestGeneric.h"
#include "FactSystemTestPX4.h"
#include "FileDialogTest.h"
#include "FlightGearTest.h"
//#include "FileDialogTest.h"
//#include "FlightGearTest.h"
#include "GeoTest.h"
#include "LinkManagerTest.h"
#include "MessageBoxTest.h"
//#include "MessageBoxTest.h"
#include "MissionItemTest.h"
#include "SimpleMissionItemTest.h"
#include "SurveyComplexItemTest.h"
#include "MissionControllerTest.h"
#include "MissionManagerTest.h"
#include "RadioConfigTest.h"
//#include "RadioConfigTest.h"
#include "MavlinkLogTest.h"
#include "MainWindowTest.h"
#include "FileManagerTest.h"
//#include "MainWindowTest.h"
//#include "FileManagerTest.h"
#include "TCPLinkTest.h"
#include "ParameterManagerTest.h"
#include "MissionCommandTreeTest.h"
#include "LogDownloadTest.h"
//#include "LogDownloadTest.h"
#include "SendMavCommandTest.h"
#include "VisualMissionItemTest.h"
#include "CameraSectionTest.h"
......@@ -48,21 +48,21 @@
UT_REGISTER_TEST(FactSystemTestGeneric)
UT_REGISTER_TEST(FactSystemTestPX4)
UT_REGISTER_TEST(FileDialogTest)
UT_REGISTER_TEST(FlightGearUnitTest)
//UT_REGISTER_TEST(FileDialogTest)
//UT_REGISTER_TEST(FlightGearUnitTest)
UT_REGISTER_TEST(GeoTest)
UT_REGISTER_TEST(LinkManagerTest)
UT_REGISTER_TEST(MessageBoxTest)
//UT_REGISTER_TEST(MessageBoxTest)
UT_REGISTER_TEST(MissionItemTest)
UT_REGISTER_TEST(SimpleMissionItemTest)
UT_REGISTER_TEST(MissionControllerTest)
UT_REGISTER_TEST(MissionManagerTest)
UT_REGISTER_TEST(RadioConfigTest)
//UT_REGISTER_TEST(RadioConfigTest)
UT_REGISTER_TEST(TCPLinkTest)
UT_REGISTER_TEST(FileManagerTest)
//UT_REGISTER_TEST(FileManagerTest)
UT_REGISTER_TEST(ParameterManagerTest)
UT_REGISTER_TEST(MissionCommandTreeTest)
UT_REGISTER_TEST(LogDownloadTest)
//UT_REGISTER_TEST(LogDownloadTest)
UT_REGISTER_TEST(SendMavCommandTest)
UT_REGISTER_TEST(SurveyComplexItemTest)
UT_REGISTER_TEST(CameraSectionTest)
......
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