mattinger
06/02/2022, 2:14 AMoffset(5) should be less than line limit(0)
java.lang.IndexOutOfBoundsException: offset(5) should be less than line limit(0)
at android.text.TextLine.measure(TextLine.java:353)
at android.text.Layout.getHorizontal(Layout.java:1213)
at android.text.Layout.getHorizontal(Layout.java:1190)
at android.text.Layout.getPrimaryHorizontal(Layout.java:1160)
See thread for test code.@OptIn(ExperimentalComposeUiApi::class)
@Test
fun TestStyleIssue() {
composeRule.setContent {
MaterialTheme {
val keyboardController = LocalSoftwareKeyboardController.current
val (value, onValueChange) = remember { mutableStateOf("") }
TextField(
modifier = Modifier.testTag("input"),
value = value,
onValueChange = onValueChange,
textStyle = TextStyle(
fontFamily = FontFamily.SansSerif,
fontWeight = FontWeight.Normal,
fontSize = 14.sp,
lineHeight = 21.sp,
),
keyboardActions = KeyboardActions(
onDone = {
keyboardController?.hide()
}
),
keyboardOptions = KeyboardOptions(
imeAction = ImeAction.Done
)
)
}
}
composeRule.onNodeWithTag("input")
.assertExists()
.performTextInput("text0")
composeRule.onNodeWithTag("input")
.performImeAction()