-
Notifications
You must be signed in to change notification settings - Fork 108
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
Qualified night/dark assets not being picked up in @Preview snapshot tests #377
Comments
@drinkthestars Showkase isn't currently parsing |
Continuing an offline discussion. Gave it some more thought, and this is probably a very naive approach but it looks like with this issue and #292, we have the following requirements:
For the opt-in mechanism: The following cases would be supported: Case 1: @Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
@ShowkaseCustomConfig(config = ShowkaseCustomConfig.Config.InheritPreview)
@Composable
fun NightPreview() {
// This Composable will strictly follow the NIGHT mode setup from @Preview, no additional permutations.
} Case 2: @Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
@ShowkaseCustomConfig(config = ShowkaseCustomConfig.Config.MergePreview(
excludeDimensions = arrayOf(Dimension.RTL)
))
@Composable
fun CustomizedPreview() {
// Applies NIGHT mode from @Preview; includes everything except RTL.
} Case 3: @Preview
@ShowkaseCustomConfig(config = ShowkaseCustomConfig.Config.MergePreview(
excludeDimensions = arrayOf(Dimension.RTL, Dimension.FontSize)
))
@Composable
fun BroadCustomizedPreview() {
// Generates permutations for all UI modes but excludes RTL & FontSize.
} Handling Complex Edge Cases This assumes a lot of flexibility is required - if we assume some flexibility loss perhaps this can be whittled down further. Overall the main idea is to have some type of an opt-in customization mechanism. Sorry for the long text, hoping this makes sense somewhat 😅 |
@drinkthestars For the Showkase configuration, do you think it makes sense to handle it at the root level instead of doing it for each preview? Would that work better? |
@vinaygaba hmm, maybe 🤔 would you have an example of what you're thinking of? trying to visualize it |
Given the following:
where the
R.drawable.test_drawable
is a vector that references night/day qualified colors or has adrawable-night
equivalent, the recorded snapshots only show the light variant - somehow the dark/night qualified assets are not being picked up:Preview:
Golden Snapshots:
Tried the following to try to force it, but didn't work either:
Is this a bug/limitation or is it a config issue? Thanks!
The text was updated successfully, but these errors were encountered: