Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
b02ba0ea
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
b02ba0ea
编写于
12月 01, 2021
作者:
N
NOBUGGERS
提交者:
Gitee
12月 01, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
media test刷新 Signed-off-by: NOBUGGERS <ruanmeng@huawei.com>
上级
608302cd
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
187 addition
and
465 deletion
+187
-465
multimedia/media/media_cpp_test_standard/player/src/function/ActsPlayerStateTest.cpp
...test_standard/player/src/function/ActsPlayerStateTest.cpp
+187
-465
未找到文件。
multimedia/media/media_cpp_test_standard/player/src/function/ActsPlayerStateTest.cpp
浏览文件 @
b02ba0ea
...
...
@@ -23,128 +23,83 @@ using namespace testing::ext;
using
namespace
TestPlayerBasic
;
/**
* @tc.number : SUB_MEDIA_PLAYER_
Local_Function
_04_0100
* @tc.number : SUB_MEDIA_PLAYER_
FUNCTION
_04_0100
* @tc.name : 001.prepare-reset-release
* @tc.desc : 播控
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
Local_Function
_04_0100
,
Function
|
MediumTest
|
Level0
)
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
FUNCTION
_04_0100
,
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
());
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
));
std
::
shared_ptr
<
TestPlayer
>
player
;
PreparePlayEnv
(
player
);
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.number : SUB_MEDIA_PLAYER_
FUNCTION
_04_0200
* @tc.name : 002.prepare-reset
* @tc.desc : 播控
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
Local_Function
_04_0200
,
Function
|
MediumTest
|
Level0
)
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
FUNCTION
_04_0200
,
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
());
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
));
std
::
shared_ptr
<
TestPlayer
>
player
;
PreparePlayEnv
(
player
);
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.number : SUB_MEDIA_PLAYER_
FUNCTION
_04_0300
* @tc.name : 003.prepare-stop-reset-release
* @tc.desc : 播控
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
Local_Function
_04_0300
,
Function
|
MediumTest
|
Level0
)
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
FUNCTION
_04_0300
,
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
());
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
));
std
::
shared_ptr
<
TestPlayer
>
player
;
PreparePlayEnv
(
player
);
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
,
player
->
Release
());
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum_
);
EXPECT_EQ
(
RET_OK
,
testCallback
_
->
errorNum_
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_
Local_Function
_04_0400
* @tc.number : SUB_MEDIA_PLAYER_
FUNCTION
_04_0400
* @tc.name : 004.prepare-stop-reset
* @tc.desc : 播控
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
Local_Function
_04_0400
,
Function
|
MediumTest
|
Level0
)
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
FUNCTION
_04_0400
,
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
());
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
));
std
::
shared_ptr
<
TestPlayer
>
player
;
PreparePlayEnv
(
player
);
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.number : SUB_MEDIA_PLAYER_
FUNCTION
_04_0600
* @tc.name : 006.prepare-play-reset
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
Local_Function
_04_0600
,
Function
|
MediumTest
|
Level0
)
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
FUNCTION
_04_0600
,
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
());
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
int32_t
time
;
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
));
std
::
shared_ptr
<
TestPlayer
>
player
;
PreparePlayEnv
(
player
);
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
...
...
@@ -155,27 +110,19 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_0600, 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_0700
* @tc.number : SUB_MEDIA_PLAYER_
FUNCTION
_04_0700
* @tc.name : 007.prepare-seek-play-reset-release
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
Local_Function
_04_0700
,
Function
|
MediumTest
|
Level0
)
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
FUNCTION
_04_0700
,
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
());
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
int32_t
time
;
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
));
std
::
shared_ptr
<
TestPlayer
>
player
;
PreparePlayEnv
(
player
);
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
...
...
@@ -188,27 +135,19 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_0700, 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_0800
* @tc.number : SUB_MEDIA_PLAYER_
FUNCTION
_04_0800
* @tc.name : 008.prepare-seek-play-reset
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
Local_Function
_04_0800
,
Function
|
MediumTest
|
Level0
)
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
FUNCTION
_04_0800
,
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
());
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
int32_t
time
;
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
));
std
::
shared_ptr
<
TestPlayer
>
player
;
PreparePlayEnv
(
player
);
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_MODE
));
...
...
@@ -221,27 +160,19 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_0800, 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_0900
* @tc.number : SUB_MEDIA_PLAYER_
FUNCTION
_04_0900
* @tc.name : 009.prepare-play-seek-reset-release
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
Local_Function
_04_0900
,
Function
|
MediumTest
|
Level0
)
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
FUNCTION
_04_0900
,
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
());
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
int32_t
time
;
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
));
std
::
shared_ptr
<
TestPlayer
>
player
;
PreparePlayEnv
(
player
);
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
...
...
@@ -255,27 +186,19 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_0900, 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_1000
* @tc.number : SUB_MEDIA_PLAYER_
FUNCTION
_04_1000
* @tc.name : 010.prepare-play-seek-reset
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
Local_Function
_04_1000
,
Function
|
MediumTest
|
Level0
)
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
FUNCTION
_04_1000
,
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
());
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
int32_t
time
;
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
));
std
::
shared_ptr
<
TestPlayer
>
player
;
PreparePlayEnv
(
player
);
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
...
...
@@ -288,27 +211,19 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_1000, Function |
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.number : SUB_MEDIA_PLAYER_
FUNCTION
_04_1100
* @tc.name : 011.prepare-play-seek-pause-reset
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
Local_Function
_04_1100
,
Function
|
MediumTest
|
Level0
)
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
FUNCTION
_04_1100
,
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
());
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
int32_t
time
;
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
));
std
::
shared_ptr
<
TestPlayer
>
player
;
PreparePlayEnv
(
player
);
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
...
...
@@ -323,27 +238,19 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_1100, Function |
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.number : SUB_MEDIA_PLAYER_
FUNCTION
_04_1200
* @tc.name : 012.prepare-play-seek-pause-reset-release
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
Local_Function
_04_1200
,
Function
|
MediumTest
|
Level0
)
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
FUNCTION
_04_1200
,
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
());
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
int32_t
time
;
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
));
std
::
shared_ptr
<
TestPlayer
>
player
;
PreparePlayEnv
(
player
);
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
(
void
)
sleep
(
PLAYING_TIME
);
...
...
@@ -359,27 +266,19 @@ 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.number : SUB_MEDIA_PLAYER_
FUNCTION
_04_1300
* @tc.name : 013.prepare-play-seek-pause-stop-reset
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
Local_Function
_04_1300
,
Function
|
MediumTest
|
Level0
)
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
FUNCTION
_04_1300
,
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
());
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
int32_t
time
;
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
));
std
::
shared_ptr
<
TestPlayer
>
player
;
PreparePlayEnv
(
player
);
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
...
...
@@ -396,27 +295,19 @@ 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.number : SUB_MEDIA_PLAYER_
FUNCTION
_04_1400
* @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
)
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
FUNCTION
_04_1400
,
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
());
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
int32_t
time
;
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
));
std
::
shared_ptr
<
TestPlayer
>
player
;
PreparePlayEnv
(
player
);
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
...
...
@@ -435,26 +326,18 @@ 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.number : SUB_MEDIA_PLAYER_
FUNCTION
_04_1500
* @tc.name : 015.prepare-play-stop-reset
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
Local_Function
_04_1500
,
Function
|
MediumTest
|
Level0
)
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
FUNCTION
_04_1500
,
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
());
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
));
std
::
shared_ptr
<
TestPlayer
>
player
;
PreparePlayEnv
(
player
);
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
...
...
@@ -464,26 +347,18 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_1500, 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_1600
* @tc.number : SUB_MEDIA_PLAYER_
FUNCTION
_04_1600
* @tc.name : 016.prepare-play-stop-reset-release
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
Local_Function
_04_1600
,
Function
|
MediumTest
|
Level0
)
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
FUNCTION
_04_1600
,
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
());
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
));
std
::
shared_ptr
<
TestPlayer
>
player
;
PreparePlayEnv
(
player
);
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
...
...
@@ -494,52 +369,36 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_1600, 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_1700
* @tc.number : SUB_MEDIA_PLAYER_
FUNCTION
_04_1700
* @tc.name : 017.prepare-stop
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
Local_Function
_04_1700
,
Function
|
MediumTest
|
Level0
)
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
FUNCTION
_04_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
());
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
));
std
::
shared_ptr
<
TestPlayer
>
player
;
PreparePlayEnv
(
player
);
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_
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_
Local_Function
_04_1800
* @tc.number : SUB_MEDIA_PLAYER_
FUNCTION
_04_1800
* @tc.name : 018.pause-GetCurrentTime-play-GetCurrentTime
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
Local_Function
_04_1800
,
Function
|
MediumTest
|
Level0
)
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
FUNCTION
_04_1800
,
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
());
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
int32_t
time
;
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
));
std
::
shared_ptr
<
TestPlayer
>
player
;
PreparePlayEnv
(
player
);
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
...
...
@@ -557,27 +416,19 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_1800, Function |
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
PLAYING_TIME
*
TIME_SEC2MS
+
PLAYING_TIME
*
TIME_SEC2MS
,
time
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum_
);
EXPECT_EQ
(
RET_OK
,
testCallback
_
->
errorNum_
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_
Local_Function
_04_1900
* @tc.number : SUB_MEDIA_PLAYER_
FUNCTION
_04_1900
* @tc.name : 019.pause-GetCurrentTime-seek-play-GetCurrentTime
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
Local_Function
_04_1900
,
Function
|
MediumTest
|
Level0
)
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
FUNCTION
_04_1900
,
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
());
std
::
string
uri
=
TestParamsConfig
::
GetInstance
().
GetUri
();
int32_t
time
;
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
));
std
::
shared_ptr
<
TestPlayer
>
player
;
PreparePlayEnv
(
player
);
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
...
...
@@ -599,29 +450,20 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_1900, Function |
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
SEEK_TIME_2_SEC
+
PLAYING_TIME
*
TIME_SEC2MS
,
time
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum_
);
EXPECT_EQ
(
RET_OK
,
testCallback
_
->
errorNum_
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_
Local_Function
_04_2000
* @tc.number : SUB_MEDIA_PLAYER_
FUNCTION
_04_2000
* @tc.name : 020.play-seek EOS-GetCurrentTime-进入PlaybackCompleted,loop=0
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
Local_Function
_04_2000
,
Function
|
MediumTest
|
Level1
)
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
FUNCTION
_04_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
durationTime
;
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
));
std
::
shared_ptr
<
TestPlayer
>
player
;
PreparePlayEnv
(
player
);
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
...
...
@@ -633,7 +475,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2000, Function |
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
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_TRUE
(
TestParamsConfig
::
GetInstance
().
CompareTime
(
durationTime
,
time
,
SEEK_MODE
));
EXPECT_FALSE
(
player
->
IsLooping
());
...
...
@@ -641,29 +483,20 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2000, Function |
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_
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_
Local_Function
_04_2100
* @tc.number : SUB_MEDIA_PLAYER_
FUNCTION
_04_2100
* @tc.name : 021.seek EOS-GetCurrentTime-进入PlaybackCompleted,loop=0
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
Local_Function
_04_2100
,
Function
|
MediumTest
|
Level1
)
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
FUNCTION
_04_2100
,
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
durationTime
;
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
));
std
::
shared_ptr
<
TestPlayer
>
player
;
PreparePlayEnv
(
player
);
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
EXPECT_EQ
(
RET_OK
,
player
->
SetLooping
(
false
));
...
...
@@ -677,31 +510,22 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2100, Function |
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_
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_
Local_Function
_04_2200
* @tc.number : SUB_MEDIA_PLAYER_
FUNCTION
_04_2200
* @tc.name : 022.play-seek EOS-GetCurrentTime,loop=1
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
Local_Function
_04_2200
,
Function
|
MediumTest
|
Level1
)
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
FUNCTION
_04_2200
,
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_before
;
int32_t
time_after
;
int32_t
time
;
int32_t
durationTime
;
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
));
std
::
shared_ptr
<
TestPlayer
>
player
;
PreparePlayEnv
(
player
);
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
...
...
@@ -722,29 +546,20 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2200, Function |
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_
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_
Local_Function
_04_2300
* @tc.number : SUB_MEDIA_PLAYER_
FUNCTION
_04_2300
* @tc.name : 023.prepare-play-seek EOS-GetCurrentTime-进入PlaybackCompleted-stop,loop=0
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
Local_Function
_04_2300
,
Function
|
MediumTest
|
Level1
)
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
FUNCTION
_04_2300
,
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
durationTime
;
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
));
std
::
shared_ptr
<
TestPlayer
>
player
;
PreparePlayEnv
(
player
);
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
...
...
@@ -755,36 +570,27 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2300, Function |
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
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_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
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_
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_
Local_Function
_04_2400
* @tc.number : SUB_MEDIA_PLAYER_
FUNCTION
_04_2400
* @tc.name : 024.seek,seek随机+EOS附近
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
Local_Function
_04_2400
,
Function
|
MediumTest
|
Level1
)
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
FUNCTION
_04_2400
,
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
durationTime
;
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
));
std
::
shared_ptr
<
TestPlayer
>
player
;
PreparePlayEnv
(
player
);
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
...
...
@@ -796,156 +602,114 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2400, Function |
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_
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_
Local_Function
_04_2500
* @tc.number : SUB_MEDIA_PLAYER_
FUNCTION
_04_2500
* @tc.name : 025.pause-seek-resume,不等seek完成
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
Local_Function
_04_2500
,
Function
|
MediumTest
|
Level3
)
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
FUNCTION
_04_2500
,
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
;
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
));
std
::
shared_ptr
<
TestPlayer
>
player
;
PreparePlayEnv
(
player
);
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
(
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
());
(
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_
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_
Local_Function
_04_2600
* @tc.number : SUB_MEDIA_PLAYER_
FUNCTION
_04_2600
* @tc.name : 026.seek,不等seek完成,seek
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
Local_Function
_04_2600
,
Function
|
MediumTest
|
Level3
)
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
FUNCTION
_04_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
;
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
));
std
::
shared_ptr
<
TestPlayer
>
player
;
PreparePlayEnv
(
player
);
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
(
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_TRUE
(
TestParamsConfig
::
GetInstance
().
CompareTime
(
SEEK_TIME_5_SEC
,
time
,
SEEK_MODE
));
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum_
);
EXPECT_EQ
(
RET_OK
,
testCallback
_
->
errorNum_
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_
Local_Function
_04_2625
* @tc.number : SUB_MEDIA_PLAYER_
FUNCTION
_04_2625
* @tc.name : 026.seek,不等seek完成,pause
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
Local_Function
_04_2625
,
Function
|
MediumTest
|
Level3
)
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
FUNCTION
_04_2625
,
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
());
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
));
std
::
shared_ptr
<
TestPlayer
>
player
;
PreparePlayEnv
(
player
);
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
(
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
* @tc.number : SUB_MEDIA_PLAYER_
FUNCTION
_04_2650
* @tc.name : 026.seek,不等seek完成,GetDuration
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
Local_Function
_04_2650
,
Function
|
MediumTest
|
Level3
)
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
FUNCTION
_04_2650
,
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
durationTime
;
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
));
std
::
shared_ptr
<
TestPlayer
>
player
;
PreparePlayEnv
(
player
);
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
(
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
* @tc.number : SUB_MEDIA_PLAYER_
FUNCTION
_04_2651
* @tc.name : 026.seek,不等seek完成,GetCurrentTime
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
Local_Function
_04_2651
,
Function
|
MediumTest
|
Level3
)
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
FUNCTION
_04_2651
,
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
;
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
));
std
::
shared_ptr
<
TestPlayer
>
player
;
PreparePlayEnv
(
player
);
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
...
...
@@ -955,60 +719,44 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2651, Function |
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
PLAYING_TIME
*
TIME_SEC2MS
,
time
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum_
);
EXPECT_EQ
(
RET_OK
,
testCallback
_
->
errorNum_
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_
Local_Function
_04_2675
* @tc.number : SUB_MEDIA_PLAYER_
FUNCTION
_04_2675
* @tc.name : 026.seek,不等seek完成,play
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
Local_Function
_04_2675
,
Function
|
MediumTest
|
Level3
)
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
FUNCTION
_04_2675
,
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
;
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
));
std
::
shared_ptr
<
TestPlayer
>
player
;
PreparePlayEnv
(
player
);
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
(
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
*
TIME_SEC2MS
,
time
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum_
);
EXPECT_EQ
(
RET_OK
,
testCallback
_
->
errorNum_
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_
Local_Function
_04_2700
* @tc.number : SUB_MEDIA_PLAYER_
FUNCTION
_04_2700
* @tc.name : 027.prepare-seek未完成-seek eos-start-seek eos-start-stop
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
Local_Function
_04_2700
,
Function
|
MediumTest
|
Level3
)
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
FUNCTION
_04_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
durationTime
;
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
));
std
::
shared_ptr
<
TestPlayer
>
player
;
PreparePlayEnv
(
player
);
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
...
...
@@ -1021,32 +769,23 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2700, Function |
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
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
,
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_
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_
Local_Function
_04_2800
* @tc.number : SUB_MEDIA_PLAYER_
FUNCTION
_04_2800
* @tc.name : 028.prepare-start-pause-seek eos-stop-prepare-start-stop
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
Local_Function
_04_2800
,
Function
|
MediumTest
|
Level3
)
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
FUNCTION
_04_2800
,
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
durationTime
;
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
));
std
::
shared_ptr
<
TestPlayer
>
player
;
PreparePlayEnv
(
player
);
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
...
...
@@ -1065,29 +804,20 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2800, Function |
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_
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_
Local_Function
_04_2900
* @tc.number : SUB_MEDIA_PLAYER_
FUNCTION
_04_2900
* @tc.name : 029.prepare-seek eos-start-stop-prepare-seek eos-start-stop,loop=1
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
Local_Function
_04_2900
,
Function
|
MediumTest
|
Level3
)
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
FUNCTION
_04_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
durationTime
;
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
));
std
::
shared_ptr
<
TestPlayer
>
player
;
PreparePlayEnv
(
player
);
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
EXPECT_EQ
(
RET_OK
,
player
->
SetLooping
(
true
));
...
...
@@ -1096,39 +826,31 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2900, Function |
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_TRUE
(
TestParamsConfig
::
GetInstance
().
CompareTime
(
durationTime
,
time
,
SEEK_MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_NE
(
RET_OK
,
testCallback
->
WaitForState
(
PLAYER_PLAYBACK_COMPLETE
));
EXPECT_NE
(
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
));
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_NE
(
RET_OK
,
testCallback
->
WaitForState
(
PLAYER_PLAYBACK_COMPLETE
));
EXPECT_NE
(
RET_OK
,
testCallback_
->
WaitForState
(
PLAYER_PLAYBACK_COMPLETE
));
EXPECT_TRUE
(
player
->
IsPlaying
());
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
_04_3000
* @tc.number : SUB_MEDIA_PLAYER_
FUNCTION
_04_3000
* @tc.name : 030.prepare-start-pause-seek eos-start-stop-prepare-start-pause-seek-start-stop,loop=1
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
Local_Function
_04_3000
,
Function
|
MediumTest
|
Level3
)
HWTEST_F
(
ActsPlayerFuncTest
,
SUB_MEDIA_PLAYER_
FUNCTION
_04_3000
,
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_before
;
int32_t
time_after
;
int32_t
durationTime
;
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
));
std
::
shared_ptr
<
TestPlayer
>
player
;
PreparePlayEnv
(
player
);
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
EXPECT_EQ
(
RET_OK
,
player
->
SetLooping
(
true
));
...
...
@@ -1139,7 +861,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_3000, Function |
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_TRUE
(
TestParamsConfig
::
GetInstance
().
CompareTime
(
durationTime
,
time
,
SEEK_MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_NE
(
RET_OK
,
testCallback
->
WaitForState
(
PLAYER_PLAYBACK_COMPLETE
));
EXPECT_NE
(
RET_OK
,
testCallback
_
->
WaitForState
(
PLAYER_PLAYBACK_COMPLETE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time_before
));
(
void
)
sleep
(
PLAYING_TIME
);
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time_after
));
...
...
@@ -1155,6 +877,6 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_3000, Function |
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_
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录