-
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
107acd3
commit 3b5486e
Showing
17 changed files
with
134 additions
and
415 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,3 +1,42 @@ | ||
public abstract interface annotation class app/cash/paparazzi/annotations/Paparazzi : java/lang/annotation/Annotation { | ||
} | ||
|
||
public abstract interface class app/cash/paparazzi/annotations/PaparazziPreviewData { | ||
} | ||
|
||
public final class app/cash/paparazzi/annotations/PaparazziPreviewData$Default : app/cash/paparazzi/annotations/PaparazziPreviewData { | ||
public static final field $stable I | ||
public fun <init> (Ljava/lang/String;Lkotlin/jvm/functions/Function2;)V | ||
public final fun component1 ()Ljava/lang/String; | ||
public final fun component2 ()Lkotlin/jvm/functions/Function2; | ||
public final fun copy (Ljava/lang/String;Lkotlin/jvm/functions/Function2;)Lapp/cash/paparazzi/annotations/PaparazziPreviewData$Default; | ||
public static synthetic fun copy$default (Lapp/cash/paparazzi/annotations/PaparazziPreviewData$Default;Ljava/lang/String;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/cash/paparazzi/annotations/PaparazziPreviewData$Default; | ||
public fun equals (Ljava/lang/Object;)Z | ||
public final fun getComposable ()Lkotlin/jvm/functions/Function2; | ||
public final fun getSnapshotName ()Ljava/lang/String; | ||
public fun hashCode ()I | ||
public fun toString ()Ljava/lang/String; | ||
} | ||
|
||
public final class app/cash/paparazzi/annotations/PaparazziPreviewData$Empty : app/cash/paparazzi/annotations/PaparazziPreviewData { | ||
public static final field $stable I | ||
public static final field INSTANCE Lapp/cash/paparazzi/annotations/PaparazziPreviewData$Empty; | ||
public fun equals (Ljava/lang/Object;)Z | ||
public fun hashCode ()I | ||
public fun toString ()Ljava/lang/String; | ||
} | ||
|
||
public final class app/cash/paparazzi/annotations/PaparazziPreviewData$Error : app/cash/paparazzi/annotations/PaparazziPreviewData { | ||
public static final field $stable I | ||
public fun <init> (Ljava/lang/String;Ljava/lang/String;)V | ||
public final fun component1 ()Ljava/lang/String; | ||
public final fun component2 ()Ljava/lang/String; | ||
public final fun copy (Ljava/lang/String;Ljava/lang/String;)Lapp/cash/paparazzi/annotations/PaparazziPreviewData$Error; | ||
public static synthetic fun copy$default (Lapp/cash/paparazzi/annotations/PaparazziPreviewData$Error;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Lapp/cash/paparazzi/annotations/PaparazziPreviewData$Error; | ||
public fun equals (Ljava/lang/Object;)Z | ||
public final fun getMessage ()Ljava/lang/String; | ||
public final fun getSnapshotName ()Ljava/lang/String; | ||
public fun hashCode ()I | ||
public fun toString ()Ljava/lang/String; | ||
} | ||
|
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,9 +1,7 @@ | ||
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 | ||
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
25 changes: 25 additions & 0 deletions
25
paparazzi-preview-test-junit/api/paparazzi-preview-test-junit.api
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,25 @@ | ||
public final class app/cash/paparazzi/preview/ComposableSingletons$SnapshotKt { | ||
public static final field INSTANCE Lapp/cash/paparazzi/preview/ComposableSingletons$SnapshotKt; | ||
public static field lambda-1 Lkotlin/jvm/functions/Function3; | ||
public fun <init> ()V | ||
public final fun getLambda-1$paparazzi_preview_test_junit ()Lkotlin/jvm/functions/Function3; | ||
} | ||
|
||
public final class app/cash/paparazzi/preview/ComposableSingletons$UtilsKt { | ||
public static final field INSTANCE Lapp/cash/paparazzi/preview/ComposableSingletons$UtilsKt; | ||
public static field lambda-1 Lkotlin/jvm/functions/Function3; | ||
public fun <init> ()V | ||
public final fun getLambda-1$paparazzi_preview_test_junit ()Lkotlin/jvm/functions/Function3; | ||
} | ||
|
||
public class app/cash/paparazzi/preview/PaparazziValuesProvider : com/google/testing/junit/testparameterinjector/TestParameter$TestParameterValuesProvider { | ||
public static final field $stable I | ||
public fun <init> (Ljava/util/List;)V | ||
public fun provideValues ()Ljava/util/List; | ||
} | ||
|
||
public final class app/cash/paparazzi/preview/SnapshotKt { | ||
public static final fun snapshot (Lapp/cash/paparazzi/Paparazzi;Lapp/cash/paparazzi/annotations/PaparazziPreviewData;Ljava/lang/String;Lkotlin/jvm/functions/Function3;)V | ||
public static synthetic fun snapshot$default (Lapp/cash/paparazzi/Paparazzi;Lapp/cash/paparazzi/annotations/PaparazziPreviewData;Ljava/lang/String;Lkotlin/jvm/functions/Function3;ILjava/lang/Object;)V | ||
} | ||
|
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,10 @@ | ||
apply plugin: 'org.jetbrains.kotlin.jvm' | ||
apply plugin: 'org.jetbrains.kotlin.plugin.compose' | ||
apply plugin: 'com.vanniktech.maven.publish' | ||
|
||
dependencies { | ||
compileOnly libs.compose.runtime | ||
implementation projects.paparazzi | ||
implementation projects.paparazziAnnotations | ||
api libs.testParameterInjector | ||
} |
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,4 @@ | ||
POM_ARTIFACT_ID=paparazzi-preview-test-junit | ||
POM_NAME=Paparazzi Preview Test JUnit | ||
POM_DESCRIPTION=Adds helpers to use in code generated from Paparazzi Gradle Plugin for composables annotated with @Paparazzi | ||
POM_PACKAGING=jar |
36 changes: 36 additions & 0 deletions
36
paparazzi-preview-test-junit/src/main/java/app/cash/paparazzi/preview/Snapshot.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,36 @@ | ||
// Copyright Square, Inc. | ||
package app.cash.paparazzi.preview | ||
|
||
import androidx.compose.runtime.Composable | ||
import app.cash.paparazzi.Paparazzi | ||
import app.cash.paparazzi.annotations.PaparazziPreviewData | ||
import com.google.testing.junit.testparameterinjector.TestParameter.TestParameterValuesProvider | ||
|
||
/** | ||
* Take a snapshot of the given [previewData]. | ||
*/ | ||
public fun Paparazzi.snapshot( | ||
previewData: PaparazziPreviewData, | ||
name: String? = null, | ||
wrapper: @Composable (@Composable () -> Unit) -> Unit = { it() } | ||
) { | ||
when (previewData) { | ||
is PaparazziPreviewData.Default -> snapshotDefault(previewData, name, wrapper) | ||
is PaparazziPreviewData.Empty -> Unit | ||
is PaparazziPreviewData.Error -> error(previewData.message) | ||
} | ||
} | ||
|
||
/** | ||
* A `@TestParameter` values provider for the given [annotations]. | ||
* | ||
* Example usage: | ||
* ``` | ||
* private class ValuesProvider : PaparazziValuesProvider(paparazziAnnotations) | ||
* ``` | ||
*/ | ||
public open class PaparazziValuesProvider( | ||
private val annotations: List<PaparazziPreviewData> | ||
) : TestParameterValuesProvider { | ||
override fun provideValues(): List<PaparazziPreviewData> = annotations | ||
} |
16 changes: 16 additions & 0 deletions
16
paparazzi-preview-test-junit/src/main/java/app/cash/paparazzi/preview/Utils.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,16 @@ | ||
// Copyright Square, Inc. | ||
package app.cash.paparazzi.preview | ||
|
||
import androidx.compose.runtime.Composable | ||
import app.cash.paparazzi.Paparazzi | ||
import app.cash.paparazzi.annotations.PaparazziPreviewData | ||
|
||
internal fun Paparazzi.snapshotDefault( | ||
previewData: PaparazziPreviewData.Default, | ||
name: String?, | ||
wrapper: @Composable (@Composable () -> Unit) -> Unit = { it() } | ||
) { | ||
snapshot(name) { | ||
wrapper { previewData.composable() } | ||
} | ||
} |
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.