From 3bc8dd514abd6e737c557f3987315401ebf8d452 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 25 Jul 2018 17:54:09 +0200 Subject: Ensure that we shutdown all resources before existing the test. A lingering resource will also block the test from exiting. --- tests/CMakeLists.txt | 1 + tests/qml/ViewTestCase.qml | 30 +++++++++++++++++++++++ tests/qmldir | 2 ++ views/accounts/tests/tst_accountsview.qml | 8 +----- views/calendar/tests/tst_calendar.qml | 5 ++-- views/composer/tests/tst_composerview.qml | 4 +-- views/conversation/tests/tst_conversationview.qml | 4 +-- views/inboxcrusher/tests/tst_inboxcrusher.qml | 5 ++-- views/log/tests/tst_logview.qml | 4 +-- views/people/tests/tst_peopleview.qml | 4 +-- views/search/tests/tst_searchview.qml | 5 +--- 11 files changed, 44 insertions(+), 28 deletions(-) create mode 100644 tests/qml/ViewTestCase.qml diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index d7dfe81d..d06880fb 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -11,6 +11,7 @@ target_link_libraries(kubetestrunner kubeframework ) +install(DIRECTORY qml/ DESTINATION ${QML_INSTALL_DIR}/org/kube/test) install(FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kube/test) add_library(testplugin SHARED testplugin.cpp teststore.cpp) diff --git a/tests/qml/ViewTestCase.qml b/tests/qml/ViewTestCase.qml new file mode 100644 index 00000000..f2d08bb1 --- /dev/null +++ b/tests/qml/ViewTestCase.qml @@ -0,0 +1,30 @@ +/* + * 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 QtTest 1.0 +import org.kube.test 1.0 + +TestCase { + width: 400 + height: 400 + + function cleanup() { + TestStore.shutdownResources(); + } +} diff --git a/tests/qmldir b/tests/qmldir index 2ccb630a..63b4ba66 100644 --- a/tests/qmldir +++ b/tests/qmldir @@ -1,3 +1,5 @@ module org.kube.test +ViewTestCase 1.0 ViewTestCase.qml + plugin testplugin diff --git a/views/accounts/tests/tst_accountsview.qml b/views/accounts/tests/tst_accountsview.qml index 8d7bc29d..468a0716 100644 --- a/views/accounts/tests/tst_accountsview.qml +++ b/views/accounts/tests/tst_accountsview.qml @@ -22,17 +22,11 @@ import QtTest 1.0 import org.kube.test 1.0 import "../qml" -TestCase { +ViewTestCase { id: testCase - width: 400 - height: 400 name: "AccountsView" when: windowShown - function cleanup() { - TestStore.shutdownResources(); - } - function visitChildren(item) { console.warn(item) for (var i = 0; i < item.children.length; i++) { diff --git a/views/calendar/tests/tst_calendar.qml b/views/calendar/tests/tst_calendar.qml index 46f7dba2..20b78ba7 100644 --- a/views/calendar/tests/tst_calendar.qml +++ b/views/calendar/tests/tst_calendar.qml @@ -19,11 +19,10 @@ import QtQuick 2.7 import QtTest 1.0 +import org.kube.test 1.0 import "../qml" -TestCase { - width: 400 - height: 400 +ViewTestCase { name: "Todo" View { diff --git a/views/composer/tests/tst_composerview.qml b/views/composer/tests/tst_composerview.qml index 61668ecb..d3b6a420 100644 --- a/views/composer/tests/tst_composerview.qml +++ b/views/composer/tests/tst_composerview.qml @@ -23,10 +23,8 @@ import org.kube.framework 1.0 as Kube import org.kube.test 1.0 import "../qml" -TestCase { +ViewTestCase { id: testCase - width: 400 - height: 400 name: "ComposerView" when: windowShown diff --git a/views/conversation/tests/tst_conversationview.qml b/views/conversation/tests/tst_conversationview.qml index 186c2634..b85f4cb6 100644 --- a/views/conversation/tests/tst_conversationview.qml +++ b/views/conversation/tests/tst_conversationview.qml @@ -23,10 +23,8 @@ import "../qml" import org.kube.framework 1.0 as Kube import org.kube.test 1.0 -TestCase { +ViewTestCase { id: testCase - width: 400 - height: 400 name: "MailView" Component { diff --git a/views/inboxcrusher/tests/tst_inboxcrusher.qml b/views/inboxcrusher/tests/tst_inboxcrusher.qml index dba4603a..3e756569 100644 --- a/views/inboxcrusher/tests/tst_inboxcrusher.qml +++ b/views/inboxcrusher/tests/tst_inboxcrusher.qml @@ -18,10 +18,10 @@ */ import QtQuick 2.7 -import QtTest 1.0 +import org.kube.test 1.0 import "../qml" -TestCase { +ViewTestCase { width: 400 height: 400 name: "InboxCrusher" @@ -33,4 +33,5 @@ TestCase { function test_start() { verify(view) } + } diff --git a/views/log/tests/tst_logview.qml b/views/log/tests/tst_logview.qml index 8f733b6c..2479172d 100644 --- a/views/log/tests/tst_logview.qml +++ b/views/log/tests/tst_logview.qml @@ -23,10 +23,8 @@ import org.kube.framework 1.0 as Kube import org.kube.test 1.0 import "../qml" -TestCase { +ViewTestCase { id: logviewTestcase - width: 400 - height: 400 name: "LogView" View { diff --git a/views/people/tests/tst_peopleview.qml b/views/people/tests/tst_peopleview.qml index d2764c31..4b940c6d 100644 --- a/views/people/tests/tst_peopleview.qml +++ b/views/people/tests/tst_peopleview.qml @@ -22,10 +22,8 @@ import QtTest 1.0 import org.kube.test 1.0 import "../qml" -TestCase { +ViewTestCase { id: testCase - width: 400 - height: 400 name: "PeopleView" View { diff --git a/views/search/tests/tst_searchview.qml b/views/search/tests/tst_searchview.qml index 3aeae109..ead62a9d 100644 --- a/views/search/tests/tst_searchview.qml +++ b/views/search/tests/tst_searchview.qml @@ -20,13 +20,10 @@ import QtQuick 2.7 import QtTest 1.0 import "../qml" -import org.kube.framework 1.0 as Kube import org.kube.test 1.0 -TestCase { +ViewTestCase { id: testCase - width: 400 - height: 400 name: "SearchView" Component { -- cgit v1.2.3