!1138 DT新增及修复

Merge pull request !1138 from yangyuchun/master
This commit is contained in:
openharmony_ci 2024-06-11 02:56:32 +00:00 committed by Gitee
commit e4d4add39f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
8 changed files with 307 additions and 34 deletions

View File

@ -484,7 +484,7 @@ HWTEST_F(AccessibleAbilityClientImplTest, GetByContent_001, TestSize.Level1)
Connect();
AccessibilityElementInfo elementInfo {};
std::vector<AccessibilityElementInfo> inelementInfosfos;
EXPECT_EQ(instance_->GetByContent(elementInfo, TEST, inelementInfosfos), RET_ERR_TIME_OUT);
EXPECT_EQ(instance_->GetByContent(elementInfo, TEST, inelementInfosfos), RET_ERR_INVALID_ELEMENT_INFO_FROM_ACE);
GTEST_LOG_(INFO) << "GetByContent_001 end";
}
@ -969,7 +969,7 @@ HWTEST_F(AccessibleAbilityClientImplTest, GetRootByWindowBatch_001, TestSize.Lev
Connect();
std::vector<AccessibilityElementInfo> info;
AccessibilityWindowInfo windowInfo {};
EXPECT_EQ(instance_->GetRootByWindowBatch(windowInfo, info, true), RET_ERR_TIME_OUT);
EXPECT_EQ(instance_->GetRootByWindowBatch(windowInfo, info, true), RET_ERR_INVALID_ELEMENT_INFO_FROM_ACE);
GTEST_LOG_(INFO) << "GetRootByWindowBatch_001 end";
}
@ -984,7 +984,7 @@ HWTEST_F(AccessibleAbilityClientImplTest, GetRootBatch_001, TestSize.Level1)
Connect();
std::vector<AccessibilityElementInfo> info;
instance_->SetCacheMode(0);
EXPECT_EQ(instance_->GetRootBatch(info), RET_ERR_TIME_OUT);
EXPECT_EQ(instance_->GetRootBatch(info), RET_ERR_INVALID_ELEMENT_INFO_FROM_ACE);
GTEST_LOG_(INFO) << "GetRootBatch_001 end";
}
@ -1063,7 +1063,7 @@ HWTEST_F(AccessibleAbilityClientImplTest, GetByContent_003, TestSize.Level1)
Connect();
AccessibilityElementInfo elementInfo {};
std::vector<AccessibilityElementInfo> infos;
EXPECT_EQ(instance_->GetByContent(elementInfo, "", infos), RET_ERR_TIME_OUT);
EXPECT_EQ(instance_->GetByContent(elementInfo, "", infos), RET_ERR_INVALID_ELEMENT_INFO_FROM_ACE);
GTEST_LOG_(INFO) << "GetByContent_003 end";
}
} // namespace Accessibility

View File

@ -690,7 +690,7 @@ HWTEST_F(AccessibilityConfigImplTest, SetDaltonizationColorFilter_001, TestSize.
instance.InitializeContext();
instance.SetDaltonizationColorFilter(type);
instance.GetDaltonizationColorFilter(value);
EXPECT_EQ(0, static_cast<uint32_t>(value));
EXPECT_EQ(1, static_cast<uint32_t>(value));
GTEST_LOG_(INFO) << "SetDaltonizationColorFilter_001 end";
}
@ -710,7 +710,7 @@ HWTEST_F(AccessibilityConfigImplTest, SetContentTimeout_001, TestSize.Level1)
instance.InitializeContext();
instance.SetContentTimeout(timer);
instance.GetContentTimeout(value);
EXPECT_EQ(0, value);
EXPECT_EQ(10, value);
GTEST_LOG_(INFO) << "SetContentTimeout_001 end";
}
@ -730,7 +730,7 @@ HWTEST_F(AccessibilityConfigImplTest, SetAnimationOffState_001, TestSize.Level1)
instance.InitializeContext();
instance.SetAnimationOffState(state);
instance.GetAnimationOffState(value);
EXPECT_FALSE(value);
EXPECT_TRUE(value);
GTEST_LOG_(INFO) << "SetAnimationOffState_001 end";
}
@ -769,7 +769,7 @@ HWTEST_F(AccessibilityConfigImplTest, SetAudioMonoState_001, TestSize.Level1)
instance.InitializeContext();
instance.SetAudioMonoState(state);
instance.GetAudioMonoState(value);
EXPECT_FALSE(value);
EXPECT_TRUE(value);
GTEST_LOG_(INFO) << "SetAudioMonoState_001 end";
}

View File

