Skip to content

Commit

Permalink
Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
colinrtwhite committed Jul 24, 2024
1 parent 6e0f3ff commit 1a754c1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import app.cash.redwood.layout.widget.Column
import app.cash.redwood.layout.widget.Row
import app.cash.redwood.lazylayout.composeui.ComposeUiLazyList
import app.cash.redwood.lazylayout.widget.LazyList
import app.cash.redwood.ui.Px
import app.cash.redwood.widget.Widget
import app.cash.redwood.widget.compose.ComposeWidgetChildren
import app.cash.redwood.yoga.FlexDirection
Expand Down Expand Up @@ -112,7 +113,7 @@ class ComposeUiLazyListTest(
override val value: @Composable () -> Unit get() = delegate.value

private var childCount = 0
private var onScroll: ((Double) -> Unit)? = null
private var onScroll: ((Px) -> Unit)? = null

constructor(direction: FlexDirection, backgroundColor: Int) : this(
ComposeUiLazyList().apply {
Expand All @@ -126,11 +127,11 @@ class ComposeUiLazyListTest(
override fun mainAxisAlignment(mainAxisAlignment: MainAxisAlignment) {
}

override fun onScroll(onScroll: ((Double) -> Unit)?) {
override fun onScroll(onScroll: ((Px) -> Unit)?) {
this.onScroll = onScroll
}

override fun scroll(offset: Double) {
override fun scroll(offset: Px) {
onScroll?.invoke(offset)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import app.cash.redwood.layout.view.ViewRedwoodLayoutWidgetFactory
import app.cash.redwood.layout.widget.Column
import app.cash.redwood.layout.widget.Row
import app.cash.redwood.lazylayout.widget.LazyList
import app.cash.redwood.ui.Px
import app.cash.redwood.widget.ChangeListener
import app.cash.redwood.widget.Widget
import app.cash.redwood.yoga.FlexDirection
Expand Down Expand Up @@ -94,7 +95,7 @@ class ViewLazyListTest(
LazyList<View> by delegate,
ChangeListener by delegate {
private var childCount = 0
private var onScroll: ((Double) -> Unit)? = null
private var onScroll: ((Px) -> Unit)? = null

constructor(context: Context, direction: FlexDirection, backgroundColor: Int) : this(
ViewLazyList(context).apply {
Expand All @@ -105,11 +106,11 @@ class ViewLazyListTest(

override val children: Widget.Children<View> = delegate.items

override fun onScroll(onScroll: ((Double) -> Unit)?) {
override fun onScroll(onScroll: ((Px) -> Unit)?) {
this.onScroll = onScroll
}

override fun scroll(offset: Double) {
override fun scroll(offset: Px) {
onScroll?.invoke(offset)
}

Expand Down

0 comments on commit 1a754c1

Please sign in to comment.