From d7adc7ad13bd58bffc6cb097dde20539f90a5fe7 Mon Sep 17 00:00:00 2001 From: guojin31 Date: Thu, 10 Jul 2025 19:36:56 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: guojin31 --- .../src/input_method_private_member_test.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/unittest/cpp_test/src/input_method_private_member_test.cpp b/test/unittest/cpp_test/src/input_method_private_member_test.cpp index 4a6ed8f6c..f231cc58b 100644 --- a/test/unittest/cpp_test/src/input_method_private_member_test.cpp +++ b/test/unittest/cpp_test/src/input_method_private_member_test.cpp @@ -639,19 +639,23 @@ HWTEST_F(InputMethodPrivateMemberTest, III_TestRestoreInputMethod_001, TestSize. auto ret = service_->RestoreInputmethod(bundleName); EXPECT_EQ(ret, ErrorCode::ERROR_ENABLE_IME); - auto currentProp = InputMethodController::GetInstance()->GetCurrentInputMethod(); + auto userId = service_->GetCallingUserId(); + auto currentProp = ImeInfoInquirer::GetInstance().GetCurrentInputMethod(userId); ret = service_->RestoreInputmethod(currentProp->name); EXPECT_EQ(ret, ErrorCode::NO_ERROR); auto defaultIme = ImeInfoInquirer::GetInstance().GetDefaultIme(); ret = service_->RestoreInputmethod(defaultIme.bundleName); - EXPECT_EQ(ret, ErrorCode::NO_ERROR); + EXPECT_TRUE(ret == ErrorCode::NO_ERROR ||ret == ErrorCode::ERROR_IMSA_REBOOT_OLD_IME_NOT_STOP); bundleName = "com.example.newTestIme"; + EnabledStatus status = EnabledStatus::DISABLED; + ImeEnabledInfoManager::GetInstance().GetEnabledState(userId, bundleName, status); + EXPECT_TRUE(status == EnabledStatus::DISABLED); ret = service_->RestoreInputmethod(bundleName); - EXPECT_EQ(ret, ErrorCode::ERROR_IMSA_REBOOT_OLD_IME_NOT_STOP); + ImeEnabledInfoManager::GetInstance().GetEnabledState(userId, bundleName, status); + EXPECT_TRUE(status == EnabledStatus::BASIC_MODE); - auto userId = service_->GetCallingUserId(); UserSessionManager::GetInstance().RemoveUserSession(userId); ret = service_->RestoreInputmethod(defaultIme.bundleName); EXPECT_EQ(ret, ErrorCode::ERROR_NULL_POINTER); -- Gitee From 20f1e8e5da90450ee304804a158887b66fd466b9 Mon Sep 17 00:00:00 2001 From: guojin31 Date: Thu, 10 Jul 2025 16:02:42 +0000 Subject: [PATCH 2/3] update test/unittest/cpp_test/src/input_method_private_member_test.cpp. Signed-off-by: guojin31 --- .../cpp_test/src/input_method_private_member_test.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/test/unittest/cpp_test/src/input_method_private_member_test.cpp b/test/unittest/cpp_test/src/input_method_private_member_test.cpp index f231cc58b..2a6f36dae 100644 --- a/test/unittest/cpp_test/src/input_method_private_member_test.cpp +++ b/test/unittest/cpp_test/src/input_method_private_member_test.cpp @@ -650,11 +650,14 @@ HWTEST_F(InputMethodPrivateMemberTest, III_TestRestoreInputMethod_001, TestSize. bundleName = "com.example.newTestIme"; EnabledStatus status = EnabledStatus::DISABLED; - ImeEnabledInfoManager::GetInstance().GetEnabledState(userId, bundleName, status); - EXPECT_TRUE(status == EnabledStatus::DISABLED); + ImeInfoInquirer::GetInstance().systemConfig_.enableInputMethodFeature = true; + service_->EnableIme(userId, bundleName, "", status); + ImeEnabledInfoManager::GetInstance().GetEnabledStateInner(userId, bundleName, status); + EXPECT_EQ(status, EnabledStatus::DISABLED); ret = service_->RestoreInputmethod(bundleName); - ImeEnabledInfoManager::GetInstance().GetEnabledState(userId, bundleName, status); - EXPECT_TRUE(status == EnabledStatus::BASIC_MODE); + ImeEnabledInfoManager::GetInstance().GetEnabledStateInner(userId, bundleName, status); + EXPECT_EQ(status, EnabledStatus::BASIC_MODE); + ImeInfoInquirer::GetInstance().systemConfig_.enableInputMethodFeature = false; UserSessionManager::GetInstance().RemoveUserSession(userId); ret = service_->RestoreInputmethod(defaultIme.bundleName); -- Gitee From b04ea6f9b10b12817eb07b7184a73ff1134134ff Mon Sep 17 00:00:00 2001 From: guojin31 Date: Thu, 10 Jul 2025 16:04:11 +0000 Subject: [PATCH 3/3] update test/unittest/cpp_test/src/input_method_private_member_test.cpp. Signed-off-by: guojin31 --- test/unittest/cpp_test/src/input_method_private_member_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unittest/cpp_test/src/input_method_private_member_test.cpp b/test/unittest/cpp_test/src/input_method_private_member_test.cpp index 2a6f36dae..81de5ff33 100644 --- a/test/unittest/cpp_test/src/input_method_private_member_test.cpp +++ b/test/unittest/cpp_test/src/input_method_private_member_test.cpp @@ -654,7 +654,7 @@ HWTEST_F(InputMethodPrivateMemberTest, III_TestRestoreInputMethod_001, TestSize. service_->EnableIme(userId, bundleName, "", status); ImeEnabledInfoManager::GetInstance().GetEnabledStateInner(userId, bundleName, status); EXPECT_EQ(status, EnabledStatus::DISABLED); - ret = service_->RestoreInputmethod(bundleName); + service_->RestoreInputmethod(bundleName); ImeEnabledInfoManager::GetInstance().GetEnabledStateInner(userId, bundleName, status); EXPECT_EQ(status, EnabledStatus::BASIC_MODE); ImeInfoInquirer::GetInstance().systemConfig_.enableInputMethodFeature = false; -- Gitee