Commit 5030f072 authored by Matthieu Gallien's avatar Matthieu Gallien 🎵

test opening all top level views with the full elisa application window

first automated test with the full Elisa application and window
parent 5192facb
Pipeline #36428 passed with stage
in 17 minutes and 50 seconds
......@@ -198,6 +198,30 @@ if (Qt5Quick_FOUND AND Qt5Widgets_FOUND AND NOT WIN32)
target_compile_definitions(elisaqmltests PRIVATE QUICK_TEST_SOURCE_DIR="${CMAKE_SOURCE_DIR}/autotests/qmltests")
target_include_directories(elisaqmltests PRIVATE ${CMAKE_SOURCE_DIR}/src)
set(elisaqmlintegrationtests_SOURCES
elisaqmlintegrationtests.cpp
qmlintegrationtests/tst_OpenTopViews.qml
)
kconfig_add_kcfg_files(elisaqmlintegrationtests_SOURCES ../src/elisa_settings.kcfgc GENERATE_MOC )
add_executable(elisaqmlintegrationtests
${elisaqmlintegrationtests_SOURCES}
)
target_link_libraries(elisaqmlintegrationtests
LINK_PRIVATE
Qt5::Core Qt5::Widgets Qt5::Quick Qt5::Test Qt5::QuickTest KF5::ConfigCore KF5::ConfigGui
)
add_test(NAME elisaqmlintegrationtests
COMMAND $<TARGET_FILE:elisaqmlintegrationtests> -widgets
)
target_compile_definitions(elisaqmlintegrationtests PRIVATE QUICK_TEST_SOURCE_DIR="${CMAKE_SOURCE_DIR}/autotests/qmlintegrationtests")
target_include_directories(elisaqmltests PRIVATE ${CMAKE_SOURCE_DIR}/src)
endif()
set(filescannerTest_SOURCES
......
/*
SPDX-FileCopyrightText: 2018 (c) Matthieu Gallien <matthieu_gallien@yahoo.fr>
SPDX-License-Identifier: LGPL-3.0-or-later
*/
#include <QtQuickTest>
#include <QQmlEngine>
#include <QQmlContext>
#include "elisa_settings.h"
class ElisaArguments : public QObject
{
Q_OBJECT
public:
ElisaArguments() {}
};
class Setup : public QObject
{
Q_OBJECT
public:
Setup() {}
public Q_SLOTS:
void qmlEngineAvailable(QQmlEngine *engine)
{
int typeId = qmlRegisterSingletonType<ElisaArguments>("org.kde.elisa.host", 1, 0, "ElisaArguments", [](QQmlEngine *qmlEngine, QJSEngine *scriptEngine) -> QObject* {
Q_UNUSED(qmlEngine)
Q_UNUSED(scriptEngine)
auto *result = new ElisaArguments;
return result;
});
QStandardPaths::setTestModeEnabled(true);
Elisa::ElisaConfiguration::instance(QStringLiteral("testfoo"));
}
};
QUICK_TEST_MAIN_WITH_SETUP(ElisaQmlIntegrationTests, Setup)
#include "elisaqmlintegrationtests.moc"
/*
SPDX-FileCopyrightText: 2018 (c) Matthieu Gallien <matthieu_gallien@yahoo.fr>
SPDX-License-Identifier: LGPL-3.0-or-later
*/
import QtQuick 2.3
import QtTest 1.0
import "../../src/qml"
import org.kde.elisa 1.0
TestCase {
name: "TestPlayListEntry"
when: windowShown
function init() {
}
function test_playnow_click() {
mainWindow.requestActivate()
let contentViewItem = findChild(mainWindow, 'contentView')
verify(contentViewItem !== null, 'valid contentView')
let listViewsItem = findChild(contentViewItem, 'listViews')
verify(listViewsItem !== null, 'valid listViews')
let viewStackItem = findChild(contentViewItem, 'viewStack')
verify(viewStackItem !== null, 'valid viewStack')
wait(3000);
let navigationBarItem = viewStackItem.currentItem
verify(listViewsItem !== null, 'navigationBar')
compare(navigationBarItem.mainTitle, 'Albums')
let i = 0
while(!listViewsItem.focus) {
keyClick(Qt.Key_Tab)
++i
verify(i < 10, 'Impossible to focus the view selector')
}
keyClick(Qt.Key_Down)
wait(200);
verify(!listViewsItem.focus)
navigationBarItem = viewStackItem.currentItem
verify(listViewsItem !== null, 'navigationBar')
compare(navigationBarItem.mainTitle, 'Artists');
compare(navigationBarItem.mainTitle, listViewsItem.currentItem.title);
i = 0
while(!listViewsItem.focus) {
keyClick(Qt.Key_Tab)
++i
verify(i < 10, 'Impossible to focus the view selector')
}
keyClick(Qt.Key_Down)
wait(200);
verify(!listViewsItem.focus)
navigationBarItem = viewStackItem.currentItem
verify(listViewsItem !== null, 'navigationBar')
compare(navigationBarItem.mainTitle, 'Tracks');
compare(navigationBarItem.mainTitle, listViewsItem.currentItem.title);
i = 0
while(!listViewsItem.focus) {
keyClick(Qt.Key_Tab)
++i
verify(i < 10, 'Impossible to focus the view selector')
}
keyClick(Qt.Key_Down)
wait(200);
verify(!listViewsItem.focus)
navigationBarItem = viewStackItem.currentItem
verify(listViewsItem !== null, 'navigationBar')
compare(navigationBarItem.mainTitle, 'Genres');
compare(navigationBarItem.mainTitle, listViewsItem.currentItem.title);
i = 0
while(!listViewsItem.focus) {
keyClick(Qt.Key_Tab)
++i
verify(i < 10, 'Impossible to focus the view selector')
}
keyClick(Qt.Key_Down)
wait(200);
verify(!listViewsItem.focus)
navigationBarItem = viewStackItem.currentItem
verify(listViewsItem !== null, 'navigationBar')
compare(navigationBarItem.mainTitle, 'Files');
compare(navigationBarItem.mainTitle, listViewsItem.currentItem.title);
i = 0
while(!listViewsItem.focus) {
keyClick(Qt.Key_Tab)
++i
verify(i < 12, 'Impossible to focus the view selector')
}
keyClick(Qt.Key_Down)
wait(200);
verify(!listViewsItem.focus)
navigationBarItem = viewStackItem.currentItem
verify(listViewsItem !== null, 'navigationBar')
compare(navigationBarItem.mainTitle, 'Radios');
compare(navigationBarItem.mainTitle, listViewsItem.currentItem.title);
for (let j = 0; j < 6; ++j) {
i = 0
while(!listViewsItem.focus) {
keyClick(Qt.Key_Tab)
++i
verify(i < 13, 'Impossible to focus the view selector')
}
keyClick(Qt.Key_Up)
}
wait(200);
verify(!listViewsItem.focus)
navigationBarItem = viewStackItem.currentItem
verify(listViewsItem !== null, 'navigationBar')
compare(navigationBarItem.mainTitle, 'Frequently Played');
compare(navigationBarItem.mainTitle, listViewsItem.currentItem.title);
i = 0
while(!listViewsItem.focus) {
keyClick(Qt.Key_Tab)
++i
verify(i < 10, 'Impossible to focus the view selector')
}
keyClick(Qt.Key_Up)
wait(200);
verify(!listViewsItem.focus)
navigationBarItem = viewStackItem.currentItem
verify(listViewsItem !== null, 'navigationBar')
compare(navigationBarItem.mainTitle, 'Recently Played');
compare(navigationBarItem.mainTitle, listViewsItem.currentItem.title);
i = 0
while(!listViewsItem.focus) {
keyClick(Qt.Key_Tab)
++i
verify(i < 10, 'Impossible to focus the view selector')
}
keyClick(Qt.Key_Up)
wait(200);
verify(listViewsItem.focus)
navigationBarItem = viewStackItem.currentItem
verify(listViewsItem !== null, 'navigationBar')
compare(navigationBarItem.mainTitle, 'Now Playing');
compare(navigationBarItem.mainTitle, listViewsItem.currentItem.title);
}
ElisaMainWindow {
id: mainWindow
height: 800
width: 1000
}
}
......@@ -174,6 +174,8 @@ RowLayout {
ViewSelector {
id: listViews
objectName: 'listViews'
model: pageProxyModel
Layout.fillHeight: true
......@@ -209,6 +211,8 @@ RowLayout {
StackView {
id: browseStackView
objectName: 'viewStack'
anchors.fill: parent
clip: true
......@@ -380,7 +384,7 @@ RowLayout {
databaseId: ElisaApplication.manageHeaderBar.databaseId
trackType: ElisaApplication.manageHeaderBar.trackType
title: ElisaApplication.manageHeaderBar.title
mainTitle: ElisaApplication.manageHeaderBar.title
artistName: ElisaApplication.manageHeaderBar.artist
albumName: ElisaApplication.manageHeaderBar.album
albumArtUrl: ElisaApplication.manageHeaderBar.image
......
......@@ -19,7 +19,7 @@ FocusScope {
property int databaseId: 0
property var trackType
property alias title: titleLabel.text
property alias mainTitle: titleLabel.text
property string albumName: ''
property string artistName: ''
property url albumArtUrl: ''
......
......@@ -281,6 +281,9 @@ Kirigami.ApplicationWindow {
ContentView {
id: contentView
objectName: 'contentView'
Layout.fillHeight: true
Layout.fillWidth: true
showPlaylist: persistentSettings.showPlaylist
......
......@@ -14,6 +14,8 @@ import org.kde.elisa 1.0
ColumnLayout {
id: navigationBar
objectName: 'navigationBar'
spacing: 0
property string mainTitle
......
......@@ -15,6 +15,7 @@ FocusScope {
id: rootFocusScope
readonly property alias currentIndex: viewModeView.currentIndex
readonly property alias currentItem: viewModeView.currentItem
property double textOpacity
property alias model: pageDelegateModel.model
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment