Skip to content

Commit 9b7aaf8

Browse files
committed
Undoes view tag wonkiness in ComposeViewTreeIntegrationTest
It was left over from an earlier draft of ScreenViewFactory.
1 parent 11856b0 commit 9b7aaf8

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

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

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ 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
4849
import org.junit.Rule
4950
import org.junit.Test
5051
import org.junit.rules.RuleChain
@@ -588,15 +589,19 @@ internal class ComposeViewTreeIntegrationTest {
588589
context: Context,
589590
container: ViewGroup?
590591
): ScreenViewHolder<TestComposeRendering> {
591-
val view = ComposeView(context)
592-
return ScreenViewHolder(initialEnvironment, view) { rendering, _ ->
593-
val lastCompositionStrategy = view.tag as? ViewCompositionStrategy
594-
view.tag = rendering.disposeStrategy
595-
if (rendering.disposeStrategy != lastCompositionStrategy) {
596-
lastCompositionStrategy?.let { view.setViewCompositionStrategy(it) }
597-
}
592+
var lastCompositionStrategy = initialRendering.disposeStrategy
593+
594+
return ComposeView(context).let { view ->
595+
lastCompositionStrategy?.let(view::setViewCompositionStrategy)
598596

599-
view.setContent(rendering.content)
597+
ScreenViewHolder(initialEnvironment, view) { rendering, _ ->
598+
if (rendering.disposeStrategy != lastCompositionStrategy) {
599+
lastCompositionStrategy = rendering.disposeStrategy
600+
lastCompositionStrategy?.let { view.setViewCompositionStrategy(it) }
601+
}
602+
603+
view.setContent(rendering.content)
604+
}
600605
}
601606
}
602607
}

0 commit comments

Comments
 (0)