Add action bar preview and all swipe actions; rename App lock
Check PR / check (pull_request) Successful in 56s
Check PR / check (pull_request) Successful in 56s
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user