Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
f2df31b4
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看板
提交
f2df31b4
编写于
8月 31, 2021
作者:
B
bird_j
提交者:
Gitee
8月 31, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ActsPlayerAPITest刷新
Signed-off-by:
N
bird_j
<
jianghongpeng@huawei.com
>
上级
0ebace6b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
376 addition
and
0 deletion
+376
-0
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/api/ ActsPlayerAPITest.cpp
0 → 100644
浏览文件 @
f2df31b4
/*
* 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
());
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录