-
Notifications
You must be signed in to change notification settings - Fork 38
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
Consider passing RoborazziOptions to Compose Preview Support #447
Comments
This would be for default options right? then you can get that info via AndroidComposablePreviewScanner()
…
.includeAnnotationInfoForAllOf(RoborazziConfig::class.java) and map them in the tests with You can find some examples here: |
Thanks! I believe we have two main use cases for this:
(In Roborazzi)
annotation class RoborazziConfig(xxxx)
class AndroidComposePreviewTester : ComposePreviewTester<AndroidPreviewInfo> {
// This will be a new method of ComposePreviewTester
override fun roborazziOptions(): RoborazziOptions {
// How to access the composablePreview here?
// options().composablePreview or passing as a parameter
val someOptions = composablePreview.getAnnotation<RoborazziConfig>().xxxx
return RoborazziOptions(xxx)
}
override fun test(composablePreview) {
val roborazziOptions = roborazziOptions()
...
}
} https://github.com/takahirom/roborazzi/blob/main/roborazzi-compose-preview-scanner-support/src/main/java/com/github/takahirom/roborazzi/RoborazziPreviewScannerSupport.kt#L85C1-L85C34 (The current implementation of AndroidComposePreviewTester)
(In user project)
class MyCustomComposePreviewTester : ComposePreviewTester<AndroidPreviewInfo> by AndroidComposePreviewTester() {
override fun roborazziOptions(): RoborazziOptions {
// How to access the composablePreview here?
// options().composablePreview or passing as a parameter
val someOptions = composablePreview.getAnnotation<UserCustomConfig>().xxxx
return RoborazziOptions(xxx)
}
} I think we need to consider adding a new |
So for me there are 3 use cases then:
I'd focus first on providing options 1 & 2 |
My suggestion is to create a
roborazziOptions(): RoborazziOptions
function in the tester interface to set up the RoborazziOptions. However, we might want to access the annotations of the Preview function within roborazziOptions(). We could pass a ComposablePreview instance as a parameter, but I'm unsure if there's a more efficient approach.The text was updated successfully, but these errors were encountered: