ScreenController

public class ScreenController
extends Object

java.lang.Object
   ↳ androidx.car.app.testing.ScreenController


A controller that allows testing of a Screen.

This controller will allows:

Summary

Public methods

ScreenController create()

Creates the Screen being controlled.

ScreenController destroy()

Destroys to the Screen being controlled.

Screen get()

Returns the Screen being controlled.

Object getScreenResult()

Returns the result that was set via Screen.setResult(Object), or null if one was not set.

List<Template> getTemplatesReturned()

Returns all the Templates returned from Screen.onGetTemplate() for the Screen being controlled.

static ScreenController of(TestCarContext testCarContext, Screen screen)

Creates a ScreenController to control a Screen for testing.

ScreenController pause()

Pauses the Screen being controlled.

void reset()

Resets values tracked by this ScreenController.

ScreenController resume()

Resumes the Screen being controlled.

ScreenController start()

Starts the Screen being controlled.

ScreenController stop()

Stops to the Screen being controlled.

Inherited methods

Public methods

create

public ScreenController create ()

Creates the Screen being controlled.

This method will also push the Screen onto the ScreenManager's screen stack if it isn't the current top.

Returns
ScreenController

destroy

public ScreenController destroy ()

Destroys to the Screen being controlled.

Returns
ScreenController

get

public Screen get ()

Returns the Screen being controlled.

Returns
Screen

getScreenResult

public Object getScreenResult ()

Returns the result that was set via Screen.setResult(Object), or null if one was not set.

Returns
Object

getTemplatesReturned

public List<Template> getTemplatesReturned ()

Returns all the Templates returned from Screen.onGetTemplate() for the Screen being controlled.

The templates are stored in the order in which they were returned from Screen.onGetTemplate(), where the first template in the list, is the first template returned.

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

Returns
List<Template>

of

public static ScreenController of (TestCarContext testCarContext, 
                Screen screen)

Creates a ScreenController to control a Screen for testing.

Parameters
testCarContext TestCarContext

screen Screen

Returns
ScreenController

Throws
NullPointerException if either testCarContext or screen are null

pause

public ScreenController pause ()

Pauses the Screen being controlled.

Returns
ScreenController

reset

public void reset ()

Resets values tracked by this ScreenController.

resume

public ScreenController resume ()

Resumes the Screen being controlled.

This method will also push the Screen onto the ScreenManager's screen stack if it isn't the current top.

Returns
ScreenController

start

public ScreenController start ()

Starts the Screen being controlled.

This method will also push the Screen onto the ScreenManager's screen stack if it isn't the current top.

Returns
ScreenController

stop

public ScreenController stop ()

Stops to the Screen being controlled.

Returns
ScreenController