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
d5e7f407
Unverified
Commit
d5e7f407
authored
Jul 14, 2023
by
Polina Cherkasova
Committed by
GitHub
Jul 14, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test cover some leak-free code. (#130543)
parent
93919232
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
198 additions
and
185 deletions
+198
-185
expand_icon_test.dart
packages/flutter/test/material/expand_icon_test.dart
+11
-9
floating_action_button_location_test.dart
...r/test/material/floating_action_button_location_test.dart
+39
-37
ink_sparkle_test.dart
packages/flutter/test/material/ink_sparkle_test.dart
+7
-6
material_test.dart
packages/flutter/test/material/material_test.dart
+41
-40
navigation_bar_test.dart
packages/flutter/test/material/navigation_bar_test.dart
+22
-21
persistent_bottom_sheet_test.dart
...s/flutter/test/material/persistent_bottom_sheet_test.dart
+14
-12
radio_test.dart
packages/flutter/test/material/radio_test.dart
+27
-26
refresh_indicator_test.dart
packages/flutter/test/material/refresh_indicator_test.dart
+30
-28
segmented_button_test.dart
packages/flutter/test/material/segmented_button_test.dart
+7
-6
No files found.
packages/flutter/test/material/expand_icon_test.dart
View file @
d5e7f407
...
...
@@ -5,6 +5,8 @@
import
'package:flutter/material.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'../foundation/leak_tracking.dart'
;
Widget
wrap
(
{
required
Widget
child
,
ThemeData
?
theme
})
{
return
MaterialApp
(
theme:
theme
,
...
...
@@ -15,7 +17,7 @@ Widget wrap({ required Widget child, ThemeData? theme }) {
}
void
main
(
)
{
testWidgets
(
'ExpandIcon test'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'ExpandIcon test'
,
(
WidgetTester
tester
)
async
{
bool
expanded
=
false
;
IconTheme
iconTheme
;
...
...
@@ -73,7 +75,7 @@ void main() {
expect
(
iconTheme
.
data
.
color
,
equals
(
Colors
.
white60
));
});
testWidgets
(
'ExpandIcon disabled'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'ExpandIcon disabled'
,
(
WidgetTester
tester
)
async
{
IconTheme
iconTheme
;
// Light mode test
await
tester
.
pumpWidget
(
wrap
(
...
...
@@ -96,7 +98,7 @@ void main() {
expect
(
iconTheme
.
data
.
color
,
equals
(
Colors
.
white38
));
});
testWidgets
(
'ExpandIcon test isExpanded does not trigger callback'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'ExpandIcon test isExpanded does not trigger callback'
,
(
WidgetTester
tester
)
async
{
bool
expanded
=
false
;
await
tester
.
pumpWidget
(
wrap
(
...
...
@@ -119,7 +121,7 @@ void main() {
expect
(
expanded
,
isFalse
);
});
testWidgets
(
'ExpandIcon is rotated initially if isExpanded is true on first build'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'ExpandIcon is rotated initially if isExpanded is true on first build'
,
(
WidgetTester
tester
)
async
{
bool
expanded
=
true
;
await
tester
.
pumpWidget
(
wrap
(
...
...
@@ -134,7 +136,7 @@ void main() {
expect
(
rotation
.
turns
.
value
,
0.5
);
});
testWidgets
(
'ExpandIcon default size is 24'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'ExpandIcon default size is 24'
,
(
WidgetTester
tester
)
async
{
final
ExpandIcon
expandIcon
=
ExpandIcon
(
onPressed:
(
bool
isExpanded
)
{},
);
...
...
@@ -147,7 +149,7 @@ void main() {
expect
(
icon
.
size
,
24
);
});
testWidgets
(
'ExpandIcon has the correct given size'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'ExpandIcon has the correct given size'
,
(
WidgetTester
tester
)
async
{
ExpandIcon
expandIcon
=
ExpandIcon
(
size:
36
,
onPressed:
(
bool
isExpanded
)
{},
...
...
@@ -173,7 +175,7 @@ void main() {
expect
(
icon
.
size
,
48
);
});
testWidgets
(
'ExpandIcon has correct semantic hints'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'ExpandIcon has correct semantic hints'
,
(
WidgetTester
tester
)
async
{
final
SemanticsHandle
handle
=
tester
.
ensureSemantics
();
const
DefaultMaterialLocalizations
localizations
=
DefaultMaterialLocalizations
();
await
tester
.
pumpWidget
(
wrap
(
...
...
@@ -210,7 +212,7 @@ void main() {
handle
.
dispose
();
});
testWidgets
(
'ExpandIcon uses custom icon color and expanded icon color'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'ExpandIcon uses custom icon color and expanded icon color'
,
(
WidgetTester
tester
)
async
{
bool
expanded
=
false
;
IconTheme
iconTheme
;
...
...
@@ -271,7 +273,7 @@ void main() {
expect
(
iconTheme
.
data
.
color
,
equals
(
Colors
.
indigo
));
});
testWidgets
(
'ExpandIcon uses custom disabled icon color'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'ExpandIcon uses custom disabled icon color'
,
(
WidgetTester
tester
)
async
{
IconTheme
iconTheme
;
await
tester
.
pumpWidget
(
wrap
(
...
...
packages/flutter/test/material/floating_action_button_location_test.dart
View file @
d5e7f407
This diff is collapsed.
Click to expand it.
packages/flutter/test/material/ink_sparkle_test.dart
View file @
d5e7f407
...
...
@@ -11,10 +11,11 @@ import 'package:flutter/material.dart';
import
'package:flutter/src/foundation/constants.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'../foundation/leak_tracking.dart'
;
import
'../rendering/mock_canvas.dart'
;
void
main
(
)
{
testWidgets
(
'InkSparkle in a Button compiles and does not crash'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'InkSparkle in a Button compiles and does not crash'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
body:
Center
(
...
...
@@ -34,7 +35,7 @@ void main() {
skip:
kIsWeb
,
// [intended] shaders are not yet supported for web.
);
testWidgets
(
'InkSparkle default splashFactory paints with drawRect when bounded'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'InkSparkle default splashFactory paints with drawRect when bounded'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
body:
Center
(
...
...
@@ -65,7 +66,7 @@ void main() {
skip:
kIsWeb
,
// [intended] shaders are not yet supported for web.
);
testWidgets
(
'InkSparkle default splashFactory paints with drawPaint when unbounded'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'InkSparkle default splashFactory paints with drawPaint when unbounded'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
body:
Center
(
...
...
@@ -92,19 +93,19 @@ void main() {
// Goldens //
/////////////
testWidgets
(
'InkSparkle renders with sparkles when top left of button is tapped'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'InkSparkle renders with sparkles when top left of button is tapped'
,
(
WidgetTester
tester
)
async
{
await
_runTest
(
tester
,
'top_left'
,
0.2
);
},
skip:
kIsWeb
,
// [intended] shaders are not yet supported for web.
);
testWidgets
(
'InkSparkle renders with sparkles when center of button is tapped'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'InkSparkle renders with sparkles when center of button is tapped'
,
(
WidgetTester
tester
)
async
{
await
_runTest
(
tester
,
'center'
,
0.5
);
},
skip:
kIsWeb
,
// [intended] shaders are not yet supported for web.
);
testWidgets
(
'InkSparkle renders with sparkles when bottom right of button is tapped'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'InkSparkle renders with sparkles when bottom right of button is tapped'
,
(
WidgetTester
tester
)
async
{
await
_runTest
(
tester
,
'bottom_right'
,
0.8
);
},
skip:
kIsWeb
,
// [intended] shaders are not yet supported for web.
...
...
packages/flutter/test/material/material_test.dart
View file @
d5e7f407
This diff is collapsed.
Click to expand it.
packages/flutter/test/material/navigation_bar_test.dart
View file @
d5e7f407
...
...
@@ -14,10 +14,11 @@ import 'package:flutter/gestures.dart';
import
'package:flutter/material.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'../foundation/leak_tracking.dart'
;
import
'../rendering/mock_canvas.dart'
;
void
main
(
)
{
testWidgets
(
'Navigation bar updates destinations when tapped'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Navigation bar updates destinations when tapped'
,
(
WidgetTester
tester
)
async
{
int
mutatedIndex
=
-
1
;
final
Widget
widget
=
_buildWidget
(
NavigationBar
(
...
...
@@ -49,7 +50,7 @@ void main() {
expect
(
mutatedIndex
,
0
);
});
testWidgets
(
'NavigationBar can update background color'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'NavigationBar can update background color'
,
(
WidgetTester
tester
)
async
{
const
Color
color
=
Colors
.
yellow
;
await
tester
.
pumpWidget
(
...
...
@@ -74,7 +75,7 @@ void main() {
expect
(
_getMaterial
(
tester
).
color
,
equals
(
color
));
});
testWidgets
(
'NavigationBar can update elevation'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'NavigationBar can update elevation'
,
(
WidgetTester
tester
)
async
{
const
double
elevation
=
42.0
;
await
tester
.
pumpWidget
(
...
...
@@ -99,7 +100,7 @@ void main() {
expect
(
_getMaterial
(
tester
).
elevation
,
equals
(
elevation
));
});
testWidgets
(
'NavigationBar adds bottom padding to height'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'NavigationBar adds bottom padding to height'
,
(
WidgetTester
tester
)
async
{
const
double
bottomPadding
=
40.0
;
await
tester
.
pumpWidget
(
...
...
@@ -148,7 +149,7 @@ void main() {
expect
(
tester
.
getSize
(
find
.
byType
(
NavigationBar
)).
height
,
expectedHeight
);
});
testWidgets
(
'NavigationBar respects the notch/system navigation bar in landscape mode'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'NavigationBar respects the notch/system navigation bar in landscape mode'
,
(
WidgetTester
tester
)
async
{
const
double
safeAreaPadding
=
40.0
;
Widget
navigationBar
()
{
return
NavigationBar
(
...
...
@@ -246,7 +247,7 @@ void main() {
);
});
testWidgets
(
'Material2 - NavigationBar uses proper defaults when no parameters are given'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Material2 - NavigationBar uses proper defaults when no parameters are given'
,
(
WidgetTester
tester
)
async
{
// M2 settings that were hand coded.
await
tester
.
pumpWidget
(
_buildWidget
(
...
...
@@ -275,7 +276,7 @@ void main() {
expect
(
_getIndicatorDecoration
(
tester
)?.
shape
,
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
circular
(
16
)));
});
testWidgets
(
'Material3 - NavigationBar uses proper defaults when no parameters are given'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Material3 - NavigationBar uses proper defaults when no parameters are given'
,
(
WidgetTester
tester
)
async
{
// M3 settings from the token database.
final
ThemeData
theme
=
ThemeData
(
useMaterial3:
true
);
await
tester
.
pumpWidget
(
...
...
@@ -305,7 +306,7 @@ void main() {
expect
(
_getIndicatorDecoration
(
tester
)?.
shape
,
const
StadiumBorder
());
});
testWidgets
(
'Material2 - NavigationBar shows tooltips with text scaling'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Material2 - NavigationBar shows tooltips with text scaling'
,
(
WidgetTester
tester
)
async
{
const
String
label
=
'A'
;
Widget
buildApp
({
required
double
textScaleFactor
})
{
...
...
@@ -364,7 +365,7 @@ void main() {
expect
(
tester
.
getSize
(
find
.
text
(
label
).
last
),
Size
(
defaultTooltipSize
.
width
*
4
,
defaultTooltipSize
.
height
*
4
));
});
testWidgets
(
'Material3 - NavigationBar shows tooltips with text scaling'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Material3 - NavigationBar shows tooltips with text scaling'
,
(
WidgetTester
tester
)
async
{
const
String
label
=
'A'
;
Widget
buildApp
({
required
double
textScaleFactor
})
{
...
...
@@ -430,7 +431,7 @@ void main() {
}
});
testWidgets
(
'Custom tooltips in NavigationBarDestination'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Custom tooltips in NavigationBarDestination'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
...
...
@@ -470,7 +471,7 @@ void main() {
});
testWidgets
(
'Navigation bar semantics'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Navigation bar semantics'
,
(
WidgetTester
tester
)
async
{
Widget
widget
({
int
selectedIndex
=
0
})
{
return
_buildWidget
(
NavigationBar
(
...
...
@@ -534,7 +535,7 @@ void main() {
);
});
testWidgets
(
'Navigation bar semantics with some labels hidden'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Navigation bar semantics with some labels hidden'
,
(
WidgetTester
tester
)
async
{
Widget
widget
({
int
selectedIndex
=
0
})
{
return
_buildWidget
(
NavigationBar
(
...
...
@@ -599,7 +600,7 @@ void main() {
);
});
testWidgets
(
'Navigation bar does not grow with text scale factor'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Navigation bar does not grow with text scale factor'
,
(
WidgetTester
tester
)
async
{
const
int
animationMilliseconds
=
800
;
Widget
widget
({
double
textScaleFactor
=
1
})
{
...
...
@@ -632,7 +633,7 @@ void main() {
expect
(
newHeight
,
equals
(
initialHeight
));
});
testWidgets
(
'Material3 - Navigation indicator renders ripple'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Material3 - Navigation indicator renders ripple'
,
(
WidgetTester
tester
)
async
{
// This is a regression test for https://github.com/flutter/flutter/issues/116751.
int
selectedIndex
=
0
;
...
...
@@ -833,7 +834,7 @@ void main() {
);
});
testWidgets
(
'Material3 - Navigation indicator ripple golden test'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Material3 - Navigation indicator ripple golden test'
,
(
WidgetTester
tester
)
async
{
// This is a regression test for https://github.com/flutter/flutter/issues/117420.
Widget
buildWidget
({
NavigationDestinationLabelBehavior
?
labelBehavior
})
{
...
...
@@ -890,7 +891,7 @@ void main() {
await
expectLater
(
find
.
byType
(
NavigationBar
),
matchesGoldenFile
(
'indicator_onlyShowSelected_unselected_m3.png'
));
});
testWidgets
(
'Navigation indicator scale transform'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Navigation indicator scale transform'
,
(
WidgetTester
tester
)
async
{
int
selectedIndex
=
0
;
Widget
buildNavigationBar
()
{
...
...
@@ -941,7 +942,7 @@ void main() {
expect
(
transform
.
getColumn
(
0
)[
0
],
1.0
);
});
testWidgets
(
'Material3 - Navigation destination updates indicator color and shape'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Material3 - Navigation destination updates indicator color and shape'
,
(
WidgetTester
tester
)
async
{
final
ThemeData
theme
=
ThemeData
(
useMaterial3:
true
);
const
Color
color
=
Color
(
0xff0000ff
);
const
ShapeBorder
shape
=
RoundedRectangleBorder
();
...
...
@@ -987,7 +988,7 @@ void main() {
// support is deprecated and the APIs are removed, these tests
// can be deleted.
testWidgets
(
'Material2 - Navigation destination updates indicator color and shape'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Material2 - Navigation destination updates indicator color and shape'
,
(
WidgetTester
tester
)
async
{
final
ThemeData
theme
=
ThemeData
(
useMaterial3:
false
);
const
Color
color
=
Color
(
0xff0000ff
);
const
ShapeBorder
shape
=
RoundedRectangleBorder
();
...
...
@@ -1031,7 +1032,7 @@ void main() {
expect
(
_getIndicatorDecoration
(
tester
)?.
shape
,
shape
);
});
testWidgets
(
'Material2 - Navigation indicator renders ripple'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Material2 - Navigation indicator renders ripple'
,
(
WidgetTester
tester
)
async
{
// This is a regression test for https://github.com/flutter/flutter/issues/116751.
int
selectedIndex
=
0
;
...
...
@@ -1232,7 +1233,7 @@ void main() {
);
});
testWidgets
(
'Material2 - Navigation indicator ripple golden test'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Material2 - Navigation indicator ripple golden test'
,
(
WidgetTester
tester
)
async
{
// This is a regression test for https://github.com/flutter/flutter/issues/117420.
Widget
buildWidget
({
NavigationDestinationLabelBehavior
?
labelBehavior
})
{
...
...
@@ -1289,7 +1290,7 @@ void main() {
await
expectLater
(
find
.
byType
(
NavigationBar
),
matchesGoldenFile
(
'indicator_onlyShowSelected_unselected_m2.png'
));
});
testWidgets
(
'Destination icon does not rebuild when tapped'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Destination icon does not rebuild when tapped'
,
(
WidgetTester
tester
)
async
{
// This is a regression test for https://github.com/flutter/flutter/issues/122811.
Widget
buildNavigationBar
()
{
...
...
packages/flutter/test/material/persistent_bottom_sheet_test.dart
View file @
d5e7f407
...
...
@@ -6,6 +6,8 @@ import 'package:flutter/material.dart';
import
'package:flutter/rendering.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'../foundation/leak_tracking.dart'
;
void
main
(
)
{
// Pumps and ensures that the BottomSheet animates non-linearly.
Future
<
void
>
checkNonLinearAnimation
(
WidgetTester
tester
)
async
{
...
...
@@ -95,7 +97,7 @@ void main() {
await
tester
.
pumpWidget
(
buildFrame
(
const
Text
(
'I love Flutter!'
)));
});
testWidgets
(
'Verify that a BottomSheet can be rebuilt with ScaffoldFeatureController.setState()'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Verify that a BottomSheet can be rebuilt with ScaffoldFeatureController.setState()'
,
(
WidgetTester
tester
)
async
{
final
GlobalKey
<
ScaffoldState
>
scaffoldKey
=
GlobalKey
<
ScaffoldState
>();
int
buildCount
=
0
;
...
...
@@ -122,7 +124,7 @@ void main() {
expect
(
buildCount
,
equals
(
2
));
});
testWidgets
(
'Verify that a persistent BottomSheet cannot be dismissed'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Verify that a persistent BottomSheet cannot be dismissed'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
body:
const
Center
(
child:
Text
(
'body'
)),
...
...
@@ -153,7 +155,7 @@ void main() {
expect
(
find
.
text
(
'Two'
),
findsOneWidget
);
});
testWidgets
(
'Verify that a scrollable BottomSheet can be dismissed'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Verify that a scrollable BottomSheet can be dismissed'
,
(
WidgetTester
tester
)
async
{
final
GlobalKey
<
ScaffoldState
>
scaffoldKey
=
GlobalKey
<
ScaffoldState
>();
await
tester
.
pumpWidget
(
MaterialApp
(
...
...
@@ -185,7 +187,7 @@ void main() {
expect
(
find
.
text
(
'Two'
),
findsNothing
);
});
testWidgets
(
'Verify DraggableScrollableSheet.shouldCloseOnMinExtent == false prevents dismissal'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Verify DraggableScrollableSheet.shouldCloseOnMinExtent == false prevents dismissal'
,
(
WidgetTester
tester
)
async
{
final
GlobalKey
<
ScaffoldState
>
scaffoldKey
=
GlobalKey
<
ScaffoldState
>();
await
tester
.
pumpWidget
(
MaterialApp
(
...
...
@@ -223,7 +225,7 @@ void main() {
expect
(
find
.
text
(
'Two'
),
findsOneWidget
);
});
testWidgets
(
'Verify that a BottomSheet animates non-linearly'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Verify that a BottomSheet animates non-linearly'
,
(
WidgetTester
tester
)
async
{
final
GlobalKey
<
ScaffoldState
>
scaffoldKey
=
GlobalKey
<
ScaffoldState
>();
await
tester
.
pumpWidget
(
MaterialApp
(
...
...
@@ -297,7 +299,7 @@ void main() {
expect
(
find
.
text
(
'Two'
),
findsNothing
);
});
testWidgets
(
'Verify that a persistent BottomSheet can fling up and hide the fab'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Verify that a persistent BottomSheet can fling up and hide the fab'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
...
...
@@ -408,7 +410,7 @@ void main() {
expect
(
find
.
text
(
'Item 22'
),
findsNothing
);
});
testWidgets
(
'Verify that a scrollable BottomSheet hides the fab when scrolled up'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Verify that a scrollable BottomSheet hides the fab when scrolled up'
,
(
WidgetTester
tester
)
async
{
final
GlobalKey
<
ScaffoldState
>
scaffoldKey
=
GlobalKey
<
ScaffoldState
>();
await
tester
.
pumpWidget
(
MaterialApp
(
...
...
@@ -462,7 +464,7 @@ void main() {
expect
(
find
.
byType
(
FloatingActionButton
).
hitTestable
(),
findsNothing
);
});
testWidgets
(
'showBottomSheet()'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'showBottomSheet()'
,
(
WidgetTester
tester
)
async
{
final
GlobalKey
key
=
GlobalKey
();
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
...
...
@@ -486,7 +488,7 @@ void main() {
expect
(
buildCount
,
equals
(
1
));
});
testWidgets
(
'Scaffold removes top MediaQuery padding'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Scaffold removes top MediaQuery padding'
,
(
WidgetTester
tester
)
async
{
late
BuildContext
scaffoldContext
;
late
BuildContext
bottomSheetContext
;
...
...
@@ -588,7 +590,7 @@ void main() {
});
// Regression test for https://github.com/flutter/flutter/issues/71435
testWidgets
(
testWidgets
WithLeakTracking
(
'Scaffold.bottomSheet should be updated without creating a new RO'
' when the new widget has the same key and type.'
,
(
WidgetTester
tester
)
async
{
...
...
@@ -612,7 +614,7 @@ void main() {
},
);
testWidgets
(
'Verify that visual properties are passed through'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Verify that visual properties are passed through'
,
(
WidgetTester
tester
)
async
{
final
GlobalKey
<
ScaffoldState
>
scaffoldKey
=
GlobalKey
<
ScaffoldState
>();
const
Color
color
=
Colors
.
pink
;
const
double
elevation
=
9.0
;
...
...
@@ -647,7 +649,7 @@ void main() {
expect
(
bottomSheet
.
clipBehavior
,
clipBehavior
);
});
testWidgets
(
'PersistentBottomSheetController.close dismisses the bottom sheet'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'PersistentBottomSheetController.close dismisses the bottom sheet'
,
(
WidgetTester
tester
)
async
{
final
GlobalKey
<
ScaffoldState
>
scaffoldKey
=
GlobalKey
();
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
...
...
packages/flutter/test/material/radio_test.dart
View file @
d5e7f407
This diff is collapsed.
Click to expand it.
packages/flutter/test/material/refresh_indicator_test.dart
View file @
d5e7f407
This diff is collapsed.
Click to expand it.
packages/flutter/test/material/segmented_button_test.dart
View file @
d5e7f407
...
...
@@ -10,6 +10,7 @@ import 'package:flutter/material.dart';
import
'package:flutter/rendering.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'../foundation/leak_tracking.dart'
;
import
'../rendering/mock_canvas.dart'
;
import
'../widgets/semantics_tester.dart'
;
...
...
@@ -22,7 +23,7 @@ Widget boilerplate({required Widget child}) {
void
main
(
)
{
testWidgets
(
'SegmentedButton is built with Material of type MaterialType.transparency'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'SegmentedButton is built with Material of type MaterialType.transparency'
,
(
WidgetTester
tester
)
async
{
final
ThemeData
theme
=
ThemeData
(
useMaterial3:
true
);
await
tester
.
pumpWidget
(
MaterialApp
(
...
...
@@ -330,7 +331,7 @@ testWidgets('SegmentedButton shows checkboxes for selected segments', (WidgetTes
});
testWidgets
(
'SegmentedButtons have correct semantics'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'SegmentedButtons have correct semantics'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
SemanticsTester
(
tester
);
await
tester
.
pumpWidget
(
...
...
@@ -409,7 +410,7 @@ testWidgets('SegmentedButton shows checkboxes for selected segments', (WidgetTes
});
testWidgets
(
'Multi-select SegmentedButtons have correct semantics'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Multi-select SegmentedButtons have correct semantics'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
SemanticsTester
(
tester
);
await
tester
.
pumpWidget
(
...
...
@@ -486,7 +487,7 @@ testWidgets('SegmentedButton shows checkboxes for selected segments', (WidgetTes
semantics
.
dispose
();
});
testWidgets
(
'SegmentedButton default overlayColor and foregroundColor resolve pressed state'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'SegmentedButton default overlayColor and foregroundColor resolve pressed state'
,
(
WidgetTester
tester
)
async
{
final
ThemeData
theme
=
ThemeData
(
useMaterial3:
true
);
await
tester
.
pumpWidget
(
...
...
@@ -534,7 +535,7 @@ testWidgets('SegmentedButton shows checkboxes for selected segments', (WidgetTes
expect
(
material
.
textStyle
?.
color
,
theme
.
colorScheme
.
onSurface
);
});
testWidgets
(
'SegmentedButton has no tooltips by default'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'SegmentedButton has no tooltips by default'
,
(
WidgetTester
tester
)
async
{
final
ThemeData
theme
=
ThemeData
(
useMaterial3:
true
);
await
tester
.
pumpWidget
(
MaterialApp
(
...
...
@@ -558,7 +559,7 @@ testWidgets('SegmentedButton shows checkboxes for selected segments', (WidgetTes
expect
(
find
.
byType
(
Tooltip
),
findsNothing
);
});
testWidgets
(
'SegmentedButton has correct tooltips'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'SegmentedButton has correct tooltips'
,
(
WidgetTester
tester
)
async
{
final
ThemeData
theme
=
ThemeData
(
useMaterial3:
true
);
await
tester
.
pumpWidget
(
MaterialApp
(
...
...
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