diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-24 16:35:02 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-24 16:35:02 +0200 |
| commit | 1d46fbbe97cd890da984596fa2076d3f83b1c663 (patch) | |
| tree | 7c21a1a05e94cec0d7fdc9e2419f16d85a5d6d75 /tests | |
| parent | 8af4edebd2caa9516ec3901857e4abf84c2bfdf0 (diff) | |
| download | qtmaildir-1d46fbbe97cd890da984596fa2076d3f83b1c663.tar.gz qtmaildir-1d46fbbe97cd890da984596fa2076d3f83b1c663.zip | |
test: an occurrence delete keeps the exdates already there
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_calendarstore.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_calendarstore.cpp b/tests/test_calendarstore.cpp index 921a194..e492bfb 100644 --- a/tests/test_calendarstore.cpp +++ b/tests/test_calendarstore.cpp @@ -157,6 +157,7 @@ private slots: void editingOneOccurrenceWritesAnOverride(); void editingTheSameOccurrenceAgainReplacesItsOverride(); void deletingOneOccurrenceAddsAnExdateAndDropsItsOverride(); + void deletingOneOccurrenceKeepsExistingExdates(); }; void TestCalendarStore::parsesAUtcEvent() @@ -661,5 +662,23 @@ void TestCalendarStore::deletingOneOccurrenceAddsAnExdateAndDropsItsOverride() QCOMPARE(CalendarStore::occurrences({ e }, rome(21, 0), rome(26, 0)).size(), 4); } +void TestCalendarStore::deletingOneOccurrenceKeepsExistingExdates() +{ + // A series that already skips the 21st; deleting the 22nd must leave that + // existing exception alone. A setTime-style replace would drop it. + const QString body = QStringLiteral( + "UID:d@example.org\r\nDTSTAMP:20260901T000000Z\r\n" + "DTSTART;TZID=Europe/Rome:20260921T100000\r\nDTEND;TZID=Europe/Rome:20260921T110000\r\n" + "RRULE:FREQ=DAILY;COUNT=5\r\n" + "EXDATE;TZID=Europe/Rome:20260921T100000\r\nSUMMARY:Daily\r\n"); + const QByteArray after = CalendarStore::deleteOccurrence(ics(vevent(body)), rome(22, 10)); + + const CalEvent e = reparse(after); + QVERIFY(e.exdates.contains(rome(21, 10))); + QVERIFY(e.exdates.contains(rome(22, 10))); + QCOMPARE(e.exdates.size(), 2); + QCOMPARE(CalendarStore::occurrences({ e }, rome(21, 0), rome(26, 0)).size(), 3); +} + QTEST_MAIN(TestCalendarStore) #include "test_calendarstore.moc" |
