@@ -313,6 +313,7 @@ flutter:
313313 < String , DevFSContent > {},
314314 < String , AssetKind > {},
315315 loggerOverride: testLogger,
316+ targetPlatform: TargetPlatform .android,
316317 );
317318
318319 expect (testLogger.warningText, contains ('Expected Error Text' ));
@@ -434,6 +435,7 @@ flutter:
434435 bundle.entries,
435436 bundle.entryKinds,
436437 loggerOverride: testLogger,
438+ targetPlatform: TargetPlatform .android,
437439 );
438440
439441 }, overrides: < Type , Generator > {
@@ -459,7 +461,7 @@ flutter:
459461 ]),
460462 });
461463
462- testUsingContext ('Included shaders are not compiled for the web' , () async {
464+ testUsingContext ('Included shaders are compiled for the web' , () async {
463465 fileSystem.file ('.packages' ).createSync ();
464466 fileSystem.file ('pubspec.yaml' )
465467 ..createSync ()
@@ -478,18 +480,34 @@ flutter:
478480 bundle.entries,
479481 bundle.entryKinds,
480482 loggerOverride: testLogger,
483+ targetPlatform: TargetPlatform .web_javascript,
481484 );
482485
483486 }, overrides: < Type , Generator > {
484487 Artifacts : () => artifacts,
485488 FileSystem : () => fileSystem,
486489 ProcessManager : () => FakeProcessManager .list (< FakeCommand > [
487- // No impeller commands are expected here because shader compilation is
488- // not supposed to happen for the web.
490+ FakeCommand (
491+ command: < String > [
492+ impellerc,
493+ '--sksl' ,
494+ '--iplr' ,
495+ '--json' ,
496+ '--sl=$outputPath ' ,
497+ '--spirv=$outputPath .spirv' ,
498+ '--input=/$shaderPath ' ,
499+ '--input-type=frag' ,
500+ '--include=/$assetsPath ' ,
501+ ],
502+ onRun: () {
503+ fileSystem.file (outputPath).createSync (recursive: true );
504+ fileSystem.file ('$outputPath .spirv' ).createSync (recursive: true );
505+ },
506+ ),
489507 ]),
490508 });
491509
492- testUsingContext ('Material shaders are not compiled for the web' , () async {
510+ testUsingContext ('Material shaders are compiled for the web' , () async {
493511 fileSystem.file ('.packages' ).createSync ();
494512
495513 final String materialIconsPath = fileSystem.path.join (
@@ -508,6 +526,25 @@ flutter:
508526 materialDir.childFile (shader).createSync (recursive: true );
509527 }
510528
529+ (globals.processManager as FakeProcessManager )
530+ .addCommand (FakeCommand (
531+ command: < String > [
532+ impellerc,
533+ '--sksl' ,
534+ '--iplr' ,
535+ '--json' ,
536+ '--sl=${fileSystem .path .join (output .path , 'shaders' , 'ink_sparkle.frag' )}' ,
537+ '--spirv=${fileSystem .path .join (output .path , 'shaders' , 'ink_sparkle.frag.spirv' )}' ,
538+ '--input=${fileSystem .path .join (materialDir .path , 'shaders' , 'ink_sparkle.frag' )}' ,
539+ '--input-type=frag' ,
540+ '--include=${fileSystem .path .join (materialDir .path , 'shaders' )}' ,
541+ ],
542+ onRun: () {
543+ fileSystem.file (outputPath).createSync (recursive: true );
544+ fileSystem.file ('$outputPath .spirv' ).createSync (recursive: true );
545+ },
546+ ));
547+
511548 fileSystem.file ('pubspec.yaml' )
512549 ..createSync ()
513550 ..writeAsStringSync (r'''
@@ -524,15 +561,13 @@ flutter:
524561 bundle.entries,
525562 bundle.entryKinds,
526563 loggerOverride: testLogger,
564+ targetPlatform: TargetPlatform .web_javascript,
527565 );
528566
529567 }, overrides: < Type , Generator > {
530568 Artifacts : () => artifacts,
531569 FileSystem : () => fileSystem,
532- ProcessManager : () => FakeProcessManager .list (< FakeCommand > [
533- // No impeller commands are expected here because shader compilation is
534- // not supposed to happen for the web.
535- ]),
570+ ProcessManager : () => FakeProcessManager .list (< FakeCommand > []),
536571 });
537572 });
538573
0 commit comments