diff --git a/services/screenclient/test/unittest/src/screen_client_test.cpp b/services/screenclient/test/unittest/src/screen_client_test.cpp index e217187a5a0d7f727fbd820e801fc76be0b71958..98d2d37a095733686811e2e570729052615cfdc5 100644 --- a/services/screenclient/test/unittest/src/screen_client_test.cpp +++ b/services/screenclient/test/unittest/src/screen_client_test.cpp @@ -85,6 +85,66 @@ HWTEST_F(ScreenClientTest, ShowWindow_002, TestSize.Level1) ScreenClient::GetInstance().RemoveWindow(windowId); } +/** + * @tc.name: ShowWindow_003 + * @tc.desc: Verify the ShowWindow function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(ScreenClientTest, ShowWindow_003, TestSize.Level1) +{ + int32_t windowId = 100; + sptr surface = nullptr; + ScreenClient::GetInstance().surfaceMap_.emplace(windowId, surface); + int32_t actual = ScreenClient::GetInstance().ShowWindow(windowId); + EXPECT_EQ(ERR_DH_SCREEN_SCREENCLIENT_SHOW_WINDOW_ERROR, actual); + ScreenClient::GetInstance().RemoveWindow(windowId); +} + +/** + * @tc.name: HideWindow_001 + * @tc.desc: Verify the HideWindow function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(ScreenClientTest, HideWindow_001, TestSize.Level1) +{ + int32_t windowId = 0; + int32_t actual = ScreenClient::GetInstance().HideWindow(windowId); + EXPECT_EQ(ERR_DH_SCREEN_SCREENCLIENT_HIDE_WINDOW_ERROR, actual); +} + +/** + * @tc.name: HideWindow_002 + * @tc.desc: Verify the HideWindow function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(ScreenClientTest, HideWindow_002, TestSize.Level1) +{ + std::shared_ptr windowProperty = std::make_shared(); + int32_t windowId = ScreenClient::GetInstance().AddWindow(windowProperty); + int32_t actual = ScreenClient::GetInstance().HideWindow(windowId); + EXPECT_EQ(DH_SUCCESS, actual); + ScreenClient::GetInstance().RemoveWindow(windowId); +} + +/** + * @tc.name: HideWindow_003 + * @tc.desc: Verify the HideWindow function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(ScreenClientTest, HideWindow_003, TestSize.Level1) +{ + int32_t windowId = 0; + sptr surface = nullptr; + ScreenClient::GetInstance().surfaceMap_.emplace(windowId, surface); + int32_t actual = ScreenClient::GetInstance().HideWindow(windowId); + EXPECT_EQ(ERR_DH_SCREEN_SCREENCLIENT_HIDE_WINDOW_ERROR, actual); + ScreenClient::GetInstance().RemoveWindow(windowId); +} + /** * @tc.name: MoveWindow_001 * @tc.desc: Verify the MoveWindow function. @@ -117,6 +177,24 @@ HWTEST_F(ScreenClientTest, MoveWindow_002, TestSize.Level1) ScreenClient::GetInstance().RemoveWindow(windowId); } +/** + * @tc.name: MoveWindow_003 + * @tc.desc: Verify the MoveWindow function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(ScreenClientTest, MoveWindow_003, TestSize.Level1) +{ + int32_t windowId = 0; + sptr surface = nullptr; + ScreenClient::GetInstance().surfaceMap_.emplace(windowId, surface); + int32_t startX = 0; + int32_t startY = 0; + int32_t actual = ScreenClient::GetInstance().MoveWindow(windowId, startX, startY); + EXPECT_EQ(ERR_DH_SCREEN_SCREENCLIENT_MOVE_WINDOW_ERROR, actual); + ScreenClient::GetInstance().RemoveWindow(windowId); +} + /** * @tc.name: RemoveWindow_001 * @tc.desc: Verify the RemoveWindow function. @@ -144,6 +222,22 @@ HWTEST_F(ScreenClientTest, RemoveWindow_002, TestSize.Level1) EXPECT_EQ(DH_SUCCESS, actual); } +/** + * @tc.name: RemoveWindow_002 + * @tc.desc: Verify the RemoveWindow function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(ScreenClientTest, RemoveWindow_003, TestSize.Level1) +{ + int32_t windowId = 0; + sptr surface = nullptr; + ScreenClient::GetInstance().surfaceMap_.emplace(windowId, surface); + int32_t actual = ScreenClient::GetInstance().RemoveWindow(windowId); + EXPECT_EQ(ERR_DH_SCREEN_SCREENCLIENT_REMOVE_WINDOW_ERROR, actual); + ScreenClient::GetInstance().RemoveWindow(windowId); +} + /** * @tc.name: GetSurface_001 * @tc.desc: Verify the GetSurface function. @@ -171,5 +265,20 @@ HWTEST_F(ScreenClientTest, GetSurface_002, TestSize.Level1) EXPECT_NE(nullptr, actualSurface); ScreenClient::GetInstance().RemoveWindow(windowId); } + +/** + * @tc.name: DestroyAllWindow_001 + * @tc.desc: Verify the DestroyAllWindow function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(ScreenClientTest, DestroyAllWindow_001, TestSize.Level1) +{ + std::shared_ptr windowProperty = std::make_shared(); + ScreenClient::GetInstance().AddWindow(windowProperty); + int32_t actual = ScreenClient::GetInstance().DestroyAllWindow(); + EXPECT_EQ(DH_SUCCESS, actual); +} + } // DistributedHardware } // OHOS \ No newline at end of file diff --git a/services/screenclient/test/unittest/src/screen_client_window_adapter_test.cpp b/services/screenclient/test/unittest/src/screen_client_window_adapter_test.cpp index fb67f5a1ecc3386eb507155ed82f7d331d8eedda..40f7b8992c40906638b97f6d4d51219ff16518a1 100644 --- a/services/screenclient/test/unittest/src/screen_client_window_adapter_test.cpp +++ b/services/screenclient/test/unittest/src/screen_client_window_adapter_test.cpp @@ -68,7 +68,7 @@ HWTEST_F(ScreenClientWindowAdapterTest, CreateWindow_002, TestSize.Level1) */ HWTEST_F(ScreenClientWindowAdapterTest, ShowWindow_001, TestSize.Level1) { - int32_t windowId = 0; + int32_t windowId = 100; int32_t actual = ScreenClientWindowAdapter::GetInstance().ShowWindow(windowId); EXPECT_EQ(ERR_DH_SCREEN_SCREENCLIENT_SHOW_WINDOW_ERROR, actual); } @@ -82,13 +82,28 @@ HWTEST_F(ScreenClientWindowAdapterTest, ShowWindow_001, TestSize.Level1) HWTEST_F(ScreenClientWindowAdapterTest, ShowWindow_002, TestSize.Level1) { std::shared_ptr windowProperty = std::make_shared(); - int32_t windowId = 0; + int32_t windowId = 100; ScreenClientWindowAdapter::GetInstance().CreateWindow(windowProperty, windowId); int32_t actual = ScreenClientWindowAdapter::GetInstance().ShowWindow(windowId); EXPECT_EQ(DH_SUCCESS, actual); ScreenClientWindowAdapter::GetInstance().RemoveWindow(windowId); } +/** + * @tc.name: ShowWindow_003 + * @tc.desc: Verify the ShowWindow function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(ScreenClientWindowAdapterTest, ShowWindow_003, TestSize.Level1) +{ + int32_t windowId = 0; + sptr window = nullptr; + ScreenClientWindowAdapter::GetInstance().windowIdMap_.emplace(windowId, window); + int32_t actual = ScreenClientWindowAdapter::GetInstance().ShowWindow(windowId); + EXPECT_EQ(ERR_DH_SCREEN_SCREENCLIENT_SHOW_WINDOW_ERROR, actual); + ScreenClientWindowAdapter::GetInstance().RemoveWindow(windowId); +} /** * @tc.name: HideWindow_001 * @tc.desc: Verify the HideWindow function. @@ -118,6 +133,22 @@ HWTEST_F(ScreenClientWindowAdapterTest, HideWindow_002, TestSize.Level1) ScreenClientWindowAdapter::GetInstance().RemoveWindow(windowId); } +/** + * @tc.name: HideWindow_003 + * @tc.desc: Verify the HideWindow function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(ScreenClientWindowAdapterTest, HideWindow_003, TestSize.Level1) +{ + int32_t windowId = 0; + sptr window = nullptr; + ScreenClientWindowAdapter::GetInstance().windowIdMap_.emplace(windowId, window); + int32_t actual = ScreenClientWindowAdapter::GetInstance().HideWindow(windowId); + EXPECT_EQ(ERR_DH_SCREEN_SCREENCLIENT_HIDE_WINDOW_ERROR, actual); + ScreenClientWindowAdapter::GetInstance().RemoveWindow(windowId); +} + /** * @tc.name: MoveWindow_001 * @tc.desc: Verify the MoveWindow function. @@ -151,6 +182,24 @@ HWTEST_F(ScreenClientWindowAdapterTest, MoveWindow_002, TestSize.Level1) ScreenClientWindowAdapter::GetInstance().RemoveWindow(windowId); } +/** + * @tc.name: MoveWindow_003 + * @tc.desc: Verify the MoveWindow function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(ScreenClientWindowAdapterTest, MoveWindow_003, TestSize.Level1) +{ + int32_t windowId = 0; + int32_t startX = 0; + int32_t startY = 0; + sptr window = nullptr; + ScreenClientWindowAdapter::GetInstance().windowIdMap_.emplace(windowId, window); + int32_t actual = ScreenClientWindowAdapter::GetInstance().MoveWindow(windowId, startX, startY); + EXPECT_EQ(ERR_DH_SCREEN_SCREENCLIENT_MOVE_WINDOW_ERROR, actual); + ScreenClientWindowAdapter::GetInstance().RemoveWindow(windowId); +} + /** * @tc.name: RemoveWindow_001 * @tc.desc: Verify the RemoveWindow function. @@ -178,5 +227,35 @@ HWTEST_F(ScreenClientWindowAdapterTest, RemoveWindow_002, TestSize.Level1) int32_t actual = ScreenClientWindowAdapter::GetInstance().RemoveWindow(windowId); EXPECT_EQ(DH_SUCCESS, actual); } + +/** + * @tc.name: RemoveWindow_003 + * @tc.desc: Verify the RemoveWindow function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(ScreenClientWindowAdapterTest, RemoveWindow_003, TestSize.Level1) +{ + int32_t windowId = 0; + sptr window = nullptr; + ScreenClientWindowAdapter::GetInstance().windowIdMap_.emplace(windowId, window); + int32_t actual = ScreenClientWindowAdapter::GetInstance().RemoveWindow(windowId); + EXPECT_EQ(ERR_DH_SCREEN_SCREENCLIENT_REMOVE_WINDOW_ERROR, actual); +} + +/** + * @tc.name: DestroyAllWindow_001 + * @tc.desc: Verify the DestroyAllWindow function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(ScreenClientWindowAdapterTest, DestroyAllWindow_001, TestSize.Level1) +{ + int32_t windowId = 0; + sptr window = nullptr; + ScreenClientWindowAdapter::GetInstance().windowIdMap_.emplace(windowId, window); + int32_t actual = ScreenClientWindowAdapter::GetInstance().DestroyAllWindow(); + EXPECT_EQ(DH_SUCCESS, actual); +} } // DistributedHardware } // OHOS \ No newline at end of file