# DisplayFeatureTesting

Added in 1.0.0

*** ** * ** ***


```
public final class DisplayFeatureTesting
```

<br />

*** ** * ** ***

## Summary

| ### Public methods |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/FoldingFeature` | `https://developer.android.com/reference/androidx/window/testing/layout/DisplayFeatureTesting#createFoldingFeature(android.app.Activity,kotlin.Int,kotlin.Int,androidx.window.layout.FoldingFeature.State,androidx.window.layout.FoldingFeature.Orientation)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/app/Activity.html activity, @https://developer.android.com/reference/androidx/annotation/IntRange(from = -1) int center, int size, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/FoldingFeature.State state, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/FoldingFeature.Orientation orientation )` A convenience method to get a test fold with default values provided. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/FoldingFeature` | `https://developer.android.com/reference/androidx/window/testing/layout/DisplayFeatureTesting#createFoldingFeature(android.graphics.Rect,kotlin.Int,kotlin.Int,androidx.window.layout.FoldingFeature.State,androidx.window.layout.FoldingFeature.Orientation)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Rect.html windowBounds, @https://developer.android.com/reference/androidx/annotation/IntRange(from = -1) int center, int size, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/FoldingFeature.State state, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/FoldingFeature.Orientation orientation )` A convenience method to get a test `https://developer.android.com/reference/androidx/window/testing/layout/package-summary#FoldingFeature(android.graphics.Rect,kotlin.Int,kotlin.Int,androidx.window.layout.FoldingFeature.State,androidx.window.layout.FoldingFeature.Orientation)` with default values provided. |

## Public methods

### createFoldingFeature

