summaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/CMakeLists.txt1
-rw-r--r--components/kube/tests/CMakeLists.txt1
-rw-r--r--components/kube/tests/tst_applicationstart.qml42
-rw-r--r--components/kube/tests/tst_logview.qml65
4 files changed, 109 insertions, 0 deletions
diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt
index ed28b5f4..9ae2824d 100644
--- a/components/CMakeLists.txt
+++ b/components/CMakeLists.txt
@@ -8,5 +8,6 @@ macro(install_qml_component name)
8endmacro(install_qml_component) 8endmacro(install_qml_component)
9 9
10install_qml_component(kube) 10install_qml_component(kube)
11add_subdirectory(kube/tests)
11install_qml_component(accounts) 12install_qml_component(accounts)
12install_qml_component(mailviewer) 13install_qml_component(mailviewer)
diff --git a/components/kube/tests/CMakeLists.txt b/components/kube/tests/CMakeLists.txt
new file mode 100644
index 00000000..0c786cfe
--- /dev/null
+++ b/components/kube/tests/CMakeLists.txt
@@ -0,0 +1 @@
add_test(NAME kubecomponenttests COMMAND kubetestrunner WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
diff --git a/components/kube/tests/tst_applicationstart.qml b/components/kube/tests/tst_applicationstart.qml
new file mode 100644
index 00000000..fdfc2634
--- /dev/null
+++ b/components/kube/tests/tst_applicationstart.qml
@@ -0,0 +1,42 @@
1/*
2 * Copyright 2017 Christian Mollekopf <mollekopf@kolabsys.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Library General Public License as
6 * published by the Free Software Foundation; either version 2, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Library General Public License for more details
13 *
14 * You should have received a copy of the GNU Library General Public
15 * License along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20import QtQuick 2.7
21import QtQuick.Controls 2.0
22import QtQuick.Window 2.1
23import QtTest 1.0
24import "../qml"
25
26
27TestCase {
28 id: testCase
29 width: 400
30 height: 400
31 name: "ApplicationStart"
32
33 Kube {
34 id: kube
35 }
36
37 function test_startToWizard() {
38 var accountWizard = findChild(kube, "accountWizard");
39 verify(accountWizard)
40 verify(accountWizard.visible)
41 }
42}
diff --git a/components/kube/tests/tst_logview.qml b/components/kube/tests/tst_logview.qml
new file mode 100644
index 00000000..d3326db1
--- /dev/null
+++ b/components/kube/tests/tst_logview.qml
@@ -0,0 +1,65 @@
1/*
2 * Copyright 2017 Christian Mollekopf <mollekopf@kolabsys.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Library General Public License as
6 * published by the Free Software Foundation; either version 2, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Library General Public License for more details
13 *
14 * You should have received a copy of the GNU Library General Public
15 * License along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20import QtQuick 2.7
21import QtQuick.Controls 2.0
22import QtQuick.Window 2.1
23import QtTest 1.0
24import org.kube.framework 1.0 as Kube
25import "../qml"
26
27TestCase {
28 id: logviewTestcase
29 width: 400
30 height: 400
31 name: "LogView"
32
33 LogView {
34 id: logView
35 }
36
37 function test_logview() {
38 var listModel = findChild(logView, "logModel");
39 verify(listModel)
40 compare(listModel.count, 0)
41 //ignore progress
42 Kube.Fabric.postMessage(Kube.Messages.progressNotification, {})
43 compare(listModel.count, 0)
44
45 Kube.Fabric.postMessage(Kube.Messages.notification, {type: Kube.Notifications.info, message: "foobar", resource: "resource"})
46 compare(listModel.count, 1)
47 compare(logView.pendingError, false)
48
49 Kube.Fabric.postMessage(Kube.Messages.notification, {"type": Kube.Notifications.error, message: "foobar", resource: "resource"})
50 compare(listModel.count, 2)
51 compare(logView.pendingError, true)
52 compare(listModel.get(0).type, Kube.Notifications.error)
53 compare(listModel.get(0).errors.count, 1)
54 compare(listModel.get(0).errors.get(0).message, "foobar")
55 compare(listModel.get(0).errors.get(0).resource, "resource")
56
57 Kube.Fabric.postMessage(Kube.Messages.notification, {"type": Kube.Notifications.error, "subtype": "merge", message: "merge1", resource: "resource1"})
58 compare(listModel.count, 3)
59 Kube.Fabric.postMessage(Kube.Messages.notification, {"type": Kube.Notifications.error, "subtype": "merge", message: "merge2", resource: "resource2"})
60 compare(listModel.count, 3)
61 compare(listModel.get(0).errors.count, 2)
62 compare(listModel.get(0).errors.get(0).message, "merge2")
63 compare(listModel.get(0).errors.get(0).resource, "resource2")
64 }
65}