mirror of
https://gitee.com/openharmony/inputmethod_imf
synced 2024-11-27 00:41:04 +00:00
modify ut
Signed-off-by: zhaolinglan <zhaolinglan@huawei.com>
This commit is contained in:
parent
70c1ac826c
commit
6ee380c22b
@ -193,6 +193,41 @@ HWTEST_F(InputMethodEditorTest, testShowTextInputUnfocused, TestSize.Level0)
|
||||
EXPECT_EQ(ret, ErrorCode::ERROR_CLIENT_NOT_EDITABLE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testRequestInput001.
|
||||
* @tc.desc: InputMethodEditorTest RequestShowInput/RequestHideInput neither permitted nor focused.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(InputMethodEditorTest, testRequestInput001, TestSize.Level0)
|
||||
{
|
||||
IMSA_HILOGI("InputMethodEditorTest testRequestInput001 Test START");
|
||||
TddUtil::GetUnfocused();
|
||||
InputMethodEditorTest::inputMethodController_->Close();
|
||||
int32_t ret = InputMethodEditorTest::inputMethodController_->RequestShowInput();
|
||||
EXPECT_EQ(ret, ErrorCode::ERROR_STATUS_PERMISSION_DENIED);
|
||||
ret = InputMethodEditorTest::inputMethodController_->RequestHideInput();
|
||||
EXPECT_EQ(ret, ErrorCode::ERROR_STATUS_PERMISSION_DENIED);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testRequestInput002.
|
||||
* @tc.desc: InputMethodEditorTest RequestShowInput/RequestHideInput with permitted and not focused.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(InputMethodEditorTest, testRequestInput002, TestSize.Level0)
|
||||
{
|
||||
IMSA_HILOGI("InputMethodEditorTest testRequestInput002 Test START");
|
||||
TddUtil::GetUnfocused();
|
||||
InputMethodEditorTest::inputMethodController_->Close();
|
||||
TddUtil::SetTestTokenID(TddUtil::AllocTestTokenID(true, "undefine", { "ohos.permission.CONNECT_IME_ABILITY" }));
|
||||
int32_t ret = InputMethodEditorTest::inputMethodController_->RequestShowInput();
|
||||
EXPECT_EQ(ret, ErrorCode::NO_ERROR);
|
||||
ret = InputMethodEditorTest::inputMethodController_->RequestHideInput();
|
||||
EXPECT_EQ(ret, ErrorCode::NO_ERROR);
|
||||
TddUtil::RestoreSelfTokenID();
|
||||
TddUtil::SetTestTokenID(TddUtil::AllocTestTokenID(true, "undefine"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: test AttachFocused
|
||||
* @tc.desc: InputMethodEditorTest Attach Focused
|
||||
@ -397,39 +432,5 @@ HWTEST_F(InputMethodEditorTest, testRequestHideInput, TestSize.Level0)
|
||||
EXPECT_FALSE(imeListener_->keyboardState_);
|
||||
TddUtil::GetUnfocused();
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testRequestInput001.
|
||||
* @tc.desc: InputMethodEditorTest RequestShowInput/RequestHideInput neither permitted nor focused.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(InputMethodEditorTest, testRequestInput001, TestSize.Level0)
|
||||
{
|
||||
IMSA_HILOGI("InputMethodEditorTest testRequestInput001 Test START");
|
||||
TddUtil::GetUnfocused();
|
||||
InputMethodEditorTest::inputMethodController_->Close();
|
||||
int32_t ret = InputMethodEditorTest::inputMethodController_->RequestShowInput();
|
||||
EXPECT_EQ(ret, ErrorCode::ERROR_STATUS_PERMISSION_DENIED);
|
||||
ret = InputMethodEditorTest::inputMethodController_->RequestHideInput();
|
||||
EXPECT_EQ(ret, ErrorCode::ERROR_STATUS_PERMISSION_DENIED);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testRequestInput002.
|
||||
* @tc.desc: InputMethodEditorTest RequestShowInput/RequestHideInput with permitted and not focused.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(InputMethodEditorTest, testRequestInput002, TestSize.Level0)
|
||||
{
|
||||
IMSA_HILOGI("InputMethodEditorTest testRequestInput002 Test START");
|
||||
TddUtil::GetUnfocused();
|
||||
InputMethodEditorTest::inputMethodController_->Close();
|
||||
TddUtil::SetTestTokenID(TddUtil::AllocTestTokenID(true, "undefine", { "ohos.permission.CONNECT_IME_ABILITY" }));
|
||||
|
||||
int32_t ret = InputMethodEditorTest::inputMethodController_->RequestShowInput();
|
||||
EXPECT_EQ(ret, ErrorCode::NO_ERROR);
|
||||
ret = InputMethodEditorTest::inputMethodController_->RequestHideInput();
|
||||
EXPECT_EQ(ret, ErrorCode::NO_ERROR);
|
||||
}
|
||||
} // namespace MiscServices
|
||||
} // namespace OHOS
|
||||
|
Loading…
Reference in New Issue
Block a user