Skip to content

Instantly share code, notes, and snippets.

@alexvanyo
Created August 29, 2024 23:49
Show Gist options
  • Save alexvanyo/5ed675f77fac4b69b7ba778aaed1a110 to your computer and use it in GitHub Desktop.
Save alexvanyo/5ed675f77fac4b69b7ba778aaed1a110 to your computer and use it in GitHub Desktop.
/* Copyright 2024 Google LLC.
SPDX-License-Identifier: Apache-2.0 */
composeTestRule.setContent {
DeviceConfigurationOverride(
DeviceConfigurationOverride.WindowInsets(
WindowInsetsCompat.Builder()
.setInsets(
WindowInsetsCompat.Type.statusBars(),
DpRect(
left = 0.dp,
top = 64.dp,
right = 0.dp,
bottom = 0.dp,
).toAndroidXInsets(),
)
.setInsets(
WindowInsetsCompat.Type.navigationBars(),
DpRect(
left = 64.dp,
top = 0.dp,
right = 64.dp,
bottom = 64.dp,
).toInsets(),
)
.build(),
),
)
) {
Box {
content() // Your content under test
DebugVisibleWindowInsets(Modifier.fillMaxSize()) // Debug overlay (optional)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment