SearchTemplateController
public
class
SearchTemplateController
extends Object
java.lang.Object | |
↳ | com.google.android.libraries.car.app.testing.model.SearchTemplateController |
A controller that allows testing of a SearchTemplate
.
This controller allows:
- Performing a search as if the user did.
- Retrieving the initial search text set via
SearchTemplate.Builder.setInitialSearchText(String)
. - Retrieving the search hint set via
SearchTemplate.Builder.setSearchHint(String)
. - Retrieving the loading state set via
SearchTemplate.Builder.setIsLoading(boolean)
. - Retrieving the
ItemList
set viaSearchTemplate.Builder.setItemList(ItemList)
. - Retrieving a
Row
from theItemList
by title. - Retrieving the header
Action
which is set viaSearchTemplate.Builder.setHeaderAction(Action)
. - Retrieving the
ActionStrip
set viaSearchTemplate.Builder.setActionStrip(ActionStrip)
. - Verifying whether the keyboard is set to show by default, via
SearchTemplate.Builder.setShowKeyboardByDefault(boolean)
.
Summary
Public methods | |
---|---|
SearchTemplate
|
get()
Retrieves the |
ActionStripController
|
getActionStrip()
Returns an |
ActionController
|
getHeaderAction()
Retrieves a |
String
|
getInitialSearchText()
Returns the initial search text for the |
ItemListController
|
getItemList()
Returns an |
RowController
|
getRowByTitle(String title)
Returns a |
String
|
getSearchHint()
Returns the search hint for the |
boolean
|
isLoading()
Returns |
static
SearchTemplateController
|
of(SearchTemplate searchTemplate)
Creates a |
void
|
performSearchSubmitted(String searchText)
Sends the search text as if the user submitted it. |
void
|
performSearchTextChanged(String searchText)
Sends the search text as if the user entered it. |
boolean
|
showKeyboardByDefault()
Verifies whether the keyboard is set to open by default. |
Inherited methods | |
---|---|
Public methods
get
public SearchTemplate get ()
Retrieves the PlaceListMapTemplate
that this controller is controlling.
Returns | |
---|---|
SearchTemplate |
getActionStrip
public ActionStripController getActionStrip ()
Returns an ActionStripController
that contains the ActionStrip
in the SearchTemplate
that is being controlled, or null
if one is not present.
Returns | |
---|---|
ActionStripController |
getHeaderAction
public ActionController getHeaderAction ()
Retrieves a ActionController
for the header Action
that is being controlled, or
null
if none is present.
Returns | |
---|---|
ActionController |
getInitialSearchText
public String getInitialSearchText ()
Returns the initial search text for the SearchTemplate
being controlled, or null
if one is not present.
Returns | |
---|---|
String |
getItemList
public ItemListController getItemList ()
Returns an ItemListController
that contains the ItemList
in the SearchTemplate
that is being controlled, or null
if one is not present.
Returns | |
---|---|
ItemListController |
getRowByTitle
public RowController getRowByTitle (String title)
Returns a RowController
containing the first Row
that was added with the given
title as its title, in the ItemList
contained in the SearchTemplate
that is
being controlled, or null
if none match.
The value should be the CharSequence.toString()
for the title originally provided.
Parameters | |
---|---|
title |
String |
Returns | |
---|---|
RowController |
getSearchHint
public String getSearchHint ()
Returns the search hint for the SearchTemplate
being controlled, or null
if one
is not present.
Returns | |
---|---|
String |
isLoading
public boolean isLoading ()
Returns true
if the template is set to be loading.
This state is set via calling SearchTemplate.Builder.setIsLoading(boolean)
.
Returns | |
---|---|
boolean |
of
public static SearchTemplateController of (SearchTemplate searchTemplate)
Creates a SearchTemplateController
to control an SearchTemplate
for testing.
Parameters | |
---|---|
searchTemplate |
SearchTemplate |
Returns | |
---|---|
SearchTemplateController |
performSearchSubmitted
public void performSearchSubmitted (String searchText)
Sends the search text as if the user submitted it.
Parameters | |
---|---|
searchText |
String |
performSearchTextChanged
public void performSearchTextChanged (String searchText)
Sends the search text as if the user entered it.
This method is not for copying user behavior of typing slowly, it will send the input to the
search listener contained in the SearchTemplate
being controlled.
In the real app, the host may send callbacks every 1 or few characters, this method will send the value provided. To copy host behavior you can call this method consecutively with parts of the input.
Parameters | |
---|---|
searchText |
String |
showKeyboardByDefault
public boolean showKeyboardByDefault ()
Verifies whether the keyboard is set to open by default.
This is set via calling SearchTemplate.Builder.setShowKeyboardByDefault(boolean)
.
Returns | |
---|---|
boolean |