Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,35 @@ class GoogleMapViewTests {
assertThat(cameraPositionState.position.target).isEqualTo(startingPosition)
}

@Test
fun testDefaultColorSchemeIsFollowSystem() {
var capturedOptions: GoogleMapOptions? = null
composeTestRule.setContent {
GoogleMap(
mapViewFactory = { context, options ->
capturedOptions = options
MapView(context, options)
}
)
}
assertThat(capturedOptions?.mapColorScheme).isEqualTo(MapColorScheme.FOLLOW_SYSTEM)
}

@Test
fun testDefaultColorSchemeWithGoogleMapOptionsFactory() {
var capturedOptions: GoogleMapOptions? = null
composeTestRule.setContent {
GoogleMap(
googleMapOptionsFactory = { GoogleMapOptions().liteMode(false) },
mapViewFactory = { context, options ->
capturedOptions = options
MapView(context, options)
}
)
}
assertThat(capturedOptions?.mapColorScheme).isEqualTo(MapColorScheme.FOLLOW_SYSTEM)
}

@Test
fun testRightInitialColorScheme() {
var capturedOptions: GoogleMapOptions? = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ import kotlinx.coroutines.launch
* @param onPOIClick lambda invoked when a POI is clicked
* @param contentPadding the padding values used to signal that portions of the map around the edges
* may be obscured. The map will move the Google logo, etc. to avoid overlapping the padding.
* @param mapColorScheme Defines the color scheme for the Map.
* @param mapColorScheme Defines the color scheme for the Map. Defaults to [ComposeMapColorScheme.FOLLOW_SYSTEM].
* @param content the content of the map
*/
@Composable
Expand All @@ -111,7 +111,7 @@ public fun GoogleMap(
onMyLocationClick: ((Location) -> Unit)? = null,
onPOIClick: ((PointOfInterest) -> Unit)? = null,
contentPadding: PaddingValues = DefaultMapContentPadding,
mapColorScheme: ComposeMapColorScheme? = null,
mapColorScheme: ComposeMapColorScheme? = ComposeMapColorScheme.FOLLOW_SYSTEM,
mapViewFactory: (Context, GoogleMapOptions) -> MapView = ::MapView,
content: @Composable @GoogleMapComposable () -> Unit = {},
) {
Expand Down