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
cd97639c
Commit
cd97639c
authored
Jun 03, 2017
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix section dirty bit handling
parent
859766f1
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
138 additions
and
0 deletions
+138
-0
qgroundcontrol.pro
qgroundcontrol.pro
+2
-0
MissionSettingsItem.cc
src/MissionManager/MissionSettingsItem.cc
+4
-0
MissionSettingsTest.cc
src/MissionManager/MissionSettingsTest.cc
+64
-0
MissionSettingsTest.h
src/MissionManager/MissionSettingsTest.h
+32
-0
SimpleMissionItemTest.cc
src/MissionManager/SimpleMissionItemTest.cc
+32
-0
SimpleMissionItemTest.h
src/MissionManager/SimpleMissionItemTest.h
+2
-0
UnitTestList.cc
src/qgcunittest/UnitTestList.cc
+2
-0
No files found.
qgroundcontrol.pro
View file @
cd97639c
...
...
@@ -398,6 +398,7 @@ DebugBuild { PX4FirmwarePlugin { PX4FirmwarePluginFactory { APMFirmwarePlugin {
src
/
MissionManager
/
MissionControllerTest
.
h
\
src
/
MissionManager
/
MissionItemTest
.
h
\
src
/
MissionManager
/
MissionManagerTest
.
h
\
src
/
MissionManager
/
MissionSettingsTest
.
h
\
src
/
MissionManager
/
PlanMasterControllerTest
.
h
\
src
/
MissionManager
/
SectionTest
.
h
\
src
/
MissionManager
/
SimpleMissionItemTest
.
h
\
...
...
@@ -431,6 +432,7 @@ DebugBuild { PX4FirmwarePlugin { PX4FirmwarePluginFactory { APMFirmwarePlugin {
src
/
MissionManager
/
MissionControllerTest
.
cc
\
src
/
MissionManager
/
MissionItemTest
.
cc
\
src
/
MissionManager
/
MissionManagerTest
.
cc
\
src
/
MissionManager
/
MissionSettingsTest
.
cc
\
src
/
MissionManager
/
PlanMasterControllerTest
.
cc
\
src
/
MissionManager
/
SectionTest
.
cc
\
src
/
MissionManager
/
SimpleMissionItemTest
.
cc
\
...
...
src/MissionManager/MissionSettingsItem.cc
View file @
cd97639c
...
...
@@ -80,6 +80,10 @@ void MissionSettingsItem::setDirty(bool dirty)
{
if
(
_dirty
!=
dirty
)
{
_dirty
=
dirty
;
if
(
!
dirty
)
{
_cameraSection
.
setDirty
(
false
);
_speedSection
.
setDirty
(
false
);
}
emit
dirtyChanged
(
_dirty
);
}
}
...
...
src/MissionManager/MissionSettingsTest.cc
0 → 100644
View file @
cd97639c
/****************************************************************************
*
* (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 "MissionSettingsTest.h"
#include "QGCApplication.h"
#include "QGroundControlQmlGlobal.h"
#include "SettingsManager.h"
MissionSettingsTest
::
MissionSettingsTest
(
void
)
:
_settingsItem
(
NULL
)
{
}
void
MissionSettingsTest
::
init
(
void
)
{
VisualMissionItemTest
::
init
();
_settingsItem
=
new
MissionSettingsItem
(
_offlineVehicle
,
this
);
}
void
MissionSettingsTest
::
cleanup
(
void
)
{
delete
_settingsItem
;
VisualMissionItemTest
::
cleanup
();
}
void
MissionSettingsTest
::
_testCameraSectionDirty
(
void
)
{
CameraSection
*
cameraSection
=
_settingsItem
->
cameraSection
();
QVERIFY
(
!
cameraSection
->
dirty
());
QVERIFY
(
!
_settingsItem
->
dirty
());
// Dirtying the camera section should also dirty the item
cameraSection
->
setDirty
(
true
);
QVERIFY
(
_settingsItem
->
dirty
());
// Clearing the dirty bit from the item should also clear the dirty bit on the camera section
_settingsItem
->
setDirty
(
false
);
QVERIFY
(
!
cameraSection
->
dirty
());
}
void
MissionSettingsTest
::
_testSpeedSectionDirty
(
void
)
{
SpeedSection
*
speedSection
=
_settingsItem
->
speedSection
();
QVERIFY
(
!
speedSection
->
dirty
());
QVERIFY
(
!
_settingsItem
->
dirty
());
// Dirtying the speed section should also dirty the item
speedSection
->
setDirty
(
true
);
QVERIFY
(
_settingsItem
->
dirty
());
// Clearing the dirty bit from the item should also clear the dirty bit on the camera section
_settingsItem
->
setDirty
(
false
);
QVERIFY
(
!
speedSection
->
dirty
());
}
src/MissionManager/MissionSettingsTest.h
0 → 100644
View file @
cd97639c
/****************************************************************************
*
* (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 "VisualMissionItemTest.h"
#include "MissionSettingsItem.h"
/// Unit test for SimpleMissionItem
class
MissionSettingsTest
:
public
VisualMissionItemTest
{
Q_OBJECT
public:
MissionSettingsTest
(
void
);
void
init
(
void
)
override
;
void
cleanup
(
void
)
override
;
private
slots
:
void
_testCameraSectionDirty
(
void
);
void
_testSpeedSectionDirty
(
void
);
private:
MissionSettingsItem
*
_settingsItem
;
};
src/MissionManager/SimpleMissionItemTest.cc
View file @
cd97639c
...
...
@@ -256,6 +256,38 @@ void SimpleMissionItemTest::_testSignals(void)
QVERIFY
(
_spyVisualItem
->
checkSignalsByMask
(
commandNameChangedMask
|
dirtyChangedMask
|
coordinateChangedMask
));
}
void
SimpleMissionItemTest
::
_testCameraSectionDirty
(
void
)
{
CameraSection
*
cameraSection
=
_simpleItem
->
cameraSection
();
QVERIFY
(
!
cameraSection
->
dirty
());
QVERIFY
(
!
_simpleItem
->
dirty
());
// Dirtying the camera section should also dirty the item
cameraSection
->
setDirty
(
true
);
QVERIFY
(
_simpleItem
->
dirty
());
// Clearing the dirty bit from the item should also clear the dirty bit on the camera section
_simpleItem
->
setDirty
(
false
);
QVERIFY
(
!
cameraSection
->
dirty
());
}
void
SimpleMissionItemTest
::
_testSpeedSectionDirty
(
void
)
{
SpeedSection
*
speedSection
=
_simpleItem
->
speedSection
();
QVERIFY
(
!
speedSection
->
dirty
());
QVERIFY
(
!
_simpleItem
->
dirty
());
// Dirtying the speed section should also dirty the item
speedSection
->
setDirty
(
true
);
QVERIFY
(
_simpleItem
->
dirty
());
// Clearing the dirty bit from the item should also clear the dirty bit on the camera section
_simpleItem
->
setDirty
(
false
);
QVERIFY
(
!
speedSection
->
dirty
());
}
void
SimpleMissionItemTest
::
_testCameraSection
(
void
)
{
// No gimbal yaw to start with
...
...
src/MissionManager/SimpleMissionItemTest.h
View file @
cd97639c
...
...
@@ -27,6 +27,8 @@ private slots:
void
_testSignals
(
void
);
void
_testEditorFacts
(
void
);
void
_testDefaultValues
(
void
);
void
_testCameraSectionDirty
(
void
);
void
_testSpeedSectionDirty
(
void
);
void
_testCameraSection
(
void
);
void
_testSpeedSection
(
void
);
...
...
src/qgcunittest/UnitTestList.cc
View file @
cd97639c
...
...
@@ -36,6 +36,7 @@
#include "CameraSectionTest.h"
#include "SpeedSectionTest.h"
#include "PlanMasterControllerTest.h"
#include "MissionSettingsTest.h"
UT_REGISTER_TEST
(
FactSystemTestGeneric
)
UT_REGISTER_TEST
(
FactSystemTestPX4
)
...
...
@@ -58,6 +59,7 @@ UT_REGISTER_TEST(SurveyMissionItemTest)
UT_REGISTER_TEST
(
CameraSectionTest
)
UT_REGISTER_TEST
(
SpeedSectionTest
)
UT_REGISTER_TEST
(
PlanMasterControllerTest
)
UT_REGISTER_TEST
(
MissionSettingsTest
)
// 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