TestScreenManager
class TestScreenManager : ScreenManager
The ScreenManager that is used for testing.
This class will track the following usages of the ScreenManager throughout your test:
- All the
Screens pushed viapush, orpushForResult. - All the
Screens removed via,pop,popTo, orremove.
Summary
Public functions |
|
|---|---|
(Mutable)List<Screen!> |
Returns all the |
(Mutable)List<Screen!> |
|
Boolean |
Returns |
Unit |
pop()Pops the top |
Unit |
Removes screens from the top of the stack until a |
Unit |
Removes all screens from the stack until the root has been reached. |
Unit |
Pushes the |
Unit |
pushForResult(Pushes a |
Unit |
Removes the |
Unit |
reset()Resets the values tracked by this |
Inherited functions |
||||||
|---|---|---|---|---|---|---|
|
Public functions
getScreensPushed
fun getScreensPushed(): (Mutable)List<Screen!>
Returns all the Screens pushed via push, and pushForResult.
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.
getScreensRemoved
fun getScreensRemoved(): (Mutable)List<Screen!>
Returns all the Screens removed via pop, popTo, and remove.
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.
hasScreens
fun hasScreens(): Boolean
Returns true if the Screen stack has any screens in it.
pop
fun pop(): Unit
Pops the top Screen from the stack.
If the top Screen is the only Screen in the stack, it will not be removed.
If the app's lifecycle is already in the DESTROYED state, this operation is a no-op.
| Throws | |
|---|---|
java.lang.IllegalStateException |
if the current thread is not the main thread |
popTo
fun popTo(marker: String): Unit
Removes screens from the top of the stack until a Screen which has the given
marker is found, or the root has been reached.
The root Screen will not be popped.
If the app's lifecycle is already in the DESTROYED state, this operation is a no-op.
| Throws | |
|---|---|
java.lang.NullPointerException |
if |
java.lang.IllegalStateException |
if the current thread is not the main thread |
| See also | |
|---|---|
setMarker |
popToRoot
fun popToRoot(): Unit
Removes all screens from the stack until the root has been reached.
If the app's lifecycle is already in the DESTROYED state, this operation is a no-op.
| Throws | |
|---|---|
java.lang.IllegalStateException |
if the current thread is not the main thread |
push
fun push(screen: Screen): Unit
Pushes the screen to the stack.
If the screen pushed is already in the stack it will be moved to the top of the stack.
If the app's lifecycle is already in the DESTROYED state, this operation is a no-op.
| Throws | |
|---|---|
java.lang.NullPointerException |
if |
java.lang.IllegalStateException |
if the current thread is not the main thread |
pushForResult
fun pushForResult(
screen: Screen,
onScreenResultListener: OnScreenResultListener
): Unit
Pushes a Screen, for which you would like a result from, onto the stack.
When the given screen finishes, the onScreenResultCallback will receive a callback to onScreenResult with the result that the pushed screen set via setResult.
If the app's lifecycle is already in the DESTROYED state, this operation is a no-op.
| Parameters | |
|---|---|
screen: Screen |
the |
onScreenResultListener: OnScreenResultListener |
the listener that will be executed with the result pushed by the |
| Throws | |
|---|---|
java.lang.NullPointerException |
if either the |
java.lang.IllegalStateException |
if the current thread is not the main thread |
remove
fun remove(screen: Screen): Unit
Removes the screen from the stack.
If the screen is the only Screen in the stack, it will not be removed.
If the app's lifecycle is already in the DESTROYED state, this operation is a no-op.
| Throws | |
|---|---|
java.lang.NullPointerException |
if |
java.lang.IllegalStateException |
if the current thread is not the main thread |
reset
fun reset(): Unit
Resets the values tracked by this TestScreenManager and the Screen stack.