Browse Source

Added a unit test, setAirframeTest. Changed setAirframe function. Added an end_of_enum to the airframe enum.

QGC4.4
Jessica 13 years ago
parent
commit
70c7c99e27
  1. 13
      qgcunittest/UASUnitTest.cc
  2. 10
      src/uas/UAS.h
  3. 3
      src/uas/UASInterface.h

13
qgcunittest/UASUnitTest.cc

@ -179,8 +179,17 @@ void UASUnitTest::getAirframe_test() @@ -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()
{

10
src/uas/UAS.h

@ -483,15 +483,19 @@ public slots: @@ -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);

3
src/uas/UASInterface.h

@ -149,7 +149,8 @@ public: @@ -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
};
/**

Loading…
Cancel
Save