Skip to content

Commit

Permalink
Use preview method name
Browse files Browse the repository at this point in the history
  • Loading branch information
takahirom committed Jul 19, 2024
1 parent e79d924 commit 2ed0813
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 9 deletions.
1 change: 0 additions & 1 deletion core/testing/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,4 @@ dependencies {
implementation(libs.composablePreviewScanner)
implementation(libs.composablePreviewScannerJvm)
implementation(libs.roborazziPreviewScannerSupport)
implementation(libs.kotlinReflect)
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,12 @@ import com.github.takahirom.roborazzi.ComposePreviewTester
import com.github.takahirom.roborazzi.captureRoboImage
import sergio.sastre.composable.preview.scanner.core.preview.ComposablePreview
import sergio.sastre.composable.preview.scanner.jvm.JvmAnnotationScanner
import kotlin.reflect.jvm.kotlinFunction

class DroidKaigiKmpPreviewTester : ComposePreviewTester<JvmAnnotationScanner.DesktopPreviewInfo> {
override fun previews(vararg packages: String): List<ComposablePreview<JvmAnnotationScanner.DesktopPreviewInfo>> {
return JvmAnnotationScanner("org.jetbrains.compose.ui.tooling.preview.Preview")
.scanPackageTrees(*packages)
.getPreviews()
.filter { preview ->
System.getProperties()
Class.forName(preview.declaringClass).declaredMethods.first {
it.name == preview.methodName
}.kotlinFunction?.visibility == kotlin.reflect.KVisibility.PUBLIC
}
}

override fun test(preview: ComposablePreview<JvmAnnotationScanner.DesktopPreviewInfo>) {
Expand Down
1 change: 0 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ roborazziRule = { module = "io.github.takahirom.roborazzi:roborazzi-junit-rule",
roborazziPreviewScannerSupport = { module = "io.github.takahirom.roborazzi:roborazzi-compose-preview-scanner-support", version.ref = "roborazzi" }
composablePreviewScanner = { module = "com.github.sergio-sastre.ComposablePreviewScanner:android", version.ref = "composablePreviewScanner" }
composablePreviewScannerJvm = { module = "com.github.sergio-sastre.ComposablePreviewScanner:jvm", version.ref = "composablePreviewScanner" }
kotlinReflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" }

[plugins]
androidGradlePlugin = { id = "com.android.application", version.ref = "androidGradlePlugin" }
Expand Down

0 comments on commit 2ed0813

Please sign in to comment.