[tdd]:test ui content ShowDumpHelp and Create

Change-Id: I535be5774f8dc5b814e640a26d9d6981c0d87aba
Signed-off-by: fred <zhourenfeng@huawei.com>
This commit is contained in:
fred 2023-06-25 11:48:36 +08:00
parent 1869d6c3c6
commit 65340b1b7f
2 changed files with 43 additions and 1 deletions

View File

@ -30,7 +30,32 @@ ohos_unittest("ui_content_test") {
"ui_content_test.cpp",
]
external_deps = [ "multimedia_image_framework:image" ]
include_dirs = [
"$window_manager_path/interfaces/innerkits",
"$window_manager_path/interfaces/innerkits/wm",
"$window_manager_path/wm/include",
]
deps = [
"$ace_root/frameworks/base:ace_memory_monitor_ohos",
"$ace_root/test/unittest:ace_engine_unittest_flutter_deps",
"$ace_root/test/unittest:ace_unittest_log",
"$ace_root/test/unittest:ace_unittest_trace",
"$cjson_root:cjson",
"$graphic_standard_path/rosen/modules/render_service_client:librender_service_client",
"//third_party/googletest:gmock_main",
]
external_deps = [
"ability_runtime:abilitykit_native",
"input:libmmi-client",
"ipc:ipc_single",
"multimedia_image_framework:image",
"window_manager:libdm",
"window_manager:libwm",
"window_manager:scene_session",
"window_manager:scene_session_manager",
]
configs = [ "$ace_root/test/unittest:ace_unittest_config" ]
}

View File

@ -15,6 +15,9 @@
#include "gtest/gtest.h"
#include "interfaces/inner_api/ace/ui_content.h"
#include "ability_context.h"
#include "ability_info.h"
#include "context_impl.h"
using namespace testing;
using namespace testing::ext;
@ -36,4 +39,18 @@ HWTEST_F(UiContentTest, DumpTest001, TestSize.Level1)
GTEST_LOG_(INFO) << info;
}
}
/**
* @tc.name: UIContentTest001
* @tc.desc: test Create
* @tc.type: FUNC
*/
HWTEST_F(UiContentTest, UIContentTest001, TestSize.Level1)
{
std::vector<std::string> info;
UIContent::ShowDumpHelp(info);
EXPECT_NE(UIContent::Create(nullptr, nullptr, false), nullptr);
EXPECT_NE(UIContent::Create(nullptr, nullptr), nullptr);
EXPECT_NE(UIContent::Create(nullptr), nullptr);
}
} // namespace OHOS::Ace