Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
2b3a8d8c
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2b3a8d8c
编写于
9月 16, 2021
作者:
X
XUXIAOBO
提交者:
Gitee
9月 16, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
音频播放器js添加遍历播放码流用例以及修改测试码流。Signed-off-by: XUXIAOBO <xuxiaobo5@huawei.com>
上级
212476b5
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
101 addition
and
18 deletion
+101
-18
multimedia/audio/audio_js_standard/audioPlayer/src/main/js/default/test/PlayerLocalTestAudioFUNC.test.js
...src/main/js/default/test/PlayerLocalTestAudioFUNC.test.js
+31
-4
multimedia/audio/audio_js_standard/audioPlayer/src/main/js/default/test/PlayerLocalTestAudioFormat.test.js
...c/main/js/default/test/PlayerLocalTestAudioFormat.test.js
+41
-12
multimedia/audio/audio_js_standard/audioPlayer_API/src/main/js/default/test/PlayerLocalTestAudioAPI.test.js
.../src/main/js/default/test/PlayerLocalTestAudioAPI.test.js
+29
-2
未找到文件。
multimedia/audio/audio_js_standard/audioPlayer/src/main/js/default/test/PlayerLocalTestAudioFUNC.test.js
浏览文件 @
2b3a8d8c
...
...
@@ -38,7 +38,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
const
LOOP_STATE
=
11
;
const
SECOND_INDEX
=
1
;
const
RAND_NUM
=
5
;
const
TIME_OUT
=
35
000
;
const
TIME_OUT
=
40
000
;
const
MAX_VOLUME
=
1
;
beforeAll
(
function
()
{
...
...
@@ -125,8 +125,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
}
}
function
setCallback
(
mySteps
,
done
)
{
console
.
info
(
`case setCallback`
);
function
setSrcCallback
(
mySteps
)
{
audioPlayer
.
on
(
'
dataLoad
'
,
()
=>
{
mySteps
.
shift
();
console
.
info
(
`case dataLoad called`
);
...
...
@@ -135,7 +134,9 @@ describe('PlayerLocalTestAudioFUNC', function () {
expect
(
audioPlayer
.
state
).
assertEqual
(
'
paused
'
);
nextStep
(
mySteps
);
});
}
function
setPlayCallback
(
mySteps
)
{
audioPlayer
.
on
(
'
play
'
,
()
=>
{
mySteps
.
shift
();
console
.
info
(
`case play called`
);
...
...
@@ -149,7 +150,9 @@ describe('PlayerLocalTestAudioFUNC', function () {
expect
(
audioPlayer
.
state
).
assertEqual
(
'
playing
'
);
nextStep
(
mySteps
);
});
}
function
setPauseCallback
(
mySteps
)
{
audioPlayer
.
on
(
'
pause
'
,
()
=>
{
mySteps
.
shift
();
console
.
info
(
`case pause called`
);
...
...
@@ -158,14 +161,18 @@ describe('PlayerLocalTestAudioFUNC', function () {
expect
(
audioPlayer
.
state
).
assertEqual
(
'
paused
'
);
nextStep
(
mySteps
);
});
}
function
setResetCallback
(
mySteps
)
{
audioPlayer
.
on
(
'
reset
'
,
()
=>
{
mySteps
.
shift
();
console
.
info
(
`case reset called`
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
idle
'
);
nextStep
(
mySteps
);
});
}
function
setStopCallback
(
mySteps
)
{
audioPlayer
.
on
(
'
stop
'
,
()
=>
{
if
(
mySteps
[
0
]
==
RESET_STATE
)
{
console
.
info
(
`case reset stop called`
);
...
...
@@ -178,7 +185,9 @@ describe('PlayerLocalTestAudioFUNC', function () {
expect
(
audioPlayer
.
state
).
assertEqual
(
'
stopped
'
);
nextStep
(
mySteps
);
});
}
function
setSeekCallback
(
mySteps
)
{
audioPlayer
.
on
(
'
timeUpdate
'
,
(
seekDoneTime
)
=>
{
if
(
typeof
(
seekDoneTime
)
==
'
undefined
'
)
{
console
.
info
(
`case seek filed,errcode is
${
seekDoneTime
}
`
);
...
...
@@ -201,7 +210,9 @@ describe('PlayerLocalTestAudioFUNC', function () {
nextStep
(
mySteps
);
}
});
}
function
setVolumeCallback
(
mySteps
)
{
audioPlayer
.
on
(
'
volumeChange
'
,
()
=>
{
console
.
info
(
`case setvolume called`
);
mySteps
.
shift
();
...
...
@@ -211,7 +222,9 @@ describe('PlayerLocalTestAudioFUNC', function () {
}
nextStep
(
mySteps
);
});
}
function
setFinishCallback
(
mySteps
)
{
audioPlayer
.
on
(
'
finish
'
,
()
=>
{
mySteps
.
shift
();
expect
(
audioPlayer
.
state
).
assertEqual
(
'
stopped
'
);
...
...
@@ -219,7 +232,9 @@ describe('PlayerLocalTestAudioFUNC', function () {
console
.
info
(
`case finish called`
);
nextStep
(
mySteps
);
});
}
function
setErrorCallback
(
mySteps
)
{
audioPlayer
.
on
(
'
error
'
,
(
err
)
=>
{
console
.
info
(
`case error called,errName is
${
err
.
name
}
`
);
console
.
info
(
`case error called,errCode is
${
err
.
code
}
`
);
...
...
@@ -234,7 +249,19 @@ describe('PlayerLocalTestAudioFUNC', function () {
}
nextStep
(
mySteps
);
});
}
function
setCallback
(
mySteps
,
done
)
{
console
.
info
(
`case setCallback`
);
setSrcCallback
(
mySteps
);
setPlayCallback
(
mySteps
);
setPauseCallback
(
mySteps
);
setResetCallback
(
mySteps
);
setStopCallback
(
mySteps
);
setSeekCallback
(
mySteps
);
setVolumeCallback
(
mySteps
);
setFinishCallback
(
mySteps
);
setErrorCallback
(
mySteps
);
setTimeout
(
function
()
{
if
(
!
isTimeOut
)
{
console
.
info
(
`case is time out!`
);
...
...
multimedia/audio/audio_js_standard/audioPlayer/src/main/js/default/test/PlayerLocalTestAudioFormat.test.js
浏览文件 @
2b3a8d8c
...
...
@@ -21,11 +21,15 @@ describe('PlayerLocalTestAudioFormat', function () {
const
MAX_VOLUME
=
1
;
const
PLAY_TIME
=
3000
;
const
SEEK_TIME
=
10000
;
// 10s
let
isToSeek
=
false
;
let
isToDuration
=
false
;
beforeAll
(
function
()
{
console
.
info
(
'
beforeAll case
'
);
})
beforeEach
(
function
()
{
isToSeek
=
false
;
isToDuration
=
false
;
console
.
info
(
'
beforeEach case
'
);
})
...
...
@@ -41,24 +45,16 @@ describe('PlayerLocalTestAudioFormat', function () {
for
(
let
t
=
Date
.
now
();
Date
.
now
()
-
t
<=
time
;);
}
function
playSource
(
audioSource
,
done
)
{
let
audioPlayer
=
media
.
createAudioPlayer
();
let
isToSeek
=
false
;
let
isToDuration
=
false
;
if
(
typeof
(
audioPlayer
)
==
'
undefined
'
)
{
console
.
info
(
'
case create player is faild
'
);
expect
().
assertFail
();
done
();
return
;
}
function
setSrcCallback
(
audioPlayer
)
{
audioPlayer
.
on
(
'
dataLoad
'
,
()
=>
{
console
.
info
(
'
case set source success
'
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
paused
'
);
expect
(
audioPlayer
.
currentTime
).
assertEqual
(
0
);
audioPlayer
.
play
();
});
}
function
setPlayCallback
(
audioPlayer
)
{
audioPlayer
.
on
(
'
play
'
,
()
=>
{
console
.
info
(
'
case start to play
'
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
playing
'
);
...
...
@@ -69,13 +65,17 @@ describe('PlayerLocalTestAudioFormat', function () {
audioPlayer
.
seek
(
SEEK_TIME
);
}
});
}
function
setPauseCallback
(
audioPlayer
)
{
audioPlayer
.
on
(
'
pause
'
,
()
=>
{
console
.
info
(
'
case now is paused
'
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
paused
'
);
audioPlayer
.
setVolume
(
MAX_VOLUME
);
});
}
function
setResetCallback
(
audioPlayer
,
done
)
{
audioPlayer
.
on
(
'
reset
'
,
()
=>
{
console
.
info
(
'
case reset success
'
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
idle
'
);
...
...
@@ -83,13 +83,17 @@ describe('PlayerLocalTestAudioFormat', function () {
audioPlayer
=
undefined
;
done
();
});
}
function
setStopCallback
(
audioPlayer
)
{
audioPlayer
.
on
(
'
stop
'
,
()
=>
{
console
.
info
(
'
case stop success
'
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
stopped
'
);
audioPlayer
.
reset
();
});
}
function
setSeekCallback
(
audioPlayer
,
done
)
{
audioPlayer
.
on
(
'
timeUpdate
'
,
(
seekDoneTime
)
=>
{
if
(
typeof
(
seekDoneTime
)
==
"
undefined
"
)
{
console
.
info
(
`case seek filed,errcode is
${
seekDoneTime
}
`
);
...
...
@@ -108,19 +112,25 @@ describe('PlayerLocalTestAudioFormat', function () {
expect
(
audioPlayer
.
duration
).
assertEqual
(
seekDoneTime
);
}
});
}
function
setVolumeCallback
(
audioPlayer
)
{
audioPlayer
.
on
(
'
volumeChange
'
,
()
=>
{
console
.
info
(
'
case set volume value to
'
+
MAX_VOLUME
);
audioPlayer
.
play
();
isToSeek
=
true
;
});
}
function
setFinishCallback
(
audioPlayer
)
{
audioPlayer
.
on
(
'
finish
'
,
()
=>
{
console
.
info
(
'
case play end
'
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
stopped
'
);
audioPlayer
.
stop
();
});
}
function
setErrorCallback
(
audioPlayer
,
done
)
{
audioPlayer
.
on
(
'
error
'
,
(
err
)
=>
{
console
.
info
(
`case error called,errName is
${
err
.
name
}
`
);
console
.
info
(
`case error called,errCode is
${
err
.
code
}
`
);
...
...
@@ -129,6 +139,25 @@ describe('PlayerLocalTestAudioFormat', function () {
expect
().
assertFail
();
done
();
});
}
function
playSource
(
audioSource
,
done
)
{
let
audioPlayer
=
media
.
createAudioPlayer
();
if
(
typeof
(
audioPlayer
)
==
'
undefined
'
)
{
console
.
info
(
'
case create player is faild
'
);
expect
().
assertFail
();
done
();
return
;
}
setSrcCallback
(
audioPlayer
);
setPlayCallback
(
audioPlayer
);
setPauseCallback
(
audioPlayer
);
setResetCallback
(
audioPlayer
,
done
);
setStopCallback
(
audioPlayer
);
setSeekCallback
(
audioPlayer
,
done
);
setVolumeCallback
(
audioPlayer
);
setFinishCallback
(
audioPlayer
);
setErrorCallback
(
audioPlayer
,
done
);
audioPlayer
.
src
=
audioSource
;
}
...
...
multimedia/audio/audio_js_standard/audioPlayer_API/src/main/js/default/test/PlayerLocalTestAudioAPI.test.js
浏览文件 @
2b3a8d8c
...
...
@@ -127,8 +127,7 @@ describe('PlayerLocalTestAudioAPI', function () {
}
}
function
setCallback
(
mySteps
,
done
)
{
console
.
info
(
`case setCallback`
);
function
setSrcCallback
(
mySteps
)
{
audioPlayer
.
on
(
'
dataLoad
'
,
()
=>
{
mySteps
.
shift
();
console
.
info
(
`case dataLoad called`
);
...
...
@@ -137,7 +136,9 @@ describe('PlayerLocalTestAudioAPI', function () {
expect
(
audioPlayer
.
state
).
assertEqual
(
'
paused
'
);
nextStep
(
mySteps
);
});
}
function
setPlayCallback
(
mySteps
)
{
audioPlayer
.
on
(
'
play
'
,
()
=>
{
mySteps
.
shift
();
console
.
info
(
`case play called`
);
...
...
@@ -150,7 +151,9 @@ describe('PlayerLocalTestAudioAPI', function () {
expect
(
audioPlayer
.
state
).
assertEqual
(
'
playing
'
);
nextStep
(
mySteps
);
});
}
function
setPauseCallback
(
mySteps
)
{
audioPlayer
.
on
(
'
pause
'
,
()
=>
{
mySteps
.
shift
();
console
.
info
(
`case pause called`
);
...
...
@@ -159,14 +162,18 @@ describe('PlayerLocalTestAudioAPI', function () {
expect
(
audioPlayer
.
state
).
assertEqual
(
'
paused
'
);
nextStep
(
mySteps
);
});
}
function
setResetCallback
(
mySteps
)
{
audioPlayer
.
on
(
'
reset
'
,
()
=>
{
mySteps
.
shift
();
console
.
info
(
`case reset called`
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
idle
'
);
nextStep
(
mySteps
);
});
}
function
setStopCallback
(
mySteps
)
{
audioPlayer
.
on
(
'
stop
'
,
()
=>
{
if
(
mySteps
[
0
]
==
RESET_STATE
)
{
console
.
info
(
`case reset stop called`
);
...
...
@@ -179,7 +186,9 @@ describe('PlayerLocalTestAudioAPI', function () {
expect
(
audioPlayer
.
state
).
assertEqual
(
'
stopped
'
);
nextStep
(
mySteps
);
});
}
function
setSeekCallback
(
mySteps
)
{
audioPlayer
.
on
(
'
timeUpdate
'
,
(
seekDoneTime
)
=>
{
if
(
typeof
(
seekDoneTime
)
==
'
undefined
'
)
{
console
.
info
(
`case seek filed,errcode is
${
seekDoneTime
}
`
);
...
...
@@ -202,7 +211,9 @@ describe('PlayerLocalTestAudioAPI', function () {
nextStep
(
mySteps
);
}
});
}
function
setVolumeCallback
(
mySteps
)
{
audioPlayer
.
on
(
'
volumeChange
'
,
()
=>
{
console
.
info
(
`case setvolume called`
);
mySteps
.
shift
();
...
...
@@ -212,7 +223,9 @@ describe('PlayerLocalTestAudioAPI', function () {
}
nextStep
(
mySteps
);
});
}
function
setFinishCallback
(
mySteps
)
{
audioPlayer
.
on
(
'
finish
'
,
()
=>
{
mySteps
.
shift
();
expect
(
audioPlayer
.
state
).
assertEqual
(
'
stopped
'
);
...
...
@@ -220,7 +233,9 @@ describe('PlayerLocalTestAudioAPI', function () {
console
.
info
(
`case finish called`
);
nextStep
(
mySteps
);
});
}
function
setErrorCallback
(
mySteps
)
{
audioPlayer
.
on
(
'
error
'
,
(
err
)
=>
{
console
.
info
(
`case error called,errName is
${
err
.
name
}
`
);
console
.
info
(
`case error called,errCode is
${
err
.
code
}
`
);
...
...
@@ -240,7 +255,19 @@ describe('PlayerLocalTestAudioAPI', function () {
nextStep
(
mySteps
);
}
});
}
function
setCallback
(
mySteps
,
done
)
{
console
.
info
(
`case setCallback`
);
setSrcCallback
(
mySteps
);
setPlayCallback
(
mySteps
);
setPauseCallback
(
mySteps
);
setResetCallback
(
mySteps
);
setStopCallback
(
mySteps
);
setSeekCallback
(
mySteps
);
setVolumeCallback
(
mySteps
);
setFinishCallback
(
mySteps
);
setErrorCallback
(
mySteps
);
setTimeout
(
function
()
{
if
(
!
isTimeOut
)
{
console
.
info
(
`case is time out!`
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录