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:
- Moving a
Screenthrough its differentLifecycle.States. - Retrieving all
Templates returned fromScreen.onGetTemplate(). The values can be reset withreset().
Summary
Public methods | |
|---|---|
ScreenController
|
create()
Creates the |
ScreenController
|
destroy()
Destroys to the |
Screen
|
get()
Returns the |
Object
|
getScreenResult()
Returns the result that was set via |
List<Template>
|
getTemplatesReturned()
Returns all the |
static
ScreenController
|
of(TestCarContext testCarContext, Screen screen)
Creates a ScreenController to control a |
ScreenController
|
pause()
Pauses the |
void
|
reset()
Resets values tracked by this |
ScreenController
|
resume()
Resumes the |
ScreenController
|
start()
Starts the |
ScreenController
|
stop()
Stops to the |
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 |
|
See also:
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 |
|
See also:
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 |
|
See also:
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 |
|
See also:
stop
public ScreenController stop ()
Stops to the Screen being controlled.
| Returns | |
|---|---|
ScreenController |
|
See also: