修改tdd用例

Signed-off-by: cy7717 <chenyu301@huawei.com>
This commit is contained in:
cy7717 2023-01-19 11:13:48 +08:00
parent c96eb78bac
commit ee98efcb00
4 changed files with 16 additions and 23 deletions

View File

@ -124,6 +124,10 @@ std::string ImeCfgManager::GetDefaultIme()
void ImeCfgManager::FromJson(const json &jsonConfigs, std::vector<ImeCfg> &configs)
{
if (!jsonConfigs.contains("imeCfg_list")) {
IMSA_HILOGE("imeCfg_list not find");
return;
}
for (auto &jsonCfg : jsonConfigs["imeCfg_list"]) {
ImeCfg cfg;
FromJson(jsonCfg, cfg);

View File

@ -197,5 +197,6 @@ ohos_unittest("InputMethodPrivateMemberTest") {
"imf:inputmethod_client",
"ipc:ipc_core",
"ipc:ipc_single",
"os_account:os_account_innerkits",
]
}

View File

@ -94,7 +94,7 @@ HWTEST_F(InputMethodDfxTest, InputMethodDfxTest_DumpAllMethod_001, TestSize.Leve
EXPECT_TRUE(ret);
EXPECT_NE(result.find("get input method"), std::string::npos);
EXPECT_NE(result.find("imeList"), std::string::npos);
EXPECT_NE(result.find("isDefaultIme"), std::string::npos);
EXPECT_NE(result.find("isCurrentIme"), std::string::npos);
}
/**

View File

@ -27,6 +27,8 @@
#include "application_info.h"
#include "global.h"
#include "ime_cfg_manager.h"
#include "os_account_manager.h"
using namespace testing::ext;
namespace OHOS {
namespace MiscServices {
@ -227,9 +229,14 @@ HWTEST_F(InputMethodPrivateMemberTest, SA_GetUserSessionWithInexistentUserId, Te
HWTEST_F(InputMethodPrivateMemberTest, SA_FindSubPropertyWithInexistentSubLabel, TestSize.Level0)
{
InputMethodSystemAbility service;
auto prop = service.GetCurrentInputMethod();
ASSERT_TRUE(prop != nullptr);
auto subProp = service.FindSubProperty(prop->name, "");
std::vector<int32_t> userIds;
if (AccountSA::OsAccountManager::QueryActiveOsAccountIds(userIds) == ERR_OK && !userIds.empty()) {
service.userId_ = userIds[0];
}
auto ime = ImeCfgManager::GetDefaultIme();
EXPECT_FALSE(ime.empty());
auto pos = ime.find("/");
auto subProp = service.FindSubProperty(ime.substr(0, pos), "");
EXPECT_EQ(subProp.name, "");
}
@ -247,25 +254,6 @@ HWTEST_F(InputMethodPrivateMemberTest, SA_FindSubPropertyByCompareWithNullBundle
EXPECT_EQ(subProp.label, "");
}
/**
* @tc.name: SA_FindSubPropertyByCompare
* @tc.desc: SA FindSubPropertyByCompare
* @tc.type: FUNC
* @tc.require: issuesI669E8
*/
HWTEST_F(InputMethodPrivateMemberTest, SA_FindSubPropertyByCompare, TestSize.Level0)
{
InputMethodSystemAbility service;
auto prop = service.GetCurrentInputMethod();
ASSERT_TRUE(prop != nullptr);
auto subProp = service.GetCurrentInputMethodSubtype();
ASSERT_TRUE(subProp != nullptr);
auto subProp1 = service.FindSubPropertyByCompare(
prop->name, [subProp](const SubProperty &subProperty) { return subProperty.mode == subProp->mode; });
EXPECT_EQ(subProp1.mode, subProp->mode);
EXPECT_EQ(subProp1.label, subProp->label);
}
/**
* @tc.name: IMC_ListInputMethodCommonWithErrorStatus
* @tc.desc: IMC ListInputMethodCommon With Error Status.