Skip to content

Commit

Permalink
Add a test to demonstrate a layout bug in Yoga (#2346)
Browse files Browse the repository at this point in the history
* Add a test to demonstrate a layout bug in Yoga

We've accidentally set the maximum width of a cell to its
maximum height.

* Use fewer 'A's in the snapshot
  • Loading branch information
squarejesse authored Oct 1, 2024
1 parent d5a72d9 commit 98c04fc
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 0 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,27 @@ abstract class AbstractFlexContainerTest<T : Any> {
snapshotter(container.value).snapshot()
}

@Test fun testRowWithFixedWidthHasChildWithFixedHeight() {
val container = flexContainer(FlexDirection.Row).apply {
crossAxisAlignment(CrossAxisAlignment.Start)
modifier = WidthImpl(200.dp)
width(Constraint.Fill)
height(Constraint.Fill)
}

widgetFactory.text("A ".repeat(10)).apply {
modifier = HeightImpl(50.dp)
container.children.insert(0, this)
}

widgetFactory.text("B ".repeat(100)).apply {
container.children.insert(1, this)
}

container.onEndChanges()
snapshotter(container.value).snapshot()
}

@Test fun testChildWithUpdatedProperty() {
val container = flexContainer(FlexDirection.Column)
val snapshotter = snapshotter(container.value)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 98c04fc

Please sign in to comment.