Merge branch 'worktree-print-labels': print seed labels with QR

# Conflicts:
#	apps/app_seeds/lib/i18n/strings.g.dart
#	apps/app_seeds/lib/ui/inventory_list_screen.dart
This commit is contained in:
vjrj 2026-07-10 19:19:29 +02:00
commit 63f48db5c2
21 changed files with 1522 additions and 115 deletions

View file

@ -219,4 +219,66 @@ void main() {
await disposeTree(tester);
},
);
testWidgets('the label toolbar enters selection and Select all enables print', (
tester,
) async {
final repo = newTestRepository(db);
await repo.addQuickVariety(label: 'Tomato', category: 'Solanaceae');
await repo.addQuickVariety(label: 'Bean', category: 'Fabaceae');
await tester.pumpWidget(
wrapScreen(repository: repo, child: const InventoryListScreen()),
);
await tester.pumpAndSettle();
await tester.tap(find.byKey(const Key('inventory.selectLabels')));
await tester.pumpAndSettle();
// Nothing picked yet: the count reads zero and print is disabled.
expect(find.text('0 selected'), findsOneWidget);
expect(
tester
.widget<IconButton>(find.byKey(const Key('inventory.selection.print')))
.onPressed,
isNull,
);
await tester.tap(find.byKey(const Key('inventory.selection.selectAll')));
await tester.pumpAndSettle();
expect(find.text('2 selected'), findsOneWidget);
expect(
tester
.widget<IconButton>(find.byKey(const Key('inventory.selection.print')))
.onPressed,
isNotNull,
);
// Closing the contextual bar leaves selection mode.
await tester.tap(find.byKey(const Key('inventory.selection.close')));
await tester.pumpAndSettle();
expect(find.byKey(const Key('inventory.selection.print')), findsNothing);
await disposeTree(tester);
});
testWidgets('long-pressing a tile enters selection with it picked', (
tester,
) async {
final repo = newTestRepository(db);
await repo.addQuickVariety(label: 'Tomato', category: 'Solanaceae');
await repo.addQuickVariety(label: 'Bean', category: 'Fabaceae');
await tester.pumpWidget(
wrapScreen(repository: repo, child: const InventoryListScreen()),
);
await tester.pumpAndSettle();
await tester.longPress(find.text('Tomato'));
await tester.pumpAndSettle();
expect(find.text('1 selected'), findsOneWidget);
expect(find.byType(Checkbox), findsNWidgets(2)); // one per tile
await disposeTree(tester);
});
}