Google 致力于为黑人社区推动种族平等。查看具体举措

androidx.fragment.app.testing

Interfaces

FragmentAction

Classes

FragmentScenario

FragmentScenario provides API to start and drive a Fragment's lifecycle state for testing.

Top-level functions summary

FragmentScenario<F>
launchFragment(fragmentArgs: Bundle? = null, @StyleRes themeResId: Int = R.style.FragmentScenarioEmptyFragmentActivityTheme, factory: FragmentFactory? = null)

FragmentScenario<F>
launchFragment(fragmentArgs: Bundle? = null, @StyleRes themeResId: Int = R.style.FragmentScenarioEmptyFragmentActivityTheme, crossinline instantiate: () -> F)

FragmentScenario<F>
launchFragment(fragmentArgs: Bundle? = null, @StyleRes themeResId: Int = R.style.FragmentScenarioEmptyFragmentActivityTheme, initialState: Lifecycle.State = Lifecycle.State.RESUMED, factory: FragmentFactory? = null)

Launches a Fragment with given arguments hosted by an empty FragmentActivity using given FragmentFactory and waits for it to reach initialState.

FragmentScenario<F>
launchFragment(fragmentArgs: Bundle? = null, @StyleRes themeResId: Int = R.style.FragmentScenarioEmptyFragmentActivityTheme, initialState: Lifecycle.State = Lifecycle.State.RESUMED, crossinline instantiate: () -> F)

Launches a Fragment with given arguments hosted by an empty FragmentActivity using instantiate to create the Fragment and waits for it to reach initialState.

FragmentScenario<F>
launchFragmentInContainer(fragmentArgs: Bundle? = null, @StyleRes themeResId: Int = R.style.FragmentScenarioEmptyFragmentActivityTheme, factory: FragmentFactory? = null)

FragmentScenario<F>
launchFragmentInContainer(fragmentArgs: Bundle? = null, @StyleRes themeResId: Int = R.style.FragmentScenarioEmptyFragmentActivityTheme, crossinline instantiate: () -> F)

FragmentScenario<F>
launchFragmentInContainer(fragmentArgs: Bundle? = null, @StyleRes themeResId: Int = R.style.FragmentScenarioEmptyFragmentActivityTheme, initialState: Lifecycle.State = Lifecycle.State.RESUMED, factory: FragmentFactory? = null)

Launches a Fragment in the Activity's root view container android.R.id.content, with given arguments hosted by an empty FragmentActivity and waits for it to reach initialState.

FragmentScenario<F>
launchFragmentInContainer(fragmentArgs: Bundle? = null, @StyleRes themeResId: Int = R.style.FragmentScenarioEmptyFragmentActivityTheme, initialState: Lifecycle.State = Lifecycle.State.RESUMED, crossinline instantiate: () -> F)

Launches a Fragment in the Activity's root view container android.R.id.content, with given arguments hosted by an empty FragmentActivity using instantiate to create the Fragment and waits for it to reach initialState.

Extension functions summary