diff --git a/src/qgcunittest/FileDialogTest.h b/src/qgcunittest/FileDialogTest.h index 673ef04a8eff0eabdabfa8535aaa8eb9dcafd1d0..e9f3a3eaf14f211291c14db79cb2ea0a7a84c2e7 100644 --- a/src/qgcunittest/FileDialogTest.h +++ b/src/qgcunittest/FileDialogTest.h @@ -1,6 +1,6 @@ /**************************************************************************** * - * (c) 2009-2016 QGROUNDCONTROL PROJECT + * (c) 2009-2018 QGROUNDCONTROL PROJECT * * QGroundControl is licensed according to the terms in the file * COPYING.md in the root of the source code directory. @@ -13,8 +13,7 @@ /// /// @author Don Gagne -#ifndef FILEDIALOGTEST_H -#define FILEDIALOGTEST_H +#pragma once #include "UnitTest.h" @@ -33,4 +32,3 @@ private slots: void _fileDialogExpectedIncorrect_test(void); }; -#endif diff --git a/src/qgcunittest/FileManagerTest.h b/src/qgcunittest/FileManagerTest.h index 50ab8af903f90c9da4d3bcb3ab8b4926604d754b..d27700cfea20d2c773993cfd175d018f5a0c1765 100644 --- a/src/qgcunittest/FileManagerTest.h +++ b/src/qgcunittest/FileManagerTest.h @@ -1,6 +1,6 @@ /**************************************************************************** * - * (c) 2009-2016 QGROUNDCONTROL PROJECT + * (c) 2009-2018 QGROUNDCONTROL PROJECT * * QGroundControl is licensed according to the terms in the file * COPYING.md in the root of the source code directory. @@ -8,8 +8,7 @@ ****************************************************************************/ -#ifndef FileManagerTEST_H -#define FileManagerTEST_H +#pragma once #include #include @@ -77,4 +76,3 @@ private: QStringList _fileListReceived; }; -#endif diff --git a/src/qgcunittest/FlightGearTest.h b/src/qgcunittest/FlightGearTest.h index 814dd37b586111580cd8fbc0374208e923e17668..8ad9aa5004cc124d8412c416dbf81bbe4a34f39b 100644 --- a/src/qgcunittest/FlightGearTest.h +++ b/src/qgcunittest/FlightGearTest.h @@ -1,6 +1,6 @@ /**************************************************************************** * - * (c) 2009-2016 QGROUNDCONTROL PROJECT + * (c) 2009-2018 QGROUNDCONTROL PROJECT * * QGroundControl is licensed according to the terms in the file * COPYING.md in the root of the source code directory. @@ -8,8 +8,7 @@ ****************************************************************************/ -#ifndef FLIGHTGEARTEST_H -#define FLIGHTGEARTEST_H +#pragma once #include "UnitTest.h" #include "TCPLink.h" @@ -31,4 +30,3 @@ private slots: void _parseUIArguments_test(void); }; -#endif diff --git a/src/qgcunittest/GeoTest.h b/src/qgcunittest/GeoTest.h index 7e57c3c58a58993f4ca725d087348be1ea4126bf..0ddcf6020fb6d1bec54d4daefdda2e1f8cdcbd65 100644 --- a/src/qgcunittest/GeoTest.h +++ b/src/qgcunittest/GeoTest.h @@ -1,6 +1,6 @@ /**************************************************************************** * - * (c) 2009-2016 QGROUNDCONTROL PROJECT + * (c) 2009-2018 QGROUNDCONTROL PROJECT * * QGroundControl is licensed according to the terms in the file * COPYING.md in the root of the source code directory. @@ -13,8 +13,7 @@ /// /// @author David Goodman -#ifndef GEOTEST_H -#define GEOTEST_H +#pragma once #include @@ -38,4 +37,3 @@ private: QGeoCoordinate _origin; }; -#endif // GEOTEST_H diff --git a/src/qgcunittest/LinkManagerTest.h b/src/qgcunittest/LinkManagerTest.h index 274c5506fd07c8c1f5341ddad19ed000736cf83d..9dba48bfe2a053a02f2c24f72c039c4bed7c9e22 100644 --- a/src/qgcunittest/LinkManagerTest.h +++ b/src/qgcunittest/LinkManagerTest.h @@ -1,6 +1,6 @@ /**************************************************************************** * - * (c) 2009-2016 QGROUNDCONTROL PROJECT + * (c) 2009-2018 QGROUNDCONTROL PROJECT * * QGroundControl is licensed according to the terms in the file * COPYING.md in the root of the source code directory. @@ -8,8 +8,7 @@ ****************************************************************************/ -#ifndef LINKMANAGERTEST_H -#define LINKMANAGERTEST_H +#pragma once #include "UnitTest.h" #include "LinkManager.h" @@ -54,4 +53,3 @@ private: const char* _rgSignals[_cSignals]; }; -#endif diff --git a/src/qgcunittest/MainWindowTest.h b/src/qgcunittest/MainWindowTest.h index 3f91c544158742832008d0966355ac176f71b356..cbfba663cebb631c5a8df4602b0f8fc068043a54 100644 --- a/src/qgcunittest/MainWindowTest.h +++ b/src/qgcunittest/MainWindowTest.h @@ -1,6 +1,6 @@ /**************************************************************************** * - * (c) 2009-2016 QGROUNDCONTROL PROJECT + * (c) 2009-2018 QGROUNDCONTROL PROJECT * * QGroundControl is licensed according to the terms in the file * COPYING.md in the root of the source code directory. @@ -13,8 +13,7 @@ /// /// @author Don Gagne -#ifndef MAINWINDOWTEST_H -#define MAINWINDOWTEST_H +#pragma once #include "UnitTest.h" #include "MainWindow.h" @@ -31,4 +30,3 @@ private: void _connectWindowClose_test(MAV_AUTOPILOT autopilot); }; -#endif diff --git a/src/qgcunittest/MavlinkLogTest.h b/src/qgcunittest/MavlinkLogTest.h index e10c94ef58259725dcef7a9cdff970ed4d51f863..e32dca36d3742b35b85db054b092b5550bfa1f3d 100644 --- a/src/qgcunittest/MavlinkLogTest.h +++ b/src/qgcunittest/MavlinkLogTest.h @@ -1,6 +1,6 @@ /**************************************************************************** * - * (c) 2009-2016 QGROUNDCONTROL PROJECT + * (c) 2009-2018 QGROUNDCONTROL PROJECT * * QGroundControl is licensed according to the terms in the file * COPYING.md in the root of the source code directory. @@ -13,8 +13,7 @@ /// /// @author Don Gagne -#ifndef MAVLINKLOGTEST_H -#define MAVLINKLOGTEST_H +#pragma once #include "UnitTest.h" @@ -48,4 +47,3 @@ private: static const char* _saveLogFilename; ///< Filename to save log files to }; -#endif diff --git a/src/qgcunittest/MessageBoxTest.h b/src/qgcunittest/MessageBoxTest.h index f9e4642f7514bdab0d2bfb198a82aeba458c1177..5567fb8f9b68caa006230de0a55bdad7c9a8a3a8 100644 --- a/src/qgcunittest/MessageBoxTest.h +++ b/src/qgcunittest/MessageBoxTest.h @@ -1,6 +1,6 @@ /**************************************************************************** * - * (c) 2009-2016 QGROUNDCONTROL PROJECT + * (c) 2009-2018 QGROUNDCONTROL PROJECT * * QGroundControl is licensed according to the terms in the file * COPYING.md in the root of the source code directory. @@ -13,8 +13,7 @@ /// /// @author Don Gagne -#ifndef MESSAGEBOXTEST_H -#define MESSAGEBOXTEST_H +#pragma once #include "UnitTest.h" @@ -33,4 +32,3 @@ private slots: void _badResponseButton_test(void); }; -#endif diff --git a/src/qgcunittest/MultiSignalSpy.h b/src/qgcunittest/MultiSignalSpy.h index 151c5ed0a134ed4db66e6fe9e83d3dea4fef9d76..c077c5c77aed035d3b8e64726432077359e1536d 100644 --- a/src/qgcunittest/MultiSignalSpy.h +++ b/src/qgcunittest/MultiSignalSpy.h @@ -1,6 +1,6 @@ /**************************************************************************** * - * (c) 2009-2016 QGROUNDCONTROL PROJECT + * (c) 2009-2018 QGROUNDCONTROL PROJECT * * QGroundControl is licensed according to the terms in the file * COPYING.md in the root of the source code directory. @@ -8,8 +8,7 @@ ****************************************************************************/ -#ifndef MULTISIGNALSPY_H -#define MULTISIGNALSPY_H +#pragma once #include #include @@ -80,4 +79,3 @@ private: bool _timeout; }; -#endif diff --git a/src/qgcunittest/RadioConfigTest.h b/src/qgcunittest/RadioConfigTest.h index 7791d097cfaf864a518a94101a9698e9efb97b69..d5f24296b547f9b207768fbb5b94a8e9cd122ada 100644 --- a/src/qgcunittest/RadioConfigTest.h +++ b/src/qgcunittest/RadioConfigTest.h @@ -1,6 +1,6 @@ /**************************************************************************** * - * (c) 2009-2016 QGROUNDCONTROL PROJECT + * (c) 2009-2018 QGROUNDCONTROL PROJECT * * QGroundControl is licensed according to the terms in the file * COPYING.md in the root of the source code directory. @@ -8,8 +8,7 @@ ****************************************************************************/ -#ifndef RadioConfigTest_H -#define RadioConfigTest_H +#pragma once #include "UnitTest.h" #include "MockLink.h" @@ -116,4 +115,3 @@ private: RadioComponentController* _controller; }; -#endif diff --git a/src/qgcunittest/TCPLinkTest.h b/src/qgcunittest/TCPLinkTest.h index e34d993da7fe78ff4de0b361eeb02233d4938e8d..f1788ce5c2b307f3bed9c4442d7c89b0f24a5378 100644 --- a/src/qgcunittest/TCPLinkTest.h +++ b/src/qgcunittest/TCPLinkTest.h @@ -1,6 +1,6 @@ /**************************************************************************** * - * (c) 2009-2016 QGROUNDCONTROL PROJECT + * (c) 2009-2018 QGROUNDCONTROL PROJECT * * QGroundControl is licensed according to the terms in the file * COPYING.md in the root of the source code directory. @@ -8,8 +8,7 @@ ****************************************************************************/ -#ifndef TCPLINKTEST_H -#define TCPLINKTEST_H +#pragma once #include "UnitTest.h" #include "TCPLink.h" @@ -67,4 +66,3 @@ private: const char* _rgSignals[_cSignals]; }; -#endif diff --git a/src/qgcunittest/TCPLoopBackServer.h b/src/qgcunittest/TCPLoopBackServer.h index e171f15114bedb307d18a3d58278ffbb3b04fafd..a224d078e2a5e8851b0d6f3b42e16ec52e571941 100644 --- a/src/qgcunittest/TCPLoopBackServer.h +++ b/src/qgcunittest/TCPLoopBackServer.h @@ -1,6 +1,6 @@ /**************************************************************************** * - * (c) 2009-2016 QGROUNDCONTROL PROJECT + * (c) 2009-2018 QGROUNDCONTROL PROJECT * * QGroundControl is licensed according to the terms in the file * COPYING.md in the root of the source code directory. @@ -8,8 +8,7 @@ ****************************************************************************/ -#ifndef TCPLOOPBACKSERVER_H -#define TCPLOOPBACKSERVER_H +#pragma once #include #include @@ -44,4 +43,3 @@ private: QTcpSocket* _tcpSocket; }; -#endif \ No newline at end of file diff --git a/src/qgcunittest/UnitTest.h b/src/qgcunittest/UnitTest.h index 34b18484e2e96ffb9817a0235ab34f187d8b3185..f203d33f67085d5f897b24e66a41f7e5ae5c57bb 100644 --- a/src/qgcunittest/UnitTest.h +++ b/src/qgcunittest/UnitTest.h @@ -1,6 +1,6 @@ /**************************************************************************** * - * (c) 2009-2016 QGROUNDCONTROL PROJECT + * (c) 2009-2018 QGROUNDCONTROL PROJECT * * QGroundControl is licensed according to the terms in the file * COPYING.md in the root of the source code directory. @@ -13,9 +13,8 @@ /// /// @author Don Gagne -#ifndef UNITTEST_H -#define UNITTEST_H #ifndef __mobile__ +#pragma once #include #include @@ -42,15 +41,15 @@ class UnitTest : public QObject public: UnitTest(void); virtual ~UnitTest(void); - + /// @brief Called to run all the registered unit tests /// @param singleTest Name of test to just run a single test static int run(QString& singleTest); - + /// @brief Sets up for an expected QGCMessageBox /// @param response Response to take on message box void setExpectedMessageBox(QMessageBox::StandardButton response); - + /// @brief Types for UnitTest::setExpectedFileDialog enum FileDialogType { getExistingDirectory, @@ -58,30 +57,30 @@ public: getOpenFileNames, getSaveFileName }; - + /// @brief Sets up for an expected QGCQFileDialog /// @param type Type of expected file dialog /// @param response Files to return from call. Multiple files only supported by getOpenFileNames void setExpectedFileDialog(enum FileDialogType type, QStringList response); - + enum { expectFailNoFailure = 1 << 0, ///< not expecting any failures expectFailNoDialog = 1 << 1, ///< expecting a failure due to no dialog displayed expectFailBadResponseButton = 1 << 2, ///< expecting a failure due to bad button response (QGCMessageBox only) expectFailWrongFileDialog = 1 << 3 ///< expecting one dialog type, got the wrong type (QGCQFileDialog ony) }; - + /// @brief Check whether a message box was displayed and correctly responded to // @param Expected failure response flags void checkExpectedMessageBox(int expectFailFlags = expectFailNoFailure); - + /// Checks that the specified number of message boxes where shown. Do not call setExpectedMessageBox when using this method. void checkMultipleExpectedMessageBox(int messageCount); /// @brief Check whether a message box was displayed and correctly responded to // @param Expected failure response flags void checkExpectedFileDialog(int expectFailFlags = expectFailNoFailure); - + /// @brief Adds a unit test to the list. Should only be called by UnitTestWrapper. static void _addTest(QObject* test); @@ -102,18 +101,18 @@ public: void changeFactValue(Fact* fact, double increment = 0); protected slots: - + // These are all pure virtuals to force the derived class to implement each one and in turn // call the UnitTest private implementation. - + /// @brief Called before each test. /// Make sure to call UnitTest::init first in your derived class. virtual void init(void); - + /// @brief Called after each test. /// Make sure to call UnitTest::cleanup last in your derived class. virtual void cleanup(void); - + protected: void _connectMockLink(MAV_AUTOPILOT autopilot = MAV_AUTOPILOT_PX4); void _disconnectMockLink(void); @@ -133,38 +132,38 @@ private slots: private: // When the app is running in unit test mode the QGCMessageBox methods are re-routed here. - + static QMessageBox::StandardButton _messageBox(QMessageBox::Icon icon, const QString& title, const QString& text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton); - + // This allows the private call to _messageBox friend class QGCMessageBox; - + // When the app is running in unit test mode the QGCQFileDialog methods are re-routed here. - + static QString _getExistingDirectory( QWidget* parent, const QString& caption, const QString& dir, QFileDialog::Options options); - + static QString _getOpenFileName( QWidget* parent, const QString& caption, const QString& dir, const QString& filter, QFileDialog::Options options); - + static QStringList _getOpenFileNames( QWidget* parent, const QString& caption, const QString& dir, const QString& filter, QFileDialog::Options options); - + static QString _getSaveFileName( QWidget* parent, const QString& caption, @@ -186,14 +185,14 @@ private: static bool _badResponseButton; ///< Attempt to repond to expected message box with button not being displayed static QMessageBox::StandardButton _messageBoxResponseButton; ///< Response to next message box static int _missedMessageBoxCount; ///< Count of message box not checked with call to messageBoxWasDisplayed - + // Catch QGCQFileDialog calls static bool _fileDialogRespondedTo; ///< File dialog was responded to static bool _fileDialogResponseSet; ///< true: _fileDialogResponse was set by a call to UnitTest::setExpectedFileDialog static QStringList _fileDialogResponse; ///< Response to next file dialog static enum FileDialogType _fileDialogExpectedType; ///< type of file dialog expected to show static int _missedFileDialogCount; ///< Count of file dialogs not checked with call to UnitTest::fileDialogWasDisplayed - + bool _unitTestRun; ///< true: Unit Test was run bool _initCalled; ///< true: UnitTest::_init was called bool _cleanupCalled; ///< true: UnitTest::_cleanup was called @@ -213,5 +212,4 @@ private: QSharedPointer _unitTest; }; -#endif // Android #endif