Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move plugin tests from testDebug to verifyPaparazziDebug to use same diffing execution path #1504

Merged
merged 2 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class LaunchViewTest {
val paparazzi = Paparazzi()

@Test
fun testViews() {
fun test() {
val launch = paparazzi.inflate<LinearLayout>(R.layout.launch)
paparazzi.snapshot(launch, "launch")
paparazzi.snapshot(launch, "arrow_missing")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class LaunchViewTest {
val paparazzi = Paparazzi()

@Test
fun testViews() {
fun test() {
val launch = paparazzi.inflate<LinearLayout>(R.layout.launch)
paparazzi.snapshot(launch, "launch")
paparazzi.snapshot(launch, "arrow_present")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,3 @@ dependencies {
implementation libs.composeUi.material
}


Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package app.cash.paparazzi.plugin.test

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextDecoration

@Composable
fun HelloPaparazzi() {
val text = "Hello, Paparazzi"
Column(
Modifier
.background(Color.White)
.fillMaxSize()
.wrapContentSize()
) {
Text(text)
Text(text, style = TextStyle(fontFamily = FontFamily.Cursive))
Text(
text = text,
style = TextStyle(textDecoration = TextDecoration.LineThrough)
)
Text(
text = text,
style = TextStyle(textDecoration = TextDecoration.Underline)
)
Text(
text = text,
style = TextStyle(
textDecoration = TextDecoration.combine(
listOf(
TextDecoration.Underline,
TextDecoration.LineThrough
)
),
fontWeight = FontWeight.Bold
)
)
}
}

This file was deleted.

This file was deleted.

Binary file not shown.
Binary file not shown.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package app.cash.paparazzi.plugin.test
import android.content.Context
import android.graphics.Typeface
import android.view.Gravity.CENTER
import android.view.View
import android.view.ViewGroup.LayoutParams.MATCH_PARENT
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
import android.widget.LinearLayout
Expand All @@ -35,7 +36,7 @@ class CustomFontsTest {
val paparazzi = Paparazzi()

@Test
fun customFontInTextViewInCode() {
fun inCode() {
val context = paparazzi.context

val root = LinearLayout(context).apply {
Expand Down Expand Up @@ -74,7 +75,13 @@ class CustomFontsTest {
)
}

paparazzi.snapshot(root, "text in code")
paparazzi.snapshot(root)
}

@Test
fun inXml() {
val view = paparazzi.inflate<View>(R.layout.textviews)
paparazzi.snapshot(view)
}

@Test
Expand All @@ -89,7 +96,7 @@ class CustomFontsTest {
gravity = CENTER
}
}
paparazzi.snapshot(text, "singleLine")
paparazzi.snapshot(text)
}

private fun createTextView(context: Context) =
Expand Down

This file was deleted.

Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,9 @@ class NightModeTest(
fun xml() {
paparazzi.snapshot(paparazzi.inflate(R.layout.layout))
}

@Test
fun compose() {
paparazzi.snapshot { LightDark() }
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class TextAppearanceTest {
val paparazzi = Paparazzi()

@Test
fun verify() {
fun inCode() {
val context = paparazzi.context
val view = LinearLayout(context).apply {
orientation = LinearLayout.VERTICAL
Expand All @@ -54,6 +54,12 @@ class TextAppearanceTest {
paparazzi.snapshot(view)
}

@Test
fun inXml() {
val view = paparazzi.inflate<LinearLayout>(R.layout.text_appearance_test)
paparazzi.snapshot(view)
}

private fun createTextView(context: Context) =
TextView(context, null, 0).apply {
layoutParams = LinearLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class AmountViewTest {
val paparazzi = Paparazzi()

@Test
fun testViews() {
fun amount() {
val amount = AmountView(paparazzi.context)
paparazzi.snapshot(amount, "amount")
paparazzi.snapshot(amount, "five_bucks")
}
}

This file was deleted.

This file was deleted.

This file was deleted.

Diff not rendered.
Loading