修复tdd用例失败问题

Signed-off-by: cy7717 <chenyu301@huawei.com>
This commit is contained in:
cy7717 2023-03-02 15:47:58 +08:00
parent 89b5231844
commit 4e7dfe215e
4 changed files with 10 additions and 8 deletions

View File

@ -549,7 +549,8 @@ int32_t InputMethodSystemAbility::OnSwitchInputMethod(const std::string &bundleN
IMSA_HILOGE("session is nullptr");
return ErrorCode::ERROR_NULL_POINTER;
}
return userSession_->OnInputMethodSwitched(FindProperty(bundleName), FindSubProperty(bundleName, name));
userSession_->OnInputMethodSwitched(FindProperty(bundleName), FindSubProperty(bundleName, name));
return ErrorCode::NO_ERROR;
}
Property InputMethodSystemAbility::FindProperty(const std::string &name)

View File

@ -486,7 +486,7 @@ sptr<IInputClient> PerUserSession::GetCurrentClient()
return currentClient;
}
int32_t PerUserSession::OnInputMethodSwitched(const Property &property, const SubProperty &subProperty)
void PerUserSession::OnInputMethodSwitched(const Property &property, const SubProperty &subProperty)
{
IMSA_HILOGD("PerUserSession::OnInputMethodSwitched");
std::lock_guard<std::recursive_mutex> lock(mtx);
@ -498,26 +498,25 @@ int32_t PerUserSession::OnInputMethodSwitched(const Property &property, const Su
}
int32_t ret = clientInfo->client->OnSwitchInput(property, subProperty);
if (ret != ErrorCode::NO_ERROR) {
IMSA_HILOGE("PerUserSession::OnSwitchInput failed, ret %{public}d", ret);
return ret;
IMSA_HILOGE(
"OnSwitchInput failed, ret: %{public}d, uid: %{public}d", ret, static_cast<int32_t>(clientInfo->uid));
continue;
}
}
if (subProperty.id != currentSubProperty.id) {
SetCurrentSubProperty(subProperty);
return ErrorCode::NO_ERROR;
return;
}
SetCurrentSubProperty(subProperty);
sptr<IInputMethodCore> core = GetImsCore(CURRENT_IME);
if (core == nullptr) {
IMSA_HILOGE("imsCore is nullptr");
return ErrorCode::ERROR_EX_NULL_POINTER;
return;
}
int32_t ret = core->SetSubtype(subProperty);
if (ret != ErrorCode::NO_ERROR) {
IMSA_HILOGE("PerUserSession::SetSubtype failed, ret %{public}d", ret);
return ret;
}
return ErrorCode::NO_ERROR;
}
SubProperty PerUserSession::GetCurrentSubProperty()

View File

@ -205,6 +205,7 @@ public:
static void TearDownTestCase(void)
{
IMSA_HILOGI("InputMethodAbilityTest::TearDownTestCase");
imc_->Close();
}
void SetUp()
{

View File

@ -73,6 +73,7 @@ void InputMethodSwitchTest::SetUpTestCase(void)
void InputMethodSwitchTest::TearDownTestCase(void)
{
IMSA_HILOGI("InputMethodSwitchTest::TearDownTestCase");
InputMethodController::GetInstance()->Close();
}
void InputMethodSwitchTest::SetUp(void)