Skip to content

Commit dd4338a

Browse files
committed
Eliminates workarounds for old Compose testing issue
https://issuetracker.google.com/issues/179455327 was fixed.
1 parent 9b7aaf8 commit dd4338a

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

workflow-ui/compose/src/androidTest/java/com/squareup/workflow1/ui/compose/ComposeViewTreeIntegrationTest.kt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ import com.squareup.workflow1.ui.internal.test.IdlingDispatcherRule
4545
import com.squareup.workflow1.ui.internal.test.WorkflowUiTestActivity
4646
import com.squareup.workflow1.ui.plus
4747
import org.junit.Before
48-
import org.junit.Ignore
4948
import org.junit.Rule
5049
import org.junit.Test
5150
import org.junit.rules.RuleChain
@@ -606,11 +605,14 @@ internal class ComposeViewTreeIntegrationTest {
606605
}
607606
}
608607

609-
companion object {
610-
// Use a ComposeView here because the Compose test infra doesn't like it if there are no
611-
// Compose views at all. See https://issuetracker.google.com/issues/179455327.
612-
val EmptyRendering: Screen = TestComposeRendering(compatibilityKey = "") {}
608+
object EmptyRendering : AndroidScreen<EmptyRendering> {
609+
override val viewFactory: ScreenViewFactory<EmptyRendering>
610+
get() = ScreenViewFactory.fromCode { _, e, c, _ ->
611+
ScreenViewHolder(e, View(c)) { _, _, -> }
612+
}
613+
}
613614

615+
companion object {
614616
const val CounterTag = "counter"
615617
const val CounterTag2 = "counter2"
616618
const val CounterTag3 = "counter3"

workflow-ui/compose/src/androidTest/java/com/squareup/workflow1/ui/compose/LegacyComposeViewTreeIntegrationTest.kt

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,11 @@ import androidx.compose.ui.test.onNodeWithTag
2626
import androidx.compose.ui.test.onNodeWithText
2727
import androidx.compose.ui.test.performClick
2828
import com.google.common.truth.Truth.assertThat
29+
import com.squareup.workflow1.ui.AndroidScreen
2930
import com.squareup.workflow1.ui.AndroidViewRendering
3031
import com.squareup.workflow1.ui.Compatible
32+
import com.squareup.workflow1.ui.ScreenViewFactory
33+
import com.squareup.workflow1.ui.ScreenViewHolder
3134
import com.squareup.workflow1.ui.ViewEnvironment
3235
import com.squareup.workflow1.ui.ViewFactory
3336
import com.squareup.workflow1.ui.ViewRegistry
@@ -615,11 +618,14 @@ internal class LegacyComposeViewTreeIntegrationTest {
615618
}
616619
}
617620

618-
companion object {
619-
// Use a ComposeView here because the Compose test infra doesn't like it if there are no
620-
// Compose views at all. See https://issuetracker.google.com/issues/179455327.
621-
val EmptyRendering = TestComposeRendering(compatibilityKey = "") {}
621+
object EmptyRendering : AndroidScreen<EmptyRendering> {
622+
override val viewFactory: ScreenViewFactory<EmptyRendering>
623+
get() = ScreenViewFactory.fromCode { _, e, c, _ ->
624+
ScreenViewHolder(e, View(c)) { _, _, -> }
625+
}
626+
}
622627

628+
companion object {
623629
const val CounterTag = "counter"
624630
const val CounterTag2 = "counter2"
625631
const val CounterTag3 = "counter3"

0 commit comments

Comments
 (0)