Package-level declarations

Types

Link copied to clipboard

Reads a rendered tree the way an accessibility service does: as nodes, not as Views.

Link copied to clipboard

One node in the tree a service walks, whether it is backed by a View or is virtual. Which of the two it is deliberately does not change how a test reads or acts on it.

Link copied to clipboard
open class BackgroundLayoutLooperRule : TestRule
TestRule which allows a test to manually step through the default ComponentTree layout thread Looper while still executing those tasks on a background thread.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open class InteractionUtil
Utilities for interacting with an app.
Link copied to clipboard
class LithoAnimationTestRule(afterFrame: () -> Unit = {}) : TestRule

JUnit rule that installs a deterministic animation frame driver for the duration of a test.

Link copied to clipboard
open class LithoStatsRule : TestRule
This rule resets the litho stats counters resetAllCounters after every test, and provides utilities methods to get the litho stats.
Link copied to clipboard
class LithoTestRule @JvmOverloads constructor(val componentsConfiguration: ComponentsConfiguration? = null, val themeResId: Int? = null, lithoVisibilityEventsController: () -> LithoVisibilityEventsController? = null, lifecycleOwner: () -> LifecycleOwner? = null, resizeMode: LithoTestRuleResizeMode = LithoTestRuleResizeMode.AUTO, val androidContext: Context? = null, val attachToRealWindow: Boolean = false) : TestRule

This test utility allows clients to create a TestLithoView instance that allows to test assertion on the view hierarchy rendered by a Litho components.

Link copied to clipboard

The resize mode determines when to call measure and layout methods for TestLithoView. This can be triggered by a root change or state update.

Link copied to clipboard
class Message(val messageType: MessageType, val semaphore: TimeOutSemaphore)
Link copied to clipboard
Link copied to clipboard

A wrapper class that exposes methods specific to testing collection components.

Link copied to clipboard
data class TestCollectionItem(testCollection: TestCollection, componentTreeHolder: ComponentTreeHolder?, val index: Int, collectionItem: CollectionItem<*>? = null)

A wrapper class that exposes methods specific to testing collection children.

Link copied to clipboard
Base class for test components which expose lifecycle information.
Link copied to clipboard
open class TestDrawable : Drawable
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Holder class for the result of LithoTestRule.render call, exposing methods to for finding the views/components and assertions

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
class ThreadLooperController(val layoutLooper: ShadowLooper = Shadows.shadowOf( Whitebox.invokeMethod<Any>(ComponentTree::class.java, "getDefaultLayoutThreadLooper") as Looper, )) : BaseThreadLooperController

Helper class extracting looper functionality from BackgroundLayoutLooperRule that can be reused in other TestRules

Link copied to clipboard
Link copied to clipboard
open class TimeOutSemaphore
Semaphore wrapper that automatically times out in 5 seconds so that we don't forget to do it and hang tests or not check for whether the lock was successfully acquired.
Link copied to clipboard

Dispatches well-formed MotionEvent streams through a real View.dispatchTouchEvent chain.

Link copied to clipboard
class TrackedItemPool(lifecycle: Any, size: Int) : MountContentPools.DefaultContentPool
Link copied to clipboard
open class TransitionTestRule : TestRule
Link copied to clipboard
Exception thrown when a view isn't found in a test.
Link copied to clipboard
open class Whitebox
Internal copy of Whitebox implementation of Powermock.

Properties

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
Link copied to clipboard
fun atMost(px: Int): Int

Shorthand for creating a View.MeasureSpec.AT_MOST measure spec.

Link copied to clipboard

Opens a gesture that outlives a single statement, for tests that mutate the tree mid-gesture (a re-render or unmount between DOWN and UP). Prefer performTouchInput when the whole gesture fits in one block.

beginTouchInput targeting the rendered LithoView.

Link copied to clipboard

The centre of this view, in the coordinate space of ancestor.

Link copied to clipboard
fun exactly(px: Int): Int

Shorthand for creating a View.MeasureSpec.EXACTLY measure spec.

Link copied to clipboard

Runs block against a TouchInjectionScope targeting this view. Coordinates inside block are in this view's coordinate space.

Runs block against a TouchInjectionScope targeting the rendered LithoView, so a gesture enters at the root and is hit-tested down the real hierarchy. Coordinates are in the LithoView's space.

Link copied to clipboard

Shorthand for creating a View.MeasureSpec.UNSPECIFIED measure spec.