Skip to content

Commit 7df7401

Browse files
authored
Revert "Use bundled Roboto in all tests (flutter#16218)"
This reverts commit 01a7086.
1 parent 661dbd3 commit 7df7401

File tree

8 files changed

+21
-37
lines changed

8 files changed

+21
-37
lines changed

lib/web_ui/dev/goldens_lock.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
repository: https://github.com/flutter/goldens.git
2-
revision: 43254f4abddc2542ece540f222545970caf12908
2+
revision: 3db2bb2329e7277c34389a92507eacaab774c8e8

lib/web_ui/lib/src/engine/dom_renderer.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ flt-glass-pane * {
343343
setElementStyle(bodyElement, 'touch-action', 'none');
344344

345345
// These are intentionally outrageous font parameters to make sure that the
346-
// apps fully specify their text styles.
346+
// apps fully specifies their text styles.
347347
setElementStyle(bodyElement, 'font', defaultCssFont);
348348
setElementStyle(bodyElement, 'color', 'red');
349349

lib/web_ui/test/golden_tests/engine/canvas_draw_image_golden_test.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ import 'package:test/test.dart';
1212

1313
import 'package:web_engine_tester/golden_tester.dart';
1414

15-
import 'scuba.dart';
16-
1715
void main() async {
1816
const double screenWidth = 600.0;
1917
const double screenHeight = 800.0;
@@ -41,10 +39,11 @@ void main() async {
4139

4240
setUp(() async {
4341
debugEmulateFlutterTesterEnvironment = true;
42+
await webOnlyInitializePlatform();
43+
webOnlyFontCollection.debugRegisterTestFonts();
44+
await webOnlyFontCollection.ensureFontsLoaded();
4445
});
4546

46-
setUpStableTestFonts();
47-
4847
test('Paints image', () async {
4948
final RecordingCanvas rc =
5049
RecordingCanvas(const Rect.fromLTRB(0, 0, 400, 300));

lib/web_ui/test/golden_tests/engine/canvas_golden_test.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import 'package:test/test.dart';
1010

1111
import 'package:web_engine_tester/golden_tester.dart';
1212

13-
import 'scuba.dart';
14-
1513
void main() async {
1614
final Rect region = Rect.fromLTWH(0, 0, 500, 100);
1715

@@ -24,7 +22,11 @@ void main() async {
2422
html.document.querySelector('flt-scene-host').append(testScene);
2523
}
2624

27-
setUpStableTestFonts();
25+
setUp(() async {
26+
await webOnlyInitializePlatform();
27+
webOnlyFontCollection.debugRegisterTestFonts();
28+
await webOnlyFontCollection.ensureFontsLoaded();
29+
});
2830

2931
tearDown(() {
3032
html.document.querySelector('flt-scene').remove();

lib/web_ui/test/golden_tests/engine/multiline_text_clipping_golden_test.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ void main() async {
1717
viewportSize: const Size(600, 600),
1818
);
1919

20-
setUpStableTestFonts();
21-
2220
void paintTest(EngineCanvas canvas, PaintTest painter) {
2321
final RecordingCanvas recordingCanvas =
2422
RecordingCanvas(const Rect.fromLTWH(0, 0, 600, 600));
@@ -118,7 +116,7 @@ void drawQuickBrownFox(RecordingCanvas canvas) {
118116
textStyle: TextStyle(
119117
color: const Color(0xFF000000),
120118
decoration: TextDecoration.none,
121-
fontFamily: 'Roboto',
119+
fontFamily: 'Arial',
122120
fontSize: 30,
123121
background: Paint()..color = const Color.fromRGBO(50, 255, 50, 1.0),
124122
),

lib/web_ui/test/golden_tests/engine/scuba.dart

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ void testEachCanvas(String description, CanvasTest body,
132132

133133
final ui.TextStyle _defaultTextStyle = ui.TextStyle(
134134
color: const ui.Color(0xFF000000),
135-
fontFamily: 'Roboto',
135+
fontFamily: 'Arial',
136136
fontSize: 14,
137137
);
138138

@@ -149,13 +149,3 @@ ui.Paragraph paragraph(
149149
builder.pop();
150150
return builder.build()..layout(ui.ParagraphConstraints(width: maxWidth));
151151
}
152-
153-
/// Configures the test to use bundled Roboto and Ahem fonts to avoid golden
154-
/// screenshot differences due to differences in the preinstalled system fonts.
155-
void setUpStableTestFonts() {
156-
setUp(() async {
157-
await ui.webOnlyInitializePlatform();
158-
ui.webOnlyFontCollection.debugRegisterTestFonts();
159-
await ui.webOnlyFontCollection.ensureFontsLoaded();
160-
});
161-
}

lib/web_ui/test/golden_tests/engine/text_overflow_golden_test.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,10 @@ void main() async {
2727

2828
final TextStyle warningStyle = TextStyle(
2929
color: const Color(0xFFFF0000),
30-
fontFamily: 'Roboto',
30+
fontFamily: 'Arial',
3131
fontSize: 10,
3232
);
3333

34-
setUpStableTestFonts();
35-
3634
Paragraph warning(String text) {
3735
return paragraph(text, textStyle: warningStyle);
3836
}

lib/web_ui/test/golden_tests/engine/text_style_golden_test.dart

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
import 'package:test/test.dart';
65
import 'package:ui/ui.dart';
76
import 'package:ui/src/engine.dart';
87

@@ -13,8 +12,6 @@ void main() async {
1312
viewportSize: const Size(800, 800),
1413
);
1514

16-
setUpStableTestFonts();
17-
1815
void drawLetterAndWordSpacing(EngineCanvas canvas) {
1916
Offset offset = Offset.zero;
2017

@@ -24,7 +21,7 @@ void main() async {
2421
textStyle: TextStyle(
2522
color: const Color(0xFF000000),
2623
decoration: TextDecoration.none,
27-
fontFamily: 'Roboto',
24+
fontFamily: 'Arial',
2825
fontSize: 30,
2926
letterSpacing: spacing)),
3027
offset,
@@ -35,7 +32,7 @@ void main() async {
3532
final TextStyle textStyle = TextStyle(
3633
color: const Color(0xFF00FF00),
3734
decoration: TextDecoration.none,
38-
fontFamily: 'Roboto',
35+
fontFamily: 'Arial',
3936
fontSize: 30,
4037
wordSpacing: spacing);
4138
canvas.drawParagraph(
@@ -69,7 +66,7 @@ void main() async {
6966
decoration: TextDecoration.underline,
7067
decorationStyle: decorationStyle,
7168
decorationColor: const Color.fromRGBO(50, 50, 50, 1.0),
72-
fontFamily: 'Roboto',
69+
fontFamily: 'Arial',
7370
fontSize: 30,
7471
);
7572
canvas.drawParagraph(
@@ -108,7 +105,7 @@ void main() async {
108105
decoration: decoration,
109106
decorationStyle: TextDecorationStyle.solid,
110107
decorationColor: const Color.fromRGBO(255, 160, 0, 1.0),
111-
fontFamily: 'Roboto',
108+
fontFamily: 'Arial',
112109
fontSize: 20,
113110
);
114111
canvas.drawParagraph(
@@ -138,7 +135,7 @@ void main() async {
138135
textStyle: TextStyle(
139136
color: const Color.fromRGBO(0, 0, 0, 1.0),
140137
background: Paint()..color = const Color.fromRGBO(255, 50, 50, 1.0),
141-
fontFamily: 'Roboto',
138+
fontFamily: 'Arial',
142139
fontSize: 30,
143140
),
144141
),
@@ -153,7 +150,7 @@ void main() async {
153150
textStyle: TextStyle(
154151
color: const Color.fromRGBO(0, 0, 0, 1.0),
155152
background: Paint()..color = const Color.fromRGBO(50, 50, 255, 1.0),
156-
fontFamily: 'Roboto',
153+
fontFamily: 'Arial',
157154
fontSize: 30,
158155
),
159156
),
@@ -170,7 +167,7 @@ void main() async {
170167
textStyle: TextStyle(
171168
color: const Color.fromRGBO(0, 0, 0, 1.0),
172169
background: Paint()..color = const Color.fromRGBO(255, 50, 50, 1.0),
173-
fontFamily: 'Roboto',
170+
fontFamily: 'Arial',
174171
fontSize: 30,
175172
shadows: <Shadow>[
176173
Shadow(
@@ -192,7 +189,7 @@ void main() async {
192189
textStyle: TextStyle(
193190
color: const Color.fromRGBO(0, 0, 0, 1.0),
194191
background: Paint()..color = const Color.fromRGBO(50, 50, 255, 1.0),
195-
fontFamily: 'Roboto',
192+
fontFamily: 'Arial',
196193
fontSize: 30,
197194
shadows: <Shadow>[
198195
Shadow(

0 commit comments

Comments
 (0)