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,32 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:marianum_mobile/api/marianumconnect/queries/timetable_get_rooms/timetable_get_rooms_response.dart';
import 'package:marianum_mobile/state/app/modules/timetable/bloc/timetable_state.dart';
TimetableGetRoomsResponse _rooms(String name) => TimetableGetRoomsResponse(
result: [McRoom(id: 1, shortName: name, longName: name)],
);
void main() {
final base = TimetableState(
startDate: DateTime(2026, 9, 21),
endDate: DateTime(2026, 9, 25),
rooms: _rooms('A101'),
dataVersion: 3,
);
test('returns the same state when the content is unchanged', () {
expect(base.withReferenceData(rooms: _rooms('A101')), same(base));
});
test('bumps dataVersion and takes the new value when content changed', () {
final next = _rooms('B202');
final result = base.withReferenceData(rooms: next);
expect(result.rooms, same(next));
expect(result.dataVersion, 4);
});
test('keeps unchanged instances when only another field changed', () {
final result = base.withReferenceData(rooms: _rooms('A101'));
expect(result.rooms, same(base.rooms));
});
}