File indexing completed on 2024-12-01 04:48:06

0001 /*
0002    SPDX-FileCopyrightText: 2009 Thomas McGuire <mcguire@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #pragma once
0008 
0009 #include "fakeserver/fakeserver.h"
0010 #include "maildirsettings.h"
0011 #include "pop3settings.h"
0012 
0013 #include <Akonadi/Collection>
0014 #include <Akonadi/Item>
0015 
0016 #include <QList>
0017 #include <QObject>
0018 
0019 class Pop3Test : public QObject
0020 {
0021     Q_OBJECT
0022 
0023     void replymMaildirSettingsInterface(QString arg1);
0024 private Q_SLOTS:
0025     void initTestCase();
0026     void cleanupTestCase();
0027     void testSimpleDownload();
0028     void testSimpleLeaveOnServer();
0029     void testBigFetch();
0030     void testSeenUIDCleanup();
0031     void testTimeBasedLeaveRule();
0032     void testCountBasedLeaveRule();
0033     void testSizeBasedLeaveRule();
0034     void testMixedLeaveRules();
0035 
0036 private:
0037     void lowerTimeOfSeenMail(const QString &uidOfMail, int secondsToLower);
0038     void cleanupMaildir(const Akonadi::Item::List &items);
0039     void checkMailsInMaildir(const QList<QByteArray> &mails);
0040     Akonadi::Item::List checkMailsOnAkonadiServer(const QList<QByteArray> &mails);
0041     void syncAndWaitForFinish();
0042     QString loginSequence() const;
0043     QString retrieveSequence(const QList<QByteArray> &mails, const QList<int> &exceptions = QList<int>()) const;
0044     QString deleteSequence(int numToDelete) const;
0045     QString quitSequence() const;
0046     QString listSequence(const QList<QByteArray> &mails) const;
0047     QString uidSequence(const QStringList &uids) const;
0048 
0049     FakeServerThread *mFakeServerThread = nullptr;
0050 
0051     OrgKdeAkonadiPOP3SettingsInterface *mPOP3SettingsInterface = nullptr;
0052     OrgKdeAkonadiMaildirSettingsInterface *mMaildirSettingsInterface = nullptr;
0053     Akonadi::Collection mMaildirCollection;
0054     QString mPop3Identifier;
0055     QString mMaildirIdentifier;
0056     QString mMaildirPath;
0057 };