diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc index 3ce5ad56c5604c764f85434adb3800e4508c3178..176c47811750253476752f9905a47b43ad3e5ea3 100644 --- a/qgroundcontrol.qrc +++ b/qgroundcontrol.qrc @@ -24,6 +24,7 @@ src/ui/preferences/MavlinkSettings.qml src/MissionEditor/MissionEditor.qml src/MissionEditor/MissionEditorHelp.qml + src/ui/preferences/MockLink.qml src/AutoPilotPlugins/PX4/PowerComponent.qml src/AutoPilotPlugins/PX4/PowerComponentSummary.qml src/VehicleSetup/PX4FlowSensor.qml diff --git a/src/AutoPilotPlugins/PX4/AirframeComponentController.cc b/src/AutoPilotPlugins/PX4/AirframeComponentController.cc index 3fc8a16fd9108e1f6f39c6318735ba84a82729c9..757c64d9817cb928e65eb4159077687c73950256 100644 --- a/src/AutoPilotPlugins/PX4/AirframeComponentController.cc +++ b/src/AutoPilotPlugins/PX4/AirframeComponentController.cc @@ -98,7 +98,7 @@ AirframeComponentController::~AirframeComponentController() void AirframeComponentController::changeAutostart(void) { - if (qgcApp()->toolbox()->multiVehicleManager()->vehicles().count() > 1) { + if (qgcApp()->toolbox()->multiVehicleManager()->vehicles()->count() > 1) { QGCMessageBox::warning("Airframe Config", "You cannot change airframe configuration while connected to multiple vehicles."); return; } diff --git a/src/FactSystem/FactSystemTestGeneric.cc b/src/FactSystem/FactSystemTestGeneric.cc index 2bb68940248499cc7fa856b6e8bf671bbd7e7798..bd17c673dc1cf61600863d3eacacd92fc1c1cdb8 100644 --- a/src/FactSystem/FactSystemTestGeneric.cc +++ b/src/FactSystem/FactSystemTestGeneric.cc @@ -27,8 +27,6 @@ #include "FactSystemTestGeneric.h" #include "QGCMAVLink.h" -UT_REGISTER_TEST(FactSystemTestGeneric) - /// FactSystem Unit Test for PX4 autpilot FactSystemTestGeneric::FactSystemTestGeneric(void) { diff --git a/src/FactSystem/FactSystemTestPX4.cc b/src/FactSystem/FactSystemTestPX4.cc index 8a53049403fe0325b76925eda290acf539d10611..09a8a561bf12ab8ffcee0097a06fe0c378a45f4b 100644 --- a/src/FactSystem/FactSystemTestPX4.cc +++ b/src/FactSystem/FactSystemTestPX4.cc @@ -27,8 +27,6 @@ #include "FactSystemTestPX4.h" #include "QGCMAVLink.h" -UT_REGISTER_TEST(FactSystemTestPX4) - /// FactSystem Unit Test for PX4 autpilot FactSystemTestPX4::FactSystemTestPX4(void) { diff --git a/src/MissionItemTest.cc b/src/MissionItemTest.cc index b19582b1a4c66f24d7786b5ecbe77c6ba3798716..378d2da2918c6e01434dc3a13260fa7f54cfddce 100644 --- a/src/MissionItemTest.cc +++ b/src/MissionItemTest.cc @@ -24,8 +24,6 @@ #include "MissionItemTest.h" #include "MissionItem.h" -UT_REGISTER_TEST(MissionItemTest) - const MissionItemTest::ItemInfo_t MissionItemTest::_rgItemInfo[] = { { 1, QGeoCoordinate(-10.0, -20.0, -30.0), MAV_CMD_NAV_WAYPOINT, 10.0, 20.0, 30.0, 1.0, true, false, MAV_FRAME_GLOBAL_RELATIVE_ALT }, { 1, QGeoCoordinate(-10.0, -20.0, -30.0), MAV_CMD_NAV_LOITER_UNLIM, 10.0, 20.0, 30.0, 1.0, true, false, MAV_FRAME_GLOBAL_RELATIVE_ALT }, diff --git a/src/MissionManager/MissionControllerTest.cc b/src/MissionManager/MissionControllerTest.cc index 3e8a43a77099205b260488eeee65e3322275e72e..ec1d9e1155441203edb63803618b72b4a106af78 100644 --- a/src/MissionManager/MissionControllerTest.cc +++ b/src/MissionManager/MissionControllerTest.cc @@ -25,8 +25,6 @@ #include "LinkManager.h" #include "MultiVehicleManager.h" -UT_REGISTER_TEST(MissionControllerTest) - MissionControllerTest::MissionControllerTest(void) : _multiSpyMissionController(NULL) , _multiSpyMissionItem(NULL) diff --git a/src/MissionManager/MissionManagerTest.cc b/src/MissionManager/MissionManagerTest.cc index d3ded1bf171c2a3a8718dd982e54d9d9ba2c0856..ec3bbd81228a18b8b3895273f41a4eff22dcd53e 100644 --- a/src/MissionManager/MissionManagerTest.cc +++ b/src/MissionManager/MissionManagerTest.cc @@ -25,9 +25,6 @@ #include "LinkManager.h" #include "MultiVehicleManager.h" -// FIXME: Temporarily disabled until this can be stabilized -//UT_REGISTER_TEST(MissionManagerTest) - const MissionManagerTest::TestCase_t MissionManagerTest::_rgTestCases[] = { { "0\t0\t3\t16\t10\t20\t30\t40\t-10\t-20\t-30\t1\r\n", { 0, QGeoCoordinate(-10.0, -20.0, -30.0), MAV_CMD_NAV_WAYPOINT, 10.0, 20.0, 30.0, 40.0, true, false, MAV_FRAME_GLOBAL_RELATIVE_ALT } }, { "1\t0\t3\t17\t10\t20\t30\t40\t-10\t-20\t-30\t1\r\n", { 1, QGeoCoordinate(-10.0, -20.0, -30.0), MAV_CMD_NAV_LOITER_UNLIM, 10.0, 20.0, 30.0, 40.0, true, false, MAV_FRAME_GLOBAL_RELATIVE_ALT } }, diff --git a/src/QmlControls/QGroundControlQmlGlobal.cc b/src/QmlControls/QGroundControlQmlGlobal.cc index 53dd03924c2d99b3e53424d94864a4f5b9ea2843..97fc9f598c889c5e074b5e5ca73921e2e7dd1acd 100644 --- a/src/QmlControls/QGroundControlQmlGlobal.cc +++ b/src/QmlControls/QGroundControlQmlGlobal.cc @@ -66,3 +66,91 @@ bool QGroundControlQmlGlobal::loadBoolGlobalSetting (const QString& key, bool de settings.beginGroup(kQmlGlobalKeyName); return settings.value(key, defaultValue).toBool(); } + +#ifdef QT_DEBUG +void QGroundControlQmlGlobal::_startMockLink(MockConfiguration* mockConfig) +{ + MockLink* mockLink = new MockLink(mockConfig); + + LinkManager* linkManager = qgcApp()->toolbox()->linkManager(); + + linkManager->_addLink(mockLink); + linkManager->connectLink(mockLink); +} +#endif + +void QGroundControlQmlGlobal::startPX4MockLink(bool sendStatusText) +{ +#ifdef QT_DEBUG + MockConfiguration mockConfig("PX4 MockLink"); + + mockConfig.setFirmwareType(MAV_AUTOPILOT_PX4); + mockConfig.setVehicleType(MAV_TYPE_QUADROTOR); + mockConfig.setSendStatusText(sendStatusText); + + _startMockLink(&mockConfig); +#else + Q_UNUSED(sendStatusText); +#endif +} + +void QGroundControlQmlGlobal::startGenericMockLink(bool sendStatusText) +{ +#ifdef QT_DEBUG + MockConfiguration mockConfig("Generic MockLink"); + + mockConfig.setFirmwareType(MAV_AUTOPILOT_GENERIC); + mockConfig.setVehicleType(MAV_TYPE_QUADROTOR); + mockConfig.setSendStatusText(sendStatusText); + + _startMockLink(&mockConfig); +#else + Q_UNUSED(sendStatusText); +#endif +} + +void QGroundControlQmlGlobal::startAPMArduCopterMockLink(bool sendStatusText) +{ +#ifdef QT_DEBUG + MockConfiguration mockConfig("APM ArduCopter MockLink"); + + mockConfig.setFirmwareType(MAV_AUTOPILOT_ARDUPILOTMEGA); + mockConfig.setVehicleType(MAV_TYPE_QUADROTOR); + mockConfig.setSendStatusText(sendStatusText); + + _startMockLink(&mockConfig); +#else + Q_UNUSED(sendStatusText); +#endif +} + +void QGroundControlQmlGlobal::startAPMArduPlaneMockLink(bool sendStatusText) +{ +#ifdef QT_DEBUG + MockConfiguration mockConfig("APM ArduPlane MockLink"); + + mockConfig.setFirmwareType(MAV_AUTOPILOT_ARDUPILOTMEGA); + mockConfig.setVehicleType(MAV_TYPE_FIXED_WING); + mockConfig.setSendStatusText(sendStatusText); + + _startMockLink(&mockConfig); +#else + Q_UNUSED(sendStatusText); +#endif +} + +void QGroundControlQmlGlobal::stopAllMockLinks(void) +{ +#ifdef QT_DEBUG + LinkManager* linkManager = qgcApp()->toolbox()->linkManager(); + + QList links = linkManager->getLinks(); + for (int i=0; i(link); + if (mockLink) { + linkManager->disconnectLink(mockLink); + } + } +#endif +} diff --git a/src/QmlControls/QGroundControlQmlGlobal.h b/src/QmlControls/QGroundControlQmlGlobal.h index 8f3ad3c0b1bf8b39aa7fd6a47d60445df331f560..302439196909c892313cc6f4b8b41228641b3591 100644 --- a/src/QmlControls/QGroundControlQmlGlobal.h +++ b/src/QmlControls/QGroundControlQmlGlobal.h @@ -34,6 +34,10 @@ #include "HomePositionManager.h" #include "FlightMapSettings.h" +#ifdef QT_DEBUG +#include "MockLink.h" +#endif + class QGCToolbox; class QGroundControlQmlGlobal : public QObject @@ -58,6 +62,12 @@ public: Q_INVOKABLE void saveBoolGlobalSetting (const QString& key, bool value); Q_INVOKABLE bool loadBoolGlobalSetting (const QString& key, bool defaultValue); + Q_INVOKABLE void startPX4MockLink (bool sendStatusText); + Q_INVOKABLE void startGenericMockLink (bool sendStatusText); + Q_INVOKABLE void startAPMArduCopterMockLink (bool sendStatusText); + Q_INVOKABLE void startAPMArduPlaneMockLink (bool sendStatusText); + Q_INVOKABLE void stopAllMockLinks (void); + // Property accesors HomePositionManager* homePositionManager () { return _homePositionManager; } @@ -123,6 +133,10 @@ signals: void isVersionCheckEnabledChanged (bool enabled); private: +#ifdef QT_DEBUG + void _startMockLink(MockConfiguration* mockConfig); +#endif + HomePositionManager* _homePositionManager; FlightMapSettings* _flightMapSettings; }; diff --git a/src/Vehicle/MultiVehicleManager.cc b/src/Vehicle/MultiVehicleManager.cc index 6e1630228e5f3ea079409f34bf9c201ba29bd7e2..0416ea6bafdd463e029f5955de969785cd606464 100644 --- a/src/Vehicle/MultiVehicleManager.cc +++ b/src/Vehicle/MultiVehicleManager.cc @@ -246,16 +246,3 @@ Vehicle* MultiVehicleManager::getVehicleById(int vehicleId) return NULL; } - -QList MultiVehicleManager::vehicles(void) -{ - QList list; - - for (int i=0; i< _vehicles.count(); i++) { - list += qobject_cast(_vehicles[i]); - } - - return list; -} - - diff --git a/src/Vehicle/MultiVehicleManager.h b/src/Vehicle/MultiVehicleManager.h index bc3a42acb609543160efa9b0c0faf6e0d31efa2d..0b85ee3a4bf88c2e1dab0df9985525177e6c9c8e 100644 --- a/src/Vehicle/MultiVehicleManager.h +++ b/src/Vehicle/MultiVehicleManager.h @@ -54,7 +54,7 @@ public: Q_PROPERTY(bool activeVehicleAvailable READ activeVehicleAvailable NOTIFY activeVehicleAvailableChanged) Q_PROPERTY(bool parameterReadyVehicleAvailable READ parameterReadyVehicleAvailable NOTIFY parameterReadyVehicleAvailableChanged) Q_PROPERTY(Vehicle* activeVehicle READ activeVehicle WRITE setActiveVehicle NOTIFY activeVehicleChanged) - Q_PROPERTY(QmlObjectListModel* vehicles READ vehiclesModel CONSTANT) + Q_PROPERTY(QmlObjectListModel* vehicles READ vehicles CONSTANT) // Methods @@ -70,8 +70,6 @@ public: UAS* activeUas(void) { return _activeVehicle ? _activeVehicle->uas() : NULL; } - QList vehicles(void); - // Property accessors bool activeVehicleAvailable(void) { return _activeVehicleAvailable; } @@ -81,7 +79,7 @@ public: Vehicle* activeVehicle(void) { return _activeVehicle; } void setActiveVehicle(Vehicle* vehicle); - QmlObjectListModel* vehiclesModel(void) { return &_vehicles; } + QmlObjectListModel* vehicles(void) { return &_vehicles; } // Override from QGCTool virtual void setToolbox(QGCToolbox *toolbox); diff --git a/src/VehicleSetup/SetupViewTest.cc b/src/VehicleSetup/SetupViewTest.cc index 3ab4c6f654ef9af6f89a0435a11cfa5736cb6a1b..d7fa322a8c3d36180bd96a206844b604360e1a8c 100644 --- a/src/VehicleSetup/SetupViewTest.cc +++ b/src/VehicleSetup/SetupViewTest.cc @@ -29,8 +29,6 @@ #include "QGCMessageBox.h" #include "MultiVehicleManager.h" -UT_REGISTER_TEST(SetupViewTest) - void SetupViewTest::_clickThrough_test(void) { _connectMockLink(); diff --git a/src/main.cc b/src/main.cc index a3a156750f65ae6eb196f5b44463a81642e62ca0..e104854cc30c49fdf945884845c055850eec5bd2 100644 --- a/src/main.cc +++ b/src/main.cc @@ -156,16 +156,21 @@ int main(int argc, char *argv[]) // We parse a small set of command line options here prior to QGCApplication in order to handle the ones // which need to be handled before a QApplication object is started. + bool stressUnitTests = false; // Stress test unit tests bool quietWindowsAsserts = false; // Don't let asserts pop dialog boxes QString unitTestOptions; CmdLineOpt_t rgCmdLineOptions[] = { { "--unittest", &runUnitTests, &unitTestOptions }, + { "--unittest-stress", &stressUnitTests, &unitTestOptions }, { "--no-windows-assert-ui", &quietWindowsAsserts, NULL }, // Add additional command line option flags here }; ParseCmdLineOptions(argc, argv, rgCmdLineOptions, sizeof(rgCmdLineOptions)/sizeof(rgCmdLineOptions[0]), false); + if (stressUnitTests) { + runUnitTests = true; + } if (quietWindowsAsserts) { #ifdef Q_OS_WIN @@ -195,23 +200,27 @@ int main(int argc, char *argv[]) app->_initCommon(); - int exitCode; + int exitCode = 0; #ifndef __mobile__ #ifdef QT_DEBUG if (runUnitTests) { - if (!app->_initForUnitTests()) { - return -1; - } - - // Run the test - int failures = UnitTest::run(unitTestOptions); - if (failures == 0) { - qDebug() << "ALL TESTS PASSED"; - } else { - qDebug() << failures << " TESTS FAILED!"; + for (int i=0; i < (stressUnitTests ? 20 : 1); i++) { + if (!app->_initForUnitTests()) { + return -1; + } + + // Run the test + int failures = UnitTest::run(unitTestOptions); + if (failures == 0) { + qDebug() << "ALL TESTS PASSED"; + exitCode = 0; + } else { + qDebug() << failures << " TESTS FAILED!"; + exitCode = -failures; + break; + } } - exitCode = -failures; } else #endif #endif diff --git a/src/qgcunittest/FileDialogTest.cc b/src/qgcunittest/FileDialogTest.cc index d98d0eabe1e2b4d1ebb629035fe3bc2cef762b63..d2a843da58bb23de4f77b46cb7af8fb6985f9985 100644 --- a/src/qgcunittest/FileDialogTest.cc +++ b/src/qgcunittest/FileDialogTest.cc @@ -29,8 +29,6 @@ #include "FileDialogTest.h" #include "QGCFileDialog.h" -UT_REGISTER_TEST(FileDialogTest) - FileDialogTest::FileDialogTest(void) { diff --git a/src/qgcunittest/FileManagerTest.cc b/src/qgcunittest/FileManagerTest.cc index 54eae9353cf674908453d3ec567b5096a0160ad2..d7a94d7b8c403bd18889e8c8fac376b064936d58 100644 --- a/src/qgcunittest/FileManagerTest.cc +++ b/src/qgcunittest/FileManagerTest.cc @@ -29,8 +29,6 @@ #include "UAS.h" #include "QGCApplication.h" -//UT_REGISTER_TEST(FileManagerTest) - FileManagerTest::FileManagerTest(void) : _fileServer(NULL) , _fileManager(NULL) diff --git a/src/qgcunittest/FlightGearTest.cc b/src/qgcunittest/FlightGearTest.cc index da6cdc3fa1eed41b0e09ae481674ead082081488..7fd12a13d7aa2c8945a168354f107250f3bd88e1 100644 --- a/src/qgcunittest/FlightGearTest.cc +++ b/src/qgcunittest/FlightGearTest.cc @@ -29,8 +29,6 @@ /// /// @author Don Gagne -UT_REGISTER_TEST(FlightGearUnitTest) - FlightGearUnitTest::FlightGearUnitTest(void) { diff --git a/src/qgcunittest/GeoTest.cc b/src/qgcunittest/GeoTest.cc index 4ae24b5162d7d883be94b10d056d9f2574c7d01a..c24dd69c93d0271b6309ba187bc6d8fd485f3def 100644 --- a/src/qgcunittest/GeoTest.cc +++ b/src/qgcunittest/GeoTest.cc @@ -29,8 +29,6 @@ #include "GeoTest.h" #include "QGCGeo.h" -UT_REGISTER_TEST(GeoTest) - /* GeoTest::GeoTest(void) { diff --git a/src/qgcunittest/LinkManagerTest.cc b/src/qgcunittest/LinkManagerTest.cc index 3c522c35a0c7e8b9b0c67324fe2b3163f17e320e..114dab7774f35475d545c73743ca561b2897236c 100644 --- a/src/qgcunittest/LinkManagerTest.cc +++ b/src/qgcunittest/LinkManagerTest.cc @@ -30,8 +30,6 @@ #include "MockLink.h" #include "QGCApplication.h" -UT_REGISTER_TEST(LinkManagerTest) - LinkManagerTest::LinkManagerTest(void) : _linkMgr(NULL), _multiSpy(NULL) diff --git a/src/qgcunittest/MainWindowTest.cc b/src/qgcunittest/MainWindowTest.cc index c360c84da8edf560cb5295f77414403f2a992c17..da6453872ceceaab365f5b0d38349c9e629320d4 100644 --- a/src/qgcunittest/MainWindowTest.cc +++ b/src/qgcunittest/MainWindowTest.cc @@ -31,9 +31,6 @@ #include "QGCMessageBox.h" #include "MultiVehicleManager.h" -// FIXME: Temporarily turned off -//UT_REGISTER_TEST(MainWindowTest) - void MainWindowTest::_connectWindowClose_test(MAV_AUTOPILOT autopilot) { _createMainWindow(); diff --git a/src/qgcunittest/MavlinkLogTest.cc b/src/qgcunittest/MavlinkLogTest.cc index 766cb9e1e852e9b8d7174e3544b255e9db257d6b..310a4adcfcfadea56160ef6ac3090568dce787ab 100644 --- a/src/qgcunittest/MavlinkLogTest.cc +++ b/src/qgcunittest/MavlinkLogTest.cc @@ -34,9 +34,6 @@ #include "UAS.h" #include "MultiVehicleManager.h" -// FIXME: Temporarily disabled until this can be stabilized -//UT_REGISTER_TEST(MavlinkLogTest) - const char* MavlinkLogTest::_tempLogFileTemplate = "FlightDataXXXXXX"; ///< Template for temporary log file const char* MavlinkLogTest::_logFileExtension = "mavlink"; ///< Extension for log files const char* MavlinkLogTest::_saveLogFilename = "qgroundcontrol.mavlink.ut"; ///< Filename to save log files to diff --git a/src/qgcunittest/MessageBoxTest.cc b/src/qgcunittest/MessageBoxTest.cc index 72cf44bfc58fc55d7ecea199bddd040b7591ca78..ff03bc1a55d4e50998fec45770eb3c34d5f44922 100644 --- a/src/qgcunittest/MessageBoxTest.cc +++ b/src/qgcunittest/MessageBoxTest.cc @@ -29,8 +29,6 @@ #include "MessageBoxTest.h" #include "QGCMessageBox.h" -UT_REGISTER_TEST(MessageBoxTest) - MessageBoxTest::MessageBoxTest(void) { diff --git a/src/qgcunittest/PX4RCCalibrationTest.cc b/src/qgcunittest/PX4RCCalibrationTest.cc index 3aec7f6227e4b70abbfdcf68d92be8780d93227f..04091421c257a16e4960a50b9500e92fd404167c 100644 --- a/src/qgcunittest/PX4RCCalibrationTest.cc +++ b/src/qgcunittest/PX4RCCalibrationTest.cc @@ -31,7 +31,6 @@ /// /// @author Don Gagne -UT_REGISTER_TEST(RadioConfigTest) QGC_LOGGING_CATEGORY(RadioConfigTestLog, "RadioConfigTestLog") // This will check for the wizard buttons being enabled of disabled according to the mask you pass in. diff --git a/src/qgcunittest/TCPLinkTest.cc b/src/qgcunittest/TCPLinkTest.cc index 2ebd3b8bb5dc4c8157da4301a212ef891077b6d6..7d2c99f68d5ff277bc14790714db3054055c2a99 100644 --- a/src/qgcunittest/TCPLinkTest.cc +++ b/src/qgcunittest/TCPLinkTest.cc @@ -29,10 +29,6 @@ /// /// @author Don Gagne -// This unit test has gotten too flaky to run reliably under TeamCity. Removing for now till there is -// time to debug. -//UT_REGISTER_TEST(TCPLinkUnitTest) - TCPLinkUnitTest::TCPLinkUnitTest(void) : _config(NULL) , _link(NULL) diff --git a/src/qgcunittest/UnitTest.h b/src/qgcunittest/UnitTest.h index a05855b179fb4bc168d0492cdccaf87938d3845e..5326872e41d2e73900e00ef254e99e40d1bcd3cd 100644 --- a/src/qgcunittest/UnitTest.h +++ b/src/qgcunittest/UnitTest.h @@ -38,7 +38,7 @@ #include "QGCMAVLink.h" #include "LinkInterface.h" -#define UT_REGISTER_TEST(className) static UnitTestWrapper t(#className); +#define UT_REGISTER_TEST(className) static UnitTestWrapper className(#className); class QGCMessageBox; class QGCFileDialog; diff --git a/src/qgcunittest/UnitTestList.cc b/src/qgcunittest/UnitTestList.cc new file mode 100644 index 0000000000000000000000000000000000000000..6a71c97e7da5cda67ac8d50278cccf8a2592e76e --- /dev/null +++ b/src/qgcunittest/UnitTestList.cc @@ -0,0 +1,70 @@ +/*===================================================================== + + QGroundControl Open Source Ground Control Station + + (c) 2009 - 2014 QGROUNDCONTROL PROJECT + + This file is part of the QGROUNDCONTROL project + + QGROUNDCONTROL is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + QGROUNDCONTROL is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with QGROUNDCONTROL. If not, see . + + ======================================================================*/ + +// We keep the list of all unit tests in a global location so it's easier to see which +// ones are enabled/disabled + +#include "FactSystemTestGeneric.h" +#include "FactSystemTestPX4.h" +#include "FileDialogTest.h" +#include "FlightGearTest.h" +#include "GeoTest.h" +#include "LinkManagerTest.h" +#include "MessageBoxTest.h" +#include "MissionItemTest.h" +#include "MissionControllerTest.h" +#include "PX4RCCalibrationTest.h" +#include "SetupViewTest.h" +#include "MavlinkLogTest.h" + +UT_REGISTER_TEST(FactSystemTestGeneric) +UT_REGISTER_TEST(FactSystemTestPX4) +UT_REGISTER_TEST(FileDialogTest) +UT_REGISTER_TEST(FlightGearUnitTest) +UT_REGISTER_TEST(GeoTest) +UT_REGISTER_TEST(LinkManagerTest) +UT_REGISTER_TEST(MavlinkLogTest) +UT_REGISTER_TEST(MessageBoxTest) +UT_REGISTER_TEST(MissionItemTest) +UT_REGISTER_TEST(MissionControllerTest) +UT_REGISTER_TEST(RadioConfigTest) +UT_REGISTER_TEST(SetupViewTest) + +// List of unit test which are currently disabled. +// If disabling a new test, include reason in comment. + +// Why is this one off? +//UT_REGISTER_TEST(FileManagerTest) + +// FIXME: Temporarily disabled until this can be stabilized +//UT_REGISTER_TEST(MainWindowTest) + +// FIXME: Temporarily disabled until this can be stabilized + +// FIXME: Temporarily disabled until this can be stabilized +//UT_REGISTER_TEST(MissionManagerTest) + +// This unit test has gotten too flaky to run reliably under TeamCity. Removing for now till there is +// time to debug. +//UT_REGISTER_TEST(TCPLinkUnitTest) + diff --git a/src/ui/MainWindow.cc b/src/ui/MainWindow.cc index ad2b4cc492bb0392ab78fb69e4c54d7a0c282ff7..db4a8509cfbd61e18c6522c9c9626cf04d0de8df 100644 --- a/src/ui/MainWindow.cc +++ b/src/ui/MainWindow.cc @@ -437,7 +437,7 @@ void MainWindow::showStatusBarCallback(bool checked) void MainWindow::closeEvent(QCloseEvent *event) { // Disallow window close if there are active connections - if (qgcApp()->toolbox()->linkManager()->anyConnectedLinks()) { + if (qgcApp()->toolbox()->multiVehicleManager()->vehicles()->count()) { QGCMessageBox::StandardButton button = QGCMessageBox::warning( tr("QGroundControl close"), diff --git a/src/ui/MainWindowLeftPanel.qml b/src/ui/MainWindowLeftPanel.qml index b831c8f025c25760eda1c6f296fde513d8fcacd7..668c236d848c8a6f7c0c291abd0e1508a3c22bf3 100644 --- a/src/ui/MainWindowLeftPanel.qml +++ b/src/ui/MainWindowLeftPanel.qml @@ -169,6 +169,20 @@ Item { checked = true } } + QGCButton { + width: parent.width * 0.8 + height: ScreenTools.defaultFontPixelHeight * 2.5 + text: "Mock Link" + visible: ScreenTools.isDebug + exclusiveGroup: panelActionGroup + anchors.horizontalCenter: parent.horizontalCenter + onClicked: { + if(__rightPanel.source != "MockLink.qml") { + __rightPanel.source = "MockLink.qml" + } + checked = true + } + } QGCButton { width: parent.width * 0.8 height: ScreenTools.defaultFontPixelHeight * 2.5 diff --git a/src/ui/MultiVehicleDockWidget.cc b/src/ui/MultiVehicleDockWidget.cc index e0a7e9be1c329007000bdc40e321c1ffce9bb084..1ff1da63ff9a22ec336f02d2bc0e120ba959ab71 100644 --- a/src/ui/MultiVehicleDockWidget.cc +++ b/src/ui/MultiVehicleDockWidget.cc @@ -41,8 +41,10 @@ MultiVehicleDockWidget::MultiVehicleDockWidget(const QString& title, QAction* ac void MultiVehicleDockWidget::init(void) { - foreach (Vehicle* vehicle, qgcApp()->toolbox()->multiVehicleManager()->vehicles()) { - _vehicleAdded(vehicle); + QmlObjectListModel* vehicles = qgcApp()->toolbox()->multiVehicleManager()->vehicles(); + + for (int i=0; icount(); i++) { + _vehicleAdded(qobject_cast(vehicles->get(i))); } if (qgcApp()->toolbox()->multiVehicleManager()->activeVehicle()) { diff --git a/src/ui/preferences/MockLink.qml b/src/ui/preferences/MockLink.qml new file mode 100644 index 0000000000000000000000000000000000000000..7398aa59db6465289d848e97ec81b02952e3f71f --- /dev/null +++ b/src/ui/preferences/MockLink.qml @@ -0,0 +1,67 @@ +/*===================================================================== + + QGroundControl Open Source Ground Control Station + + (c) 2009 - 2015 QGROUNDCONTROL PROJECT + + This file is part of the QGROUNDCONTROL project + + QGROUNDCONTROL is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + QGROUNDCONTROL is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with QGROUNDCONTROL. If not, see . + + ======================================================================*/ + +import QtQuick 2.3 + +import QGroundControl 1.0 +import QGroundControl.Controls 1.0 +import QGroundControl.Palette 1.0 +import QGroundControl.ScreenTools 1.0 + +Rectangle { + color: qgcPal.window + + QGCPalette { id: qgcPal; colorGroupEnabled: true } + + Column { + anchors.margins: ScreenTools.defaultFontPixelHeight + anchors.left: parent.left + anchors.top: parent.top + spacing: ScreenTools.defaultFontPixelHeight + + QGCButton { + text: "PX4 Vehicle" + onClicked: QGroundControl.startPX4MockLink(sendStatusText.checked) + } + QGCButton { + text: "APM ArduCopter Vehicle" + onClicked: QGroundControl.startAPMArduCopterMockLink(sendStatusText.checked) + } + QGCButton { + text: "APM ArduPlane Vehicle" + onClicked: QGroundControl.startAPMArduPlaneMockLink(sendStatusText.checked) + } + QGCButton { + text: "Generic Vehicle" + onClicked: QGroundControl.startGenericMockLink(sendStatusText.checked) + } + QGCCheckBox { + id: sendStatusText + text: "Send status text + voice" + } + QGCButton { + text: "Stop All MockLinks" + onClicked: QGroundControl.stopAllMockLinks() + } + } +}