From 1c23c02685a1cbcb0dce2324d6acd36ebe1b66ae Mon Sep 17 00:00:00 2001 From: freemanmmmm Date: Mon, 18 Aug 2025 20:29:04 +0800 Subject: [PATCH 1/3] =?UTF-8?q?SetPlayRangeUsWithMode=E3=80=81SetPlayRange?= =?UTF-8?q?WithMode=20Signed-off-by:=20freemanmmmm=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/unittest/src/player_unit_test.cpp | 284 ++++++++++++++++++ 1 file changed, 284 insertions(+) diff --git a/frameworks/native/player/test/unittest/src/player_unit_test.cpp b/frameworks/native/player/test/unittest/src/player_unit_test.cpp index e8a75c839..ac3d7f640 100644 --- a/frameworks/native/player/test/unittest/src/player_unit_test.cpp +++ b/frameworks/native/player/test/unittest/src/player_unit_test.cpp @@ -4741,5 +4741,289 @@ HWTEST_F(PlayerUnitTest, Player_EnableReportMediaProgress_004, TestSize.Level0) ASSERT_EQ(MSERR_OK, player_->EnableReportMediaProgress(true)); EXPECT_EQ(MSERR_OK, player_->Play()); } + +/** + * @tc.name : Test SetPlayRangeWithMode [0, 600] SEEK_PREVIOUS_SYNC + * @tc.number: Player_SetPlayRangeWithMode_001 + * @tc.desc : Test Player SetPlayRangeWithMode interface with valid range and mode + */ +HWTEST_F(PlayerUnitTest, Player_SetPlayRangeWithMode_001, TestSize.Level0) +{ + int32_t duration = 0; + ASSERT_EQ(MSERR_OK, player_->SetSource(VIDEO_FILE1)); + sptr videoSurface = player_->GetVideoSurface(); + ASSERT_NE(nullptr, videoSurface); + EXPECT_EQ(MSERR_OK, player_->SetVideoSurface(videoSurface)); + + // 首次设置范围:[0, 600],使用默认模式SEEK_PREVIOUS_SYNC + EXPECT_EQ(MSERR_OK, player_->SetPlayRangeWithMode(0, 600)); + EXPECT_EQ(MSERR_OK, player_->PrepareAsync()); + EXPECT_EQ(MSERR_OK, player_->GetDuration(duration)); + EXPECT_EQ(MSERR_OK, player_->Play()); + EXPECT_TRUE(player_->IsPlaying()); + EXPECT_EQ(MSERR_OK, player_->Pause()); + + // 调整范围:[0, duration],使用支持的SEEK_CLOSEST模式 + EXPECT_EQ(MSERR_OK, player_->SetPlayRangeWithMode(0, duration, SEEK_CLOSEST)); + EXPECT_EQ(MSERR_OK, player_->Play()); + EXPECT_TRUE(player_->IsPlaying()); + EXPECT_EQ(MSERR_OK, player_->Pause()); +} + +/** + * @tc.name : Test SetPlayRangeWithMode [1000, 5000] SEEK_CLOSEST + * @tc.number: Player_SetPlayRangeWithMode_002 + * @tc.desc : Test Player SetPlayRangeWithMode in playing state + */ +HWTEST_F(PlayerUnitTest, Player_SetPlayRangeWithMode_002, TestSize.Level0) +{ + int32_t duration = 0; + ASSERT_EQ(MSERR_OK, player_->SetSource(VIDEO_FILE1)); + sptr videoSurface = player_->GetVideoSurface(); + ASSERT_NE(nullptr, videoSurface); + EXPECT_EQ(MSERR_OK, player_->SetVideoSurface(videoSurface)); + + EXPECT_EQ(MSERR_OK, player_->PrepareAsync()); + EXPECT_EQ(MSERR_OK, player_->GetDuration(duration)); + EXPECT_EQ(MSERR_OK, player_->Play()); + EXPECT_TRUE(player_->IsPlaying()); + EXPECT_EQ(MSERR_OK, player_->Pause()); + + // 在暂停状态下设置范围,使用SEEK_CLOSEST模式 + EXPECT_EQ(MSERR_OK, player_->SetPlayRangeWithMode(1000, 5000, SEEK_CLOSEST)); + EXPECT_EQ(MSERR_OK, player_->Play()); + EXPECT_TRUE(player_->IsPlaying()); + EXPECT_EQ(MSERR_OK, player_->Pause()); +} + +/** + * @tc.name : Test SetPlayRangeWithMode [-2, -1] SEEK_PREVIOUS_SYNC + * @tc.number: Player_SetPlayRangeWithMode_003 + * @tc.desc : Test Player SetPlayRangeWithMode with negative range + */ +HWTEST_F(PlayerUnitTest, Player_SetPlayRangeWithMode_003, TestSize.Level0) +{ + ASSERT_EQ(MSERR_OK, player_->SetSource(VIDEO_FILE1)); + sptr videoSurface = player_->GetVideoSurface(); + ASSERT_NE(nullptr, videoSurface); + EXPECT_EQ(MSERR_OK, player_->SetVideoSurface(videoSurface)); + + // 测试负数值范围 + ASSERT_NE(MSERR_OK, player_->SetPlayRangeWithMode(-2, -1, SEEK_PREVIOUS_SYNC)); +} + +/** + * @tc.name : Test SetPlayRangeWithMode [100, 20] SEEK_CLOSEST + * @tc.number: Player_SetPlayRangeWithMode_004 + * @tc.desc : Test Player SetPlayRangeWithMode with start > end + */ +HWTEST_F(PlayerUnitTest, Player_SetPlayRangeWithMode_004, TestSize.Level0) +{ + ASSERT_EQ(MSERR_OK, player_->SetSource(VIDEO_FILE1)); + sptr videoSurface = player_->GetVideoSurface(); + ASSERT_NE(nullptr, videoSurface); + EXPECT_EQ(MSERR_OK, player_->SetVideoSurface(videoSurface)); + + // 测试起始时间大于结束时间 + ASSERT_NE(MSERR_OK, player_->SetPlayRangeWithMode(100, 20, SEEK_CLOSEST)); +} + +/** + * @tc.name : Test SetPlayRangeWithMode [0, 600] SEEK_NEXT_SYNC + * @tc.number: Player_SetPlayRangeWithMode_005 + * @tc.desc : Test Player SetPlayRangeWithMode with unsupported mode + */ +HWTEST_F(PlayerUnitTest, Player_SetPlayRangeWithMode_005, TestSize.Level0) +{ + ASSERT_EQ(MSERR_OK, player_->SetSource(VIDEO_FILE1)); + sptr videoSurface = player_->GetVideoSurface(); + ASSERT_NE(nullptr, videoSurface); + EXPECT_EQ(MSERR_OK, player_->SetVideoSurface(videoSurface)); + + // 测试不支持的SEEK_NEXT_SYNC模式 + ASSERT_NE(MSERR_OK, player_->SetPlayRangeWithMode(0, 600, SEEK_NEXT_SYNC)); +} + +/** + * @tc.name : Test SetPlayRangeWithMode [duration+1, duration+2] + * @tc.number: Player_SetPlayRangeWithMode_006 + * @tc.desc : Test Player SetPlayRangeWithMode beyond media duration + */ +HWTEST_F(PlayerUnitTest, Player_SetPlayRangeWithMode_006, TestSize.Level0) +{ + int32_t duration = 0; + ASSERT_EQ(MSERR_OK, player_->SetSource(VIDEO_FILE1)); + sptr videoSurface = player_->GetVideoSurface(); + ASSERT_NE(nullptr, videoSurface); + EXPECT_EQ(MSERR_OK, player_->SetVideoSurface(videoSurface)); + EXPECT_EQ(MSERR_OK, player_->PrepareAsync()); + EXPECT_EQ(MSERR_OK, player_->GetDuration(duration)); + EXPECT_EQ(MSERR_OK, player_->Play()); + EXPECT_TRUE(player_->IsPlaying()); + EXPECT_EQ(MSERR_OK, player_->Pause()); + + // 测试范围超出媒体总时长 + int32_t start = duration + 1; + int32_t end = duration + 2; + ASSERT_NE(MSERR_OK, player_->SetPlayRangeWithMode(start, end, SEEK_PREVIOUS_SYNC)); +} + +/** + * @tc.name : Test SetPlayRangeWithMode before SetSource + * @tc.number: Player_SetPlayRangeWithMode_007 + * @tc.desc : Test Player SetPlayRangeWithMode without SetSource + */ +HWTEST_F(PlayerUnitTest, Player_SetPlayRangeWithMode_007, TestSize.Level0) +{ + sptr videoSurface = player_->GetVideoSurface(); + ASSERT_NE(nullptr, videoSurface); + EXPECT_EQ(MSERR_OK, player_->SetVideoSurface(videoSurface)); + + // 测试未设置媒体源时调用接口 + ASSERT_NE(MSERR_OK, player_->SetPlayRangeWithMode(0, 600, SEEK_PREVIOUS_SYNC)); +} + +/** + * @tc.name : Test SetPlayRangeUsWithMode [0, 600000] SEEK_PREVIOUS_SYNC + * @tc.number: Player_SetPlayRangeUsWithMode_001 + * @tc.desc : Test Player SetPlayRangeUsWithMode interface with valid range and default mode + */ +HWTEST_F(PlayerUnitTest, Player_SetPlayRangeUsWithMode_001, TestSize.Level0) +{ + int32_t duration = 0; // 单位:毫秒,需转换为微秒使用 + ASSERT_EQ(MSERR_OK, player_->SetSource(VIDEO_FILE1)); + sptr videoSurface = player_->GetVideoSurface(); + ASSERT_NE(nullptr, videoSurface); + EXPECT_EQ(MSERR_OK, player_->SetVideoSurface(videoSurface)); + + // 首次设置范围:[0微秒, 600000微秒(600毫秒)],使用默认模式SEEK_PREVIOUS_SYNC + EXPECT_EQ(MSERR_OK, player_->SetPlayRangeUsWithMode(0, 600000)); + EXPECT_EQ(MSERR_OK, player_->PrepareAsync()); + EXPECT_EQ(MSERR_OK, player_->GetDuration(duration)); // 获取总时长(毫秒) + int64_t durationUs = static_cast(duration) * 1000; // 转换为微秒 + EXPECT_EQ(MSERR_OK, player_->Play()); + EXPECT_TRUE(player_->IsPlaying()); + EXPECT_EQ(MSERR_OK, player_->Pause()); + + // 调整范围:[0微秒, 总时长微秒],使用支持的SEEK_CLOSEST模式 + EXPECT_EQ(MSERR_OK, player_->SetPlayRangeUsWithMode(0, durationUs, SEEK_CLOSEST)); + EXPECT_EQ(MSERR_OK, player_->Play()); + EXPECT_TRUE(player_->IsPlaying()); + EXPECT_EQ(MSERR_OK, player_->Pause()); +} + +/** + * @tc.name : Test SetPlayRangeUsWithMode [1000000, 5000000] SEEK_CLOSEST + * @tc.number: Player_SetPlayRangeUsWithMode_002 + * @tc.desc : Test Player SetPlayRangeUsWithMode in paused state + */ +HWTEST_F(PlayerUnitTest, Player_SetPlayRangeUsWithMode_002, TestSize.Level0) +{ + int32_t duration = 0; + ASSERT_EQ(MSERR_OK, player_->SetSource(VIDEO_FILE1)); + sptr videoSurface = player_->GetVideoSurface(); + ASSERT_NE(nullptr, videoSurface); + EXPECT_EQ(MSERR_OK, player_->SetVideoSurface(videoSurface)); + + EXPECT_EQ(MSERR_OK, player_->PrepareAsync()); + EXPECT_EQ(MSERR_OK, player_->GetDuration(duration)); + EXPECT_EQ(MSERR_OK, player_->Play()); + EXPECT_TRUE(player_->IsPlaying()); + EXPECT_EQ(MSERR_OK, player_->Pause()); + + // 在暂停状态下设置范围:[1000000微秒(1秒), 5000000微秒(5秒)],使用SEEK_CLOSEST模式 + EXPECT_EQ(MSERR_OK, player_->SetPlayRangeUsWithMode(1000000, 5000000, SEEK_CLOSEST)); + EXPECT_EQ(MSERR_OK, player_->Play()); + EXPECT_TRUE(player_->IsPlaying()); + EXPECT_EQ(MSERR_OK, player_->Pause()); +} + +/** + * @tc.name : Test SetPlayRangeWithMode [-2, -1] SEEK_PREVIOUS_SYNC + * @tc.number: Player_SetPlayRangeWithMode_003 + * @tc.desc : Test Player SetPlayRangeWithMode with negative range + */ +HWTEST_F(PlayerUnitTest, Player_SetPlayRangeWithMode_003, TestSize.Level0) +{ + ASSERT_EQ(MSERR_OK, player_->SetSource(VIDEO_FILE1)); + sptr videoSurface = player_->GetVideoSurface(); + ASSERT_NE(nullptr, videoSurface); + EXPECT_EQ(MSERR_OK, player_->SetVideoSurface(videoSurface)); + + // 测试负数值范围 + ASSERT_NE(MSERR_OK, player_->SetPlayRangeWithMode(-2, -1, SEEK_PREVIOUS_SYNC)); +} + +/** + * @tc.name : Test SetPlayRangeWithMode [100, 20] SEEK_CLOSEST + * @tc.number: Player_SetPlayRangeWithMode_004 + * @tc.desc : Test Player SetPlayRangeWithMode with start > end + */ +HWTEST_F(PlayerUnitTest, Player_SetPlayRangeWithMode_004, TestSize.Level0) +{ + ASSERT_EQ(MSERR_OK, player_->SetSource(VIDEO_FILE1)); + sptr videoSurface = player_->GetVideoSurface(); + ASSERT_NE(nullptr, videoSurface); + EXPECT_EQ(MSERR_OK, player_->SetVideoSurface(videoSurface)); + + // 测试起始时间大于结束时间 + ASSERT_NE(MSERR_OK, player_->SetPlayRangeWithMode(100, 20, SEEK_CLOSEST)); +} + +/** + * @tc.name : Test SetPlayRangeWithMode [0, 600] SEEK_NEXT_SYNC + * @tc.number: Player_SetPlayRangeWithMode_005 + * @tc.desc : Test Player SetPlayRangeWithMode with unsupported mode + */ +HWTEST_F(PlayerUnitTest, Player_SetPlayRangeWithMode_005, TestSize.Level0) +{ + ASSERT_EQ(MSERR_OK, player_->SetSource(VIDEO_FILE1)); + sptr videoSurface = player_->GetVideoSurface(); + ASSERT_NE(nullptr, videoSurface); + EXPECT_EQ(MSERR_OK, player_->SetVideoSurface(videoSurface)); + + // 测试不支持的SEEK_NEXT_SYNC模式 + ASSERT_NE(MSERR_OK, player_->SetPlayRangeWithMode(0, 600, SEEK_NEXT_SYNC)); +} + +/** + * @tc.name : Test SetPlayRangeWithMode [duration+1, duration+2] + * @tc.number: Player_SetPlayRangeWithMode_006 + * @tc.desc : Test Player SetPlayRangeWithMode beyond media duration + */ +HWTEST_F(PlayerUnitTest, Player_SetPlayRangeWithMode_006, TestSize.Level0) +{ + int32_t duration = 0; + ASSERT_EQ(MSERR_OK, player_->SetSource(VIDEO_FILE1)); + sptr videoSurface = player_->GetVideoSurface(); + ASSERT_NE(nullptr, videoSurface); + EXPECT_EQ(MSERR_OK, player_->SetVideoSurface(videoSurface)); + EXPECT_EQ(MSERR_OK, player_->PrepareAsync()); + EXPECT_EQ(MSERR_OK, player_->GetDuration(duration)); + EXPECT_EQ(MSERR_OK, player_->Play()); + EXPECT_TRUE(player_->IsPlaying()); + EXPECT_EQ(MSERR_OK, player_->Pause()); + + // 测试范围超出媒体总时长 + int32_t start = duration + 1; + int32_t end = duration + 2; + ASSERT_NE(MSERR_OK, player_->SetPlayRangeWithMode(start, end, SEEK_PREVIOUS_SYNC)); +} + +/** + * @tc.name : Test SetPlayRangeWithMode before SetSource + * @tc.number: Player_SetPlayRangeWithMode_007 + * @tc.desc : Test Player SetPlayRangeWithMode without SetSource + */ +HWTEST_F(PlayerUnitTest, Player_SetPlayRangeWithMode_007, TestSize.Level0) +{ + sptr videoSurface = player_->GetVideoSurface(); + ASSERT_NE(nullptr, videoSurface); + EXPECT_EQ(MSERR_OK, player_->SetVideoSurface(videoSurface)); + + // 测试未设置媒体源时调用接口 + ASSERT_NE(MSERR_OK, player_->SetPlayRangeWithMode(0, 600, SEEK_PREVIOUS_SYNC)); +} + } // namespace Media } // namespace OHOS -- Gitee From 5e034130b58445d3b7f46bfd812a26fb2a990321 Mon Sep 17 00:00:00 2001 From: freemanmmmm Date: Tue, 19 Aug 2025 10:52:29 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E5=A4=B4?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=92=8C=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: freemanmmmm --- .../player/test/unittest/include/player_mock.h | 2 ++ .../player/test/unittest/src/player_mock.cpp | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/frameworks/native/player/test/unittest/include/player_mock.h b/frameworks/native/player/test/unittest/include/player_mock.h index 2fcaa6bcc..9aa345e59 100644 --- a/frameworks/native/player/test/unittest/include/player_mock.h +++ b/frameworks/native/player/test/unittest/include/player_mock.h @@ -179,6 +179,8 @@ public: int32_t EnableReportMediaProgress(bool enable); void ReleaseClientListener(); int32_t EnableReportAudioInterrupt(bool enable); + int32_t SetPlayRangeWithMode(int64_t start, int64_t end, PlayerSeekMode mode = SEEK_PREVIOUS_SYNC); + int32_t SetPlayRangeUsWithMode(int64_t start, int64_t end, PlayerSeekMode mode = SEEK_PREVIOUS_SYNC); private: void SeekPrepare(int32_t &mseconds, PlayerSeekMode &mode); std::shared_ptr player_ = nullptr; diff --git a/frameworks/native/player/test/unittest/src/player_mock.cpp b/frameworks/native/player/test/unittest/src/player_mock.cpp index 7e4706446..b05e97798 100644 --- a/frameworks/native/player/test/unittest/src/player_mock.cpp +++ b/frameworks/native/player/test/unittest/src/player_mock.cpp @@ -855,5 +855,21 @@ void PlayerMock::ReleaseClientListener() UNITTEST_CHECK_AND_RETURN_LOG(player_ != nullptr, "player_ == nullptr"); player_->ReleaseClientListener(); } + +int32_t PlayerMock::SetPlayRangeWithMode(int64_t start, int64_t end, PlayerSeekMode mode = SEEK_PREVIOUS_SYNC) +{ + (void)start; + (void)end; + (void)mode; + return 0; +} + +int32_t PlayerMock::SetPlayRangeUsWithMode(int64_t start, int64_t end, PlayerSeekMode mode = SEEK_PREVIOUS_SYNC) +{ + (void)start; + (void)end; + (void)mode; + return 0; +} } // namespace Media } // namespace OHOS -- Gitee From 90ce462e1e5b57197dcd0b74254347ef12ae8256 Mon Sep 17 00:00:00 2001 From: freemanmmmm Date: Tue, 19 Aug 2025 12:33:23 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20Signed-off-by:=20freem?= =?UTF-8?q?anmmmm=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/unittest/src/player_unit_test.cpp | 88 ------------------- 1 file changed, 88 deletions(-) diff --git a/frameworks/native/player/test/unittest/src/player_unit_test.cpp b/frameworks/native/player/test/unittest/src/player_unit_test.cpp index ac3d7f640..a0004f895 100644 --- a/frameworks/native/player/test/unittest/src/player_unit_test.cpp +++ b/frameworks/native/player/test/unittest/src/player_unit_test.cpp @@ -4937,93 +4937,5 @@ HWTEST_F(PlayerUnitTest, Player_SetPlayRangeUsWithMode_002, TestSize.Level0) EXPECT_TRUE(player_->IsPlaying()); EXPECT_EQ(MSERR_OK, player_->Pause()); } - -/** - * @tc.name : Test SetPlayRangeWithMode [-2, -1] SEEK_PREVIOUS_SYNC - * @tc.number: Player_SetPlayRangeWithMode_003 - * @tc.desc : Test Player SetPlayRangeWithMode with negative range - */ -HWTEST_F(PlayerUnitTest, Player_SetPlayRangeWithMode_003, TestSize.Level0) -{ - ASSERT_EQ(MSERR_OK, player_->SetSource(VIDEO_FILE1)); - sptr videoSurface = player_->GetVideoSurface(); - ASSERT_NE(nullptr, videoSurface); - EXPECT_EQ(MSERR_OK, player_->SetVideoSurface(videoSurface)); - - // 测试负数值范围 - ASSERT_NE(MSERR_OK, player_->SetPlayRangeWithMode(-2, -1, SEEK_PREVIOUS_SYNC)); -} - -/** - * @tc.name : Test SetPlayRangeWithMode [100, 20] SEEK_CLOSEST - * @tc.number: Player_SetPlayRangeWithMode_004 - * @tc.desc : Test Player SetPlayRangeWithMode with start > end - */ -HWTEST_F(PlayerUnitTest, Player_SetPlayRangeWithMode_004, TestSize.Level0) -{ - ASSERT_EQ(MSERR_OK, player_->SetSource(VIDEO_FILE1)); - sptr videoSurface = player_->GetVideoSurface(); - ASSERT_NE(nullptr, videoSurface); - EXPECT_EQ(MSERR_OK, player_->SetVideoSurface(videoSurface)); - - // 测试起始时间大于结束时间 - ASSERT_NE(MSERR_OK, player_->SetPlayRangeWithMode(100, 20, SEEK_CLOSEST)); -} - -/** - * @tc.name : Test SetPlayRangeWithMode [0, 600] SEEK_NEXT_SYNC - * @tc.number: Player_SetPlayRangeWithMode_005 - * @tc.desc : Test Player SetPlayRangeWithMode with unsupported mode - */ -HWTEST_F(PlayerUnitTest, Player_SetPlayRangeWithMode_005, TestSize.Level0) -{ - ASSERT_EQ(MSERR_OK, player_->SetSource(VIDEO_FILE1)); - sptr videoSurface = player_->GetVideoSurface(); - ASSERT_NE(nullptr, videoSurface); - EXPECT_EQ(MSERR_OK, player_->SetVideoSurface(videoSurface)); - - // 测试不支持的SEEK_NEXT_SYNC模式 - ASSERT_NE(MSERR_OK, player_->SetPlayRangeWithMode(0, 600, SEEK_NEXT_SYNC)); -} - -/** - * @tc.name : Test SetPlayRangeWithMode [duration+1, duration+2] - * @tc.number: Player_SetPlayRangeWithMode_006 - * @tc.desc : Test Player SetPlayRangeWithMode beyond media duration - */ -HWTEST_F(PlayerUnitTest, Player_SetPlayRangeWithMode_006, TestSize.Level0) -{ - int32_t duration = 0; - ASSERT_EQ(MSERR_OK, player_->SetSource(VIDEO_FILE1)); - sptr videoSurface = player_->GetVideoSurface(); - ASSERT_NE(nullptr, videoSurface); - EXPECT_EQ(MSERR_OK, player_->SetVideoSurface(videoSurface)); - EXPECT_EQ(MSERR_OK, player_->PrepareAsync()); - EXPECT_EQ(MSERR_OK, player_->GetDuration(duration)); - EXPECT_EQ(MSERR_OK, player_->Play()); - EXPECT_TRUE(player_->IsPlaying()); - EXPECT_EQ(MSERR_OK, player_->Pause()); - - // 测试范围超出媒体总时长 - int32_t start = duration + 1; - int32_t end = duration + 2; - ASSERT_NE(MSERR_OK, player_->SetPlayRangeWithMode(start, end, SEEK_PREVIOUS_SYNC)); -} - -/** - * @tc.name : Test SetPlayRangeWithMode before SetSource - * @tc.number: Player_SetPlayRangeWithMode_007 - * @tc.desc : Test Player SetPlayRangeWithMode without SetSource - */ -HWTEST_F(PlayerUnitTest, Player_SetPlayRangeWithMode_007, TestSize.Level0) -{ - sptr videoSurface = player_->GetVideoSurface(); - ASSERT_NE(nullptr, videoSurface); - EXPECT_EQ(MSERR_OK, player_->SetVideoSurface(videoSurface)); - - // 测试未设置媒体源时调用接口 - ASSERT_NE(MSERR_OK, player_->SetPlayRangeWithMode(0, 600, SEEK_PREVIOUS_SYNC)); -} - } // namespace Media } // namespace OHOS -- Gitee