2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-17 15:26:23 +00:00

For #25980: Use new backQueue instead of removed backStack.

This commit is contained in:
mcarare 2022-10-10 11:47:21 +03:00 committed by mergify[bot]
parent 55724deda9
commit 8ed3bf704f
2 changed files with 5 additions and 6 deletions

View File

@ -917,7 +917,7 @@ class SearchDialogFragment : AppCompatDialogFragment(), UserInteractionHandler {
internal fun getPreviousDestination(): NavBackStackEntry? {
// This duplicates the platform functionality for "previousBackStackEntry" but additionally skips this entry.
val descendingEntries = findNavController().backStack.descendingIterator()
val descendingEntries = findNavController().backQueue.reversed().iterator()
// Throw the topmost destination away.
if (descendingEntries.hasNext()) {
descendingEntries.next()

View File

@ -17,7 +17,6 @@ import org.junit.Assert.assertNull
import org.junit.Assert.assertSame
import org.junit.Before
import org.junit.Test
import java.util.ArrayDeque
internal class SearchDialogFragmentTest {
private val navController: NavController = mockk()
@ -36,14 +35,14 @@ internal class SearchDialogFragmentTest {
@Test
fun `GIVEN this is the only visible fragment WHEN asking for the previous destination THEN return null`() {
every { navController.backStack } returns ArrayDeque(listOf(getDestination(fragmentName)))
every { navController.backQueue } returns ArrayDeque(listOf(getDestination(fragmentName)))
assertNull(fragment.getPreviousDestination())
}
@Test
fun `GIVEN this and FragmentB on top of this are visible WHEN asking for the previous destination THEN return null`() {
every { navController.backStack } returns ArrayDeque(
every { navController.backQueue } returns ArrayDeque(
listOf(
getDestination(fragmentName),
getDestination("FragmentB"),
@ -56,7 +55,7 @@ internal class SearchDialogFragmentTest {
@Test
fun `GIVEN FragmentA, this and FragmentB are visible WHEN asking for the previous destination THEN return FragmentA`() {
val fragmentADestination = getDestination("FragmentA")
every { navController.backStack } returns ArrayDeque(
every { navController.backQueue } returns ArrayDeque(
listOf(
fragmentADestination,
getDestination(fragmentName),
@ -70,7 +69,7 @@ internal class SearchDialogFragmentTest {
@Test
fun `GIVEN FragmentA and this on top of it are visible WHEN asking for the previous destination THEN return FragmentA`() {
val fragmentADestination = getDestination("FragmentA")
every { navController.backStack } returns ArrayDeque(
every { navController.backQueue } returns ArrayDeque(
listOf(
fragmentADestination,
getDestination(fragmentName),