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
f013b25b
Unverified
Commit
f013b25b
authored
Jan 17, 2020
by
Greg Spencer
Committed by
GitHub
Jan 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add TargetPlatform.macOS tests to the widgets library. (#48997)
parent
3dbe90e1
Changes
16
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
178 additions
and
259 deletions
+178
-259
draggable_scrollable_sheet_test.dart
...flutter/test/widgets/draggable_scrollable_sheet_test.dart
+8
-8
drawer_test.dart
packages/flutter/test/widgets/drawer_test.dart
+3
-7
editable_text_cursor_test.dart
packages/flutter/test/widgets/editable_text_cursor_test.dart
+17
-27
editable_text_test.dart
packages/flutter/test/widgets/editable_text_test.dart
+3
-7
heroes_test.dart
packages/flutter/test/widgets/heroes_test.dart
+5
-17
list_wheel_scroll_view_test.dart
...ges/flutter/test/widgets/list_wheel_scroll_view_test.dart
+1
-5
modal_barrier_test.dart
packages/flutter/test/widgets/modal_barrier_test.dart
+1
-4
nested_scroll_view_test.dart
packages/flutter/test/widgets/nested_scroll_view_test.dart
+8
-13
page_transitions_test.dart
packages/flutter/test/widgets/page_transitions_test.dart
+6
-15
page_view_test.dart
packages/flutter/test/widgets/page_view_test.dart
+1
-2
scrollable_dispose_test.dart
packages/flutter/test/widgets/scrollable_dispose_test.dart
+2
-5
scrollable_fling_test.dart
packages/flutter/test/widgets/scrollable_fling_test.dart
+13
-3
scrollable_test.dart
packages/flutter/test/widgets/scrollable_test.dart
+43
-31
selectable_text_test.dart
packages/flutter/test/widgets/selectable_text_test.dart
+60
-84
sliver_fill_remaining_test.dart
...ages/flutter/test/widgets/sliver_fill_remaining_test.dart
+6
-26
text_selection_test.dart
packages/flutter/test/widgets/text_selection_test.dart
+1
-5
No files found.
packages/flutter/test/widgets/draggable_scrollable_sheet_test.dart
View file @
f013b25b
...
...
@@ -105,7 +105,7 @@ void main() {
expect
(
find
.
text
(
'Item 1'
),
findsOneWidget
);
expect
(
find
.
text
(
'Item 21'
),
findsOneWidget
);
expect
(
find
.
text
(
'Item 31'
),
findsOneWidget
);
},
skip:
isBrowser
);
},
skip:
isBrowser
,
variant:
TargetPlatformVariant
.
all
()
);
testWidgets
(
'Can be dragged down when not full height'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
_boilerplate
(
null
));
...
...
@@ -118,7 +118,7 @@ void main() {
expect
(
find
.
text
(
'Item 1'
),
findsOneWidget
);
expect
(
find
.
text
(
'Item 21'
),
findsNothing
);
expect
(
find
.
text
(
'Item 36'
),
findsNothing
);
},
skip:
isBrowser
);
},
skip:
isBrowser
,
variant:
TargetPlatformVariant
.
all
()
);
testWidgets
(
'Can be dragged down when list is shorter than full height'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
_boilerplate
(
null
,
itemCount:
30
,
initialChildSize:
.
25
));
...
...
@@ -135,7 +135,7 @@ void main() {
await
tester
.
pumpAndSettle
();
expect
(
find
.
text
(
'Item 1'
).
hitTestable
(),
findsOneWidget
);
expect
(
find
.
text
(
'Item 29'
).
hitTestable
(),
findsNothing
);
},
skip:
isBrowser
);
},
skip:
isBrowser
,
variant:
TargetPlatformVariant
.
all
()
);
testWidgets
(
'Can be dragged up and cover its container and scroll in single motion, and then dragged back down'
,
(
WidgetTester
tester
)
async
{
int
taps
=
0
;
...
...
@@ -164,7 +164,7 @@ void main() {
expect
(
find
.
text
(
'Item 1'
),
findsOneWidget
);
expect
(
find
.
text
(
'Item 18'
),
findsOneWidget
);
expect
(
find
.
text
(
'Item 36'
),
findsNothing
);
},
skip:
isBrowser
);
},
skip:
isBrowser
,
variant:
TargetPlatformVariant
.
all
()
);
testWidgets
(
'Can be flung up gently'
,
(
WidgetTester
tester
)
async
{
int
taps
=
0
;
...
...
@@ -187,7 +187,7 @@ void main() {
expect
(
find
.
text
(
'Item 21'
),
findsOneWidget
);
expect
(
find
.
text
(
'Item 36'
),
findsOneWidget
);
expect
(
find
.
text
(
'Item 70'
),
findsNothing
);
},
skip:
isBrowser
);
},
skip:
isBrowser
,
variant:
TargetPlatformVariant
.
all
()
);
testWidgets
(
'Can be flung up'
,
(
WidgetTester
tester
)
async
{
int
taps
=
0
;
...
...
@@ -208,7 +208,7 @@ void main() {
expect
(
find
.
text
(
'Item 1'
),
findsNothing
);
expect
(
find
.
text
(
'Item 21'
),
findsNothing
);
expect
(
find
.
text
(
'Item 70'
),
findsOneWidget
);
},
skip:
isBrowser
);
},
skip:
isBrowser
,
variant:
TargetPlatformVariant
.
all
()
);
testWidgets
(
'Can be flung down when not full height'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
_boilerplate
(
null
));
...
...
@@ -221,7 +221,7 @@ void main() {
expect
(
find
.
text
(
'Item 1'
),
findsOneWidget
);
expect
(
find
.
text
(
'Item 21'
),
findsNothing
);
expect
(
find
.
text
(
'Item 36'
),
findsNothing
);
},
skip:
isBrowser
);
},
skip:
isBrowser
,
variant:
TargetPlatformVariant
.
all
()
);
testWidgets
(
'Can be flung up and then back down'
,
(
WidgetTester
tester
)
async
{
int
taps
=
0
;
...
...
@@ -260,7 +260,7 @@ void main() {
expect
(
find
.
text
(
'Item 1'
),
findsOneWidget
);
expect
(
find
.
text
(
'Item 21'
),
findsNothing
);
expect
(
find
.
text
(
'Item 70'
),
findsNothing
);
},
skip:
isBrowser
);
},
skip:
isBrowser
,
variant:
TargetPlatformVariant
.
all
()
);
debugDefaultTargetPlatformOverride
=
null
;
});
...
...
packages/flutter/test/widgets/drawer_test.dart
View file @
f013b25b
...
...
@@ -304,9 +304,7 @@ void main() {
expect
(
buttonPressed
,
equals
(
true
));
});
testWidgets
(
'Dismissible ModalBarrier includes button in semantic tree on iOS'
,
(
WidgetTester
tester
)
async
{
debugDefaultTargetPlatformOverride
=
TargetPlatform
.
iOS
;
testWidgets
(
'Dismissible ModalBarrier includes button in semantic tree'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
SemanticsTester
(
tester
);
final
GlobalKey
<
ScaffoldState
>
scaffoldKey
=
GlobalKey
<
ScaffoldState
>();
...
...
@@ -331,9 +329,7 @@ void main() {
expect
(
semantics
,
includesNodeWith
(
label:
'Dismiss'
));
semantics
.
dispose
();
debugDefaultTargetPlatformOverride
=
null
;
});
},
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
}));
testWidgets
(
'Dismissible ModalBarrier is hidden on Android (back button is used to dismiss)'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
SemanticsTester
(
tester
);
...
...
@@ -361,7 +357,7 @@ void main() {
expect
(
semantics
,
isNot
(
includesNodeWith
(
label:
'Dismiss'
)));
semantics
.
dispose
();
});
}
,
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
android
})
);
testWidgets
(
'Drawer contains route semantics flags'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
SemanticsTester
(
tester
);
...
...
packages/flutter/test/widgets/editable_text_cursor_test.dart
View file @
f013b25b
...
...
@@ -145,10 +145,9 @@ void main() {
);
});
testWidgets
(
'Cursor animates on iOS'
,
(
WidgetTester
tester
)
async
{
final
Widget
widget
=
MaterialApp
(
theme:
ThemeData
(
platform:
TargetPlatform
.
iOS
),
home:
const
Material
(
testWidgets
(
'Cursor animates'
,
(
WidgetTester
tester
)
async
{
const
Widget
widget
=
MaterialApp
(
home:
Material
(
child:
TextField
(
maxLines:
3
,
),
...
...
@@ -200,7 +199,7 @@ void main() {
// Cursor starts coming back.
expect
(
renderEditable
.
cursorColor
.
alpha
,
79
);
expect
(
renderEditable
,
paints
..
rrect
(
color:
const
Color
(
0x4f2196f3
)));
});
}
,
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
})
);
testWidgets
(
'Cursor does not animate on Android'
,
(
WidgetTester
tester
)
async
{
const
Widget
widget
=
MaterialApp
(
...
...
@@ -241,11 +240,10 @@ void main() {
expect
(
renderEditable
,
paintsExactlyCountTimes
(
#drawRect
,
0
));
});
testWidgets
(
'Cursor does not animates
on iOS
when debugDeterministicCursor is set'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Cursor does not animates when debugDeterministicCursor is set'
,
(
WidgetTester
tester
)
async
{
EditableText
.
debugDeterministicCursor
=
true
;
final
Widget
widget
=
MaterialApp
(
theme:
ThemeData
(
platform:
TargetPlatform
.
iOS
),
home:
const
Material
(
const
Widget
widget
=
MaterialApp
(
home:
Material
(
child:
TextField
(
maxLines:
3
,
),
...
...
@@ -277,7 +275,7 @@ void main() {
expect
(
renderEditable
,
paints
..
rrect
(
color:
const
Color
(
0xff2196f3
)));
EditableText
.
debugDeterministicCursor
=
false
;
});
}
,
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
})
);
testWidgets
(
'Cursor does not animate on Android when debugDeterministicCursor is set'
,
(
WidgetTester
tester
)
async
{
EditableText
.
debugDeterministicCursor
=
true
;
...
...
@@ -346,10 +344,9 @@ void main() {
expect
(
renderEditable
,
paintsExactlyCountTimes
(
#drawRect
,
0
));
});
testWidgets
(
'Cursor radius is 2.0 on iOS'
,
(
WidgetTester
tester
)
async
{
final
Widget
widget
=
MaterialApp
(
theme:
ThemeData
(
platform:
TargetPlatform
.
iOS
),
home:
const
Material
(
testWidgets
(
'Cursor radius is 2.0'
,
(
WidgetTester
tester
)
async
{
const
Widget
widget
=
MaterialApp
(
home:
Material
(
child:
TextField
(
maxLines:
3
,
),
...
...
@@ -361,7 +358,7 @@ void main() {
final
RenderEditable
renderEditable
=
editableTextState
.
renderEditable
;
expect
(
renderEditable
.
cursorRadius
,
const
Radius
.
circular
(
2.0
));
});
}
,
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
})
);
testWidgets
(
'Cursor gets placed correctly after going out of bounds'
,
(
WidgetTester
tester
)
async
{
const
String
text
=
'hello world this is fun and cool and awesome!'
;
...
...
@@ -645,9 +642,7 @@ void main() {
expect
(
controller
.
selection
.
baseOffset
,
text
.
length
);
},
skip:
isBrowser
);
testWidgets
(
'Floating cursor is painted on iOS'
,
(
WidgetTester
tester
)
async
{
debugDefaultTargetPlatformOverride
=
TargetPlatform
.
iOS
;
testWidgets
(
'Floating cursor is painted'
,
(
WidgetTester
tester
)
async
{
final
TextEditingController
controller
=
TextEditingController
();
const
TextStyle
textStyle
=
TextStyle
();
const
String
text
=
'hello world this is fun and cool and awesome!'
;
...
...
@@ -656,7 +651,6 @@ void main() {
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
ThemeData
(
platform:
TargetPlatform
.
iOS
),
home:
Padding
(
padding:
const
EdgeInsets
.
only
(
top:
0.25
),
child:
Material
(
...
...
@@ -731,16 +725,13 @@ void main() {
editableTextState
.
updateFloatingCursor
(
RawFloatingCursorPoint
(
state:
FloatingCursorDragState
.
End
));
await
tester
.
pumpAndSettle
();
debugDefaultTargetPlatformOverride
=
null
;
},
skip:
isBrowser
);
},
skip:
isBrowser
,
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
})
);
testWidgets
(
'cursor layout
iOS
'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'cursor layout'
,
(
WidgetTester
tester
)
async
{
final
GlobalKey
<
EditableTextState
>
editableTextKey
=
GlobalKey
<
EditableTextState
>();
debugDefaultTargetPlatformOverride
=
TargetPlatform
.
iOS
;
String
changedValue
;
final
Widget
widget
=
MaterialApp
(
theme:
ThemeData
(
platform:
TargetPlatform
.
iOS
),
home:
RepaintBoundary
(
key:
const
ValueKey
<
int
>(
1
),
child:
Column
(
...
...
@@ -751,7 +742,7 @@ void main() {
key:
editableTextKey
,
controller:
TextEditingController
(),
focusNode:
FocusNode
(),
style:
Typography
(
platform:
TargetPlatform
.
iOS
).
black
.
subhead
,
style:
Typography
(
platform:
debugDefaultTargetPlatformOverride
).
black
.
subhead
,
cursorColor:
Colors
.
blue
,
selectionControls:
materialTextSelectionControls
,
keyboardType:
TextInputType
.
text
,
...
...
@@ -793,6 +784,5 @@ void main() {
find
.
byKey
(
const
ValueKey
<
int
>(
1
)),
matchesGoldenFile
(
'editable_text_test.2.png'
),
);
debugDefaultTargetPlatformOverride
=
null
;
});
},
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
}));
}
packages/flutter/test/widgets/editable_text_test.dart
View file @
f013b25b
...
...
@@ -3757,9 +3757,7 @@ void main() {
});
// Regression test for https://github.com/flutter/flutter/issues/31287
testWidgets
(
'iOS text selection handle visibility'
,
(
WidgetTester
tester
)
async
{
debugDefaultTargetPlatformOverride
=
TargetPlatform
.
iOS
;
testWidgets
(
'text selection handle visibility'
,
(
WidgetTester
tester
)
async
{
// Text with two separate words to select.
const
String
testText
=
'XXXXX XXXXX'
;
final
TextEditingController
controller
=
TextEditingController
(
text:
testText
);
...
...
@@ -3774,7 +3772,7 @@ void main() {
showSelectionHandles:
true
,
controller:
controller
,
focusNode:
FocusNode
(),
style:
Typography
(
platform:
TargetPlatform
.
iOS
).
black
.
subhead
,
style:
Typography
(
platform:
debugDefaultTargetPlatformOverride
).
black
.
subhead
,
cursorColor:
Colors
.
blue
,
backgroundCursorColor:
Colors
.
grey
,
selectionControls:
cupertinoTextSelectionControls
,
...
...
@@ -3924,9 +3922,7 @@ void main() {
// at all. Again, both handles should be invisible.
scrollable
.
controller
.
jumpTo
(
0
);
await
verifyVisibility
(
HandlePositionInViewport
.
rightEdge
,
false
,
HandlePositionInViewport
.
rightEdge
,
false
);
debugDefaultTargetPlatformOverride
=
null
;
},
skip:
isBrowser
);
},
skip:
isBrowser
,
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
}));
testWidgets
(
'scrolling doesn
\'
t bounce'
,
(
WidgetTester
tester
)
async
{
// 3 lines of text, where the last line overflows and requires scrolling.
...
...
packages/flutter/test/widgets/heroes_test.dart
View file @
f013b25b
...
...
@@ -1614,10 +1614,7 @@ Future<void> main() async {
testWidgets
(
'Heroes do not transition on back gestures by default'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
ThemeData
(
platform:
TargetPlatform
.
iOS
,
),
routes:
routes
,
routes:
routes
,
));
expect
(
find
.
byKey
(
firstKey
),
isOnstage
);
...
...
@@ -1652,14 +1649,11 @@ Future<void> main() async {
expect
(
find
.
byKey
(
firstKey
),
isInCard
);
expect
(
find
.
byKey
(
secondKey
),
isOnstage
);
expect
(
find
.
byKey
(
secondKey
),
isInCard
);
});
}
,
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
})
);
testWidgets
(
'Heroes can transition on gesture in one frame'
,
(
WidgetTester
tester
)
async
{
transitionFromUserGestures
=
true
;
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
ThemeData
(
platform:
TargetPlatform
.
iOS
,
),
routes:
routes
,
));
...
...
@@ -1698,14 +1692,11 @@ Future<void> main() async {
expect
(
find
.
byKey
(
firstKey
),
isOnstage
);
expect
(
find
.
byKey
(
firstKey
),
isInCard
);
expect
(
find
.
byKey
(
secondKey
),
findsNothing
);
});
}
,
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
})
);
testWidgets
(
'Heroes animate should hide destination hero and display original hero in case of dismissed'
,
(
WidgetTester
tester
)
async
{
transitionFromUserGestures
=
true
;
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
ThemeData
(
platform:
TargetPlatform
.
iOS
,
),
routes:
routes
,
));
...
...
@@ -1737,7 +1728,7 @@ Future<void> main() async {
expect
(
find
.
byKey
(
firstKey
),
findsNothing
);
expect
(
find
.
byKey
(
secondKey
),
isOnstage
);
expect
(
find
.
byKey
(
secondKey
),
isInCard
);
});
}
,
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
})
);
testWidgets
(
'Handles transitions when a non-default initial route is set'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
...
...
@@ -2298,9 +2289,6 @@ Future<void> main() async {
testWidgets
(
'Remove user gesture driven flights when the gesture is invalid'
,
(
WidgetTester
tester
)
async
{
transitionFromUserGestures
=
true
;
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
ThemeData
(
platform:
TargetPlatform
.
iOS
,
),
routes:
routes
,
));
...
...
@@ -2324,7 +2312,7 @@ Future<void> main() async {
// The simple route should still be on top.
expect
(
find
.
byKey
(
simpleKey
),
findsOneWidget
);
expect
(
tester
.
takeException
(),
isNull
);
});
}
,
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
})
);
// Regression test for https://github.com/flutter/flutter/issues/40239.
testWidgets
(
...
...
packages/flutter/test/widgets/list_wheel_scroll_view_test.dart
View file @
f013b25b
...
...
@@ -1203,8 +1203,6 @@ void main() {
});
testWidgets
(
'high fling velocities lands exactly on items'
,
(
WidgetTester
tester
)
async
{
debugDefaultTargetPlatformOverride
=
TargetPlatform
.
iOS
;
final
FixedExtentScrollController
controller
=
FixedExtentScrollController
(
initialItem:
40
);
final
List
<
double
>
scrolledPositions
=
<
double
>[];
...
...
@@ -1252,9 +1250,7 @@ void main() {
expect
(
controller
.
selectedItem
,
49
);
// More importantly, lands tightly on 49.
expect
(
scrolledPositions
.
last
,
moreOrLessEquals
(
49
*
100.0
,
epsilon:
0.3
));
debugDefaultTargetPlatformOverride
=
null
;
});
},
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
}));
});
testWidgets
(
'ListWheelScrollView getOffsetToReveal'
,
(
WidgetTester
tester
)
async
{
...
...
packages/flutter/test/widgets/modal_barrier_test.dart
View file @
f013b25b
...
...
@@ -340,8 +340,6 @@ void main() {
});
testWidgets
(
'Dismissible ModalBarrier includes button in semantic tree on iOS'
,
(
WidgetTester
tester
)
async
{
debugDefaultTargetPlatformOverride
=
TargetPlatform
.
iOS
;
final
SemanticsTester
semantics
=
SemanticsTester
(
tester
);
await
tester
.
pumpWidget
(
const
Directionality
(
textDirection:
TextDirection
.
ltr
,
...
...
@@ -364,8 +362,7 @@ void main() {
expect
(
semantics
,
hasSemantics
(
expectedSemantics
,
ignoreId:
true
));
semantics
.
dispose
();
debugDefaultTargetPlatformOverride
=
null
;
});
},
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
}));
testWidgets
(
'Dismissible ModalBarrier is hidden on Android (back button is used to dismiss)'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
SemanticsTester
(
tester
);
...
...
packages/flutter/test/widgets/nested_scroll_view_test.dart
View file @
f013b25b
...
...
@@ -113,7 +113,6 @@ Widget buildTest({ ScrollController controller, String title = 'TTTTTTTT' }) {
void
main
(
)
{
testWidgets
(
'NestedScrollView overscroll and release and hold'
,
(
WidgetTester
tester
)
async
{
debugDefaultTargetPlatformOverride
=
TargetPlatform
.
iOS
;
await
tester
.
pumpWidget
(
buildTest
());
expect
(
find
.
text
(
'aaa2'
),
findsOneWidget
);
await
tester
.
pump
(
const
Duration
(
milliseconds:
250
));
...
...
@@ -128,10 +127,8 @@ void main() {
// TODO(ianh): Once we improve how we handle scrolling down from overscroll,
// the following expectation should switch to 200.0.
expect
(
tester
.
renderObject
<
RenderBox
>(
find
.
byType
(
AppBar
)).
size
.
height
,
120.0
);
debugDefaultTargetPlatformOverride
=
null
;
});
},
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
}));
testWidgets
(
'NestedScrollView overscroll and release and hold'
,
(
WidgetTester
tester
)
async
{
debugDefaultTargetPlatformOverride
=
TargetPlatform
.
iOS
;
await
tester
.
pumpWidget
(
buildTest
());
expect
(
find
.
text
(
'aaa2'
),
findsOneWidget
);
await
tester
.
pump
(
const
Duration
(
milliseconds:
250
));
...
...
@@ -149,10 +146,8 @@ void main() {
await
tester
.
pump
(
const
Duration
(
milliseconds:
10
));
expect
(
find
.
text
(
'aaa2'
),
findsNothing
);
await
tester
.
pump
(
const
Duration
(
milliseconds:
1000
));
debugDefaultTargetPlatformOverride
=
null
;
});
},
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
}));
testWidgets
(
'NestedScrollView overscroll and release'
,
(
WidgetTester
tester
)
async
{
debugDefaultTargetPlatformOverride
=
TargetPlatform
.
iOS
;
await
tester
.
pumpWidget
(
buildTest
());
expect
(
find
.
text
(
'aaa2'
),
findsOneWidget
);
await
tester
.
pump
(
const
Duration
(
milliseconds:
500
));
...
...
@@ -164,8 +159,10 @@ void main() {
await
gesture1
.
up
();
await
tester
.
pumpAndSettle
();
expect
(
find
.
text
(
'aaa2'
),
findsOneWidget
);
debugDefaultTargetPlatformOverride
=
null
;
},
skip:
true
);
// https://github.com/flutter/flutter/issues/9040
},
skip:
true
,
// https://github.com/flutter/flutter/issues/9040
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
}));
testWidgets
(
'NestedScrollView'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
buildTest
());
expect
(
find
.
text
(
'aaa2'
),
findsOneWidget
);
...
...
@@ -610,12 +607,11 @@ void main() {
debugDisableShadows
=
true
;
});
testWidgets
(
'NestedScrollView and
iOS
bouncing'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'NestedScrollView and bouncing'
,
(
WidgetTester
tester
)
async
{
// This verifies that overscroll bouncing works correctly on iOS. For
// example, this checks that if you pull to overscroll, friction is applied;
// it also makes sure that if you scroll back the other way, the scroll
// positions of the inner and outer list don't have a discontinuity.
debugDefaultTargetPlatformOverride
=
TargetPlatform
.
iOS
;
const
Key
key1
=
ValueKey
<
int
>(
1
);
const
Key
key2
=
ValueKey
<
int
>(
2
);
await
tester
.
pumpWidget
(
...
...
@@ -674,8 +670,7 @@ void main() {
await
tester
.
pump
();
expect
(
tester
.
getRect
(
find
.
byKey
(
key1
)),
const
Rect
.
fromLTWH
(
0.0
,
0.0
,
800.0
,
100.0
));
await
gesture
.
up
();
debugDefaultTargetPlatformOverride
=
null
;
});
},
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
}));
}
class
TestHeader
extends
SliverPersistentHeaderDelegate
{
...
...
packages/flutter/test/widgets/page_transitions_test.dart
View file @
f013b25b
...
...
@@ -157,10 +157,7 @@ void main() {
),
};
await
tester
.
pumpWidget
(
MaterialApp
(
routes:
routes
,
theme:
ThemeData
(
platform:
TargetPlatform
.
iOS
),
));
await
tester
.
pumpWidget
(
MaterialApp
(
routes:
routes
));
Navigator
.
pushNamed
(
containerKey1
.
currentContext
,
'/settings'
);
...
...
@@ -199,7 +196,7 @@ void main() {
settingsOffset
=
tester
.
getTopLeft
(
find
.
text
(
'Settings'
));
expect
(
settingsOffset
.
dx
,
greaterThan
(
100.0
));
expect
(
settingsOffset
.
dy
,
100.0
);
});
}
,
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
})
);
testWidgets
(
'Check back gesture doesn
\'
t start during transitions'
,
(
WidgetTester
tester
)
async
{
final
GlobalKey
containerKey1
=
GlobalKey
();
...
...
@@ -209,10 +206,7 @@ void main() {
'/settings'
:
(
_
)
=>
Scaffold
(
key:
containerKey2
,
body:
const
Text
(
'Settings'
)),
};
await
tester
.
pumpWidget
(
MaterialApp
(
routes:
routes
,
theme:
ThemeData
(
platform:
TargetPlatform
.
iOS
),
));
await
tester
.
pumpWidget
(
MaterialApp
(
routes:
routes
));
Navigator
.
pushNamed
(
containerKey1
.
currentContext
,
'/settings'
);
...
...
@@ -245,7 +239,7 @@ void main() {
expect
(
find
.
text
(
'Home'
),
isOnstage
);
expect
(
find
.
text
(
'Settings'
),
findsNothing
);
});
}
,
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
})
);
// Tests bug https://github.com/flutter/flutter/issues/6451
testWidgets
(
'Check back gesture with a persistent bottom sheet showing'
,
(
WidgetTester
tester
)
async
{
...
...
@@ -256,10 +250,7 @@ void main() {
'/sheet'
:
(
_
)
=>
PersistentBottomSheetTest
(
key:
containerKey2
),
};
await
tester
.
pumpWidget
(
MaterialApp
(
routes:
routes
,
theme:
ThemeData
(
platform:
TargetPlatform
.
iOS
),
));
await
tester
.
pumpWidget
(
MaterialApp
(
routes:
routes
));
Navigator
.
pushNamed
(
containerKey1
.
currentContext
,
'/sheet'
);
...
...
@@ -302,7 +293,7 @@ void main() {
// Sheet did not call setState (since the gesture did nothing).
expect
(
sheet
.
setStateCalled
,
isFalse
);
});
}
,
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
})
);
testWidgets
(
'Test completed future'
,
(
WidgetTester
tester
)
async
{
final
Map
<
String
,
WidgetBuilder
>
routes
=
<
String
,
WidgetBuilder
>{
...
...
packages/flutter/test/widgets/page_view_test.dart
View file @
f013b25b
...
...
@@ -83,7 +83,6 @@ void main() {
testWidgets
(
'PageView does not squish when overscrolled'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
ThemeData
(
platform:
TargetPlatform
.
iOS
),
home:
PageView
(
children:
List
<
Widget
>.
generate
(
10
,
(
int
i
)
{
return
Container
(
...
...
@@ -113,7 +112,7 @@ void main() {
expect
(
leftOf
(
0
),
lessThan
(
0.0
));
expect
(
sizeOf
(
0
),
equals
(
const
Size
(
800.0
,
600.0
)));
});
}
,
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
})
);
testWidgets
(
'PageController control test'
,
(
WidgetTester
tester
)
async
{
final
PageController
controller
=
PageController
(
initialPage:
4
);
...
...
packages/flutter/test/widgets/scrollable_dispose_test.dart
View file @
f013b25b
...
...
@@ -28,10 +28,9 @@ void main() {
await
tester
.
pump
(
const
Duration
(
hours:
5
));
});
testWidgets
(
'Disposing a (nested) Scrollable while holding in overscroll
(iOS)
does not crash'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Disposing a (nested) Scrollable while holding in overscroll does not crash'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/27707.
debugDefaultTargetPlatformOverride
=
TargetPlatform
.
iOS
;
final
ScrollController
controller
=
ScrollController
();
final
Key
outterContainer
=
GlobalKey
();
...
...
@@ -88,7 +87,5 @@ void main() {
);
await
tester
.
pumpAndSettle
();
expect
(
controller
.
hasClients
,
isFalse
);
debugDefaultTargetPlatformOverride
=
null
;
});
},
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
}));
}
packages/flutter/test/widgets/scrollable_fling_test.dart
View file @
f013b25b
...
...
@@ -43,7 +43,7 @@ void main() {
await
tester
.
pump
();
// trigger fling
expect
(
getCurrentOffset
(),
dragOffset
);
await
tester
.
pump
(
const
Duration
(
seconds:
5
));
final
double
result1
=
getCurrentOffset
();
final
double
androidResult
=
getCurrentOffset
();
await
pumpTest
(
tester
,
TargetPlatform
.
iOS
);
await
tester
.
fling
(
find
.
byType
(
ListView
),
const
Offset
(
0.0
,
-
dragOffset
),
1000.0
);
...
...
@@ -52,9 +52,19 @@ void main() {
await
tester
.
pump
();
// trigger fling
expect
(
getCurrentOffset
(),
moreOrLessEquals
(
210.71026666666666
));
await
tester
.
pump
(
const
Duration
(
seconds:
5
));
final
double
result2
=
getCurrentOffset
();
final
double
iOSResult
=
getCurrentOffset
();
expect
(
result1
,
lessThan
(
result2
));
// iOS (result2) is slipperier than Android (result1)
await
pumpTest
(
tester
,
TargetPlatform
.
macOS
);
await
tester
.
fling
(
find
.
byType
(
ListView
),
const
Offset
(
0.0
,
-
dragOffset
),
1000.0
);
// Scroll starts ease into the scroll on iOS.
expect
(
getCurrentOffset
(),
moreOrLessEquals
(
210.71026666666666
));
await
tester
.
pump
();
// trigger fling
expect
(
getCurrentOffset
(),
moreOrLessEquals
(
210.71026666666666
));
await
tester
.
pump
(
const
Duration
(
seconds:
5
));
final
double
macOSResult
=
getCurrentOffset
();
expect
(
androidResult
,
lessThan
(
iOSResult
));
// iOS is slipperier than Android
expect
(
androidResult
,
lessThan
(
macOSResult
));
// macOS is slipperier than Android
});
testWidgets
(
'fling and tap to stop'
,
(
WidgetTester
tester
)
async
{
...
...
packages/flutter/test/widgets/scrollable_test.dart
View file @
f013b25b
...
...
@@ -97,7 +97,7 @@ void main() {
await
tester
.
pump
();
// trigger fling
expect
(
getScrollOffset
(
tester
),
dragOffset
);
await
tester
.
pump
(
const
Duration
(
seconds:
5
));
final
double
result1
=
getScrollOffset
(
tester
);
final
double
androidResult
=
getScrollOffset
(
tester
);
resetScrollOffset
(
tester
);
...
...
@@ -108,13 +108,25 @@ void main() {
await
tester
.
pump
();
// trigger fling
expect
(
getScrollOffset
(
tester
),
moreOrLessEquals
(
197.16666666666669
));
await
tester
.
pump
(
const
Duration
(
seconds:
5
));
final
double
result2
=
getScrollOffset
(
tester
);
final
double
iOSResult
=
getScrollOffset
(
tester
);
expect
(
result1
,
lessThan
(
result2
));
// iOS (result2) is slipperier than Android (result1)
resetScrollOffset
(
tester
);
await
pumpTest
(
tester
,
TargetPlatform
.
macOS
);
await
tester
.
fling
(
find
.
byType
(
Viewport
),
const
Offset
(
0.0
,
-
dragOffset
),
1000.0
);
// Scroll starts ease into the scroll on iOS.
expect
(
getScrollOffset
(
tester
),
moreOrLessEquals
(
197.16666666666669
));
await
tester
.
pump
();
// trigger fling
expect
(
getScrollOffset
(
tester
),
moreOrLessEquals
(
197.16666666666669
));
await
tester
.
pump
(
const
Duration
(
seconds:
5
));
final
double
macOSResult
=
getScrollOffset
(
tester
);
expect
(
androidResult
,
lessThan
(
iOSResult
));
// iOS is slipperier than Android
expect
(
androidResult
,
lessThan
(
macOSResult
));
// macOS is slipperier than Android
});
testWidgets
(
'Holding scroll'
,
(
WidgetTester
tester
)
async
{
await
pumpTest
(
tester
,
TargetPlatform
.
iOS
);
await
pumpTest
(
tester
,
debugDefaultTargetPlatformOverride
);
await
tester
.
drag
(
find
.
byType
(
Viewport
),
const
Offset
(
0.0
,
200.0
),
touchSlopY:
0.0
);
expect
(
getScrollOffset
(
tester
),
-
200.0
);
await
tester
.
pump
();
// trigger ballistic
...
...
@@ -130,10 +142,10 @@ void main() {
// Once the hold is let go, it should still snap back to origin.
expect
(
await
tester
.
pumpAndSettle
(
const
Duration
(
minutes:
1
)),
2
);
expect
(
getScrollOffset
(
tester
),
0.0
);
});
}
,
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
})
);
testWidgets
(
'Repeated flings builds momentum
on iOS
'
,
(
WidgetTester
tester
)
async
{
await
pumpTest
(
tester
,
TargetPlatform
.
iOS
);
testWidgets
(
'Repeated flings builds momentum'
,
(
WidgetTester
tester
)
async
{
await
pumpTest
(
tester
,
debugDefaultTargetPlatformOverride
);
await
tester
.
fling
(
find
.
byType
(
Viewport
),
const
Offset
(
0.0
,
-
dragOffset
),
1000.0
);
await
tester
.
pump
();
// trigger fling
await
tester
.
pump
(
const
Duration
(
milliseconds:
10
));
...
...
@@ -143,9 +155,9 @@ void main() {
// On iOS, the velocity will be larger than the velocity of the last fling by a
// non-trivial amount.
expect
(
getScrollVelocity
(
tester
),
greaterThan
(
1100.0
));
},
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
}));
resetScrollOffset
(
tester
);
testWidgets
(
'Repeated flings do not build momentum on Android'
,
(
WidgetTester
tester
)
async
{
await
pumpTest
(
tester
,
TargetPlatform
.
android
);
await
tester
.
fling
(
find
.
byType
(
Viewport
),
const
Offset
(
0.0
,
-
dragOffset
),
1000.0
);
await
tester
.
pump
();
// trigger fling
...
...
@@ -158,8 +170,8 @@ void main() {
expect
(
getScrollVelocity
(
tester
),
moreOrLessEquals
(
1000.0
));
});
testWidgets
(
'No iOS momentum build with flings in opposite directions'
,
(
WidgetTester
tester
)
async
{
await
pumpTest
(
tester
,
TargetPlatform
.
iOS
);
testWidgets
(
'No iOS
/macOS
momentum build with flings in opposite directions'
,
(
WidgetTester
tester
)
async
{
await
pumpTest
(
tester
,
debugDefaultTargetPlatformOverride
);
await
tester
.
fling
(
find
.
byType
(
Viewport
),
const
Offset
(
0.0
,
-
dragOffset
),
1000.0
);
await
tester
.
pump
();
// trigger fling
await
tester
.
pump
(
const
Duration
(
milliseconds:
10
));
...
...
@@ -170,10 +182,10 @@ void main() {
// opposite direction.
expect
(
getScrollVelocity
(
tester
),
greaterThan
(-
1000.0
));
expect
(
getScrollVelocity
(
tester
),
lessThan
(
0.0
));
});
}
,
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
})
);
testWidgets
(
'No iOS momentum kept on hold gestures'
,
(
WidgetTester
tester
)
async
{
await
pumpTest
(
tester
,
TargetPlatform
.
iOS
);
testWidgets
(
'No iOS
/macOS
momentum kept on hold gestures'
,
(
WidgetTester
tester
)
async
{
await
pumpTest
(
tester
,
debugDefaultTargetPlatformOverride
);
await
tester
.
fling
(
find
.
byType
(
Viewport
),
const
Offset
(
0.0
,
-
dragOffset
),
1000.0
);
await
tester
.
pump
();
// trigger fling
await
tester
.
pump
(
const
Duration
(
milliseconds:
10
));
...
...
@@ -183,7 +195,7 @@ void main() {
await
gesture
.
up
();
// After a hold longer than 2 frames, previous velocity is lost.
expect
(
getScrollVelocity
(
tester
),
0.0
);
});
}
,
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
})
);
testWidgets
(
'Drags creeping unaffected on Android'
,
(
WidgetTester
tester
)
async
{
await
pumpTest
(
tester
,
TargetPlatform
.
android
);
...
...
@@ -196,8 +208,8 @@ void main() {
expect
(
getScrollOffset
(
tester
),
1.5
);
});
testWidgets
(
'Drags creeping must break threshold on iOS'
,
(
WidgetTester
tester
)
async
{
await
pumpTest
(
tester
,
TargetPlatform
.
iOS
);
testWidgets
(
'Drags creeping must break threshold on iOS
/macOS
'
,
(
WidgetTester
tester
)
async
{
await
pumpTest
(
tester
,
debugDefaultTargetPlatformOverride
);
final
TestGesture
gesture
=
await
tester
.
startGesture
(
tester
.
getCenter
(
find
.
byType
(
Viewport
)));
await
gesture
.
moveBy
(
const
Offset
(
0.0
,
-
0.5
));
expect
(
getScrollOffset
(
tester
),
0.0
);
...
...
@@ -214,18 +226,18 @@ void main() {
await
gesture
.
moveBy
(
const
Offset
(
0.0
,
-
0.5
),
timeStamp:
const
Duration
(
milliseconds:
50
));
// -0.5 over threshold transferred.
expect
(
getScrollOffset
(
tester
),
0.5
);
});
}
,
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
})
);
testWidgets
(
'Big drag over threshold magnitude preserved on iOS'
,
(
WidgetTester
tester
)
async
{
await
pumpTest
(
tester
,
TargetPlatform
.
iOS
);
testWidgets
(
'Big drag over threshold magnitude preserved on iOS
/macOS
'
,
(
WidgetTester
tester
)
async
{
await
pumpTest
(
tester
,
debugDefaultTargetPlatformOverride
);
final
TestGesture
gesture
=
await
tester
.
startGesture
(
tester
.
getCenter
(
find
.
byType
(
Viewport
)));
await
gesture
.
moveBy
(
const
Offset
(
0.0
,
-
30.0
));
// No offset lost from threshold.
expect
(
getScrollOffset
(
tester
),
30.0
);
});
}
,
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
})
);
testWidgets
(
'Slow threshold breaks are attenuated on iOS'
,
(
WidgetTester
tester
)
async
{
await
pumpTest
(
tester
,
TargetPlatform
.
iOS
);
testWidgets
(
'Slow threshold breaks are attenuated on iOS
/macOS
'
,
(
WidgetTester
tester
)
async
{
await
pumpTest
(
tester
,
debugDefaultTargetPlatformOverride
);
final
TestGesture
gesture
=
await
tester
.
startGesture
(
tester
.
getCenter
(
find
.
byType
(
Viewport
)));
// This is a typical 'hesitant' iOS scroll start.
await
gesture
.
moveBy
(
const
Offset
(
0.0
,
-
10.0
));
...
...
@@ -233,10 +245,10 @@ void main() {
await
gesture
.
moveBy
(
const
Offset
(
0.0
,
-
10.0
),
timeStamp:
const
Duration
(
milliseconds:
20
));
// Subsequent motions unaffected.
expect
(
getScrollOffset
(
tester
),
moreOrLessEquals
(
11.16666666666666673
));
});
}
,
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
})
);
testWidgets
(
'Small continuing motion preserved on iOS'
,
(
WidgetTester
tester
)
async
{
await
pumpTest
(
tester
,
TargetPlatform
.
iOS
);
testWidgets
(
'Small continuing motion preserved on iOS
/macOS
'
,
(
WidgetTester
tester
)
async
{
await
pumpTest
(
tester
,
debugDefaultTargetPlatformOverride
);
final
TestGesture
gesture
=
await
tester
.
startGesture
(
tester
.
getCenter
(
find
.
byType
(
Viewport
)));
await
gesture
.
moveBy
(
const
Offset
(
0.0
,
-
30.0
));
// Break threshold.
expect
(
getScrollOffset
(
tester
),
30.0
);
...
...
@@ -246,10 +258,10 @@ void main() {
expect
(
getScrollOffset
(
tester
),
31.0
);
await
gesture
.
moveBy
(
const
Offset
(
0.0
,
-
0.5
),
timeStamp:
const
Duration
(
milliseconds:
60
));
expect
(
getScrollOffset
(
tester
),
31.5
);
});
}
,
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
})
);
testWidgets
(
'Motion stop resets threshold on iOS'
,
(
WidgetTester
tester
)
async
{
await
pumpTest
(
tester
,
TargetPlatform
.
iOS
);
testWidgets
(
'Motion stop resets threshold on iOS
/macOS
'
,
(
WidgetTester
tester
)
async
{
await
pumpTest
(
tester
,
debugDefaultTargetPlatformOverride
);
final
TestGesture
gesture
=
await
tester
.
startGesture
(
tester
.
getCenter
(
find
.
byType
(
Viewport
)));
await
gesture
.
moveBy
(
const
Offset
(
0.0
,
-
30.0
));
// Break threshold.
expect
(
getScrollOffset
(
tester
),
30.0
);
...
...
@@ -269,9 +281,9 @@ void main() {
expect
(
getScrollOffset
(
tester
),
31.5
);
await
gesture
.
moveBy
(
const
Offset
(
0.0
,
-
1.0
),
timeStamp:
const
Duration
(
milliseconds:
180
));
expect
(
getScrollOffset
(
tester
),
32.5
);
});
}
,
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
})
);
testWidgets
(
'Scroll pointer signals are handled'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Scroll pointer signals are handled
on Fuchsia
'
,
(
WidgetTester
tester
)
async
{
await
pumpTest
(
tester
,
TargetPlatform
.
fuchsia
);
final
Offset
scrollEventLocation
=
tester
.
getCenter
(
find
.
byType
(
Viewport
));
final
TestPointer
testPointer
=
TestPointer
(
1
,
ui
.
PointerDeviceKind
.
mouse
);
...
...
packages/flutter/test/widgets/selectable_text_test.dart
View file @
f013b25b
This diff is collapsed.
Click to expand it.
packages/flutter/test/widgets/sliver_fill_remaining_test.dart
View file @
f013b25b
...
...
@@ -283,7 +283,6 @@ void main() {
});
testWidgets
(
'alignment with a flexible works'
,
(
WidgetTester
tester
)
async
{
debugDefaultTargetPlatformOverride
=
TargetPlatform
.
iOS
;
final
GlobalKey
key
=
GlobalKey
();
final
List
<
Widget
>
slivers
=
<
Widget
>[
sliverBox
,
...
...
@@ -347,13 +346,10 @@ void main() {
);
expect
(
tester
.
getBottomLeft
(
button
).
dy
,
lessThan
(
600.0
));
expect
(
tester
.
getCenter
(
button
).
dx
,
equals
(
400.0
));
debugDefaultTargetPlatformOverride
=
null
;
});
},
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
}));
group
(
'fillOverscroll: true, relevant platforms'
,
()
{
testWidgets
(
'child without size is sized by extent and overscroll'
,
(
WidgetTester
tester
)
async
{
debugDefaultTargetPlatformOverride
=
TargetPlatform
.
iOS
;
final
List
<
Widget
>
slivers
=
<
Widget
>[
sliverBox
,
SliverFillRemaining
(
...
...
@@ -378,12 +374,9 @@ void main() {
await
tester
.
pumpAndSettle
();
final
RenderBox
box3
=
tester
.
renderObject
<
RenderBox
>(
find
.
byType
(
Container
).
last
);
expect
(
box3
.
size
.
height
,
equals
(
450
));
debugDefaultTargetPlatformOverride
=
null
;
});
},
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
}));
testWidgets
(
'child with smaller size is overridden and sized by extent and overscroll'
,
(
WidgetTester
tester
)
async
{
debugDefaultTargetPlatformOverride
=
TargetPlatform
.
iOS
;
final
GlobalKey
key
=
GlobalKey
();
final
List
<
Widget
>
slivers
=
<
Widget
>[
sliverBox
,
...
...
@@ -428,12 +421,9 @@ void main() {
tester
.
renderObject
<
RenderBox
>(
find
.
byKey
(
key
)).
size
.
height
,
equals
(
450
),
);
debugDefaultTargetPlatformOverride
=
null
;
});
},
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
}));
testWidgets
(
'extent is overridden by child size and overscroll if precedingScrollExtent > viewportMainAxisExtent'
,
(
WidgetTester
tester
)
async
{
debugDefaultTargetPlatformOverride
=
TargetPlatform
.
iOS
;
final
GlobalKey
key
=
GlobalKey
();
final
ScrollController
controller
=
ScrollController
();
final
List
<
Widget
>
slivers
=
<
Widget
>[
...
...
@@ -473,12 +463,10 @@ void main() {
tester
.
renderObject
<
RenderBox
>(
find
.
byKey
(
key
)).
size
.
height
,
equals
(
148.0
),
);
// Check that the button alignment is true to expectations
final
Finder
button
=
find
.
byType
(
RaisedButton
);
expect
(
tester
.
getBottomLeft
(
button
).
dy
,
equals
(
550.0
));
expect
(
tester
.
getCenter
(
button
).
dx
,
equals
(
400.0
));
debugDefaultTargetPlatformOverride
=
null
;
// Drag for overscroll
await
tester
.
drag
(
find
.
byType
(
Scrollable
),
const
Offset
(
0.0
,
-
50.0
));
...
...
@@ -498,12 +486,9 @@ void main() {
tester
.
renderObject
<
RenderBox
>(
find
.
byKey
(
key
)).
size
.
height
,
equals
(
148.0
),
);
debugDefaultTargetPlatformOverride
=
null
;
});
},
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
}));
testWidgets
(
'fillOverscroll works when child has no size and precedingScrollExtent > viewportMainAxisExtent'
,
(
WidgetTester
tester
)
async
{
debugDefaultTargetPlatformOverride
=
TargetPlatform
.
iOS
;
final
GlobalKey
key
=
GlobalKey
();
final
ScrollController
controller
=
ScrollController
();
final
List
<
Widget
>
slivers
=
<
Widget
>[
...
...
@@ -557,12 +542,9 @@ void main() {
tester
.
widgetList
<
DecoratedBox
>(
find
.
byType
(
DecoratedBox
)).
last
.
decoration
,
amberBox
,
);
debugDefaultTargetPlatformOverride
=
null
;
});
},
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
}));
testWidgets
(
'alignment with a flexible works with fillOverscroll'
,
(
WidgetTester
tester
)
async
{
debugDefaultTargetPlatformOverride
=
TargetPlatform
.
iOS
;
final
GlobalKey
key
=
GlobalKey
();
final
List
<
Widget
>
slivers
=
<
Widget
>[
sliverBox
,
...
...
@@ -648,9 +630,7 @@ void main() {
);
expect
(
tester
.
getBottomLeft
(
button
).
dy
,
equals
(
600.0
));
expect
(
tester
.
getCenter
(
button
).
dx
,
equals
(
400.0
));
debugDefaultTargetPlatformOverride
=
null
;
});
},
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
}));
});
group
(
'fillOverscroll: true, is ignored on irrevelant platforms'
,
()
{
...
...
packages/flutter/test/widgets/text_selection_test.dart
View file @
f013b25b
...
...
@@ -7,7 +7,6 @@ import 'package:flutter/gestures.dart' show PointerDeviceKind;
import
'package:flutter/widgets.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/foundation.dart'
show
debugDefaultTargetPlatformOverride
;
void
main
(
)
{
int
tapCount
;
...
...
@@ -552,7 +551,6 @@ void main() {
// Regression test for https://github.com/flutter/flutter/issues/37032.
testWidgets
(
"selection handle's GestureDetector should not cover the entire screen"
,
(
WidgetTester
tester
)
async
{
debugDefaultTargetPlatformOverride
=
TargetPlatform
.
iOS
;
final
TextEditingController
controller
=
TextEditingController
(
text:
'a'
);
await
tester
.
pumpWidget
(
...
...
@@ -583,9 +581,7 @@ void main() {
expect
(
hitRect
.
size
.
width
,
lessThan
(
textFieldRect
.
size
.
width
));
expect
(
hitRect
.
size
.
height
,
lessThan
(
textFieldRect
.
size
.
height
));
debugDefaultTargetPlatformOverride
=
null
;
});
},
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
iOS
,
TargetPlatform
.
macOS
}));
}
class
FakeTextSelectionGestureDetectorBuilderDelegate
implements
TextSelectionGestureDetectorBuilderDelegate
{
...
...
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