Skip to content

Commit

Permalink
More realistic, failing BackstackTransitionsTest
Browse files Browse the repository at this point in the history
`BackstackTransitionsTest` now uses a map, to expose problems hidden when key and content are the same thing. As a result we crash when popping.

Reproduces #63.
  • Loading branch information
rjrjr committed Aug 26, 2022
1 parent 82429b4 commit db1d5a1
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,18 @@ class BackstackTransitionsTest {
}

private fun assertTransition(transition: BackstackTransition, forward: Boolean) {
val firstBackstack = listOf("one")
val secondBackstack = listOf("one", "two")
val firstBackstack = mapOf(1 to "one")
val secondBackstack = mapOf(1 to "one", 2 to "two")
var backstack by mutableStateOf(if (forward) firstBackstack else secondBackstack)
compose.mainClock.autoAdvance = false
compose.setContent {
Backstack(
backstack,
backstack.keys.toList(),
frameController = rememberTransitionController(
animationSpec = animation,
transition = transition
)
) { BasicText(it) }
) { BasicText(backstack.getValue(it)) }
}
val initialText = if (forward) "one" else "two"
val newText = if (forward) "two" else "one"
Expand Down

0 comments on commit db1d5a1

Please sign in to comment.