diff --git a/frameworks/native/inputmethod_ability/src/input_method_ability.cpp b/frameworks/native/inputmethod_ability/src/input_method_ability.cpp index 8bf4cfa3d882a69e35b3c51fb20ff93b8ec7c6c4..d7b75ced2e1a420e464a587099ce92d91e550c38 100644 --- a/frameworks/native/inputmethod_ability/src/input_method_ability.cpp +++ b/frameworks/native/inputmethod_ability/src/input_method_ability.cpp @@ -782,17 +782,16 @@ int32_t InputMethodAbility::GetTextIndexAtCursorInner(int32_t &index) int32_t InputMethodAbility::GetTextConfig(TextTotalConfig &textConfig) { - IMSA_HILOGD("InputMethodAbility start."); + IMSA_HILOGI("InputMethodAbility start."); auto channel = GetInputDataChannelProxy(); if (channel == nullptr) { IMSA_HILOGE("channel is nullptr!"); return ErrorCode::ERROR_CLIENT_NULL_POINTER; } - TextTotalConfigInner textConfigInner = {}; - textConfigInner = InputMethodTools::GetInstance().TextTotalConfigToInner(textConfig); + TextTotalConfigInner textConfigInner = InputMethodTools::GetInstance().TextTotalConfigToInner(textConfig); auto ret = channel->GetTextConfig(textConfigInner); - textConfig = InputMethodTools::GetInstance().InnerToTextTotalConfig(textConfigInner); if (ret == ErrorCode::NO_ERROR) { + textConfig = InputMethodTools::GetInstance().InnerToTextTotalConfig(textConfigInner); textConfig.inputAttribute.bundleName = GetInputAttribute().bundleName; textConfig.inputAttribute.callingDisplayId = GetInputAttribute().callingDisplayId; textConfig.inputAttribute.windowId = textConfig.windowId; diff --git a/test/unittest/cpp_test/src/input_method_ability_test.cpp b/test/unittest/cpp_test/src/input_method_ability_test.cpp index 1e8483afeafe37029689c0a1e5dc71eb6b51bc7e..57c46241cf0e3a2fffdb11b091d68ced25b06c30 100644 --- a/test/unittest/cpp_test/src/input_method_ability_test.cpp +++ b/test/unittest/cpp_test/src/input_method_ability_test.cpp @@ -495,6 +495,11 @@ HWTEST_F(InputMethodAbilityTest, testSendFunctionKey, TestSize.Level0) auto ret = inputMethodAbility_->SendFunctionKey(funcKey); EXPECT_EQ(ret, ErrorCode::NO_ERROR); EXPECT_TRUE(TextListener::WaitSendFunctionKey(funcKey)); + + TextListener::ResetParam(); + ret = InputMethodAbilityInterface::GetInstance().SendFunctionKey(funcKey); + EXPECT_EQ(ret, ErrorCode::NO_ERROR); + EXPECT_TRUE(TextListener::WaitSendFunctionKey(funcKey)); } /** @@ -585,6 +590,11 @@ HWTEST_F(InputMethodAbilityTest, testGetTextConfig, TestSize.Level0) EXPECT_EQ(ret, ErrorCode::NO_ERROR); EXPECT_EQ(textTotalConfig.inputAttribute.inputPattern, textConfig.inputAttribute.inputPattern); EXPECT_EQ(textTotalConfig.inputAttribute.enterKeyType, textConfig.inputAttribute.enterKeyType); + + InputAttribute inputAttribute; + ret = InputMethodAbilityInterface::GetInstance().GetInputAttribute(inputAttribute); + EXPECT_EQ(ret, ErrorCode::NO_ERROR); + EXPECT_EQ(inputAttribute, textConfig.inputAttribute); } /**