File indexing completed on 2024-06-16 05:01:53
0001 /* Copyright (C) 2006 - 2014 Jan Kundrát <jkt@flaska.net> 0002 0003 This file is part of the Trojita Qt IMAP e-mail client, 0004 http://trojita.flaska.net/ 0005 0006 This program is free software; you can redistribute it and/or 0007 modify it under the terms of the GNU General Public License as 0008 published by the Free Software Foundation; either version 2 of 0009 the License or (at your option) version 3 or any later version 0010 accepted by the membership of KDE e.V. (or its successor approved 0011 by the membership of KDE e.V.), which shall act as a proxy 0012 defined in Section 14 of version 3 of the license. 0013 0014 This program is distributed in the hope that it will be useful, 0015 but WITHOUT ANY WARRANTY; without even the implied warranty of 0016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0017 GNU General Public License for more details. 0018 0019 You should have received a copy of the GNU General Public License 0020 along with this program. If not, see <http://www.gnu.org/licenses/>. 0021 */ 0022 0023 #ifndef TEST_COMPOSER_SUBMISSION 0024 #define TEST_COMPOSER_SUBMISSION 0025 0026 #include <QTest> 0027 #include "Utils/LibMailboxSync.h" 0028 #include "Composer/Submission.h" 0029 #include "MSA/FakeMSA.h" 0030 0031 /** @short Test e-mail submission */ 0032 class ComposerSubmissionTest : public LibMailboxSync 0033 { 0034 Q_OBJECT 0035 public: 0036 ComposerSubmissionTest(); 0037 0038 private slots: 0039 void testEmptySubmission(); 0040 void testSimpleSubmission(); 0041 void testSimpleSubmissionWithAppendFailed(); 0042 void testSimpleSubmissionWithAppendNoAppenduid(); 0043 void testSimpleSubmissionWithAppendAppenduid(); 0044 void testSimpleSubmissionReplyingToOk(); 0045 void testSimpleSubmissionReplyingToFailedFlags(); 0046 void testMissingFileAttachmentSmtpSave(); 0047 void testMissingFileAttachmentSmtpNoSave(); 0048 void testMissingFileAttachmentBurlSave(); 0049 void testMissingFileAttachmentBurlNoSave(); 0050 void testMissingFileAttachmentImap(); 0051 void testMissingImapAttachmentSmtpSave(); 0052 void testMissingImapAttachmentSmtpNoSave(); 0053 void testMissingImapAttachmentBurlSave(); 0054 void testMissingImapAttachmentBurlNoSave(); 0055 void testMissingImapAttachmentImap(); 0056 void testBurlSubmission(); 0057 void testBurlSubmissionAttachedWholeMessage(); 0058 void testCatenateBurlWithoutUrlauth(); 0059 void testCatenateBurlWithoutUrlauth_data(); 0060 void testFailedMsa(); 0061 void testNoImapContinuation(); 0062 void testReplyingNormal(); 0063 void testForwardingNormal(); 0064 void testReplyingToRemoved(); 0065 void testForwardingDeletedWhileFetching(); 0066 void init(); 0067 void cleanup(); 0068 0069 private: 0070 void helperTestSimpleAppend(bool appendOk, bool appendUid, bool shallUpdateReplyingTo, bool replyingToUpdateOk); 0071 void helperSetupProperHeaders(); 0072 void helperMissingAttachment(bool save, bool burl, bool imap, bool attachingFile); 0073 void helperAttachImapPart(const int row, const QByteArray mimePart); 0074 void helperAttachImapMessage(const uint uid); 0075 0076 Composer::Submission *m_submission; 0077 std::shared_ptr<Composer::MessageComposer> m_composer; 0078 MSA::FakeFactory *m_msaFactory; 0079 0080 QSignalSpy *sendingSpy; 0081 QSignalSpy *sentSpy; 0082 QSignalSpy *requestedSendingSpy; 0083 QSignalSpy *requestedBurlSendingSpy; 0084 0085 QSignalSpy *submissionSucceededSpy; 0086 QSignalSpy *submissionFailedSpy; 0087 }; 0088 0089 #endif