perf(player): 优化点击响应与互动反馈
This commit is contained in:
1 parent
3ad371aa9d
commit
35cbdd2bd3
4 files changed
+30
-15
No files matched your search
@@ -16,8 +16,10 @@ import '../support/fake_haptics.dart';
|
||||
import '../support/fake_interaction_repositories.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('double tap within 320ms never pauses', (tester) async {
|
||||
for (final delay in [120, 250, 300]) {
|
||||
testWidgets('should_like_without_pausing_when_double_tap_within_240ms', (
|
||||
tester,
|
||||
) async {
|
||||
for (final delay in [80, 160, 220]) {
|
||||
final repository = FakeInteractionRepository();
|
||||
final haptics = FakeHaptics();
|
||||
final key = GlobalKey<_HarnessState>();
|
||||
@@ -53,7 +55,7 @@ void main() {
|
||||
}
|
||||
});
|
||||
|
||||
testWidgets('taps 500ms apart toggle playback twice', (tester) async {
|
||||
testWidgets('should_toggle_twice_when_taps_are_260ms_apart', (tester) async {
|
||||
final key = GlobalKey<_HarnessState>();
|
||||
final clock = _TestClock();
|
||||
await _pumpHarness(
|
||||
@@ -67,15 +69,15 @@ void main() {
|
||||
await tester.tapAt(
|
||||
tester.getCenter(find.byKey(const Key('home-feed-gesture'))),
|
||||
);
|
||||
clock.advance(const Duration(milliseconds: 500));
|
||||
await tester.pump(const Duration(milliseconds: 500));
|
||||
clock.advance(const Duration(milliseconds: 260));
|
||||
await tester.pump(const Duration(milliseconds: 260));
|
||||
expect(key.currentState!.pauseToggles, 1);
|
||||
|
||||
await tester.tapAt(
|
||||
tester.getCenter(find.byKey(const Key('home-feed-gesture'))),
|
||||
);
|
||||
clock.advance(const Duration(milliseconds: 500));
|
||||
await tester.pump(const Duration(milliseconds: 500));
|
||||
clock.advance(const Duration(milliseconds: 260));
|
||||
await tester.pump(const Duration(milliseconds: 260));
|
||||
expect(key.currentState!.pauseToggles, 2);
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user