Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
fd5c7f8a
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看板
提交
fd5c7f8a
编写于
9月 09, 2021
作者:
O
openharmony_ci
提交者:
Gitee
9月 09, 2021
浏览文件
操作
浏览文件
下载
差异文件
!506 media native 测试用例提交
Merge pull request !506 from bird_j/bird-j-master-patch-96179
上级
196be2a0
1d6acc7a
变更
9
显示空白变更内容
内联
并排
Showing
9 changed file
with
535 addition
and
145 deletion
+535
-145
multimedia/media/media_cpp_test_standard/BUILD.gn
multimedia/media/media_cpp_test_standard/BUILD.gn
+1
-12
multimedia/media/media_cpp_test_standard/player/Testplayer.cpp
...media/media/media_cpp_test_standard/player/Testplayer.cpp
+35
-10
multimedia/media/media_cpp_test_standard/player/include/Testplayer.h
...media/media_cpp_test_standard/player/include/Testplayer.h
+1
-16
multimedia/media/media_cpp_test_standard/player/include/common.h
...dia/media/media_cpp_test_standard/player/include/common.h
+18
-3
multimedia/media/media_cpp_test_standard/player/src/api/ ActsPlayerAPITest.cpp
...a_cpp_test_standard/player/src/api/ ActsPlayerAPITest.cpp
+376
-0
multimedia/media/media_cpp_test_standard/player/src/function/ActsPlayerFuncAsyncTest.cpp
..._standard/player/src/function/ActsPlayerFuncAsyncTest.cpp
+23
-23
multimedia/media/media_cpp_test_standard/player/src/function/ActsPlayerFuncTest.cpp
..._test_standard/player/src/function/ActsPlayerFuncTest.cpp
+23
-23
multimedia/media/media_cpp_test_standard/player/src/function/ActsPlayerStateAsyncTest.cpp
...standard/player/src/function/ActsPlayerStateAsyncTest.cpp
+29
-29
multimedia/media/media_cpp_test_standard/player/src/function/ActsPlayerStateTest.cpp
...test_standard/player/src/function/ActsPlayerStateTest.cpp
+29
-29
未找到文件。
multimedia/media/media_cpp_test_standard/BUILD.gn
浏览文件 @
fd5c7f8a
...
@@ -33,18 +33,7 @@ ohos_moduletest_suite("ActsMediaCppStandardTest") {
...
@@ -33,18 +33,7 @@ ohos_moduletest_suite("ActsMediaCppStandardTest") {
"player/src/function/ActsPlayerFuncAsyncTest.cpp",
"player/src/function/ActsPlayerFuncAsyncTest.cpp",
"player/src/function/ActsPlayerStateTest.cpp",
"player/src/function/ActsPlayerStateTest.cpp",
"player/src/function/ActsPlayerStateAsyncTest.cpp",
"player/src/function/ActsPlayerStateAsyncTest.cpp",
"player/src/api/01.SetSource.cpp",
"player/src/api/ActsPlayerAPITest.cpp",
"player/src/api/02.Prepare.cpp",
"player/src/api/03.Play.cpp",
"player/src/api/04.Pause.cpp",
"player/src/api/05.Stop.cpp",
"player/src/api/06.Reset.cpp",
"player/src/api/07.Seek.cpp",
"player/src/api/08.SetVolume.cpp",
"player/src/api/09.SetLooping.cpp",
"player/src/api/10.SetPlaybackSpeed.cpp",
"player/src/api/11.PrepareAsync.cpp",
"player/src/api/12.GetCurrentTime.cpp",
]
]
include_dirs = [
include_dirs = [
"include",
"include",
...
...
multimedia/media/media_cpp_test_standard/player/Testplayer.cpp
浏览文件 @
fd5c7f8a
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
#include "Testplayer.h"
#include "Testplayer.h"
#include "parameter.h"
#include "parameter.h"
#include "media_errors.h"
using
namespace
OHOS
;
using
namespace
OHOS
;
using
namespace
OHOS
::
Media
;
using
namespace
OHOS
::
Media
;
...
@@ -39,6 +40,7 @@ TestPlayer::~TestPlayer()
...
@@ -39,6 +40,7 @@ TestPlayer::~TestPlayer()
}
}
bool
TestPlayer
::
CreatePlayer
()
bool
TestPlayer
::
CreatePlayer
()
{
{
MEDIA_INFO_LOG
(
"%s"
,
__FUNCTION__
);
player
=
PlayerFactory
::
CreatePlayer
();
player
=
PlayerFactory
::
CreatePlayer
();
if
(
player
==
nullptr
)
{
if
(
player
==
nullptr
)
{
return
false
;
return
false
;
...
@@ -47,11 +49,13 @@ bool TestPlayer::CreatePlayer()
...
@@ -47,11 +49,13 @@ bool TestPlayer::CreatePlayer()
}
}
int32_t
TestPlayer
::
SetSource
(
const
std
::
string
&
uri
)
int32_t
TestPlayer
::
SetSource
(
const
std
::
string
&
uri
)
{
{
MEDIA_INFO_LOG
(
"%s"
,
__FUNCTION__
);
return
player
->
SetSource
(
uri
);
return
player
->
SetSource
(
uri
);
}
}
int32_t
TestPlayer
::
Play
()
int32_t
TestPlayer
::
Play
()
{
{
MEDIA_INFO_LOG
(
"%s"
,
__FUNCTION__
);
int32_t
ret
=
player
->
Play
();
int32_t
ret
=
player
->
Play
();
if
(
test_
->
mutexFlag_
==
true
&&
test_
->
state_
!=
PLAYER_STARTED
)
{
if
(
test_
->
mutexFlag_
==
true
&&
test_
->
state_
!=
PLAYER_STARTED
)
{
std
::
unique_lock
<
std
::
mutex
>
lockPlay
(
test_
->
mutexPlay_
);
std
::
unique_lock
<
std
::
mutex
>
lockPlay
(
test_
->
mutexPlay_
);
...
@@ -65,6 +69,7 @@ int32_t TestPlayer::Play()
...
@@ -65,6 +69,7 @@ int32_t TestPlayer::Play()
int32_t
TestPlayer
::
Prepare
()
int32_t
TestPlayer
::
Prepare
()
{
{
MEDIA_INFO_LOG
(
"%s"
,
__FUNCTION__
);
int32_t
ret
=
player
->
Prepare
();
int32_t
ret
=
player
->
Prepare
();
if
(
test_
->
mutexFlag_
==
true
&&
test_
->
state_
!=
PLAYER_PREPARED
)
{
if
(
test_
->
mutexFlag_
==
true
&&
test_
->
state_
!=
PLAYER_PREPARED
)
{
std
::
unique_lock
<
std
::
mutex
>
lockPrepare
(
test_
->
mutexPrepare_
);
std
::
unique_lock
<
std
::
mutex
>
lockPrepare
(
test_
->
mutexPrepare_
);
...
@@ -78,6 +83,7 @@ int32_t TestPlayer::Prepare()
...
@@ -78,6 +83,7 @@ int32_t TestPlayer::Prepare()
int32_t
TestPlayer
::
PrepareAsync
()
int32_t
TestPlayer
::
PrepareAsync
()
{
{
MEDIA_INFO_LOG
(
"%s"
,
__FUNCTION__
);
int32_t
ret
=
player
->
PrepareAsync
();
int32_t
ret
=
player
->
PrepareAsync
();
if
(
test_
->
mutexFlag_
==
true
&&
test_
->
state_
!=
PLAYER_PREPARED
)
{
if
(
test_
->
mutexFlag_
==
true
&&
test_
->
state_
!=
PLAYER_PREPARED
)
{
std
::
unique_lock
<
std
::
mutex
>
lockPrepare
(
test_
->
mutexPrepare_
);
std
::
unique_lock
<
std
::
mutex
>
lockPrepare
(
test_
->
mutexPrepare_
);
...
@@ -91,6 +97,7 @@ int32_t TestPlayer::PrepareAsync()
...
@@ -91,6 +97,7 @@ int32_t TestPlayer::PrepareAsync()
int32_t
TestPlayer
::
Pause
()
int32_t
TestPlayer
::
Pause
()
{
{
MEDIA_INFO_LOG
(
"%s"
,
__FUNCTION__
);
int32_t
ret
=
player
->
Pause
();
int32_t
ret
=
player
->
Pause
();
if
(
test_
->
mutexFlag_
==
true
&&
test_
->
state_
!=
PLAYER_PAUSED
)
{
if
(
test_
->
mutexFlag_
==
true
&&
test_
->
state_
!=
PLAYER_PAUSED
)
{
std
::
unique_lock
<
std
::
mutex
>
lockPause
(
test_
->
mutexPause_
);
std
::
unique_lock
<
std
::
mutex
>
lockPause
(
test_
->
mutexPause_
);
...
@@ -104,6 +111,7 @@ int32_t TestPlayer::Pause()
...
@@ -104,6 +111,7 @@ int32_t TestPlayer::Pause()
int32_t
TestPlayer
::
Stop
()
int32_t
TestPlayer
::
Stop
()
{
{
MEDIA_INFO_LOG
(
"%s"
,
__FUNCTION__
);
int32_t
ret
=
player
->
Stop
();
int32_t
ret
=
player
->
Stop
();
if
(
test_
->
mutexFlag_
==
true
&&
test_
->
state_
!=
PLAYER_STOPPED
)
{
if
(
test_
->
mutexFlag_
==
true
&&
test_
->
state_
!=
PLAYER_STOPPED
)
{
std
::
unique_lock
<
std
::
mutex
>
lockStop
(
test_
->
mutexStop_
);
std
::
unique_lock
<
std
::
mutex
>
lockStop
(
test_
->
mutexStop_
);
...
@@ -117,6 +125,7 @@ int32_t TestPlayer::Stop()
...
@@ -117,6 +125,7 @@ int32_t TestPlayer::Stop()
int32_t
TestPlayer
::
Reset
()
int32_t
TestPlayer
::
Reset
()
{
{
MEDIA_INFO_LOG
(
"%s"
,
__FUNCTION__
);
int32_t
ret
=
player
->
Reset
();
int32_t
ret
=
player
->
Reset
();
if
(
test_
->
mutexFlag_
==
true
&&
test_
->
state_
!=
PLAYER_IDLE
)
{
if
(
test_
->
mutexFlag_
==
true
&&
test_
->
state_
!=
PLAYER_IDLE
)
{
std
::
unique_lock
<
std
::
mutex
>
lockReset
(
test_
->
mutexReset_
);
std
::
unique_lock
<
std
::
mutex
>
lockReset
(
test_
->
mutexReset_
);
...
@@ -130,16 +139,19 @@ int32_t TestPlayer::Reset()
...
@@ -130,16 +139,19 @@ int32_t TestPlayer::Reset()
int32_t
TestPlayer
::
Release
()
int32_t
TestPlayer
::
Release
()
{
{
MEDIA_INFO_LOG
(
"%s"
,
__FUNCTION__
);
return
player
->
Release
();
return
player
->
Release
();
}
}
int32_t
TestPlayer
::
SetVolume
(
float
leftVolume
,
float
rightVolume
)
int32_t
TestPlayer
::
SetVolume
(
float
leftVolume
,
float
rightVolume
)
{
{
MEDIA_INFO_LOG
(
"%s"
,
__FUNCTION__
);
return
player
->
SetVolume
(
leftVolume
,
rightVolume
);
return
player
->
SetVolume
(
leftVolume
,
rightVolume
);
}
}
int32_t
TestPlayer
::
Seek
(
int32_t
mseconds
,
PlayerSeekMode
mode
)
int32_t
TestPlayer
::
Seek
(
int32_t
mseconds
,
PlayerSeekMode
mode
)
{
{
MEDIA_INFO_LOG
(
"%s"
,
__FUNCTION__
);
test_
->
seekDoneFlag_
=
false
;
test_
->
seekDoneFlag_
=
false
;
test_
->
seekPositon_
=
mseconds
;
test_
->
seekPositon_
=
mseconds
;
int32_t
ret
=
player
->
Seek
(
mseconds
,
mode
);
int32_t
ret
=
player
->
Seek
(
mseconds
,
mode
);
...
@@ -155,36 +167,40 @@ int32_t TestPlayer::Seek(int32_t mseconds, PlayerSeekMode mode)
...
@@ -155,36 +167,40 @@ int32_t TestPlayer::Seek(int32_t mseconds, PlayerSeekMode mode)
int32_t
TestPlayer
::
GetCurrentTime
(
int32_t
&
currentTime
)
int32_t
TestPlayer
::
GetCurrentTime
(
int32_t
&
currentTime
)
{
{
MEDIA_INFO_LOG
(
"%s"
,
__FUNCTION__
);
return
player
->
GetCurrentTime
(
currentTime
);
return
player
->
GetCurrentTime
(
currentTime
);
}
}
int32_t
TestPlayer
::
GetDuration
(
int32_t
&
duration
)
int32_t
TestPlayer
::
GetDuration
(
int32_t
&
duration
)
{
{
MEDIA_INFO_LOG
(
"%s"
,
__FUNCTION__
);
return
player
->
GetDuration
(
duration
);
return
player
->
GetDuration
(
duration
);
}
}
int32_t
TestPlayer
::
SetPlaybackSpeed
(
PlaybackRateMode
mode
)
int32_t
TestPlayer
::
SetPlaybackSpeed
(
PlaybackRateMode
mode
)
{
{
MEDIA_INFO_LOG
(
"%s"
,
__FUNCTION__
);
return
player
->
SetPlaybackSpeed
(
mode
);
return
player
->
SetPlaybackSpeed
(
mode
);
}
}
int32_t
TestPlayer
::
GetPlaybackSpeed
(
PlaybackRateMode
&
mode
)
int32_t
TestPlayer
::
GetPlaybackSpeed
(
PlaybackRateMode
&
mode
)
{
{
MEDIA_INFO_LOG
(
"%s"
,
__FUNCTION__
);
return
player
->
GetPlaybackSpeed
(
mode
);
return
player
->
GetPlaybackSpeed
(
mode
);
}
}
sptr
<
Surface
>
TestPlayer
::
GetVideoSurface
(
WindowConfig
sub_config
)
sptr
<
Surface
>
TestPlayer
::
GetVideoSurface
(
WindowConfig
sub_config
)
{
{
char
surface
[
256
]
=
"null"
;
char
surface
[
256
]
=
"null"
;
GetParameter
(
"sys.media.test.surface"
,
"null"
,
&
surface
[
0
],
256
);
GetParameter
(
"sys.media.test.surface"
,
"null"
,
&
surface
[
0
],
256
);
sptr
<
Surface
>
videoSurface
=
nullptr
;
if
(
strcmp
(
surface
,
"null"
)
==
0
)
{
return
videoSurface
;
}
mwindow
=
WindowManager
::
GetInstance
()
->
CreateWindow
(
&
g_config
);
mwindow
=
WindowManager
::
GetInstance
()
->
CreateWindow
(
&
g_config
);
if
(
mwindow
==
nullptr
)
{
if
(
mwindow
==
nullptr
)
{
MEDIA_ERROR_LOG
(
"Create mwindow failed!!!"
);
MEDIA_ERROR_LOG
(
"Create mwindow failed!!!"
);
return
nullptr
;
return
nullptr
;
}
}
sptr
<
Surface
>
videoSurface
=
nullptr
;
if
(
strcmp
(
surface
,
"null"
)
==
0
)
{
return
videoSurface
;
}
if
(
strcmp
(
surface
,
"subwindow"
)
==
0
)
{
if
(
strcmp
(
surface
,
"subwindow"
)
==
0
)
{
InitSubWindow
(
sub_config
);
InitSubWindow
(
sub_config
);
videoSurface
=
window
->
GetSurface
();
videoSurface
=
window
->
GetSurface
();
...
@@ -192,12 +208,13 @@ sptr<Surface> TestPlayer::GetVideoSurface(WindowConfig sub_config)
...
@@ -192,12 +208,13 @@ sptr<Surface> TestPlayer::GetVideoSurface(WindowConfig sub_config)
videoSurface
=
mwindow
->
GetSurface
();
videoSurface
=
mwindow
->
GetSurface
();
videoSurface
->
SetUserData
(
SURFACE_FORMAT
,
std
::
to_string
(
PIXEL_FMT_RGBA_8888
));
videoSurface
->
SetUserData
(
SURFACE_FORMAT
,
std
::
to_string
(
PIXEL_FMT_RGBA_8888
));
std
::
string
format
=
videoSurface
->
GetUserData
(
SURFACE_FORMAT
);
std
::
string
format
=
videoSurface
->
GetUserData
(
SURFACE_FORMAT
);
MEDIA_
INFO
_LOG
(
"SetUserData SURFACE_FORMAT = %s"
,
format
.
c_str
());
MEDIA_
DEBUG
_LOG
(
"SetUserData SURFACE_FORMAT = %s"
,
format
.
c_str
());
}
}
return
videoSurface
;
return
videoSurface
;
}
}
int32_t
TestPlayer
::
SetVideoSurface
(
const
sptr
<
Surface
>
surface
)
int32_t
TestPlayer
::
SetVideoSurface
(
const
sptr
<
Surface
>
surface
)
{
{
MEDIA_INFO_LOG
(
"%s"
,
__FUNCTION__
);
char
parameter
[
256
]
=
"null"
;
char
parameter
[
256
]
=
"null"
;
GetParameter
(
"sys.media.test.surface"
,
"null"
,
&
parameter
[
0
],
256
);
GetParameter
(
"sys.media.test.surface"
,
"null"
,
&
parameter
[
0
],
256
);
if
(
strcmp
(
parameter
,
"null"
)
==
0
)
{
if
(
strcmp
(
parameter
,
"null"
)
==
0
)
{
...
@@ -219,11 +236,13 @@ bool TestPlayer::IsLooping()
...
@@ -219,11 +236,13 @@ bool TestPlayer::IsLooping()
int32_t
TestPlayer
::
SetLooping
(
bool
loop
)
int32_t
TestPlayer
::
SetLooping
(
bool
loop
)
{
{
MEDIA_INFO_LOG
(
"%s"
,
__FUNCTION__
);
return
player
->
SetLooping
(
loop
);
return
player
->
SetLooping
(
loop
);
}
}
int32_t
TestPlayer
::
SetPlayerCallback
(
const
std
::
shared_ptr
<
PlayerCallback
>
&
callback
)
int32_t
TestPlayer
::
SetPlayerCallback
(
const
std
::
shared_ptr
<
PlayerCallback
>
&
callback
)
{
{
MEDIA_INFO_LOG
(
"%s"
,
__FUNCTION__
);
return
player
->
SetPlayerCallback
(
callback
);
return
player
->
SetPlayerCallback
(
callback
);
}
}
...
@@ -270,9 +289,12 @@ void TestPlayerCallback::OnError(PlayerErrorType errorType, int32_t errorCode)
...
@@ -270,9 +289,12 @@ void TestPlayerCallback::OnError(PlayerErrorType errorType, int32_t errorCode)
errorNum
++
;
errorNum
++
;
errorType_
=
errorType
;
errorType_
=
errorType
;
errorCode_
=
errorCode
;
errorCode_
=
errorCode
;
MEDIA_INFO_LOG
(
"TestPlayerCallback: OnError errorType is %d, errorCode is %d"
,
errorType_
,
errorCode_
);
std
::
string
errorTypeMsg
=
PlayerErrorTypeToString
(
errorType
);
std
::
string
errorCodeMsg
=
MSErrorToString
(
static_cast
<
MediaServiceErrCode
>
(
errorCode
));
MEDIA_ERROR_LOG
(
"TestPlayerCallback: OnError errorType is %s, errorCode is %s"
,
errorTypeMsg
.
c_str
(),
errorCodeMsg
.
c_str
());
}
}
void
TestPlayerCallback
::
OnInfo
(
PlayerOnInfoType
type
,
int32_t
extra
,
const
Format
&
I
nfoBody
)
void
TestPlayerCallback
::
OnInfo
(
PlayerOnInfoType
type
,
int32_t
extra
,
const
Format
&
i
nfoBody
)
{
{
switch
(
type
)
{
switch
(
type
)
{
case
INFO_TYPE_SEEKDONE
:
case
INFO_TYPE_SEEKDONE
:
...
@@ -290,7 +312,6 @@ void TestPlayerCallback::OnInfo(PlayerOnInfoType type, int32_t extra, const Form
...
@@ -290,7 +312,6 @@ void TestPlayerCallback::OnInfo(PlayerOnInfoType type, int32_t extra, const Form
break
;
break
;
case
INFO_TYPE_STATE_CHANGE
:
case
INFO_TYPE_STATE_CHANGE
:
state_
=
static_cast
<
PlayerStates
>
(
extra
);
state_
=
static_cast
<
PlayerStates
>
(
extra
);
test_
->
SetState
(
state_
);
PrintState
(
state_
);
PrintState
(
state_
);
break
;
break
;
case
INFO_TYPE_POSITION_UPDATE
:
case
INFO_TYPE_POSITION_UPDATE
:
...
@@ -303,7 +324,6 @@ void TestPlayerCallback::OnInfo(PlayerOnInfoType type, int32_t extra, const Form
...
@@ -303,7 +324,6 @@ void TestPlayerCallback::OnInfo(PlayerOnInfoType type, int32_t extra, const Form
break
;
break
;
}
}
}
}
int
TestPlayerCallback
::
WaitForSeekDone
(
int32_t
currentPositon
)
int
TestPlayerCallback
::
WaitForSeekDone
(
int32_t
currentPositon
)
{
{
int64_t
waitTime
=
0
;
int64_t
waitTime
=
0
;
...
@@ -328,7 +348,7 @@ int TestPlayerCallback::WaitForState(PlayerStates state)
...
@@ -328,7 +348,7 @@ int TestPlayerCallback::WaitForState(PlayerStates state)
waitTime
+=
1
;
waitTime
+=
1
;
}
}
if
(
waitTime
>=
WAITSECOND
*
1000
)
{
if
(
waitTime
>=
WAITSECOND
*
1000
)
{
MEDIA_
INFO
_LOG
(
"Failed to wait for state[%d] down"
,
state
);
MEDIA_
ERROR
_LOG
(
"Failed to wait for state[%d] down"
,
state
);
return
-
1
;
return
-
1
;
}
}
return
0
;
return
0
;
...
@@ -341,6 +361,7 @@ void TestPlayerCallback::PrintState(PlayerStates state)
...
@@ -341,6 +361,7 @@ void TestPlayerCallback::PrintState(PlayerStates state)
break
;
break
;
case
PLAYER_IDLE
:
case
PLAYER_IDLE
:
MEDIA_INFO_LOG
(
"State: IDLE"
);
MEDIA_INFO_LOG
(
"State: IDLE"
);
test_
->
SetState
(
state
);
test_
->
condVarReset_
.
notify_all
();
test_
->
condVarReset_
.
notify_all
();
break
;
break
;
case
PLAYER_INITIALIZED
:
case
PLAYER_INITIALIZED
:
...
@@ -351,18 +372,22 @@ void TestPlayerCallback::PrintState(PlayerStates state)
...
@@ -351,18 +372,22 @@ void TestPlayerCallback::PrintState(PlayerStates state)
break
;
break
;
case
PLAYER_PREPARED
:
case
PLAYER_PREPARED
:
MEDIA_INFO_LOG
(
"State: Prepared"
);
MEDIA_INFO_LOG
(
"State: Prepared"
);
test_
->
SetState
(
state
);
test_
->
condVarPrepare_
.
notify_all
();
test_
->
condVarPrepare_
.
notify_all
();
break
;
break
;
case
PLAYER_STARTED
:
case
PLAYER_STARTED
:
MEDIA_INFO_LOG
(
"State: Started"
);
MEDIA_INFO_LOG
(
"State: Started"
);
test_
->
SetState
(
state
);
test_
->
condVarPlay_
.
notify_all
();
test_
->
condVarPlay_
.
notify_all
();
break
;
break
;
case
PLAYER_PAUSED
:
case
PLAYER_PAUSED
:
MEDIA_INFO_LOG
(
"State: Paused"
);
MEDIA_INFO_LOG
(
"State: Paused"
);
test_
->
SetState
(
state
);
test_
->
condVarPause_
.
notify_all
();
test_
->
condVarPause_
.
notify_all
();
break
;
break
;
case
PLAYER_STOPPED
:
case
PLAYER_STOPPED
:
MEDIA_INFO_LOG
(
"State: Stopped"
);
MEDIA_INFO_LOG
(
"State: Stopped"
);
test_
->
SetState
(
state
);
test_
->
condVarStop_
.
notify_all
();
test_
->
condVarStop_
.
notify_all
();
break
;
break
;
case
PLAYER_PLAYBACK_COMPLETE
:
case
PLAYER_PLAYBACK_COMPLETE
:
...
...
multimedia/media/media_cpp_test_standard/player/include/Testplayer.h
浏览文件 @
fd5c7f8a
...
@@ -15,26 +15,11 @@
...
@@ -15,26 +15,11 @@
#include "securec.h"
#include "securec.h"
#include "common.h"
#include "common.h"
#include "player.h"
#include "mediatest_log.h"
#include "mediatest_log.h"
#include "window_manager.h"
#include "window_manager.h"
#include "surface_type.h"
#include "surface_type.h"
#include "display_type.h"
#include "display_type.h"
namespace
PlayerNameSpace
{
static
const
int
MAX_THREADS
=
16
;
static
const
int32_t
PLAYING_TIME
=
3
;
static
const
int32_t
PAUSED_TIME
=
1
;
static
const
int32_t
SEEK_TIME_5_SEC
=
5000
;
static
const
int32_t
SEEK_TIME_2_SEC
=
2000
;
static
const
int
DELTA_TIME
=
1000
;
static
const
int
WAITSECOND
=
2
;
static
const
int
MAXTIME
=
20
;
static
const
int
RET_OK
=
0
;
static
const
int32_t
FILE_BEGIN
=
0
;
std
::
string
GetUri
();
}
namespace
OHOS
{
namespace
OHOS
{
namespace
Media
{
namespace
Media
{
static
const
std
::
string
SURFACE_STRIDE_ALIGNMENT
=
"SURFACE_STRIDE_ALIGNMENT"
;
static
const
std
::
string
SURFACE_STRIDE_ALIGNMENT
=
"SURFACE_STRIDE_ALIGNMENT"
;
...
@@ -119,7 +104,7 @@ public:
...
@@ -119,7 +104,7 @@ public:
~
TestPlayerCallback
();
~
TestPlayerCallback
();
void
OnError
(
PlayerErrorType
errorType
,
int32_t
errorCode
);
void
OnError
(
PlayerErrorType
errorType
,
int32_t
errorCode
);
int
WaitForSeekDone
(
int32_t
currentPositon
);
int
WaitForSeekDone
(
int32_t
currentPositon
);
void
OnInfo
(
PlayerOnInfoType
type
,
int32_t
extra
,
const
Format
&
I
nfoBody
=
{});
void
OnInfo
(
PlayerOnInfoType
type
,
int32_t
extra
,
const
Format
&
i
nfoBody
=
{});
int
WaitForState
(
PlayerStates
state
);
int
WaitForState
(
PlayerStates
state
);
private:
private:
PlayerErrorType
errorType_
=
PLAYER_ERROR_UNKNOWN
;
PlayerErrorType
errorType_
=
PLAYER_ERROR_UNKNOWN
;
...
...
multimedia/media/media_cpp_test_standard/player/include/common.h
浏览文件 @
fd5c7f8a
...
@@ -14,7 +14,22 @@
...
@@ -14,7 +14,22 @@
*/
*/
#include "gtest/gtest.h"
#include "gtest/gtest.h"
#include "player.h"
#define MOUNT_147 "/data/147"
namespace
PlayerNameSpace
{
#define MOUNT_189 "/data/189"
static
std
::
string
MOUNT_147
=
"/data/media/audio/147"
;
static
std
::
string
MOUNT_189
=
"/data/media/audio/189"
;
static
const
int
MAX_THREADS
=
16
;
static
const
int32_t
PLAYING_TIME
=
3
;
static
const
int32_t
PAUSED_TIME
=
1
;
static
const
int32_t
SEEK_TIME_5_SEC
=
5000
;
static
const
int32_t
SEEK_TIME_2_SEC
=
2000
;
static
const
int
DELTA_TIME
=
1000
;
static
const
int
WAITSECOND
=
2
;
static
const
int
MAXTIME
=
1000
;
static
const
int
RET_OK
=
0
;
static
const
int32_t
FILE_BEGIN
=
0
;
static
const
int32_t
BUF_SIZE
=
1024
*
1024
;
static
const
OHOS
::
Media
::
PlayerSeekMode
SEEK_MODE
=
OHOS
::
Media
::
PlayerSeekMode
::
SEEK_PREVIOUS_SYNC
;
std
::
string
GetUri
();
}
\ No newline at end of file
multimedia/media/media_cpp_test_standard/player/src/api/ ActsPlayerAPITest.cpp
0 → 100644
浏览文件 @
fd5c7f8a
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ActsPlayerAPITest.h"
#include "player.h"
using
namespace
std
;
using
namespace
OHOS
;
using
namespace
OHOS
::
Media
;
using
namespace
testing
::
ext
;
using
namespace
PlayerNameSpace
;
/**
* @tc.number : SUB_MEDIA_PLAYER_APITest_SetSource_0100
* @tc.name : 01.SetSource操作在new之后
* @tc.desc : test SetSource
*/
HWTEST_F
(
ActsPlayerAPITest
,
SUB_MEDIA_PLAYER_APITest_SetSource_0100
,
Reliability
|
MediumTest
|
Level2
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
std
::
string
uri
=
GetUri
();
ASSERT_EQ
(
RET_OK
,
player
->
SetSource
(
uri
));
}
/**
* @tc.number : SUB_MEDIA_PLAYER_APITest_Prepare_0100
* @tc.name : 03.Prepare操作在SetSource之后
* @tc.desc : test Prepare
*/
HWTEST_F
(
ActsPlayerAPITest
,
SUB_MEDIA_PLAYER_APITest_Prepare_0100
,
Reliability
|
MediumTest
|
Level2
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
std
::
string
uri
=
GetUri
();
ASSERT_EQ
(
RET_OK
,
player
->
SetSource
(
uri
));
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
&
testObj
);
EXPECT_EQ
(
RET_OK
,
player
->
SetPlayerCallback
(
testCallback
));
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
EXPECT_EQ
(
RET_OK
,
player
->
Reset
());
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_APITest_PrepareAsync_0100
* @tc.name : 03.PrepareAsync操作在SetSource之后
* @tc.desc : test PrepareAsync
*/
HWTEST_F
(
ActsPlayerAPITest
,
SUB_MEDIA_PLAYER_APITest_PrepareAsync_0100
,
Reliability
|
MediumTest
|
Level2
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
std
::
string
uri
=
GetUri
();
ASSERT_EQ
(
RET_OK
,
player
->
SetSource
(
uri
));
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
&
testObj
);
EXPECT_EQ
(
RET_OK
,
player
->
SetPlayerCallback
(
testCallback
));
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
Reset
());
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_APITest_Play_0100
* @tc.name : 02.Play操作在PrepareAsync之后
* @tc.desc : test Play
*/
HWTEST_F
(
ActsPlayerAPITest
,
SUB_MEDIA_PLAYER_APITest_Play_0100
,
Reliability
|
MediumTest
|
Level2
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
std
::
string
uri
=
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
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Reset
());
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_APITest_Stop_0100
* @tc.name : 04.Stop操作在Play之后
* @tc.desc : test Stop
*/
HWTEST_F
(
ActsPlayerAPITest
,
SUB_MEDIA_PLAYER_APITest_Stop_0100
,
Reliability
|
MediumTest
|
Level2
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
std
::
string
uri
=
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
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Stop
());
EXPECT_EQ
(
RET_OK
,
player
->
Reset
());
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_APITest_Pause_0100
* @tc.name : 05.Pause操作在Play之后
* @tc.desc : test Pause
*/
HWTEST_F
(
ActsPlayerAPITest
,
SUB_MEDIA_PLAYER_APITest_Pause_0100
,
Reliability
|
MediumTest
|
Level2
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
std
::
string
uri
=
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
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Pause
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Reset
());
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_APITest_Reset_0100
* @tc.name : 06.Reset操作在Seek之后
* @tc.desc : test Reset
*/
HWTEST_F
(
ActsPlayerAPITest
,
SUB_MEDIA_PLAYER_APITest_Reset_0100
,
Reliability
|
MediumTest
|
Level2
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
std
::
string
uri
=
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
));
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
SEEK_TIME_2_SEC
,
time
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
player
->
Reset
());
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_APITest_Seek_0100
* @tc.name : 04.Seek操作在Play之后
* @tc.desc : test Seek
*/
HWTEST_F
(
ActsPlayerAPITest
,
SUB_MEDIA_PLAYER_APITest_Seek_0100
,
Reliability
|
MediumTest
|
Level2
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
std
::
string
uri
=
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
));
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
SEEK_TIME_2_SEC
,
time
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
player
->
Reset
());
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_APITest_Seek_0200
* @tc.name : 06.Seek操作在Pause之后
* @tc.desc : test Seek
*/
HWTEST_F
(
ActsPlayerAPITest
,
SUB_MEDIA_PLAYER_APITest_Seek_0200
,
Reliability
|
MediumTest
|
Level2
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
std
::
string
uri
=
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
));
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Pause
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
SEEK_TIME_2_SEC
,
time
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
player
->
Reset
());
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_APITest_Seek_0300
* @tc.name : 10.Seek操作调用3次
* @tc.desc : test Seek
*/
HWTEST_F
(
ActsPlayerAPITest
,
SUB_MEDIA_PLAYER_APITest_Seek_0300
,
Reliability
|
MediumTest
|
Level2
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
std
::
string
uri
=
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
));
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
SEEK_TIME_2_SEC
,
time
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
SEEK_TIME_2_SEC
,
time
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
SEEK_TIME_2_SEC
,
time
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
player
->
Pause
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
Stop
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Reset
());
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_APITest_SetVolume_0100
* @tc.name : 01.SetVolume 0.5 0.5
* @tc.desc : test SetVolume
*/
HWTEST_F
(
ActsPlayerAPITest
,
SUB_MEDIA_PLAYER_APITest_SetVolume_0100
,
Reliability
|
MediumTest
|
Level2
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
std
::
string
uri
=
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
));
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
SEEK_TIME_2_SEC
,
time
,
DELTA_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_EQ
(
RET_OK
,
player
->
SetVolume
(
0.5
,
0.5
));
sleep
(
PLAYING_TIME
);
EXPECT_EQ
(
RET_OK
,
player
->
Stop
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Reset
());
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_APITest_SetPlaybackSpeed_0100
* @tc.name : 02.SetPlaybackSpeed操作在play之后
* @tc.desc :
*/
HWTEST_F
(
ActsPlayerAPITest
,
SUB_MEDIA_PLAYER_APITest_SetPlaybackSpeed_0100
,
Reliability
|
MediumTest
|
Level2
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
std
::
string
uri
=
GetUri
();
ASSERT_EQ
(
RET_OK
,
player
->
SetSource
(
uri
));
PlaybackRateMode
mode
;
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
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
SetPlaybackSpeed
(
SPEED_FORWARD_0_75_X
));
EXPECT_EQ
(
RET_OK
,
player
->
GetPlaybackSpeed
(
mode
));
EXPECT_EQ
(
SPEED_FORWARD_0_75_X
,
mode
);
}
/**
* @tc.number : SUB_MEDIA_PLAYER_APITest_Seek_1500
* @tc.name : 15.GET操作在每个可进行的操作后都调用一次
* @tc.desc : test Seek
*/
HWTEST_F
(
ActsPlayerAPITest
,
SUB_MEDIA_PLAYER_APITest_GetParameter_0100
,
Reliability
|
MediumTest
|
Level2
)
{
PlayerSignal
testObj
;
std
::
shared_ptr
<
TestPlayer
>
player
=
std
::
make_shared
<
TestPlayer
>
(
&
testObj
);
ASSERT_NE
(
nullptr
,
player
);
ASSERT_EQ
(
true
,
player
->
CreatePlayer
());
std
::
string
uri
=
GetUri
();
int32_t
time
;
int32_t
duration
;
int32_t
defaultDuration
;
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
));
// prepare
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
FILE_BEGIN
,
time
);
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
defaultDuration
));
EXPECT_FALSE
(
player
->
IsPlaying
());
// play
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
FILE_BEGIN
,
time
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
duration
));
EXPECT_EQ
(
defaultDuration
,
duration
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Stop
());
EXPECT_EQ
(
RET_OK
,
player
->
Reset
());
}
multimedia/media/media_cpp_test_standard/player/src/function/ActsPlayerFuncAsyncTest.cpp
浏览文件 @
fd5c7f8a
...
@@ -423,7 +423,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_1400, Func
...
@@ -423,7 +423,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_1400, Func
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
player
->
Pause
());
EXPECT_EQ
(
RET_OK
,
player
->
Pause
());
...
@@ -458,7 +458,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_1500, Func
...
@@ -458,7 +458,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_1500, Func
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Pause
());
EXPECT_EQ
(
RET_OK
,
player
->
Pause
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
...
@@ -501,7 +501,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_1600, Func
...
@@ -501,7 +501,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_1600, Func
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
for
(
int32_t
i
=
1
;
i
<
4
;
i
++
)
{
for
(
int32_t
i
=
1
;
i
<
4
;
i
++
)
{
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
i
*
1000
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
i
*
1000
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
i
*
1000
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
i
*
1000
,
time
,
DELTA_TIME
);
}
}
...
@@ -537,7 +537,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_1700, Func
...
@@ -537,7 +537,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_1700, Func
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
...
@@ -570,7 +570,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_1800, Func
...
@@ -570,7 +570,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_1800, Func
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
...
@@ -608,7 +608,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_1900, Func
...
@@ -608,7 +608,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_1900, Func
EXPECT_EQ
(
RET_OK
,
player
->
Stop
());
EXPECT_EQ
(
RET_OK
,
player
->
Stop
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_FALSE
(
player
->
IsPlaying
());
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
MODE
));
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
...
@@ -647,7 +647,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_2000, Func
...
@@ -647,7 +647,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_2000, Func
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
for
(
int32_t
i
=
0
;
i
<
durationTime
;
i
=
i
+
(
durationTime
/
3
)
+
1
)
{
for
(
int32_t
i
=
0
;
i
<
durationTime
;
i
=
i
+
(
durationTime
/
3
)
+
1
)
{
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
i
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
i
,
SEEK_
MODE
));
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
...
@@ -691,7 +691,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_2100, Func
...
@@ -691,7 +691,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_2100, Func
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
for
(
int32_t
i
=
0
;
i
<
durationTime
;
i
=
i
+
(
durationTime
/
3
)
+
1
)
{
for
(
int32_t
i
=
0
;
i
<
durationTime
;
i
=
i
+
(
durationTime
/
3
)
+
1
)
{
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
i
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
i
,
SEEK_
MODE
));
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
i
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
i
,
time
,
DELTA_TIME
);
...
@@ -729,7 +729,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_2200, Func
...
@@ -729,7 +729,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_2200, Func
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
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
MODE
));
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
...
@@ -771,7 +771,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_2300, Func
...
@@ -771,7 +771,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_2300, Func
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
MODE
));
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
...
@@ -808,7 +808,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_2400, Func
...
@@ -808,7 +808,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_2400, Func
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
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_NE
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
MODE
));
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
FILE_BEGIN
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
FILE_BEGIN
,
time
,
DELTA_TIME
);
...
@@ -845,8 +845,8 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_2500, Func
...
@@ -845,8 +845,8 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_2500, Func
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
FILE_BEGIN
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
FILE_BEGIN
,
SEEK_
MODE
));
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
FILE_BEGIN
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
FILE_BEGIN
,
time
,
DELTA_TIME
);
...
@@ -881,7 +881,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_2600, Func
...
@@ -881,7 +881,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_2600, Func
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
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_NE
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
MODE
));
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
FILE_BEGIN
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
FILE_BEGIN
,
time
,
DELTA_TIME
);
...
@@ -919,7 +919,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_2700, Func
...
@@ -919,7 +919,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_2700, Func
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
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_NE
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
MODE
));
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
...
@@ -960,7 +960,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_2800, Func
...
@@ -960,7 +960,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_2800, Func
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
,
SEEK_
PREVIOUS_SYNC
));
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
));
...
@@ -995,7 +995,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_2900, Func
...
@@ -995,7 +995,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_2900, Func
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
+
1
,
SEEK_
PREVIOUS_SYNC
));
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_EQ
(
durationTime
,
time
);
EXPECT_EQ
(
durationTime
,
time
);
...
@@ -1032,7 +1032,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_3000, Func
...
@@ -1032,7 +1032,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_3000, Func
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
/
3
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
/
3
,
SEEK_
MODE
));
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
durationTime
/
3
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
durationTime
/
3
,
time
,
DELTA_TIME
);
...
@@ -1068,7 +1068,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_3100, Func
...
@@ -1068,7 +1068,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_3100, Func
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
for
(
int32_t
i
=
0
;
i
<
durationTime
;
i
=
i
+
(
durationTime
/
3
)
+
1
)
{
for
(
int32_t
i
=
0
;
i
<
durationTime
;
i
=
i
+
(
durationTime
/
3
)
+
1
)
{
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
i
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
i
,
SEEK_
MODE
));
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
i
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
i
,
time
,
DELTA_TIME
);
...
@@ -1108,7 +1108,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_3200, Func
...
@@ -1108,7 +1108,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_3200, Func
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
->
Seek
(
FILE_BEGIN
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
FILE_BEGIN
,
SEEK_
MODE
));
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
FILE_BEGIN
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
FILE_BEGIN
,
time
,
DELTA_TIME
);
...
@@ -1148,7 +1148,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_3300, Func
...
@@ -1148,7 +1148,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_3300, Func
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
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
,
SEEK_
MODE
));
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
durationTime
,
time
);
EXPECT_EQ
(
durationTime
,
time
);
...
@@ -1190,7 +1190,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_3400, Func
...
@@ -1190,7 +1190,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_03_3400, Func
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
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
+
1
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
+
1
,
SEEK_
MODE
));
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
...
...
multimedia/media/media_cpp_test_standard/player/src/function/ActsPlayerFuncTest.cpp
浏览文件 @
fd5c7f8a
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
#include "ActsPlayerFuncTest.h"
#include "ActsPlayerFuncTest.h"
#include "securec.h"
#include "securec.h"
...
@@ -428,10 +429,9 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_1400, Function |
...
@@ -428,10 +429,9 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_1400, Function |
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
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
->
Stop
());
EXPECT_EQ
(
RET_OK
,
player
->
Stop
());
...
@@ -465,7 +465,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_1500, Function |
...
@@ -465,7 +465,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_1500, Function |
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Pause
());
EXPECT_EQ
(
RET_OK
,
player
->
Pause
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
...
@@ -509,7 +509,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_1600, Function |
...
@@ -509,7 +509,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_1600, Function |
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
for
(
int32_t
i
=
1
;
i
<
4
;
i
++
)
{
for
(
int32_t
i
=
1
;
i
<
4
;
i
++
)
{
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
i
*
1000
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
i
*
1000
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
i
*
1000
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
i
*
1000
,
time
,
DELTA_TIME
);
}
}
...
@@ -546,7 +546,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_1700, Function |
...
@@ -546,7 +546,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_1700, Function |
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
...
@@ -580,7 +580,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_1800, Function |
...
@@ -580,7 +580,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_1800, Function |
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
...
@@ -619,7 +619,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_1900, Function |
...
@@ -619,7 +619,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_1900, Function |
EXPECT_EQ
(
RET_OK
,
player
->
Stop
());
EXPECT_EQ
(
RET_OK
,
player
->
Stop
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_FALSE
(
player
->
IsPlaying
());
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
MODE
));
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
...
@@ -659,7 +659,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2000, Function |
...
@@ -659,7 +659,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2000, Function |
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
for
(
int32_t
i
=
0
;
i
<
durationTime
;
i
=
i
+
(
durationTime
/
3
)
+
1
)
{
for
(
int32_t
i
=
0
;
i
<
durationTime
;
i
=
i
+
(
durationTime
/
3
)
+
1
)
{
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
i
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
i
,
SEEK_
MODE
));
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
...
@@ -705,7 +705,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2100, Function |
...
@@ -705,7 +705,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2100, Function |
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
for
(
int32_t
i
=
0
;
i
<
durationTime
;
i
=
i
+
(
durationTime
/
3
)
+
1
)
{
for
(
int32_t
i
=
0
;
i
<
durationTime
;
i
=
i
+
(
durationTime
/
3
)
+
1
)
{
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
i
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
i
,
SEEK_
MODE
));
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
i
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
i
,
time
,
DELTA_TIME
);
...
@@ -744,7 +744,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2200, Function |
...
@@ -744,7 +744,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2200, 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
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
MODE
));
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
...
@@ -787,7 +787,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2300, Function |
...
@@ -787,7 +787,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2300, Function |
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
MODE
));
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
...
@@ -825,7 +825,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2400, Function |
...
@@ -825,7 +825,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2400, 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
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_NE
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
MODE
));
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
FILE_BEGIN
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
FILE_BEGIN
,
time
,
DELTA_TIME
);
...
@@ -863,8 +863,8 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2500, Function |
...
@@ -863,8 +863,8 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2500, Function |
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
FILE_BEGIN
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
FILE_BEGIN
,
SEEK_
MODE
));
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
FILE_BEGIN
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
FILE_BEGIN
,
time
,
DELTA_TIME
);
...
@@ -900,7 +900,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2600, Function |
...
@@ -900,7 +900,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2600, 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
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_NE
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
MODE
));
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
FILE_BEGIN
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
FILE_BEGIN
,
time
,
DELTA_TIME
);
...
@@ -939,7 +939,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2700, Function |
...
@@ -939,7 +939,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2700, 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
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_NE
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
MODE
));
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
...
@@ -981,7 +981,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2800, Function |
...
@@ -981,7 +981,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2800, Function |
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
,
SEEK_
PREVIOUS_SYNC
));
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
));
...
@@ -1017,7 +1017,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2900, Function |
...
@@ -1017,7 +1017,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_2900, Function |
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
+
1
,
SEEK_
PREVIOUS_SYNC
));
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_EQ
(
durationTime
,
time
);
EXPECT_EQ
(
durationTime
,
time
);
...
@@ -1055,7 +1055,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_3000, Function |
...
@@ -1055,7 +1055,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_3000, Function |
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
/
3
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
/
3
,
SEEK_
MODE
));
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
durationTime
/
3
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
durationTime
/
3
,
time
,
DELTA_TIME
);
...
@@ -1092,7 +1092,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_3100, Function |
...
@@ -1092,7 +1092,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_3100, Function |
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
for
(
int32_t
i
=
0
;
i
<
durationTime
;
i
=
i
+
(
durationTime
/
3
)
+
1
)
{
for
(
int32_t
i
=
0
;
i
<
durationTime
;
i
=
i
+
(
durationTime
/
3
)
+
1
)
{
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
i
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
i
,
SEEK_
MODE
));
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
i
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
i
,
time
,
DELTA_TIME
);
...
@@ -1134,7 +1134,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_3200, Function |
...
@@ -1134,7 +1134,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_3200, 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
->
Seek
(
FILE_BEGIN
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
FILE_BEGIN
,
SEEK_
MODE
));
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
...
@@ -1176,7 +1176,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_3300, Function |
...
@@ -1176,7 +1176,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_3300, 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
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
,
SEEK_
MODE
));
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
durationTime
,
time
);
EXPECT_EQ
(
durationTime
,
time
);
...
@@ -1219,7 +1219,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_3400, Function |
...
@@ -1219,7 +1219,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_03_3400, 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
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
+
1
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
+
1
,
SEEK_
MODE
));
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
durationTime
,
time
);
EXPECT_EQ
(
durationTime
,
time
);
...
...
multimedia/media/media_cpp_test_standard/player/src/function/ActsPlayerStateAsyncTest.cpp
浏览文件 @
fd5c7f8a
...
@@ -205,7 +205,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_0800, Func
...
@@ -205,7 +205,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_0800, Func
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
&
testObj
);
std
::
shared_ptr
<
TestPlayerCallback
>
testCallback
=
std
::
make_shared
<
TestPlayerCallback
>
(
&
testObj
);
EXPECT_EQ
(
RET_OK
,
player
->
SetPlayerCallback
(
testCallback
));
EXPECT_EQ
(
RET_OK
,
player
->
SetPlayerCallback
(
testCallback
));
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
...
@@ -242,7 +242,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_0900, Func
...
@@ -242,7 +242,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_0900, Func
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
...
@@ -276,7 +276,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1000, Func
...
@@ -276,7 +276,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1000, Func
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
...
@@ -309,7 +309,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1100, Func
...
@@ -309,7 +309,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1100, Func
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
player
->
Pause
());
EXPECT_EQ
(
RET_OK
,
player
->
Pause
());
...
@@ -344,7 +344,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1200, Func
...
@@ -344,7 +344,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1200, Func
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
...
@@ -381,7 +381,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1300, Func
...
@@ -381,7 +381,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1300, Func
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
...
@@ -419,7 +419,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1400, Func
...
@@ -419,7 +419,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1400, Func
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
...
@@ -585,7 +585,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1900, Func
...
@@ -585,7 +585,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_1900, Func
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
PLAYING_TIME
*
1000
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
PLAYING_TIME
*
1000
,
time
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
SEEK_TIME_2_SEC
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
SEEK_TIME_2_SEC
,
time
,
DELTA_TIME
);
...
@@ -626,7 +626,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2000, Func
...
@@ -626,7 +626,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2000, Func
EXPECT_EQ
(
RET_OK
,
player
->
SetLooping
(
false
));
EXPECT_EQ
(
RET_OK
,
player
->
SetLooping
(
false
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
+
1
,
SEEK_
PREVIOUS_SYNC
));
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_EQ
(
durationTime
,
time
);
EXPECT_EQ
(
durationTime
,
time
);
...
@@ -662,7 +662,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2100, Func
...
@@ -662,7 +662,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2100, Func
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
SetLooping
(
false
));
EXPECT_EQ
(
RET_OK
,
player
->
SetLooping
(
false
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
+
1
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
+
1
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
durationTime
,
time
);
EXPECT_EQ
(
durationTime
,
time
);
EXPECT_FALSE
(
player
->
IsLooping
());
EXPECT_FALSE
(
player
->
IsLooping
());
...
@@ -704,7 +704,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2200, Func
...
@@ -704,7 +704,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2200, Func
EXPECT_EQ
(
RET_OK
,
player
->
SetLooping
(
true
));
EXPECT_EQ
(
RET_OK
,
player
->
SetLooping
(
true
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
+
1
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
+
1
,
SEEK_
MODE
));
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsLooping
());
EXPECT_TRUE
(
player
->
IsLooping
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
...
@@ -746,7 +746,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2300, Func
...
@@ -746,7 +746,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2300, Func
EXPECT_EQ
(
RET_OK
,
player
->
SetLooping
(
false
));
EXPECT_EQ
(
RET_OK
,
player
->
SetLooping
(
false
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
+
1
,
SEEK_
PREVIOUS_SYNC
));
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_FALSE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
...
@@ -785,7 +785,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2400, Func
...
@@ -785,7 +785,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2400, Func
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
-
1
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
-
1
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
durationTime
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
durationTime
,
time
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
...
@@ -817,7 +817,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2500, Func
...
@@ -817,7 +817,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2500, Func
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
testObj
.
mutexFlag_
=
false
;
testObj
.
mutexFlag_
=
false
;
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
MODE
));
testObj
.
mutexFlag_
=
true
;
testObj
.
mutexFlag_
=
true
;
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
...
@@ -852,10 +852,10 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2600, Func
...
@@ -852,10 +852,10 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2600, Func
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
testObj
.
mutexFlag_
=
false
;
testObj
.
mutexFlag_
=
false
;
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_
PREVIOUS_SYNC
));
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_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
...
@@ -884,7 +884,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2625, Func
...
@@ -884,7 +884,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2625, Func
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
testObj
.
mutexFlag_
=
false
;
testObj
.
mutexFlag_
=
false
;
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_
PREVIOUS_SYNC
));
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
,
player
->
Pause
());
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
...
@@ -914,7 +914,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2650, Func
...
@@ -914,7 +914,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2650, Func
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
testObj
.
mutexFlag_
=
false
;
testObj
.
mutexFlag_
=
false
;
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
}
}
...
@@ -943,7 +943,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2651, Func
...
@@ -943,7 +943,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2651, Func
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
testObj
.
mutexFlag_
=
false
;
testObj
.
mutexFlag_
=
false
;
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
PLAYING_TIME
*
1000
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
PLAYING_TIME
*
1000
,
time
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
...
@@ -973,7 +973,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2675, Func
...
@@ -973,7 +973,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2675, Func
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
testObj
.
mutexFlag_
=
false
;
testObj
.
mutexFlag_
=
false
;
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_
PREVIOUS_SYNC
));
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
->
Play
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
...
@@ -1003,12 +1003,12 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2700, Func
...
@@ -1003,12 +1003,12 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2700, Func
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
durationTime
,
time
);
EXPECT_EQ
(
durationTime
,
time
);
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
durationTime
,
time
);
EXPECT_EQ
(
durationTime
,
time
);
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
...
@@ -1046,7 +1046,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2800, Func
...
@@ -1046,7 +1046,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2800, Func
EXPECT_EQ
(
RET_OK
,
player
->
Pause
());
EXPECT_EQ
(
RET_OK
,
player
->
Pause
());
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
durationTime
,
time
);
EXPECT_EQ
(
durationTime
,
time
);
EXPECT_EQ
(
RET_OK
,
player
->
Stop
());
EXPECT_EQ
(
RET_OK
,
player
->
Stop
());
...
@@ -1085,14 +1085,14 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2900, Func
...
@@ -1085,14 +1085,14 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_2900, Func
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
SetLooping
(
true
));
EXPECT_EQ
(
RET_OK
,
player
->
SetLooping
(
true
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
durationTime
,
time
);
EXPECT_EQ
(
durationTime
,
time
);
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
->
Stop
());
EXPECT_EQ
(
RET_OK
,
player
->
Stop
());
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
durationTime
,
time
);
EXPECT_EQ
(
durationTime
,
time
);
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
...
@@ -1133,7 +1133,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_3000, Func
...
@@ -1133,7 +1133,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_3000, Func
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_EQ
(
RET_OK
,
player
->
Pause
());
EXPECT_EQ
(
RET_OK
,
player
->
Pause
());
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
durationTime
,
time
);
EXPECT_EQ
(
durationTime
,
time
);
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
...
@@ -1147,7 +1147,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_3000, Func
...
@@ -1147,7 +1147,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Async_Function_04_3000, Func
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
ASSERT_EQ
(
RET_OK
,
player
->
PrepareAsync
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_EQ
(
RET_OK
,
player
->
Pause
());
EXPECT_EQ
(
RET_OK
,
player
->
Pause
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
SEEK_TIME_2_SEC
,
time
);
EXPECT_EQ
(
SEEK_TIME_2_SEC
,
time
);
EXPECT_EQ
(
RET_OK
,
player
->
Stop
());
EXPECT_EQ
(
RET_OK
,
player
->
Stop
());
...
...
multimedia/media/media_cpp_test_standard/player/src/function/ActsPlayerStateTest.cpp
浏览文件 @
fd5c7f8a
...
@@ -211,7 +211,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_0800, Function |
...
@@ -211,7 +211,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_0800, Function |
EXPECT_EQ
(
RET_OK
,
player
->
SetPlayerCallback
(
testCallback
));
EXPECT_EQ
(
RET_OK
,
player
->
SetPlayerCallback
(
testCallback
));
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
...
@@ -248,7 +248,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_0900, Function |
...
@@ -248,7 +248,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_0900, Function |
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
...
@@ -282,7 +282,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_1000, Function |
...
@@ -282,7 +282,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_1000, Function |
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
...
@@ -315,7 +315,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_1100, Function |
...
@@ -315,7 +315,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_1100, Function |
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
player
->
Pause
());
EXPECT_EQ
(
RET_OK
,
player
->
Pause
());
...
@@ -349,7 +349,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_1200, Function |
...
@@ -349,7 +349,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_1200, Function |
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
...
@@ -386,7 +386,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_1300, Function |
...
@@ -386,7 +386,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_1300, Function |
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
...
@@ -424,7 +424,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_1400, Function |
...
@@ -424,7 +424,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_1400, Function |
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
...
@@ -590,7 +590,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_1900, Function |
...
@@ -590,7 +590,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_1900, Function |
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
PLAYING_TIME
*
1000
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
PLAYING_TIME
*
1000
,
time
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
SEEK_TIME_2_SEC
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
SEEK_TIME_2_SEC
,
time
,
DELTA_TIME
);
...
@@ -631,7 +631,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2000, Function |
...
@@ -631,7 +631,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2000, Function |
EXPECT_EQ
(
RET_OK
,
player
->
SetLooping
(
false
));
EXPECT_EQ
(
RET_OK
,
player
->
SetLooping
(
false
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
+
1
,
SEEK_
PREVIOUS_SYNC
));
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
));
...
@@ -668,7 +668,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2100, Function |
...
@@ -668,7 +668,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2100, Function |
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
EXPECT_EQ
(
RET_OK
,
player
->
SetLooping
(
false
));
EXPECT_EQ
(
RET_OK
,
player
->
SetLooping
(
false
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
+
1
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
+
1
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
durationTime
,
time
);
EXPECT_EQ
(
durationTime
,
time
);
...
@@ -710,7 +710,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2200, Function |
...
@@ -710,7 +710,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2200, Function |
EXPECT_EQ
(
RET_OK
,
player
->
SetLooping
(
true
));
EXPECT_EQ
(
RET_OK
,
player
->
SetLooping
(
true
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
+
1
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
+
1
,
SEEK_
MODE
));
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsLooping
());
EXPECT_TRUE
(
player
->
IsLooping
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
...
@@ -753,7 +753,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2300, Function |
...
@@ -753,7 +753,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2300, Function |
EXPECT_EQ
(
RET_OK
,
player
->
SetLooping
(
false
));
EXPECT_EQ
(
RET_OK
,
player
->
SetLooping
(
false
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
+
1
,
SEEK_
PREVIOUS_SYNC
));
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_FALSE
(
player
->
IsPlaying
());
...
@@ -793,7 +793,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2400, Function |
...
@@ -793,7 +793,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2400, Function |
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
-
1
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
-
1
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
durationTime
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
durationTime
,
time
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
...
@@ -825,7 +825,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2500, Function |
...
@@ -825,7 +825,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2500, Function |
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
testObj
.
mutexFlag_
=
false
;
testObj
.
mutexFlag_
=
false
;
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
MODE
));
testObj
.
mutexFlag_
=
true
;
testObj
.
mutexFlag_
=
true
;
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
...
@@ -860,10 +860,10 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2600, Function |
...
@@ -860,10 +860,10 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2600, Function |
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
testObj
.
mutexFlag_
=
false
;
testObj
.
mutexFlag_
=
false
;
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_
PREVIOUS_SYNC
));
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_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_5_SEC
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
SEEK_TIME_5_SEC
,
time
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
...
@@ -892,7 +892,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2625, Function |
...
@@ -892,7 +892,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2625, Function |
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
testObj
.
mutexFlag_
=
false
;
testObj
.
mutexFlag_
=
false
;
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_
PREVIOUS_SYNC
));
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
,
player
->
Pause
());
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
...
@@ -922,7 +922,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2650, Function |
...
@@ -922,7 +922,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2650, Function |
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
testObj
.
mutexFlag_
=
false
;
testObj
.
mutexFlag_
=
false
;
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_
PREVIOUS_SYNC
));
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
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
...
@@ -952,7 +952,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2651, Function |
...
@@ -952,7 +952,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2651, Function |
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_NEAR
(
PLAYING_TIME
*
1000
,
time
,
DELTA_TIME
);
EXPECT_NEAR
(
PLAYING_TIME
*
1000
,
time
,
DELTA_TIME
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
EXPECT_EQ
(
RET_OK
,
testCallback
->
errorNum
);
...
@@ -982,7 +982,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2675, Function |
...
@@ -982,7 +982,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2675, Function |
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_TRUE
(
player
->
IsPlaying
());
EXPECT_TRUE
(
player
->
IsPlaying
());
testObj
.
mutexFlag_
=
false
;
testObj
.
mutexFlag_
=
false
;
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_
PREVIOUS_SYNC
));
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
->
Play
());
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
...
@@ -1012,12 +1012,12 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2700, Function |
...
@@ -1012,12 +1012,12 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2700, Function |
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
durationTime
,
time
);
EXPECT_EQ
(
durationTime
,
time
);
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
durationTime
,
time
);
EXPECT_EQ
(
durationTime
,
time
);
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
...
@@ -1055,7 +1055,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2800, Function |
...
@@ -1055,7 +1055,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2800, Function |
EXPECT_EQ
(
RET_OK
,
player
->
Pause
());
EXPECT_EQ
(
RET_OK
,
player
->
Pause
());
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
durationTime
,
time
);
EXPECT_EQ
(
durationTime
,
time
);
EXPECT_EQ
(
RET_OK
,
player
->
Stop
());
EXPECT_EQ
(
RET_OK
,
player
->
Stop
());
...
@@ -1094,14 +1094,14 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2900, Function |
...
@@ -1094,14 +1094,14 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_2900, Function |
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
EXPECT_EQ
(
RET_OK
,
player
->
SetLooping
(
true
));
EXPECT_EQ
(
RET_OK
,
player
->
SetLooping
(
true
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
durationTime
,
time
);
EXPECT_EQ
(
durationTime
,
time
);
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
->
Stop
());
EXPECT_EQ
(
RET_OK
,
player
->
Stop
());
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
sleep
(
PLAYING_TIME
);
sleep
(
PLAYING_TIME
);
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time_before
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time_before
));
...
@@ -1141,7 +1141,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_3000, Function |
...
@@ -1141,7 +1141,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_3000, Function |
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_EQ
(
RET_OK
,
player
->
Pause
());
EXPECT_EQ
(
RET_OK
,
player
->
Pause
());
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
GetDuration
(
durationTime
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
durationTime
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
durationTime
,
time
);
EXPECT_EQ
(
durationTime
,
time
);
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
...
@@ -1155,7 +1155,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_3000, Function |
...
@@ -1155,7 +1155,7 @@ HWTEST_F(ActsPlayerFuncTest, SUB_MEDIA_PLAYER_Local_Function_04_3000, Function |
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
ASSERT_EQ
(
RET_OK
,
player
->
Prepare
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_EQ
(
RET_OK
,
player
->
Play
());
EXPECT_EQ
(
RET_OK
,
player
->
Pause
());
EXPECT_EQ
(
RET_OK
,
player
->
Pause
());
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_
PREVIOUS_SYNC
));
EXPECT_EQ
(
RET_OK
,
player
->
Seek
(
SEEK_TIME_2_SEC
,
SEEK_
MODE
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
RET_OK
,
player
->
GetCurrentTime
(
time
));
EXPECT_EQ
(
SEEK_TIME_2_SEC
,
time
);
EXPECT_EQ
(
SEEK_TIME_2_SEC
,
time
);
EXPECT_EQ
(
RET_OK
,
player
->
Stop
());
EXPECT_EQ
(
RET_OK
,
player
->
Stop
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录