From ed277f30c8a95eadfc4a351b032ded333783e3b5 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Fri, 6 Oct 2017 09:57:20 +0200 Subject: TextEditor html conversion and testrunner --- framework/qml/tests/CMakeLists.txt | 11 ++++++++ framework/qml/tests/testrunner.cpp | 6 +++++ framework/qml/tests/tst_texteditor.qml | 46 ++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 framework/qml/tests/CMakeLists.txt create mode 100644 framework/qml/tests/testrunner.cpp create mode 100644 framework/qml/tests/tst_texteditor.qml (limited to 'framework/qml/tests') 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 @@ + +find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Quick QuickTest) + +add_executable(testrunner testrunner.cpp) +target_link_libraries(testrunner + Qt5::Quick + Qt5::QuickTest +) + +add_test(NAME frameworkqmltests COMMAND testrunner WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + 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 @@ +#include + +int main(int argc, char **argv) +{ + return quick_test_main(argc, argv, "example", 0); +} 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 @@ +/* + * Copyright 2017 Christian Mollekopf + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Library General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +import QtQuick 2.7 +import QtTest 1.0 +import org.kube.framework 1.0 as Kube + + +TestCase { + id: testCase + width: 400 + height: 400 + name: "TextEditor" + + Kube.TextEditor { + id: editor + initialText: "Foobar" + htmlEnabled: false + } + + function test_1initialText() { + compare(editor.text, editor.initialText) + } + + function test_2htmlConversion() { + editor.htmlEnabled = true + editor.htmlEnabled = false + compare(editor.text, editor.initialText) + } +} -- cgit v1.2.3