Add JVM based screenshot test for material button
Test: ./gradlew compose:material:material:test
Change-Id: Iad43b3a2b4e4ee3b8c87c29ea2d7cfffb10e068a
diff --git a/compose/material/material/build.gradle b/compose/material/material/build.gradle
index 53e8375..e2da821 100644
--- a/compose/material/material/build.gradle
+++ b/compose/material/material/build.gradle
@@ -21,6 +21,7 @@
id("AndroidXPlugin")
id("com.android.library")
id("AndroidXComposePlugin")
+ id("AndroidXPaparazziPlugin")
}
AndroidXComposePlugin.applyAndConfigureKotlinPlugin(project)
diff --git a/compose/material/material/src/test/kotlin/androidx/compose/material/ButtonPaparazziScreenshotTest.kt b/compose/material/material/src/test/kotlin/androidx/compose/material/ButtonPaparazziScreenshotTest.kt
new file mode 100644
index 0000000..8f6e548
--- /dev/null
+++ b/compose/material/material/src/test/kotlin/androidx/compose/material/ButtonPaparazziScreenshotTest.kt
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.compose.material
+
+import androidx.testutils.paparazzi.androidxPaparazzi
+import org.junit.Rule
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+
+@RunWith(JUnit4::class)
+class ButtonPaparazziScreenshotTest {
+ @get:Rule
+ val paparazzi = androidxPaparazzi()
+
+ @Test
+ fun default_button() {
+ paparazzi.snapshot {
+ MaterialTheme {
+ Surface {
+ Button(onClick = { }) {
+ Text("Button")
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file