This repository was archived by the owner on Feb 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[google_maps_flutter]: LatLng longitude loses precision in constructor #90574 #4374
Merged
fluttergithubbot
merged 6 commits into
flutter-team-archive:master
from
Murray-Meller:90574-Fix-LatLng-longitude-precision
Oct 1, 2021
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
6a2e738
#90574: Avoids normalizing longitude in LatLng constructor if value i…
MurrayMeller 7ef23db
#90574: Avoids normalizing longitude in LatLng constructor if value i…
MurrayMeller eeb0dd5
#90574: Update CHANGELOG.md, pubspec.yaml
MurrayMeller a69321e
#90574: Moves comment about implementation detail from the documentat…
MurrayMeller d8c389a
Update version for conflict
stuartmorgan-g 93929cb
Merge branch 'master' into 90574-Fix-LatLng-longitude-precision
stuartmorgan-g File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
packages/google_maps_flutter/google_maps_flutter_platform_interface/CHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
.../google_maps_flutter/google_maps_flutter_platform_interface/test/types/location_test.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| // Copyright 2013 The Flutter Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| import 'package:flutter_test/flutter_test.dart'; | ||
| import 'package:google_maps_flutter_platform_interface/google_maps_flutter_platform_interface.dart'; | ||
|
|
||
| void main() { | ||
| TestWidgetsFlutterBinding.ensureInitialized(); | ||
|
|
||
| group('LanLng constructor', () { | ||
| test('Maintains longitude precision if within acceptable range', () async { | ||
|
Murray-Meller marked this conversation as resolved.
Outdated
|
||
| const lat = -34.509981; | ||
| const lng = 150.792384; | ||
|
|
||
| final latLng = LatLng(lat, lng); | ||
|
|
||
| expect(latLng.latitude, equals(lat)); | ||
| expect(latLng.longitude, equals(lng)); | ||
| }); | ||
|
|
||
| test('Normalizes longitude that is below lower limit', () async { | ||
| const lat = -34.509981; | ||
| const lng = -270.0; | ||
|
|
||
| final latLng = LatLng(lat, lng); | ||
|
|
||
| expect(latLng.latitude, equals(lat)); | ||
| expect(latLng.longitude, equals(90.0)); | ||
| }); | ||
|
|
||
| test('Normalizes longitude that is above upper limit', () async { | ||
| const lat = -34.509981; | ||
| const lng = 270.0; | ||
|
|
||
| final latLng = LatLng(lat, lng); | ||
|
|
||
| expect(latLng.latitude, equals(lat)); | ||
| expect(latLng.longitude, equals(-90.0)); | ||
| }); | ||
|
|
||
| test('Includes longitude set to lower limit', () async { | ||
| const lat = -34.509981; | ||
| const lng = -180.0; | ||
|
|
||
| final latLng = LatLng(lat, lng); | ||
|
|
||
| expect(latLng.latitude, equals(lat)); | ||
| expect(latLng.longitude, equals(-180.0)); | ||
| }); | ||
|
|
||
| test('Normalizes longitude set to upper limit', () async { | ||
| const lat = -34.509981; | ||
| const lng = 180.0; | ||
|
|
||
| final latLng = LatLng(lat, lng); | ||
|
|
||
| expect(latLng.latitude, equals(lat)); | ||
| expect(latLng.longitude, equals(-180.0)); | ||
| }); | ||
| }); | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.