From 39bfe2fef547806a33f5196e30589a1dc0f459cd Mon Sep 17 00:00:00 2001 From: Colin White Date: Thu, 23 Nov 2023 02:27:18 -0800 Subject: [PATCH 1/9] Add support for Modifier.flex. --- .../redwood/buildsupport/flexboxHelpers.kt | 7 ++++ .../redwood/layout/compose/LayoutScopes.kt | 28 ------------- .../layout/compose/LayoutScopesTest.kt | 40 ------------------- redwood-layout-schema/redwood-api.xml | 3 ++ .../app/cash/redwood/layout/modifiers.kt | 12 ++++++ .../kotlin/app/cash/redwood/layout/schema.kt | 3 +- .../kotlin/app/cash/redwood/yoga/Node.kt | 7 ++++ .../app/cash/redwood/yoga/internal/Yoga.kt | 8 ++++ .../yoga/internal/detail/CompactValue.kt | 4 +- .../emojisearch/presenter/EmojiSearch.kt | 1 - 10 files changed, 41 insertions(+), 72 deletions(-) delete mode 100644 redwood-layout-compose/src/commonMain/kotlin/app/cash/redwood/layout/compose/LayoutScopes.kt delete mode 100644 redwood-layout-compose/src/commonTest/kotlin/app/cash/redwood/layout/compose/LayoutScopesTest.kt diff --git a/build-support/src/main/resources/app/cash/redwood/buildsupport/flexboxHelpers.kt b/build-support/src/main/resources/app/cash/redwood/buildsupport/flexboxHelpers.kt index ec213e9e13..19500efb95 100644 --- a/build-support/src/main/resources/app/cash/redwood/buildsupport/flexboxHelpers.kt +++ b/build-support/src/main/resources/app/cash/redwood/buildsupport/flexboxHelpers.kt @@ -18,6 +18,7 @@ package com.example import app.cash.redwood.Modifier import app.cash.redwood.layout.api.CrossAxisAlignment import app.cash.redwood.layout.api.MainAxisAlignment +import app.cash.redwood.layout.modifier.Flex as FlexModifier import app.cash.redwood.layout.modifier.Grow as GrowModifier import app.cash.redwood.layout.modifier.Height as HeightModifier import app.cash.redwood.layout.modifier.HorizontalAlignment as HorizontalAlignmentModifier @@ -97,6 +98,12 @@ internal fun Node.applyModifier(parentModifier: Modifier, density: Density) { requestedMinHeight = height requestedMaxHeight = height } + is FlexModifier -> { + val flex = childModifier.value.coerceAtLeast(0.0).toFloat() + flexGrow = flex + flexShrink = 1.0f + flexBasis = if (flex > 0) 0.0f else -1.0f + } } } } diff --git a/redwood-layout-compose/src/commonMain/kotlin/app/cash/redwood/layout/compose/LayoutScopes.kt b/redwood-layout-compose/src/commonMain/kotlin/app/cash/redwood/layout/compose/LayoutScopes.kt deleted file mode 100644 index 222ea48b42..0000000000 --- a/redwood-layout-compose/src/commonMain/kotlin/app/cash/redwood/layout/compose/LayoutScopes.kt +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2023 Square, Inc. - * - * 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 app.cash.redwood.layout.compose - -import androidx.compose.runtime.Stable -import app.cash.redwood.Modifier - -/** - * Equivalent to `modifier.grow(value).shrink(value)`. - * - * Call this in [ColumnScope] or [RowScope]. - */ -@Stable -public fun Modifier.flex(`value`: Double): Modifier = - then(GrowImpl(`value`)).then(ShrinkImpl(`value`)) diff --git a/redwood-layout-compose/src/commonTest/kotlin/app/cash/redwood/layout/compose/LayoutScopesTest.kt b/redwood-layout-compose/src/commonTest/kotlin/app/cash/redwood/layout/compose/LayoutScopesTest.kt deleted file mode 100644 index 006b1dbea2..0000000000 --- a/redwood-layout-compose/src/commonTest/kotlin/app/cash/redwood/layout/compose/LayoutScopesTest.kt +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2023 Square, Inc. - * - * 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 app.cash.redwood.layout.compose - -import app.cash.redwood.Modifier -import kotlin.test.Test -import kotlin.test.assertEquals - -class LayoutScopesTest { - @Test - fun flexIsGrowAndShrink() { - val flex = Modifier.flex(0.5) - val components = flex.components() - assertEquals( - listOf(GrowImpl(0.5), ShrinkImpl(0.5)), - components, - ) - } - - private fun Modifier.components(): List { - return buildList { - this@components.forEach { - add(it) - } - } - } -} diff --git a/redwood-layout-schema/redwood-api.xml b/redwood-layout-schema/redwood-api.xml index bd571c9d8e..fac28ec74c 100644 --- a/redwood-layout-schema/redwood-api.xml +++ b/redwood-layout-schema/redwood-api.xml @@ -54,4 +54,7 @@ + + + diff --git a/redwood-layout-schema/src/main/kotlin/app/cash/redwood/layout/modifiers.kt b/redwood-layout-schema/src/main/kotlin/app/cash/redwood/layout/modifiers.kt index 3a1e39624b..08cbb0a5ae 100644 --- a/redwood-layout-schema/src/main/kotlin/app/cash/redwood/layout/modifiers.kt +++ b/redwood-layout-schema/src/main/kotlin/app/cash/redwood/layout/modifiers.kt @@ -91,3 +91,15 @@ public data class Size( val width: Dp, val height: Dp, ) + +/** + * This value acts as a weight for the width/height of a widget along the main axis. + * + * For instance, setting `flex(1.0)` on each widget in a layout will create equally sized widgets. + * + * https://developer.mozilla.org/en-US/docs/Web/CSS/flex + */ +@Modifier(9, RowScope::class, ColumnScope::class) +public data class Flex( + val value: Double, +) diff --git a/redwood-layout-schema/src/main/kotlin/app/cash/redwood/layout/schema.kt b/redwood-layout-schema/src/main/kotlin/app/cash/redwood/layout/schema.kt index 1e100e5742..1d483075c0 100644 --- a/redwood-layout-schema/src/main/kotlin/app/cash/redwood/layout/schema.kt +++ b/redwood-layout-schema/src/main/kotlin/app/cash/redwood/layout/schema.kt @@ -27,6 +27,7 @@ import app.cash.redwood.schema.Schema // Next tag: 5 // Modifiers + Flex::class, Grow::class, Height::class, HorizontalAlignment::class, @@ -35,7 +36,7 @@ import app.cash.redwood.schema.Schema Size::class, VerticalAlignment::class, Width::class, - // Next tag: 9 + // Next tag: 10 ], ) public interface RedwoodLayout diff --git a/redwood-yoga/src/commonMain/kotlin/app/cash/redwood/yoga/Node.kt b/redwood-yoga/src/commonMain/kotlin/app/cash/redwood/yoga/Node.kt index 85572bf044..a6d4a763c8 100644 --- a/redwood-yoga/src/commonMain/kotlin/app/cash/redwood/yoga/Node.kt +++ b/redwood-yoga/src/commonMain/kotlin/app/cash/redwood/yoga/Node.kt @@ -49,6 +49,13 @@ public class Node internal constructor( public var flexShrink: Float get() = Yoga.YGNodeStyleGetFlexShrink(native) set(value) = Yoga.YGNodeStyleSetFlexShrink(native, value) + public var flexBasis: Float + get() = Yoga.YGNodeStyleGetFlexBasisPercent(native) + set(value) = if (value >= 0) { + Yoga.YGNodeStyleSetFlexBasisPercent(native, value) + } else { + Yoga.YGNodeStyleSetFlexBasisAuto(native) + } public var marginStart: Float get() = getMargin(YGEdge.YGEdgeStart) set(value) = setMargin(YGEdge.YGEdgeStart, value) diff --git a/redwood-yoga/src/commonMain/kotlin/app/cash/redwood/yoga/internal/Yoga.kt b/redwood-yoga/src/commonMain/kotlin/app/cash/redwood/yoga/internal/Yoga.kt index fe1af179e6..c11f848e83 100644 --- a/redwood-yoga/src/commonMain/kotlin/app/cash/redwood/yoga/internal/Yoga.kt +++ b/redwood-yoga/src/commonMain/kotlin/app/cash/redwood/yoga/internal/Yoga.kt @@ -796,6 +796,14 @@ internal object Yoga { } } + fun YGNodeStyleGetFlexBasisPercent(node: YGNode): Float { + return if (node.style.flexBasis.isPercent()) { + node.style.flexBasis.convertToYgValue().value + } else { + -1.0f // This is a stand-in for any non-point value. + } + } + private fun > updateStyleIndexed( node: YGNode, edge: T, diff --git a/redwood-yoga/src/commonMain/kotlin/app/cash/redwood/yoga/internal/detail/CompactValue.kt b/redwood-yoga/src/commonMain/kotlin/app/cash/redwood/yoga/internal/detail/CompactValue.kt index 9a5255a159..61596509aa 100644 --- a/redwood-yoga/src/commonMain/kotlin/app/cash/redwood/yoga/internal/detail/CompactValue.kt +++ b/redwood-yoga/src/commonMain/kotlin/app/cash/redwood/yoga/internal/detail/CompactValue.kt @@ -34,11 +34,11 @@ internal class CompactValue { return undefined || !isAuto() && !isPoint() && !isPercent() && payload_.value.isNaN() } - private fun isPercent(): Boolean { + fun isPercent(): Boolean { return payload_.unit == YGUnit.YGUnitPercent } - private fun isPoint(): Boolean { + fun isPoint(): Boolean { return payload_.unit == YGUnit.YGUnitPoint } diff --git a/samples/emoji-search/presenter/src/commonMain/kotlin/com/example/redwood/emojisearch/presenter/EmojiSearch.kt b/samples/emoji-search/presenter/src/commonMain/kotlin/com/example/redwood/emojisearch/presenter/EmojiSearch.kt index 99407b94df..96209f8c4e 100644 --- a/samples/emoji-search/presenter/src/commonMain/kotlin/com/example/redwood/emojisearch/presenter/EmojiSearch.kt +++ b/samples/emoji-search/presenter/src/commonMain/kotlin/com/example/redwood/emojisearch/presenter/EmojiSearch.kt @@ -34,7 +34,6 @@ import app.cash.redwood.layout.api.CrossAxisAlignment import app.cash.redwood.layout.api.MainAxisAlignment import app.cash.redwood.layout.compose.Column import app.cash.redwood.layout.compose.Row -import app.cash.redwood.layout.compose.flex import app.cash.redwood.lazylayout.compose.ExperimentalRedwoodLazyLayoutApi import app.cash.redwood.lazylayout.compose.LazyColumn import app.cash.redwood.lazylayout.compose.items From 1553cc5530d43238f13a109aa21fae50910bf94a Mon Sep 17 00:00:00 2001 From: Colin White Date: Thu, 23 Nov 2023 02:28:06 -0800 Subject: [PATCH 2/9] Docs. --- .../commonMain/kotlin/app/cash/redwood/yoga/internal/Yoga.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redwood-yoga/src/commonMain/kotlin/app/cash/redwood/yoga/internal/Yoga.kt b/redwood-yoga/src/commonMain/kotlin/app/cash/redwood/yoga/internal/Yoga.kt index c11f848e83..7bc6f95c5b 100644 --- a/redwood-yoga/src/commonMain/kotlin/app/cash/redwood/yoga/internal/Yoga.kt +++ b/redwood-yoga/src/commonMain/kotlin/app/cash/redwood/yoga/internal/Yoga.kt @@ -800,7 +800,7 @@ internal object Yoga { return if (node.style.flexBasis.isPercent()) { node.style.flexBasis.convertToYgValue().value } else { - -1.0f // This is a stand-in for any non-point value. + -1.0f // This is a stand-in for any non-percent value. } } From 70533f608994ae5004f900142f865529937d1faf Mon Sep 17 00:00:00 2001 From: Colin White Date: Thu, 23 Nov 2023 02:38:18 -0800 Subject: [PATCH 3/9] Add test. --- ...FlexCreatesEquivalentSizedWidgets[LTR].png | 3 +++ ...FlexCreatesEquivalentSizedWidgets[RTL].png | 3 +++ .../layout/AbstractFlexContainerTest.kt | 26 ++++++++++++++++--- ...FlexCreatesEquivalentSizedWidgets[LTR].png | 3 +++ ...FlexCreatesEquivalentSizedWidgets[RTL].png | 3 +++ ...FlexCreatesEquivalentSizedWidgets[LTR].png | 3 +++ ...FlexCreatesEquivalentSizedWidgets[RTL].png | 3 +++ ...FlexCreatesEquivalentSizedWidgets[LTR].png | 3 +++ ...FlexCreatesEquivalentSizedWidgets[RTL].png | 3 +++ 9 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexCreatesEquivalentSizedWidgets[LTR].png create mode 100644 redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexCreatesEquivalentSizedWidgets[RTL].png create mode 100644 redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexCreatesEquivalentSizedWidgets[LTR].png create mode 100644 redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexCreatesEquivalentSizedWidgets[RTL].png create mode 100644 redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testFlexCreatesEquivalentSizedWidgets[LTR].png create mode 100644 redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testFlexCreatesEquivalentSizedWidgets[RTL].png create mode 100644 redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testFlexCreatesEquivalentSizedWidgets[LTR].png create mode 100644 redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testFlexCreatesEquivalentSizedWidgets[RTL].png diff --git a/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexCreatesEquivalentSizedWidgets[LTR].png b/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexCreatesEquivalentSizedWidgets[LTR].png new file mode 100644 index 0000000000..ebda8aa974 --- /dev/null +++ b/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexCreatesEquivalentSizedWidgets[LTR].png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bf2c950e21c16f1ba234681f69a7c1f7597d21418efa3669d5f0823c90278f26 +size 10217 diff --git a/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexCreatesEquivalentSizedWidgets[RTL].png b/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexCreatesEquivalentSizedWidgets[RTL].png new file mode 100644 index 0000000000..787b543d36 --- /dev/null +++ b/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexCreatesEquivalentSizedWidgets[RTL].png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:47f6085e608f526972a4686d33190b56cea16883b822403f1ea170c6bef935f8 +size 10291 diff --git a/redwood-layout-shared-test/src/commonMain/kotlin/app/cash/redwood/layout/AbstractFlexContainerTest.kt b/redwood-layout-shared-test/src/commonMain/kotlin/app/cash/redwood/layout/AbstractFlexContainerTest.kt index 196f2f4c18..fef5b81a84 100644 --- a/redwood-layout-shared-test/src/commonMain/kotlin/app/cash/redwood/layout/AbstractFlexContainerTest.kt +++ b/redwood-layout-shared-test/src/commonMain/kotlin/app/cash/redwood/layout/AbstractFlexContainerTest.kt @@ -15,10 +15,12 @@ */ package app.cash.redwood.layout +import app.cash.redwood.layout.modifier.Margin as MarginModifier import app.cash.redwood.Modifier import app.cash.redwood.layout.api.Constraint import app.cash.redwood.layout.api.CrossAxisAlignment import app.cash.redwood.layout.api.MainAxisAlignment +import app.cash.redwood.layout.modifier.Flex import app.cash.redwood.layout.modifier.Grow import app.cash.redwood.layout.modifier.Height import app.cash.redwood.layout.modifier.HorizontalAlignment @@ -495,6 +497,18 @@ abstract class AbstractFlexContainerTest { verifySnapshot(parent, "single") } + @Test + fun testFlexCreatesEquivalentSizedWidgets() { + val container = flexContainer(FlexDirection.Row) + container.width(Constraint.Fill) + container.height(Constraint.Fill) + container.add(widget("REALLY LONG TEXT", FlexImpl(1.0))) + container.add(widget("SHORTER TEXT", FlexImpl(1.0))) + container.add(widget("A", FlexImpl(1.0))) + container.add(widget("LINE1\nLINE2\nLINE3", FlexImpl(1.0))) + verifySnapshot(container) + } + /** We don't have assume() on kotlin.test. Tests that fail here should be skipped instead. */ private fun assumeTrue(b: Boolean) { assertTrue(b) @@ -550,15 +564,19 @@ private data class SizeImpl( ) : Size private data class MarginImpl( - override val margin: app.cash.redwood.ui.Margin, -) : app.cash.redwood.layout.modifier.Margin { + override val margin: Margin, +) : MarginModifier { constructor(all: Dp = 0.dp) : this(Margin(all)) } private data class GrowImpl( - override val `value`: Double, + override val value: Double, ) : Grow private data class ShrinkImpl( - override val `value`: Double, + override val value: Double, ) : Shrink + +private data class FlexImpl( + override val value: Double, +) : Flex diff --git a/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexCreatesEquivalentSizedWidgets[LTR].png b/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexCreatesEquivalentSizedWidgets[LTR].png new file mode 100644 index 0000000000..ebda8aa974 --- /dev/null +++ b/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexCreatesEquivalentSizedWidgets[LTR].png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bf2c950e21c16f1ba234681f69a7c1f7597d21418efa3669d5f0823c90278f26 +size 10217 diff --git a/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexCreatesEquivalentSizedWidgets[RTL].png b/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexCreatesEquivalentSizedWidgets[RTL].png new file mode 100644 index 0000000000..787b543d36 --- /dev/null +++ b/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexCreatesEquivalentSizedWidgets[RTL].png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:47f6085e608f526972a4686d33190b56cea16883b822403f1ea170c6bef935f8 +size 10291 diff --git a/redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testFlexCreatesEquivalentSizedWidgets[LTR].png b/redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testFlexCreatesEquivalentSizedWidgets[LTR].png new file mode 100644 index 0000000000..9a2c59b3c2 --- /dev/null +++ b/redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testFlexCreatesEquivalentSizedWidgets[LTR].png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:acc62a51e5e2cb9fcbf2c66623255c90b2a9ec71fd8daa3cc91ffc9a0e8ad5ba +size 10218 diff --git a/redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testFlexCreatesEquivalentSizedWidgets[RTL].png b/redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testFlexCreatesEquivalentSizedWidgets[RTL].png new file mode 100644 index 0000000000..236f4ef34b --- /dev/null +++ b/redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testFlexCreatesEquivalentSizedWidgets[RTL].png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:21680269f0226afd516b2ee8f52a301260db3ab04d1c3cde39b3983827fde4ba +size 10160 diff --git a/redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testFlexCreatesEquivalentSizedWidgets[LTR].png b/redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testFlexCreatesEquivalentSizedWidgets[LTR].png new file mode 100644 index 0000000000..ebb6a426ef --- /dev/null +++ b/redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testFlexCreatesEquivalentSizedWidgets[LTR].png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cdca08973fd5cbf55a12717a65eaa147bbfaff662cc7dca62bcae0f9d63a9859 +size 3837 diff --git a/redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testFlexCreatesEquivalentSizedWidgets[RTL].png b/redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testFlexCreatesEquivalentSizedWidgets[RTL].png new file mode 100644 index 0000000000..ebb6a426ef --- /dev/null +++ b/redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testFlexCreatesEquivalentSizedWidgets[RTL].png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cdca08973fd5cbf55a12717a65eaa147bbfaff662cc7dca62bcae0f9d63a9859 +size 3837 From 2c726f4c9e8de1fbd0a52e46908cafe29ca50ac1 Mon Sep 17 00:00:00 2001 From: Colin White Date: Thu, 23 Nov 2023 02:48:57 -0800 Subject: [PATCH 4/9] Re-add and deprecate. --- .../redwood/layout/compose/LayoutScopes.kt | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 redwood-layout-compose/src/commonMain/kotlin/app/cash/redwood/layout/compose/LayoutScopes.kt diff --git a/redwood-layout-compose/src/commonMain/kotlin/app/cash/redwood/layout/compose/LayoutScopes.kt b/redwood-layout-compose/src/commonMain/kotlin/app/cash/redwood/layout/compose/LayoutScopes.kt new file mode 100644 index 0000000000..0d16263410 --- /dev/null +++ b/redwood-layout-compose/src/commonMain/kotlin/app/cash/redwood/layout/compose/LayoutScopes.kt @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2023 Square, Inc. + * + * 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 app.cash.redwood.layout.compose + +import androidx.compose.runtime.Stable +import app.cash.redwood.Modifier + +/** + * Equivalent to `modifier.grow(value).shrink(value)`. + * + * Call this in [ColumnScope] or [RowScope]. + */ +@Stable +@Deprecated( + message = "This extension function is obselete now that RowScope and " + + "ColumnScope support flex directly. Remove the import for this function.", + replaceWith = ReplaceWith("flex(value)"), +) +public fun Modifier.flex(`value`: Double): Modifier = + then(GrowImpl(`value`)).then(ShrinkImpl(`value`)) From 0462c9f153631c92cd2b58a94d903afacfb36ac0 Mon Sep 17 00:00:00 2001 From: Colin White Date: Thu, 23 Nov 2023 02:49:18 -0800 Subject: [PATCH 5/9] Mark as error. --- .../kotlin/app/cash/redwood/layout/compose/LayoutScopes.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/redwood-layout-compose/src/commonMain/kotlin/app/cash/redwood/layout/compose/LayoutScopes.kt b/redwood-layout-compose/src/commonMain/kotlin/app/cash/redwood/layout/compose/LayoutScopes.kt index 0d16263410..4ee89442c2 100644 --- a/redwood-layout-compose/src/commonMain/kotlin/app/cash/redwood/layout/compose/LayoutScopes.kt +++ b/redwood-layout-compose/src/commonMain/kotlin/app/cash/redwood/layout/compose/LayoutScopes.kt @@ -28,6 +28,7 @@ import app.cash.redwood.Modifier message = "This extension function is obselete now that RowScope and " + "ColumnScope support flex directly. Remove the import for this function.", replaceWith = ReplaceWith("flex(value)"), + level = DeprecationLevel.ERROR, ) public fun Modifier.flex(`value`: Double): Modifier = then(GrowImpl(`value`)).then(ShrinkImpl(`value`)) From 7c7250b7177d14294edf0f8809eb39658ce5d0bb Mon Sep 17 00:00:00 2001 From: Colin White Date: Thu, 23 Nov 2023 03:04:55 -0800 Subject: [PATCH 6/9] Spotless. --- .../kotlin/app/cash/redwood/layout/AbstractFlexContainerTest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redwood-layout-shared-test/src/commonMain/kotlin/app/cash/redwood/layout/AbstractFlexContainerTest.kt b/redwood-layout-shared-test/src/commonMain/kotlin/app/cash/redwood/layout/AbstractFlexContainerTest.kt index fef5b81a84..fbb164aeaa 100644 --- a/redwood-layout-shared-test/src/commonMain/kotlin/app/cash/redwood/layout/AbstractFlexContainerTest.kt +++ b/redwood-layout-shared-test/src/commonMain/kotlin/app/cash/redwood/layout/AbstractFlexContainerTest.kt @@ -15,7 +15,6 @@ */ package app.cash.redwood.layout -import app.cash.redwood.layout.modifier.Margin as MarginModifier import app.cash.redwood.Modifier import app.cash.redwood.layout.api.Constraint import app.cash.redwood.layout.api.CrossAxisAlignment @@ -24,6 +23,7 @@ import app.cash.redwood.layout.modifier.Flex import app.cash.redwood.layout.modifier.Grow import app.cash.redwood.layout.modifier.Height import app.cash.redwood.layout.modifier.HorizontalAlignment +import app.cash.redwood.layout.modifier.Margin as MarginModifier import app.cash.redwood.layout.modifier.Shrink import app.cash.redwood.layout.modifier.Size import app.cash.redwood.layout.modifier.VerticalAlignment From 87d267474a67828f77ffe0908143577daf5440c8 Mon Sep 17 00:00:00 2001 From: Colin White Date: Thu, 23 Nov 2023 11:28:40 -0800 Subject: [PATCH 7/9] Update redwood-layout-compose/src/commonMain/kotlin/app/cash/redwood/layout/compose/LayoutScopes.kt Co-authored-by: Jake Wharton --- .../kotlin/app/cash/redwood/layout/compose/LayoutScopes.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/redwood-layout-compose/src/commonMain/kotlin/app/cash/redwood/layout/compose/LayoutScopes.kt b/redwood-layout-compose/src/commonMain/kotlin/app/cash/redwood/layout/compose/LayoutScopes.kt index 4ee89442c2..a8f2a903da 100644 --- a/redwood-layout-compose/src/commonMain/kotlin/app/cash/redwood/layout/compose/LayoutScopes.kt +++ b/redwood-layout-compose/src/commonMain/kotlin/app/cash/redwood/layout/compose/LayoutScopes.kt @@ -27,7 +27,6 @@ import app.cash.redwood.Modifier @Deprecated( message = "This extension function is obselete now that RowScope and " + "ColumnScope support flex directly. Remove the import for this function.", - replaceWith = ReplaceWith("flex(value)"), level = DeprecationLevel.ERROR, ) public fun Modifier.flex(`value`: Double): Modifier = From 953dbebe5076c43415dcafe517c4c9d156b14752 Mon Sep 17 00:00:00 2001 From: Colin White Date: Thu, 23 Nov 2023 14:40:08 -0800 Subject: [PATCH 8/9] Update tests. --- ...testFlexDistributesWeightEqually[LTR].png} | 0 ...testFlexDistributesWeightEqually[RTL].png} | 0 ...estFlexDistributesWeightUnequally[LTR].png | 3 ++ ...estFlexDistributesWeightUnequally[RTL].png | 3 ++ .../layout/AbstractFlexContainerTest.kt | 14 ++++- .../RedwoodLayoutUIViewTests.xcscheme | 54 +++++++++++++++++++ ...testFlexDistributesWeightEqually[LTR].png} | 0 ...testFlexDistributesWeightEqually[RTL].png} | 0 ...estFlexDistributesWeightUnequally[LTR].png | 3 ++ ...estFlexDistributesWeightUnequally[RTL].png | 3 ++ ...testFlexDistributesWeightEqually[LTR].png} | 0 ...testFlexDistributesWeightEqually[RTL].png} | 0 ...estFlexDistributesWeightUnequally[LTR].png | 3 ++ ...estFlexDistributesWeightUnequally[RTL].png | 3 ++ ...testFlexDistributesWeightEqually[LTR].png} | 0 ...testFlexDistributesWeightEqually[RTL].png} | 0 ...estFlexDistributesWeightUnequally[LTR].png | 3 ++ ...estFlexDistributesWeightUnequally[RTL].png | 3 ++ 18 files changed, 91 insertions(+), 1 deletion(-) rename redwood-layout-composeui/src/test/snapshots/images/{app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexCreatesEquivalentSizedWidgets[LTR].png => app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexDistributesWeightEqually[LTR].png} (100%) rename redwood-layout-composeui/src/test/snapshots/images/{app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexCreatesEquivalentSizedWidgets[RTL].png => app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexDistributesWeightEqually[RTL].png} (100%) create mode 100644 redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexDistributesWeightUnequally[LTR].png create mode 100644 redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexDistributesWeightUnequally[RTL].png create mode 100644 redwood-layout-uiview/RedwoodLayoutUIViewTests.xcodeproj/xcshareddata/xcschemes/RedwoodLayoutUIViewTests.xcscheme rename redwood-layout-view/src/test/snapshots/images/{app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexCreatesEquivalentSizedWidgets[LTR].png => app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexDistributesWeightEqually[LTR].png} (100%) rename redwood-layout-view/src/test/snapshots/images/{app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexCreatesEquivalentSizedWidgets[RTL].png => app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexDistributesWeightEqually[RTL].png} (100%) create mode 100644 redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexDistributesWeightUnequally[LTR].png create mode 100644 redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexDistributesWeightUnequally[RTL].png rename redwood-lazylayout-composeui/src/test/snapshots/images/{app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testFlexCreatesEquivalentSizedWidgets[LTR].png => app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testFlexDistributesWeightEqually[LTR].png} (100%) rename redwood-lazylayout-composeui/src/test/snapshots/images/{app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testFlexCreatesEquivalentSizedWidgets[RTL].png => app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testFlexDistributesWeightEqually[RTL].png} (100%) create mode 100644 redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testFlexDistributesWeightUnequally[LTR].png create mode 100644 redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testFlexDistributesWeightUnequally[RTL].png rename redwood-lazylayout-view/src/test/snapshots/images/{app.cash.redwood.lazylayout.view_ViewLazyListTest_testFlexCreatesEquivalentSizedWidgets[LTR].png => app.cash.redwood.lazylayout.view_ViewLazyListTest_testFlexDistributesWeightEqually[LTR].png} (100%) rename redwood-lazylayout-view/src/test/snapshots/images/{app.cash.redwood.lazylayout.view_ViewLazyListTest_testFlexCreatesEquivalentSizedWidgets[RTL].png => app.cash.redwood.lazylayout.view_ViewLazyListTest_testFlexDistributesWeightEqually[RTL].png} (100%) create mode 100644 redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testFlexDistributesWeightUnequally[LTR].png create mode 100644 redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testFlexDistributesWeightUnequally[RTL].png diff --git a/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexCreatesEquivalentSizedWidgets[LTR].png b/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexDistributesWeightEqually[LTR].png similarity index 100% rename from redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexCreatesEquivalentSizedWidgets[LTR].png rename to redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexDistributesWeightEqually[LTR].png diff --git a/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexCreatesEquivalentSizedWidgets[RTL].png b/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexDistributesWeightEqually[RTL].png similarity index 100% rename from redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexCreatesEquivalentSizedWidgets[RTL].png rename to redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexDistributesWeightEqually[RTL].png diff --git a/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexDistributesWeightUnequally[LTR].png b/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexDistributesWeightUnequally[LTR].png new file mode 100644 index 0000000000..a98bbd011e --- /dev/null +++ b/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexDistributesWeightUnequally[LTR].png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9bca3940fac5f97e68c4f739576dde64d481db472cc56aed60969df7dd5ddf13 +size 10240 diff --git a/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexDistributesWeightUnequally[RTL].png b/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexDistributesWeightUnequally[RTL].png new file mode 100644 index 0000000000..f075c132dd --- /dev/null +++ b/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testFlexDistributesWeightUnequally[RTL].png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9f2ae8b6c781141c460143f3593e712c8f9e69817a536d3acb33f84b27b13d7f +size 10154 diff --git a/redwood-layout-shared-test/src/commonMain/kotlin/app/cash/redwood/layout/AbstractFlexContainerTest.kt b/redwood-layout-shared-test/src/commonMain/kotlin/app/cash/redwood/layout/AbstractFlexContainerTest.kt index fbb164aeaa..f4503275ea 100644 --- a/redwood-layout-shared-test/src/commonMain/kotlin/app/cash/redwood/layout/AbstractFlexContainerTest.kt +++ b/redwood-layout-shared-test/src/commonMain/kotlin/app/cash/redwood/layout/AbstractFlexContainerTest.kt @@ -498,7 +498,7 @@ abstract class AbstractFlexContainerTest { } @Test - fun testFlexCreatesEquivalentSizedWidgets() { + fun testFlexDistributesWeightEqually() { val container = flexContainer(FlexDirection.Row) container.width(Constraint.Fill) container.height(Constraint.Fill) @@ -509,6 +509,18 @@ abstract class AbstractFlexContainerTest { verifySnapshot(container) } + @Test + fun testFlexDistributesWeightUnequally() { + val container = flexContainer(FlexDirection.Row) + container.width(Constraint.Fill) + container.height(Constraint.Fill) + container.add(widget("REALLY LONG TEXT", FlexImpl(3.0))) + container.add(widget("SHORTER TEXT", FlexImpl(1.0))) + container.add(widget("A", FlexImpl(1.0))) + container.add(widget("LINE1\nLINE2\nLINE3", FlexImpl(1.0))) + verifySnapshot(container) + } + /** We don't have assume() on kotlin.test. Tests that fail here should be skipped instead. */ private fun assumeTrue(b: Boolean) { assertTrue(b) diff --git a/redwood-layout-uiview/RedwoodLayoutUIViewTests.xcodeproj/xcshareddata/xcschemes/RedwoodLayoutUIViewTests.xcscheme b/redwood-layout-uiview/RedwoodLayoutUIViewTests.xcodeproj/xcshareddata/xcschemes/RedwoodLayoutUIViewTests.xcscheme new file mode 100644 index 0000000000..b489a6b622 --- /dev/null +++ b/redwood-layout-uiview/RedwoodLayoutUIViewTests.xcodeproj/xcshareddata/xcschemes/RedwoodLayoutUIViewTests.xcscheme @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexCreatesEquivalentSizedWidgets[LTR].png b/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexDistributesWeightEqually[LTR].png similarity index 100% rename from redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexCreatesEquivalentSizedWidgets[LTR].png rename to redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexDistributesWeightEqually[LTR].png diff --git a/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexCreatesEquivalentSizedWidgets[RTL].png b/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexDistributesWeightEqually[RTL].png similarity index 100% rename from redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexCreatesEquivalentSizedWidgets[RTL].png rename to redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexDistributesWeightEqually[RTL].png diff --git a/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexDistributesWeightUnequally[LTR].png b/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexDistributesWeightUnequally[LTR].png new file mode 100644 index 0000000000..51ef899710 --- /dev/null +++ b/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexDistributesWeightUnequally[LTR].png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8211254756c6ef0608390d6ef17ff97f6994e17bed7fcbaf9441ed40d917baf1 +size 10318 diff --git a/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexDistributesWeightUnequally[RTL].png b/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexDistributesWeightUnequally[RTL].png new file mode 100644 index 0000000000..57f1416310 --- /dev/null +++ b/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testFlexDistributesWeightUnequally[RTL].png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9e5df9553cc1bb3e73a3df3c50cf33e6c98529cab0d1cecb4cad60d681a41da4 +size 10467 diff --git a/redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testFlexCreatesEquivalentSizedWidgets[LTR].png b/redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testFlexDistributesWeightEqually[LTR].png similarity index 100% rename from redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testFlexCreatesEquivalentSizedWidgets[LTR].png rename to redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testFlexDistributesWeightEqually[LTR].png diff --git a/redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testFlexCreatesEquivalentSizedWidgets[RTL].png b/redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testFlexDistributesWeightEqually[RTL].png similarity index 100% rename from redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testFlexCreatesEquivalentSizedWidgets[RTL].png rename to redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testFlexDistributesWeightEqually[RTL].png diff --git a/redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testFlexDistributesWeightUnequally[LTR].png b/redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testFlexDistributesWeightUnequally[LTR].png new file mode 100644 index 0000000000..9a2c59b3c2 --- /dev/null +++ b/redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testFlexDistributesWeightUnequally[LTR].png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:acc62a51e5e2cb9fcbf2c66623255c90b2a9ec71fd8daa3cc91ffc9a0e8ad5ba +size 10218 diff --git a/redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testFlexDistributesWeightUnequally[RTL].png b/redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testFlexDistributesWeightUnequally[RTL].png new file mode 100644 index 0000000000..236f4ef34b --- /dev/null +++ b/redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testFlexDistributesWeightUnequally[RTL].png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:21680269f0226afd516b2ee8f52a301260db3ab04d1c3cde39b3983827fde4ba +size 10160 diff --git a/redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testFlexCreatesEquivalentSizedWidgets[LTR].png b/redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testFlexDistributesWeightEqually[LTR].png similarity index 100% rename from redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testFlexCreatesEquivalentSizedWidgets[LTR].png rename to redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testFlexDistributesWeightEqually[LTR].png diff --git a/redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testFlexCreatesEquivalentSizedWidgets[RTL].png b/redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testFlexDistributesWeightEqually[RTL].png similarity index 100% rename from redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testFlexCreatesEquivalentSizedWidgets[RTL].png rename to redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testFlexDistributesWeightEqually[RTL].png diff --git a/redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testFlexDistributesWeightUnequally[LTR].png b/redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testFlexDistributesWeightUnequally[LTR].png new file mode 100644 index 0000000000..ebb6a426ef --- /dev/null +++ b/redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testFlexDistributesWeightUnequally[LTR].png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cdca08973fd5cbf55a12717a65eaa147bbfaff662cc7dca62bcae0f9d63a9859 +size 3837 diff --git a/redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testFlexDistributesWeightUnequally[RTL].png b/redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testFlexDistributesWeightUnequally[RTL].png new file mode 100644 index 0000000000..ebb6a426ef --- /dev/null +++ b/redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testFlexDistributesWeightUnequally[RTL].png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cdca08973fd5cbf55a12717a65eaa147bbfaff662cc7dca62bcae0f9d63a9859 +size 3837 From 9c109f16202f0ac68bed2ae35d5e57b5b40be95b Mon Sep 17 00:00:00 2001 From: Colin White Date: Thu, 23 Nov 2023 16:25:12 -0800 Subject: [PATCH 9/9] Add iOS tests. --- .../testFlexDistributesWeightEqually.1.png | 3 +++ .../testFlexDistributesWeightUnequally.1.png | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 redwood-layout-uiview/RedwoodLayoutUIViewTests/__Snapshots__/UIViewFlexContainerTestHost/testFlexDistributesWeightEqually.1.png create mode 100644 redwood-layout-uiview/RedwoodLayoutUIViewTests/__Snapshots__/UIViewFlexContainerTestHost/testFlexDistributesWeightUnequally.1.png diff --git a/redwood-layout-uiview/RedwoodLayoutUIViewTests/__Snapshots__/UIViewFlexContainerTestHost/testFlexDistributesWeightEqually.1.png b/redwood-layout-uiview/RedwoodLayoutUIViewTests/__Snapshots__/UIViewFlexContainerTestHost/testFlexDistributesWeightEqually.1.png new file mode 100644 index 0000000000..77873ba145 --- /dev/null +++ b/redwood-layout-uiview/RedwoodLayoutUIViewTests/__Snapshots__/UIViewFlexContainerTestHost/testFlexDistributesWeightEqually.1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:08702e97effc63a8329e2b0c1b2765ae8c2424a47a9ee2afd2e783c589055d1e +size 73348 diff --git a/redwood-layout-uiview/RedwoodLayoutUIViewTests/__Snapshots__/UIViewFlexContainerTestHost/testFlexDistributesWeightUnequally.1.png b/redwood-layout-uiview/RedwoodLayoutUIViewTests/__Snapshots__/UIViewFlexContainerTestHost/testFlexDistributesWeightUnequally.1.png new file mode 100644 index 0000000000..6ec11a11aa --- /dev/null +++ b/redwood-layout-uiview/RedwoodLayoutUIViewTests/__Snapshots__/UIViewFlexContainerTestHost/testFlexDistributesWeightUnequally.1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4d89029ad74cdcddbd5dcb8ba78b8f573db455541847c28370ea6654adf445ec +size 73097