Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
a20ebc51
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看板
未验证
提交
a20ebc51
编写于
8月 16, 2022
作者:
O
openharmony_ci
提交者:
Gitee
8月 16, 2022
浏览文件
操作
浏览文件
下载
差异文件
!4782 媒体子系统测试用例根据开发代码修改同步修改
Merge pull request !4782 from FULIZHONG/0803master
上级
a0497577
eadbd07e
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
692 addition
and
55 deletion
+692
-55
multimedia/media/media_js_standard/AudioPlayerTestBase.js
multimedia/media/media_js_standard/AudioPlayerTestBase.js
+1
-1
multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioAPI.test.js
...ioPlayer/src/main/js/test/PlayerLocalTestAudioAPI.test.js
+2
-2
multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFUNC.test.js
...oPlayer/src/main/js/test/PlayerLocalTestAudioFUNC.test.js
+36
-3
multimedia/media/media_js_standard/audioRecorder/src/main/js/test/RecorderLocalTestAudioAPI.test.js
...corder/src/main/js/test/RecorderLocalTestAudioAPI.test.js
+5
-37
multimedia/media/media_js_standard/audioRecorder/src/main/js/test/RecorderLocalTestAudioFUNC.test.js
...order/src/main/js/test/RecorderLocalTestAudioFUNC.test.js
+5
-7
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerAPICallbackTest.test.js
...layer/src/main/js/test/VideoPlayerAPICallbackTest.test.js
+174
-3
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js
...ayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js
+52
-0
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js
...layer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js
+417
-2
未找到文件。
multimedia/media/media_js_standard/AudioPlayerTestBase.js
浏览文件 @
a20ebc51
...
...
@@ -39,7 +39,7 @@ export function playAudioSource(src, duration, playTime, checkSeekTime, done) {
}
audioPlayer
.
on
(
'
dataLoad
'
,
()
=>
{
console
.
info
(
'
case set source success
'
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
paused
'
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
idle
'
);
expect
(
audioPlayer
.
currentTime
).
assertEqual
(
0
);
expect
(
audioPlayer
.
duration
).
assertClose
(
duration
,
500
);
// step 0: dataLoad -> play
...
...
multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioAPI.test.js
浏览文件 @
a20ebc51
...
...
@@ -148,7 +148,7 @@ describe('PlayerLocalTestAudioAPI', function () {
console
.
info
(
`case dataLoad called`
);
expect
(
audioPlayer
.
currentTime
).
assertEqual
(
0
);
expect
(
audioPlayer
.
duration
).
assertEqual
(
DURATION_TIME
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
paused
'
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
idle
'
);
nextStep
(
mySteps
,
done
);
});
audioPlayer
.
on
(
'
play
'
,
()
=>
{
...
...
@@ -735,7 +735,7 @@ describe('PlayerLocalTestAudioAPI', function () {
expect
(
audioPlayer
.
src
).
assertEqual
(
fdHead
+
fileDescriptor
.
fd
);
expect
(
audioPlayer
.
currentTime
).
assertEqual
(
0
);
expect
(
audioPlayer
.
duration
).
assertEqual
(
DURATION_TIME
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
paused
'
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
idle
'
);
expect
(
audioPlayer
.
loop
).
assertEqual
(
false
);
done
();
})
...
...
multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFUNC.test.js
浏览文件 @
a20ebc51
...
...
@@ -194,7 +194,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
console
.
info
(
`case dataLoad called`
);
expect
(
audioPlayer
.
currentTime
).
assertEqual
(
0
);
expect
(
audioPlayer
.
duration
).
assertEqual
(
DURATION_TIME
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
paused
'
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
idle
'
);
nextStep
(
mySteps
,
done
);
});
audioPlayer
.
on
(
'
play
'
,
()
=>
{
...
...
@@ -319,6 +319,39 @@ describe('PlayerLocalTestAudioFUNC', function () {
audioPlayer
.
src
=
fdPath
;
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_SEEK
* @tc.name : 001.test seek mode 0 / 0.5 * duration/ duration
* @tc.desc : Audio playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_SEEK
'
,
0
,
async
function
(
done
)
{
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
SEEK_STATE
,
0
,
SEEK_STATE
,
DURATION_TIME
/
2
,
SEEK_STATE
,
DURATION_TIME
,
FINISH_STATE
,
RELEASE_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fdHead
+
fileDescriptor
.
fd
;
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_GETTRECKDESCRIPTION
* @tc.name : 001.test getTrackDescription
* @tc.desc : Audio playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_GETTRECKDESCRIPTION
'
,
0
,
async
function
(
done
)
{
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
GETDESCRIPTION_PROMISE
,
GETDESCRIPTION_CALLBACK
,
RELEASE_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fdHead
+
fileDescriptor
.
fd
;
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_LOOP
* @tc.name : 001.test loop
...
...
@@ -342,7 +375,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
testAudioPlayer
.
on
(
'
dataLoad
'
,
()
=>
{
expect
(
testAudioPlayer
.
duration
).
assertEqual
(
DURATION_TIME
);
expect
(
testAudioPlayer
.
state
).
assertEqual
(
'
paused
'
);
expect
(
testAudioPlayer
.
state
).
assertEqual
(
'
idle
'
);
testAudioPlayer
.
play
();
});
testAudioPlayer
.
on
(
'
play
'
,
()
=>
{
...
...
multimedia/media/media_js_standard/audioRecorder/src/main/js/test/RecorderLocalTestAudioAPI.test.js
浏览文件 @
a20ebc51
...
...
@@ -18,7 +18,7 @@ import * as mediaTestBase from '../../../../../MediaTestBase.js';
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
'
RecorderLocalTestAudioAPI
'
,
function
()
{
let
audioRecorder
=
media
.
createAudioRecorder
()
;
let
audioRecorder
=
null
;
const
END_STATE
=
0
;
const
PRE_STATE
=
1
;
const
START_STATE
=
2
;
...
...
@@ -42,9 +42,9 @@ describe('RecorderLocalTestAudioAPI', function () {
fileFormat
:
media
.
ContainerFormatType
.
CFT_MPEG_4A
,
}
function
initAudioRecorder
()
{
if
(
typeof
(
audioRecorder
)
!=
'
undefined
'
)
{
if
(
audioRecorder
!=
null
)
{
audioRecorder
.
release
();
audioRecorder
=
undefined
;
audioRecorder
=
null
;
}
audioRecorder
=
media
.
createAudioRecorder
();
}
...
...
@@ -83,7 +83,7 @@ describe('RecorderLocalTestAudioAPI', function () {
case
RELEASE_STATE
:
console
.
info
(
'
case to release
'
);
audioRecorder
.
release
();
audioRecorder
=
undefined
;
audioRecorder
=
null
;
break
;
case
ERROR_STATE
:
console
.
info
(
'
case to wait error callback
'
);
...
...
@@ -138,9 +138,7 @@ describe('RecorderLocalTestAudioAPI', function () {
nextStep
(
mySteps
,
done
);
});
audioRecorder
.
on
(
'
error
'
,
(
err
)
=>
{
console
.
info
(
`case error called,errName is
${
err
.
name
}
`
);
console
.
info
(
`case error called,errCode is
${
err
.
code
}
`
);
console
.
info
(
`case error called,errMessage is
${
err
.
message
}
`
);
mySteps
.
shift
();
expect
(
mySteps
[
0
]).
assertEqual
(
ERROR_STATE
);
mySteps
.
shift
();
...
...
@@ -168,36 +166,6 @@ describe('RecorderLocalTestAudioAPI', function () {
console
.
info
(
'
afterAll case
'
);
})
/* *
* @tc.number : SUB_MEDIA_RECORDER_createAudioRecorder_API_0100
* @tc.name : Create an AudioRecoder Object by function of createAudioRecorder
* @tc.desc : Reliability Test
* @tc.size : MediumTest
* @tc.type : Reliability
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_RECORDER_createAudioRecorder_API_0100
'
,
0
,
async
function
(
done
)
{
let
testAudioRecorder
=
undefined
;
testAudioRecorder
=
media
.
createAudioRecorder
();
expect
(
testAudioRecorder
!=
undefined
).
assertTrue
();
done
();
})
/* *
* @tc.number : SUB_MEDIA_RECORDER_AudioRecorder_Prepare_API_0100
* @tc.name : 01.creatAudioRecorder->prepare
* @tc.desc : Reliability Test
* @tc.size : MediumTest
* @tc.type : Reliability
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_RECORDER_AudioRecorder_Prepare_API_0100
'
,
0
,
async
function
(
done
)
{
let
testAudioRecorder
=
media
.
createAudioRecorder
();
expect
(
testAudioRecorder
!=
null
).
assertTrue
();
testAudioRecorder
.
prepare
(
audioConfig
);
done
();
})
/* *
* @tc.number : SUB_MEDIA_RECORDER_AudioRecorder_Prepare_API_0200
* @tc.name : 02.start->prepare
...
...
@@ -1000,7 +968,7 @@ describe('RecorderLocalTestAudioAPI', function () {
let
mySteps
=
new
Array
(
RELEASE_STATE
,
END_STATE
);
setCallback
(
mySteps
,
done
);
audioRecorder
.
release
();
audioRecorder
=
undefined
;
audioRecorder
=
null
;
})
/* *
...
...
multimedia/media/media_js_standard/audioRecorder/src/main/js/test/RecorderLocalTestAudioFUNC.test.js
浏览文件 @
a20ebc51
...
...
@@ -19,7 +19,7 @@ import * as videoRecorderBase from '../../../../../VideoRecorderTestBase.js';
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
'
RecorderLocalTestAudioFUNC
'
,
function
()
{
let
audioRecorder
=
media
.
createAudioRecorder
()
;
let
audioRecorder
=
null
;
const
END_STATE
=
0
;
const
PRE_STATE
=
1
;
const
START_STATE
=
2
;
...
...
@@ -52,9 +52,9 @@ describe('RecorderLocalTestAudioFUNC', function () {
}
function
initAudioRecorder
()
{
if
(
typeof
(
audioRecorder
)
!=
'
undefined
'
)
{
if
(
audioRecorder
!=
null
)
{
audioRecorder
.
release
();
audioRecorder
=
undefined
;
audioRecorder
=
null
;
}
audioRecorder
=
media
.
createAudioRecorder
();
}
...
...
@@ -110,7 +110,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
case
RELEASE_STATE
:
console
.
info
(
'
case to release
'
);
audioRecorder
.
release
();
audioRecorder
=
undefined
;
audioRecorder
=
null
;
break
;
case
CHECK_STATE
:
mySteps
.
shift
();
...
...
@@ -174,9 +174,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
nextStep
(
mySteps
,
done
);
});
audioRecorder
.
on
(
'
error
'
,
(
err
)
=>
{
console
.
info
(
`case error called,errName is
${
err
.
name
}
`
);
console
.
info
(
`case error called,errCode is
${
err
.
code
}
`
);
console
.
info
(
`case error called,errMessage is
${
err
.
message
}
`
);
mySteps
.
shift
();
expect
(
mySteps
[
0
]).
assertEqual
(
ERROR_STATE
);
mySteps
.
shift
();
...
...
@@ -345,7 +343,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
* @tc.type : Function
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_RECORDER_CODEC_AAC_03
4
0
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_RECORDER_CODEC_AAC_03
5
0
'
,
0
,
async
function
(
done
)
{
fdObject
=
await
mediaTestBase
.
getAudioFd
(
'
audio_08.m4a
'
);
fdPath
=
"
fd://
"
+
fdObject
.
fdNumber
.
toString
();
audioConfig
.
uri
=
fdPath
;
...
...
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerAPICallbackTest.test.js
浏览文件 @
a20ebc51
...
...
@@ -40,6 +40,7 @@ describe('VideoPlayerAPICallbackTest', function () {
const
SEEK_MODE_EVENT
=
'
seekMode
'
;
const
SETVOLUME_EVENT
=
'
volume
'
;
const
SETSPEED_EVENT
=
'
speed
'
;
const
FINISH_EVENT
=
'
finish
'
;
const
ERROR_EVENT
=
'
error
'
;
const
END_EVENT
=
'
end
'
;
const
VOLUME_VALUE
=
1
;
...
...
@@ -105,6 +106,7 @@ describe('VideoPlayerAPICallbackTest', function () {
function
setOnCallback
(
videoPlayer
,
steps
,
done
)
{
videoPlayer
.
on
(
'
playbackCompleted
'
,
()
=>
{
console
.
info
(
'
case playbackCompleted success
'
);
toNextStep
(
videoPlayer
,
steps
,
done
);
});
videoPlayer
.
on
(
'
bufferingUpdate
'
,
(
infoType
,
value
)
=>
{
...
...
@@ -381,6 +383,11 @@ describe('VideoPlayerAPICallbackTest', function () {
});
});
eventEmitter
.
on
(
FINISH_EVENT
,
(
videoPlayer
,
steps
,
done
)
=>
{
steps
.
shift
();
console
.
info
(
'
case wait for playbackCompleted
'
);
});
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_fdSrc_CALLBACK_0100
* @tc.name : fd is wrong
...
...
@@ -641,6 +648,22 @@ describe('VideoPlayerAPICallbackTest', function () {
eventEmitter
.
emit
(
mySteps
[
0
],
videoPlayer
,
mySteps
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_PREPARE_CALLBACK_1300
* @tc.name : 13.finish -> prepare
* @tc.desc : Video playback control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_PREPARE_CALLBACK_1300
'
,
0
,
async
function
(
done
)
{
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETURL_EVENT
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
SEEK_EVENT
,
DURATION_TIME
,
FINISH_EVENT
,
PREPARE_EVENT
,
ERROR_EVENT
,
RELEASE_EVENT
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoPlayer
,
mySteps
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_PLAY_CALLBACK_0100
* @tc.name : 01.create->play
...
...
@@ -832,6 +855,22 @@ describe('VideoPlayerAPICallbackTest', function () {
eventEmitter
.
emit
(
mySteps
[
0
],
videoPlayer
,
mySteps
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_PLAY_CALLBACK_1300
* @tc.name : 13.finish -> play
* @tc.desc : Video playback control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_PLAY_CALLBACK_1300
'
,
0
,
async
function
(
done
)
{
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETURL_EVENT
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
SEEK_EVENT
,
DURATION_TIME
,
FINISH_EVENT
,
PLAY_EVENT
,
RELEASE_EVENT
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoPlayer
,
mySteps
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_PAUSE_CALLBACK_0100
* @tc.name : 01.create->pause
...
...
@@ -1024,6 +1063,23 @@ describe('VideoPlayerAPICallbackTest', function () {
eventEmitter
.
emit
(
mySteps
[
0
],
videoPlayer
,
mySteps
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_PAUSE_CALLBACK_1300
* @tc.name : 13.finish -> pause
* @tc.desc : Video playback control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_PAUSE_CALLBACK_1300
'
,
0
,
async
function
(
done
)
{
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETURL_EVENT
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
SEEK_EVENT
,
DURATION_TIME
,
FINISH_EVENT
,
PAUSE_EVENT
,
ERROR_EVENT
,
RELEASE_EVENT
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoPlayer
,
mySteps
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_STOP_CALLBACK_0100
* @tc.name : 001.create->stop
...
...
@@ -1211,8 +1267,24 @@ describe('VideoPlayerAPICallbackTest', function () {
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETURL_EVENT
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
STOP_EVENT
,
STOP_EVENT
,
ERROR_EVENT
,
STOP_EVENT
,
ERROR_EVENT
,
RELEASE_EVENT
,
END_EVENT
);
PREPARE_EVENT
,
PLAY_EVENT
,
STOP_EVENT
,
STOP_EVENT
,
ERROR_EVENT
,
STOP_EVENT
,
ERROR_EVENT
,
RELEASE_EVENT
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoPlayer
,
mySteps
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_STOP_CALLBACK_1300
* @tc.name : 13.finish -> stop
* @tc.desc : Video playback control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_STOP_CALLBACK_1300
'
,
0
,
async
function
(
done
)
{
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETURL_EVENT
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
SEEK_EVENT
,
DURATION_TIME
,
FINISH_EVENT
,
STOP_EVENT
,
RELEASE_EVENT
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoPlayer
,
mySteps
,
done
);
})
...
...
@@ -1403,7 +1475,25 @@ describe('VideoPlayerAPICallbackTest', function () {
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETURL_EVENT
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
RESET_EVENT
,
RESET_EVENT
,
ERROR_EVENT
,
RESET_EVENT
,
ERROR_EVENT
,
RELEASE_EVENT
,
END_EVENT
);
PREPARE_EVENT
,
RESET_EVENT
,
RESET_EVENT
,
ERROR_EVENT
,
RESET_EVENT
,
ERROR_EVENT
,
RELEASE_EVENT
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoPlayer
,
mySteps
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_RESET_CALLBACK_1300
* @tc.name : 13.finish -> reset
* @tc.desc : Video playback control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_RESET_CALLBACK_1300
'
,
0
,
async
function
(
done
)
{
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETURL_EVENT
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
SEEK_EVENT
,
DURATION_TIME
,
FINISH_EVENT
,
RESET_EVENT
,
SETURL_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
RELEASE_EVENT
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoPlayer
,
mySteps
,
done
);
})
...
...
@@ -1597,6 +1687,22 @@ describe('VideoPlayerAPICallbackTest', function () {
eventEmitter
.
emit
(
mySteps
[
0
],
videoPlayer
,
mySteps
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_RELEASE_CALLBACK_1300
* @tc.name : 13.finish -> RELEASE
* @tc.desc : Video playback control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_RELEASE_CALLBACK_1300
'
,
0
,
async
function
(
done
)
{
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETURL_EVENT
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
SEEK_EVENT
,
DURATION_TIME
,
FINISH_EVENT
,
RELEASE_EVENT
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoPlayer
,
mySteps
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_SEEK_CALLBACK_0100
* @tc.name : 01.create->seek
...
...
@@ -1758,6 +1864,23 @@ describe('VideoPlayerAPICallbackTest', function () {
eventEmitter
.
emit
(
mySteps
[
0
],
videoPlayer
,
mySteps
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_SEEK_CALLBACK_1100
* @tc.name : 11.seek 3 times
* @tc.desc : Video playback control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_SEEK_CALLBACK_1100
'
,
0
,
async
function
(
done
)
{
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETURL_EVENT
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
SEEK_EVENT
,
SEEK_TIME
,
SEEK_EVENT
,
SEEK_TIME
,
SEEK_EVENT
,
SEEK_TIME
,
RELEASE_EVENT
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoPlayer
,
mySteps
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_SEEK_CALLBACK_1300
* @tc.name : 13.seek(-1)
...
...
@@ -1790,6 +1913,22 @@ describe('VideoPlayerAPICallbackTest', function () {
eventEmitter
.
emit
(
mySteps
[
0
],
videoPlayer
,
mySteps
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_SEEK_CALLBACK_1500
* @tc.name : 13.finish -> seek
* @tc.desc : Video playback control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_SEEK_CALLBACK_1500
'
,
0
,
async
function
(
done
)
{
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETURL_EVENT
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
SEEK_EVENT
,
DURATION_TIME
,
FINISH_EVENT
,
SEEK_EVENT
,
0
,
ERROR_EVENT
,
RELEASE_EVENT
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoPlayer
,
mySteps
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_SETVOLUME_CALLBACK_0100
* @tc.name : 01.create->setvolume
...
...
@@ -2000,6 +2139,22 @@ describe('VideoPlayerAPICallbackTest', function () {
eventEmitter
.
emit
(
mySteps
[
0
],
videoPlayer
,
mySteps
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_SETVOLUME_CALLBACK_1500
* @tc.name : 15.finish -> setvolume
* @tc.desc : Video playback control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_SETVOLUME_CALLBACK_1500
'
,
0
,
async
function
(
done
)
{
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETURL_EVENT
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
SEEK_EVENT
,
DURATION_TIME
,
FINISH_EVENT
,
SETVOLUME_EVENT
,
1
,
RELEASE_EVENT
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoPlayer
,
mySteps
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_SETSPEED_CALLBACK_0100
* @tc.name : 01.create->setspeed
...
...
@@ -2211,5 +2366,21 @@ describe('VideoPlayerAPICallbackTest', function () {
PREPARE_EVENT
,
PLAY_EVENT
,
SETSPEED_EVENT
,
5
,
ERROR_EVENT
,
RELEASE_EVENT
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoPlayer
,
mySteps
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_SETSPEED_CALLBACK_1500
* @tc.name : 15.finish -> setspeed
* @tc.desc : Video playback control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_SETSPEED_CALLBACK_1500
'
,
0
,
async
function
(
done
)
{
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETURL_EVENT
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
SEEK_EVENT
,
DURATION_TIME
,
FINISH_EVENT
,
SETSPEED_EVENT
,
4
,
RELEASE_EVENT
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoPlayer
,
mySteps
,
done
);
})
})
}
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js
浏览文件 @
a20ebc51
...
...
@@ -522,6 +522,23 @@ describe('VideoPlayerFuncCallbackTest', function () {
eventEmitter
.
emit
(
mySteps
[
0
],
videoPlayer
,
mySteps
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_SEEKMODE
* @tc.name : 001.test seek mode SEEK_PREV_SYNC/SEEK_NEXT_SYNC (callback)
* @tc.desc : Video playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_SEEKMODE
'
,
0
,
async
function
(
done
)
{
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETFDSOURCE_EVENT
,
fileDescriptor
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
SEEK_MODE_EVENT
,
SEEK_TIME
,
media
.
SeekMode
.
SEEK_NEXT_SYNC
,
SEEK_MODE_EVENT
,
SEEK_TIME
,
media
.
SeekMode
.
SEEK_PREV_SYNC
,
RELEASE_EVENT
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoPlayer
,
mySteps
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_CALLBACK
* @tc.name : 001.test callback bufferingUpdate/videoSizeChanged/startRenderFrame/playbackCompleted
...
...
@@ -628,6 +645,22 @@ describe('VideoPlayerFuncCallbackTest', function () {
eventEmitter
.
emit
(
'
test_create
'
);
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_GETTRECKDESCRIPTION
* @tc.name : 001.test getTrackDescription (callback)
* @tc.desc : Video playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_GETTRECKDESCRIPTION
'
,
0
,
async
function
(
done
)
{
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETFDSOURCE_EVENT
,
fileDescriptor
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
GETDESCRIPTION
,
RELEASE_EVENT
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoPlayer
,
mySteps
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_LOOP
* @tc.name : 001.test LOOP (callback)
...
...
@@ -645,5 +678,24 @@ describe('VideoPlayerFuncCallbackTest', function () {
SEEK_EVENT
,
DURATION_TIME
,
WAIT_EVENT
,
SETLOOP_EVENT
,
false
,
RELEASE_EVENT
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoPlayer
,
mySteps
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_BASE
* @tc.name : 001.test video playe (callback)
* @tc.desc : Video playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_BASE
'
,
0
,
async
function
(
done
)
{
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
fdPath
=
fdHead
+
fileDescriptor
.
fd
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETFDSOURCE_EVENT
,
fileDescriptor
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
PAUSE_EVENT
,
PLAY_EVENT
,
STOP_EVENT
,
RESET_EVENT
,
SETSOURCE_EVENT
,
fdPath
,
PREPARE_EVENT
,
SETLOOP_EVENT
,
true
,
PLAY_EVENT
,
SEEK_EVENT
,
DURATION_TIME
/
2
,
SEEK_EVENT
,
0
,
SEEK_EVENT
,
DURATION_TIME
,
WAIT_EVENT
,
SETLOOP_EVENT
,
false
,
RELEASE_EVENT
,
END_EVENT
);
eventEmitter
.
emit
(
mySteps
[
0
],
videoPlayer
,
mySteps
,
done
);
})
})
}
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js
浏览文件 @
a20ebc51
...
...
@@ -22,7 +22,7 @@ export default function VideoPlayerFuncPromiseTest() {
describe
(
'
VideoPlayerFuncPromiseTest
'
,
function
()
{
const
VIDEO_SOURCE
=
'
H264_AAC.mp4
'
;
const
AUDIO_SOURCE
=
'
01.mp3
'
;
const
PLAY_TIME
=
3
000
;
const
PLAY_TIME
=
2
000
;
const
SEEK_TIME
=
5000
;
const
WIDTH_VALUE
=
720
;
const
HEIGHT_VALUE
=
480
;
...
...
@@ -76,6 +76,13 @@ describe('VideoPlayerFuncPromiseTest', function () {
console
.
info
(
'
case file fail
'
);
}
function
checkTime
(
actualTime
,
expectTIme
,
delteTime
)
{
console
.
info
(
'
checkTime case actualTime is :
'
+
actualTime
+
'
, expectTIme is :
'
+
expectTIme
);
let
valueTime
=
Math
.
abs
(
expectTIme
-
actualTime
);
console
.
info
(
'
checkTime case time is :
'
+
valueTime
+
'
, delteTime is :
'
+
delteTime
);
expect
(
valueTime
<
delteTime
).
assertEqual
(
true
);
}
function
checkSpeedTime
(
videoPlayer
,
speedValue
,
startTime
)
{
let
newTime
=
videoPlayer
.
currentTime
;
if
(
videoPlayer
.
state
==
'
playing
'
)
{
...
...
@@ -285,6 +292,92 @@ describe('VideoPlayerFuncPromiseTest', function () {
done
();
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_SeekMode
* @tc.name : 001.seek mode SEEK_PREV_SYNC/SEEK_NEXT_SYNC (promise)
* @tc.desc : Video playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_SeekMode
'
,
0
,
async
function
(
done
)
{
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
await
media
.
createVideoPlayer
().
then
((
video
)
=>
{
if
(
typeof
(
video
)
!=
'
undefined
'
)
{
videoPlayer
=
video
;
expect
(
videoPlayer
.
state
).
assertEqual
(
'
idle
'
);
}
else
{
console
.
info
(
'
case createVideoPlayer is failed
'
);
expect
().
assertFail
();
}
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
videoPlayer
.
url
=
fdHead
+
fileDescriptor
.
fd
;
await
videoPlayer
.
setDisplaySurface
(
surfaceID
).
then
(()
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
idle
'
);
console
.
info
(
'
case setDisplaySurface success
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
prepare
().
then
(()
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
prepared
'
);
expect
(
videoPlayer
.
duration
).
assertEqual
(
DURATION_TIME
);
expect
(
videoPlayer
.
width
).
assertEqual
(
WIDTH_VALUE
);
expect
(
videoPlayer
.
height
).
assertEqual
(
HEIGHT_VALUE
);
console
.
info
(
'
case prepare called!!
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
let
startTime
=
videoPlayer
.
currentTime
;
await
videoPlayer
.
play
().
then
(()
=>
{
console
.
info
(
'
case play called!!
'
);
mediaTestBase
.
msleep
(
PLAY_TIME
);
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
let
endTime
=
videoPlayer
.
currentTime
;
expect
(
endTime
-
startTime
).
assertClose
(
PLAY_TIME
,
DELTA_TIME
);
await
videoPlayer
.
seek
(
SEEK_TIME
,
media
.
SeekMode
.
SEEK_NEXT_SYNC
).
then
((
seekDoneTime
)
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
expect
(
seekDoneTime
).
assertClose
(
NEXT_FRAME_TIME
,
DELTA_SEEK_TIME
);
console
.
info
(
'
case seek called and seekDoneTime is
'
+
seekDoneTime
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
seek
(
SEEK_TIME
,
media
.
SeekMode
.
SEEK_PREV_SYNC
).
then
((
seekDoneTime
)
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
expect
(
seekDoneTime
).
assertClose
(
PREV_FRAME_TIME
,
DELTA_SEEK_TIME
);
console
.
info
(
'
case seek called and seekDoneTime is
'
+
seekDoneTime
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
seek
(
PREV_FRAME_TIME
-
100
,
media
.
SeekMode
.
SEEK_PREV_SYNC
).
then
((
seekDoneTime
)
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
expect
(
seekDoneTime
+
DELTA_SEEK_TIME
).
assertClose
(
DELTA_SEEK_TIME
,
DELTA_SEEK_TIME
);
console
.
info
(
'
case seek called and seekDoneTime is
'
+
seekDoneTime
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
seek
(
PREV_FRAME_TIME
+
100
,
media
.
SeekMode
.
SEEK_PREV_SYNC
).
then
((
seekDoneTime
)
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
expect
(
seekDoneTime
).
assertClose
(
PREV_FRAME_TIME
,
DELTA_SEEK_TIME
);
console
.
info
(
'
case seek called and seekDoneTime is
'
+
seekDoneTime
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
seek
(
NEXT_FRAME_TIME
-
100
,
media
.
SeekMode
.
SEEK_NEXT_SYNC
).
then
((
seekDoneTime
)
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
expect
(
seekDoneTime
).
assertClose
(
NEXT_FRAME_TIME
,
DELTA_SEEK_TIME
);
console
.
info
(
'
case seek called and seekDoneTime is
'
+
seekDoneTime
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
seek
(
NEXT_FRAME_TIME
+
100
,
media
.
SeekMode
.
SEEK_NEXT_SYNC
).
then
((
seekDoneTime
)
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
expect
(
seekDoneTime
).
assertClose
(
NEXT_FRAME_TIME
+
100
,
DELTA_SEEK_TIME
);
console
.
info
(
'
case seek called and seekDoneTime is
'
+
seekDoneTime
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
case release called!!
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
done
();
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_Callback
* @tc.name : 001.test callback bufferingUpdate/videoSizeChanged/startRenderFrame/playbackCompleted
...
...
@@ -360,6 +453,67 @@ describe('VideoPlayerFuncPromiseTest', function () {
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_GetTreckDescription
* @tc.name : 001.getTrackDescription (promise)
* @tc.desc : Video playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_GetTreckDescription
'
,
0
,
async
function
(
done
)
{
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
arrayDescription
=
null
;
let
videoTrackKey
=
new
Array
(
'
bitrate
'
,
'
codec_mime
'
,
'
frame_rate
'
,
'
height
'
,
'
track_index
'
,
'
track_type
'
,
'
width
'
);
let
audioTrackKey
=
new
Array
(
'
bitrate
'
,
'
channel_count
'
,
'
codec_mime
'
,
'
sample_rate
'
,
'
track_index
'
,
'
track_type
'
);
let
videoTrackValue
=
new
Array
(
1366541
,
'
video/x-h264
'
,
6000
,
480
,
0
,
1
,
720
);
let
audioTrackValue
=
new
Array
(
129207
,
2
,
'
audio/mpeg
'
,
44100
,
1
,
0
);
let
descriptionKey
=
new
Array
(
videoTrackKey
,
audioTrackKey
);
let
descriptionValue
=
new
Array
(
videoTrackValue
,
audioTrackValue
);
await
media
.
createVideoPlayer
().
then
((
video
)
=>
{
if
(
typeof
(
video
)
!=
'
undefined
'
)
{
videoPlayer
=
video
;
expect
(
videoPlayer
.
state
).
assertEqual
(
'
idle
'
);
}
else
{
console
.
info
(
'
case createVideoPlayer is failed
'
);
expect
().
assertFail
();
}
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
videoPlayer
.
url
=
fdHead
+
fileDescriptor
.
fd
;
await
videoPlayer
.
setDisplaySurface
(
surfaceID
).
then
(()
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
idle
'
);
console
.
info
(
'
case setDisplaySurface success
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
prepare
().
then
(()
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
prepared
'
);
console
.
info
(
'
case prepare called!!
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
getTrackDescription
().
then
((
arrayList
)
=>
{
console
.
info
(
'
case getTrackDescription called!!
'
);
if
(
typeof
(
arrayList
)
!=
'
undefined
'
)
{
arrayDescription
=
arrayList
;
}
else
{
console
.
info
(
'
case getTrackDescription is failed
'
);
expect
().
assertFail
();
}
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
for
(
let
i
=
0
;
i
<
arrayDescription
.
length
;
i
++
)
{
mediaTestBase
.
checkDescription
(
arrayDescription
[
i
],
descriptionKey
[
i
],
descriptionValue
[
i
]);
}
await
videoPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
case release called!!
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
done
();
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_Loop
* @tc.name : 001.Loop true (promise)
...
...
@@ -808,5 +962,266 @@ describe('VideoPlayerFuncPromiseTest', function () {
videoPlayer
.
videoScaleType
=
-
1
;
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_PARAMETER_0100
* @tc.name : 001.parameter value after create/reset/release (promise)
* @tc.desc : Video playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_PARAMETER_0100
'
,
0
,
async
function
(
done
)
{
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
await
media
.
createVideoPlayer
().
then
((
video
)
=>
{
if
(
typeof
(
video
)
!=
'
undefined
'
)
{
videoPlayer
=
video
;
}
else
{
console
.
info
(
'
case createVideoPlayer is failed
'
);
expect
().
assertFail
();
}
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
expect
(
videoPlayer
.
state
).
assertEqual
(
'
idle
'
);
expect
(
videoPlayer
.
url
).
assertEqual
(
''
);
expect
(
videoPlayer
.
fdSrc
.
fd
).
assertEqual
(
0
);
expect
(
videoPlayer
.
fdSrc
.
offset
).
assertEqual
(
0
);
expect
(
videoPlayer
.
fdSrc
.
length
).
assertEqual
(
-
1
);
expect
(
videoPlayer
.
currentTime
).
assertEqual
(
-
1
);
expect
(
videoPlayer
.
duration
).
assertEqual
(
-
1
);
expect
(
videoPlayer
.
width
).
assertEqual
(
0
);
expect
(
videoPlayer
.
height
).
assertEqual
(
0
);
expect
(
videoPlayer
.
loop
).
assertEqual
(
false
);
videoPlayer
.
url
=
fdPath
;
await
videoPlayer
.
setDisplaySurface
(
surfaceID
).
then
(()
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
idle
'
);
console
.
info
(
'
case setDisplaySurface success
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
prepare
().
then
(()
=>
{
console
.
info
(
'
case prepare success
'
);
videoPlayer
.
loop
=
true
;
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
expect
(
videoPlayer
.
state
).
assertEqual
(
'
prepared
'
);
expect
(
videoPlayer
.
url
).
assertEqual
(
fdPath
);
expect
(
videoPlayer
.
fdSrc
.
fd
).
assertEqual
(
0
);
expect
(
videoPlayer
.
fdSrc
.
offset
).
assertEqual
(
0
);
expect
(
videoPlayer
.
fdSrc
.
length
).
assertEqual
(
-
1
);
expect
(
videoPlayer
.
currentTime
).
assertEqual
(
0
);
expect
(
videoPlayer
.
duration
).
assertEqual
(
DURATION_TIME
);
expect
(
videoPlayer
.
width
).
assertEqual
(
WIDTH_VALUE
);
expect
(
videoPlayer
.
height
).
assertEqual
(
HEIGHT_VALUE
);
expect
(
videoPlayer
.
loop
).
assertEqual
(
true
);
await
videoPlayer
.
reset
().
then
(()
=>
{
console
.
info
(
'
case reset success
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
expect
(
videoPlayer
.
state
).
assertEqual
(
'
idle
'
);
expect
(
videoPlayer
.
fdSrc
.
fd
).
assertEqual
(
0
);
expect
(
videoPlayer
.
fdSrc
.
offset
).
assertEqual
(
0
);
expect
(
videoPlayer
.
fdSrc
.
length
).
assertEqual
(
-
1
);
expect
(
videoPlayer
.
currentTime
).
assertEqual
(
-
1
);
expect
(
videoPlayer
.
duration
).
assertEqual
(
-
1
);
expect
(
videoPlayer
.
loop
).
assertEqual
(
false
);
await
videoPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
case release called!!
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
done
();
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_PARAMETER_0200
* @tc.name : 002.speed and loop value after finish (promise)
* @tc.desc : Video playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_PARAMETER_0200
'
,
0
,
async
function
(
done
)
{
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
await
media
.
createVideoPlayer
().
then
((
video
)
=>
{
if
(
typeof
(
video
)
!=
'
undefined
'
)
{
videoPlayer
=
video
;
expect
(
videoPlayer
.
state
).
assertEqual
(
'
idle
'
);
}
else
{
console
.
info
(
'
case createVideoPlayer is failed
'
);
expect
().
assertFail
();
}
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
videoPlayer
.
on
(
'
playbackCompleted
'
,
async
()
=>
{
console
.
info
(
'
case playbackCompleted success
'
);
expect
(
videoPlayer
.
loop
).
assertEqual
(
false
);
expect
(
videoPlayer
.
url
).
assertEqual
(
fdPath
);
expect
(
videoPlayer
.
currentTime
).
assertEqual
(
DURATION_TIME
);
expect
(
videoPlayer
.
duration
).
assertEqual
(
DURATION_TIME
);
expect
(
videoPlayer
.
width
).
assertEqual
(
WIDTH_VALUE
);
expect
(
videoPlayer
.
height
).
assertEqual
(
HEIGHT_VALUE
);
await
videoPlayer
.
play
().
then
(()
=>
{
expect
(
videoPlayer
.
loop
).
assertEqual
(
false
);
startTime
=
videoPlayer
.
currentTime
;
console
.
info
(
'
case play called!!
'
);
mediaTestBase
.
msleep
(
PLAY_TIME
);
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
endTime
=
videoPlayer
.
currentTime
;
checkTime
(
PLAY_TIME
*
2
,
(
endTime
-
startTime
),
DELTA_TIME
);
startTime
=
videoPlayer
.
currentTime
;
await
videoPlayer
.
setSpeed
(
media
.
PlaybackSpeed
.
SPEED_FORWARD_0_75_X
).
then
((
speedMode
)
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
expect
(
speedMode
).
assertEqual
(
media
.
PlaybackSpeed
.
SPEED_FORWARD_0_75_X
);
mediaTestBase
.
msleep
(
PLAY_TIME
);
endTime
=
videoPlayer
.
currentTime
;
console
.
info
(
'
case setSpeed endTime is
'
+
endTime
);
checkTime
(
PLAY_TIME
*
0.75
,
(
endTime
-
startTime
),
DELTA_TIME
);
console
.
info
(
'
case setSpeed called and speedMode is
'
+
speedMode
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
case release called!!
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
done
();
});
videoPlayer
.
url
=
fdPath
;
await
videoPlayer
.
setDisplaySurface
(
surfaceID
).
then
(()
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
idle
'
);
console
.
info
(
'
case setDisplaySurface success
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
prepare
().
then
(()
=>
{
videoPlayer
.
loop
=
true
;
expect
(
videoPlayer
.
state
).
assertEqual
(
'
prepared
'
);
expect
(
videoPlayer
.
duration
).
assertEqual
(
DURATION_TIME
);
expect
(
videoPlayer
.
width
).
assertEqual
(
WIDTH_VALUE
);
expect
(
videoPlayer
.
height
).
assertEqual
(
HEIGHT_VALUE
);
console
.
info
(
'
case prepare called!!
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
let
startTime
=
videoPlayer
.
currentTime
;
await
videoPlayer
.
play
().
then
(()
=>
{
expect
(
videoPlayer
.
loop
).
assertEqual
(
true
);
console
.
info
(
'
case play called!!
'
);
mediaTestBase
.
msleep
(
1000
);
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
let
endTime
=
videoPlayer
.
currentTime
;
checkTime
(
1000
,
(
endTime
-
startTime
),
DELTA_TIME
);
expect
(
videoPlayer
.
loop
).
assertEqual
(
true
);
startTime
=
videoPlayer
.
currentTime
;
console
.
info
(
'
case startTime is :
'
+
startTime
);
await
videoPlayer
.
setSpeed
(
media
.
PlaybackSpeed
.
SPEED_FORWARD_2_00_X
).
then
((
speedMode
)
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
expect
(
speedMode
).
assertEqual
(
media
.
PlaybackSpeed
.
SPEED_FORWARD_2_00_X
);
mediaTestBase
.
msleep
(
PLAY_TIME
);
endTime
=
videoPlayer
.
currentTime
;
checkTime
(
PLAY_TIME
*
2
,
(
endTime
-
startTime
),
DELTA_TIME
);
console
.
info
(
'
case setSpeed called and speedMode is
'
+
speedMode
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
seek
(
SEEK_TIME
,
media
.
SeekMode
.
SEEK_PREV_SYNC
).
then
((
seekDoneTime
)
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
expect
(
seekDoneTime
).
assertClose
(
PREV_FRAME_TIME
,
DELTA_SEEK_TIME
);
console
.
info
(
'
case seek called and seekDoneTime is
'
+
seekDoneTime
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
startTime
=
videoPlayer
.
currentTime
;
mediaTestBase
.
msleep
(
PLAY_TIME
);
endTime
=
videoPlayer
.
currentTime
;
checkTime
(
PLAY_TIME
*
2
,
(
endTime
-
startTime
),
DELTA_TIME
);
expect
(
videoPlayer
.
loop
).
assertEqual
(
true
);
mediaTestBase
.
msleep
(
DURATION_TIME
);
expect
(
videoPlayer
.
loop
).
assertEqual
(
true
);
videoPlayer
.
loop
=
false
;
})
/* *
* @tc.number : SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_PARAMETER_0300
* @tc.name : 003.speed and loop value after reset (promise)
* @tc.desc : Video playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_PARAMETER_0300
'
,
0
,
async
function
(
done
)
{
mediaTestBase
.
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
await
media
.
createVideoPlayer
().
then
((
video
)
=>
{
if
(
typeof
(
video
)
!=
'
undefined
'
)
{
videoPlayer
=
video
;
expect
(
videoPlayer
.
state
).
assertEqual
(
'
idle
'
);
}
else
{
console
.
info
(
'
case createVideoPlayer is failed
'
);
expect
().
assertFail
();
}
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
videoPlayer
.
on
(
'
playbackCompleted
'
,
async
()
=>
{
console
.
info
(
'
case playbackCompleted success
'
);
expect
(
videoPlayer
.
loop
).
assertEqual
(
false
);
await
videoPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
case release called!!
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
done
();
});
videoPlayer
.
url
=
fdPath
;
await
videoPlayer
.
setDisplaySurface
(
surfaceID
).
then
(()
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
idle
'
);
console
.
info
(
'
case setDisplaySurface success
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
prepare
().
then
(()
=>
{
videoPlayer
.
loop
=
true
;
expect
(
videoPlayer
.
state
).
assertEqual
(
'
prepared
'
);
expect
(
videoPlayer
.
duration
).
assertEqual
(
DURATION_TIME
);
expect
(
videoPlayer
.
width
).
assertEqual
(
WIDTH_VALUE
);
expect
(
videoPlayer
.
height
).
assertEqual
(
HEIGHT_VALUE
);
console
.
info
(
'
case prepare called!!
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
let
startTime
=
videoPlayer
.
currentTime
;
await
videoPlayer
.
play
().
then
(()
=>
{
expect
(
videoPlayer
.
loop
).
assertEqual
(
true
);
console
.
info
(
'
case play called!!
'
);
mediaTestBase
.
msleep
(
1000
);
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
let
endTime
=
videoPlayer
.
currentTime
;
checkTime
(
1000
,
(
endTime
-
startTime
),
DELTA_TIME
);
expect
(
videoPlayer
.
loop
).
assertEqual
(
true
);
startTime
=
videoPlayer
.
currentTime
;
console
.
info
(
'
case startTime is :
'
+
startTime
);
await
videoPlayer
.
setSpeed
(
media
.
PlaybackSpeed
.
SPEED_FORWARD_2_00_X
).
then
((
speedMode
)
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
expect
(
speedMode
).
assertEqual
(
media
.
PlaybackSpeed
.
SPEED_FORWARD_2_00_X
);
mediaTestBase
.
msleep
(
PLAY_TIME
);
endTime
=
videoPlayer
.
currentTime
;
checkTime
(
PLAY_TIME
*
2
,
(
endTime
-
startTime
),
DELTA_TIME
);
console
.
info
(
'
case setSpeed called and speedMode is
'
+
speedMode
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoPlayer
.
reset
().
then
(()
=>
{
expect
(
videoPlayer
.
loop
).
assertEqual
(
false
);
expect
(
videoPlayer
.
state
).
assertEqual
(
'
idle
'
);
expect
(
videoPlayer
.
duration
).
assertEqual
(
-
1
);
console
.
info
(
'
case reset called!!
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
videoPlayer
.
url
=
fdPath
;
await
videoPlayer
.
prepare
().
then
(()
=>
{
expect
(
videoPlayer
.
state
).
assertEqual
(
'
prepared
'
);
expect
(
videoPlayer
.
duration
).
assertEqual
(
DURATION_TIME
);
expect
(
videoPlayer
.
width
).
assertEqual
(
WIDTH_VALUE
);
expect
(
videoPlayer
.
height
).
assertEqual
(
HEIGHT_VALUE
);
console
.
info
(
'
case prepare called!!
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
startTime
=
videoPlayer
.
currentTime
;
await
videoPlayer
.
play
().
then
(()
=>
{
expect
(
videoPlayer
.
loop
).
assertEqual
(
false
);
console
.
info
(
'
case play called!!
'
);
mediaTestBase
.
msleep
(
PLAY_TIME
);
expect
(
videoPlayer
.
state
).
assertEqual
(
'
playing
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
endTime
=
videoPlayer
.
currentTime
;
checkTime
(
PLAY_TIME
*
2
,
(
endTime
-
startTime
),
DELTA_TIME
);
})
})
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录