Venkataramanan Parameswaran
12/30/2024, 5:58 PMZach Klippenstein (he/him) [MOD]
12/30/2024, 8:20 PMVenkataramanan Parameswaran
12/31/2024, 6:47 AM@OptIn(ExperimentalComposeUiApi::class)
@Test
fun keyboardOptionsTest() {
rule.setContent {
InterceptPlatformTextInput(
interceptor = { request, nextHandler ->
val modifiedRequest =
object : PlatformTextInputMethodRequest {
override fun createInputConnection(outAttributes: EditorInfo): InputConnection {
Log.d(">>>", "create input connection is called with inputType: ${outAttributes.inputType}")
Log.d(">>>", "create input connection is called with imeOptions: ${outAttributes.imeOptions}")
val inputConnection = request.createInputConnection(outAttributes)
return inputConnection
}
}
// Send our wrapping request to the next handler, which could be the system or another
// interceptor up the tree.
nextHandler.startInputMethod(modifiedRequest)
}
) {
var value by remember { mutableStateOf("") }
BasicTextField(
value = value,
onValueChange = {
value = it
},
modifier = Modifier.testTag(TEXT_INPUT_TEST_TAG),
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number)
)
}
}
rule.onNodeWithTag(TEXT_INPUT_TEST_TAG).performTextClearance()
rule.onNodeWithTag(TEXT_INPUT_TEST_TAG).performTextInput("98")
rule.onNodeWithTag(TEXT_INPUT_TEST_TAG).assert(hasText("98"))
}
I tried with this test with keyboardOptions KeyboardType.Number and Keyboard.Text but all the time i'm getting inputType and imeOptions as 0 only in the createInputConnection method.Zach Klippenstein (he/him) [MOD]
12/31/2024, 4:31 PMVenkataramanan Parameswaran
01/03/2025, 5:41 AM