summaryrefslogtreecommitdiffstats
path: root/views/log/tests/tst_logview.qml
diff options
context:
space:
mode:
Diffstat (limited to 'views/log/tests/tst_logview.qml')
-rw-r--r--views/log/tests/tst_logview.qml65
1 files changed, 65 insertions, 0 deletions
diff --git a/views/log/tests/tst_logview.qml b/views/log/tests/tst_logview.qml
new file mode 100644
index 00000000..a78d71cb
--- /dev/null
+++ b/views/log/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 View {
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}