# androidx.window.testing.embedding

*** ** * ** ***

## Classes

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/window/testing/embedding/ActivityEmbeddingRule` | A `https://junit.org/junit4/javadoc/latest/org/junit/rules/TestRule.html` that will stub out the behavior of `https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityEmbeddingController` and `https://developer.android.com/reference/kotlin/androidx/window/embedding/RuleController` with a more simple one that will support testing independent of the current platform. |

## Top-level functions summary

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityStack` | `https://developer.android.com/reference/kotlin/androidx/window/testing/embedding/package-summary#TestActivityStack(kotlin.collections.List,kotlin.Boolean)(activitiesInProcess: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/android/app/Activity.html>, isEmpty: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Creates an `https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityStack` instance for testing. |
| `https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitAttributesCalculatorParams` | `https://developer.android.com/reference/kotlin/androidx/window/testing/embedding/package-summary#TestSplitAttributesCalculatorParams(androidx.window.layout.WindowMetrics,android.content.res.Configuration,androidx.window.layout.WindowLayoutInfo,androidx.window.embedding.SplitAttributes,kotlin.Boolean,kotlin.String)( parentWindowMetrics: https://developer.android.com/reference/kotlin/androidx/window/layout/WindowMetrics, parentConfiguration: https://developer.android.com/reference/android/content/res/Configuration.html, parentWindowLayoutInfo: https://developer.android.com/reference/kotlin/androidx/window/layout/WindowLayoutInfo, defaultSplitAttributes: https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitAttributes, areDefaultConstraintsSatisfied: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, splitRuleTag: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html? )` Returns an instance of `https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitAttributesCalculatorParams` for testing. |
| `https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitInfo` | `https://developer.android.com/reference/kotlin/androidx/window/testing/embedding/package-summary#TestSplitInfo(androidx.window.embedding.ActivityStack,androidx.window.embedding.ActivityStack,androidx.window.embedding.SplitAttributes)( primaryActivityStack: https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityStack, secondActivityStack: https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityStack, splitAttributes: https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitAttributes )` Creates a `https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitInfo` instance for testing. |

## Top-level functions

### TestActivityStack

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/embedding/ActivityStackTesting.kt+function:TestActivityStack)

```
fun TestActivityStack(
    activitiesInProcess: List<Activity> = emptyList(),
    isEmpty: Boolean = false
): ActivityStack
```

Creates an `https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityStack` instance for testing. The default values are an empty list for `https://developer.android.com/reference/kotlin/androidx/window/testing/embedding/package-summary#TestActivityStack(kotlin.collections.List,kotlin.Boolean)` but a false value for `https://developer.android.com/reference/kotlin/androidx/window/testing/embedding/package-summary#TestActivityStack(kotlin.collections.List,kotlin.Boolean)`. This is the same as being embedded with an `https://developer.android.com/reference/android/app/Activity.html` from another process.

| Parameters |
|---|---|
| `activitiesInProcess: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/android/app/Activity.html> = emptyList()` | The `https://developer.android.com/reference/android/app/Activity.html` list with the same process of the host task with empty list as the default value. |
| `isEmpty: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = false` | Indicates whether this `ActivityStack` contains any `https://developer.android.com/reference/android/app/Activity.html` regardless of the process with `false` as the default value. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityStack` | An `https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityStack` instance for testing. |

### TestSplitAttributesCalculatorParams

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

```
fun TestSplitAttributesCalculatorParams(
    parentWindowMetrics: WindowMetrics,
    parentConfiguration: Configuration = Configuration(),
    parentWindowLayoutInfo: WindowLayoutInfo = WindowLayoutInfo(Collections.emptyList()),
    defaultSplitAttributes: SplitAttributes = SplitAttributes.Builder().build(),
    areDefaultConstraintsSatisfied: Boolean = true,
    splitRuleTag: String? = null
): SplitAttributesCalculatorParams
```

Returns an instance of `https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitAttributesCalculatorParams` for testing. It is used to verify the developer implemented callback set by `https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitController#setSplitAttributesCalculator(kotlin.Function1)` by setting the relevant values in `https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitAttributesCalculatorParams` with this method.

