Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Jun 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down