summaryrefslogtreecommitdiffstats
path: root/framework/qml/tests
diff options
context:
space:
mode:
Diffstat (limited to 'framework/qml/tests')
-rw-r--r--framework/qml/tests/CMakeLists.txt11
-rw-r--r--framework/qml/tests/testrunner.cpp6
-rw-r--r--framework/qml/tests/tst_texteditor.qml46
3 files changed, 63 insertions, 0 deletions
diff --git a/framework/qml/tests/CMakeLists.txt b/framework/qml/tests/CMakeLists.txt
new file mode 100644
index 00000000..bc34855c
--- /dev/null
+++ b/framework/qml/tests/CMakeLists.txt
@@ -0,0 +1,11 @@
1
2find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Quick QuickTest)
3
4add_executable(testrunner testrunner.cpp)
5target_link_libraries(testrunner
6 Qt5::Quick
7 Qt5::QuickTest
8)
9
10add_test(NAME frameworkqmltests COMMAND testrunner WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
11
diff --git a/framework/qml/tests/testrunner.cpp b/framework/qml/tests/testrunner.cpp
new file mode 100644
index 00000000..c0bee01a
--- /dev/null
+++ b/framework/qml/tests/testrunner.cpp
@@ -0,0 +1,6 @@
1#include <QtQuickTest/quicktest.h>
2
3int main(int argc, char **argv)
4{
5 return quick_test_main(argc, argv, "example", 0);
6}
diff --git a/framework/qml/tests/tst_texteditor.qml b/framework/qml/tests/tst_texteditor.qml
new file mode 100644
index 00000000..21ebe642
--- /dev/null
+++ b/framework/qml/tests/tst_texteditor.qml
@@ -0,0 +1,46 @@
1/*
2 * Copyright 2017 Christian Mollekopf <mollekopf@kolabsystems.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 QtTest 1.0
22import org.kube.framework 1.0 as Kube
23
24
25TestCase {
26 id: testCase
27 width: 400
28 height: 400
29 name: "TextEditor"
30
31 Kube.TextEditor {
32 id: editor
33 initialText: "Foobar"
34 htmlEnabled: false
35 }
36
37 function test_1initialText() {
38 compare(editor.text, editor.initialText)
39 }
40
41 function test_2htmlConversion() {
42 editor.htmlEnabled = true
43 editor.htmlEnabled = false
44 compare(editor.text, editor.initialText)
45 }
46}