Skip to content

Commit

Permalink
test: update tests and format
Browse files Browse the repository at this point in the history
  • Loading branch information
illuminati1911 authored and jokerttu committed Feb 14, 2025
1 parent ee8246b commit 5d840f9
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 16 deletions.
3 changes: 2 additions & 1 deletion lib/src/google_maps_map_view_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ class GoogleMapViewController {

// Gets the map padding from the map view.
Future<EdgeInsets> getPadding() async {
return GoogleMapsNavigationPlatform.instance.viewAPI.getPadding(viewId: _viewId);
return GoogleMapsNavigationPlatform.instance.viewAPI
.getPadding(viewId: _viewId);
}
}
44 changes: 29 additions & 15 deletions test/google_navigation_flutter_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,18 @@ void main() {

final List<GoogleMapsNavigationPlatform> platforms =
<GoogleMapsNavigationPlatform>[
GoogleMapsNavigationAndroid(),
GoogleMapsNavigationIOS(),
GoogleMapsNavigationAndroid(
AndroidNavigationSessionAPIImpl(),
MapViewAPIImpl(),
AutoMapViewAPIImpl(),
ImageRegistryAPIImpl(),
),
GoogleMapsNavigationIOS(
NavigationSessionAPIImpl(),
MapViewAPIImpl(),
AutoMapViewAPIImpl(),
ImageRegistryAPIImpl(),
),
];

setUp(() {
Expand Down Expand Up @@ -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 =
Expand Down Expand Up @@ -947,8 +958,9 @@ void main() {
.thenAnswer((Invocation _) => <MarkerDto>[messageMarker]);

// Get markers
final List<Marker?> markersOut =
await GoogleMapsNavigationPlatform.instance.getMarkers(viewId: 0);
final List<Marker?> markersOut = await GoogleMapsNavigationPlatform
.instance.viewAPI
.getMarkers(viewId: 0);

// Verify correct message sent from view api
final VerificationResult result =
Expand Down Expand Up @@ -981,7 +993,7 @@ void main() {

// Add marker
final List<Marker?> markersOut = await GoogleMapsNavigationPlatform
.instance
.instance.viewAPI
.addMarkers(viewId: 0, markerOptions: <MarkerOptions>[optionsIn]);

// Verify correct message sent from view api
Expand Down Expand Up @@ -1009,7 +1021,7 @@ void main() {

// Edit marker
final List<Marker?> markersOut = await GoogleMapsNavigationPlatform
.instance
.instance.viewAPI
.updateMarkers(viewId: 0, markers: <Marker>[marker]);

// Verify correct message sent from view api
Expand All @@ -1035,7 +1047,7 @@ void main() {
.thenAnswer((Invocation _) => ());

// Remove marker
await GoogleMapsNavigationPlatform.instance
await GoogleMapsNavigationPlatform.instance.viewAPI
.removeMarkers(viewId: 0, markers: <Marker>[marker]);

// Verify correct message sent from view api
Expand All @@ -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 =
Expand All @@ -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 =
Expand All @@ -1096,7 +1109,7 @@ void main() {

// Get polygons
final List<Polygon?> polygonsOut = await GoogleMapsNavigationPlatform
.instance
.instance.viewAPI
.getPolygons(viewId: 0);

// Verify correct message sent from view api
Expand Down Expand Up @@ -1133,7 +1146,7 @@ void main() {

// Add polygon
final List<Polygon?> polygonsOut =
await GoogleMapsNavigationPlatform.instance.addPolygons(
await GoogleMapsNavigationPlatform.instance.viewAPI.addPolygons(
viewId: 0, polygonOptions: <PolygonOptions>[optionsIn]);

// Verify correct message sent from view api
Expand Down Expand Up @@ -1161,7 +1174,7 @@ void main() {

// Edit polygon
final List<Polygon?> polygonsOut = await GoogleMapsNavigationPlatform
.instance
.instance.viewAPI
.updatePolygons(viewId: 0, polygons: <Polygon>[polygon]);

// Verify correct message sent from view api
Expand All @@ -1187,7 +1200,7 @@ void main() {
.thenAnswer((Invocation _) async => ());

// Remove polygon
await GoogleMapsNavigationPlatform.instance
await GoogleMapsNavigationPlatform.instance.viewAPI
.removePolygons(viewId: 0, polygons: <Polygon>[polygon]);

// Verify correct message sent from view api
Expand All @@ -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 =
Expand Down

0 comments on commit 5d840f9

Please sign in to comment.