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
b0381df1
Unverified
Commit
b0381df1
authored
Mar 04, 2020
by
Flutter GitHub Bot
Committed by
GitHub
Mar 04, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unlooping Golden File Tests (#51883)
parent
0b8129db
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
73 additions
and
60 deletions
+73
-60
bottom_navigation_bar_test.dart
...ges/flutter/test/material/bottom_navigation_bar_test.dart
+19
-16
text_field_test.dart
packages/flutter/test/material/text_field_test.dart
+4
-4
gradient_test.dart
packages/flutter/test/painting/gradient_test.dart
+10
-6
shadow_test.dart
packages/flutter/test/widgets/shadow_test.dart
+40
-34
No files found.
packages/flutter/test/material/bottom_navigation_bar_test.dart
View file @
b0381df1
...
@@ -1404,12 +1404,11 @@ void main() {
...
@@ -1404,12 +1404,11 @@ void main() {
expect
(
tester
.
widget
<
Material
>(
backgroundMaterial
).
color
,
Colors
.
green
);
expect
(
tester
.
widget
<
Material
>(
backgroundMaterial
).
color
,
Colors
.
green
);
});
});
testWidgets
(
'BottomNavigationBar shifting backgroundColor with transition'
,
(
WidgetTester
tester
)
async
{
group
(
'BottomNavigationBar shifting backgroundColor with transition'
,
()
{
// Regression test for: https://github.com/flutter/flutter/issues/22226
// Regression test for: https://github.com/flutter/flutter/issues/22226
Widget
runTest
()
{
int
_currentIndex
=
0
;
int
_currentIndex
=
0
;
await
tester
.
pumpWidget
(
return
MaterialApp
(
MaterialApp
(
home:
StatefulBuilder
(
home:
StatefulBuilder
(
builder:
(
BuildContext
context
,
StateSetter
setState
)
{
builder:
(
BuildContext
context
,
StateSetter
setState
)
{
return
Scaffold
(
return
Scaffold
(
...
@@ -1439,19 +1438,23 @@ void main() {
...
@@ -1439,19 +1438,23 @@ void main() {
);
);
},
},
),
),
),
);
await
tester
.
tap
(
find
.
text
(
'Green'
));
for
(
int
pump
=
0
;
pump
<
8
;
pump
++)
{
await
tester
.
pump
(
const
Duration
(
milliseconds:
30
));
await
expectLater
(
find
.
byType
(
BottomNavigationBar
),
matchesGoldenFile
(
'bottom_navigation_bar.shifting_transition.
$pump
.png'
),
);
);
}
}
},
skip:
isBrowser
);
for
(
int
pump
=
1
;
pump
<
9
;
pump
++)
{
testWidgets
(
'pump
$pump
'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
runTest
());
await
tester
.
tap
(
find
.
text
(
'Green'
));
for
(
int
i
=
0
;
i
<
pump
;
i
++)
{
await
tester
.
pump
(
const
Duration
(
milliseconds:
30
));
}
await
expectLater
(
find
.
byType
(
BottomNavigationBar
),
matchesGoldenFile
(
'bottom_navigation_bar.shifting_transition.
${pump - 1}
.png'
),
);
},
skip:
isBrowser
);
// TODO(yjbanov): web does not support golden tests yet: https://github.com/flutter/flutter/issues/40297
}
});
testWidgets
(
'BottomNavigationBar item title should not be nullable'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'BottomNavigationBar item title should not be nullable'
,
(
WidgetTester
tester
)
async
{
expect
(()
{
expect
(()
{
...
...
packages/flutter/test/material/text_field_test.dart
View file @
b0381df1
...
@@ -681,10 +681,10 @@ void main() {
...
@@ -681,10 +681,10 @@ void main() {
await
expectLater
(
await
expectLater
(
find
.
byType
(
TextField
),
find
.
byType
(
TextField
),
matchesGoldenFile
(
'text_field_cursor_width_test.0.
0.png'
,
version:
0
),
matchesGoldenFile
(
'text_field_cursor_width_test.0.
png'
),
);
);
EditableText
.
debugDeterministicCursor
=
false
;
EditableText
.
debugDeterministicCursor
=
false
;
}
,
skip:
!
isLinux
);
});
testWidgets
(
'cursor layout has correct radius'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'cursor layout has correct radius'
,
(
WidgetTester
tester
)
async
{
EditableText
.
debugDeterministicCursor
=
true
;
EditableText
.
debugDeterministicCursor
=
true
;
...
@@ -703,10 +703,10 @@ void main() {
...
@@ -703,10 +703,10 @@ void main() {
await
expectLater
(
await
expectLater
(
find
.
byType
(
TextField
),
find
.
byType
(
TextField
),
matchesGoldenFile
(
'text_field_cursor_width_test.1.
0.png'
,
version:
0
),
matchesGoldenFile
(
'text_field_cursor_width_test.1.
png'
),
);
);
EditableText
.
debugDeterministicCursor
=
false
;
EditableText
.
debugDeterministicCursor
=
false
;
}
,
skip:
!
isLinux
);
});
testWidgets
(
'Overflowing a line with spaces stops the cursor at the end'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Overflowing a line with spaces stops the cursor at the end'
,
(
WidgetTester
tester
)
async
{
final
TextEditingController
controller
=
TextEditingController
();
final
TextEditingController
controller
=
TextEditingController
();
...
...
packages/flutter/test/painting/gradient_test.dart
View file @
b0381df1
...
@@ -813,17 +813,21 @@ void main() {
...
@@ -813,17 +813,21 @@ void main() {
);
);
}
}
testWidgets
(
'Gradients - 45 degrees'
,
(
WidgetTester
tester
)
async
{
group
(
'Gradients - 45 degrees'
,
()
{
for
(
final
Gradient
gradient
in
gradients45
)
{
for
(
final
Gradient
gradient
in
gradients45
)
{
await
runTest
(
tester
,
gradient
,
45
);
testWidgets
(
'
$gradient
'
,
(
WidgetTester
tester
)
async
{
await
runTest
(
tester
,
gradient
,
45
);
},
skip:
isBrowser
);
// TODO(yjbanov): web does not support golden tests yet: https://github.com/flutter/flutter/issues/40297
}
}
}
,
skip:
isBrowser
);
// TODO(yjbanov): web does not support golden tests yet: https://github.com/flutter/flutter/issues/40297
}
);
testWidgets
(
'Gradients - 90 degrees'
,
(
WidgetTester
tester
)
async
{
group
(
'Gradients - 90 degrees'
,
()
{
for
(
final
Gradient
gradient
in
gradients90
)
{
for
(
final
Gradient
gradient
in
gradients90
)
{
await
runTest
(
tester
,
gradient
,
90
);
testWidgets
(
'
$gradient
'
,
(
WidgetTester
tester
)
async
{
await
runTest
(
tester
,
gradient
,
90
);
},
skip:
isBrowser
);
// TODO(yjbanov): web does not support golden tests yet: https://github.com/flutter/flutter/issues/40297
}
}
}
,
skip:
isBrowser
);
// TODO(yjbanov): web does not support golden tests yet: https://github.com/flutter/flutter/issues/40297
}
);
});
});
}
}
...
...
packages/flutter/test/widgets/shadow_test.dart
View file @
b0381df1
...
@@ -39,8 +39,7 @@ void main() {
...
@@ -39,8 +39,7 @@ void main() {
debugDisableShadows
=
true
;
debugDisableShadows
=
true
;
});
});
testWidgets
(
'Shadows on ShapeDecoration'
,
(
WidgetTester
tester
)
async
{
group
(
'Shadows on ShapeDecoration'
,
()
{
debugDisableShadows
=
false
;
Widget
build
(
int
elevation
)
{
Widget
build
(
int
elevation
)
{
return
Center
(
return
Center
(
child:
RepaintBoundary
(
child:
RepaintBoundary
(
...
@@ -57,13 +56,16 @@ void main() {
...
@@ -57,13 +56,16 @@ void main() {
);
);
}
}
for
(
final
int
elevation
in
kElevationToShadow
.
keys
)
{
for
(
final
int
elevation
in
kElevationToShadow
.
keys
)
{
await
tester
.
pumpWidget
(
build
(
elevation
));
testWidgets
(
'elevation
$elevation
'
,
(
WidgetTester
tester
)
async
{
await
expectLater
(
debugDisableShadows
=
false
;
find
.
byType
(
Container
),
await
tester
.
pumpWidget
(
build
(
elevation
));
matchesGoldenFile
(
'shadow.ShapeDecoration.
$elevation
.png'
),
await
expectLater
(
);
find
.
byType
(
Container
),
matchesGoldenFile
(
'shadow.ShapeDecoration.
$elevation
.png'
),
);
debugDisableShadows
=
true
;
});
}
}
debugDisableShadows
=
true
;
});
});
testWidgets
(
'Shadows with PhysicalLayer'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Shadows with PhysicalLayer'
,
(
WidgetTester
tester
)
async
{
...
@@ -99,34 +101,38 @@ void main() {
...
@@ -99,34 +101,38 @@ void main() {
debugDisableShadows
=
true
;
debugDisableShadows
=
true
;
});
});
for
(
final
int
elevation
in
kElevationToShadow
.
keys
)
{
group
(
'Shadows with PhysicalShape'
,
()
{
testWidgets
(
'Shadows with PhysicalShape
$elevation
'
,
(
WidgetTester
tester
)
async
{
Widget
build
(
double
elevation
)
{
debugDisableShadows
=
false
;
return
Center
(
Widget
build
(
double
elevation
)
{
child:
RepaintBoundary
(
return
Center
(
child:
Container
(
child:
RepaintBoundary
(
padding:
const
EdgeInsets
.
all
(
150.0
),
child:
Container
(
color:
Colors
.
yellow
[
200
],
padding:
const
EdgeInsets
.
all
(
150.0
),
child:
PhysicalShape
(
color:
Colors
.
yellow
[
200
],
color:
Colors
.
green
[
900
],
child:
PhysicalShape
(
clipper:
ShapeBorderClipper
(
shape:
BeveledRectangleBorder
(
color:
Colors
.
green
[
900
],
borderRadius:
BorderRadius
.
circular
(
20.0
))),
clipper:
ShapeBorderClipper
(
shape:
BeveledRectangleBorder
(
borderRadius:
BorderRadius
.
circular
(
20.0
))),
elevation:
elevation
,
elevation:
elevation
,
child:
const
SizedBox
(
child:
const
SizedBox
(
height:
100.0
,
height:
100.0
,
width:
100.0
,
width:
100.0
,
),
),
),
),
),
),
),
);
),
}
await
tester
.
pumpWidget
(
build
(
elevation
.
toDouble
()));
await
expectLater
(
find
.
byType
(
Container
),
matchesGoldenFile
(
'shadow.PhysicalShape.
$elevation
.png'
),
);
);
debugDisableShadows
=
true
;
}
});
}
for
(
final
int
elevation
in
kElevationToShadow
.
keys
)
{
testWidgets
(
'elevation
$elevation
'
,
(
WidgetTester
tester
)
async
{
debugDisableShadows
=
false
;
await
tester
.
pumpWidget
(
build
(
elevation
.
toDouble
()));
await
expectLater
(
find
.
byType
(
Container
),
matchesGoldenFile
(
'shadow.PhysicalShape.
$elevation
.png'
),
);
debugDisableShadows
=
true
;
});
}
});
}
}
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