From 5d840f9fe3be25660a2a17c6c841fe2db5f07f76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20V=C3=A4limaa?= Date: Fri, 14 Feb 2025 14:05:47 +0800 Subject: [PATCH] test: update tests and format --- lib/src/google_maps_map_view_controller.dart | 3 +- test/google_navigation_flutter_test.dart | 44 +++++++++++++------- 2 files changed, 31 insertions(+), 16 deletions(-) diff --git a/lib/src/google_maps_map_view_controller.dart b/lib/src/google_maps_map_view_controller.dart index 5828e1c5..f7fe5398 100644 --- a/lib/src/google_maps_map_view_controller.dart +++ b/lib/src/google_maps_map_view_controller.dart @@ -384,6 +384,7 @@ class GoogleMapViewController { // Gets the map padding from the map view. Future getPadding() async { - return GoogleMapsNavigationPlatform.instance.viewAPI.getPadding(viewId: _viewId); + return GoogleMapsNavigationPlatform.instance.viewAPI + .getPadding(viewId: _viewId); } } diff --git a/test/google_navigation_flutter_test.dart b/test/google_navigation_flutter_test.dart index 1793b7a2..a8c4cd8f 100644 --- a/test/google_navigation_flutter_test.dart +++ b/test/google_navigation_flutter_test.dart @@ -35,8 +35,18 @@ void main() { final List platforms = [ - GoogleMapsNavigationAndroid(), - GoogleMapsNavigationIOS(), + GoogleMapsNavigationAndroid( + AndroidNavigationSessionAPIImpl(), + MapViewAPIImpl(), + AutoMapViewAPIImpl(), + ImageRegistryAPIImpl(), + ), + GoogleMapsNavigationIOS( + NavigationSessionAPIImpl(), + MapViewAPIImpl(), + AutoMapViewAPIImpl(), + ImageRegistryAPIImpl(), + ), ]; setUp(() { @@ -89,7 +99,8 @@ void main() { .thenAnswer((Invocation _) async => ()); // Await map ready - await GoogleMapsNavigationPlatform.instance.awaitMapReady(viewId: 0); + await GoogleMapsNavigationPlatform.instance.viewAPI + .awaitMapReady(viewId: 0); // Verify correct message sent from view api final VerificationResult result = @@ -947,8 +958,9 @@ void main() { .thenAnswer((Invocation _) => [messageMarker]); // Get markers - final List markersOut = - await GoogleMapsNavigationPlatform.instance.getMarkers(viewId: 0); + final List markersOut = await GoogleMapsNavigationPlatform + .instance.viewAPI + .getMarkers(viewId: 0); // Verify correct message sent from view api final VerificationResult result = @@ -981,7 +993,7 @@ void main() { // Add marker final List markersOut = await GoogleMapsNavigationPlatform - .instance + .instance.viewAPI .addMarkers(viewId: 0, markerOptions: [optionsIn]); // Verify correct message sent from view api @@ -1009,7 +1021,7 @@ void main() { // Edit marker final List markersOut = await GoogleMapsNavigationPlatform - .instance + .instance.viewAPI .updateMarkers(viewId: 0, markers: [marker]); // Verify correct message sent from view api @@ -1035,7 +1047,7 @@ void main() { .thenAnswer((Invocation _) => ()); // Remove marker - await GoogleMapsNavigationPlatform.instance + await GoogleMapsNavigationPlatform.instance.viewAPI .removeMarkers(viewId: 0, markers: [marker]); // Verify correct message sent from view api @@ -1054,7 +1066,8 @@ void main() { .thenAnswer((Invocation _) async => ()); // Clear map - await GoogleMapsNavigationPlatform.instance.clearMarkers(viewId: 0); + await GoogleMapsNavigationPlatform.instance.viewAPI + .clearMarkers(viewId: 0); // Verify correct message sent from view api final VerificationResult result = @@ -1070,7 +1083,7 @@ void main() { when(viewMockApi.clear(any)).thenAnswer((Invocation _) async => ()); // Clear map - await GoogleMapsNavigationPlatform.instance.clear(viewId: 0); + await GoogleMapsNavigationPlatform.instance.viewAPI.clear(viewId: 0); // Verify correct message sent from view api final VerificationResult result = @@ -1096,7 +1109,7 @@ void main() { // Get polygons final List polygonsOut = await GoogleMapsNavigationPlatform - .instance + .instance.viewAPI .getPolygons(viewId: 0); // Verify correct message sent from view api @@ -1133,7 +1146,7 @@ void main() { // Add polygon final List polygonsOut = - await GoogleMapsNavigationPlatform.instance.addPolygons( + await GoogleMapsNavigationPlatform.instance.viewAPI.addPolygons( viewId: 0, polygonOptions: [optionsIn]); // Verify correct message sent from view api @@ -1161,7 +1174,7 @@ void main() { // Edit polygon final List polygonsOut = await GoogleMapsNavigationPlatform - .instance + .instance.viewAPI .updatePolygons(viewId: 0, polygons: [polygon]); // Verify correct message sent from view api @@ -1187,7 +1200,7 @@ void main() { .thenAnswer((Invocation _) async => ()); // Remove polygon - await GoogleMapsNavigationPlatform.instance + await GoogleMapsNavigationPlatform.instance.viewAPI .removePolygons(viewId: 0, polygons: [polygon]); // Verify correct message sent from view api @@ -1206,7 +1219,8 @@ void main() { .thenAnswer((Invocation _) async => ()); // Clear map - await GoogleMapsNavigationPlatform.instance.clearPolygons(viewId: 0); + await GoogleMapsNavigationPlatform.instance.viewAPI + .clearPolygons(viewId: 0); // Verify correct message sent from view api final VerificationResult result =