From 6d726bb10386b3d7f5481d41b735ec06cb2163ad Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 9 Jan 2018 09:35:59 +0100 Subject: Install composer/converations/people as separate views and load them dynamically. --- views/composer/tests/tst_composerview.qml | 97 +++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 views/composer/tests/tst_composerview.qml (limited to 'views/composer/tests/tst_composerview.qml') diff --git a/views/composer/tests/tst_composerview.qml b/views/composer/tests/tst_composerview.qml new file mode 100644 index 00000000..eac391c1 --- /dev/null +++ b/views/composer/tests/tst_composerview.qml @@ -0,0 +1,97 @@ +/* + * 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 "../qml" +import org.kube.framework 1.0 as Kube +import org.kube.test 1.0 + +TestCase { + id: testCase + width: 400 + height: 400 + name: "ComposerView" + when: windowShown + + Component { + id:composerComponent + View { + focus: true + } + } + + function test_1start() { + var composer = createTemporaryObject(composerComponent, testCase, {}) + verify(composer) + } + + function test_2verifyInitialFocus() { + var composer = createTemporaryObject(composerComponent, testCase, {}) + var newMailButton = findChild(composer, "newMailButton"); + verify(newMailButton) + verify(newMailButton.activeFocus) + } + + function test_3sendMessage() { + var initialState = { + accounts: [{ + id: "account1", + }], + identities: [{ + account: "account1", + name: "Test Identity", + address: "identity@example.org" + }], + resources: [{ + id: "resource1", + account: "account1", + type: "dummy" + }, + { + id: "resource2", + account: "account1", + type: "mailtransport" + }], + mails:[{ + resource: "resource1", + subject: "subject", + body: "body", + to: ["to@example.org"], + cc: ["cc@example.org"], + bcc: ["bcc@example.org"], + draft: true + }] + } + TestStore.setup(initialState) + var composer = createTemporaryObject(composerComponent, testCase, {}) + + var createdMail = TestStore.load("mail", {resource: "resource1"}) + + var loadAsDraft = true + composer.loadMessage(createdMail, loadAsDraft) + var sendMailButton = findChild(composer, "sendButton") + verify(sendMailButton) + tryVerify(function(){ return sendMailButton.enabled }) + sendMailButton.clicked() + + tryVerify(function(){ return TestStore.load("mail", {resource: "resource2"}) }) + tryVerify(function(){ return !TestStore.load("mail", {resource: "resource1"}) }) + } +} -- cgit v1.2.3