Assigned
Status Update
Comments
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
commit df7e5823b5e0ad1a1da88a71b44708597848769f
Author: Andrey Kulikov <andreykulikov@google.com>
Date: Wed Dec 20 14:18:39 2023
Filter out deactivated nodes from SemanticNodes.children
In aosp/2787059 we started filtering out the deactivated nodes so users can't see them in their tests. However one use case was missed:
rule.onNodeWithTag("list")
.onChildren().assertCountEquals(expectedCount)
This code will still see the deactivated nodes as we are not filtering out deactivated nodes in the list returned by SemanticNode.children.
Test: new test in SubcomposeLayoutTest
Bug: 187188981
Bug: 305905580
Fixes: 317202262
Change-Id: I4fd3d6248fc5a24bdadfdd5c60afe31386fcf7d7
M compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/layout/SubcomposeLayoutTest.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/semantics/SemanticsNode.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/semantics/SemanticsOwner.kt
https://android-review.googlesource.com/2885026
Branch: androidx-main
commit df7e5823b5e0ad1a1da88a71b44708597848769f
Author: Andrey Kulikov <andreykulikov@google.com>
Date: Wed Dec 20 14:18:39 2023
Filter out deactivated nodes from SemanticNodes.children
In aosp/2787059 we started filtering out the deactivated nodes so users can't see them in their tests. However one use case was missed:
rule.onNodeWithTag("list")
.onChildren().assertCountEquals(expectedCount)
This code will still see the deactivated nodes as we are not filtering out deactivated nodes in the list returned by SemanticNode.children.
Test: new test in SubcomposeLayoutTest
Bug: 187188981
Bug: 305905580
Fixes: 317202262
Change-Id: I4fd3d6248fc5a24bdadfdd5c60afe31386fcf7d7
M compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/layout/SubcomposeLayoutTest.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/semantics/SemanticsNode.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/semantics/SemanticsOwner.kt
Description
There are usecases when users want to know the amount of visible children to assert it with the expected one. The current workaround could be something like:
But we need to provide an official api for this use case as well See: https://b.corp.google.com/issues/187188981#comment11 for the original discussion.