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
4513e96a
Unverified
Commit
4513e96a
authored
Oct 08, 2020
by
Michael Goderbauer
Committed by
GitHub
Oct 08, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate more material tests (#67591)
parent
b79e3462
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
146 additions
and
157 deletions
+146
-157
tabs_test.dart
packages/flutter/test/material/tabs_test.dart
+72
-71
text_button_test.dart
packages/flutter/test/material/text_button_test.dart
+38
-40
text_button_theme_test.dart
packages/flutter/test/material/text_button_theme_test.dart
+12
-14
text_field_focus_test.dart
packages/flutter/test/material/text_field_focus_test.dart
+2
-4
text_field_helper_text_test.dart
...es/flutter/test/material/text_field_helper_text_test.dart
+0
-2
text_field_restoration_test.dart
...es/flutter/test/material/text_field_restoration_test.dart
+2
-4
text_field_splash_test.dart
packages/flutter/test/material/text_field_splash_test.dart
+20
-22
No files found.
packages/flutter/test/material/tabs_test.dart
View file @
4513e96a
This diff is collapsed.
Click to expand it.
packages/flutter/test/material/text_button_test.dart
View file @
4513e96a
This diff is collapsed.
Click to expand it.
packages/flutter/test/material/text_button_theme_test.dart
View file @
4513e96a
...
...
@@ -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'
;
...
...
@@ -37,10 +35,10 @@ void main() {
expect
(
material
.
elevation
,
0.0
);
expect
(
material
.
shadowColor
,
const
Color
(
0xff000000
));
expect
(
material
.
shape
,
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
circular
(
4.0
)));
expect
(
material
.
textStyle
.
color
,
colorScheme
.
primary
);
expect
(
material
.
textStyle
.
fontFamily
,
'Roboto'
);
expect
(
material
.
textStyle
.
fontSize
,
14
);
expect
(
material
.
textStyle
.
fontWeight
,
FontWeight
.
w500
);
expect
(
material
.
textStyle
!
.
color
,
colorScheme
.
primary
);
expect
(
material
.
textStyle
!
.
fontFamily
,
'Roboto'
);
expect
(
material
.
textStyle
!
.
fontSize
,
14
);
expect
(
material
.
textStyle
!
.
fontWeight
,
FontWeight
.
w500
);
});
group
(
'[Theme, TextTheme, TextButton style overrides]'
,
()
{
...
...
@@ -78,7 +76,7 @@ void main() {
enableFeedback:
enableFeedback
,
);
Widget
buildFrame
({
ButtonStyle
buttonStyle
,
ButtonStyle
themeStyle
,
ButtonStyle
overallStyle
})
{
Widget
buildFrame
({
ButtonStyle
?
buttonStyle
,
ButtonStyle
?
themeStyle
,
ButtonStyle
?
overallStyle
})
{
final
Widget
child
=
Builder
(
builder:
(
BuildContext
context
)
{
return
TextButton
(
...
...
@@ -123,15 +121,15 @@ void main() {
void
checkButton
(
WidgetTester
tester
)
{
final
Material
material
=
tester
.
widget
<
Material
>(
findMaterial
);
final
InkWell
inkWell
=
tester
.
widget
<
InkWell
>(
findInkWell
);
expect
(
material
.
textStyle
.
color
,
primaryColor
);
expect
(
material
.
textStyle
.
fontSize
,
12
);
expect
(
material
.
textStyle
!
.
color
,
primaryColor
);
expect
(
material
.
textStyle
!
.
fontSize
,
12
);
expect
(
material
.
color
,
backgroundColor
);
expect
(
material
.
shadowColor
,
shadowColor
);
expect
(
material
.
elevation
,
elevation
);
expect
(
MaterialStateProperty
.
resolveAs
<
MouseCursor
>(
inkWell
.
mouseCursor
,
enabled
),
enabledMouseCursor
);
expect
(
MaterialStateProperty
.
resolveAs
<
MouseCursor
>(
inkWell
.
mouseCursor
,
disabled
),
disabledMouseCursor
);
expect
(
inkWell
.
overlayColor
.
resolve
(
hovered
),
primaryColor
.
withOpacity
(
0.04
));
expect
(
inkWell
.
overlayColor
.
resolve
(
focused
),
primaryColor
.
withOpacity
(
0.12
));
expect
(
MaterialStateProperty
.
resolveAs
<
MouseCursor
?
>(
inkWell
.
mouseCursor
,
enabled
),
enabledMouseCursor
);
expect
(
MaterialStateProperty
.
resolveAs
<
MouseCursor
?
>(
inkWell
.
mouseCursor
,
disabled
),
disabledMouseCursor
);
expect
(
inkWell
.
overlayColor
!
.
resolve
(
hovered
),
primaryColor
.
withOpacity
(
0.04
));
expect
(
inkWell
.
overlayColor
!
.
resolve
(
focused
),
primaryColor
.
withOpacity
(
0.12
));
expect
(
inkWell
.
enableFeedback
,
enableFeedback
);
expect
(
material
.
borderRadius
,
null
);
expect
(
material
.
shape
,
shape
);
...
...
@@ -183,7 +181,7 @@ void main() {
const
Color
shadowColor
=
Color
(
0xff000001
);
const
Color
overiddenColor
=
Color
(
0xff000002
);
Widget
buildFrame
({
Color
overallShadowColor
,
Color
themeShadowColor
,
Color
shadowColor
})
{
Widget
buildFrame
({
Color
?
overallShadowColor
,
Color
?
themeShadowColor
,
Color
?
shadowColor
})
{
return
MaterialApp
(
theme:
ThemeData
.
from
(
colorScheme:
colorScheme
).
copyWith
(
shadowColor:
overallShadowColor
,
...
...
packages/flutter/test/material/text_field_focus_test.dart
View file @
4513e96a
...
...
@@ -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'
;
...
...
@@ -40,7 +38,7 @@ void main() {
expect
(
tester
.
testTextInput
.
isVisible
,
isFalse
);
Navigator
.
of
(
tester
.
element
(
find
.
text
(
'Dialog'
))).
pop
();
Navigator
.
of
(
tester
.
element
(
find
.
text
(
'Dialog'
)))
!
.
pop
();
await
tester
.
pump
();
expect
(
focusNode
.
hasPrimaryFocus
,
isTrue
);
...
...
@@ -177,7 +175,7 @@ void main() {
testWidgets
(
'Focus keep-alive works with GlobalKey reparenting'
,
(
WidgetTester
tester
)
async
{
final
FocusNode
focusNode
=
FocusNode
();
Widget
makeTest
(
String
prefix
)
{
Widget
makeTest
(
String
?
prefix
)
{
return
MaterialApp
(
home:
Material
(
child:
ListView
(
...
...
packages/flutter/test/material/text_field_helper_text_test.dart
View file @
4513e96a
...
...
@@ -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/text_field_restoration_test.dart
View file @
4513e96a
...
...
@@ -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'
;
...
...
@@ -74,7 +72,7 @@ Future<void> restoreAndVerify(WidgetTester tester) async {
}
class
TestWidget
extends
StatefulWidget
{
const
TestWidget
({
Key
key
,
this
.
useExternal
=
false
})
:
super
(
key:
key
);
const
TestWidget
({
Key
?
key
,
this
.
useExternal
=
false
})
:
super
(
key:
key
);
final
bool
useExternal
;
...
...
@@ -89,7 +87,7 @@ class TestWidgetState extends State<TestWidget> with RestorationMixin {
String
get
restorationId
=>
'widget'
;
@override
void
restoreState
(
RestorationBucket
oldBucket
,
bool
initialRestore
)
{
void
restoreState
(
RestorationBucket
?
oldBucket
,
bool
initialRestore
)
{
registerForRestoration
(
controller
,
'controller'
);
}
...
...
packages/flutter/test/material/text_field_splash_test.dart
View file @
4513e96a
...
...
@@ -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/gestures.dart'
show
kPressTimeout
;
import
'package:flutter/material.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
...
...
@@ -14,17 +12,17 @@ bool cancelCalled = false;
class
TestInkSplash
extends
InkSplash
{
TestInkSplash
({
MaterialInkController
controller
,
RenderBox
referenceBox
,
Offset
position
,
Color
color
,
required
MaterialInkController
controller
,
required
RenderBox
referenceBox
,
Offset
?
position
,
required
Color
color
,
bool
containedInkWell
=
false
,
RectCallback
rectCallback
,
BorderRadius
borderRadius
,
ShapeBorder
customBorder
,
double
radius
,
VoidCallback
onRemoved
,
TextDirection
textDirection
,
RectCallback
?
rectCallback
,
BorderRadius
?
borderRadius
,
ShapeBorder
?
customBorder
,
double
?
radius
,
VoidCallback
?
onRemoved
,
required
TextDirection
textDirection
,
})
:
super
(
controller:
controller
,
referenceBox:
referenceBox
,
...
...
@@ -57,17 +55,17 @@ class TestInkSplashFactory extends InteractiveInkFeatureFactory {
@override
InteractiveInkFeature
create
({
MaterialInkController
controller
,
RenderBox
referenceBox
,
Offset
position
,
Color
color
,
required
MaterialInkController
controller
,
required
RenderBox
referenceBox
,
Offset
?
position
,
required
Color
color
,
bool
containedInkWell
=
false
,
RectCallback
rectCallback
,
BorderRadius
borderRadius
,
ShapeBorder
customBorder
,
double
radius
,
VoidCallback
onRemoved
,
TextDirection
textDirection
,
RectCallback
?
rectCallback
,
BorderRadius
?
borderRadius
,
ShapeBorder
?
customBorder
,
double
?
radius
,
VoidCallback
?
onRemoved
,
required
TextDirection
textDirection
,
})
{
return
TestInkSplash
(
controller:
controller
,
...
...
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