From 2499690d9dca26f4026f0d0e89c58c8fb38b974b Mon Sep 17 00:00:00 2001 From: Rick Busarow Date: Mon, 19 Sep 2022 14:41:48 -0500 Subject: [PATCH 1/3] update compose runtime to 1.2.1, bump Android compileSdk to 32, targetSdk to 31 A compile version of 32+ is required in order to use the latest compose libraries. Internally, Square is currently using compileSdk 32 and targetSdk of 31. --- .../src/main/java/android-defaults.gradle.kts | 8 ++-- gradle/libs.versions.toml | 8 ++-- .../compose/launcher/SampleLauncherApp.kt | 8 ++-- .../dependencies/releaseRuntimeClasspath.txt | 38 ++++++++++--------- .../dependencies/releaseRuntimeClasspath.txt | 31 ++++++++------- 5 files changed, 52 insertions(+), 41 deletions(-) diff --git a/buildSrc/src/main/java/android-defaults.gradle.kts b/buildSrc/src/main/java/android-defaults.gradle.kts index 33cc37a08..aec33b29f 100644 --- a/buildSrc/src/main/java/android-defaults.gradle.kts +++ b/buildSrc/src/main/java/android-defaults.gradle.kts @@ -1,7 +1,9 @@ import com.android.build.gradle.TestedExtension +import com.squareup.workflow1.libsCatalog +import com.squareup.workflow1.version configure { - compileSdkVersion(31) + compileSdkVersion(libsCatalog.version("compileSdk").toInt()) compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 @@ -9,8 +11,8 @@ configure { } defaultConfig { - minSdk = 21 - targetSdk = 30 + minSdk = libsCatalog.version("minSdk").toInt() + targetSdk = libsCatalog.version("targetSdk").toInt() versionCode = 1 versionName = "1.0" } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 10e4c73e2..a11a27551 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,15 +2,15 @@ androidTools = "7.4.1" -compileSdk = "31" -minSdkVersion = "21" -targetSdk = "30" +compileSdk = "32" +minSdk = "21" +targetSdk = "31" androidx-activity = "1.3.0" androidx-appcompat = "1.3.1" androidx-benchmark = "1.1.0-rc03" androidx-cardview = "1.0.0" -androidx-compose = "1.1.0-rc01" +androidx-compose = "1.2.1" androidx-compose-compiler = "1.3.2" androidx-constraintlayout = "2.1.2" androidx-core = "1.6.0" diff --git a/samples/compose-samples/src/main/java/com/squareup/sample/compose/launcher/SampleLauncherApp.kt b/samples/compose-samples/src/main/java/com/squareup/sample/compose/launcher/SampleLauncherApp.kt index f7e719cdc..515972251 100644 --- a/samples/compose-samples/src/main/java/com/squareup/sample/compose/launcher/SampleLauncherApp.kt +++ b/samples/compose-samples/src/main/java/com/squareup/sample/compose/launcher/SampleLauncherApp.kt @@ -8,6 +8,7 @@ import androidx.compose.foundation.gestures.forEachGesture import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.aspectRatio import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.requiredHeight import androidx.compose.foundation.layout.requiredWidth import androidx.compose.foundation.lazy.LazyColumn @@ -27,7 +28,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.geometry.Rect import androidx.compose.ui.graphics.graphicsLayer import androidx.compose.ui.input.pointer.PointerEventPass.Initial -import androidx.compose.ui.input.pointer.consumeDownChange import androidx.compose.ui.input.pointer.pointerInput import androidx.compose.ui.layout.LayoutCoordinates import androidx.compose.ui.layout.boundsInRoot @@ -50,8 +50,8 @@ import com.squareup.sample.compose.R Text(stringResource(R.string.app_name)) }) } - ) { - LazyColumn { + ) { padding -> + LazyColumn(Modifier.padding(padding)) { items(samples) { SampleItem(it) } @@ -152,7 +152,7 @@ private fun Modifier.disableTouchInput(): Modifier = pointerInput(Unit) { awaitPointerEventScope { awaitPointerEvent(Initial).let { event -> event.changes.forEach { change -> - change.consumeDownChange() + change.consume() } } } diff --git a/workflow-ui/compose-tooling/dependencies/releaseRuntimeClasspath.txt b/workflow-ui/compose-tooling/dependencies/releaseRuntimeClasspath.txt index 4b28918d4..59e94583e 100644 --- a/workflow-ui/compose-tooling/dependencies/releaseRuntimeClasspath.txt +++ b/workflow-ui/compose-tooling/dependencies/releaseRuntimeClasspath.txt @@ -10,21 +10,23 @@ androidx.arch.core:core-common:2.1.0 androidx.arch.core:core-runtime:2.1.0 androidx.autofill:autofill:1.0.0 androidx.collection:collection:1.1.0 -androidx.compose.animation:animation-core:1.1.0-rc01 -androidx.compose.animation:animation:1.1.0-rc01 -androidx.compose.foundation:foundation-layout:1.1.0-rc01 -androidx.compose.foundation:foundation:1.1.0-rc01 -androidx.compose.runtime:runtime-saveable:1.1.0-rc01 -androidx.compose.runtime:runtime:1.1.0-rc01 -androidx.compose.ui:ui-geometry:1.1.0-rc01 -androidx.compose.ui:ui-graphics:1.1.0-rc01 -androidx.compose.ui:ui-text:1.1.0-rc01 -androidx.compose.ui:ui-tooling-preview:1.1.0-rc01 -androidx.compose.ui:ui-unit:1.1.0-rc01 -androidx.compose.ui:ui-util:1.1.0-rc01 -androidx.compose.ui:ui:1.1.0-rc01 +androidx.compose.animation:animation-core:1.1.1 +androidx.compose.animation:animation:1.1.1 +androidx.compose.foundation:foundation-layout:1.2.1 +androidx.compose.foundation:foundation:1.2.1 +androidx.compose.runtime:runtime-saveable:1.2.1 +androidx.compose.runtime:runtime:1.2.1 +androidx.compose.ui:ui-geometry:1.2.1 +androidx.compose.ui:ui-graphics:1.2.1 +androidx.compose.ui:ui-text:1.2.1 +androidx.compose.ui:ui-tooling-preview:1.2.1 +androidx.compose.ui:ui-unit:1.2.1 +androidx.compose.ui:ui-util:1.2.1 +androidx.compose.ui:ui:1.2.1 +androidx.concurrent:concurrent-futures:1.0.0 androidx.core:core-ktx:1.6.0 -androidx.core:core:1.6.0 +androidx.core:core:1.7.0 +androidx.customview:customview-poolingcontainer:1.0.0 androidx.lifecycle:lifecycle-common-java8:2.4.0 androidx.lifecycle:lifecycle-common:2.4.0 androidx.lifecycle:lifecycle-livedata-core:2.4.0 @@ -32,12 +34,14 @@ androidx.lifecycle:lifecycle-runtime-ktx:2.4.0 androidx.lifecycle:lifecycle-runtime:2.4.0 androidx.lifecycle:lifecycle-viewmodel-savedstate:2.4.0 androidx.lifecycle:lifecycle-viewmodel:2.4.0 -androidx.profileinstaller:profileinstaller:1.1.0-rc01 -androidx.savedstate:savedstate:1.1.0 -androidx.startup:startup-runtime:1.0.0 +androidx.profileinstaller:profileinstaller:1.2.0 +androidx.savedstate:savedstate-ktx:1.2.0 +androidx.savedstate:savedstate:1.2.0 +androidx.startup:startup-runtime:1.1.1 androidx.tracing:tracing:1.0.0 androidx.transition:transition:1.4.1 androidx.versionedparcelable:versionedparcelable:1.1.1 +com.google.guava:listenablefuture:1.0 com.squareup.okio:okio-jvm:3.0.0 com.squareup.okio:okio:3.0.0 org.jetbrains.kotlin:kotlin-bom:1.7.20 diff --git a/workflow-ui/compose/dependencies/releaseRuntimeClasspath.txt b/workflow-ui/compose/dependencies/releaseRuntimeClasspath.txt index 7b6d47835..13159a341 100644 --- a/workflow-ui/compose/dependencies/releaseRuntimeClasspath.txt +++ b/workflow-ui/compose/dependencies/releaseRuntimeClasspath.txt @@ -9,17 +9,20 @@ androidx.arch.core:core-common:2.1.0 androidx.arch.core:core-runtime:2.1.0 androidx.autofill:autofill:1.0.0 androidx.collection:collection:1.1.0 -androidx.compose.foundation:foundation-layout:1.1.0-rc01 -androidx.compose.runtime:runtime-saveable:1.1.0-rc01 -androidx.compose.runtime:runtime:1.1.0-rc01 -androidx.compose.ui:ui-geometry:1.1.0-rc01 -androidx.compose.ui:ui-graphics:1.1.0-rc01 -androidx.compose.ui:ui-text:1.1.0-rc01 -androidx.compose.ui:ui-unit:1.1.0-rc01 -androidx.compose.ui:ui-util:1.1.0-rc01 -androidx.compose.ui:ui:1.1.0-rc01 +androidx.compose.animation:animation-core:1.1.1 +androidx.compose.foundation:foundation-layout:1.2.1 +androidx.compose.runtime:runtime-saveable:1.2.1 +androidx.compose.runtime:runtime:1.2.1 +androidx.compose.ui:ui-geometry:1.2.1 +androidx.compose.ui:ui-graphics:1.2.1 +androidx.compose.ui:ui-text:1.2.1 +androidx.compose.ui:ui-unit:1.2.1 +androidx.compose.ui:ui-util:1.2.1 +androidx.compose.ui:ui:1.2.1 +androidx.concurrent:concurrent-futures:1.0.0 androidx.core:core-ktx:1.6.0 -androidx.core:core:1.6.0 +androidx.core:core:1.7.0 +androidx.customview:customview-poolingcontainer:1.0.0 androidx.lifecycle:lifecycle-common-java8:2.4.0 androidx.lifecycle:lifecycle-common:2.4.0 androidx.lifecycle:lifecycle-livedata-core:2.4.0 @@ -27,12 +30,14 @@ androidx.lifecycle:lifecycle-runtime-ktx:2.4.0 androidx.lifecycle:lifecycle-runtime:2.4.0 androidx.lifecycle:lifecycle-viewmodel-savedstate:2.4.0 androidx.lifecycle:lifecycle-viewmodel:2.4.0 -androidx.profileinstaller:profileinstaller:1.1.0-rc01 -androidx.savedstate:savedstate:1.1.0 -androidx.startup:startup-runtime:1.0.0 +androidx.profileinstaller:profileinstaller:1.2.0 +androidx.savedstate:savedstate-ktx:1.2.0 +androidx.savedstate:savedstate:1.2.0 +androidx.startup:startup-runtime:1.1.1 androidx.tracing:tracing:1.0.0 androidx.transition:transition:1.4.1 androidx.versionedparcelable:versionedparcelable:1.1.1 +com.google.guava:listenablefuture:1.0 com.squareup.okio:okio-jvm:3.0.0 com.squareup.okio:okio:3.0.0 org.jetbrains.kotlin:kotlin-bom:1.7.20 From ef8447a455c375e62f0966bbc575c0b29fd72ac7 Mon Sep 17 00:00:00 2001 From: Rick Busarow Date: Thu, 27 Oct 2022 19:20:44 -0500 Subject: [PATCH 2/3] bump androidx-test core to `1.4.0`, Robolectric to `4.7.3` --- gradle/libs.versions.toml | 4 ++-- samples/compose-samples/src/main/AndroidManifest.xml | 10 ++++++---- .../containers/app-poetry/src/main/AndroidManifest.xml | 8 +++++--- .../containers/app-raven/src/main/AndroidManifest.xml | 8 +++++--- .../hello-back-button/src/main/AndroidManifest.xml | 8 +++++--- samples/dungeon/app/src/main/AndroidManifest.xml | 1 + .../src/main/AndroidManifest.xml | 6 ++++-- samples/hello-workflow/src/main/AndroidManifest.xml | 8 +++++--- samples/stub-visibility/src/main/AndroidManifest.xml | 8 +++++--- samples/tictactoe/app/src/main/AndroidManifest.xml | 6 ++++-- samples/todo-android/app/src/main/AndroidManifest.xml | 6 ++++-- .../src/androidTest/AndroidManifest.xml | 5 ++++- .../core-android/src/androidTest/AndroidManifest.xml | 2 ++ 13 files changed, 52 insertions(+), 28 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a11a27551..f0755a19b 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -24,7 +24,7 @@ androidx-recyclerview = "1.2.1" androidx-room = "2.4.0-alpha04" androidx-savedstate = "1.1.0" androidx-startup = "1.1.0" -androidx-test = "1.3.0" +androidx-test = "1.4.0" androidx-test-espresso = "3.3.0" androidx-test-junit-ext = "1.1.3" androidx-test-truth-ext = "1.4.0" @@ -64,7 +64,7 @@ mockito-core = "3.3.3" mockito-kotlin = "3.2.0" mockk = "1.11.0" -robolectric = "4.6.1" +robolectric = "4.7.3" rxjava2-android = "2.1.1" rxjava2-core = "2.2.21" diff --git a/samples/compose-samples/src/main/AndroidManifest.xml b/samples/compose-samples/src/main/AndroidManifest.xml index 2d3dc35ba..00faf1073 100644 --- a/samples/compose-samples/src/main/AndroidManifest.xml +++ b/samples/compose-samples/src/main/AndroidManifest.xml @@ -9,20 +9,22 @@ tools:ignore="GoogleAppIndexingWarning,MissingApplicationIcon" > - + - + - - + + diff --git a/samples/containers/app-poetry/src/main/AndroidManifest.xml b/samples/containers/app-poetry/src/main/AndroidManifest.xml index 8b398d0b2..138fab474 100644 --- a/samples/containers/app-poetry/src/main/AndroidManifest.xml +++ b/samples/containers/app-poetry/src/main/AndroidManifest.xml @@ -9,11 +9,13 @@ tools:ignore="AllowBackup,GoogleAppIndexingWarning,MissingApplicationIcon" > - + - - + + diff --git a/samples/containers/app-raven/src/main/AndroidManifest.xml b/samples/containers/app-raven/src/main/AndroidManifest.xml index e5f581d7c..59eaaa882 100644 --- a/samples/containers/app-raven/src/main/AndroidManifest.xml +++ b/samples/containers/app-raven/src/main/AndroidManifest.xml @@ -9,11 +9,13 @@ tools:ignore="AllowBackup,GoogleAppIndexingWarning,MissingApplicationIcon" > - + - - + + diff --git a/samples/containers/hello-back-button/src/main/AndroidManifest.xml b/samples/containers/hello-back-button/src/main/AndroidManifest.xml index 4789f9e25..a9f98ccdf 100644 --- a/samples/containers/hello-back-button/src/main/AndroidManifest.xml +++ b/samples/containers/hello-back-button/src/main/AndroidManifest.xml @@ -9,11 +9,13 @@ tools:ignore="GoogleAppIndexingWarning,MissingApplicationIcon" > - + - - + + diff --git a/samples/dungeon/app/src/main/AndroidManifest.xml b/samples/dungeon/app/src/main/AndroidManifest.xml index a8cc3bb22..42c6bec3c 100644 --- a/samples/dungeon/app/src/main/AndroidManifest.xml +++ b/samples/dungeon/app/src/main/AndroidManifest.xml @@ -12,6 +12,7 @@ diff --git a/samples/hello-workflow-fragment/src/main/AndroidManifest.xml b/samples/hello-workflow-fragment/src/main/AndroidManifest.xml index 38b8dc545..6b1ca5d84 100644 --- a/samples/hello-workflow-fragment/src/main/AndroidManifest.xml +++ b/samples/hello-workflow-fragment/src/main/AndroidManifest.xml @@ -3,12 +3,14 @@ xmlns:android="http://schemas.android.com/apk/res/android"> - + diff --git a/samples/hello-workflow/src/main/AndroidManifest.xml b/samples/hello-workflow/src/main/AndroidManifest.xml index e3614bb15..6fda67906 100644 --- a/samples/hello-workflow/src/main/AndroidManifest.xml +++ b/samples/hello-workflow/src/main/AndroidManifest.xml @@ -9,11 +9,13 @@ tools:ignore="GoogleAppIndexingWarning,MissingApplicationIcon" > - + - - + + diff --git a/samples/stub-visibility/src/main/AndroidManifest.xml b/samples/stub-visibility/src/main/AndroidManifest.xml index ab0c63d5e..d63e5bb1c 100644 --- a/samples/stub-visibility/src/main/AndroidManifest.xml +++ b/samples/stub-visibility/src/main/AndroidManifest.xml @@ -9,11 +9,13 @@ tools:ignore="GoogleAppIndexingWarning,MissingApplicationIcon" > - + - - + + diff --git a/samples/tictactoe/app/src/main/AndroidManifest.xml b/samples/tictactoe/app/src/main/AndroidManifest.xml index 24d6db423..1b2cd61e1 100644 --- a/samples/tictactoe/app/src/main/AndroidManifest.xml +++ b/samples/tictactoe/app/src/main/AndroidManifest.xml @@ -3,12 +3,14 @@ xmlns:android="http://schemas.android.com/apk/res/android"> - + diff --git a/samples/todo-android/app/src/main/AndroidManifest.xml b/samples/todo-android/app/src/main/AndroidManifest.xml index 73f695f62..cdc99877f 100644 --- a/samples/todo-android/app/src/main/AndroidManifest.xml +++ b/samples/todo-android/app/src/main/AndroidManifest.xml @@ -3,12 +3,14 @@ xmlns:android="http://schemas.android.com/apk/res/android"> - + diff --git a/workflow-ui/container-android/src/androidTest/AndroidManifest.xml b/workflow-ui/container-android/src/androidTest/AndroidManifest.xml index 65f648973..6612a8c9d 100644 --- a/workflow-ui/container-android/src/androidTest/AndroidManifest.xml +++ b/workflow-ui/container-android/src/androidTest/AndroidManifest.xml @@ -1,9 +1,12 @@ - + diff --git a/workflow-ui/core-android/src/androidTest/AndroidManifest.xml b/workflow-ui/core-android/src/androidTest/AndroidManifest.xml index 67a3ee4a2..28af391c5 100644 --- a/workflow-ui/core-android/src/androidTest/AndroidManifest.xml +++ b/workflow-ui/core-android/src/androidTest/AndroidManifest.xml @@ -3,9 +3,11 @@ From 2e317dd866feb80be3ccf4a53126ec955ebf1511 Mon Sep 17 00:00:00 2001 From: Rick Busarow Date: Tue, 20 Dec 2022 16:08:13 -0600 Subject: [PATCH 3/3] update LeakCanary to `2.10` --- .../src/main/java/android-ui-tests.gradle.kts | 1 - gradle/libs.versions.toml | 2 +- .../compose/hellocompose/HelloComposeTest.kt | 2 +- .../hellocomposebinding/HelloBindingTest.kt | 2 +- .../HelloComposeWorkflowTest.kt | 2 +- .../inlinerendering/InlineRenderingTest.kt | 2 +- .../compose/launcher/SampleLauncherTest.kt | 2 +- .../nestedrenderings/NestedRenderingsTest.kt | 2 +- .../sample/compose/preview/PreviewTest.kt | 2 +- .../sample/compose/textinput/TextInputTest.kt | 2 +- .../sample/poetryapp/PoetryAppTest.kt | 2 +- .../squareup/sample/ravenapp/RavenAppTest.kt | 2 +- .../HelloBackButtonEspressoTest.kt | 2 +- .../squareup/sample/dungeon/DungeonAppTest.kt | 2 +- .../HelloWorkflowFragmentAppTest.kt | 2 +- .../helloworkflow/HelloWorkflowAppTest.kt | 2 +- .../stubvisibility/StubVisibilityAppTest.kt | 2 +- .../squareup/sample/TicTacToeEspressoTest.kt | 2 +- .../sample/mainactivity/TodoAppTest.kt | 2 +- .../tooling/LegacyPreviewViewFactoryTest.kt | 2 +- .../compose/tooling/PreviewViewFactoryTest.kt | 2 +- .../ui/compose/ComposeViewFactoryTest.kt | 2 +- .../compose/ComposeViewTreeIntegrationTest.kt | 2 +- .../ui/compose/CompositionRootTest.kt | 2 +- .../compose/LegacyComposeViewFactoryTest.kt | 2 +- .../LegacyComposeViewTreeIntegrationTest.kt | 4 +- .../ui/compose/LegacyWorkflowRenderingTest.kt | 6 +-- .../workflow1/ui/compose/RenderAsStateTest.kt | 2 +- .../ui/compose/WorkflowRenderingTest.kt | 6 +-- .../test/ModalViewContainerLifecycleTest.kt | 2 +- .../workflow1/ui/BackPressedHandlerTest.kt | 2 +- .../ui/WorkflowViewStubLifecycleTest.kt | 2 +- ...kStackContainerPersistenceLifecycleTest.kt | 2 +- .../api/internal-testing-android.api | 7 ---- .../test/DetectLeaksAfterTestSuccess.kt | 39 ------------------- 35 files changed, 37 insertions(+), 84 deletions(-) delete mode 100644 workflow-ui/internal-testing-android/src/main/java/com/squareup/workflow1/ui/internal/test/DetectLeaksAfterTestSuccess.kt diff --git a/buildSrc/src/main/java/android-ui-tests.gradle.kts b/buildSrc/src/main/java/android-ui-tests.gradle.kts index 5e9a5e37c..542a33f26 100644 --- a/buildSrc/src/main/java/android-ui-tests.gradle.kts +++ b/buildSrc/src/main/java/android-ui-tests.gradle.kts @@ -9,7 +9,6 @@ plugins { configure { defaultConfig { testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" - testInstrumentationRunnerArguments["listener"] = "leakcanary.FailTestOnLeakRunListener" } testOptions { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f0755a19b..89868f5a0 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -71,7 +71,7 @@ rxjava2-core = "2.2.21" squareup-curtains = "1.2.2" squareup-cycler = "0.1.9" -squareup-leakcanary = "2.8.1" +squareup-leakcanary = "2.10" squareup-moshi = "1.13.0" squareup-okhttp = "4.9.1" squareup-okio = "3.0.0" diff --git a/samples/compose-samples/src/androidTest/java/com/squareup/sample/compose/hellocompose/HelloComposeTest.kt b/samples/compose-samples/src/androidTest/java/com/squareup/sample/compose/hellocompose/HelloComposeTest.kt index 1cccd8895..f90aea904 100644 --- a/samples/compose-samples/src/androidTest/java/com/squareup/sample/compose/hellocompose/HelloComposeTest.kt +++ b/samples/compose-samples/src/androidTest/java/com/squareup/sample/compose/hellocompose/HelloComposeTest.kt @@ -6,12 +6,12 @@ import androidx.compose.ui.test.onNodeWithText import androidx.compose.ui.test.performClick import androidx.test.ext.junit.runners.AndroidJUnit4 import com.squareup.workflow1.ui.WorkflowUiExperimentalApi -import com.squareup.workflow1.ui.internal.test.DetectLeaksAfterTestSuccess import com.squareup.workflow1.ui.internal.test.IdleAfterTestRule import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule import com.squareup.workflow1.ui.internal.test.compose.settleForNextRendering import com.squareup.workflow1.ui.internal.test.retry import kotlinx.coroutines.runBlocking +import leakcanary.DetectLeaksAfterTestSuccess import org.junit.Rule import org.junit.Test import org.junit.rules.RuleChain diff --git a/samples/compose-samples/src/androidTest/java/com/squareup/sample/compose/hellocomposebinding/HelloBindingTest.kt b/samples/compose-samples/src/androidTest/java/com/squareup/sample/compose/hellocomposebinding/HelloBindingTest.kt index d6f4ba3f3..a79a295d9 100644 --- a/samples/compose-samples/src/androidTest/java/com/squareup/sample/compose/hellocomposebinding/HelloBindingTest.kt +++ b/samples/compose-samples/src/androidTest/java/com/squareup/sample/compose/hellocomposebinding/HelloBindingTest.kt @@ -6,9 +6,9 @@ import androidx.compose.ui.test.onNodeWithText import androidx.compose.ui.test.performClick import androidx.test.ext.junit.runners.AndroidJUnit4 import com.squareup.workflow1.ui.WorkflowUiExperimentalApi -import com.squareup.workflow1.ui.internal.test.DetectLeaksAfterTestSuccess import com.squareup.workflow1.ui.internal.test.IdleAfterTestRule import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule +import leakcanary.DetectLeaksAfterTestSuccess import org.junit.Rule import org.junit.Test import org.junit.rules.RuleChain diff --git a/samples/compose-samples/src/androidTest/java/com/squareup/sample/compose/hellocomposeworkflow/HelloComposeWorkflowTest.kt b/samples/compose-samples/src/androidTest/java/com/squareup/sample/compose/hellocomposeworkflow/HelloComposeWorkflowTest.kt index bb2eb58fe..fb9e131c1 100644 --- a/samples/compose-samples/src/androidTest/java/com/squareup/sample/compose/hellocomposeworkflow/HelloComposeWorkflowTest.kt +++ b/samples/compose-samples/src/androidTest/java/com/squareup/sample/compose/hellocomposeworkflow/HelloComposeWorkflowTest.kt @@ -6,9 +6,9 @@ import androidx.compose.ui.test.onNodeWithText import androidx.compose.ui.test.performClick import androidx.test.ext.junit.runners.AndroidJUnit4 import com.squareup.workflow1.ui.WorkflowUiExperimentalApi -import com.squareup.workflow1.ui.internal.test.DetectLeaksAfterTestSuccess import com.squareup.workflow1.ui.internal.test.IdleAfterTestRule import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule +import leakcanary.DetectLeaksAfterTestSuccess import org.junit.Rule import org.junit.Test import org.junit.rules.RuleChain diff --git a/samples/compose-samples/src/androidTest/java/com/squareup/sample/compose/inlinerendering/InlineRenderingTest.kt b/samples/compose-samples/src/androidTest/java/com/squareup/sample/compose/inlinerendering/InlineRenderingTest.kt index a38736b47..b6e3566ed 100644 --- a/samples/compose-samples/src/androidTest/java/com/squareup/sample/compose/inlinerendering/InlineRenderingTest.kt +++ b/samples/compose-samples/src/androidTest/java/com/squareup/sample/compose/inlinerendering/InlineRenderingTest.kt @@ -7,12 +7,12 @@ import androidx.compose.ui.test.junit4.createAndroidComposeRule import androidx.compose.ui.test.performClick import androidx.test.ext.junit.runners.AndroidJUnit4 import com.squareup.workflow1.ui.WorkflowUiExperimentalApi -import com.squareup.workflow1.ui.internal.test.DetectLeaksAfterTestSuccess import com.squareup.workflow1.ui.internal.test.IdleAfterTestRule import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule import com.squareup.workflow1.ui.internal.test.compose.settleForNextRendering import com.squareup.workflow1.ui.internal.test.retry import kotlinx.coroutines.runBlocking +import leakcanary.DetectLeaksAfterTestSuccess import org.junit.Rule import org.junit.Test import org.junit.rules.RuleChain diff --git a/samples/compose-samples/src/androidTest/java/com/squareup/sample/compose/launcher/SampleLauncherTest.kt b/samples/compose-samples/src/androidTest/java/com/squareup/sample/compose/launcher/SampleLauncherTest.kt index 4a8fd5032..d7af71a16 100644 --- a/samples/compose-samples/src/androidTest/java/com/squareup/sample/compose/launcher/SampleLauncherTest.kt +++ b/samples/compose-samples/src/androidTest/java/com/squareup/sample/compose/launcher/SampleLauncherTest.kt @@ -12,9 +12,9 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.platform.app.InstrumentationRegistry import com.squareup.sample.compose.R import com.squareup.workflow1.ui.WorkflowUiExperimentalApi -import com.squareup.workflow1.ui.internal.test.DetectLeaksAfterTestSuccess import com.squareup.workflow1.ui.internal.test.IdleAfterTestRule import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule +import leakcanary.DetectLeaksAfterTestSuccess import org.junit.Rule import org.junit.Test import org.junit.rules.RuleChain diff --git a/samples/compose-samples/src/androidTest/java/com/squareup/sample/compose/nestedrenderings/NestedRenderingsTest.kt b/samples/compose-samples/src/androidTest/java/com/squareup/sample/compose/nestedrenderings/NestedRenderingsTest.kt index 504549c45..3a1376f94 100644 --- a/samples/compose-samples/src/androidTest/java/com/squareup/sample/compose/nestedrenderings/NestedRenderingsTest.kt +++ b/samples/compose-samples/src/androidTest/java/com/squareup/sample/compose/nestedrenderings/NestedRenderingsTest.kt @@ -10,9 +10,9 @@ import androidx.compose.ui.test.onNodeWithText import androidx.compose.ui.test.performClick import androidx.test.ext.junit.runners.AndroidJUnit4 import com.squareup.workflow1.ui.WorkflowUiExperimentalApi -import com.squareup.workflow1.ui.internal.test.DetectLeaksAfterTestSuccess import com.squareup.workflow1.ui.internal.test.IdleAfterTestRule import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule +import leakcanary.DetectLeaksAfterTestSuccess import org.junit.Rule import org.junit.Test import org.junit.rules.RuleChain diff --git a/samples/compose-samples/src/androidTest/java/com/squareup/sample/compose/preview/PreviewTest.kt b/samples/compose-samples/src/androidTest/java/com/squareup/sample/compose/preview/PreviewTest.kt index 5e538a6fe..ec222c5fd 100644 --- a/samples/compose-samples/src/androidTest/java/com/squareup/sample/compose/preview/PreviewTest.kt +++ b/samples/compose-samples/src/androidTest/java/com/squareup/sample/compose/preview/PreviewTest.kt @@ -6,9 +6,9 @@ import androidx.compose.ui.test.junit4.createAndroidComposeRule import androidx.compose.ui.test.onNodeWithText import androidx.test.ext.junit.runners.AndroidJUnit4 import com.squareup.workflow1.ui.WorkflowUiExperimentalApi -import com.squareup.workflow1.ui.internal.test.DetectLeaksAfterTestSuccess import com.squareup.workflow1.ui.internal.test.IdleAfterTestRule import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule +import leakcanary.DetectLeaksAfterTestSuccess import org.junit.Rule import org.junit.Test import org.junit.rules.RuleChain diff --git a/samples/compose-samples/src/androidTest/java/com/squareup/sample/compose/textinput/TextInputTest.kt b/samples/compose-samples/src/androidTest/java/com/squareup/sample/compose/textinput/TextInputTest.kt index a77e60c0b..adfc481f8 100644 --- a/samples/compose-samples/src/androidTest/java/com/squareup/sample/compose/textinput/TextInputTest.kt +++ b/samples/compose-samples/src/androidTest/java/com/squareup/sample/compose/textinput/TextInputTest.kt @@ -10,12 +10,12 @@ import androidx.compose.ui.test.performTextInput import androidx.compose.ui.test.performTextReplacement import androidx.test.ext.junit.runners.AndroidJUnit4 import com.squareup.workflow1.ui.WorkflowUiExperimentalApi -import com.squareup.workflow1.ui.internal.test.DetectLeaksAfterTestSuccess import com.squareup.workflow1.ui.internal.test.IdleAfterTestRule import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule import com.squareup.workflow1.ui.internal.test.compose.settleForNextRendering import com.squareup.workflow1.ui.internal.test.retry import kotlinx.coroutines.runBlocking +import leakcanary.DetectLeaksAfterTestSuccess import org.junit.Rule import org.junit.Test import org.junit.rules.RuleChain diff --git a/samples/containers/app-poetry/src/androidTest/java/com/squareup/sample/poetryapp/PoetryAppTest.kt b/samples/containers/app-poetry/src/androidTest/java/com/squareup/sample/poetryapp/PoetryAppTest.kt index 775ccc044..6bc56540d 100644 --- a/samples/containers/app-poetry/src/androidTest/java/com/squareup/sample/poetryapp/PoetryAppTest.kt +++ b/samples/containers/app-poetry/src/androidTest/java/com/squareup/sample/poetryapp/PoetryAppTest.kt @@ -7,9 +7,9 @@ import androidx.test.ext.junit.rules.ActivityScenarioRule import androidx.test.ext.junit.runners.AndroidJUnit4 import com.squareup.sample.container.poetryapp.R import com.squareup.workflow1.ui.WorkflowUiExperimentalApi -import com.squareup.workflow1.ui.internal.test.DetectLeaksAfterTestSuccess import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule import com.squareup.workflow1.ui.internal.test.inAnyView +import leakcanary.DetectLeaksAfterTestSuccess import org.junit.Rule import org.junit.Test import org.junit.rules.RuleChain diff --git a/samples/containers/app-raven/src/androidTest/java/com/squareup/sample/ravenapp/RavenAppTest.kt b/samples/containers/app-raven/src/androidTest/java/com/squareup/sample/ravenapp/RavenAppTest.kt index 753c6186e..b1644b1e9 100644 --- a/samples/containers/app-raven/src/androidTest/java/com/squareup/sample/ravenapp/RavenAppTest.kt +++ b/samples/containers/app-raven/src/androidTest/java/com/squareup/sample/ravenapp/RavenAppTest.kt @@ -6,9 +6,9 @@ import androidx.test.espresso.matcher.ViewMatchers.withText import androidx.test.ext.junit.rules.ActivityScenarioRule import androidx.test.ext.junit.runners.AndroidJUnit4 import com.squareup.workflow1.ui.WorkflowUiExperimentalApi -import com.squareup.workflow1.ui.internal.test.DetectLeaksAfterTestSuccess import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule import com.squareup.workflow1.ui.internal.test.inAnyView +import leakcanary.DetectLeaksAfterTestSuccess import org.junit.Rule import org.junit.Test import org.junit.rules.RuleChain diff --git a/samples/containers/hello-back-button/src/androidTest/java/com/squareup/sample/hellobackbutton/HelloBackButtonEspressoTest.kt b/samples/containers/hello-back-button/src/androidTest/java/com/squareup/sample/hellobackbutton/HelloBackButtonEspressoTest.kt index 3971552b9..c353358a5 100644 --- a/samples/containers/hello-back-button/src/androidTest/java/com/squareup/sample/hellobackbutton/HelloBackButtonEspressoTest.kt +++ b/samples/containers/hello-back-button/src/androidTest/java/com/squareup/sample/hellobackbutton/HelloBackButtonEspressoTest.kt @@ -8,11 +8,11 @@ import androidx.test.espresso.matcher.ViewMatchers.withText import androidx.test.ext.junit.rules.ActivityScenarioRule import androidx.test.ext.junit.runners.AndroidJUnit4 import com.squareup.workflow1.ui.WorkflowUiExperimentalApi -import com.squareup.workflow1.ui.internal.test.DetectLeaksAfterTestSuccess import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule import com.squareup.workflow1.ui.internal.test.actuallyPressBack import com.squareup.workflow1.ui.internal.test.inAnyView import com.squareup.workflow1.ui.internal.test.retryBlocking +import leakcanary.DetectLeaksAfterTestSuccess import org.junit.Rule import org.junit.Test import org.junit.rules.RuleChain diff --git a/samples/dungeon/app/src/androidTest/java/com/squareup/sample/dungeon/DungeonAppTest.kt b/samples/dungeon/app/src/androidTest/java/com/squareup/sample/dungeon/DungeonAppTest.kt index 2bf2c51b5..c38a2e8e0 100644 --- a/samples/dungeon/app/src/androidTest/java/com/squareup/sample/dungeon/DungeonAppTest.kt +++ b/samples/dungeon/app/src/androidTest/java/com/squareup/sample/dungeon/DungeonAppTest.kt @@ -6,9 +6,9 @@ import androidx.test.espresso.matcher.ViewMatchers.withText import androidx.test.ext.junit.rules.ActivityScenarioRule import androidx.test.ext.junit.runners.AndroidJUnit4 import com.squareup.workflow1.ui.WorkflowUiExperimentalApi -import com.squareup.workflow1.ui.internal.test.DetectLeaksAfterTestSuccess import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule import com.squareup.workflow1.ui.internal.test.inAnyView +import leakcanary.DetectLeaksAfterTestSuccess import org.junit.Rule import org.junit.Test import org.junit.rules.RuleChain diff --git a/samples/hello-workflow-fragment/src/androidTest/java/com/squareup/sample/helloworkflowfragment/HelloWorkflowFragmentAppTest.kt b/samples/hello-workflow-fragment/src/androidTest/java/com/squareup/sample/helloworkflowfragment/HelloWorkflowFragmentAppTest.kt index 73640814a..78ad2d60a 100644 --- a/samples/hello-workflow-fragment/src/androidTest/java/com/squareup/sample/helloworkflowfragment/HelloWorkflowFragmentAppTest.kt +++ b/samples/hello-workflow-fragment/src/androidTest/java/com/squareup/sample/helloworkflowfragment/HelloWorkflowFragmentAppTest.kt @@ -7,9 +7,9 @@ import androidx.test.espresso.matcher.ViewMatchers.withText import androidx.test.ext.junit.rules.ActivityScenarioRule import androidx.test.ext.junit.runners.AndroidJUnit4 import com.squareup.workflow1.ui.WorkflowUiExperimentalApi -import com.squareup.workflow1.ui.internal.test.DetectLeaksAfterTestSuccess import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule import com.squareup.workflow1.ui.internal.test.inAnyView +import leakcanary.DetectLeaksAfterTestSuccess import org.hamcrest.Matchers.containsString import org.junit.Rule import org.junit.Test diff --git a/samples/hello-workflow/src/androidTest/java/com/squareup/sample/helloworkflow/HelloWorkflowAppTest.kt b/samples/hello-workflow/src/androidTest/java/com/squareup/sample/helloworkflow/HelloWorkflowAppTest.kt index b9045d4b8..66dbdb855 100644 --- a/samples/hello-workflow/src/androidTest/java/com/squareup/sample/helloworkflow/HelloWorkflowAppTest.kt +++ b/samples/hello-workflow/src/androidTest/java/com/squareup/sample/helloworkflow/HelloWorkflowAppTest.kt @@ -7,9 +7,9 @@ import androidx.test.espresso.matcher.ViewMatchers.withText import androidx.test.ext.junit.rules.ActivityScenarioRule import androidx.test.ext.junit.runners.AndroidJUnit4 import com.squareup.workflow1.ui.WorkflowUiExperimentalApi -import com.squareup.workflow1.ui.internal.test.DetectLeaksAfterTestSuccess import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule import com.squareup.workflow1.ui.internal.test.inAnyView +import leakcanary.DetectLeaksAfterTestSuccess import org.junit.Rule import org.junit.Test import org.junit.rules.RuleChain diff --git a/samples/stub-visibility/src/androidTest/java/com/squareup/sample/stubvisibility/StubVisibilityAppTest.kt b/samples/stub-visibility/src/androidTest/java/com/squareup/sample/stubvisibility/StubVisibilityAppTest.kt index eac0b7314..a5f216963 100644 --- a/samples/stub-visibility/src/androidTest/java/com/squareup/sample/stubvisibility/StubVisibilityAppTest.kt +++ b/samples/stub-visibility/src/androidTest/java/com/squareup/sample/stubvisibility/StubVisibilityAppTest.kt @@ -8,9 +8,9 @@ import androidx.test.espresso.matcher.ViewMatchers.withText import androidx.test.ext.junit.rules.ActivityScenarioRule import androidx.test.ext.junit.runners.AndroidJUnit4 import com.squareup.workflow1.ui.WorkflowUiExperimentalApi -import com.squareup.workflow1.ui.internal.test.DetectLeaksAfterTestSuccess import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule import com.squareup.workflow1.ui.internal.test.inAnyView +import leakcanary.DetectLeaksAfterTestSuccess import org.hamcrest.CoreMatchers.not import org.junit.Rule import org.junit.Test diff --git a/samples/tictactoe/app/src/androidTest/java/com/squareup/sample/TicTacToeEspressoTest.kt b/samples/tictactoe/app/src/androidTest/java/com/squareup/sample/TicTacToeEspressoTest.kt index 563b7a876..12bd4c2f7 100644 --- a/samples/tictactoe/app/src/androidTest/java/com/squareup/sample/TicTacToeEspressoTest.kt +++ b/samples/tictactoe/app/src/androidTest/java/com/squareup/sample/TicTacToeEspressoTest.kt @@ -19,11 +19,11 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import com.squareup.sample.mainactivity.TicTacToeActivity import com.squareup.sample.tictactoe.R import com.squareup.workflow1.ui.WorkflowUiExperimentalApi -import com.squareup.workflow1.ui.internal.test.DetectLeaksAfterTestSuccess import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule import com.squareup.workflow1.ui.internal.test.actuallyPressBack import com.squareup.workflow1.ui.internal.test.inAnyView import com.squareup.workflow1.ui.internal.test.retryBlocking +import leakcanary.DetectLeaksAfterTestSuccess import org.hamcrest.CoreMatchers.allOf import org.hamcrest.CoreMatchers.endsWith import org.junit.After diff --git a/samples/todo-android/app/src/androidTest/java/com/squareup/sample/mainactivity/TodoAppTest.kt b/samples/todo-android/app/src/androidTest/java/com/squareup/sample/mainactivity/TodoAppTest.kt index 1ee097ff8..4f88c6676 100644 --- a/samples/todo-android/app/src/androidTest/java/com/squareup/sample/mainactivity/TodoAppTest.kt +++ b/samples/todo-android/app/src/androidTest/java/com/squareup/sample/mainactivity/TodoAppTest.kt @@ -12,10 +12,10 @@ import androidx.test.uiautomator.UiDevice import com.squareup.sample.todo.R import com.squareup.sample.todo.ToDoActivity import com.squareup.workflow1.ui.WorkflowUiExperimentalApi -import com.squareup.workflow1.ui.internal.test.DetectLeaksAfterTestSuccess import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule import com.squareup.workflow1.ui.internal.test.actuallyPressBack import com.squareup.workflow1.ui.internal.test.inAnyView +import leakcanary.DetectLeaksAfterTestSuccess import org.hamcrest.Matchers.allOf import org.junit.After import org.junit.Before diff --git a/workflow-ui/compose-tooling/src/androidTest/java/com/squareup/workflow1/ui/compose/tooling/LegacyPreviewViewFactoryTest.kt b/workflow-ui/compose-tooling/src/androidTest/java/com/squareup/workflow1/ui/compose/tooling/LegacyPreviewViewFactoryTest.kt index 4d43c9060..6338b6c94 100644 --- a/workflow-ui/compose-tooling/src/androidTest/java/com/squareup/workflow1/ui/compose/tooling/LegacyPreviewViewFactoryTest.kt +++ b/workflow-ui/compose-tooling/src/androidTest/java/com/squareup/workflow1/ui/compose/tooling/LegacyPreviewViewFactoryTest.kt @@ -18,9 +18,9 @@ import com.squareup.workflow1.ui.ViewEnvironmentKey import com.squareup.workflow1.ui.WorkflowUiExperimentalApi import com.squareup.workflow1.ui.compose.WorkflowRendering import com.squareup.workflow1.ui.compose.composeViewFactory -import com.squareup.workflow1.ui.internal.test.DetectLeaksAfterTestSuccess import com.squareup.workflow1.ui.internal.test.IdleAfterTestRule import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule +import leakcanary.DetectLeaksAfterTestSuccess import org.junit.Rule import org.junit.Test import org.junit.rules.RuleChain diff --git a/workflow-ui/compose-tooling/src/androidTest/java/com/squareup/workflow1/ui/compose/tooling/PreviewViewFactoryTest.kt b/workflow-ui/compose-tooling/src/androidTest/java/com/squareup/workflow1/ui/compose/tooling/PreviewViewFactoryTest.kt index 2af1f0c58..bba768ca6 100644 --- a/workflow-ui/compose-tooling/src/androidTest/java/com/squareup/workflow1/ui/compose/tooling/PreviewViewFactoryTest.kt +++ b/workflow-ui/compose-tooling/src/androidTest/java/com/squareup/workflow1/ui/compose/tooling/PreviewViewFactoryTest.kt @@ -19,9 +19,9 @@ import com.squareup.workflow1.ui.ViewEnvironmentKey import com.squareup.workflow1.ui.WorkflowUiExperimentalApi import com.squareup.workflow1.ui.compose.WorkflowRendering import com.squareup.workflow1.ui.compose.composeScreenViewFactory -import com.squareup.workflow1.ui.internal.test.DetectLeaksAfterTestSuccess import com.squareup.workflow1.ui.internal.test.IdleAfterTestRule import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule +import leakcanary.DetectLeaksAfterTestSuccess import org.junit.Rule import org.junit.Test import org.junit.rules.RuleChain diff --git a/workflow-ui/compose/src/androidTest/java/com/squareup/workflow1/ui/compose/ComposeViewFactoryTest.kt b/workflow-ui/compose/src/androidTest/java/com/squareup/workflow1/ui/compose/ComposeViewFactoryTest.kt index af9f0d181..6f1aae60a 100644 --- a/workflow-ui/compose/src/androidTest/java/com/squareup/workflow1/ui/compose/ComposeViewFactoryTest.kt +++ b/workflow-ui/compose/src/androidTest/java/com/squareup/workflow1/ui/compose/ComposeViewFactoryTest.kt @@ -22,10 +22,10 @@ import com.squareup.workflow1.ui.ViewEnvironmentKey import com.squareup.workflow1.ui.ViewRegistry import com.squareup.workflow1.ui.WorkflowUiExperimentalApi import com.squareup.workflow1.ui.WorkflowViewStub -import com.squareup.workflow1.ui.internal.test.DetectLeaksAfterTestSuccess import com.squareup.workflow1.ui.internal.test.IdleAfterTestRule import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule import com.squareup.workflow1.ui.plus +import leakcanary.DetectLeaksAfterTestSuccess import org.junit.Rule import org.junit.Test import org.junit.rules.RuleChain diff --git a/workflow-ui/compose/src/androidTest/java/com/squareup/workflow1/ui/compose/ComposeViewTreeIntegrationTest.kt b/workflow-ui/compose/src/androidTest/java/com/squareup/workflow1/ui/compose/ComposeViewTreeIntegrationTest.kt index ce8d343de..5f7711963 100644 --- a/workflow-ui/compose/src/androidTest/java/com/squareup/workflow1/ui/compose/ComposeViewTreeIntegrationTest.kt +++ b/workflow-ui/compose/src/androidTest/java/com/squareup/workflow1/ui/compose/ComposeViewTreeIntegrationTest.kt @@ -37,11 +37,11 @@ import com.squareup.workflow1.ui.container.BackStackScreen import com.squareup.workflow1.ui.container.BodyAndOverlaysScreen import com.squareup.workflow1.ui.container.ScreenOverlay import com.squareup.workflow1.ui.container.ScreenOverlayDialogFactory -import com.squareup.workflow1.ui.internal.test.DetectLeaksAfterTestSuccess import com.squareup.workflow1.ui.internal.test.IdleAfterTestRule import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule import com.squareup.workflow1.ui.internal.test.WorkflowUiTestActivity import com.squareup.workflow1.ui.plus +import leakcanary.DetectLeaksAfterTestSuccess import org.junit.Before import org.junit.Rule import org.junit.Test diff --git a/workflow-ui/compose/src/androidTest/java/com/squareup/workflow1/ui/compose/CompositionRootTest.kt b/workflow-ui/compose/src/androidTest/java/com/squareup/workflow1/ui/compose/CompositionRootTest.kt index abd78f668..bce16d6a7 100644 --- a/workflow-ui/compose/src/androidTest/java/com/squareup/workflow1/ui/compose/CompositionRootTest.kt +++ b/workflow-ui/compose/src/androidTest/java/com/squareup/workflow1/ui/compose/CompositionRootTest.kt @@ -8,9 +8,9 @@ import androidx.compose.ui.test.junit4.createComposeRule import androidx.compose.ui.test.onNodeWithText import androidx.test.ext.junit.runners.AndroidJUnit4 import com.squareup.workflow1.ui.WorkflowUiExperimentalApi -import com.squareup.workflow1.ui.internal.test.DetectLeaksAfterTestSuccess import com.squareup.workflow1.ui.internal.test.IdleAfterTestRule import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule +import leakcanary.DetectLeaksAfterTestSuccess import org.junit.Rule import org.junit.Test import org.junit.rules.RuleChain diff --git a/workflow-ui/compose/src/androidTest/java/com/squareup/workflow1/ui/compose/LegacyComposeViewFactoryTest.kt b/workflow-ui/compose/src/androidTest/java/com/squareup/workflow1/ui/compose/LegacyComposeViewFactoryTest.kt index 1daec571b..8ee54914f 100644 --- a/workflow-ui/compose/src/androidTest/java/com/squareup/workflow1/ui/compose/LegacyComposeViewFactoryTest.kt +++ b/workflow-ui/compose/src/androidTest/java/com/squareup/workflow1/ui/compose/LegacyComposeViewFactoryTest.kt @@ -23,10 +23,10 @@ import com.squareup.workflow1.ui.ViewEnvironmentKey import com.squareup.workflow1.ui.ViewRegistry import com.squareup.workflow1.ui.WorkflowUiExperimentalApi import com.squareup.workflow1.ui.WorkflowViewStub -import com.squareup.workflow1.ui.internal.test.DetectLeaksAfterTestSuccess import com.squareup.workflow1.ui.internal.test.IdleAfterTestRule import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule import com.squareup.workflow1.ui.plus +import leakcanary.DetectLeaksAfterTestSuccess import org.junit.Rule import org.junit.Test import org.junit.rules.RuleChain diff --git a/workflow-ui/compose/src/androidTest/java/com/squareup/workflow1/ui/compose/LegacyComposeViewTreeIntegrationTest.kt b/workflow-ui/compose/src/androidTest/java/com/squareup/workflow1/ui/compose/LegacyComposeViewTreeIntegrationTest.kt index f9f476889..7a6e18005 100644 --- a/workflow-ui/compose/src/androidTest/java/com/squareup/workflow1/ui/compose/LegacyComposeViewTreeIntegrationTest.kt +++ b/workflow-ui/compose/src/androidTest/java/com/squareup/workflow1/ui/compose/LegacyComposeViewTreeIntegrationTest.kt @@ -37,12 +37,12 @@ import com.squareup.workflow1.ui.ViewRegistry import com.squareup.workflow1.ui.WorkflowUiExperimentalApi import com.squareup.workflow1.ui.backstack.BackStackScreen import com.squareup.workflow1.ui.bindShowRendering -import com.squareup.workflow1.ui.internal.test.DetectLeaksAfterTestSuccess import com.squareup.workflow1.ui.internal.test.IdleAfterTestRule import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule import com.squareup.workflow1.ui.internal.test.LegacyWorkflowUiTestActivity import com.squareup.workflow1.ui.modal.HasModals import com.squareup.workflow1.ui.modal.ModalViewContainer +import leakcanary.DetectLeaksAfterTestSuccess import org.junit.Before import org.junit.Rule import org.junit.Test @@ -622,7 +622,7 @@ internal class LegacyComposeViewTreeIntegrationTest { object EmptyRendering : AndroidScreen { override val viewFactory: ScreenViewFactory get() = ScreenViewFactory.fromCode { _, e, c, _ -> - ScreenViewHolder(e, View(c)) { _, _, -> } + ScreenViewHolder(e, View(c)) { _, _ -> } } } diff --git a/workflow-ui/compose/src/androidTest/java/com/squareup/workflow1/ui/compose/LegacyWorkflowRenderingTest.kt b/workflow-ui/compose/src/androidTest/java/com/squareup/workflow1/ui/compose/LegacyWorkflowRenderingTest.kt index a465216e1..bebc39245 100644 --- a/workflow-ui/compose/src/androidTest/java/com/squareup/workflow1/ui/compose/LegacyWorkflowRenderingTest.kt +++ b/workflow-ui/compose/src/androidTest/java/com/squareup/workflow1/ui/compose/LegacyWorkflowRenderingTest.kt @@ -67,10 +67,10 @@ import com.squareup.workflow1.ui.ViewFactory import com.squareup.workflow1.ui.ViewRegistry import com.squareup.workflow1.ui.WorkflowUiExperimentalApi import com.squareup.workflow1.ui.bindShowRendering -import com.squareup.workflow1.ui.internal.test.DetectLeaksAfterTestSuccess import com.squareup.workflow1.ui.internal.test.IdleAfterTestRule import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule import com.squareup.workflow1.ui.plus +import leakcanary.DetectLeaksAfterTestSuccess import org.hamcrest.Description import org.hamcrest.TypeSafeMatcher import org.junit.Rule @@ -114,8 +114,8 @@ internal class LegacyWorkflowRenderingTest { } /** - * Ensures we match the behavior of WorkflowViewStub and other containers, which only check for - * a new factory when a new rendering is incompatible with the current one. + * Ensures we match the behavior of WorkflowViewStub and other containers, which only check for a + * new factory when a new rendering is incompatible with the current one. */ @Test fun doesNotRecompose_whenAndroidViewRendering_factoryChanged() { data class ShiftyRendering(val whichFactory: Boolean) : AndroidViewRendering { diff --git a/workflow-ui/compose/src/androidTest/java/com/squareup/workflow1/ui/compose/RenderAsStateTest.kt b/workflow-ui/compose/src/androidTest/java/com/squareup/workflow1/ui/compose/RenderAsStateTest.kt index 2b29f540c..e060be47e 100644 --- a/workflow-ui/compose/src/androidTest/java/com/squareup/workflow1/ui/compose/RenderAsStateTest.kt +++ b/workflow-ui/compose/src/androidTest/java/com/squareup/workflow1/ui/compose/RenderAsStateTest.kt @@ -24,7 +24,6 @@ import com.squareup.workflow1.rendering import com.squareup.workflow1.stateless import com.squareup.workflow1.ui.WorkflowUiExperimentalApi import com.squareup.workflow1.ui.compose.RenderAsStateTest.SnapshottingWorkflow.SnapshottedRendering -import com.squareup.workflow1.ui.internal.test.DetectLeaksAfterTestSuccess import com.squareup.workflow1.ui.internal.test.IdleAfterTestRule import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule import com.squareup.workflow1.writeUtf8WithLength @@ -37,6 +36,7 @@ import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.UnconfinedTestDispatcher import kotlinx.coroutines.test.advanceUntilIdle import kotlinx.coroutines.test.runTest +import leakcanary.DetectLeaksAfterTestSuccess import okio.ByteString import okio.ByteString.Companion.decodeBase64 import org.junit.Rule diff --git a/workflow-ui/compose/src/androidTest/java/com/squareup/workflow1/ui/compose/WorkflowRenderingTest.kt b/workflow-ui/compose/src/androidTest/java/com/squareup/workflow1/ui/compose/WorkflowRenderingTest.kt index acd205fd8..78de06629 100644 --- a/workflow-ui/compose/src/androidTest/java/com/squareup/workflow1/ui/compose/WorkflowRenderingTest.kt +++ b/workflow-ui/compose/src/androidTest/java/com/squareup/workflow1/ui/compose/WorkflowRenderingTest.kt @@ -65,10 +65,10 @@ import com.squareup.workflow1.ui.ScreenViewHolder import com.squareup.workflow1.ui.ViewEnvironment import com.squareup.workflow1.ui.ViewRegistry import com.squareup.workflow1.ui.WorkflowUiExperimentalApi -import com.squareup.workflow1.ui.internal.test.DetectLeaksAfterTestSuccess import com.squareup.workflow1.ui.internal.test.IdleAfterTestRule import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule import com.squareup.workflow1.ui.plus +import leakcanary.DetectLeaksAfterTestSuccess import org.hamcrest.Description import org.hamcrest.TypeSafeMatcher import org.junit.Rule @@ -116,8 +116,8 @@ internal class WorkflowRenderingTest { } /** - * Ensures we match the behavior of WorkflowViewStub and other containers, which only check for - * a new factory when a new rendering is incompatible with the current one. + * Ensures we match the behavior of WorkflowViewStub and other containers, which only check for a + * new factory when a new rendering is incompatible with the current one. */ @Test fun doesNotRecompose_whenAndroidViewRendering_factoryChanged() { data class ShiftyRendering(val whichFactory: Boolean) : AndroidScreen { diff --git a/workflow-ui/container-android/src/androidTest/java/com/squareup/workflow1/ui/modal/test/ModalViewContainerLifecycleTest.kt b/workflow-ui/container-android/src/androidTest/java/com/squareup/workflow1/ui/modal/test/ModalViewContainerLifecycleTest.kt index 25f3aa6bf..6b871edeb 100644 --- a/workflow-ui/container-android/src/androidTest/java/com/squareup/workflow1/ui/modal/test/ModalViewContainerLifecycleTest.kt +++ b/workflow-ui/container-android/src/androidTest/java/com/squareup/workflow1/ui/modal/test/ModalViewContainerLifecycleTest.kt @@ -8,11 +8,11 @@ import androidx.lifecycle.LifecycleOwner import androidx.test.ext.junit.rules.ActivityScenarioRule import com.google.common.truth.Truth.assertThat import com.squareup.workflow1.ui.WorkflowUiExperimentalApi -import com.squareup.workflow1.ui.internal.test.DetectLeaksAfterTestSuccess import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule import com.squareup.workflow1.ui.modal.ModalViewContainer import com.squareup.workflow1.ui.modal.test.ModalViewContainerLifecycleActivity.TestRendering.LeafRendering import com.squareup.workflow1.ui.modal.test.ModalViewContainerLifecycleActivity.TestRendering.RecurseRendering +import leakcanary.DetectLeaksAfterTestSuccess import org.junit.Rule import org.junit.Test import org.junit.rules.RuleChain diff --git a/workflow-ui/core-android/src/androidTest/java/com/squareup/workflow1/ui/BackPressedHandlerTest.kt b/workflow-ui/core-android/src/androidTest/java/com/squareup/workflow1/ui/BackPressedHandlerTest.kt index c40530dc1..62ec7f962 100644 --- a/workflow-ui/core-android/src/androidTest/java/com/squareup/workflow1/ui/BackPressedHandlerTest.kt +++ b/workflow-ui/core-android/src/androidTest/java/com/squareup/workflow1/ui/BackPressedHandlerTest.kt @@ -11,8 +11,8 @@ import androidx.lifecycle.LifecycleRegistry import androidx.lifecycle.ViewTreeLifecycleOwner import androidx.test.ext.junit.rules.ActivityScenarioRule import com.google.common.truth.Truth.assertThat -import com.squareup.workflow1.ui.internal.test.DetectLeaksAfterTestSuccess import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule +import leakcanary.DetectLeaksAfterTestSuccess import org.junit.Rule import org.junit.Test import org.junit.rules.RuleChain diff --git a/workflow-ui/core-android/src/androidTest/java/com/squareup/workflow1/ui/WorkflowViewStubLifecycleTest.kt b/workflow-ui/core-android/src/androidTest/java/com/squareup/workflow1/ui/WorkflowViewStubLifecycleTest.kt index a9bfffa7f..d8cfd4e90 100644 --- a/workflow-ui/core-android/src/androidTest/java/com/squareup/workflow1/ui/WorkflowViewStubLifecycleTest.kt +++ b/workflow-ui/core-android/src/androidTest/java/com/squareup/workflow1/ui/WorkflowViewStubLifecycleTest.kt @@ -30,8 +30,8 @@ import com.squareup.workflow1.ui.WorkflowViewStubLifecycleActivity.TestRendering import com.squareup.workflow1.ui.WorkflowViewStubLifecycleActivity.TestRendering.LeafRendering import com.squareup.workflow1.ui.WorkflowViewStubLifecycleActivity.TestRendering.RecurseRendering import com.squareup.workflow1.ui.WorkflowViewStubLifecycleActivity.TestRendering.ViewRendering -import com.squareup.workflow1.ui.internal.test.DetectLeaksAfterTestSuccess import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule +import leakcanary.DetectLeaksAfterTestSuccess import org.hamcrest.Matchers.equalTo import org.junit.Rule import org.junit.Test diff --git a/workflow-ui/core-android/src/androidTest/java/com/squareup/workflow1/ui/container/BackStackContainerPersistenceLifecycleTest.kt b/workflow-ui/core-android/src/androidTest/java/com/squareup/workflow1/ui/container/BackStackContainerPersistenceLifecycleTest.kt index de2cd2649..60d69c4a2 100644 --- a/workflow-ui/core-android/src/androidTest/java/com/squareup/workflow1/ui/container/BackStackContainerPersistenceLifecycleTest.kt +++ b/workflow-ui/core-android/src/androidTest/java/com/squareup/workflow1/ui/container/BackStackContainerPersistenceLifecycleTest.kt @@ -16,8 +16,8 @@ import com.squareup.workflow1.ui.container.fixtures.BackStackContainerLifecycleA import com.squareup.workflow1.ui.container.fixtures.ViewStateTestView import com.squareup.workflow1.ui.container.fixtures.viewForScreen import com.squareup.workflow1.ui.container.fixtures.waitForScreen -import com.squareup.workflow1.ui.internal.test.DetectLeaksAfterTestSuccess import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule +import leakcanary.DetectLeaksAfterTestSuccess import org.junit.Rule import org.junit.Test import org.junit.rules.RuleChain diff --git a/workflow-ui/internal-testing-android/api/internal-testing-android.api b/workflow-ui/internal-testing-android/api/internal-testing-android.api index e450ec62a..68a9699a0 100644 --- a/workflow-ui/internal-testing-android/api/internal-testing-android.api +++ b/workflow-ui/internal-testing-android/api/internal-testing-android.api @@ -47,13 +47,6 @@ public final class com/squareup/workflow1/ui/internal/test/AbstractLifecycleTest public static fun onViewTreeLifecycleStateChanged (Lcom/squareup/workflow1/ui/internal/test/AbstractLifecycleTestActivity$ViewObserver;Ljava/lang/Object;Landroidx/lifecycle/Lifecycle$Event;)V } -public final class com/squareup/workflow1/ui/internal/test/DetectLeaksAfterTestSuccess : org/junit/rules/TestRule { - public fun ()V - public fun (Ljava/lang/String;)V - public synthetic fun (Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public fun apply (Lorg/junit/runners/model/Statement;Lorg/junit/runner/Description;)Lorg/junit/runners/model/Statement; -} - public final class com/squareup/workflow1/ui/internal/test/EspressoKt { public static final field DEFAULT_RETRY_TIMEOUT J public static final field RETRY_POLLING_INTERVAL J diff --git a/workflow-ui/internal-testing-android/src/main/java/com/squareup/workflow1/ui/internal/test/DetectLeaksAfterTestSuccess.kt b/workflow-ui/internal-testing-android/src/main/java/com/squareup/workflow1/ui/internal/test/DetectLeaksAfterTestSuccess.kt deleted file mode 100644 index 7a2dae6ff..000000000 --- a/workflow-ui/internal-testing-android/src/main/java/com/squareup/workflow1/ui/internal/test/DetectLeaksAfterTestSuccess.kt +++ /dev/null @@ -1,39 +0,0 @@ -package com.squareup.workflow1.ui.internal.test - -import leakcanary.AppWatcher -import leakcanary.LeakAssertions -import org.junit.rules.TestRule -import org.junit.runner.Description -import org.junit.runners.model.Statement - -/** - * Forked from Leakcanary until https://github.com/square/leakcanary/issues/2297 is fixed. - * - * [TestRule] that invokes [LeakAssertions.assertNoLeaks] after the test - * successfully evaluates. Pay attention to where you set up this rule in the - * rule chain as you might detect different leaks (e.g. around vs wrapped by the - * activity rule). It's also possible to use this rule several times in a rule - * chain. - */ -public class DetectLeaksAfterTestSuccess( - private val tag: String = DetectLeaksAfterTestSuccess::class.java.simpleName -) : TestRule { - override fun apply( - base: Statement, - description: Description - ): Statement { - return object : Statement() { - override fun evaluate() { - // If the test fails, evaluate() will throw and we won't run the analysis (which is good). - try { - base.evaluate() - LeakAssertions.assertNoLeaks(tag) - } finally { - // Otherwise upstream test failures will be reported as leaks. - // https://github.com/square/leakcanary/issues/2297 - AppWatcher.objectWatcher.clearWatchedObjects() - } - } - } - } -}