Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linphone-desktop
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
Administrator
linphone-desktop
Commits
8ea7ec79
Commit
8ea7ec79
authored
Jul 20, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(tests): add AssistantViewTest
parent
651d3103
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
114 additions
and
2 deletions
+114
-2
CMakeLists.txt
CMakeLists.txt
+2
-0
TestUtils.hpp
src/tests/TestUtils.hpp
+5
-0
AssistantViewTest.cpp
src/tests/assistant-view/AssistantViewTest.cpp
+50
-0
AssistantViewTest.hpp
src/tests/assistant-view/AssistantViewTest.hpp
+41
-0
MainViewTest.cpp
src/tests/main-view/MainViewTest.cpp
+4
-2
MainViewTest.hpp
src/tests/main-view/MainViewTest.hpp
+5
-0
main.cpp
src/tests/main.cpp
+2
-0
SelfTest.hpp
src/tests/self-test/SelfTest.hpp
+5
-0
No files found.
CMakeLists.txt
View file @
8ea7ec79
...
...
@@ -213,6 +213,8 @@ set(HEADERS
)
set
(
TESTS
src/tests/assistant-view/AssistantViewTest.cpp
src/tests/assistant-view/AssistantViewTest.hpp
src/tests/main-view/MainViewTest.cpp
src/tests/main-view/MainViewTest.hpp
src/tests/self-test/SelfTest.cpp
...
...
src/tests/TestUtils.hpp
View file @
8ea7ec79
...
...
@@ -20,6 +20,9 @@
* Author: Ronan Abhamon
*/
#ifndef TEST_UTILS_H_
#define TEST_UTILS_H_
#include <QQuickItem>
#include <QQuickWindow>
...
...
@@ -42,3 +45,5 @@ namespace TestUtils {
QQuickItem
*
getVirtualWindowContent
(
const
QQuickWindow
*
window
);
}
#endif // ifndef TEST_UTILS_H_
src/tests/assistant-view/AssistantViewTest.cpp
0 → 100644
View file @
8ea7ec79
/*
* AssistantViewTest.cpp
* Copyright (C) 2017 Belledonne Communications, Grenoble, France
*
* This program 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 2
* of the License, or (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Created on: July 20, 2017
* Author: Ronan Abhamon
*/
#include <QQmlProperty>
#include <QQuickItem>
#include <QSignalSpy>
#include <QTest>
#include "../../app/App.hpp"
#include "AssistantViewTest.hpp"
// =============================================================================
void
AssistantViewTest
::
showAssistantView
()
{
QQuickWindow
*
mainWindow
=
App
::
getInstance
()
->
getMainWindow
();
// Ensure home view is selected.
QQuickItem
*
contentLoader
=
mainWindow
->
findChild
<
QQuickItem
*>
(
"__contentLoader"
);
QVERIFY
(
contentLoader
);
QTest
::
mouseClick
(
mainWindow
,
Qt
::
LeftButton
,
Qt
::
KeyboardModifiers
(),
QPoint
(
110
,
100
));
// Show assistant view.
QSignalSpy
spyLoaderReady
(
contentLoader
,
SIGNAL
(
loaded
()));
QTest
::
mouseClick
(
mainWindow
,
Qt
::
LeftButton
,
Qt
::
KeyboardModifiers
(),
QPoint
(
705
,
485
));
QVERIFY
(
spyLoaderReady
.
count
()
==
1
);
QCOMPARE
(
QQmlProperty
::
read
(
contentLoader
,
"source"
).
toString
(),
QStringLiteral
(
"qrc:/ui/views/App/Main/Assistant.qml"
)
);
}
src/tests/assistant-view/AssistantViewTest.hpp
0 → 100644
View file @
8ea7ec79
/*
* AssistantViewTest.hpp
* Copyright (C) 2017 Belledonne Communications, Grenoble, France
*
* This program 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 2
* of the License, or (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Created on: July 20, 2017
* Author: Ronan Abhamon
*/
#ifndef ASSISTANT_VIEW_TEST_H_
#define ASSISTANT_VIEW_TEST_H_
#include <QObject>
// =============================================================================
class
AssistantViewTest
:
public
QObject
{
Q_OBJECT
;
public:
AssistantViewTest
()
=
default
;
~
AssistantViewTest
()
=
default
;
private
slots
:
void
showAssistantView
();
};
#endif // ifndef ASSISTANT_VIEW_TEST_H_
src/tests/main-view/MainViewTest.cpp
View file @
8ea7ec79
...
...
@@ -88,13 +88,15 @@ void MainViewTest::testMainMenuEntries_data () {
}
void
MainViewTest
::
testMainMenuEntries
()
{
QQuickItem
*
contentLoader
=
App
::
getInstance
()
->
getMainWindow
()
->
findChild
<
QQuickItem
*>
(
"__contentLoader"
);
QQuickWindow
*
mainWindow
=
App
::
getInstance
()
->
getMainWindow
();
QQuickItem
*
contentLoader
=
mainWindow
->
findChild
<
QQuickItem
*>
(
"__contentLoader"
);
QVERIFY
(
contentLoader
);
QSignalSpy
spyLoaderReady
(
contentLoader
,
SIGNAL
(
loaded
()));
QFETCH
(
int
,
y
);
QTest
::
mouseClick
(
App
::
getInstance
()
->
getMainWindow
()
,
Qt
::
LeftButton
,
Qt
::
KeyboardModifiers
(),
QPoint
(
110
,
y
));
QTest
::
mouseClick
(
mainWindow
,
Qt
::
LeftButton
,
Qt
::
KeyboardModifiers
(),
QPoint
(
110
,
y
));
QVERIFY
(
spyLoaderReady
.
count
()
==
1
);
QFETCH
(
QString
,
source
);
...
...
src/tests/main-view/MainViewTest.hpp
View file @
8ea7ec79
...
...
@@ -20,6 +20,9 @@
* Author: Ronan Abhamon
*/
#ifndef MAIN_VIEW_TEST_H_
#define MAIN_VIEW_TEST_H_
#include <QObject>
// =============================================================================
...
...
@@ -39,3 +42,5 @@ private slots:
void
testMainMenuEntries_data
();
void
testMainMenuEntries
();
};
#endif // ifndef MAIN_VIEW_TEST_H_
src/tests/main.cpp
View file @
8ea7ec79
...
...
@@ -26,6 +26,7 @@
#include "../app/AppController.hpp"
#include "../utils/Utils.hpp"
#include "assistant-view/AssistantViewTest.hpp"
#include "main-view/MainViewTest.hpp"
#include "self-test/SelfTest.hpp"
...
...
@@ -33,6 +34,7 @@
static
QHash
<
QString
,
QObject
*>
initializeTests
()
{
QHash
<
QString
,
QObject
*>
hash
;
hash
[
"assistant-view"
]
=
new
AssistantViewTest
();
hash
[
"main-view"
]
=
new
MainViewTest
();
return
hash
;
}
...
...
src/tests/self-test/SelfTest.hpp
View file @
8ea7ec79
...
...
@@ -20,6 +20,9 @@
* Author: Ronan Abhamon
*/
#ifndef SELF_TEST_H_
#define SELF_TEST_H_
#include <QObject>
// =============================================================================
...
...
@@ -33,3 +36,5 @@ public:
private
slots
:
void
checkAppStartup
();
};
#endif // ifndef SELF_TEST_H_
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