| Parameters |
|---|---|
| `parentWindowMetrics: https://developer.android.com/reference/kotlin/androidx/window/layout/WindowMetrics` | The `https://developer.android.com/reference/kotlin/androidx/window/layout/WindowMetrics` of the host task. See `https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitAttributesCalculatorParams#parentWindowMetrics()`. |
| `parentConfiguration: https://developer.android.com/reference/android/content/res/Configuration.html = Configuration()` | The `https://developer.android.com/reference/android/content/res/Configuration.html` of the host task with empty `https://developer.android.com/reference/android/content/res/Configuration.html` as the default value. See `https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitAttributesCalculatorParams#parentConfiguration()` |
| `parentWindowLayoutInfo: https://developer.android.com/reference/kotlin/androidx/window/layout/WindowLayoutInfo = WindowLayoutInfo(Collections.emptyList())` | Used for reporting the `https://developer.android.com/reference/kotlin/androidx/window/layout/FoldingFeature` with empty `https://developer.android.com/reference/kotlin/androidx/window/layout/WindowLayoutInfo` as the default value. See `https://developer.android.com/reference/kotlin/androidx/window/testing/layout/package-summary#TestWindowLayoutInfo(kotlin.collections.List,kotlin.collections.Set)` and `https://developer.android.com/reference/kotlin/androidx/window/testing/layout/package-summary#FoldingFeature(android.app.Activity,kotlin.Int,kotlin.Int,androidx.window.layout.FoldingFeature.State,androidx.window.layout.FoldingFeature.Orientation)` for how to create test `https://developer.android.com/reference/kotlin/androidx/window/layout/WindowLayoutInfo` with `https://developer.android.com/reference/kotlin/androidx/window/layout/FoldingFeature`. |
| `defaultSplitAttributes: https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitAttributes = SplitAttributes.Builder().build()` | The `https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitRule#defaultSplitAttributes()` or the `https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitRule#defaultSplitAttributes()` that the callback is applied a vertical equal `https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitAttributes` as the default value. See `https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitAttributesCalculatorParams#defaultSplitAttributes()` |
| `areDefaultConstraintsSatisfied: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = true` | `true` to indicate that the `https://developer.android.com/reference/kotlin/androidx/window/testing/embedding/package-summary#TestSplitAttributesCalculatorParams(androidx.window.layout.WindowMetrics,android.content.res.Configuration,androidx.window.layout.WindowLayoutInfo,androidx.window.embedding.SplitAttributes,kotlin.Boolean,kotlin.String)` satisfies the constraints of `https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitPairRule` or `https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitPlaceholderRule` which defaults to `true`. See `https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitAttributesCalculatorParams#areDefaultConstraintsSatisfied()` |
| `splitRuleTag: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html? = null` | The `https://developer.android.com/reference/kotlin/androidx/window/embedding/EmbeddingRule#tag()` or the `https://developer.android.com/reference/kotlin/androidx/window/embedding/EmbeddingRule#tag()` that the callback is applied with `null` as the default value. See `https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitAttributesCalculatorParams#splitRuleTag()`. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitAttributesCalculatorParams` |   |

### TestSplitInfo

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

```
fun TestSplitInfo(
    primaryActivityStack: ActivityStack = TestActivityStack(),
    secondActivityStack: ActivityStack = TestActivityStack(),
    splitAttributes: SplitAttributes = SplitAttributes.Builder().build()
): SplitInfo
```

Creates a `https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitInfo` instance for testing.

It is suggested to construct `https://developer.android.com/reference/kotlin/androidx/window/testing/embedding/package-summary#TestSplitInfo(androidx.window.embedding.ActivityStack,androidx.window.embedding.ActivityStack,androidx.window.embedding.SplitAttributes)` and `https://developer.android.com/reference/kotlin/androidx/window/testing/embedding/package-summary#TestSplitInfo(androidx.window.embedding.ActivityStack,androidx.window.embedding.ActivityStack,androidx.window.embedding.SplitAttributes)` by `https://developer.android.com/reference/kotlin/androidx/window/testing/embedding/package-summary#TestActivityStack(kotlin.collections.List,kotlin.Boolean)`, and `https://developer.android.com/reference/kotlin/androidx/window/testing/embedding/package-summary#TestSplitInfo(androidx.window.embedding.ActivityStack,androidx.window.embedding.ActivityStack,androidx.window.embedding.SplitAttributes)` by `https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitAttributes.Builder` APIs

| Parameters |
|---|---|
| `primaryActivityStack: https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityStack = TestActivityStack()` | The primary `https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityStack` with an empty `https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityStack` as the default value. |
| `secondActivityStack: https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityStack = TestActivityStack()` | The secondary `https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityStack` with an empty `https://developer.android.com/reference/kotlin/androidx/window/embedding/ActivityStack` as the default value. |
| `splitAttributes: https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitAttributes = SplitAttributes.Builder().build()` | The current `https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitAttributes` for this test split, which defaults to split equally with layout direction `https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitAttributes.LayoutDirection#LOCALE()`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitInfo` | A `https://developer.android.com/reference/kotlin/androidx/window/embedding/SplitInfo` instance for testing |