Migrate benchmark utils to separate module.
This enables to hide them and share them between multiple benchmark
modules.
Bug: 162919420
Test: N/A
Relnote: N/A
Change-Id: Ifff3936dac9e113652318f11c4e052381ad409f8
diff --git a/compose/test-utils/OWNERS b/compose/test-utils/OWNERS
new file mode 100644
index 0000000..305021a
--- /dev/null
+++ b/compose/test-utils/OWNERS
@@ -0,0 +1,2 @@
[email protected]
[email protected]
diff --git a/compose/test-utils/build.gradle b/compose/test-utils/build.gradle
new file mode 100644
index 0000000..3c77ff1
--- /dev/null
+++ b/compose/test-utils/build.gradle
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import androidx.build.LibraryGroups
+import androidx.build.LibraryVersions
+import androidx.build.Publish
+import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
+
+import static androidx.build.dependencies.DependenciesKt.*
+
+plugins {
+ id("AndroidXPlugin")
+ id("com.android.library")
+ id("AndroidXUiPlugin")
+ id("kotlin-multiplatform")
+}
+
+dependencies {
+ kotlinPlugin project(path: ":compose:compose-compiler")
+}
+
+kotlin {
+ android()
+ sourceSets {
+ commonMain.dependencies {
+ implementation(KOTLIN_STDLIB_COMMON)
+ implementation project(":benchmark:benchmark-junit4")
+ implementation project(":compose:runtime:runtime")
+ implementation project(":compose:ui:ui")
+ implementation project(":ui:ui-test")
+ }
+
+ androidMain.dependencies {
+ api "androidx.activity:activity:1.2.0-alpha02"
+ implementation(ANDROIDX_TEST_RULES)
+ }
+
+ test.dependencies {
+ implementation(TRUTH)
+ }
+
+ androidAndroidTest.dependencies {
+ implementation(TRUTH)
+ implementation project(':compose:material:material')
+ }
+ }
+}
+
+android {
+ tasks.withType(KotlinCompile).configureEach {
+ kotlinOptions {
+ useIR = true
+ }
+ }
+}
+
+androidx {
+ name = "Compose Internal Test Utils"
+ publish = Publish.NONE
+ inceptionYear = "2020"
+ description = "Compose internal test utils."
+}
diff --git a/compose/test-utils/src/androidAndroidTest/AndroidManifest.xml b/compose/test-utils/src/androidAndroidTest/AndroidManifest.xml
new file mode 100644
index 0000000..a19fa88
--- /dev/null
+++ b/compose/test-utils/src/androidAndroidTest/AndroidManifest.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright 2020 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="androidx.ui.test"/>
\ No newline at end of file
diff --git a/ui/ui-test/src/androidAndroidTest/kotlin/androidx/ui/test/AndroidComposeTestCaseRunnerTest.kt b/compose/test-utils/src/androidAndroidTest/kotlin/androidx/ui/test/AndroidComposeTestCaseRunnerTest.kt
similarity index 94%
rename from ui/ui-test/src/androidAndroidTest/kotlin/androidx/ui/test/AndroidComposeTestCaseRunnerTest.kt
rename to compose/test-utils/src/androidAndroidTest/kotlin/androidx/ui/test/AndroidComposeTestCaseRunnerTest.kt
index ac8b7dd..bc78761 100644
--- a/ui/ui-test/src/androidAndroidTest/kotlin/androidx/ui/test/AndroidComposeTestCaseRunnerTest.kt
+++ b/compose/test-utils/src/androidAndroidTest/kotlin/androidx/ui/test/AndroidComposeTestCaseRunnerTest.kt
@@ -16,6 +16,7 @@
package androidx.ui.test
+import androidx.activity.ComponentActivity
import androidx.compose.foundation.Box
import androidx.compose.foundation.Text
import androidx.compose.runtime.Composable
@@ -23,6 +24,8 @@
import androidx.compose.runtime.onPreCommit
import androidx.compose.runtime.remember
import androidx.test.filters.SmallTest
+import androidx.ui.test.android.AndroidComposeTestRule
+import androidx.ui.test.android.createAndroidComposeRule
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@@ -33,14 +36,13 @@
class AndroidComposeTestCaseRunnerTest {
@get:Rule
- val composeTestRule = createComposeRule(
+ val composeTestRule = createAndroidComposeRule<ComponentActivity>(
disableTransitions = true
)
- internal fun ComposeTestRule.forGivenContent(
+ internal fun <T : ComponentActivity> AndroidComposeTestRule<T>.forGivenContent(
composable: @Composable () -> Unit
): ComposeTestCaseSetup {
- @OptIn(ExperimentalTesting::class)
return forGivenTestCase(object : ComposeTestCase {
@Composable
override fun emitContent() {
diff --git a/compose/test-utils/src/androidMain/AndroidManifest.xml b/compose/test-utils/src/androidMain/AndroidManifest.xml
new file mode 100644
index 0000000..33e66ad
--- /dev/null
+++ b/compose/test-utils/src/androidMain/AndroidManifest.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="androidx.ui.test"/>
diff --git a/ui/integration-tests/benchmark/src/main/java/androidx/ui/benchmark/AndroidBenchmarkRule.kt b/compose/test-utils/src/androidMain/kotlin/androidx/ui/benchmark/AndroidBenchmarkRule.kt
similarity index 100%
rename from ui/integration-tests/benchmark/src/main/java/androidx/ui/benchmark/AndroidBenchmarkRule.kt
rename to compose/test-utils/src/androidMain/kotlin/androidx/ui/benchmark/AndroidBenchmarkRule.kt
diff --git a/ui/integration-tests/benchmark/src/main/java/androidx/ui/benchmark/BenchmarkFirstExtensions.kt b/compose/test-utils/src/androidMain/kotlin/androidx/ui/benchmark/BenchmarkFirstExtensions.kt
similarity index 100%
rename from ui/integration-tests/benchmark/src/main/java/androidx/ui/benchmark/BenchmarkFirstExtensions.kt
rename to compose/test-utils/src/androidMain/kotlin/androidx/ui/benchmark/BenchmarkFirstExtensions.kt
diff --git a/compose/test-utils/src/androidMain/kotlin/androidx/ui/benchmark/BenchmarkHelpers.kt b/compose/test-utils/src/androidMain/kotlin/androidx/ui/benchmark/BenchmarkHelpers.kt
new file mode 100644
index 0000000..25084e6
--- /dev/null
+++ b/compose/test-utils/src/androidMain/kotlin/androidx/ui/benchmark/BenchmarkHelpers.kt
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.ui.benchmark
+
+import android.annotation.TargetApi
+import android.graphics.Picture
+import android.graphics.RenderNode
+import android.os.Build
+import androidx.compose.ui.graphics.Canvas
+
+// We must separate the use of RenderNode so that it isn't referenced in any
+// way on platforms that don't have it. This extracts RenderNode use to a
+// potentially unloaded class, RenderNodeCapture.
+interface DrawCapture {
+ fun beginRecording(width: Int, height: Int): Canvas
+ fun endRecording()
+}
+
+fun DrawCapture(): DrawCapture {
+ val supportsRenderNode = Build.VERSION.SDK_INT >= 29
+ return if (supportsRenderNode) {
+ RenderNodeCapture()
+ } else {
+ PictureCapture()
+ }
+}
+
+@TargetApi(Build.VERSION_CODES.Q)
+private class RenderNodeCapture : DrawCapture {
+ private val renderNode = RenderNode("Test")
+
+ override fun beginRecording(width: Int, height: Int): Canvas {
+ renderNode.setPosition(0, 0, width, height)
+ return Canvas(renderNode.beginRecording())
+ }
+
+ override fun endRecording() {
+ renderNode.endRecording()
+ }
+}
+
+private class PictureCapture : DrawCapture {
+ private val picture = Picture()
+
+ override fun beginRecording(width: Int, height: Int): Canvas {
+ return Canvas(picture.beginRecording(width, height))
+ }
+
+ override fun endRecording() {
+ picture.endRecording()
+ }
+}
\ No newline at end of file
diff --git a/ui/integration-tests/benchmark/src/main/java/androidx/ui/benchmark/BenchmarksExtensions.kt b/compose/test-utils/src/androidMain/kotlin/androidx/ui/benchmark/BenchmarksExtensions.kt
similarity index 98%
rename from ui/integration-tests/benchmark/src/main/java/androidx/ui/benchmark/BenchmarksExtensions.kt
rename to compose/test-utils/src/androidMain/kotlin/androidx/ui/benchmark/BenchmarksExtensions.kt
index 49f1b61..6c1bf22 100644
--- a/ui/integration-tests/benchmark/src/main/java/androidx/ui/benchmark/BenchmarksExtensions.kt
+++ b/compose/test-utils/src/androidMain/kotlin/androidx/ui/benchmark/BenchmarksExtensions.kt
@@ -1,5 +1,5 @@
/*
- * Copyright 2019 The Android Open Source Project
+ * Copyright 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,11 +20,10 @@
import androidx.benchmark.junit4.BenchmarkRule
import androidx.benchmark.junit4.measureRepeated
import androidx.ui.test.ComposeTestCase
-import androidx.ui.integration.test.ToggleableTestCase
-import androidx.ui.test.assertNoPendingChanges
import androidx.ui.benchmark.android.AndroidTestCase
import androidx.compose.ui.graphics.Canvas
-import androidx.ui.integration.test.DrawCapture
+import androidx.ui.test.ToggleableTestCase
+import androidx.ui.test.assertNoPendingChanges
import androidx.ui.test.doFramesUntilNoChangesPending
import androidx.ui.test.recomposeAssertHadChanges
import androidx.ui.test.setupContent
diff --git a/ui/integration-tests/benchmark/src/main/java/androidx/ui/benchmark/ComposeBenchmarkRule.kt b/compose/test-utils/src/androidMain/kotlin/androidx/ui/benchmark/ComposeBenchmarkRule.kt
similarity index 91%
rename from ui/integration-tests/benchmark/src/main/java/androidx/ui/benchmark/ComposeBenchmarkRule.kt
rename to compose/test-utils/src/androidMain/kotlin/androidx/ui/benchmark/ComposeBenchmarkRule.kt
index 49f3b99..e8179aa 100644
--- a/ui/integration-tests/benchmark/src/main/java/androidx/ui/benchmark/ComposeBenchmarkRule.kt
+++ b/compose/test-utils/src/androidMain/kotlin/androidx/ui/benchmark/ComposeBenchmarkRule.kt
@@ -23,7 +23,7 @@
import androidx.ui.test.ComposeBenchmarkScope
import androidx.ui.test.ComposeTestCase
import androidx.ui.test.DisableTransitions
-import androidx.ui.test.android.createAndroidComposeBenchmarkRunner
+import androidx.ui.test.createAndroidComposeBenchmarkRunner
import org.junit.rules.TestRule
import org.junit.runner.Description
import org.junit.runners.model.Statement
@@ -31,7 +31,6 @@
/**
* Rule to be used to run Compose / Android benchmarks.
*/
-// TODO(pavlis): Move this to a separate module, something like androidx.ui.test-benchmark
class ComposeBenchmarkRule(
private val enableTransitions: Boolean = false
) : TestRule {
@@ -71,8 +70,10 @@
activityTestRule.runOnUiThread {
// TODO(pavlis): Assert that there is no existing composition before we run benchmark
- val runner = createAndroidComposeBenchmarkRunner(givenTestCase,
- activityTestRule.activity)
+ val runner = createAndroidComposeBenchmarkRunner(
+ givenTestCase,
+ activityTestRule.activity
+ )
try {
block(runner)
} finally {
diff --git a/ui/integration-tests/src/main/java/androidx/ui/benchmark/android/AndroidTestCase.kt b/compose/test-utils/src/androidMain/kotlin/androidx/ui/benchmark/android/AndroidTestCase.kt
similarity index 100%
rename from ui/integration-tests/src/main/java/androidx/ui/benchmark/android/AndroidTestCase.kt
rename to compose/test-utils/src/androidMain/kotlin/androidx/ui/benchmark/android/AndroidTestCase.kt
diff --git a/ui/integration-tests/src/main/java/androidx/ui/benchmark/android/AndroidTestCaseRunner.kt b/compose/test-utils/src/androidMain/kotlin/androidx/ui/benchmark/android/AndroidTestCaseRunner.kt
similarity index 100%
rename from ui/integration-tests/src/main/java/androidx/ui/benchmark/android/AndroidTestCaseRunner.kt
rename to compose/test-utils/src/androidMain/kotlin/androidx/ui/benchmark/android/AndroidTestCaseRunner.kt
diff --git a/ui/ui-test/src/androidMain/kotlin/androidx/ui/test/android/AndroidComposeTestCaseRunner.kt b/compose/test-utils/src/androidMain/kotlin/androidx/ui/test/AndroidComposeTestCaseRunner.kt
similarity index 98%
rename from ui/ui-test/src/androidMain/kotlin/androidx/ui/test/android/AndroidComposeTestCaseRunner.kt
rename to compose/test-utils/src/androidMain/kotlin/androidx/ui/test/AndroidComposeTestCaseRunner.kt
index 61a1911..1cfef71 100644
--- a/ui/ui-test/src/androidMain/kotlin/androidx/ui/test/android/AndroidComposeTestCaseRunner.kt
+++ b/compose/test-utils/src/androidMain/kotlin/androidx/ui/test/AndroidComposeTestCaseRunner.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package androidx.ui.test.android
+package androidx.ui.test
import android.annotation.TargetApi
import android.app.Activity
@@ -35,9 +35,6 @@
import androidx.compose.runtime.snapshots.Snapshot
import androidx.compose.ui.platform.AndroidOwner
import androidx.compose.ui.platform.setContent
-import androidx.ui.test.ComposeBenchmarkScope
-import androidx.ui.test.ComposeTestCase
-import androidx.ui.test.setupContent
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.launch
diff --git a/ui/ui-test/src/androidMain/kotlin/androidx/ui/test/android/AndroidComposeTestCaseSetup.kt b/compose/test-utils/src/androidMain/kotlin/androidx/ui/test/AndroidComposeTestCaseSetup.kt
similarity index 83%
rename from ui/ui-test/src/androidMain/kotlin/androidx/ui/test/android/AndroidComposeTestCaseSetup.kt
rename to compose/test-utils/src/androidMain/kotlin/androidx/ui/test/AndroidComposeTestCaseSetup.kt
index 9e06609..ede1071 100644
--- a/ui/ui-test/src/androidMain/kotlin/androidx/ui/test/android/AndroidComposeTestCaseSetup.kt
+++ b/compose/test-utils/src/androidMain/kotlin/androidx/ui/test/AndroidComposeTestCaseSetup.kt
@@ -14,14 +14,9 @@
* limitations under the License.
*/
-package androidx.ui.test.android
+package androidx.ui.test
import androidx.activity.ComponentActivity
-import androidx.ui.test.ComposeExecutionControl
-import androidx.ui.test.ComposeTestCase
-import androidx.ui.test.ComposeTestCaseSetup
-import androidx.ui.test.runOnUiThread
-import androidx.ui.test.setupContent
class AndroidComposeTestCaseSetup(
private val testCase: ComposeTestCase,
diff --git a/compose/test-utils/src/androidMain/kotlin/androidx/ui/test/TestRuleExtensions.kt b/compose/test-utils/src/androidMain/kotlin/androidx/ui/test/TestRuleExtensions.kt
new file mode 100644
index 0000000..dea4f06
--- /dev/null
+++ b/compose/test-utils/src/androidMain/kotlin/androidx/ui/test/TestRuleExtensions.kt
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.ui.test
+
+import androidx.activity.ComponentActivity
+import androidx.ui.test.android.AndroidComposeTestRule
+
+/**
+ * Takes the given test case and prepares it for execution-controlled test via
+ * [ComposeTestCaseSetup].
+ */
+fun <T : ComponentActivity> AndroidComposeTestRule<T>.forGivenTestCase(testCase: ComposeTestCase):
+ ComposeTestCaseSetup {
+ fun getActivity(): T {
+ var activity: T? = null
+ if (activity == null) {
+ activityRule.scenario.onActivity { activity = it }
+ if (activity == null) {
+ throw IllegalStateException("Activity was not set in the ActivityScenarioRule!")
+ }
+ }
+ return activity!!
+ }
+
+ return AndroidComposeTestCaseSetup(
+ testCase,
+ getActivity()
+ )
+}
\ No newline at end of file
diff --git a/ui/ui-test/src/androidMain/kotlin/androidx/ui/test/android/fake/FakeViewStructure.kt b/compose/test-utils/src/androidMain/kotlin/androidx/ui/test/fake/FakeViewStructure.kt
similarity index 99%
rename from ui/ui-test/src/androidMain/kotlin/androidx/ui/test/android/fake/FakeViewStructure.kt
rename to compose/test-utils/src/androidMain/kotlin/androidx/ui/test/fake/FakeViewStructure.kt
index 818e001e..6b3d36a 100644
--- a/ui/ui-test/src/androidMain/kotlin/androidx/ui/test/android/fake/FakeViewStructure.kt
+++ b/compose/test-utils/src/androidMain/kotlin/androidx/ui/test/fake/FakeViewStructure.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package androidx.ui.test.android.fake
+package androidx.ui.test.fake
import android.graphics.Matrix
import android.graphics.Rect
diff --git a/ui/ui-test/src/commonMain/kotlin/androidx/ui/test/ComposeBenchmarkScope.kt b/compose/test-utils/src/commonMain/kotlin/androidx/ui/test/ComposeBenchmarkScope.kt
similarity index 100%
rename from ui/ui-test/src/commonMain/kotlin/androidx/ui/test/ComposeBenchmarkScope.kt
rename to compose/test-utils/src/commonMain/kotlin/androidx/ui/test/ComposeBenchmarkScope.kt
diff --git a/ui/ui-test/src/commonMain/kotlin/androidx/ui/test/ComposeExecutionControl.kt b/compose/test-utils/src/commonMain/kotlin/androidx/ui/test/ComposeExecutionControl.kt
similarity index 92%
rename from ui/ui-test/src/commonMain/kotlin/androidx/ui/test/ComposeExecutionControl.kt
rename to compose/test-utils/src/commonMain/kotlin/androidx/ui/test/ComposeExecutionControl.kt
index 971f4be..e72ff88 100644
--- a/ui/ui-test/src/commonMain/kotlin/androidx/ui/test/ComposeExecutionControl.kt
+++ b/compose/test-utils/src/commonMain/kotlin/androidx/ui/test/ComposeExecutionControl.kt
@@ -104,6 +104,19 @@
fun launchRecomposeIn(coroutineScope: CoroutineScope): Job
}
+/**
+ * Helper interface to run execution-controlled test via [ComposeTestRule].
+ */
+interface ComposeTestCaseSetup {
+ /**
+ * Takes the content provided via [ComposeTestRule#setContent] and runs the given test
+ * instruction. The test is executed on the main thread and prevents interference from Activity
+ * so the frames can be controlled manually. See [ComposeExecutionControl] for available
+ * methods.
+ */
+ fun performTestWithEventsControl(block: androidx.ui.test.ComposeExecutionControl.() -> Unit)
+}
+
// Assertions
/**
@@ -226,4 +239,4 @@
// Still not stable
throw AssertionError("Changes are still pending after '$maxAmountOfFrames' " +
"frames.")
-}
+}
\ No newline at end of file
diff --git a/ui/ui-test/src/commonMain/kotlin/androidx/ui/test/ComposeTestCase.kt b/compose/test-utils/src/commonMain/kotlin/androidx/ui/test/ComposeTestCase.kt
similarity index 100%
rename from ui/ui-test/src/commonMain/kotlin/androidx/ui/test/ComposeTestCase.kt
rename to compose/test-utils/src/commonMain/kotlin/androidx/ui/test/ComposeTestCase.kt
diff --git a/ui/integration-tests/src/main/java/androidx/ui/integration/test/ToggleableTestCase.kt b/compose/test-utils/src/commonMain/kotlin/androidx/ui/test/ToggleableTestCase.kt
similarity index 95%
rename from ui/integration-tests/src/main/java/androidx/ui/integration/test/ToggleableTestCase.kt
rename to compose/test-utils/src/commonMain/kotlin/androidx/ui/test/ToggleableTestCase.kt
index bac0ad4..24abf2a 100644
--- a/ui/integration-tests/src/main/java/androidx/ui/integration/test/ToggleableTestCase.kt
+++ b/compose/test-utils/src/commonMain/kotlin/androidx/ui/test/ToggleableTestCase.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package androidx.ui.integration.test
+package androidx.ui.test
/**
* Test case that allows to trigger a change of state. This is run multiple times by the benchmarks.
diff --git a/ui/integration-tests/benchmark/build.gradle b/ui/integration-tests/benchmark/build.gradle
index b12a1295..5e992e1 100644
--- a/ui/integration-tests/benchmark/build.gradle
+++ b/ui/integration-tests/benchmark/build.gradle
@@ -46,6 +46,7 @@
androidTestImplementation project(":compose:foundation:foundation-layout")
androidTestImplementation project(":compose:material:material")
androidTestImplementation project(":ui:ui-test")
+ androidTestImplementation project(":compose:test-utils")
androidTestImplementation project(":compose:runtime:runtime")
androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
androidTestImplementation(KOTLIN_TEST_COMMON)
diff --git a/ui/integration-tests/benchmark/src/androidTest/java/androidx/compose/ui/OnPositionedBenchmark.kt b/ui/integration-tests/benchmark/src/androidTest/java/androidx/compose/ui/OnPositionedBenchmark.kt
index 1cc3fc9..dc8f396 100644
--- a/ui/integration-tests/benchmark/src/androidTest/java/androidx/compose/ui/OnPositionedBenchmark.kt
+++ b/ui/integration-tests/benchmark/src/androidTest/java/androidx/compose/ui/OnPositionedBenchmark.kt
@@ -29,7 +29,7 @@
import androidx.test.filters.LargeTest
import androidx.ui.benchmark.ComposeBenchmarkRule
import androidx.ui.benchmark.toggleStateBenchmarkLayout
-import androidx.ui.integration.test.ToggleableTestCase
+import androidx.ui.test.ToggleableTestCase
import androidx.ui.test.ComposeTestCase
import org.junit.Rule
import org.junit.Test
diff --git a/ui/integration-tests/benchmark/src/androidTest/java/androidx/compose/ui/WithConstraintsBenchmark.kt b/ui/integration-tests/benchmark/src/androidTest/java/androidx/compose/ui/WithConstraintsBenchmark.kt
index f881f47..4a7c2b5 100644
--- a/ui/integration-tests/benchmark/src/androidTest/java/androidx/compose/ui/WithConstraintsBenchmark.kt
+++ b/ui/integration-tests/benchmark/src/androidTest/java/androidx/compose/ui/WithConstraintsBenchmark.kt
@@ -34,7 +34,7 @@
import androidx.ui.benchmark.ComposeBenchmarkRule
import androidx.ui.benchmark.toggleStateBenchmarkComposeMeasureLayout
import androidx.ui.benchmark.toggleStateBenchmarkMeasureLayout
-import androidx.ui.integration.test.ToggleableTestCase
+import androidx.ui.test.ToggleableTestCase
import androidx.ui.test.ComposeTestCase
import org.junit.Rule
import org.junit.Test
diff --git a/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/benchmark/test/RadioGroupBenchmark.kt b/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/benchmark/test/RadioGroupBenchmark.kt
index a813803..e3f82df 100644
--- a/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/benchmark/test/RadioGroupBenchmark.kt
+++ b/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/benchmark/test/RadioGroupBenchmark.kt
@@ -33,7 +33,7 @@
import androidx.compose.ui.Modifier
import androidx.compose.foundation.Text
import androidx.compose.foundation.selection.selectable
-import androidx.ui.integration.test.ToggleableTestCase
+import androidx.ui.test.ToggleableTestCase
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.material.MaterialTheme
diff --git a/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/benchmark/test/SpacingBenchmark.kt b/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/benchmark/test/SpacingBenchmark.kt
index d4468a8..65075fa 100644
--- a/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/benchmark/test/SpacingBenchmark.kt
+++ b/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/benchmark/test/SpacingBenchmark.kt
@@ -39,7 +39,7 @@
import androidx.ui.benchmark.toggleStateBenchmarkLayout
import androidx.ui.benchmark.toggleStateBenchmarkMeasure
import androidx.ui.benchmark.toggleStateBenchmarkRecompose
-import androidx.ui.integration.test.ToggleableTestCase
+import androidx.ui.test.ToggleableTestCase
import androidx.ui.test.ComposeTestCase
import org.junit.Rule
import org.junit.Test
@@ -156,8 +156,7 @@
}
}
-private sealed class PaddingTestCase : ComposeTestCase,
- ToggleableTestCase {
+private sealed class PaddingTestCase : ComposeTestCase, ToggleableTestCase {
var paddingState: MutableState<Dp>? = null
diff --git a/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/benchmark/test/TrailingLambdaBenchmark.kt b/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/benchmark/test/TrailingLambdaBenchmark.kt
index df185ec..dd53d3b 100644
--- a/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/benchmark/test/TrailingLambdaBenchmark.kt
+++ b/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/benchmark/test/TrailingLambdaBenchmark.kt
@@ -29,7 +29,7 @@
import androidx.ui.benchmark.ComposeBenchmarkRule
import androidx.ui.benchmark.benchmarkFirstCompose
import androidx.ui.benchmark.toggleStateBenchmarkRecompose
-import androidx.ui.integration.test.ToggleableTestCase
+import androidx.ui.test.ToggleableTestCase
import androidx.ui.test.ComposeTestCase
import org.junit.Rule
import org.junit.Test
@@ -63,8 +63,7 @@
}
}
-private sealed class TrailingLambdaTestCase() : ComposeTestCase,
- ToggleableTestCase {
+private sealed class TrailingLambdaTestCase() : ComposeTestCase, ToggleableTestCase {
var numberState: MutableState<Int>? = null
diff --git a/ui/integration-tests/build.gradle b/ui/integration-tests/build.gradle
index 2235dfb..994b358 100644
--- a/ui/integration-tests/build.gradle
+++ b/ui/integration-tests/build.gradle
@@ -44,6 +44,7 @@
implementation project(":compose:foundation:foundation-layout")
implementation project(":compose:material:material")
implementation project(":ui:ui-test")
+ implementation project(":compose:test-utils")
}
androidx {
diff --git a/ui/integration-tests/src/androidTest/java/androidx/ui/integration/test/CheckboxesInRowsTest.kt b/ui/integration-tests/src/androidTest/java/androidx/ui/integration/test/CheckboxesInRowsTest.kt
index 157633f..f7fa98109 100644
--- a/ui/integration-tests/src/androidTest/java/androidx/ui/integration/test/CheckboxesInRowsTest.kt
+++ b/ui/integration-tests/src/androidTest/java/androidx/ui/integration/test/CheckboxesInRowsTest.kt
@@ -16,12 +16,14 @@
package androidx.ui.integration.test
+import androidx.activity.ComponentActivity
import androidx.test.filters.MediumTest
import androidx.ui.test.assertMeasureSizeIsPositive
import androidx.ui.test.assertNoPendingChanges
import androidx.ui.integration.test.material.CheckboxesInRowsTestCase
import androidx.ui.test.ExperimentalTesting
-import androidx.ui.test.createComposeRule
+import androidx.ui.test.android.createAndroidComposeRule
+import androidx.ui.test.forGivenTestCase
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@@ -42,7 +44,7 @@
}
@get:Rule
- val composeTestRule = createComposeRule(disableTransitions = true)
+ val composeTestRule = createAndroidComposeRule<ComponentActivity>(disableTransitions = true)
@Test
fun toggleRectangleColor_compose() {
diff --git a/ui/integration-tests/src/androidTest/java/androidx/ui/integration/test/ObservableThemeTest.kt b/ui/integration-tests/src/androidTest/java/androidx/ui/integration/test/ObservableThemeTest.kt
index e24325c..18045a5 100644
--- a/ui/integration-tests/src/androidTest/java/androidx/ui/integration/test/ObservableThemeTest.kt
+++ b/ui/integration-tests/src/androidTest/java/androidx/ui/integration/test/ObservableThemeTest.kt
@@ -16,6 +16,7 @@
package androidx.ui.integration.test
+import androidx.activity.ComponentActivity
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Immutable
import androidx.compose.runtime.MutableState
@@ -29,11 +30,13 @@
import androidx.compose.ui.graphics.Color
import androidx.test.filters.MediumTest
import androidx.ui.test.ComposeTestCase
+import androidx.ui.test.ToggleableTestCase
import androidx.ui.test.ExperimentalTesting
+import androidx.ui.test.android.createAndroidComposeRule
import androidx.ui.test.assertNoPendingChanges
-import androidx.ui.test.createComposeRule
import androidx.ui.test.doFramesUntilNoChangesPending
-import org.junit.Assert
+import androidx.ui.test.forGivenTestCase
+import org.junit.Assert.assertEquals
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@@ -49,7 +52,7 @@
@OptIn(ExperimentalTesting::class)
class ObservableThemeTest {
@get:Rule
- val composeTestRule = createComposeRule(disableTransitions = true)
+ val composeTestRule = createAndroidComposeRule<ComponentActivity>(disableTransitions = true)
@Test
fun testObservableTheme() {
@@ -60,8 +63,8 @@
doFrame()
assertNoPendingChanges()
- Assert.assertEquals(2, testCase.primaryCompositions)
- Assert.assertEquals(1, testCase.secondaryCompositions)
+ assertEquals(2, testCase.primaryCompositions)
+ assertEquals(1, testCase.secondaryCompositions)
doFrame()
assertNoPendingChanges()
@@ -70,8 +73,8 @@
doFramesUntilNoChangesPending(maxAmountOfFrames = 1)
- Assert.assertEquals(4, testCase.primaryCompositions)
- Assert.assertEquals(1, testCase.secondaryCompositions)
+ assertEquals(4, testCase.primaryCompositions)
+ assertEquals(1, testCase.secondaryCompositions)
}
}
@@ -84,8 +87,8 @@
doFrame()
assertNoPendingChanges()
- Assert.assertEquals(2, testCase.primaryCompositions)
- Assert.assertEquals(1, testCase.secondaryCompositions)
+ assertEquals(2, testCase.primaryCompositions)
+ assertEquals(1, testCase.secondaryCompositions)
doFrame()
assertNoPendingChanges()
@@ -94,8 +97,8 @@
doFramesUntilNoChangesPending(maxAmountOfFrames = 1)
- Assert.assertEquals(4, testCase.primaryCompositions)
- Assert.assertEquals(2, testCase.secondaryCompositions)
+ assertEquals(4, testCase.primaryCompositions)
+ assertEquals(2, testCase.secondaryCompositions)
}
}
}
diff --git a/ui/integration-tests/src/androidTest/java/androidx/ui/integration/test/RectsInColumnSharedModelTest.kt b/ui/integration-tests/src/androidTest/java/androidx/ui/integration/test/RectsInColumnSharedModelTest.kt
index e933b87..4e8700a 100644
--- a/ui/integration-tests/src/androidTest/java/androidx/ui/integration/test/RectsInColumnSharedModelTest.kt
+++ b/ui/integration-tests/src/androidTest/java/androidx/ui/integration/test/RectsInColumnSharedModelTest.kt
@@ -16,12 +16,14 @@
package androidx.ui.integration.test
+import androidx.activity.ComponentActivity
import androidx.test.filters.MediumTest
import androidx.ui.test.assertMeasureSizeIsPositive
import androidx.ui.test.assertNoPendingChanges
import androidx.ui.integration.test.foundation.RectsInColumnSharedModelTestCase
import androidx.ui.test.ExperimentalTesting
-import androidx.ui.test.createComposeRule
+import androidx.ui.test.android.createAndroidComposeRule
+import androidx.ui.test.forGivenTestCase
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@@ -42,7 +44,7 @@
}
@get:Rule
- val composeTestRule = createComposeRule(disableTransitions = true)
+ val composeTestRule = createAndroidComposeRule<ComponentActivity>(disableTransitions = true)
@Test
fun toggleRectangleColor_compose() {
diff --git a/ui/integration-tests/src/androidTest/java/androidx/ui/integration/test/RectsInColumnTest.kt b/ui/integration-tests/src/androidTest/java/androidx/ui/integration/test/RectsInColumnTest.kt
index ff6bbe6..e2a4c8b 100644
--- a/ui/integration-tests/src/androidTest/java/androidx/ui/integration/test/RectsInColumnTest.kt
+++ b/ui/integration-tests/src/androidTest/java/androidx/ui/integration/test/RectsInColumnTest.kt
@@ -16,12 +16,14 @@
package androidx.ui.integration.test
+import androidx.activity.ComponentActivity
import androidx.test.filters.MediumTest
import androidx.ui.test.assertMeasureSizeIsPositive
import androidx.ui.test.assertNoPendingChanges
import androidx.ui.integration.test.foundation.RectsInColumnTestCase
import androidx.ui.test.ExperimentalTesting
-import androidx.ui.test.createComposeRule
+import androidx.ui.test.android.createAndroidComposeRule
+import androidx.ui.test.forGivenTestCase
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@@ -42,7 +44,7 @@
}
@get:Rule
- val composeTestRule = createComposeRule(disableTransitions = true)
+ val composeTestRule = createAndroidComposeRule<ComponentActivity>(disableTransitions = true)
@Test
fun toggleRectangleColor_compose() {
diff --git a/ui/integration-tests/src/main/java/androidx/ui/integration/test/TextBenchmarkHelper.kt b/ui/integration-tests/src/main/java/androidx/ui/integration/test/TextBenchmarkHelper.kt
index ffaa651..c7f7dab 100644
--- a/ui/integration-tests/src/main/java/androidx/ui/integration/test/TextBenchmarkHelper.kt
+++ b/ui/integration-tests/src/main/java/androidx/ui/integration/test/TextBenchmarkHelper.kt
@@ -16,12 +16,7 @@
package androidx.ui.integration.test
-import android.annotation.TargetApi
-import android.graphics.Picture
-import android.graphics.RenderNode
-import android.os.Build
import androidx.compose.ui.geometry.Offset
-import androidx.compose.ui.graphics.Canvas
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Shadow
import androidx.compose.ui.text.AnnotatedString
@@ -231,46 +226,3 @@
acc.flatMap { accListItem -> list.map { accListItem + it } }
}
}
-
-// We must separate the use of RenderNode so that it isn't referenced in any
-// way on platforms that don't have it. This extracts RenderNode use to a
-// potentially unloaded class, RenderNodeCapture.
-interface DrawCapture {
- fun beginRecording(width: Int, height: Int): Canvas
- fun endRecording()
-}
-
-fun DrawCapture(): DrawCapture {
- val supportsRenderNode = Build.VERSION.SDK_INT >= 29
- return if (supportsRenderNode) {
- RenderNodeCapture()
- } else {
- PictureCapture()
- }
-}
-
-@TargetApi(Build.VERSION_CODES.Q)
-private class RenderNodeCapture : DrawCapture {
- private val renderNode = RenderNode("Test")
-
- override fun beginRecording(width: Int, height: Int): Canvas {
- renderNode.setPosition(0, 0, width, height)
- return Canvas(renderNode.beginRecording())
- }
-
- override fun endRecording() {
- renderNode.endRecording()
- }
-}
-
-private class PictureCapture : DrawCapture {
- private val picture = Picture()
-
- override fun beginRecording(width: Int, height: Int): Canvas {
- return Canvas(picture.beginRecording(width, height))
- }
-
- override fun endRecording() {
- picture.endRecording()
- }
-}
\ No newline at end of file
diff --git a/ui/integration-tests/src/main/java/androidx/ui/integration/test/core/BaseSimpleRadioButtonTestCase.kt b/ui/integration-tests/src/main/java/androidx/ui/integration/test/core/BaseSimpleRadioButtonTestCase.kt
index 460c749..1ac2fb8 100644
--- a/ui/integration-tests/src/main/java/androidx/ui/integration/test/core/BaseSimpleRadioButtonTestCase.kt
+++ b/ui/integration-tests/src/main/java/androidx/ui/integration/test/core/BaseSimpleRadioButtonTestCase.kt
@@ -22,7 +22,7 @@
import androidx.compose.runtime.remember
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
-import androidx.ui.integration.test.ToggleableTestCase
+import androidx.ui.test.ToggleableTestCase
import androidx.ui.test.ComposeTestCase
abstract class BaseSimpleRadioButtonTestCase : ComposeTestCase, ToggleableTestCase {
diff --git a/ui/integration-tests/src/main/java/androidx/ui/integration/test/core/text/TextBasicTestCase.kt b/ui/integration-tests/src/main/java/androidx/ui/integration/test/core/text/TextBasicTestCase.kt
index 6749f14..102cc50 100644
--- a/ui/integration-tests/src/main/java/androidx/ui/integration/test/core/text/TextBasicTestCase.kt
+++ b/ui/integration-tests/src/main/java/androidx/ui/integration/test/core/text/TextBasicTestCase.kt
@@ -23,7 +23,7 @@
import androidx.compose.foundation.Box
import androidx.compose.foundation.Text
import androidx.compose.ui.graphics.Color
-import androidx.ui.integration.test.ToggleableTestCase
+import androidx.ui.test.ToggleableTestCase
import androidx.compose.foundation.layout.preferredWidth
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.ui.unit.Dp
diff --git a/ui/integration-tests/src/main/java/androidx/ui/integration/test/core/text/TextToggleTextTestCase.kt b/ui/integration-tests/src/main/java/androidx/ui/integration/test/core/text/TextToggleTextTestCase.kt
index 7c13954..69fdf8a 100644
--- a/ui/integration-tests/src/main/java/androidx/ui/integration/test/core/text/TextToggleTextTestCase.kt
+++ b/ui/integration-tests/src/main/java/androidx/ui/integration/test/core/text/TextToggleTextTestCase.kt
@@ -26,7 +26,7 @@
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.ui.integration.test.RandomTextGenerator
-import androidx.ui.integration.test.ToggleableTestCase
+import androidx.ui.test.ToggleableTestCase
import androidx.ui.test.ComposeTestCase
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.TextUnit
diff --git a/ui/integration-tests/src/main/java/androidx/ui/integration/test/foundation/NestedScrollerTestCase.kt b/ui/integration-tests/src/main/java/androidx/ui/integration/test/foundation/NestedScrollerTestCase.kt
index 9f77fdf..5a8d61c 100644
--- a/ui/integration-tests/src/main/java/androidx/ui/integration/test/foundation/NestedScrollerTestCase.kt
+++ b/ui/integration-tests/src/main/java/androidx/ui/integration/test/foundation/NestedScrollerTestCase.kt
@@ -30,7 +30,7 @@
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.background
import androidx.compose.ui.graphics.Color
-import androidx.ui.integration.test.ToggleableTestCase
+import androidx.ui.test.ToggleableTestCase
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.RowScope
diff --git a/ui/integration-tests/src/main/java/androidx/ui/integration/test/foundation/RectsInColumnSharedModelTestCase.kt b/ui/integration-tests/src/main/java/androidx/ui/integration/test/foundation/RectsInColumnSharedModelTestCase.kt
index fbd39a0..d30b826 100644
--- a/ui/integration-tests/src/main/java/androidx/ui/integration/test/foundation/RectsInColumnSharedModelTestCase.kt
+++ b/ui/integration-tests/src/main/java/androidx/ui/integration/test/foundation/RectsInColumnSharedModelTestCase.kt
@@ -26,7 +26,7 @@
import androidx.compose.foundation.layout.Column
import androidx.compose.material.MaterialTheme
import androidx.ui.test.ComposeTestCase
-import androidx.ui.integration.test.ToggleableTestCase
+import androidx.ui.test.ToggleableTestCase
import androidx.compose.foundation.layout.preferredSize
/**
diff --git a/ui/integration-tests/src/main/java/androidx/ui/integration/test/foundation/RectsInColumnTestCase.kt b/ui/integration-tests/src/main/java/androidx/ui/integration/test/foundation/RectsInColumnTestCase.kt
index 97395cb..645f8c1 100644
--- a/ui/integration-tests/src/main/java/androidx/ui/integration/test/foundation/RectsInColumnTestCase.kt
+++ b/ui/integration-tests/src/main/java/androidx/ui/integration/test/foundation/RectsInColumnTestCase.kt
@@ -29,7 +29,7 @@
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
-import androidx.ui.integration.test.ToggleableTestCase
+import androidx.ui.test.ToggleableTestCase
import androidx.ui.test.ComposeTestCase
/**
diff --git a/ui/integration-tests/src/main/java/androidx/ui/integration/test/foundation/ScrollerTestCase.kt b/ui/integration-tests/src/main/java/androidx/ui/integration/test/foundation/ScrollerTestCase.kt
index e2ec6e0..d0a030b 100644
--- a/ui/integration-tests/src/main/java/androidx/ui/integration/test/foundation/ScrollerTestCase.kt
+++ b/ui/integration-tests/src/main/java/androidx/ui/integration/test/foundation/ScrollerTestCase.kt
@@ -23,7 +23,7 @@
import androidx.compose.foundation.ScrollableColumn
import androidx.compose.foundation.rememberScrollState
import androidx.compose.ui.graphics.Color
-import androidx.ui.integration.test.ToggleableTestCase
+import androidx.ui.test.ToggleableTestCase
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.preferredSize
diff --git a/ui/integration-tests/src/main/java/androidx/ui/integration/test/foundation/TextInColumnTestCase.kt b/ui/integration-tests/src/main/java/androidx/ui/integration/test/foundation/TextInColumnTestCase.kt
index f816802..6a56f5f 100644
--- a/ui/integration-tests/src/main/java/androidx/ui/integration/test/foundation/TextInColumnTestCase.kt
+++ b/ui/integration-tests/src/main/java/androidx/ui/integration/test/foundation/TextInColumnTestCase.kt
@@ -19,7 +19,7 @@
import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf
import androidx.compose.foundation.Text
-import androidx.ui.integration.test.ToggleableTestCase
+import androidx.ui.test.ToggleableTestCase
import androidx.compose.foundation.layout.Column
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Surface
diff --git a/ui/integration-tests/src/main/java/androidx/ui/integration/test/material/CheckboxesInRowsTestCase.kt b/ui/integration-tests/src/main/java/androidx/ui/integration/test/material/CheckboxesInRowsTestCase.kt
index 34ae215..f0fa98b 100644
--- a/ui/integration-tests/src/main/java/androidx/ui/integration/test/material/CheckboxesInRowsTestCase.kt
+++ b/ui/integration-tests/src/main/java/androidx/ui/integration/test/material/CheckboxesInRowsTestCase.kt
@@ -29,7 +29,7 @@
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
-import androidx.ui.integration.test.ToggleableTestCase
+import androidx.ui.test.ToggleableTestCase
import androidx.ui.test.ComposeTestCase
/**
diff --git a/ui/integration-tests/src/main/java/androidx/ui/integration/test/view/AndroidNestedScrollViewTestCase.kt b/ui/integration-tests/src/main/java/androidx/ui/integration/test/view/AndroidNestedScrollViewTestCase.kt
index 04ebda8..279da91 100644
--- a/ui/integration-tests/src/main/java/androidx/ui/integration/test/view/AndroidNestedScrollViewTestCase.kt
+++ b/ui/integration-tests/src/main/java/androidx/ui/integration/test/view/AndroidNestedScrollViewTestCase.kt
@@ -22,7 +22,7 @@
import android.widget.HorizontalScrollView
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.toArgb
-import androidx.ui.integration.test.ToggleableTestCase
+import androidx.ui.test.ToggleableTestCase
import androidx.ui.benchmark.android.AndroidTestCase
import androidx.ui.integration.test.foundation.NestedScrollerTestCase
import kotlin.random.Random
@@ -30,8 +30,7 @@
/**
* Version of [NestedScrollerTestCase] using Android views.
*/
-class AndroidNestedScrollViewTestCase : AndroidTestCase,
- ToggleableTestCase {
+class AndroidNestedScrollViewTestCase : AndroidTestCase, ToggleableTestCase {
lateinit var firstScrollView: HorizontalScrollView
override fun getContent(activity: Activity): ViewGroup {
diff --git a/ui/integration-tests/src/main/java/androidx/ui/integration/test/view/AndroidRectsInLinearLayoutTestCase.kt b/ui/integration-tests/src/main/java/androidx/ui/integration/test/view/AndroidRectsInLinearLayoutTestCase.kt
index b816715..0ee50d8 100644
--- a/ui/integration-tests/src/main/java/androidx/ui/integration/test/view/AndroidRectsInLinearLayoutTestCase.kt
+++ b/ui/integration-tests/src/main/java/androidx/ui/integration/test/view/AndroidRectsInLinearLayoutTestCase.kt
@@ -27,9 +27,7 @@
/**
* Version of [CheckboxesInRowsTestCase] using Android views.
*/
-class AndroidRectsInLinearLayoutTestCase(
- private val numberOfRectangles: Int
-) : AndroidTestCase {
+class AndroidRectsInLinearLayoutTestCase(private val numberOfRectangles: Int) : AndroidTestCase {
private val rectangles = mutableListOf<View>()
var isBlue = true
diff --git a/ui/settings.gradle b/ui/settings.gradle
index e4344cd..d4d1bca 100644
--- a/ui/settings.gradle
+++ b/ui/settings.gradle
@@ -119,6 +119,7 @@
includeProject(":test-screenshot", "../test/screenshot")
includeProject(":compose:runtime:runtime-rxjava2", "ui-rxjava2")
includeProject(":compose:runtime:runtime-rxjava2:samples", "ui-rxjava2/samples")
+includeProject(":compose:test-utils", "../compose/test-utils")
includeProject(":compose:ui:ui-viewbinding", "ui-core-viewbinding")
includeProject(":compose:ui:ui-viewbinding:samples", "ui-core-viewbinding/samples")
diff --git a/ui/ui-core/build.gradle b/ui/ui-core/build.gradle
index 01d9998..415009e 100644
--- a/ui/ui-core/build.gradle
+++ b/ui/ui-core/build.gradle
@@ -90,6 +90,7 @@
}
implementation(ROBOLECTRIC)
implementation project(":ui:ui-test")
+ implementation project(":compose:test-utils")
}
androidAndroidTest.dependencies {
@@ -107,6 +108,7 @@
exclude group: 'org.mockito' // to keep control on the mockito version
}
implementation project(":ui:ui-test")
+ implementation project(":compose:test-utils")
implementation project(":compose:ui:ui-test-font")
implementation project(":compose:foundation:foundation-layout")
implementation project(":compose:foundation:foundation")
@@ -161,4 +163,4 @@
configuration.setExtendsFrom(configuration.extendsFrom - erroneousExtendsFrom)
}
}
-}
\ No newline at end of file
+}
diff --git a/ui/ui-core/src/androidAndroidTest/kotlin/androidx/compose/ui/autofill/AndroidAutoFillTest.kt b/ui/ui-core/src/androidAndroidTest/kotlin/androidx/compose/ui/autofill/AndroidAutoFillTest.kt
index 1d85abb..59b4796 100644
--- a/ui/ui-core/src/androidAndroidTest/kotlin/androidx/compose/ui/autofill/AndroidAutoFillTest.kt
+++ b/ui/ui-core/src/androidAndroidTest/kotlin/androidx/compose/ui/autofill/AndroidAutoFillTest.kt
@@ -27,7 +27,7 @@
import androidx.compose.ui.platform.AutofillAmbient
import androidx.compose.ui.platform.AutofillTreeAmbient
import androidx.compose.ui.platform.ViewAmbient
-import androidx.ui.test.android.fake.FakeViewStructure
+import androidx.ui.test.fake.FakeViewStructure
import androidx.ui.test.createComposeRule
import com.google.common.truth.Truth.assertThat
import org.junit.Before
diff --git a/ui/ui-core/src/test/kotlin/androidx/compose/ui/autofill/AndroidPopulateViewStructureTest.kt b/ui/ui-core/src/test/kotlin/androidx/compose/ui/autofill/AndroidPopulateViewStructureTest.kt
index fe8db17..a8120dd 100644
--- a/ui/ui-core/src/test/kotlin/androidx/compose/ui/autofill/AndroidPopulateViewStructureTest.kt
+++ b/ui/ui-core/src/test/kotlin/androidx/compose/ui/autofill/AndroidPopulateViewStructureTest.kt
@@ -23,7 +23,7 @@
import androidx.test.filters.SmallTest
import androidx.compose.ui.test.ComposeUiRobolectricTestRunner
import androidx.compose.ui.geometry.Rect
-import androidx.ui.test.android.fake.FakeViewStructure
+import androidx.ui.test.fake.FakeViewStructure
import com.google.common.truth.Truth.assertThat
import org.junit.Before
import org.junit.Test
diff --git a/ui/ui-test/api/current.txt b/ui/ui-test/api/current.txt
index 6c605f7..03bc395 100644
--- a/ui/ui-test/api/current.txt
+++ b/ui/ui-test/api/current.txt
@@ -94,61 +94,7 @@
method public static androidx.compose.ui.unit.Bounds getUnclippedBoundsInRoot(androidx.ui.test.SemanticsNodeInteraction);
}
- public interface ComposeBenchmarkScope<T> extends androidx.ui.test.ComposeExecutionControl {
- method public void createTestCase();
- method public void disposeContent();
- method public void draw();
- method public void drawFinish();
- method public void drawPrepare();
- method public void emitContent();
- method public T! getTestCase();
- method public void invalidateViews();
- method public void measureWithSpec(int widthSpec, int heightSpec);
- method public void requestLayout();
- }
-
- public final class ComposeBenchmarkScopeKt {
- method public static <T> void setupContent(androidx.ui.test.ComposeBenchmarkScope<T>);
- }
-
- public interface ComposeExecutionControl {
- method public void capturePreviewPictureToActivity();
- method public void doFrame();
- method public void drawToBitmap();
- method public boolean getDidLastRecomposeHaveChanges();
- method public int getMeasuredHeight();
- method public int getMeasuredWidth();
- method public boolean hasPendingChanges();
- method public kotlinx.coroutines.Job launchRecomposeIn(kotlinx.coroutines.CoroutineScope coroutineScope);
- method public void layout();
- method public void measure();
- method public void recompose();
- property public abstract boolean didLastRecomposeHaveChanges;
- property public abstract int measuredHeight;
- property public abstract int measuredWidth;
- }
-
- public final class ComposeExecutionControlKt {
- method public static void assertHasPendingChanges(androidx.ui.test.ComposeExecutionControl);
- method public static void assertLastRecomposeHadChanges(androidx.ui.test.ComposeExecutionControl);
- method public static void assertLastRecomposeHadNoChanges(androidx.ui.test.ComposeExecutionControl);
- method public static void assertMeasureSizeIsPositive(androidx.ui.test.ComposeExecutionControl);
- method public static void assertNoPendingChanges(androidx.ui.test.ComposeExecutionControl);
- method public static void doFramesAssertAllHadChangesExceptLastOne(androidx.ui.test.ComposeExecutionControl, int numberOfFramesToBeStable);
- method public static int doFramesUntilNoChangesPending(androidx.ui.test.ComposeExecutionControl, int maxAmountOfFrames = 10);
- method public static void recomposeAssertHadChanges(androidx.ui.test.ComposeExecutionControl);
- }
-
- public interface ComposeTestCase {
- method @androidx.compose.runtime.Composable public void emitContent();
- }
-
- public interface ComposeTestCaseSetup {
- method public void performTestWithEventsControl(kotlin.jvm.functions.Function1<? super androidx.ui.test.ComposeExecutionControl,kotlin.Unit> block);
- }
-
public interface ComposeTestRule extends org.junit.rules.TestRule {
- method @androidx.ui.test.ExperimentalTesting public androidx.ui.test.ComposeTestCaseSetup forGivenTestCase(androidx.ui.test.ComposeTestCase testCase);
method public androidx.ui.test.AnimationClockTestRule getClockTestRule();
method public androidx.compose.ui.unit.Density getDensity();
method public android.util.DisplayMetrics getDisplayMetrics();
@@ -308,12 +254,6 @@
method public static boolean performKeyPress(androidx.ui.test.SemanticsNodeInteraction, androidx.compose.ui.input.key.KeyEvent keyEvent);
}
- public interface LayeredComposeTestCase extends androidx.ui.test.ComposeTestCase {
- method @androidx.compose.runtime.Composable public default void emitContent();
- method @androidx.compose.runtime.Composable public void emitContentWrappers(kotlin.jvm.functions.Function0<kotlin.Unit> content);
- method @androidx.compose.runtime.Composable public void emitMeasuredContent();
- }
-
public final class OutputKt {
method public static void printToLog(androidx.ui.test.SemanticsNodeInteraction, String tag, @IntRange(from=0) int maxDepth = 2147483647);
method public static void printToLog(androidx.ui.test.SemanticsNodeInteractionCollection, String tag, @IntRange(from=0) int maxDepth = 0);
@@ -420,19 +360,9 @@
package androidx.ui.test.android {
- public final class AndroidComposeTestCaseRunnerKt {
- method public static <T extends androidx.ui.test.ComposeTestCase> androidx.ui.test.ComposeBenchmarkScope<T> createAndroidComposeBenchmarkRunner(kotlin.jvm.functions.Function0<? extends T> testCaseFactory, androidx.activity.ComponentActivity activity);
- }
-
- public final class AndroidComposeTestCaseSetup implements androidx.ui.test.ComposeTestCaseSetup {
- ctor public AndroidComposeTestCaseSetup(androidx.ui.test.ComposeTestCase testCase, androidx.activity.ComponentActivity activity);
- method public void performTestWithEventsControl(kotlin.jvm.functions.Function1<? super androidx.ui.test.ComposeExecutionControl,kotlin.Unit> block);
- }
-
public final class AndroidComposeTestRule<T extends androidx.activity.ComponentActivity> implements androidx.ui.test.ComposeTestRule {
ctor public AndroidComposeTestRule(androidx.test.ext.junit.rules.ActivityScenarioRule<T> activityRule, boolean disableTransitions, boolean disableBlinkingCursor);
method public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description? description);
- method @androidx.ui.test.ExperimentalTesting public androidx.ui.test.ComposeTestCaseSetup forGivenTestCase(androidx.ui.test.ComposeTestCase testCase);
method public androidx.test.ext.junit.rules.ActivityScenarioRule<T> getActivityRule();
method public androidx.ui.test.AnimationClockTestRule getClockTestRule();
method public androidx.compose.ui.unit.Density getDensity();
@@ -470,10 +400,3 @@
}
-package androidx.ui.test.android.fake {
-
- public final class FakeViewStructureKt {
- }
-
-}
-
diff --git a/ui/ui-test/api/public_plus_experimental_current.txt b/ui/ui-test/api/public_plus_experimental_current.txt
index 6c605f7..03bc395 100644
--- a/ui/ui-test/api/public_plus_experimental_current.txt
+++ b/ui/ui-test/api/public_plus_experimental_current.txt
@@ -94,61 +94,7 @@
method public static androidx.compose.ui.unit.Bounds getUnclippedBoundsInRoot(androidx.ui.test.SemanticsNodeInteraction);
}
- public interface ComposeBenchmarkScope<T> extends androidx.ui.test.ComposeExecutionControl {
- method public void createTestCase();
- method public void disposeContent();
- method public void draw();
- method public void drawFinish();
- method public void drawPrepare();
- method public void emitContent();
- method public T! getTestCase();
- method public void invalidateViews();
- method public void measureWithSpec(int widthSpec, int heightSpec);
- method public void requestLayout();
- }
-
- public final class ComposeBenchmarkScopeKt {
- method public static <T> void setupContent(androidx.ui.test.ComposeBenchmarkScope<T>);
- }
-
- public interface ComposeExecutionControl {
- method public void capturePreviewPictureToActivity();
- method public void doFrame();
- method public void drawToBitmap();
- method public boolean getDidLastRecomposeHaveChanges();
- method public int getMeasuredHeight();
- method public int getMeasuredWidth();
- method public boolean hasPendingChanges();
- method public kotlinx.coroutines.Job launchRecomposeIn(kotlinx.coroutines.CoroutineScope coroutineScope);
- method public void layout();
- method public void measure();
- method public void recompose();
- property public abstract boolean didLastRecomposeHaveChanges;
- property public abstract int measuredHeight;
- property public abstract int measuredWidth;
- }
-
- public final class ComposeExecutionControlKt {
- method public static void assertHasPendingChanges(androidx.ui.test.ComposeExecutionControl);
- method public static void assertLastRecomposeHadChanges(androidx.ui.test.ComposeExecutionControl);
- method public static void assertLastRecomposeHadNoChanges(androidx.ui.test.ComposeExecutionControl);
- method public static void assertMeasureSizeIsPositive(androidx.ui.test.ComposeExecutionControl);
- method public static void assertNoPendingChanges(androidx.ui.test.ComposeExecutionControl);
- method public static void doFramesAssertAllHadChangesExceptLastOne(androidx.ui.test.ComposeExecutionControl, int numberOfFramesToBeStable);
- method public static int doFramesUntilNoChangesPending(androidx.ui.test.ComposeExecutionControl, int maxAmountOfFrames = 10);
- method public static void recomposeAssertHadChanges(androidx.ui.test.ComposeExecutionControl);
- }
-
- public interface ComposeTestCase {
- method @androidx.compose.runtime.Composable public void emitContent();
- }
-
- public interface ComposeTestCaseSetup {
- method public void performTestWithEventsControl(kotlin.jvm.functions.Function1<? super androidx.ui.test.ComposeExecutionControl,kotlin.Unit> block);
- }
-
public interface ComposeTestRule extends org.junit.rules.TestRule {
- method @androidx.ui.test.ExperimentalTesting public androidx.ui.test.ComposeTestCaseSetup forGivenTestCase(androidx.ui.test.ComposeTestCase testCase);
method public androidx.ui.test.AnimationClockTestRule getClockTestRule();
method public androidx.compose.ui.unit.Density getDensity();
method public android.util.DisplayMetrics getDisplayMetrics();
@@ -308,12 +254,6 @@
method public static boolean performKeyPress(androidx.ui.test.SemanticsNodeInteraction, androidx.compose.ui.input.key.KeyEvent keyEvent);
}
- public interface LayeredComposeTestCase extends androidx.ui.test.ComposeTestCase {
- method @androidx.compose.runtime.Composable public default void emitContent();
- method @androidx.compose.runtime.Composable public void emitContentWrappers(kotlin.jvm.functions.Function0<kotlin.Unit> content);
- method @androidx.compose.runtime.Composable public void emitMeasuredContent();
- }
-
public final class OutputKt {
method public static void printToLog(androidx.ui.test.SemanticsNodeInteraction, String tag, @IntRange(from=0) int maxDepth = 2147483647);
method public static void printToLog(androidx.ui.test.SemanticsNodeInteractionCollection, String tag, @IntRange(from=0) int maxDepth = 0);
@@ -420,19 +360,9 @@
package androidx.ui.test.android {
- public final class AndroidComposeTestCaseRunnerKt {
- method public static <T extends androidx.ui.test.ComposeTestCase> androidx.ui.test.ComposeBenchmarkScope<T> createAndroidComposeBenchmarkRunner(kotlin.jvm.functions.Function0<? extends T> testCaseFactory, androidx.activity.ComponentActivity activity);
- }
-
- public final class AndroidComposeTestCaseSetup implements androidx.ui.test.ComposeTestCaseSetup {
- ctor public AndroidComposeTestCaseSetup(androidx.ui.test.ComposeTestCase testCase, androidx.activity.ComponentActivity activity);
- method public void performTestWithEventsControl(kotlin.jvm.functions.Function1<? super androidx.ui.test.ComposeExecutionControl,kotlin.Unit> block);
- }
-
public final class AndroidComposeTestRule<T extends androidx.activity.ComponentActivity> implements androidx.ui.test.ComposeTestRule {
ctor public AndroidComposeTestRule(androidx.test.ext.junit.rules.ActivityScenarioRule<T> activityRule, boolean disableTransitions, boolean disableBlinkingCursor);
method public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description? description);
- method @androidx.ui.test.ExperimentalTesting public androidx.ui.test.ComposeTestCaseSetup forGivenTestCase(androidx.ui.test.ComposeTestCase testCase);
method public androidx.test.ext.junit.rules.ActivityScenarioRule<T> getActivityRule();
method public androidx.ui.test.AnimationClockTestRule getClockTestRule();
method public androidx.compose.ui.unit.Density getDensity();
@@ -470,10 +400,3 @@
}
-package androidx.ui.test.android.fake {
-
- public final class FakeViewStructureKt {
- }
-
-}
-
diff --git a/ui/ui-test/api/restricted_current.txt b/ui/ui-test/api/restricted_current.txt
index 6c605f7..03bc395 100644
--- a/ui/ui-test/api/restricted_current.txt
+++ b/ui/ui-test/api/restricted_current.txt
@@ -94,61 +94,7 @@
method public static androidx.compose.ui.unit.Bounds getUnclippedBoundsInRoot(androidx.ui.test.SemanticsNodeInteraction);
}
- public interface ComposeBenchmarkScope<T> extends androidx.ui.test.ComposeExecutionControl {
- method public void createTestCase();
- method public void disposeContent();
- method public void draw();
- method public void drawFinish();
- method public void drawPrepare();
- method public void emitContent();
- method public T! getTestCase();
- method public void invalidateViews();
- method public void measureWithSpec(int widthSpec, int heightSpec);
- method public void requestLayout();
- }
-
- public final class ComposeBenchmarkScopeKt {
- method public static <T> void setupContent(androidx.ui.test.ComposeBenchmarkScope<T>);
- }
-
- public interface ComposeExecutionControl {
- method public void capturePreviewPictureToActivity();
- method public void doFrame();
- method public void drawToBitmap();
- method public boolean getDidLastRecomposeHaveChanges();
- method public int getMeasuredHeight();
- method public int getMeasuredWidth();
- method public boolean hasPendingChanges();
- method public kotlinx.coroutines.Job launchRecomposeIn(kotlinx.coroutines.CoroutineScope coroutineScope);
- method public void layout();
- method public void measure();
- method public void recompose();
- property public abstract boolean didLastRecomposeHaveChanges;
- property public abstract int measuredHeight;
- property public abstract int measuredWidth;
- }
-
- public final class ComposeExecutionControlKt {
- method public static void assertHasPendingChanges(androidx.ui.test.ComposeExecutionControl);
- method public static void assertLastRecomposeHadChanges(androidx.ui.test.ComposeExecutionControl);
- method public static void assertLastRecomposeHadNoChanges(androidx.ui.test.ComposeExecutionControl);
- method public static void assertMeasureSizeIsPositive(androidx.ui.test.ComposeExecutionControl);
- method public static void assertNoPendingChanges(androidx.ui.test.ComposeExecutionControl);
- method public static void doFramesAssertAllHadChangesExceptLastOne(androidx.ui.test.ComposeExecutionControl, int numberOfFramesToBeStable);
- method public static int doFramesUntilNoChangesPending(androidx.ui.test.ComposeExecutionControl, int maxAmountOfFrames = 10);
- method public static void recomposeAssertHadChanges(androidx.ui.test.ComposeExecutionControl);
- }
-
- public interface ComposeTestCase {
- method @androidx.compose.runtime.Composable public void emitContent();
- }
-
- public interface ComposeTestCaseSetup {
- method public void performTestWithEventsControl(kotlin.jvm.functions.Function1<? super androidx.ui.test.ComposeExecutionControl,kotlin.Unit> block);
- }
-
public interface ComposeTestRule extends org.junit.rules.TestRule {
- method @androidx.ui.test.ExperimentalTesting public androidx.ui.test.ComposeTestCaseSetup forGivenTestCase(androidx.ui.test.ComposeTestCase testCase);
method public androidx.ui.test.AnimationClockTestRule getClockTestRule();
method public androidx.compose.ui.unit.Density getDensity();
method public android.util.DisplayMetrics getDisplayMetrics();
@@ -308,12 +254,6 @@
method public static boolean performKeyPress(androidx.ui.test.SemanticsNodeInteraction, androidx.compose.ui.input.key.KeyEvent keyEvent);
}
- public interface LayeredComposeTestCase extends androidx.ui.test.ComposeTestCase {
- method @androidx.compose.runtime.Composable public default void emitContent();
- method @androidx.compose.runtime.Composable public void emitContentWrappers(kotlin.jvm.functions.Function0<kotlin.Unit> content);
- method @androidx.compose.runtime.Composable public void emitMeasuredContent();
- }
-
public final class OutputKt {
method public static void printToLog(androidx.ui.test.SemanticsNodeInteraction, String tag, @IntRange(from=0) int maxDepth = 2147483647);
method public static void printToLog(androidx.ui.test.SemanticsNodeInteractionCollection, String tag, @IntRange(from=0) int maxDepth = 0);
@@ -420,19 +360,9 @@
package androidx.ui.test.android {
- public final class AndroidComposeTestCaseRunnerKt {
- method public static <T extends androidx.ui.test.ComposeTestCase> androidx.ui.test.ComposeBenchmarkScope<T> createAndroidComposeBenchmarkRunner(kotlin.jvm.functions.Function0<? extends T> testCaseFactory, androidx.activity.ComponentActivity activity);
- }
-
- public final class AndroidComposeTestCaseSetup implements androidx.ui.test.ComposeTestCaseSetup {
- ctor public AndroidComposeTestCaseSetup(androidx.ui.test.ComposeTestCase testCase, androidx.activity.ComponentActivity activity);
- method public void performTestWithEventsControl(kotlin.jvm.functions.Function1<? super androidx.ui.test.ComposeExecutionControl,kotlin.Unit> block);
- }
-
public final class AndroidComposeTestRule<T extends androidx.activity.ComponentActivity> implements androidx.ui.test.ComposeTestRule {
ctor public AndroidComposeTestRule(androidx.test.ext.junit.rules.ActivityScenarioRule<T> activityRule, boolean disableTransitions, boolean disableBlinkingCursor);
method public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description? description);
- method @androidx.ui.test.ExperimentalTesting public androidx.ui.test.ComposeTestCaseSetup forGivenTestCase(androidx.ui.test.ComposeTestCase testCase);
method public androidx.test.ext.junit.rules.ActivityScenarioRule<T> getActivityRule();
method public androidx.ui.test.AnimationClockTestRule getClockTestRule();
method public androidx.compose.ui.unit.Density getDensity();
@@ -470,10 +400,3 @@
}
-package androidx.ui.test.android.fake {
-
- public final class FakeViewStructureKt {
- }
-
-}
-
diff --git a/ui/ui-test/src/androidMain/kotlin/androidx/ui/test/ComposeTestRule.kt b/ui/ui-test/src/androidMain/kotlin/androidx/ui/test/ComposeTestRule.kt
index 4d607ab..03b81d9 100644
--- a/ui/ui-test/src/androidMain/kotlin/androidx/ui/test/ComposeTestRule.kt
+++ b/ui/ui-test/src/androidMain/kotlin/androidx/ui/test/ComposeTestRule.kt
@@ -52,31 +52,11 @@
*/
fun setContent(composable: @Composable () -> Unit)
- /**
- * Takes the given test case and prepares it for execution-controlled test via
- * [ComposeTestCaseSetup].
- */
- @ExperimentalTesting
- fun forGivenTestCase(testCase: ComposeTestCase): ComposeTestCaseSetup
-
// TODO(pavlis): Provide better abstraction for host side reusability
val displayMetrics: DisplayMetrics get
}
/**
- * Helper interface to run execution-controlled test via [ComposeTestRule].
- */
-interface ComposeTestCaseSetup {
- /**
- * Takes the content provided via [ComposeTestRule#setContent] and runs the given test
- * instruction. The test is executed on the main thread and prevents interference from Activity
- * so the frames can be controlled manually. See [ComposeExecutionControl] for available
- * methods.
- */
- fun performTestWithEventsControl(block: ComposeExecutionControl.() -> Unit)
-}
-
-/**
* Factory method to provide implementation of [ComposeTestRule].
*
* This method is useful for tests in compose libraries where no custom Activity is usually
diff --git a/ui/ui-test/src/androidMain/kotlin/androidx/ui/test/android/AndroidComposeTestRule.kt b/ui/ui-test/src/androidMain/kotlin/androidx/ui/test/android/AndroidComposeTestRule.kt
index 3b8257d..8c76b42 100644
--- a/ui/ui-test/src/androidMain/kotlin/androidx/ui/test/android/AndroidComposeTestRule.kt
+++ b/ui/ui-test/src/androidMain/kotlin/androidx/ui/test/android/AndroidComposeTestRule.kt
@@ -27,10 +27,7 @@
import androidx.compose.foundation.blinkingCursorEnabled
import androidx.compose.ui.text.input.textInputServiceFactory
import androidx.ui.test.AnimationClockTestRule
-import androidx.ui.test.ComposeTestCase
-import androidx.ui.test.ComposeTestCaseSetup
import androidx.ui.test.ComposeTestRule
-import androidx.ui.test.ExperimentalTesting
import androidx.ui.test.TextInputServiceForTests
import androidx.ui.test.createComposeRule
import androidx.ui.test.isOnUiThread
@@ -172,14 +169,6 @@
}
}
- @ExperimentalTesting
- override fun forGivenTestCase(testCase: ComposeTestCase): ComposeTestCaseSetup {
- return AndroidComposeTestCaseSetup(
- testCase,
- getActivity()
- )
- }
-
inner class AndroidComposeStatement(
private val base: Statement
) : Statement() {