diet-guard/app/test/ui/source_icon_test.dart
Krzysztof kuhy Rudnicki 49144a2c49 Move the app to material_ui for Flutter 3.50
Flutter 3.50 deprecates package:flutter/material.dart; 73 deprecation
infos failed flutter analyze --fatal-infos, and four Dart pins were
behind (crdt_sync_flutter 0.8.2, flutter_local_notifications 23.0.2,
github_device_auth 0.5.0, sync_settings_ui 0.8.2). Those UI packages
now sit on material_ui, so the app has to as well or their widgets lose
MaterialLocalizations.

Imports swap one-for-one and dart fix re-sorted the directives; no
behaviour change. analyze is clean and all six test shards pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzxdWWfb63jncj9Lca2jeX
2026-11-16 09:25:34 +01:00

27 lines
854 B
Dart

import 'package:diet_guard_app/ui/source_icon.dart';
import 'package:material_ui/material_ui.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
test(
'every stored source has its own glyph, unknown ones a neutral ring',
() {
expect(sourceIcon('manual'), Icons.edit);
expect(sourceIcon('food bank'), Icons.restaurant_menu);
expect(sourceIcon('catering'), Icons.local_shipping);
expect(sourceIcon('legacy'), Icons.circle_outlined);
},
);
testWidgets('the mark paints no text and speaks the stored source', (
tester,
) async {
await tester.pumpWidget(
const MaterialApp(home: Scaffold(body: SourceMark('catering'))),
);
expect(find.byType(Text), findsNothing);
final icon = tester.widget<Icon>(find.byType(Icon));
expect(icon.semanticLabel, 'catering');
});
}