# WindowMetricsTesting

Added in 1.4.0

*** ** * ** ***


```
public final class WindowMetricsTesting
```

<br />

*** ** * ** ***

## Summary

| ### Public methods |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/WindowMetrics` | `https://developer.android.com/reference/androidx/window/testing/layout/WindowMetricsTesting#createWindowMetrics(android.graphics.Rect,kotlin.Float)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Rect.html bounds, float density)` Returns a `https://developer.android.com/reference/androidx/window/layout/WindowMetrics` with default values for testing. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/WindowMetrics` | `https://developer.android.com/reference/androidx/window/testing/layout/WindowMetricsTesting#createWindowMetrics(kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Int,kotlin.Float)( int left, int top, int right, int bottom, float density )` Returns a `https://developer.android.com/reference/androidx/window/layout/WindowMetrics` with default values for testing. |

## Public methods

### createWindowMetrics

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/WindowMetricsTesting.kt+function:TestWindowMetrics) Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/window#1.4.0)

```
public static final @NonNull WindowMetrics createWindowMetrics(@NonNull Rect bounds, float density)
```

Returns a `https://developer.android.com/reference/androidx/window/layout/WindowMetrics` with default values for testing.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Rect.html bounds` | The window bounds This value cannot be null. |
| `float density` | The window density. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/WindowMetrics` | `https://developer.android.com/reference/androidx/window/layout/WindowMetrics` object |

### createWindowMetrics

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/WindowMetricsTesting.kt+function:TestWindowMetrics) Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/window#1.4.0)

```
public static final @NonNull WindowMetrics createWindowMetrics(
    int left,
    int top,
    int right,
    int bottom,
    float density
)
```

Returns a `https://developer.android.com/reference/androidx/window/layout/WindowMetrics` with default values for testing.

| Parameters |
|---|---|
| `int left` | The X coordinate of the left side of window bounds. |
| `int top` | The Y coordinate of the top side of window bounds. |
| `int right` | The X coordinate of the right side of window bounds. |
| `int bottom` | The Y coordinate of the bottom side of window bounds. |
| `float density` | The window density. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/window/layout/WindowMetrics` | `https://developer.android.com/reference/androidx/window/layout/WindowMetrics` object |