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
f029110b
Commit
f029110b
authored
Dec 27, 2013
by
Lorenz Meier
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #443 from DonLakeFlyer/UnitTest
Unit test changes
parents
e59fa155
f83b8b10
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
55 additions
and
77 deletions
+55
-77
qgcunittest.pro
qgcunittest.pro
+0
-35
qgroundcontrol.pri
qgroundcontrol.pri
+5
-5
qgroundcontrol.pro
qgroundcontrol.pro
+18
-3
main.cc
src/main.cc
+23
-1
AutoTest.h
src/qgcunittest/AutoTest.h
+1
-1
UASUnitTest.cc
src/qgcunittest/UASUnitTest.cc
+6
-3
UASUnitTest.h
src/qgcunittest/UASUnitTest.h
+2
-1
testSuite.cc
src/qgcunittest/testSuite.cc
+0
-28
No files found.
qgcunittest.pro
deleted
100644 → 0
View file @
e59fa155
# -------------------------------------------------
#
QGroundControl
-
Micro
Air
Vehicle
Groundstation
#
Please
see
our
website
at
<
http
://
qgroundcontrol
.
org
>
#
Maintainer
:
#
Lorenz
Meier
<
lm
@
inf
.
ethz
.
ch
>
#
(
c
)
2009
-
2011
QGroundControl
Developers
#
This
file
is
part
of
the
open
groundstation
project
#
QGroundControl
is
free
software
:
you
can
redistribute
it
and
/
or
modify
#
it
under
the
terms
of
the
GNU
General
Public
License
as
published
by
#
the
Free
Software
Foundation
,
either
version
3
of
the
License
,
or
#
(
at
your
option
)
any
later
version
.
#
QGroundControl
is
distributed
in
the
hope
that
it
will
be
useful
,
#
but
WITHOUT
ANY
WARRANTY
;
without
even
the
implied
warranty
of
#
MERCHANTABILITY
or
FITNESS
FOR
A
PARTICULAR
PURPOSE
.
See
the
#
GNU
General
Public
License
for
more
details
.
#
You
should
have
received
a
copy
of
the
GNU
General
Public
License
#
along
with
QGroundControl
.
If
not
,
see
<
http
://
www
.
gnu
.
org
/
licenses
/>.
#
-------------------------------------------------
TARGET
=
qgcunittest
QT
+=
testlib
QGCS_UNITTEST_OVERRIDE
=
true
include
(
qgroundcontrol
.
pro
)
TESTDIR
=
$$
BASEDIR
/
src
/
qgcunittest
HEADERS
+=
\
$$
TESTDIR
/
AutoTest
.
h
\
$$
TESTDIR
/
UASUnitTest
.
h
\
SOURCES
+=
\
$$
TESTDIR
/
testSuite
.
cc
\
$$
TESTDIR
/
UASUnitTest
.
cc
\ No newline at end of file
qgroundcontrol.pri
View file @
f029110b
...
...
@@ -175,7 +175,7 @@ linux-g++|linux-g++-64{
CONFIG -= console
DEFINES += __STDC_LIMIT_MACROS
release
{
CONFIG(release, debug|release)
{
DEFINES += QT_NO_DEBUG
}
...
...
@@ -429,11 +429,11 @@ win32-g++ {
debug
{
CONFIG(debug, debug|release)
{
CONFIG += console
}
release
{
CONFIG(release, debug|release)
{
CONFIG -= console
DEFINES += QT_NO_DEBUG
}
...
...
@@ -445,14 +445,14 @@ win32-g++ {
system(cp): {
# CP command is available, use it instead of copy / xcopy
message("Using cp to copy image and audio files to executable")
debug
{
CONFIG(debug, debug|release)
{
QMAKE_POST_LINK += && cp $$BASEDIR/libs/lib/sdl/win32/SDL.dll $$TARGETDIR/debug/SDL.dll
QMAKE_POST_LINK += && cp -r $$BASEDIR/files $$TARGETDIR/debug/files
QMAKE_POST_LINK += && cp -r $$BASEDIR/libs/mavlink $$TARGETDIR/debug/mavlink
QMAKE_POST_LINK += && cp -r $$BASEDIR/models $$TARGETDIR/debug/models
}
release
{
CONFIG(release, debug|release)
{
QMAKE_POST_LINK += && cp $$BASEDIR/libs/lib/sdl/win32/SDL.dll $$TARGETDIR/release/SDL.dll
QMAKE_POST_LINK += && cp -r $$BASEDIR/files $$TARGETDIR/release/files
QMAKE_POST_LINK += && cp -r $$BASEDIR/libs/mavlink $$TARGETDIR/release/mavlink
...
...
qgroundcontrol.pro
View file @
f029110b
...
...
@@ -30,7 +30,8 @@ QT += network \
phonon
\
webkit
\
sql
\
declarative
declarative
\
testlib
#
Setting
this
variable
allows
you
to
include
this
.
pro
file
in
another
such
that
#
you
can
set
your
own
TARGET
and
main
()
function
.
This
is
used
by
the
unit
test
...
...
@@ -43,11 +44,11 @@ isEmpty(QGCS_UNITTEST_OVERRIDE) {
BASEDIR
=
$$
{
IN_PWD
}
linux
-
g
++
|
linux
-
g
++-
64
{
debug
{
CONFIG
(
debug
,
debug
|
release
)
{
TARGETDIR
=
$$
{
OUT_PWD
}
/
debug
BUILDDIR
=
$$
{
OUT_PWD
}
/
build
-
debug
}
release
{
CONFIG
(
release
,
debug
|
release
)
{
TARGETDIR
=
$$
{
OUT_PWD
}
/
release
BUILDDIR
=
$$
{
OUT_PWD
}
/
build
-
release
}
...
...
@@ -736,6 +737,20 @@ SOURCES += \
src
/
ui
/
designer
/
QGCXYPlot
.
cc
\
src
/
ui
/
menuactionhelper
.
cpp
CONFIG
(
debug
,
debug
|
release
)
{
#
Unit
Test
sources
/
headers
go
here
INCLUDEPATH
+=
\
src
/
qgcunittest
HEADERS
+=
\
src
/
qgcunittest
/
AutoTest
.
h
\
src
/
qgcunittest
/
UASUnitTest
.
h
SOURCES
+=
\
src
/
qgcunittest
/
UASUnitTest
.
cc
}
#
Enable
Google
Earth
only
on
Mac
OS
and
Windows
with
Visual
Studio
compiler
macx
|
macx
-
g
++
|
macx
-
g
++
42
|
win32
-
msvc2008
|
win32
-
msvc2010
|
win32
-
msvc2012
::
SOURCES
+=
src
/
ui
/
map3D
/
QGCGoogleEarthView
.
cc
...
...
src/main.cc
View file @
f029110b
...
...
@@ -32,7 +32,7 @@ This file is part of the QGROUNDCONTROL project
#include "QGCCore.h"
#include "MainWindow.h"
#include "configuration.h"
#include "AutoTest.h"
/* SDL does ugly things to main() */
#ifdef main
...
...
@@ -69,6 +69,28 @@ int main(int argc, char *argv[])
qInstallMsgHandler
(
msgHandler
);
#endif
#ifdef QT_DEBUG
if
(
argc
>
1
&&
QString
(
argv
[
1
]).
compare
(
"--unittest"
,
Qt
::
CaseInsensitive
)
==
0
)
{
// Strip off extra command line args so QTest doesn't complain
for
(
int
i
=
1
;
i
<
argc
-
1
;
i
++
)
{
argv
[
i
]
=
argv
[
i
+
1
];
}
// Run the test
int
failures
=
AutoTest
::
run
(
argc
-
1
,
argv
);
if
(
failures
==
0
)
{
qDebug
()
<<
"ALL TESTS PASSED"
;
}
else
{
qDebug
()
<<
failures
<<
" TESTS FAILED!"
;
}
return
failures
;
}
#endif
QGCCore
*
core
=
NULL
;
int
val
;
bool
firstStart
=
true
;
...
...
src/qgcunittest/AutoTest.h
View file @
f029110b
...
...
@@ -51,7 +51,7 @@ namespace AutoTest
inline
int
run
(
int
argc
,
char
*
argv
[])
{
int
ret
=
0
;
Q
Core
Application
t
(
argc
,
argv
);
QApplication
t
(
argc
,
argv
);
foreach
(
QObject
*
test
,
testList
())
{
ret
+=
QTest
::
qExec
(
test
,
argc
,
argv
);
...
...
src/qgcunittest/UASUnitTest.cc
View file @
f029110b
...
...
@@ -147,9 +147,13 @@ void UASUnitTest::getLongitude_test()
{
QCOMPARE
(
uas
->
getLongitude
(),
0.0
);
}
void
UASUnitTest
::
getAltitude_test
()
void
UASUnitTest
::
getAltitude
AMSL
_test
()
{
QCOMPARE
(
uas
->
getAltitude
(),
0.0
);
QCOMPARE
(
uas
->
getAltitudeAMSL
(),
0.0
);
}
void
UASUnitTest
::
getAltitudeRelative_test
()
{
QCOMPARE
(
uas
->
getAltitudeRelative
(),
0.0
);
}
void
UASUnitTest
::
getRoll_test
()
{
...
...
@@ -316,7 +320,6 @@ void UASUnitTest::signalUASLink_test()
{
qDebug
()
<<
link
->
getName
();
qDebug
()
<<
QString
::
number
(
link
->
getId
());
qDebug
()
<<
QString
::
number
(
link
->
getNominalDataRate
());
QVERIFY
(
link
!=
NULL
);
uas
->
addLink
(
link
);
}
...
...
src/qgcunittest/UASUnitTest.h
View file @
f029110b
...
...
@@ -42,7 +42,8 @@ private slots:
void
getLocalZ_test
();
void
getLatitude_test
();
void
getLongitude_test
();
void
getAltitude_test
();
void
getAltitudeAMSL_test
();
void
getAltitudeRelative_test
();
void
getRoll_test
();
void
getPitch_test
();
void
getYaw_test
();
...
...
src/qgcunittest/testSuite.cc
deleted
100755 → 0
View file @
e59fa155
/**
* @author Rob Caldecott
* @note This was obtained from http://qtcreator.blogspot.com/2010/04/sample-multiple-unit-test-project.html
*
*/
#include "AutoTest.h"
#include <QDebug>
#if 1
// This is all you need to run all the tests
TEST_MAIN
#else
// Or supply your own main function
int
main
(
int
argc
,
char
*
argv
[])
{
int
failures
=
AutoTest
::
run
(
argc
,
argv
);
if
(
failures
==
0
)
{
qDebug
()
<<
"ALL TESTS PASSED"
;
}
else
{
qDebug
()
<<
failures
<<
" TESTS FAILED!"
;
}
return
failures
;
}
#endif
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