未验证 提交 b4d1d59f 编写于 作者: N NOBUGGERS 提交者: Gitee

ActsPlayerFuncTest 刷新 Signed-off-by: NOBUGGERS <ruanmeng@huawei.com>

上级 c7ac8e4b
...@@ -22,23 +22,32 @@ using namespace OHOS::Media; ...@@ -22,23 +22,32 @@ using namespace OHOS::Media;
using namespace testing::ext; using namespace testing::ext;
using namespace TestPlayerBasic; using namespace TestPlayerBasic;
/**
* @tc.number : SUB_MEDIA_PLAYER_Local_Function_03_0100 void ActsPlayerFuncTest::PreparePlayEnv(std::shared_ptr<TestPlayer> &player)
* @tc.name : 001.进行播放
* @tc.desc : 播控
*/
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_0100, Function | MediumTest | Level0)
{ {
std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>(); testObj_ = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj); player = std::make_shared<TestPlayer>(testObj_);
ASSERT_NE(nullptr, player); ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer()); ASSERT_EQ(true, player->CreatePlayer());
std::string uri = TestParamsConfig::GetInstance().GetUri(); printf("PreparePlayEnv source is %s", uri_.c_str());
ASSERT_EQ(RET_OK, player->SetSource(uri)); ASSERT_EQ(RET_OK, player->SetSource(uri_));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj); testCallback_ = std::make_shared<TestPlayerCallback>(testObj_);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback)); EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback_));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config); sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface)); EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
}
/**
* @tc.number : SUB_MEDIA_PLAYER_FUNCTION_03_0100
* @tc.name : 001.进行播放
* @tc.desc : 播控
*/
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_FUNCTION_03_0100, Function | MediumTest | Level0)
{
std::shared_ptr<TestPlayer> player;
PreparePlayEnv(player);
ASSERT_EQ(RET_OK, player->Prepare()); ASSERT_EQ(RET_OK, player->Prepare());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
(void)sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
...@@ -46,30 +55,19 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_0100, Function | ...@@ -46,30 +55,19 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_0100, Function |
EXPECT_EQ(RET_OK, player->Stop()); EXPECT_EQ(RET_OK, player->Stop());
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_EQ(RET_OK, player->Release()); 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_03_0200 * @tc.number : SUB_MEDIA_PLAYER_FUNCTION_03_0200
* @tc.name : 002.进行暂停 * @tc.name : 002.进行暂停
* @tc.desc : 播控 * @tc.desc : 播控
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_0200, Function | MediumTest | Level0) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_FUNCTION_03_0200, Function | MediumTest | Level0)
{ {
std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>(); std::shared_ptr<TestPlayer> player;
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj); PreparePlayEnv(player);
ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer());
std::string uri = TestParamsConfig::GetInstance().GetUri();
ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->Prepare()); ASSERT_EQ(RET_OK, player->Prepare());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
(void)sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
EXPECT_TRUE(player->IsPlaying()); EXPECT_TRUE(player->IsPlaying());
...@@ -79,28 +77,18 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_0200, Function | ...@@ -79,28 +77,18 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_0200, Function |
EXPECT_EQ(RET_OK, player->Stop()); EXPECT_EQ(RET_OK, player->Stop());
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_EQ(RET_OK, testCallback->errorNum_); EXPECT_EQ(RET_OK, testCallback_->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Function_03_0300 * @tc.number : SUB_MEDIA_PLAYER_FUNCTION_03_0300
* @tc.name : 003.进行恢复播放 * @tc.name : 003.进行恢复播放
* @tc.desc : 播控 * @tc.desc : 播控
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_0300, Function | MediumTest | Level0) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_FUNCTION_03_0300, Function | MediumTest | Level0)
{ {
std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>(); std::shared_ptr<TestPlayer> player;
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj); PreparePlayEnv(player);
ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer());
std::string uri = TestParamsConfig::GetInstance().GetUri();
ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->Prepare()); ASSERT_EQ(RET_OK, player->Prepare());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
...@@ -116,27 +104,18 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_0300, Function | ...@@ -116,27 +104,18 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_0300, Function |
EXPECT_EQ(RET_OK, player->Stop()); EXPECT_EQ(RET_OK, player->Stop());
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_EQ(RET_OK, testCallback->errorNum_); EXPECT_EQ(RET_OK, testCallback_->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Function_03_0400 * @tc.number : SUB_MEDIA_PLAYER_FUNCTION_03_0400
* @tc.name : 004.进行停止播放 * @tc.name : 004.进行停止播放
* @tc.desc : 播控 * @tc.desc : 播控
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_0400, Function | MediumTest | Level0) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_FUNCTION_03_0400, Function | MediumTest | Level0)
{ {
std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>(); std::shared_ptr<TestPlayer> player;
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj); PreparePlayEnv(player);
ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer());
std::string uri = TestParamsConfig::GetInstance().GetUri();
ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->Prepare()); ASSERT_EQ(RET_OK, player->Prepare());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
(void)sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
...@@ -144,27 +123,18 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_0400, Function | ...@@ -144,27 +123,18 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_0400, Function |
EXPECT_EQ(RET_OK, player->Stop()); EXPECT_EQ(RET_OK, player->Stop());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_EQ(RET_OK, testCallback->errorNum_); EXPECT_EQ(RET_OK, testCallback_->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Function_03_0500 * @tc.number : SUB_MEDIA_PLAYER_FUNCTION_03_0500
* @tc.name : 005.进行结束播放 * @tc.name : 005.进行结束播放
* @tc.desc : 播控 * @tc.desc : 播控
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_0500, Function | MediumTest | Level0) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_FUNCTION_03_0500, Function | MediumTest | Level0)
{ {
std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>(); std::shared_ptr<TestPlayer> player;
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj); PreparePlayEnv(player);
ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer());
std::string uri = TestParamsConfig::GetInstance().GetUri();
ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->Prepare()); ASSERT_EQ(RET_OK, player->Prepare());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
(void)sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
...@@ -172,27 +142,18 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_0500, Function | ...@@ -172,27 +142,18 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_0500, Function |
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, testCallback->errorNum_); EXPECT_EQ(RET_OK, testCallback_->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Function_03_0600 * @tc.number : SUB_MEDIA_PLAYER_FUNCTION_03_0600
* @tc.name : 006.暂停后恢复播放,再次暂停 * @tc.name : 006.暂停后恢复播放,再次暂停
* @tc.desc : 播控 * @tc.desc : 播控
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_0600, Function | MediumTest | Level1) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_FUNCTION_03_0600, Function | MediumTest | Level1)
{ {
std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>(); std::shared_ptr<TestPlayer> player;
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj); PreparePlayEnv(player);
ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer());
std::string uri = TestParamsConfig::GetInstance().GetUri();
ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->Prepare()); ASSERT_EQ(RET_OK, player->Prepare());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
(void)sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
...@@ -210,27 +171,18 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_0600, Function | ...@@ -210,27 +171,18 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_0600, Function |
EXPECT_EQ(RET_OK, player->Stop()); EXPECT_EQ(RET_OK, player->Stop());
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_EQ(RET_OK, testCallback->errorNum_); EXPECT_EQ(RET_OK, testCallback_->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Function_03_0700 * @tc.number : SUB_MEDIA_PLAYER_FUNCTION_03_0700
* @tc.name : 007.暂停后结束播放 * @tc.name : 007.暂停后结束播放
* @tc.desc : 播控 * @tc.desc : 播控
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_0700, Function | MediumTest | Level1) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_FUNCTION_03_0700, Function | MediumTest | Level1)
{ {
std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>(); std::shared_ptr<TestPlayer> player;
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj); PreparePlayEnv(player);
ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer());
std::string uri = TestParamsConfig::GetInstance().GetUri();
ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->Prepare()); ASSERT_EQ(RET_OK, player->Prepare());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
...@@ -239,27 +191,18 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_0700, Function | ...@@ -239,27 +191,18 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_0700, Function |
EXPECT_EQ(RET_OK, player->Pause()); EXPECT_EQ(RET_OK, player->Pause());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_EQ(RET_OK, testCallback->errorNum_); EXPECT_EQ(RET_OK, testCallback_->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Function_03_0800 * @tc.number : SUB_MEDIA_PLAYER_FUNCTION_03_0800
* @tc.name : 008.暂停后恢复播放,再结束播放 * @tc.name : 008.暂停后恢复播放,再结束播放
* @tc.desc : 播控 * @tc.desc : 播控
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_0800, Function | MediumTest | Level1) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_FUNCTION_03_0800, Function | MediumTest | Level1)
{ {
std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>(); std::shared_ptr<TestPlayer> player;
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj); PreparePlayEnv(player);
ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer());
std::string uri = TestParamsConfig::GetInstance().GetUri();
ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->Prepare()); ASSERT_EQ(RET_OK, player->Prepare());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
...@@ -271,27 +214,18 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_0800, Function | ...@@ -271,27 +214,18 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_0800, Function |
(void)sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
EXPECT_TRUE(player->IsPlaying()); EXPECT_TRUE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_EQ(RET_OK, testCallback->errorNum_); EXPECT_EQ(RET_OK, testCallback_->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Function_03_0900 * @tc.number : SUB_MEDIA_PLAYER_FUNCTION_03_0900
* @tc.name : 009.停止播放后重新开始播放,暂停后恢复播放,再结束播放 * @tc.name : 009.停止播放后重新开始播放,暂停后恢复播放,再结束播放
* @tc.desc : 播控 * @tc.desc : 播控
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_0900, Function | MediumTest | Level2) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_FUNCTION_03_0900, Function | MediumTest | Level2)
{ {
std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>(); std::shared_ptr<TestPlayer> player;
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj); PreparePlayEnv(player);
ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer());
std::string uri = TestParamsConfig::GetInstance().GetUri();
ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->Prepare()); ASSERT_EQ(RET_OK, player->Prepare());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
(void)sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
...@@ -309,27 +243,18 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_0900, Function | ...@@ -309,27 +243,18 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_0900, Function |
(void)sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
EXPECT_TRUE(player->IsPlaying()); EXPECT_TRUE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_EQ(RET_OK, testCallback->errorNum_); EXPECT_EQ(RET_OK, testCallback_->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Function_03_1000 * @tc.number : SUB_MEDIA_PLAYER_FUNCTION_03_1000
* @tc.name : 010.停止播放后重新开始播放,暂停后结束播放 * @tc.name : 010.停止播放后重新开始播放,暂停后结束播放
* @tc.desc : 播控 * @tc.desc : 播控
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_1000, Function | MediumTest | Level2) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_FUNCTION_03_1000, Function | MediumTest | Level2)
{ {
std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>(); std::shared_ptr<TestPlayer> player;
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj); PreparePlayEnv(player);
ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer());
std::string uri = TestParamsConfig::GetInstance().GetUri();
ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->Prepare()); ASSERT_EQ(RET_OK, player->Prepare());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
...@@ -344,54 +269,35 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_1000, Function | ...@@ -344,54 +269,35 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_1000, Function |
EXPECT_EQ(RET_OK, player->Pause()); EXPECT_EQ(RET_OK, player->Pause());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_EQ(RET_OK, testCallback->errorNum_); EXPECT_EQ(RET_OK, testCallback_->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Function_03_1100 * @tc.number : SUB_MEDIA_PLAYER_FUNCTION_03_1100
* @tc.name : 011.停止播放后重新开始播放,再次结束播放 * @tc.name : 011.停止播放后重新开始播放,再次结束播放
* @tc.desc : 播控 * @tc.desc : 播控
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_1100, Function | MediumTest | Level2) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_FUNCTION_03_1100, Function | MediumTest | Level2)
{ {
std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>(); std::shared_ptr<TestPlayer> player;
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj); PreparePlayEnv(player);
ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer());
std::string uri = TestParamsConfig::GetInstance().GetUri();
ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->Prepare()); ASSERT_EQ(RET_OK, player->Prepare());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
(void)sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
EXPECT_TRUE(player->IsPlaying()); EXPECT_TRUE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_EQ(RET_OK, testCallback->errorNum_); EXPECT_EQ(RET_OK, testCallback_->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Function_03_1300 * @tc.number : SUB_MEDIA_PLAYER_FUNCTION_03_1300
* @tc.name : 013.停止播放后暂停 * @tc.name : 013.停止播放后暂停
* @tc.desc : 播控 * @tc.desc : 播控
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_1300, Function | MediumTest | Level1) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_FUNCTION_03_1300, Function | MediumTest | Level1)
{ {
std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>(); std::shared_ptr<TestPlayer> player;
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj); PreparePlayEnv(player);
ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer());
std::string uri = TestParamsConfig::GetInstance().GetUri();
ASSERT_EQ(RET_OK, player->SetSource(uri));
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->Prepare()); ASSERT_EQ(RET_OK, player->Prepare());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
...@@ -401,28 +307,19 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_1300, Function | ...@@ -401,28 +307,19 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_1300, Function |
EXPECT_EQ(RET_OK, player->Stop()); EXPECT_EQ(RET_OK, player->Stop());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_NE(RET_OK, player->Pause()); EXPECT_NE(RET_OK, player->Pause());
EXPECT_EQ(RET_OK, testCallback->errorNum_); EXPECT_EQ(RET_OK, testCallback_->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Function_03_1400 * @tc.number : SUB_MEDIA_PLAYER_FUNCTION_03_1400
* @tc.name : 014.开始播放,进行Seek,再暂停 * @tc.name : 014.开始播放,进行Seek,再暂停
* @tc.desc : 播控 * @tc.desc : 播控
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_1400, Function | MediumTest | Level1) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_FUNCTION_03_1400, Function | MediumTest | Level1)
{ {
std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer());
int32_t time; int32_t time;
std::string uri = TestParamsConfig::GetInstance().GetUri(); std::shared_ptr<TestPlayer> player;
ASSERT_EQ(RET_OK, player->SetSource(uri)); PreparePlayEnv(player);
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->Prepare()); ASSERT_EQ(RET_OK, player->Prepare());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
...@@ -436,28 +333,19 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_1400, Function | ...@@ -436,28 +333,19 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_1400, Function |
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->Stop()); EXPECT_EQ(RET_OK, player->Stop());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, testCallback->errorNum_); EXPECT_EQ(RET_OK, testCallback_->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Function_03_1500 * @tc.number : SUB_MEDIA_PLAYER_FUNCTION_03_1500
* @tc.name : 015.开始播放,暂停后进行Seek,再恢复播放 * @tc.name : 015.开始播放,暂停后进行Seek,再恢复播放
* @tc.desc : 播控 * @tc.desc : 播控
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_1500, Function | MediumTest | Level2) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_FUNCTION_03_1500, Function | MediumTest | Level2)
{ {
std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer());
int32_t time; int32_t time;
std::string uri = TestParamsConfig::GetInstance().GetUri(); std::shared_ptr<TestPlayer> player;
ASSERT_EQ(RET_OK, player->SetSource(uri)); PreparePlayEnv(player);
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->Prepare()); ASSERT_EQ(RET_OK, player->Prepare());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
...@@ -475,28 +363,19 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_1500, Function | ...@@ -475,28 +363,19 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_1500, Function |
EXPECT_EQ(RET_OK, player->Stop()); EXPECT_EQ(RET_OK, player->Stop());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, testCallback->errorNum_); EXPECT_EQ(RET_OK, testCallback_->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Function_03_1600 * @tc.number : SUB_MEDIA_PLAYER_FUNCTION_03_1600
* @tc.name : 016.开始播放,暂停后恢复播放,进行Seek,再暂停 * @tc.name : 016.开始播放,暂停后恢复播放,进行Seek,再暂停
* @tc.desc : 播控 * @tc.desc : 播控
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_1600, Function | MediumTest | Level2) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_FUNCTION_03_1600, Function | MediumTest | Level2)
{ {
std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer());
int32_t time; int32_t time;
std::string uri = TestParamsConfig::GetInstance().GetUri(); std::shared_ptr<TestPlayer> player;
ASSERT_EQ(RET_OK, player->SetSource(uri)); PreparePlayEnv(player);
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->Prepare()); ASSERT_EQ(RET_OK, player->Prepare());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
...@@ -518,28 +397,19 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_1600, Function | ...@@ -518,28 +397,19 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_1600, Function |
EXPECT_EQ(RET_OK, player->Stop()); EXPECT_EQ(RET_OK, player->Stop());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, testCallback->errorNum_); EXPECT_EQ(RET_OK, testCallback_->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Function_03_1700 * @tc.number : SUB_MEDIA_PLAYER_FUNCTION_03_1700
* @tc.name : 017.开始播放,进行Seek * @tc.name : 017.开始播放,进行Seek
* @tc.desc : 播控 * @tc.desc : 播控
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_1700, Function | MediumTest | Level0) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_FUNCTION_03_1700, Function | MediumTest | Level0)
{ {
std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer());
int32_t time; int32_t time;
std::string uri = TestParamsConfig::GetInstance().GetUri(); std::shared_ptr<TestPlayer> player;
ASSERT_EQ(RET_OK, player->SetSource(uri)); PreparePlayEnv(player);
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->Prepare()); ASSERT_EQ(RET_OK, player->Prepare());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
...@@ -552,28 +422,19 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_1700, Function | ...@@ -552,28 +422,19 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_1700, Function |
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, testCallback->errorNum_); EXPECT_EQ(RET_OK, testCallback_->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Function_03_1800 * @tc.number : SUB_MEDIA_PLAYER_FUNCTION_03_1800
* @tc.name : 018.开始播放,进行Seek,停止播放, * @tc.name : 018.开始播放,进行Seek,停止播放,
* @tc.desc : 播控 * @tc.desc : 播控
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_1800, Function | MediumTest | Level1) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_FUNCTION_03_1800, Function | MediumTest | Level1)
{ {
std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer());
int32_t time; int32_t time;
std::string uri = TestParamsConfig::GetInstance().GetUri(); std::shared_ptr<TestPlayer> player;
ASSERT_EQ(RET_OK, player->SetSource(uri)); PreparePlayEnv(player);
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->Prepare()); ASSERT_EQ(RET_OK, player->Prepare());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
...@@ -588,28 +449,19 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_1800, Function | ...@@ -588,28 +449,19 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_1800, Function |
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, testCallback->errorNum_); EXPECT_EQ(RET_OK, testCallback_->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Function_03_1900 * @tc.number : SUB_MEDIA_PLAYER_FUNCTION_03_1900
* @tc.name : 019.开始播放,停止播放,进行Seek * @tc.name : 019.开始播放,停止播放,进行Seek
* @tc.desc : 播控 * @tc.desc : 播控
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_1900, Function | MediumTest | Level2) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_FUNCTION_03_1900, Function | MediumTest | Level2)
{ {
std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer());
int32_t time; int32_t time;
std::string uri = TestParamsConfig::GetInstance().GetUri(); std::shared_ptr<TestPlayer> player;
ASSERT_EQ(RET_OK, player->SetSource(uri)); PreparePlayEnv(player);
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->Prepare()); ASSERT_EQ(RET_OK, player->Prepare());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
...@@ -626,29 +478,20 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_1900, Function | ...@@ -626,29 +478,20 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_1900, Function |
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, testCallback->errorNum_); EXPECT_EQ(RET_OK, testCallback_->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Function_03_2000 * @tc.number : SUB_MEDIA_PLAYER_FUNCTION_03_2000
* @tc.name : 020.开始播放,暂停后进行Seek * @tc.name : 020.开始播放,暂停后进行Seek
* @tc.desc : 播控 * @tc.desc : 播控
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2000, Function | MediumTest | Level1) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_FUNCTION_03_2000, Function | MediumTest | Level1)
{ {
std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer());
int32_t time; int32_t time;
int32_t durationTime; int32_t durationTime;
std::string uri = TestParamsConfig::GetInstance().GetUri(); std::shared_ptr<TestPlayer> player;
ASSERT_EQ(RET_OK, player->SetSource(uri)); PreparePlayEnv(player);
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->Prepare()); ASSERT_EQ(RET_OK, player->Prepare());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
...@@ -672,29 +515,20 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2000, Function | ...@@ -672,29 +515,20 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2000, Function |
EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time));
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, testCallback->errorNum_); EXPECT_EQ(RET_OK, testCallback_->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Function_03_2100 * @tc.number : SUB_MEDIA_PLAYER_FUNCTION_03_2100
* @tc.name : 021.开始播放,暂停后进行Seek,停止播放 * @tc.name : 021.开始播放,暂停后进行Seek,停止播放
* @tc.desc : 播控 * @tc.desc : 播控
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2100, Function | MediumTest | Level2) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_FUNCTION_03_2100, Function | MediumTest | Level2)
{ {
std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer());
int32_t time; int32_t time;
int32_t durationTime; int32_t durationTime;
std::string uri = TestParamsConfig::GetInstance().GetUri(); std::shared_ptr<TestPlayer> player;
ASSERT_EQ(RET_OK, player->SetSource(uri)); PreparePlayEnv(player);
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->Prepare()); ASSERT_EQ(RET_OK, player->Prepare());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
...@@ -714,28 +548,19 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2100, Function | ...@@ -714,28 +548,19 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2100, Function |
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, testCallback->errorNum_); EXPECT_EQ(RET_OK, testCallback_->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Function_03_2200 * @tc.number : SUB_MEDIA_PLAYER_FUNCTION_03_2200
* @tc.name : 022.开始播放,暂停后恢复播放,进行Seek * @tc.name : 022.开始播放,暂停后恢复播放,进行Seek
* @tc.desc : 播控 * @tc.desc : 播控
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2200, Function | MediumTest | Level2) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_FUNCTION_03_2200, Function | MediumTest | Level2)
{ {
std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer());
int32_t time; int32_t time;
std::string uri = TestParamsConfig::GetInstance().GetUri(); std::shared_ptr<TestPlayer> player;
ASSERT_EQ(RET_OK, player->SetSource(uri)); PreparePlayEnv(player);
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->Prepare()); ASSERT_EQ(RET_OK, player->Prepare());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
...@@ -753,28 +578,19 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2200, Function | ...@@ -753,28 +578,19 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2200, Function |
EXPECT_NEAR(PLAYING_TIME * TIME_SEC2MS + SEEK_TIME_5_SEC, time, DELTA_TIME); EXPECT_NEAR(PLAYING_TIME * TIME_SEC2MS + SEEK_TIME_5_SEC, time, DELTA_TIME);
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, testCallback->errorNum_); EXPECT_EQ(RET_OK, testCallback_->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Function_03_2300 * @tc.number : SUB_MEDIA_PLAYER_FUNCTION_03_2300
* @tc.name : 023.开始播放,暂停后恢复播放,进行Seek,停止播放 * @tc.name : 023.开始播放,暂停后恢复播放,进行Seek,停止播放
* @tc.desc : 播控 * @tc.desc : 播控
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2300, Function | MediumTest | Level2) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_FUNCTION_03_2300, Function | MediumTest | Level2)
{ {
std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer());
int32_t time; int32_t time;
std::string uri = TestParamsConfig::GetInstance().GetUri(); std::shared_ptr<TestPlayer> player;
ASSERT_EQ(RET_OK, player->SetSource(uri)); PreparePlayEnv(player);
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->Prepare()); ASSERT_EQ(RET_OK, player->Prepare());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
...@@ -795,28 +611,19 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2300, Function | ...@@ -795,28 +611,19 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2300, Function |
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, testCallback->errorNum_); EXPECT_EQ(RET_OK, testCallback_->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Function_03_2400 * @tc.number : SUB_MEDIA_PLAYER_FUNCTION_03_2400
* @tc.name : 024.开始播放,停止播放,进行Seek,重新播放 * @tc.name : 024.开始播放,停止播放,进行Seek,重新播放
* @tc.desc : 播控 * @tc.desc : 播控
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2400, Function | MediumTest | Level2) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_FUNCTION_03_2400, Function | MediumTest | Level2)
{ {
std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer());
int32_t time; int32_t time;
std::string uri = TestParamsConfig::GetInstance().GetUri(); std::shared_ptr<TestPlayer> player;
ASSERT_EQ(RET_OK, player->SetSource(uri)); PreparePlayEnv(player);
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->Prepare()); ASSERT_EQ(RET_OK, player->Prepare());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
...@@ -836,28 +643,19 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2400, Function | ...@@ -836,28 +643,19 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2400, Function |
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, testCallback->errorNum_); EXPECT_EQ(RET_OK, testCallback_->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Function_03_2500 * @tc.number : SUB_MEDIA_PLAYER_FUNCTION_03_2500
* @tc.name : 025.进行Seek,Seek到文件开始的位置 * @tc.name : 025.进行Seek,Seek到文件开始的位置
* @tc.desc : 播控 * @tc.desc : 播控
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2500, Function | MediumTest | Level1) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_FUNCTION_03_2500, Function | MediumTest | Level1)
{ {
std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer());
int32_t time; int32_t time;
std::string uri = TestParamsConfig::GetInstance().GetUri(); std::shared_ptr<TestPlayer> player;
ASSERT_EQ(RET_OK, player->SetSource(uri)); PreparePlayEnv(player);
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->Prepare()); ASSERT_EQ(RET_OK, player->Prepare());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
...@@ -870,28 +668,19 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2500, Function | ...@@ -870,28 +668,19 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2500, Function |
EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(FILE_BEGIN, time, SEEK_MODE)); EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(FILE_BEGIN, time, SEEK_MODE));
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, testCallback->errorNum_); EXPECT_EQ(RET_OK, testCallback_->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Function_03_2600 * @tc.number : SUB_MEDIA_PLAYER_FUNCTION_03_2600
* @tc.name : 026.开始播放,停止播放,进行Seek,再暂停 * @tc.name : 026.开始播放,停止播放,进行Seek,再暂停
* @tc.desc : 播控 * @tc.desc : 播控
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2600, Function | MediumTest | Level3) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_FUNCTION_03_2600, Function | MediumTest | Level3)
{ {
std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer());
int32_t time; int32_t time;
std::string uri = TestParamsConfig::GetInstance().GetUri(); std::shared_ptr<TestPlayer> player;
ASSERT_EQ(RET_OK, player->SetSource(uri)); PreparePlayEnv(player);
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->Prepare()); ASSERT_EQ(RET_OK, player->Prepare());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
...@@ -909,28 +698,19 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2600, Function | ...@@ -909,28 +698,19 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2600, Function |
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, testCallback->errorNum_); EXPECT_EQ(RET_OK, testCallback_->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Function_03_2700 * @tc.number : SUB_MEDIA_PLAYER_FUNCTION_03_2700
* @tc.name : 027.开始播放,停止播放,进行Seek,再进行恢复播放操作 * @tc.name : 027.开始播放,停止播放,进行Seek,再进行恢复播放操作
* @tc.desc : 播控 * @tc.desc : 播控
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2700, Function | MediumTest | Level3) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_FUNCTION_03_2700, Function | MediumTest | Level3)
{ {
std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer());
int32_t time; int32_t time;
std::string uri = TestParamsConfig::GetInstance().GetUri(); std::shared_ptr<TestPlayer> player;
ASSERT_EQ(RET_OK, player->SetSource(uri)); PreparePlayEnv(player);
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->Prepare()); ASSERT_EQ(RET_OK, player->Prepare());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
...@@ -951,29 +731,20 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2700, Function | ...@@ -951,29 +731,20 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2700, Function |
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, testCallback->errorNum_); EXPECT_EQ(RET_OK, testCallback_->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Function_03_2800 * @tc.number : SUB_MEDIA_PLAYER_FUNCTION_03_2800
* @tc.name : 028.进行Seek,Seek到文件结尾的位置 * @tc.name : 028.进行Seek,Seek到文件结尾的位置
* @tc.desc : 播控 * @tc.desc : 播控
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2800, Function | MediumTest | Level1) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_FUNCTION_03_2800, Function | MediumTest | Level1)
{ {
std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer());
int32_t time; int32_t time;
int32_t durationTime; int32_t durationTime;
std::string uri = TestParamsConfig::GetInstance().GetUri(); std::shared_ptr<TestPlayer> player;
ASSERT_EQ(RET_OK, player->SetSource(uri)); PreparePlayEnv(player);
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->Prepare()); ASSERT_EQ(RET_OK, player->Prepare());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
...@@ -982,34 +753,25 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2800, Function | ...@@ -982,34 +753,25 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2800, Function |
EXPECT_EQ(RET_OK, player->GetDuration(durationTime)); EXPECT_EQ(RET_OK, player->GetDuration(durationTime));
EXPECT_EQ(RET_OK, player->Seek(durationTime, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Seek(durationTime, SEEK_MODE));
EXPECT_EQ(RET_OK, testCallback->WaitForState(PLAYER_PLAYBACK_COMPLETE)); EXPECT_EQ(RET_OK, testCallback_->WaitForState(PLAYER_PLAYBACK_COMPLETE));
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time));
EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(durationTime, time, SEEK_MODE)); EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(durationTime, time, SEEK_MODE));
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_EQ(RET_OK, testCallback->errorNum_); EXPECT_EQ(RET_OK, testCallback_->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Function_03_2900 * @tc.number : SUB_MEDIA_PLAYER_FUNCTION_03_2900
* @tc.name : 029.进行Seek,Seek到超过文件结尾的位置 * @tc.name : 029.进行Seek,Seek到超过文件结尾的位置
* @tc.desc : 播控 * @tc.desc : 播控
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2900, Function | MediumTest | Level3) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_FUNCTION_03_2900, Function | MediumTest | Level3)
{ {
std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer());
int32_t time; int32_t time;
int32_t durationTime; int32_t durationTime;
std::string uri = TestParamsConfig::GetInstance().GetUri(); std::shared_ptr<TestPlayer> player;
ASSERT_EQ(RET_OK, player->SetSource(uri)); PreparePlayEnv(player);
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->Prepare()); ASSERT_EQ(RET_OK, player->Prepare());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
...@@ -1018,36 +780,27 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2900, Function | ...@@ -1018,36 +780,27 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2900, Function |
EXPECT_EQ(RET_OK, player->GetDuration(durationTime)); EXPECT_EQ(RET_OK, player->GetDuration(durationTime));
EXPECT_EQ(RET_OK, player->Seek(durationTime + 1, SEEK_MODE)); EXPECT_EQ(RET_OK, player->Seek(durationTime + 1, SEEK_MODE));
EXPECT_EQ(RET_OK, testCallback->WaitForState(PLAYER_PLAYBACK_COMPLETE)); EXPECT_EQ(RET_OK, testCallback_->WaitForState(PLAYER_PLAYBACK_COMPLETE));
EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time));
EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(durationTime, time, SEEK_MODE)); EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(durationTime, time, SEEK_MODE));
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->Stop()); EXPECT_EQ(RET_OK, player->Stop());
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, testCallback->errorNum_); EXPECT_EQ(RET_OK, testCallback_->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Function_03_3000 * @tc.number : SUB_MEDIA_PLAYER_FUNCTION_03_3000
* @tc.name : 030.进行Seek,Seek到文件随机的位置 * @tc.name : 030.进行Seek,Seek到文件随机的位置
* @tc.desc : 播控 * @tc.desc : 播控
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_3000, Function | MediumTest | Level1) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_FUNCTION_03_3000, Function | MediumTest | Level1)
{ {
std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer());
int32_t time; int32_t time;
int32_t durationTime; int32_t durationTime;
std::string uri = TestParamsConfig::GetInstance().GetUri(); std::shared_ptr<TestPlayer> player;
ASSERT_EQ(RET_OK, player->SetSource(uri)); PreparePlayEnv(player);
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->Prepare()); ASSERT_EQ(RET_OK, player->Prepare());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
...@@ -1061,29 +814,20 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_3000, Function | ...@@ -1061,29 +814,20 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_3000, Function |
EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(durationTime / 3, time, SEEK_MODE)); EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(durationTime / 3, time, SEEK_MODE));
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, testCallback->errorNum_); EXPECT_EQ(RET_OK, testCallback_->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Function_03_3100 * @tc.number : SUB_MEDIA_PLAYER_FUNCTION_03_3100
* @tc.name : 031.进行Seek,seek后开始进行基本播控操作 * @tc.name : 031.进行Seek,seek后开始进行基本播控操作
* @tc.desc : 播控 * @tc.desc : 播控
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_3100, Function | MediumTest | Level2) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_FUNCTION_03_3100, Function | MediumTest | Level2)
{ {
std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer());
int32_t time; int32_t time;
int32_t durationTime; int32_t durationTime;
std::string uri = TestParamsConfig::GetInstance().GetUri(); std::shared_ptr<TestPlayer> player;
ASSERT_EQ(RET_OK, player->SetSource(uri)); PreparePlayEnv(player);
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->Prepare()); ASSERT_EQ(RET_OK, player->Prepare());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
...@@ -1104,28 +848,19 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_3100, Function | ...@@ -1104,28 +848,19 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_3100, Function |
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, testCallback->errorNum_); EXPECT_EQ(RET_OK, testCallback_->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Function_03_3200 * @tc.number : SUB_MEDIA_PLAYER_FUNCTION_03_3200
* @tc.name : 032.暂停时Seek到文件开始,恢复播放 * @tc.name : 032.暂停时Seek到文件开始,恢复播放
* @tc.desc : 播控 * @tc.desc : 播控
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_3200, Function | MediumTest | Level1) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_FUNCTION_03_3200, Function | MediumTest | Level1)
{ {
std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer());
int32_t time; int32_t time;
std::string uri = TestParamsConfig::GetInstance().GetUri(); std::shared_ptr<TestPlayer> player;
ASSERT_EQ(RET_OK, player->SetSource(uri)); PreparePlayEnv(player);
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->Prepare()); ASSERT_EQ(RET_OK, player->Prepare());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
...@@ -1144,29 +879,20 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_3200, Function | ...@@ -1144,29 +879,20 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_3200, Function |
EXPECT_TRUE(player->IsPlaying()); EXPECT_TRUE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, testCallback->errorNum_); EXPECT_EQ(RET_OK, testCallback_->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Function_03_3300 * @tc.number : SUB_MEDIA_PLAYER_FUNCTION_03_3300
* @tc.name : 033.暂停时Seek到文件结尾,恢复播放 * @tc.name : 033.暂停时Seek到文件结尾,恢复播放
* @tc.desc : 播控 * @tc.desc : 播控
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_3300, Function | MediumTest | Level2) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_FUNCTION_03_3300, Function | MediumTest | Level2)
{ {
std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer());
int32_t time; int32_t time;
int32_t durationTime; int32_t durationTime;
std::string uri = TestParamsConfig::GetInstance().GetUri(); std::shared_ptr<TestPlayer> player;
ASSERT_EQ(RET_OK, player->SetSource(uri)); PreparePlayEnv(player);
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->Prepare()); ASSERT_EQ(RET_OK, player->Prepare());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
...@@ -1181,35 +907,26 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_3300, Function | ...@@ -1181,35 +907,26 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_3300, Function |
EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time));
EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(durationTime, time, SEEK_MODE)); EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(durationTime, time, SEEK_MODE));
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
EXPECT_EQ(RET_OK, testCallback->WaitForState(PLAYER_PLAYBACK_COMPLETE)); EXPECT_EQ(RET_OK, testCallback_->WaitForState(PLAYER_PLAYBACK_COMPLETE));
(void)sleep(PLAYING_TIME); (void)sleep(PLAYING_TIME);
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Play());
EXPECT_FALSE(player->IsPlaying()); EXPECT_TRUE(player->IsPlaying());
EXPECT_EQ(RET_OK, testCallback->errorNum_); EXPECT_EQ(RET_OK, testCallback_->errorNum_);
} }
/** /**
* @tc.number : SUB_MEDIA_PLAYER_Local_Function_03_3400 * @tc.number : SUB_MEDIA_PLAYER_FUNCTION_03_3400
* @tc.name : 034.暂停时Seek到超过文件结尾的位置,恢复播放 * @tc.name : 034.暂停时Seek到超过文件结尾的位置,Seek
* @tc.desc : 播控 * @tc.desc : 播控
*/ */
HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_3400, Function | MediumTest | Level3) HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_FUNCTION_03_3400, Function | MediumTest | Level3)
{ {
std::shared_ptr<PlayerSignal> testObj = std::make_shared<PlayerSignal>();
std::shared_ptr<TestPlayer> player = std::make_shared<TestPlayer>(testObj);
ASSERT_NE(nullptr, player);
ASSERT_EQ(true, player->CreatePlayer());
int32_t time; int32_t time;
int32_t durationTime; int32_t durationTime;
std::string uri = TestParamsConfig::GetInstance().GetUri(); std::shared_ptr<TestPlayer> player;
ASSERT_EQ(RET_OK, player->SetSource(uri)); PreparePlayEnv(player);
sptr<Surface> videoSurface = player->GetVideoSurface(g_sub_config);
EXPECT_EQ(RET_OK, player->SetVideoSurface(videoSurface));
std::shared_ptr<TestPlayerCallback> testCallback = std::make_shared<TestPlayerCallback>(testObj);
EXPECT_EQ(RET_OK, player->SetPlayerCallback(testCallback));
ASSERT_EQ(RET_OK, player->Prepare()); ASSERT_EQ(RET_OK, player->Prepare());
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
...@@ -1224,8 +941,11 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_3400, Function | ...@@ -1224,8 +941,11 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_3400, Function |
EXPECT_EQ(RET_OK, player->GetCurrentTime(time)); EXPECT_EQ(RET_OK, player->GetCurrentTime(time));
EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(durationTime, time, SEEK_MODE)); EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(durationTime, time, SEEK_MODE));
EXPECT_EQ(RET_OK, player->Play()); EXPECT_EQ(RET_OK, player->Play());
EXPECT_EQ(RET_OK, testCallback->WaitForState(PLAYER_PLAYBACK_COMPLETE)); EXPECT_EQ(RET_OK, testCallback_->WaitForState(PLAYER_PLAYBACK_COMPLETE));
EXPECT_EQ(RET_OK, player->Reset()); EXPECT_EQ(RET_OK, player->Seek(SEEK_TIME_5_SEC, SEEK_MODE));
EXPECT_EQ(RET_OK, player->GetCurrentTime(time));
EXPECT_TRUE(TestParamsConfig::GetInstance().CompareTime(SEEK_TIME_5_SEC, time, SEEK_MODE));
EXPECT_FALSE(player->IsPlaying()); EXPECT_FALSE(player->IsPlaying());
EXPECT_EQ(RET_OK, testCallback->errorNum_); EXPECT_EQ(RET_OK, player->Reset());
EXPECT_EQ(RET_OK, testCallback_->errorNum_);
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册