Skip to content
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
3 changes: 2 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ paparazzi = "1.3.2"
zipline = "1.22.0"
coil = "3.3.0"
okio = "3.16.0"
burst = "2.7.1"
burst = "2.8.1"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I shipped 2.8.0 foolishly, and I need this fix before this PR runs correctly:
cashapp/burst#187


[libraries]
kotlin-compiler = { module = "org.jetbrains.kotlin:kotlin-compiler", version.ref = "kotlin" }
Expand Down Expand Up @@ -79,6 +79,7 @@ coil-network-okhttp = { module = "io.coil-kt.coil3:coil-network-okhttp", version

androidGradlePlugin = { module = "com.android.tools.build:gradle", version = "8.13.0" }
burst = { module = "app.cash.burst:burst", version.ref = "burst" }
burst-coroutines = { module = "app.cash.burst:burst-coroutines", version.ref = "burst" }
burst-gradle-plugin = { module = "app.cash.burst:burst-gradle-plugin", version.ref = "burst" }
kotlinPoet = { module = "com.squareup:kotlinpoet", version = "2.2.0" }
clikt = "com.github.ajalt.clikt:clikt:5.0.3"
Expand Down
2 changes: 2 additions & 0 deletions redwood-layout-shared-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ kotlin {
api projects.redwoodYoga
api libs.kotlin.test
implementation libs.burst
implementation libs.burst.coroutines
implementation libs.kotlinx.coroutines.test
}
}
jvmMain {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import app.cash.redwood.snapshot.testing.text
import app.cash.redwood.ui.Margin
import app.cash.redwood.ui.dp
import kotlin.test.Test
import kotlinx.coroutines.test.runTest

@Burst
abstract class AbstractBoxTest<T : Any> {
Expand All @@ -48,7 +49,7 @@ abstract class AbstractBoxTest<T : Any> {
* Explicitly apply defaults to our Box instance. This is only necessary in tests; in production
* the framework explicitly sets every property.
*/
protected fun Box<T>.applyDefaults() {
protected fun Box<T>.applyDefaults() = runTest {
width(Constraint.Wrap)
height(Constraint.Wrap)
margin(Margin.Zero)
Expand All @@ -57,13 +58,13 @@ abstract class AbstractBoxTest<T : Any> {
}

@Test
fun testEmpty_Defaults() {
fun testEmpty_Defaults() = runTest {
val widget = box()
snapshotterFactory(widget.value).snapshot()
}

@Test
fun testEmpty_Wrap() {
fun testEmpty_Wrap() = runTest {
val widget = box().apply {
width(Constraint.Wrap)
height(Constraint.Wrap)
Expand All @@ -72,7 +73,7 @@ abstract class AbstractBoxTest<T : Any> {
}

@Test
fun testEmpty_Fill() {
fun testEmpty_Fill() = runTest {
val widget = box().apply {
width(Constraint.Fill)
height(Constraint.Fill)
Expand All @@ -98,7 +99,7 @@ abstract class AbstractBoxTest<T : Any> {
CrossAxisAlignment.End,
CrossAxisAlignment.Stretch,
),
) {
) = runTest {
val widget = box().apply {
width(constraint)
height(constraint)
Expand Down Expand Up @@ -130,7 +131,7 @@ abstract class AbstractBoxTest<T : Any> {
}

@Test
fun testMargins() {
fun testMargins() = runTest {
// Different margins allow us to know which direction start and end get applied.
val asymmetric = Margin(start = 10.dp, top = 20.dp, end = 30.dp, bottom = 40.dp)

Expand All @@ -156,7 +157,7 @@ abstract class AbstractBoxTest<T : Any> {
}

@Test
fun testBoxMeasurementIncludesMargins() {
fun testBoxMeasurementIncludesMargins() = runTest {
val container = widgetFactory.column()
container.add(
box().apply {
Expand Down Expand Up @@ -199,7 +200,7 @@ abstract class AbstractBoxTest<T : Any> {
}

@Test
fun testMarginsAndAlignment() {
fun testMarginsAndAlignment() = runTest {
val widget = box().apply {
width(Constraint.Fill)
height(Constraint.Fill)
Expand Down Expand Up @@ -242,7 +243,7 @@ abstract class AbstractBoxTest<T : Any> {
}

@Test
fun testMarginsAndStretch() {
fun testMarginsAndStretch() = runTest {
val widget = box().apply {
width(Constraint.Fill)
height(Constraint.Fill)
Expand Down Expand Up @@ -285,7 +286,7 @@ abstract class AbstractBoxTest<T : Any> {
}

@Test
fun testChildrenModifierChanges() {
fun testChildrenModifierChanges() = runTest {
val redColor = widgetFactory.text(
modifier = MarginImpl(30.dp),
text = longText(),
Expand Down Expand Up @@ -319,7 +320,7 @@ abstract class AbstractBoxTest<T : Any> {

/** The view shouldn't crash if its displayed after being detached. */
@Test
fun testLayoutAfterDetach() {
fun testLayoutAfterDetach() = runTest {
val widget = box().apply {
width(Constraint.Wrap)
height(Constraint.Wrap)
Expand Down Expand Up @@ -361,7 +362,7 @@ abstract class AbstractBoxTest<T : Any> {
}

@Test
fun testDynamicWidgetResizing() {
fun testDynamicWidgetResizing() = runTest {
val container = box()
.apply {
width(Constraint.Fill)
Expand Down Expand Up @@ -393,7 +394,7 @@ abstract class AbstractBoxTest<T : Any> {
}

@Test
fun testLayoutUpdatesWithoutSizeChanges() {
fun testLayoutUpdatesWithoutSizeChanges() = runTest {
val container = widgetFactory.column()
val snapshotter = snapshotterFactory(container.value)

Expand Down Expand Up @@ -421,7 +422,7 @@ abstract class AbstractBoxTest<T : Any> {
}

@Test
fun testChildExplicitHeight() {
fun testChildExplicitHeight() = runTest {
val container = box()
.apply {
width(Constraint.Fill)
Expand Down Expand Up @@ -453,7 +454,7 @@ abstract class AbstractBoxTest<T : Any> {
}

@Test
fun testChildExplicitWidth() {
fun testChildExplicitWidth() = runTest {
val container = box()
.apply {
width(Constraint.Fill)
Expand Down Expand Up @@ -486,7 +487,7 @@ abstract class AbstractBoxTest<T : Any> {

/** We had a bug where stretch alignment impacted measurement. It shouldn't. */
@Test
fun testStretchDoesNotImpactMeasurement() {
fun testStretchDoesNotImpactMeasurement() = runTest {
val container = box()
.apply {
width(Constraint.Fill)
Expand Down
Loading