android - 将 Compose 语义树打印到日志
问题描述
我正在Jetpack Compose Codelab 中进行测试,但我无法使用节点上的函数打印语义树。printToLog
我在androidTest
包内使用此代码。
import androidx.compose.ui.test.printToLog
...
//testing function
@Test
fun rallyTopAppBarTest() {
val allScreen = RallyScreen.values().toList()
testRule.setContent {
//the component be tested in isolation goes here
RallyTopAppBar(
allScreens = allScreen,
onTabSelected = {},
currentScreen = RallyScreen.Accounts
)
}
testRule.onRoot().printToLog("currentLabelExists")
....
}
我已经使用标签检查了我的 LogCat调试和详细过滤,"currentLabelExists"
但语义树没有在日志上打印。
关于我可能会错过的任何想法。
解决方案
推荐阅读
- matlab - 如何在 simulink 模型中定义变量(而不是在工作区中)?
- javascript - 使用 ES6 导入时的执行顺序说明?
- bash - 将 yaml 数组转换为字符串数组
- python - 逻辑回归给了我 0.55 的精度。我的代码有什么问题?
- vue.js - 试图让 2 个应用程序在 nginx 上运行的配置问题
- java - 对一个对象的更改无意中更改了另一个对象
- php - PHP通过其他csv删除csv行
- flutter - 我可以从匹配多个文档的查询中读取 Flutter 中的 Firestore 事务吗
- c# - 无法使用 appium 和 c# 在 ionic5 应用程序中检测选择器元素
- javascript - 我如何记录数组中正确元素的索引,答案不是 -1