public final class ComponentTestHelper extends Object
Modifier and Type | Method and Description |
---|---|
static LithoView |
dispatchVisibleEvent(ComponentContext context,
EventHandler onVisibleHandler,
Component component)
Mounts the component & triggers the visibility event.
|
static <T extends ComponentLifecycle> |
getSubComponent(Component.Builder component,
Class<T> componentClass)
Returns the first subComponent of type class.
|
static List<SubComponent> |
getSubComponents(Component.Builder component)
Get the subcomponents of a component
|
static List<SubComponent> |
getSubComponents(Component.Builder component,
int widthSpec,
int heightSpec)
Get the subcomponents of a component
|
static List<SubComponent> |
getSubComponents(ComponentContext context,
Component component)
Get the subcomponents of a component
|
static List<SubComponent> |
getSubComponents(ComponentContext context,
Component component,
int widthSpec,
int heightSpec)
Get the subcomponents of a component
|
static void |
measureAndLayout(View view)
Measure and layout a component view.
|
static LithoView |
mountComponent(Component.Builder component)
Mount a component into a component view.
|
static LithoView |
mountComponent(Component.Builder component,
boolean incrementalMountEnabled)
Mount a component into a component view.
|
static LithoView |
mountComponent(ComponentContext context,
Component component)
Mount a component into a component view.
|
static LithoView |
mountComponent(ComponentContext context,
Component component,
boolean incrementalMountEnabled)
Mount a component into a component view.
|
static LithoView |
mountComponent(ComponentContext context,
Component component,
int width,
int height)
Mount a component into a component view.
|
static LithoView |
mountComponent(ComponentContext context,
LithoView lithoView,
Component component)
Mount a component into a component view.
|
static LithoView |
mountComponent(ComponentContext context,
LithoView lithoView,
Component component,
boolean incrementalMountEnabled,
int width,
int height)
Mount a component into a component view.
|
static LithoView |
mountComponent(ComponentContext context,
LithoView lithoView,
Component component,
int width,
int height)
Mount a component into a component view.
|
static LithoView |
mountComponent(LithoView lithoView,
ComponentTree componentTree)
Mount a component tree into a component view.
|
static LithoView |
mountComponent(LithoView lithoView,
ComponentTree componentTree,
int widthSpec,
int heightSpec)
Mount a component tree into a component view.
|
static void |
setTreeProp(ComponentContext context,
Class propClass,
Object prop)
Sets a TreeProp that will be visible to all Components which are created from
the given Context (unless a child overwrites its).
|
static void |
unbindComponent(LithoView lithoView)
Unbinds a component tree from a component view.
|
static void |
unmountComponent(LithoView lithoView)
Unmounts a component tree from a component view.
|
public static LithoView mountComponent(Component.Builder component)
component
- The component builder to mountpublic static LithoView mountComponent(Component.Builder component, boolean incrementalMountEnabled)
component
- The component builder to mountincrementalMountEnabled
- States whether incremental mount is enabledpublic static LithoView mountComponent(ComponentContext context, Component component)
context
- A components contextcomponent
- The component to mountpublic static LithoView mountComponent(ComponentContext context, Component component, boolean incrementalMountEnabled)
context
- A components contextcomponent
- The component to mountincrementalMountEnabled
- States whether incremental mount is enabledpublic static LithoView mountComponent(ComponentContext context, Component component, int width, int height)
context
- A components contextcomponent
- The component to mountwidth
- The width of the resulting viewheight
- The height of the resulting viewpublic static LithoView mountComponent(ComponentContext context, LithoView lithoView, Component component)
context
- A components contextlithoView
- The view to mount the component intocomponent
- The component to mountpublic static LithoView mountComponent(ComponentContext context, LithoView lithoView, Component component, int width, int height)
context
- A components contextlithoView
- The view to mount the component intocomponent
- The component to mountwidth
- The width of the resulting viewheight
- The height of the resulting viewpublic static LithoView mountComponent(ComponentContext context, LithoView lithoView, Component component, boolean incrementalMountEnabled, int width, int height)
context
- A components contextlithoView
- The view to mount the component intocomponent
- The component to mountincrementalMountEnabled
- States whether incremental mount is enabledwidth
- The width of the resulting viewheight
- The height of the resulting viewpublic static LithoView mountComponent(LithoView lithoView, ComponentTree componentTree)
lithoView
- The view to mount the component tree intocomponentTree
- The component tree to mountpublic static LithoView mountComponent(LithoView lithoView, ComponentTree componentTree, int widthSpec, int heightSpec)
lithoView
- The view to mount the component tree intocomponentTree
- The component tree to mountwidthSpec
- The width spec used to measure the resulting viewheightSpec
- The height spec used to measure the resulting viewpublic static void unmountComponent(LithoView lithoView)
lithoView
- the view to unmountpublic static void unbindComponent(LithoView lithoView)
lithoView
- The view to unbind.public static List<SubComponent> getSubComponents(Component.Builder component)
component
- The component builder which to get the subcomponents ofpublic static List<SubComponent> getSubComponents(ComponentContext context, Component component)
context
- A components contextcomponent
- The component which to get the subcomponents ofpublic static List<SubComponent> getSubComponents(Component.Builder component, int widthSpec, int heightSpec)
component
- The component which to get the subcomponents ofwidthSpec
- The width to measure the component withheightSpec
- The height to measure the component withpublic static List<SubComponent> getSubComponents(ComponentContext context, Component component, int widthSpec, int heightSpec)
context
- A components contextcomponent
- The component which to get the subcomponents ofwidthSpec
- The width to measure the component withheightSpec
- The height to measure the component withpublic static <T extends ComponentLifecycle> Component<T> getSubComponent(Component.Builder component, Class<T> componentClass)
component
- The component builder which to get the subcomponent fromcomponentClass
- the class type of the requested sub componentpublic static void measureAndLayout(View view)
view
- The component view to measure and layoutpublic static LithoView dispatchVisibleEvent(ComponentContext context, EventHandler onVisibleHandler, Component component)
VisibleEvent
context
- A components contextonVisibleHandler
- SpecificComponent.onVisible(component)component
- The component builder which to get the subcomponent frompublic static void setTreeProp(ComponentContext context, Class propClass, Object prop)