diff options
author | Bernd Weimer <bernd.weimer@pelagicore.com> | 2018-06-20 17:11:25 +0200 |
---|---|---|
committer | Robert Griebl <robert.griebl@pelagicore.com> | 2018-06-22 09:35:30 +0000 |
commit | eddd13dda4969f01dd7545c126a550bd77ee944b (patch) | |
tree | 845de8bb13d854bc752134bd857231547e3b4da0 | |
parent | 0dc94333e70bb4cbb7e6acbf6f79267a4ba8f29e (diff) | |
download | qtapplicationmanager-eddd13dda4969f01dd7545c126a550bd77ee944b.tar.gz |
Add auto tests for quick launch feature
Also fixed applicationRunStateChanged documentation
Change-Id: Idb3ac19ed10040218c2a5ccbac455e9b95892e60
Reviewed-by: Robert Griebl <robert.griebl@pelagicore.com>
-rw-r--r-- | src/manager-lib/applicationmanager.cpp | 5 | ||||
-rw-r--r-- | tests/qml/qml.pro | 3 | ||||
-rw-r--r-- | tests/qml/quicklaunch/am-config.yaml | 19 | ||||
-rw-r--r-- | tests/qml/quicklaunch/apps/tld.test.quicklaunch/app.qml | 47 | ||||
-rw-r--r-- | tests/qml/quicklaunch/apps/tld.test.quicklaunch/icon.png | bin | 0 -> 1486 bytes | |||
-rw-r--r-- | tests/qml/quicklaunch/apps/tld.test.quicklaunch/info.yaml | 10 | ||||
-rw-r--r-- | tests/qml/quicklaunch/quicklaunch.pro | 4 | ||||
-rw-r--r-- | tests/qml/quicklaunch/tst_quicklaunch.qml | 87 |
8 files changed, 172 insertions, 3 deletions
diff --git a/src/manager-lib/applicationmanager.cpp b/src/manager-lib/applicationmanager.cpp index bd7ccda4..6954c735 100644 --- a/src/manager-lib/applicationmanager.cpp +++ b/src/manager-lib/applicationmanager.cpp @@ -250,7 +250,8 @@ \qmlsignal ApplicationManager::applicationRunStateChanged(string id, enumeration runState) This signal is emitted when the \a runState of the application identified by \a id changed. - The \a runState can be one of: + Possible values for the \l {Application::runState} {runState} are defined by the Application + type. For example this signal can be used to restart an application in multi-process mode when it has crashed: @@ -259,7 +260,7 @@ Connections { target: ApplicationManager onApplicationRunStateChanged: { - if (runState === ApplicationManager.NotRunning + if (runState === Application.NotRunning && ApplicationManager.application(id).lastExitStatus === Application.CrashExit) { ApplicationManager.startApplication(id); } diff --git a/tests/qml/qml.pro b/tests/qml/qml.pro index 78ee24a8..449e4aa5 100644 --- a/tests/qml/qml.pro +++ b/tests/qml/qml.pro @@ -4,4 +4,5 @@ SUBDIRS = \ windowmapping \ fakeamwindow \ installer \ - monitoring + monitoring \ + quicklaunch diff --git a/tests/qml/quicklaunch/am-config.yaml b/tests/qml/quicklaunch/am-config.yaml new file mode 100644 index 00000000..cb9e528a --- /dev/null +++ b/tests/qml/quicklaunch/am-config.yaml @@ -0,0 +1,19 @@ +formatVersion: 1 +formatType: am-configuration +--- +applications: + builtinAppsManifestDir: "${CONFIG_PWD}/apps" + installedAppsManifestDir: "/tmp/am-quicklaunch-test/manifests" + appImageMountDir: "/tmp/am-quicklaunch-test/image-mounts" + database: "/tmp/am-quicklaunch-test/apps.db" + +installationLocations: +- id: "internal-0" + installationPath: "/tmp/am/apps" + documentPath: "/tmp/am/docs" + mountPoint: "/tmp" + isDefault: true + +quicklaunch: + runtimesPerContainer: 2 + idleLoad: 1.0 diff --git a/tests/qml/quicklaunch/apps/tld.test.quicklaunch/app.qml b/tests/qml/quicklaunch/apps/tld.test.quicklaunch/app.qml new file mode 100644 index 00000000..aeee7172 --- /dev/null +++ b/tests/qml/quicklaunch/apps/tld.test.quicklaunch/app.qml @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2018 Pelagicore AG +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Pelagicore Application Manager. +** +** $QT_BEGIN_LICENSE:LGPL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite licenses may use +** this file in accordance with the commercial license agreement provided +** with the Software or, alternatively, in accordance with the terms +** contained in a written agreement between you and The Qt Company. For +** licensing terms and conditions see https://www.qt.io/terms-conditions. +** For further information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +** SPDX-License-Identifier: LGPL-3.0 +** +****************************************************************************/ + +import QtApplicationManager 1.0 + +ApplicationManagerWindow { + width: 320 + height: 240 +} diff --git a/tests/qml/quicklaunch/apps/tld.test.quicklaunch/icon.png b/tests/qml/quicklaunch/apps/tld.test.quicklaunch/icon.png Binary files differnew file mode 100644 index 00000000..c1397153 --- /dev/null +++ b/tests/qml/quicklaunch/apps/tld.test.quicklaunch/icon.png diff --git a/tests/qml/quicklaunch/apps/tld.test.quicklaunch/info.yaml b/tests/qml/quicklaunch/apps/tld.test.quicklaunch/info.yaml new file mode 100644 index 00000000..e898a02b --- /dev/null +++ b/tests/qml/quicklaunch/apps/tld.test.quicklaunch/info.yaml @@ -0,0 +1,10 @@ +formatVersion: 1 +formatType: am-application +--- +id: 'tld.test.quicklaunch' +icon: 'icon.png' +code: 'app.qml' +runtime: 'qml' +version: '1.0' +name: + en: 'Quicklaunch' diff --git a/tests/qml/quicklaunch/quicklaunch.pro b/tests/qml/quicklaunch/quicklaunch.pro new file mode 100644 index 00000000..4c6b8f74 --- /dev/null +++ b/tests/qml/quicklaunch/quicklaunch.pro @@ -0,0 +1,4 @@ +AM_CONFIG = am-config.yaml +TEST_FILES = tst_quicklaunch.qml + +load(am-qml-testcase) diff --git a/tests/qml/quicklaunch/tst_quicklaunch.qml b/tests/qml/quicklaunch/tst_quicklaunch.qml new file mode 100644 index 00000000..15f1a316 --- /dev/null +++ b/tests/qml/quicklaunch/tst_quicklaunch.qml @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2018 Pelagicore AG +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Pelagicore Application Manager. +** +** $QT_BEGIN_LICENSE:LGPL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite licenses may use +** this file in accordance with the commercial license agreement provided +** with the Software or, alternatively, in accordance with the terms +** contained in a written agreement between you and The Qt Company. For +** licensing terms and conditions see https://www.qt.io/terms-conditions. +** For further information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +** SPDX-License-Identifier: LGPL-3.0 +** +****************************************************************************/ + +import QtQuick 2.3 +import QtTest 1.0 +import QtApplicationManager 1.0 + +// Tests are meaningless in single-process mode, but still work + +TestCase { + id: testCase + when: windowShown + name: "Quicklaunch" + + Connections { + target: WindowManager + onWindowLost: WindowManager.releaseWindow(window); + } + + SignalSpy { + id: windowReadySpy + target: WindowManager + signalName: "windowReady" + } + + SignalSpy { + id: runStateChangedSpy + target: ApplicationManager + signalName: "applicationRunStateChanged" + } + + function test_quicklaunch() { + var app = "tld.test.quicklaunch" + wait(1000); + // Check for quick-launching is done every second in appman. After 1s now, this test + // sometimes caused some race where the app would not be started at all in the past: + ApplicationManager.startApplication(app); + windowReadySpy.wait(3000); + runStateChangedSpy.clear(); + ApplicationManager.stopApplication(app, true); + runStateChangedSpy.wait(3000); // wait for ShuttingDown + runStateChangedSpy.wait(3000); // wait for NotRunning + wait(1000); + // Unfortunately there is no reliable means to determine, whether a quicklaunch process + // is running, but after at least 2s now, there should be a process that can be attached to. + ApplicationManager.startApplication(app); + windowReadySpy.wait(3000); + } +} |