Clean up golden files (#19440)

Makes them all be generated on Linux and fixes some to not be so large.
This commit is contained in:
Ian Hickson
2018-07-18 12:01:56 -07:00
committed by GitHub
parent 7a9dd709c6
commit 089f59d2c5
3 changed files with 26 additions and 47 deletions

View File

@@ -1 +1 @@
35f172d7c241a8112db53dd9ee3c29a13cf19eb8
4948d5d7c0e07d092bd38511e5e159007425ec48

View File

@@ -1165,13 +1165,6 @@ void main() {
});
testWidgets('Golden Test Placeholder Widget', (WidgetTester tester) async {
// Different machines render this content differently. Since the golden
// files are rendered on MacOS, this test should only be run on MacOS.
// If the golden files are regenerated on another OS, please change this
// test to only run on that OS.
if (Platform.isMacOS)
return;
final Map<int, Widget> children = <int, Widget>{};
children[0] = new Container();
children[1] = const Placeholder();
@@ -1200,16 +1193,9 @@ void main() {
find.byType(RepaintBoundary),
matchesGoldenFile('segmented_control_test.0.0.png'),
);
});
}, skip: !Platform.isLinux);
testWidgets('Golden Test Pressed State', (WidgetTester tester) async {
// Different machines render this content differently. Since the golden
// files are rendered on MacOS, this test should only be run on MacOS.
// If the golden files are regenerated on another OS, please change this
// test to only run on that OS.
if (!Platform.isMacOS)
return;
final Map<int, Widget> children = <int, Widget>{};
children[0] = const Text('A');
children[1] = const Text('B');
@@ -1242,5 +1228,5 @@ void main() {
find.byType(RepaintBoundary),
matchesGoldenFile('segmented_control_test.1.0.png'),
);
});
}, skip: !Platform.isLinux);
}

View File

@@ -11,8 +11,8 @@ import 'package:flutter/widgets.dart';
void main() {
testWidgets('Centered text', (WidgetTester tester) async {
await tester.pumpWidget(
new RepaintBoundary(
child: new Center(
new Center(
child: new RepaintBoundary(
child: new Container(
width: 200.0,
height: 100.0,
@@ -32,12 +32,11 @@ void main() {
await expectLater(
find.byType(Container),
matchesGoldenFile('text_golden.Centered.png'),
skip: !Platform.isLinux,
);
await tester.pumpWidget(
new RepaintBoundary(
child: new Center(
new Center(
child: new RepaintBoundary(
child: new Container(
width: 200.0,
height: 100.0,
@@ -57,20 +56,22 @@ void main() {
await expectLater(
find.byType(Container),
matchesGoldenFile('text_golden.Centered.wrap.png'),
skip: !Platform.isLinux,
);
});
}, skip: !Platform.isLinux);
testWidgets('Text Foreground', (WidgetTester tester) async {
const Color black = const Color(0xFF000000);
const Color red = const Color(0xFFFF0000);
const Color blue = const Color(0xFF0000FF);
final Shader linearGradient = const LinearGradient(colors: <Color>[red, blue]).createShader(new Rect.fromLTWH(0.0, 0.0, 50.0, 20.0));
final Shader linearGradient = const LinearGradient(
colors: const <Color>[red, blue],
).createShader(new Rect.fromLTWH(0.0, 0.0, 50.0, 20.0));
await tester.pumpWidget(
new RepaintBoundary(
child: new Center(
new Align(
alignment: Alignment.topLeft,
child: new RepaintBoundary(
child: new Text('Hello',
textDirection: TextDirection.ltr,
style: new TextStyle(
@@ -86,16 +87,14 @@ void main() {
await expectLater(
find.byType(RepaintBoundary),
matchesGoldenFile('text_golden.Foreground.gradient.png'),
// this was generated on MacOS and will fail on Linux
// change to !Platform.isLinux once they're properly generated
skip: true, // !Platform.isLinux,
);
await tester.pumpWidget(
new RepaintBoundary(
child: new Center(
child: new Text('Hello',
textDirection: TextDirection.ltr,
new Align(
alignment: Alignment.topLeft,
child: new RepaintBoundary(
child: new Text('Hello',
textDirection: TextDirection.ltr,
style: new TextStyle(
foreground: new Paint()
..color = black
@@ -110,16 +109,14 @@ void main() {
await expectLater(
find.byType(RepaintBoundary),
matchesGoldenFile('text_golden.Foreground.stroke.png'),
// this was generated on MacOS and will fail on Linux
// change to !Platform.isLinux once they're properly generated
skip: true, // !Platform.isLinux,
);
await tester.pumpWidget(
new RepaintBoundary(
child: new Center(
child: new Text('Hello',
textDirection: TextDirection.ltr,
new Align(
alignment: Alignment.topLeft,
child: new RepaintBoundary(
child: new Text('Hello',
textDirection: TextDirection.ltr,
style: new TextStyle(
foreground: new Paint()
..color = black
@@ -135,11 +132,8 @@ void main() {
await expectLater(
find.byType(RepaintBoundary),
matchesGoldenFile('text_golden.Foreground.stroke_and_gradient.png'),
// this was generated on MacOS and will fail on Linux
// change to !Platform.isLinux once they're properly generated
skip: true, // !Platform.isLinux,
);
});
}, skip: !Platform.isLinux);
testWidgets('Text Fade', (WidgetTester tester) async {
await tester.pumpWidget(
@@ -174,7 +168,6 @@ void main() {
await expectLater(
find.byType(RepaintBoundary).first,
matchesGoldenFile('text_golden.Fade.1.png'),
skip: !Platform.isLinux,
);
});
}, skip: !Platform.isLinux);
}