[url_launcher] Add ignores for deprecated member to test (#4220)

We are going to deprecate `RendererBinding.renderView` for multi-view where the binding will manages multiple RenderViews. Change for that is staged in https://github.com/flutter/flutter/pull/125003.
This commit is contained in:
Michael Goderbauer
2023-06-15 19:13:03 -07:00
committed by GitHub
parent 6a51bef718
commit f185bffa21

View File

@ -7,6 +7,7 @@
import 'dart:ui' show Brightness;
import 'package:flutter/foundation.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart' show PlatformException;
import 'package:flutter_test/flutter_test.dart';
import 'package:url_launcher/src/legacy_api.dart';
@ -241,15 +242,18 @@ void main() {
_anonymize(TestWidgetsFlutterBinding.ensureInitialized())!
as TestWidgetsFlutterBinding;
debugDefaultTargetPlatformOverride = TargetPlatform.iOS;
binding.renderView.automaticSystemUiAdjustment = true;
// TODO(goderbauer): Migrate to binding.renderViews when that is available in the oldest supported stable.
final RenderView renderView =
binding.renderView; // ignore: deprecated_member_use
renderView.automaticSystemUiAdjustment = true;
final Future<bool> launchResult =
launch('http://flutter.dev/', statusBarBrightness: Brightness.dark);
// Should take over control of the automaticSystemUiAdjustment while it's
// pending, then restore it back to normal after the launch finishes.
expect(binding.renderView.automaticSystemUiAdjustment, isFalse);
expect(renderView.automaticSystemUiAdjustment, isFalse);
await launchResult;
expect(binding.renderView.automaticSystemUiAdjustment, isTrue);
expect(renderView.automaticSystemUiAdjustment, isTrue);
});
test('sets automaticSystemUiAdjustment to not be null', () async {
@ -270,15 +274,18 @@ void main() {
_anonymize(TestWidgetsFlutterBinding.ensureInitialized())!
as TestWidgetsFlutterBinding;
debugDefaultTargetPlatformOverride = TargetPlatform.android;
expect(binding.renderView.automaticSystemUiAdjustment, true);
// TODO(goderbauer): Migrate to binding.renderViews when that is available in the oldest supported stable.
final RenderView renderView =
binding.renderView; // ignore: deprecated_member_use
expect(renderView.automaticSystemUiAdjustment, true);
final Future<bool> launchResult =
launch('http://flutter.dev/', statusBarBrightness: Brightness.dark);
// The automaticSystemUiAdjustment should be set before the launch
// and equal to true after the launch result is complete.
expect(binding.renderView.automaticSystemUiAdjustment, true);
expect(renderView.automaticSystemUiAdjustment, true);
await launchResult;
expect(binding.renderView.automaticSystemUiAdjustment, true);
expect(renderView.automaticSystemUiAdjustment, true);
});
test('open non-parseable url', () async {