admin管理员组文章数量:1122832
I have a composable with unit tests. When I add the clip modifier to it to clip the background to a particular shape, the unit tests verify click behavior starts to fail.
If I use default compose shape RoundCornerShape or CircleShape for the clip the tests pass, only when I use a custom shape (using Outline.Generic) the tests start failing.
// Layout
MyView.clip().background().border().padding().clickable().testTag("CONTAINER_TAG")
// Test
composeRule.onNodeWithTag("CONTAINER_TAG", true).performClick() // Fail only when clip modifier with custom shape is added.
I have a composable with unit tests. When I add the clip modifier to it to clip the background to a particular shape, the unit tests verify click behavior starts to fail.
If I use default compose shape RoundCornerShape or CircleShape for the clip the tests pass, only when I use a custom shape (using Outline.Generic) the tests start failing.
// Layout
MyView.clip().background().border().padding().clickable().testTag("CONTAINER_TAG")
// Test
composeRule.onNodeWithTag("CONTAINER_TAG", true).performClick() // Fail only when clip modifier with custom shape is added.
Share
Improve this question
edited Nov 23, 2024 at 16:37
Rachit Mishra
asked Nov 23, 2024 at 3:57
Rachit MishraRachit Mishra
6,1124 gold badges31 silver badges51 bronze badges
1 Answer
Reset to default -1clip().background().border().padding().clickable()
All this modifiers require values. For example:
.clip(shape: Shape)
.background(color: Color)
Or, if your code has this, can you provide mode code for understanding your problem ?
本文标签: androidCompose Adding clip modifier makes unit tests failStack Overflow
版权声明:本文标题:android - Compose: Adding clip modifier makes unit tests fail - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736299880a1930616.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论