improved performance and battery usage on older devices

This commit is contained in:
2026-09-25 23:58:08 +02:00
parent ed8e52f475
commit 56a497985b
70 changed files with 1631 additions and 621 deletions
@@ -0,0 +1,48 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:marianum_mobile/utils/recurrence_occurrences.dart';
void main() {
setUp(RecurrenceOccurrences.clear);
final anchor = DateTime.utc(2024, 9, 2, 8);
test('returns only occurrences inside the half-open range', () {
final hits = RecurrenceOccurrences.between(
'RRULE:FREQ=DAILY',
anchor,
DateTime.utc(2026, 9, 21),
DateTime.utc(2026, 9, 24),
);
expect(hits, [
DateTime.utc(2026, 9, 21, 8),
DateTime.utc(2026, 9, 22, 8),
DateTime.utc(2026, 9, 23, 8),
]);
});
test('answers earlier ranges after a later one was expanded', () {
RecurrenceOccurrences.between(
'RRULE:FREQ=WEEKLY',
anchor,
DateTime.utc(2026, 1, 1),
DateTime.utc(2026, 1, 31),
);
final hits = RecurrenceOccurrences.between(
'RRULE:FREQ=WEEKLY',
anchor,
DateTime.utc(2024, 9, 1),
DateTime.utc(2024, 9, 10),
);
expect(hits, [DateTime.utc(2024, 9, 2, 8), DateTime.utc(2024, 9, 9, 8)]);
});
test('stops at the end of a finite series', () {
final hits = RecurrenceOccurrences.between(
'RRULE:FREQ=DAILY;COUNT=2',
anchor,
DateTime.utc(2024, 1, 1),
DateTime.utc(2030, 1, 1),
);
expect(hits, hasLength(2));
});
}