From d24d1d070c986e57a004cf58b15bf3123f065abf Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 10 Jan 2018 17:59:02 +0100 Subject: InboxCrusher testsetup --- tests/teststore.cpp | 10 ++++++ views/inboxcrusher/main.qml | 85 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 views/inboxcrusher/main.qml diff --git a/tests/teststore.cpp b/tests/teststore.cpp index d57c9e07..aafd56aa 100644 --- a/tests/teststore.cpp +++ b/tests/teststore.cpp @@ -47,6 +47,15 @@ static QStringList toStringList(const QVariantList &list) return s; } +static QByteArrayList toByteArrayList(const QVariantList &list) +{ + QByteArrayList s; + for (const auto &e : list) { + s << e.toByteArray(); + } + return s; +} + static void createMail(const QVariantMap &object, const QByteArray &folder = {}) { using namespace Sink::ApplicationDomain; @@ -82,6 +91,7 @@ static void createFolder(const QVariantMap &object) using namespace Sink::ApplicationDomain; auto folder = ApplicationDomainType::createEntity(object["resource"].toByteArray()); folder.setName(object["name"].toString()); + folder.setSpecialPurpose(toByteArrayList(object["specialpurpose"].toList())); Sink::Store::create(folder).exec().waitForFinished(); iterateOverObjects(object.value("mails").toList(), [=](const QVariantMap &object) { diff --git a/views/inboxcrusher/main.qml b/views/inboxcrusher/main.qml new file mode 100644 index 00000000..c3b40e38 --- /dev/null +++ b/views/inboxcrusher/main.qml @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2018 Christian Mollekopf, + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, 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 General Public License for more details. + * + * You should have received a copy of the GNU 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 QtQuick.Controls 2.0 +import QtQuick.Window 2.0 + +import org.kube.framework 1.0 as Kube +import org.kube.test 1.0 +import "qml" + +ApplicationWindow { + id: app + height: Screen.desktopAvailableHeight * 0.8 + width: Screen.desktopAvailableWidth * 0.8 + + Component.onCompleted: { + var initialState = { + accounts: [{ + id: "account1", + name: "Test Account" + }], + identities: [{ + account: "account1", + name: "Test Identity", + address: "identity@example.org" + }], + resources: [{ + id: "resource1", + account: "account1", + type: "dummy" + }, + { + id: "resource2", + account: "account1", + type: "mailtransport" + }], + folders: [{ + id: "folder1", + resource: "resource1", + name: "Folder 1", + specialpurpose: ["inbox"], + mails: [{ + resource: "resource1", + subject: "subject1", + body: "body", + to: ["to@example.org"], + cc: ["cc@example.org"], + bcc: ["bcc@example.org"], + draft: true + }, + { + resource: "resource1", + subject: "subject2", + body: "body", + to: ["to@example.org"], + cc: ["cc@example.org"], + bcc: ["bcc@example.org"], + draft: true + } + ], + }], + } + TestStore.setup(initialState) + } + + View { + anchors.fill: parent + } +} -- cgit v1.2.3