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
c2368bdd
Unverified
Commit
c2368bdd
authored
Aug 15, 2020
by
Ming Lyu (CareF)
Committed by
GitHub
Aug 15, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fix for pointer id in test gestures (#63816)
parent
d1583fc3
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
184 additions
and
53 deletions
+184
-53
text_field_test.dart
packages/flutter/test/cupertino/text_field_test.dart
+2
-2
text_field_test.dart
packages/flutter/test/material/text_field_test.dart
+3
-3
gesture_detector_test.dart
packages/flutter/test/widgets/gesture_detector_test.dart
+83
-17
selectable_text_test.dart
packages/flutter/test/widgets/selectable_text_test.dart
+3
-3
text_selection_test.dart
packages/flutter/test/widgets/text_selection_test.dart
+45
-21
controller.dart
packages/flutter_test/lib/src/controller.dart
+9
-6
controller_test.dart
packages/flutter_test/test/controller_test.dart
+39
-1
No files found.
packages/flutter/test/cupertino/text_field_test.dart
View file @
c2368bdd
...
...
@@ -2216,7 +2216,7 @@ void main() {
final
Offset
textfieldStart
=
tester
.
getTopLeft
(
find
.
byType
(
CupertinoTextField
));
const
int
pointerValue
=
1
;
final
int
pointerValue
=
tester
.
nextPointer
;
final
TestGesture
gesture
=
await
tester
.
createGesture
();
await
gesture
.
downWithCustomEvent
(
textfieldStart
+
const
Offset
(
150.0
,
5.0
),
...
...
@@ -2256,7 +2256,7 @@ void main() {
final
Offset
textfieldStart
=
tester
.
getTopLeft
(
find
.
byType
(
CupertinoTextField
));
const
int
pointerValue
=
1
;
final
int
pointerValue
=
tester
.
nextPointer
;
final
TestGesture
gesture
=
await
tester
.
createGesture
();
await
gesture
.
downWithCustomEvent
(
textfieldStart
+
const
Offset
(
150.0
,
5.0
),
...
...
packages/flutter/test/material/text_field_test.dart
View file @
c2368bdd
...
...
@@ -6988,7 +6988,7 @@ void main() {
final
Offset
offset
=
tester
.
getTopLeft
(
find
.
byType
(
TextField
))
+
const
Offset
(
150.0
,
9.0
);
const
int
pointerValue
=
1
;
final
int
pointerValue
=
tester
.
nextPointer
;
final
TestGesture
gesture
=
await
tester
.
createGesture
();
await
gesture
.
downWithCustomEvent
(
offset
,
...
...
@@ -7026,7 +7026,7 @@ void main() {
final
Offset
textfieldStart
=
tester
.
getTopLeft
(
find
.
byType
(
TextField
));
const
int
pointerValue
=
1
;
final
int
pointerValue
=
tester
.
nextPointer
;
final
Offset
offset
=
textfieldStart
+
const
Offset
(
150.0
,
9.0
);
final
TestGesture
gesture
=
await
tester
.
createGesture
();
await
gesture
.
downWithCustomEvent
(
...
...
@@ -7077,7 +7077,7 @@ void main() {
final
Offset
textfieldStart
=
tester
.
getTopLeft
(
find
.
byType
(
TextField
));
const
int
pointerValue
=
1
;
final
int
pointerValue
=
tester
.
nextPointer
;
final
Offset
offset
=
textfieldStart
+
const
Offset
(
150.0
,
9.0
);
final
TestGesture
gesture
=
await
tester
.
createGesture
();
await
gesture
.
downWithCustomEvent
(
...
...
packages/flutter/test/widgets/gesture_detector_test.dart
View file @
c2368bdd
...
...
@@ -501,12 +501,12 @@ void main() {
),
),
);
const
int
pointerValue
=
1
;
final
int
pointerValue
=
tester
.
nextPointer
;
final
TestGesture
gesture
=
await
tester
.
createGesture
();
await
gesture
.
downWithCustomEvent
(
forcePressOffset
,
const
PointerDownEvent
(
PointerDownEvent
(
pointer:
pointerValue
,
position:
forcePressOffset
,
pressure:
0.0
,
...
...
@@ -515,31 +515,73 @@ void main() {
),
);
await
gesture
.
updateWithCustomEvent
(
const
PointerMoveEvent
(
pointer:
pointerValue
,
position:
Offset
(
0.0
,
0.0
),
pressure:
0.3
,
pressureMin:
0
,
pressureMax:
1
));
await
gesture
.
updateWithCustomEvent
(
PointerMoveEvent
(
pointer:
pointerValue
,
position:
const
Offset
(
0.0
,
0.0
),
pressure:
0.3
,
pressureMin:
0
,
pressureMax:
1
,
));
expect
(
forcePressStart
,
0
);
expect
(
forcePressPeaked
,
0
);
expect
(
forcePressUpdate
,
0
);
expect
(
forcePressEnded
,
0
);
await
gesture
.
updateWithCustomEvent
(
const
PointerMoveEvent
(
pointer:
pointerValue
,
position:
Offset
(
0.0
,
0.0
),
pressure:
0.5
,
pressureMin:
0
,
pressureMax:
1
));
await
gesture
.
updateWithCustomEvent
(
PointerMoveEvent
(
pointer:
pointerValue
,
position:
const
Offset
(
0.0
,
0.0
),
pressure:
0.5
,
pressureMin:
0
,
pressureMax:
1
));
expect
(
forcePressStart
,
1
);
expect
(
forcePressPeaked
,
0
);
expect
(
forcePressUpdate
,
1
);
expect
(
forcePressEnded
,
0
);
await
gesture
.
updateWithCustomEvent
(
const
PointerMoveEvent
(
pointer:
pointerValue
,
position:
Offset
(
0.0
,
0.0
),
pressure:
0.6
,
pressureMin:
0
,
pressureMax:
1
));
await
gesture
.
updateWithCustomEvent
(
const
PointerMoveEvent
(
pointer:
pointerValue
,
position:
Offset
(
0.0
,
0.0
),
pressure:
0.7
,
pressureMin:
0
,
pressureMax:
1
));
await
gesture
.
updateWithCustomEvent
(
const
PointerMoveEvent
(
pointer:
pointerValue
,
position:
Offset
(
0.0
,
0.0
),
pressure:
0.2
,
pressureMin:
0
,
pressureMax:
1
));
await
gesture
.
updateWithCustomEvent
(
const
PointerMoveEvent
(
pointer:
pointerValue
,
position:
Offset
(
0.0
,
0.0
),
pressure:
0.3
,
pressureMin:
0
,
pressureMax:
1
));
await
gesture
.
updateWithCustomEvent
(
PointerMoveEvent
(
pointer:
pointerValue
,
position:
const
Offset
(
0.0
,
0.0
),
pressure:
0.6
,
pressureMin:
0
,
pressureMax:
1
,
));
await
gesture
.
updateWithCustomEvent
(
PointerMoveEvent
(
pointer:
pointerValue
,
position:
const
Offset
(
0.0
,
0.0
),
pressure:
0.7
,
pressureMin:
0
,
pressureMax:
1
));
await
gesture
.
updateWithCustomEvent
(
PointerMoveEvent
(
pointer:
pointerValue
,
position:
const
Offset
(
0.0
,
0.0
),
pressure:
0.2
,
pressureMin:
0
,
pressureMax:
1
));
await
gesture
.
updateWithCustomEvent
(
PointerMoveEvent
(
pointer:
pointerValue
,
position:
const
Offset
(
0.0
,
0.0
),
pressure:
0.3
,
pressureMin:
0
,
pressureMax:
1
));
expect
(
forcePressStart
,
1
);
expect
(
forcePressPeaked
,
0
);
expect
(
forcePressUpdate
,
5
);
expect
(
forcePressEnded
,
0
);
await
gesture
.
updateWithCustomEvent
(
const
PointerMoveEvent
(
pointer:
pointerValue
,
position:
Offset
(
0.0
,
0.0
),
pressure:
0.9
,
pressureMin:
0
,
pressureMax:
1
));
await
gesture
.
updateWithCustomEvent
(
PointerMoveEvent
(
pointer:
pointerValue
,
position:
const
Offset
(
0.0
,
0.0
),
pressure:
0.9
,
pressureMin:
0
,
pressureMax:
1
,
));
expect
(
forcePressStart
,
1
);
expect
(
forcePressPeaked
,
1
);
...
...
@@ -573,14 +615,14 @@ void main() {
),
);
const
int
pointerValue
=
1
;
final
int
pointerValue
=
tester
.
nextPointer
;
const
double
maxPressure
=
6.0
;
final
TestGesture
gesture
=
await
tester
.
createGesture
();
await
gesture
.
downWithCustomEvent
(
forcePressOffset
,
const
PointerDownEvent
(
PointerDownEvent
(
pointer:
pointerValue
,
position:
forcePressOffset
,
pressure:
0.0
,
...
...
@@ -589,7 +631,13 @@ void main() {
),
);
await
gesture
.
updateWithCustomEvent
(
const
PointerMoveEvent
(
pointer:
pointerValue
,
position:
Offset
(
400.0
,
50.0
),
pressure:
0.3
,
pressureMin:
0
,
pressureMax:
maxPressure
));
await
gesture
.
updateWithCustomEvent
(
PointerMoveEvent
(
pointer:
pointerValue
,
position:
const
Offset
(
400.0
,
50.0
),
pressure:
0.3
,
pressureMin:
0
,
pressureMax:
maxPressure
));
expect
(
forcePressStart
,
0
);
expect
(
longPressTimes
,
0
);
...
...
@@ -601,7 +649,13 @@ void main() {
expect
(
forcePressStart
,
0
);
// Failed attempt to trigger the force press.
await
gesture
.
updateWithCustomEvent
(
const
PointerMoveEvent
(
pointer:
pointerValue
,
position:
Offset
(
400.0
,
50.0
),
pressure:
0.5
,
pressureMin:
0
,
pressureMax:
maxPressure
));
await
gesture
.
updateWithCustomEvent
(
PointerMoveEvent
(
pointer:
pointerValue
,
position:
const
Offset
(
400.0
,
50.0
),
pressure:
0.5
,
pressureMin:
0
,
pressureMax:
maxPressure
));
expect
(
longPressTimes
,
1
);
expect
(
forcePressStart
,
0
);
...
...
@@ -626,13 +680,13 @@ void main() {
),
);
const
int
pointerValue
=
1
;
final
int
pointerValue
=
tester
.
nextPointer
;
final
TestGesture
gesture
=
await
tester
.
createGesture
();
await
gesture
.
downWithCustomEvent
(
forcePressOffset
,
const
PointerDownEvent
(
PointerDownEvent
(
pointer:
pointerValue
,
position:
forcePressOffset
,
pressure:
0.0
,
...
...
@@ -641,7 +695,13 @@ void main() {
),
);
await
gesture
.
updateWithCustomEvent
(
const
PointerMoveEvent
(
pointer:
pointerValue
,
position:
Offset
(
0.0
,
0.0
),
pressure:
0.3
,
pressureMin:
0
,
pressureMax:
1
));
await
gesture
.
updateWithCustomEvent
(
PointerMoveEvent
(
pointer:
pointerValue
,
position:
const
Offset
(
0.0
,
0.0
),
pressure:
0.3
,
pressureMin:
0
,
pressureMax:
1
));
expect
(
forcePressStart
,
0
);
expect
(
horizontalDragStart
,
0
);
...
...
@@ -653,7 +713,13 @@ void main() {
expect
(
forcePressStart
,
0
);
// Failed attempt to trigger the force press.
await
gesture
.
updateWithCustomEvent
(
const
PointerMoveEvent
(
pointer:
pointerValue
,
position:
Offset
(
0.0
,
0.0
),
pressure:
0.5
,
pressureMin:
0
,
pressureMax:
1
));
await
gesture
.
updateWithCustomEvent
(
PointerMoveEvent
(
pointer:
pointerValue
,
position:
const
Offset
(
0.0
,
0.0
),
pressure:
0.5
,
pressureMin:
0
,
pressureMax:
1
,
));
expect
(
horizontalDragStart
,
1
);
expect
(
forcePressStart
,
0
);
...
...
packages/flutter/test/widgets/selectable_text_test.dart
View file @
c2368bdd
...
...
@@ -3117,7 +3117,7 @@ void main() {
final
Offset
offset
=
tester
.
getTopLeft
(
find
.
byType
(
SelectableText
))
+
const
Offset
(
150.0
,
5.0
);
const
int
pointerValue
=
1
;
final
int
pointerValue
=
tester
.
nextPointer
;
final
TestGesture
gesture
=
await
tester
.
createGesture
();
await
gesture
.
downWithCustomEvent
(
offset
,
...
...
@@ -3153,7 +3153,7 @@ void main() {
final
Offset
selectableTextStart
=
tester
.
getTopLeft
(
find
.
byType
(
SelectableText
));
const
int
pointerValue
=
1
;
final
int
pointerValue
=
tester
.
nextPointer
;
final
Offset
offset
=
selectableTextStart
+
const
Offset
(
150.0
,
5.0
);
final
TestGesture
gesture
=
await
tester
.
createGesture
();
await
gesture
.
downWithCustomEvent
(
...
...
@@ -3194,7 +3194,7 @@ void main() {
final
Offset
selectableTextStart
=
tester
.
getTopLeft
(
find
.
byType
(
SelectableText
));
const
int
pointerValue
=
1
;
final
int
pointerValue
=
tester
.
nextPointer
;
final
Offset
offset
=
selectableTextStart
+
const
Offset
(
150.0
,
5.0
);
final
TestGesture
gesture
=
await
tester
.
createGesture
();
await
gesture
.
downWithCustomEvent
(
...
...
packages/flutter/test/widgets/text_selection_test.dart
View file @
c2368bdd
...
...
@@ -198,13 +198,13 @@ void main() {
testWidgets
(
'a force press initiates a force press'
,
(
WidgetTester
tester
)
async
{
await
pumpGestureDetector
(
tester
);
const
int
pointerValue
=
1
;
final
int
pointerValue
=
tester
.
nextPointer
;
final
TestGesture
gesture
=
await
tester
.
createGesture
();
await
gesture
.
downWithCustomEvent
(
forcePressOffset
,
const
PointerDownEvent
(
PointerDownEvent
(
pointer:
pointerValue
,
position:
forcePressOffset
,
pressure:
0.0
,
...
...
@@ -213,13 +213,19 @@ void main() {
),
);
await
gesture
.
updateWithCustomEvent
(
const
PointerMoveEvent
(
pointer:
pointerValue
,
position:
Offset
(
0.0
,
0.0
),
pressure:
0.5
,
pressureMin:
0
,
pressureMax:
1
));
await
gesture
.
updateWithCustomEvent
(
PointerMoveEvent
(
pointer:
pointerValue
,
position:
const
Offset
(
0.0
,
0.0
),
pressure:
0.5
,
pressureMin:
0
,
pressureMax:
1
,
));
await
gesture
.
up
();
await
tester
.
pumpAndSettle
();
await
gesture
.
downWithCustomEvent
(
forcePressOffset
,
const
PointerDownEvent
(
PointerDownEvent
(
pointer:
pointerValue
,
position:
forcePressOffset
,
pressure:
0.0
,
...
...
@@ -227,13 +233,19 @@ void main() {
pressureMin:
0.0
,
),
);
await
gesture
.
updateWithCustomEvent
(
const
PointerMoveEvent
(
pointer:
pointerValue
,
position:
Offset
(
0.0
,
0.0
),
pressure:
0.5
,
pressureMin:
0
,
pressureMax:
1
));
await
gesture
.
updateWithCustomEvent
(
PointerMoveEvent
(
pointer:
pointerValue
,
position:
const
Offset
(
0.0
,
0.0
),
pressure:
0.5
,
pressureMin:
0
,
pressureMax:
1
,
));
await
gesture
.
up
();
await
tester
.
pump
(
const
Duration
(
milliseconds:
20
));
await
gesture
.
downWithCustomEvent
(
forcePressOffset
,
const
PointerDownEvent
(
PointerDownEvent
(
pointer:
pointerValue
,
position:
forcePressOffset
,
pressure:
0.0
,
...
...
@@ -241,13 +253,19 @@ void main() {
pressureMin:
0.0
,
),
);
await
gesture
.
updateWithCustomEvent
(
const
PointerMoveEvent
(
pointer:
pointerValue
,
position:
Offset
(
0.0
,
0.0
),
pressure:
0.5
,
pressureMin:
0
,
pressureMax:
1
));
await
gesture
.
updateWithCustomEvent
(
PointerMoveEvent
(
pointer:
pointerValue
,
position:
const
Offset
(
0.0
,
0.0
),
pressure:
0.5
,
pressureMin:
0
,
pressureMax:
1
,
));
await
gesture
.
up
();
await
tester
.
pump
(
const
Duration
(
milliseconds:
20
));
await
gesture
.
downWithCustomEvent
(
forcePressOffset
,
const
PointerDownEvent
(
PointerDownEvent
(
pointer:
pointerValue
,
position:
forcePressOffset
,
pressure:
0.0
,
...
...
@@ -255,7 +273,13 @@ void main() {
pressureMin:
0.0
,
),
);
await
gesture
.
updateWithCustomEvent
(
const
PointerMoveEvent
(
pointer:
pointerValue
,
position:
Offset
(
0.0
,
0.0
),
pressure:
0.5
,
pressureMin:
0
,
pressureMax:
1
));
await
gesture
.
updateWithCustomEvent
(
PointerMoveEvent
(
pointer:
pointerValue
,
position:
const
Offset
(
0.0
,
0.0
),
pressure:
0.5
,
pressureMin:
0
,
pressureMax:
1
,
));
await
gesture
.
up
();
expect
(
forcePressStartCount
,
4
);
...
...
@@ -264,11 +288,11 @@ void main() {
testWidgets
(
'a tap and then force press initiates a force press and not a double tap'
,
(
WidgetTester
tester
)
async
{
await
pumpGestureDetector
(
tester
);
const
int
pointerValue
=
1
;
final
int
pointerValue
=
tester
.
nextPointer
;
final
TestGesture
gesture
=
await
tester
.
createGesture
();
await
gesture
.
downWithCustomEvent
(
forcePressOffset
,
const
PointerDownEvent
(
PointerDownEvent
(
pointer:
pointerValue
,
position:
forcePressOffset
,
pressure:
0.0
,
...
...
@@ -279,9 +303,9 @@ void main() {
);
// Initiate a quick tap.
await
gesture
.
updateWithCustomEvent
(
const
PointerMoveEvent
(
PointerMoveEvent
(
pointer:
pointerValue
,
position:
Offset
(
0.0
,
0.0
),
position:
const
Offset
(
0.0
,
0.0
),
pressure:
0.0
,
pressureMin:
0
,
pressureMax:
1
,
...
...
@@ -293,7 +317,7 @@ void main() {
// Initiate a force tap.
await
gesture
.
downWithCustomEvent
(
forcePressOffset
,
const
PointerDownEvent
(
PointerDownEvent
(
pointer:
pointerValue
,
position:
forcePressOffset
,
pressure:
0.0
,
...
...
@@ -301,9 +325,9 @@ void main() {
pressureMin:
0.0
,
),
);
await
gesture
.
updateWithCustomEvent
(
const
PointerMoveEvent
(
await
gesture
.
updateWithCustomEvent
(
PointerMoveEvent
(
pointer:
pointerValue
,
position:
Offset
(
0.0
,
0.0
),
position:
const
Offset
(
0.0
,
0.0
),
pressure:
0.5
,
pressureMin:
0
,
pressureMax:
1
,
...
...
@@ -321,7 +345,7 @@ void main() {
testWidgets
(
'a long press from a touch device is recognized as a long single tap'
,
(
WidgetTester
tester
)
async
{
await
pumpGestureDetector
(
tester
);
const
int
pointerValue
=
1
;
final
int
pointerValue
=
tester
.
nextPointer
;
final
TestGesture
gesture
=
await
tester
.
startGesture
(
const
Offset
(
200.0
,
200.0
),
pointer:
pointerValue
,
...
...
@@ -340,7 +364,7 @@ void main() {
testWidgets
(
'a long press from a mouse is just a tap'
,
(
WidgetTester
tester
)
async
{
await
pumpGestureDetector
(
tester
);
const
int
pointerValue
=
1
;
final
int
pointerValue
=
tester
.
nextPointer
;
final
TestGesture
gesture
=
await
tester
.
startGesture
(
const
Offset
(
200.0
,
200.0
),
pointer:
pointerValue
,
...
...
@@ -359,7 +383,7 @@ void main() {
testWidgets
(
'a touch drag is not recognized for text selection'
,
(
WidgetTester
tester
)
async
{
await
pumpGestureDetector
(
tester
);
const
int
pointerValue
=
1
;
final
int
pointerValue
=
tester
.
nextPointer
;
final
TestGesture
gesture
=
await
tester
.
startGesture
(
const
Offset
(
200.0
,
200.0
),
pointer:
pointerValue
,
...
...
@@ -382,7 +406,7 @@ void main() {
testWidgets
(
'a mouse drag is recognized for text selection'
,
(
WidgetTester
tester
)
async
{
await
pumpGestureDetector
(
tester
);
const
int
pointerValue
=
1
;
final
int
pointerValue
=
tester
.
nextPointer
;
final
TestGesture
gesture
=
await
tester
.
startGesture
(
const
Offset
(
200.0
,
200.0
),
pointer:
pointerValue
,
...
...
@@ -405,7 +429,7 @@ void main() {
testWidgets
(
'a slow mouse drag is still recognized for text selection'
,
(
WidgetTester
tester
)
async
{
await
pumpGestureDetector
(
tester
);
const
int
pointerValue
=
1
;
final
int
pointerValue
=
tester
.
nextPointer
;
final
TestGesture
gesture
=
await
tester
.
startGesture
(
const
Offset
(
200.0
,
200.0
),
pointer:
pointerValue
,
...
...
packages/flutter_test/lib/src/controller.dart
View file @
c2368bdd
...
...
@@ -662,6 +662,7 @@ abstract class WidgetController {
assert
(
frequency
>
0
);
final
int
intervals
=
duration
.
inMicroseconds
*
frequency
~/
1
E6
;
assert
(
intervals
>
1
);
pointer
??=
_getNextPointer
();
final
List
<
Duration
>
timeStamps
=
<
Duration
>[
for
(
int
t
=
0
;
t
<=
intervals
;
t
+=
1
)
duration
*
t
~/
intervals
,
...
...
@@ -701,8 +702,8 @@ abstract class WidgetController {
timeStamp:
duration
,
position:
offsets
.
last
,
pointer:
pointer
,
// The PointerData rec
ie
ved from the engine with
// cha
gne = PointerChna
ge.up, which translates to PointerUpEvent,
// The PointerData rec
ei
ved from the engine with
// cha
nge = PointerChan
ge.up, which translates to PointerUpEvent,
// doesn't provide the button field.
// buttons: buttons,
)
...
...
@@ -717,11 +718,13 @@ abstract class WidgetController {
///
/// This is the default pointer identifier that will be used the next time the
/// [startGesture] method is called without an explicit pointer identifier.
int
nextPointer
=
1
;
int
get
nextPointer
=>
_nextPointer
;
int
_getNextPointer
()
{
final
int
result
=
nextPointer
;
nextPointer
+=
1
;
static
int
_nextPointer
=
1
;
static
int
_getNextPointer
()
{
final
int
result
=
_nextPointer
;
_nextPointer
+=
1
;
return
result
;
}
...
...
packages/flutter_test/test/controller_test.dart
View file @
c2368bdd
...
...
@@ -577,7 +577,7 @@ void main() {
}
});
testWidgets
(
testWidgets
(
'WidgetTester.timedDrag must respect buttons'
,
(
WidgetTester
tester
)
async
{
final
List
<
String
>
logs
=
<
String
>[];
...
...
@@ -614,6 +614,44 @@ void main() {
},
);
testWidgets
(
'WidgetTester.timedDrag uses correct pointer'
,
(
WidgetTester
tester
)
async
{
final
List
<
String
>
logs
=
<
String
>[];
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
Listener
(
onPointerDown:
(
PointerDownEvent
event
)
=>
logs
.
add
(
'down
${event.pointer}
'
),
child:
const
Text
(
'test'
),
),
),
);
await
tester
.
timedDrag
(
find
.
text
(
'test'
),
const
Offset
(-
200.0
,
0.0
),
const
Duration
(
seconds:
1
),
buttons:
kSecondaryMouseButton
,
);
await
tester
.
pumpAndSettle
();
await
tester
.
timedDrag
(
find
.
text
(
'test'
),
const
Offset
(
200.0
,
0.0
),
const
Duration
(
seconds:
1
),
buttons:
kSecondaryMouseButton
,
);
await
tester
.
pumpAndSettle
();
expect
(
logs
.
length
,
2
);
expect
(
logs
[
0
],
isNotNull
);
expect
(
logs
[
1
],
isNotNull
);
expect
(
logs
[
1
]
!=
logs
[
0
],
isTrue
);
},
);
testWidgets
(
'ensureVisible: scrolls to make widget visible'
,
(
WidgetTester
tester
)
async
{
...
...
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