Skip to content

Commit

Permalink
Cleanup from upstream changes
Browse files Browse the repository at this point in the history
  • Loading branch information
geoff-powell committed Nov 20, 2024
1 parent 0d74bae commit 4a56e55
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 42 deletions.
22 changes: 0 additions & 22 deletions paparazzi-annotations/api/paparazzi-annotations.api
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,3 @@ public final class app/cash/paparazzi/annotations/PaparazziPreviewData$Default :
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;
}

Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import androidx.compose.runtime.Composable
* Represents composables annotated with @Paparazzi annotation
*
* Default - Represents a composable with no parameters
* Empty - Represents a configuration with zero annotated composables
* Error - Represents an error state with a message if the composable is misconfgured (ex. private Composable function)
*/
public sealed interface PaparazziPreviewData {

Expand All @@ -17,15 +15,4 @@ public sealed interface PaparazziPreviewData {
) : PaparazziPreviewData {
override fun toString(): String = snapshotName
}

public data object Empty : PaparazziPreviewData {
override fun toString(): String = "Empty"
}

public data class Error(
val snapshotName: String,
val message: String
) : PaparazziPreviewData {
override fun toString(): String = snapshotName
}
}
Empty file.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
public class app/cash/paparazzi/preview/PaparazziValuesProvider : com/google/testing/junit/testparameterinjector/TestParameter$TestParameterValuesProvider {
public class app/cash/paparazzi/preview/PaparazziValuesProvider : com/google/testing/junit/testparameterinjector/TestParameterValuesProvider {
public static final field $stable I
public fun <init> (Ljava/util/List;)V
public fun provideValues ()Ljava/util/List;
protected fun provideValues (Lcom/google/testing/junit/testparameterinjector/TestParameterValuesProvider$Context;)Ljava/util/List;
}

public final class app/cash/paparazzi/preview/SnapshotKt {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@ package app.cash.paparazzi.preview

import app.cash.paparazzi.Paparazzi
import app.cash.paparazzi.annotations.PaparazziPreviewData
import com.google.testing.junit.testparameterinjector.TestParameter.TestParameterValuesProvider
import com.google.testing.junit.testparameterinjector.TestParameterValuesProvider

/**
* Take a snapshot of the given [previewData].
*/
public fun Paparazzi.snapshot(previewData: PaparazziPreviewData, name: String? = null) {
when (previewData) {
is PaparazziPreviewData.Default -> snapshotDefault(previewData, name)
is PaparazziPreviewData.Empty -> Unit
is PaparazziPreviewData.Error -> error(previewData.message)
}
}

Expand All @@ -26,6 +24,6 @@ public fun Paparazzi.snapshot(previewData: PaparazziPreviewData, name: String? =
*/
public open class PaparazziValuesProvider(
private val annotations: List<PaparazziPreviewData>
) : TestParameterValuesProvider {
override fun provideValues(): List<PaparazziPreviewData> = annotations
) : TestParameterValuesProvider() {
override fun provideValues(context: Context?): MutableList<*> = annotations.toMutableList()
}

0 comments on commit 4a56e55

Please sign in to comment.