File indexing completed on 2024-05-12 05:22:06
0001 /* 0002 * SPDX-FileCopyrightText: 2018 Daniel Vrátil <dvratil@kde.org> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 #include "calendartestutils.h" 0008 #include "calendarservice.h" 0009 #include "testutils.h" 0010 0011 #include <QFile> 0012 0013 KGAPI2::CalendarPtr calendarFromFile(const QString &path) 0014 { 0015 QFile f(path); 0016 VERIFY_RET(f.open(QIODevice::ReadOnly), {}); 0017 0018 auto calendar = KGAPI2::CalendarService::JSONToCalendar(f.readAll()); 0019 VERIFY_RET(calendar, {}); 0020 return calendar; 0021 } 0022 0023 KGAPI2::EventPtr eventFromFile(const QString &path) 0024 { 0025 QFile f(path); 0026 VERIFY_RET(f.open(QIODevice::ReadOnly), {}); 0027 0028 auto event = KGAPI2::CalendarService::JSONToEvent(f.readAll()); 0029 VERIFY_RET(event, {}); 0030 return event; 0031 }