manifest_impeller_test.dart 1.0 KB

123456789101112131415161718192021222324252627
  1. import 'dart:io';
  2. import 'package:flutter_test/flutter_test.dart';
  3. void main() {
  4. test('Impeller opt-out is application-scoped', () {
  5. final manifest = File('android/app/src/main/AndroidManifest.xml')
  6. .readAsStringSync();
  7. final applicationStart = manifest.indexOf('<application');
  8. final applicationEnd = manifest.indexOf('</application>');
  9. final activityStart = manifest.indexOf('<activity');
  10. final activityEnd = manifest.indexOf('</activity>');
  11. final impeller = manifest.indexOf(
  12. 'io.flutter.embedding.android.EnableImpeller',
  13. );
  14. expect(applicationStart, greaterThanOrEqualTo(0));
  15. expect(applicationEnd, greaterThan(applicationStart));
  16. expect(activityStart, greaterThan(applicationStart));
  17. expect(activityEnd, greaterThan(activityStart));
  18. expect(impeller, greaterThan(applicationStart));
  19. expect(impeller, lessThan(applicationEnd));
  20. // Flutter ignores this key under <activity>; keep it out of that block.
  21. expect(impeller < activityStart || impeller > activityEnd, isTrue);
  22. });
  23. }