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
1691530a
Commit
1691530a
authored
Mar 04, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1320 from DonLakeFlyer/UTFixes
Unit Test fixes
parents
278871b8
e278b23b
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
47 additions
and
48 deletions
+47
-48
FlightModeConfigTest.cc
src/AutoPilotPlugins/PX4/Tests/FlightModeConfigTest.cc
+3
-1
SetupViewTest.cc
src/VehicleSetup/SetupViewTest.cc
+10
-22
SetupViewTest.h
src/VehicleSetup/SetupViewTest.h
+3
-1
MainWindowTest.cc
src/qgcunittest/MainWindowTest.cc
+17
-17
MainWindowTest.h
src/qgcunittest/MainWindowTest.h
+4
-1
MainWindow.cc
src/ui/MainWindow.cc
+1
-3
MainWindow.h
src/ui/MainWindow.h
+5
-0
MainToolBar.cc
src/ui/toolbar/MainToolBar.cc
+3
-2
MainToolBar.h
src/ui/toolbar/MainToolBar.h
+1
-1
No files found.
src/AutoPilotPlugins/PX4/Tests/FlightModeConfigTest.cc
View file @
1691530a
...
...
@@ -31,7 +31,9 @@
///
/// @author Don Gagne <don@thegagnes.com>
UT_REGISTER_TEST
(
FlightModeConfigTest
)
// Turned off due to signletonn shutdown sequencing problem. Also since FlightMode config is
// being re-written this test will need to be re-written as well.
//UT_REGISTER_TEST(FlightModeConfigTest)
FlightModeConfigTest
::
FlightModeConfigTest
(
void
)
:
_mockUASManager
(
NULL
),
...
...
src/VehicleSetup/SetupViewTest.cc
View file @
1691530a
...
...
@@ -28,10 +28,11 @@
#include "MockLink.h"
#include "QGCMessageBox.h"
// TODO: This is not working in Windows. Needs to be updated for new tool bar any way.
//UT_REGISTER_TEST(SetupViewTest)
UT_REGISTER_TEST
(
SetupViewTest
)
SetupViewTest
::
SetupViewTest
(
void
)
SetupViewTest
::
SetupViewTest
(
void
)
:
_mainWindow
(
NULL
),
_mainToolBar
(
NULL
)
{
}
...
...
@@ -42,6 +43,9 @@ void SetupViewTest::init(void)
_mainWindow
=
MainWindow
::
_create
(
NULL
);
Q_CHECK_PTR
(
_mainWindow
);
_mainToolBar
=
_mainWindow
->
getMainToolBar
();
Q_ASSERT
(
_mainToolBar
);
}
void
SetupViewTest
::
cleanup
(
void
)
...
...
@@ -64,26 +68,10 @@ void SetupViewTest::_clickThrough_test(void)
linkMgr
->
connectLink
(
link
);
QTest
::
qWait
(
5000
);
// Give enough time for UI to settle and heartbeats to go through
// Find the Setup button and click it
// Tool Bar is now a QQuickWidget and cannot be manipulated like below
#if 0
QGCToolBar* toolbar = _mainWindow->findChild<QGCToolBar*>();
Q_ASSERT(toolbar);
QList<QToolButton*> buttons = toolbar->findChildren<QToolButton*>();
QToolButton* setupButton = NULL;
foreach(QToolButton* button, buttons) {
if (button->text() == "Setup") {
setupButton = button;
break;
}
}
Q_ASSERT(setupButton);
QTest::mouseClick(setupButton, Qt::LeftButton);
// Switch to the Setup view
_mainToolBar
->
onSetupView
();
QTest
::
qWait
(
1000
);
#endif
// Click through all the setup buttons
// FIXME: NYI
...
...
src/VehicleSetup/SetupViewTest.h
View file @
1691530a
...
...
@@ -29,6 +29,7 @@
#include "UnitTest.h"
#include "MainWindow.h"
#include "MainToolBar.h"
/// Click through test for Setup View buttons
class
SetupViewTest
:
public
UnitTest
...
...
@@ -45,7 +46,8 @@ private slots:
void
_clickThrough_test
(
void
);
private:
MainWindow
*
_mainWindow
;
MainWindow
*
_mainWindow
;
MainToolBar
*
_mainToolBar
;
};
#endif
src/qgcunittest/MainWindowTest.cc
View file @
1691530a
...
...
@@ -31,10 +31,11 @@
#include "MockLink.h"
#include "QGCMessageBox.h"
// TODO: This needs to be changed to accomodate the new QML based tool bar
// UT_REGISTER_TEST(MainWindowTest)
UT_REGISTER_TEST
(
MainWindowTest
)
MainWindowTest
::
MainWindowTest
(
void
)
MainWindowTest
::
MainWindowTest
(
void
)
:
_mainWindow
(
NULL
),
_mainToolBar
(
NULL
)
{
}
...
...
@@ -45,6 +46,9 @@ void MainWindowTest::init(void)
_mainWindow
=
MainWindow
::
_create
(
NULL
);
Q_CHECK_PTR
(
_mainWindow
);
_mainToolBar
=
_mainWindow
->
getMainToolBar
();
Q_ASSERT
(
_mainToolBar
);
}
void
MainWindowTest
::
cleanup
(
void
)
...
...
@@ -67,21 +71,17 @@ void MainWindowTest::_connectWindowClose_test(MAV_AUTOPILOT autopilot)
linkMgr
->
connectLink
(
link
);
QTest
::
qWait
(
5000
);
// Give enough time for UI to settle and heartbeats to go through
// Tool Bar is now a QQuickWidget and cannot be manipulated like below
#if 0
// Click through all top level toolbar buttons
QGCToolBar* toolbar = _mainWindow->findChild<QGCToolBar*>();
Q_ASSERT(toolbar);
// Cycle through all the top level views
_mainToolBar
->
onSetupView
();
QTest
::
qWait
(
1000
);
_mainToolBar
->
onPlanView
();
QTest
::
qWait
(
1000
);
_mainToolBar
->
onFlyView
();
QTest
::
qWait
(
1000
);
_mainToolBar
->
onAnalyzeView
();
QTest
::
qWait
(
1000
);
QList<QToolButton*> buttons = toolbar->findChildren<QToolButton*>();
foreach(QToolButton* button, buttons) {
if (!button->menu()) {
QTest::mouseClick(button, Qt::LeftButton);
QTest::qWait(1000);
}
}
#endif
// On MainWindow close we should get a message box telling the user to disconnect first. Cancel should do nothing.
setExpectedMessageBox
(
QGCMessageBox
::
Cancel
);
_mainWindow
->
close
();
...
...
src/qgcunittest/MainWindowTest.h
View file @
1691530a
...
...
@@ -31,6 +31,7 @@
#include "UnitTest.h"
#include "MainWindow.h"
#include "MainToolBar.h"
class
MainWindowTest
:
public
UnitTest
{
...
...
@@ -48,7 +49,9 @@ private slots:
private:
void
_connectWindowClose_test
(
MAV_AUTOPILOT
autopilot
);
MainWindow
*
_mainWindow
;
MainWindow
*
_mainWindow
;
MainToolBar
*
_mainToolBar
;
};
#endif
src/ui/MainWindow.cc
View file @
1691530a
...
...
@@ -171,9 +171,7 @@ MainWindow::MainWindow(QSplashScreen* splashScreen)
QDockWidget
*
widget
=
new
QDockWidget
(
this
);
widget
->
setObjectName
(
"ToolBarDockWidget"
);
qmlRegisterType
<
MainToolBar
>
(
"QGroundControl.MainToolBar"
,
1
,
0
,
"MainToolBar"
);
_mainToolBar
=
new
MainToolBar
();
_mainToolBar
->
setParent
(
widget
);
_mainToolBar
->
setVisible
(
true
);
_mainToolBar
=
new
MainToolBar
(
widget
);
widget
->
setWidget
(
_mainToolBar
);
widget
->
setFeatures
(
QDockWidget
::
NoDockWidgetFeatures
);
widget
->
setTitleBarWidget
(
new
QWidget
(
this
));
// Disables the title bar
...
...
src/ui/MainWindow.h
View file @
1691530a
...
...
@@ -125,6 +125,11 @@ public:
/// @brief Restore (and connects) the last used connection (if any)
void
restoreLastUsedConnection
();
#ifdef UNITTEST_BUILD
// Returns a pointer to the MainToolBar so that unit tests can change views.
MainToolBar
*
getMainToolBar
(
void
)
{
return
_mainToolBar
;
}
#endif
public
slots
:
...
...
src/ui/toolbar/MainToolBar.cc
View file @
1691530a
...
...
@@ -35,8 +35,9 @@ This file is part of the QGROUNDCONTROL project
#include "UASMessageHandler.h"
#include "UASMessageView.h"
MainToolBar
::
MainToolBar
()
:
_mav
(
NULL
)
MainToolBar
::
MainToolBar
(
QWidget
*
parent
)
:
QGCQmlWidgetHolder
(
parent
)
,
_mav
(
NULL
)
,
_toolBar
(
NULL
)
,
_currentView
(
ViewNone
)
,
_batteryVoltage
(
0.0
)
...
...
src/ui/toolbar/MainToolBar.h
View file @
1691530a
...
...
@@ -42,7 +42,7 @@ class MainToolBar : public QGCQmlWidgetHolder
Q_ENUMS
(
ViewType_t
)
Q_ENUMS
(
MessageType_t
)
public:
MainToolBar
();
MainToolBar
(
QWidget
*
parent
=
NULL
);
~
MainToolBar
();
typedef
enum
{
...
...
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