Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
30d65882
Commit
30d65882
authored
May 03, 2017
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unit tests for .waypoints and .mission file format load
parent
bf761e36
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
226 additions
and
2 deletions
+226
-2
UnitTest.qrc
UnitTest.qrc
+2
-0
qgroundcontrol.pro
qgroundcontrol.pro
+2
-0
PlanMasterControllerTest.cc
src/MissionManager/PlanMasterControllerTest.cc
+52
-0
PlanMasterControllerTest.h
src/MissionManager/PlanMasterControllerTest.h
+39
-0
MissionPlanner.waypoints
src/MissionManager/UnitTest/MissionPlanner.waypoints
+7
-0
OldFileFormat.mission
src/MissionManager/UnitTest/OldFileFormat.mission
+120
-0
UnitTest.h
src/qgcunittest/UnitTest.h
+2
-2
UnitTestList.cc
src/qgcunittest/UnitTestList.cc
+2
-0
No files found.
UnitTest.qrc
View file @
30d65882
...
...
@@ -6,5 +6,7 @@
<file alias="MavCmdInfoRover.json">src/MissionManager/UnitTest/MavCmdInfoRover.json</file>
<file alias="MavCmdInfoSub.json">src/MissionManager/UnitTest/MavCmdInfoSub.json</file>
<file alias="MavCmdInfoVTOL.json">src/MissionManager/UnitTest/MavCmdInfoVTOL.json</file>
<file alias="MissionPlanner.waypoints">src/MissionManager/UnitTest/MissionPlanner.waypoints</file>
<file alias="OldFileFormat.mission">src/MissionManager/UnitTest/OldFileFormat.mission</file>
</qresource>
</RCC>
qgroundcontrol.pro
View file @
30d65882
...
...
@@ -390,6 +390,7 @@ DebugBuild { PX4FirmwarePlugin { PX4FirmwarePluginFactory { APMFirmwarePlugin {
src/MissionManager/MissionControllerTest.h \
src/MissionManager/MissionItemTest.h \
src/MissionManager/MissionManagerTest.h \
src/MissionManager/PlanMasterControllerTest.h \
src/MissionManager/SectionTest.h \
src/MissionManager/SimpleMissionItemTest.h \
src/MissionManager/SpeedSectionTest.h \
...
...
@@ -422,6 +423,7 @@ DebugBuild { PX4FirmwarePlugin { PX4FirmwarePluginFactory { APMFirmwarePlugin {
src/MissionManager/MissionControllerTest.cc \
src/MissionManager/MissionItemTest.cc \
src/MissionManager/MissionManagerTest.cc \
src/MissionManager/PlanMasterControllerTest.cc \
src/MissionManager/SectionTest.cc \
src/MissionManager/SimpleMissionItemTest.cc \
src/MissionManager/SpeedSectionTest.cc \
...
...
src/MissionManager/PlanMasterControllerTest.cc
0 → 100644
View file @
30d65882
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
#include "PlanMasterControllerTest.h"
#include "LinkManager.h"
#include "MultiVehicleManager.h"
#include "SimpleMissionItem.h"
#include "MissionSettingsItem.h"
#include "QGCApplication.h"
#include "SettingsManager.h"
#include "AppSettings.h"
PlanMasterControllerTest
::
PlanMasterControllerTest
(
void
)
:
_masterController
(
NULL
)
{
}
void
PlanMasterControllerTest
::
init
(
void
)
{
UnitTest
::
init
();
_masterController
=
new
PlanMasterController
(
this
);
_masterController
->
start
(
true
/* editMode */
);
}
void
PlanMasterControllerTest
::
cleanup
(
void
)
{
delete
_masterController
;
_masterController
=
NULL
;
UnitTest
::
cleanup
();
}
void
PlanMasterControllerTest
::
_testMissionFileLoad
(
void
)
{
_masterController
->
loadFromFile
(
":/json/unittest/OldFileFormat.mission"
);
QCOMPARE
(
_masterController
->
missionController
()
->
visualItems
()
->
count
(),
7
);
}
void
PlanMasterControllerTest
::
_testMissionPlannerFileLoad
(
void
)
{
_masterController
->
loadFromFile
(
":/json/unittest/MissionPlanner.waypoints"
);
QCOMPARE
(
_masterController
->
missionController
()
->
visualItems
()
->
count
(),
6
);
}
src/MissionManager/PlanMasterControllerTest.h
0 → 100644
View file @
30d65882
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
#pragma once
#include "UnitTest.h"
#include "MockLink.h"
#include "MissionManager.h"
#include "MultiSignalSpy.h"
#include "MissionControllerManagerTest.h"
#include "PlanMasterController.h"
#include "MissionController.h"
#include "SimpleMissionItem.h"
#include <QGeoCoordinate>
class
PlanMasterControllerTest
:
public
UnitTest
{
Q_OBJECT
public:
PlanMasterControllerTest
(
void
);
private
slots
:
void
init
(
void
)
final
;
void
cleanup
(
void
)
final
;
void
_testMissionFileLoad
(
void
);
void
_testMissionPlannerFileLoad
(
void
);
private:
PlanMasterController
*
_masterController
;
};
src/MissionManager/UnitTest/MissionPlanner.waypoints
0 → 100644
View file @
30d65882
QGC WPL 110
0 1 0 16 0 0 0 0 47.660459 -122.103167 5.210000 1
1 0 3 16 0.000000 0.000000 0.000000 0.000000 47.661298 -122.103274 100.000000 1
2 0 3 16 0.000000 0.000000 0.000000 0.000000 47.661030 -122.101858 100.000000 1
3 0 3 16 0.000000 0.000000 0.000000 0.000000 47.659961 -122.101525 100.000000 1
4 0 3 16 0.000000 0.000000 0.000000 0.000000 47.659195 -122.103370 100.000000 1
5 0 3 16 0.000000 0.000000 0.000000 0.000000 47.660459 -122.105538 100.000000 1
src/MissionManager/UnitTest/OldFileFormat.mission
0 → 100644
View file @
30d65882
{
"firmwareType": 3,
"groundStation": "QGroundControl",
"items": [
{
"autoContinue": true,
"command": 22,
"coordinate": [
47.660137763851573,
-122.29411931627152,
50
],
"doJumpId": 1,
"frame": 2,
"params": [
0,
0,
0,
0
],
"type": "SimpleItem"
},
{
"autoContinue": true,
"command": 18,
"coordinate": [
47.660316610000002,
-122.29423867,
10
],
"doJumpId": 2,
"frame": 3,
"params": [
1,
0,
0,
0
],
"type": "SimpleItem"
},
{
"autoContinue": true,
"command": 18,
"coordinate": [
47.660299945473923,
-122.29402946102036,
20
],
"doJumpId": 3,
"frame": 3,
"params": [
3,
0,
0,
0
],
"type": "SimpleItem"
},
{
"autoContinue": true,
"command": 16,
"coordinate": [
47.660239429999997,
-122.29371564,
5
],
"doJumpId": 4,
"frame": 3,
"params": [
0,
0,
0,
0
],
"type": "SimpleItem"
},
{
"autoContinue": true,
"command": 16,
"coordinate": [
47.660368599999998,
-122.29426013,
5
],
"doJumpId": 5,
"frame": 3,
"params": [
0,
0,
0,
0
],
"type": "SimpleItem"
},
{
"autoContinue": true,
"command": 21,
"coordinate": [
47.660153620000003,
-122.29410455999999,
3
],
"doJumpId": 6,
"frame": 3,
"params": [
0,
0,
0,
0
],
"type": "SimpleItem"
}
],
"plannedHomePosition": [
47.660137763851573,
-122.29411931627152,
0
],
"version": 2
}
src/qgcunittest/UnitTest.h
View file @
30d65882
...
...
@@ -98,11 +98,11 @@ protected slots:
// call the UnitTest private implementation.
/// @brief Called before each test.
/// Make sure to call
_
init first in your derived class.
/// Make sure to call
UnitTest::
init first in your derived class.
virtual
void
init
(
void
);
/// @brief Called after each test.
/// Make sure to call
_cleanup fir
st in your derived class.
/// Make sure to call
UnitTest::cleanup la
st in your derived class.
virtual
void
cleanup
(
void
);
protected:
...
...
src/qgcunittest/UnitTestList.cc
View file @
30d65882
...
...
@@ -35,6 +35,7 @@
#include "VisualMissionItemTest.h"
#include "CameraSectionTest.h"
#include "SpeedSectionTest.h"
#include "PlanMasterControllerTest.h"
UT_REGISTER_TEST
(
FactSystemTestGeneric
)
UT_REGISTER_TEST
(
FactSystemTestPX4
)
...
...
@@ -56,6 +57,7 @@ UT_REGISTER_TEST(SendMavCommandTest)
UT_REGISTER_TEST
(
SurveyMissionItemTest
)
UT_REGISTER_TEST
(
CameraSectionTest
)
UT_REGISTER_TEST
(
SpeedSectionTest
)
UT_REGISTER_TEST
(
PlanMasterControllerTest
)
// List of unit test which are currently disabled.
// If disabling a new test, include reason in comment.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment