From a464f03564bd64b973eda4c63e2d51b57deadd58 Mon Sep 17 00:00:00 2001 From: c00680103 Date: Fri, 8 Nov 2024 10:52:33 +0800 Subject: [PATCH] =?UTF-8?q?2024/11/8:=E6=96=B0=E5=A2=9ETDD=E7=94=A8?= =?UTF-8?q?=E4=BE=8B001?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: c00680103 --- wm/test/unittest/root_scene_test.cpp | 63 +++++++++++++++++++++++ wm/test/unittest/screen_scene_test.cpp | 69 ++++++++++++++++++++++++++ 2 files changed, 132 insertions(+) diff --git a/wm/test/unittest/root_scene_test.cpp b/wm/test/unittest/root_scene_test.cpp index 19dedacc1b..506b7f162e 100644 --- a/wm/test/unittest/root_scene_test.cpp +++ b/wm/test/unittest/root_scene_test.cpp @@ -220,6 +220,69 @@ HWTEST_F(RootSceneTest, SetUiDvsyncSwitchErr, Function | SmallTest | Level3) ASSERT_EQ(1, rootScene.GetWindowId()); } +/** + * @tc.name: IsLastFrameLayoutFinished + * @tc.desc: IsLastFrameLayoutFinished Test + * @tc.type: FUNC + */ +HWTEST_F(RootSceneTest, IsLastFrameLayoutFinished, Function | SmallTest | Level3) +{ + RootScene rootScene; + auto ret = rootScene.IsLastFrameLayoutFinished(); + ASSERT_EQ(ret,false); + ASSERT_EQ(1, rootScene.GetWindowId()); +} + +/** + * @tc.name: OnFlushUIParams + * @tc.desc: OnFlushUIParams Test + * @tc.type: FUNC + */ +HWTEST_F(RootSceneTest, OnFlushUIParams, Function | SmallTest | Level3) +{ + RootScene rootScene; + rootScene.OnFlushUIParams(); + ASSERT_EQ(1, rootScene.GetWindowId()); +} + +/** + * @tc.name: OnBundleUpdated + * @tc.desc: OnBundleUpdated Test + * @tc.type: FUNC + */ +HWTEST_F(RootSceneTest, OnBundleUpdated, Function | SmallTest | Level3) +{ + RootScene rootScene; + rootScene.OnBundleUpdated(); + ASSERT_EQ(1, rootScene.GetWindowId()); +} + +/** + * @tc.name: SetDisplayOrientation + * @tc.desc: SetDisplayOrientation Test01 + * @tc.type: FUNC + */ +HWTEST_F(RootSceneTest, SetDisplayOrientationTest01, Function | SmallTest | Level3) +{ + RootScene rootScene; + int32_t orientation = 0; + rootScene.SetDisplayOrientation(orientation); + ASSERT_EQ(1, rootScene.GetWindowId()); +} + +/** + * @tc.name: SetDisplayOrientation + * @tc.desc: SetDisplayOrientation Test02 + * @tc.type: FUNC + */ +HWTEST_F(RootSceneTest, SetDisplayOrientationTest02, Function | SmallTest | Level3) +{ + RootScene rootScene; + int32_t orientation = 100; + rootScene.SetDisplayOrientation(orientation); + ASSERT_EQ(1, rootScene.GetWindowId()); +} + /** * @tc.name: GetSessionRectByType * @tc.desc: GetSessionRectByType Test err diff --git a/wm/test/unittest/screen_scene_test.cpp b/wm/test/unittest/screen_scene_test.cpp index 831ebc55a2..875f2b2abc 100644 --- a/wm/test/unittest/screen_scene_test.cpp +++ b/wm/test/unittest/screen_scene_test.cpp @@ -146,6 +146,75 @@ HWTEST_F(ScreenSceneTest, FlushFrameRate, Function | SmallTest | Level3) ASSERT_EQ(1, screenScene.GetWindowId()); } +/** + * @tc.name: OnBundleUpdated + * @tc.desc: OnBundleUpdated Test + * @tc.type: FUNC + */ +HWTEST_F(ScreenSceneTest, OnBundleUpdated, Function | SmallTest | Level3) +{ + ScreenScene screenScene("UNKNOWN"); + std::string bundleName = "test"; + screenScene.OnBundleUpdated(bundleName); + ASSERT_EQ(1, screenScene.GetWindowId()); +} + +/** + * @tc.name: GetDisplayId & SetDisplayId + * @tc.desc: GetDisplayId & SetDisplayId Test01 + * @tc.type: FUNC + */ +HWTEST_F(ScreenSceneTest, DisplayIdTest01, Function | SmallTest | Level3) +{ + ScreenScene screenScene("UNKNOWN"); + DisplayId setDisplayId = 0; + screenScene.SetDisplayId(setDisplayId); + auto getDisplayId = screenScene.GetDisplayId(); + ASSERT_EQ(getDisplayId, setDisplayId); + ASSERT_EQ(1, screenScene.GetWindowId()); +} + +/** + * @tc.name: GetDisplayId & SetDisplayId + * @tc.desc: GetDisplayId & SetDisplayId Test02 + * @tc.type: FUNC + */ +HWTEST_F(ScreenSceneTest, DisplayIdTest02, Function | SmallTest | Level3) +{ + ScreenScene screenScene("UNKNOWN"); + DisplayId setDisplayId = 100; + screenScene.SetDisplayId(setDisplayId); + auto getDisplayId = screenScene.GetDisplayId(); + ASSERT_EQ(getDisplayId, setDisplayId); + ASSERT_EQ(1, screenScene.GetWindowId()); +} + +/** + * @tc.name: SetDisplayOrientation + * @tc.desc: SetDisplayOrientation Test01 + * @tc.type: FUNC + */ +HWTEST_F(ScreenSceneTest, SetDisplayOrientation01, Function | SmallTest | Level3) +{ + ScreenScene screenScene("UNKNOWN"); + int32_t orientation = 0; + screenScene.SetDisplayOrientation(orientation); + ASSERT_EQ(1, screenScene.GetWindowId()); +} + +/** + * @tc.name: SetDisplayOrientation + * @tc.desc: SetDisplayOrientation Test02 + * @tc.type: FUNC + */ +HWTEST_F(ScreenSceneTest, SetDisplayOrientation02, Function | SmallTest | Level3) +{ + ScreenScene screenScene("UNKNOWN"); + int32_t orientation = 100; + screenScene.SetDisplayOrientation(orientation); + ASSERT_EQ(1, screenScene.GetWindowId()); +} + /** * @tc.name: SetFrameLayoutFinishCallback * @tc.desc: SetFrameLayoutFinishCallback Test