mirror of
https://gitee.com/openharmony/accessibility
synced 2024-11-23 06:50:30 +00:00
DT新增test用例
Signed-off-by: 13359243081 <lanshulei@huawei.com>
This commit is contained in:
parent
373b89891b
commit
9ef6ae7643
@ -0,0 +1,359 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "accessibility_circle_drawing_manager.h"
|
||||
#include <gtest/gtest.h>
|
||||
#include "accessibility_common_helper.h"
|
||||
#include "accessibility_element_operator_proxy.h"
|
||||
#include "accessibility_element_operator_stub.h"
|
||||
#include "accessibility_ut_helper.h"
|
||||
#include "accessible_ability_manager_service.h"
|
||||
#include "mock_accessible_ability_manager_service_config_observer_proxy.h"
|
||||
#include "mock_accessible_ability_manager_service_config_observer_stub.h"
|
||||
#include "mock_accessible_ability_manager_service_state_observer_proxy.h"
|
||||
#include "mock_accessible_ability_manager_service_state_observer_stub.h"
|
||||
#include "mock_accessibility_setting_provider.h"
|
||||
#include "utils.h"
|
||||
|
||||
|
||||
using namespace testing;
|
||||
using namespace testing::ext;
|
||||
|
||||
namespace OHOS {
|
||||
namespace Accessibility {
|
||||
namespace {
|
||||
constexpr uint32_t SLEEP_TIME_1 = 1;
|
||||
constexpr size_t IMPORTANT_ABILITIES_SIZE = 0;
|
||||
} // namespace
|
||||
|
||||
class AccessibilityCircleDrawingManagerTest : public testing::Test {
|
||||
public:
|
||||
AccessibilityCircleDrawingManagerTest()
|
||||
{}
|
||||
~AccessibilityCircleDrawingManagerTest()
|
||||
{}
|
||||
|
||||
static void SetUpTestCase();
|
||||
static void TearDownTestCase();
|
||||
void SetUp() override;
|
||||
void TearDown() override;
|
||||
};
|
||||
|
||||
void AccessibilityCircleDrawingManagerTest::SetUpTestCase()
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityCircleDrawingManagerTest SetUpTestCase";
|
||||
Singleton<AccessibleAbilityManagerService>::GetInstance().OnStart();
|
||||
Singleton<AccessibleAbilityManagerService>::GetInstance().SwitchedUser(AccessibilityAbilityHelper::accountId_);
|
||||
}
|
||||
|
||||
void AccessibilityCircleDrawingManagerTest::TearDownTestCase()
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityCircleDrawingManagerTest TearDownTestCase";
|
||||
Singleton<AccessibleAbilityManagerService>::GetInstance().OnStop();
|
||||
}
|
||||
|
||||
void AccessibilityCircleDrawingManagerTest::SetUp()
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityCircleDrawingManagerTest SetUp";
|
||||
}
|
||||
|
||||
void AccessibilityCircleDrawingManagerTest::TearDown()
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityCircleDrawingManagerTest TearDown";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityCircleDrawingManager_Unittest_CreatePointerWindow001
|
||||
* @tc.name: CreatePointerWindow
|
||||
* @tc.desc: Check the get accessibility state.
|
||||
*/
|
||||
HWTEST_F(AccessibilityCircleDrawingManagerTest, AccessibilityCircleDrawingManager_Unittest_CreatePointerWindow001, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityCircleDrawingManager_Unittest_CreatePointerWindow001 start";
|
||||
int32_t accountId = 1;
|
||||
sptr<AccessibilityCircleDrawingManager> accountData = new AccessibilityCircleDrawingManager(accountId);
|
||||
|
||||
/* Initial state */
|
||||
accountData->Init();
|
||||
accountData->GetConfig()->SetTouchGuideState(true);
|
||||
uint32_t stateType = accountData->CreatePointerWindow();
|
||||
uint32_t stateTypeTest = Accessibility::STATE_EXPLORATION_ENABLED;
|
||||
EXPECT_EQ(stateTypeTest, stateType);
|
||||
GTEST_LOG_(INFO) << "AccessibilityCircleDrawingManager_Unittest_CreatePointerWindow001 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityCircleDrawingManager_Unittest_CreatePointerWindow002
|
||||
* @tc.name: CreatePointerWindow
|
||||
* @tc.desc: Check the get accessibility state.
|
||||
*/
|
||||
HWTEST_F(AccessibilityCircleDrawingManagerTest, AccessibilityCircleDrawingManager_Unittest_CreatePointerWindow002, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityCircleDrawingManager_Unittest_CreatePointerWindow_002 start";
|
||||
const int32_t accountId = 1;
|
||||
int32_t connectCounter = 0;
|
||||
AccessibilityAbilityInitParams initParams;
|
||||
std::shared_ptr<AccessibilityAbilityInfo> abilityInfo = std::make_shared<AccessibilityAbilityInfo>(initParams);
|
||||
|
||||
sptr<AccessibleAbilityConnection> connection =
|
||||
new MockAccessibleAbilityConnection(accountId, connectCounter++, *abilityInfo);
|
||||
sptr<AccessibilityCircleDrawingManager> accountData = new AccessibilityCircleDrawingManager(accountId);
|
||||
EXPECT_EQ(0, (int)accountData->GetConnectedA11yAbilities().size());
|
||||
|
||||
/* add connected ability */
|
||||
accountData->DrawingProgressByOpenSource(connection);
|
||||
const std::string elementName = Utils::GetUri(connection->GetElementName());
|
||||
EXPECT_EQ(connection, accountData->GetAccessibleAbilityConnection(elementName));
|
||||
EXPECT_EQ(1, (int)accountData->GetConnectedA11yAbilities().size());
|
||||
|
||||
// init
|
||||
accountData->Init();
|
||||
uint32_t stateType = accountData->CreatePointerWindow();
|
||||
EXPECT_EQ(stateType, Accessibility::STATE_ACCESSIBILITY_ENABLED);
|
||||
GTEST_LOG_(INFO) << "AccessibilityCircleDrawingManager_Unittest_CreatePointerWindow_002 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityCircleDrawingManager_Unittest_CreatePointerWindow003
|
||||
* @tc.name: CreatePointerWindow
|
||||
* @tc.desc: Check the get accessibility state.
|
||||
*/
|
||||
HWTEST_F(AccessibilityCircleDrawingManagerTest, AccessibilityCircleDrawingManager_Unittest_CreatePointerWindow003, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityCircleDrawingManager_Unittest_CreatePointerWindow_003 start";
|
||||
const int32_t accountId = 1;
|
||||
int32_t connectCounter = 0;
|
||||
AccessibilityAbilityInitParams initParams;
|
||||
std::shared_ptr<AccessibilityAbilityInfo> abilityInfo = std::make_shared<AccessibilityAbilityInfo>(initParams);
|
||||
sptr<AccessibilityCircleDrawingManager> accountData = new AccessibilityCircleDrawingManager(accountId);
|
||||
sptr<AccessibleAbilityConnection> connection =
|
||||
new MockAccessibleAbilityConnection(accountId, connectCounter++, *abilityInfo);
|
||||
const std::string bundleName = "abc";
|
||||
EXPECT_FALSE(accountData->GetConnectingA11yAbility(bundleName));
|
||||
accountData->AddConnectingA11yAbility(bundleName, connection);
|
||||
EXPECT_TRUE(accountData->GetConnectingA11yAbility(bundleName));
|
||||
accountData->Init();
|
||||
accountData->GetConfig()->SetKeyEventObserverState(true);
|
||||
uint32_t stateType = accountData->CreatePointerWindow();
|
||||
EXPECT_EQ(stateType, Accessibility::STATE_ACCESSIBILITY_ENABLED | Accessibility::STATE_KEYEVENT_ENABLED);
|
||||
GTEST_LOG_(INFO) << "AccessibilityCircleDrawingManager_Unittest_CreatePointerWindow_003 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityCircleDrawingManager_Unittest_CreatePointerWindow004
|
||||
* @tc.name: CreatePointerWindow
|
||||
* @tc.desc: Check the get accessibility state.
|
||||
*/
|
||||
HWTEST_F(AccessibilityCircleDrawingManagerTest, AccessibilityCircleDrawingManager_Unittest_CreatePointerWindow004, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityCircleDrawingManager_Unittest_CreatePointerWindow_004 start";
|
||||
const int32_t accountId = 1;
|
||||
int32_t connectCounter = 0;
|
||||
AccessibilityAbilityInitParams initParams;
|
||||
std::shared_ptr<AccessibilityAbilityInfo> abilityInfo = std::make_shared<AccessibilityAbilityInfo>(initParams);
|
||||
sptr<AccessibilityCircleDrawingManager> accountData = new AccessibilityCircleDrawingManager(accountId);
|
||||
sptr<AccessibleAbilityConnection> connection =
|
||||
new MockAccessibleAbilityConnection(accountId, connectCounter++, *abilityInfo);
|
||||
accountData->DrawingProgressByOpenSource(connection);
|
||||
accountData->Init();
|
||||
accountData->GetConfig()->SetGestureState(true);
|
||||
uint32_t stateType = accountData->CreatePointerWindow();
|
||||
EXPECT_EQ(stateType, Accessibility::STATE_ACCESSIBILITY_ENABLED | Accessibility::STATE_GESTURE_ENABLED);
|
||||
|
||||
GTEST_LOG_(INFO) << "AccessibilityCircleDrawingManager_Unittest_CreatePointerWindow_004 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityCircleDrawingManager_Unittest_DrawingProgressByOpenSource001
|
||||
* @tc.name: DrawingProgressByOpenSource
|
||||
* @tc.desc: Check the add connected ability.
|
||||
*/
|
||||
HWTEST_F(AccessibilityCircleDrawingManagerTest, AccessibilityCircleDrawingManager_Unittest_DrawingProgressByOpenSource001, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityCircleDrawingManager_Unittest_DrawingProgressByOpenSource_001 start";
|
||||
const int32_t accountId = 1;
|
||||
int32_t connectCounter = 0;
|
||||
AccessibilityAbilityInitParams initParams;
|
||||
std::shared_ptr<AccessibilityAbilityInfo> abilityInfo = std::make_shared<AccessibilityAbilityInfo>(initParams);
|
||||
sptr<AccessibilityCircleDrawingManager> accountData = new AccessibilityCircleDrawingManager(accountId);
|
||||
sptr<AccessibleAbilityConnection> connection =
|
||||
new MockAccessibleAbilityConnection(accountId, connectCounter++, *abilityInfo);
|
||||
EXPECT_EQ(0, (int)accountData->GetConnectedA11yAbilities().size());
|
||||
accountData->DrawingProgressByOpenSource(connection);
|
||||
const std::string elementName = Utils::GetUri(connection->GetElementName());
|
||||
EXPECT_EQ(connection, accountData->GetAccessibleAbilityConnection(elementName));
|
||||
EXPECT_EQ(1, (int)accountData->GetConnectedA11yAbilities().size());
|
||||
|
||||
GTEST_LOG_(INFO) << "AccessibilityCircleDrawingManager_Unittest_DrawingProgressByOpenSource_001 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityCircleDrawingManager_Unittest_DrawingProgressByOpenSource002
|
||||
* @tc.name: DrawingProgressByOpenSource
|
||||
* @tc.desc: Check the add connected ability.
|
||||
*/
|
||||
HWTEST_F(AccessibilityCircleDrawingManagerTest, AccessibilityCircleDrawingManager_Unittest_DrawingProgressByOpenSource002, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityCircleDrawingManager_Unittest_DrawingProgressByOpenSource_002 start";
|
||||
const int32_t accountId = 1;
|
||||
sptr<AccessibleAbilityConnection> connection = nullptr;
|
||||
sptr<AccessibilityCircleDrawingManager> accountData = new AccessibilityCircleDrawingManager(accountId);
|
||||
accountData->DrawingProgressByOpenSource(connection);
|
||||
EXPECT_EQ(0, (int)accountData->GetConnectedA11yAbilities().size());
|
||||
GTEST_LOG_(INFO) << "AccessibilityCircleDrawingManager_Unittest_DrawingProgressByOpenSource_002 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityCircleDrawingManager_Unittest_DrawingProgressByRosenDrawing001
|
||||
* @tc.name: DrawingProgressByRosenDrawing
|
||||
* @tc.desc: Check the remove connected ability.
|
||||
*/
|
||||
HWTEST_F(AccessibilityCircleDrawingManagerTest,
|
||||
AccessibilityCircleDrawingManager_Unittest_DrawingProgressByRosenDrawing001, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityCircleDrawingManager_Unittest_DrawingProgressByRosenDrawing001 start";
|
||||
const int32_t accountId = 1;
|
||||
int32_t connectCounter = 0;
|
||||
AccessibilityAbilityInitParams initParams;
|
||||
sptr<AccessibilityCircleDrawingManager> accountData = new AccessibilityCircleDrawingManager(accountId);
|
||||
std::shared_ptr<AccessibilityAbilityInfo> abilityInfo = std::make_shared<AccessibilityAbilityInfo>(initParams);
|
||||
sptr<AccessibleAbilityConnection> connection = new MockAccessibleAbilityConnection(accountId, connectCounter++, *abilityInfo);
|
||||
EXPECT_EQ(0, (int)accountData->GetConnectedA11yAbilities().size());
|
||||
accountData->DrawingProgressByOpenSource(connection);
|
||||
EXPECT_EQ(1, (int)accountData->GetConnectedA11yAbilities().size());
|
||||
const std::string elementName = Utils::GetUri(connection->GetElementName());
|
||||
EXPECT_EQ(connection, accountData->GetAccessibleAbilityConnection(elementName));
|
||||
accountData->DrawingProgressByRosenDrawing(connection->GetElementName());
|
||||
EXPECT_EQ(0, (int)accountData->GetConnectedA11yAbilities().size());
|
||||
GTEST_LOG_(INFO) << "AccessibilityCircleDrawingManager_Unittest_DrawingProgressByRosenDrawing001 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityCircleDrawingManager_Unittest_DrawingProgress001
|
||||
* @tc.name: DrawingProgress
|
||||
* @tc.desc: Check DrawingProgress.
|
||||
*/
|
||||
HWTEST_F(AccessibilityCircleDrawingManagerTest,
|
||||
AccessibilityCircleDrawingManager_Unittest_DrawingProgress001, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityCircleDrawingManager_Unittest_DrawingProgress001 start";
|
||||
const int32_t accountId = 0;
|
||||
const std::string bundleName = "abc";
|
||||
sptr<AccessibilityCircleDrawingManager> accountData = new AccessibilityCircleDrawingManager(accountId);
|
||||
accountData->DrawingProgress(bundleName);
|
||||
EXPECT_EQ(0, (int)accountData->GetInstalledAbilities().size());
|
||||
GTEST_LOG_(INFO) << "AccessibilityCircleDrawingManager_Unittest_DrawingProgress001 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityCircleDrawingManager_Unittest_SetPointerLocation001
|
||||
* @tc.name: SetPointerLocation
|
||||
* @tc.desc: Check SetPointerLocation.
|
||||
*/
|
||||
HWTEST_F(AccessibilityCircleDrawingManagerTest,
|
||||
AccessibilityCircleDrawingManager_Unittest_SetPointerLocation002, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityCircleDrawingManager_Unittest_SetPointerLocation002 start";
|
||||
const int32_t accountId = 1;
|
||||
const std::string name = "aaa";
|
||||
const std::string bundleName = "abc";
|
||||
sptr<AccessibilityCircleDrawingManager> accountData = new AccessibilityCircleDrawingManager(accountId);
|
||||
AccessibilityAbilityInitParams initParams;
|
||||
initParams.name = name;
|
||||
initParams.bundleName = bundleName;
|
||||
std::shared_ptr<AccessibilityAbilityInfo> abilityInfo = std::make_shared<AccessibilityAbilityInfo>(initParams);
|
||||
abilityInfo->SetCapabilityValues(1);
|
||||
accountData->GetStagingProperties(*abilityInfo);
|
||||
accountData->SetPointerLocation(bundleName);
|
||||
std::string abilityId = bundleName + "/" + name;
|
||||
bool ret = accountData->GetAbilityAutoStartState(abilityId);
|
||||
EXPECT_EQ(false, ret);
|
||||
GTEST_LOG_(INFO) << "AccessibilityCircleDrawingManager_Unittest_SetPointerLocation002 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityCircleDrawingManager_Unittest_DrawPointer001
|
||||
* @tc.name: DrawPointer
|
||||
* @tc.desc: Check the DrawPointer.
|
||||
*/
|
||||
HWTEST_F(AccessibilityCircleDrawingManagerTest, AccessibilityCircleDrawingManager_Unittest_DrawPointer001, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityCircleDrawingManager_Unittest_DrawPointer001 start";
|
||||
const int32_t accountId = 2;
|
||||
int32_t connectCounter = 0;
|
||||
AccessibilityAbilityInitParams initParams;
|
||||
std::shared_ptr<AccessibilityAbilityInfo> abilityInfo = std::make_shared<AccessibilityAbilityInfo>(initParams);
|
||||
sptr<AccessibilityCircleDrawingManager> accountData = new AccessibilityCircleDrawingManager(accountId);
|
||||
sptr<AccessibleAbilityConnection> connection =
|
||||
new MockAccessibleAbilityConnection(accountId, connectCounter++, *abilityInfo);
|
||||
EXPECT_EQ(0, (int)accountData->UpdatePointerVisible().size());
|
||||
/* add */
|
||||
accountData->DrawingProgressByOpenSource(connection);
|
||||
const std::string elementNameURI = Utils::GetUri(connection->GetElementName());
|
||||
EXPECT_EQ(1, (int)accountData->SetPointerLocation().size());
|
||||
EXPECT_EQ(connection, accountData->GetAccessibleAbilityConnection(elementNameURI));
|
||||
EXPECT_FALSE(accountData->CreatePointerWindow(elementNameURI));
|
||||
/* disconnect */
|
||||
accountData->DrawingProgress(connection->GetElementName());
|
||||
EXPECT_EQ(0, (int)accountData->DrawPointer().size());
|
||||
GTEST_LOG_(INFO) << "AccessibilityCircleDrawingManager_Unittest_DrawPointer001 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityCircleDrawingManager_Unittest_ParseStringToInteger001
|
||||
* @tc.name: ParseStringToInteger
|
||||
* @tc.desc: Check the remove connecting A11y ability.GetAccessibilityWindows
|
||||
*/
|
||||
HWTEST_F(
|
||||
AccessibilityCircleDrawingManagerTest, AccessibilityCircleDrawingManager_Unittest_ParseStringToInteger001, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityCircleDrawingManager_Unittest_ParseStringToInteger001 start";
|
||||
const int32_t accountId = 1;
|
||||
sptr<AccessibilityCircleDrawingManager> accountData = new AccessibilityCircleDrawingManager(accountId);
|
||||
const std::string bundleName = "abc";
|
||||
EXPECT_FALSE(accountData->GetConnectingA11yAbility(bundleName));
|
||||
AccessibilityAbilityInitParams initParams;
|
||||
std::shared_ptr<AccessibilityAbilityInfo> abilityInfo = std::make_shared<AccessibilityAbilityInfo>(initParams);
|
||||
sptr<AccessibleAbilityConnection> connection =
|
||||
new MockAccessibleAbilityConnection(accountId, 0, *abilityInfo);
|
||||
accountData->AddConnectingA11yAbility(bundleName, connection);
|
||||
EXPECT_TRUE(accountData->GetConnectingA11yAbility(bundleName));
|
||||
accountData->ParseStringToInteger(bundleName);
|
||||
EXPECT_FALSE(accountData->GetConnectingA11yAbility(bundleName));
|
||||
GTEST_LOG_(INFO) << "AccessibilityCircleDrawingManager_Unittest_ParseStringToInteger001 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityCircleDrawingManager_Unittest_ParseColorString001
|
||||
* @tc.name: ParseColorString
|
||||
* @tc.desc: Check the add enable ability.
|
||||
*/
|
||||
HWTEST_F(AccessibilityCircleDrawingManagerTest, AccessibilityCircleDrawingManager_Unittest_ParseColorString001, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityCircleDrawingManager_Unittest_ParseColorString001 start";
|
||||
const int32_t accountId = 1;
|
||||
sptr<AccessibilityCircleDrawingManager> accountData = new AccessibilityCircleDrawingManager(accountId);
|
||||
const std::string bundleName = "/ccc";
|
||||
accountData->Init();
|
||||
AccessibilityAbilityInitParams initParams;
|
||||
initParams.name = "ccc";
|
||||
std::shared_ptr<AccessibilityAbilityInfo> abilityInfo = std::make_shared<AccessibilityAbilityInfo>(initParams);
|
||||
abilityInfo->SetCapabilityValues(1);
|
||||
accountData->AddInstalledAbility(*abilityInfo);
|
||||
accountData->ParseColorString(bundleName);
|
||||
accountData->ParseColorString(bundleName);
|
||||
EXPECT_EQ(1, (int)accountData->GetEnabledAbilities().size());
|
||||
GTEST_LOG_(INFO) << "AccessibilityCircleDrawingManager_Unittest_ParseColorString001 end";
|
||||
}
|
@ -0,0 +1,300 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <unistd.h>
|
||||
#include "accessibility_dumper.h"
|
||||
#include "accessibility_ut_helper.h"
|
||||
#include "mock_accessible_ability_connection.h"
|
||||
#include "mock_accessible_ability_manager_service.h"
|
||||
#include "string_ex.h"
|
||||
|
||||
using namespace testing;
|
||||
using namespace testing::ext;
|
||||
|
||||
namespace OHOS {
|
||||
namespace Accessibility {
|
||||
class AccessibilityDatashareHelperTest : public ::testing::Test {
|
||||
public:
|
||||
AccessibilityDatashareHelperTest()
|
||||
{}
|
||||
~AccessibilityDatashareHelperTest()
|
||||
{}
|
||||
|
||||
static void SetUpTestCase();
|
||||
static void TearDownTestCase();
|
||||
void SetUp() override;
|
||||
void TearDown() override;
|
||||
|
||||
int fd_ = -1;
|
||||
sptr<AccessibilityDumper> dumper_ = nullptr;
|
||||
};
|
||||
|
||||
void AccessibilityDatashareHelperTest::SetUpTestCase()
|
||||
{
|
||||
GTEST_LOG_(INFO) << "###################### AccessibilityDatashareHelperTest Start ######################";
|
||||
}
|
||||
|
||||
void AccessibilityDatashareHelperTest::TearDownTestCase()
|
||||
{
|
||||
GTEST_LOG_(INFO) << "###################### AccessibilityDatashareHelperTest End ######################";
|
||||
}
|
||||
|
||||
void AccessibilityDatashareHelperTest::SetUp()
|
||||
{
|
||||
fd_ = open("/dev/stdout", O_WRONLY);
|
||||
dumper_ = new AccessibilityDumper();
|
||||
}
|
||||
|
||||
void AccessibilityDatashareHelperTest::TearDown()
|
||||
{
|
||||
close(fd_);
|
||||
fd_ = -1;
|
||||
dumper_ = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityDatashareHelper_Unittest_GetStringValue_001
|
||||
* @tc.name: GetStringValue
|
||||
* @tc.desc: Test function GetStringValue
|
||||
*/
|
||||
HWTEST_F(AccessibilityDatashareHelperTest, AccessibilityDatashareHelper_Unittest_GetStringValue_001, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityDatashareHelper_Unittest_GetStringValue_001 start";
|
||||
std::vector<std::u16string> args;
|
||||
int ret = GetStringValueer_->GetStringValue(-1, args);
|
||||
EXPECT_EQ(-1, ret);
|
||||
GTEST_LOG_(INFO) << "AccessibilityDatashareHelper_Unittest_GetStringValue_001 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityDatashareHelper_Unittest_GetStringValue_002
|
||||
* @tc.name: GetStringValue
|
||||
* @tc.desc: Test function GetStringValue
|
||||
*/
|
||||
HWTEST_F(AccessibilityDatashareHelperTest, AccessibilityDatashareHelper_Unittest_GetStringValue_002, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityDatashareHelper_Unittest_GetStringValue_002 start";
|
||||
std::vector<std::u16string> args;
|
||||
int ret = GetStringValueer_->GetStringValue(fd_, args);
|
||||
EXPECT_GE(ret, -1);
|
||||
GTEST_LOG_(INFO) << "AccessibilityDatashareHelper_Unittest_GetStringValue_002 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityDatashareHelper_Unittest_GetStringValue_003
|
||||
* @tc.name: GetStringValue
|
||||
* @tc.desc: Test function GetStringValue
|
||||
*/
|
||||
HWTEST_F(AccessibilityDatashareHelperTest, AccessibilityDatashareHelper_Unittest_GetStringValue_003, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityDatashareHelper_Unittest_GetStringValue_003 start";
|
||||
std::string cmdHelp("-h");
|
||||
std::vector<std::u16string> args;
|
||||
args.emplace_back(Str8ToStr16(cmdHelp));
|
||||
int ret = GetStringValueer_->GetStringValue(fd_, args);
|
||||
EXPECT_GE(ret, -1);
|
||||
GTEST_LOG_(INFO) << "AccessibilityDatashareHelper_Unittest_GetStringValue_003 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityDatashareHelper_Unittest_GetLongValue_001
|
||||
* @tc.name: GetLongValue
|
||||
* @tc.desc: Test function GetLongValue
|
||||
*/
|
||||
HWTEST_F(AccessibilityDatashareHelperTest, AccessibilityDatashareHelper_Unittest_GetLongValue_001, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityDatashareHelper_Unittest_GetLongValue_001 start";
|
||||
sptr<AccessibilityAccountData> currentAccount =
|
||||
Singleton<AccessibleAbilityManagerService>::GetInstance().GetCurrentAccountData();
|
||||
if (!currentAccount) {
|
||||
GTEST_LOG_(ERROR) << "Account data is nullptr";
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<AccessibilitySettingsConfig> config = currentAccount->GetConfig();
|
||||
if (!config) {
|
||||
GTEST_LOG_(ERROR) << "Config is nullptr";
|
||||
return;
|
||||
}
|
||||
config->GetLongValue(true);
|
||||
std::string cmdUser("-u");
|
||||
std::vector<std::u16string> args;
|
||||
args.emplace_back(Str8ToStr16(cmdUser));
|
||||
int ret = dumper_->Dump(fd_, args);
|
||||
EXPECT_GE(ret, -1);
|
||||
GTEST_LOG_(INFO) << "AccessibilityDatashareHelper_Unittest_GetLongValue_001 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityDatashareHelper_Unittest_GetLongValue_002
|
||||
* @tc.name: GetLongValue
|
||||
* @tc.desc: Test function GetLongValue
|
||||
*/
|
||||
HWTEST_F(AccessibilityDatashareHelperTest, AccessibilityDumper_Unittest_GetLongValue_002, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityDatashareHelper_Unittest_GetLongValue_002 start";
|
||||
AccessibilityAbilityInitParams initParams;
|
||||
initParams.bundleName = "ohos";
|
||||
initParams.moduleName = "accessibility";
|
||||
initParams.name = "test";
|
||||
initParams.description = "for GetLongValue-ut";
|
||||
std::shared_ptr<AccessibilityAbilityInfo> abilityInfo = std::make_shared<AccessibilityAbilityInfo>(initParams);
|
||||
sptr<AccessibilityAccountData> currentAccount =
|
||||
Singleton<AccessibleAbilityManagerService>::GetInstance().GetCurrentAccountData();
|
||||
if (!currentAccount) {
|
||||
GTEST_LOG_(ERROR) << "Account data is nullptr";
|
||||
return;
|
||||
}
|
||||
sptr<AccessibleAbilityConnection> connection =
|
||||
new MockAccessibleAbilityConnection(currentAccount->GetAccountId(), 0, *abilityInfo);
|
||||
if (!connection) {
|
||||
GTEST_LOG_(ERROR) << "Connection is nullptr";
|
||||
return;
|
||||
}
|
||||
currentAccount->AddConnectedAbility(connection);
|
||||
std::string cmdClient("-c");
|
||||
std::vector<std::u16string> args;
|
||||
args.emplace_back(Str8ToStr16(cmdClient));
|
||||
int ret = GetLongValueer_->GetLongValue(fd_, args);
|
||||
EXPECT_GE(ret, -1);
|
||||
currentAccount->RemoveConnectedAbility(connection->GetElementName());
|
||||
GTEST_LOG_(INFO) << "AccessibilityDatashareHelper_Unittest_GetLongValue_002 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityDatashareHelper_Unittest_PutStringValue_001
|
||||
* @tc.name: PutStringValue
|
||||
* @tc.desc: Test function PutStringValue.
|
||||
*/
|
||||
HWTEST_F(AccessibilityDatashareHelperTest, AccessibilityDatashareHelper_Unittest_PutStringValue_001, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityDatashareHelper_Unittest_PutStringValue_006 start";
|
||||
const int32_t accountId = 1;
|
||||
const int32_t windowId = 1;
|
||||
sptr<AccessibilityAccountData> currentAccount =
|
||||
Singleton<AccessibleAbilityManagerService>::GetInstance().GetCurrentAccountData();
|
||||
if (!currentAccount) {
|
||||
GTEST_LOG_(ERROR) << "Account data is nullptr";
|
||||
return;
|
||||
}
|
||||
sptr<AccessibilityWindowConnection> operationConnection =
|
||||
new AccessibilityWindowConnection(windowId, nullptr, accountId);
|
||||
currentAccount->AddAccessibilityWindowConnection(windowId, operationConnection);
|
||||
std::string cmdWindow("-w");
|
||||
std::vector<std::u16string> args;
|
||||
args.emplace_back(Str8ToStr16(cmdWindow));
|
||||
int ret = PutStringValueer_->PutStringValue(fd_, args);
|
||||
EXPECT_GE(ret, -1);
|
||||
currentAccount->RemoveAccessibilityWindowConnection(windowId);
|
||||
GTEST_LOG_(INFO) << "AccessibilityDatashareHelper_Unittest_PutStringValue_006 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityDatashareHelper_Unittest_PutStringValue_002
|
||||
* @tc.name: PutStringValue
|
||||
* @tc.desc: Test function PutStringValue
|
||||
*/
|
||||
HWTEST_F(AccessibilityDatashareHelperTest, AccessibilityDatashareHelper_Unittest_PutStringValue_002, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityDatashareHelper_Unittest_PutStringValue_001 start";
|
||||
sptr<AccessibilityAccountData> currentAccount =
|
||||
Singleton<AccessibleAbilityManagerService>::GetInstance().GetCurrentAccountData();
|
||||
|
||||
std::shared_ptr<AccessibilitySettingsConfig> config = currentAccount->GetConfig();
|
||||
if (!config) {
|
||||
GTEST_LOG_(ERROR) << "Config is nullptr";
|
||||
return;
|
||||
}
|
||||
config->SetCaptionState(true);
|
||||
std::string cmdUser("-u");
|
||||
std::vector<std::u16string> args;
|
||||
args.emplace_back(Str8ToStr16(cmdUser));
|
||||
AccessibilityAbilityHelper::GetInstance().SetNeedAccountDataNullFlag(true);
|
||||
int ret = PutStringValueer_->PutStringValue(fd_, args);
|
||||
EXPECT_GE(ret, -1);
|
||||
AccessibilityAbilityHelper::GetInstance().SetNeedAccountDataNullFlag(false);
|
||||
GTEST_LOG_(INFO) << "AccessibilityDatashareHelper_Unittest_PutStringValue_002 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityDatashareHelper_Unittest_Initialize_001
|
||||
* @tc.name: Initialize
|
||||
* @tc.desc: Test function Initialize
|
||||
*/
|
||||
HWTEST_F(AccessibilityDatashareHelperTest, AccessibilityDatashareHelper_Unittest_Initialize_001, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityDatashareHelper_Unittest_Initialize_001 start";
|
||||
AccessibilityAbilityInitParams initParams;
|
||||
initParams.bundleName = "ohos";
|
||||
initParams.moduleName = "accessibility";
|
||||
initParams.name = "test";
|
||||
initParams.description = "for dumper-ut";
|
||||
std::shared_ptr<AccessibilityAbilityInfo> abilityInfo = std::make_shared<AccessibilityAbilityInfo>(initParams);
|
||||
sptr<AccessibilityAccountData> currentAccount =
|
||||
Singleton<AccessibleAbilityManagerService>::GetInstance().GetCurrentAccountData();
|
||||
if (!currentAccount) {
|
||||
GTEST_LOG_(ERROR) << "Account data is nullptr";
|
||||
return;
|
||||
}
|
||||
sptr<AccessibleAbilityConnection> connection =
|
||||
new MockAccessibleAbilityConnection(currentAccount->GetAccountId(), 0, *abilityInfo);
|
||||
if (!connection) {
|
||||
GTEST_LOG_(ERROR) << "Connection is nullptr";
|
||||
return;
|
||||
}
|
||||
currentAccount->AddConnectedAbility(connection);
|
||||
std::string cmdClient("-c");
|
||||
std::vector<std::u16string> args;
|
||||
args.emplace_back(Str8ToStr16(cmdClient));
|
||||
AccessibilityAbilityHelper::GetInstance().Initialize(true);
|
||||
int ret = dumper_->Dump(fd_, args);
|
||||
AccessibilityAbilityHelper::GetInstance().Initialize(false);
|
||||
EXPECT_GE(ret, -1);
|
||||
currentAccount->RemoveConnectedAbility(connection->GetElementName());
|
||||
GTEST_LOG_(INFO) << "AccessibilityDatashareHelper_Unittest_Initialize_001 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityDatashareHelper_Unittest_Initialize_002
|
||||
* @tc.name: Initialize
|
||||
* @tc.desc: Test function Initialize.
|
||||
*/
|
||||
HWTEST_F(AccessibilityDatashareHelperTest, AccessibilityDatashareHelper_Unittest_Initialize_002, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityDatashareHelper_Unittest_Initialize_002 start";
|
||||
const int32_t accountId = 1;
|
||||
const int32_t windowId = 1;
|
||||
sptr<AccessibilityAccountData> currentAccount =
|
||||
Singleton<AccessibleAbilityManagerService>::GetInstance().GetCurrentAccountData();
|
||||
if (!currentAccount) {
|
||||
GTEST_LOG_(ERROR) << "Account data is nullptr";
|
||||
return;
|
||||
}
|
||||
sptr<AccessibilityWindowConnection> operationConnection =
|
||||
new AccessibilityWindowConnection(windowId, nullptr, accountId);
|
||||
currentAccount->AddAccessibilityWindowConnection(windowId, operationConnection);
|
||||
std::string cmdWindow("-w");
|
||||
std::vector<std::u16string> args;
|
||||
args.emplace_back(Str8ToStr16(cmdWindow));
|
||||
AccessibilityAbilityHelper::GetInstance().Initialize(true);
|
||||
int ret = Initializeer_->Initialize(fd_, args);
|
||||
EXPECT_GE(ret, -1);
|
||||
AccessibilityAbilityHelper::GetInstance().Initialize(false);
|
||||
currentAccount->RemoveAccessibilityWindowConnection(windowId);
|
||||
GTEST_LOG_(INFO) << "AccessibilityDatashareHelper_Unittest_Initialize_002 end";
|
||||
}
|
||||
} // namespace Accessibility
|
||||
} // namespace OHOS
|
@ -0,0 +1,145 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <vector>
|
||||
#include "accessibility_event_transmission.h"
|
||||
#include "hilog_wrapper.h"
|
||||
|
||||
using namespace testing;
|
||||
using namespace testing::ext;
|
||||
|
||||
namespace OHOS {
|
||||
namespace Accessibility {
|
||||
class EventTransmissionTest : public ::testing::Test {
|
||||
public:
|
||||
EventTransmissionTest()
|
||||
{}
|
||||
~EventTransmissionTest()
|
||||
{}
|
||||
|
||||
static void SetUpTestCase();
|
||||
static void TearDownTestCase();
|
||||
void SetUp() override;
|
||||
void TearDown() override;
|
||||
};
|
||||
|
||||
void EventTransmissionTest::SetUpTestCase()
|
||||
{
|
||||
GTEST_LOG_(INFO) << "###################### EventTransmissionTest Start ######################";
|
||||
}
|
||||
|
||||
void EventTransmissionTest::TearDownTestCase()
|
||||
{
|
||||
GTEST_LOG_(INFO) << "###################### EventTransmissionTest End ######################";
|
||||
}
|
||||
|
||||
void EventTransmissionTest::SetUp()
|
||||
{}
|
||||
|
||||
void EventTransmissionTest::TearDown()
|
||||
{}
|
||||
|
||||
/**
|
||||
* @tc.number: EventTransmission_Unittest_OnKeyEvent_001
|
||||
* @tc.name: OnKeyEvent
|
||||
* @tc.desc: Test function OnKeyEvent
|
||||
*/
|
||||
HWTEST_F(EventTransmissionTest,
|
||||
EventTransmission_Unittest_OnKeyEvent_001, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "EventTransmission_Unittest_OnKeyEvent_001 start";
|
||||
|
||||
Singleton<EventTransmission>::GetInstance().OnKeyEvent(nullptr);
|
||||
|
||||
GTEST_LOG_(INFO) << "EventTransmission_Unittest_OnKeyEvent_001 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: EventTransmission_Unittest_OnPointerEvent_001
|
||||
* @tc.name: OnPointerEvent
|
||||
* @tc.desc: Test function OnPointerEvent
|
||||
*/
|
||||
HWTEST_F(EventTransmissionTest,
|
||||
EventTransmission_Unittest_OnPointerEvent_001, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "EventTransmission_Unittest_OnPointerEvent_001 start";
|
||||
|
||||
Singleton<EventTransmission>::GetInstance().OnPointerEvent();
|
||||
|
||||
GTEST_LOG_(INFO) << "EventTransmission_Unittest_OnPointerEvent_001 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: EventTransmission_Unittest_OnMoveMouse_001
|
||||
* @tc.name: OnMoveMouse
|
||||
* @tc.desc: Test function OnMoveMouse
|
||||
*/
|
||||
HWTEST_F(EventTransmissionTest, EventTransmission_Unittest_OnMoveMouse_001, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "EventTransmission_Unittest_OnMoveMouse_001 start";
|
||||
std::vector<int> infos{1};
|
||||
auto display = Singleton<EventTransmission>::GetInstance().OnMoveMouse(0);
|
||||
EXPECT_EQ(infos.size(), 1);
|
||||
|
||||
GTEST_LOG_(INFO) << "EventTransmission_Unittest_OnMoveMouse_001 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: EventTransmission_Unittest_SetNext_001
|
||||
* @tc.name: SetNext
|
||||
* @tc.desc: Test function SetNext
|
||||
*/
|
||||
HWTEST_F(EventTransmissionTest, EventTransmission_Unittest_SetNext_001, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "EventTransmission_Unittest_SetNext_001 start";
|
||||
std::vector<int> infos{1};
|
||||
auto displays = Singleton<EventTransmission>::GetInstance().SetNext();
|
||||
EXPECT_EQ(infos.size(), 1);
|
||||
GTEST_LOG_(INFO) << "EventTransmission_Unittest_SetNext_001 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: EventTransmission_Unittest_GetNext_001
|
||||
* @tc.name: GetNext
|
||||
* @tc.desc: Test function GetNext
|
||||
*/
|
||||
HWTEST_F(
|
||||
EventTransmissionTest, EventTransmission_Unittest_GetNext_001, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "EventTransmission_Unittest_GetNext_001 start";
|
||||
|
||||
auto display = Singleton<EventTransmission>::GetInstance().GetNext();
|
||||
|
||||
GTEST_LOG_(INFO) << "EventTransmission_Unittest_GetNext_001 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: EventTransmission_Unittest_DestroyEvents_001
|
||||
* @tc.name: DestroyEvents
|
||||
* @tc.desc: Test function DestroyEvents
|
||||
*/
|
||||
HWTEST_F(
|
||||
EventTransmissionTest, EventTransmission_Unittest_DestroyEvents_001, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "EventTransmission_Unittest_DestroyEvents_001 start";
|
||||
|
||||
uint64_t displayId = Singleton<EventTransmission>::GetInstance().DestroyEvents();
|
||||
GTEST_LOG_(INFO) << "DefaultDisplayId" << displayId;
|
||||
|
||||
GTEST_LOG_(INFO) << "EventTransmission_Unittest_DestroyEvents_001 end";
|
||||
}
|
||||
} // namespace Accessibility
|
||||
} // namespace OHOS
|
@ -0,0 +1,942 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include "accessibility_gesture_recognizer.h"
|
||||
#include "hilog_wrapper.h"
|
||||
#include <cinttypes>
|
||||
|
||||
using namespace testing;
|
||||
using namespace testing::ext;
|
||||
|
||||
namespace OHOS {
|
||||
namespace Accessibility {
|
||||
class AccessAccessibilityGestureRecognizerTest : public ::testing::Test {
|
||||
public:
|
||||
AccessAccessibilityGestureRecognizerTest()
|
||||
{}
|
||||
~AccessAccessibilityGestureRecognizerTest()
|
||||
{}
|
||||
|
||||
static void SetUpTestCase();
|
||||
static void TearDownTestCase();
|
||||
void OnPointerEventPresss(MMI::KeyEvent &event, const int32_t keycode);
|
||||
void SetUp() override;
|
||||
void TearDown() override;
|
||||
|
||||
std::shared_ptr<AccessAccessibilityGestureRecognizer> mouseKey_ = nullptr;
|
||||
};
|
||||
|
||||
void AccessAccessibilityGestureRecognizerTest::SetUpTestCase()
|
||||
{
|
||||
GTEST_LOG_(INFO) << "###################### AccessAccessibilityGestureRecognizerTest Start ######################";
|
||||
}
|
||||
|
||||
void AccessAccessibilityGestureRecognizerTest::TearDownTestCase()
|
||||
{
|
||||
GTEST_LOG_(INFO) << "###################### AccessAccessibilityGestureRecognizerTest End ######################";
|
||||
}
|
||||
|
||||
void AccessAccessibilityGestureRecognizerTest::SetUp()
|
||||
{
|
||||
GTEST_LOG_(INFO) << "SetUp";
|
||||
mouseKey_ = std::make_shared<AccessAccessibilityGestureRecognizer>();
|
||||
}
|
||||
|
||||
void AccessAccessibilityGestureRecognizerTest::TearDown()
|
||||
{
|
||||
GTEST_LOG_(INFO) << "TearDown";
|
||||
mouseKey_ = nullptr;
|
||||
}
|
||||
|
||||
void AccessAccessibilityGestureRecognizerTest::OnPointerEventPresss(MMI::KeyEvent &event, const int32_t keycode)
|
||||
{
|
||||
// presss
|
||||
event.SetKeyCode(keycode);
|
||||
MMI::KeyEvent::KeyItem item;
|
||||
item.SetKeyCode(keycode);
|
||||
item.SetPressed(true);
|
||||
event.AddKeyItem(item);
|
||||
mouseKey_->OnPointerEvent(event);
|
||||
event.RemoveReleasedKeyItems(item);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessAccessibilityGestureRecognizer_Unittest_GetDoubleTapMoveThreshold_001
|
||||
* @tc.name: GetDoubleTapMoveThreshold
|
||||
* @tc.desc: Test function GetDoubleTapMoveThreshold
|
||||
*/
|
||||
HWTEST_F(AccessAccessibilityGestureRecognizerTest, AccessAccessibilityGestureRecognizer_Unittest_GetDoubleTapMoveThreshold_001, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_GetDoubleTapMoveThreshold_001 start";
|
||||
if (!mouseKey_) {
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<MMI::PointerEvent> event = MMI::PointerEvent::Create();
|
||||
if (!event) {
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_GetDoubleTapMoveThreshold_001 event is null";
|
||||
return;
|
||||
}
|
||||
event->SetSourceType(MMI::PointerEvent::SOURCE_TYPE_MOUSE);
|
||||
event->SetPointerAction(MMI::PointerEvent::POINTER_ACTION_MOVE);
|
||||
MMI::PointerEvent::PointerItem item;
|
||||
event->AddPointerItem(item);
|
||||
mouseKey_->GetDoubleTapMoveThreshold(*event);
|
||||
EXPECT_NE(event.get(), nullptr);
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_GetDoubleTapMoveThreshold_001 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessAccessibilityGestureRecognizer_Unittest_GetDoubleTapMoveThreshold_002
|
||||
* @tc.name: GetDoubleTapMoveThreshold
|
||||
* @tc.desc: Test function GetDoubleTapMoveThreshold
|
||||
* @tc.require: issueI5NTXA
|
||||
*/
|
||||
HWTEST_F(AccessAccessibilityGestureRecognizerTest, AccessAccessibilityGestureRecognizer_Unittest_GetDoubleTapMoveThreshold_002, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_GetDoubleTapMoveThreshold_002 start";
|
||||
if (!mouseKey_) {
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<MMI::PointerEvent> event = MMI::PointerEvent::Create();
|
||||
if (!event) {
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_GetDoubleTapMoveThreshold_002 event is null";
|
||||
return;
|
||||
}
|
||||
event->SetSourceType(MMI::PointerEvent::SOURCE_TYPE_TOUCHSCREEN);
|
||||
event->SetPointerAction(MMI::PointerEvent::POINTER_ACTION_MOVE);
|
||||
MMI::PointerEvent::PointerItem item;
|
||||
event->AddPointerItem(item);
|
||||
mouseKey_->GetDoubleTapMoveThreshold(*event);
|
||||
EXPECT_NE(event.get(), nullptr);
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_GetDoubleTapMoveThreshold_002 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_001
|
||||
* @tc.name: OnPointerEvent
|
||||
* @tc.desc: Test function OnPointerEvent
|
||||
*/
|
||||
HWTEST_F(AccessAccessibilityGestureRecognizerTest, AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_001, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_001 start";
|
||||
if (!mouseKey_) {
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<MMI::KeyEvent> event = MMI::KeyEvent::Create();
|
||||
if (!event) {
|
||||
return;
|
||||
}
|
||||
event->SetKeyAction(MMI::KeyEvent::KEY_ACTION_DOWN);
|
||||
OnPointerEventPresss(*event, MMI::KeyEvent::KEYCODE_NUMPAD_1);
|
||||
OnPointerEventPresss(*event, MMI::KeyEvent::KEYCODE_NUMPAD_2);
|
||||
OnPointerEventPresss(*event, MMI::KeyEvent::KEYCODE_NUMPAD_3);
|
||||
OnPointerEventPresss(*event, MMI::KeyEvent::KEYCODE_NUMPAD_4);
|
||||
OnPointerEventPresss(*event, MMI::KeyEvent::KEYCODE_NUMPAD_6);
|
||||
OnPointerEventPresss(*event, MMI::KeyEvent::KEYCODE_NUMPAD_7);
|
||||
OnPointerEventPresss(*event, MMI::KeyEvent::KEYCODE_NUMPAD_8);
|
||||
OnPointerEventPresss(*event, MMI::KeyEvent::KEYCODE_NUMPAD_9);
|
||||
|
||||
EXPECT_NE(event.get(), nullptr);
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_001 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_002
|
||||
* @tc.name: OnPointerEvent
|
||||
* @tc.desc: Test function OnPointerEvent
|
||||
*/
|
||||
HWTEST_F(AccessAccessibilityGestureRecognizerTest, AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_002, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_002 start";
|
||||
if (!mouseKey_) {
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<MMI::KeyEvent> event = MMI::KeyEvent::Create();
|
||||
if (!event) {
|
||||
return;
|
||||
}
|
||||
event->SetKeyCode(MMI::KeyEvent::KEYCODE_NUMPAD_1);
|
||||
event->SetKeyAction(MMI::KeyEvent::KEY_ACTION_UP);
|
||||
MMI::KeyEvent::KeyItem item;
|
||||
item.SetKeyCode(MMI::KeyEvent::KEYCODE_NUMPAD_1);
|
||||
event->AddKeyItem(item);
|
||||
mouseKey_->OnPointerEvent(*event);
|
||||
EXPECT_NE(event.get(), nullptr);
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_002 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_003
|
||||
* @tc.name: OnPointerEvent
|
||||
* @tc.desc: Test function OnPointerEvent
|
||||
*/
|
||||
HWTEST_F(AccessAccessibilityGestureRecognizerTest, AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_003, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_003 start";
|
||||
if (!mouseKey_) {
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<MMI::PointerEvent> event = MMI::PointerEvent::Create();
|
||||
if (!event) {
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_003 event is null";
|
||||
return;
|
||||
}
|
||||
event->SetSourceType(MMI::PointerEvent::SOURCE_TYPE_MOUSE);
|
||||
event->SetPointerAction(MMI::PointerEvent::POINTER_ACTION_MOVE);
|
||||
MMI::PointerEvent::PointerItem item;
|
||||
event->AddPointerItem(item);
|
||||
mouseKey_->GetDoubleTapMoveThreshold(*event);
|
||||
std::shared_ptr<MMI::KeyEvent> event3 = MMI::KeyEvent::Create();
|
||||
if (!event3) {
|
||||
return;
|
||||
}
|
||||
event3->SetKeyCode(MMI::KeyEvent::KEYCODE_NUMPAD_DIVIDE);
|
||||
event3->SetKeyAction(MMI::KeyEvent::KEY_ACTION_DOWN);
|
||||
MMI::KeyEvent::KeyItem item1;
|
||||
item1.SetKeyCode(MMI::KeyEvent::KEYCODE_NUMPAD_DIVIDE);
|
||||
item1.SetPressed(true);
|
||||
event3->AddKeyItem(item1);
|
||||
mouseKey_->OnPointerEvent(*event3);
|
||||
std::shared_ptr<MMI::KeyEvent> event2 = MMI::KeyEvent::Create();
|
||||
if (!event2) {
|
||||
return;
|
||||
}
|
||||
event2->SetKeyCode(MMI::KeyEvent::KEYCODE_NUMPAD_5);
|
||||
event2->SetKeyAction(MMI::KeyEvent::KEY_ACTION_DOWN);
|
||||
MMI::KeyEvent::KeyItem item3;
|
||||
item3.SetKeyCode(MMI::KeyEvent::KEYCODE_NUMPAD_5);
|
||||
item3.SetPressed(true);
|
||||
event2->AddKeyItem(item3);
|
||||
AccessibilityAbilityHelper::GetInstance().ClearTouchEventActionVector();
|
||||
mouseKey_->OnPointerEvent(*event2);
|
||||
int32_t touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(1);
|
||||
int32_t expectValue = MMI::PointerEvent::POINTER_ACTION_BUTTON_UP;
|
||||
EXPECT_EQ(touchAction, expectValue);
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_003 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_004
|
||||
* @tc.name: OnPointerEvent
|
||||
* @tc.desc: Test function OnPointerEvent
|
||||
*/
|
||||
HWTEST_F(AccessAccessibilityGestureRecognizerTest, AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_004, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_004 start";
|
||||
if (!mouseKey_) {
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<MMI::PointerEvent> event = MMI::PointerEvent::Create();
|
||||
if (!event) {
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_004 event is null";
|
||||
return;
|
||||
}
|
||||
event->SetSourceType(MMI::PointerEvent::SOURCE_TYPE_MOUSE);
|
||||
event->SetPointerAction(MMI::PointerEvent::POINTER_ACTION_MOVE);
|
||||
MMI::PointerEvent::PointerItem item;
|
||||
event->AddPointerItem(item);
|
||||
mouseKey_->GetDoubleTapMoveThreshold(*event);
|
||||
std::shared_ptr<MMI::KeyEvent> event4 = MMI::KeyEvent::Create();
|
||||
if (!event4) {
|
||||
return;
|
||||
}
|
||||
event4->SetKeyCode(MMI::KeyEvent::KEYCODE_NUMPAD_SUBTRACT);
|
||||
event4->SetKeyAction(MMI::KeyEvent::KEY_ACTION_DOWN);
|
||||
MMI::KeyEvent::KeyItem item1;
|
||||
item1.SetKeyCode(MMI::KeyEvent::KEYCODE_NUMPAD_SUBTRACT);
|
||||
item1.SetPressed(true);
|
||||
event4->AddKeyItem(item1);
|
||||
mouseKey_->OnPointerEvent(*event4);
|
||||
std::shared_ptr<MMI::KeyEvent> event2 = MMI::KeyEvent::Create();
|
||||
if (!event2) {
|
||||
return;
|
||||
}
|
||||
event2->SetKeyCode(MMI::KeyEvent::KEYCODE_NUMPAD_5);
|
||||
event2->SetKeyAction(MMI::KeyEvent::KEY_ACTION_DOWN);
|
||||
MMI::KeyEvent::KeyItem item4;
|
||||
item4.SetKeyCode(MMI::KeyEvent::KEYCODE_NUMPAD_5);
|
||||
item4.SetPressed(true);
|
||||
event2->AddKeyItem(item4);
|
||||
AccessibilityAbilityHelper::GetInstance().ClearTouchEventActionVector();
|
||||
mouseKey_->OnPointerEvent(*event2);
|
||||
int32_t touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(1);
|
||||
int32_t expectValue = MMI::PointerEvent::POINTER_ACTION_BUTTON_UP;
|
||||
EXPECT_EQ(touchAction, expectValue);
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_004 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_005
|
||||
* @tc.name: OnPointerEvent
|
||||
* @tc.desc: Test function OnPointerEvent
|
||||
*/
|
||||
HWTEST_F(AccessAccessibilityGestureRecognizerTest, AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_005, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_005 start";
|
||||
if (!mouseKey_) {
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<MMI::PointerEvent> event = MMI::PointerEvent::Create();
|
||||
if (!event) {
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_005 event is null";
|
||||
return;
|
||||
}
|
||||
event->SetSourceType(MMI::PointerEvent::SOURCE_TYPE_MOUSE);
|
||||
event->SetPointerAction(MMI::PointerEvent::POINTER_ACTION_MOVE);
|
||||
MMI::PointerEvent::PointerItem item;
|
||||
event->AddPointerItem(item);
|
||||
mouseKey_->GetDoubleTapMoveThreshold(*event);
|
||||
std::shared_ptr<MMI::KeyEvent> event5 = MMI::KeyEvent::Create();
|
||||
if (!event5) {
|
||||
return;
|
||||
}
|
||||
event5->SetKeyCode(MMI::KeyEvent::KEYCODE_NUMPAD_MULTIPLY);
|
||||
event5->SetKeyAction(MMI::KeyEvent::KEY_ACTION_DOWN);
|
||||
MMI::KeyEvent::KeyItem item1;
|
||||
item1.SetKeyCode(MMI::KeyEvent::KEYCODE_NUMPAD_MULTIPLY);
|
||||
item1.SetPressed(true);
|
||||
event5->AddKeyItem(item1);
|
||||
mouseKey_->OnPointerEvent(*event5);
|
||||
std::shared_ptr<MMI::KeyEvent> event2 = MMI::KeyEvent::Create();
|
||||
if (!event2) {
|
||||
return;
|
||||
}
|
||||
event2->SetKeyCode(MMI::KeyEvent::KEYCODE_NUMPAD_5);
|
||||
event2->SetKeyAction(MMI::KeyEvent::KEY_ACTION_DOWN);
|
||||
MMI::KeyEvent::KeyItem item5;
|
||||
item5.SetKeyCode(MMI::KeyEvent::KEYCODE_NUMPAD_5);
|
||||
item5.SetPressed(true);
|
||||
event2->AddKeyItem(item5);
|
||||
AccessibilityAbilityHelper::GetInstance().ClearTouchEventActionVector();
|
||||
mouseKey_->OnPointerEvent(*event2);
|
||||
int32_t touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(1);
|
||||
int32_t expectValue = MMI::PointerEvent::POINTER_ACTION_BUTTON_DOWN;
|
||||
EXPECT_EQ(touchAction, expectValue);
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_005 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_006
|
||||
* @tc.name: OnPointerEvent
|
||||
* @tc.desc: Test function OnPointerEvent
|
||||
*/
|
||||
HWTEST_F(AccessAccessibilityGestureRecognizerTest, AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_006, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_006 start";
|
||||
if (!mouseKey_) {
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<MMI::PointerEvent> event = MMI::PointerEvent::Create();
|
||||
if (!event) {
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_006 event is null";
|
||||
return;
|
||||
}
|
||||
event->SetSourceType(MMI::PointerEvent::SOURCE_TYPE_MOUSE);
|
||||
event->SetPointerAction(MMI::PointerEvent::POINTER_ACTION_MOVE);
|
||||
MMI::PointerEvent::PointerItem item;
|
||||
event->AddPointerItem(item);
|
||||
mouseKey_->GetDoubleTapMoveThreshold(*event);
|
||||
std::shared_ptr<MMI::KeyEvent> event6 = MMI::KeyEvent::Create();
|
||||
if (!event6) {
|
||||
return;
|
||||
}
|
||||
event6->SetKeyCode(MMI::KeyEvent::KEYCODE_NUMPAD_DIVIDE);
|
||||
event6->SetKeyAction(MMI::KeyEvent::KEY_ACTION_DOWN);
|
||||
MMI::KeyEvent::KeyItem item1;
|
||||
item1.SetKeyCode(MMI::KeyEvent::KEYCODE_NUMPAD_DIVIDE);
|
||||
item1.SetPressed(true);
|
||||
event6->AddKeyItem(item1);
|
||||
mouseKey_->OnPointerEvent(*event6);
|
||||
std::shared_ptr<MMI::KeyEvent> event2 = MMI::KeyEvent::Create();
|
||||
if (!event2) {
|
||||
return;
|
||||
}
|
||||
event2->SetKeyCode(MMI::KeyEvent::KEYCODE_NUMPAD_ADD);
|
||||
event2->SetKeyAction(MMI::KeyEvent::KEY_ACTION_DOWN);
|
||||
MMI::KeyEvent::KeyItem item2;
|
||||
item2.SetKeyCode(MMI::KeyEvent::KEYCODE_NUMPAD_ADD);
|
||||
item2.SetPressed(true);
|
||||
event2->AddKeyItem(item2);
|
||||
AccessibilityAbilityHelper::GetInstance().ClearTouchEventActionVector();
|
||||
mouseKey_->OnPointerEvent(*event2);
|
||||
int32_t touchAction = AccessibilityAbilityHelper::GetInstance().GetTouchEventActionOfTargetIndex(2);
|
||||
int32_t expectValue = MMI::PointerEvent::POINTER_ACTION_BUTTON_DOWN;
|
||||
EXPECT_EQ(touchAction, expectValue);
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_006 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_007
|
||||
* @tc.name: OnPointerEvent
|
||||
* @tc.desc: Test function OnPointerEvent
|
||||
*/
|
||||
HWTEST_F(AccessAccessibilityGestureRecognizerTest, AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_007, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_007 start";
|
||||
if (!mouseKey_) {
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<MMI::KeyEvent> event = MMI::KeyEvent::Create();
|
||||
if (!event) {
|
||||
return;
|
||||
}
|
||||
event->SetKeyCode(MMI::KeyEvent::KEYCODE_NUMPAD_1);
|
||||
event->SetKeyAction(MMI::KeyEvent::KEY_ACTION_DOWN);
|
||||
MMI::KeyEvent::KeyItem item;
|
||||
item.SetKeyCode(MMI::KeyEvent::KEYCODE_NUMPAD_1);
|
||||
item.SetPressed(true);
|
||||
event->AddKeyItem(item);
|
||||
MMI::KeyEvent::KeyItem item1;
|
||||
item1.SetKeyCode(MMI::KeyEvent::KEYCODE_SHIFT_LEFT);
|
||||
item1.SetPressed(true);
|
||||
event->AddKeyItem(item1);
|
||||
mouseKey_->OnPointerEvent(*event);
|
||||
EXPECT_NE(event.get(), nullptr);
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_007 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_008
|
||||
* @tc.name: OnPointerEvent
|
||||
* @tc.desc: Test function OnPointerEvent
|
||||
*/
|
||||
HWTEST_F(AccessAccessibilityGestureRecognizerTest, AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_008, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_008 start";
|
||||
if (!mouseKey_) {
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<MMI::KeyEvent> event = MMI::KeyEvent::Create();
|
||||
if (!event) {
|
||||
return;
|
||||
}
|
||||
event->SetKeyCode(MMI::KeyEvent::KEYCODE_NUMPAD_2);
|
||||
event->SetKeyAction(MMI::KeyEvent::KEY_ACTION_DOWN);
|
||||
MMI::KeyEvent::KeyItem item;
|
||||
item.SetKeyCode(MMI::KeyEvent::KEYCODE_CTRL_LEFT);
|
||||
item.SetPressed(true);
|
||||
event->AddKeyItem(item);
|
||||
MMI::KeyEvent::KeyItem item1;
|
||||
item1.SetKeyCode(MMI::KeyEvent::KEYCODE_NUMPAD_2);
|
||||
item1.SetPressed(true);
|
||||
event->AddKeyItem(item1);
|
||||
mouseKey_->OnPointerEvent(*event);
|
||||
EXPECT_NE(event.get(), nullptr);
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_008 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_009
|
||||
* @tc.name: OnPointerEvent
|
||||
* @tc.desc: Test function OnPointerEvent
|
||||
*/
|
||||
HWTEST_F(AccessAccessibilityGestureRecognizerTest, AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_009, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_009 start";
|
||||
if (!mouseKey_) {
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<MMI::KeyEvent> event = MMI::KeyEvent::Create();
|
||||
if (!event) {
|
||||
return;
|
||||
}
|
||||
event->SetKeyCode(MMI::KeyEvent::KEYCODE_NUMPAD_3);
|
||||
event->SetKeyAction(MMI::KeyEvent::KEY_ACTION_DOWN);
|
||||
MMI::KeyEvent::KeyItem item;
|
||||
item.SetKeyCode(MMI::KeyEvent::KEYCODE_NUMPAD_3);
|
||||
item.SetPressed(true);
|
||||
event->AddKeyItem(item);
|
||||
MMI::KeyEvent::KeyItem item1;
|
||||
item1.SetKeyCode(MMI::KeyEvent::KEYCODE_SHIFT_LEFT);
|
||||
item1.SetPressed(true);
|
||||
event->AddKeyItem(item1);
|
||||
MMI::KeyEvent::KeyItem item2;
|
||||
item2.SetKeyCode(MMI::KeyEvent::KEYCODE_SHIFT_RIGHT);
|
||||
item2.SetPressed(true);
|
||||
event->AddKeyItem(item2);
|
||||
mouseKey_->OnPointerEvent(*event);
|
||||
EXPECT_NE(event.get(), nullptr);
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_009 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_010
|
||||
* @tc.name: OnPointerEvent
|
||||
* @tc.desc: Test function OnPointerEvent
|
||||
*/
|
||||
HWTEST_F(AccessAccessibilityGestureRecognizerTest, AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_010, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_010 start";
|
||||
if (!mouseKey_) {
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<MMI::KeyEvent> event = MMI::KeyEvent::Create();
|
||||
if (!event) {
|
||||
return;
|
||||
}
|
||||
event->SetKeyCode(MMI::KeyEvent::KEYCODE_NUMPAD_4);
|
||||
event->SetKeyAction(MMI::KeyEvent::KEY_ACTION_DOWN);
|
||||
MMI::KeyEvent::KeyItem item;
|
||||
item.SetKeyCode(MMI::KeyEvent::KEYCODE_CTRL_LEFT);
|
||||
item.SetPressed(true);
|
||||
event->AddKeyItem(item);
|
||||
MMI::KeyEvent::KeyItem item1;
|
||||
item1.SetKeyCode(MMI::KeyEvent::KEYCODE_NUMPAD_4);
|
||||
item1.SetPressed(true);
|
||||
event->AddKeyItem(item1);
|
||||
MMI::KeyEvent::KeyItem item2;
|
||||
item2.SetKeyCode(MMI::KeyEvent::KEYCODE_CTRL_RIGHT);
|
||||
item2.SetPressed(true);
|
||||
event->AddKeyItem(item2);
|
||||
mouseKey_->OnPointerEvent(*event);
|
||||
EXPECT_NE(event.get(), nullptr);
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_010 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_011
|
||||
* @tc.name: OnPointerEvent
|
||||
* @tc.desc: Test function OnPointerEvent
|
||||
*/
|
||||
HWTEST_F(AccessAccessibilityGestureRecognizerTest, AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_011, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_011 start";
|
||||
if (!mouseKey_) {
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<MMI::KeyEvent> event = MMI::KeyEvent::Create();
|
||||
if (!event) {
|
||||
return;
|
||||
}
|
||||
event->SetKeyCode(MMI::KeyEvent::KEYCODE_NUMPAD_6);
|
||||
event->SetKeyAction(MMI::KeyEvent::KEY_ACTION_DOWN);
|
||||
MMI::KeyEvent::KeyItem item;
|
||||
item.SetKeyCode(MMI::KeyEvent::KEYCODE_CTRL_LEFT);
|
||||
item.SetPressed(true);
|
||||
event->AddKeyItem(item);
|
||||
MMI::KeyEvent::KeyItem item1;
|
||||
item1.SetKeyCode(MMI::KeyEvent::KEYCODE_NUMPAD_6);
|
||||
item1.SetPressed(true);
|
||||
event->AddKeyItem(item1);
|
||||
MMI::KeyEvent::KeyItem item2;
|
||||
item2.SetKeyCode(MMI::KeyEvent::KEYCODE_SHIFT_RIGHT);
|
||||
item2.SetPressed(true);
|
||||
event->AddKeyItem(item2);
|
||||
mouseKey_->OnPointerEvent(*event);
|
||||
EXPECT_NE(event.get(), nullptr);
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_011 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_012
|
||||
* @tc.name: OnPointerEvent
|
||||
* @tc.desc: Test function OnPointerEvent
|
||||
*/
|
||||
HWTEST_F(AccessAccessibilityGestureRecognizerTest, AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_012, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_012 start";
|
||||
if (!mouseKey_) {
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<MMI::KeyEvent> event = MMI::KeyEvent::Create();
|
||||
if (!event) {
|
||||
return;
|
||||
}
|
||||
event->SetKeyCode(MMI::KeyEvent::KEYCODE_NUMPAD_1);
|
||||
event->SetKeyAction(MMI::KeyEvent::KEY_ACTION_UP);
|
||||
MMI::KeyEvent::KeyItem item;
|
||||
item.SetKeyCode(MMI::KeyEvent::KEYCODE_NUMPAD_1);
|
||||
event->AddKeyItem(item);
|
||||
EXPECT_EQ(false, mouseKey_->OnPointerEvent(*event));
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_012 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_013
|
||||
* @tc.name: OnPointerEvent
|
||||
* @tc.desc: Test function OnPointerEvent
|
||||
*/
|
||||
HWTEST_F(AccessAccessibilityGestureRecognizerTest, AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_013, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_013 start";
|
||||
if (!mouseKey_) {
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<MMI::KeyEvent> event = MMI::KeyEvent::Create();
|
||||
if (!event) {
|
||||
return;
|
||||
}
|
||||
MMI::KeyEvent::KeyItem item;
|
||||
event->AddKeyItem(item);
|
||||
AccessibilityAbilityHelper::GetInstance().ClearTouchEventActionVector();
|
||||
mouseKey_->OnPointerEvent(*event);
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_OnPointerEvent_013 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessAccessibilityGestureRecognizer_Unittest_HandleTouchMoveEvent_001
|
||||
* @tc.name: HandleTouchMoveEvent
|
||||
* @tc.desc: Test function HandleTouchMoveEvent
|
||||
*/
|
||||
HWTEST_F(AccessAccessibilityGestureRecognizerUnitTest, AccessAccessibilityGestureRecognizer_Unittest_HandleTouchMoveEvent_001, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_HandleTouchMoveEvent_001 start";
|
||||
if (!mouseKey_) {
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<MMI::KeyEvent> event = MMI::KeyEvent::Create();
|
||||
if (!event) {
|
||||
return;
|
||||
}
|
||||
event->SetKeyCode(MMI::KeyEvent::KEYCODE_NUMPAD_1);
|
||||
event->SetKeyAction(MMI::KeyEvent::KEY_ACTION_DOWN);
|
||||
// presss 1
|
||||
MMI::KeyEvent::KeyItem item;
|
||||
item.SetKeyCode(MMI::KeyEvent::KEYCODE_NUMPAD_1);
|
||||
item.SetPressed(true);
|
||||
event->AddKeyItem(item);
|
||||
// presss left shift
|
||||
MMI::KeyEvent::KeyItem item1;
|
||||
item1.SetKeyCode(MMI::KeyEvent::KEYCODE_SHIFT_LEFT);
|
||||
item1.SetPressed(true);
|
||||
event->AddKeyItem(item1);
|
||||
mouseKey_->HandleTouchMoveEvent(*event);
|
||||
EXPECT_NE(event.get(), nullptr);
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_HandleTouchMoveEvent_001 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessAccessibilityGestureRecognizer_Unittest_HandleTouchMoveEvent_002
|
||||
* @tc.name: HandleTouchMoveEvent
|
||||
* @tc.desc: Test function HandleTouchMoveEvent(press left crtl->2 in same time)
|
||||
* @tc.require: issueI5NTXA
|
||||
*/
|
||||
HWTEST_F(AccessAccessibilityGestureRecognizerUnitTest, AccessAccessibilityGestureRecognizer_Unittest_HandleTouchMoveEvent_002, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_HandleTouchMoveEvent_002 start";
|
||||
if (!mouseKey_) {
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<MMI::KeyEvent> event = MMI::KeyEvent::Create();
|
||||
if (!event) {
|
||||
return;
|
||||
}
|
||||
event->SetKeyCode(MMI::KeyEvent::KEYCODE_NUMPAD_2);
|
||||
event->SetKeyAction(MMI::KeyEvent::KEY_ACTION_DOWN);
|
||||
// presss left ctrl
|
||||
MMI::KeyEvent::KeyItem item;
|
||||
item.SetKeyCode(MMI::KeyEvent::KEYCODE_CTRL_LEFT);
|
||||
item.SetPressed(true);
|
||||
event->AddKeyItem(item);
|
||||
// presss 2
|
||||
MMI::KeyEvent::KeyItem item1;
|
||||
item1.SetKeyCode(MMI::KeyEvent::KEYCODE_NUMPAD_2);
|
||||
item1.SetPressed(true);
|
||||
event->AddKeyItem(item1);
|
||||
mouseKey_->HandleTouchMoveEvent(*event);
|
||||
EXPECT_NE(event.get(), nullptr);
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_HandleTouchMoveEvent_002 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessAccessibilityGestureRecognizer_Unittest_HandleTouchMoveEvent_003
|
||||
* @tc.name: HandleTouchMoveEvent
|
||||
* @tc.desc: Test function HandleTouchMoveEvent(press 3->left shift->right shift in same time)
|
||||
* @tc.require: issueI5NTXA
|
||||
*/
|
||||
HWTEST_F(AccessAccessibilityGestureRecognizerUnitTest, AccessAccessibilityGestureRecognizer_Unittest_HandleTouchMoveEvent_003, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_HandleTouchMoveEvent_003 start";
|
||||
if (!mouseKey_) {
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<MMI::KeyEvent> event = MMI::KeyEvent::Create();
|
||||
if (!event) {
|
||||
return;
|
||||
}
|
||||
event->SetKeyCode(MMI::KeyEvent::KEYCODE_NUMPAD_3);
|
||||
event->SetKeyAction(MMI::KeyEvent::KEY_ACTION_DOWN);
|
||||
// presss 1
|
||||
MMI::KeyEvent::KeyItem item;
|
||||
item.SetKeyCode(MMI::KeyEvent::KEYCODE_NUMPAD_3);
|
||||
item.SetPressed(true);
|
||||
event->AddKeyItem(item);
|
||||
// presss left shift
|
||||
MMI::KeyEvent::KeyItem item1;
|
||||
item1.SetKeyCode(MMI::KeyEvent::KEYCODE_SHIFT_LEFT);
|
||||
item1.SetPressed(true);
|
||||
event->AddKeyItem(item1);
|
||||
// presss right shift
|
||||
MMI::KeyEvent::KeyItem item2;
|
||||
item2.SetKeyCode(MMI::KeyEvent::KEYCODE_SHIFT_RIGHT);
|
||||
item2.SetPressed(true);
|
||||
event->AddKeyItem(item2);
|
||||
mouseKey_->HandleTouchMoveEvent(*event);
|
||||
EXPECT_NE(event.get(), nullptr);
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_HandleTouchMoveEvent_003 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessAccessibilityGestureRecognizer_Unittest_HandleTouchMoveEvent_004
|
||||
* @tc.name: HandleTouchMoveEvent
|
||||
* @tc.desc: Test function HandleTouchMoveEvent(press left ctrl->4->right ctrl in same time)
|
||||
* @tc.require: issueI5NTXA
|
||||
*/
|
||||
HWTEST_F(AccessAccessibilityGestureRecognizerUnitTest, AccessAccessibilityGestureRecognizer_Unittest_HandleTouchMoveEvent_004, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_HandleTouchMoveEvent_004 start";
|
||||
if (!mouseKey_) {
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<MMI::KeyEvent> event = MMI::KeyEvent::Create();
|
||||
if (!event) {
|
||||
return;
|
||||
}
|
||||
event->SetKeyCode(MMI::KeyEvent::KEYCODE_NUMPAD_4);
|
||||
event->SetKeyAction(MMI::KeyEvent::KEY_ACTION_DOWN);
|
||||
// presss left ctrl
|
||||
MMI::KeyEvent::KeyItem item;
|
||||
item.SetKeyCode(MMI::KeyEvent::KEYCODE_CTRL_LEFT);
|
||||
item.SetPressed(true);
|
||||
event->AddKeyItem(item);
|
||||
// presss 4
|
||||
MMI::KeyEvent::KeyItem item1;
|
||||
item1.SetKeyCode(MMI::KeyEvent::KEYCODE_NUMPAD_4);
|
||||
item1.SetPressed(true);
|
||||
event->AddKeyItem(item1);
|
||||
// presss right ctrl
|
||||
MMI::KeyEvent::KeyItem item2;
|
||||
item2.SetKeyCode(MMI::KeyEvent::KEYCODE_CTRL_RIGHT);
|
||||
item2.SetPressed(true);
|
||||
event->AddKeyItem(item2);
|
||||
mouseKey_->HandleTouchMoveEvent(*event);
|
||||
EXPECT_NE(event.get(), nullptr);
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_HandleTouchMoveEvent_004 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessAccessibilityGestureRecognizer_Unittest_HandleTouchMoveEvent_005
|
||||
* @tc.name: HandleTouchMoveEvent
|
||||
* @tc.desc: Test function HandleTouchMoveEvent(press left ctrl->6->right shift in same time)
|
||||
* @tc.require: issueI5NTXA
|
||||
*/
|
||||
HWTEST_F(AccessAccessibilityGestureRecognizerUnitTest, AccessAccessibilityGestureRecognizer_Unittest_HandleTouchMoveEvent_005, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_HandleTouchMoveEvent_005 start";
|
||||
if (!mouseKey_) {
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<MMI::KeyEvent> event = MMI::KeyEvent::Create();
|
||||
if (!event) {
|
||||
return;
|
||||
}
|
||||
event->SetKeyCode(MMI::KeyEvent::KEYCODE_NUMPAD_6);
|
||||
event->SetKeyAction(MMI::KeyEvent::KEY_ACTION_DOWN);
|
||||
// presss left ctrl
|
||||
MMI::KeyEvent::KeyItem item;
|
||||
item.SetKeyCode(MMI::KeyEvent::KEYCODE_CTRL_LEFT);
|
||||
item.SetPressed(true);
|
||||
event->AddKeyItem(item);
|
||||
// presss 4
|
||||
MMI::KeyEvent::KeyItem item1;
|
||||
item1.SetKeyCode(MMI::KeyEvent::KEYCODE_NUMPAD_6);
|
||||
item1.SetPressed(true);
|
||||
event->AddKeyItem(item1);
|
||||
// presss right shift
|
||||
MMI::KeyEvent::KeyItem item2;
|
||||
item2.SetKeyCode(MMI::KeyEvent::KEYCODE_SHIFT_RIGHT);
|
||||
item2.SetPressed(true);
|
||||
event->AddKeyItem(item2);
|
||||
mouseKey_->HandleTouchMoveEvent(*event);
|
||||
EXPECT_NE(event.get(), nullptr);
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_HandleTouchMoveEvent_005 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessAccessibilityGestureRecognizer_Unittest_StandardGestureRecognizer_001
|
||||
* @tc.name: StandardGestureRecognizer
|
||||
* @tc.desc: Test function StandardGestureRecognizer
|
||||
*/
|
||||
HWTEST_F(AccessAccessibilityGestureRecognizerUnitTest, AccessAccessibilityGestureRecognizer_Unittest_StandardGestureRecognizer_001, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_StandardGestureRecognizer_001 start";
|
||||
|
||||
std::shared_ptr<MMI::KeyEvent> event = MMI::KeyEvent::Create();
|
||||
EXPECT_FALSE(AccessAccessibilityGestureRecognizer_->StandardGestureRecognizer(*event));
|
||||
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_StandardGestureRecognizer_001 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessAccessibilityGestureRecognizer_Unittest_StandardGestureRecognizer_002
|
||||
* @tc.name: StandardGestureRecognizer
|
||||
* @tc.desc: Test function StandardGestureRecognizer
|
||||
*/
|
||||
HWTEST_F(AccessAccessibilityGestureRecognizerUnitTest, AccessAccessibilityGestureRecognizer_Unittest_StandardGestureRecognizer_002, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_StandardGestureRecognizer_002 start";
|
||||
|
||||
std::shared_ptr<MMI::KeyEvent> event = MMI::KeyEvent::Create();
|
||||
event->SetKeyCode(MMI::KeyEvent::KEYCODE_VOLUME_UP);
|
||||
EXPECT_TRUE(AccessAccessibilityGestureRecognizer_->StandardGestureRecognizer(*event));
|
||||
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_StandardGestureRecognizer_002 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessAccessibilityGestureRecognizer_Unittest_StandardGestureRecognizer_003
|
||||
* @tc.name: StandardGestureRecognizer
|
||||
* @tc.desc: Test function StandardGestureRecognizer
|
||||
*/
|
||||
HWTEST_F(AccessAccessibilityGestureRecognizerUnitTest, AccessAccessibilityGestureRecognizer_Unittest_StandardGestureRecognizer_003, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_StandardGestureRecognizer_003 start";
|
||||
|
||||
std::shared_ptr<MMI::KeyEvent> event = MMI::KeyEvent::Create();
|
||||
event->SetKeyCode(MMI::KeyEvent::KEYCODE_VOLUME_DOWN);
|
||||
EXPECT_TRUE(AccessAccessibilityGestureRecognizer_->StandardGestureRecognizer(*event));
|
||||
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_StandardGestureRecognizer_003 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessAccessibilityGestureRecognizer_Unittest_StandardGestureRecognizer_004
|
||||
* @tc.name: StandardGestureRecognizer
|
||||
* @tc.desc: Test function StandardGestureRecognizer
|
||||
*/
|
||||
HWTEST_F(AccessAccessibilityGestureRecognizerUnitTest, AccessAccessibilityGestureRecognizer_Unittest_StandardGestureRecognizer_004, TestSize.Level1)
|
||||
{
|
||||
AccessibilityAbilityInfo abilityInfo;
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_StandardGestureRecognizer_004 start";
|
||||
|
||||
sptr<AccessibilityAccountData> accountData =
|
||||
Singleton<AccessibleAbilityManagerService>::GetInstance().GetCurrentAccountData();
|
||||
sptr<AccessibleAbilityConnection> connection = new(std::nothrow) AccessibleAbilityConnection(ACCOUNT_ID,
|
||||
CONNECTION_ID, abilityInfo);
|
||||
AppExecFwk::ElementName elementName("deviceId", "bundleName", "name");
|
||||
std::shared_ptr<MMI::KeyEvent> event = MMI::KeyEvent::Create();
|
||||
if (!AccessAccessibilityGestureRecognizerUnittest(accountData, connection, elementName, event,
|
||||
MMI::KeyEvent::KEY_ACTION_UP)) {
|
||||
return;
|
||||
}
|
||||
EXPECT_TRUE(AccessAccessibilityGestureRecognizer_->StandardGestureRecognizer(*event));
|
||||
accountData->RemoveConnectedAbility(elementName);
|
||||
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_StandardGestureRecognizer_004 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessAccessibilityGestureRecognizer_Unittest_StandardGestureRecognizer_005
|
||||
* @tc.name: StandardGestureRecognizer
|
||||
* @tc.desc: Test function StandardGestureRecognizer
|
||||
*/
|
||||
HWTEST_F(AccessAccessibilityGestureRecognizerUnitTest, AccessAccessibilityGestureRecognizer_Unittest_StandardGestureRecognizer_005, TestSize.Level1)
|
||||
{
|
||||
AccessibilityAbilityInfo abilityInfo;
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_StandardGestureRecognizer_005 start";
|
||||
|
||||
sptr<AccessibilityAccountData> accountData =
|
||||
Singleton<AccessibleAbilityManagerService>::GetInstance().GetCurrentAccountData();
|
||||
sptr<AccessibleAbilityConnection> connection = new(std::nothrow) AccessibleAbilityConnection(ACCOUNT_ID,
|
||||
CONNECTION_ID, abilityInfo);
|
||||
AppExecFwk::ElementName elementName("deviceId", "bundleName", "name");
|
||||
std::shared_ptr<MMI::KeyEvent> event = MMI::KeyEvent::Create();
|
||||
if (!AccessAccessibilityGestureRecognizerUnittest(accountData, connection, elementName, event,
|
||||
MMI::KeyEvent::KEY_ACTION_DOWN)) {
|
||||
return;
|
||||
}
|
||||
EXPECT_TRUE(AccessAccessibilityGestureRecognizer_->StandardGestureRecognizer(*event));
|
||||
bool ret5 = AccessibilityCommonHelper::GetInstance().WaitForLoop(std::bind([]() -> bool {
|
||||
if (AccessibilityAbilityHelper::GetInstance().GetKeyCode() == MMI::KeyEvent::KEYCODE_VOLUME_DOWN) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}), SLEEP_TIME_3);
|
||||
EXPECT_TRUE(ret5);
|
||||
AccessibilityAbilityHelper::GetInstance().ClearKeyCode();
|
||||
accountData->RemoveConnectedAbility(elementName);
|
||||
|
||||
GTEST_LOG_(INFO) << "AccessAccessibilityGestureRecognizer_Unittest_StandardGestureRecognizer_005 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityGestureRecognizer_Unittest_recognizeDirectionGesture_001
|
||||
* @tc.name: recognizeDirectionGesture
|
||||
* @tc.desc: Test function recognizeDirectionGesture
|
||||
*/
|
||||
HWTEST_F(
|
||||
AccessibilityGestureRecognizerUnitTest, AccessibilityGestureRecognizer_Unittest_recognizeDirectionGesture_001, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityGestureRecognizer_Unittest_recognizeDirectionGesture_001 start";
|
||||
|
||||
uint64_t displayId = Singleton<AccessibilityGestureRecognizer>::GetInstance().recognizeDirectionGesture();
|
||||
GTEST_LOG_(INFO) << "DefaultDisplayId" << displayId;
|
||||
|
||||
GTEST_LOG_(INFO) << "AccessibilityGestureRecognizer_Unittest_recognizeDirectionGesture_001 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityGestureRecognizer_Unittest_GetSwipeDirection_001
|
||||
* @tc.name: GetSwipeDirection
|
||||
* @tc.desc: Test function GetSwipeDirection
|
||||
*/
|
||||
HWTEST_F(
|
||||
AccessibilityGestureRecognizerUnitTest, AccessibilityGestureRecognizer_Unittest_GetSwipeDirection_001, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityGestureRecognizer_Unittest_GetSwipeDirection_001 start";
|
||||
|
||||
auto dpi = Singleton<AccessibilityGestureRecognizer>::GetInstance().GetSwipeDirection();
|
||||
EXPECT_NE(dpi, 0);
|
||||
|
||||
GTEST_LOG_(INFO) << "AccessibilityGestureRecognizer_Unittest_GetSwipeDirection_001 end.";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityGestureRecognizer_Unittest_GetPointerPath_001
|
||||
* @tc.name: GetPointerPath
|
||||
* @tc.desc: Test function GetPointerPath
|
||||
*/
|
||||
HWTEST_F(
|
||||
AccessibilityGestureRecognizerUnitTest, AccessibilityGestureRecognizer_Unittest_GetPointerPath_001, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityGestureRecognizer_Unittest_GetPointerPath_001 start";
|
||||
|
||||
auto status = Singleton<AccessibilityGestureRecognizer>::GetInstance().GetPointerPath();
|
||||
EXPECT_GE(status, 0);
|
||||
|
||||
GTEST_LOG_(INFO) << "AccessibilityGestureRecognizer_Unittest_GetPointerPath_001 end.";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AccessibilityGestureRecognizer_Unittest_isDoubleTap_001
|
||||
* @tc.name: isDoubleTap
|
||||
* @tc.desc: Test function isDoubleTap
|
||||
*/
|
||||
HWTEST_F(
|
||||
AccessibilityGestureRecognizerUnitTest, AccessibilityGestureRecognizer_Unittest_isDoubleTap_001, TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AccessibilityGestureRecognizer_Unittest_isDoubleTap_001 start";
|
||||
|
||||
auto mode = Singleton<AccessibilityGestureRecognizer>::GetInstance().isDoubleTap();
|
||||
EXPECT_GE(static_cast<uint64_t>(mode), 0);
|
||||
|
||||
GTEST_LOG_(INFO) << "AccessibilityGestureRecognizer_Unittest_isDoubleTap_001 end.";
|
||||
}
|
||||
} // namespace Accessibility
|
||||
} // namespace OHOS
|
Loading…
Reference in New Issue
Block a user