summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/CMakeLists.txt13
-rw-r--r--tests/kubetestrunner.cpp8
-rw-r--r--tests/tst_applicationstart.qml41
-rw-r--r--tests/tst_logview.qml66
4 files changed, 2 insertions, 126 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 0515c052..70e21481 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -1,17 +1,6 @@
1project(tests) 1find_package(Qt5 REQUIRED NO_MODULE COMPONENTS QuickTest)
2 2
3find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Core Quick Test Gui Widgets WebEngine QuickTest)
4
5# build testrunner
6add_executable(kubetestrunner kubetestrunner.cpp) 3add_executable(kubetestrunner kubetestrunner.cpp)
7target_link_libraries(kubetestrunner 4target_link_libraries(kubetestrunner
8 Qt5::Gui
9 Qt5::Quick
10 Qt5::Widgets
11 Qt5::WebEngine
12 Qt5::QuickTest 5 Qt5::QuickTest
13) 6)
14
15# tests
16add_test(NAME qmltests COMMAND kubetestrunner WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
17
diff --git a/tests/kubetestrunner.cpp b/tests/kubetestrunner.cpp
index 4a8d447a..c114c5fd 100644
--- a/tests/kubetestrunner.cpp
+++ b/tests/kubetestrunner.cpp
@@ -1,8 +1,2 @@
1#include <QtQuickTest/quicktest.h> 1#include <QtQuickTest/quicktest.h>
2 2QUICK_TEST_MAIN("kube")
3int main(int argc, char **argv)
4{
5 QTEST_ADD_GPU_BLACKLIST_SUPPORT
6 QTEST_SET_MAIN_SOURCE_PATH
7 return quick_test_main(argc, argv, "kubetest", 0);
8}
diff --git a/tests/tst_applicationstart.qml b/tests/tst_applicationstart.qml
deleted file mode 100644
index 16107ec0..00000000
--- a/tests/tst_applicationstart.qml
+++ /dev/null
@@ -1,41 +0,0 @@
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.components.kube 1.0 as Kube
25
26
27TestCase {
28 id: testCase
29 width: 400
30 height: 400
31 name: "ApplicationStart"
32
33 Kube.Kube {
34 id: kube
35 }
36
37 function test_startToWizard() {
38 var accountWizard = findChild(kube, "accountWizard");
39 verify(accountWizard.visible)
40 }
41}
diff --git a/tests/tst_logview.qml b/tests/tst_logview.qml
deleted file mode 100644
index 86668d72..00000000
--- a/tests/tst_logview.qml
+++ /dev/null
@@ -1,66 +0,0 @@
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 "../components/kube/contents/ui/" as Components
26
27
28TestCase {
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 Kube.Fabric.postMessage(Kube.Messages.notification, {"type": Kube.Notifications.error, "subtype": "merge", message: "merge1", resource: "resource1"})
59 compare(listModel.count, 3)
60 Kube.Fabric.postMessage(Kube.Messages.notification, {"type": Kube.Notifications.error, "subtype": "merge", message: "merge2", resource: "resource2"})
61 compare(listModel.count, 3)
62 compare(listModel.get(0).errors.count, 2)
63 compare(listModel.get(0).errors.get(0).message, "merge2")
64 compare(listModel.get(0).errors.get(0).resource, "resource2")
65 }
66}