diff --git a/app/lib/screens/github_mirror_screen.dart b/app/lib/screens/github_mirror_screen.dart index aebf61c..590b411 100644 --- a/app/lib/screens/github_mirror_screen.dart +++ b/app/lib/screens/github_mirror_screen.dart @@ -162,6 +162,7 @@ class _GitHubMirrorScreenState extends State // it says nothing about Firebase. IconButton.outlined( onPressed: _busy ? null : _testConnection, + tooltip: 'Test', icon: const Icon( Icons.network_check, semanticLabel: 'Test GitHub connection', diff --git a/app/lib/screens/log_meal_actions.dart b/app/lib/screens/log_meal_actions.dart index bcb2e3d..994d443 100644 --- a/app/lib/screens/log_meal_actions.dart +++ b/app/lib/screens/log_meal_actions.dart @@ -47,22 +47,27 @@ List logMealAppBarActions({ }) => [ ...leading, IconButton( + tooltip: 'Body', icon: const Icon(Icons.monitor_weight, semanticLabel: 'Body'), onPressed: onBody, ), IconButton( + tooltip: 'Foods', icon: const Icon(Icons.restaurant_menu, semanticLabel: 'Food bank'), onPressed: onFoodBank, ), IconButton( + tooltip: 'History', icon: const Icon(Icons.history, semanticLabel: 'History'), onPressed: onHistory, ), IconButton( + tooltip: 'Calendar', icon: const Icon(Icons.calendar_month, semanticLabel: 'Calendar'), onPressed: onCalendar, ), IconButton( + tooltip: 'Sync', icon: const Icon(Icons.settings, semanticLabel: 'Sync settings'), onPressed: onSettings, ), diff --git a/app/lib/widgets/meal_time_dropdown.dart b/app/lib/widgets/meal_time_dropdown.dart index 1b895c0..cd398aa 100644 --- a/app/lib/widgets/meal_time_dropdown.dart +++ b/app/lib/widgets/meal_time_dropdown.dart @@ -123,6 +123,7 @@ class MealTimeDropdown extends StatelessWidget { ), ), IconButton( + tooltip: 'Time', icon: const Icon( Icons.schedule, semanticLabel: 'Type or pick an exact time', diff --git a/app/pubspec.yaml b/app/pubspec.yaml index 15ecd35..3ace666 100644 --- a/app/pubspec.yaml +++ b/app/pubspec.yaml @@ -2,7 +2,7 @@ name: diet_guard_app description: "Companion phone app for diet_guard: log meals on the go." publish_to: 'none' -version: 1.0.192+1 +version: 1.0.193+1 environment: sdk: ^3.12.2 diff --git a/app/test/log_meal_tooltips_test.dart b/app/test/log_meal_tooltips_test.dart new file mode 100644 index 0000000..e9c4f67 --- /dev/null +++ b/app/test/log_meal_tooltips_test.dart @@ -0,0 +1,27 @@ +import 'package:diet_guard_app/screens/log_meal_actions.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('logMealAppBarActions tooltips name each icon', (tester) async { + await tester.pumpWidget( + MaterialApp( + home: Scaffold( + appBar: AppBar( + actions: logMealAppBarActions( + onFoodBank: () {}, + onHistory: () {}, + onCalendar: () {}, + onSettings: () {}, + onBody: () {}, + ), + ), + ), + ), + ); + + for (final label in ['Body', 'Foods', 'History', 'Calendar', 'Sync']) { + expect(find.byTooltip(label), findsOneWidget, reason: label); + } + }); +} diff --git a/app/test/no_words_support.dart b/app/test/no_words_support.dart index dc40394..37aac72 100644 --- a/app/test/no_words_support.dart +++ b/app/test/no_words_support.dart @@ -5,7 +5,8 @@ /// A word is two or more letters in a row. Allowed without listing: numbers, /// punctuation, single letters, unit symbols next to a figure ([unitTokens]) /// and the method acronyms kept as DOUBT rows (`MET`). Content (food names, -/// workout labels, typed values) is passed per test as [content]. +/// workout labels, typed values) is passed per test as [content]. One-word +/// tooltips naming an icon are exempt (textgate one-word-tooltip exception). library; import 'package:material_ui/material_ui.dart'; @@ -16,11 +17,15 @@ const Set unitTokens = {'kcal', 'kg', 'cm', 'lb', 'st', 'MET'}; final RegExp _word = RegExp('[A-Za-z]{2,}'); +/// A one-word tooltip naming an icon (textgate exception, 2026-11-22). +final RegExp _oneWordTooltip = RegExp(r'^[A-Za-z][A-Za-z-]{0,19}$'); + /// Every painted string in the current tree (one per [RichText] / tooltip). List paintedStrings(WidgetTester tester) => [ for (final w in tester.widgetList(find.byType(RichText))) w.text.toPlainText(includePlaceholders: false), - for (final w in tester.widgetList(find.byType(Tooltip))) ?w.message, + for (final w in tester.widgetList(find.byType(Tooltip))) + if (w.message case final m? when !_oneWordTooltip.hasMatch(m)) m, ]; /// The words in [text] that are neither units nor part of [content].