File indexing completed on 2025-01-05 04:49:48

0001 /*
0002  * SPDX-FileCopyrightText: 2016 Daniel Vrátil <dvratil@kde.org>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-or-later
0005  *
0006  */
0007 
0008 #pragma once
0009 
0010 #include <KCalendarCore/Event>
0011 #include <QMultiHash>
0012 #include <QObject>
0013 
0014 class QDate;
0015 namespace CalendarEvents
0016 {
0017 class EventData;
0018 }
0019 class FakePimDataSource;
0020 
0021 using DateEventDataHash = QMultiHash<QDate, CalendarEvents::EventData>;
0022 
0023 class PimEventsPluginTest : public QObject
0024 {
0025     Q_OBJECT
0026 
0027 private Q_SLOTS:
0028     void initTestCase();
0029     void testLoadEventsForDataRange();
0030     void testEventAdded();
0031     void testEventModified();
0032     void testEventRemoved();
0033 
0034 private:
0035     [[nodiscard]] bool compareEventDataHashes(const DateEventDataHash &actual, const DateEventDataHash &expected);
0036     [[nodiscard]] DateEventDataHash populateCalendar(FakePimDataSource *source, bool uniqueEventData);
0037     [[nodiscard]] QList<CalendarEvents::EventData> findEventData(const KCalendarCore::Event::Ptr &event, const DateEventDataHash &allData);
0038 };