-
Notifications
You must be signed in to change notification settings - Fork 39
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 localInspectionMode property to RoborazziComposeOptions #588
add localInspectionMode property to RoborazziComposeOptions #588
Conversation
7ca46e1
to
f62d182
Compare
composablePreview() | ||
CompositionLocalProvider(LocalInspectionMode provides true) { | ||
composablePreview() | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When running the Preview Screenshot Test, it is normally expected to produce the same result as during the Preview rendering, so there is no option to choose between true or false. If there is a need to make it selectable, I will modify it accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@takahirom
I’m actually thinking whether it’d make sense to provide this option also via gradle plugin?
Maybe in a future version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could have something like roborazz.compose.inspectionmode = true
. The default would be null. However, this might be a little confusing because we can't inject the setting if you use your activity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then better to leave it as ComposeOption only
Thanks. I think there is a trade-off when we use |
OK👍 |
16a5061
to
f62d182
Compare
Sorry, I intended to add the configuration to I suggest rebasing this PR onto the |
I just realized the same thing. Thank you for letting me know. |
Sorry, I'm going to change the APIs a little bit more. The timing is a bit unfortunate 🙇. I suggest you try this tomorrow. |
Thank you for your patience. I believe you can work on this now. |
f62d182
to
2f972ac
Compare
data class RoborazziComposeLocalInspectionModeOption(private val localInspectionMode: Boolean) : | ||
RoborazziComposeComposableOption { | ||
override fun configureWithComposable( | ||
content: @Composable () -> Unit | ||
): @Composable () -> Unit = { | ||
CompositionLocalProvider(LocalInspectionMode provides localInspectionMode) { | ||
content() | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@takahirom
I added the option to configure localInspectionMode in RoborazziComposeOptions.
/* The default value is false, but we can set it to true, | ||
if you want to use the logic for Preview in composable functions. */ | ||
localInspectionMode(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I don't think we need to apply localInspectionMode explicitly. How about making it a comment?
/* The default value is false, but we can set it to true, | |
if you want to use the logic for Preview in composable functions. */ | |
localInspectionMode(false) | |
/* | |
We don't specify `localInspectionMode` by default. The default value for `localInspectionMode` in Compose is `false`. This is to maintain higher fidelity in tests. | |
If you encounter issues integrating the library, you can set `localInspectionMode` to `true`. | |
localInspectionMode(true) | |
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@takahirom
OK, I have incorporated your feedback into the comment.
4f6007a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thank you for your contribution!
fix this issue #589