TestNavigationEventDispatcherOwner



A test implementation of NavigationEventDispatcherOwner for verifying NavigationEventDispatcher interactions.

Use this class in tests to confirm that the fallbackOnBackPressed action is invoked as expected. It tracks the number of times this event occurs.

Summary

Public constructors

Cmn

Public properties

open NavigationEventDispatcher

The NavigationEventDispatcher instance managed by this owner.

Cmn
Int

The number of times the dispatcher's fallbackOnBackPressed lambda has been invoked.

Cmn

Public constructors

TestNavigationEventDispatcherOwner

TestNavigationEventDispatcherOwner(
    onBackCompletedFallback: TestNavigationEventDispatcherOwner.() -> Unit = {}
)
Parameters
onBackCompletedFallback: TestNavigationEventDispatcherOwner.() -> Unit = {}

An optional lambda to execute when the NavigationEventDispatcher back fallback is triggered. This is invoked after the internal invocation counter is incremented.

Public properties

open val navigationEventDispatcherNavigationEventDispatcher

The NavigationEventDispatcher instance managed by this owner.

This dispatcher is created with the fallbackOnBackPressed lambda provided to the TestNavigationEventDispatcherOwner's constructor, which increments onBackCompletedFallback.

onBackCompletedFallbackInvocations

val onBackCompletedFallbackInvocationsInt

The number of times the dispatcher's fallbackOnBackPressed lambda has been invoked.

This counter is incremented when a back navigation event completes and no NavigationEventHandler handles it.