mattinger
09/03/2025, 6:52 PM@RunWith(AndroidJUnit4::class)
class AnimatedVisibilityTest {
@get:Rule
val rule = createComposeRule()
@Test
fun testStructure() {
rule.setContent {
Column {
Text("Header")
AnimatedVisibility(visible = true) {
Text("Body")
}
}
}
println(rule.onRoot().printToString())
}
}
On 1.7, i'd get this:
Node #1 at (l=0.0, t=0.0, r=6.0, b=70.0)px
|-Node #3 at (l=0.0, t=0.0, r=6.0, b=35.0)px
| Text = '[Header]'
| Actions = [SetTextSubstitution, ShowTextSubstitution, ClearTextSubstitution, GetTextLayoutResult]
|-Node #5 at (l=0.0, t=35.0, r=4.0, b=70.0)px
Text = '[Body]'
Actions = [SetTextSubstitution, ShowTextSubstitution, ClearTextSubstitution, GetTextLayoutResult]
And i get this in 1.9 (notice the extra node, node #4):
Node #1 at (l=0.0, t=0.0, r=6.0, b=70.0)px
|-Node #3 at (l=0.0, t=0.0, r=6.0, b=35.0)px
| Text = '[Header]'
| Actions = [ClearTextSubstitution, GetTextLayoutResult, SetTextSubstitution, ShowTextSubstitution]
|-Node #4 at (l=0.0, t=35.0, r=4.0, b=70.0)px
|-Node #5 at (l=0.0, t=35.0, r=4.0, b=70.0)px
Text = '[Body]'
Actions = [ClearTextSubstitution, GetTextLayoutResult, SetTextSubstitution, ShowTextSubstitution]
I have also tried using an unmerged tree on 1.7, but that node #4 is not there, even then. This is affecting how i write my test fixtures, so i'm curious what changed that's causing this.Kirill Grouchnikov
09/03/2025, 7:02 PMmattinger
09/03/2025, 7:16 PMKirill Grouchnikov
09/03/2025, 8:08 PMgraphicsLayer)
to https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/[…]ibility.kt;l=756;drc=2b5d7088b8ca441777eede6864a9ef741690d94c inside the implementation of AnimatedVisibility
to https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/[…]nsition.kt;l=893;drc=2b5d7088b8ca441777eede6864a9ef741690d94c which does use graphicsLayer
all the way down.mattinger
09/03/2025, 8:26 PM