Unverified Commit c83d24d5 authored by Todd Volkert's avatar Todd Volkert Committed by GitHub

Always add a DevFS asset entry for the font manifest (#16650)

The engine expects it to always be there.
parent 9e0a6107
...@@ -204,8 +204,6 @@ class _ManifestAssetBundle implements AssetBundle { ...@@ -204,8 +204,6 @@ class _ManifestAssetBundle implements AssetBundle {
entries[_kAssetManifestJson] = _createAssetManifest(assetVariants); 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 // TODO(ianh): Only do the following line if we've changed packages or if our LICENSE file changed
......
...@@ -123,8 +123,8 @@ $fontsSection ...@@ -123,8 +123,8 @@ $fontsSection
final AssetBundle bundle = AssetBundleFactory.instance.createBundle(); final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
await bundle.build(manifestPath: 'pubspec.yaml'); await bundle.build(manifestPath: 'pubspec.yaml');
expect(bundle.entries.length, 2); // LICENSE, AssetManifest expect(bundle.entries.length, 3); // LICENSE, AssetManifest, FontManifest
expect(bundle.entries.containsKey('FontManifest.json'), false); expect(bundle.entries.containsKey('FontManifest.json'), isTrue);
}); });
testUsingContext('App font uses font file from package', () async { testUsingContext('App font uses font file from package', () async {
......
...@@ -124,12 +124,16 @@ $assetsSection ...@@ -124,12 +124,16 @@ $assetsSection
final AssetBundle bundle = AssetBundleFactory.instance.createBundle(); final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
await bundle.build(manifestPath: 'pubspec.yaml'); await bundle.build(manifestPath: 'pubspec.yaml');
expect(bundle.entries.length, 2); // LICENSE, AssetManifest expect(bundle.entries.length, 3); // LICENSE, AssetManifest, FontManifest
const String expectedAssetManifest = '{}'; const String expectedAssetManifest = '{}';
expect( expect(
utf8.decode(await bundle.entries['AssetManifest.json'].contentsAsBytes()), utf8.decode(await bundle.entries['AssetManifest.json'].contentsAsBytes()),
expectedAssetManifest, 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 { testUsingContext('No assets are bundled when the package has an asset that is not listed', () async {
...@@ -144,13 +148,16 @@ $assetsSection ...@@ -144,13 +148,16 @@ $assetsSection
final AssetBundle bundle = AssetBundleFactory.instance.createBundle(); final AssetBundle bundle = AssetBundleFactory.instance.createBundle();
await bundle.build(manifestPath: 'pubspec.yaml'); await bundle.build(manifestPath: 'pubspec.yaml');
expect(bundle.entries.length, 2); // LICENSE, AssetManifest expect(bundle.entries.length, 3); // LICENSE, AssetManifest, FontManifest
const String expectedAssetManifest = '{}'; const String expectedAssetManifest = '{}';
expect( expect(
utf8.decode(await bundle.entries['AssetManifest.json'].contentsAsBytes()), utf8.decode(await bundle.entries['AssetManifest.json'].contentsAsBytes()),
expectedAssetManifest, 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 { testUsingContext('One asset is bundled when the package has and lists one asset its pubspec', () async {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment