From db1d5a1b6d966e1da638adac5025c91219c0eb18 Mon Sep 17 00:00:00 2001 From: Ray Ryan Date: Fri, 26 Aug 2022 09:07:59 -0700 Subject: [PATCH] More realistic, failing `BackstackTransitionsTest` `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. --- .../compose/backstack/BackstackTransitionsTest.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compose-backstack/src/androidTest/java/com/zachklipp/compose/backstack/BackstackTransitionsTest.kt b/compose-backstack/src/androidTest/java/com/zachklipp/compose/backstack/BackstackTransitionsTest.kt index ee44875..b11eab9 100644 --- a/compose-backstack/src/androidTest/java/com/zachklipp/compose/backstack/BackstackTransitionsTest.kt +++ b/compose-backstack/src/androidTest/java/com/zachklipp/compose/backstack/BackstackTransitionsTest.kt @@ -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"