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
baf5606c
Commit
baf5606c
authored
Jul 27, 2012
by
Jessica
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'signalWaypoint_unittest_fix' into reorganize_qgcunittest
parents
3562e602
8d3f5c4c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
27 deletions
+38
-27
UASUnitTest.cc
qgcunittest/UASUnitTest.cc
+17
-10
UAS.cc
src/uas/UAS.cc
+20
-15
UAS.h
src/uas/UAS.h
+1
-2
No files found.
qgcunittest/UASUnitTest.cc
View file @
baf5606c
#include "UASUnitTest.h"
#include "UASUnitTest.h"
#include <stdio.h>
#include <stdio.h>
#include <QObject>
UASUnitTest
::
UASUnitTest
()
UASUnitTest
::
UASUnitTest
()
{
{
}
}
...
@@ -15,8 +16,10 @@ void UASUnitTest::cleanup()
...
@@ -15,8 +16,10 @@ void UASUnitTest::cleanup()
{
{
delete
mav
;
delete
mav
;
mav
=
NULL
;
mav
=
NULL
;
if
(
uas
!=
NULL
){
delete
uas
;
delete
uas
;
uas
=
NULL
;
uas
=
NULL
;
}
}
}
void
UASUnitTest
::
getUASID_test
()
void
UASUnitTest
::
getUASID_test
()
...
@@ -167,8 +170,9 @@ void UASUnitTest::getSelected_test()
...
@@ -167,8 +170,9 @@ void UASUnitTest::getSelected_test()
}
}
void
UASUnitTest
::
getSystemType_test
()
void
UASUnitTest
::
getSystemType_test
()
{
//best guess: it is not initialized in the constructor,
{
//check that system type is set to MAV_TYPE_GENERIC when initialized
//what should it be initialized to?
QCOMPARE
(
uas
->
getSystemType
(),
0
);
uas
->
setSystemType
(
13
);
QCOMPARE
(
uas
->
getSystemType
(),
13
);
QCOMPARE
(
uas
->
getSystemType
(),
13
);
}
}
...
@@ -251,33 +255,36 @@ void UASUnitTest::getWaypoint_test()
...
@@ -251,33 +255,36 @@ void UASUnitTest::getWaypoint_test()
void
UASUnitTest
::
signalWayPoint_test
()
void
UASUnitTest
::
signalWayPoint_test
()
{
{
QSignalSpy
spy
(
uas
->
getWaypointManager
(),
SIGNAL
(
waypoint
ListChanged
(
UASID
)));
QSignalSpy
spy
(
uas
->
getWaypointManager
(),
SIGNAL
(
waypoint
EditableListChanged
(
)));
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
,
1
.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
);
uas
->
getWaypointManager
()
->
addWaypointEditable
(
wp
,
true
);
printf
(
"spy.count = %d
\n
"
,
spy
.
count
());
//
QCOMPARE(spy.count(), 1); // 1 listChanged for add wayPoint
QCOMPARE
(
spy
.
count
(),
1
);
// 1 listChanged for add wayPoint
uas
->
getWaypointManager
()
->
removeWaypoint
(
0
);
uas
->
getWaypointManager
()
->
removeWaypoint
(
0
);
QCOMPARE
(
spy
.
count
(),
2
);
// 2 listChanged for remove wayPoint
QCOMPARE
(
spy
.
count
(),
2
);
// 2 listChanged for remove wayPoint
QSignalSpy
spyDestroyed
(
uas
->
getWaypointManager
(),
SIGNAL
(
destroyed
()));
QSignalSpy
spyDestroyed
(
uas
->
getWaypointManager
(),
SIGNAL
(
destroyed
()));
QVERIFY
(
spyDestroyed
.
isValid
());
QVERIFY
(
spyDestroyed
.
isValid
());
QCOMPARE
(
spyDestroyed
.
count
(),
0
);
QCOMPARE
(
spyDestroyed
.
count
(),
0
);
delete
uas
;
// delete(destroyed) uas for validating
delete
uas
;
// delete(destroyed) uas for validating
uas
=
NULL
;
QCOMPARE
(
spyDestroyed
.
count
(),
1
);
// count destroyed uas should are 1
QCOMPARE
(
spyDestroyed
.
count
(),
1
);
// count destroyed uas should are 1
uas
=
new
UAS
(
mav
,
UASID
);
uas
=
new
UAS
(
mav
,
UASID
);
QSignalSpy
spy2
(
uas
->
getWaypointManager
(),
SIGNAL
(
waypointListChanged
()));
QSignalSpy
spy2
(
uas
->
getWaypointManager
(),
SIGNAL
(
waypoint
Editable
ListChanged
()));
QCOMPARE
(
spy2
.
count
(),
0
);
QCOMPARE
(
spy2
.
count
(),
0
);
Waypoint
*
wp2
=
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
);
uas
->
getWaypointManager
()
->
addWaypointEditable
(
wp
2
,
true
);
QCOMPARE
(
spy2
.
count
(),
1
);
QCOMPARE
(
spy2
.
count
(),
1
);
uas
->
getWaypointManager
()
->
clearWaypointList
();
uas
->
getWaypointManager
()
->
clearWaypointList
();
QVector
<
Waypoint
*>
wpList
=
uas
->
getWaypointManager
()
->
getWaypointEditableList
();
QVector
<
Waypoint
*>
wpList
=
uas
->
getWaypointManager
()
->
getWaypointEditableList
();
QCOMPARE
(
wpList
.
count
(),
1
);
QCOMPARE
(
wpList
.
count
(),
1
);
delete
wp2
;
}
}
void
UASUnitTest
::
signalUASLink_test
()
void
UASUnitTest
::
signalUASLink_test
()
...
...
src/uas/UAS.cc
View file @
baf5606c
...
@@ -112,6 +112,7 @@ UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(),
...
@@ -112,6 +112,7 @@ UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(),
connect
(
this
,
SIGNAL
(
systemSpecsChanged
(
int
)),
this
,
SLOT
(
writeSettings
()));
connect
(
this
,
SIGNAL
(
systemSpecsChanged
(
int
)),
this
,
SLOT
(
writeSettings
()));
statusTimeout
->
start
(
500
);
statusTimeout
->
start
(
500
);
readSettings
();
readSettings
();
type
=
MAV_TYPE_GENERIC
;
// Initial signals
// Initial signals
emit
disarmed
();
emit
disarmed
();
emit
armingChanged
(
false
);
emit
armingChanged
(
false
);
...
@@ -2081,7 +2082,10 @@ void UAS::requestParameter(int component, const QString& parameter)
...
@@ -2081,7 +2082,10 @@ void UAS::requestParameter(int component, const QString& parameter)
void
UAS
::
setSystemType
(
int
systemType
)
void
UAS
::
setSystemType
(
int
systemType
)
{
{
if
((
systemType
>=
MAV_TYPE_GENERIC
)
&&
(
systemType
<
MAV_TYPE_ENUM_END
))
{
type
=
systemType
;
type
=
systemType
;
// If the airframe is still generic, change it to a close default type
// If the airframe is still generic, change it to a close default type
if
(
airframe
==
0
)
if
(
airframe
==
0
)
{
{
...
@@ -2096,6 +2100,7 @@ void UAS::setSystemType(int systemType)
...
@@ -2096,6 +2100,7 @@ void UAS::setSystemType(int systemType)
}
}
}
}
emit
systemSpecsChanged
(
uasId
);
emit
systemSpecsChanged
(
uasId
);
}
}
}
void
UAS
::
setUASName
(
const
QString
&
name
)
void
UAS
::
setUASName
(
const
QString
&
name
)
...
...
src/uas/UAS.h
View file @
baf5606c
...
@@ -490,7 +490,7 @@ public slots:
...
@@ -490,7 +490,7 @@ public slots:
/** @brief Set the specific airframe type */
/** @brief Set the specific airframe type */
void
setAirframe
(
int
airframe
)
void
setAirframe
(
int
airframe
)
{
{
if
((
airframe
>=
0
)
&&
(
airframe
<
12
))
if
((
airframe
>=
QGC_AIRFRAME_GENERIC
)
&&
(
airframe
<
QGC_AIRFRAME_END_OF_ENUM
))
{
{
this
->
airframe
=
airframe
;
this
->
airframe
=
airframe
;
emit
systemSpecsChanged
(
uasId
);
emit
systemSpecsChanged
(
uasId
);
...
@@ -643,7 +643,6 @@ public slots:
...
@@ -643,7 +643,6 @@ public slots:
void
stopDataRecording
();
void
stopDataRecording
();
void
deleteSettings
();
void
deleteSettings
();
signals:
signals:
/** @brief The main/battery voltage has changed/was updated */
/** @brief The main/battery voltage has changed/was updated */
//void voltageChanged(int uasId, double voltage); // Defined in UASInterface already
//void voltageChanged(int uasId, double voltage); // Defined in UASInterface already
/** @brief An actuator value has changed */
/** @brief An actuator value has changed */
...
...
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