Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
2965d81a
Unverified
Commit
2965d81a
authored
Aug 11, 2020
by
Ming Lyu (CareF)
Committed by
GitHub
Aug 11, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update for WidgetTester.move and WidgetTester.fling doc (#63390)
parent
111f76b6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
31 deletions
+30
-31
controller.dart
packages/flutter_test/lib/src/controller.dart
+30
-31
No files found.
packages/flutter_test/lib/src/controller.dart
View file @
2965d81a
...
@@ -304,13 +304,26 @@ abstract class WidgetController {
...
@@ -304,13 +304,26 @@ abstract class WidgetController {
/// If the middle of the widget is not exposed, this might send
/// If the middle of the widget is not exposed, this might send
/// events to another object.
/// events to another object.
///
///
/// This can pump frames. See [flingFrom] for a discussion of how the
/// {@template flutter.flutter_test.fling}
/// `offset`, `velocity` and `frameInterval` arguments affect this.
/// This can pump frames.
///
/// Exactly 50 pointer events are synthesized.
///
///
/// The `speed` is in pixels per second in the direction given by `offset`.
/// The `speed` is in pixels per second in the direction given by `offset`.
///
///
/// A fling is essentially a drag that ends at a particular speed. If you
/// The `offset` and `speed` control the interval between each pointer event.
/// just want to drag and end without a fling, use [drag].
/// For example, if the `offset` is 200 pixels down, and the `speed` is 800
/// pixels per second, the pointer events will be sent for each increment
/// of 4 pixels (200/50), over 250ms (200/800), meaning events will be sent
/// every 1.25ms (250/200).
///
/// To make tests more realistic, frames may be pumped during this time (using
/// calls to [pump]). If the total duration is longer than `frameInterval`,
/// then one frame is pumped each time that amount of time elapses while
/// sending events, or each time an event is synthesized, whichever is rarer.
///
/// See [LiveTestWidgetsFlutterBindingFramePolicy.benchmarkLive] if the method
/// is used in a live environment and accurate time control is important.
///
///
/// The `initialOffset` argument, if non-zero, causes the pointer to first
/// The `initialOffset` argument, if non-zero, causes the pointer to first
/// apply that offset, then pump a delay of `initialOffsetDelay`. This can be
/// apply that offset, then pump a delay of `initialOffsetDelay`. This can be
...
@@ -318,6 +331,10 @@ abstract class WidgetController {
...
@@ -318,6 +331,10 @@ abstract class WidgetController {
/// opposite direction of the fling (e.g. dragging 200 pixels to the right,
/// opposite direction of the fling (e.g. dragging 200 pixels to the right,
/// then fling to the left over 200 pixels, ending at the exact point that the
/// then fling to the left over 200 pixels, ending at the exact point that the
/// drag started).
/// drag started).
/// {@endtemplate}
///
/// A fling is essentially a drag that ends at a particular speed. If you
/// just want to drag and end without a fling, use [drag].
Future
<
void
>
fling
(
Future
<
void
>
fling
(
Finder
finder
,
Finder
finder
,
Offset
offset
,
Offset
offset
,
...
@@ -343,28 +360,10 @@ abstract class WidgetController {
...
@@ -343,28 +360,10 @@ abstract class WidgetController {
/// Attempts a fling gesture starting from the given location, moving the
/// Attempts a fling gesture starting from the given location, moving the
/// given distance, reaching the given speed.
/// given distance, reaching the given speed.
///
///
/// Exactly 50 pointer events are synthesized.
/// {@macro flutter.flutter_test.fling}
///
/// The offset and speed control the interval between each pointer event. For
/// example, if the offset is 200 pixels down, and the speed is 800 pixels per
/// second, the pointer events will be sent for each increment of 4 pixels
/// (200/50), over 250ms (200/800), meaning events will be sent every 1.25ms
/// (250/200).
///
/// To make tests more realistic, frames may be pumped during this time (using
/// calls to [pump]). If the total duration is longer than `frameInterval`,
/// then one frame is pumped each time that amount of time elapses while
/// sending events, or each time an event is synthesized, whichever is rarer.
///
///
/// A fling is essentially a drag that ends at a particular speed. If you
/// A fling is essentially a drag that ends at a particular speed. If you
/// just want to drag and end without a fling, use [dragFrom].
/// just want to drag and end without a fling, use [dragFrom].
///
/// The `initialOffset` argument, if non-zero, causes the pointer to first
/// apply that offset, then pump a delay of `initialOffsetDelay`. This can be
/// used to simulate a drag followed by a fling, including dragging in the
/// opposite direction of the fling (e.g. dragging 200 pixels to the right,
/// then fling to the left over 200 pixels, ending at the exact point that the
/// drag started).
Future
<
void
>
flingFrom
(
Future
<
void
>
flingFrom
(
Offset
startLocation
,
Offset
startLocation
,
Offset
offset
,
Offset
offset
,
...
@@ -478,20 +477,20 @@ abstract class WidgetController {
...
@@ -478,20 +477,20 @@ abstract class WidgetController {
/// system identifies the gesture as a fling, consider using [fling] instead.
/// system identifies the gesture as a fling, consider using [fling] instead.
///
///
/// {@template flutter.flutter_test.drag}
/// {@template flutter.flutter_test.drag}
/// By default, if the x or y component of offset is greater than
[kTouchSlop], the
/// By default, if the x or y component of offset is greater than
///
gesture is broken up into two separate moves calls. Changing 'touchSlopX' or
///
[kDragSlopDefault], the gesture is broken up into two separate moves
///
`touchSlopY` will change the minimum amount of movement in the respective axis
///
calls. Changing `touchSlopX` or `touchSlopY` will change the minimum
///
before the drag will be broken into multiple calls. To always send the
///
amount of movement in the respective axis before the drag will be broken
///
drag with just a single call to [TestGesture.moveBy], `touchSlopX` and `touchSlopY`
///
into multiple calls. To always send the drag with just a single call to
/// should be set to 0.
///
[TestGesture.moveBy], `touchSlopX` and `touchSlopY`
should be set to 0.
///
///
/// Breaking the drag into multiple moves is necessary for accurate execution
/// Breaking the drag into multiple moves is necessary for accurate execution
/// of drag update calls with a [DragStartBehavior] variable set to
/// of drag update calls with a [DragStartBehavior] variable set to
/// [DragStartBehavior.start]. Without such a change, the dragUpdate callback
/// [DragStartBehavior.start]. Without such a change, the dragUpdate callback
/// from a drag recognizer will never be invoked.
/// from a drag recognizer will never be invoked.
///
///
/// To force this function to a send a single move event, the
'touchSlopX'
and
/// To force this function to a send a single move event, the
`touchSlopX`
and
///
'touchSlopY'
variables should be set to 0. However, generally, these values
///
`touchSlopY`
variables should be set to 0. However, generally, these values
/// should be left to their default values.
/// should be left to their default values.
/// {@endtemplate}
/// {@endtemplate}
Future
<
void
>
drag
(
Future
<
void
>
drag
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment