Commit 97039eb6 authored by Don Gagne's avatar Don Gagne

Rework RadioCal unit test to Qml RadioCal

parent 20df7ebf
......@@ -515,8 +515,7 @@ HEADERS += \
src/qgcunittest/UnitTest.h \
src/VehicleSetup/SetupViewTest.h \
src/qgcunittest/FileManagerTest.h \
#src/qgcunittest/PX4RCCalibrationTest.h \
src/qgcunittest/PX4RCCalibrationTest.h \
SOURCES += \
src/qgcunittest/FlightGearTest.cc \
......@@ -534,8 +533,7 @@ SOURCES += \
src/qgcunittest/UnitTest.cc \
src/VehicleSetup/SetupViewTest.cc \
src/qgcunittest/FileManagerTest.cc \
#src/qgcunittest/PX4RCCalibrationTest.cc \
src/qgcunittest/PX4RCCalibrationTest.cc \
} # DebugBuild|WindowsDebugAndRelease
} # AndroidBuild
......
......@@ -34,6 +34,11 @@
QGC_LOGGING_CATEGORY(RadioComponentControllerLog, "RadioComponentControllerLog")
#ifdef UNITTEST_BUILD
// Nasty hack to expose controller to unit test code
RadioComponentController* RadioComponentController::_unitTestController = NULL;
#endif
const int RadioComponentController::_updateInterval = 150; ///< Interval for timer which updates radio channel widgets
const int RadioComponentController::_rcCalPWMCenterPoint = ((RadioComponentController::_rcCalPWMValidMaxValue - RadioComponentController::_rcCalPWMValidMinValue) / 2.0f) + RadioComponentController::_rcCalPWMValidMinValue;
// FIXME: Double check these mins againt 150% throws
......@@ -93,6 +98,11 @@ RadioComponentController::RadioComponentController(void) :
_nextButton(NULL),
_skipButton(NULL)
{
#ifdef UNITTEST_BUILD
// Nasty hack to expose controller to unit test code
_unitTestController = this;
#endif
connect(_uas, &UASInterface::remoteControlChannelRawChanged, this, &RadioComponentController::_remoteControlChannelRawChanged);
_loadSettings();
......
......@@ -38,7 +38,7 @@
Q_DECLARE_LOGGING_CATEGORY(RadioComponentControllerLog)
//class RadioComponentControllerTest;
class RadioConfigest;
namespace Ui {
class RadioComponentController;
......@@ -49,7 +49,7 @@ class RadioComponentController : public FactPanelController
{
Q_OBJECT
//friend class RadioComponentControllerTest; ///< 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);
......@@ -324,6 +324,11 @@ private:
QQuickItem* _skipButton;
QString _imageHelp;
#ifdef UNITTEST_BUILD
// Nasty hack to expose controller to unit test code
static RadioComponentController* _unitTestController;
#endif
};
#endif // RadioComponentController_H
This diff is collapsed.
......@@ -21,30 +21,30 @@
======================================================================*/
#ifndef PX4RCCALIBRATIONTEST_H
#define PX4RCCALIBRATIONTEST_H
#ifndef RadioConfigTest_H
#define RadioConfigTest_H
#include "UnitTest.h"
#include "MockLink.h"
#include "MultiSignalSpy.h"
#include "px4_configuration/PX4RCCalibration.h"
#include "RadioComponentController.h"
#include "QGCLoggingCategory.h"
#include "AutoPilotPlugin.h"
#include "QGCQmlWidgetHolder.h"
/// @file
/// @brief PX4RCCalibration Widget unit test
/// @brief Radio Config unit test
///
/// @author Don Gagne <don@thegagnes.com>
Q_DECLARE_LOGGING_CATEGORY(PX4RCCalibrationTestLog)
Q_DECLARE_LOGGING_CATEGORY(RadioConfigTestLog)
/// @brief PX4RCCalibration Widget unit test
class PX4RCCalibrationTest : public UnitTest
class RadioConfigTest : public UnitTest
{
Q_OBJECT
public:
PX4RCCalibrationTest(void);
RadioConfigTest(void);
private slots:
void init(void);
......@@ -71,10 +71,10 @@ private:
void _minRCChannels(void);
void _beginCalibration(void);
void _stickMoveWaitForSettle(int channel, int value);
void _stickMoveAutoStep(const char* functionStr, enum PX4RCCalibration::rcCalFunctions function, enum MoveToDirection direction, bool identifyStep);
void _stickMoveAutoStep(const char* functionStr, enum RadioComponentController::rcCalFunctions function, enum MoveToDirection direction, bool identifyStep);
void _switchMinMaxStep(void);
void _flapsDetectStep(void);
void _switchSelectAutoStep(const char* functionStr, PX4RCCalibration::rcCalFunctions function);
void _switchSelectAutoStep(const char* functionStr, RadioComponentController::rcCalFunctions function);
enum {
validateMinMaxMask = 1 << 0,
......@@ -97,7 +97,7 @@ private:
MockLink* _mockLink;
AutoPilotPlugin* _autopilot;
PX4RCCalibration* _calWidget;
QGCQmlWidgetHolder* _calWidget;
enum {
nextButtonMask = 1 << 0,
......@@ -105,13 +105,6 @@ private:
skipButtonMask = 1 << 2
};
QPushButton* _nextButton;
QPushButton* _cancelButton;
QPushButton* _skipButton;
QLabel* _statusLabel;
RCValueWidget* _rgValueWidget[PX4RCCalibration::_chanMax];
const char* _rgSignals[1];
MultiSignalSpy* _multiSpyNextButtonMessageBox;
......@@ -125,9 +118,11 @@ private:
static const int _stickSettleWait;
static const struct ChannelSettings _rgChannelSettings[_availableChannels];
static const struct ChannelSettings _rgChannelSettingsValidate[PX4RCCalibration::_chanMax];
static const struct ChannelSettings _rgChannelSettingsValidate[RadioComponentController::_chanMax];
int _rgFunctionChannelMap[PX4RCCalibration::rcCalFunctionMax];
int _rgFunctionChannelMap[RadioComponentController::rcCalFunctionMax];
RadioComponentController* _controller;
};
#endif
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