Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
89de2ae2
Commit
89de2ae2
authored
Nov 29, 2014
by
Don Gagne
Browse files
Fix constructor ordering bug
parent
91abffc0
Changes
2
Hide whitespace changes
Inline
Side-by-side
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
Supports
Markdown
0%
Try again
or
attach a new 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