Skip to content

Commit 3fd5a64

Browse files
committed
Merge branch 'master' into add_zoom_to_android_webview
* master: [webview_flutter] Add zoomEnabled to webview flutter platform interface (flutter#4404) [ci] Remove obsolete Dockerfile (flutter#4405) Fix order-dependant platform interface tests (flutter#4406) [google_maps_flutter]: LatLng longitude loses precision in constructor #90574 (flutter#4374)
2 parents f13a0dd + 0558169 commit 3fd5a64

File tree

11 files changed

+98
-46
lines changed

11 files changed

+98
-46
lines changed

.ci/java8.Dockerfile

Lines changed: 0 additions & 33 deletions
This file was deleted.

packages/file_selector/file_selector_platform_interface/test/file_selector_platform_interface_test.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ import 'package:file_selector_platform_interface/src/method_channel/method_chann
77
import 'package:flutter_test/flutter_test.dart';
88

99
void main() {
10+
// Store the initial instance before any tests change it.
11+
final FileSelectorPlatform initialInstance = FileSelectorPlatform.instance;
12+
1013
group('$FileSelectorPlatform', () {
1114
test('$MethodChannelFileSelector() is the default instance', () {
12-
expect(FileSelectorPlatform.instance,
13-
isInstanceOf<MethodChannelFileSelector>());
15+
expect(initialInstance, isInstanceOf<MethodChannelFileSelector>());
1416
});
1517

1618
test('Can be extended', () {

packages/google_maps_flutter/google_maps_flutter_platform_interface/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 2.1.3
2+
3+
* `LatLng` constructor maintains longitude precision when given within
4+
acceptable range
5+
16
## 2.1.2
27

38
* Add additional marker drag events

packages/google_maps_flutter/google_maps_flutter_platform_interface/lib/src/types/location.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,16 @@ class LatLng {
1414
/// The latitude is clamped to the inclusive interval from -90.0 to +90.0.
1515
///
1616
/// The longitude is normalized to the half-open interval from -180.0
17-
/// (inclusive) to +180.0 (exclusive)
17+
/// (inclusive) to +180.0 (exclusive).
1818
const LatLng(double latitude, double longitude)
1919
: assert(latitude != null),
2020
assert(longitude != null),
2121
latitude =
2222
(latitude < -90.0 ? -90.0 : (90.0 < latitude ? 90.0 : latitude)),
23-
longitude = (longitude + 180.0) % 360.0 - 180.0;
23+
// Avoids normalization if possible to prevent unnecessary loss of precision
24+
longitude = longitude >= -180 && longitude < 180
25+
? longitude
26+
: (longitude + 180.0) % 360.0 - 180.0;
2427

2528
/// The latitude in degrees between -90.0 and 90.0, both inclusive.
2629
final double latitude;

packages/google_maps_flutter/google_maps_flutter_platform_interface/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ repository: https://github.com/flutter/plugins/tree/master/packages/google_maps_
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22
55
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
66
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
7-
version: 2.1.2
7+
version: 2.1.3
88

99
environment:
1010
sdk: '>=2.12.0 <3.0.0'

packages/google_maps_flutter/google_maps_flutter_platform_interface/test/platform_interface/google_maps_flutter_platform_test.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,13 @@ import 'package:google_maps_flutter_platform_interface/google_maps_flutter_platf
1616
void main() {
1717
TestWidgetsFlutterBinding.ensureInitialized();
1818

19+
// Store the initial instance before any tests change it.
20+
final GoogleMapsFlutterPlatform initialInstance =
21+
GoogleMapsFlutterPlatform.instance;
22+
1923
group('$GoogleMapsFlutterPlatform', () {
2024
test('$MethodChannelGoogleMapsFlutter() is the default instance', () {
21-
expect(GoogleMapsFlutterPlatform.instance,
22-
isInstanceOf<MethodChannelGoogleMapsFlutter>());
25+
expect(initialInstance, isInstanceOf<MethodChannelGoogleMapsFlutter>());
2326
});
2427

2528
test('Cannot be implemented with `implements`', () {
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// Copyright 2013 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
import 'package:flutter_test/flutter_test.dart';
6+
import 'package:google_maps_flutter_platform_interface/google_maps_flutter_platform_interface.dart';
7+
8+
void main() {
9+
TestWidgetsFlutterBinding.ensureInitialized();
10+
11+
group('LanLng constructor', () {
12+
test('Maintains longitude precision if within acceptable range', () async {
13+
const lat = -34.509981;
14+
const lng = 150.792384;
15+
16+
final latLng = LatLng(lat, lng);
17+
18+
expect(latLng.latitude, equals(lat));
19+
expect(latLng.longitude, equals(lng));
20+
});
21+
22+
test('Normalizes longitude that is below lower limit', () async {
23+
const lat = -34.509981;
24+
const lng = -270.0;
25+
26+
final latLng = LatLng(lat, lng);
27+
28+
expect(latLng.latitude, equals(lat));
29+
expect(latLng.longitude, equals(90.0));
30+
});
31+
32+
test('Normalizes longitude that is above upper limit', () async {
33+
const lat = -34.509981;
34+
const lng = 270.0;
35+
36+
final latLng = LatLng(lat, lng);
37+
38+
expect(latLng.latitude, equals(lat));
39+
expect(latLng.longitude, equals(-90.0));
40+
});
41+
42+
test('Includes longitude set to lower limit', () async {
43+
const lat = -34.509981;
44+
const lng = -180.0;
45+
46+
final latLng = LatLng(lat, lng);
47+
48+
expect(latLng.latitude, equals(lat));
49+
expect(latLng.longitude, equals(-180.0));
50+
});
51+
52+
test('Normalizes longitude set to upper limit', () async {
53+
const lat = -34.509981;
54+
const lng = 180.0;
55+
56+
final latLng = LatLng(lat, lng);
57+
58+
expect(latLng.latitude, equals(lat));
59+
expect(latLng.longitude, equals(-180.0));
60+
});
61+
});
62+
}

packages/google_sign_in/google_sign_in_platform_interface/test/google_sign_in_platform_interface_test.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ import 'package:flutter_test/flutter_test.dart';
77
import 'package:mockito/mockito.dart';
88

99
void main() {
10+
// Store the initial instance before any tests change it.
11+
final GoogleSignInPlatform initialInstance = GoogleSignInPlatform.instance;
12+
1013
group('$GoogleSignInPlatform', () {
1114
test('$MethodChannelGoogleSignIn is the default instance', () {
12-
expect(GoogleSignInPlatform.instance, isA<MethodChannelGoogleSignIn>());
15+
expect(initialInstance, isA<MethodChannelGoogleSignIn>());
1316
});
1417

1518
test('Cannot be implemented with `implements`', () {

packages/quick_actions/quick_actions_platform_interface/test/quick_actions_platform_interface_test.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@ import 'package:quick_actions_platform_interface/platform_interface/quick_action
99
void main() {
1010
TestWidgetsFlutterBinding.ensureInitialized();
1111

12+
// Store the initial instance before any tests change it.
13+
final QuickActionsPlatform initialInstance = QuickActionsPlatform.instance;
14+
1215
group('$QuickActionsPlatform', () {
1316
test('$MethodChannelQuickActions is the default instance', () {
14-
expect(QuickActionsPlatform.instance, isA<MethodChannelQuickActions>());
17+
expect(initialInstance, isA<MethodChannelQuickActions>());
1518
});
1619

1720
test('Cannot be implemented with `implements`', () {

packages/url_launcher/url_launcher_platform_interface/test/method_channel_url_launcher_test.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ import 'package:url_launcher_platform_interface/url_launcher_platform_interface.
1414
void main() {
1515
TestWidgetsFlutterBinding.ensureInitialized();
1616

17+
// Store the initial instance before any tests change it.
18+
final UrlLauncherPlatform initialInstance = UrlLauncherPlatform.instance;
19+
1720
group('$UrlLauncherPlatform', () {
1821
test('$MethodChannelUrlLauncher() is the default instance', () {
19-
expect(UrlLauncherPlatform.instance,
20-
isInstanceOf<MethodChannelUrlLauncher>());
22+
expect(initialInstance, isInstanceOf<MethodChannelUrlLauncher>());
2123
});
2224

2325
test('Cannot be implemented with `implements`', () {

packages/video_player/video_player_platform_interface/test/method_channel_video_player_test.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,12 @@ class _ApiLogger implements TestHostVideoPlayerApi {
9292
void main() {
9393
TestWidgetsFlutterBinding.ensureInitialized();
9494

95+
// Store the initial instance before any tests change it.
96+
final VideoPlayerPlatform initialInstance = VideoPlayerPlatform.instance;
97+
9598
group('$VideoPlayerPlatform', () {
9699
test('$MethodChannelVideoPlayer() is the default instance', () {
97-
expect(VideoPlayerPlatform.instance,
98-
isInstanceOf<MethodChannelVideoPlayer>());
100+
expect(initialInstance, isInstanceOf<MethodChannelVideoPlayer>());
99101
});
100102
});
101103

0 commit comments

Comments
 (0)