From b0550a4e2f0ef8d94eda66cb91776b1ca0b03c6d Mon Sep 17 00:00:00 2001 From: Jonathan Joelson Date: Fri, 9 Jun 2023 17:12:28 -0400 Subject: [PATCH] Update fitBounds to handle rotation --- lib/src/map/state.dart | 29 +- test/flutter_map_controller_test.dart | 2279 +++++++++++++++++++++++++ 2 files changed, 2305 insertions(+), 3 deletions(-) diff --git a/lib/src/map/state.dart b/lib/src/map/state.dart index 73568952c..57d5196db 100644 --- a/lib/src/map/state.dart +++ b/lib/src/map/state.dart @@ -514,7 +514,20 @@ class FlutterMapState extends MapGestureMixin final paddingOffset = (paddingBR - paddingTL) / 2; final swPoint = project(bounds.southWest, zoom); final nePoint = project(bounds.northEast, zoom); - final center = unproject((swPoint + nePoint) / 2 + paddingOffset, zoom); + + final CustomPoint projectedCenter; + if (_rotation != 0.0) { + final swPointRotated = swPoint.rotate(-rotationRad); + final nePointRotated = nePoint.rotate(-rotationRad); + final centerRotated = + (swPointRotated + nePointRotated) / 2 + paddingOffset; + + projectedCenter = centerRotated.rotate(rotationRad); + } else { + projectedCenter = (swPoint + nePoint) / 2 + paddingOffset; + } + + final center = unproject(projectedCenter, zoom); return CenterZoom( center: center, zoom: zoom, @@ -528,10 +541,20 @@ class FlutterMapState extends MapGestureMixin final max = options.maxZoom ?? double.infinity; final nw = bounds.northWest; final se = bounds.southEast; - var size = this.size - padding; + var size = nonrotatedSize - padding; // Prevent negative size which results in NaN zoom value later on in the calculation size = CustomPoint(math.max(0, size.x), math.max(0, size.y)); - final boundsSize = Bounds(project(se, zoom), project(nw, zoom)).size; + + var boundsSize = Bounds(project(se, zoom), project(nw, zoom)).size; + if (_rotation != 0.0) { + final cosAngle = math.cos(rotationRad).abs(); + final sinAngle = math.sin(rotationRad).abs(); + boundsSize = CustomPoint( + (boundsSize.x * cosAngle) + (boundsSize.y * sinAngle), + (boundsSize.y * cosAngle) + (boundsSize.x * sinAngle), + ); + } + final scaleX = size.x / boundsSize.x; final scaleY = size.y / boundsSize.y; final scale = inside ? math.max(scaleX, scaleY) : math.min(scaleX, scaleY); diff --git a/test/flutter_map_controller_test.dart b/test/flutter_map_controller_test.dart index b17e9a8b5..d863f65f7 100644 --- a/test/flutter_map_controller_test.dart +++ b/test/flutter_map_controller_test.dart @@ -1,3 +1,4 @@ +import 'package:flutter/widgets.dart'; import 'package:flutter_map/flutter_map.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:latlong2/latlong.dart'; @@ -118,4 +119,2282 @@ void main() { expect(controller.zoom, equals(expectedZoom)); } }); + testWidgets('test fit bounds methods with rotation', (tester) async { + final controller = MapController(); + final bounds = LatLngBounds( + const LatLng(4.214943, 33.925781), + const LatLng(-1.362176, 29.575195), + ); + + await tester.pumpWidget(TestApp(controller: controller)); + + Future testFitBounds({ + required double rotation, + required FitBoundsOptions options, + required LatLngBounds expectedBounds, + required LatLng expectedCenter, + required double expectedZoom, + }) async { + controller.rotate(rotation); + final fit = controller.centerZoomFitBounds(bounds, options: options); + controller.move(fit.center, fit.zoom); + await tester.pump(); + expect( + controller.bounds?.northWest.latitude, + moreOrLessEquals(expectedBounds.northWest.latitude), + ); + expect( + controller.bounds?.northWest.longitude, + moreOrLessEquals(expectedBounds.northWest.longitude), + ); + expect( + controller.bounds?.southEast.latitude, + moreOrLessEquals(expectedBounds.southEast.latitude), + ); + expect( + controller.bounds?.southEast.longitude, + moreOrLessEquals(expectedBounds.southEast.longitude), + ); + expect( + controller.center.latitude, + moreOrLessEquals(expectedCenter.latitude), + ); + expect( + controller.center.longitude, + moreOrLessEquals(expectedCenter.longitude), + ); + expect(controller.zoom, moreOrLessEquals(expectedZoom)); + + controller.fitBounds(bounds, options: options); + await tester.pump(); + expect( + controller.bounds?.northWest.latitude, + moreOrLessEquals(expectedBounds.northWest.latitude), + ); + expect( + controller.bounds?.northWest.longitude, + moreOrLessEquals(expectedBounds.northWest.longitude), + ); + expect( + controller.bounds?.southEast.latitude, + moreOrLessEquals(expectedBounds.southEast.latitude), + ); + expect( + controller.bounds?.southEast.longitude, + moreOrLessEquals(expectedBounds.southEast.longitude), + ); + expect( + controller.center.latitude, + moreOrLessEquals(expectedCenter.latitude), + ); + expect( + controller.center.longitude, + moreOrLessEquals(expectedCenter.longitude), + ); + expect(controller.zoom, moreOrLessEquals(expectedZoom)); + } + + // Tests with no padding + + await testFitBounds( + rotation: -360, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(4.220875035073316, 28.95466920920177), + const LatLng(-1.3562295282017047, 34.53572340816548), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.655171629288527, + ); + await testFitBounds( + rotation: -350, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(5.0649687311133835, 28.125143823996357), + const LatLng(-2.1702639345497245, 35.36750536897148), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.491452249967169, + ); + await testFitBounds( + rotation: -340, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(5.759884116064697, 27.421434696700945), + const LatLng(-2.8582877724265283, 36.05051909118752), + ), + expectedCenter: const LatLng(1.4280748738291607, 31.75048799999998), + expectedZoom: 5.384574784150165, + ); + await testFitBounds( + rotation: -330, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(6.229878688707217, 26.943661553415026), + const LatLng(-3.3298966942067114, 36.517625059412495), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.32657729277294, + ); + await testFitBounds( + rotation: -320, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(6.404221292029658, 26.74932338937486), + const LatLng(-3.543173671065116, 36.71235590310393), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.313623992279296, + ); + await testFitBounds( + rotation: -310, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(6.404221292029098, 26.74932338937554), + const LatLng(-3.5431736710657136, 36.71235590310461), + ), + expectedCenter: const LatLng(1.4280748738291607, 31.750488000000022), + expectedZoom: 5.313623992279291, + ); + await testFitBounds( + rotation: -300, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(6.229878688707217, 26.943661553415026), + const LatLng(-3.3298966942067114, 36.517625059412495), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.32657729277294, + ); + await testFitBounds( + rotation: -290, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(5.75988411606457, 27.421434696701105), + const LatLng(-2.8582877724266553, 36.05051909118768), + ), + expectedCenter: const LatLng(1.4280748738291607, 31.75048799999998), + expectedZoom: 5.384574784150164, + ); + await testFitBounds( + rotation: -280, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(5.064968731113154, 28.125143823996638), + const LatLng(-2.1702639345499533, 35.36750536897171), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.491452249967168, + ); + await testFitBounds( + rotation: -270, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(4.220875035073316, 28.95466920920177), + const LatLng(-1.3562295282017047, 34.53572340816548), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.655171629288527, + ); + await testFitBounds( + rotation: -260, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(5.0649687311133835, 28.125143823996357), + const LatLng(-2.1702639345497245, 35.36750536897148), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.491452249967169, + ); + await testFitBounds( + rotation: -250, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(5.759884116064697, 27.421434696700945), + const LatLng(-2.8582877724265283, 36.05051909118752), + ), + expectedCenter: const LatLng(1.4280748738291607, 31.75048799999998), + expectedZoom: 5.384574784150165, + ); + await testFitBounds( + rotation: -240, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(6.229878688707217, 26.943661553415026), + const LatLng(-3.3298966942067114, 36.517625059412495), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.32657729277294, + ); + await testFitBounds( + rotation: -230, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(6.404221292029658, 26.74932338937486), + const LatLng(-3.543173671065116, 36.71235590310393), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.313623992279296, + ); + await testFitBounds( + rotation: -220, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(6.404221292029098, 26.74932338937554), + const LatLng(-3.5431736710657136, 36.71235590310461), + ), + expectedCenter: const LatLng(1.4280748738291607, 31.750488000000022), + expectedZoom: 5.313623992279291, + ); + await testFitBounds( + rotation: -210, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(6.229878688707217, 26.943661553415026), + const LatLng(-3.3298966942067114, 36.517625059412495), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.32657729277294, + ); + await testFitBounds( + rotation: -200, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(5.75988411606457, 27.421434696701105), + const LatLng(-2.8582877724266553, 36.05051909118768), + ), + expectedCenter: const LatLng(1.4280748738291607, 31.75048799999998), + expectedZoom: 5.384574784150164, + ); + await testFitBounds( + rotation: -190, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(5.064968731113154, 28.125143823996638), + const LatLng(-2.1702639345499533, 35.36750536897171), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.491452249967168, + ); + await testFitBounds( + rotation: -180, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(4.220875035073316, 28.95466920920177), + const LatLng(-1.3562295282017047, 34.53572340816548), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.655171629288527, + ); + await testFitBounds( + rotation: -170, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(5.0649687311133835, 28.125143823996357), + const LatLng(-2.1702639345497245, 35.36750536897148), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.491452249967169, + ); + await testFitBounds( + rotation: -160, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(5.759884116064697, 27.421434696700945), + const LatLng(-2.8582877724265283, 36.05051909118752), + ), + expectedCenter: const LatLng(1.4280748738291607, 31.75048799999998), + expectedZoom: 5.384574784150165, + ); + await testFitBounds( + rotation: -150, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(6.229878688707217, 26.943661553415026), + const LatLng(-3.3298966942067114, 36.517625059412495), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.32657729277294, + ); + await testFitBounds( + rotation: -140, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(6.404221292029658, 26.74932338937486), + const LatLng(-3.543173671065116, 36.71235590310393), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.313623992279296, + ); + await testFitBounds( + rotation: -130, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(6.404221292029098, 26.74932338937554), + const LatLng(-3.5431736710657136, 36.71235590310461), + ), + expectedCenter: const LatLng(1.4280748738291607, 31.750488000000022), + expectedZoom: 5.313623992279291, + ); + await testFitBounds( + rotation: -120, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(6.2298786887073065, 26.943661553414902), + const LatLng(-3.329896694206635, 36.517625059412374), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.3265772927729405, + ); + await testFitBounds( + rotation: -110, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(5.759884116064697, 27.421434696700945), + const LatLng(-2.8582877724265283, 36.05051909118752), + ), + expectedCenter: const LatLng(1.4280748738291607, 31.75048799999998), + expectedZoom: 5.384574784150165, + ); + await testFitBounds( + rotation: -100, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(5.0649687311133835, 28.125143823996357), + const LatLng(-2.1702639345497245, 35.36750536897148), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.491452249967169, + ); + await testFitBounds( + rotation: -90, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(4.220875035073545, 28.95466920920149), + const LatLng(-1.3562295282014631, 34.53572340816524), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.655171629288529, + ); + await testFitBounds( + rotation: -80, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(5.064968731113549, 28.12514382399612), + const LatLng(-2.1702639345495207, 35.36750536897124), + ), + expectedCenter: const LatLng(1.4280748738291735, 31.75048799999998), + expectedZoom: 5.491452249967171, + ); + await testFitBounds( + rotation: -70, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(5.759884116064137, 27.421434696701624), + const LatLng(-2.858287772427088, 36.050519091188235), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.750488000000022), + expectedZoom: 5.3845747841501606, + ); + await testFitBounds( + rotation: -60, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(6.2298786887073065, 26.943661553414902), + const LatLng(-3.329896694206635, 36.517625059412374), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.3265772927729405, + ); + await testFitBounds( + rotation: -50, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(6.404221292029747, 26.74932338937478), + const LatLng(-3.5431736710650394, 36.71235590310381), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.313623992279297, + ); + await testFitBounds( + rotation: -40, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(6.404221292028678, 26.74932338937606), + const LatLng(-3.543173671066159, 36.71235590310517), + ), + expectedCenter: const LatLng(1.4280748738291607, 31.75048799999998), + expectedZoom: 5.313623992279288, + ); + await testFitBounds( + rotation: -30, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(6.229878688707217, 26.943661553415026), + const LatLng(-3.3298966942067114, 36.517625059412495), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.32657729277294, + ); + await testFitBounds( + rotation: -20, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(5.75988411606457, 27.421434696701105), + const LatLng(-2.8582877724266553, 36.05051909118768), + ), + expectedCenter: const LatLng(1.4280748738291607, 31.75048799999998), + expectedZoom: 5.384574784150164, + ); + await testFitBounds( + rotation: -10, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(5.064968731113154, 28.125143823996638), + const LatLng(-2.1702639345499533, 35.36750536897171), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.491452249967168, + ); + await testFitBounds( + rotation: 0, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(4.220875035073316, 28.95466920920177), + const LatLng(-1.3562295282017047, 34.53572340816548), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.655171629288527, + ); + await testFitBounds( + rotation: 10, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(5.0649687311133835, 28.125143823996357), + const LatLng(-2.1702639345497245, 35.36750536897148), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.491452249967169, + ); + await testFitBounds( + rotation: 20, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(5.759884116064697, 27.421434696700945), + const LatLng(-2.8582877724265283, 36.05051909118752), + ), + expectedCenter: const LatLng(1.4280748738291607, 31.75048799999998), + expectedZoom: 5.384574784150165, + ); + await testFitBounds( + rotation: 30, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(6.229878688707217, 26.943661553415026), + const LatLng(-3.3298966942067114, 36.517625059412495), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.32657729277294, + ); + await testFitBounds( + rotation: 40, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(6.404221292029658, 26.74932338937486), + const LatLng(-3.543173671065116, 36.71235590310393), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.313623992279296, + ); + await testFitBounds( + rotation: 50, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(6.404221292029098, 26.74932338937554), + const LatLng(-3.5431736710657136, 36.71235590310461), + ), + expectedCenter: const LatLng(1.4280748738291607, 31.750488000000022), + expectedZoom: 5.313623992279291, + ); + await testFitBounds( + rotation: 60, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(6.229878688707217, 26.943661553415026), + const LatLng(-3.3298966942067114, 36.517625059412495), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.32657729277294, + ); + await testFitBounds( + rotation: 70, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(5.75988411606457, 27.421434696701105), + const LatLng(-2.8582877724266553, 36.05051909118768), + ), + expectedCenter: const LatLng(1.4280748738291607, 31.75048799999998), + expectedZoom: 5.384574784150164, + ); + await testFitBounds( + rotation: 80, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(5.064968731113154, 28.125143823996638), + const LatLng(-2.1702639345499533, 35.36750536897171), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.491452249967168, + ); + await testFitBounds( + rotation: 90, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(4.220875035073316, 28.95466920920177), + const LatLng(-1.3562295282017047, 34.53572340816548), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.655171629288527, + ); + await testFitBounds( + rotation: 100, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(5.0649687311133835, 28.125143823996357), + const LatLng(-2.1702639345497245, 35.36750536897148), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.491452249967169, + ); + await testFitBounds( + rotation: 110, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(5.759884116064697, 27.421434696700945), + const LatLng(-2.8582877724265283, 36.05051909118752), + ), + expectedCenter: const LatLng(1.4280748738291607, 31.75048799999998), + expectedZoom: 5.384574784150165, + ); + await testFitBounds( + rotation: 120, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(6.229878688707217, 26.943661553415026), + const LatLng(-3.3298966942067114, 36.517625059412495), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.32657729277294, + ); + await testFitBounds( + rotation: 130, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(6.404221292029658, 26.74932338937486), + const LatLng(-3.543173671065116, 36.71235590310393), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.313623992279296, + ); + await testFitBounds( + rotation: 140, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(6.404221292029098, 26.74932338937554), + const LatLng(-3.5431736710657136, 36.71235590310461), + ), + expectedCenter: const LatLng(1.4280748738291607, 31.750488000000022), + expectedZoom: 5.313623992279291, + ); + await testFitBounds( + rotation: 150, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(6.229878688707217, 26.943661553415026), + const LatLng(-3.3298966942067114, 36.517625059412495), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.32657729277294, + ); + await testFitBounds( + rotation: 160, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(5.75988411606457, 27.421434696701105), + const LatLng(-2.8582877724266553, 36.05051909118768), + ), + expectedCenter: const LatLng(1.4280748738291607, 31.75048799999998), + expectedZoom: 5.384574784150164, + ); + await testFitBounds( + rotation: 170, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(5.064968731113154, 28.125143823996638), + const LatLng(-2.1702639345499533, 35.36750536897171), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.491452249967168, + ); + await testFitBounds( + rotation: 180, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(4.220875035073316, 28.95466920920177), + const LatLng(-1.3562295282017047, 34.53572340816548), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.655171629288527, + ); + await testFitBounds( + rotation: 190, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(5.064968731113256, 28.125143823996478), + const LatLng(-2.170263934549839, 35.3675053689716), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.4914522499671685, + ); + await testFitBounds( + rotation: 200, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(5.759884116064786, 27.421434696700867), + const LatLng(-2.8582877724264137, 36.05051909118744), + ), + expectedCenter: const LatLng(1.4280748738291607, 31.75048799999998), + expectedZoom: 5.384574784150166, + ); + await testFitBounds( + rotation: 210, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(6.229878688706886, 26.94366155341542), + const LatLng(-3.3298966942070676, 36.51762505941289), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.326577292772937, + ); + await testFitBounds( + rotation: 220, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(6.404221292029302, 26.749323389375302), + const LatLng(-3.543173671065485, 36.71235590310433), + ), + expectedCenter: const LatLng(1.4280748738291607, 31.75048799999998), + expectedZoom: 5.313623992279293, + ); + await testFitBounds( + rotation: 230, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(6.4042212920299635, 26.749323389374503), + const LatLng(-3.543173671064798, 36.71235590310353), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.3136239922792985, + ); + await testFitBounds( + rotation: 240, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(6.229878688706365, 26.94366155341602), + const LatLng(-3.3298966942076276, 36.51762505941353), + ), + expectedCenter: const LatLng(1.4280748738291607, 31.75048799999998), + expectedZoom: 5.3265772927729325, + ); + await testFitBounds( + rotation: 250, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(5.7598841160639465, 27.421434696701862), + const LatLng(-2.8582877724273295, 36.050519091188484), + ), + expectedCenter: const LatLng(1.4280748738291607, 31.75048799999998), + expectedZoom: 5.384574784150159, + ); + await testFitBounds( + rotation: 260, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(5.064968731113256, 28.125143823996478), + const LatLng(-2.170263934549839, 35.3675053689716), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.4914522499671685, + ); + await testFitBounds( + rotation: 270, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(4.220875035073443, 28.954669209201615), + const LatLng(-1.3562295282015904, 34.53572340816536), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.655171629288528, + ); + await testFitBounds( + rotation: 280, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(5.0649687311133835, 28.125143823996357), + const LatLng(-2.1702639345497245, 35.36750536897148), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.491452249967169, + ); + await testFitBounds( + rotation: 290, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(5.759884116064697, 27.421434696700945), + const LatLng(-2.8582877724265283, 36.05051909118752), + ), + expectedCenter: const LatLng(1.4280748738291607, 31.75048799999998), + expectedZoom: 5.384574784150165, + ); + await testFitBounds( + rotation: 300, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(6.229878688707217, 26.943661553415026), + const LatLng(-3.3298966942067114, 36.517625059412495), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.32657729277294, + ); + await testFitBounds( + rotation: 310, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(6.404221292029658, 26.74932338937486), + const LatLng(-3.543173671065116, 36.71235590310393), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.313623992279296, + ); + await testFitBounds( + rotation: 320, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(6.404221292029098, 26.74932338937554), + const LatLng(-3.5431736710657136, 36.71235590310461), + ), + expectedCenter: const LatLng(1.4280748738291607, 31.750488000000022), + expectedZoom: 5.313623992279291, + ); + await testFitBounds( + rotation: 330, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(6.229878688707217, 26.943661553415026), + const LatLng(-3.3298966942067114, 36.517625059412495), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.32657729277294, + ); + await testFitBounds( + rotation: 340, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(5.75988411606457, 27.421434696701105), + const LatLng(-2.8582877724266553, 36.05051909118768), + ), + expectedCenter: const LatLng(1.4280748738291607, 31.75048799999998), + expectedZoom: 5.384574784150164, + ); + await testFitBounds( + rotation: 350, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(5.064968731113154, 28.125143823996638), + const LatLng(-2.1702639345499533, 35.36750536897171), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.491452249967168, + ); + await testFitBounds( + rotation: 360, + options: const FitBoundsOptions(padding: EdgeInsets.zero), + expectedBounds: LatLngBounds( + const LatLng(4.220875035073316, 28.95466920920177), + const LatLng(-1.3562295282017047, 34.53572340816548), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.655171629288527, + ); + + // Tests with symmetric padding + + const symmetricPadding = EdgeInsets.all(12); + + await testFitBounds( + rotation: -360, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(4.604066851713044, 28.560190151047802), + const LatLng(-1.732813138431261, 34.902297195324785), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.470747058151099, + ); + await testFitBounds( + rotation: -350, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(5.541088725566302, 27.62708389812815), + const LatLng(-2.6792328593972004, 35.8570401992362), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999994), + expectedZoom: 5.307027678829742, + ); + await testFitBounds( + rotation: -340, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.32669953307482, 26.825437506742954), + const LatLng(-3.4640696683004615, 36.631215227750474), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.200150213012734, + ); + await testFitBounds( + rotation: -330, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.862564855410873, 26.292484184305316), + const LatLng(-3.9972253151859714, 37.17198816839335), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999994), + expectedZoom: 5.142152721635512, + ); + await testFitBounds( + rotation: -320, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.0788181869584115, 26.052346122155633), + const LatLng(-4.220908739354, 37.373973978665916), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.129199421141867, + ); + await testFitBounds( + rotation: -310, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.078818186958309, 26.05234612215575), + const LatLng(-4.2209087393541145, 37.37397397866604), + ), + expectedCenter: const LatLng(1.4280748738291607, 31.75048799999998), + expectedZoom: 5.129199421141866, + ); + await testFitBounds( + rotation: -300, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.862564855409817, 26.292484184306595), + const LatLng(-3.997225315187129, 37.171988168394705), + ), + expectedCenter: const LatLng(1.4280748738291607, 31.75048799999998), + expectedZoom: 5.142152721635503, + ); + await testFitBounds( + rotation: -290, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.326699533075024, 26.825437506742713), + const LatLng(-3.4640696683002576, 36.63121522775023), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.200150213012736, + ); + await testFitBounds( + rotation: -280, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(5.541088725565997, 27.627083898128507), + const LatLng(-2.6792328593975183, 35.85704019923659), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.30702767882974, + ); + await testFitBounds( + rotation: -270, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(4.604066851712166, 28.560190151048843), + const LatLng(-1.7328131384321388, 34.902297195325865), + ), + expectedCenter: const LatLng(1.4280748738291607, 31.75048799999998), + expectedZoom: 5.470747058151092, + ); + await testFitBounds( + rotation: -260, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(5.541088725565424, 27.627083898129182), + const LatLng(-2.6792328593981165, 35.857040199237275), + ), + expectedCenter: const LatLng(1.4280748738291098, 31.75048799999998), + expectedZoom: 5.307027678829735, + ); + await testFitBounds( + rotation: -250, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.326699533074719, 26.825437506743075), + const LatLng(-3.464069668300576, 36.631215227750594), + ), + expectedCenter: const LatLng(1.4280748738291735, 31.75048799999998), + expectedZoom: 5.2001502130127335, + ); + await testFitBounds( + rotation: -240, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.862564855410326, 26.292484184305955), + const LatLng(-3.9972253151865824, 37.17198816839402), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.142152721635507, + ); + await testFitBounds( + rotation: -230, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.078818186959047, 26.05234612215487), + const LatLng(-4.2209087393533515, 37.37397397866511), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.129199421141872, + ); + await testFitBounds( + rotation: -220, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.0788181869584115, 26.052346122155633), + const LatLng(-4.220908739354, 37.373973978665916), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.129199421141867, + ); + await testFitBounds( + rotation: -210, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.862564855410428, 26.292484184305835), + const LatLng(-3.997225315186455, 37.17198816839391), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.142152721635508, + ); + await testFitBounds( + rotation: -200, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.326699533075355, 26.82543750674231), + const LatLng(-3.4640696682999015, 36.63121522774979), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.200150213012739, + ); + await testFitBounds( + rotation: -190, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(5.541088725566404, 27.627083898128024), + const LatLng(-2.679232859397111, 35.857040199236074), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.307027678829743, + ); + await testFitBounds( + rotation: -180, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(4.6040668517126235, 28.560190151048324), + const LatLng(-1.7328131384316936, 34.9022971953253), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999994), + expectedZoom: 5.470747058151096, + ); + await testFitBounds( + rotation: -170, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(5.54108872556587, 27.627083898128667), + const LatLng(-2.679232859397671, 35.85704019923676), + ), + expectedCenter: const LatLng(1.4280748738291607, 31.75048799999998), + expectedZoom: 5.307027678829739, + ); + await testFitBounds( + rotation: -160, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.326699533074287, 26.825437506743594), + const LatLng(-3.464069668301021, 36.631215227751156), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.20015021301273, + ); + await testFitBounds( + rotation: -150, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.862564855411076, 26.292484184305035), + const LatLng(-3.997225315185781, 37.171988168393064), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.142152721635513, + ); + await testFitBounds( + rotation: -140, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.078818186958641, 26.052346122155353), + const LatLng(-4.2209087393537965, 37.37397397866564), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999994), + expectedZoom: 5.129199421141869, + ); + await testFitBounds( + rotation: -130, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.0788181869585385, 26.052346122155512), + const LatLng(-4.220908739353911, 37.37397397866575), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.129199421141868, + ); + await testFitBounds( + rotation: -120, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.862564855410096, 26.292484184306193), + const LatLng(-3.997225315186811, 37.17198816839431), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.142152721635505, + ); + await testFitBounds( + rotation: -110, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.326699533075355, 26.82543750674231), + const LatLng(-3.4640696682999015, 36.63121522774979), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.200150213012739, + ); + await testFitBounds( + rotation: -100, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(5.541088725566404, 27.627083898128024), + const LatLng(-2.679232859397111, 35.857040199236074), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.307027678829743, + ); + await testFitBounds( + rotation: -90, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(4.604066851712751, 28.560190151048204), + const LatLng(-1.732813138431579, 34.90229719532515), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.470747058151097, + ); + await testFitBounds( + rotation: -80, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(5.541088725565997, 27.627083898128507), + const LatLng(-2.6792328593975183, 35.85704019923659), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.30702767882974, + ); + await testFitBounds( + rotation: -70, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.326699533074184, 26.825437506743715), + const LatLng(-3.4640696683011356, 36.63121522775128), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999994), + expectedZoom: 5.200150213012729, + ); + await testFitBounds( + rotation: -60, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.8625648554105165, 26.292484184305717), + const LatLng(-3.9972253151863786, 37.17198816839379), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.142152721635509, + ); + await testFitBounds( + rotation: -50, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.078818186958641, 26.052346122155353), + const LatLng(-4.2209087393537965, 37.37397397866564), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999994), + expectedZoom: 5.129199421141869, + ); + await testFitBounds( + rotation: -40, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.0788181869585385, 26.052346122155512), + const LatLng(-4.220908739353911, 37.37397397866575), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.129199421141868, + ); + await testFitBounds( + rotation: -30, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.862564855410008, 26.292484184306353), + const LatLng(-3.9972253151869386, 37.17198816839443), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.1421527216355045, + ); + await testFitBounds( + rotation: -20, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.326699533075266, 26.825437506742436), + const LatLng(-3.464069668300029, 36.63121522774991), + ), + expectedCenter: const LatLng(1.4280748738291607, 31.75048799999998), + expectedZoom: 5.200150213012738, + ); + await testFitBounds( + rotation: -10, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(5.541088725566404, 27.627083898128024), + const LatLng(-2.679232859397111, 35.857040199236074), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.307027678829743, + ); + await testFitBounds( + rotation: 0, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(4.604066851712751, 28.560190151048204), + const LatLng(-1.732813138431579, 34.90229719532515), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.470747058151097, + ); + await testFitBounds( + rotation: 10, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(5.541088725565997, 27.627083898128507), + const LatLng(-2.6792328593975183, 35.85704019923659), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.30702767882974, + ); + await testFitBounds( + rotation: 20, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.326699533074184, 26.825437506743715), + const LatLng(-3.4640696683011356, 36.63121522775128), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999994), + expectedZoom: 5.200150213012729, + ); + await testFitBounds( + rotation: 30, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.8625648554105165, 26.292484184305717), + const LatLng(-3.9972253151863786, 37.17198816839379), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.142152721635509, + ); + await testFitBounds( + rotation: 40, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.078818186958641, 26.052346122155353), + const LatLng(-4.2209087393537965, 37.37397397866564), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999994), + expectedZoom: 5.129199421141869, + ); + await testFitBounds( + rotation: 50, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.0788181869585385, 26.052346122155512), + const LatLng(-4.220908739353911, 37.37397397866575), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.129199421141868, + ); + await testFitBounds( + rotation: 60, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.862564855410008, 26.292484184306353), + const LatLng(-3.9972253151869386, 37.17198816839443), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.1421527216355045, + ); + await testFitBounds( + rotation: 70, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.326699533075266, 26.825437506742436), + const LatLng(-3.464069668300029, 36.63121522774991), + ), + expectedCenter: const LatLng(1.4280748738291607, 31.75048799999998), + expectedZoom: 5.200150213012738, + ); + await testFitBounds( + rotation: 80, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(5.541088725566404, 27.627083898128024), + const LatLng(-2.679232859397111, 35.857040199236074), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.307027678829743, + ); + await testFitBounds( + rotation: 90, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(4.604066851712751, 28.560190151048204), + const LatLng(-1.732813138431579, 34.90229719532515), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.470747058151097, + ); + await testFitBounds( + rotation: 100, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(5.541088725565997, 27.627083898128507), + const LatLng(-2.6792328593975183, 35.85704019923659), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.30702767882974, + ); + await testFitBounds( + rotation: 110, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.326699533074184, 26.825437506743715), + const LatLng(-3.4640696683011356, 36.63121522775128), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999994), + expectedZoom: 5.200150213012729, + ); + await testFitBounds( + rotation: 120, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.8625648554105165, 26.292484184305717), + const LatLng(-3.9972253151863786, 37.17198816839379), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.142152721635509, + ); + await testFitBounds( + rotation: 130, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.078818186958641, 26.052346122155353), + const LatLng(-4.2209087393537965, 37.37397397866564), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999994), + expectedZoom: 5.129199421141869, + ); + await testFitBounds( + rotation: 140, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.0788181869585385, 26.052346122155512), + const LatLng(-4.220908739353911, 37.37397397866575), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.129199421141868, + ); + await testFitBounds( + rotation: 150, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.862564855410008, 26.292484184306353), + const LatLng(-3.9972253151869386, 37.17198816839443), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.1421527216355045, + ); + await testFitBounds( + rotation: 160, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.326699533075266, 26.825437506742436), + const LatLng(-3.464069668300029, 36.63121522774991), + ), + expectedCenter: const LatLng(1.4280748738291607, 31.75048799999998), + expectedZoom: 5.200150213012738, + ); + await testFitBounds( + rotation: 170, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(5.541088725566404, 27.627083898128024), + const LatLng(-2.679232859397111, 35.857040199236074), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.307027678829743, + ); + await testFitBounds( + rotation: 180, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(4.6040668517126235, 28.560190151048324), + const LatLng(-1.7328131384316936, 34.9022971953253), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999994), + expectedZoom: 5.470747058151096, + ); + await testFitBounds( + rotation: 190, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(5.54108872556587, 27.627083898128667), + const LatLng(-2.679232859397671, 35.85704019923676), + ), + expectedCenter: const LatLng(1.4280748738291607, 31.75048799999998), + expectedZoom: 5.307027678829739, + ); + await testFitBounds( + rotation: 200, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.326699533074287, 26.825437506743594), + const LatLng(-3.464069668301021, 36.631215227751156), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.20015021301273, + ); + await testFitBounds( + rotation: 210, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.862564855411076, 26.292484184305035), + const LatLng(-3.997225315185781, 37.171988168393064), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.142152721635513, + ); + await testFitBounds( + rotation: 220, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.078818186958641, 26.052346122155353), + const LatLng(-4.2209087393537965, 37.37397397866564), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999994), + expectedZoom: 5.129199421141869, + ); + await testFitBounds( + rotation: 230, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.0788181869585385, 26.052346122155512), + const LatLng(-4.220908739353911, 37.37397397866575), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.129199421141868, + ); + await testFitBounds( + rotation: 240, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.862564855410008, 26.292484184306353), + const LatLng(-3.9972253151869386, 37.17198816839443), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.1421527216355045, + ); + await testFitBounds( + rotation: 250, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.326699533075266, 26.825437506742436), + const LatLng(-3.464069668300029, 36.63121522774991), + ), + expectedCenter: const LatLng(1.4280748738291607, 31.75048799999998), + expectedZoom: 5.200150213012738, + ); + await testFitBounds( + rotation: 260, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(5.541088725566404, 27.627083898128024), + const LatLng(-2.679232859397111, 35.857040199236074), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.307027678829743, + ); + await testFitBounds( + rotation: 270, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(4.6040668517126235, 28.560190151048324), + const LatLng(-1.7328131384316936, 34.9022971953253), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999994), + expectedZoom: 5.470747058151096, + ); + await testFitBounds( + rotation: 280, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(5.54108872556587, 27.627083898128667), + const LatLng(-2.679232859397671, 35.85704019923676), + ), + expectedCenter: const LatLng(1.4280748738291607, 31.75048799999998), + expectedZoom: 5.307027678829739, + ); + await testFitBounds( + rotation: 290, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.326699533074287, 26.825437506743594), + const LatLng(-3.464069668301021, 36.631215227751156), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.20015021301273, + ); + await testFitBounds( + rotation: 300, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.862564855411076, 26.292484184305035), + const LatLng(-3.997225315185781, 37.171988168393064), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.142152721635513, + ); + await testFitBounds( + rotation: 310, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.0788181869585385, 26.052346122155512), + const LatLng(-4.220908739353911, 37.37397397866575), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.129199421141868, + ); + await testFitBounds( + rotation: 320, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.0788181869579025, 26.05234612215623), + const LatLng(-4.220908739354547, 37.373973978666555), + ), + expectedCenter: const LatLng(1.4280748738291098, 31.75048799999998), + expectedZoom: 5.129199421141863, + ); + await testFitBounds( + rotation: 330, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.862564855410669, 26.292484184305554), + const LatLng(-3.9972253151862134, 37.17198816839358), + ), + expectedCenter: const LatLng(1.4280748738291353, 31.75048799999998), + expectedZoom: 5.14215272163551, + ); + await testFitBounds( + rotation: 340, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.326699533074719, 26.825437506743075), + const LatLng(-3.464069668300576, 36.631215227750594), + ), + expectedCenter: const LatLng(1.4280748738291735, 31.75048799999998), + expectedZoom: 5.2001502130127335, + ); + await testFitBounds( + rotation: 350, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(5.541088725565768, 27.627083898128788), + const LatLng(-2.67923285939776, 35.85704019923688), + ), + expectedCenter: const LatLng(1.4280748738291607, 31.75048799999994), + expectedZoom: 5.307027678829738, + ); + await testFitBounds( + rotation: 360, + options: const FitBoundsOptions(padding: symmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(4.604066851711988, 28.56019015104908), + const LatLng(-1.7328131384323806, 34.902297195326106), + ), + expectedCenter: const LatLng(1.4280748738291607, 31.75048799999998), + expectedZoom: 5.47074705815109, + ); + + // Tests with asymmetric padding + + const asymmetricPadding = EdgeInsets.fromLTRB(12, 12, 24, 24); + + await testFitBounds( + rotation: -360, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(4.634132562246874, 28.54085445883965), + const LatLng(-2.1664538621122844, 35.34701811611249), + ), + expectedCenter: const LatLng(1.2239447514276816, 31.954672909718134), + expectedZoom: 5.368867444131886, + ); + await testFitBounds( + rotation: -350, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(5.660540026784471, 27.571171071640066), + const LatLng(-3.1607730111546735, 36.40331929721947), + ), + expectedCenter: const LatLng(1.242595236773053, 32.01545244676736), + expectedZoom: 5.205148064810527, + ); + await testFitBounds( + rotation: -340, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.54968145744685, 26.76991163607834), + const LatLng(-3.9561333978424402, 37.29318528789126), + ), + expectedCenter: const LatLng(1.2809035554895796, 32.06618620955434), + expectedZoom: 5.09827059899352, + ); + await testFitBounds( + rotation: -330, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.1843462799293905, 26.25867685916364), + const LatLng(-4.467783700569267, 37.93424211038007), + ), + expectedCenter: const LatLng(1.3342484033566948, 32.10075495753643), + expectedZoom: 5.040273107616296, + ); + await testFitBounds( + rotation: -320, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.489680258264411, 26.037009155250715), + const LatLng(-4.633877724423506, 38.187048806139785), + ), + expectedCenter: const LatLng(1.39619483745402, 32.114989189526646), + expectedZoom: 5.027319807122656, + ); + await testFitBounds( + rotation: -310, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.532431229986924, 26.03700915525127), + const LatLng(-4.590896406541693, 38.18704880614038), + ), + expectedCenter: const LatLng(1.4599544679956014, 32.11498918952669), + expectedZoom: 5.027319807122653, + ); + await testFitBounds( + rotation: -300, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.353914452121884, 26.258676859164435), + const LatLng(-4.297341450189851, 37.9342421103809), + ), + expectedCenter: const LatLng(1.5218975140385778, 32.10075495753647), + expectedZoom: 5.040273107616291, + ); + await testFitBounds( + rotation: -290, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.835084364918724, 26.76991163607846), + const LatLng(-3.6694084778488008, 37.29318528789139), + ), + expectedCenter: const LatLng(1.5752367686310453, 32.06618620955438), + expectedZoom: 5.098270598993519, + ); + await testFitBounds( + rotation: -280, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.039757427578975, 27.571171071639785), + const LatLng(-2.7800824328511253, 36.403319297219184), + ), + expectedCenter: const LatLng(1.6135395432667161, 32.01545244676736), + expectedZoom: 5.205148064810529, + ); + await testFitBounds( + rotation: -270, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(5.041046797566279, 28.540854458839487), + const LatLng(-1.7583244079256857, 35.347018116112324), + ), + expectedCenter: const LatLng(1.6321868673570248, 31.954672909718177), + expectedZoom: 5.368867444131887, + ); + await testFitBounds( + rotation: -260, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.115569587879605, 27.494930379251944), + const LatLng(-2.703929036276337, 36.32707860483131), + ), + expectedCenter: const LatLng(1.6929408152064371, 31.936018102984026), + expectedZoom: 5.205148064810529, + ); + await testFitBounds( + rotation: -250, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.998095725135421, 26.60570520938884), + const LatLng(-3.5055238797490254, 37.12897886120173), + ), + expectedCenter: const LatLng(1.7436517631793655, 31.897700492780995), + expectedZoom: 5.098270598993524, + ); + await testFitBounds( + rotation: -240, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.6081448623143, 26.00226365003461), + const LatLng(-4.041607090303907, 37.677828901251075), + ), + expectedCenter: const LatLng(1.7782041854790855, 31.844341748407157), + expectedZoom: 5.0402731076162945, + ); + await testFitBounds( + rotation: -230, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.874285213097485, 25.692041431761353), + const LatLng(-4.2469546716806, 37.842081082650424), + ), + expectedCenter: const LatLng(1.7924315078035666, 31.782377721925275), + expectedZoom: 5.027319807122654, + ); + await testFitBounds( + rotation: -220, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.874285213097078, 25.605799500889418), + const LatLng(-4.246954671681046, 37.75583915177857), + ), + expectedCenter: const LatLng(1.7924315078036048, 31.718598278074644), + expectedZoom: 5.027319807122651, + ); + await testFitBounds( + rotation: -210, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.608144862314071, 25.788585975760473), + const LatLng(-4.041607090304137, 37.46415122697694), + ), + expectedCenter: const LatLng(1.7782041854790855, 31.656634251592763), + expectedZoom: 5.040273107616293, + ); + await testFitBounds( + rotation: -200, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.998095725134989, 26.31834396268385), + const LatLng(-3.5055238797494703, 36.841617614496776), + ), + expectedCenter: const LatLng(1.7436517631794035, 31.603275507218967), + expectedZoom: 5.098270598993521, + ); + await testFitBounds( + rotation: -190, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.1155695878797065, 27.11372691731255), + const LatLng(-2.703929036276248, 35.94587514289191), + ), + expectedCenter: const LatLng(1.6929408152064371, 31.564957897015862), + expectedZoom: 5.20514806481053, + ); + await testFitBounds( + rotation: -180, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(5.041046797566381, 28.132484639403017), + const LatLng(-1.7583244079256093, 34.93864829667586), + ), + expectedCenter: const LatLng(1.63218686735705, 31.546303090281786), + expectedZoom: 5.3688674441318875, + ); + await testFitBounds( + rotation: -170, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.039757427578097, 27.037486224925832), + const LatLng(-2.780082432852041, 35.869634450505266), + ), + expectedCenter: const LatLng(1.6135395432667161, 31.485523553232603), + expectedZoom: 5.205148064810522, + ); + await testFitBounds( + rotation: -160, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.835084364918495, 26.15413753599551), + const LatLng(-3.6694084778489917, 36.67741118780848), + ), + expectedCenter: const LatLng(1.5752367686310453, 31.434789790445585), + expectedZoom: 5.098270598993517, + ); + await testFitBounds( + rotation: -150, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.353914452122216, 25.532172766631046), + const LatLng(-4.297341450189495, 37.207738017847504), + ), + expectedCenter: const LatLng(1.5218975140386541, 31.40022104246349), + expectedZoom: 5.040273107616294, + ); + await testFitBounds( + rotation: -140, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.532431229987661, 25.303952742834888), + const LatLng(-4.5908964065408915, 37.453992393723915), + ), + expectedCenter: const LatLng(1.4599544679955887, 31.385986810473277), + expectedZoom: 5.027319807122659, + ); + await testFitBounds( + rotation: -130, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.489680258263851, 25.303952742835886), + const LatLng(-4.633877724424105, 37.453992393724995), + ), + expectedCenter: const LatLng(1.39619483745402, 31.385986810473316), + expectedZoom: 5.027319807122652, + ); + await testFitBounds( + rotation: -120, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.184346279929569, 25.53217276663045), + const LatLng(-4.467783700569064, 37.207738017846864), + ), + expectedCenter: const LatLng(1.334248403356733, 31.400221042463446), + expectedZoom: 5.040273107616298, + ); + await testFitBounds( + rotation: -110, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.549681457446634, 26.154137535995396), + const LatLng(-3.9561333978426823, 36.67741118780832), + ), + expectedCenter: const LatLng(1.2809035554895796, 31.434789790445585), + expectedZoom: 5.098270598993518, + ); + await testFitBounds( + rotation: -100, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(5.660540026784712, 27.03748622492479), + const LatLng(-3.1607730111544443, 35.869634450504186), + ), + expectedCenter: const LatLng(1.2425952367730149, 31.48552355323256), + expectedZoom: 5.205148064810529, + ); + await testFitBounds( + rotation: -90, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(4.634132562247001, 28.13248463940314), + const LatLng(-2.1664538621121574, 34.93864829667597), + ), + expectedCenter: const LatLng(1.223944751427669, 31.546303090281786), + expectedZoom: 5.368867444131887, + ); + await testFitBounds( + rotation: -80, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(5.5846661472659775, 27.11372691731267), + const LatLng(-3.23689490728696, 35.945875142892035), + ), + expectedCenter: const LatLng(1.1631784045348394, 31.564957897015898), + expectedZoom: 5.205148064810529, + ); + await testFitBounds( + rotation: -70, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.386520306045658, 26.318343962683333), + const LatLng(-4.119932130068094, 36.84161761449626), + ), + expectedCenter: const LatLng(1.1124546469064802, 31.603275507218928), + expectedZoom: 5.098270598993524, + ); + await testFitBounds( + rotation: -60, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.929875826124592, 25.788585975760196), + const LatLng(-4.723372343263628, 37.46415122697666), + ), + expectedCenter: const LatLng(1.0778922142686074, 31.656634251592763), + expectedZoom: 5.0402731076162945, + ); + await testFitBounds( + rotation: -50, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.147523464731419, 25.605799500888935), + const LatLng(-4.977632173560321, 37.75583915177801), + ), + expectedCenter: const LatLng(1.0636604679862347, 31.718598278074644), + expectedZoom: 5.027319807122654, + ); + await testFitBounds( + rotation: -40, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.147523464730987, 25.69204143176183), + const LatLng(-4.977632173560804, 37.84208108265094), + ), + expectedCenter: const LatLng(1.0636604679862858, 31.78237772192524), + expectedZoom: 5.027319807122651, + ); + await testFitBounds( + rotation: -30, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.9298758261243885, 26.00226365003489), + const LatLng(-4.723372343263869, 37.677828901251345), + ), + expectedCenter: const LatLng(1.0778922142686453, 31.8443417484072), + expectedZoom: 5.040273107616293, + ); + await testFitBounds( + rotation: -20, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.386520306045212, 26.605705209389363), + const LatLng(-4.119932130068564, 37.12897886120229), + ), + expectedCenter: const LatLng(1.1124546469064802, 31.897700492781038), + expectedZoom: 5.098270598993521, + ); + await testFitBounds( + rotation: -10, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(5.584666147266067, 27.49493037925183), + const LatLng(-3.2368949072868327, 36.327078604831186), + ), + expectedCenter: const LatLng(1.163178404534865, 31.936018102984065), + expectedZoom: 5.20514806481053, + ); + await testFitBounds( + rotation: 0, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(4.63413256224709, 28.540854458839405), + const LatLng(-2.166453862112043, 35.347018116112245), + ), + expectedCenter: const LatLng(1.223944751427669, 31.954672909718177), + expectedZoom: 5.3688674441318875, + ); + await testFitBounds( + rotation: 10, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(5.6605400267838215, 27.571171071640826), + const LatLng(-3.1607730111553605, 36.403319297220264), + ), + expectedCenter: const LatLng(1.242595236773053, 32.01545244676732), + expectedZoom: 5.205148064810522, + ); + await testFitBounds( + rotation: 20, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.549681457446519, 26.7699116360787), + const LatLng(-3.956133397842797, 37.29318528789166), + ), + expectedCenter: const LatLng(1.2809035554896178, 32.06618620955438), + expectedZoom: 5.098270598993517, + ); + await testFitBounds( + rotation: 30, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.184346279929048, 26.25867685916404), + const LatLng(-4.4677837005696235, 37.9342421103805), + ), + expectedCenter: const LatLng(1.3342484033567583, 32.10075495753647), + expectedZoom: 5.040273107616294, + ); + await testFitBounds( + rotation: 40, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.489680258264703, 26.037009155250352), + const LatLng(-4.633877724423188, 38.18704880613942), + ), + expectedCenter: const LatLng(1.396194837454071, 32.11498918952661), + expectedZoom: 5.027319807122659, + ); + await testFitBounds( + rotation: 50, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.532431229986809, 26.03700915525139), + const LatLng(-4.590896406541807, 38.1870488061405), + ), + expectedCenter: const LatLng(1.4599544679956014, 32.114989189526646), + expectedZoom: 5.027319807122652, + ); + await testFitBounds( + rotation: 60, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.353914452122737, 26.258676859163398), + const LatLng(-4.297341450188935, 37.93424211037982), + ), + expectedCenter: const LatLng(1.521897514038616, 32.10075495753647), + expectedZoom: 5.040273107616298, + ); + await testFitBounds( + rotation: 70, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.835084364918597, 26.769911636078582), + const LatLng(-3.6694084778489153, 37.293185287891546), + ), + expectedCenter: const LatLng(1.5752367686310962, 32.06618620955434), + expectedZoom: 5.098270598993518, + ); + await testFitBounds( + rotation: 80, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.039757427578975, 27.571171071639785), + const LatLng(-2.7800824328511253, 36.403319297219184), + ), + expectedCenter: const LatLng(1.6135395432667161, 32.01545244676732), + expectedZoom: 5.205148064810529, + ); + await testFitBounds( + rotation: 90, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(5.041046797566279, 28.540854458839487), + const LatLng(-1.7583244079256857, 35.347018116112324), + ), + expectedCenter: const LatLng(1.6321868673570248, 31.954672909718177), + expectedZoom: 5.368867444131887, + ); + await testFitBounds( + rotation: 100, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.115569587879605, 27.494930379251944), + const LatLng(-2.703929036276337, 36.32707860483131), + ), + expectedCenter: const LatLng(1.6929408152064371, 31.936018102984065), + expectedZoom: 5.205148064810529, + ); + await testFitBounds( + rotation: 110, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.998095725135421, 26.60570520938884), + const LatLng(-3.5055238797490254, 37.12897886120173), + ), + expectedCenter: const LatLng(1.7436517631793274, 31.897700492781038), + expectedZoom: 5.098270598993524, + ); + await testFitBounds( + rotation: 120, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.6081448623143, 26.00226365003461), + const LatLng(-4.041607090303907, 37.677828901251075), + ), + expectedCenter: const LatLng(1.7782041854790855, 31.8443417484072), + expectedZoom: 5.0402731076162945, + ); + await testFitBounds( + rotation: 130, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.874285213097485, 25.692041431761353), + const LatLng(-4.2469546716806, 37.842081082650424), + ), + expectedCenter: const LatLng(1.7924315078035666, 31.782377721925275), + expectedZoom: 5.027319807122654, + ); + await testFitBounds( + rotation: 140, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.874285213097078, 25.605799500889418), + const LatLng(-4.246954671681046, 37.75583915177857), + ), + expectedCenter: const LatLng(1.792431507803541, 31.718598278074683), + expectedZoom: 5.027319807122651, + ); + await testFitBounds( + rotation: 150, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.608144862314071, 25.788585975760473), + const LatLng(-4.041607090304137, 37.46415122697694), + ), + expectedCenter: const LatLng(1.7782041854790855, 31.656634251592763), + expectedZoom: 5.040273107616293, + ); + await testFitBounds( + rotation: 160, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.998095725134989, 26.31834396268385), + const LatLng(-3.5055238797494703, 36.841617614496776), + ), + expectedCenter: const LatLng(1.7436517631794035, 31.603275507218928), + expectedZoom: 5.098270598993521, + ); + await testFitBounds( + rotation: 170, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.1155695878797065, 27.11372691731255), + const LatLng(-2.703929036276248, 35.94587514289191), + ), + expectedCenter: const LatLng(1.6929408152064371, 31.564957897015862), + expectedZoom: 5.20514806481053, + ); + await testFitBounds( + rotation: 180, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(5.041046797566381, 28.132484639403017), + const LatLng(-1.7583244079256093, 34.93864829667586), + ), + expectedCenter: const LatLng(1.63218686735705, 31.546303090281786), + expectedZoom: 5.3688674441318875, + ); + await testFitBounds( + rotation: 190, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.039757427578097, 27.037486224925832), + const LatLng(-2.780082432852041, 35.869634450505266), + ), + expectedCenter: const LatLng(1.6135395432667161, 31.485523553232603), + expectedZoom: 5.205148064810522, + ); + await testFitBounds( + rotation: 200, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.835084364918495, 26.15413753599551), + const LatLng(-3.6694084778489917, 36.67741118780848), + ), + expectedCenter: const LatLng(1.5752367686310071, 31.434789790445585), + expectedZoom: 5.098270598993517, + ); + await testFitBounds( + rotation: 210, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.353914452122216, 25.532172766631046), + const LatLng(-4.297341450189495, 37.207738017847504), + ), + expectedCenter: const LatLng(1.521897514038616, 31.40022104246349), + expectedZoom: 5.040273107616294, + ); + await testFitBounds( + rotation: 220, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.532431229987661, 25.303952742834888), + const LatLng(-4.5908964065408915, 37.453992393723915), + ), + expectedCenter: const LatLng(1.459954467995627, 31.385986810473234), + expectedZoom: 5.027319807122659, + ); + await testFitBounds( + rotation: 230, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.489680258263851, 25.303952742835886), + const LatLng(-4.633877724424105, 37.453992393724995), + ), + expectedCenter: const LatLng(1.39619483745402, 31.385986810473316), + expectedZoom: 5.027319807122652, + ); + await testFitBounds( + rotation: 240, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.184346279929569, 25.53217276663045), + const LatLng(-4.467783700569064, 37.207738017846864), + ), + expectedCenter: const LatLng(1.334248403356733, 31.40022104246349), + expectedZoom: 5.040273107616298, + ); + await testFitBounds( + rotation: 250, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.549681457446634, 26.154137535995396), + const LatLng(-3.9561333978426823, 36.67741118780832), + ), + expectedCenter: const LatLng(1.2809035554895796, 31.434789790445542), + expectedZoom: 5.098270598993518, + ); + await testFitBounds( + rotation: 260, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(5.660540026784712, 27.03748622492479), + const LatLng(-3.1607730111544443, 35.869634450504186), + ), + expectedCenter: const LatLng(1.2425952367730149, 31.48552355323256), + expectedZoom: 5.205148064810529, + ); + await testFitBounds( + rotation: 270, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(4.634132562247001, 28.13248463940314), + const LatLng(-2.1664538621121574, 34.93864829667597), + ), + expectedCenter: const LatLng(1.223944751427669, 31.546303090281786), + expectedZoom: 5.368867444131887, + ); + await testFitBounds( + rotation: 280, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(5.584666147266067, 27.11372691731255), + const LatLng(-3.2368949072868327, 35.94587514289191), + ), + expectedCenter: const LatLng(1.163178404534865, 31.564957897015898), + expectedZoom: 5.20514806481053, + ); + await testFitBounds( + rotation: 290, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.386520306045429, 26.31834396268357), + const LatLng(-4.119932130068322, 36.84161761449649), + ), + expectedCenter: const LatLng(1.1124546469064802, 31.603275507218967), + expectedZoom: 5.098270598993523, + ); + await testFitBounds( + rotation: 300, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.929875826125113, 25.788585975759595), + const LatLng(-4.7233723432630805, 37.46415122697602), + ), + expectedCenter: const LatLng(1.0778922142686453, 31.6566342515928), + expectedZoom: 5.040273107616299, + ); + await testFitBounds( + rotation: 310, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.147523464730655, 25.605799500889855), + const LatLng(-4.97763217356116, 37.755839151778964), + ), + expectedCenter: const LatLng(1.063660467986222, 31.718598278074683), + expectedZoom: 5.027319807122648, + ); + await testFitBounds( + rotation: 320, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(7.147523464731164, 25.69204143176163), + const LatLng(-4.9776321735606, 37.842081082650715), + ), + expectedCenter: const LatLng(1.0636604679862602, 31.782377721925275), + expectedZoom: 5.027319807122653, + ); + await testFitBounds( + rotation: 330, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.9298758261241336, 26.00226365003513), + const LatLng(-4.723372343264111, 37.67782890125163), + ), + expectedCenter: const LatLng(1.0778922142686453, 31.8443417484072), + expectedZoom: 5.040273107616291, + ); + await testFitBounds( + rotation: 340, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(6.386520306045009, 26.6057052093896), + const LatLng(-4.119932130068768, 37.128978861202526), + ), + expectedCenter: const LatLng(1.1124546469065184, 31.897700492780995), + expectedZoom: 5.098270598993519, + ); + await testFitBounds( + rotation: 350, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(5.584666147265863, 27.494930379252068), + const LatLng(-3.2368949072870747, 36.32707860483143), + ), + expectedCenter: const LatLng(1.1631784045348394, 31.936018102984065), + expectedZoom: 5.205148064810528, + ); + await testFitBounds( + rotation: 360, + options: const FitBoundsOptions(padding: asymmetricPadding), + expectedBounds: LatLngBounds( + const LatLng(4.634132562246874, 28.54085445883965), + const LatLng(-2.1664538621122844, 35.34701811611249), + ), + expectedCenter: const LatLng(1.2239447514276816, 31.954672909718134), + expectedZoom: 5.368867444131886, + ); + }); }