From 19800730496d714cddac922b1abc2e8c31435492 Mon Sep 17 00:00:00 2001 From: pwx1285814 Date: Fri, 17 Nov 2023 13:06:13 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E8=A1=A5=E5=85=85UT?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: pwx1285814 --- services/common/test/unittest/utils/BUILD.gn | 1 + .../unittest/utils/dscreen_hidumper_test.cpp | 85 +++++++++++++++++++ .../unittest/utils/dscreen_hidumper_test.h | 37 ++++++++ .../2.0/src/dscreen_manager_test.cpp | 48 +++++++++++ .../src/dscreen_source_stub_test.cpp | 4 +- .../src/screen_data_channel_impl_test.cpp | 81 ++++++++++++++++++ 6 files changed, 255 insertions(+), 1 deletion(-) create mode 100644 services/common/test/unittest/utils/dscreen_hidumper_test.cpp create mode 100644 services/common/test/unittest/utils/dscreen_hidumper_test.h diff --git a/services/common/test/unittest/utils/BUILD.gn b/services/common/test/unittest/utils/BUILD.gn index 791403c6..cd5874d2 100644 --- a/services/common/test/unittest/utils/BUILD.gn +++ b/services/common/test/unittest/utils/BUILD.gn @@ -41,6 +41,7 @@ ohos_unittest("UtilsTest") { sources = [ "${services_path}/common/test/unittest/utils/dscreen_fwkkit_test.cpp", + "${services_path}/common/test/unittest/utils/dscreen_hidumper_test.cpp", "${services_path}/common/test/unittest/utils/dscreen_maprelation_test.cpp", "${services_path}/common/test/unittest/utils/video_param_test.cpp", ] diff --git a/services/common/test/unittest/utils/dscreen_hidumper_test.cpp b/services/common/test/unittest/utils/dscreen_hidumper_test.cpp new file mode 100644 index 00000000..ef9549fd --- /dev/null +++ b/services/common/test/unittest/utils/dscreen_hidumper_test.cpp @@ -0,0 +1,85 @@ +/* + * 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. + */ + +#define private public +#include "dscreen_hidumper_test.h" +#undef private + +using namespace testing::ext; + +namespace OHOS { +namespace DistributedHardware { +void DScreenHidumperTest::SetUpTestCase(void) {} + +void DScreenHidumperTest::TearDownTestCase(void) {} + +void DScreenHidumperTest::SetUp() {} + +void DScreenHidumperTest::TearDown() {} + +/** + * @tc.name: Dump_001 + * @tc.desc: Verify the Dump function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(DScreenHidumperTest, Dump_001, TestSize.Level1) +{ + + std::string result; + std::string helpStr; + std::vector argsStr; + DscreenHidumper::GetInstance().ShowHelp(helpStr); + bool ret = DscreenHidumper::GetInstance().Dump(argsStr, result); + EXPECT_EQ(true, ret); + EXPECT_EQ(helpStr, result); +} + +/** + * @tc.name: Dump_002 + * @tc.desc: Verify the Dump function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(DScreenHidumperTest, Dump_002, TestSize.Level1) +{ + + std::string result; + std::vector argsStr = {"arg1", "arg2"}; + bool ret = DscreenHidumper::GetInstance().Dump(argsStr, result); + EXPECT_EQ(true, ret); + EXPECT_EQ("unknown command, -h for help.", result); +} + +/** + * @tc.name: Dump_003 + * @tc.desc: Verify the Dump function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(DScreenHidumperTest, Dump_003, TestSize.Level1) +{ + + std::string result; + std::string helpStr; + std::vector argsStr = {"-h"}; + DscreenHidumper::GetInstance().ShowHelp(helpStr); + bool ret = DscreenHidumper::GetInstance().Dump(argsStr, result); + EXPECT_EQ(true, ret); + EXPECT_EQ(helpStr, result); +} + +} // namespace DistributedHardware +} // namespace OHOS \ No newline at end of file diff --git a/services/common/test/unittest/utils/dscreen_hidumper_test.h b/services/common/test/unittest/utils/dscreen_hidumper_test.h new file mode 100644 index 00000000..6a980560 --- /dev/null +++ b/services/common/test/unittest/utils/dscreen_hidumper_test.h @@ -0,0 +1,37 @@ +/* + * 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. + */ + +#ifndef OHOS_DSCREEN_MAPRELATION_TEST_H +#define OHOS_DSCREEN_MAPRELATION_TEST_H + +#include + +#include "dscreen_constants.h" +#include "dscreen_errcode.h" +#include "dscreen_hidumper.h" + + +namespace OHOS { +namespace DistributedHardware { +class DScreenHidumperTest : public testing::Test { +public: + static void SetUpTestCase(void); + static void TearDownTestCase(void); + void SetUp(); + void TearDown(); +}; +} // namespace DistributedHardware +} // namespace OHOS +#endif \ No newline at end of file diff --git a/services/screenservice/test/unittest/sourceservice/dscreenmgr/2.0/src/dscreen_manager_test.cpp b/services/screenservice/test/unittest/sourceservice/dscreenmgr/2.0/src/dscreen_manager_test.cpp index 173bb187..96416142 100644 --- a/services/screenservice/test/unittest/sourceservice/dscreenmgr/2.0/src/dscreen_manager_test.cpp +++ b/services/screenservice/test/unittest/sourceservice/dscreenmgr/2.0/src/dscreen_manager_test.cpp @@ -13,7 +13,10 @@ * limitations under the License. */ +#define private public #include "2.0/include/dscreen_manager_test.h" +#include "common/include/screen_manager_adapter.h" +#undef private using namespace testing; using namespace testing::ext; @@ -204,6 +207,51 @@ HWTEST_F(DScreenManagerTestV2, DisableDistributedScreen_001, TestSize.Level1) EXPECT_EQ(DH_SUCCESS, ret); } +/** + * @tc.name: DisableDistributedScreen_002 + * @tc.desc: erify the DisableDistributedScreen function failed + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(DScreenManagerTestV2, DisableDistributedScreen_002, TestSize.Level1) +{ + std::shared_ptr dScreenCallback = nullptr; + std::string devId = "devId000"; + std::string dhId = "dhId000"; + std::string reqId = "reqId000"; + std::string dScreenIdx = devId + SEPERATOR + dhId; + std::shared_ptr dScreen = std::make_shared(devId, dhId, dScreenCallback); + DScreenManager::GetInstance().dScreens_[dScreenIdx] = dScreen; + + DScreenManager::GetInstance().dScreens_[dScreenIdx]->SetState(DScreenState::DISABLED); + int32_t ret = DScreenManager::GetInstance().DisableDistributedScreen(devId, dhId, reqId); + EXPECT_EQ(ERR_DH_SCREEN_SA_DISABLE_FAILED, ret); + + DScreenManager::GetInstance().dScreens_[dScreenIdx]->SetState(DScreenState::DISABLING); + ret = DScreenManager::GetInstance().DisableDistributedScreen(devId, dhId, reqId); + EXPECT_EQ(ERR_DH_SCREEN_SA_DISABLE_FAILED, ret); + + DScreenManager::GetInstance().dScreens_[dScreenIdx]->SetState(DScreenState::ENABLED); + ret = DScreenManager::GetInstance().DisableDistributedScreen(devId, dhId, reqId); + EXPECT_EQ(DH_SUCCESS, ret); + + DScreenManager::GetInstance().dScreens_[dScreenIdx]->SetState(DScreenState::ENABLING); + ret = DScreenManager::GetInstance().DisableDistributedScreen(devId, dhId, reqId); + EXPECT_EQ(DH_SUCCESS, ret); + + DScreenManager::GetInstance().dScreens_[dScreenIdx]->SetState(DScreenState::CONNECTING); + ret = DScreenManager::GetInstance().DisableDistributedScreen(devId, dhId, reqId); + EXPECT_EQ(DH_SUCCESS, ret); + + DScreenManager::GetInstance().dScreens_[dScreenIdx]->SetState(DScreenState::CONNECTED); + ret = DScreenManager::GetInstance().DisableDistributedScreen(devId, dhId, reqId); + EXPECT_EQ(DH_SUCCESS, ret); + + DScreenManager::GetInstance().dScreens_[dScreenIdx]->SetState(DScreenState::DISCONNECTING); + ret = DScreenManager::GetInstance().DisableDistributedScreen(devId, dhId, reqId); + EXPECT_EQ(DH_SUCCESS, ret); +} + /** * @tc.name: FindDScreenById_001 * @tc.desc: Verify the FindDScreenById function failed. diff --git a/services/screenservice/test/unittest/sourceservice/dscreenservice/src/dscreen_source_stub_test.cpp b/services/screenservice/test/unittest/sourceservice/dscreenservice/src/dscreen_source_stub_test.cpp index c022643d..37738b8c 100644 --- a/services/screenservice/test/unittest/sourceservice/dscreenservice/src/dscreen_source_stub_test.cpp +++ b/services/screenservice/test/unittest/sourceservice/dscreenservice/src/dscreen_source_stub_test.cpp @@ -12,11 +12,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + #define private public #include "dscreen_source_stub_test.h" +#include "dscreen_constants.h" +#undef private #include -#include "dscreen_constants.h" using namespace testing; using namespace testing::ext; diff --git a/services/screentransport/test/unittest/screendatachannel/src/screen_data_channel_impl_test.cpp b/services/screentransport/test/unittest/screendatachannel/src/screen_data_channel_impl_test.cpp index 6a9754ce..91ef22a7 100644 --- a/services/screentransport/test/unittest/screendatachannel/src/screen_data_channel_impl_test.cpp +++ b/services/screentransport/test/unittest/screendatachannel/src/screen_data_channel_impl_test.cpp @@ -15,6 +15,8 @@ #define private public #include "screen_data_channel_impl_test.h" +#include "dscreen_util.h" +#include "dscreen_json_util.h" #undef private using namespace testing; @@ -264,5 +266,84 @@ HWTEST_F(ScreenDataChannelImplTest, on_session_opened_test_002, TestSize.Level1) dataChannelImpl_->OnSessionOpened(-1, -1); EXPECT_EQ(0, dataChannelImpl_->sessionId_); } + +/** + * @tc.name: on_session_opened_test_003 + * @tc.desc: Verify the OnSessionOpened function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(ScreenDataChannelImplTest, on_session_opened_test_003, TestSize.Level1) +{ + std::shared_ptr mockListener = std::make_shared(); + dataChannelImpl_->channelListener_ = mockListener; + int32_t sessionId = 1; + int32_t result = 1; + dataChannelImpl_->jpegSessionFlag_ = true; + dataChannelImpl_->sessionId_ = 1; + dataChannelImpl_->jpegSessionId_ = 1; + dataChannelImpl_->jpegSessionOpened = false; + dataChannelImpl_->OnSessionOpened(sessionId, result); + + dataChannelImpl_->sessionId_ = 2; + dataChannelImpl_->dataSessionOpened = false; + dataChannelImpl_->OnSessionOpened(sessionId, result); + EXPECT_NE(nullptr, dataChannelImpl_->channelListener_.lock()); +} + +/** + * @tc.name: JsonToDirtyJson_001 + * @tc.desc: Verify the JsonToDirtyJson function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(ScreenDataChannelImplTest, JsonToDirtyJson_001, TestSize.Level1) +{ + std::shared_ptr screenData = std::make_shared(10); + nlohmann::json rectJson; + dataChannelImpl_->JsonToDirtyJson(rectJson, screenData); + + rectJson["dirtySize"] = 2; + dataChannelImpl_->JsonToDirtyJson(rectJson, screenData); + + rectJson["dirtySize"] = INT32_MAX + 1; + rectJson["dataType"] = 2; + dataChannelImpl_->JsonToDirtyJson(rectJson, screenData); + + rectJson["dirtySize"] = DIRTY_MAX_SIZE; + rectJson["dataType"] = 2; + dataChannelImpl_->JsonToDirtyJson(rectJson, screenData); + + rectJson["dirtySize"] = 2; + rectJson["dataType"] = 2; + rectJson["3"] = 2; + dataChannelImpl_->JsonToDirtyJson(rectJson, screenData); + + nlohmann::json testJson; + rectJson["0"] = testJson; + rectJson["0"][KEY_POINT_DIRTY_X] = INT32_MAX + 1; + rectJson["0"][KEY_POINT_DIRTY_Y] = INT32_MAX + 1; + rectJson["0"][KEY_POINT_DIRTY_W] = INT32_MAX + 1; + rectJson["0"][KEY_POINT_DIRTY_H] = INT32_MAX + 1; + rectJson["0"][KEY_POINT_DIRTY_SIZE] = INT32_MAX + 1; + dataChannelImpl_->JsonToDirtyJson(rectJson, screenData); + + rectJson["0"][KEY_POINT_DIRTY_SIZE] = 2; + dataChannelImpl_->JsonToDirtyJson(rectJson, screenData); + + rectJson["0"][KEY_POINT_DIRTY_H] = 2; + dataChannelImpl_->JsonToDirtyJson(rectJson, screenData); + + rectJson["0"][KEY_POINT_DIRTY_W] = 2; + dataChannelImpl_->JsonToDirtyJson(rectJson, screenData); + + rectJson["0"][KEY_POINT_DIRTY_Y] = 2; + dataChannelImpl_->JsonToDirtyJson(rectJson, screenData); + + rectJson["0"][KEY_POINT_DIRTY_X] = 2; + dataChannelImpl_->JsonToDirtyJson(rectJson, screenData); + EXPECT_EQ(nullptr, dataChannelImpl_->channelListener_.lock()); +} + } // DistributedHardware } // OHOS \ No newline at end of file -- Gitee From ce7f232818d51c96eb8bdbd71414d8e261bd5c77 Mon Sep 17 00:00:00 2001 From: pwx1285814 Date: Fri, 17 Nov 2023 15:52:51 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E8=A1=A5=E5=85=85ut?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: pwx1285814 --- services/common/test/unittest/utils/dscreen_hidumper_test.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/services/common/test/unittest/utils/dscreen_hidumper_test.cpp b/services/common/test/unittest/utils/dscreen_hidumper_test.cpp index ef9549fd..16fb4781 100644 --- a/services/common/test/unittest/utils/dscreen_hidumper_test.cpp +++ b/services/common/test/unittest/utils/dscreen_hidumper_test.cpp @@ -37,7 +37,6 @@ void DScreenHidumperTest::TearDown() {} */ HWTEST_F(DScreenHidumperTest, Dump_001, TestSize.Level1) { - std::string result; std::string helpStr; std::vector argsStr; @@ -55,7 +54,6 @@ HWTEST_F(DScreenHidumperTest, Dump_001, TestSize.Level1) */ HWTEST_F(DScreenHidumperTest, Dump_002, TestSize.Level1) { - std::string result; std::vector argsStr = {"arg1", "arg2"}; bool ret = DscreenHidumper::GetInstance().Dump(argsStr, result); @@ -71,7 +69,6 @@ HWTEST_F(DScreenHidumperTest, Dump_002, TestSize.Level1) */ HWTEST_F(DScreenHidumperTest, Dump_003, TestSize.Level1) { - std::string result; std::string helpStr; std::vector argsStr = {"-h"}; -- Gitee From 9408e72f5e356741e1033e6a459721812613e041 Mon Sep 17 00:00:00 2001 From: pwx1285814 Date: Sat, 18 Nov 2023 16:00:19 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E8=A1=A5=E5=85=85UT?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: pwx1285814 --- .../2.0/src/dscreen_manager_test.cpp | 52 +++++++++++++++++++ .../src/screen_source_trans_test.cpp | 50 +++++++++++++++++- 2 files changed, 101 insertions(+), 1 deletion(-) diff --git a/services/screenservice/test/unittest/sourceservice/dscreenmgr/2.0/src/dscreen_manager_test.cpp b/services/screenservice/test/unittest/sourceservice/dscreenmgr/2.0/src/dscreen_manager_test.cpp index 96416142..280a634d 100644 --- a/services/screenservice/test/unittest/sourceservice/dscreenmgr/2.0/src/dscreen_manager_test.cpp +++ b/services/screenservice/test/unittest/sourceservice/dscreenmgr/2.0/src/dscreen_manager_test.cpp @@ -264,6 +264,58 @@ HWTEST_F(DScreenManagerTestV2, FindDScreenById_001, TestSize.Level1) EXPECT_EQ(nullptr, dScreen); } +/** + * @tc.name: FindDScreenById_002 + * @tc.desc: Verify the FindDScreenById function failed. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(DScreenManagerTestV2, FindDScreenById_002, TestSize.Level1) +{ + std::string devId = "devId000"; + std::string dhId = "dhId000"; + std::string dScreenIdx = devId + SEPERATOR + dhId; + std::shared_ptr dScreen = nullptr; + DScreenManager::GetInstance().dScreens_[dScreenIdx] = dScreen; + EXPECT_EQ(nullptr, DScreenManager::GetInstance().FindDScreenById(99)); +} + +/** + * @tc.name: FindDScreenById_003 + * @tc.desc: Verify the FindDScreenById function failed. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(DScreenManagerTestV2, FindDScreenById_003, TestSize.Level1) +{ + std::shared_ptr dScreenCallback = nullptr; + std::string devId = "devId000"; + std::string dhId = "dhId000"; + std::string dScreenIdx = devId + SEPERATOR + dhId; + std::shared_ptr dScreen = std::make_shared(devId, dhId, dScreenCallback); + dScreen->screenId_ = 99; + DScreenManager::GetInstance().dScreens_[dScreenIdx] = dScreen; + EXPECT_EQ(dScreen, DScreenManager::GetInstance().FindDScreenById(99)); +} + +/** + * @tc.name: FindDScreenById_004 + * @tc.desc: Verify the FindDScreenById function failed. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(DScreenManagerTestV2, FindDScreenById_004, TestSize.Level1) +{ + std::shared_ptr dScreenCallback = nullptr; + std::string devId = "devId000"; + std::string dhId = "dhId000"; + std::string dScreenIdx = devId + SEPERATOR + dhId; + std::shared_ptr dScreen = std::make_shared(devId, dhId, dScreenCallback); + dScreen->screenId_ = 90; + DScreenManager::GetInstance().dScreens_[dScreenIdx] = dScreen; + EXPECT_EQ(nullptr, DScreenManager::GetInstance().FindDScreenById(99)); +} + /** * @tc.name: GetScreenDumpInfo_001 * @tc.desc: Verify the GetScreenDumpInfo function failed. diff --git a/services/screentransport/test/unittest/screensourcetrans/src/screen_source_trans_test.cpp b/services/screentransport/test/unittest/screensourcetrans/src/screen_source_trans_test.cpp index 1ef036b4..b474a8fa 100644 --- a/services/screentransport/test/unittest/screensourcetrans/src/screen_source_trans_test.cpp +++ b/services/screentransport/test/unittest/screensourcetrans/src/screen_source_trans_test.cpp @@ -12,7 +12,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - #include "screen_source_trans_test.h" #include "screentrans_test_utils.h" @@ -516,5 +515,54 @@ HWTEST_F(ScreenSourceTransTest, OnImageProcessDone_002, TestSize.Level1) EXPECT_NE(queueSize, trans->dataQueue_.size()); } + +/** + * @tc.name: SetConsumerSurface_001 + * @tc.desc: Verify the SetConsumerSurface function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(ScreenSourceTransTest, SetConsumerSurface_001, TestSize.Level1) +{ + + VideoParam videoParam; + std::vector damages; + sptr surfaceBuffer = nullptr; + trans->OnDamageProcessDone(surfaceBuffer, damages); + trans->imageProcessor_ = std::make_shared(); + std::shared_ptr listener = std::make_shared(); + trans->imageProcessor_->ConfigureImageProcessor(videoParam, videoParam, listener); + int32_t ret = trans->SetConsumerSurface(); + EXPECT_EQ(ERR_DH_SCREEN_SURFACE_INVALIED, ret); +} + +/** + * @tc.name: SetConsumerSurface_002 + * @tc.desc: Verify the SetConsumerSurface function. + * @tc.type: FUNC + * @tc.require: Issue Number + */ +HWTEST_F(ScreenSourceTransTest, SetConsumerSurface_002, TestSize.Level1) +{ + VideoParam localParam; + localParam.videoFormat_ = VIDEO_DATA_FORMAT_YUVI420; + localParam.codecType_ = VIDEO_CODEC_TYPE_VIDEO_H264; + localParam.videoWidth_ = DSCREEN_MAX_VIDEO_DATA_WIDTH; + localParam.videoHeight_ = DSCREEN_MAX_VIDEO_DATA_HEIGHT; + localParam.screenWidth_ = DSCREEN_MAX_SCREEN_DATA_WIDTH; + localParam.screenHeight_ = DSCREEN_MAX_SCREEN_DATA_HEIGHT; + VideoParam remoteParam; + remoteParam.codecType_ = VIDEO_CODEC_TYPE_VIDEO_H264; + remoteParam.videoFormat_ = VIDEO_DATA_FORMAT_YUVI420; + remoteParam.videoHeight_ = DSCREEN_MAX_VIDEO_DATA_HEIGHT; + remoteParam.videoWidth_ = DSCREEN_MAX_VIDEO_DATA_WIDTH; + remoteParam.screenHeight_ = DSCREEN_MAX_SCREEN_DATA_HEIGHT; + remoteParam.screenWidth_ = DSCREEN_MAX_SCREEN_DATA_WIDTH; + trans->imageProcessor_ = std::make_shared(); + std::shared_ptr listener = std::make_shared(); + trans->imageProcessor_->ConfigureImageProcessor(localParam, remoteParam, listener); + int32_t ret = trans->SetConsumerSurface(); + EXPECT_EQ(DH_SUCCESS, ret); +} } } -- Gitee From e12be4d8f8199a82b78d6f93bdec48ff0c9b64b2 Mon Sep 17 00:00:00 2001 From: pwx1285814 Date: Sat, 18 Nov 2023 16:40:15 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E8=A1=A5=E5=85=85UT?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: pwx1285814 --- .../src/screen_source_trans_test.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/services/screentransport/test/unittest/screensourcetrans/src/screen_source_trans_test.cpp b/services/screentransport/test/unittest/screensourcetrans/src/screen_source_trans_test.cpp index b474a8fa..557a4a77 100644 --- a/services/screentransport/test/unittest/screensourcetrans/src/screen_source_trans_test.cpp +++ b/services/screentransport/test/unittest/screensourcetrans/src/screen_source_trans_test.cpp @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + #include "screen_source_trans_test.h" #include "screentrans_test_utils.h" @@ -524,7 +525,6 @@ HWTEST_F(ScreenSourceTransTest, OnImageProcessDone_002, TestSize.Level1) */ HWTEST_F(ScreenSourceTransTest, SetConsumerSurface_001, TestSize.Level1) { - VideoParam videoParam; std::vector damages; sptr surfaceBuffer = nullptr; @@ -544,13 +544,6 @@ HWTEST_F(ScreenSourceTransTest, SetConsumerSurface_001, TestSize.Level1) */ HWTEST_F(ScreenSourceTransTest, SetConsumerSurface_002, TestSize.Level1) { - VideoParam localParam; - localParam.videoFormat_ = VIDEO_DATA_FORMAT_YUVI420; - localParam.codecType_ = VIDEO_CODEC_TYPE_VIDEO_H264; - localParam.videoWidth_ = DSCREEN_MAX_VIDEO_DATA_WIDTH; - localParam.videoHeight_ = DSCREEN_MAX_VIDEO_DATA_HEIGHT; - localParam.screenWidth_ = DSCREEN_MAX_SCREEN_DATA_WIDTH; - localParam.screenHeight_ = DSCREEN_MAX_SCREEN_DATA_HEIGHT; VideoParam remoteParam; remoteParam.codecType_ = VIDEO_CODEC_TYPE_VIDEO_H264; remoteParam.videoFormat_ = VIDEO_DATA_FORMAT_YUVI420; @@ -558,6 +551,13 @@ HWTEST_F(ScreenSourceTransTest, SetConsumerSurface_002, TestSize.Level1) remoteParam.videoWidth_ = DSCREEN_MAX_VIDEO_DATA_WIDTH; remoteParam.screenHeight_ = DSCREEN_MAX_SCREEN_DATA_HEIGHT; remoteParam.screenWidth_ = DSCREEN_MAX_SCREEN_DATA_WIDTH; + VideoParam localParam; + localParam.videoFormat_ = VIDEO_DATA_FORMAT_YUVI420; + localParam.codecType_ = VIDEO_CODEC_TYPE_VIDEO_H264; + localParam.videoWidth_ = DSCREEN_MAX_VIDEO_DATA_WIDTH; + localParam.videoHeight_ = DSCREEN_MAX_VIDEO_DATA_HEIGHT; + localParam.screenWidth_ = DSCREEN_MAX_SCREEN_DATA_WIDTH; + localParam.screenHeight_ = DSCREEN_MAX_SCREEN_DATA_HEIGHT; trans->imageProcessor_ = std::make_shared(); std::shared_ptr listener = std::make_shared(); trans->imageProcessor_->ConfigureImageProcessor(localParam, remoteParam, listener); -- Gitee