From 924ed6580b0154a1aa92f0f63b328351db50fd2f Mon Sep 17 00:00:00 2001 From: Jesse Wilson Date: Fri, 17 Nov 2023 13:44:01 -0500 Subject: [PATCH] Test layout content changes We were missing tests for items being removed from Column, etc. --- .../composeui/ComposeUiFlexContainerTest.kt | 14 +++++++++-- ...t_testDynamicElementUpdates[LTR]_abcde.png | 3 +++ ...st_testDynamicElementUpdates[LTR]_abde.png | 3 +++ ...st_testDynamicElementUpdates[LTR]_bcde.png | 3 +++ ...t_testDynamicElementUpdates[RTL]_abcde.png | 3 +++ ...st_testDynamicElementUpdates[RTL]_abde.png | 3 +++ ...st_testDynamicElementUpdates[RTL]_bcde.png | 3 +++ .../layout/AbstractFlexContainerTest.kt | 24 +++++++++++++++++++ .../layout/uiview/UIViewFlexContainerTest.kt | 12 +++++++++- .../layout/view/ViewFlexContainerTest.kt | 12 +++++++++- ...t_testDynamicElementUpdates[LTR]_abcde.png | 3 +++ ...st_testDynamicElementUpdates[LTR]_abde.png | 3 +++ ...st_testDynamicElementUpdates[LTR]_bcde.png | 3 +++ ...t_testDynamicElementUpdates[RTL]_abcde.png | 3 +++ ...st_testDynamicElementUpdates[RTL]_abde.png | 3 +++ ...st_testDynamicElementUpdates[RTL]_bcde.png | 3 +++ .../layout/composeui/ComposeUiLazyListTest.kt | 14 +++++++++-- ...t_testDynamicElementUpdates[LTR]_abcde.png | 3 +++ ...st_testDynamicElementUpdates[LTR]_abde.png | 3 +++ ...st_testDynamicElementUpdates[LTR]_bcde.png | 3 +++ ...t_testDynamicElementUpdates[RTL]_abcde.png | 3 +++ ...st_testDynamicElementUpdates[RTL]_abde.png | 3 +++ ...st_testDynamicElementUpdates[RTL]_bcde.png | 3 +++ .../lazylayout/view/ViewLazyListTest.kt | 12 +++++++++- ...t_testDynamicElementUpdates[LTR]_abcde.png | 3 +++ ...st_testDynamicElementUpdates[LTR]_abde.png | 3 +++ ...st_testDynamicElementUpdates[LTR]_bcde.png | 3 +++ ...t_testDynamicElementUpdates[RTL]_abcde.png | 3 +++ ...st_testDynamicElementUpdates[RTL]_abde.png | 3 +++ ...st_testDynamicElementUpdates[RTL]_bcde.png | 3 +++ 30 files changed, 153 insertions(+), 7 deletions(-) create mode 100644 redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testDynamicElementUpdates[LTR]_abcde.png create mode 100644 redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testDynamicElementUpdates[LTR]_abde.png create mode 100644 redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testDynamicElementUpdates[LTR]_bcde.png create mode 100644 redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testDynamicElementUpdates[RTL]_abcde.png create mode 100644 redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testDynamicElementUpdates[RTL]_abde.png create mode 100644 redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testDynamicElementUpdates[RTL]_bcde.png create mode 100644 redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testDynamicElementUpdates[LTR]_abcde.png create mode 100644 redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testDynamicElementUpdates[LTR]_abde.png create mode 100644 redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testDynamicElementUpdates[LTR]_bcde.png create mode 100644 redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testDynamicElementUpdates[RTL]_abcde.png create mode 100644 redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testDynamicElementUpdates[RTL]_abde.png create mode 100644 redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testDynamicElementUpdates[RTL]_bcde.png create mode 100644 redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testDynamicElementUpdates[LTR]_abcde.png create mode 100644 redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testDynamicElementUpdates[LTR]_abde.png create mode 100644 redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testDynamicElementUpdates[LTR]_bcde.png create mode 100644 redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testDynamicElementUpdates[RTL]_abcde.png create mode 100644 redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testDynamicElementUpdates[RTL]_abde.png create mode 100644 redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testDynamicElementUpdates[RTL]_bcde.png create mode 100644 redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testDynamicElementUpdates[LTR]_abcde.png create mode 100644 redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testDynamicElementUpdates[LTR]_abde.png create mode 100644 redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testDynamicElementUpdates[LTR]_bcde.png create mode 100644 redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testDynamicElementUpdates[RTL]_abcde.png create mode 100644 redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testDynamicElementUpdates[RTL]_abde.png create mode 100644 redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testDynamicElementUpdates[RTL]_bcde.png diff --git a/redwood-layout-composeui/src/androidUnitTest/kotlin/app/cash/redwood/layout/composeui/ComposeUiFlexContainerTest.kt b/redwood-layout-composeui/src/androidUnitTest/kotlin/app/cash/redwood/layout/composeui/ComposeUiFlexContainerTest.kt index 12640184b4..456c52e41d 100644 --- a/redwood-layout-composeui/src/androidUnitTest/kotlin/app/cash/redwood/layout/composeui/ComposeUiFlexContainerTest.kt +++ b/redwood-layout-composeui/src/androidUnitTest/kotlin/app/cash/redwood/layout/composeui/ComposeUiFlexContainerTest.kt @@ -15,6 +15,7 @@ */ package app.cash.redwood.layout.composeui +import app.cash.redwood.Modifier as RedwoodModifier import androidx.compose.foundation.background import androidx.compose.foundation.text.BasicText import androidx.compose.runtime.Composable @@ -27,7 +28,6 @@ import androidx.compose.ui.text.TextStyle import androidx.compose.ui.unit.sp import app.cash.paparazzi.DeviceConfig import app.cash.paparazzi.Paparazzi -import app.cash.redwood.Modifier as RedwoodModifier import app.cash.redwood.layout.AbstractFlexContainerTest import app.cash.redwood.layout.TestFlexContainer import app.cash.redwood.layout.Text @@ -90,7 +90,17 @@ class ComposeUiFlexContainerTest( ) override fun add(widget: Widget<@Composable () -> Unit>) { - delegate.children.insert(childCount++, widget) + addAt(childCount, widget) + } + + override fun addAt(index: Int, widget: Widget<() -> Unit>) { + delegate.children.insert(index, widget) + childCount++ + } + + override fun removeAt(index: Int) { + delegate.children.remove(index = index, count = 1) + childCount-- } override fun onEndChanges() { diff --git a/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testDynamicElementUpdates[LTR]_abcde.png b/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testDynamicElementUpdates[LTR]_abcde.png new file mode 100644 index 0000000000..fa9eee49e8 --- /dev/null +++ b/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testDynamicElementUpdates[LTR]_abcde.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:84c70ea7306c335b4f5ef372d5e49b4ce71e4800660f3a9e40613681ff572948 +size 5307 diff --git a/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testDynamicElementUpdates[LTR]_abde.png b/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testDynamicElementUpdates[LTR]_abde.png new file mode 100644 index 0000000000..67f0d8af8f --- /dev/null +++ b/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testDynamicElementUpdates[LTR]_abde.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3def4c79fa6ff36bc428a00d2d866425f067426a3ede81a39ba986cfbdc17524 +size 4970 diff --git a/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testDynamicElementUpdates[LTR]_bcde.png b/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testDynamicElementUpdates[LTR]_bcde.png new file mode 100644 index 0000000000..08b4d43983 --- /dev/null +++ b/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testDynamicElementUpdates[LTR]_bcde.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:647993ec7eacd77063d68f106b7eae9750146c1838bcbb5507566548c04d0c99 +size 4976 diff --git a/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testDynamicElementUpdates[RTL]_abcde.png b/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testDynamicElementUpdates[RTL]_abcde.png new file mode 100644 index 0000000000..91497717ff --- /dev/null +++ b/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testDynamicElementUpdates[RTL]_abcde.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:25dfe344b7703b0cf63b37f29b03cddb2d781072935776702ec4ceb0e558b9c5 +size 5333 diff --git a/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testDynamicElementUpdates[RTL]_abde.png b/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testDynamicElementUpdates[RTL]_abde.png new file mode 100644 index 0000000000..e48f4b9b31 --- /dev/null +++ b/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testDynamicElementUpdates[RTL]_abde.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d783dfafea012c945fd2d9eacbf4495235fce067e8024226c26332854a065163 +size 5013 diff --git a/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testDynamicElementUpdates[RTL]_bcde.png b/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testDynamicElementUpdates[RTL]_bcde.png new file mode 100644 index 0000000000..b6fd97cb95 --- /dev/null +++ b/redwood-layout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiFlexContainerTest_testDynamicElementUpdates[RTL]_bcde.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bcb08a179e8e6210300536fb791f496fc2b89d14230b6110b92a72f23c54b74c +size 5037 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 0012f8e9a7..03fbd0ba1d 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 @@ -415,6 +415,28 @@ abstract class AbstractFlexContainerTest { verifySnapshot(column) } + @Test + fun testDynamicElementUpdates() { + val container = flexContainer(FlexDirection.Column) + container.width(Constraint.Fill) + container.height(Constraint.Fill) + container.add(widget("A")) + container.add(widget("B")) + container.add(widget("D")) + container.add(widget("E")) + + container.onEndChanges() + verifySnapshot(container, "ABDE") + + container.addAt(index = 2, widget = widget("C")) + container.onEndChanges() + verifySnapshot(container, "ABCDE") + + container.removeAt(index = 0) + container.onEndChanges() + verifySnapshot(container, "BCDE") + } + /** We don't have assume() on kotlin.test. Tests that fail here should be skipped instead. */ private fun assumeTrue(b: Boolean) { assertTrue(b) @@ -429,6 +451,8 @@ interface TestFlexContainer : Widget, ChangeListener { fun mainAxisAlignment(mainAxisAlignment: MainAxisAlignment) fun margin(margin: Margin) fun add(widget: Widget) + fun addAt(index: Int, widget: Widget) + fun removeAt(index: Int) } interface Text : Widget { diff --git a/redwood-layout-uiview/src/commonTest/kotlin/app/cash/redwood/layout/uiview/UIViewFlexContainerTest.kt b/redwood-layout-uiview/src/commonTest/kotlin/app/cash/redwood/layout/uiview/UIViewFlexContainerTest.kt index 8ed33a6762..e5a76a3591 100644 --- a/redwood-layout-uiview/src/commonTest/kotlin/app/cash/redwood/layout/uiview/UIViewFlexContainerTest.kt +++ b/redwood-layout-uiview/src/commonTest/kotlin/app/cash/redwood/layout/uiview/UIViewFlexContainerTest.kt @@ -61,7 +61,17 @@ class UIViewFlexContainerTest( } override fun add(widget: Widget) { - delegate.children.insert(childCount++, widget) + addAt(childCount, widget) + } + + override fun addAt(index: Int, widget: Widget) { + delegate.children.insert(index, widget) + childCount++ + } + + override fun removeAt(index: Int) { + delegate.children.remove(index = index, count = 1) + childCount-- } } diff --git a/redwood-layout-view/src/test/kotlin/app/cash/redwood/layout/view/ViewFlexContainerTest.kt b/redwood-layout-view/src/test/kotlin/app/cash/redwood/layout/view/ViewFlexContainerTest.kt index a778b4dc8f..67033ca52d 100644 --- a/redwood-layout-view/src/test/kotlin/app/cash/redwood/layout/view/ViewFlexContainerTest.kt +++ b/redwood-layout-view/src/test/kotlin/app/cash/redwood/layout/view/ViewFlexContainerTest.kt @@ -83,7 +83,17 @@ class ViewFlexContainerTest( ) override fun add(widget: Widget) { - delegate.children.insert(childCount++, widget) + addAt(childCount, widget) + } + + override fun addAt(index: Int, widget: Widget) { + delegate.children.insert(index, widget) + childCount++ + } + + override fun removeAt(index: Int) { + delegate.children.remove(index = index, count = 1) + childCount-- } } } diff --git a/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testDynamicElementUpdates[LTR]_abcde.png b/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testDynamicElementUpdates[LTR]_abcde.png new file mode 100644 index 0000000000..fa9eee49e8 --- /dev/null +++ b/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testDynamicElementUpdates[LTR]_abcde.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:84c70ea7306c335b4f5ef372d5e49b4ce71e4800660f3a9e40613681ff572948 +size 5307 diff --git a/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testDynamicElementUpdates[LTR]_abde.png b/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testDynamicElementUpdates[LTR]_abde.png new file mode 100644 index 0000000000..67f0d8af8f --- /dev/null +++ b/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testDynamicElementUpdates[LTR]_abde.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3def4c79fa6ff36bc428a00d2d866425f067426a3ede81a39ba986cfbdc17524 +size 4970 diff --git a/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testDynamicElementUpdates[LTR]_bcde.png b/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testDynamicElementUpdates[LTR]_bcde.png new file mode 100644 index 0000000000..08b4d43983 --- /dev/null +++ b/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testDynamicElementUpdates[LTR]_bcde.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:647993ec7eacd77063d68f106b7eae9750146c1838bcbb5507566548c04d0c99 +size 4976 diff --git a/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testDynamicElementUpdates[RTL]_abcde.png b/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testDynamicElementUpdates[RTL]_abcde.png new file mode 100644 index 0000000000..91497717ff --- /dev/null +++ b/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testDynamicElementUpdates[RTL]_abcde.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:25dfe344b7703b0cf63b37f29b03cddb2d781072935776702ec4ceb0e558b9c5 +size 5333 diff --git a/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testDynamicElementUpdates[RTL]_abde.png b/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testDynamicElementUpdates[RTL]_abde.png new file mode 100644 index 0000000000..e48f4b9b31 --- /dev/null +++ b/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testDynamicElementUpdates[RTL]_abde.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d783dfafea012c945fd2d9eacbf4495235fce067e8024226c26332854a065163 +size 5013 diff --git a/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testDynamicElementUpdates[RTL]_bcde.png b/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testDynamicElementUpdates[RTL]_bcde.png new file mode 100644 index 0000000000..b6fd97cb95 --- /dev/null +++ b/redwood-layout-view/src/test/snapshots/images/app.cash.redwood.layout.view_ViewFlexContainerTest_testDynamicElementUpdates[RTL]_bcde.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bcb08a179e8e6210300536fb791f496fc2b89d14230b6110b92a72f23c54b74c +size 5037 diff --git a/redwood-lazylayout-composeui/src/androidUnitTest/kotlin/app/cash/redwood/layout/composeui/ComposeUiLazyListTest.kt b/redwood-lazylayout-composeui/src/androidUnitTest/kotlin/app/cash/redwood/layout/composeui/ComposeUiLazyListTest.kt index d02c8d6678..c9a508f993 100644 --- a/redwood-lazylayout-composeui/src/androidUnitTest/kotlin/app/cash/redwood/layout/composeui/ComposeUiLazyListTest.kt +++ b/redwood-lazylayout-composeui/src/androidUnitTest/kotlin/app/cash/redwood/layout/composeui/ComposeUiLazyListTest.kt @@ -15,6 +15,7 @@ */ package app.cash.redwood.layout.composeui +import app.cash.redwood.Modifier as RedwoodModifier import androidx.compose.foundation.background import androidx.compose.foundation.text.BasicText import androidx.compose.runtime.Composable @@ -27,7 +28,6 @@ import androidx.compose.ui.text.TextStyle import androidx.compose.ui.unit.sp import app.cash.paparazzi.DeviceConfig import app.cash.paparazzi.Paparazzi -import app.cash.redwood.Modifier as RedwoodModifier import app.cash.redwood.layout.AbstractFlexContainerTest import app.cash.redwood.layout.TestFlexContainer import app.cash.redwood.layout.Text @@ -96,7 +96,17 @@ class ComposeUiLazyListTest( } override fun add(widget: Widget<@Composable () -> Unit>) { - delegate.items.insert(childCount++, widget) + addAt(childCount, widget) + } + + override fun addAt(index: Int, widget: Widget<() -> Unit>) { + delegate.items.insert(index, widget) + childCount++ + } + + override fun removeAt(index: Int) { + delegate.items.remove(index = index, count = 1) + childCount-- } override fun onEndChanges() { diff --git a/redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testDynamicElementUpdates[LTR]_abcde.png b/redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testDynamicElementUpdates[LTR]_abcde.png new file mode 100644 index 0000000000..c34ed55a5d --- /dev/null +++ b/redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testDynamicElementUpdates[LTR]_abcde.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:447b60563e10b2a9447bcbb12063cf3e64ef565801072685f46b27bc5a69b2ed +size 5112 diff --git a/redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testDynamicElementUpdates[LTR]_abde.png b/redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testDynamicElementUpdates[LTR]_abde.png new file mode 100644 index 0000000000..053b9d62bf --- /dev/null +++ b/redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testDynamicElementUpdates[LTR]_abde.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bad1bb41743071c9468d065da2e06d1e36e1c08f2ddfdd5ce7f379d7942580db +size 4805 diff --git a/redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testDynamicElementUpdates[LTR]_bcde.png b/redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testDynamicElementUpdates[LTR]_bcde.png new file mode 100644 index 0000000000..2ab047ce56 --- /dev/null +++ b/redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testDynamicElementUpdates[LTR]_bcde.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aeb31084a2a8a4cfe5c650451e294f5bc2211455470a400e96fbe8dba943dd27 +size 4817 diff --git a/redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testDynamicElementUpdates[RTL]_abcde.png b/redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testDynamicElementUpdates[RTL]_abcde.png new file mode 100644 index 0000000000..2e529eea4e --- /dev/null +++ b/redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testDynamicElementUpdates[RTL]_abcde.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:165f80e674d1354b42612c3e335548b1ba714752c7e2b5204c6ca44e6816bc68 +size 5208 diff --git a/redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testDynamicElementUpdates[RTL]_abde.png b/redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testDynamicElementUpdates[RTL]_abde.png new file mode 100644 index 0000000000..792b6e2f5e --- /dev/null +++ b/redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testDynamicElementUpdates[RTL]_abde.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:04416c3b64a1e6e1543be3a65785ebf4a4891ae9523ff01ee9444e7af38efbf5 +size 4905 diff --git a/redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testDynamicElementUpdates[RTL]_bcde.png b/redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testDynamicElementUpdates[RTL]_bcde.png new file mode 100644 index 0000000000..382803840d --- /dev/null +++ b/redwood-lazylayout-composeui/src/test/snapshots/images/app.cash.redwood.layout.composeui_ComposeUiLazyListTest_testDynamicElementUpdates[RTL]_bcde.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3b9086943c97c3353418a09124b4231700cd3adf9a2d8ddc7e316df22c69fca4 +size 4897 diff --git a/redwood-lazylayout-view/src/test/kotlin/app/cash/redwood/lazylayout/view/ViewLazyListTest.kt b/redwood-lazylayout-view/src/test/kotlin/app/cash/redwood/lazylayout/view/ViewLazyListTest.kt index 03ef65f729..c032a67234 100644 --- a/redwood-lazylayout-view/src/test/kotlin/app/cash/redwood/lazylayout/view/ViewLazyListTest.kt +++ b/redwood-lazylayout-view/src/test/kotlin/app/cash/redwood/lazylayout/view/ViewLazyListTest.kt @@ -85,7 +85,17 @@ class ViewLazyListTest( } override fun add(widget: Widget) { - delegate.items.insert(childCount++, widget) + addAt(childCount, widget) + } + + override fun addAt(index: Int, widget: Widget) { + delegate.items.insert(index, widget) + childCount++ + } + + override fun removeAt(index: Int) { + delegate.items.remove(index = index, count = 1) + childCount-- } } } diff --git a/redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testDynamicElementUpdates[LTR]_abcde.png b/redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testDynamicElementUpdates[LTR]_abcde.png new file mode 100644 index 0000000000..c34ed55a5d --- /dev/null +++ b/redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testDynamicElementUpdates[LTR]_abcde.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:447b60563e10b2a9447bcbb12063cf3e64ef565801072685f46b27bc5a69b2ed +size 5112 diff --git a/redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testDynamicElementUpdates[LTR]_abde.png b/redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testDynamicElementUpdates[LTR]_abde.png new file mode 100644 index 0000000000..053b9d62bf --- /dev/null +++ b/redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testDynamicElementUpdates[LTR]_abde.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bad1bb41743071c9468d065da2e06d1e36e1c08f2ddfdd5ce7f379d7942580db +size 4805 diff --git a/redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testDynamicElementUpdates[LTR]_bcde.png b/redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testDynamicElementUpdates[LTR]_bcde.png new file mode 100644 index 0000000000..2ab047ce56 --- /dev/null +++ b/redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testDynamicElementUpdates[LTR]_bcde.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aeb31084a2a8a4cfe5c650451e294f5bc2211455470a400e96fbe8dba943dd27 +size 4817 diff --git a/redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testDynamicElementUpdates[RTL]_abcde.png b/redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testDynamicElementUpdates[RTL]_abcde.png new file mode 100644 index 0000000000..2e529eea4e --- /dev/null +++ b/redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testDynamicElementUpdates[RTL]_abcde.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:165f80e674d1354b42612c3e335548b1ba714752c7e2b5204c6ca44e6816bc68 +size 5208 diff --git a/redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testDynamicElementUpdates[RTL]_abde.png b/redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testDynamicElementUpdates[RTL]_abde.png new file mode 100644 index 0000000000..792b6e2f5e --- /dev/null +++ b/redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testDynamicElementUpdates[RTL]_abde.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:04416c3b64a1e6e1543be3a65785ebf4a4891ae9523ff01ee9444e7af38efbf5 +size 4905 diff --git a/redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testDynamicElementUpdates[RTL]_bcde.png b/redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testDynamicElementUpdates[RTL]_bcde.png new file mode 100644 index 0000000000..382803840d --- /dev/null +++ b/redwood-lazylayout-view/src/test/snapshots/images/app.cash.redwood.lazylayout.view_ViewLazyListTest_testDynamicElementUpdates[RTL]_bcde.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3b9086943c97c3353418a09124b4231700cd3adf9a2d8ddc7e316df22c69fca4 +size 4897