Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DeviceConfigurationOverride for insets to allow screenshot testing insets #1498

Merged
merged 1 commit into from
Jul 2, 2024

Conversation

alexvanyo
Copy link
Contributor

This adds a way to test for #1295, by creating a DeviceConfigurationOverride.WindowInsets that allows injecting arbitrary window insets for content under test.

By using this override in host-side screenshot tests to inject a non-zero amount of system bar insets on all sides, we can visually show how the snackbar is not being inset properly, and can be obscured by the system insets.

This is a prototype for the upstream request for a DeviceConfigurationOverride.WindowInsets: https://issuetracker.google.com/343474632

Copy link

Combined test coverage report

Overall Project 41.4% 🍏

There is no coverage information present for the Files changed

@alexvanyo alexvanyo force-pushed the av/device-configuration-override-window-insets branch from 171faf9 to b6e01c1 Compare June 10, 2024 17:24
Copy link

Combined test coverage report

Overall Project 41.37% 🍏

There is no coverage information present for the Files changed

…g insets

Change-Id: Idc781bf23021c1dba0d992bda0a3233e38e7c436
@alexvanyo alexvanyo force-pushed the av/device-configuration-override-window-insets branch from e7bfb87 to ea4ab18 Compare June 10, 2024 18:11
Copy link

Combined test coverage report

Overall Project 41.4% 🍏

There is no coverage information present for the Files changed

@Jaehwa-Noh
Copy link
Contributor

Jaehwa-Noh commented Jun 11, 2024

I have a question.
I used WindowInsets.safeDrawing.getBottom to avoid the System UI in
https://github.com/android/nowinandroid/pull/1296/files#diff-3fcb081475d70c62cae861a437429902dd21cd40067b7b52ec0c9c5184a1bf06R90-R95

val density = LocalDensity.current
val bottomSystemUiHeight = density.run {
WindowInsets.safeDrawing
.getBottom(density = density)
.toDp()
}

If I set the windowInsets like yours to test, the windowInsets would be set to the safeDrawing?
Is there any way to set SafeDrawing manually?


Aha, I found the code you set the navigation insets.
https://github.com/android/nowinandroid/pull/1498/files#diff-b76aa2071cc8cc921b26f6a03e5c8679ca440ea7b1950fecfe58f57d6abeaa3aR253-R260

.setInsets(
WindowInsetsCompat.Type.navigationBars(),
DpRect(
left = 64.dp,
top = 0.dp,
right = 64.dp,
bottom = 64.dp,
).toInsets(),

@dturner dturner merged commit b85ecbf into main Jul 2, 2024
4 checks passed
@alexvanyo alexvanyo deleted the av/device-configuration-override-window-insets branch July 2, 2024 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants