Add action bar preview and all swipe actions; rename App lock
Check PR / check (pull_request) Successful in 56s

This commit is contained in:
Ayushya Amitabh
2026-10-07 23:14:21 -04:00
parent 91ab8b4a07
commit 2d244ce335
10 changed files with 277 additions and 82 deletions
+48
View File
@@ -1,6 +1,8 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:noo/widgets/noo/files/noo_swipe_action.dart';
import 'package:noo/models/selection_action.dart';
import 'package:noo/providers/settings_controller.dart';
import 'noo_test_utils.dart';
@@ -8,6 +10,52 @@ void main() {
setUpNooTests();
group('NooSwipeAction', () {
test('every action-bar action has a swipe setting', () {
expect(
SwipeAction.values
.map((action) => action.selectionKind)
.whereType<SelectionActionKind>()
.toSet(),
SelectionActionKind.values.toSet(),
);
});
for (final kind in SelectionActionKind.values) {
testNooWidgets('a full swipe runs ${kind.label}', (
tester,
theme,
c,
) async {
var triggered = 0;
await pumpNoo(
tester,
SizedBox(
width: 360,
height: 64,
child: NooSwipeAction(
startAction: NooSwipeActionSpec(
kind: kind,
onTriggered: () => triggered++,
),
child: const ColoredBox(
color: Colors.white,
child: SizedBox(width: 360, height: 64),
),
),
),
theme: theme,
);
await tester.drag(find.byType(NooSwipeAction), const Offset(60, 0));
await tester.pumpAndSettle();
expect(triggered, 0);
expect(find.text(kind.label), findsOneWidget);
expect(find.byIcon(kind.icon), findsOneWidget);
await tester.drag(find.byType(NooSwipeAction), const Offset(300, 0));
await tester.pump();
expect(triggered, 1);
});
}
testNooWidgets('a moderate swipe opens the action without triggering it', (
tester,
theme,