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

Add UIKit screenshot tests for layout's Spacer #1542

Merged
merged 1 commit into from
Oct 4, 2023
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
8 changes: 5 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ jobs:
path: build/dokka/htmlMultiModule/
if-no-files-found: error

paparazzi:
runs-on: ubuntu-latest
screenshot-tests:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -91,6 +91,8 @@ jobs:

- run: ./gradlew verifyPaparazziDebug

- run: xcodebuild -project redwood-layout-uiview/RedwoodLayoutUIViewTests.xcodeproj -scheme RedwoodLayoutUIViewTests -destination 'platform=iOS Simulator,name=iPhone 12,OS=latest' test

sample-counter:
runs-on: macos-latest
steps:
Expand Down Expand Up @@ -161,9 +163,9 @@ jobs:
- build
- connected
- dokka
- paparazzi
- sample-counter
- sample-emoji
- screenshot-tests
- test-app
steps:
- uses: actions/checkout@v4
Expand Down
38 changes: 28 additions & 10 deletions redwood-layout-shared-test/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
apply plugin: 'org.jetbrains.kotlin.jvm'
import app.cash.redwood.buildsupport.KmpTargets

dependencies {
api projects.redwoodLayoutApi
api projects.redwoodLayoutModifiers
api projects.redwoodLayoutWidget
api projects.redwoodRuntime
api projects.redwoodWidget
api projects.redwoodYoga
api libs.junit
api libs.testParameterInjector
apply plugin: 'org.jetbrains.kotlin.multiplatform'

kotlin {
KmpTargets.addAllTargets(project)

sourceSets {
commonMain {
dependencies {
api projects.redwoodLayoutApi
api projects.redwoodLayoutModifiers
api projects.redwoodLayoutWidget
api projects.redwoodRuntime
api projects.redwoodWidget
api projects.redwoodYoga
api libs.kotlin.test
}
}
jvmMain {
dependencies {
// The kotlin.test library provides JVM variants for multiple testing frameworks. When used
// as a test dependency this selection is transparent. But since we are publishing a library
// we need to select one ourselves at compilation time.
api libs.kotlin.test.junit
api libs.testParameterInjector
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package app.cash.redwood.layout
import app.cash.redwood.layout.widget.Spacer
import app.cash.redwood.ui.dp
import app.cash.redwood.widget.Widget
import org.junit.Test
import kotlin.test.Test

abstract class AbstractSpacerTest<T : Any> {

Expand All @@ -33,22 +33,22 @@ abstract class AbstractSpacerTest<T : Any> {
height(height.dp)
}

@Test fun zeroSpacer() {
@Test fun testZeroSpacer() {
val widget = widget(width = 0, height = 0)
verifySnapshot(wrap(widget, horizontal = true))
}

@Test fun widthOnlySpacer() {
@Test fun testWidthOnlySpacer() {
val widget = widget(width = 100, height = 0)
verifySnapshot(wrap(widget, horizontal = true))
}

@Test fun heightOnlySpacer() {
@Test fun testHeightOnlySpacer() {
val widget = widget(width = 0, height = 100)
verifySnapshot(wrap(widget, horizontal = false))
}

@Test fun bothSpacer() {
@Test fun testBothSpacer() {
val widget = widget(width = 100, height = 100)
verifySnapshot(wrap(widget, horizontal = false))
}
Expand Down
Loading