From 792a7131a49ec6161f25c0c5ca754e23ef43dec9 Mon Sep 17 00:00:00 2001 From: bird_j Date: Sat, 18 Sep 2021 08:07:42 +0000 Subject: [PATCH] =?UTF-8?q?ActsPlayerFuncTest=20=E5=88=B7=E6=96=B0=20Signe?= =?UTF-8?q?d-off-by:=20bird=5Fj=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/function/ActsPlayerStateTest.cpp | 512 +++++++++--------- 1 file changed, 253 insertions(+), 259 deletions(-) diff --git a/multimedia/media/media_cpp_test_standard/player/src/function/ActsPlayerStateTest.cpp b/multimedia/media/media_cpp_test_standard/player/src/function/ActsPlayerStateTest.cpp index 8ca638837..6dff69855 100755 --- a/multimedia/media/media_cpp_test_standard/player/src/function/ActsPlayerStateTest.cpp +++ b/multimedia/media/media_cpp_test_standard/player/src/function/ActsPlayerStateTest.cpp @@ -20,77 +20,77 @@ using namespace std; using namespace OHOS; using namespace OHOS::Media; using namespace testing::ext; -using namespace PlayerNameSpace; +using namespace TestPlayerBasic; /** * @tc.number : SUB_MEDIA_PLAYER_Local_Function_04_0100 - * @tc.name : 001.prepare-reset,销毁播放器 + * @tc.name : 001.prepare-reset-release * @tc.desc : 播控 */ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_0100, Function | MediumTest | Level0) { - PlayerSignal testObj; - std::shared_ptr player = std::make_shared(&testObj); + std::shared_ptr testObj = std::make_shared(); + std::shared_ptr player = std::make_shared(testObj); ASSERT_NE(nullptr, player); ASSERT_EQ(true, player->CreatePlayer()); - std::string uri = GetUri(); + std::string uri = TestParamsConfig::GetInstance().GetUri(); ASSERT_EQ(RET_OK, player->SetSource(uri)); sptr videoSurface = player->GetVideoSurface(g_sub_config); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); - std::shared_ptr testCallback = std::make_shared(&testObj); + std::shared_ptr testCallback = std::make_shared(testObj); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); ASSERT_EQ(RET_OK, player->Prepare()); EXPECT_EQ(RET_OK, player->Reset()); EXPECT_FALSE(player->IsPlaying()); EXPECT_EQ(RET_OK, player->Release()); - EXPECT_EQ(RET_OK, testCallback->errorNum); + EXPECT_EQ(RET_OK, testCallback->errorNum_); } /** * @tc.number : SUB_MEDIA_PLAYER_Local_Function_04_0200 - * @tc.name : 002.prepare-reset,不销毁播放器 + * @tc.name : 002.prepare-reset * @tc.desc : 播控 */ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_0200, Function | MediumTest | Level0) { - PlayerSignal testObj; - std::shared_ptr player = std::make_shared(&testObj); + std::shared_ptr testObj = std::make_shared(); + std::shared_ptr player = std::make_shared(testObj); ASSERT_NE(nullptr, player); ASSERT_EQ(true, player->CreatePlayer()); - std::string uri = GetUri(); + std::string uri = TestParamsConfig::GetInstance().GetUri(); ASSERT_EQ(RET_OK, player->SetSource(uri)); sptr videoSurface = player->GetVideoSurface(g_sub_config); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); - std::shared_ptr testCallback = std::make_shared(&testObj); + std::shared_ptr testCallback = std::make_shared(testObj); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); ASSERT_EQ(RET_OK, player->Prepare()); EXPECT_EQ(RET_OK, player->Reset()); EXPECT_FALSE(player->IsPlaying()); - EXPECT_EQ(RET_OK, testCallback->errorNum); + EXPECT_EQ(RET_OK, testCallback->errorNum_); } /** * @tc.number : SUB_MEDIA_PLAYER_Local_Function_04_0300 - * @tc.name : 003.prepare-stop-reset,销毁播放器 + * @tc.name : 003.prepare-stop-reset-release * @tc.desc : 播控 */ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_0300, Function | MediumTest | Level0) { - PlayerSignal testObj; - std::shared_ptr player = std::make_shared(&testObj); + std::shared_ptr testObj = std::make_shared(); + std::shared_ptr player = std::make_shared(testObj); ASSERT_NE(nullptr, player); ASSERT_EQ(true, player->CreatePlayer()); - std::string uri = GetUri(); + std::string uri = TestParamsConfig::GetInstance().GetUri(); ASSERT_EQ(RET_OK, player->SetSource(uri)); sptr videoSurface = player->GetVideoSurface(g_sub_config); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); - std::shared_ptr testCallback = std::make_shared(&testObj); + std::shared_ptr testCallback = std::make_shared(testObj); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); ASSERT_EQ(RET_OK, player->Prepare()); @@ -98,260 +98,260 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_0300, Function | EXPECT_EQ(RET_OK, player->Reset()); EXPECT_FALSE(player->IsPlaying()); EXPECT_EQ(RET_OK, player->Release()); - EXPECT_EQ(RET_OK, testCallback->errorNum); + EXPECT_EQ(RET_OK, testCallback->errorNum_); } /** * @tc.number : SUB_MEDIA_PLAYER_Local_Function_04_0400 - * @tc.name : 004.prepare-stop-reset,不销毁播放器 + * @tc.name : 004.prepare-stop-reset * @tc.desc : 播控 */ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_0400, Function | MediumTest | Level0) { - PlayerSignal testObj; - std::shared_ptr player = std::make_shared(&testObj); + std::shared_ptr testObj = std::make_shared(); + std::shared_ptr player = std::make_shared(testObj); ASSERT_NE(nullptr, player); ASSERT_EQ(true, player->CreatePlayer()); - std::string uri = GetUri(); + std::string uri = TestParamsConfig::GetInstance().GetUri(); ASSERT_EQ(RET_OK, player->SetSource(uri)); sptr videoSurface = player->GetVideoSurface(g_sub_config); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); - std::shared_ptr testCallback = std::make_shared(&testObj); + std::shared_ptr testCallback = std::make_shared(testObj); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); ASSERT_EQ(RET_OK, player->Prepare()); EXPECT_EQ(RET_OK, player->Stop()); EXPECT_EQ(RET_OK, player->Reset()); EXPECT_FALSE(player->IsPlaying()); - EXPECT_EQ(RET_OK, testCallback->errorNum); + EXPECT_EQ(RET_OK, testCallback->errorNum_); } /** * @tc.number : SUB_MEDIA_PLAYER_Local_Function_04_0600 - * @tc.name : 006.prepare-play-reset,不销毁播放器 + * @tc.name : 006.prepare-play-reset * @tc.desc : */ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_0600, Function | MediumTest | Level0) { - PlayerSignal testObj; - std::shared_ptr player = std::make_shared(&testObj); + std::shared_ptr testObj = std::make_shared(); + std::shared_ptr player = std::make_shared(testObj); ASSERT_NE(nullptr, player); ASSERT_EQ(true, player->CreatePlayer()); - std::string uri = GetUri(); + std::string uri = TestParamsConfig::GetInstance().GetUri(); int32_t time; ASSERT_EQ(RET_OK, player->SetSource(uri)); sptr videoSurface = player->GetVideoSurface(g_sub_config); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); - std::shared_ptr testCallback = std::make_shared(&testObj); + std::shared_ptr testCallback = std::make_shared(testObj); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); ASSERT_EQ(RET_OK, player->Prepare()); EXPECT_EQ(RET_OK, player->Play()); EXPECT_TRUE(player->IsPlaying()); - sleep(PLAYING_TIME); + (void)sleep(PLAYING_TIME); EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); - EXPECT_NEAR(time, PLAYING_TIME * 1000, 1000); + EXPECT_NEAR(time, PLAYING_TIME * TIME_SEC2MS, DELTA_TIME); EXPECT_EQ(RET_OK, player->Stop()); EXPECT_EQ(RET_OK, player->Reset()); EXPECT_FALSE(player->IsPlaying()); - EXPECT_EQ(RET_OK, testCallback->errorNum); + EXPECT_EQ(RET_OK, testCallback->errorNum_); } /** * @tc.number : SUB_MEDIA_PLAYER_Local_Function_04_0700 - * @tc.name : 007.prepare-seek-play-reset,销毁播放器 + * @tc.name : 007.prepare-seek-play-reset-release * @tc.desc : */ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_0700, Function | MediumTest | Level0) { - PlayerSignal testObj; - std::shared_ptr player = std::make_shared(&testObj); + std::shared_ptr testObj = std::make_shared(); + std::shared_ptr player = std::make_shared(testObj); ASSERT_NE(nullptr, player); ASSERT_EQ(true, player->CreatePlayer()); - std::string uri = GetUri(); + std::string uri = TestParamsConfig::GetInstance().GetUri(); int32_t time; ASSERT_EQ(RET_OK, player->SetSource(uri)); sptr videoSurface = player->GetVideoSurface(g_sub_config); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); - std::shared_ptr testCallback = std::make_shared(&testObj); + std::shared_ptr testCallback = std::make_shared(testObj); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); ASSERT_EQ(RET_OK, player->Prepare()); EXPECT_EQ(RET_OK, player->Play()); - sleep(PLAYING_TIME); + (void)sleep(PLAYING_TIME); EXPECT_TRUE(player->IsPlaying()); EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); - EXPECT_NEAR(time, PLAYING_TIME * 1000, 1000); + EXPECT_NEAR(time, PLAYING_TIME * TIME_SEC2MS, DELTA_TIME); EXPECT_EQ(RET_OK, player->Stop()); EXPECT_EQ(RET_OK, player->Reset()); EXPECT_FALSE(player->IsPlaying()); EXPECT_EQ(RET_OK, player->Release()); - EXPECT_EQ(RET_OK, testCallback->errorNum); + EXPECT_EQ(RET_OK, testCallback->errorNum_); } /** * @tc.number : SUB_MEDIA_PLAYER_Local_Function_04_0800 - * @tc.name : 008.prepare-seek-play-reset,不销毁播放器 + * @tc.name : 008.prepare-seek-play-reset * @tc.desc : */ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_0800, Function | MediumTest | Level0) { - PlayerSignal testObj; - std::shared_ptr player = std::make_shared(&testObj); + std::shared_ptr testObj = std::make_shared(); + std::shared_ptr player = std::make_shared(testObj); ASSERT_NE(nullptr, player); ASSERT_EQ(true, player->CreatePlayer()); - std::string uri = GetUri(); + std::string uri = TestParamsConfig::GetInstance().GetUri(); int32_t time; ASSERT_EQ(RET_OK, player->SetSource(uri)); sptr videoSurface = player->GetVideoSurface(g_sub_config); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); - std::shared_ptr testCallback = std::make_shared(&testObj); + std::shared_ptr testCallback = std::make_shared(testObj); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); ASSERT_EQ(RET_OK, player->Prepare()); EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_5_SEC, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Play()); - sleep(PLAYING_TIME); + (void)sleep(PLAYING_TIME); EXPECT_TRUE(player->IsPlaying()); EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); - EXPECT_NEAR(time, SEEK_TIME_5_SEC + PLAYING_TIME * 1000, 1000); + EXPECT_NEAR(time, SEEK_TIME_5_SEC + PLAYING_TIME * TIME_SEC2MS, DELTA_TIME); EXPECT_EQ(RET_OK, player->Stop()); EXPECT_EQ(RET_OK, player->Reset()); EXPECT_FALSE(player->IsPlaying()); - EXPECT_EQ(RET_OK, testCallback->errorNum); + EXPECT_EQ(RET_OK, testCallback->errorNum_); } /** * @tc.number : SUB_MEDIA_PLAYER_Local_Function_04_0900 - * @tc.name : 009.prepare-play-seek-reset,销毁播放器 + * @tc.name : 009.prepare-play-seek-reset-release * @tc.desc : */ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_0900, Function | MediumTest | Level0) { - PlayerSignal testObj; - std::shared_ptr player = std::make_shared(&testObj); + std::shared_ptr testObj = std::make_shared(); + std::shared_ptr player = std::make_shared(testObj); ASSERT_NE(nullptr, player); ASSERT_EQ(true, player->CreatePlayer()); - std::string uri = GetUri(); + std::string uri = TestParamsConfig::GetInstance().GetUri(); int32_t time; ASSERT_EQ(RET_OK, player->SetSource(uri)); sptr videoSurface = player->GetVideoSurface(g_sub_config); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); - std::shared_ptr testCallback = std::make_shared(&testObj); + std::shared_ptr testCallback = std::make_shared(testObj); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); ASSERT_EQ(RET_OK, player->Prepare()); EXPECT_EQ(RET_OK, player->Play()); - sleep(PLAYING_TIME); + (void)sleep(PLAYING_TIME); EXPECT_TRUE(player->IsPlaying()); EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_5_SEC, SEEK_MODE)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); - EXPECT_NEAR(SEEK_TIME_5_SEC, time, DELTA_TIME); + EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(SEEK_TIME_5_SEC, time, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Reset()); EXPECT_FALSE(player->IsPlaying()); EXPECT_EQ(RET_OK, player->Release()); - EXPECT_EQ(RET_OK, testCallback->errorNum); + EXPECT_EQ(RET_OK, testCallback->errorNum_); } /** * @tc.number : SUB_MEDIA_PLAYER_Local_Function_04_1000 - * @tc.name : 010.prepare-play-seek-reset,不销毁播放器 + * @tc.name : 010.prepare-play-seek-reset * @tc.desc : */ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_1000, Function | MediumTest | Level0) { - PlayerSignal testObj; - std::shared_ptr player = std::make_shared(&testObj); + std::shared_ptr testObj = std::make_shared(); + std::shared_ptr player = std::make_shared(testObj); ASSERT_NE(nullptr, player); ASSERT_EQ(true, player->CreatePlayer()); - std::string uri = GetUri(); + std::string uri = TestParamsConfig::GetInstance().GetUri(); int32_t time; ASSERT_EQ(RET_OK, player->SetSource(uri)); sptr videoSurface = player->GetVideoSurface(g_sub_config); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); - std::shared_ptr testCallback = std::make_shared(&testObj); + std::shared_ptr testCallback = std::make_shared(testObj); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); ASSERT_EQ(RET_OK, player->Prepare()); EXPECT_EQ(RET_OK, player->Play()); - sleep(PLAYING_TIME); + (void)sleep(PLAYING_TIME); EXPECT_TRUE(player->IsPlaying()); EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_5_SEC, SEEK_MODE)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); - EXPECT_NEAR(SEEK_TIME_5_SEC, time, DELTA_TIME); + EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(SEEK_TIME_5_SEC, time, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Reset()); EXPECT_FALSE(player->IsPlaying()); - EXPECT_EQ(RET_OK, testCallback->errorNum); + EXPECT_EQ(RET_OK, testCallback->errorNum_); } /** * @tc.number : SUB_MEDIA_PLAYER_Local_Function_04_1100 - * @tc.name : 011.prepare-play-seek-pause-reset,不销毁播放器 + * @tc.name : 011.prepare-play-seek-pause-reset * @tc.desc : */ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_1100, Function | MediumTest | Level0) { - PlayerSignal testObj; - std::shared_ptr player = std::make_shared(&testObj); + std::shared_ptr testObj = std::make_shared(); + std::shared_ptr player = std::make_shared(testObj); ASSERT_NE(nullptr, player); ASSERT_EQ(true, player->CreatePlayer()); - std::string uri = GetUri(); + std::string uri = TestParamsConfig::GetInstance().GetUri(); int32_t time; ASSERT_EQ(RET_OK, player->SetSource(uri)); sptr videoSurface = player->GetVideoSurface(g_sub_config); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); - std::shared_ptr testCallback = std::make_shared(&testObj); + std::shared_ptr testCallback = std::make_shared(testObj); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); ASSERT_EQ(RET_OK, player->Prepare()); EXPECT_EQ(RET_OK, player->Play()); - sleep(PLAYING_TIME); + (void)sleep(PLAYING_TIME); EXPECT_TRUE(player->IsPlaying()); EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_5_SEC, SEEK_MODE)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); - EXPECT_NEAR(SEEK_TIME_5_SEC, time, DELTA_TIME); + EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(SEEK_TIME_5_SEC, time, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Pause()); EXPECT_FALSE(player->IsPlaying()); EXPECT_EQ(RET_OK, player->Reset()); EXPECT_FALSE(player->IsPlaying()); - EXPECT_EQ(RET_OK, testCallback->errorNum); + EXPECT_EQ(RET_OK, testCallback->errorNum_); } /** * @tc.number : SUB_MEDIA_PLAYER_Local_Function_04_1200 - * @tc.name : 012.prepare-play-seek-pause-reset,销毁播放器 + * @tc.name : 012.prepare-play-seek-pause-reset-release * @tc.desc : */ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_1200, Function | MediumTest | Level0) { - PlayerSignal testObj; - std::shared_ptr player = std::make_shared(&testObj); + std::shared_ptr testObj = std::make_shared(); + std::shared_ptr player = std::make_shared(testObj); ASSERT_NE(nullptr, player); ASSERT_EQ(true, player->CreatePlayer()); - std::string uri = GetUri(); + std::string uri = TestParamsConfig::GetInstance().GetUri(); int32_t time; ASSERT_EQ(RET_OK, player->SetSource(uri)); sptr videoSurface = player->GetVideoSurface(g_sub_config); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); - std::shared_ptr testCallback = std::make_shared(&testObj); + std::shared_ptr testCallback = std::make_shared(testObj); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); ASSERT_EQ(RET_OK, player->Prepare()); EXPECT_EQ(RET_OK, player->Play()); - sleep(PLAYING_TIME); + (void)sleep(PLAYING_TIME); EXPECT_TRUE(player->IsPlaying()); EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_5_SEC, SEEK_MODE)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); - EXPECT_NEAR(SEEK_TIME_5_SEC, time, DELTA_TIME); + EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(SEEK_TIME_5_SEC, time, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Pause()); EXPECT_FALSE(player->IsPlaying()); @@ -359,36 +359,36 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_1200, Function | EXPECT_EQ(RET_OK, player->Reset()); EXPECT_FALSE(player->IsPlaying()); EXPECT_EQ(RET_OK, player->Release()); - EXPECT_EQ(RET_OK, testCallback->errorNum); + EXPECT_EQ(RET_OK, testCallback->errorNum_); } /** * @tc.number : SUB_MEDIA_PLAYER_Local_Function_04_1300 - * @tc.name : 013.prepare-play-seek-pause-stop-reset,不销毁播放器 + * @tc.name : 013.prepare-play-seek-pause-stop-reset * @tc.desc : */ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_1300, Function | MediumTest | Level0) { - PlayerSignal testObj; - std::shared_ptr player = std::make_shared(&testObj); + std::shared_ptr testObj = std::make_shared(); + std::shared_ptr player = std::make_shared(testObj); ASSERT_NE(nullptr, player); ASSERT_EQ(true, player->CreatePlayer()); - std::string uri = GetUri(); + std::string uri = TestParamsConfig::GetInstance().GetUri(); int32_t time; ASSERT_EQ(RET_OK, player->SetSource(uri)); sptr videoSurface = player->GetVideoSurface(g_sub_config); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); - std::shared_ptr testCallback = std::make_shared(&testObj); + std::shared_ptr testCallback = std::make_shared(testObj); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); ASSERT_EQ(RET_OK, player->Prepare()); EXPECT_EQ(RET_OK, player->Play()); - sleep(PLAYING_TIME); + (void)sleep(PLAYING_TIME); EXPECT_TRUE(player->IsPlaying()); EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_5_SEC, SEEK_MODE)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); - EXPECT_NEAR(SEEK_TIME_5_SEC, time, DELTA_TIME); + EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(SEEK_TIME_5_SEC, time, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Pause()); EXPECT_FALSE(player->IsPlaying()); @@ -396,37 +396,37 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_1300, Function | EXPECT_EQ(RET_OK, player->Stop()); EXPECT_EQ(RET_OK, player->Reset()); EXPECT_FALSE(player->IsPlaying()); - EXPECT_EQ(RET_OK, testCallback->errorNum); + EXPECT_EQ(RET_OK, testCallback->errorNum_); } /** * @tc.number : SUB_MEDIA_PLAYER_Local_Function_04_1400 - * @tc.name : 014.prepare-play-seek-pause-stop-reset,销毁播放器 + * @tc.name : 014.prepare-play-seek-pause-stop-reset-release * @tc.desc : */ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_1400, Function | MediumTest | Level0) { - PlayerSignal testObj; - std::shared_ptr player = std::make_shared(&testObj); + std::shared_ptr testObj = std::make_shared(); + std::shared_ptr player = std::make_shared(testObj); ASSERT_NE(nullptr, player); ASSERT_EQ(true, player->CreatePlayer()); - std::string uri = GetUri(); + std::string uri = TestParamsConfig::GetInstance().GetUri(); int32_t time; ASSERT_EQ(RET_OK, player->SetSource(uri)); sptr videoSurface = player->GetVideoSurface(g_sub_config); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); - std::shared_ptr testCallback = std::make_shared(&testObj); + std::shared_ptr testCallback = std::make_shared(testObj); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); ASSERT_EQ(RET_OK, player->Prepare()); EXPECT_EQ(RET_OK, player->Play()); - sleep(PLAYING_TIME); + (void)sleep(PLAYING_TIME); EXPECT_TRUE(player->IsPlaying()); EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_5_SEC, SEEK_MODE)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); - EXPECT_NEAR(SEEK_TIME_5_SEC, time, DELTA_TIME); + EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(SEEK_TIME_5_SEC, time, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Pause()); EXPECT_FALSE(player->IsPlaying()); @@ -435,91 +435,91 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_1400, Function | EXPECT_EQ(RET_OK, player->Reset()); EXPECT_FALSE(player->IsPlaying()); EXPECT_EQ(RET_OK, player->Release()); - EXPECT_EQ(RET_OK, testCallback->errorNum); + EXPECT_EQ(RET_OK, testCallback->errorNum_); } /** * @tc.number : SUB_MEDIA_PLAYER_Local_Function_04_1500 - * @tc.name : 015.prepare-play-stop-reset,不销毁播放器 + * @tc.name : 015.prepare-play-stop-reset * @tc.desc : */ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_1500, Function | MediumTest | Level0) { - PlayerSignal testObj; - std::shared_ptr player = std::make_shared(&testObj); + std::shared_ptr testObj = std::make_shared(); + std::shared_ptr player = std::make_shared(testObj); ASSERT_NE(nullptr, player); ASSERT_EQ(true, player->CreatePlayer()); - std::string uri = GetUri(); + std::string uri = TestParamsConfig::GetInstance().GetUri(); ASSERT_EQ(RET_OK, player->SetSource(uri)); sptr videoSurface = player->GetVideoSurface(g_sub_config); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); - std::shared_ptr testCallback = std::make_shared(&testObj); + std::shared_ptr testCallback = std::make_shared(testObj); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); ASSERT_EQ(RET_OK, player->Prepare()); EXPECT_EQ(RET_OK, player->Play()); - sleep(PLAYING_TIME); + (void)sleep(PLAYING_TIME); EXPECT_TRUE(player->IsPlaying()); EXPECT_EQ(RET_OK, player->Stop()); EXPECT_EQ(RET_OK, player->Reset()); EXPECT_FALSE(player->IsPlaying()); - EXPECT_EQ(RET_OK, testCallback->errorNum); + EXPECT_EQ(RET_OK, testCallback->errorNum_); } /** * @tc.number : SUB_MEDIA_PLAYER_Local_Function_04_1600 - * @tc.name : 016.prepare-play-stop-reset,销毁播放器 + * @tc.name : 016.prepare-play-stop-reset-release * @tc.desc : */ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_1600, Function | MediumTest | Level0) { - PlayerSignal testObj; - std::shared_ptr player = std::make_shared(&testObj); + std::shared_ptr testObj = std::make_shared(); + std::shared_ptr player = std::make_shared(testObj); ASSERT_NE(nullptr, player); ASSERT_EQ(true, player->CreatePlayer()); - std::string uri = GetUri(); + std::string uri = TestParamsConfig::GetInstance().GetUri(); ASSERT_EQ(RET_OK, player->SetSource(uri)); sptr videoSurface = player->GetVideoSurface(g_sub_config); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); - std::shared_ptr testCallback = std::make_shared(&testObj); + std::shared_ptr testCallback = std::make_shared(testObj); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); ASSERT_EQ(RET_OK, player->Prepare()); EXPECT_EQ(RET_OK, player->Play()); - sleep(PLAYING_TIME); + (void)sleep(PLAYING_TIME); EXPECT_TRUE(player->IsPlaying()); EXPECT_EQ(RET_OK, player->Stop()); EXPECT_EQ(RET_OK, player->Reset()); EXPECT_FALSE(player->IsPlaying()); EXPECT_EQ(RET_OK, player->Release()); - EXPECT_EQ(RET_OK, testCallback->errorNum); + EXPECT_EQ(RET_OK, testCallback->errorNum_); } /** * @tc.number : SUB_MEDIA_PLAYER_Local_Function_04_1700 - * @tc.name : 017.prepare-stop,不销毁播放器 + * @tc.name : 017.prepare-stop * @tc.desc : */ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_1700, Function | MediumTest | Level0) { - PlayerSignal testObj; - std::shared_ptr player = std::make_shared(&testObj); + std::shared_ptr testObj = std::make_shared(); + std::shared_ptr player = std::make_shared(testObj); ASSERT_NE(nullptr, player); ASSERT_EQ(true, player->CreatePlayer()); - std::string uri = GetUri(); + std::string uri = TestParamsConfig::GetInstance().GetUri(); ASSERT_EQ(RET_OK, player->SetSource(uri)); sptr videoSurface = player->GetVideoSurface(g_sub_config); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); - std::shared_ptr testCallback = std::make_shared(&testObj); + std::shared_ptr testCallback = std::make_shared(testObj); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); ASSERT_EQ(RET_OK, player->Prepare()); EXPECT_EQ(RET_OK, player->Stop()); EXPECT_FALSE(player->IsPlaying()); - EXPECT_EQ(RET_OK, testCallback->errorNum); + EXPECT_EQ(RET_OK, testCallback->errorNum_); } /** @@ -529,35 +529,35 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_1700, Function | */ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_1800, Function | MediumTest | Level0) { - PlayerSignal testObj; - std::shared_ptr player = std::make_shared(&testObj); + std::shared_ptr testObj = std::make_shared(); + std::shared_ptr player = std::make_shared(testObj); ASSERT_NE(nullptr, player); ASSERT_EQ(true, player->CreatePlayer()); - std::string uri = GetUri(); + std::string uri = TestParamsConfig::GetInstance().GetUri(); int32_t time; ASSERT_EQ(RET_OK, player->SetSource(uri)); sptr videoSurface = player->GetVideoSurface(g_sub_config); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); - std::shared_ptr testCallback = std::make_shared(&testObj); + std::shared_ptr testCallback = std::make_shared(testObj); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); ASSERT_EQ(RET_OK, player->Prepare()); EXPECT_EQ(RET_OK, player->Play()); - sleep(PLAYING_TIME); + (void)sleep(PLAYING_TIME); EXPECT_TRUE(player->IsPlaying()); EXPECT_EQ(RET_OK, player->Pause()); EXPECT_FALSE(player->IsPlaying()); EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); - EXPECT_NEAR(PLAYING_TIME * 1000, time, DELTA_TIME); + EXPECT_NEAR(PLAYING_TIME * TIME_SEC2MS, time, DELTA_TIME); EXPECT_EQ(RET_OK, player->Play()); - sleep(PLAYING_TIME); + (void)sleep(PLAYING_TIME); EXPECT_TRUE(player->IsPlaying()); EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); - EXPECT_NEAR(PLAYING_TIME * 1000 * 2, time, DELTA_TIME); - EXPECT_EQ(RET_OK, testCallback->errorNum); + EXPECT_NEAR(PLAYING_TIME * TIME_SEC2MS + PLAYING_TIME * TIME_SEC2MS, time, DELTA_TIME); + EXPECT_EQ(RET_OK, testCallback->errorNum_); } /** @@ -567,39 +567,39 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_1800, Function | */ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_1900, Function | MediumTest | Level0) { - PlayerSignal testObj; - std::shared_ptr player = std::make_shared(&testObj); + std::shared_ptr testObj = std::make_shared(); + std::shared_ptr player = std::make_shared(testObj); ASSERT_NE(nullptr, player); ASSERT_EQ(true, player->CreatePlayer()); - std::string uri = GetUri(); + std::string uri = TestParamsConfig::GetInstance().GetUri(); int32_t time; ASSERT_EQ(RET_OK, player->SetSource(uri)); sptr videoSurface = player->GetVideoSurface(g_sub_config); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); - std::shared_ptr testCallback = std::make_shared(&testObj); + std::shared_ptr testCallback = std::make_shared(testObj); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); ASSERT_EQ(RET_OK, player->Prepare()); EXPECT_EQ(RET_OK, player->Play()); - sleep(PLAYING_TIME); + (void)sleep(PLAYING_TIME); EXPECT_TRUE(player->IsPlaying()); EXPECT_EQ(RET_OK, player->Pause()); EXPECT_FALSE(player->IsPlaying()); EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); - EXPECT_NEAR(PLAYING_TIME * 1000, time, DELTA_TIME); + EXPECT_NEAR(PLAYING_TIME * TIME_SEC2MS, time, DELTA_TIME); EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_2_SEC, SEEK_MODE)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); - EXPECT_NEAR(SEEK_TIME_2_SEC, time, DELTA_TIME); + EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(SEEK_TIME_2_SEC, time, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Play()); - sleep(PLAYING_TIME); + (void)sleep(PLAYING_TIME); EXPECT_TRUE(player->IsPlaying()); EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); - EXPECT_NEAR(SEEK_TIME_2_SEC + PLAYING_TIME * 1000, time, DELTA_TIME); - EXPECT_EQ(RET_OK, testCallback->errorNum); + EXPECT_NEAR(SEEK_TIME_2_SEC + PLAYING_TIME * TIME_SEC2MS, time, DELTA_TIME); + EXPECT_EQ(RET_OK, testCallback->errorNum_); } /** @@ -609,24 +609,24 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_1900, Function | */ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2000, Function | MediumTest | Level1) { - PlayerSignal testObj; - std::shared_ptr player = std::make_shared(&testObj); + std::shared_ptr testObj = std::make_shared(); + std::shared_ptr player = std::make_shared(testObj); ASSERT_NE(nullptr, player); ASSERT_EQ(true, player->CreatePlayer()); int32_t time; int32_t durationTime; - std::string uri = GetUri(); + std::string uri = TestParamsConfig::GetInstance().GetUri(); ASSERT_EQ(RET_OK, player->SetSource(uri)); sptr videoSurface = player->GetVideoSurface(g_sub_config); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); - std::shared_ptr testCallback = std::make_shared(&testObj); + std::shared_ptr testCallback = std::make_shared(testObj); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); ASSERT_EQ(RET_OK, player->Prepare()); EXPECT_EQ(RET_OK, player->Play()); - sleep(PLAYING_TIME); + (void)sleep(PLAYING_TIME); EXPECT_TRUE(player->IsPlaying()); EXPECT_EQ(RET_OK, player->SetLooping(false)); @@ -635,13 +635,13 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2000, Function | EXPECT_EQ(RET_OK, testCallback->WaitForState(PLAYER_PLAYBACK_COMPLETE)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); - EXPECT_EQ(durationTime, time); + EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(durationTime, time, SEEK_MODE)); EXPECT_FALSE(player->IsLooping()); EXPECT_FALSE(player->IsPlaying()); EXPECT_EQ(RET_OK, player->Stop()); EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(FILE_BEGIN, time); - EXPECT_EQ(RET_OK, testCallback->errorNum); + EXPECT_EQ(RET_OK, testCallback->errorNum_); } /** @@ -651,18 +651,18 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2000, Function | */ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2100, Function | MediumTest | Level1) { - PlayerSignal testObj; - std::shared_ptr player = std::make_shared(&testObj); + std::shared_ptr testObj = std::make_shared(); + std::shared_ptr player = std::make_shared(testObj); ASSERT_NE(nullptr, player); ASSERT_EQ(true, player->CreatePlayer()); int32_t time; int32_t durationTime; - std::string uri = GetUri(); + std::string uri = TestParamsConfig::GetInstance().GetUri(); ASSERT_EQ(RET_OK, player->SetSource(uri)); sptr videoSurface = player->GetVideoSurface(g_sub_config); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); - std::shared_ptr testCallback = std::make_shared(&testObj); + std::shared_ptr testCallback = std::make_shared(testObj); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); ASSERT_EQ(RET_OK, player->Prepare()); @@ -671,13 +671,13 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2100, Function | EXPECT_EQ(RET_OK, player->Seek(durationTime + 1, SEEK_MODE)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); - EXPECT_EQ(durationTime, time); + EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(durationTime, time, SEEK_MODE)); EXPECT_FALSE(player->IsLooping()); EXPECT_FALSE(player->IsPlaying()); EXPECT_EQ(RET_OK, player->Stop()); EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(FILE_BEGIN, time); - EXPECT_EQ(RET_OK, testCallback->errorNum); + EXPECT_EQ(RET_OK, testCallback->errorNum_); } /** @@ -687,42 +687,42 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2100, Function | */ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2200, Function | MediumTest | Level1) { - PlayerSignal testObj; - std::shared_ptr player = std::make_shared(&testObj); + std::shared_ptr testObj = std::make_shared(); + std::shared_ptr player = std::make_shared(testObj); ASSERT_NE(nullptr, player); ASSERT_EQ(true, player->CreatePlayer()); int32_t time_before; int32_t time_after; int32_t time; int32_t durationTime; - std::string uri = GetUri(); + std::string uri = TestParamsConfig::GetInstance().GetUri(); ASSERT_EQ(RET_OK, player->SetSource(uri)); sptr videoSurface = player->GetVideoSurface(g_sub_config); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); - std::shared_ptr testCallback = std::make_shared(&testObj); + std::shared_ptr testCallback = std::make_shared(testObj); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); ASSERT_EQ(RET_OK, player->Prepare()); EXPECT_EQ(RET_OK, player->Play()); - sleep(PLAYING_TIME); + (void)sleep(PLAYING_TIME); EXPECT_TRUE(player->IsPlaying()); EXPECT_EQ(RET_OK, player->SetLooping(true)); EXPECT_EQ(RET_OK, player->GetDuration(durationTime)); EXPECT_EQ(RET_OK, player->Seek(durationTime + 1, SEEK_MODE)); - sleep(PLAYING_TIME); + (void)sleep(PLAYING_TIME); EXPECT_TRUE(player->IsLooping()); EXPECT_TRUE(player->IsPlaying()); EXPECT_EQ(RET_OK, player->GetCurrentTime(time_before)); - sleep(PLAYING_TIME); + (void)sleep(PLAYING_TIME); EXPECT_EQ(RET_OK, player->GetCurrentTime(time_after)); - EXPECT_NEAR(time_after - time_before, PLAYING_TIME * 1000, DELTA_TIME); + EXPECT_NEAR(time_after - time_before, PLAYING_TIME * TIME_SEC2MS, DELTA_TIME); EXPECT_EQ(RET_OK, player->Stop()); EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); - EXPECT_NEAR(FILE_BEGIN, time, DELTA_TIME); - EXPECT_EQ(RET_OK, testCallback->errorNum); + EXPECT_EQ(FILE_BEGIN, time); + EXPECT_EQ(RET_OK, testCallback->errorNum_); } /** @@ -732,23 +732,23 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2200, Function | */ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2300, Function | MediumTest | Level1) { - PlayerSignal testObj; - std::shared_ptr player = std::make_shared(&testObj); + std::shared_ptr testObj = std::make_shared(); + std::shared_ptr player = std::make_shared(testObj); ASSERT_NE(nullptr, player); ASSERT_EQ(true, player->CreatePlayer()); int32_t time; int32_t durationTime; - std::string uri = GetUri(); + std::string uri = TestParamsConfig::GetInstance().GetUri(); ASSERT_EQ(RET_OK, player->SetSource(uri)); sptr videoSurface = player->GetVideoSurface(g_sub_config); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); - std::shared_ptr testCallback = std::make_shared(&testObj); + std::shared_ptr testCallback = std::make_shared(testObj); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); ASSERT_EQ(RET_OK, player->Prepare()); EXPECT_EQ(RET_OK, player->Play()); - sleep(PLAYING_TIME); + (void)sleep(PLAYING_TIME); EXPECT_TRUE(player->IsPlaying()); EXPECT_EQ(RET_OK, player->SetLooping(false)); @@ -758,11 +758,11 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2300, Function | EXPECT_EQ(RET_OK, testCallback->WaitForState(PLAYER_PLAYBACK_COMPLETE)); EXPECT_FALSE(player->IsPlaying()); EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); - EXPECT_EQ(durationTime, time); + EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(durationTime, time, SEEK_MODE)); EXPECT_FALSE(player->IsLooping()); EXPECT_EQ(RET_OK, player->Stop()); - EXPECT_EQ(RET_OK, testCallback->errorNum); + EXPECT_EQ(RET_OK, testCallback->errorNum_); } /** @@ -772,31 +772,31 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2300, Function | */ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2400, Function | MediumTest | Level1) { - PlayerSignal testObj; - std::shared_ptr player = std::make_shared(&testObj); + std::shared_ptr testObj = std::make_shared(); + std::shared_ptr player = std::make_shared(testObj); ASSERT_NE(nullptr, player); ASSERT_EQ(true, player->CreatePlayer()); int32_t time; int32_t durationTime; - std::string uri = GetUri(); + std::string uri = TestParamsConfig::GetInstance().GetUri(); ASSERT_EQ(RET_OK, player->SetSource(uri)); sptr videoSurface = player->GetVideoSurface(g_sub_config); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); - std::shared_ptr testCallback = std::make_shared(&testObj); + std::shared_ptr testCallback = std::make_shared(testObj); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); ASSERT_EQ(RET_OK, player->Prepare()); EXPECT_EQ(RET_OK, player->Play()); - sleep(PLAYING_TIME); + (void)sleep(PLAYING_TIME); EXPECT_TRUE(player->IsPlaying()); EXPECT_EQ(RET_OK, player->GetDuration(durationTime)); EXPECT_EQ(RET_OK, player->Seek(durationTime - 1, SEEK_MODE)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_NEAR(durationTime, time, DELTA_TIME); - EXPECT_EQ(RET_OK, testCallback->errorNum); + EXPECT_EQ(RET_OK, testCallback->errorNum_); } /** @@ -806,33 +806,33 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2400, Function | */ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2500, Function | MediumTest | Level3) { - PlayerSignal testObj; - std::shared_ptr player = std::make_shared(&testObj); + std::shared_ptr testObj = std::make_shared(); + std::shared_ptr player = std::make_shared(testObj); ASSERT_NE(nullptr, player); ASSERT_EQ(true, player->CreatePlayer()); int32_t time; - std::string uri = GetUri(); + std::string uri = TestParamsConfig::GetInstance().GetUri(); ASSERT_EQ(RET_OK, player->SetSource(uri)); sptr videoSurface = player->GetVideoSurface(g_sub_config); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); - std::shared_ptr testCallback = std::make_shared(&testObj); + std::shared_ptr testCallback = std::make_shared(testObj); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); ASSERT_EQ(RET_OK, player->Prepare()); EXPECT_EQ(RET_OK, player->Play()); - sleep(PLAYING_TIME); + (void)sleep(PLAYING_TIME); EXPECT_TRUE(player->IsPlaying()); - testObj.mutexFlag_ = false; + testObj->mutexFlag_ = false; EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_5_SEC, SEEK_MODE)); - testObj.mutexFlag_ = true; + testObj->mutexFlag_ = true; EXPECT_EQ(RET_OK, player->Play()); - sleep(PLAYING_TIME); + (void)sleep(PLAYING_TIME); EXPECT_TRUE(player->IsPlaying()); EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_GE(time, SEEK_TIME_5_SEC); - EXPECT_EQ(RET_OK, testCallback->errorNum); + EXPECT_EQ(RET_OK, testCallback->errorNum_); } /** @@ -842,31 +842,31 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2500, Function | */ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2600, Function | MediumTest | Level3) { - PlayerSignal testObj; - std::shared_ptr player = std::make_shared(&testObj); + std::shared_ptr testObj = std::make_shared(); + std::shared_ptr player = std::make_shared(testObj); ASSERT_NE(nullptr, player); ASSERT_EQ(true, player->CreatePlayer()); int32_t time; - std::string uri = GetUri(); + std::string uri = TestParamsConfig::GetInstance().GetUri(); ASSERT_EQ(RET_OK, player->SetSource(uri)); sptr videoSurface = player->GetVideoSurface(g_sub_config); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); - std::shared_ptr testCallback = std::make_shared(&testObj); + std::shared_ptr testCallback = std::make_shared(testObj); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); ASSERT_EQ(RET_OK, player->Prepare()); EXPECT_EQ(RET_OK, player->Play()); - sleep(PLAYING_TIME); + (void)sleep(PLAYING_TIME); EXPECT_TRUE(player->IsPlaying()); - testObj.mutexFlag_ = false; + testObj->mutexFlag_ = false; EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_2_SEC, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_2_SEC, SEEK_MODE)); - testObj.mutexFlag_ = true; + testObj->mutexFlag_ = true; EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_5_SEC, SEEK_MODE)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); - EXPECT_NEAR(SEEK_TIME_5_SEC, time, DELTA_TIME); - EXPECT_EQ(RET_OK, testCallback->errorNum); + EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(SEEK_TIME_5_SEC, time, SEEK_MODE)); + EXPECT_EQ(RET_OK, testCallback->errorNum_); } /** * @tc.number : SUB_MEDIA_PLAYER_Local_Function_04_2625 @@ -875,27 +875,27 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2600, Function | */ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2625, Function | MediumTest | Level3) { - PlayerSignal testObj; - std::shared_ptr player = std::make_shared(&testObj); + std::shared_ptr testObj = std::make_shared(); + std::shared_ptr player = std::make_shared(testObj); ASSERT_NE(nullptr, player); ASSERT_EQ(true, player->CreatePlayer()); - std::string uri = GetUri(); + std::string uri = TestParamsConfig::GetInstance().GetUri(); ASSERT_EQ(RET_OK, player->SetSource(uri)); sptr videoSurface = player->GetVideoSurface(g_sub_config); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); - std::shared_ptr testCallback = std::make_shared(&testObj); + std::shared_ptr testCallback = std::make_shared(testObj); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); ASSERT_EQ(RET_OK, player->Prepare()); EXPECT_EQ(RET_OK, player->Play()); - sleep(PLAYING_TIME); + (void)sleep(PLAYING_TIME); EXPECT_TRUE(player->IsPlaying()); - testObj.mutexFlag_ = false; + testObj->mutexFlag_ = false; EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_2_SEC, SEEK_MODE)); - testObj.mutexFlag_ = true; + testObj->mutexFlag_ = true; EXPECT_EQ(RET_OK, player->Pause()); - EXPECT_EQ(RET_OK, testCallback->errorNum); + EXPECT_EQ(RET_OK, testCallback->errorNum_); } /** * @tc.number : SUB_MEDIA_PLAYER_Local_Function_04_2650 @@ -904,28 +904,28 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2625, Function | */ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2650, Function | MediumTest | Level3) { - PlayerSignal testObj; - std::shared_ptr player = std::make_shared(&testObj); + std::shared_ptr testObj = std::make_shared(); + std::shared_ptr player = std::make_shared(testObj); ASSERT_NE(nullptr, player); ASSERT_EQ(true, player->CreatePlayer()); int32_t durationTime; - std::string uri = GetUri(); + std::string uri = TestParamsConfig::GetInstance().GetUri(); ASSERT_EQ(RET_OK, player->SetSource(uri)); sptr videoSurface = player->GetVideoSurface(g_sub_config); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); - std::shared_ptr testCallback = std::make_shared(&testObj); + std::shared_ptr testCallback = std::make_shared(testObj); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); ASSERT_EQ(RET_OK, player->Prepare()); EXPECT_EQ(RET_OK, player->Play()); - sleep(PLAYING_TIME); + (void)sleep(PLAYING_TIME); EXPECT_TRUE(player->IsPlaying()); - testObj.mutexFlag_ = false; + testObj->mutexFlag_ = false; EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_2_SEC, SEEK_MODE)); - testObj.mutexFlag_ = true; + testObj->mutexFlag_ = true; EXPECT_EQ(RET_OK, player->GetDuration(durationTime)); - EXPECT_EQ(RET_OK, testCallback->errorNum); + EXPECT_EQ(RET_OK, testCallback->errorNum_); } /** * @tc.number : SUB_MEDIA_PLAYER_Local_Function_04_2651 @@ -934,28 +934,28 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2650, Function | */ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2651, Function | MediumTest | Level3) { - PlayerSignal testObj; - std::shared_ptr player = std::make_shared(&testObj); + std::shared_ptr testObj = std::make_shared(); + std::shared_ptr player = std::make_shared(testObj); ASSERT_NE(nullptr, player); ASSERT_EQ(true, player->CreatePlayer()); int32_t time; - std::string uri = GetUri(); + std::string uri = TestParamsConfig::GetInstance().GetUri(); ASSERT_EQ(RET_OK, player->SetSource(uri)); sptr videoSurface = player->GetVideoSurface(g_sub_config); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); - std::shared_ptr testCallback = std::make_shared(&testObj); + std::shared_ptr testCallback = std::make_shared(testObj); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); ASSERT_EQ(RET_OK, player->Prepare()); EXPECT_EQ(RET_OK, player->Play()); - sleep(PLAYING_TIME); + (void)sleep(PLAYING_TIME); EXPECT_TRUE(player->IsPlaying()); EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_2_SEC, SEEK_MODE)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); - EXPECT_NEAR(PLAYING_TIME * 1000, time, DELTA_TIME); - EXPECT_EQ(RET_OK, testCallback->errorNum); + EXPECT_NEAR(PLAYING_TIME * TIME_SEC2MS, time, DELTA_TIME); + EXPECT_EQ(RET_OK, testCallback->errorNum_); } /** * @tc.number : SUB_MEDIA_PLAYER_Local_Function_04_2675 @@ -964,30 +964,30 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2651, Function | */ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2675, Function | MediumTest | Level3) { - PlayerSignal testObj; - std::shared_ptr player = std::make_shared(&testObj); + std::shared_ptr testObj = std::make_shared(); + std::shared_ptr player = std::make_shared(testObj); ASSERT_NE(nullptr, player); ASSERT_EQ(true, player->CreatePlayer()); int32_t time; - std::string uri = GetUri(); + std::string uri = TestParamsConfig::GetInstance().GetUri(); ASSERT_EQ(RET_OK, player->SetSource(uri)); sptr videoSurface = player->GetVideoSurface(g_sub_config); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); - std::shared_ptr testCallback = std::make_shared(&testObj); + std::shared_ptr testCallback = std::make_shared(testObj); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); ASSERT_EQ(RET_OK, player->Prepare()); EXPECT_EQ(RET_OK, player->Play()); - sleep(PLAYING_TIME); + (void)sleep(PLAYING_TIME); EXPECT_TRUE(player->IsPlaying()); - testObj.mutexFlag_ = false; + testObj->mutexFlag_ = false; EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_2_SEC, SEEK_MODE)); - testObj.mutexFlag_ = true; + testObj->mutexFlag_ = true; EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); - EXPECT_NEAR(PLAYING_TIME * 1000, time, DELTA_TIME); - EXPECT_EQ(RET_OK, testCallback->errorNum); + EXPECT_NEAR(PLAYING_TIME * TIME_SEC2MS, time, DELTA_TIME); + EXPECT_EQ(RET_OK, testCallback->errorNum_); } /** * @tc.number : SUB_MEDIA_PLAYER_Local_Function_04_2700 @@ -996,18 +996,18 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2675, Function | */ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2700, Function | MediumTest | Level3) { - PlayerSignal testObj; - std::shared_ptr player = std::make_shared(&testObj); + std::shared_ptr testObj = std::make_shared(); + std::shared_ptr player = std::make_shared(testObj); ASSERT_NE(nullptr, player); ASSERT_EQ(true, player->CreatePlayer()); int32_t time; int32_t durationTime; - std::string uri = GetUri(); + std::string uri = TestParamsConfig::GetInstance().GetUri(); ASSERT_EQ(RET_OK, player->SetSource(uri)); sptr videoSurface = player->GetVideoSurface(g_sub_config); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); - std::shared_ptr testCallback = std::make_shared(&testObj); + std::shared_ptr testCallback = std::make_shared(testObj); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); ASSERT_EQ(RET_OK, player->Prepare()); @@ -1016,15 +1016,15 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2700, Function | EXPECT_EQ(RET_OK, player->GetDuration(durationTime)); EXPECT_EQ(RET_OK, player->Seek(durationTime, SEEK_MODE)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); - EXPECT_EQ(durationTime, time); + EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(durationTime, time, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Seek(durationTime, SEEK_MODE)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); - EXPECT_EQ(durationTime, time); + EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(durationTime, time, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, testCallback->WaitForState(PLAYER_PLAYBACK_COMPLETE)); EXPECT_FALSE(player->IsPlaying()); EXPECT_EQ(RET_OK, player->Stop()); - EXPECT_EQ(RET_OK, testCallback->errorNum); + EXPECT_EQ(RET_OK, testCallback->errorNum_); } /** @@ -1034,38 +1034,38 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2700, Function | */ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2800, Function | MediumTest | Level3) { - PlayerSignal testObj; - std::shared_ptr player = std::make_shared(&testObj); + std::shared_ptr testObj = std::make_shared(); + std::shared_ptr player = std::make_shared(testObj); ASSERT_NE(nullptr, player); ASSERT_EQ(true, player->CreatePlayer()); int32_t time; int32_t durationTime; - std::string uri = GetUri(); + std::string uri = TestParamsConfig::GetInstance().GetUri(); ASSERT_EQ(RET_OK, player->SetSource(uri)); sptr videoSurface = player->GetVideoSurface(g_sub_config); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); - std::shared_ptr testCallback = std::make_shared(&testObj); + std::shared_ptr testCallback = std::make_shared(testObj); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); ASSERT_EQ(RET_OK, player->Prepare()); EXPECT_EQ(RET_OK, player->Play()); - sleep(PLAYING_TIME); + (void)sleep(PLAYING_TIME); EXPECT_TRUE(player->IsPlaying()); EXPECT_EQ(RET_OK, player->Pause()); EXPECT_EQ(RET_OK, player->GetDuration(durationTime)); EXPECT_EQ(RET_OK, player->Seek(durationTime, SEEK_MODE)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); - EXPECT_EQ(durationTime, time); + EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(durationTime, time, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Stop()); ASSERT_EQ(RET_OK, player->Prepare()); EXPECT_EQ(RET_OK, player->Play()); - sleep(PLAYING_TIME); + (void)sleep(PLAYING_TIME); EXPECT_TRUE(player->IsPlaying()); EXPECT_EQ(RET_OK, player->Stop()); EXPECT_EQ(RET_OK, player->Reset()); - EXPECT_EQ(RET_OK, testCallback->errorNum); + EXPECT_EQ(RET_OK, testCallback->errorNum_); } /** @@ -1075,20 +1075,18 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2800, Function | */ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2900, Function | MediumTest | Level3) { - PlayerSignal testObj; - std::shared_ptr player = std::make_shared(&testObj); + std::shared_ptr testObj = std::make_shared(); + std::shared_ptr player = std::make_shared(testObj); ASSERT_NE(nullptr, player); ASSERT_EQ(true, player->CreatePlayer()); int32_t time; - int32_t time_before; - int32_t time_after; int32_t durationTime; - std::string uri = GetUri(); + std::string uri = TestParamsConfig::GetInstance().GetUri(); ASSERT_EQ(RET_OK, player->SetSource(uri)); sptr videoSurface = player->GetVideoSurface(g_sub_config); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); - std::shared_ptr testCallback = std::make_shared(&testObj); + std::shared_ptr testCallback = std::make_shared(testObj); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); ASSERT_EQ(RET_OK, player->Prepare()); @@ -1096,21 +1094,17 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2900, Function | EXPECT_EQ(RET_OK, player->GetDuration(durationTime)); EXPECT_EQ(RET_OK, player->Seek(durationTime, SEEK_MODE)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); - EXPECT_EQ(durationTime, time); + EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(durationTime, time, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, testCallback->WaitForState(PLAYER_PLAYBACK_COMPLETE)); EXPECT_EQ(RET_OK, player->Stop()); ASSERT_EQ(RET_OK, player->Prepare()); EXPECT_EQ(RET_OK, player->Seek(durationTime, SEEK_MODE)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); - sleep(PLAYING_TIME); - EXPECT_EQ(RET_OK, player->GetCurrentTime(time_before)); - sleep(PLAYING_TIME); - EXPECT_EQ(RET_OK, player->GetCurrentTime(time_after)); EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, testCallback->WaitForState(PLAYER_PLAYBACK_COMPLETE)); EXPECT_EQ(RET_OK, player->Reset()); - EXPECT_EQ(RET_OK, testCallback->errorNum); + EXPECT_EQ(RET_OK, testCallback->errorNum_); } /** @@ -1120,20 +1114,20 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2900, Function | */ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_3000, Function | MediumTest | Level3) { - PlayerSignal testObj; - std::shared_ptr player = std::make_shared(&testObj); + std::shared_ptr testObj = std::make_shared(); + std::shared_ptr player = std::make_shared(testObj); ASSERT_NE(nullptr, player); ASSERT_EQ(true, player->CreatePlayer()); int32_t time; int32_t time_before; int32_t time_after; int32_t durationTime; - std::string uri = GetUri(); + std::string uri = TestParamsConfig::GetInstance().GetUri(); ASSERT_EQ(RET_OK, player->SetSource(uri)); sptr videoSurface = player->GetVideoSurface(g_sub_config); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); - std::shared_ptr testCallback = std::make_shared(&testObj); + std::shared_ptr testCallback = std::make_shared(testObj); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); ASSERT_EQ(RET_OK, player->Prepare()); @@ -1143,24 +1137,24 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_3000, Function | EXPECT_EQ(RET_OK, player->GetDuration(durationTime)); EXPECT_EQ(RET_OK, player->Seek(durationTime, SEEK_MODE)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); - EXPECT_EQ(durationTime, time); + EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(durationTime, time, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, testCallback->WaitForState(PLAYER_PLAYBACK_COMPLETE)); - sleep(PLAYING_TIME); + (void)sleep(PLAYING_TIME); EXPECT_EQ(RET_OK, player->GetCurrentTime(time_before)); - sleep(PLAYING_TIME); + (void)sleep(PLAYING_TIME); EXPECT_EQ(RET_OK, player->GetCurrentTime(time_after)); - EXPECT_NEAR(time_after - time_before, PLAYING_TIME * 1000, DELTA_TIME); + EXPECT_NEAR(time_after - time_before, PLAYING_TIME * TIME_SEC2MS, DELTA_TIME); EXPECT_EQ(RET_OK, player->Stop()); ASSERT_EQ(RET_OK, player->Prepare()); EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Pause()); EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_2_SEC, SEEK_MODE)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); - EXPECT_EQ(SEEK_TIME_2_SEC, time); + EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(SEEK_TIME_2_SEC, time, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Stop()); EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(FILE_BEGIN, time); EXPECT_EQ(RET_OK, player->Reset()); - EXPECT_EQ(RET_OK, testCallback->errorNum); + EXPECT_EQ(RET_OK, testCallback->errorNum_); } -- GitLab