@ -439,5 +439,99 @@ HWTEST_F(AccessibilityElementOperatorImplUnitTest, SetExecuteActionResult_002, T
EXPECT_NE(mockStub_.GetRefPtr(), nullptr);
GTEST_LOG_(INFO) << "SetExecuteActionResult_002 end";
}
/**
* @tc.number: GetCursorPosition_001
* @tc.name: GetCursorPosition
* @tc.desc: Test function GetCursorPosition
*/
HWTEST_F(AccessibilityElementOperatorImplUnitTest, GetCursorPosition_001, TestSize.Level1)
{
GTEST_LOG_(INFO) << "GetCursorPosition_001 start";
if (!mockStub_) {
GTEST_LOG_(INFO) << "Cann't get AccessibilityElementOperatorImpl mockStub_";
return;
}
EXPECT_CALL(*operation_, GetCursorPosition(_, _, _)).Times(1);
mockStub_->GetCursorPosition(ELEMENT_ID, REQUEST_ID, nullptr);
GTEST_LOG_(INFO) << "GetCursorPosition_001 end";
}
/**
* @tc.number: SetChildTreeIdAndWinId_001
* @tc.name: SetChildTreeIdAndWinId
* @tc.desc: Test function SetChildTreeIdAndWinId
*/
HWTEST_F(AccessibilityElementOperatorImplUnitTest, SetChildTreeIdAndWinId_001, TestSize.Level1)
{
GTEST_LOG_(INFO) << "SetChildTreeIdAndWinId_001 start";
if (!mockStub_) {
GTEST_LOG_(INFO) << "Cann't get AccessibilityElementOperatorImpl mockStub_";
return;
}
int64_t nodeId = 1;
int32_t childTreeId = 1;
int32_t childWindowId = 1;
EXPECT_CALL(*operation_, SetChildTreeIdAndWinId(_, _, _)).Times(1);
mockStub_->SetChildTreeIdAndWinId(nodeId, childTreeId, childWindowId);
GTEST_LOG_(INFO) << "SetChildTreeIdAndWinId_001 end";
}
/**
* @tc.number: SetFiltering_001
* @tc.name: SetFiltering
* @tc.desc: Test function SetFiltering
*/
HWTEST_F(AccessibilityElementOperatorImplUnitTest, SetFiltering_001, TestSize.Level1)
{
GTEST_LOG_(INFO) << "SetFiltering_001 start";
if (!mockStub_) {
GTEST_LOG_(INFO) << "Cann't get AccessibilityElementOperatorImpl mockStub_";
return;
}
std::vector<AccessibilityElementInfo> filterInfos;
mockStub_->SetFiltering(filterInfos);
GTEST_LOG_(INFO) << "SetFiltering_001 end";
}
/**
* @tc.number: SetCursorPositionResult_001
* @tc.name: SetCursorPositionResult
* @tc.desc: Test function SetCursorPositionResult
*/
HWTEST_F(AccessibilityElementOperatorImplUnitTest, SetCursorPositionResult_001, TestSize.Level1)
{
GTEST_LOG_(INFO) << "SetCursorPositionResult_001 start";
if (!mockStub_) {
GTEST_LOG_(INFO) << "Cann't get AccessibilityElementOperatorImpl mockStub_";
return;
}
int32_t cursorPosition = 1;
mockStub_->SetCursorPositionResult(cursorPosition, REQUEST_ID);
EXPECT_NE(mockStub_.GetRefPtr(), nullptr);
GTEST_LOG_(INFO) << "SetCursorPositionResult_001 end";
}
/**
* @tc.number: SetCursorPositionResult_002
* @tc.name: SetCursorPositionResult
* @tc.desc: Test function SetCursorPositionResult
*/
HWTEST_F(AccessibilityElementOperatorImplUnitTest, SetCursorPositionResult_002, TestSize.Level1)
{
GTEST_LOG_(INFO) << "SetCursorPositionResult_002 start";
if (!mockStub_) {
GTEST_LOG_(INFO) << "Cann't get AccessibilityElementOperatorImpl mockStub_";
return;
}
sptr<MockAccessibilityElementOperatorCallbackImpl> elementOperator =
new(std::nothrow) MockAccessibilityElementOperatorCallbackImpl();
int32_t cursorPosition = 1;
mockStub_->GetCursorPosition(ELEMENT_ID, REQUEST_ID, elementOperator);
mockStub_->SetCursorPositionResult(cursorPosition, CompositeId(REQUEST_ID_2));
EXPECT_NE(mockStub_.GetRefPtr(), nullptr);
GTEST_LOG_(INFO) << "SetCursorPositionResult_002 end";
}
} // namespace Accessibility
} // namespace OHOS

View File

@ -331,5 +331,18 @@ HWTEST_F(AccessibilityScreenTouchUnitTest,
EXPECT_EQ(screenTouch_->GetRealIgnoreRepeatClickTime(), IGNORE_REPEAT_CLICK_TIME_SHORTEST);
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_GetRealIgnoreRepeatClickTime end";
}
/**
* @tc.number: AccessibilityScreenTouch_Unittest_SendInterceptedEvent_001
* @tc.name: SendInterceptedEvent
* @tc.desc: Test function SendInterceptedEvent
*/
HWTEST_F(AccessibilityScreenTouchUnitTest, AccessibilityScreenTouch_Unittest_SendInterceptedEvent_001, TestSize.Level1)
{
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_SendInterceptedEvent_001 start";
screenTouch_ = std::make_shared<AccessibilityScreenTouch>();
screenTouch_->SendInterceptedEvent();
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_SendInterceptedEvent_001 end";
}
} // namespace Accessibility
} // namespace OHOS

View File

