Commit 70c7c99e authored by Jessica's avatar Jessica

Added a unit test, setAirframeTest. Changed setAirframe function. Added an...

Added a unit test, setAirframeTest. Changed setAirframe function. Added an end_of_enum to the airframe enum.
parent be2a388b
......@@ -179,8 +179,17 @@ void UASUnitTest::getAirframe_test()
void UASUnitTest::setAirframe_test()
{
uas->setAirframe(25);
QVERIFY(uas->getAirframe() == 25);
//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()
{
......
......@@ -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