Skip to content

Commit

Permalink
Add a test for the already-fixed CrossAxisAlignment layout bug (#2363)
Browse files Browse the repository at this point in the history
* Add a test for the already-fixed CrossAxisAlignment layout bug

Closes: #2093

* Add a test for the already-fixed Row-child-wrapping bug

Closes: #2011
  • Loading branch information
squarejesse authored Oct 4, 2024
1 parent 1d5d711 commit d96b659
Show file tree
Hide file tree
Showing 21 changed files with 98 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.
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 @@ -871,6 +871,44 @@ abstract class AbstractFlexContainerTest<T : Any> {

snapshotter(root.value).snapshot()
}

/**
* CrossAxisAlignment.Start forces child to wrap its size on Android
* https://github.com/cashapp/redwood/issues/2093
*/
@Test fun testCrossAxisAlignmentStart() {
val root = flexContainer(FlexDirection.Column).apply {
width(Constraint.Fill)
crossAxisAlignment(CrossAxisAlignment.Start)
}

val row = row().apply {
width(Constraint.Fill)
horizontalAlignment(MainAxisAlignment.SpaceBetween)
root.add(this)
}

row.children.insert(0, widgetFactory.text("Something"))
row.children.insert(1, widgetFactory.text("Something else"))

snapshotter(root.value).snapshot()
}

/**
* Text not wrapping inside a row.
* https://github.com/cashapp/redwood/issues/2011
*/
@Test fun testTextWrapsInsideRow() {
val root = flexContainer(FlexDirection.Row)

root.add(
widgetFactory.text(
"This is a long piece of text that will wrap the screen. ".repeat(3),
),
)

snapshotter(root.value).snapshot()
}
}

interface TestFlexContainer<T : Any> :
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.
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 d96b659

Please sign in to comment.