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
89de2ae2
Commit
89de2ae2
authored
Nov 29, 2014
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix constructor ordering bug
parent
91abffc0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
11 deletions
+17
-11
UnitTest.cc
src/qgcunittest/UnitTest.cc
+13
-4
UnitTest.h
src/qgcunittest/UnitTest.h
+4
-7
No files found.
src/qgcunittest/UnitTest.cc
View file @
89de2ae2
...
...
@@ -33,7 +33,6 @@ bool UnitTest::_messageBoxRespondedTo = false;
bool
UnitTest
::
_badResponseButton
=
false
;
QMessageBox
::
StandardButton
UnitTest
::
_messageBoxResponseButton
=
QMessageBox
::
NoButton
;
int
UnitTest
::
_missedMessageBoxCount
=
0
;
UnitTest
::
UnitTestList_t
UnitTest
::
_tests
;
UnitTest
::
UnitTest
(
void
)
:
_unitTestRun
(
false
),
...
...
@@ -58,9 +57,11 @@ UnitTest::~UnitTest()
void
UnitTest
::
_addTest
(
QObject
*
test
)
{
Q_ASSERT
(
!
_tests
.
contains
(
test
));
QList
<
QObject
*>&
tests
=
_testList
();
Q_ASSERT
(
!
tests
.
contains
(
test
));
_
tests
.
append
(
test
);
tests
.
append
(
test
);
}
void
UnitTest
::
_unitTestCalled
(
void
)
...
...
@@ -68,11 +69,18 @@ void UnitTest::_unitTestCalled(void)
_unitTestRun
=
true
;
}
/// @brief Returns the list of unit tests.
QList
<
QObject
*>&
UnitTest
::
_testList
(
void
)
{
static
QList
<
QObject
*>
tests
;
return
tests
;
}
int
UnitTest
::
run
(
int
argc
,
char
*
argv
[],
QString
&
singleTest
)
{
int
ret
=
0
;
foreach
(
QObject
*
test
,
_test
s
)
{
foreach
(
QObject
*
test
,
_test
List
()
)
{
if
(
singleTest
.
isEmpty
()
||
singleTest
==
test
->
objectName
())
{
ret
+=
QTest
::
qExec
(
test
,
argc
,
argv
);
}
...
...
@@ -196,3 +204,4 @@ QMessageBox::StandardButton UnitTest::_messageBox(QMessageBox::Icon icon, const
return
retButton
;
}
src/qgcunittest/UnitTest.h
View file @
89de2ae2
...
...
@@ -79,9 +79,9 @@ public:
// @param Expected failure response flags
void
checkExpectedMessageBox
(
int
expectFailFlags
=
expectFailNoFailure
);
//
Should only be called by UnitTestWrapper
//
/ @brief Adds a unit test to the list. Should only be called by UnitTestWrapper.
static
void
_addTest
(
QObject
*
test
);
protected
slots
:
// These are all pure virtuals to force the derived class to implement each one and in turn
...
...
@@ -124,7 +124,8 @@ private:
friend
class
QGCMessageBox
;
void
_unitTestCalled
(
void
);
static
QList
<
QObject
*>&
_testList
(
void
);
static
bool
_messageBoxRespondedTo
;
///< Message box was responded to
static
bool
_badResponseButton
;
///< Attempt to repond to expected message box with button not being displayed
static
QMessageBox
::
StandardButton
_messageBoxResponseButton
;
///< Response to next message box
...
...
@@ -135,10 +136,6 @@ private:
bool
_cleanupTestCaseCalled
;
///< true: UnitTest::_cleanupTestCase was called
bool
_initCalled
;
///< true: UnitTest::_init was called
bool
_cleanupCalled
;
///< true: UnitTest::_cleanup was called
typedef
QList
<
QObject
*>
UnitTestList_t
;
static
UnitTestList_t
_tests
;
};
template
<
class
T
>
...
...
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