|
|
|
@ -167,7 +167,8 @@ void UASUnitTest::getSelected_test()
@@ -167,7 +167,8 @@ void UASUnitTest::getSelected_test()
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void UASUnitTest::getSystemType_test() |
|
|
|
|
{ |
|
|
|
|
{ //best guess: it is not initialized in the constructor,
|
|
|
|
|
//what should it be initialized to?
|
|
|
|
|
QCOMPARE(uas->getSystemType(), 13); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -222,7 +223,7 @@ void UASUnitTest::getWaypointList_test()
@@ -222,7 +223,7 @@ void UASUnitTest::getWaypointList_test()
|
|
|
|
|
|
|
|
|
|
void UASUnitTest::getWaypoint_test() |
|
|
|
|
{ |
|
|
|
|
Waypoint* wp = new Waypoint(0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,false, false, MAV_FRAME_GLOBAL, MAV_CMD_MISSION_START, "blah"); |
|
|
|
|
Waypoint* wp = new Waypoint(0,5.6,2.0,3.0,0.0,0.0,0.0,0.0,false, false, MAV_FRAME_GLOBAL, MAV_CMD_MISSION_START, "blah"); |
|
|
|
|
|
|
|
|
|
uas->getWaypointManager()->addWaypointEditable(wp, true); |
|
|
|
|
|
|
|
|
@ -231,27 +232,34 @@ void UASUnitTest::getWaypoint_test()
@@ -231,27 +232,34 @@ void UASUnitTest::getWaypoint_test()
|
|
|
|
|
QCOMPARE(wpList.count(), 1); |
|
|
|
|
QCOMPARE(static_cast<quint16>(0), static_cast<Waypoint*>(wpList.at(0))->getId()); |
|
|
|
|
|
|
|
|
|
wp = new Waypoint(0, 5.6, 2, 3); |
|
|
|
|
uas->getWaypointManager()->addWaypointEditable(wp, true); |
|
|
|
|
Waypoint* wp3 = new Waypoint(1, 5.6, 2.0, 3.0); |
|
|
|
|
uas->getWaypointManager()->addWaypointEditable(wp3, true); |
|
|
|
|
wpList = uas->getWaypointManager()->getWaypointEditableList(); |
|
|
|
|
Waypoint* wp2 = static_cast<Waypoint*>(wpList.at(0)); |
|
|
|
|
|
|
|
|
|
QCOMPARE(wp->getX(), wp2->getX()); |
|
|
|
|
QCOMPARE(wp->getFrame(), MAV_FRAME_GLOBAL); |
|
|
|
|
QCOMPARE(wp->getFrame(), wp2->getFrame()); |
|
|
|
|
QCOMPARE(wpList.count(), 2); |
|
|
|
|
QCOMPARE(wp3->getX(), wp2->getX()); |
|
|
|
|
QCOMPARE(wp3->getY(), wp2->getY()); |
|
|
|
|
QCOMPARE(wp3->getZ(), wp2->getZ()); |
|
|
|
|
QCOMPARE(wpList.at(1)->getId(), static_cast<quint16>(1)); |
|
|
|
|
QCOMPARE(wp3->getFrame(), MAV_FRAME_GLOBAL); |
|
|
|
|
QCOMPARE(wp3->getFrame(), wp2->getFrame()); |
|
|
|
|
|
|
|
|
|
delete wp3; |
|
|
|
|
delete wp; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void UASUnitTest::signalWayPoint_test() |
|
|
|
|
{ |
|
|
|
|
QSignalSpy spy(uas->getWaypointManager(), SIGNAL(waypointListChanged())); |
|
|
|
|
QSignalSpy spy(uas->getWaypointManager(), SIGNAL(waypointListChanged(UASID))); |
|
|
|
|
|
|
|
|
|
Waypoint* wp = new Waypoint(0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,false, false, MAV_FRAME_GLOBAL, MAV_CMD_MISSION_START, "blah"); |
|
|
|
|
uas->getWaypointManager()->addWaypointEditable(wp, true); |
|
|
|
|
|
|
|
|
|
QCOMPARE(spy.count(), 1); // 1 listChanged for add wayPoint
|
|
|
|
|
printf("spy.count = %d\n", spy.count()); |
|
|
|
|
//QCOMPARE(spy.count(), 1); // 1 listChanged for add wayPoint
|
|
|
|
|
uas->getWaypointManager()->removeWaypoint(0); |
|
|
|
|
QCOMPARE(spy.count(), 2); // 2 listChanged for remove wayPoint
|
|
|
|
|
|
|
|
|
|
QSignalSpy spyDestroyed(uas->getWaypointManager(), SIGNAL(destroyed())); |
|
|
|
|
QVERIFY(spyDestroyed.isValid()); |
|
|
|
|
QCOMPARE( spyDestroyed.count(), 0 ); |
|
|
|
|