diff --git a/maps-app/src/androidTest/java/com/google/maps/android/compose/GoogleMapViewTests.kt b/maps-app/src/androidTest/java/com/google/maps/android/compose/GoogleMapViewTests.kt index abdd2a46..b5ab3a00 100644 --- a/maps-app/src/androidTest/java/com/google/maps/android/compose/GoogleMapViewTests.kt +++ b/maps-app/src/androidTest/java/com/google/maps/android/compose/GoogleMapViewTests.kt @@ -207,6 +207,22 @@ class GoogleMapViewTests { } } + @Test + fun testCameraZoomLevels() { + assertThat(cameraPositionState.minZoomLevel).isNull() + assertThat(cameraPositionState.maxZoomLevel).isNull() + + initMap() + + composeTestRule.runOnUiThread { + val minZoomLevel = cameraPositionState.minZoomLevel + val maxZoomLevel = cameraPositionState.maxZoomLevel + assertThat(minZoomLevel).isNotNull() + assertThat(maxZoomLevel).isNotNull() + assertThat(minZoomLevel!!).isAtMost(maxZoomLevel!!) + } + } + @Test(expected = IllegalStateException::class) fun testMarkerStateCannotBeReused() { initMap { @@ -314,4 +330,4 @@ class GoogleMapViewTests { assertionBlock() } -} \ No newline at end of file +} diff --git a/maps-compose/src/main/java/com/google/maps/android/compose/CameraPositionState.kt b/maps-compose/src/main/java/com/google/maps/android/compose/CameraPositionState.kt index 19f94035..f25e2dfd 100644 --- a/maps-compose/src/main/java/com/google/maps/android/compose/CameraPositionState.kt +++ b/maps-compose/src/main/java/com/google/maps/android/compose/CameraPositionState.kt @@ -112,6 +112,20 @@ public class CameraPositionState private constructor( public val projection: Projection? get() = map?.projection + /** + * The minimum zoom level for the currently bound map, or `null` if this state is not currently + * bound to a [GoogleMap]. + */ + public val minZoomLevel: Float? + get() = map?.minZoomLevel + + /** + * The maximum zoom level for the currently bound map, or `null` if this state is not currently + * bound to a [GoogleMap]. + */ + public val maxZoomLevel: Float? + get() = map?.maxZoomLevel + /** * Local source of truth for the current camera position. * While [map] is non-null this reflects the current position of [map] as it changes.