diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-10-25 14:00:43 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-10-25 14:00:43 +0200 |
commit | da955d84beda72e26ce641375bd6fc4159a4c9fc (patch) | |
tree | 9ced7c7fc2d1404a45728ea8fc64a14590fdb9d3 /tests | |
parent | 65d7fe39ccb3ae011f63ab6abbdcec5ee0c71055 (diff) | |
download | kube-da955d84beda72e26ce641375bd6fc4159a4c9fc.tar.gz kube-da955d84beda72e26ce641375bd6fc4159a4c9fc.zip |
Prepare logview for error merging.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/tst_logview.qml | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/tests/tst_logview.qml b/tests/tst_logview.qml new file mode 100644 index 00000000..48e21734 --- /dev/null +++ b/tests/tst_logview.qml | |||
@@ -0,0 +1,58 @@ | |||
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 | |||
20 | import QtQuick 2.7 | ||
21 | import QtQuick.Controls 2.0 | ||
22 | import QtQuick.Window 2.1 | ||
23 | import QtTest 1.0 | ||
24 | import org.kube.framework 1.0 as Kube | ||
25 | import "../components/kube/contents/ui/" as Components | ||
26 | |||
27 | |||
28 | TestCase { | ||
29 | id: logviewTestcase | ||
30 | width: 400 | ||
31 | height: 400 | ||
32 | name: "LogView" | ||
33 | |||
34 | Components.LogView { | ||
35 | id: logView | ||
36 | } | ||
37 | |||
38 | function test_logview() { | ||
39 | var listModel = findChild(logView, "logModel"); | ||
40 | verify(listModel) | ||
41 | compare(listModel.count, 0) | ||
42 | //ignore progress | ||
43 | Kube.Fabric.postMessage(Kube.Messages.progressNotification, {}) | ||
44 | compare(listModel.count, 0) | ||
45 | |||
46 | Kube.Fabric.postMessage(Kube.Messages.notification, {type: Kube.Notifications.info, message: "foobar", resource: "resource"}) | ||
47 | compare(listModel.count, 1) | ||
48 | compare(logView.pendingError, false) | ||
49 | |||
50 | Kube.Fabric.postMessage(Kube.Messages.notification, {"type": Kube.Notifications.error, message: "foobar", resource: "resource"}) | ||
51 | compare(listModel.count, 2) | ||
52 | compare(logView.pendingError, true) | ||
53 | compare(listModel.get(0).type, Kube.Notifications.error) | ||
54 | compare(listModel.get(0).errors.count, 1) | ||
55 | compare(listModel.get(0).errors.get(0).message, "foobar") | ||
56 | compare(listModel.get(0).errors.get(0).resource, "resource") | ||
57 | } | ||
58 | } | ||