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
14f411da
Commit
14f411da
authored
Jun 09, 2020
by
Aleksey Kontsevich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Select vertex functionality test
parent
ce27d8fc
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
76 additions
and
4 deletions
+76
-4
QGCMapPolygonTest.cc
src/MissionManager/QGCMapPolygonTest.cc
+35
-0
QGCMapPolygonTest.h
src/MissionManager/QGCMapPolygonTest.h
+3
-2
QGCMapPolylineTest.cc
src/MissionManager/QGCMapPolylineTest.cc
+35
-0
QGCMapPolylineTest.h
src/MissionManager/QGCMapPolylineTest.h
+3
-2
No files found.
src/MissionManager/QGCMapPolygonTest.cc
View file @
14f411da
...
...
@@ -219,3 +219,38 @@ void QGCMapPolygonTest::_testKMLLoad(void)
QVERIFY
(
!
_mapPolygon
->
loadKMLOrSHPFile
(
QStringLiteral
(
":/unittest/PolygonBadCoordinatesNode.kml"
)));
checkExpectedMessageBox
();
}
void
QGCMapPolygonTest
::
_testSelectVertex
(
void
)
{
// Create polygon
foreach
(
auto
vertex
,
_polyPoints
)
{
_mapPolygon
->
appendVertex
(
vertex
);
}
QVERIFY
(
_mapPolygon
->
selectedVertex
()
==
-
1
);
QVERIFY
(
_mapPolygon
->
count
()
==
_polyPoints
.
count
());
// Test deselect
_mapPolygon
->
selectVertex
(
-
1
);
QVERIFY
(
_mapPolygon
->
selectedVertex
()
==
-
1
);
// Test out of bounds
_mapPolygon
->
selectVertex
(
_polyPoints
.
count
());
QVERIFY
(
_mapPolygon
->
selectedVertex
()
==
-
1
);
// Simple select test
_mapPolygon
->
selectVertex
(
_polyPoints
.
count
()
-
1
);
QVERIFY
(
_mapPolygon
->
selectedVertex
()
==
_polyPoints
.
count
()
-
1
);
// Keep selected test
_mapPolygon
->
selectVertex
(
0
);
_mapPolygon
->
removeVertex
(
_polyPoints
.
count
()
-
1
);
QVERIFY
(
_mapPolygon
->
selectedVertex
()
==
0
);
// Deselect if selected vertex removed
_mapPolygon
->
appendVertex
(
_polyPoints
[
_polyPoints
.
count
()
-
1
]);
_mapPolygon
->
selectVertex
(
_polyPoints
.
count
()
-
1
);
_mapPolygon
->
removeVertex
(
_polyPoints
.
count
()
-
1
);
QVERIFY
(
_mapPolygon
->
selectedVertex
()
==
-
1
);
// Shift selected index down if removed index < selected index
_mapPolygon
->
appendVertex
(
_polyPoints
[
_polyPoints
.
count
()
-
1
]);
_mapPolygon
->
selectVertex
(
_polyPoints
.
count
()
-
1
);
_mapPolygon
->
removeVertex
(
0
);
QVERIFY
(
_mapPolygon
->
selectedVertex
()
==
_mapPolygon
->
count
()
-
1
);
}
src/MissionManager/QGCMapPolygonTest.h
View file @
14f411da
...
...
@@ -17,18 +17,19 @@
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
);
void
_testKMLLoad
(
void
);
void
_testSelectVertex
(
void
);
private:
enum
{
...
...
src/MissionManager/QGCMapPolylineTest.cc
View file @
14f411da
...
...
@@ -200,3 +200,38 @@ void QGCMapPolylineTest::_testKMLLoad(void)
checkExpectedMessageBox();
}
#endif
void
QGCMapPolylineTest
::
_testSelectVertex
(
void
)
{
// Create polyline
foreach
(
auto
vertex
,
_linePoints
)
{
_mapPolyline
->
appendVertex
(
vertex
);
}
QVERIFY
(
_mapPolyline
->
selectedVertex
()
==
-
1
);
QVERIFY
(
_mapPolyline
->
count
()
==
_linePoints
.
count
());
// Test deselect
_mapPolyline
->
selectVertex
(
-
1
);
QVERIFY
(
_mapPolyline
->
selectedVertex
()
==
-
1
);
// Test out of bounds
_mapPolyline
->
selectVertex
(
_linePoints
.
count
());
QVERIFY
(
_mapPolyline
->
selectedVertex
()
==
-
1
);
// Simple select test
_mapPolyline
->
selectVertex
(
_linePoints
.
count
()
-
1
);
QVERIFY
(
_mapPolyline
->
selectedVertex
()
==
_linePoints
.
count
()
-
1
);
// Keep selected test
_mapPolyline
->
selectVertex
(
0
);
_mapPolyline
->
removeVertex
(
_linePoints
.
count
()
-
1
);
QVERIFY
(
_mapPolyline
->
selectedVertex
()
==
0
);
// Deselect if selected vertex removed
_mapPolyline
->
appendVertex
(
_linePoints
[
_linePoints
.
count
()
-
1
]);
_mapPolyline
->
selectVertex
(
_linePoints
.
count
()
-
1
);
_mapPolyline
->
removeVertex
(
_linePoints
.
count
()
-
1
);
QVERIFY
(
_mapPolyline
->
selectedVertex
()
==
-
1
);
// Shift selected index down if removed index < selected index
_mapPolyline
->
appendVertex
(
_linePoints
[
_linePoints
.
count
()
-
1
]);
_mapPolyline
->
selectVertex
(
_linePoints
.
count
()
-
1
);
_mapPolyline
->
removeVertex
(
0
);
QVERIFY
(
_mapPolyline
->
selectedVertex
()
==
_mapPolyline
->
count
()
-
1
);
}
src/MissionManager/QGCMapPolylineTest.h
View file @
14f411da
...
...
@@ -17,18 +17,19 @@
class
QGCMapPolylineTest
:
public
UnitTest
{
Q_OBJECT
public:
QGCMapPolylineTest
(
void
);
protected:
void
init
(
void
)
final
;
void
cleanup
(
void
)
final
;
private
slots
:
void
_testDirty
(
void
);
void
_testVertexManipulation
(
void
);
// void _testKMLLoad(void);
void
_testSelectVertex
(
void
);
private:
enum
{
...
...
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