@@ -25,31 +25,36 @@ void main() async {
25
25
if (kIsWeb || ! Platform .isLinux) {
26
26
return ;
27
27
}
28
- final bool isMainChannel = ! Platform .environment.containsKey ('CHANNEL' ) ||
28
+ final bool isMainChannel =
29
+ ! Platform .environment.containsKey ('CHANNEL' ) ||
29
30
Platform .environment['CHANNEL' ] == 'main' ||
30
31
Platform .environment['CHANNEL' ] == 'master' ;
31
32
// Only test against main to avoid rendering differences between flutter channels.
32
33
if (! isMainChannel) {
33
34
return ;
34
35
}
35
36
// Load font.
36
- final String effectiveFontFamily = const TextStyle (
37
- fontFamily: CupertinoIcons .iconFont,
38
- package: CupertinoIcons .iconFontPackage)
39
- .fontFamily! ;
37
+ final String effectiveFontFamily =
38
+ const TextStyle (
39
+ fontFamily: CupertinoIcons .iconFont,
40
+ package: CupertinoIcons .iconFontPackage,
41
+ ).fontFamily! ;
40
42
final FontLoader fontLoader = FontLoader (effectiveFontFamily);
41
43
final String filePath = path.canonicalize ('assets/CupertinoIcons.ttf' );
42
44
final File file = File (filePath);
43
- fontLoader
44
- .addFont (file.readAsBytes ().then ((Uint8List v) => v.buffer.asByteData ()));
45
+ fontLoader.addFont (
46
+ file.readAsBytes ().then ((Uint8List v) => v.buffer.asByteData ()),
47
+ );
45
48
await fontLoader.load ();
46
49
47
50
assert (icons.isNotEmpty);
48
51
for (int index = 0 ; index < icons.length;) {
49
52
final int groupEndCodePoint =
50
53
(icons[index].codePoint ~ / iconsPerImage + 1 ) * iconsPerImage;
51
54
final int next = icons.indexWhere (
52
- (IconData icon) => icon.codePoint >= groupEndCodePoint, index);
55
+ (IconData icon) => icon.codePoint >= groupEndCodePoint,
56
+ index,
57
+ );
53
58
final int nextIndex = next < 0 ? icons.length : next;
54
59
registerTestForIconGroup (icons.slice (index, nextIndex));
55
60
index = nextIndex;
@@ -71,15 +76,19 @@ void registerTestForIconGroup(List<IconData> iconGroup) {
71
76
72
77
testWidgets ('font golden test: $range ' , (WidgetTester tester) async {
73
78
addTearDown (tester.view.reset);
74
- const Size canvasSize =
75
- Size (iconSize * iconsPerRow, iconSize * iconsPerCol);
79
+ const Size canvasSize = Size (
80
+ iconSize * iconsPerRow,
81
+ iconSize * iconsPerCol,
82
+ );
76
83
tester.view.physicalSize = canvasSize * tester.view.devicePixelRatio;
77
84
78
85
const Widget fillerBox = SizedBox .square (dimension: iconSize);
79
86
final List <Widget > children = List <Widget >.filled (iconsPerImage, fillerBox);
80
87
for (final IconData icon in iconGroup) {
81
- children[icon.codePoint - groupStartCodePoint] =
82
- Icon (icon, size: iconSize);
88
+ children[icon.codePoint - groupStartCodePoint] = Icon (
89
+ icon,
90
+ size: iconSize,
91
+ );
83
92
}
84
93
85
94
final Widget widget = Directionality (
@@ -94,6 +103,8 @@ void registerTestForIconGroup(List<IconData> iconGroup) {
94
103
);
95
104
await tester.pumpWidget (widget);
96
105
await expectLater (
97
- find.byType (Wrap ), matchesGoldenFile ('goldens/glyph_$range .png' ));
106
+ find.byType (Wrap ),
107
+ matchesGoldenFile ('goldens/glyph_$range .png' ),
108
+ );
98
109
});
99
110
}
0 commit comments