Artifact: [androidx.window:window-testing](https://developer.android.com/jetpack/androidx/releases/window) [View Source](https://cs.android.com/search?q=file:androidx/window/testing/layout/DisplayFeatureTesting.kt+function:FoldingFeature) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/window#1.0.0)

```
public static final @NonNull FoldingFeature createFoldingFeature(
    @NonNull Activity activity,
    @IntRange(from = -1) int center,
    int size,
    @NonNull FoldingFeature.State state,
    @NonNull FoldingFeature.Orientation orientation
)
```

A convenience method to get a test fold with default values provided. With the default values it returns a `https://developer.android.com/reference/androidx/window/layout/FoldingFeature.State#HALF_OPENED()` feature that splits the screen along the `https://developer.android.com/reference/androidx/window/layout/FoldingFeature.Orientation#HORIZONTAL()` axis.

The bounds of the feature are calculated based on `https://developer.android.com/reference/androidx/window/testing/layout/package-summary#FoldingFeature(android.app.Activity,kotlin.Int,kotlin.Int,androidx.window.layout.FoldingFeature.State,androidx.window.layout.FoldingFeature.Orientation)` and `https://developer.android.com/reference/androidx/window/testing/layout/package-summary#FoldingFeature(android.app.Activity,kotlin.Int,kotlin.Int,androidx.window.layout.FoldingFeature.State,androidx.window.layout.FoldingFeature.Orientation)`. If the feature is `https://developer.android.com/reference/androidx/window/layout/FoldingFeature.Orientation#VERTICAL()` then the feature is centered horizontally. The top-left x-coordinate is center - (`https://developer.android.com/reference/androidx/window/testing/layout/package-summary#FoldingFeature(android.app.Activity,kotlin.Int,kotlin.Int,androidx.window.layout.FoldingFeature.State,androidx.window.layout.FoldingFeature.Orientation)` / 2) and the top-right x-coordinate is center + (`https://developer.android.com/reference/androidx/window/testing/layout/package-summary#FoldingFeature(android.app.Activity,kotlin.Int,kotlin.Int,androidx.window.layout.FoldingFeature.State,androidx.window.layout.FoldingFeature.Orientation)` / 2). If the feature is `https://developer.android.com/reference/androidx/window/layout/FoldingFeature.Orientation#HORIZONTAL()` then the feature is centered vertically. The top-left y-coordinate is center - (`https://developer.android.com/reference/androidx/window/testing/layout/package-summary#FoldingFeature(android.app.Activity,kotlin.Int,kotlin.Int,androidx.window.layout.FoldingFeature.State,androidx.window.layout.FoldingFeature.Orientation)` / 2) and the bottom-left y-coordinate is center - (`https://developer.android.com/reference/androidx/window/testing/layout/package-summary#FoldingFeature(android.app.Activity,kotlin.Int,kotlin.Int,androidx.window.layout.FoldingFeature.State,androidx.window.layout.FoldingFeature.Orientation)` / 2). The folding features always cover the window in one dimension and that determines the other coordinates.

Use `https://developer.android.com/reference/androidx/window/testing/layout/FoldingFeatureTestingConstants#FOLDING_FEATURE_CENTER_DEFAULT()` to default to the center of `https://developer.android.com/reference/android/app/Activity.html` window bounds. Otherwise, use values greater than or equal to 0 to specify the center.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/app/Activity.html activity` | that will house the `https://developer.android.com/reference/androidx/window/testing/layout/package-summary#FoldingFeature(android.app.Activity,kotlin.Int,kotlin.Int,androidx.window.layout.FoldingFeature.State,androidx.window.layout.FoldingFeature.Orientation)`. |
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = -1) int center` | the center of the fold complementary to the orientation in px. For a `https://developer.android.com/reference/androidx/window/layout/FoldingFeature.Orientation#HORIZONTAL()` fold, this is the y-axis and for a `https://developer.android.com/reference/androidx/window/layout/FoldingFeature.Orientation#VERTICAL()` fold this is the x-axis. The default value will be calculated to be in the middle of the window. |
| `int size` | the smaller dimension of the fold in px. The larger dimension always covers the entire window. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/FoldingFeature.State state` | `https://developer.android.com/reference/androidx/window/layout/FoldingFeature.State` of the fold. The default value is `https://developer.android.com/reference/androidx/window/layout/FoldingFeature.State#HALF_OPENED()` |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/FoldingFeature.Orientation orientation` | `https://developer.android.com/reference/androidx/window/layout/FoldingFeature.Orientation` of the fold. The default value is `https://developer.android.com/reference/androidx/window/layout/FoldingFeature.Orientation#HORIZONTAL()` |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/FoldingFeature` | `https://developer.android.com/reference/androidx/window/testing/layout/package-summary#FoldingFeature(android.app.Activity,kotlin.Int,kotlin.Int,androidx.window.layout.FoldingFeature.State,androidx.window.layout.FoldingFeature.Orientation)` that is splitting if the width is not 0 and runs parallel to the `https://developer.android.com/reference/androidx/window/layout/FoldingFeature.Orientation` axis. |

### createFoldingFeature

