-
Notifications
You must be signed in to change notification settings - Fork 220
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
1 parent
7422ce3
commit ce36598
Showing
21 changed files
with
297 additions
and
135 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,7 @@ | ||
import org.jetbrains.kotlin.gradle.plugin.AbstractKotlinPluginKt | ||
|
||
apply plugin: 'org.jetbrains.kotlin.jvm' | ||
apply plugin: 'org.jetbrains.kotlin.plugin.compose' | ||
apply plugin: 'com.vanniktech.maven.publish' | ||
apply plugin: 'aar2jar' | ||
|
||
aar2jar.configureForConfiguration("compileOnly") | ||
|
||
dependencies { | ||
compileOnlyAarAsJar libs.compose.runtime | ||
|
||
add(AbstractKotlinPluginKt.PLUGIN_CLASSPATH_CONFIGURATION_NAME, libs.compose.compiler) | ||
compileOnly libs.compose.runtime | ||
} |
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
42 changes: 42 additions & 0 deletions
42
paparazzi-gradle-plugin/src/main/java/app/cash/paparazzi/gradle/PreviewTests.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,42 @@ | ||
package app.cash.paparazzi.gradle | ||
|
||
private const val PREVIEW_TEST_SOURCE = """ | ||
import app.cash.paparazzi.Paparazzi | ||
import app.cash.paparazzi.preview.DefaultLocaleRule | ||
import app.cash.paparazzi.preview.PaparazziPreviewData | ||
import app.cash.paparazzi.preview.PaparazziValuesProvider | ||
import app.cash.paparazzi.preview.deviceConfig | ||
import app.cash.paparazzi.preview.locale | ||
import app.cash.paparazzi.preview.snapshot | ||
import com.android.ide.common.rendering.api.SessionParams.RenderingMode.SHRINK | ||
import com.google.testing.junit.testparameterinjector.TestParameter | ||
import com.google.testing.junit.testparameterinjector.TestParameterInjector | ||
import org.junit.Assume.assumeTrue | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
@RunWith(TestParameterInjector::class) | ||
class PreviewTests( | ||
@TestParameter(valuesProvider = PreviewConfigValuesProvider::class) | ||
private val preview: PaparazziPreviewData, | ||
) { | ||
private class PreviewConfigValuesProvider : PaparazziValuesProvider(paparazziPreviews) | ||
@get:Rule | ||
val paparazzi = Paparazzi( | ||
deviceConfig = preview.deviceConfig(), | ||
renderingMode = SHRINK, | ||
maxPercentDifference = 0.11, | ||
) | ||
@get:Rule | ||
val localeRule = DefaultLocaleRule(preview.locale()) | ||
@Test | ||
fun preview() { | ||
assumeTrue(preview !is PaparazziPreviewData.Empty) | ||
paparazzi.snapshot(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
Oops, something went wrong.