forked from flutter/plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[google_maps_flutter]: LatLng longitude loses precision in constructo…
…r #90574 (flutter#4374)
- Loading branch information
1 parent
588e89b
commit 003d568
Showing
4 changed files
with
73 additions
and
3 deletions.
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 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 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 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 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 { | ||
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)); | ||
}); | ||
}); | ||
} |