Commit e4c1f3ad authored by Lorenz Meier's avatar Lorenz Meier

Merge pull request #131 from jjhall89/airframe_unittest_fix

Airframe unit test fix
parents dcdf3701 70c7c99e
......@@ -163,10 +163,7 @@ void UASUnitTest::getYaw_test()
void UASUnitTest::getSelected_test()
{
bool test = uas->getSelected();
if(test != NULL){
QCOMPARE(test, false);
}
QCOMPARE(uas->getSelected(), false);
}
void UASUnitTest::getSystemType_test()
......@@ -176,12 +173,24 @@ void UASUnitTest::getSystemType_test()
void UASUnitTest::getAirframe_test()
{
//when uas is constructed, airframe is set to QGC_AIRFRAME_GENERIC which is 0
QCOMPARE(uas->getAirframe(), 0);
uas->setAirframe(25);
QVERIFY(uas->getAirframe() == 25);
}
void UASUnitTest::setAirframe_test()
{
//check at construction, that airframe=0 (GENERIC)
QVERIFY(uas->getAirframe() == 0);
//check that set airframe works
uas->setAirframe(11);
QVERIFY(uas->getAirframe() == 11);
//check that setAirframe will not assign a number to airframe, that is
//not defined in the enum
uas->setAirframe(12);
QVERIFY(uas->getAirframe() == 11);
}
void UASUnitTest::getWaypointList_test()
{
QVector<Waypoint*> kk = uas->getWaypointManager()->getWaypointEditableList();
......
......@@ -49,6 +49,7 @@ private slots:
void getSelected_test();
void getSystemType_test();
void getAirframe_test();
void setAirframe_test();
void getWaypointList_test();
void signalWayPoint_test();
void getWaypoint_test();
......
......@@ -86,7 +86,7 @@ UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(),
receivedRGBDImageTimestamp(0.0),
#endif
paramsOnceRequested(false),
airframe(QGC_AIRFRAME_EASYSTAR),
airframe(QGC_AIRFRAME_GENERIC),
attitudeKnown(false),
paramManager(NULL),
attitudeStamped(false),
......@@ -104,7 +104,7 @@ UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(),
componentID[i] = -1;
componentMulti[i] = false;
}
color = UASInterface::getNextColor();
setBatterySpecs(QString("9V,9.5V,12.6V"));
......@@ -152,9 +152,9 @@ void UAS::readSettings()
void UAS::deleteSettings()
{
this->name = "";
this->airframe = QGC_AIRFRAME_EASYSTAR;
this->airframe = QGC_AIRFRAME_GENERIC;
this->autopilot = -1;
setBatterySpecs(QString("9V,9.5V,12.6V"));
setBatterySpecs(QString("9V,9.5V,12.6V"));
}
int UAS::getUASID() const
......
......@@ -483,15 +483,19 @@ public slots:
void setAutopilotType(int apType)
{
autopilot = apType;
//emit systemSpecsChanged(uasId);
emit systemSpecsChanged(uasId);
}
/** @brief Set the type of airframe */
void setSystemType(int systemType);
/** @brief Set the specific airframe type */
void setAirframe(int airframe)
{
this->airframe = airframe;
emit systemSpecsChanged(uasId);
if((airframe >= 0) && (airframe < 12))
{
this->airframe = airframe;
emit systemSpecsChanged(uasId);
}
}
/** @brief Set a new name **/
void setUASName(const QString& name);
......
......@@ -149,7 +149,8 @@ public:
QGC_AIRFRAME_COAXIAL,
QGC_AIRFRAME_PTERYX,
QGC_AIRFRAME_TRICOPTER,
QGC_AIRFRAME_HEXCOPTER
QGC_AIRFRAME_HEXCOPTER,
QGC_AIRFRAME_END_OF_ENUM
};
/**
......
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