TestScreenManager

public class TestScreenManager
extends ScreenManager

java.lang.Object
   ↳ androidx.car.app.ScreenManager
     ↳ androidx.car.app.testing.TestScreenManager


The ScreenManager that is used for testing.

This class will track the following usages of the ScreenManager throughout your test:

Summary

Public methods

List<Screen> getScreensPushed()

Returns all the Screens pushed via ScreenManager.push(Screen), and ScreenManager.pushForResult(Screen, OnScreenResultListener).

List<Screen> getScreensRemoved()

Returns all the Screens removed via ScreenManager.pop(), ScreenManager.popTo(String), and ScreenManager.remove(Screen).

boolean hasScreens()

Returns true if the Screen stack has any screens in it.

void pop()

Pops the top Screen from the stack.

void popTo(String marker)

Removes screens from the top of the stack until a Screen which has the given marker is found, or the root has been reached.

void popToRoot()

Removes all screens from the stack until the root has been reached.

void push(Screen screen)

Pushes the screen to the stack.

void pushForResult(Screen screen, OnScreenResultListener onScreenResultListener)

Pushes a Screen, for which you would like a result from, onto the stack.

void remove(Screen screen)

Removes the screen from the stack.

void reset()

Resets the values tracked by this TestScreenManager and the Screen stack.

Inherited methods

Public methods

getScreensPushed

public List<Screen> getScreensPushed ()

Returns all the Screens pushed via ScreenManager.push(Screen), and ScreenManager.pushForResult(Screen, OnScreenResultListener).

The screens are stored in the order in which they were pushed, where the first screen in the list is the first screen that was pushed.

The screens will be stored until reset() is called.

Returns
List<Screen>

getScreensRemoved

public List<Screen> getScreensRemoved ()

Returns all the Screens removed via ScreenManager.pop(), ScreenManager.popTo(String), and ScreenManager.remove(Screen).

The screens are stored in the order in which they were removed, where the first screen in the list, is the first screen that was removed.

The screens will be stored until reset() is called.

Returns
List<Screen>

hasScreens

public boolean hasScreens ()

Returns true if the Screen stack has any screens in it.

Returns
boolean

pop