mirror of
https://github.com/flutter/packages.git
synced 2025-07-01 23:51:55 +08:00
[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:

committed by
GitHub

parent
6a51bef718
commit
f185bffa21
@ -7,6 +7,7 @@
|
|||||||
import 'dart:ui' show Brightness;
|
import 'dart:ui' show Brightness;
|
||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:flutter/rendering.dart';
|
||||||
import 'package:flutter/services.dart' show PlatformException;
|
import 'package:flutter/services.dart' show PlatformException;
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:url_launcher/src/legacy_api.dart';
|
import 'package:url_launcher/src/legacy_api.dart';
|
||||||
@ -241,15 +242,18 @@ void main() {
|
|||||||
_anonymize(TestWidgetsFlutterBinding.ensureInitialized())!
|
_anonymize(TestWidgetsFlutterBinding.ensureInitialized())!
|
||||||
as TestWidgetsFlutterBinding;
|
as TestWidgetsFlutterBinding;
|
||||||
debugDefaultTargetPlatformOverride = TargetPlatform.iOS;
|
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 =
|
final Future<bool> launchResult =
|
||||||
launch('http://flutter.dev/', statusBarBrightness: Brightness.dark);
|
launch('http://flutter.dev/', statusBarBrightness: Brightness.dark);
|
||||||
|
|
||||||
// Should take over control of the automaticSystemUiAdjustment while it's
|
// Should take over control of the automaticSystemUiAdjustment while it's
|
||||||
// pending, then restore it back to normal after the launch finishes.
|
// pending, then restore it back to normal after the launch finishes.
|
||||||
expect(binding.renderView.automaticSystemUiAdjustment, isFalse);
|
expect(renderView.automaticSystemUiAdjustment, isFalse);
|
||||||
await launchResult;
|
await launchResult;
|
||||||
expect(binding.renderView.automaticSystemUiAdjustment, isTrue);
|
expect(renderView.automaticSystemUiAdjustment, isTrue);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('sets automaticSystemUiAdjustment to not be null', () async {
|
test('sets automaticSystemUiAdjustment to not be null', () async {
|
||||||
@ -270,15 +274,18 @@ void main() {
|
|||||||
_anonymize(TestWidgetsFlutterBinding.ensureInitialized())!
|
_anonymize(TestWidgetsFlutterBinding.ensureInitialized())!
|
||||||
as TestWidgetsFlutterBinding;
|
as TestWidgetsFlutterBinding;
|
||||||
debugDefaultTargetPlatformOverride = TargetPlatform.android;
|
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 =
|
final Future<bool> launchResult =
|
||||||
launch('http://flutter.dev/', statusBarBrightness: Brightness.dark);
|
launch('http://flutter.dev/', statusBarBrightness: Brightness.dark);
|
||||||
|
|
||||||
// The automaticSystemUiAdjustment should be set before the launch
|
// The automaticSystemUiAdjustment should be set before the launch
|
||||||
// and equal to true after the launch result is complete.
|
// and equal to true after the launch result is complete.
|
||||||
expect(binding.renderView.automaticSystemUiAdjustment, true);
|
expect(renderView.automaticSystemUiAdjustment, true);
|
||||||
await launchResult;
|
await launchResult;
|
||||||
expect(binding.renderView.automaticSystemUiAdjustment, true);
|
expect(renderView.automaticSystemUiAdjustment, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('open non-parseable url', () async {
|
test('open non-parseable url', () async {
|
||||||
|
Reference in New Issue
Block a user