Skip to content

Commit cf5c5d9

Browse files
committed
Guard prepared Inter assets in the mobile test suite
Signed-off-by: Tom Brow <[email protected]>
1 parent dd1460b commit cf5c5d9

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

‎mobile/assets/fonts/README.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,8 @@ python3 mobile/test/visual/verify_heart_screenshots.py before.png after.png
4545

4646
Use original 1206×2622 captures from the documented simulator and fixture for
4747
this check. PR images may be cropped afterward for readability.
48+
49+
`test/shared/fonts/inter_assets_test.dart` pins the verified generated font
50+
artifacts in the existing Flutter test lane. Restoring either original font or
51+
changing any other font data fails CI. When upgrading Inter, verify the
52+
transformation and native rendering before updating the expected digests.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import 'dart:io';
2+
3+
import 'package:crypto/crypto.dart';
4+
import 'package:flutter_test/flutter_test.dart';
5+
6+
void main() {
7+
// These are the reproducible outputs of scripts/prepare-inter.py. Pin the
8+
// complete artifacts so CI rejects restored heart/warning mappings and any
9+
// unintended changes to other glyphs, metrics, or language coverage.
10+
// On a font update, first verify the transformation as documented in
11+
// assets/fonts/README.md, then update these expected digests.
12+
const expected = {
13+
'InterVariable.ttf':
14+
'c6540e8bbb50fac6ccdb0f0c01301bf195c95985c21fe9767cffe6963cc23afd',
15+
'InterVariable-Italic.ttf':
16+
'74a6ff09b186744377e1ff68772e50754f5113079e1bd1abf2e4ab1942c1d9b6',
17+
};
18+
19+
for (final entry in expected.entries) {
20+
test('${entry.key} retains verified native emoji fallback coverage', () {
21+
final bytes = File('assets/fonts/${entry.key}').readAsBytesSync();
22+
expect(
23+
sha256.convert(bytes).toString(),
24+
entry.value,
25+
reason:
26+
'Bundled Inter must match the verified heart/warning fallback '
27+
'artifact. See assets/fonts/README.md before updating this digest.',
28+
);
29+
});
30+
}
31+
}

0 commit comments

Comments
 (0)