File indexing completed on 2025-03-09 04:53:56
0001 /* 0002 SPDX-FileCopyrightText: 2010 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com 0003 SPDX-FileCopyrightText: 2010 Leo Franchi <lfranchi@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #pragma once 0009 0010 #include <gpgme++/key.h> 0011 0012 #include <KMime/Message> 0013 0014 namespace MessageComposer 0015 { 0016 namespace Test 0017 { 0018 /** 0019 * setup a environment variables for tests: 0020 * QStandardPaths::setTestModeEnabled(true) 0021 */ 0022 void setupEnv(); 0023 0024 /** 0025 * setup a full environment variables for tests: 0026 * setupEnv 0027 * set LC_ALL to en_US.UTF-8 0028 * set TZ to UTC 0029 */ 0030 void setupFullEnv(); 0031 0032 /** 0033 * Returns list of keys used in various crypto routines 0034 */ 0035 std::vector<GpgME::Key> getKeys(bool smime = false); 0036 0037 /** 0038 * Loads a message from filename and returns a message pointer 0039 */ 0040 KMime::Message::Ptr loadMessage(const QString &filename); 0041 0042 /** 0043 * Loads a message from MAIL_DATA_DIR and returns a message pointer 0044 */ 0045 KMime::Message::Ptr loadMessageFromDataDir(const QString &filename); 0046 0047 /** 0048 * compares a KMime::Content against the referenceFile 0049 * If the files are not euqal print diff output. 0050 */ 0051 void compareFile(KMime::Content *content, const QString &referenceFile); 0052 0053 /** 0054 * compare two mails via files. 0055 * If the files are not euqal print diff output. 0056 */ 0057 void compareFile(const QString &outFile, const QString &referenceFile); 0058 0059 /** 0060 * Adds keydata into keyring insinde gnupgHome. 0061 */ 0062 void populateKeyring(const QString &gnupgHome, const QByteArray &keydata); 0063 0064 /** 0065 * Adds keydata into keyring insinde gnupgHome. 0066 */ 0067 void populateKeyring(const QString &gnupgHome, const GpgME::Key &key); 0068 0069 } 0070 }