Skip to content

Commit 9ac6d73

Browse files
authored
Add text rendering test to engine_integration_golden_test (flutter#190678)
Add text rendering test to engine_integration_golden_test Part of flutter#190301 Manual run on Windows: <img width="1264" height="681" alt="image" src="https://github.com/user-attachments/assets/7e1a55aa-ac80-44f2-9613-f95733695d25" /> Compare with a manual run that includes a revert of flutter#190477: <img width="1264" height="681" alt="image" src="https://github.com/user-attachments/assets/ac587e4b-3573-419b-b124-4e8341376608" /> ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [ ] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [AI contribution guidelines]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
1 parent 5b5f63a commit 9ac6d73

4 files changed

Lines changed: 105 additions & 3 deletions

File tree

‎dev/integration_tests/engine_integration_golden_test/README.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ This integration test suite validates engine related rendering tests using Skia
44

55
## Running Locally
66
```sh
7-
flutter test dev/integration_tests/engine_integration_golden_test/integration_test/engine_integration_golden_test.dart -d <device_id>
7+
cd dev/integration_tests/engine_integration_golden_test
8+
flutter test integration_test/engine_integration_golden_test.dart -d <device_id>
89
```
910

1011
## Running via Devicelab on Windows

‎dev/integration_tests/engine_integration_golden_test/integration_test/engine_integration_golden_test.dart‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
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:engine_integration_golden_test/primitive_shape_main.dart' as primitive_shape;
5+
import 'package:engine_integration_golden_test/primitive_shape_main.dart'
6+
as primitive_shape;
7+
import 'package:engine_integration_golden_test/text_main.dart' as text_main;
68
import 'package:flutter/material.dart';
79
import 'package:flutter_test/flutter_test.dart';
10+
import 'package:google_fonts/google_fonts.dart';
811
import 'package:integration_test/integration_test.dart';
912

1013
void main() {
@@ -19,4 +22,15 @@ void main() {
1922
matchesGoldenFile('primitive_shape_canvas_snapshot.png'),
2023
);
2124
});
25+
26+
testWidgets('renders text', (WidgetTester tester) async {
27+
await tester.pumpWidget(const text_main.TextRenderingApp());
28+
await GoogleFonts.pendingFonts();
29+
await tester.pumpAndSettle();
30+
31+
await expectLater(
32+
find.byKey(const Key('text_rendering_canvas')),
33+
matchesGoldenFile('text_rendering_canvas_snapshot.png'),
34+
);
35+
});
2236
}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
// Copyright 2014 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
import 'package:flutter/material.dart';
6+
import 'package:google_fonts/google_fonts.dart';
7+
8+
void main() {
9+
runApp(const TextRenderingApp());
10+
}
11+
12+
/// A test application that renders text with various font weights and colors
13+
/// to validate text rendering in integration tests.
14+
class TextRenderingApp extends StatelessWidget {
15+
/// Creates a [TextRenderingApp].
16+
const TextRenderingApp({super.key});
17+
18+
static const String _testText =
19+
'the quick brown fox jumped over the lazy dog!.?';
20+
21+
Widget _buildTextSection({
22+
required Color textColor,
23+
required Color backgroundColor,
24+
}) {
25+
return Expanded(
26+
child: Container(
27+
color: backgroundColor,
28+
padding: const EdgeInsets.all(12.0),
29+
child: Column(
30+
crossAxisAlignment: CrossAxisAlignment.start,
31+
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
32+
children: <Widget>[
33+
for (final FontWeight weight in <FontWeight>[
34+
FontWeight.w100,
35+
FontWeight.normal,
36+
FontWeight.bold,
37+
])
38+
Text(
39+
_testText,
40+
style: GoogleFonts.roboto(
41+
color: textColor,
42+
fontSize: 20.0,
43+
fontWeight: weight,
44+
),
45+
),
46+
],
47+
),
48+
),
49+
);
50+
}
51+
52+
@override
53+
Widget build(BuildContext context) {
54+
return MaterialApp(
55+
debugShowCheckedModeBanner: false,
56+
home: Scaffold(
57+
body: Container(
58+
key: const Key('text_rendering_canvas'),
59+
color: Colors.grey[850],
60+
width: double.infinity,
61+
height: double.infinity,
62+
padding: const EdgeInsets.all(16.0),
63+
child: Column(
64+
crossAxisAlignment: CrossAxisAlignment.stretch,
65+
children: <Widget>[
66+
_buildTextSection(
67+
textColor: Colors.white,
68+
backgroundColor: Colors.black,
69+
),
70+
const SizedBox(height: 16.0),
71+
_buildTextSection(
72+
textColor: Colors.black,
73+
backgroundColor: Colors.white,
74+
),
75+
const SizedBox(height: 16.0),
76+
_buildTextSection(
77+
textColor: Colors.green,
78+
backgroundColor: Colors.black,
79+
),
80+
],
81+
),
82+
),
83+
),
84+
);
85+
}
86+
}

‎dev/integration_tests/engine_integration_golden_test/pubspec.yaml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ dependencies:
1212
sdk: flutter
1313
flutter_driver:
1414
sdk: flutter
15+
google_fonts: any
1516
integration_test:
1617
sdk: flutter
1718
path: any
@@ -23,4 +24,4 @@ dev_dependencies:
2324
sdk: flutter
2425
test: any
2526

26-
# PUBSPEC CHECKSUM: fp4cre
27+
# PUBSPEC CHECKSUM: 3hii4d

0 commit comments

Comments
 (0)