androidx.window.testing.layout
Classes
WindowLayoutInfoPublisherRule |
A |
WindowMetricsCalculatorRule |
A |
Objects
FoldingFeatureTestingConstants |
A class to contain all the constants related to testing |
Top-level functions summary
FoldingFeature |
FoldingFeature(A convenience method to get a test fold with default values provided. |
FoldingFeature |
FoldingFeature(A convenience method to get a test |
WindowLayoutInfo |
TestWindowLayoutInfo(displayFeatures: List<DisplayFeature>)Returns a |
WindowMetrics |
TestWindowMetrics(bounds: Rect, density: Float)Returns a |
WindowMetrics |
Returns a |
Top-level functions
FoldingFeature
fun FoldingFeature(
activity: Activity,
center: @IntRange(from = -1) Int = FOLDING_FEATURE_CENTER_DEFAULT,
size: Int = 0,
state: FoldingFeature.State = HALF_OPENED,
orientation: FoldingFeature.Orientation = HORIZONTAL
): FoldingFeature
A convenience method to get a test fold with default values provided. With the default values it returns a FoldingFeature.State.HALF_OPENED feature that splits the screen along the FoldingFeature.Orientation.HORIZONTAL axis.
The bounds of the feature are calculated based on orientation and size. If the feature is VERTICAL then the feature is centered horizontally. The top-left x-coordinate is center - (size / 2) and the top-right x-coordinate is center + (size / 2). If the feature is HORIZONTAL then the feature is centered vertically. The top-left y-coordinate is center - (size / 2) and the bottom-left y-coordinate is center - (size / 2). The folding features always cover the window in one dimension and that determines the other coordinates.
Use FOLDING_FEATURE_CENTER_DEFAULT to default to the center of Activity window bounds. Otherwise, use values greater than or equal to 0 to specify the center.
| Parameters | |
|---|---|
activity: Activity |
that will house the |
center: @IntRange(from = -1) Int = FOLDING_FEATURE_CENTER_DEFAULT |
the center of the fold complementary to the orientation in px. For a |
size: Int = 0 |
the smaller dimension of the fold in px. The larger dimension always covers the entire window. |
state: FoldingFeature.State = HALF_OPENED |
|
orientation: FoldingFeature.Orientation = HORIZONTAL |
|
| Returns | |
|---|---|
FoldingFeature |
|
FoldingFeature
fun FoldingFeature(
windowBounds: Rect,
center: @IntRange(from = -1) Int = FOLDING_FEATURE_CENTER_DEFAULT,
size: Int = 0,
state: FoldingFeature.State = HALF_OPENED,
orientation: FoldingFeature.Orientation = HORIZONTAL
): FoldingFeature
A convenience method to get a test FoldingFeature with default values provided. With the default values it returns a FoldingFeature.State.HALF_OPENED feature that splits the screen along the FoldingFeature.Orientation.HORIZONTAL axis.
The bounds of the feature are calculated based on orientation and size. If the feature is VERTICAL then the feature is centered horizontally. The top-left x-coordinate is center - (size / 2) and the top-right x-coordinate is center + (size / 2). If the feature is HORIZONTAL then the feature is centered vertically. The top-left y-coordinate is center - (size / 2) and the bottom-left y-coordinate is center - (size / 2). The folding features always cover the window in one dimension and that determines the other coordinates.
Use FOLDING_FEATURE_CENTER_DEFAULT to default to the center of Activity window bounds. Otherwise, use values greater than or equal to 0 to specify the center.
| Parameters | |
|---|---|
windowBounds: Rect |
that will contain the |
center: @IntRange(from = -1) Int = FOLDING_FEATURE_CENTER_DEFAULT |
the center of the fold complementary to the orientation in px. For a |
size: Int = 0 |
the smaller dimension of the fold in px. The larger dimension always covers the entire window. |
state: FoldingFeature.State = HALF_OPENED |
|
orientation: FoldingFeature.Orientation = HORIZONTAL |
|
| Returns | |
|---|---|
FoldingFeature |
|
TestWindowLayoutInfo
fun TestWindowLayoutInfo(displayFeatures: List<DisplayFeature> = emptyList()): WindowLayoutInfo
Returns a WindowLayoutInfo with default values for testing.
| Parameters | |
|---|---|
displayFeatures: List<DisplayFeature> = emptyList() |
a |
| Returns | |
|---|---|
WindowLayoutInfo |
|
| See also | |
|---|---|
overrideWindowLayoutInfo |
TestWindowMetrics
fun TestWindowMetrics(bounds: Rect, density: Float = 1.0f): WindowMetrics
Returns a WindowMetrics with default values for testing.
| Parameters | |
|---|---|
bounds: Rect |
The window bounds This value cannot be null. |
density: Float = 1.0f |
The window density. |
| Returns | |
|---|---|
WindowMetrics |
|
TestWindowMetrics
fun TestWindowMetrics(
left: Int,
top: Int,
right: Int,
bottom: Int,
density: Float = 1.0f
): WindowMetrics
Returns a WindowMetrics with default values for testing.
| Parameters | |
|---|---|
left: Int |
The X coordinate of the left side of window bounds. |
top: Int |
The Y coordinate of the top side of window bounds. |
right: Int |
The X coordinate of the right side of window bounds. |
bottom: Int |
The Y coordinate of the bottom side of window bounds. |
density: Float = 1.0f |
The window density. |
| Returns | |
|---|---|
WindowMetrics |
|