Always add a DevFS asset entry for the font manifest (#16650)
The engine expects it to always be there.
This commit is contained in:
@@ -204,9 +204,7 @@ class _ManifestAssetBundle implements AssetBundle {
|
||||
|
||||
entries[_kAssetManifestJson] = _createAssetManifest(assetVariants);
|
||||
|
||||
|
||||
if (fonts.isNotEmpty)
|
||||
entries[_kFontManifestJson] = new DevFSStringContent(json.encode(fonts));
|
||||
entries[_kFontManifestJson] = new DevFSStringContent(json.encode(fonts));
|
||||
|
||||
// TODO(ianh): Only do the following line if we've changed packages or if our LICENSE file changed
|
||||
entries[_kLICENSE] = await _obtainLicenses(packageMap, assetBasePath, reportPackages: reportLicensedPackages);
|
||||
|
||||
@@ -123,8 +123,8 @@ $fontsSection
|
||||
|
||||
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
||||
await bundle.build(manifestPath: 'pubspec.yaml');
|
||||
expect(bundle.entries.length, 2); // LICENSE, AssetManifest
|
||||
expect(bundle.entries.containsKey('FontManifest.json'), false);
|
||||
expect(bundle.entries.length, 3); // LICENSE, AssetManifest, FontManifest
|
||||
expect(bundle.entries.containsKey('FontManifest.json'), isTrue);
|
||||
});
|
||||
|
||||
testUsingContext('App font uses font file from package', () async {
|
||||
|
||||
@@ -124,12 +124,16 @@ $assetsSection
|
||||
|
||||
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
||||
await bundle.build(manifestPath: 'pubspec.yaml');
|
||||
expect(bundle.entries.length, 2); // LICENSE, AssetManifest
|
||||
expect(bundle.entries.length, 3); // LICENSE, AssetManifest, FontManifest
|
||||
const String expectedAssetManifest = '{}';
|
||||
expect(
|
||||
utf8.decode(await bundle.entries['AssetManifest.json'].contentsAsBytes()),
|
||||
expectedAssetManifest,
|
||||
);
|
||||
expect(
|
||||
utf8.decode(await bundle.entries['FontManifest.json'].contentsAsBytes()),
|
||||
'[]',
|
||||
);
|
||||
});
|
||||
|
||||
testUsingContext('No assets are bundled when the package has an asset that is not listed', () async {
|
||||
@@ -144,13 +148,16 @@ $assetsSection
|
||||
|
||||
final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
|
||||
await bundle.build(manifestPath: 'pubspec.yaml');
|
||||
expect(bundle.entries.length, 2); // LICENSE, AssetManifest
|
||||
expect(bundle.entries.length, 3); // LICENSE, AssetManifest, FontManifest
|
||||
const String expectedAssetManifest = '{}';
|
||||
expect(
|
||||
utf8.decode(await bundle.entries['AssetManifest.json'].contentsAsBytes()),
|
||||
expectedAssetManifest,
|
||||
);
|
||||
|
||||
expect(
|
||||
utf8.decode(await bundle.entries['FontManifest.json'].contentsAsBytes()),
|
||||
'[]',
|
||||
);
|
||||
});
|
||||
|
||||
testUsingContext('One asset is bundled when the package has and lists one asset its pubspec', () async {
|
||||
|
||||
Reference in New Issue
Block a user