mirror of
https://gitee.com/openharmony/accessibility
synced 2024-11-27 00:51:07 +00:00
!1432 screen_touch DT用例补充
Merge pull request !1432 from 小发发/accessibility_240921
This commit is contained in:
commit
e47e6f409b
@ -37,8 +37,10 @@ namespace {
|
||||
constexpr uint32_t TIMESTAMP_1500 = 1500;
|
||||
constexpr uint32_t TIMESTAMP_1600 = 1600;
|
||||
constexpr uint32_t TIMESTAMP_1700 = 1700;
|
||||
constexpr uint32_t TIMESTAMP_2500 = 2500;
|
||||
constexpr uint32_t TIMESTAMP_2700 = 2700;
|
||||
constexpr uint32_t TIMESTAMP_2800 = 2800;
|
||||
constexpr uint32_t SLEEP_TIME_MS = 500;
|
||||
} // namespace
|
||||
|
||||
class AccessibilityScreenTouchUnitTest : public ::testing::Test {
|
||||
@ -53,15 +55,19 @@ public:
|
||||
void SetUp() override;
|
||||
void TearDown() override;
|
||||
std::shared_ptr<MMI::PointerEvent> SetPointerEvent(uint32_t time, uint32_t action);
|
||||
std::shared_ptr<MMI::PointerEvent> SetPointerEvent(uint32_t time, uint32_t action,
|
||||
std::vector<MMI::PointerEvent::PointerItem> &points, int32_t pointerId);
|
||||
|
||||
std::shared_ptr<AccessibilityScreenTouch> screenTouch_ = nullptr;
|
||||
static uint32_t lastUpTime_;
|
||||
};
|
||||
|
||||
uint32_t AccessibilityScreenTouchUnitTest::lastUpTime_ = 0;
|
||||
|
||||
void AccessibilityScreenTouchUnitTest::SetUpTestCase()
|
||||
{
|
||||
GTEST_LOG_(INFO) << "###################### AccessibilityScreenTouchUnitTest Start ######################";
|
||||
Singleton<AccessibleAbilityManagerService>::GetInstance().OnStart();
|
||||
AccessibilityCommonHelper::GetInstance().WaitForServicePublish();
|
||||
}
|
||||
|
||||
void AccessibilityScreenTouchUnitTest::TearDownTestCase()
|
||||
@ -78,6 +84,17 @@ void AccessibilityScreenTouchUnitTest::SetUp()
|
||||
void AccessibilityScreenTouchUnitTest::TearDown()
|
||||
{
|
||||
GTEST_LOG_(INFO) << "TearDown";
|
||||
screenTouch_ = nullptr;
|
||||
AccessibilityAbilityHelper::GetInstance().ClearTouchEventActionVector();
|
||||
|
||||
sptr<AccessibilityAccountData> accountData =
|
||||
Singleton<AccessibleAbilityManagerService>::GetInstance().GetCurrentAccountData();
|
||||
if (!accountData) {
|
||||
GTEST_LOG_(INFO) << "accountData is nullptr";
|
||||
return;
|
||||
}
|
||||
accountData->GetConfig()->SetClickResponseTime(0);
|
||||
accountData->GetConfig()->SetIgnoreRepeatClickState(false);
|
||||
}
|
||||
|
||||
std::shared_ptr<MMI::PointerEvent> AccessibilityScreenTouchUnitTest::SetPointerEvent(uint32_t time, uint32_t action)
|
||||
@ -93,14 +110,34 @@ std::shared_ptr<MMI::PointerEvent> AccessibilityScreenTouchUnitTest::SetPointerE
|
||||
return event;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityScreenTouch_Unittest_OnPointerEvent_001
|
||||
* @tc.name: OnPointerEvent
|
||||
* @tc.desc: Test function OnPointerEvent
|
||||
*/
|
||||
HWTEST_F(AccessibilityScreenTouchUnitTest, AccessibilityScreenTouch_Unittest_OnPointerEvent_001, TestSize.Level1)
|
||||
std::shared_ptr<MMI::PointerEvent> AccessibilityScreenTouchUnitTest::SetPointerEvent(uint32_t time, uint32_t action,
|
||||
std::vector<MMI::PointerEvent::PointerItem> &points, int32_t pointerId)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_OnPointerEvent_001 start";
|
||||
std::shared_ptr<MMI::PointerEvent> event = MMI::PointerEvent::Create();
|
||||
|
||||
for (auto &point : points) {
|
||||
if (point.GetPointerId() == pointerId) {
|
||||
point.SetPressed(action == MMI::PointerEvent::POINTER_ACTION_UP ? false : true);
|
||||
} else {
|
||||
point.SetPressed(true);
|
||||
}
|
||||
event->AddPointerItem(point);
|
||||
}
|
||||
event->SetSourceType(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
|
||||
event->SetPointerAction(action);
|
||||
event->SetPointerId(pointerId);
|
||||
event->SetActionTime(time);
|
||||
return event;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityScreenTouch_Unittest_SetClickResponseTime_001
|
||||
* @tc.name: SetClickResponseTime
|
||||
* @tc.desc: Test function SetClickResponseTime
|
||||
*/
|
||||
HWTEST_F(AccessibilityScreenTouchUnitTest, AccessibilityScreenTouch_Unittest_SetClickResponseTime_001, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_SetClickResponseTime_001 start";
|
||||
sptr<AccessibilityAccountData> accountData =
|
||||
Singleton<AccessibleAbilityManagerService>::GetInstance().GetCurrentAccountData();
|
||||
if (!accountData) {
|
||||
@ -109,13 +146,75 @@ HWTEST_F(AccessibilityScreenTouchUnitTest, AccessibilityScreenTouch_Unittest_OnP
|
||||
}
|
||||
|
||||
accountData->GetConfig()->SetClickResponseTime(CLICK_RESPONSE_DELAY_LONG);
|
||||
screenTouch_ = std::make_shared<AccessibilityScreenTouch>();
|
||||
|
||||
EXPECT_EQ(screenTouch_->GetRealClickResponseTime(), CLICK_RESPONSE_TIME_LONG);
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_SetClickResponseTime_001 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityScreenTouch_Unittest_SetIgnoreRepeatClickState_001
|
||||
* @tc.name: SetIgnoreRepeatClickState
|
||||
* @tc.desc: Test function SetIgnoreRepeatClickState
|
||||
*/
|
||||
HWTEST_F(AccessibilityScreenTouchUnitTest, AccessibilityScreenTouch_Unittest_SetIgnoreRepeatClickState_001,
|
||||
TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_SetIgnoreRepeatClickState_001 start";
|
||||
sptr<AccessibilityAccountData> accountData =
|
||||
Singleton<AccessibleAbilityManagerService>::GetInstance().GetCurrentAccountData();
|
||||
if (!accountData) {
|
||||
GTEST_LOG_(INFO) << "accountData is nullptr";
|
||||
return;
|
||||
}
|
||||
|
||||
accountData->GetConfig()->SetIgnoreRepeatClickState(true);
|
||||
screenTouch_ = std::make_shared<AccessibilityScreenTouch>();
|
||||
|
||||
EXPECT_EQ(screenTouch_->GetRealIgnoreRepeatClickState(), true);
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_SetIgnoreRepeatClickState_001 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityScreenTouch_Unittest_SetIgnoreRepeatClickTime_001
|
||||
* @tc.name: SetIgnoreRepeatClickTime
|
||||
* @tc.desc: Test function SetIgnoreRepeatClickTime
|
||||
*/
|
||||
HWTEST_F(AccessibilityScreenTouchUnitTest, AccessibilityScreenTouch_Unittest_SetIgnoreRepeatClickTime_001,
|
||||
TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_SetIgnoreRepeatClickTime_001 start";
|
||||
sptr<AccessibilityAccountData> accountData =
|
||||
Singleton<AccessibleAbilityManagerService>::GetInstance().GetCurrentAccountData();
|
||||
if (!accountData) {
|
||||
GTEST_LOG_(INFO) << "accountData is nullptr";
|
||||
return;
|
||||
}
|
||||
|
||||
accountData->GetConfig()->SetIgnoreRepeatClickState(true);
|
||||
accountData->GetConfig()->SetIgnoreRepeatClickTime(IGNORE_REPEAT_CLICK_LONGEST);
|
||||
screenTouch_ = std::make_shared<AccessibilityScreenTouch>();
|
||||
|
||||
EXPECT_EQ(screenTouch_->GetRealClickResponseTime(), CLICK_RESPONSE_TIME_LONG);
|
||||
EXPECT_EQ(screenTouch_->GetRealIgnoreRepeatClickTime(), IGNORE_REPEAT_CLICK_TIME_LONGEST);
|
||||
EXPECT_EQ(screenTouch_->GetRealIgnoreRepeatClickState(), true);
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_SetIgnoreRepeatClickTime_001 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityScreenTouch_Unittest_OnPointerEvent_001
|
||||
* @tc.name: OnPointerEvent
|
||||
* @tc.desc: Test function OnPointerEvent
|
||||
*/
|
||||
HWTEST_F(AccessibilityScreenTouchUnitTest, AccessibilityScreenTouch_Unittest_OnPointerEvent_001, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_OnPointerEvent_001 start";
|
||||
screenTouch_ = std::make_shared<AccessibilityScreenTouch>();
|
||||
std::shared_ptr<MMI::PointerEvent> event = MMI::PointerEvent::Create();
|
||||
if (screenTouch_ == nullptr || event == nullptr) {
|
||||
GTEST_LOG_(INFO) << "null pointer";
|
||||
}
|
||||
|
||||
event->SetSourceType(MMI::PointerEvent::SOURCE_TYPE_MOUSE);
|
||||
EXPECT_EQ(screenTouch_->OnPointerEvent(*event), false);
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_OnPointerEvent_001 end";
|
||||
}
|
||||
|
||||
@ -133,7 +232,14 @@ HWTEST_F(AccessibilityScreenTouchUnitTest, AccessibilityScreenTouch_Unittest_OnP
|
||||
GTEST_LOG_(INFO) << "null pointer";
|
||||
}
|
||||
|
||||
event->SetSourceType(MMI::PointerEvent::SOURCE_TYPE_MOUSE);
|
||||
MMI::PointerEvent::PointerItem pointer = {};
|
||||
pointer.SetPointerId(1);
|
||||
pointer.SetToolType(MMI::PointerEvent::TOOL_TYPE_KNUCKLE);
|
||||
event->SetPointerId(1);
|
||||
event->AddPointerItem(pointer);
|
||||
event->SetSourceType(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
|
||||
event->SetPointerAction(MMI::PointerEvent::POINTER_ACTION_DOWN);
|
||||
|
||||
EXPECT_EQ(screenTouch_->OnPointerEvent(*event), false);
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_OnPointerEvent_002 end";
|
||||
}
|
||||
@ -158,23 +264,24 @@ HWTEST_F(AccessibilityScreenTouchUnitTest, AccessibilityScreenTouch_Unittest_OnP
|
||||
event->AddPointerItem(pointer);
|
||||
event->SetSourceType(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
|
||||
event->SetPointerAction(MMI::PointerEvent::POINTER_ACTION_CANCEL);
|
||||
screenTouch_->OnPointerEvent(*event);
|
||||
|
||||
EXPECT_EQ(screenTouch_->OnPointerEvent(*event), true);
|
||||
EXPECT_EQ(AccessibilityAbilityHelper::GetInstance().GetTouchEventActionVector().size(), 0);
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_OnPointerEvent_003 end.";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityScreenTouch_Unittest_OnPointerEvent_004
|
||||
* @tc.name: OnPointerEvent
|
||||
* @tc.desc: Test function OnPointerEvent
|
||||
* @tc.number: AccessibilityScreenTouch_Unittest_HandleIgnoreRepeatClickState_001
|
||||
* @tc.name: HandleIgnoreRepeatClickState
|
||||
* @tc.desc: Test function HandleIgnoreRepeatClickState
|
||||
*/
|
||||
HWTEST_F(AccessibilityScreenTouchUnitTest, AccessibilityScreenTouch_Unittest_OnPointerEvent_004, TestSize.Level1)
|
||||
HWTEST_F(AccessibilityScreenTouchUnitTest, AccessibilityScreenTouch_Unittest_HandleIgnoreRepeatClickState_001,
|
||||
TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_OnPointerEvent_004 start";
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_HandleIgnoreRepeatClickState_001 start";
|
||||
sptr<AccessibilityAccountData> accountData =
|
||||
Singleton<AccessibleAbilityManagerService>::GetInstance().GetCurrentAccountData();
|
||||
screenTouch_ = std::make_shared<AccessibilityScreenTouch>();
|
||||
if (accountData == nullptr || screenTouch_ == nullptr) {
|
||||
if (accountData == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -182,29 +289,45 @@ HWTEST_F(AccessibilityScreenTouchUnitTest, AccessibilityScreenTouch_Unittest_OnP
|
||||
accountData->GetConfig()->SetIgnoreRepeatClickState(true);
|
||||
accountData->GetConfig()->SetIgnoreRepeatClickTime(IGNORE_REPEAT_CLICK_LONGEST);
|
||||
|
||||
auto eventDown = SetPointerEvent(TIMESTAMP_1500, MMI::PointerEvent::POINTER_ACTION_DOWN);
|
||||
screenTouch_ = std::make_shared<AccessibilityScreenTouch>();
|
||||
if (screenTouch_ == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto eventDown = SetPointerEvent(TIMESTAMP_1500 * US_TO_MS, MMI::PointerEvent::POINTER_ACTION_DOWN);
|
||||
screenTouch_->OnPointerEvent(*eventDown);
|
||||
|
||||
auto eventMove = SetPointerEvent(TIMESTAMP_1600, MMI::PointerEvent::POINTER_ACTION_MOVE);
|
||||
auto eventMove = SetPointerEvent(TIMESTAMP_1600 * US_TO_MS, MMI::PointerEvent::POINTER_ACTION_MOVE);
|
||||
screenTouch_->OnPointerEvent(*eventMove);
|
||||
|
||||
auto eventUp = SetPointerEvent(TIMESTAMP_1700, MMI::PointerEvent::POINTER_ACTION_UP);
|
||||
EXPECT_EQ(screenTouch_->OnPointerEvent(*eventUp), true);
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_OnPointerEvent_004 end";
|
||||
auto eventUp = SetPointerEvent(TIMESTAMP_1700 * US_TO_MS, MMI::PointerEvent::POINTER_ACTION_UP);
|
||||
screenTouch_->OnPointerEvent(*eventUp);
|
||||
|
||||
EXPECT_EQ(AccessibilityAbilityHelper::GetInstance().GetTouchEventActionVector().size(), 3);
|
||||
int32_t touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(0);
|
||||
EXPECT_EQ(touchAction, MMI::PointerEvent::POINTER_ACTION_DOWN);
|
||||
touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(1);
|
||||
EXPECT_EQ(touchAction, MMI::PointerEvent::POINTER_ACTION_MOVE);
|
||||
touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(2);
|
||||
EXPECT_EQ(touchAction, MMI::PointerEvent::POINTER_ACTION_UP);
|
||||
|
||||
lastUpTime_ = TIMESTAMP_1700;
|
||||
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_HandleIgnoreRepeatClickState_001 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityScreenTouch_Unittest_OnPointerEvent_005
|
||||
* @tc.name: OnPointerEvent
|
||||
* @tc.desc: Test function OnPointerEvent
|
||||
* @tc.number: AccessibilityScreenTouch_Unittest_HandleIgnoreRepeatClickState_002
|
||||
* @tc.name: HandleIgnoreRepeatClickState
|
||||
* @tc.desc: Test function HandleIgnoreRepeatClickState
|
||||
*/
|
||||
HWTEST_F(AccessibilityScreenTouchUnitTest, AccessibilityScreenTouch_Unittest_OnPointerEvent_005, TestSize.Level1)
|
||||
HWTEST_F(AccessibilityScreenTouchUnitTest, AccessibilityScreenTouch_Unittest_HandleIgnoreRepeatClickState_002,
|
||||
TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_OnPointerEvent_005 start";
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_HandleIgnoreRepeatClickState_002 start";
|
||||
sptr<AccessibilityAccountData> accountData =
|
||||
Singleton<AccessibleAbilityManagerService>::GetInstance().GetCurrentAccountData();
|
||||
screenTouch_ = std::make_shared<AccessibilityScreenTouch>();
|
||||
if (accountData == nullptr || screenTouch_ == nullptr) {
|
||||
if (accountData == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -212,63 +335,425 @@ HWTEST_F(AccessibilityScreenTouchUnitTest, AccessibilityScreenTouch_Unittest_OnP
|
||||
accountData->GetConfig()->SetIgnoreRepeatClickState(true);
|
||||
accountData->GetConfig()->SetIgnoreRepeatClickTime(IGNORE_REPEAT_CLICK_LONGEST);
|
||||
|
||||
auto eventDown = SetPointerEvent(TIMESTAMP_1200, MMI::PointerEvent::POINTER_ACTION_DOWN);
|
||||
screenTouch_ = std::make_shared<AccessibilityScreenTouch>();
|
||||
if (screenTouch_ == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto eventDown = SetPointerEvent((lastUpTime_ + TIMESTAMP_1200) * US_TO_MS, MMI::PointerEvent::POINTER_ACTION_DOWN);
|
||||
screenTouch_->OnPointerEvent(*eventDown);
|
||||
|
||||
auto eventMove = SetPointerEvent(TIMESTAMP_1600, MMI::PointerEvent::POINTER_ACTION_MOVE);
|
||||
auto eventMove = SetPointerEvent((lastUpTime_ + TIMESTAMP_1600) * US_TO_MS, MMI::PointerEvent::POINTER_ACTION_MOVE);
|
||||
screenTouch_->OnPointerEvent(*eventMove);
|
||||
|
||||
auto eventUp = SetPointerEvent(TIMESTAMP_1700, MMI::PointerEvent::POINTER_ACTION_UP);
|
||||
EXPECT_EQ(screenTouch_->OnPointerEvent(*eventUp), true);
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_OnPointerEvent_005 end";
|
||||
auto eventUp = SetPointerEvent((lastUpTime_ + TIMESTAMP_1700) * US_TO_MS, MMI::PointerEvent::POINTER_ACTION_UP);
|
||||
screenTouch_->OnPointerEvent(*eventUp);
|
||||
|
||||
EXPECT_EQ(AccessibilityAbilityHelper::GetInstance().GetTouchEventActionVector().size(), 0);
|
||||
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_HandleIgnoreRepeatClickState_002 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityScreenTouch_Unittest_OnPointerEvent_006
|
||||
* @tc.name: OnPointerEvent
|
||||
* @tc.desc: Test function OnPointerEvent
|
||||
* @tc.number: AccessibilityScreenTouch_Unittest_HandleIgnoreRepeatClickState_003
|
||||
* @tc.name: HandleIgnoreRepeatClickState
|
||||
* @tc.desc: Test function HandleIgnoreRepeatClickState
|
||||
*/
|
||||
HWTEST_F(AccessibilityScreenTouchUnitTest, AccessibilityScreenTouch_Unittest_OnPointerEvent_006, TestSize.Level1)
|
||||
HWTEST_F(AccessibilityScreenTouchUnitTest, AccessibilityScreenTouch_Unittest_HandleIgnoreRepeatClickState_003,
|
||||
TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_OnPointerEvent_006 start";
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_HandleIgnoreRepeatClickState_003 start";
|
||||
sptr<AccessibilityAccountData> accountData =
|
||||
Singleton<AccessibleAbilityManagerService>::GetInstance().GetCurrentAccountData();
|
||||
if (accountData == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
accountData->GetConfig()->SetClickResponseTime(0);
|
||||
accountData->GetConfig()->SetIgnoreRepeatClickState(true);
|
||||
accountData->GetConfig()->SetIgnoreRepeatClickTime(IGNORE_REPEAT_CLICK_LONGEST);
|
||||
|
||||
screenTouch_ = std::make_shared<AccessibilityScreenTouch>();
|
||||
if (accountData == nullptr || screenTouch_ == nullptr) {
|
||||
if (screenTouch_ == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto eventDown = SetPointerEvent((lastUpTime_ + TIMESTAMP_1500) * US_TO_MS, MMI::PointerEvent::POINTER_ACTION_DOWN);
|
||||
screenTouch_->OnPointerEvent(*eventDown);
|
||||
|
||||
auto eventMove = SetPointerEvent((lastUpTime_ + TIMESTAMP_1600) * US_TO_MS, MMI::PointerEvent::POINTER_ACTION_MOVE);
|
||||
screenTouch_->OnPointerEvent(*eventMove);
|
||||
|
||||
auto eventUp = SetPointerEvent((lastUpTime_ + TIMESTAMP_1700) * US_TO_MS, MMI::PointerEvent::POINTER_ACTION_UP);
|
||||
screenTouch_->OnPointerEvent(*eventUp);
|
||||
|
||||
auto eventDownContinue = SetPointerEvent((lastUpTime_ + TIMESTAMP_2500) * US_TO_MS,
|
||||
MMI::PointerEvent::POINTER_ACTION_DOWN);
|
||||
screenTouch_->OnPointerEvent(*eventDownContinue);
|
||||
|
||||
auto eventMoveContinue = SetPointerEvent((lastUpTime_ + TIMESTAMP_2700) * US_TO_MS,
|
||||
MMI::PointerEvent::POINTER_ACTION_MOVE);
|
||||
screenTouch_->OnPointerEvent(*eventMoveContinue);
|
||||
|
||||
auto eventUpContinue = SetPointerEvent((lastUpTime_ + TIMESTAMP_2800) * US_TO_MS,
|
||||
MMI::PointerEvent::POINTER_ACTION_UP);
|
||||
screenTouch_->OnPointerEvent(*eventUpContinue);
|
||||
|
||||
EXPECT_EQ(AccessibilityAbilityHelper::GetInstance().GetTouchEventActionVector().size(), 3);
|
||||
int32_t touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(0);
|
||||
EXPECT_EQ(touchAction, MMI::PointerEvent::POINTER_ACTION_DOWN);
|
||||
touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(1);
|
||||
EXPECT_EQ(touchAction, MMI::PointerEvent::POINTER_ACTION_MOVE);
|
||||
touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(2);
|
||||
EXPECT_EQ(touchAction, MMI::PointerEvent::POINTER_ACTION_UP);
|
||||
|
||||
lastUpTime_ += TIMESTAMP_1700;
|
||||
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_HandleIgnoreRepeatClickState_003 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityScreenTouch_Unittest_HandleIgnoreRepeatClickState_004
|
||||
* @tc.name: HandleIgnoreRepeatClickState
|
||||
* @tc.desc: Test function HandleIgnoreRepeatClickState
|
||||
*/
|
||||
HWTEST_F(AccessibilityScreenTouchUnitTest, AccessibilityScreenTouch_Unittest_HandleIgnoreRepeatClickState_004,
|
||||
TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_HandleIgnoreRepeatClickState_004 start";
|
||||
sptr<AccessibilityAccountData> accountData =
|
||||
Singleton<AccessibleAbilityManagerService>::GetInstance().GetCurrentAccountData();
|
||||
if (accountData == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
accountData->GetConfig()->SetClickResponseTime(0);
|
||||
accountData->GetConfig()->SetIgnoreRepeatClickState(true);
|
||||
accountData->GetConfig()->SetIgnoreRepeatClickTime(IGNORE_REPEAT_CLICK_LONGEST);
|
||||
|
||||
screenTouch_ = std::make_shared<AccessibilityScreenTouch>();
|
||||
if (screenTouch_ == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<MMI::PointerEvent::PointerItem> points = {};
|
||||
MMI::PointerEvent::PointerItem firstPoint = {};
|
||||
firstPoint.SetPointerId(0);
|
||||
points.emplace_back(firstPoint);
|
||||
auto firstDownEvent = SetPointerEvent((lastUpTime_ + TIMESTAMP_1500) * US_TO_MS,
|
||||
MMI::PointerEvent::POINTER_ACTION_DOWN, points, 0);
|
||||
screenTouch_->OnPointerEvent(*firstDownEvent);
|
||||
|
||||
auto firstMoveEvent = SetPointerEvent((lastUpTime_ + TIMESTAMP_1500) * US_TO_MS,
|
||||
MMI::PointerEvent::POINTER_ACTION_MOVE, points, 0);
|
||||
screenTouch_->OnPointerEvent(*firstMoveEvent);
|
||||
|
||||
MMI::PointerEvent::PointerItem secondPoint = {};
|
||||
secondPoint.SetPointerId(1);
|
||||
points.emplace_back(secondPoint);
|
||||
auto secondDownEvent = SetPointerEvent((lastUpTime_ + TIMESTAMP_1600) * US_TO_MS,
|
||||
MMI::PointerEvent::POINTER_ACTION_DOWN, points, 1);
|
||||
screenTouch_->OnPointerEvent(*secondDownEvent);
|
||||
|
||||
auto secondMoveEvent = SetPointerEvent((lastUpTime_ + TIMESTAMP_1600) * US_TO_MS,
|
||||
MMI::PointerEvent::POINTER_ACTION_MOVE, points, 1);
|
||||
screenTouch_->OnPointerEvent(*secondMoveEvent);
|
||||
|
||||
auto secondUpEvent = SetPointerEvent((lastUpTime_ + TIMESTAMP_1700) * US_TO_MS,
|
||||
MMI::PointerEvent::POINTER_ACTION_UP, points, 1);
|
||||
screenTouch_->OnPointerEvent(*secondUpEvent);
|
||||
|
||||
auto firstUpEvent = SetPointerEvent((lastUpTime_ + TIMESTAMP_1700) * US_TO_MS,
|
||||
MMI::PointerEvent::POINTER_ACTION_UP);
|
||||
screenTouch_->OnPointerEvent(*firstUpEvent);
|
||||
|
||||
EXPECT_EQ(AccessibilityAbilityHelper::GetInstance().GetTouchEventActionVector().size(), 6);
|
||||
int32_t touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(0);
|
||||
EXPECT_EQ(touchAction, MMI::PointerEvent::POINTER_ACTION_DOWN);
|
||||
touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(2);
|
||||
EXPECT_EQ(touchAction, MMI::PointerEvent::POINTER_ACTION_DOWN);
|
||||
touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(5);
|
||||
EXPECT_EQ(touchAction, MMI::PointerEvent::POINTER_ACTION_UP);
|
||||
|
||||
lastUpTime_ += TIMESTAMP_1700;
|
||||
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_HandleIgnoreRepeatClickState_004 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityScreenTouch_Unittest_HandleResponseDelayState_001
|
||||
* @tc.name: HandleResponseDelayState
|
||||
* @tc.desc: Test function HandleResponseDelayState
|
||||
*/
|
||||
HWTEST_F(AccessibilityScreenTouchUnitTest, AccessibilityScreenTouch_Unittest_HandleResponseDelayState_001,
|
||||
TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_HandleResponseDelayState_001 start";
|
||||
sptr<AccessibilityAccountData> accountData =
|
||||
Singleton<AccessibleAbilityManagerService>::GetInstance().GetCurrentAccountData();
|
||||
if (accountData == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
accountData->GetConfig()->SetClickResponseTime(CLICK_RESPONSE_DELAY_LONG);
|
||||
accountData->GetConfig()->SetIgnoreRepeatClickState(false);
|
||||
accountData->GetConfig()->SetIgnoreRepeatClickTime(IGNORE_REPEAT_CLICK_LONGEST);
|
||||
|
||||
auto eventDown = SetPointerEvent(0, MMI::PointerEvent::POINTER_ACTION_DOWN);
|
||||
screenTouch_ = std::make_shared<AccessibilityScreenTouch>();
|
||||
if (screenTouch_ == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto eventDown = SetPointerEvent(TIMESTAMP_1500 * US_TO_MS, MMI::PointerEvent::POINTER_ACTION_DOWN);
|
||||
screenTouch_->OnPointerEvent(*eventDown);
|
||||
|
||||
auto eventMove1 = SetPointerEvent(TIMESTAMP_800, MMI::PointerEvent::POINTER_ACTION_MOVE);
|
||||
screenTouch_->OnPointerEvent(*eventMove1);
|
||||
auto eventMove = SetPointerEvent(TIMESTAMP_1600 * US_TO_MS, MMI::PointerEvent::POINTER_ACTION_MOVE);
|
||||
screenTouch_->OnPointerEvent(*eventMove);
|
||||
|
||||
auto eventMove2 = SetPointerEvent(TIMESTAMP_1600, MMI::PointerEvent::POINTER_ACTION_MOVE);
|
||||
screenTouch_->OnPointerEvent(*eventMove2);
|
||||
sleep(1);
|
||||
|
||||
auto eventUp = SetPointerEvent(TIMESTAMP_1700, MMI::PointerEvent::POINTER_ACTION_UP);
|
||||
EXPECT_EQ(screenTouch_->OnPointerEvent(*eventUp), true);
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_OnPointerEvent_006 end";
|
||||
auto eventUp = SetPointerEvent(TIMESTAMP_1700 * US_TO_MS, MMI::PointerEvent::POINTER_ACTION_UP);
|
||||
screenTouch_->OnPointerEvent(*eventUp);
|
||||
|
||||
EXPECT_EQ(AccessibilityAbilityHelper::GetInstance().GetTouchEventActionVector().size(), 2);
|
||||
int32_t touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(0);
|
||||
EXPECT_EQ(touchAction, MMI::PointerEvent::POINTER_ACTION_DOWN);
|
||||
touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(1);
|
||||
EXPECT_EQ(touchAction, MMI::PointerEvent::POINTER_ACTION_UP);
|
||||
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_HandleResponseDelayState_001 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityScreenTouch_Unittest_OnPointerEvent_007
|
||||
* @tc.name: OnPointerEvent
|
||||
* @tc.desc: Test function OnPointerEvent
|
||||
* @tc.number: AccessibilityScreenTouch_Unittest_HandleResponseDelayState_002
|
||||
* @tc.name: HandleResponseDelayState
|
||||
* @tc.desc: Test function HandleResponseDelayState
|
||||
*/
|
||||
HWTEST_F(AccessibilityScreenTouchUnitTest, AccessibilityScreenTouch_Unittest_OnPointerEvent_007, TestSize.Level1)
|
||||
HWTEST_F(AccessibilityScreenTouchUnitTest, AccessibilityScreenTouch_Unittest_HandleResponseDelayState_002,
|
||||
TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_OnPointerEvent_007 start";
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_HandleResponseDelayState_002 start";
|
||||
sptr<AccessibilityAccountData> accountData =
|
||||
Singleton<AccessibleAbilityManagerService>::GetInstance().GetCurrentAccountData();
|
||||
if (accountData == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
accountData->GetConfig()->SetClickResponseTime(CLICK_RESPONSE_DELAY_LONG);
|
||||
accountData->GetConfig()->SetIgnoreRepeatClickState(false);
|
||||
|
||||
screenTouch_ = std::make_shared<AccessibilityScreenTouch>();
|
||||
if (accountData == nullptr || screenTouch_ == nullptr) {
|
||||
GTEST_LOG_(INFO) << "accountData is nullptr or screenTouch_ is nullptr";
|
||||
if (screenTouch_ == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto eventDown = SetPointerEvent(TIMESTAMP_1500 * US_TO_MS, MMI::PointerEvent::POINTER_ACTION_DOWN);
|
||||
screenTouch_->OnPointerEvent(*eventDown);
|
||||
|
||||
auto eventMove = SetPointerEvent(TIMESTAMP_1600 * US_TO_MS, MMI::PointerEvent::POINTER_ACTION_MOVE);
|
||||
screenTouch_->OnPointerEvent(*eventMove);
|
||||
|
||||
usleep(SLEEP_TIME_MS);
|
||||
|
||||
auto eventUp = SetPointerEvent(TIMESTAMP_1700 * US_TO_MS, MMI::PointerEvent::POINTER_ACTION_UP);
|
||||
screenTouch_->OnPointerEvent(*eventUp);
|
||||
|
||||
EXPECT_EQ(AccessibilityAbilityHelper::GetInstance().GetTouchEventActionVector().size(), 0);
|
||||
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_HandleResponseDelayState_002 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityScreenTouch_Unittest_HandleResponseDelayState_003
|
||||
* @tc.name: HandleResponseDelayState
|
||||
* @tc.desc: Test function HandleResponseDelayState
|
||||
*/
|
||||
HWTEST_F(AccessibilityScreenTouchUnitTest, AccessibilityScreenTouch_Unittest_HandleResponseDelayState_003,
|
||||
TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_HandleResponseDelayState_003 start";
|
||||
sptr<AccessibilityAccountData> accountData =
|
||||
Singleton<AccessibleAbilityManagerService>::GetInstance().GetCurrentAccountData();
|
||||
if (accountData == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
accountData->GetConfig()->SetClickResponseTime(CLICK_RESPONSE_DELAY_LONG);
|
||||
accountData->GetConfig()->SetIgnoreRepeatClickState(false);
|
||||
|
||||
screenTouch_ = std::make_shared<AccessibilityScreenTouch>();
|
||||
if (screenTouch_ == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<MMI::PointerEvent::PointerItem> points = {};
|
||||
MMI::PointerEvent::PointerItem point = {};
|
||||
point.SetPointerId(0);
|
||||
point.SetDisplayX(0);
|
||||
point.SetDisplayY(0);
|
||||
points.emplace_back(point);
|
||||
auto eventDown = SetPointerEvent(TIMESTAMP_1500 * US_TO_MS, MMI::PointerEvent::POINTER_ACTION_DOWN, points, 0);
|
||||
screenTouch_->OnPointerEvent(*eventDown);
|
||||
|
||||
points.clear();
|
||||
point.SetDisplayX(500);
|
||||
point.SetDisplayY(500);
|
||||
points.emplace_back(point);
|
||||
auto eventMove = SetPointerEvent(TIMESTAMP_1600 * US_TO_MS, MMI::PointerEvent::POINTER_ACTION_MOVE, points, 0);
|
||||
screenTouch_->OnPointerEvent(*eventMove);
|
||||
|
||||
auto eventUp = SetPointerEvent(TIMESTAMP_1700 * US_TO_MS, MMI::PointerEvent::POINTER_ACTION_UP, points, 0);
|
||||
screenTouch_->OnPointerEvent(*eventUp);
|
||||
|
||||
EXPECT_EQ(AccessibilityAbilityHelper::GetInstance().GetTouchEventActionVector().size(), 3);
|
||||
int32_t touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(0);
|
||||
EXPECT_EQ(touchAction, MMI::PointerEvent::POINTER_ACTION_DOWN);
|
||||
touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(1);
|
||||
EXPECT_EQ(touchAction, MMI::PointerEvent::POINTER_ACTION_MOVE);
|
||||
touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(2);
|
||||
EXPECT_EQ(touchAction, MMI::PointerEvent::POINTER_ACTION_UP);
|
||||
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_HandleResponseDelayState_003 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityScreenTouch_Unittest_HandleResponseDelayState_004
|
||||
* @tc.name: HandleResponseDelayState
|
||||
* @tc.desc: Test function HandleResponseDelayState
|
||||
*/
|
||||
HWTEST_F(AccessibilityScreenTouchUnitTest, AccessibilityScreenTouch_Unittest_HandleResponseDelayState_004,
|
||||
TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_HandleResponseDelayState_004 start";
|
||||
sptr<AccessibilityAccountData> accountData =
|
||||
Singleton<AccessibleAbilityManagerService>::GetInstance().GetCurrentAccountData();
|
||||
if (accountData == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
accountData->GetConfig()->SetClickResponseTime(CLICK_RESPONSE_DELAY_LONG);
|
||||
accountData->GetConfig()->SetIgnoreRepeatClickState(false);
|
||||
|
||||
screenTouch_ = std::make_shared<AccessibilityScreenTouch>();
|
||||
if (screenTouch_ == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<MMI::PointerEvent::PointerItem> points = {};
|
||||
MMI::PointerEvent::PointerItem firstPoint = {};
|
||||
firstPoint.SetPointerId(0);
|
||||
points.emplace_back(firstPoint);
|
||||
auto firstDownEvent = SetPointerEvent(TIMESTAMP_1500 * US_TO_MS, MMI::PointerEvent::POINTER_ACTION_DOWN, points, 0);
|
||||
screenTouch_->OnPointerEvent(*firstDownEvent);
|
||||
|
||||
auto firstMoveEvent = SetPointerEvent(TIMESTAMP_1500 * US_TO_MS, MMI::PointerEvent::POINTER_ACTION_MOVE, points, 0);
|
||||
screenTouch_->OnPointerEvent(*firstMoveEvent);
|
||||
|
||||
MMI::PointerEvent::PointerItem secondPoint = {};
|
||||
secondPoint.SetPointerId(1);
|
||||
points.emplace_back(secondPoint);
|
||||
auto secondDownEvent = SetPointerEvent(TIMESTAMP_1600 * US_TO_MS,
|
||||
MMI::PointerEvent::POINTER_ACTION_DOWN, points, 1);
|
||||
screenTouch_->OnPointerEvent(*secondDownEvent);
|
||||
|
||||
auto secondMoveEvent = SetPointerEvent(TIMESTAMP_1600 * US_TO_MS,
|
||||
MMI::PointerEvent::POINTER_ACTION_MOVE, points, 1);
|
||||
screenTouch_->OnPointerEvent(*secondMoveEvent);
|
||||
|
||||
sleep(1);
|
||||
|
||||
auto secondUpEvent = SetPointerEvent(TIMESTAMP_1700 * US_TO_MS, MMI::PointerEvent::POINTER_ACTION_UP, points, 1);
|
||||
screenTouch_->OnPointerEvent(*secondUpEvent);
|
||||
|
||||
auto firstUpEvent = SetPointerEvent(TIMESTAMP_1700 * US_TO_MS, MMI::PointerEvent::POINTER_ACTION_UP);
|
||||
screenTouch_->OnPointerEvent(*firstUpEvent);
|
||||
|
||||
EXPECT_EQ(AccessibilityAbilityHelper::GetInstance().GetTouchEventActionVector().size(), 4);
|
||||
int32_t touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(0);
|
||||
EXPECT_EQ(touchAction, MMI::PointerEvent::POINTER_ACTION_DOWN);
|
||||
touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(1);
|
||||
EXPECT_EQ(touchAction, MMI::PointerEvent::POINTER_ACTION_DOWN);
|
||||
touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(2);
|
||||
EXPECT_EQ(touchAction, MMI::PointerEvent::POINTER_ACTION_UP);
|
||||
touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(3);
|
||||
EXPECT_EQ(touchAction, MMI::PointerEvent::POINTER_ACTION_UP);
|
||||
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_HandleResponseDelayState_004 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityScreenTouch_Unittest_HandleResponseDelayState_005
|
||||
* @tc.name: HandleResponseDelayState
|
||||
* @tc.desc: Test function HandleResponseDelayState
|
||||
*/
|
||||
HWTEST_F(AccessibilityScreenTouchUnitTest, AccessibilityScreenTouch_Unittest_HandleResponseDelayState_005,
|
||||
TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_HandleResponseDelayState_005 start";
|
||||
sptr<AccessibilityAccountData> accountData =
|
||||
Singleton<AccessibleAbilityManagerService>::GetInstance().GetCurrentAccountData();
|
||||
if (accountData == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
accountData->GetConfig()->SetClickResponseTime(CLICK_RESPONSE_DELAY_LONG);
|
||||
accountData->GetConfig()->SetIgnoreRepeatClickState(false);
|
||||
|
||||
screenTouch_ = std::make_shared<AccessibilityScreenTouch>();
|
||||
if (screenTouch_ == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<MMI::PointerEvent::PointerItem> points = {};
|
||||
MMI::PointerEvent::PointerItem firstPoint = {};
|
||||
firstPoint.SetPointerId(0);
|
||||
points.emplace_back(firstPoint);
|
||||
auto firstDownEvent = SetPointerEvent(TIMESTAMP_1500 * US_TO_MS, MMI::PointerEvent::POINTER_ACTION_DOWN, points, 0);
|
||||
screenTouch_->OnPointerEvent(*firstDownEvent);
|
||||
|
||||
auto firstMoveEvent = SetPointerEvent(TIMESTAMP_1500 * US_TO_MS, MMI::PointerEvent::POINTER_ACTION_MOVE, points, 0);
|
||||
screenTouch_->OnPointerEvent(*firstMoveEvent);
|
||||
|
||||
sleep(1);
|
||||
|
||||
MMI::PointerEvent::PointerItem secondPoint = {};
|
||||
secondPoint.SetPointerId(1);
|
||||
points.emplace_back(secondPoint);
|
||||
auto secondDownEvent = SetPointerEvent(TIMESTAMP_1600 * US_TO_MS,
|
||||
MMI::PointerEvent::POINTER_ACTION_DOWN, points, 1);
|
||||
screenTouch_->OnPointerEvent(*secondDownEvent);
|
||||
|
||||
auto secondMoveEvent = SetPointerEvent(TIMESTAMP_1600 * US_TO_MS,
|
||||
MMI::PointerEvent::POINTER_ACTION_MOVE, points, 1);
|
||||
screenTouch_->OnPointerEvent(*secondMoveEvent);
|
||||
|
||||
auto secondUpEvent = SetPointerEvent(TIMESTAMP_1700 * US_TO_MS, MMI::PointerEvent::POINTER_ACTION_UP, points, 1);
|
||||
screenTouch_->OnPointerEvent(*secondUpEvent);
|
||||
|
||||
auto firstUpEvent = SetPointerEvent(TIMESTAMP_1700 * US_TO_MS, MMI::PointerEvent::POINTER_ACTION_UP);
|
||||
screenTouch_->OnPointerEvent(*firstUpEvent);
|
||||
|
||||
EXPECT_EQ(AccessibilityAbilityHelper::GetInstance().GetTouchEventActionVector().size(), 3);
|
||||
int32_t touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(0);
|
||||
EXPECT_EQ(touchAction, MMI::PointerEvent::POINTER_ACTION_DOWN);
|
||||
touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(1);
|
||||
EXPECT_EQ(touchAction, MMI::PointerEvent::POINTER_ACTION_MOVE);
|
||||
touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(2);
|
||||
EXPECT_EQ(touchAction, MMI::PointerEvent::POINTER_ACTION_UP);
|
||||
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_HandleResponseDelayState_005 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityScreenTouch_Unittest_HandleBothState_001
|
||||
* @tc.name: HandleBothState
|
||||
* @tc.desc: Test function HandleBothState
|
||||
*/
|
||||
HWTEST_F(AccessibilityScreenTouchUnitTest, AccessibilityScreenTouch_Unittest_HandleBothState_001, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_HandleBothState_001 start";
|
||||
sptr<AccessibilityAccountData> accountData =
|
||||
Singleton<AccessibleAbilityManagerService>::GetInstance().GetCurrentAccountData();
|
||||
if (accountData == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -276,18 +761,102 @@ HWTEST_F(AccessibilityScreenTouchUnitTest, AccessibilityScreenTouch_Unittest_OnP
|
||||
accountData->GetConfig()->SetIgnoreRepeatClickState(true);
|
||||
accountData->GetConfig()->SetIgnoreRepeatClickTime(IGNORE_REPEAT_CLICK_LONGEST);
|
||||
|
||||
auto eventDown = SetPointerEvent(TIMESTAMP_1600, MMI::PointerEvent::POINTER_ACTION_DOWN);
|
||||
screenTouch_ = std::make_shared<AccessibilityScreenTouch>();
|
||||
if (screenTouch_ == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto eventDown = SetPointerEvent((lastUpTime_ + TIMESTAMP_1500) * US_TO_MS, MMI::PointerEvent::POINTER_ACTION_DOWN);
|
||||
screenTouch_->OnPointerEvent(*eventDown);
|
||||
|
||||
auto eventMove1 = SetPointerEvent(TIMESTAMP_1700, MMI::PointerEvent::POINTER_ACTION_MOVE);
|
||||
screenTouch_->OnPointerEvent(*eventMove1);
|
||||
sleep(1);
|
||||
|
||||
auto eventMove2 = SetPointerEvent(TIMESTAMP_2700, MMI::PointerEvent::POINTER_ACTION_MOVE);
|
||||
screenTouch_->OnPointerEvent(*eventMove2);
|
||||
auto eventMove = SetPointerEvent((lastUpTime_ + TIMESTAMP_1600) * US_TO_MS, MMI::PointerEvent::POINTER_ACTION_MOVE);
|
||||
screenTouch_->OnPointerEvent(*eventMove);
|
||||
|
||||
auto eventUp = SetPointerEvent(TIMESTAMP_2800, MMI::PointerEvent::POINTER_ACTION_UP);
|
||||
EXPECT_EQ(screenTouch_->OnPointerEvent(*eventUp), true);
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_OnPointerEvent_007 end";
|
||||
auto eventUp = SetPointerEvent((lastUpTime_ + TIMESTAMP_1700) * US_TO_MS, MMI::PointerEvent::POINTER_ACTION_UP);
|
||||
screenTouch_->OnPointerEvent(*eventUp);
|
||||
|
||||
EXPECT_EQ(AccessibilityAbilityHelper::GetInstance().GetTouchEventActionVector().size(), 3);
|
||||
int32_t touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(0);
|
||||
EXPECT_EQ(touchAction, MMI::PointerEvent::POINTER_ACTION_DOWN);
|
||||
touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(1);
|
||||
EXPECT_EQ(touchAction, MMI::PointerEvent::POINTER_ACTION_MOVE);
|
||||
touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(2);
|
||||
EXPECT_EQ(touchAction, MMI::PointerEvent::POINTER_ACTION_UP);
|
||||
|
||||
lastUpTime_ += TIMESTAMP_1700;
|
||||
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_HandleBothState_001 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityScreenTouch_Unittest_HandleBothState_002
|
||||
* @tc.name: HandleBothState
|
||||
* @tc.desc: Test function HandleBothState
|
||||
*/
|
||||
HWTEST_F(AccessibilityScreenTouchUnitTest, AccessibilityScreenTouch_Unittest_HandleBothState_002, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_HandleBothState_002 start";
|
||||
sptr<AccessibilityAccountData> accountData =
|
||||
Singleton<AccessibleAbilityManagerService>::GetInstance().GetCurrentAccountData();
|
||||
if (accountData == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
accountData->GetConfig()->SetClickResponseTime(CLICK_RESPONSE_DELAY_LONG);
|
||||
accountData->GetConfig()->SetIgnoreRepeatClickState(true);
|
||||
accountData->GetConfig()->SetIgnoreRepeatClickTime(IGNORE_REPEAT_CLICK_LONGEST);
|
||||
|
||||
screenTouch_ = std::make_shared<AccessibilityScreenTouch>();
|
||||
if (screenTouch_ == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<MMI::PointerEvent::PointerItem> points = {};
|
||||
MMI::PointerEvent::PointerItem firstPoint = {};
|
||||
firstPoint.SetPointerId(0);
|
||||
points.emplace_back(firstPoint);
|
||||
auto firstDownEvent = SetPointerEvent((lastUpTime_ + TIMESTAMP_1500) * US_TO_MS,
|
||||
MMI::PointerEvent::POINTER_ACTION_DOWN, points, 0);
|
||||
screenTouch_->OnPointerEvent(*firstDownEvent);
|
||||
|
||||
auto firstMoveEvent = SetPointerEvent((lastUpTime_ + TIMESTAMP_1500) * US_TO_MS,
|
||||
MMI::PointerEvent::POINTER_ACTION_MOVE, points, 0);
|
||||
screenTouch_->OnPointerEvent(*firstMoveEvent);
|
||||
|
||||
MMI::PointerEvent::PointerItem secondPoint = {};
|
||||
secondPoint.SetPointerId(1);
|
||||
points.emplace_back(secondPoint);
|
||||
auto secondDownEvent = SetPointerEvent((lastUpTime_ + TIMESTAMP_1600) * US_TO_MS,
|
||||
MMI::PointerEvent::POINTER_ACTION_DOWN, points, 1);
|
||||
screenTouch_->OnPointerEvent(*secondDownEvent);
|
||||
|
||||
auto secondMoveEvent = SetPointerEvent((lastUpTime_ + TIMESTAMP_1600) * US_TO_MS,
|
||||
MMI::PointerEvent::POINTER_ACTION_MOVE, points, 1);
|
||||
screenTouch_->OnPointerEvent(*secondMoveEvent);
|
||||
|
||||
sleep(1);
|
||||
|
||||
auto secondUpEvent = SetPointerEvent((lastUpTime_ + TIMESTAMP_1700) * US_TO_MS,
|
||||
MMI::PointerEvent::POINTER_ACTION_UP, points, 1);
|
||||
screenTouch_->OnPointerEvent(*secondUpEvent);
|
||||
|
||||
auto firstUpEvent = SetPointerEvent((lastUpTime_ + TIMESTAMP_1700) * US_TO_MS,
|
||||
MMI::PointerEvent::POINTER_ACTION_UP);
|
||||
screenTouch_->OnPointerEvent(*firstUpEvent);
|
||||
|
||||
EXPECT_EQ(AccessibilityAbilityHelper::GetInstance().GetTouchEventActionVector().size(), 4);
|
||||
int32_t touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(0);
|
||||
EXPECT_EQ(touchAction, MMI::PointerEvent::POINTER_ACTION_DOWN);
|
||||
touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(1);
|
||||
EXPECT_EQ(touchAction, MMI::PointerEvent::POINTER_ACTION_DOWN);
|
||||
touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(3);
|
||||
EXPECT_EQ(touchAction, MMI::PointerEvent::POINTER_ACTION_UP);
|
||||
|
||||
lastUpTime_ += TIMESTAMP_1700;
|
||||
|
||||
GTEST_LOG_(INFO) << "AccessibilityScreenTouch_Unittest_HandleBothState_002 end";
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user