-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
58 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...esting/src/main/java/io/github/droidkaigi/confsched/testing/DroidKaigiKmpPreviewTester.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package io.github.droidkaigi.confsched.testing | ||
|
||
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>) { | ||
captureRoboImage { | ||
preview() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters