TestNavigationEventDispatcherOwner



A test implementation of NavigationEventDispatcherOwner for verifying NavigationEventDispatcher interactions.

Use this class in tests to confirm that the onBackCompletedFallback and onForwardCompletedFallback actions are invoked as expected. It tracks the number of times these events occur.

Summary

Public constructors

Cmn
TestNavigationEventDispatcherOwner(
    onForwardCompletedFallback: TestNavigationEventDispatcherOwner.() -> Unit,
    onBackCompletedFallback: TestNavigationEventDispatcherOwner.() -> Unit
)

Creates a TestNavigationEventDispatcherOwner with both forward and back fallbacks.

Cmn

Public properties

open NavigationEventDispatcher

The NavigationEventDispatcher instance managed by this owner.

Cmn
DirectNavigationEventInput

The DirectNavigationEventInput instance managed by this owner.

Cmn
Int

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

Cmn
Int

The number of times the dispatcher's onForwardCompletedFallback 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.

TestNavigationEventDispatcherOwner

TestNavigationEventDispatcherOwner(
    onForwardCompletedFallback: TestNavigationEventDispatcherOwner.() -> Unit,
    onBackCompletedFallback: TestNavigationEventDispatcherOwner.() -> Unit
)

Creates a TestNavigationEventDispatcherOwner with both forward and back fallbacks.

Parameters
onForwardCompletedFallback: TestNavigationEventDispatcherOwner.() -> Unit

A lambda to execute when the NavigationEventDispatcher forward fallback is triggered.

onBackCompletedFallback: TestNavigationEventDispatcherOwner.() -> Unit

An optional lambda to execute when the NavigationEventDispatcher back fallback is triggered.

Public properties

open val navigationEventDispatcherNavigationEventDispatcher

The NavigationEventDispatcher instance managed by this owner.

This dispatcher is created with the onBackCompletedFallback and onForwardCompletedFallback lambdas provided to the TestNavigationEventDispatcherOwner's constructor, which increments onBackCompletedFallbackInvocations and onForwardCompletedFallbackInvocations.

val navigationEventInputDirectNavigationEventInput

The DirectNavigationEventInput instance managed by this owner.

This input is automatically added to the navigationEventDispatcher during initialization, allowing for direct simulation of navigation events.

onBackCompletedFallbackInvocations

val onBackCompletedFallbackInvocationsInt

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

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

onForwardCompletedFallbackInvocations

val onForwardCompletedFallbackInvocationsInt

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

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