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
0306941d
Commit
0306941d
authored
Apr 28, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1515 from DonLakeFlyer/MockLink
MockLink now part of all debug builds
parents
5c4d513d
72597a5c
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
33 additions
and
30 deletions
+33
-30
QGCApplication.pro
QGCApplication.pro
+12
-4
qgroundcontrol.qrc
qgroundcontrol.qrc
+1
-1
QGCApplication.cc
src/QGCApplication.cc
+9
-2
LinkConfiguration.cc
src/comm/LinkConfiguration.cc
+3
-9
LinkConfiguration.h
src/comm/LinkConfiguration.h
+1
-1
LinkManager.cc
src/comm/LinkManager.cc
+2
-6
LinkManager.h
src/comm/LinkManager.h
+1
-3
MockLink.cc
src/comm/MockLink.cc
+0
-0
MockLink.h
src/comm/MockLink.h
+0
-0
MockLink.params
src/comm/MockLink.params
+0
-0
MockLinkMissionItemHandler.cc
src/comm/MockLinkMissionItemHandler.cc
+0
-0
MockLinkMissionItemHandler.h
src/comm/MockLinkMissionItemHandler.h
+0
-0
QGCCommConfiguration.cc
src/ui/QGCCommConfiguration.cc
+2
-2
QGCCommConfiguration.h
src/ui/QGCCommConfiguration.h
+1
-1
QGCLinkConfiguration.cc
src/ui/QGCLinkConfiguration.cc
+1
-1
No files found.
QGCApplication.pro
View file @
0306941d
...
...
@@ -357,6 +357,12 @@ HEADERS += \
src
/
ViewWidgets
/
ViewWidgetController
.
h
\
src
/
Waypoint
.
h
\
DebugBuild
{
HEADERS
+=
\
src
/
comm
/
MockLink
.
h
\
src
/
comm
/
MockLinkMissionItemHandler
.
h
}
!
AndroidBuild
{
HEADERS
+=
\
src
/
input
/
JoystickInput
.
h
\
...
...
@@ -486,6 +492,12 @@ SOURCES += \
src
/
ViewWidgets
/
ViewWidgetController
.
cc
\
src
/
Waypoint
.
cc
\
DebugBuild
{
SOURCES
+=
\
src
/
comm
/
MockLink
.
cc
\
src
/
comm
/
MockLinkMissionItemHandler
.
cc
}
!
AndroidBuild
{
SOURCES
+=
\
src
/
input
/
JoystickInput
.
cc
\
...
...
@@ -529,8 +541,6 @@ HEADERS += \
src
/
qgcunittest
/
MainWindowTest
.
h
\
src
/
qgcunittest
/
MavlinkLogTest
.
h
\
src
/
qgcunittest
/
MessageBoxTest
.
h
\
src
/
qgcunittest
/
MockLink
.
h
\
src
/
qgcunittest
/
MockLinkMissionItemHandler
.
h
\
src
/
qgcunittest
/
PX4RCCalibrationTest
.
h
\
src
/
qgcunittest
/
UnitTest
.
h
\
src
/
VehicleSetup
/
SetupViewTest
.
h
\
...
...
@@ -549,8 +559,6 @@ SOURCES += \
src
/
qgcunittest
/
MainWindowTest
.
cc
\
src
/
qgcunittest
/
MavlinkLogTest
.
cc
\
src
/
qgcunittest
/
MessageBoxTest
.
cc
\
src
/
qgcunittest
/
MockLink
.
cc
\
src
/
qgcunittest
/
MockLinkMissionItemHandler
.
cc
\
src
/
qgcunittest
/
PX4RCCalibrationTest
.
cc
\
src
/
qgcunittest
/
UnitTest
.
cc
\
src
/
VehicleSetup
/
SetupViewTest
.
cc
\
...
...
qgroundcontrol.qrc
View file @
0306941d
<RCC>
<qresource prefix="/unittest">
<file alias="MockLink.params">src/
qgcunittest
/MockLink.params</file>
<file alias="MockLink.params">src/
comm
/MockLink.params</file>
<file alias="FactSystemTest.qml">src/FactSystem/FactSystemTest.qml</file>
</qresource>
...
...
src/QGCApplication.cc
View file @
0306941d
...
...
@@ -108,6 +108,11 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting) :
setAttribute
(
Qt
::
AA_DontCreateNativeWidgetSiblings
);
#endif
#ifdef __android__
QLoggingCategory
::
setFilterRules
(
QStringLiteral
(
"*Log.debug=false"
));
#endif
#ifndef __android__
#ifdef QT_DEBUG
// First thing we want to do is set up the qtlogging.ini file. If it doesn't already exist we copy
// it to the correct location. This way default debug builds will have logging turned off.
...
...
@@ -137,9 +142,9 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting) :
if
(
loggingFile
.
open
(
QIODevice
::
WriteOnly
|
QIODevice
::
Text
))
{
QTextStream
out
(
&
loggingFile
);
out
<<
"[Rules]
\n
"
;
out
<<
"*Log=false
\n
"
;
out
<<
"*Log
.debug
=false
\n
"
;
foreach
(
QString
category
,
QGCLoggingCategoryRegister
::
instance
()
->
registeredCategories
())
{
out
<<
category
<<
"=false
\n
"
;
out
<<
category
<<
"
.debug
=false
\n
"
;
}
}
else
{
qDebug
()
<<
"Unable to create logging file"
<<
QString
(
qtLoggingFile
)
<<
"in"
<<
iniFileLocation
;
...
...
@@ -147,7 +152,9 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting) :
}
}
#endif
#endif
// Set application information
if
(
_runningUnitTests
)
{
// We don't want unit tests to use the same QSettings space as the normal app. So we tweak the app
...
...
src/comm/LinkConfiguration.cc
View file @
0306941d
...
...
@@ -32,11 +32,9 @@ This file is part of the QGROUNDCONTROL project
#include "UDPLink.h"
#include "TCPLink.h"
#ifdef UNITTEST_BUILD
#ifndef __android__
#ifdef QT_DEBUG
#include "MockLink.h"
#endif
#endif
#define LINK_SETTING_ROOT "LinkConfigurations"
...
...
@@ -93,12 +91,10 @@ LinkConfiguration* LinkConfiguration::createSettings(int type, const QString& na
case
LinkConfiguration
:
:
TypeTcp
:
config
=
new
TCPConfiguration
(
name
);
break
;
#ifdef UNITTEST_BUILD
#ifndef __android__
#ifdef QT_DEBUG
case
LinkConfiguration
:
:
TypeMock
:
config
=
new
MockConfiguration
(
name
);
break
;
#endif
#endif
}
return
config
;
...
...
@@ -121,12 +117,10 @@ LinkConfiguration* LinkConfiguration::duplicateSettings(LinkConfiguration* sourc
case
TypeTcp
:
dupe
=
new
TCPConfiguration
(
dynamic_cast
<
TCPConfiguration
*>
(
source
));
break
;
#ifdef UNITTEST_BUILD
#ifndef __android__
#ifdef QT_DEBUG
case
TypeMock
:
dupe
=
new
MockConfiguration
(
dynamic_cast
<
MockConfiguration
*>
(
source
));
break
;
#endif
#endif
}
return
dupe
;
...
...
src/comm/LinkConfiguration.h
View file @
0306941d
...
...
@@ -49,7 +49,7 @@ public:
TypeXbee, ///< XBee Proprietary Link
TypeOpal, ///< Opal-RT Link
#endif
#ifdef
UNITTEST_BUILD
#ifdef
QT_DEBUG
TypeMock
,
///< Mock Link for Unitesting
#endif
TypeLast
// Last type value (type >= TypeLast == invalid)
...
...
src/comm/LinkManager.cc
View file @
0306941d
...
...
@@ -88,12 +88,10 @@ LinkInterface* LinkManager::createConnectedLink(LinkConfiguration* config)
case
LinkConfiguration
:
:
TypeTcp
:
pLink
=
new
TCPLink
(
dynamic_cast
<
TCPConfiguration
*>
(
config
));
break
;
#ifdef UNITTEST_BUILD
#ifndef __android__
#ifdef QT_DEBUG
case
LinkConfiguration
:
:
TypeMock
:
pLink
=
new
MockLink
(
dynamic_cast
<
MockConfiguration
*>
(
config
));
break
;
#endif
#endif
}
if
(
pLink
)
{
...
...
@@ -384,13 +382,11 @@ void LinkManager::loadLinkConfigurationList()
pLink
=
(
LinkConfiguration
*
)
new
TCPConfiguration
(
name
);
pLink
->
setPreferred
(
preferred
);
break
;
#ifdef UNITTEST_BUILD
#ifndef __android__
#ifdef QT_DEBUG
case
LinkConfiguration
:
:
TypeMock
:
pLink
=
(
LinkConfiguration
*
)
new
MockConfiguration
(
name
);
pLink
->
setPreferred
(
false
);
break
;
#endif
#endif
}
if
(
pLink
)
{
...
...
src/comm/LinkManager.h
View file @
0306941d
...
...
@@ -39,11 +39,9 @@ This file is part of the PIXHAWK project
#include "UDPLink.h"
#include "TCPLink.h"
#ifdef UNITTEST_BUILD
#ifndef __android__
#ifdef QT_DEBUG
#include "MockLink.h"
#endif
#endif
#include "ProtocolInterface.h"
#include "QGCSingleton.h"
...
...
src/
qgcunittest
/MockLink.cc
→
src/
comm
/MockLink.cc
View file @
0306941d
File moved
src/
qgcunittest
/MockLink.h
→
src/
comm
/MockLink.h
View file @
0306941d
File moved
src/
qgcunittest
/MockLink.params
→
src/
comm
/MockLink.params
View file @
0306941d
File moved
src/
qgcunittest
/MockLinkMissionItemHandler.cc
→
src/
comm
/MockLinkMissionItemHandler.cc
View file @
0306941d
File moved
src/
qgcunittest
/MockLinkMissionItemHandler.h
→
src/
comm
/MockLinkMissionItemHandler.h
View file @
0306941d
File moved
src/ui/QGCCommConfiguration.cc
View file @
0306941d
...
...
@@ -48,7 +48,7 @@ QGCCommConfiguration::QGCCommConfiguration(QWidget *parent, LinkConfiguration *c
_ui
->
typeCombo
->
addItem
(
tr
(
"Serial"
),
LinkConfiguration
::
TypeSerial
);
_ui
->
typeCombo
->
addItem
(
tr
(
"UDP"
),
LinkConfiguration
::
TypeUdp
);
_ui
->
typeCombo
->
addItem
(
tr
(
"TCP"
),
LinkConfiguration
::
TypeTcp
);
#ifdef
UNITTEST_BUILD
#ifdef
QT_DEBUG
_ui
->
typeCombo
->
addItem
(
tr
(
"Mock"
),
LinkConfiguration
::
TypeMock
);
#endif
...
...
@@ -134,7 +134,7 @@ void QGCCommConfiguration::_loadTypeConfigWidget(int type)
_ui
->
typeCombo
->
setCurrentIndex
(
_ui
->
typeCombo
->
findData
(
LinkConfiguration
::
TypeTcp
));
}
break
;
#ifdef
UNITTEST_BUILD
#ifdef
QT_DEBUG
case
LinkConfiguration
:
:
TypeMock
:
{
_ui
->
linkScrollArea
->
setWidget
(
NULL
);
_ui
->
linkGroupBox
->
setTitle
(
tr
(
"Mock Link"
));
...
...
src/ui/QGCCommConfiguration.h
View file @
0306941d
...
...
@@ -54,7 +54,7 @@ public:
QGC_LINK_TCP
,
QGC_LINK_SIMULATION
,
QGC_LINK_FORWARDING
,
#ifdef
UNITTEST_BUILD
#ifdef
QT_DEBUG
QGC_LINK_MOCK
,
#endif
#ifdef QGC_XBEE_ENABLED
...
...
src/ui/QGCLinkConfiguration.cc
View file @
0306941d
...
...
@@ -158,7 +158,7 @@ void QGCLinkConfiguration::_fixUnnamed(LinkConfiguration* config)
}
}
break
;
#ifdef
UNITTEST_BUILD
#ifdef
QT_DEBUG
case
LinkConfiguration
:
:
TypeMock
:
config
->
setName
(
QString
(
"Mock Link"
));
...
...
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