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
c7509acd
Commit
c7509acd
authored
Jul 18, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(tests/MainViewTest): add a `showManageAccountsPopup` method
parent
4524a403
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
237 additions
and
8 deletions
+237
-8
CMakeLists.txt
CMakeLists.txt
+4
-0
Notifier.cpp
src/components/notifier/Notifier.cpp
+1
-1
TestUtils.cpp
src/tests/TestUtils.cpp
+103
-0
TestUtils.hpp
src/tests/TestUtils.hpp
+34
-0
MainViewTest.cpp
src/tests/main-view/MainViewTest.cpp
+45
-0
MainViewTest.hpp
src/tests/main-view/MainViewTest.hpp
+35
-0
main.cpp
src/tests/main.cpp
+2
-1
SelfTest.cpp
src/tests/self-test/SelfTest.cpp
+10
-4
DesktopPopup.qml
ui/modules/Common/Popup/DesktopPopup.qml
+1
-1
Notification.spec.qml
ui/modules/Linphone/Notifications/Notification.spec.qml
+1
-1
ManageAccounts.qml
ui/views/App/Main/Dialogs/ManageAccounts.qml
+1
-0
No files found.
CMakeLists.txt
View file @
c7509acd
...
@@ -213,8 +213,12 @@ set(HEADERS
...
@@ -213,8 +213,12 @@ set(HEADERS
)
)
set
(
TESTS
set
(
TESTS
src/tests/main-view/MainViewTest.cpp
src/tests/main-view/MainViewTest.hpp
src/tests/self-test/SelfTest.cpp
src/tests/self-test/SelfTest.cpp
src/tests/self-test/SelfTest.hpp
src/tests/self-test/SelfTest.hpp
src/tests/TestUtils.cpp
src/tests/TestUtils.hpp
)
)
set
(
MAIN_FILE src/app/main.cpp
)
set
(
MAIN_FILE src/app/main.cpp
)
...
...
src/components/notifier/Notifier.cpp
View file @
c7509acd
...
@@ -43,7 +43,7 @@
...
@@ -43,7 +43,7 @@
#define NOTIFICATION_PROPERTY_X "popupX"
#define NOTIFICATION_PROPERTY_X "popupX"
#define NOTIFICATION_PROPERTY_Y "popupY"
#define NOTIFICATION_PROPERTY_Y "popupY"
#define NOTIFICATION_PROPERTY_WINDOW "
__
internalWindow"
#define NOTIFICATION_PROPERTY_WINDOW "internalWindow"
#define NOTIFICATION_PROPERTY_TIMER "__timer"
#define NOTIFICATION_PROPERTY_TIMER "__timer"
...
...
src/tests/TestUtils.cpp
0 → 100644
View file @
c7509acd
/*
* TestUtils.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 18, 2017
* Author: Ronan Abhamon
*/
#ifdef QT_NO_DEBUG
#undef QT_NO_DEBUG
#endif // ifdef QT_NO_DEBUG
#include <QtGlobal>
#include "../app/App.hpp"
#include "TestUtils.hpp"
// =============================================================================
static
void
printItemTree
(
const
QQuickItem
*
item
,
QString
&
output
,
int
spaces
)
{
output
.
append
(
QString
().
leftJustified
(
spaces
,
' '
));
output
.
append
(
item
->
metaObject
()
->
className
());
output
.
append
(
"
\n
"
);
for
(
const
auto
&
childItem
:
item
->
childItems
())
printItemTree
(
childItem
,
output
,
spaces
+
2
);
}
void
TestUtils
::
printItemTree
(
const
QQuickItem
*
item
)
{
QString
output
;
::
printItemTree
(
item
,
output
,
0
);
qInfo
().
noquote
()
<<
output
;
}
// -----------------------------------------------------------------------------
QQuickItem
*
TestUtils
::
getMainLoaderFromMainWindow
()
{
QQuickWindow
*
window
=
App
::
getInstance
()
->
getMainWindow
();
Q_CHECK_PTR
(
window
);
QList
<
QQuickItem
*>
items
=
window
->
contentItem
()
->
childItems
();
Q_ASSERT
(
!
items
.
empty
());
for
(
int
i
=
0
;
i
<
3
;
++
i
)
{
items
=
items
.
at
(
0
)
->
childItems
();
Q_ASSERT
(
!
items
.
empty
());
}
QQuickItem
*
loader
=
items
.
at
(
0
);
Q_ASSERT
(
!
strcmp
(
loader
->
metaObject
()
->
className
(),
"QQuickLoader"
));
return
loader
;
}
// -----------------------------------------------------------------------------
QQuickItem
*
TestUtils
::
getVirtualWindow
(
const
QQuickWindow
*
window
)
{
Q_CHECK_PTR
(
window
);
QList
<
QQuickItem
*>
items
=
window
->
contentItem
()
->
childItems
();
Q_ASSERT
(
!
items
.
empty
());
items
=
items
.
at
(
0
)
->
childItems
();
Q_ASSERT
(
!
items
.
empty
());
items
=
items
.
at
(
0
)
->
childItems
();
Q_ASSERT
(
items
.
size
()
==
2
);
const
char
name
[]
=
"VirtualWindow_QMLTYPE_"
;
QQuickItem
*
virtualWindow
=
items
.
at
(
1
);
Q_ASSERT
(
!
strncmp
(
virtualWindow
->
metaObject
()
->
className
(),
name
,
sizeof
name
-
1
));
return
virtualWindow
;
}
// -----------------------------------------------------------------------------
QQuickItem
*
TestUtils
::
getVirtualWindowContainer
(
const
QQuickItem
*
virtualWindow
)
{
Q_CHECK_PTR
(
virtualWindow
);
QList
<
QQuickItem
*>
items
=
virtualWindow
->
childItems
();
Q_ASSERT
(
items
.
size
()
==
2
);
QQuickItem
*
container
=
items
.
at
(
1
);
Q_ASSERT
(
!
container
->
childItems
().
empty
());
return
container
;
}
src/tests/TestUtils.hpp
0 → 100644
View file @
c7509acd
/*
* TestUtils.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 18, 2017
* Author: Ronan Abhamon
*/
#include <QQuickItem>
#include <QQuickWindow>
// =============================================================================
namespace
TestUtils
{
void
printItemTree
(
const
QQuickItem
*
item
);
QQuickItem
*
getMainLoaderFromMainWindow
();
QQuickItem
*
getVirtualWindow
(
const
QQuickWindow
*
window
);
QQuickItem
*
getVirtualWindowContainer
(
const
QQuickItem
*
virtualWindow
);
}
src/tests/main-view/MainViewTest.cpp
0 → 100644
View file @
c7509acd
/*
* MainViewTest.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 18, 2017
* Author: Ronan Abhamon
*/
#include <QTest>
#include "../../app/App.hpp"
#include "../TestUtils.hpp"
#include "MainViewTest.hpp"
// =============================================================================
void
MainViewTest
::
showManageAccountsPopup
()
{
QQuickWindow
*
mainWindow
=
App
::
getInstance
()
->
getMainWindow
();
QTest
::
mouseClick
(
mainWindow
,
Qt
::
LeftButton
,
Qt
::
KeyboardModifiers
(),
QPoint
(
100
,
35
));
QTest
::
qWait
(
1000
);
const
char
name
[]
=
"DialogPlus_QMLTYPE_"
;
QQuickItem
*
virtualWindowContent
=
TestUtils
::
getVirtualWindowContainer
(
TestUtils
::
getVirtualWindow
(
mainWindow
)
)
->
childItems
().
at
(
0
);
QVERIFY
(
!
strncmp
(
virtualWindowContent
->
metaObject
()
->
className
(),
name
,
sizeof
name
-
1
));
QVERIFY
(
virtualWindowContent
->
objectName
()
==
"manageAccounts"
);
}
src/tests/main-view/MainViewTest.hpp
0 → 100644
View file @
c7509acd
/*
* MainViewTest.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 18, 2017
* Author: Ronan Abhamon
*/
#include <QObject>
// =============================================================================
class
MainViewTest
:
public
QObject
{
Q_OBJECT
;
public:
MainViewTest
()
=
default
;
private
slots
:
void
showManageAccountsPopup
();
};
src/tests/main.cpp
View file @
c7509acd
...
@@ -26,13 +26,14 @@
...
@@ -26,13 +26,14 @@
#include "../app/AppController.hpp"
#include "../app/AppController.hpp"
#include "../utils/Utils.hpp"
#include "../utils/Utils.hpp"
#include "main-view/MainViewTest.hpp"
#include "self-test/SelfTest.hpp"
#include "self-test/SelfTest.hpp"
// =============================================================================
// =============================================================================
static
QHash
<
QString
,
QObject
*>
initializeTests
()
{
static
QHash
<
QString
,
QObject
*>
initializeTests
()
{
QHash
<
QString
,
QObject
*>
hash
;
QHash
<
QString
,
QObject
*>
hash
;
// TODO: Add tests here.
hash
[
"main-view"
]
=
new
MainViewTest
();
return
hash
;
return
hash
;
}
}
...
...
src/tests/self-test/SelfTest.cpp
View file @
c7509acd
...
@@ -24,14 +24,20 @@
...
@@ -24,14 +24,20 @@
#include <QTest>
#include <QTest>
#include "../../components/core/CoreManager.hpp"
#include "../../components/core/CoreManager.hpp"
#include "../TestUtils.hpp"
#include "SelfTest.hpp"
#include "SelfTest.hpp"
#define SELF_TEST_DELAY 5000
// =============================================================================
// =============================================================================
void
SelfTest
::
checkAppStartup
()
{
void
SelfTest
::
checkAppStartup
()
{
QSignalSpy
spy
(
CoreManager
::
getInstance
()
->
getHandlers
().
get
(),
&
CoreHandlers
::
coreStarted
);
QSignalSpy
spyCoreStarted
(
CoreManager
::
getInstance
()
->
getHandlers
().
get
(),
&
CoreHandlers
::
coreStarted
);
QVERIFY
(
spy
.
wait
(
SELF_TEST_DELAY
));
QSignalSpy
spyLoaderReady
(
TestUtils
::
getMainLoaderFromMainWindow
(),
SIGNAL
(
loaded
()));
QVERIFY
(
spyCoreStarted
.
wait
(
5000
));
if
(
spyLoaderReady
.
count
()
==
1
)
return
;
QVERIFY
(
spyLoaderReady
.
wait
(
1000
));
}
}
ui/modules/Common/Popup/DesktopPopup.qml
View file @
c7509acd
...
@@ -48,7 +48,7 @@ Item {
...
@@ -48,7 +48,7 @@ Item {
id
:
window
id
:
window
// Used for internal purposes only. Like Notifications.
// Used for internal purposes only. Like Notifications.
objectName
:
'
__
internalWindow
'
objectName
:
'
internalWindow
'
flags
:
wrapper
.
flags
flags
:
wrapper
.
flags
opacity
:
0
opacity
:
0
...
...
ui/modules/Linphone/Notifications/Notification.spec.qml
View file @
c7509acd
...
@@ -39,6 +39,6 @@ TestCase {
...
@@ -39,6 +39,6 @@ TestCase {
var
window
=
notification
.
data
[
0
]
var
window
=
notification
.
data
[
0
]
compare
(
Utils
.
qmlTypeof
(
window
,
'
QQuickWindowQmlImpl
'
),
true
)
compare
(
Utils
.
qmlTypeof
(
window
,
'
QQuickWindowQmlImpl
'
),
true
)
compare
(
window
.
objectName
===
'
__
internalWindow
'
,
true
)
compare
(
window
.
objectName
===
'
internalWindow
'
,
true
)
}
}
}
}
ui/views/App/Main/Dialogs/ManageAccounts.qml
View file @
c7509acd
...
@@ -18,6 +18,7 @@ DialogPlus {
...
@@ -18,6 +18,7 @@ DialogPlus {
]
]
centeredButtons
:
true
centeredButtons
:
true
objectName
:
'
manageAccounts
'
height
:
ManageAccountsStyle
.
height
height
:
ManageAccountsStyle
.
height
width
:
ManageAccountsStyle
.
width
width
:
ManageAccountsStyle
.
width
...
...
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