From be1e8a8ef8740bb5412de1e337ee620c19efc52c Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Thu, 15 Sep 2022 09:28:37 +0100 Subject: [PATCH] adding and recording example paparazzi test --- .../PaparazziExampleScreenshotTest.kt | 45 +++++++++++++++++++ ...eScreenshotTest_example paparazzi test.png | 3 ++ 2 files changed, 48 insertions(+) create mode 100644 vector/src/test/java/im/vector/app/screenshot/PaparazziExampleScreenshotTest.kt create mode 100644 vector/src/test/snapshots/images/im.vector.app.screenshot_PaparazziExampleScreenshotTest_example paparazzi test.png diff --git a/vector/src/test/java/im/vector/app/screenshot/PaparazziExampleScreenshotTest.kt b/vector/src/test/java/im/vector/app/screenshot/PaparazziExampleScreenshotTest.kt new file mode 100644 index 0000000000..a1b1d05327 --- /dev/null +++ b/vector/src/test/java/im/vector/app/screenshot/PaparazziExampleScreenshotTest.kt @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2022 New Vector Ltd + * + * 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 im.vector.app.screenshot + +import android.widget.ImageView +import android.widget.TextView +import androidx.constraintlayout.widget.ConstraintLayout +import app.cash.paparazzi.DeviceConfig.Companion.PIXEL_3 +import app.cash.paparazzi.Paparazzi +import im.vector.app.R +import org.junit.Rule +import org.junit.Test + +class PaparazziExampleScreenshotTest { + + @get:Rule + val paparazzi = Paparazzi( + deviceConfig = PIXEL_3, + theme = "Theme.Vector.Light", + ) + + @Test + fun `example paparazzi test`() { + val view = paparazzi.inflate(R.layout.item_radio) + + view.findViewById(R.id.actionTitle).text = paparazzi.resources.getString(R.string.room_settings_all_messages) + view.findViewById(R.id.radioIcon).setImageResource(R.drawable.ic_radio_on) + + paparazzi.snapshot(view) + } +} diff --git a/vector/src/test/snapshots/images/im.vector.app.screenshot_PaparazziExampleScreenshotTest_example paparazzi test.png b/vector/src/test/snapshots/images/im.vector.app.screenshot_PaparazziExampleScreenshotTest_example paparazzi test.png new file mode 100644 index 0000000000..bba610b25f --- /dev/null +++ b/vector/src/test/snapshots/images/im.vector.app.screenshot_PaparazziExampleScreenshotTest_example paparazzi test.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:113cf006e9a881f19b79462297cf276aea2b82268182f9ecc297d4b31640b507 +size 11174