File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -3,3 +3,4 @@ library flutter_test_robots;
33export 'src/clipboard.dart' ;
44export 'src/input_method_engine.dart' ;
55export 'src/keyboard.dart' ;
6+ export 'src/scrollbar.dart' ;
Original file line number Diff line number Diff line change 1+ import 'package:flutter/gestures.dart' ;
2+ import 'package:flutter_test/flutter_test.dart' ;
3+
4+ /// Simulates the user interacting with a Scrollbar.
5+ extension ScrollbarInteractions on WidgetTester {
6+ /// Press a scrollbar thumb at [thumbLocation] and drag it vertically by [delta] pixels.
7+ Future <void > dragScrollbar (Offset thumbLocation, double delta) async {
8+ //Hover to make the thumb visible with a duration long enough to run the fade in animation.
9+ final testPointer = TestPointer (1 , PointerDeviceKind .mouse);
10+
11+ await sendEventToBinding (testPointer.hover (thumbLocation, timeStamp: const Duration (seconds: 1 )));
12+ await pumpAndSettle ();
13+
14+ // Press the thumb.
15+ await sendEventToBinding (testPointer.down (thumbLocation));
16+ await pump (const Duration (milliseconds: 40 ));
17+
18+ // Move the thumb down.
19+ await sendEventToBinding (testPointer.move (thumbLocation + Offset (0 , delta)));
20+ await pump ();
21+
22+ // Release the pointer.
23+ await sendEventToBinding (testPointer.up ());
24+ await pump ();
25+ }
26+ }
You can’t perform that action at this time.
0 commit comments