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
95e74729
Commit
95e74729
authored
Jul 31, 2014
by
Don Gagne
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #786 from DonLakeFlyer/FileManagerUT
File manager Unit Test back on
parents
e4977186
2076d3d4
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
23 additions
and
4 deletions
+23
-4
.gitignore
.gitignore
+1
-0
qgroundcontrol.pro
qgroundcontrol.pro
+4
-2
MockMavlinkFileServer.cc
src/qgcunittest/MockMavlinkFileServer.cc
+1
-1
MultiSignalSpy.cc
src/qgcunittest/MultiSignalSpy.cc
+13
-0
MultiSignalSpy.h
src/qgcunittest/MultiSignalSpy.h
+2
-0
QGCUASFileManagerTest.cc
src/qgcunittest/QGCUASFileManagerTest.cc
+1
-0
TCPLinkTest.cc
src/qgcunittest/TCPLinkTest.cc
+1
-1
No files found.
.gitignore
View file @
95e74729
...
...
@@ -14,6 +14,7 @@ bin/*.exe
bin/*.txt
bin/mac
*pro.user*
.qmake.stash
qrc_*.cpp
*.Debug
*.Release
...
...
qgroundcontrol.pro
View file @
95e74729
...
...
@@ -767,7 +767,8 @@ HEADERS += \
src
/
qgcunittest
/
FlightModeConfigTest
.
h
\
src
/
qgcunittest
/
FlightGearTest
.
h
\
src
/
qgcunittest
/
TCPLinkTest
.
h
\
src
/
qgcunittest
/
TCPLoopBackServer
.
h
src
/
qgcunittest
/
TCPLoopBackServer
.
h
\
src
/
qgcunittest
/
QGCUASFileManagerTest
.
h
SOURCES
+=
\
src
/
qgcunittest
/
UASUnitTest
.
cc
\
...
...
@@ -779,4 +780,5 @@ SOURCES += \
src
/
qgcunittest
/
FlightModeConfigTest
.
cc
\
src
/
qgcunittest
/
FlightGearTest
.
cc
\
src
/
qgcunittest
/
TCPLinkTest
.
cc
\
src
/
qgcunittest
/
TCPLoopBackServer
.
cc
src
/
qgcunittest
/
TCPLoopBackServer
.
cc
\
src
/
qgcunittest
/
QGCUASFileManagerTest
.
cc
src/qgcunittest/MockMavlinkFileServer.cc
View file @
95e74729
...
...
@@ -281,7 +281,7 @@ void MockMavlinkFileServer::_emitResponse(QGCUASFileManager::Request* request)
request
->
hdr
.
crc32
=
QGCUASFileManager
::
crc32
(
request
);
mavlink_msg_encapsulated_data_pack
(
250
,
0
,
&
mavlinkMessage
,
0
/*_encdata_seq*/
,
(
uint8_t
*
)
request
);
mavlink_msg_encapsulated_data_pack
(
250
,
MAV_COMP_ID_IMU
,
&
mavlinkMessage
,
0
/*_encdata_seq*/
,
(
uint8_t
*
)
request
);
emit
messageReceived
(
NULL
,
mavlinkMessage
);
}
src/qgcunittest/MultiSignalSpy.cc
View file @
95e74729
...
...
@@ -96,6 +96,7 @@ bool MultiSignalSpy::checkSignalByMask(quint16 mask)
Q_ASSERT
(
spy
!=
NULL
);
if
(
spy
->
count
()
!=
1
)
{
_printSignalState
();
return
false
;
}
}
...
...
@@ -114,10 +115,12 @@ bool MultiSignalSpy::checkOnlySignalByMask(quint16 mask)
if
((
1
<<
i
)
&
mask
)
{
if
(
spy
->
count
()
!=
1
)
{
_printSignalState
();
return
false
;
}
}
else
{
if
(
spy
->
count
()
!=
0
)
{
_printSignalState
();
return
false
;
}
}
...
...
@@ -135,6 +138,7 @@ bool MultiSignalSpy::checkNoSignalByMask(quint16 mask)
Q_ASSERT
(
spy
!=
NULL
);
if
(
spy
->
count
()
!=
0
)
{
_printSignalState
();
return
false
;
}
}
...
...
@@ -232,3 +236,12 @@ bool MultiSignalSpy::waitForSignalByIndex(
return
spy
->
count
()
!=
0
;
}
void
MultiSignalSpy
::
_printSignalState
(
void
)
{
for
(
size_t
i
=
0
;
i
<
_cSignals
;
i
++
)
{
QSignalSpy
*
spy
=
_rgSpys
[
i
];
Q_ASSERT
(
spy
!=
NULL
);
qDebug
()
<<
"Signal index:"
<<
i
<<
"count:"
<<
spy
->
count
();
}
}
src/qgcunittest/MultiSignalSpy.h
View file @
95e74729
...
...
@@ -59,6 +59,8 @@ public:
private:
// QObject overrides
void
timerEvent
(
QTimerEvent
*
event
);
void
_printSignalState
(
void
);
QObject
*
_signalEmitter
;
const
char
**
_rgSignals
;
...
...
src/qgcunittest/QGCUASFileManagerTest.cc
View file @
95e74729
...
...
@@ -53,6 +53,7 @@ void QGCUASFileManagerUnitTest::init(void)
bool
connected
=
connect
(
&
_mockFileServer
,
SIGNAL
(
messageReceived
(
LinkInterface
*
,
mavlink_message_t
)),
_fileManager
,
SLOT
(
receiveMessage
(
LinkInterface
*
,
mavlink_message_t
)));
Q_ASSERT
(
connected
);
Q_UNUSED
(
connected
);
// Silent release build compiler warning
connected
=
connect
(
_fileManager
,
SIGNAL
(
statusMessage
(
const
QString
&
)),
this
,
SLOT
(
statusMessage
(
const
QString
&
)));
Q_ASSERT
(
connected
);
...
...
src/qgcunittest/TCPLinkTest.cc
View file @
95e74729
...
...
@@ -150,7 +150,7 @@ void TCPLinkUnitTest::_connectSucceed_test(void)
QCOMPARE
(
_link
->
connect
(),
true
);
// Make sure we get the two different connected signals
QCOMPARE
(
_multiSpy
->
waitForSignalByIndex
(
connectedSignalIndex
,
1000
),
true
);
QCOMPARE
(
_multiSpy
->
waitForSignalByIndex
(
connectedSignalIndex
,
1000
0
),
true
);
QCOMPARE
(
_multiSpy
->
checkOnlySignalByMask
(
connectedSignalMask
|
connected2SignalMask
),
true
);
QList
<
QVariant
>
arguments
=
_multiSpy
->
getSpyByIndex
(
connected2SignalIndex
)
->
takeFirst
();
QCOMPARE
(
arguments
.
at
(
0
).
toBool
(),
true
);
...
...
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