mirror of
https://github.com/kuhyx/todo-app.git
synced 2026-11-19 16:34:22 +01:00
Some checks failed
dependency freshness / dependencies on newest stable (push) Has been cancelled
file-length / file length <= 250 lines (push) Has been cancelled
md-naming / markdown naming convention (push) Has been cancelled
release-apk / release (APK) (push) Has been cancelled
repo-contract / repo contract (push) Has been cancelled
crdt_sync_flutter 0.9.0's installAppErrors in main(): uncaught errors and every spinner shown over 1 s (WaitWatch: sync.run, mirror.test) upload to RTDB /todo/errors/<device> with the versionCode, where the PC app-errors ingest files board tickets (kuhyx/utils DOCS-app-errors.md). The app moves to material_ui first: sync_settings_ui 0.8.x and design_system 0.4.x sit on it, and Flutter 3.50 deprecates flutter/material. Pins: crdt_sync 0.14.1, csf 0.9.0, ssui 0.8.3, gda 0.5.1, design_system 0.4.1, image 4.13.1, mcp_dart 2.4.4. file_picker stays 13.3.3, held by data_transfer_flutter 0.2.2 (allowlisted, self-clearing). appRoute takes a route name so each report names its screen; the release build passes APP_BUILD/APP_VERSION. Nothing new on screen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
141 lines
4.5 KiB
Dart
141 lines
4.5 KiB
Dart
import 'package:material_ui/material_ui.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:todo/ui/capture_confirm_mark.dart';
|
|
|
|
import '../capture_screen_harness.dart';
|
|
import 'motion_harness.dart';
|
|
|
|
const _lightImpact = 'HapticFeedbackType.lightImpact';
|
|
final _mark = find.byKey(CaptureConfirmMark.iconKey);
|
|
|
|
double _opacity(WidgetTester tester) => tester
|
|
.widget<Opacity>(find.ancestor(of: _mark, matching: find.byType(Opacity)))
|
|
.opacity;
|
|
|
|
Future<void> _type(WidgetTester tester) async {
|
|
await tester.enterText(find.byType(TextField), 'buy milk');
|
|
await tester.pump();
|
|
}
|
|
|
|
void main() {
|
|
testWidgets('typing alone neither vibrates nor shows the checkmark', (
|
|
tester,
|
|
) async {
|
|
final haptics = recordHaptics(tester);
|
|
await pumpCapture(tester);
|
|
await _type(tester);
|
|
await tester.enterText(find.byType(TextField), 'buy milk and eggs');
|
|
await tester.pump(const Duration(milliseconds: 100));
|
|
|
|
expect(haptics, isEmpty);
|
|
expect(_mark, findsNothing);
|
|
});
|
|
|
|
testWidgets('committing a captured note vibrates once, immediately', (
|
|
tester,
|
|
) async {
|
|
final haptics = recordHaptics(tester);
|
|
await pumpCapture(tester);
|
|
await _type(tester);
|
|
|
|
await tester.tap(find.bySemanticsLabel('New note'));
|
|
await tester.pump(); // one frame: the cue must not wait for anything
|
|
|
|
expect(haptics, [_lightImpact]);
|
|
await tester.pump(const Duration(milliseconds: 700));
|
|
});
|
|
|
|
testWidgets('the checkmark fades in, holds, fades out in ~600 ms', (
|
|
tester,
|
|
) async {
|
|
recordHaptics(tester);
|
|
await pumpCapture(tester);
|
|
await _type(tester);
|
|
|
|
await tester.tap(find.bySemanticsLabel('New note'));
|
|
await tester.pump();
|
|
await tester.pump(const Duration(milliseconds: 100));
|
|
expect(_mark, findsOneWidget);
|
|
expect(_opacity(tester), inExclusiveRange(0, 1)); // fading in
|
|
|
|
await tester.pump(const Duration(milliseconds: 200)); // t = 300 ms
|
|
expect(_opacity(tester), 1); // holding
|
|
|
|
await tester.pump(const Duration(milliseconds: 200)); // t = 500 ms
|
|
expect(_opacity(tester), inExclusiveRange(0, 1)); // fading out
|
|
|
|
await tester.pump(const Duration(milliseconds: 200)); // t = 700 ms
|
|
expect(_mark, findsNothing);
|
|
});
|
|
|
|
testWidgets('an empty draft is not a capture: no haptic, no checkmark', (
|
|
tester,
|
|
) async {
|
|
final haptics = recordHaptics(tester);
|
|
await pumpCapture(tester);
|
|
|
|
await tester.tap(find.bySemanticsLabel('New note'));
|
|
await tester.pump(const Duration(milliseconds: 100));
|
|
|
|
expect(haptics, isEmpty);
|
|
expect(_mark, findsNothing);
|
|
});
|
|
|
|
testWidgets('each capture confirms once; tapping the reset box does not', (
|
|
tester,
|
|
) async {
|
|
final haptics = recordHaptics(tester);
|
|
await pumpCapture(tester);
|
|
await _type(tester);
|
|
await tester.tap(find.bySemanticsLabel('New note'));
|
|
await tester.pump(); // the ticker's clock starts on its first frame
|
|
await tester.pump(const Duration(milliseconds: 700));
|
|
await tester.tap(
|
|
find.bySemanticsLabel('New note'),
|
|
); // nothing new to capture
|
|
await tester.pump(const Duration(milliseconds: 100));
|
|
expect(haptics, hasLength(1));
|
|
expect(_mark, findsNothing);
|
|
|
|
await _type(tester);
|
|
await tester.tap(find.bySemanticsLabel('New note'));
|
|
await tester.pump(const Duration(milliseconds: 100));
|
|
expect(haptics, hasLength(2));
|
|
expect(_mark, findsOneWidget);
|
|
await tester.pump(const Duration(milliseconds: 700));
|
|
});
|
|
|
|
testWidgets('remove-animations: still vibrates, checkmark static', (
|
|
tester,
|
|
) async {
|
|
final haptics = recordHaptics(tester);
|
|
disableAnimations(tester);
|
|
await pumpCapture(tester);
|
|
await _type(tester);
|
|
|
|
await tester.tap(find.bySemanticsLabel('New note'));
|
|
await tester.pump();
|
|
expect(haptics, [_lightImpact]);
|
|
|
|
await tester.pump(const Duration(milliseconds: 1));
|
|
expect(_opacity(tester), 1); // no fade-in
|
|
await tester.pump(const Duration(milliseconds: 400));
|
|
expect(_opacity(tester), 1); // no fade-out either
|
|
await tester.pump(const Duration(milliseconds: 300));
|
|
expect(_mark, findsNothing);
|
|
});
|
|
|
|
testWidgets('the checkmark reserves its width so the counter never jumps', (
|
|
tester,
|
|
) async {
|
|
recordHaptics(tester);
|
|
await pumpCapture(tester);
|
|
final before = tester.getTopLeft(find.text('0'));
|
|
await _type(tester);
|
|
await tester.tap(find.bySemanticsLabel('New note'));
|
|
await tester.pump(const Duration(milliseconds: 300));
|
|
expect(tester.getTopLeft(find.text('1')), before);
|
|
await tester.pump(const Duration(milliseconds: 400));
|
|
});
|
|
}
|