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
5fde6e71
Commit
5fde6e71
authored
Jun 04, 2017
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better/More survey related unit testing
parent
b3fe4b6b
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
315 additions
and
120 deletions
+315
-120
qgroundcontrol.pro
qgroundcontrol.pro
+2
-0
QGCMapPolygon.cc
src/MissionManager/QGCMapPolygon.cc
+3
-0
QGCMapPolygonTest.cc
src/MissionManager/QGCMapPolygonTest.cc
+198
-0
QGCMapPolygonTest.h
src/MissionManager/QGCMapPolygonTest.h
+76
-0
SurveyMissionItemTest.cc
src/MissionManager/SurveyMissionItemTest.cc
+3
-100
SurveyMissionItemTest.h
src/MissionManager/SurveyMissionItemTest.h
+0
-4
QGCQGeoCoordinate.cc
src/QGCQGeoCoordinate.cc
+12
-2
QGCQGeoCoordinate.h
src/QGCQGeoCoordinate.h
+10
-5
QmlObjectListModel.cc
src/QmlControls/QmlObjectListModel.cc
+9
-9
UnitTestList.cc
src/qgcunittest/UnitTestList.cc
+2
-0
No files found.
qgroundcontrol.pro
View file @
5fde6e71
...
@@ -400,6 +400,7 @@ DebugBuild { PX4FirmwarePlugin { PX4FirmwarePluginFactory { APMFirmwarePlugin {
...
@@ -400,6 +400,7 @@ DebugBuild { PX4FirmwarePlugin { PX4FirmwarePluginFactory { APMFirmwarePlugin {
src
/
MissionManager
/
MissionManagerTest
.
h
\
src
/
MissionManager
/
MissionManagerTest
.
h
\
src
/
MissionManager
/
MissionSettingsTest
.
h
\
src
/
MissionManager
/
MissionSettingsTest
.
h
\
src
/
MissionManager
/
PlanMasterControllerTest
.
h
\
src
/
MissionManager
/
PlanMasterControllerTest
.
h
\
src
/
MissionManager
/
QGCMapPolygonTest
.
h
\
src
/
MissionManager
/
SectionTest
.
h
\
src
/
MissionManager
/
SectionTest
.
h
\
src
/
MissionManager
/
SimpleMissionItemTest
.
h
\
src
/
MissionManager
/
SimpleMissionItemTest
.
h
\
src
/
MissionManager
/
SpeedSectionTest
.
h
\
src
/
MissionManager
/
SpeedSectionTest
.
h
\
...
@@ -434,6 +435,7 @@ DebugBuild { PX4FirmwarePlugin { PX4FirmwarePluginFactory { APMFirmwarePlugin {
...
@@ -434,6 +435,7 @@ DebugBuild { PX4FirmwarePlugin { PX4FirmwarePluginFactory { APMFirmwarePlugin {
src
/
MissionManager
/
MissionManagerTest
.
cc
\
src
/
MissionManager
/
MissionManagerTest
.
cc
\
src
/
MissionManager
/
MissionSettingsTest
.
cc
\
src
/
MissionManager
/
MissionSettingsTest
.
cc
\
src
/
MissionManager
/
PlanMasterControllerTest
.
cc
\
src
/
MissionManager
/
PlanMasterControllerTest
.
cc
\
src
/
MissionManager
/
QGCMapPolygonTest
.
cc
\
src
/
MissionManager
/
SectionTest
.
cc
\
src
/
MissionManager
/
SectionTest
.
cc
\
src
/
MissionManager
/
SimpleMissionItemTest
.
cc
\
src
/
MissionManager
/
SimpleMissionItemTest
.
cc
\
src
/
MissionManager
/
SpeedSectionTest
.
cc
\
src
/
MissionManager
/
SpeedSectionTest
.
cc
\
...
...
src/MissionManager/QGCMapPolygon.cc
View file @
5fde6e71
...
@@ -72,6 +72,9 @@ void QGCMapPolygon::setDirty(bool dirty)
...
@@ -72,6 +72,9 @@ void QGCMapPolygon::setDirty(bool dirty)
{
{
if
(
_dirty
!=
dirty
)
{
if
(
_dirty
!=
dirty
)
{
_dirty
=
dirty
;
_dirty
=
dirty
;
if
(
!
dirty
)
{
_polygonModel
.
setDirty
(
false
);
}
emit
dirtyChanged
(
dirty
);
emit
dirtyChanged
(
dirty
);
}
}
}
}
...
...
src/MissionManager/QGCMapPolygonTest.cc
0 → 100644
View file @
5fde6e71
/****************************************************************************
*
* (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 "QGCMapPolygonTest.h"
#include "QGCApplication.h"
#include "QGCQGeoCoordinate.h"
QGCMapPolygonTest
::
QGCMapPolygonTest
(
void
)
{
_polyPoints
<<
QGeoCoordinate
(
47.635638361473475
,
-
122.09269407980834
)
<<
QGeoCoordinate
(
47.635638361473475
,
-
122.08545246602667
)
<<
QGeoCoordinate
(
47.63057923872075
,
-
122.08545246602667
)
<<
QGeoCoordinate
(
47.63057923872075
,
-
122.09269407980834
);
}
void
QGCMapPolygonTest
::
init
(
void
)
{
UnitTest
::
init
();
_rgPolygonSignals
[
polygonCountChangedIndex
]
=
SIGNAL
(
countChanged
(
int
));
_rgPolygonSignals
[
pathChangedIndex
]
=
SIGNAL
(
pathChanged
());
_rgPolygonSignals
[
polygonDirtyChangedIndex
]
=
SIGNAL
(
dirtyChanged
(
bool
));
_rgPolygonSignals
[
clearedIndex
]
=
SIGNAL
(
cleared
());
_rgPolygonSignals
[
centerChangedIndex
]
=
SIGNAL
(
centerChanged
(
QGeoCoordinate
));
_rgModelSignals
[
modelCountChangedIndex
]
=
SIGNAL
(
countChanged
(
int
));
_rgModelSignals
[
modelDirtyChangedIndex
]
=
SIGNAL
(
dirtyChanged
(
bool
));
_mapPolygon
=
new
QGCMapPolygon
(
this
,
this
);
_pathModel
=
_mapPolygon
->
qmlPathModel
();
QVERIFY
(
_pathModel
);
_multiSpyPolygon
=
new
MultiSignalSpy
();
QCOMPARE
(
_multiSpyPolygon
->
init
(
_mapPolygon
,
_rgPolygonSignals
,
_cPolygonSignals
),
true
);
_multiSpyModel
=
new
MultiSignalSpy
();
QCOMPARE
(
_multiSpyModel
->
init
(
_pathModel
,
_rgModelSignals
,
_cModelSignals
),
true
);
}
void
QGCMapPolygonTest
::
cleanup
(
void
)
{
delete
_mapPolygon
;
delete
_multiSpyPolygon
;
delete
_multiSpyModel
;
}
void
QGCMapPolygonTest
::
_testDirty
(
void
)
{
// Check basic dirty bit set/get
QVERIFY
(
!
_mapPolygon
->
dirty
());
QVERIFY
(
!
_pathModel
->
dirty
());
_mapPolygon
->
setDirty
(
false
);
QVERIFY
(
!
_mapPolygon
->
dirty
());
QVERIFY
(
!
_pathModel
->
dirty
());
QVERIFY
(
_multiSpyPolygon
->
checkNoSignals
());
QVERIFY
(
_multiSpyModel
->
checkNoSignals
());
_mapPolygon
->
setDirty
(
true
);
QVERIFY
(
_mapPolygon
->
dirty
());
QVERIFY
(
!
_pathModel
->
dirty
());
QVERIFY
(
_multiSpyPolygon
->
checkOnlySignalByMask
(
polygonDirtyChangedMask
));
QVERIFY
(
_multiSpyPolygon
->
pullBoolFromSignalIndex
(
polygonDirtyChangedIndex
));
QVERIFY
(
_multiSpyModel
->
checkNoSignals
());
_multiSpyPolygon
->
clearAllSignals
();
_mapPolygon
->
setDirty
(
false
);
QVERIFY
(
!
_mapPolygon
->
dirty
());
QVERIFY
(
!
_pathModel
->
dirty
());
QVERIFY
(
_multiSpyPolygon
->
checkOnlySignalByMask
(
polygonDirtyChangedMask
));
QVERIFY
(
!
_multiSpyPolygon
->
pullBoolFromSignalIndex
(
polygonDirtyChangedIndex
));
QVERIFY
(
_multiSpyModel
->
checkNoSignals
());
_multiSpyPolygon
->
clearAllSignals
();
_pathModel
->
setDirty
(
true
);
QVERIFY
(
_pathModel
->
dirty
());
QVERIFY
(
_mapPolygon
->
dirty
());
QVERIFY
(
_multiSpyPolygon
->
checkOnlySignalByMask
(
polygonDirtyChangedMask
));
QVERIFY
(
_multiSpyPolygon
->
pullBoolFromSignalIndex
(
polygonDirtyChangedIndex
));
QVERIFY
(
_multiSpyModel
->
checkOnlySignalByMask
(
modelDirtyChangedMask
));
QVERIFY
(
_multiSpyModel
->
pullBoolFromSignalIndex
(
modelDirtyChangedIndex
));
_multiSpyPolygon
->
clearAllSignals
();
_multiSpyModel
->
clearAllSignals
();
_mapPolygon
->
setDirty
(
false
);
QVERIFY
(
!
_mapPolygon
->
dirty
());
QVERIFY
(
!
_pathModel
->
dirty
());
QVERIFY
(
_multiSpyPolygon
->
checkOnlySignalByMask
(
polygonDirtyChangedMask
));
QVERIFY
(
!
_multiSpyPolygon
->
pullBoolFromSignalIndex
(
polygonDirtyChangedIndex
));
QVERIFY
(
_multiSpyModel
->
checkOnlySignalByMask
(
modelDirtyChangedMask
));
QVERIFY
(
!
_multiSpyModel
->
pullBoolFromSignalIndex
(
modelDirtyChangedIndex
));
_multiSpyPolygon
->
clearAllSignals
();
_multiSpyModel
->
clearAllSignals
();
}
void
QGCMapPolygonTest
::
_testVertexManipulation
(
void
)
{
#if 0
Q_INVOKABLE void clear(void);
Q_INVOKABLE void appendVertex(const QGeoCoordinate& coordinate);
Q_INVOKABLE void removeVertex(int vertexIndex);
/// Adjust the value for the specified coordinate
/// @param vertexIndex Polygon point index to modify (0-based)
/// @param coordinate New coordinate for point
Q_INVOKABLE void adjustVertex(int vertexIndex, const QGeoCoordinate coordinate);
/// Splits the segment comprised of vertextIndex -> vertexIndex + 1
Q_INVOKABLE void splitPolygonSegment(int vertexIndex);
#endif
// Vertex addition testing
for
(
int
i
=
0
;
i
<
_polyPoints
.
count
();
i
++
)
{
QCOMPARE
(
_mapPolygon
->
count
(),
i
);
_mapPolygon
->
appendVertex
(
_polyPoints
[
i
]);
QVERIFY
(
_multiSpyPolygon
->
checkOnlySignalByMask
(
pathChangedMask
|
polygonDirtyChangedMask
|
polygonCountChangedMask
|
centerChangedMask
));
QVERIFY
(
_multiSpyModel
->
checkOnlySignalByMask
(
modelDirtyChangedMask
|
modelCountChangedMask
));
QCOMPARE
(
_multiSpyPolygon
->
pullIntFromSignalIndex
(
polygonCountChangedIndex
),
i
+
1
);
QCOMPARE
(
_multiSpyModel
->
pullIntFromSignalIndex
(
modelCountChangedIndex
),
i
+
1
);
QVERIFY
(
_mapPolygon
->
dirty
());
QVERIFY
(
_pathModel
->
dirty
());
QCOMPARE
(
_mapPolygon
->
count
(),
i
+
1
);
QVariantList
polyList
=
_mapPolygon
->
path
();
QCOMPARE
(
polyList
.
count
(),
i
+
1
);
QCOMPARE
(
polyList
[
i
].
value
<
QGeoCoordinate
>
(),
_polyPoints
[
i
]);
QCOMPARE
(
_pathModel
->
count
(),
i
+
1
);
QCOMPARE
(
_pathModel
->
value
<
QGCQGeoCoordinate
*>
(
i
)
->
coordinate
(),
_polyPoints
[
i
]);
_mapPolygon
->
setDirty
(
false
);
_multiSpyPolygon
->
clearAllSignals
();
_multiSpyModel
->
clearAllSignals
();
}
// Vertex adjustment testing
QGCQGeoCoordinate
*
geoCoord
=
_pathModel
->
value
<
QGCQGeoCoordinate
*>
(
1
);
QSignalSpy
coordSpy
(
geoCoord
,
SIGNAL
(
coordinateChanged
(
QGeoCoordinate
)));
QSignalSpy
coordDirtySpy
(
geoCoord
,
SIGNAL
(
dirtyChanged
(
bool
)));
QGeoCoordinate
adjustCoord
(
_polyPoints
[
1
].
latitude
()
+
1
,
_polyPoints
[
1
].
longitude
()
+
1
);
_mapPolygon
->
adjustVertex
(
1
,
adjustCoord
);
QVERIFY
(
_multiSpyPolygon
->
checkOnlySignalByMask
(
pathChangedMask
|
polygonDirtyChangedMask
|
centerChangedMask
));
QVERIFY
(
_multiSpyModel
->
checkOnlySignalByMask
(
modelDirtyChangedMask
));
QCOMPARE
(
coordSpy
.
count
(),
1
);
QCOMPARE
(
coordDirtySpy
.
count
(),
1
);
QCOMPARE
(
geoCoord
->
coordinate
(),
adjustCoord
);
QVariantList
polyList
=
_mapPolygon
->
path
();
QCOMPARE
(
polyList
[
0
].
value
<
QGeoCoordinate
>
(),
_polyPoints
[
0
]);
QCOMPARE
(
_pathModel
->
value
<
QGCQGeoCoordinate
*>
(
0
)
->
coordinate
(),
_polyPoints
[
0
]);
QCOMPARE
(
polyList
[
2
].
value
<
QGeoCoordinate
>
(),
_polyPoints
[
2
]);
QCOMPARE
(
_pathModel
->
value
<
QGCQGeoCoordinate
*>
(
2
)
->
coordinate
(),
_polyPoints
[
2
]);
QCOMPARE
(
polyList
[
3
].
value
<
QGeoCoordinate
>
(),
_polyPoints
[
3
]);
QCOMPARE
(
_pathModel
->
value
<
QGCQGeoCoordinate
*>
(
3
)
->
coordinate
(),
_polyPoints
[
3
]);
_mapPolygon
->
setDirty
(
false
);
_multiSpyPolygon
->
clearAllSignals
();
_multiSpyModel
->
clearAllSignals
();
// Vertex removal testing
_mapPolygon
->
removeVertex
(
1
);
QVERIFY
(
_multiSpyPolygon
->
checkOnlySignalByMask
(
pathChangedMask
|
polygonDirtyChangedMask
|
polygonCountChangedMask
|
centerChangedMask
));
QVERIFY
(
_multiSpyModel
->
checkOnlySignalByMask
(
modelDirtyChangedMask
|
modelCountChangedMask
));
QCOMPARE
(
_mapPolygon
->
count
(),
3
);
polyList
=
_mapPolygon
->
path
();
QCOMPARE
(
polyList
.
count
(),
3
);
QCOMPARE
(
_pathModel
->
count
(),
3
);
QCOMPARE
(
polyList
[
0
].
value
<
QGeoCoordinate
>
(),
_polyPoints
[
0
]);
QCOMPARE
(
_pathModel
->
value
<
QGCQGeoCoordinate
*>
(
0
)
->
coordinate
(),
_polyPoints
[
0
]);
QCOMPARE
(
polyList
[
1
].
value
<
QGeoCoordinate
>
(),
_polyPoints
[
2
]);
QCOMPARE
(
_pathModel
->
value
<
QGCQGeoCoordinate
*>
(
1
)
->
coordinate
(),
_polyPoints
[
2
]);
QCOMPARE
(
polyList
[
2
].
value
<
QGeoCoordinate
>
(),
_polyPoints
[
3
]);
QCOMPARE
(
_pathModel
->
value
<
QGCQGeoCoordinate
*>
(
2
)
->
coordinate
(),
_polyPoints
[
3
]);
// Clear testing
_mapPolygon
->
clear
();
QVERIFY
(
_multiSpyPolygon
->
checkOnlySignalsByMask
(
pathChangedMask
|
polygonDirtyChangedMask
|
polygonCountChangedMask
|
centerChangedMask
|
clearedMask
));
QVERIFY
(
_multiSpyModel
->
checkOnlySignalsByMask
(
modelDirtyChangedMask
|
modelCountChangedMask
));
QVERIFY
(
_mapPolygon
->
dirty
());
QVERIFY
(
_pathModel
->
dirty
());
QCOMPARE
(
_mapPolygon
->
count
(),
0
);
polyList
=
_mapPolygon
->
path
();
QCOMPARE
(
polyList
.
count
(),
0
);
QCOMPARE
(
_pathModel
->
count
(),
0
);
}
src/MissionManager/QGCMapPolygonTest.h
0 → 100644
View file @
5fde6e71
/****************************************************************************
*
* (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 "MultiSignalSpy.h"
#include "QGCMapPolygon.h"
#include "QmlObjectListModel.h"
/// Unit test for SurveyMissionItem
class
QGCMapPolygonTest
:
public
UnitTest
{
Q_OBJECT
public:
QGCMapPolygonTest
(
void
);
protected:
void
init
(
void
)
final
;
void
cleanup
(
void
)
final
;
private
slots
:
void
_testDirty
(
void
);
void
_testVertexManipulation
(
void
);
private:
enum
{
polygonCountChangedIndex
=
0
,
pathChangedIndex
,
polygonDirtyChangedIndex
,
clearedIndex
,
centerChangedIndex
,
maxPolygonSignalIndex
};
enum
{
polygonCountChangedMask
=
1
<<
polygonCountChangedIndex
,
pathChangedMask
=
1
<<
pathChangedIndex
,
polygonDirtyChangedMask
=
1
<<
polygonDirtyChangedIndex
,
clearedMask
=
1
<<
clearedIndex
,
centerChangedMask
=
1
<<
centerChangedIndex
,
};
static
const
size_t
_cPolygonSignals
=
maxPolygonSignalIndex
;
const
char
*
_rgPolygonSignals
[
_cPolygonSignals
];
void
countChanged
(
int
count
);
void
dirtyChanged
(
bool
dirtyChanged
);
enum
{
modelCountChangedIndex
=
0
,
modelDirtyChangedIndex
,
maxModelSignalIndex
};
enum
{
modelCountChangedMask
=
1
<<
modelCountChangedIndex
,
modelDirtyChangedMask
=
1
<<
modelDirtyChangedIndex
,
};
static
const
size_t
_cModelSignals
=
maxModelSignalIndex
;
const
char
*
_rgModelSignals
[
_cModelSignals
];
MultiSignalSpy
*
_multiSpyPolygon
;
MultiSignalSpy
*
_multiSpyModel
;
QGCMapPolygon
*
_mapPolygon
;
QmlObjectListModel
*
_pathModel
;
QList
<
QGeoCoordinate
>
_polyPoints
;
};
src/MissionManager/SurveyMissionItemTest.cc
View file @
5fde6e71
...
@@ -143,106 +143,9 @@ void SurveyMissionItemTest::_testCameraValueChanged(void)
...
@@ -143,106 +143,9 @@ void SurveyMissionItemTest::_testCameraValueChanged(void)
rgFacts
.
clear
();
rgFacts
.
clear
();
}
}
#if 0
void SurveyMissionItemTest::_testAddPolygonCoordinate(void)
{
QCOMPARE(_mapPolygon->count(), 0);
// First call to addPolygonCoordinate should trigger:
// polygonPathChanged
// dirtyChanged
_mapPolygon->appendVertex(_polyPoints[0]);
QVERIFY(_multiSpy->checkOnlySignalByMask(polygonPathChangedMask | dirtyChangedMask));
// Validate object data
QVariantList polyList = _mapPolygon->path();
QCOMPARE(polyList.count(), 1);
QCOMPARE(polyList[0].value<QGeoCoordinate>(), _polyPoints[0]);
// Reset
_surveyItem->setDirty(false);
_multiSpy->clearAllSignals();
// Second call to addPolygonCoordinate should only trigger:
// polygonPathChanged
// dirtyChanged
_mapPolygon->appendVertex(_polyPoints[1]);
QVERIFY(_multiSpy->checkOnlySignalByMask(polygonPathChangedMask | dirtyChangedMask));
polyList = _mapPolygon->path();
QCOMPARE(polyList.count(), 2);
for (int i=0; i<polyList.count(); i++) {
QCOMPARE(polyList[i].value<QGeoCoordinate>(), _polyPoints[i]);
}
_surveyItem->setDirty(false);
_multiSpy->clearAllSignals();
// Third call to addPolygonCoordinate should trigger:
// polygonPathChanged
// dirtyChanged
// Grid is generated for the first time on closing of polygon which triggers:
// coordinateChanged - grid generates new entry coordinate
// exitCoordinateChanged - grid generates new exit coordinate
// specifiesCoordinateChanged - once grid entry/exit shows up specifiesCoordinate gets set to true
// Grid generation triggers the following signals
// lastSequenceNumberChanged - number of internal mission items changes
// gridPointsChanged - grid points show up for the first time
_mapPolygon->appendVertex(_polyPoints[2]);
QVERIFY(_multiSpy->checkOnlySignalByMask(polygonPathChangedMask | lastSequenceNumberChangedMask | gridPointsChangedMask | coordinateChangedMask |
exitCoordinateChangedMask | specifiesCoordinateChangedMask | dirtyChangedMask));
int seqNum = _multiSpy->pullIntFromSignalIndex(lastSequenceNumberChangedIndex);
QVERIFY(seqNum > 0);
polyList = _mapPolygon->path();
QCOMPARE(polyList.count(), 3);
for (int i=0; i<polyList.count(); i++) {
QCOMPARE(polyList[i].value<QGeoCoordinate>(), _polyPoints[i]);
}
// Test that number of waypoints is doubled when using turnaround waypoints
_surveyItem->setTurnaroundDist(60.0);
QVariantList gridPoints = _surveyItem->gridPoints();
_surveyItem->setTurnaroundDist(0.0);
QVariantList gridPointsNoT = _surveyItem->gridPoints();
QCOMPARE(gridPoints.count(), 2 * gridPointsNoT.count());
}
void SurveyMissionItemTest::_testClearPolygon(void)
{
for (int i=0; i<3; i++) {
_mapPolygon->appendVertex(_polyPoints[i]);
}
_surveyItem->setDirty(false);
_multiSpy->clearAllSignals();
// Call to clearPolygon should trigger:
// polygonPathChangedMask
// dirtyChanged
// lastSequenceNumberChangedMask
// gridPointsChangedMask
// dirtyChangedMask
// specifiesCoordinateChangedMask
_mapPolygon->clear();
QVERIFY(_multiSpy->checkOnlySignalByMask(polygonPathChangedMask | lastSequenceNumberChangedMask | gridPointsChangedMask | dirtyChangedMask |
specifiesCoordinateChangedMask));
QVERIFY(!_multiSpy->pullBoolFromSignalIndex(specifiesCoordinateChangedIndex));
QCOMPARE(_multiSpy->pullIntFromSignalIndex(lastSequenceNumberChangedIndex), 0);
QCOMPARE(_mapPolygon->path().count(), 0);
QCOMPARE(_surveyItem->gridPoints().count(), 0);
_surveyItem->setDirty(false);
_multiSpy->clearAllSignals();
}
void
SurveyMissionItemTest
::
_testCameraTrigger
(
void
)
void
SurveyMissionItemTest
::
_testCameraTrigger
(
void
)
{
{
#if 0
QCOMPARE(_surveyItem->property("cameraTrigger").toBool(), true);
QCOMPARE(_surveyItem->property("cameraTrigger").toBool(), true);
// Set up a grid
// Set up a grid
...
@@ -273,5 +176,5 @@ void SurveyMissionItemTest::_testCameraTrigger(void)
...
@@ -273,5 +176,5 @@ void SurveyMissionItemTest::_testCameraTrigger(void)
_surveyItem->setProperty("cameraTrigger", true);
_surveyItem->setProperty("cameraTrigger", true);
QVERIFY(_multiSpy->checkOnlySignalByMask(lastSequenceNumberChangedMask | dirtyChangedMask | cameraTriggerChangedMask));
QVERIFY(_multiSpy->checkOnlySignalByMask(lastSequenceNumberChangedMask | dirtyChangedMask | cameraTriggerChangedMask));
QCOMPARE(_multiSpy->pullIntFromSignalIndex(lastSequenceNumberChangedIndex), lastSeq);
QCOMPARE(_multiSpy->pullIntFromSignalIndex(lastSequenceNumberChangedIndex), lastSeq);
}
#endif
#endif
}
src/MissionManager/SurveyMissionItemTest.h
View file @
5fde6e71
...
@@ -33,11 +33,7 @@ protected:
...
@@ -33,11 +33,7 @@ protected:
private
slots
:
private
slots
:
void
_testDirty
(
void
);
void
_testDirty
(
void
);
void
_testCameraValueChanged
(
void
);
void
_testCameraValueChanged
(
void
);
#if 0
void _testAddPolygonCoordinate(void);
void _testClearPolygon(void);
void
_testCameraTrigger
(
void
);
void
_testCameraTrigger
(
void
);
#endif
private:
private:
enum
{
enum
{
...
...
src/QGCQGeoCoordinate.cc
View file @
5fde6e71
...
@@ -12,8 +12,9 @@
...
@@ -12,8 +12,9 @@
#include <QQmlEngine>
#include <QQmlEngine>
QGCQGeoCoordinate
::
QGCQGeoCoordinate
(
const
QGeoCoordinate
&
coord
,
QObject
*
parent
)
QGCQGeoCoordinate
::
QGCQGeoCoordinate
(
const
QGeoCoordinate
&
coord
,
QObject
*
parent
)
:
QObject
(
parent
)
:
QObject
(
parent
)
,
_coordinate
(
coord
)
,
_coordinate
(
coord
)
,
_dirty
(
false
)
{
{
QQmlEngine
::
setObjectOwnership
(
this
,
QQmlEngine
::
CppOwnership
);
QQmlEngine
::
setObjectOwnership
(
this
,
QQmlEngine
::
CppOwnership
);
}
}
...
@@ -23,5 +24,14 @@ void QGCQGeoCoordinate::setCoordinate(const QGeoCoordinate& coordinate)
...
@@ -23,5 +24,14 @@ void QGCQGeoCoordinate::setCoordinate(const QGeoCoordinate& coordinate)
if
(
_coordinate
!=
coordinate
)
{
if
(
_coordinate
!=
coordinate
)
{
_coordinate
=
coordinate
;
_coordinate
=
coordinate
;
emit
coordinateChanged
(
coordinate
);
emit
coordinateChanged
(
coordinate
);
setDirty
(
true
);
}
}
void
QGCQGeoCoordinate
::
setDirty
(
bool
dirty
)
{
if
(
_dirty
!=
dirty
)
{
_dirty
=
dirty
;
emit
dirtyChanged
(
dirty
);
}
}
}
}
src/QGCQGeoCoordinate.h
View file @
5fde6e71
...
@@ -21,13 +21,18 @@ public:
...
@@ -21,13 +21,18 @@ public:
QGCQGeoCoordinate
(
const
QGeoCoordinate
&
coord
,
QObject
*
parent
=
NULL
);
QGCQGeoCoordinate
(
const
QGeoCoordinate
&
coord
,
QObject
*
parent
=
NULL
);
Q_PROPERTY
(
QGeoCoordinate
coordinate
READ
coordinate
WRITE
setCoordinate
NOTIFY
coordinateChanged
)
Q_PROPERTY
(
QGeoCoordinate
coordinate
READ
coordinate
WRITE
setCoordinate
NOTIFY
coordinateChanged
)
Q_PROPERTY
(
bool
dirty
READ
dirty
WRITE
setDirty
NOTIFY
dirtyChanged
)
QGeoCoordinate
coordinate
(
void
)
const
{
return
_coordinate
;
}
QGeoCoordinate
coordinate
(
void
)
const
{
return
_coordinate
;
}
void
setCoordinate
(
const
QGeoCoordinate
&
coordinate
);
void
setCoordinate
(
const
QGeoCoordinate
&
coordinate
);
bool
dirty
(
void
)
const
{
return
_dirty
;
}
void
setDirty
(
bool
dirty
);
signals:
signals:
void
coordinateChanged
(
QGeoCoordinate
coordinate
);
void
coordinateChanged
(
QGeoCoordinate
coordinate
);
void
dirtyChanged
(
bool
dirty
);
private:
private:
QGeoCoordinate
_coordinate
;
QGeoCoordinate
_coordinate
;
bool
_dirty
;
};
};
src/QmlControls/QmlObjectListModel.cc
View file @
5fde6e71
...
@@ -196,8 +196,8 @@ int QmlObjectListModel::count(void) const
...
@@ -196,8 +196,8 @@ int QmlObjectListModel::count(void) const
void
QmlObjectListModel
::
setDirty
(
bool
dirty
)
void
QmlObjectListModel
::
setDirty
(
bool
dirty
)
{
{
if
(
_dirty
!=
dirty
)
{
_dirty
=
dirty
;
_dirty
=
dirty
;
if
(
!
dirty
)
{
if
(
!
dirty
)
{
// Need to clear dirty from all children
// Need to clear dirty from all children
foreach
(
QObject
*
object
,
_objectList
)
{
foreach
(
QObject
*
object
,
_objectList
)
{
...
@@ -206,8 +206,8 @@ void QmlObjectListModel::setDirty(bool dirty)
...
@@ -206,8 +206,8 @@ void QmlObjectListModel::setDirty(bool dirty)
}
}
}
}
}
}
emit
dirtyChanged
(
_dirty
);
emit
dirtyChanged
(
_dirty
);
}
}
}
void
QmlObjectListModel
::
_childDirtyChanged
(
bool
dirty
)
void
QmlObjectListModel
::
_childDirtyChanged
(
bool
dirty
)
...
...
src/qgcunittest/UnitTestList.cc
View file @
5fde6e71
...
@@ -37,6 +37,7 @@
...
@@ -37,6 +37,7 @@
#include "SpeedSectionTest.h"
#include "SpeedSectionTest.h"
#include "PlanMasterControllerTest.h"
#include "PlanMasterControllerTest.h"
#include "MissionSettingsTest.h"
#include "MissionSettingsTest.h"
#include "QGCMapPolygonTest.h"
UT_REGISTER_TEST
(
FactSystemTestGeneric
)
UT_REGISTER_TEST
(
FactSystemTestGeneric
)
UT_REGISTER_TEST
(
FactSystemTestPX4
)
UT_REGISTER_TEST
(
FactSystemTestPX4
)
...
@@ -60,6 +61,7 @@ UT_REGISTER_TEST(CameraSectionTest)
...
@@ -60,6 +61,7 @@ UT_REGISTER_TEST(CameraSectionTest)
UT_REGISTER_TEST
(
SpeedSectionTest
)
UT_REGISTER_TEST
(
SpeedSectionTest
)
UT_REGISTER_TEST
(
PlanMasterControllerTest
)
UT_REGISTER_TEST
(
PlanMasterControllerTest
)
UT_REGISTER_TEST
(
MissionSettingsTest
)
UT_REGISTER_TEST
(
MissionSettingsTest
)
UT_REGISTER_TEST
(
QGCMapPolygonTest
)
// List of unit test which are currently disabled.
// List of unit test which are currently disabled.
// If disabling a new test, include reason in comment.
// 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