Artifact: [androidx.window:window-testing](https://developer.android.com/jetpack/androidx/releases/window) [View Source](https://cs.android.com/search?q=file:androidx/window/testing/layout/DisplayFeatureTesting.kt+function:FoldingFeature) Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/window#1.2.0)

```
public static final @NonNull FoldingFeature createFoldingFeature(
    @NonNull Rect windowBounds,
    @IntRange(from = -1) int center,
    int size,
    @NonNull FoldingFeature.State state,
    @NonNull FoldingFeature.Orientation orientation
)
```

A convenience method to get a test `https://developer.android.com/reference/androidx/window/testing/layout/package-summary#FoldingFeature(android.graphics.Rect,kotlin.Int,kotlin.Int,androidx.window.layout.FoldingFeature.State,androidx.window.layout.FoldingFeature.Orientation)` with default values provided. With the default values it returns a `https://developer.android.com/reference/androidx/window/layout/FoldingFeature.State#HALF_OPENED()` feature that splits the screen along the `https://developer.android.com/reference/androidx/window/layout/FoldingFeature.Orientation#HORIZONTAL()` axis.

The bounds of the feature are calculated based on `https://developer.android.com/reference/androidx/window/testing/layout/package-summary#FoldingFeature(android.graphics.Rect,kotlin.Int,kotlin.Int,androidx.window.layout.FoldingFeature.State,androidx.window.layout.FoldingFeature.Orientation)` and `https://developer.android.com/reference/androidx/window/testing/layout/package-summary#FoldingFeature(android.graphics.Rect,kotlin.Int,kotlin.Int,androidx.window.layout.FoldingFeature.State,androidx.window.layout.FoldingFeature.Orientation)`. If the feature is `https://developer.android.com/reference/androidx/window/layout/FoldingFeature.Orientation#VERTICAL()` then the feature is centered horizontally. The top-left x-coordinate is center - (`https://developer.android.com/reference/androidx/window/testing/layout/package-summary#FoldingFeature(android.graphics.Rect,kotlin.Int,kotlin.Int,androidx.window.layout.FoldingFeature.State,androidx.window.layout.FoldingFeature.Orientation)` / 2) and the top-right x-coordinate is center + (`https://developer.android.com/reference/androidx/window/testing/layout/package-summary#FoldingFeature(android.graphics.Rect,kotlin.Int,kotlin.Int,androidx.window.layout.FoldingFeature.State,androidx.window.layout.FoldingFeature.Orientation)` / 2). If the feature is `https://developer.android.com/reference/androidx/window/layout/FoldingFeature.Orientation#HORIZONTAL()` then the feature is centered vertically. The top-left y-coordinate is center - (`https://developer.android.com/reference/androidx/window/testing/layout/package-summary#FoldingFeature(android.graphics.Rect,kotlin.Int,kotlin.Int,androidx.window.layout.FoldingFeature.State,androidx.window.layout.FoldingFeature.Orientation)` / 2) and the bottom-left y-coordinate is center - (`https://developer.android.com/reference/androidx/window/testing/layout/package-summary#FoldingFeature(android.graphics.Rect,kotlin.Int,kotlin.Int,androidx.window.layout.FoldingFeature.State,androidx.window.layout.FoldingFeature.Orientation)` / 2). The folding features always cover the window in one dimension and that determines the other coordinates.

Use `https://developer.android.com/reference/androidx/window/testing/layout/FoldingFeatureTestingConstants#FOLDING_FEATURE_CENTER_DEFAULT()` to default to the center of `https://developer.android.com/reference/android/app/Activity.html` window bounds. Otherwise, use values greater than or equal to 0 to specify the center.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Rect.html windowBounds` | that will contain the `https://developer.android.com/reference/androidx/window/testing/layout/package-summary#FoldingFeature(android.graphics.Rect,kotlin.Int,kotlin.Int,androidx.window.layout.FoldingFeature.State,androidx.window.layout.FoldingFeature.Orientation)`. |
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = -1) int center` | the center of the fold complementary to the orientation in px. For a `https://developer.android.com/reference/androidx/window/layout/FoldingFeature.Orientation#HORIZONTAL()` fold, this is the y-axis and for a `https://developer.android.com/reference/androidx/window/layout/FoldingFeature.Orientation#VERTICAL()` fold this is the x-axis. The default value will be calculated to be in the middle of the window. |
| `int size` | the smaller dimension of the fold in px. The larger dimension always covers the entire window. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/FoldingFeature.State state` | `https://developer.android.com/reference/androidx/window/layout/FoldingFeature.State` of the fold. The default value is `https://developer.android.com/reference/androidx/window/layout/FoldingFeature.State#HALF_OPENED()` |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/FoldingFeature.Orientation orientation` | `https://developer.android.com/reference/androidx/window/layout/FoldingFeature.Orientation` of the fold. The default value is `https://developer.android.com/reference/androidx/window/layout/FoldingFeature.Orientation#HORIZONTAL()` |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/FoldingFeature` | `https://developer.android.com/reference/androidx/window/testing/layout/package-summary#FoldingFeature(android.graphics.Rect,kotlin.Int,kotlin.Int,androidx.window.layout.FoldingFeature.State,androidx.window.layout.FoldingFeature.Orientation)` that is splitting if the width is not 0 and runs parallel to the `https://developer.android.com/reference/androidx/window/layout/FoldingFeature.Orientation` axis. |