File indexing completed on 2024-11-24 04:44:08

0001 /*
0002    SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
0003    SPDX-FileContributor: Kevin Ottens <kevin@kdab.com>
0004 
0005    SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #pragma once
0009 
0010 #include <qtest_kde.h>
0011 
0012 #include "kimaptest/fakeserver.h"
0013 
0014 #include "dummypasswordrequester.h"
0015 #include "dummyresourcestate.h"
0016 #include "imapaccount.h"
0017 #include "resourcetask.h"
0018 #include "sessionpool.h"
0019 
0020 Q_DECLARE_METATYPE(ImapAccount *)
0021 Q_DECLARE_METATYPE(DummyPasswordRequester *)
0022 Q_DECLARE_METATYPE(DummyResourceState::Ptr)
0023 Q_DECLARE_METATYPE(KIMAP::Session *)
0024 Q_DECLARE_METATYPE(QVariant)
0025 
0026 class ImapTestBase : public QObject
0027 {
0028     Q_OBJECT
0029 
0030 public:
0031     explicit ImapTestBase(QObject *parent = nullptr);
0032 
0033 protected:
0034     QString defaultUserName() const;
0035     QString defaultPassword() const;
0036     ImapAccount *createDefaultAccount() const;
0037     DummyPasswordRequester *createDefaultRequester();
0038     QList<QByteArray> defaultAuthScenario() const;
0039     QList<QByteArray> defaultPoolConnectionScenario(const QList<QByteArray> &customCapabilities = QList<QByteArray>()) const;
0040 
0041     bool waitForSignal(QObject *obj, const char *member, int timeout = 500) const;
0042 
0043     Akonadi::Collection createCollectionChain(const QString &remoteId) const;
0044 
0045 private slots:
0046     void setupTestCase();
0047 };