mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2025-02-20 04:36:46 +00:00
补充container.h中autofill接口tdd用例
Signed-off-by: abc12133 <jinguoen@huawei.com>
This commit is contained in:
parent
3a0e71057a
commit
b20487d2cf
@ -15,5 +15,8 @@ import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
|
||||
|
||||
group("adapter_unittest") {
|
||||
testonly = true
|
||||
deps = [ "ohos/capability:capability_unittest" ]
|
||||
deps = [
|
||||
"ohos/capability:capability_unittest",
|
||||
"ohos/entrance:entrance_unittest",
|
||||
]
|
||||
}
|
||||
|
46
test/unittest/adapter/ohos/entrance/BUILD.gn
Normal file
46
test/unittest/adapter/ohos/entrance/BUILD.gn
Normal file
@ -0,0 +1,46 @@
|
||||
# Copyright (c) 2024 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.
|
||||
|
||||
import("//foundation/arkui/ace_engine/test/unittest/ace_unittest.gni")
|
||||
|
||||
ohos_unittest("container_test") {
|
||||
module_out_path = adapter_test_output_path
|
||||
sources = [ "container_test.cpp" ]
|
||||
|
||||
configs = [ "$ace_root/test/unittest:ace_unittest_config" ]
|
||||
|
||||
deps = [
|
||||
"$ace_root/test/unittest:ace_base",
|
||||
"$ace_root/test/unittest:ace_components_base",
|
||||
"$ace_root/test/unittest:ace_components_event",
|
||||
"$ace_root/test/unittest:ace_components_gestures",
|
||||
"$ace_root/test/unittest:ace_components_layout",
|
||||
"$ace_root/test/unittest:ace_components_manager",
|
||||
"$ace_root/test/unittest:ace_components_mock",
|
||||
"$ace_root/test/unittest:ace_components_pattern",
|
||||
"$ace_root/test/unittest:ace_components_property",
|
||||
"$ace_root/test/unittest:ace_components_render",
|
||||
"$ace_root/test/unittest:ace_components_syntax",
|
||||
"$ace_root/test/unittest:ace_core_animation",
|
||||
"$ace_root/test/unittest:ace_core_extra",
|
||||
"$ace_root/test/unittest:ace_engine_unittest_flutter_deps",
|
||||
"$ace_root/test/unittest:ace_unittest_log",
|
||||
"$graphic_2d_path/rosen/modules/render_service_client:librender_service_client",
|
||||
"//third_party/googletest:gmock_main",
|
||||
]
|
||||
}
|
||||
|
||||
group("entrance_unittest") {
|
||||
testonly = true
|
||||
deps = [ ":container_test" ]
|
||||
}
|
85
test/unittest/adapter/ohos/entrance/container_test.cpp
Normal file
85
test/unittest/adapter/ohos/entrance/container_test.cpp
Normal file
@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright (c) 2024 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"
|
||||
#define private public
|
||||
#define protected public
|
||||
#include "test/mock/core/common/mock_container.h"
|
||||
#include "test/mock/core/pipeline/mock_pipeline_context.h"
|
||||
|
||||
using namespace testing;
|
||||
using namespace testing::ext;
|
||||
|
||||
namespace OHOS::Ace::NG {
|
||||
class ContainerTest : public testing::Test {
|
||||
public:
|
||||
static void SetUpTestSuite()
|
||||
{
|
||||
NG::MockPipelineContext::SetUp();
|
||||
MockContainer::SetUp();
|
||||
MockContainer::Current()->pipelineContext_ = PipelineBase::GetCurrentContext();
|
||||
}
|
||||
static void TearDownTestSuite()
|
||||
{
|
||||
MockContainer::Current()->pipelineContext_ = nullptr;
|
||||
NG::MockPipelineContext::TearDown();
|
||||
}
|
||||
void SetUp() {};
|
||||
void TearDown() {};
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.name: ContainerTest001
|
||||
* @tc.desc: Test autofill interface with native call
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(ContainerTest, ContainerTest001, TestSize.Level1)
|
||||
{
|
||||
bool isNative = true;
|
||||
bool isPopup = false;
|
||||
uint32_t autoFillSessionId = 0;
|
||||
AceAutoFillType type = AceAutoFillType::ACE_USER_NAME;
|
||||
bool ret = MockContainer::Current()->RequestAutoFill(nullptr, type, false, isPopup, autoFillSessionId, isNative);
|
||||
EXPECT_EQ(ret, false);
|
||||
|
||||
ret = MockContainer::Current()->UpdatePopupUIExtension(nullptr, autoFillSessionId, isNative);
|
||||
EXPECT_EQ(ret, false);
|
||||
|
||||
ret = MockContainer::Current()->ClosePopupUIExtension(autoFillSessionId);
|
||||
EXPECT_EQ(ret, false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @tc.name: ContainerTest002
|
||||
* @tc.desc: Test autofill interface with web call
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(ContainerTest, ContainerTest002, TestSize.Level1)
|
||||
{
|
||||
bool isNative = false;
|
||||
bool isPopup = false;
|
||||
uint32_t autoFillSessionId = 0;
|
||||
AceAutoFillType type = AceAutoFillType::ACE_USER_NAME;
|
||||
bool ret = MockContainer::Current()->RequestAutoFill(nullptr, type, false, isPopup, autoFillSessionId, isNative);
|
||||
EXPECT_EQ(ret, false);
|
||||
|
||||
ret = MockContainer::Current()->UpdatePopupUIExtension(nullptr, autoFillSessionId, isNative);
|
||||
EXPECT_EQ(ret, false);
|
||||
|
||||
ret = MockContainer::Current()->ClosePopupUIExtension(autoFillSessionId);
|
||||
EXPECT_EQ(ret, false);
|
||||
}
|
||||
} // namespace OHOS::Ace::NG
|
Loading…
x
Reference in New Issue
Block a user