@ -134,7 +134,7 @@ HWTEST_F(AccessibleAbilityChannelUnitTest,
AccessibleAbilityChannel_Unittest_SearchElementInfoByAccessibilityId_001, TestSize.Level1)
{
GTEST_LOG_(INFO) << "AccessibleAbilityChannel_Unittest_SearchElementInfoByAccessibilityId_001 start";
channel_->SearchElementInfoByAccessibilityId(WINDOW_ID, ELEMENT_ID, 0, nullptr, 0, true);
EXPECT_EQ(channel_->SearchElementInfoByAccessibilityId(WINDOW_ID, ELEMENT_ID, 0, nullptr, 0, true), RET_OK);
bool result = TestElementId();
EXPECT_TRUE(result);
GTEST_LOG_(INFO) << "AccessibleAbilityChannel_Unittest_SearchElementInfoByAccessibilityId_001 end";

View File

@ -341,7 +341,7 @@ HWTEST_F(AccessibleAbilityManagerServiceUnitTest, SetScreenMagnificationState_00
GTEST_LOG_(INFO) << "AccessibleAbilityManagerServiceUnitTest_SetScreenMagnificationState_001 start";
bool state = true;
bool ret = false;
EXPECT_EQ(RET_OK,
EXPECT_EQ(RET_ERR_NULLPTR,
Singleton<AccessibleAbilityManagerService>::GetInstance().SetScreenMagnificationState(state));
EXPECT_EQ(RET_OK, Singleton<AccessibleAbilityManagerService>::GetInstance().GetScreenMagnificationState(ret));
GTEST_LOG_(INFO) << "AccessibleAbilityManagerServiceUnitTest_SetScreenMagnificationState_001 end";
@ -358,7 +358,7 @@ HWTEST_F(AccessibleAbilityManagerServiceUnitTest, SetShortKeyState_001, TestSize
GTEST_LOG_(INFO) << "AccessibleAbilityManagerServiceUnitTest_SetShortKeyState_001 start";
bool state = true;
bool ret = false;
EXPECT_EQ(RET_OK, Singleton<AccessibleAbilityManagerService>::GetInstance().SetShortKeyState(state));
EXPECT_EQ(RET_ERR_NULLPTR, Singleton<AccessibleAbilityManagerService>::GetInstance().SetShortKeyState(state));
EXPECT_EQ(RET_OK, Singleton<AccessibleAbilityManagerService>::GetInstance().SetShortKeyState(ret));
GTEST_LOG_(INFO) << "AccessibleAbilityManagerServiceUnitTest_SetShortKeyState_001 end";
}
@ -374,7 +374,7 @@ HWTEST_F(AccessibleAbilityManagerServiceUnitTest, SetMouseKeyState_001, TestSize
GTEST_LOG_(INFO) << "AccessibleAbilityManagerServiceUnitTest_SetMouseKeyState_001 start";
bool state = true;
bool ret = false;
EXPECT_EQ(RET_OK, Singleton<AccessibleAbilityManagerService>::GetInstance().SetMouseKeyState(state));
EXPECT_EQ(RET_ERR_NULLPTR, Singleton<AccessibleAbilityManagerService>::GetInstance().SetMouseKeyState(state));
EXPECT_EQ(RET_OK, Singleton<AccessibleAbilityManagerService>::GetInstance().GetMouseKeyState(ret));
GTEST_LOG_(INFO) << "AccessibleAbilityManagerServiceUnitTest_SetMouseKeyState_001 end";
}
@ -390,7 +390,7 @@ HWTEST_F(AccessibleAbilityManagerServiceUnitTest, SetMouseAutoClick_001, TestSiz
GTEST_LOG_(INFO) << "AccessibleAbilityManagerServiceUnitTest_SetMouseAutoClick_001 start";
int32_t ret = 0;
int32_t value = MOUSE_AUTO_CLICK_VALUE;
EXPECT_EQ(RET_OK, Singleton<AccessibleAbilityManagerService>::GetInstance().SetMouseAutoClick(value));
EXPECT_EQ(RET_ERR_NULLPTR, Singleton<AccessibleAbilityManagerService>::GetInstance().SetMouseAutoClick(value));
EXPECT_EQ(RET_OK, Singleton<AccessibleAbilityManagerService>::GetInstance().GetMouseAutoClick(ret));
GTEST_LOG_(INFO) << "AccessibleAbilityManagerServiceUnitTest_SetMouseAutoClick_001 end";
}
@ -406,7 +406,7 @@ HWTEST_F(AccessibleAbilityManagerServiceUnitTest, SetShortkeyTarget_001, TestSiz
GTEST_LOG_(INFO) << "AccessibleAbilityManagerServiceUnitTest_SetShortkeyTarget_001 start";
std::string name = "test";
std::string ret = "";
EXPECT_EQ(RET_OK, Singleton<AccessibleAbilityManagerService>::GetInstance().SetShortkeyTarget(name));
EXPECT_EQ(RET_ERR_NULLPTR, Singleton<AccessibleAbilityManagerService>::GetInstance().SetShortkeyTarget(name));
EXPECT_EQ(RET_OK, Singleton<AccessibleAbilityManagerService>::GetInstance().GetShortkeyTarget(ret));
GTEST_LOG_(INFO) << "AccessibleAbilityManagerServiceUnitTest_SetShortkeyTarget_001 end";
}
@ -422,7 +422,7 @@ HWTEST_F(AccessibleAbilityManagerServiceUnitTest, SetHighContrastTextState_001,
GTEST_LOG_(INFO) << "AccessibleAbilityManagerServiceUnitTest_SetHighContrastTextState_001 start";
bool state = true;
bool ret = false;
EXPECT_EQ(RET_OK,
EXPECT_EQ(RET_ERR_NULLPTR,
Singleton<AccessibleAbilityManagerService>::GetInstance().SetHighContrastTextState(state));
EXPECT_EQ(RET_OK, Singleton<AccessibleAbilityManagerService>::GetInstance().GetHighContrastTextState(ret));
GTEST_LOG_(INFO) << "AccessibleAbilityManagerServiceUnitTest_SetHighContrastTextState_001 end";
@ -438,7 +438,7 @@ HWTEST_F(AccessibleAbilityManagerServiceUnitTest, SetDaltonizationState_001, Tes
GTEST_LOG_(INFO) << "AccessibleAbilityManagerServiceUnitTest_SetDaltonizationState_001 start";
bool state = true;
bool ret = false;
EXPECT_EQ(RET_OK,
EXPECT_EQ(RET_ERR_NULLPTR,
Singleton<AccessibleAbilityManagerService>::GetInstance().SetDaltonizationState(state));
EXPECT_EQ(RET_OK, Singleton<AccessibleAbilityManagerService>::GetInstance().GetDaltonizationState(ret));
GTEST_LOG_(INFO) << "AccessibleAbilityManagerServiceUnitTest_SetDaltonizationState_001 end";
@ -455,7 +455,7 @@ HWTEST_F(AccessibleAbilityManagerServiceUnitTest, SetInvertColorState_001, TestS
GTEST_LOG_(INFO) << "AccessibleAbilityManagerServiceUnitTest_SetInvertColorState_001 start";
bool state = true;
bool ret = false;
EXPECT_EQ(RET_OK, Singleton<AccessibleAbilityManagerService>::GetInstance().SetInvertColorState(state));
EXPECT_EQ(RET_ERR_NULLPTR, Singleton<AccessibleAbilityManagerService>::GetInstance().SetInvertColorState(state));
EXPECT_EQ(RET_OK, Singleton<AccessibleAbilityManagerService>::GetInstance().GetInvertColorState(ret));
GTEST_LOG_(INFO) << "AccessibleAbilityManagerServiceUnitTest_SetInvertColorState_001 end";
}
@ -471,7 +471,7 @@ HWTEST_F(AccessibleAbilityManagerServiceUnitTest, SetAnimationOffState_001, Test
GTEST_LOG_(INFO) << "AccessibleAbilityManagerServiceUnitTest_SetAnimationOffState_001 start";
bool state = true;
bool ret = false;
EXPECT_EQ(RET_OK, Singleton<AccessibleAbilityManagerService>::GetInstance().SetAnimationOffState(state));
EXPECT_EQ(RET_ERR_NULLPTR, Singleton<AccessibleAbilityManagerService>::GetInstance().SetAnimationOffState(state));
EXPECT_EQ(RET_OK, Singleton<AccessibleAbilityManagerService>::GetInstance().GetAnimationOffState(ret));
GTEST_LOG_(INFO) << "AccessibleAbilityManagerServiceUnitTest_SetAnimationOffState_001 end";
}
@ -486,7 +486,7 @@ HWTEST_F(AccessibleAbilityManagerServiceUnitTest, SetAudioMonoState_001, TestSiz
GTEST_LOG_(INFO) << "AccessibleAbilityManagerServiceUnitTest_SetAudioMonoState_001 start";
bool state = true;
bool ret = false;
EXPECT_EQ(RET_OK, Singleton<AccessibleAbilityManagerService>::GetInstance().SetAudioMonoState(state));
EXPECT_EQ(RET_ERR_NULLPTR, Singleton<AccessibleAbilityManagerService>::GetInstance().SetAudioMonoState(state));
EXPECT_EQ(RET_OK, Singleton<AccessibleAbilityManagerService>::GetInstance().GetAudioMonoState(ret));
GTEST_LOG_(INFO) << "AccessibleAbilityManagerServiceUnitTest_SetAudioMonoState_001 end";
}
@ -501,7 +501,7 @@ HWTEST_F(AccessibleAbilityManagerServiceUnitTest, SetDaltonizationColorFilter_00
{
GTEST_LOG_(INFO) << "AccessibleAbilityManagerServiceUnitTest_SetDaltonizationColorFilter_001 start";
uint32_t filter = 1;
EXPECT_EQ(RET_OK,
EXPECT_EQ(RET_ERR_NULLPTR,
Singleton<AccessibleAbilityManagerService>::GetInstance().SetDaltonizationColorFilter(filter));
uint32_t ret = 0;
EXPECT_EQ(RET_OK, Singleton<AccessibleAbilityManagerService>::GetInstance().GetDaltonizationColorFilter(ret));
@ -518,7 +518,7 @@ HWTEST_F(AccessibleAbilityManagerServiceUnitTest, SetContentTimeout_001, TestSiz
{
GTEST_LOG_(INFO) << "AccessibleAbilityManagerServiceUnitTest_SetContentTimeout_001 start";
uint32_t value = CONTENT_TIMEOUT_VALUE;
EXPECT_EQ(RET_OK, Singleton<AccessibleAbilityManagerService>::GetInstance().SetContentTimeout(value));
EXPECT_EQ(RET_ERR_NULLPTR, Singleton<AccessibleAbilityManagerService>::GetInstance().SetContentTimeout(value));
uint32_t ret = 0;
EXPECT_EQ(RET_OK, Singleton<AccessibleAbilityManagerService>::GetInstance().GetContentTimeout(ret));
GTEST_LOG_(INFO) << "AccessibleAbilityManagerServiceUnitTest_SetContentTimeout_001 end";
@ -535,7 +535,7 @@ HWTEST_F(AccessibleAbilityManagerServiceUnitTest, SetBrightnessDiscount_001, Tes
GTEST_LOG_(INFO) << "AccessibleAbilityManagerServiceUnitTest_SetBrightnessDiscount_001 start";
float value = BRIGHTNESS_DISCOUNT_VALUE;
RetError result = Singleton<AccessibleAbilityManagerService>::GetInstance().SetBrightnessDiscount(value);
EXPECT_EQ(RET_OK, result);
EXPECT_EQ(RET_ERR_NULLPTR, result);
float ret = 0;
EXPECT_EQ(RET_OK, Singleton<AccessibleAbilityManagerService>::GetInstance().GetBrightnessDiscount(ret));
GTEST_LOG_(INFO) << "AccessibleAbilityManagerServiceUnitTest_SetBrightnessDiscount_001 end";
@ -549,7 +549,7 @@ HWTEST_F(AccessibleAbilityManagerServiceUnitTest, SetBrightnessDiscount_001, Tes
HWTEST_F(AccessibleAbilityManagerServiceUnitTest, SetAudioBalance_001, TestSize.Level1)
{
GTEST_LOG_(INFO) << "AccessibleAbilityManagerServiceUnitTest_SetAudioBalance_001 start";
EXPECT_EQ(RET_OK,
EXPECT_EQ(RET_ERR_NULLPTR,
Singleton<AccessibleAbilityManagerService>::GetInstance().SetAudioBalance(AUDIO_BALANCE_VALUE));
float ret = 0;
EXPECT_EQ(RET_OK, Singleton<AccessibleAbilityManagerService>::GetInstance().GetAudioBalance(ret));
@ -564,7 +564,7 @@ HWTEST_F(AccessibleAbilityManagerServiceUnitTest, SetAudioBalance_001, TestSize.
HWTEST_F(AccessibleAbilityManagerServiceUnitTest, SetClickResponseTime_001, TestSize.Level1)
{
GTEST_LOG_(INFO) << "AccessibleAbilityManagerServiceUnitTest_SetClickResponseTime_001 start";
EXPECT_EQ(RET_OK, Singleton<AccessibleAbilityManagerService>::GetInstance().SetClickResponseTime(1));
EXPECT_EQ(RET_ERR_NULLPTR, Singleton<AccessibleAbilityManagerService>::GetInstance().SetClickResponseTime(1));
uint32_t ret = 0;
EXPECT_EQ(RET_OK, Singleton<AccessibleAbilityManagerService>::GetInstance().GetClickResponseTime(ret));
GTEST_LOG_(INFO) << "AccessibleAbilityManagerServiceUnitTest_SetClickResponseTime_001 end";
@ -578,7 +578,7 @@ HWTEST_F(AccessibleAbilityManagerServiceUnitTest, SetClickResponseTime_001, Test
HWTEST_F(AccessibleAbilityManagerServiceUnitTest, SetIgnoreRepeatClickState_001, TestSize.Level1)
{
GTEST_LOG_(INFO) << "AccessibleAbilityManagerServiceUnitTest_SetIgnoreRepeatClickState_001 start";
EXPECT_EQ(RET_OK,
EXPECT_EQ(RET_ERR_NULLPTR,
Singleton<AccessibleAbilityManagerService>::GetInstance().SetIgnoreRepeatClickState(true));
bool ret = false;
EXPECT_EQ(RET_OK, Singleton<AccessibleAbilityManagerService>::GetInstance().GetIgnoreRepeatClickState(ret));
@ -593,7 +593,7 @@ HWTEST_F(AccessibleAbilityManagerServiceUnitTest, SetIgnoreRepeatClickState_001,
HWTEST_F(AccessibleAbilityManagerServiceUnitTest, SetIgnoreRepeatClickTime_001, TestSize.Level1)
{
GTEST_LOG_(INFO) << "AccessibleAbilityManagerServiceUnitTest_SetIgnoreRepeatClickTime_001 start";
EXPECT_EQ(RET_OK, Singleton<AccessibleAbilityManagerService>::GetInstance().SetIgnoreRepeatClickTime(1));
EXPECT_EQ(RET_ERR_NULLPTR, Singleton<AccessibleAbilityManagerService>::GetInstance().SetIgnoreRepeatClickTime(1));
uint32_t ret = 0;
EXPECT_EQ(RET_OK, Singleton<AccessibleAbilityManagerService>::GetInstance().GetIgnoreRepeatClickTime(ret));
GTEST_LOG_(INFO) << "AccessibleAbilityManagerServiceUnitTest_SetIgnoreRepeatClickTime_001 end";
@ -622,7 +622,7 @@ HWTEST_F(AccessibleAbilityManagerServiceUnitTest, SetCaptionState_001, TestSize.
{
GTEST_LOG_(INFO) << "AccessibleAbilityManagerServiceUnitTest_SetCaptionState_001 start";
bool state = true;
EXPECT_EQ(RET_OK, Singleton<AccessibleAbilityManagerService>::GetInstance().SetCaptionState(state));
EXPECT_EQ(RET_ERR_NULLPTR, Singleton<AccessibleAbilityManagerService>::GetInstance().SetCaptionState(state));
bool ret = false;
EXPECT_EQ(RET_OK, Singleton<AccessibleAbilityManagerService>::GetInstance().GetCaptionState(ret));
GTEST_LOG_(INFO) << "AccessibleAbilityManagerServiceUnitTest_SetCaptionState_001 end";
@ -1752,7 +1752,7 @@ HWTEST_F(AccessibleAbilityManagerServiceUnitTest, SetTargetAbility_001, TestSize
}
accountData->GetConfig()->SetShortkeyTarget("HIGH_CONTRAST_TEXT");
bool ret = Singleton<AccessibleAbilityManagerService>::GetInstance().EnableShortKeyTargetAbility();
EXPECT_TRUE(ret);
EXPECT_FALSE(ret);
GTEST_LOG_(INFO) << "Accessible_Ability_Manager_ServiceUnittest_SetTargetAbility_001 end";
}
@ -1771,7 +1771,7 @@ HWTEST_F(AccessibleAbilityManagerServiceUnitTest, SetTargetAbility_002, TestSize
}
accountData->GetConfig()->SetShortkeyTarget("INVERT_COLOR");
bool ret = Singleton<AccessibleAbilityManagerService>::GetInstance().EnableShortKeyTargetAbility();
EXPECT_TRUE(ret);
EXPECT_FALSE(ret);
GTEST_LOG_(INFO) << "Accessible_Ability_Manager_ServiceUnittest_SetTargetAbility_002 end";
}
@ -1790,7 +1790,7 @@ HWTEST_F(AccessibleAbilityManagerServiceUnitTest, SetTargetAbility_003, TestSize
}
accountData->GetConfig()->SetShortkeyTarget("ANIMATION_OFF");
bool ret = Singleton<AccessibleAbilityManagerService>::GetInstance().EnableShortKeyTargetAbility();
EXPECT_TRUE(ret);
EXPECT_FALSE(ret);
GTEST_LOG_(INFO) << "Accessible_Ability_Manager_ServiceUnittest_SetTargetAbility_003 end";
}
@ -1809,7 +1809,7 @@ HWTEST_F(AccessibleAbilityManagerServiceUnitTest, SetTargetAbility_004, TestSize
}
accountData->GetConfig()->SetShortkeyTarget("SCREEN_MAGNIFICATION");
bool ret = Singleton<AccessibleAbilityManagerService>::GetInstance().EnableShortKeyTargetAbility();
EXPECT_TRUE(ret);
EXPECT_FALSE(ret);
GTEST_LOG_(INFO) << "Accessible_Ability_Manager_ServiceUnittest_SetTargetAbility_004 end";
}
@ -1828,7 +1828,7 @@ HWTEST_F(AccessibleAbilityManagerServiceUnitTest, SetTargetAbility_005, TestSize
}
accountData->GetConfig()->SetShortkeyTarget("AUDIO_MONO");
bool ret = Singleton<AccessibleAbilityManagerService>::GetInstance().EnableShortKeyTargetAbility();
EXPECT_TRUE(ret);
EXPECT_FALSE(ret);
GTEST_LOG_(INFO) << "Accessible_Ability_Manager_ServiceUnittest_SetTargetAbility_005 end";
}
@ -1847,7 +1847,7 @@ HWTEST_F(AccessibleAbilityManagerServiceUnitTest, SetTargetAbility_006, TestSize
}
accountData->GetConfig()->SetShortkeyTarget("MOUSE_KEY");
bool ret = Singleton<AccessibleAbilityManagerService>::GetInstance().EnableShortKeyTargetAbility();
EXPECT_TRUE(ret);
EXPECT_FALSE(ret);
GTEST_LOG_(INFO) << "Accessible_Ability_Manager_ServiceUnittest_SetTargetAbility_006 end";
}
@ -1866,7 +1866,7 @@ HWTEST_F(AccessibleAbilityManagerServiceUnitTest, SetTargetAbility_007, TestSize
}
accountData->GetConfig()->SetShortkeyTarget("CAPTION_STATE");
bool ret = Singleton<AccessibleAbilityManagerService>::GetInstance().EnableShortKeyTargetAbility();
EXPECT_TRUE(ret);
EXPECT_FALSE(ret);
GTEST_LOG_(INFO) << "Accessible_Ability_Manager_ServiceUnittest_SetTargetAbility_007 end";
}
@ -2417,5 +2417,148 @@ HWTEST_F(AccessibleAbilityManagerServiceUnitTest, RegisterShortKeyEvent_002, Tes
aams.OnAddSystemAbility(WINDOW_MANAGER_SERVICE_ID, deviceId);
GTEST_LOG_(INFO) << "Accessible_Ability_ManagerService_UnitTest_RegisterShortKeyEvent_002 end";
}
/**
* @tc.number: Accessible_Ability_ManagerService_UnitTest_SetSearchElementInfoByAccessibilityIdResult_001
* @tc.name: SetSearchElementInfoByAccessibilityIdResult
* @tc.desc: Test function SetSearchElementInfoByAccessibilityIdResult
*/
HWTEST_F(AccessibleAbilityManagerServiceUnitTest, SetSearchElementInfoByAccessibilityIdResult_001, TestSize.Level1)
{
GTEST_LOG_(INFO) << "ManagerService_UnitTest_SetSearchElementInfoByAccessibilityIdResult_001 start";
std::vector<AccessibilityElementInfo> infos;
int32_t requestId = 0;
AccessibleAbilityManagerService::ElementOperatorCallbackImpl *obj = new
AccessibleAbilityManagerService::ElementOperatorCallbackImpl();
obj->SetSearchElementInfoByAccessibilityIdResult(infos, requestId);
delete obj;
GTEST_LOG_(INFO) << "ManagerService_UnitTest_SetSearchElementInfoByAccessibilityIdResult_001 end";
}
/**
* @tc.number: Accessible_Ability_ManagerService_UnitTest_SetSearchElementInfoByTextResult_001
* @tc.name: SetSearchElementInfoByTextResult
* @tc.desc: Test function SetSearchElementInfoByTextResult
*/
HWTEST_F(AccessibleAbilityManagerServiceUnitTest, SetSearchElementInfoByTextResult_001, TestSize.Level1)
{
GTEST_LOG_(INFO) << "Accessible_Ability_ManagerService_UnitTest_SetSearchElementInfoByTextResult_001 start";
std::vector<AccessibilityElementInfo> infos;
int32_t requestId = 0;
AccessibleAbilityManagerService::ElementOperatorCallbackImpl *obj = new
AccessibleAbilityManagerService::ElementOperatorCallbackImpl();
obj->SetSearchElementInfoByTextResult(infos, requestId);
delete obj;
GTEST_LOG_(INFO) << "Accessible_Ability_ManagerService_UnitTest_SetSearchElementInfoByTextResult_001 end";
}
/**
* @tc.number: Accessible_Ability_ManagerService_UnitTest_SetFindFocusedElementInfoResult_001
* @tc.name: SetFindFocusedElementInfoResult
* @tc.desc: Test function SetFindFocusedElementInfoResult
*/
HWTEST_F(AccessibleAbilityManagerServiceUnitTest, SetFindFocusedElementInfoResult_001, TestSize.Level1)
{
GTEST_LOG_(INFO) << "Accessible_Ability_ManagerService_UnitTest_SetFindFocusedElementInfoResult_001 start";
AccessibilityElementInfo info;
int32_t requestId = 0;
AccessibleAbilityManagerService::ElementOperatorCallbackImpl *obj = new
AccessibleAbilityManagerService::ElementOperatorCallbackImpl();
obj->SetFindFocusedElementInfoResult(info, requestId);
delete obj;
GTEST_LOG_(INFO) << "Accessible_Ability_ManagerService_UnitTest_SetFindFocusedElementInfoResult_001 end";
}
/**
* @tc.number: Accessible_Ability_ManagerService_UnitTest_SetFocusMoveSearchResult_001
* @tc.name: SetFocusMoveSearchResult
* @tc.desc: Test function SetFocusMoveSearchResult
*/
HWTEST_F(AccessibleAbilityManagerServiceUnitTest, SetFocusMoveSearchResult_001, TestSize.Level1)
{
GTEST_LOG_(INFO) << "Accessible_Ability_ManagerService_UnitTest_SetFocusMoveSearchResult_001 start";
AccessibilityElementInfo info;
int32_t requestId = 0;
AccessibleAbilityManagerService::ElementOperatorCallbackImpl *obj = new
AccessibleAbilityManagerService::ElementOperatorCallbackImpl();
obj->SetFocusMoveSearchResult(info, requestId);
delete obj;;
GTEST_LOG_(INFO) << "Accessible_Ability_ManagerService_UnitTest_SetFocusMoveSearchResult_001 end";
}
/**
* @tc.number: Accessible_Ability_ManagerService_UnitTest_SetExecuteActionResult_001
* @tc.name: SetExecuteActionResult
* @tc.desc: Test function SetExecuteActionResult
*/
HWTEST_F(AccessibleAbilityManagerServiceUnitTest, SetExecuteActionResult_001, TestSize.Level1)
{
GTEST_LOG_(INFO) << "Accessible_Ability_ManagerService_UnitTest_SetExecuteActionResult_001 start";
AccessibilityElementInfo info;
int32_t requestId = 0;
bool succeeded = true;
AccessibleAbilityManagerService::ElementOperatorCallbackImpl *obj = new
AccessibleAbilityManagerService::ElementOperatorCallbackImpl();
obj->SetExecuteActionResult(succeeded, requestId);
delete obj;;
GTEST_LOG_(INFO) << "Accessible_Ability_ManagerService_UnitTest_SetExecuteActionResult_001 end";
}
/**
* @tc.number: Accessible_Ability_ManagerService_UnitTest_SetCursorPositionResult_001
* @tc.name: SetCursorPositionResult
* @tc.desc: Test function SetCursorPositionResult
*/
HWTEST_F(AccessibleAbilityManagerServiceUnitTest, SetCursorPositionResult_001, TestSize.Level1)
{
GTEST_LOG_(INFO) << "Accessible_Ability_ManagerService_UnitTest_SetCursorPositionResult_001 start";
AccessibilityElementInfo info;
int32_t requestId = 0;
int32_t cursorPosition = 0;
AccessibleAbilityManagerService::ElementOperatorCallbackImpl *obj = new
AccessibleAbilityManagerService::ElementOperatorCallbackImpl();
obj->SetCursorPositionResult(cursorPosition, requestId);
delete obj;
GTEST_LOG_(INFO) << "Accessible_Ability_ManagerService_UnitTest_SetCursorPositionResult_001 end";
}
/**
* @tc.number: Accessible_Ability_ManagerService_UnitTest_SetShortkeyMultiTarget_001
* @tc.name: SetShortkeyMultiTarget
* @tc.desc: Test function SetShortkeyMultiTarget
*/
HWTEST_F(AccessibleAbilityManagerServiceUnitTest, SetShortkeyMultiTarget_001, TestSize.Level1)
{
GTEST_LOG_(INFO) << "Accessible_Ability_ManagerService_UnitTest_SetShortkeyMultiTarget_001 start";
std::vector<std::string> name;
Singleton<AccessibleAbilityManagerService>::GetInstance().SetShortkeyMultiTarget(name);
GTEST_LOG_(INFO) << "Accessible_Ability_ManagerService_UnitTest_SetShortkeyMultiTarget_001 end";
}
/**
* @tc.number: Accessible_Ability_ManagerService_UnitTest_GetShortkeyMultiTarget_001
* @tc.name: GetShortkeyMultiTarget
* @tc.desc: Test function GetShortkeyMultiTarget
*/
HWTEST_F(AccessibleAbilityManagerServiceUnitTest, GetShortkeyMultiTarget_001, TestSize.Level1)
{
GTEST_LOG_(INFO) << "Accessible_Ability_ManagerService_UnitTest_GetShortkeyMultiTarget_001 start";
std::vector<std::string> name;
Singleton<AccessibleAbilityManagerService>::GetInstance().GetShortkeyMultiTarget(name);
GTEST_LOG_(INFO) << "Accessible_Ability_ManagerService_UnitTest_GetShortkeyMultiTarget_001 end";
}
/**OnShortKeyProcess
* @tc.number: AccessibleAbility_ManagerService_UnitTest_OnShortKeyProcess_001
* @tc.name: OnShortKeyProcess
* @tc.desc: Test function OnShortKeyProcess
*/
HWTEST_F(AccessibleAbilityManagerServiceUnitTest, OnShortKeyProcess_001, TestSize.Level1)
{
GTEST_LOG_(INFO) << "AccessibleAbility_ManagerService_UnitTest_OnShortKeyProcess_001 start";
Singleton<AccessibleAbilityManagerService>::GetInstance().OnShortKeyProcess();
GTEST_LOG_(INFO) << "AccessibleAbility_ManagerService_UnitTest_OnShortKeyProcess_001 end";
}
} // namespace Accessibility
} // namespace OHOS

View File

@ -243,6 +243,22 @@ void MockAccessibilityElementOperatorImpl::SetExecuteActionResult(
return;
}
void MockAccessibilityElementOperatorImpl::SetCursorPositionResult(
const int32_t cursorPosition, const int32_t requestId)
{
std::lock_guard<std::mutex> lock(mutex_);
auto iterator = requests_.find(requestId);
if (iterator != requests_.end()) {
if (iterator->second != nullptr) {
iterator->second->SetCursorPositionResult(cursorPosition, requestId);
}
requests_.erase(iterator);
} else {
HILOG_DEBUG("Can't find the callback [requestId:%d]", requestId);
}
return;
}
void MockAccessibilityElementOperatorImpl::SetChildTreeIdAndWinId(const int64_t elementId,
const int32_t treeId, const int32_t childWindowId)
{

View File

@ -179,6 +179,13 @@ public:
*/
void SetExecuteActionResult(const bool succeeded, const int32_t requestId);
/**
* @brief Set the result of action executed to AA.
* @param cursorPosition Mark number for cursor position.
* @param requestId The request id from AA, it is used to match with request and response.
*/
void SetCursorPositionResult(const int32_t cursorPosition, const int32_t requestId);
/**
* @brief To return the result of elementId, treeId, childWindowId.
* @param elementId: The element Id.