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
b79e3462
Unverified
Commit
b79e3462
authored
Oct 08, 2020
by
Justin McCandless
Committed by
GitHub
Oct 08, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some NNBD Test Conversion (#67558)
Just converting some test files to NNBD
parent
82ff2461
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
158 additions
and
187 deletions
+158
-187
flat_button_test.dart
packages/flutter/test/material/flat_button_test.dart
+28
-30
flexible_space_bar_collapse_mode_test.dart
.../test/material/flexible_space_bar_collapse_mode_test.dart
+0
-2
flexible_space_bar_stretch_mode_test.dart
...r/test/material/flexible_space_bar_stretch_mode_test.dart
+0
-2
flexible_space_bar_test.dart
packages/flutter/test/material/flexible_space_bar_test.dart
+7
-10
floating_action_button_location_test.dart
...r/test/material/floating_action_button_location_test.dart
+40
-42
floating_action_button_test.dart
...es/flutter/test/material/floating_action_button_test.dart
+12
-14
floating_action_button_theme_test.dart
...tter/test/material/floating_action_button_theme_test.dart
+3
-5
grid_title_test.dart
packages/flutter/test/material/grid_title_test.dart
+0
-2
icon_button_test.dart
packages/flutter/test/material/icon_button_test.dart
+6
-8
icons_test.dart
packages/flutter/test/material/icons_test.dart
+0
-2
inherited_theme_test.dart
packages/flutter/test/material/inherited_theme_test.dart
+39
-41
ink_paint_test.dart
packages/flutter/test/material/ink_paint_test.dart
+0
-2
ink_splash_test.dart
packages/flutter/test/material/ink_splash_test.dart
+0
-2
ink_well_test.dart
packages/flutter/test/material/ink_well_test.dart
+23
-25
No files found.
packages/flutter/test/material/flat_button_test.dart
View file @
b79e3462
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'package:flutter/material.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/gestures.dart'
;
...
...
@@ -38,10 +36,10 @@ void main() {
expect
(
material
.
elevation
,
0.0
);
expect
(
material
.
shadowColor
,
null
);
expect
(
material
.
shape
,
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
circular
(
2.0
)));
expect
(
material
.
textStyle
.
color
,
const
Color
(
0xdd000000
));
expect
(
material
.
textStyle
.
fontFamily
,
'Roboto'
);
expect
(
material
.
textStyle
.
fontSize
,
14
);
expect
(
material
.
textStyle
.
fontWeight
,
FontWeight
.
w500
);
expect
(
material
.
textStyle
?
.
color
,
const
Color
(
0xdd000000
));
expect
(
material
.
textStyle
?
.
fontFamily
,
'Roboto'
);
expect
(
material
.
textStyle
?
.
fontSize
,
14
);
expect
(
material
.
textStyle
?
.
fontWeight
,
FontWeight
.
w500
);
expect
(
material
.
type
,
MaterialType
.
transparency
);
final
Offset
center
=
tester
.
getCenter
(
find
.
byType
(
FlatButton
));
...
...
@@ -58,10 +56,10 @@ void main() {
expect
(
material
.
elevation
,
0.0
);
expect
(
material
.
shadowColor
,
null
);
expect
(
material
.
shape
,
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
circular
(
2.0
)));
expect
(
material
.
textStyle
.
color
,
const
Color
(
0xdd000000
));
expect
(
material
.
textStyle
.
fontFamily
,
'Roboto'
);
expect
(
material
.
textStyle
.
fontSize
,
14
);
expect
(
material
.
textStyle
.
fontWeight
,
FontWeight
.
w500
);
expect
(
material
.
textStyle
?
.
color
,
const
Color
(
0xdd000000
));
expect
(
material
.
textStyle
?
.
fontFamily
,
'Roboto'
);
expect
(
material
.
textStyle
?
.
fontSize
,
14
);
expect
(
material
.
textStyle
?
.
fontWeight
,
FontWeight
.
w500
);
expect
(
material
.
type
,
MaterialType
.
transparency
);
// Disabled FlatButton
...
...
@@ -83,10 +81,10 @@ void main() {
expect
(
material
.
elevation
,
0.0
);
expect
(
material
.
shadowColor
,
null
);
expect
(
material
.
shape
,
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
circular
(
2.0
)));
expect
(
material
.
textStyle
.
color
,
const
Color
(
0x61000000
));
expect
(
material
.
textStyle
.
fontFamily
,
'Roboto'
);
expect
(
material
.
textStyle
.
fontSize
,
14
);
expect
(
material
.
textStyle
.
fontWeight
,
FontWeight
.
w500
);
expect
(
material
.
textStyle
?
.
color
,
const
Color
(
0x61000000
));
expect
(
material
.
textStyle
?
.
fontFamily
,
'Roboto'
);
expect
(
material
.
textStyle
?
.
fontSize
,
14
);
expect
(
material
.
textStyle
?
.
fontWeight
,
FontWeight
.
w500
);
expect
(
material
.
type
,
MaterialType
.
transparency
);
});
...
...
@@ -171,9 +169,9 @@ void main() {
MaterialState
.
focused
,
};
if
(
states
.
any
(
interactiveStates
.
contains
))
{
return
Colors
.
blue
[
900
];
return
Colors
.
blue
[
900
]
!
;
}
return
Colors
.
blue
[
800
];
return
Colors
.
blue
[
800
]
!
;
}
await
tester
.
pumpWidget
(
...
...
@@ -260,8 +258,8 @@ void main() {
),
);
Color
textColor
()
{
return
tester
.
renderObject
<
RenderParagraph
>(
find
.
text
(
'FlatButton'
)).
text
.
style
.
color
;
Color
?
textColor
()
{
return
tester
.
renderObject
<
RenderParagraph
>(
find
.
text
(
'FlatButton'
)).
text
.
style
?
.
color
;
}
// Default, not disabled.
...
...
@@ -329,7 +327,7 @@ void main() {
),
);
Color
iconColor
()
=>
_iconStyle
(
tester
,
Icons
.
add
)
.
color
;
Color
?
iconColor
()
=>
_iconStyle
(
tester
,
Icons
.
add
)?
.
color
;
// Default, not disabled.
expect
(
iconColor
(),
equals
(
defaultColor
));
...
...
@@ -386,8 +384,8 @@ void main() {
),
);
Color
textColor
()
{
return
tester
.
renderObject
<
RenderParagraph
>(
find
.
text
(
'FlatButton'
)).
text
.
style
.
color
;
Color
?
textColor
()
{
return
tester
.
renderObject
<
RenderParagraph
>(
find
.
text
(
'FlatButton'
)).
text
.
style
?
.
color
;
}
// Disabled.
...
...
@@ -460,7 +458,7 @@ void main() {
addTearDown
(
gesture
.
removePointer
);
await
tester
.
pump
();
expect
(
RendererBinding
.
instance
.
mouseTracker
.
debugDeviceActiveCursor
(
1
),
SystemMouseCursors
.
text
);
expect
(
RendererBinding
.
instance
?
.
mouseTracker
.
debugDeviceActiveCursor
(
1
),
SystemMouseCursors
.
text
);
await
tester
.
pumpWidget
(
Directionality
(
...
...
@@ -476,7 +474,7 @@ void main() {
),
);
expect
(
RendererBinding
.
instance
.
mouseTracker
.
debugDeviceActiveCursor
(
1
),
SystemMouseCursors
.
text
);
expect
(
RendererBinding
.
instance
?
.
mouseTracker
.
debugDeviceActiveCursor
(
1
),
SystemMouseCursors
.
text
);
// Test default cursor
await
tester
.
pumpWidget
(
...
...
@@ -492,7 +490,7 @@ void main() {
),
);
expect
(
RendererBinding
.
instance
.
mouseTracker
.
debugDeviceActiveCursor
(
1
),
SystemMouseCursors
.
click
);
expect
(
RendererBinding
.
instance
?
.
mouseTracker
.
debugDeviceActiveCursor
(
1
),
SystemMouseCursors
.
click
);
// Test default cursor when disabled
await
tester
.
pumpWidget
(
...
...
@@ -508,7 +506,7 @@ void main() {
),
);
expect
(
RendererBinding
.
instance
.
mouseTracker
.
debugDeviceActiveCursor
(
1
),
SystemMouseCursors
.
basic
);
expect
(
RendererBinding
.
instance
?
.
mouseTracker
.
debugDeviceActiveCursor
(
1
),
SystemMouseCursors
.
basic
);
});
testWidgets
(
'Does FlatButton work with focus'
,
(
WidgetTester
tester
)
async
{
...
...
@@ -527,7 +525,7 @@ void main() {
),
);
WidgetsBinding
.
instance
.
focusManager
.
highlightStrategy
=
FocusHighlightStrategy
.
alwaysTraditional
;
WidgetsBinding
.
instance
?
.
focusManager
.
highlightStrategy
=
FocusHighlightStrategy
.
alwaysTraditional
;
focusNode
.
requestFocus
();
await
tester
.
pumpAndSettle
();
...
...
@@ -695,7 +693,7 @@ void main() {
bool
wasPressed
;
Finder
flatButton
;
Widget
buildFrame
({
VoidCallback
onPressed
,
VoidCallback
onLongPress
})
{
Widget
buildFrame
({
VoidCallback
?
onPressed
,
VoidCallback
?
onLongPress
})
{
return
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
FlatButton
(
...
...
@@ -829,7 +827,7 @@ void main() {
const
double
buttonHeight
=
100
;
const
double
buttonDefaultMinHeight
=
36.0
;
Future
<
void
>
buildWidget
({
double
buttonHeight
})
{
Future
<
void
>
buildWidget
({
double
?
buttonHeight
})
{
return
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
...
...
@@ -859,7 +857,7 @@ void main() {
const
double
buttonMinWidth
=
100
;
const
double
buttonDefaultMinWidth
=
88.0
;
Future
<
void
>
buildWidget
({
double
buttonMinWidth
})
{
Future
<
void
>
buildWidget
({
double
?
buttonMinWidth
})
{
return
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
...
...
@@ -886,7 +884,7 @@ void main() {
});
}
TextStyle
_iconStyle
(
WidgetTester
tester
,
IconData
icon
)
{
TextStyle
?
_iconStyle
(
WidgetTester
tester
,
IconData
icon
)
{
final
RichText
iconRichText
=
tester
.
widget
<
RichText
>(
find
.
descendant
(
of:
find
.
byIcon
(
icon
),
matching:
find
.
byType
(
RichText
)),
);
...
...
packages/flutter/test/material/flexible_space_bar_collapse_mode_test.dart
View file @
b79e3462
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'package:flutter/foundation.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
...
...
packages/flutter/test/material/flexible_space_bar_stretch_mode_test.dart
View file @
b79e3462
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'package:flutter/material.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
...
...
packages/flutter/test/material/flexible_space_bar_test.dart
View file @
b79e3462
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'package:flutter/material.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
...
...
@@ -110,9 +108,8 @@ void main() {
final
Text
textWidget
=
actionTextBox
.
widget
as
Text
;
final
DefaultTextStyle
defaultTextStyle
=
DefaultTextStyle
.
of
(
actionTextBox
);
TextStyle
effectiveStyle
=
textWidget
.
style
;
effectiveStyle
=
defaultTextStyle
.
style
.
merge
(
textWidget
.
style
);
expect
(
effectiveStyle
.
color
.
alpha
,
128
);
// Which is alpha of .5
final
TextStyle
effectiveStyle
=
defaultTextStyle
.
style
.
merge
(
textWidget
.
style
);
expect
(
effectiveStyle
.
color
?.
alpha
,
128
);
// Which is alpha of .5
// We drag up to fully collapse the space bar.
await
tester
.
drag
(
find
.
byType
(
Container
).
first
,
const
Offset
(
0
,
-
400.0
));
...
...
@@ -391,13 +388,13 @@ void main() {
testWidgets
(
'FlexibleSpaceBar sets width constraints for the title'
,
(
WidgetTester
tester
)
async
{
const
double
titleFontSize
=
20.0
;
const
double
height
=
300.0
;
double
width
;
late
double
width
;
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
body:
Builder
(
builder:
(
BuildContext
context
)
{
width
=
MediaQuery
.
of
(
context
).
size
.
width
;
width
=
MediaQuery
.
of
(
context
)
!
.
size
.
width
;
return
CustomScrollView
(
slivers:
<
Widget
>[
SliverAppBar
(
...
...
@@ -439,7 +436,7 @@ void main() {
});
testWidgets
(
'FlexibleSpaceBar test titlePadding defaults'
,
(
WidgetTester
tester
)
async
{
Widget
buildFrame
(
TargetPlatform
platform
,
bool
centerTitle
)
{
Widget
buildFrame
(
TargetPlatform
platform
,
bool
?
centerTitle
)
{
return
MaterialApp
(
theme:
ThemeData
(
platform:
platform
),
home:
Scaffold
(
...
...
@@ -489,7 +486,7 @@ void main() {
});
testWidgets
(
'FlexibleSpaceBar test titlePadding override'
,
(
WidgetTester
tester
)
async
{
Widget
buildFrame
(
TargetPlatform
platform
,
bool
centerTitle
)
{
Widget
buildFrame
(
TargetPlatform
platform
,
bool
?
centerTitle
)
{
return
MaterialApp
(
theme:
ThemeData
(
platform:
platform
),
home:
Scaffold
(
...
...
@@ -560,7 +557,7 @@ void main() {
class
TestDelegate
extends
SliverPersistentHeaderDelegate
{
const
TestDelegate
({
this
.
settings
,
required
this
.
settings
,
});
final
FlexibleSpaceBarSettings
settings
;
...
...
packages/flutter/test/material/floating_action_button_location_test.dart
View file @
b79e3462
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'dart:math'
;
import
'package:flutter/foundation.dart'
;
...
...
@@ -79,11 +77,11 @@ void main() {
});
group
(
'interrupts in-progress animations without jumps'
,
()
{
_GeometryListener
geometryListener
;
ScaffoldGeometry
geometry
;
_GeometryListenerState
listenerState
;
Size
previousRect
;
Iterable
<
double
>
previousRotations
;
_GeometryListener
?
geometryListener
;
ScaffoldGeometry
?
geometry
;
_GeometryListenerState
?
listenerState
;
Size
?
previousRect
;
Iterable
<
double
>
?
previousRotations
;
// The maximum amounts we expect the fab width and height to change
// during one step of a transition.
...
...
@@ -100,13 +98,13 @@ void main() {
// Measure the delta in width and height of the fab, and check that it never grows
// by more than the expected maximum deltas.
void
check
()
{
geometry
=
listenerState
.
cache
.
value
;
final
Size
currentRect
=
geometry
.
floatingActionButtonArea
?.
size
;
geometry
=
listenerState
?
.
cache
.
value
;
final
Size
?
currentRect
=
geometry
?
.
floatingActionButtonArea
?.
size
;
// Measure the delta in width and height of the rect, and check that
// it never grows by more than a safe amount.
if
(
previousRect
!=
null
&&
currentRect
!=
null
)
{
final
double
deltaWidth
=
currentRect
.
width
-
previousRect
.
width
;
final
double
deltaHeight
=
currentRect
.
height
-
previousRect
.
height
;
final
double
deltaWidth
=
currentRect
.
width
-
previousRect
!
.
width
;
final
double
deltaHeight
=
currentRect
.
height
-
previousRect
!
.
height
;
expect
(
deltaWidth
.
abs
(),
lessThanOrEqualTo
(
maxDeltaWidth
),
...
...
@@ -135,15 +133,15 @@ void main() {
final
Iterable
<
double
>
currentRotations
=
rotationTransitions
.
map
(
(
RotationTransition
t
)
=>
t
.
turns
.
value
);
if
(
previousRotations
!=
null
&&
previousRotations
.
isNotEmpty
if
(
previousRotations
!=
null
&&
previousRotations
!
.
isNotEmpty
&&
currentRotations
!=
null
&&
currentRotations
.
isNotEmpty
&&
previousRect
!=
null
&&
currentRect
!=
null
)
{
final
List
<
double
>
deltas
=
<
double
>[];
for
(
final
double
currentRotation
in
currentRotations
)
{
double
minDelta
;
for
(
final
double
previousRotation
in
previousRotations
)
{
late
double
minDelta
;
for
(
final
double
previousRotation
in
previousRotations
!
)
{
final
double
delta
=
(
previousRotation
-
currentRotation
).
abs
();
minDelta
??
=
delta
;
minDelta
=
delta
;
minDelta
=
min
(
delta
,
minDelta
);
}
deltas
.
add
(
minDelta
);
...
...
@@ -161,7 +159,7 @@ void main() {
}
listenerState
=
tester
.
state
(
find
.
byType
(
_GeometryListener
));
listenerState
.
geometryListenable
.
addListener
(
check
);
listenerState
!.
geometryListenable
!
.
addListener
(
check
);
}
setUp
(()
{
...
...
@@ -649,7 +647,7 @@ void main() {
builder:
(
BuildContext
context
)
{
return
FloatingActionButton
(
onPressed:
()
{
ScaffoldMessenger
.
of
(
context
).
showSnackBar
(
ScaffoldMessenger
.
of
(
context
)
!
.
showSnackBar
(
const
SnackBar
(
content:
Text
(
'Snacky!'
)),
);
},
...
...
@@ -677,10 +675,10 @@ void main() {
Future
<
void
>
_runFloatTests
(
WidgetTester
tester
,
FloatingActionButtonLocation
location
,
{
Rect
defaultRect
,
Rect
bottomNavigationBarRect
,
Rect
bottomSheetRect
,
Rect
snackBarRect
,
required
Rect
defaultRect
,
required
Rect
bottomNavigationBarRect
,
required
Rect
bottomSheetRect
,
required
Rect
snackBarRect
,
bool
mini
=
false
,
})
async
{
const
double
keyboardHeight
=
200.0
;
...
...
@@ -1050,10 +1048,10 @@ void main() {
Future
<
void
>
_runDockedTests
(
WidgetTester
tester
,
FloatingActionButtonLocation
location
,
{
Rect
defaultRect
,
Rect
bottomNavigationBarRect
,
Rect
bottomSheetRect
,
Rect
snackBarRect
,
required
Rect
defaultRect
,
required
Rect
bottomNavigationBarRect
,
required
Rect
bottomSheetRect
,
required
Rect
snackBarRect
,
bool
mini
=
false
,
})
async
{
const
double
keyboardHeight
=
200.0
;
...
...
@@ -1385,8 +1383,8 @@ void main() {
Future
<
void
>
_runTopTests
(
WidgetTester
tester
,
FloatingActionButtonLocation
location
,
{
Rect
defaultRect
,
Rect
appBarRect
,
required
Rect
defaultRect
,
required
Rect
appBarRect
,
bool
mini
=
false
,
})
async
{
const
double
viewPadding
=
50.0
;
...
...
@@ -1508,8 +1506,8 @@ class _GeometryListenerState extends State<_GeometryListener> {
}
int
numNotifications
=
0
;
ValueListenable
<
ScaffoldGeometry
>
geometryListenable
;
_GeometryCachePainter
cache
;
ValueListenable
<
ScaffoldGeometry
>
?
geometryListenable
;
late
_GeometryCachePainter
cache
;
@override
void
didChangeDependencies
()
{
...
...
@@ -1519,11 +1517,11 @@ class _GeometryListenerState extends State<_GeometryListener> {
return
;
if
(
geometryListenable
!=
null
)
geometryListenable
.
removeListener
(
onGeometryChanged
);
geometryListenable
!
.
removeListener
(
onGeometryChanged
);
geometryListenable
=
newListenable
;
geometryListenable
.
addListener
(
onGeometryChanged
);
cache
=
_GeometryCachePainter
(
geometryListenable
);
geometryListenable
!
.
addListener
(
onGeometryChanged
);
cache
=
_GeometryCachePainter
(
geometryListenable
!
);
}
void
onGeometryChanged
()
{
...
...
@@ -1545,7 +1543,7 @@ const double _miniFloatOffsetY = _floatOffsetY + kMiniButtonOffsetAdjustment;
Widget
_singleFabScaffold
(
FloatingActionButtonLocation
location
,
{
FloatingActionButtonAnimator
animator
,
FloatingActionButtonAnimator
?
animator
,
bool
mini
=
false
,
TextDirection
textDirection
=
TextDirection
.
ltr
,
}
...
...
@@ -1589,7 +1587,7 @@ class _GeometryCachePainter extends CustomPainter {
final
ValueListenable
<
ScaffoldGeometry
>
geometryListenable
;
ScaffoldGeometry
value
;
late
ScaffoldGeometry
value
;
@override
void
paint
(
Canvas
canvas
,
Size
size
)
{
value
=
geometryListenable
.
value
;
...
...
@@ -1602,15 +1600,15 @@ class _GeometryCachePainter extends CustomPainter {
}
Widget
buildFrame
(
{
FloatingActionButton
fab
=
const
FloatingActionButton
(
FloatingActionButton
?
fab
=
const
FloatingActionButton
(
onPressed:
null
,
child:
Text
(
'1'
),
),
FloatingActionButtonLocation
location
,
_GeometryListener
listener
,
FloatingActionButtonLocation
?
location
,
_GeometryListener
?
listener
,
TextDirection
textDirection
=
TextDirection
.
ltr
,
EdgeInsets
viewInsets
=
const
EdgeInsets
.
only
(
bottom:
200.0
),
Widget
bab
,
Widget
?
bab
,
})
{
return
Localizations
(
locale:
const
Locale
(
'en'
,
'us'
),
...
...
@@ -1677,17 +1675,17 @@ class _QuarterEndTopFabLocation extends StandardFabLocation
class
_LinearMovementFabAnimator
extends
FloatingActionButtonAnimator
{
@override
Offset
getOffset
({
@required
Offset
begin
,
@required
Offset
end
,
@
required
double
progress
})
{
return
Offset
.
lerp
(
begin
,
end
,
progress
);
Offset
getOffset
({
required
Offset
begin
,
required
Offset
end
,
required
double
progress
})
{
return
Offset
.
lerp
(
begin
,
end
,
progress
)
!
;
}
@override
Animation
<
double
>
getScaleAnimation
({
@
required
Animation
<
double
>
parent
})
{
Animation
<
double
>
getScaleAnimation
({
required
Animation
<
double
>
parent
})
{
return
const
AlwaysStoppedAnimation
<
double
>(
1.0
);
}
@override
Animation
<
double
>
getRotationAnimation
({
@
required
Animation
<
double
>
parent
})
{
Animation
<
double
>
getRotationAnimation
({
required
Animation
<
double
>
parent
})
{
return
const
AlwaysStoppedAnimation
<
double
>(
1.0
);
}
}
packages/flutter/test/material/floating_action_button_test.dart
View file @
b79e3462
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
@TestOn
(
'!chrome'
)
// whole file needs triage.
import
'dart:ui'
;
...
...
@@ -109,8 +107,8 @@ void main() {
expect
(
find
.
text
(
'Add'
),
findsNothing
);
// Test hover for tooltip.
TestGesture
gesture
=
await
tester
.
createGesture
(
kind:
PointerDeviceKind
.
mouse
);
await
gesture
.
addPointer
();
TestGesture
?
gesture
=
await
tester
.
createGesture
(
kind:
PointerDeviceKind
.
mouse
);
await
gesture
!
.
addPointer
();
addTearDown
(()
=>
gesture
?.
removePointer
());
await
gesture
.
moveTo
(
tester
.
getCenter
(
find
.
byType
(
FloatingActionButton
)));
await
tester
.
pumpAndSettle
();
...
...
@@ -146,8 +144,8 @@ void main() {
expect
(
find
.
text
(
'Add'
),
findsNothing
);
// Test hover for tooltip.
TestGesture
gesture
=
await
tester
.
createGesture
(
kind:
PointerDeviceKind
.
mouse
);
await
gesture
.
addPointer
();
TestGesture
?
gesture
=
await
tester
.
createGesture
(
kind:
PointerDeviceKind
.
mouse
);
await
gesture
!
.
addPointer
();
addTearDown
(()
=>
gesture
?.
removePointer
());
await
tester
.
pumpAndSettle
();
await
gesture
.
moveTo
(
tester
.
getCenter
(
find
.
byType
(
FloatingActionButton
)));
...
...
@@ -472,7 +470,7 @@ void main() {
});
testWidgets
(
'Floating Action Button heroTag'
,
(
WidgetTester
tester
)
async
{
BuildContext
theContext
;
late
BuildContext
theContext
;
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
...
...
@@ -495,7 +493,7 @@ void main() {
});
testWidgets
(
'Floating Action Button heroTag - with duplicate'
,
(
WidgetTester
tester
)
async
{
BuildContext
theContext
;
late
BuildContext
theContext
;
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
...
...
@@ -519,7 +517,7 @@ void main() {
});
testWidgets
(
'Floating Action Button heroTag - with duplicate'
,
(
WidgetTester
tester
)
async
{
BuildContext
theContext
;
late
BuildContext
theContext
;
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
...
...
@@ -773,7 +771,7 @@ void main() {
await
tester
.
pump
();
expect
(
RendererBinding
.
instance
.
mouseTracker
.
debugDeviceActiveCursor
(
1
),
SystemMouseCursors
.
text
);
expect
(
RendererBinding
.
instance
!
.
mouseTracker
.
debugDeviceActiveCursor
(
1
),
SystemMouseCursors
.
text
);
await
tester
.
pumpWidget
(
MaterialApp
(
...
...
@@ -791,7 +789,7 @@ void main() {
);
await
gesture
.
moveTo
(
tester
.
getCenter
(
find
.
byType
(
FloatingActionButton
)));
expect
(
RendererBinding
.
instance
.
mouseTracker
.
debugDeviceActiveCursor
(
1
),
SystemMouseCursors
.
text
);
expect
(
RendererBinding
.
instance
!
.
mouseTracker
.
debugDeviceActiveCursor
(
1
),
SystemMouseCursors
.
text
);
// Test default cursor
await
tester
.
pumpWidget
(
...
...
@@ -808,7 +806,7 @@ void main() {
),
);
expect
(
RendererBinding
.
instance
.
mouseTracker
.
debugDeviceActiveCursor
(
1
),
SystemMouseCursors
.
click
);
expect
(
RendererBinding
.
instance
!
.
mouseTracker
.
debugDeviceActiveCursor
(
1
),
SystemMouseCursors
.
click
);
// Test default cursor when disabled
await
tester
.
pumpWidget
(
...
...
@@ -825,7 +823,7 @@ void main() {
),
);
expect
(
RendererBinding
.
instance
.
mouseTracker
.
debugDeviceActiveCursor
(
1
),
SystemMouseCursors
.
basic
);
expect
(
RendererBinding
.
instance
!
.
mouseTracker
.
debugDeviceActiveCursor
(
1
),
SystemMouseCursors
.
basic
);
});
testWidgets
(
'Floating Action Button has no clip by default'
,
(
WidgetTester
tester
)
async
{
...
...
@@ -882,7 +880,7 @@ void main() {
final
RichText
iconRichText
=
tester
.
widget
<
RichText
>(
find
.
descendant
(
of:
find
.
byIcon
(
Icons
.
access_alarm
),
matching:
find
.
byType
(
RichText
)),
);
expect
(
iconRichText
.
text
.
style
.
color
,
foregroundColor
);
expect
(
iconRichText
.
text
.
style
!
.
color
,
foregroundColor
);
});
testWidgets
(
'FloatingActionButton uses custom splash color'
,
(
WidgetTester
tester
)
async
{
...
...
packages/flutter/test/material/floating_action_button_theme_test.dart
View file @
b79e3462
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'package:flutter/foundation.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/rendering.dart'
;
...
...
@@ -28,7 +26,7 @@ void main() {
// The color scheme values are guaranteed to be non null since the default
// [ThemeData] creates it with [ColorScheme.fromSwatch].
expect
(
_getRawMaterialButton
(
tester
).
fillColor
,
ThemeData
().
colorScheme
.
secondary
);
expect
(
_getRichText
(
tester
).
text
.
style
.
color
,
ThemeData
().
colorScheme
.
onSecondary
);
expect
(
_getRichText
(
tester
).
text
.
style
!
.
color
,
ThemeData
().
colorScheme
.
onSecondary
);
// These defaults come directly from the [FloatingActionButton].
expect
(
_getRawMaterialButton
(
tester
).
elevation
,
6
);
...
...
@@ -67,7 +65,7 @@ void main() {
));
expect
(
_getRawMaterialButton
(
tester
).
fillColor
,
backgroundColor
);
expect
(
_getRichText
(
tester
).
text
.
style
.
color
,
foregroundColor
);
expect
(
_getRichText
(
tester
).
text
.
style
!
.
color
,
foregroundColor
);
expect
(
_getRawMaterialButton
(
tester
).
elevation
,
elevation
);
expect
(
_getRawMaterialButton
(
tester
).
disabledElevation
,
disabledElevation
);
expect
(
_getRawMaterialButton
(
tester
).
highlightElevation
,
highlightElevation
);
...
...
@@ -112,7 +110,7 @@ void main() {
));
expect
(
_getRawMaterialButton
(
tester
).
fillColor
,
backgroundColor
);
expect
(
_getRichText
(
tester
).
text
.
style
.
color
,
foregroundColor
);
expect
(
_getRichText
(
tester
).
text
.
style
!
.
color
,
foregroundColor
);
expect
(
_getRawMaterialButton
(
tester
).
elevation
,
elevation
);
expect
(
_getRawMaterialButton
(
tester
).
disabledElevation
,
disabledElevation
);
expect
(
_getRawMaterialButton
(
tester
).
highlightElevation
,
highlightElevation
);
...
...
packages/flutter/test/material/grid_title_test.dart
View file @
b79e3462
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/material.dart'
;
...
...
packages/flutter/test/material/icon_button_test.dart
View file @
b79e3462
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'dart:ui'
;
import
'package:flutter/material.dart'
;
...
...
@@ -23,7 +21,7 @@ class MockOnPressedFunction {
}
void
main
(
)
{
MockOnPressedFunction
mockOnPressedFunction
;
late
MockOnPressedFunction
mockOnPressedFunction
;
setUp
(()
{
mockOnPressedFunction
=
MockOnPressedFunction
();
...
...
@@ -537,14 +535,14 @@ void main() {
});
group
(
'feedback'
,
()
{
FeedbackTester
feedback
;
late
FeedbackTester
feedback
;
setUp
(()
{
feedback
=
FeedbackTester
();
});
tearDown
(()
{
feedback
?
.
dispose
();
feedback
.
dispose
();
});
testWidgets
(
'IconButton with disabled feedback'
,
(
WidgetTester
tester
)
async
{
...
...
@@ -664,7 +662,7 @@ void main() {
await
tester
.
pump
();
expect
(
RendererBinding
.
instance
.
mouseTracker
.
debugDeviceActiveCursor
(
1
),
SystemMouseCursors
.
forbidden
);
expect
(
RendererBinding
.
instance
!
.
mouseTracker
.
debugDeviceActiveCursor
(
1
),
SystemMouseCursors
.
forbidden
);
// Test default is click
await
tester
.
pumpWidget
(
...
...
@@ -681,11 +679,11 @@ void main() {
),
);
expect
(
RendererBinding
.
instance
.
mouseTracker
.
debugDeviceActiveCursor
(
1
),
SystemMouseCursors
.
click
);
expect
(
RendererBinding
.
instance
!
.
mouseTracker
.
debugDeviceActiveCursor
(
1
),
SystemMouseCursors
.
click
);
});
}
Widget
wrap
(
{
Widget
child
})
{
Widget
wrap
(
{
required
Widget
child
})
{
return
FocusTraversalGroup
(
policy:
ReadingOrderTraversalPolicy
(),
child:
Directionality
(
...
...
packages/flutter/test/material/icons_test.dart
View file @
b79e3462
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'package:flutter/material.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
...
...
packages/flutter/test/material/inherited_theme_test.dart
View file @
b79e3462
This diff is collapsed.
Click to expand it.
packages/flutter/test/material/ink_paint_test.dart
View file @
b79e3462
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'package:flutter/material.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/services.dart'
;
...
...
packages/flutter/test/material/ink_splash_test.dart
View file @
b79e3462
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'package:flutter/material.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
...
...
packages/flutter/test/material/ink_well_test.dart
View file @
b79e3462
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import
'package:flutter/material.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
...
...
@@ -400,7 +398,7 @@ void main() {
),
);
expect
(
RendererBinding
.
instance
.
mouseTracker
.
debugDeviceActiveCursor
(
1
),
SystemMouseCursors
.
click
);
expect
(
RendererBinding
.
instance
!
.
mouseTracker
.
debugDeviceActiveCursor
(
1
),
SystemMouseCursors
.
click
);
// Test default of InkWell()
await
tester
.
pumpWidget
(
...
...
@@ -417,7 +415,7 @@ void main() {
),
);
expect
(
RendererBinding
.
instance
.
mouseTracker
.
debugDeviceActiveCursor
(
1
),
SystemMouseCursors
.
click
);
expect
(
RendererBinding
.
instance
!
.
mouseTracker
.
debugDeviceActiveCursor
(
1
),
SystemMouseCursors
.
click
);
// Test disabled
await
tester
.
pumpWidget
(
...
...
@@ -432,7 +430,7 @@ void main() {
),
);
expect
(
RendererBinding
.
instance
.
mouseTracker
.
debugDeviceActiveCursor
(
1
),
SystemMouseCursors
.
basic
);
expect
(
RendererBinding
.
instance
!
.
mouseTracker
.
debugDeviceActiveCursor
(
1
),
SystemMouseCursors
.
basic
);
// Test default of InkResponse()
await
tester
.
pumpWidget
(
...
...
@@ -449,7 +447,7 @@ void main() {
),
);
expect
(
RendererBinding
.
instance
.
mouseTracker
.
debugDeviceActiveCursor
(
1
),
SystemMouseCursors
.
click
);
expect
(
RendererBinding
.
instance
!
.
mouseTracker
.
debugDeviceActiveCursor
(
1
),
SystemMouseCursors
.
click
);
// Test disabled
await
tester
.
pumpWidget
(
...
...
@@ -464,18 +462,18 @@ void main() {
),
);
expect
(
RendererBinding
.
instance
.
mouseTracker
.
debugDeviceActiveCursor
(
1
),
SystemMouseCursors
.
basic
);
expect
(
RendererBinding
.
instance
!
.
mouseTracker
.
debugDeviceActiveCursor
(
1
),
SystemMouseCursors
.
basic
);
});
group
(
'feedback'
,
()
{
FeedbackTester
feedback
;
late
FeedbackTester
feedback
;
setUp
(()
{
feedback
=
FeedbackTester
();
});
tearDown
(()
{
feedback
?
.
dispose
();
feedback
.
dispose
();
});
testWidgets
(
'enabled (default)'
,
(
WidgetTester
tester
)
async
{
...
...
@@ -740,7 +738,7 @@ void main() {
testWidgets
(
'When ink wells are nested, only the inner one is triggered by tap splash'
,
(
WidgetTester
tester
)
async
{
final
GlobalKey
middleKey
=
GlobalKey
();
final
GlobalKey
innerKey
=
GlobalKey
();
Widget
paddedInkWell
({
Key
key
,
Widget
child
})
{
Widget
paddedInkWell
({
Key
?
key
,
Widget
?
child
})
{
return
InkWell
(
key:
key
,
onTap:
()
{},
...
...
@@ -769,7 +767,7 @@ void main() {
),
),
);
final
MaterialInkController
material
=
Material
.
of
(
tester
.
element
(
find
.
byKey
(
innerKey
)));
final
MaterialInkController
material
=
Material
.
of
(
tester
.
element
(
find
.
byKey
(
innerKey
)))
!
;
// Press
final
TestGesture
gesture
=
await
tester
.
startGesture
(
tester
.
getCenter
(
find
.
byKey
(
innerKey
)),
pointer:
1
);
...
...
@@ -806,7 +804,7 @@ void main() {
testWidgets
(
'Reparenting parent should allow both inkwells to show splash afterwards'
,
(
WidgetTester
tester
)
async
{
final
GlobalKey
middleKey
=
GlobalKey
();
final
GlobalKey
innerKey
=
GlobalKey
();
Widget
paddedInkWell
({
Key
key
,
Widget
child
})
{
Widget
paddedInkWell
({
Key
?
key
,
Widget
?
child
})
{
return
InkWell
(
key:
key
,
onTap:
()
{},
...
...
@@ -842,7 +840,7 @@ void main() {
),
),
);
final
MaterialInkController
material
=
Material
.
of
(
tester
.
element
(
find
.
byKey
(
innerKey
)));
final
MaterialInkController
material
=
Material
.
of
(
tester
.
element
(
find
.
byKey
(
innerKey
)))
!
;
// Press
final
TestGesture
gesture
=
await
tester
.
startGesture
(
tester
.
getCenter
(
find
.
byKey
(
innerKey
)),
pointer:
1
);
...
...
@@ -894,7 +892,7 @@ void main() {
testWidgets
(
'Parent inkwell does not block child inkwells from splashes'
,
(
WidgetTester
tester
)
async
{
final
GlobalKey
middleKey
=
GlobalKey
();
final
GlobalKey
innerKey
=
GlobalKey
();
Widget
paddedInkWell
({
Key
key
,
Widget
child
})
{
Widget
paddedInkWell
({
Key
?
key
,
Widget
?
child
})
{
return
InkWell
(
key:
key
,
onTap:
()
{},
...
...
@@ -923,7 +921,7 @@ void main() {
),
),
);
final
MaterialInkController
material
=
Material
.
of
(
tester
.
element
(
find
.
byKey
(
innerKey
)));
final
MaterialInkController
material
=
Material
.
of
(
tester
.
element
(
find
.
byKey
(
innerKey
)))
!
;
// Press middle
await
tester
.
startGesture
(
tester
.
getTopLeft
(
find
.
byKey
(
middleKey
))
+
const
Offset
(
1
,
1
),
pointer:
1
);
...
...
@@ -983,7 +981,7 @@ void main() {
),
),
);
final
MaterialInkController
material
=
Material
.
of
(
tester
.
element
(
find
.
byKey
(
leftKey
)));
final
MaterialInkController
material
=
Material
.
of
(
tester
.
element
(
find
.
byKey
(
leftKey
)))
!
;
final
Offset
parentPosition
=
tester
.
getTopLeft
(
find
.
byKey
(
parentKey
))
+
const
Offset
(
1
,
1
);
...
...
@@ -1032,10 +1030,10 @@ void main() {
final
GlobalKey
rightKey
=
GlobalKey
();
Widget
doubleInkWellRow
({
double
leftWidth
,
double
rightWidth
,
Widget
leftChild
,
Widget
rightChild
,
required
double
leftWidth
,
required
double
rightWidth
,
Widget
?
leftChild
,
Widget
?
rightChild
,
})
{
return
Material
(
child:
Directionality
(
...
...
@@ -1095,7 +1093,7 @@ void main() {
),
),
);
final
MaterialInkController
material
=
Material
.
of
(
tester
.
element
(
find
.
byKey
(
innerKey
)));
final
MaterialInkController
material
=
Material
.
of
(
tester
.
element
(
find
.
byKey
(
innerKey
)))
!
;
// Press inner
final
TestGesture
gesture
=
await
tester
.
startGesture
(
const
Offset
(
100
,
50
),
pointer:
1
);
...
...
@@ -1169,7 +1167,7 @@ void main() {
),
),
);
final
MaterialInkController
material
=
Material
.
of
(
tester
.
element
(
find
.
byKey
(
innerKey
)));
final
MaterialInkController
material
=
Material
.
of
(
tester
.
element
(
find
.
byKey
(
innerKey
)))
!
;
// Press
final
TestGesture
gesture
=
await
tester
.
startGesture
(
tester
.
getCenter
(
find
.
byKey
(
innerKey
)),
pointer:
1
);
...
...
@@ -1194,9 +1192,9 @@ void main() {
testWidgets
(
'disabled and hovered inkwell responds to mouse-exit'
,
(
WidgetTester
tester
)
async
{
int
onHoverCount
=
0
;
bool
hover
;
late
bool
hover
;
Widget
buildFrame
({
bool
enabled
})
{
Widget
buildFrame
({
required
bool
enabled
})
{
return
Material
(
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
...
...
@@ -1257,7 +1255,7 @@ void main() {
});
testWidgets
(
'Changing InkWell.enabled should not trigger TextButton setState()'
,
(
WidgetTester
tester
)
async
{
Widget
buildFrame
({
bool
enabled
})
{
Widget
buildFrame
({
required
bool
enabled
})
{
return
Material
(
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
...
...
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