mirror of
https://github.com/kuhyx/todo-app.git
synced 2026-11-10 20:27:01 +01:00
- Committing a captured note (New note tap with a persisted draft) fires HapticFeedback.lightImpact and plays a ~600 ms checkmark beside the counter; empty drafts and keystrokes confirm nothing. - appRoute: one shared page route (fade + rise, AppDuration.slow) replaces all seven MaterialPageRoute sites; guard test keeps it that way. - Wizard progress bar animates on AppDuration.base / AppCurve.standard. - Everything honours disableAnimations; the haptic and the (static) checkmark still fire. Removes the finished dopamine-ux prompt (sound step rejected). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
38 lines
1.2 KiB
Dart
38 lines
1.2 KiB
Dart
/// Shared helpers for the motion / haptic tests.
|
|
///
|
|
/// Deliberately NOT named `*_test.dart`: the runner would collect it and fail
|
|
/// on the missing `main()`.
|
|
library;
|
|
|
|
import 'package:flutter/services.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
/// Records the arguments of every `HapticFeedback.*` call for the test's
|
|
/// lifetime. Matches the platform channel Flutter's [HapticFeedback] uses.
|
|
List<String> recordHaptics(WidgetTester tester) {
|
|
final calls = <String>[];
|
|
tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(
|
|
SystemChannels.platform,
|
|
(call) async {
|
|
if (call.method == 'HapticFeedback.vibrate') {
|
|
calls.add(call.arguments as String);
|
|
}
|
|
return null;
|
|
},
|
|
);
|
|
addTearDown(
|
|
() => tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(
|
|
SystemChannels.platform,
|
|
null,
|
|
),
|
|
);
|
|
return calls;
|
|
}
|
|
|
|
/// Turns the OS "remove animations" setting on for this test.
|
|
void disableAnimations(WidgetTester tester) {
|
|
tester.platformDispatcher.accessibilityFeaturesTestValue =
|
|
const FakeAccessibilityFeatures(disableAnimations: true);
|
|
addTearDown(tester.platformDispatcher.clearAccessibilityFeaturesTestValue);
|
|
}
|