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
8ffe06fe
Commit
8ffe06fe
authored
Dec 05, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use new MockLink start methods
parent
1bf286ac
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
8 deletions
+26
-8
UnitTest.cc
src/qgcunittest/UnitTest.cc
+22
-6
UnitTest.h
src/qgcunittest/UnitTest.h
+2
-0
UnitTestList.cc
src/qgcunittest/UnitTestList.cc
+2
-2
No files found.
src/qgcunittest/UnitTest.cc
View file @
8ffe06fe
...
...
@@ -30,6 +30,7 @@
#include "QGCApplication.h"
#include "MAVLinkProtocol.h"
#include "MainWindow.h"
#include "Vehicle.h"
bool
UnitTest
::
_messageBoxRespondedTo
=
false
;
bool
UnitTest
::
_badResponseButton
=
false
;
...
...
@@ -46,6 +47,7 @@ UnitTest::UnitTest(void)
:
_linkManager
(
NULL
)
,
_mockLink
(
NULL
)
,
_mainWindow
(
NULL
)
,
_vehicle
(
NULL
)
,
_expectMissedFileDialog
(
false
)
,
_expectMissedMessageBox
(
false
)
,
_unitTestRun
(
false
)
...
...
@@ -111,6 +113,8 @@ void UnitTest::init(void)
connect
(
_linkManager
,
&
LinkManager
::
linkDeleted
,
this
,
&
UnitTest
::
_linkDeleted
);
}
_linkManager
->
restart
();
_messageBoxRespondedTo
=
false
;
_missedMessageBoxCount
=
0
;
_badResponseButton
=
false
;
...
...
@@ -369,17 +373,27 @@ void UnitTest::_connectMockLink(MAV_AUTOPILOT autopilot)
{
Q_ASSERT
(
!
_mockLink
);
_mockLink
=
new
MockLink
();
_mockLink
->
setFirmwareType
(
autopilot
);
_linkManager
->
_addLink
(
_mockLink
);
_linkManager
->
connectLink
(
_mockLink
);
switch
(
autopilot
)
{
case
MAV_AUTOPILOT_PX4
:
_mockLink
=
MockLink
::
startPX4MockLink
(
false
);
break
;
case
MAV_AUTOPILOT_ARDUPILOTMEGA
:
_mockLink
=
MockLink
::
startAPMArduCopterMockLink
(
false
);
break
;
case
MAV_AUTOPILOT_GENERIC
:
_mockLink
=
MockLink
::
startGenericMockLink
(
false
);
break
;
default:
qWarning
()
<<
"Type not supported"
;
break
;
}
// Wait for the Vehicle to get created
QSignalSpy
spyVehicle
(
qgcApp
()
->
toolbox
()
->
multiVehicleManager
(),
SIGNAL
(
parameterReadyVehicleAvailableChanged
(
bool
)));
QCOMPARE
(
spyVehicle
.
wait
(
5000
),
true
);
QVERIFY
(
qgcApp
()
->
toolbox
()
->
multiVehicleManager
()
->
parameterReadyVehicleAvailable
());
QVERIFY
(
qgcApp
()
->
toolbox
()
->
multiVehicleManager
()
->
activeVehicle
());
_vehicle
=
qgcApp
()
->
toolbox
()
->
multiVehicleManager
()
->
activeVehicle
();
QVERIFY
(
_vehicle
);
}
void
UnitTest
::
_disconnectMockLink
(
void
)
...
...
@@ -392,6 +406,8 @@ void UnitTest::_disconnectMockLink(void)
// Wait for link to go away
linkSpy
.
wait
(
1000
);
QCOMPARE
(
linkSpy
.
count
(),
1
);
_vehicle
=
NULL
;
}
}
...
...
src/qgcunittest/UnitTest.h
View file @
8ffe06fe
...
...
@@ -45,6 +45,7 @@ class QGCFileDialog;
class
LinkManager
;
class
MockLink
;
class
MainWindow
;
class
Vehicle
;
class
UnitTest
:
public
QObject
{
...
...
@@ -115,6 +116,7 @@ protected:
LinkManager
*
_linkManager
;
MockLink
*
_mockLink
;
MainWindow
*
_mainWindow
;
Vehicle
*
_vehicle
;
bool
_expectMissedFileDialog
;
// true: expect a missed file dialog, used for internal testing
bool
_expectMissedMessageBox
;
// true: expect a missed message box, used for internal testing
...
...
src/qgcunittest/UnitTestList.cc
View file @
8ffe06fe
...
...
@@ -33,10 +33,11 @@
#include "MessageBoxTest.h"
#include "MissionItemTest.h"
#include "MissionControllerTest.h"
#include "
PX4RCCalibration
Test.h"
#include "
RadioConfig
Test.h"
#include "SetupViewTest.h"
#include "MavlinkLogTest.h"
UT_REGISTER_TEST
(
SetupViewTest
)
UT_REGISTER_TEST
(
FactSystemTestGeneric
)
UT_REGISTER_TEST
(
FactSystemTestPX4
)
UT_REGISTER_TEST
(
FileDialogTest
)
...
...
@@ -48,7 +49,6 @@ UT_REGISTER_TEST(MessageBoxTest)
UT_REGISTER_TEST
(
MissionItemTest
)
UT_REGISTER_TEST
(
MissionControllerTest
)
UT_REGISTER_TEST
(
RadioConfigTest
)
UT_REGISTER_TEST
(
SetupViewTest
)
// 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