From 3e8cd47ea5c4684034bb7518d2085682797f4435 Mon Sep 17 00:00:00 2001 From: Geoff Powell Date: Wed, 21 Aug 2024 15:16:30 -0400 Subject: [PATCH] Cleanup from upstream changes --- .../api/paparazzi-annotations.api | 13 +++---- .../paparazzi/plugin/test/HelloPaparazzi.kt | 37 +++++++++++++++++++ 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/paparazzi-annotations/api/paparazzi-annotations.api b/paparazzi-annotations/api/paparazzi-annotations.api index c4016dc313..913e18bbf8 100644 --- a/paparazzi-annotations/api/paparazzi-annotations.api +++ b/paparazzi-annotations/api/paparazzi-annotations.api @@ -5,21 +5,19 @@ public abstract interface class app/cash/paparazzi/annotations/PaparazziPreviewD } public final class app/cash/paparazzi/annotations/PaparazziPreviewData$Default : app/cash/paparazzi/annotations/PaparazziPreviewData { - public static final field $stable I - public fun (Ljava/lang/String;Lkotlin/jvm/functions/Function2;)V + public fun (Ljava/lang/String;Lkotlin/jvm/functions/Function0;)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 final fun component2 ()Lkotlin/jvm/functions/Function0; + public final fun copy (Ljava/lang/String;Lkotlin/jvm/functions/Function0;)Lapp/cash/paparazzi/annotations/PaparazziPreviewData$Default; + public static synthetic fun copy$default (Lapp/cash/paparazzi/annotations/PaparazziPreviewData$Default;Ljava/lang/String;Lkotlin/jvm/functions/Function0;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 getComposable ()Lkotlin/jvm/functions/Function0; 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 @@ -27,7 +25,6 @@ public final class app/cash/paparazzi/annotations/PaparazziPreviewData$Empty : a } public final class app/cash/paparazzi/annotations/PaparazziPreviewData$Error : app/cash/paparazzi/annotations/PaparazziPreviewData { - public static final field $stable I public fun (Ljava/lang/String;Ljava/lang/String;)V public final fun component1 ()Ljava/lang/String; public final fun component2 ()Ljava/lang/String; diff --git a/paparazzi-gradle-plugin/src/test/projects/preview-annotation-sample-configuration-cache/src/main/java/app/cash/paparazzi/plugin/test/HelloPaparazzi.kt b/paparazzi-gradle-plugin/src/test/projects/preview-annotation-sample-configuration-cache/src/main/java/app/cash/paparazzi/plugin/test/HelloPaparazzi.kt index 1c3909eccc..8db06bffdc 100644 --- a/paparazzi-gradle-plugin/src/test/projects/preview-annotation-sample-configuration-cache/src/main/java/app/cash/paparazzi/plugin/test/HelloPaparazzi.kt +++ b/paparazzi-gradle-plugin/src/test/projects/preview-annotation-sample-configuration-cache/src/main/java/app/cash/paparazzi/plugin/test/HelloPaparazzi.kt @@ -1,8 +1,12 @@ package app.cash.paparazzi.plugin.test +import android.content.res.Configuration import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.tooling.preview.PreviewParameter +import androidx.compose.ui.tooling.preview.PreviewParameterProvider +import androidx.compose.ui.tooling.preview.Wallpapers import app.cash.paparazzi.annotations.Paparazzi @Paparazzi @@ -11,3 +15,36 @@ import app.cash.paparazzi.annotations.Paparazzi fun HelloPaparazzi() { Text("Hello, Paparazzi!") } + +@Paparazzi +@Preview +@Composable +fun HelloPaparazziParameterized( + @PreviewParameter(provider = PreviewData::class) text: String, +) { + Text(text) +} + +@Paparazzi +@Preview( + name = "PreviewConfig", + group = "Previews", + device = "id:Nexus 6", + apiLevel = 33, + showSystemUi = true, + uiMode = Configuration.UI_MODE_NIGHT_YES or Configuration.UI_MODE_TYPE_NORMAL, + wallpaper = Wallpapers.RED_DOMINATED_EXAMPLE, + showBackground = true, + fontScale = 1.5f +) +@Composable +fun HelloPaparazziPreviewConfig() { + Text("Hello Paparazzi Preview Config!") +} + +object PreviewData : PreviewParameterProvider { + override val values: Sequence = sequenceOf( + "Hello, Paparazzi One!", + "Hello, Paparazzi Two!", + ) +}