Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
8103f9e5
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看板
提交
8103f9e5
编写于
8月 31, 2021
作者:
B
bird_j
提交者:
Gitee
8月 31, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
PlayerLocalTestAudioFUNC 代码整改 Signed-off-by: bird_j <jianghongpeng@huawei.com>
上级
9d2792ed
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
821 addition
and
365 deletion
+821
-365
multimedia/audio/audio_js_standard/audioPlayer/src/main/js/default/test/PlayerLocalTestAudioFUNC.test.js
...src/main/js/default/test/PlayerLocalTestAudioFUNC.test.js
+821
-365
未找到文件。
multimedia/audio/audio_js_standard/audioPlayer/src/main/js/default/test/PlayerLocalTestAudioFUNC.test.js
浏览文件 @
8103f9e5
...
...
@@ -16,585 +16,1041 @@
import
media
from
'
@ohos.multimedia.media
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
'
PlayerLocalTestAudioAPI
'
,
function
()
{
var
audioPlayer
=
media
.
createAudioPlayer
();
var
audioSource
=
"
data/media/audio/Homey.mp3
"
;
var
PLAY_TIME
=
3000
;
var
ENDSTATE
=
0
;
var
SRCSTATE
=
1
;
var
PLAYSTATE
=
2
;
var
PAUSESTATE
=
3
;
var
STOPSTATE
=
4
;
var
RESETSTATE
=
5
;
var
SEEKSTATE
=
6
;
var
VOLUMESTATE
=
7
;
var
RELEASESTATE
=
8
;
var
ERRORSTATE
=
9
;
var
FINISHSTATE
=
10
;
var
LOOPSTATE
=
11
;
var
DURATION_TIME
=
89239
;
var
SEEK_TIME
=
5000
;
var
DELTA_TIME
=
1000
;
var
PAUSEERROR
=
'
pauseError
'
;
var
PLAYERROR
=
'
playError
'
;
var
loopValue
=
false
;
beforeAll
(
function
()
{
console
.
log
(
"
beforeAll case
"
);
})
beforeEach
(
function
()
{
console
.
log
(
"
beforeEach case
"
);
})
afterEach
(
function
()
{
console
.
log
(
"
afterEach case
"
);
audioPlayer
.
release
();
describe
(
'
PlayerLocalTestAudioFUNC
'
,
function
()
{
let
audioPlayer
=
media
.
createAudioPlayer
();
let
isTimeOut
=
false
;
const
AUDIO_SOURCE
=
"
file://data/media/audio/Homey.mp3
"
;
const
PLAY_TIME
=
3000
;
const
DURATION_TIME
=
89239
;
const
SEEK_TIME
=
5000
;
const
DELTA_TIME
=
1000
;
const
END_STATE
=
0
;
const
SRC_STATE
=
1
;
const
PLAY_STATE
=
2
;
const
PAUSE_STATE
=
3
;
const
STOP_STATE
=
4
;
const
RESET_STATE
=
5
;
const
SEEK_STATE
=
6
;
const
VOLUME_STATE
=
7
;
const
RELEASE_STATE
=
8
;
const
ERROR_STATE
=
9
;
const
FINISH_STATE
=
10
;
const
LOOP_STATE
=
11
;
const
SECOND_INDEX
=
1
;
const
RAND_NUM
=
5
;
const
TIME_OUT
=
35000
;
const
MAX_VOLUME
=
1
;
beforeAll
(
function
()
{
console
.
info
(
"
beforeAll case
"
);
})
afterAll
(
function
()
{
console
.
log
(
"
afterAll case
"
);
beforeEach
(
function
()
{
isTimeOut
=
false
;
console
.
info
(
"
beforeEach case
"
);
})
var
sleep
=
function
(
time
)
{
for
(
var
t
=
Date
.
now
();
Date
.
now
()
-
t
<=
time
;
);
}
;
afterEach
(
function
(
)
{
console
.
info
(
"
afterEach case
"
);
}
)
var
initAudioPlayer
=
function
()
{
audioPlayer
=
media
.
createAudioPlayer
();
afterAll
(
function
()
{
console
.
info
(
"
afterAll case
"
);
})
function
sleep
(
time
)
{
for
(
let
t
=
Date
.
now
();
Date
.
now
()
-
t
<=
time
;);
}
var
nextStep
=
function
(
mySteps
,
done
)
{
if
(
mySteps
[
0
]
==
ENDSTATE
)
{
if
(
mySteps
[
1
]
==
false
||
mySteps
[
1
]
==
true
)
{
expect
(
audioPlayer
.
loop
).
assertEqual
(
mySteps
[
1
]);
function
initAudioPlayer
()
{
audioPlayer
=
media
.
createAudioPlayer
();
}
done
();
function
nextStep
(
mySteps
)
{
if
(
mySteps
[
0
]
==
END_STATE
)
{
isTimeOut
=
true
;
return
;
}
switch
(
mySteps
[
0
])
{
case
SRCSTATE
:
console
.
log
(
`case to prepare`
);
audioPlayer
.
src
=
audioSource
;
case
SRC
_
STATE
:
console
.
info
(
`case to prepare`
);
audioPlayer
.
src
=
AUDIO_SOURCE
;
break
;
case
PLAYSTATE
:
console
.
log
(
`case to play`
);
case
PLAY
_
STATE
:
console
.
info
(
`case to play`
);
audioPlayer
.
play
();
break
;
case
PAUSESTATE
:
console
.
log
(
`case to pause`
);
case
PAUSE
_
STATE
:
console
.
info
(
`case to pause`
);
audioPlayer
.
pause
();
break
;
case
STOPSTATE
:
console
.
log
(
`case to stop`
);
case
STOP
_
STATE
:
console
.
info
(
`case to stop`
);
audioPlayer
.
stop
();
break
;
case
RESETSTATE
:
console
.
log
(
`case to reset`
);
case
RESET
_
STATE
:
console
.
info
(
`case to reset`
);
audioPlayer
.
reset
();
break
;
case
SEEKSTATE
:
console
.
log
(
`case seek to time is
${
mySteps
[
1
]}
`
);
audioPlayer
.
seek
(
mySteps
[
1
]);
case
SEEK
_
STATE
:
console
.
info
(
`case seek to time is
${
mySteps
[
SECOND_INDEX
]}
`
);
audioPlayer
.
seek
(
mySteps
[
SECOND_INDEX
]);
break
;
case
VOLUMESTATE
:
console
.
log
(
`case to setVolume`
);
audioPlayer
.
setVolume
(
mySteps
[
1
]);
case
VOLUME
_
STATE
:
console
.
info
(
`case to setVolume`
);
audioPlayer
.
setVolume
(
mySteps
[
SECOND_INDEX
]);
break
;
case
RELEASESTATE
:
console
.
log
(
`case to release`
);
case
RELEASE
_
STATE
:
console
.
info
(
`case to release`
);
mySteps
.
shift
();
audioPlayer
.
release
();
nextStep
(
mySteps
,
done
);
break
;
case
LOOPSTATE
:
loopValue
=
mySteps
[
1
];
case
LOOP
_
STATE
:
audioPlayer
.
loop
=
mySteps
[
SECOND_INDEX
];
mySteps
.
shift
();
mySteps
.
shift
();
audioPlayer
.
loop
=
loopValue
;
nextStep
(
mySteps
,
done
);
nextStep
(
mySteps
);
break
;
default
:
break
;
}
}
var
setCallback
=
function
(
mySteps
,
done
)
{
console
.
log
(
`case setCallback`
);
function
setCallback
(
mySteps
)
{
console
.
info
(
`case setCallback`
);
audioPlayer
.
on
(
'
dataLoad
'
,
()
=>
{
mySteps
.
shift
();
console
.
log
(
`case dataLoad called`
);
console
.
info
(
`case dataLoad called`
);
expect
(
audioPlayer
.
currentTime
).
assertEqual
(
0
);
expect
(
audioPlayer
.
duration
).
assertEqual
(
DURATION_TIME
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
paused
'
);
nextStep
(
mySteps
,
done
);
nextStep
(
mySteps
);
});
audioPlayer
.
on
(
'
play
'
,
()
=>
{
mySteps
.
shift
();
console
.
log
(
`case play called`
);
console
.
log
(
`case play currentTime is
${
audioPlayer
.
currentTime
}
`
);
console
.
info
(
`case play called`
);
sleep
(
PLAY_TIME
);
console
.
info
(
`case play currentTime is
${
audioPlayer
.
currentTime
}
`
);
expect
(
audioPlayer
.
duration
).
assertEqual
(
DURATION_TIME
);
if
(
mySteps
[
0
]
==
FINISHSTATE
)
{
console
.
log
(
`case wait for finish`
);
if
(
mySteps
[
0
]
==
FINISH
_
STATE
)
{
console
.
info
(
`case wait for finish`
);
return
;
}
expect
(
audioPlayer
.
state
).
assertEqual
(
'
playing
'
);
nextStep
(
mySteps
,
done
);
nextStep
(
mySteps
);
});
audioPlayer
.
on
(
'
pause
'
,
()
=>
{
mySteps
.
shift
();
console
.
log
(
`case pause called`
);
console
.
log
(
`case pause currentTime is
${
audioPlayer
.
currentTime
}
`
);
console
.
info
(
`case pause called`
);
console
.
info
(
`case pause currentTime is
${
audioPlayer
.
currentTime
}
`
);
expect
(
audioPlayer
.
duration
).
assertEqual
(
DURATION_TIME
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
paused
'
);
nextStep
(
mySteps
,
done
);
nextStep
(
mySteps
);
});
audioPlayer
.
on
(
'
reset
'
,
()
=>
{
mySteps
.
shift
();
console
.
log
(
`case reset called`
);
console
.
info
(
`case reset called`
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
idle
'
);
nextStep
(
mySteps
,
done
);
nextStep
(
mySteps
);
});
audioPlayer
.
on
(
'
stop
'
,
()
=>
{
if
(
mySteps
[
0
]
==
RESET_STATE
)
{
console
.
info
(
`case reset stop called`
);
return
;
}
mySteps
.
shift
();
console
.
log
(
`case stop called`
);
console
.
info
(
`case stop called`
);
expect
(
audioPlayer
.
currentTime
).
assertEqual
(
0
);
expect
(
audioPlayer
.
duration
).
assertEqual
(
DURATION_TIME
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
stopped
'
);
nextStep
(
mySteps
,
done
);
nextStep
(
mySteps
);
});
audioPlayer
.
on
(
'
timeUpdate
'
,
(
seekDoneTime
)
=>
{
if
(
typeof
(
seekDoneTime
)
==
"
undefined
"
)
{
console
.
log
(
`case seek filed,errcode is
${
seekDoneTime
}
`
);
console
.
info
(
`case seek filed,errcode is
${
seekDoneTime
}
`
);
return
;
}
if
(
mySteps
[
0
]
!=
SEEK_STATE
)
{
return
;
}
mySteps
.
shift
();
mySteps
.
shift
();
console
.
log
(
`case seekDoneTime is
${
seekDoneTime
}
`
);
console
.
log
(
`case seek called`
);
console
.
info
(
`case seekDoneTime is
${
seekDoneTime
}
`
);
console
.
info
(
`case seek called`
);
expect
(
audioPlayer
.
currentTime
+
DELTA_TIME
).
assertClose
(
seekDoneTime
+
DELTA_TIME
,
DELTA_TIME
);
console
.
log
(
`case loop is
${
audioPlayer
.
loop
}
`
);
console
.
info
(
`case loop is
${
audioPlayer
.
loop
}
`
);
if
((
audioPlayer
.
loop
==
true
)
&&
(
seekDoneTime
==
DURATION_TIME
))
{
console
.
log
(
'
case loop is true
'
);
sleep
(
PLAYSTATE
);
console
.
info
(
'
case loop is true
'
);
sleep
(
PLAY
_
STATE
);
}
if
(
seekDoneTime
<
audioPlayer
.
duration
||
audioPlayer
.
state
==
"
paused
"
)
{
nextStep
(
mySteps
,
done
);
if
(
(
seekDoneTime
<
audioPlayer
.
duration
)
||
(
audioPlayer
.
state
==
"
paused
"
)
)
{
nextStep
(
mySteps
);
}
});
audioPlayer
.
on
(
'
volumeChange
'
,
()
=>
{
console
.
log
(
`case setvolume called`
);
console
.
info
(
`case setvolume called`
);
mySteps
.
shift
();
mySteps
.
shift
();
if
(
audioPlayer
.
state
==
"
playing
"
)
{
sleep
(
PLAY_TIME
);
}
nextStep
(
mySteps
,
done
);
nextStep
(
mySteps
);
});
audioPlayer
.
on
(
'
finish
'
,
()
=>
{
mySteps
.
shift
();
expect
(
audioPlayer
.
state
).
assertEqual
(
'
stopped
'
);
expect
(
audioPlayer
.
currentTime
).
assertClose
(
audioPlayer
.
duration
,
DELTA_TIME
);
console
.
log
(
`case finish called`
);
nextStep
(
mySteps
,
done
);
console
.
info
(
`case finish called`
);
nextStep
(
mySteps
);
});
audioPlayer
.
on
(
'
error
'
,
(
err
)
=>
{
console
.
log
(
`case error called,errName is
${
err
.
name
}
`
);
console
.
log
(
`case error called,errCode is
${
err
.
code
}
`
);
console
.
log
(
`case error called,errMessage is
${
err
.
message
}
`
);
if
((
mySteps
[
0
]
==
SEEKSTATE
)
||
(
mySteps
[
0
]
==
VOLUMESTATE
))
{
expect
(
mySteps
[
2
]).
assertEqual
(
ERRORSTATE
);
mySteps
.
shift
();
mySteps
.
shift
();
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
}
`
);
if
((
mySteps
[
0
]
==
SEEK_STATE
)
||
(
mySteps
[
0
]
==
VOLUME_STATE
))
{
mySteps
.
shift
();
mySteps
.
shift
();
nextStep
(
mySteps
,
done
);
}
else
if
(
mySteps
[
0
]
==
ERRORSTATE
)
{
mySteps
.
shift
();
mySteps
.
shift
();
}
else
if
(
mySteps
[
0
]
==
ENDSTATE
)
{
console
.
log
(
'
case release player error
'
);
}
else
{
expect
(
mySteps
[
1
]).
assertEqual
(
ERRORSTATE
);
mySteps
.
shift
();
mySteps
.
shift
();
mySteps
.
shift
();
nextStep
(
mySteps
,
done
);
}
nextStep
(
mySteps
);
});
};
/* *
* @tc.number : SUB_MEDIA_PLAYER_
AudioPlayer_Play_API_02
00
* @tc.name : 0
2.play操作在pause之后
* @tc.desc :
* @tc.size : M
EDIUM
* @tc.type :
API T
est
* @tc.level : Level
2
* @tc.number : SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_01
00
* @tc.name : 0
01.play
* @tc.desc :
Audio playback control test
* @tc.size : M
ediumTest
* @tc.type :
Function t
est
* @tc.level : Level
0
*/
it
(
'
SUB_MEDIA_PLAYER_
AudioPlayer_Play_API_02
00
'
,
0
,
async
function
(
done
)
{
var
mySteps
=
new
Array
(
SRCSTATE
,
PLAYSTATE
,
PAUSESTATE
,
PLAYSTATE
,
END
STATE
);
it
(
'
SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_01
00
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
END_
STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
audioSource
;
setCallback
(
mySteps
);
audioPlayer
.
src
=
AUDIO_SOURCE
;
setTimeout
(
function
()
{
if
(
!
isTimeOut
)
{
console
.
info
(
`case is time out!`
);
expect
(
isTimeOut
).
assertTrue
();
}
done
();
},
TIME_OUT
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_
AudioPlayer_Play_API_03
00
* @tc.name : 0
3.play操作在stop之后
* @tc.desc :
* @tc.size : M
EDIUM
* @tc.type :
API T
est
* @tc.level : Level
2
* @tc.number : SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_02
00
* @tc.name : 0
02.play->pause
* @tc.desc :
Audio playback control test
* @tc.size : M
ediumTestTest
* @tc.type :
Function t
est
* @tc.level : Level
0
*/
it
(
'
SUB_MEDIA_PLAYER_
AudioPlayer_Play_API_03
00
'
,
0
,
async
function
(
done
)
{
var
mySteps
=
new
Array
(
SRCSTATE
,
PLAYSTATE
,
STOPSTATE
,
PLAYSTATE
,
ERRORSTATE
,
PLAYERROR
,
END
STATE
);
it
(
'
SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_02
00
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
RESET_STATE
,
END_
STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
audioSource
;
setCallback
(
mySteps
);
audioPlayer
.
src
=
AUDIO_SOURCE
;
setTimeout
(
function
()
{
if
(
!
isTimeOut
)
{
console
.
info
(
`case is time out!`
);
expect
(
isTimeOut
).
assertTrue
();
}
done
();
},
TIME_OUT
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_
AudioPlayer_Play_API_04
00
* @tc.name : 0
4.play操作在seek之后
* @tc.desc :
* @tc.size : M
EDIUM
* @tc.type :
API T
est
* @tc.level : Level
2
* @tc.number : SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_03
00
* @tc.name : 0
03.play->pause->play->reset
* @tc.desc :
Audio playback control test
* @tc.size : M
ediumTest
* @tc.type :
Function t
est
* @tc.level : Level
0
*/
it
(
'
SUB_MEDIA_PLAYER_
AudioPlayer_Play_API_04
00
'
,
0
,
async
function
(
done
)
{
var
mySteps
=
new
Array
(
SRCSTATE
,
PLAYSTATE
,
PAUSESTATE
,
SEEKSTATE
,
SEEK_TIME
,
PLAYSTATE
,
END
STATE
);
it
(
'
SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_03
00
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
PLAY_STATE
,
RESET_STATE
,
END_
STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
audioSource
;
setCallback
(
mySteps
);
audioPlayer
.
src
=
AUDIO_SOURCE
;
setTimeout
(
function
()
{
if
(
!
isTimeOut
)
{
console
.
info
(
`case is time out!`
);
expect
(
isTimeOut
).
assertTrue
();
}
done
();
},
TIME_OUT
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_
AudioPlayer_Play_API_08
00
* @tc.name : 0
8.play操作在reset之后
* @tc.desc :
* @tc.size : M
EDIUM
* @tc.type :
API T
est
* @tc.level : Level
2
* @tc.number : SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_05
00
* @tc.name : 0
05.play->reset
* @tc.desc :
Audio playback control test
* @tc.size : M
ediumTest
* @tc.type :
Function t
est
* @tc.level : Level
0
*/
it
(
'
SUB_MEDIA_PLAYER_
AudioPlayer_Play_API_08
00
'
,
0
,
async
function
(
done
)
{
var
mySteps
=
new
Array
(
SRCSTATE
,
RESETSTATE
,
PLAYSTATE
,
ERRORSTATE
,
PLAYERROR
,
END
STATE
);
it
(
'
SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_05
00
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
RESET_STATE
,
END_
STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
audioSource
;
setCallback
(
mySteps
);
audioPlayer
.
src
=
AUDIO_SOURCE
;
setTimeout
(
function
()
{
if
(
!
isTimeOut
)
{
console
.
info
(
`case is time out!`
);
expect
(
isTimeOut
).
assertTrue
();
}
done
();
},
TIME_OUT
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_
AudioPlayer_Play_API_09
00
* @tc.name : 0
9.play操作在release之后
* @tc.desc :
* @tc.size : M
EDIUM
* @tc.type :
API T
est
* @tc.level : Level
2
* @tc.number : SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_06
00
* @tc.name : 0
06.play->pause->play->pause
* @tc.desc :
Audio playback control test
* @tc.size : M
ediumTest
* @tc.type :
Function t
est
* @tc.level : Level
0
*/
it
(
'
SUB_MEDIA_PLAYER_
AudioPlayer_Play_API_09
00
'
,
0
,
async
function
(
done
)
{
var
mySteps
=
new
Array
(
SRCSTATE
,
RELEASESTATE
,
PLAYSTATE
,
ERRORSTATE
,
PLAYERROR
,
END
STATE
);
it
(
'
SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_06
00
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
END_
STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
audioSource
;
setCallback
(
mySteps
);
audioPlayer
.
src
=
AUDIO_SOURCE
;
setTimeout
(
function
()
{
if
(
!
isTimeOut
)
{
console
.
info
(
`case is time out!`
);
expect
(
isTimeOut
).
assertTrue
();
}
done
();
},
TIME_OUT
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_
AudioPlayer_Pause_API_01
00
* @tc.name : 0
1.pause操作在createAudioPlayer之后
* @tc.desc :
* @tc.size : M
EDIUM
* @tc.type :
API T
est
* @tc.level : Level
2
* @tc.number : SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_07
00
* @tc.name : 0
07.play->pause->stop
* @tc.desc :
Audio playback control test
* @tc.size : M
ediumTest
* @tc.type :
Function t
est
* @tc.level : Level
0
*/
it
(
'
SUB_MEDIA_PLAYER_
AudioPlayer_Pause_API_01
00
'
,
0
,
async
function
(
done
)
{
var
mySteps
=
new
Array
(
PAUSESTATE
,
ERRORSTATE
,
PAUSEERROR
,
END
STATE
);
it
(
'
SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_07
00
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
STOP_STATE
,
END_
STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
pause
();
setCallback
(
mySteps
);
audioPlayer
.
src
=
AUDIO_SOURCE
;
setTimeout
(
function
()
{
if
(
!
isTimeOut
)
{
console
.
info
(
`case is time out!`
);
expect
(
isTimeOut
).
assertTrue
();
}
done
();
},
TIME_OUT
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_
AudioPlayer_Pause_API_02
00
* @tc.name : 0
2.pause操作在play之后
* @tc.desc :
* @tc.size : M
EDIUM
* @tc.type :
API T
est
* @tc.level : Level
2
* @tc.number : SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_08
00
* @tc.name : 0
08.play->pause->play->stop
* @tc.desc :
Audio playback control test
* @tc.size : M
ediumTest
* @tc.type :
Function t
est
* @tc.level : Level
0
*/
it
(
'
SUB_MEDIA_PLAYER_
AudioPlayer_Pause_API_02
00
'
,
0
,
async
function
(
done
)
{
var
mySteps
=
new
Array
(
SRCSTATE
,
PLAYSTATE
,
PAUSESTATE
,
END
STATE
);
it
(
'
SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_08
00
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
PLAY_STATE
,
STOP_STATE
,
END_
STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
audioSource
;
setCallback
(
mySteps
);
audioPlayer
.
src
=
AUDIO_SOURCE
;
setTimeout
(
function
()
{
if
(
!
isTimeOut
)
{
console
.
info
(
`case is time out!`
);
expect
(
isTimeOut
).
assertTrue
();
}
done
();
},
TIME_OUT
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_
AudioPlayer_Pause_API_03
00
* @tc.name : 0
2.pause操作在stop之后
* @tc.desc :
* @tc.size : M
EDIUM
* @tc.type :
API T
est
* @tc.level : Level
2
* @tc.number : SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_09
00
* @tc.name : 0
09.play->stop->reset->play->pause->play->reset
* @tc.desc :
Audio playback control test
* @tc.size : M
ediumTest
* @tc.type :
Function t
est
* @tc.level : Level
0
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Pause_API_0300
'
,
0
,
async
function
(
done
)
{
var
mySteps
=
new
Array
(
PLAYSTATE
,
STOPSTATE
,
PAUSESTATE
,
ERRORSTATE
,
PAUSEERROR
,
ENDSTATE
);
it
(
'
SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_0900
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
STOP_STATE
,
RESET_STATE
,
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
PLAY_STATE
,
RESET_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
audioSource
;
setCallback
(
mySteps
);
audioPlayer
.
src
=
AUDIO_SOURCE
;
setTimeout
(
function
()
{
if
(
!
isTimeOut
)
{
console
.
info
(
`case is time out!`
);
expect
(
isTimeOut
).
assertTrue
();
}
done
();
},
TIME_OUT
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_
AudioPlayer_Pause_API_04
00
* @tc.name : 0
4.pause操作在seek之后
* @tc.desc :
* @tc.size : M
EDIUM
* @tc.type :
API T
est
* @tc.level : Level
2
* @tc.number : SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_10
00
* @tc.name : 0
10.play->pause->stop->reset->play->pause->reset
* @tc.desc :
Audio playback control test
* @tc.size : M
ediumTest
* @tc.type :
Function t
est
* @tc.level : Level
0
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Pause_API_0400
'
,
0
,
async
function
(
done
)
{
var
mySteps
=
new
Array
(
SRCSTATE
,
PLAYSTATE
,
SEEKSTATE
,
SEEK_TIME
,
PAUSESTATE
,
ENDSTATE
);
it
(
'
SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_1000
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
STOP_STATE
,
RESET_STATE
,
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
RESET_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
audioSource
;
setCallback
(
mySteps
);
audioPlayer
.
src
=
AUDIO_SOURCE
;
setTimeout
(
function
()
{
if
(
!
isTimeOut
)
{
console
.
info
(
`case is time out!`
);
expect
(
isTimeOut
).
assertTrue
();
}
done
();
},
TIME_OUT
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_1100
* @tc.name : 011.play->stop->reset->play->reset
* @tc.desc : Audio playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_1100
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
STOP_STATE
,
RESET_STATE
,
SRC_STATE
,
PLAY_STATE
,
RESET_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
);
audioPlayer
.
src
=
AUDIO_SOURCE
;
setTimeout
(
function
()
{
if
(
!
isTimeOut
)
{
console
.
info
(
`case is time out!`
);
expect
(
isTimeOut
).
assertTrue
();
}
done
();
},
TIME_OUT
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_
AudioPlayer_Stop_API_0
200
* @tc.name : 0
2.stop操作在play之后
* @tc.desc :
* @tc.size : M
EDIUM
* @tc.type :
API T
est
* @tc.level : Level
2
* @tc.number : SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_1
200
* @tc.name : 0
12.play->pause->play->reset
* @tc.desc :
Audio playback control test
* @tc.size : M
ediumTest
* @tc.type :
Function t
est
* @tc.level : Level
0
*/
it
(
'
SUB_MEDIA_PLAYER_
AudioPlayer_Stop_API_0
200
'
,
0
,
async
function
(
done
)
{
var
mySteps
=
new
Array
(
SRCSTATE
,
PLAYSTATE
,
STOPSTATE
,
END
STATE
);
it
(
'
SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_1
200
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
PLAY_STATE
,
RESET_STATE
,
END_
STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
audioSource
;
setCallback
(
mySteps
);
audioPlayer
.
src
=
AUDIO_SOURCE
;
setTimeout
(
function
()
{
if
(
!
isTimeOut
)
{
console
.
info
(
`case is time out!`
);
expect
(
isTimeOut
).
assertTrue
();
}
done
();
},
TIME_OUT
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_
AudioPlayer_Stop_API_0
300
* @tc.name : 0
3.stop操作在pause之后
* @tc.desc :
* @tc.size : M
EDIUM
* @tc.type :
API T
est
* @tc.level : Level
2
* @tc.number : SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_1
300
* @tc.name : 0
13.play->stop->pause
* @tc.desc :
Audio playback control test
* @tc.size : M
ediumTest
* @tc.type :
Function t
est
* @tc.level : Level
0
*/
it
(
'
SUB_MEDIA_PLAYER_
AudioPlayer_Stop_API_0
300
'
,
0
,
async
function
(
done
)
{
var
mySteps
=
new
Array
(
SRCSTATE
,
PLAYSTATE
,
PAUSESTATE
,
STOPSTATE
,
END
STATE
);
it
(
'
SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_1
300
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
STOP_STATE
,
PAUSE_STATE
,
ERROR_STATE
,
END_
STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
audioSource
;
setCallback
(
mySteps
);
audioPlayer
.
src
=
AUDIO_SOURCE
;
setTimeout
(
function
()
{
if
(
!
isTimeOut
)
{
console
.
info
(
`case is time out!`
);
expect
(
isTimeOut
).
assertTrue
();
}
done
();
},
TIME_OUT
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_
AudioPlayer_Stop_API_0
400
* @tc.name : 0
4.stop操作在seek之后
* @tc.desc :
* @tc.size : M
EDIUM
* @tc.type :
API T
est
* @tc.level : Level
2
* @tc.number : SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_1
400
* @tc.name : 0
14.play->seek->pause
* @tc.desc :
Audio playback control test
* @tc.size : M
ediumTest
* @tc.type :
Function t
est
* @tc.level : Level
0
*/
it
(
'
SUB_MEDIA_PLAYER_
AudioPlayer_Stop_API_0
400
'
,
0
,
async
function
(
done
)
{
var
mySteps
=
new
Array
(
SRCSTATE
,
PLAYSTATE
,
SEEKSTATE
,
SEEK_TIME
,
STOPSTATE
,
END
STATE
);
it
(
'
SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_1
400
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
SEEK_STATE
,
0
,
PAUSE_STATE
,
END_
STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
audioSource
;
setCallback
(
mySteps
);
audioPlayer
.
src
=
AUDIO_SOURCE
;
setTimeout
(
function
()
{
if
(
!
isTimeOut
)
{
console
.
info
(
`case is time out!`
);
expect
(
isTimeOut
).
assertTrue
();
}
done
();
},
TIME_OUT
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_
AudioPlayer_Seek_API_02
00
* @tc.name : 0
2.seek操作在play之后
* @tc.desc :
* @tc.size : M
EDIUM
* @tc.type :
API T
est
* @tc.level : Level
2
* @tc.number : SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_15
00
* @tc.name : 0
15.play->pause->seek(duration)
* @tc.desc :
Audio playback control test
* @tc.size : M
ediumTest
* @tc.type :
Function t
est
* @tc.level : Level
0
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Seek_API_0200
'
,
0
,
async
function
(
done
)
{
var
mySteps
=
new
Array
(
SRCSTATE
,
PLAYSTATE
,
SEEKSTATE
,
SEEK_TIME
,
ENDSTATE
);
it
(
'
SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_1500
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
SEEK_STATE
,
DURATION_TIME
,
PLAY_STATE
,
FINISH_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
audioSource
;
setCallback
(
mySteps
);
audioPlayer
.
src
=
AUDIO_SOURCE
;
setTimeout
(
function
()
{
if
(
!
isTimeOut
)
{
console
.
info
(
`case is time out!`
);
expect
(
isTimeOut
).
assertTrue
();
}
done
();
},
TIME_OUT
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_
AudioPlayer_Seek_API_03
00
* @tc.name : 0
3.seek操作在pause之后
* @tc.desc :
* @tc.size : M
EDIUM
* @tc.type :
API T
est
* @tc.level : Level
2
* @tc.number : SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_16
00
* @tc.name : 0
16.play->pause->play->seek(0)->pause
* @tc.desc :
Audio playback control test
* @tc.size : M
ediumTest
* @tc.type :
Function t
est
* @tc.level : Level
0
*/
it
(
'
SUB_MEDIA_PLAYER_
AudioPlayer_Seek_API_03
00
'
,
0
,
async
function
(
done
)
{
var
mySteps
=
new
Array
(
SRCSTATE
,
PLAYSTATE
,
PAUSESTATE
,
SEEKSTATE
,
SEEK_TIME
,
END
STATE
);
it
(
'
SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_16
00
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
PLAY_STATE
,
SEEK_STATE
,
0
,
PAUSE_STATE
,
END_
STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
audioSource
;
setCallback
(
mySteps
);
audioPlayer
.
src
=
AUDIO_SOURCE
;
setTimeout
(
function
()
{
if
(
!
isTimeOut
)
{
console
.
info
(
`case is time out!`
);
expect
(
isTimeOut
).
assertTrue
();
}
done
();
},
TIME_OUT
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_
AudioPlayer_Seek_API_09
00
* @tc.name :
9.seek到起始位置(0)
* @tc.desc :
* @tc.size : M
EDIUM
* @tc.type :
API T
est
* @tc.level : Level
2
* @tc.number : SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_17
00
* @tc.name :
017.play->seek(0)->reset
* @tc.desc :
Audio playback control test
* @tc.size : M
ediumTest
* @tc.type :
Function t
est
* @tc.level : Level
0
*/
it
(
'
SUB_MEDIA_PLAYER_
AudioPlayer_Seek_API_09
00
'
,
0
,
async
function
(
done
)
{
var
mySteps
=
new
Array
(
SRCSTATE
,
PLAYSTATE
,
SEEKSTATE
,
0
,
END
STATE
);
it
(
'
SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_17
00
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
SEEK_STATE
,
0
,
RESET_STATE
,
END_
STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
audioSource
;
setCallback
(
mySteps
);
audioPlayer
.
src
=
AUDIO_SOURCE
;
setTimeout
(
function
()
{
if
(
!
isTimeOut
)
{
console
.
info
(
`case is time out!`
);
expect
(
isTimeOut
).
assertTrue
();
}
done
();
},
TIME_OUT
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_
AudioPlayer_Reset_API_02
00
* @tc.name : 0
2.reset操作在play之后
* @tc.desc :
* @tc.size : M
EDIUM
* @tc.type :
API T
est
* @tc.level : Level
2
* @tc.number : SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_18
00
* @tc.name : 0
18.play->seek->stop->reset
* @tc.desc :
Audio playback control test
* @tc.size : M
ediumTest
* @tc.type :
Function t
est
* @tc.level : Level
0
*/
it
(
'
SUB_MEDIA_PLAYER_
AudioPlayer_Reset_API_02
00
'
,
0
,
async
function
(
done
)
{
var
mySteps
=
new
Array
(
SRCSTATE
,
PLAYSTATE
,
RESETSTATE
,
END
STATE
);
it
(
'
SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_18
00
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
SEEK_STATE
,
0
,
STOP_STATE
,
RESET_STATE
,
END_
STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
audioSource
;
setCallback
(
mySteps
);
audioPlayer
.
src
=
AUDIO_SOURCE
;
setTimeout
(
function
()
{
if
(
!
isTimeOut
)
{
console
.
info
(
`case is time out!`
);
expect
(
isTimeOut
).
assertTrue
();
}
done
();
},
TIME_OUT
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_
AudioPlayer_Reset_API_03
00
* @tc.name : 0
3.reset操作在pause之后
* @tc.desc :
* @tc.size : M
EDIUM
* @tc.type :
API T
est
* @tc.level : Level
2
* @tc.number : SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_19
00
* @tc.name : 0
19.play->stop->seek
* @tc.desc :
Audio playback control test
* @tc.size : M
ediumTest
* @tc.type :
Function t
est
* @tc.level : Level
0
*/
it
(
'
SUB_MEDIA_PLAYER_
AudioPlayer_Reset_API_03
00
'
,
0
,
async
function
(
done
)
{
var
mySteps
=
new
Array
(
SRCSTATE
,
PLAYSTATE
,
PAUSESTATE
,
RESETSTATE
,
END
STATE
);
it
(
'
SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_19
00
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
STOP_STATE
,
SEEK_STATE
,
0
,
ERROR_STATE
,
END_
STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
audioSource
;
setCallback
(
mySteps
);
audioPlayer
.
src
=
AUDIO_SOURCE
;
setTimeout
(
function
()
{
if
(
!
isTimeOut
)
{
console
.
info
(
`case is time out!`
);
expect
(
isTimeOut
).
assertTrue
();
}
done
();
},
TIME_OUT
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_
AudioPlayer_Release_API_02
00
* @tc.name : 02
.release操作在play之后
* @tc.desc :
* @tc.size : M
EDIUM
* @tc.type :
API T
est
* @tc.level : Level
2
* @tc.number : SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_20
00
* @tc.name : 02
0.play->pause->seek->reset
* @tc.desc :
Audio playback control test
* @tc.size : M
ediumTest
* @tc.type :
Function t
est
* @tc.level : Level
0
*/
it
(
'
SUB_MEDIA_PLAYER_
AudioPlayer_Release_API_02
00
'
,
0
,
async
function
(
done
)
{
var
mySteps
=
new
Array
(
SRCSTATE
,
PLAYSTATE
,
RELEASESTATE
,
END
STATE
);
it
(
'
SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_20
00
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
SEEK_STATE
,
0
,
RESET_STATE
,
END_
STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
audioSource
;
setCallback
(
mySteps
);
audioPlayer
.
src
=
AUDIO_SOURCE
;
setTimeout
(
function
()
{
if
(
!
isTimeOut
)
{
console
.
info
(
`case is time out!`
);
expect
(
isTimeOut
).
assertTrue
();
}
done
();
},
TIME_OUT
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_
AudioPlayer_Release_API_03
00
* @tc.name : 0
3.release操作在pause之后
* @tc.desc :
* @tc.size : M
EDIUM
* @tc.type :
API T
est
* @tc.level : Level
2
* @tc.number : SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_21
00
* @tc.name : 0
21.play->pause->seek->stop
* @tc.desc :
Audio playback control test
* @tc.size : M
ediumTest
* @tc.type :
Function t
est
* @tc.level : Level
0
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Release_API_0300
'
,
0
,
async
function
(
done
)
{
var
mySteps
=
new
Array
(
SRCSTATE
,
PLAYSTATE
,
PAUSESTATE
,
RELEASESTATE
,
ENDSTATE
);
it
(
'
SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_2100
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
SEEK_STATE
,
DURATION_TIME
/
RAND_NUM
,
STOP_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
audioSource
;
setCallback
(
mySteps
);
audioPlayer
.
src
=
AUDIO_SOURCE
;
setTimeout
(
function
()
{
if
(
!
isTimeOut
)
{
console
.
info
(
`case is time out!`
);
expect
(
isTimeOut
).
assertTrue
();
}
done
();
},
TIME_OUT
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_
AudioPlayer_Release_API_04
00
* @tc.name : 0
4.release操作在stop之后
* @tc.desc :
* @tc.size : M
EDIUM
* @tc.type :
API T
est
* @tc.level : Level
2
* @tc.number : SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_22
00
* @tc.name : 0
22.play->pause->play->seek(0)
* @tc.desc :
Audio playback control test
* @tc.size : M
ediumTest
* @tc.type :
Function t
est
* @tc.level : Level
0
*/
it
(
'
SUB_MEDIA_PLAYER_
AudioPlayer_Release_API_04
00
'
,
0
,
async
function
(
done
)
{
var
mySteps
=
new
Array
(
SRCSTATE
,
PLAYSTATE
,
STOPSTATE
,
RELEASESTATE
,
END
STATE
);
it
(
'
SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_22
00
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
PLAY_STATE
,
SEEK_STATE
,
0
,
END_
STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
audioSource
;
setCallback
(
mySteps
);
audioPlayer
.
src
=
AUDIO_SOURCE
;
setTimeout
(
function
()
{
if
(
!
isTimeOut
)
{
console
.
info
(
`case is time out!`
);
expect
(
isTimeOut
).
assertTrue
();
}
done
();
},
TIME_OUT
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_
AudioPlayer_Release_API_05
00
* @tc.name : 0
5.release操作在seek之后
* @tc.desc :
* @tc.size : M
EDIUM
* @tc.type :
API T
est
* @tc.level : Level
2
* @tc.number : SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_23
00
* @tc.name : 0
23.play->pause->play->seek(0)->stop
* @tc.desc :
Audio playback control test
* @tc.size : M
ediumTest
* @tc.type :
Function t
est
* @tc.level : Level
0
*/
it
(
'
SUB_MEDIA_PLAYER_
AudioPlayer_Release_API_05
00
'
,
0
,
async
function
(
done
)
{
var
mySteps
=
new
Array
(
SRCSTATE
,
PLAYSTATE
,
SEEKSTATE
,
SEEK_TIME
,
RELEASESTATE
,
END
STATE
);
it
(
'
SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_23
00
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
PLAY_STATE
,
SEEK_STATE
,
0
,
STOP_STATE
,
END_
STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
audioSource
;
setCallback
(
mySteps
);
audioPlayer
.
src
=
AUDIO_SOURCE
;
setTimeout
(
function
()
{
if
(
!
isTimeOut
)
{
console
.
info
(
`case is time out!`
);
expect
(
isTimeOut
).
assertTrue
();
}
done
();
},
TIME_OUT
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_
AudioPlayer_Release_API_07
00
* @tc.name : 0
7.release操作在reset之后
* @tc.desc :
* @tc.size : M
EDIUM
* @tc.type :
API T
est
* @tc.level : Level
2
* @tc.number : SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_24
00
* @tc.name : 0
24.play->stop->seek(0)->reset->play
* @tc.desc :
Audio playback control test
* @tc.size : M
ediumTest
* @tc.type :
Function t
est
* @tc.level : Level
0
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Release_API_0700
'
,
0
,
async
function
(
done
)
{
var
mySteps
=
new
Array
(
SRCSTATE
,
PLAYSTATE
,
RESETSTATE
,
RELEASESTATE
,
ENDSTATE
);
it
(
'
SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_2400
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
STOP_STATE
,
SEEK_STATE
,
0
,
ERROR_STATE
,
RESET_STATE
,
SRC_STATE
,
PLAY_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
audioSource
;
setCallback
(
mySteps
);
audioPlayer
.
src
=
AUDIO_SOURCE
;
setTimeout
(
function
()
{
if
(
!
isTimeOut
)
{
console
.
info
(
`case is time out!`
);
expect
(
isTimeOut
).
assertTrue
();
}
done
();
},
TIME_OUT
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_
AudioPlayer_Time_API_01
00
* @tc.name : 0
1.获取参数操作在createAudioPlayer之后
* @tc.desc :
* @tc.size : M
EDIUM
* @tc.type :
API T
est
* @tc.level : Level
2
* @tc.number : SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_25
00
* @tc.name : 0
25.play->seek(0)
* @tc.desc :
Audio playback control test
* @tc.size : M
ediumTest
* @tc.type :
Function t
est
* @tc.level : Level
0
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Time_API_0100
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_2500
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
SEEK_STATE
,
0
,
END_STATE
);
initAudioPlayer
();
expect
(
audioPlayer
.
src
).
assertEqual
(
undefined
);
expect
(
audioPlayer
.
duration
).
assertEqual
(
undefined
);
expect
(
audioPlayer
.
currentTime
).
assertEqual
(
undefined
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
idle
'
);
expect
(
audioPlayer
.
loop
).
assertEqual
(
false
);
setCallback
(
mySteps
);
audioPlayer
.
src
=
AUDIO_SOURCE
;
setTimeout
(
function
()
{
if
(
!
isTimeOut
)
{
console
.
info
(
`case is time out!`
);
expect
(
isTimeOut
).
assertTrue
();
}
done
();
},
TIME_OUT
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_
AudioPlayer_Time_API_02
00
* @tc.name : 02
.获取参数操作在setsrc之后
* @tc.desc :
* @tc.size : M
EDIUM
* @tc.type :
API T
est
* @tc.level : Level
2
* @tc.number : SUB_MEDIA_PLAYER_
LOCAL_AUDIO_Function_04_26
00
* @tc.name : 02
6.play->stop->seek->pause
* @tc.desc :
Audio playback control test
* @tc.size : M
ediumTest
* @tc.type :
Function t
est
* @tc.level : Level
3
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Time_API_0200
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_2600
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
STOP_STATE
,
SEEK_STATE
,
SEEK_TIME
,
ERROR_STATE
,
PAUSE_STATE
,
ERROR_STATE
,
RESET_STATE
,
END_STATE
);
initAudioPlayer
();
audioPlayer
.
src
=
audioSource
;
setCallback
(
mySteps
);
audioPlayer
.
src
=
AUDIO_SOURCE
;
setTimeout
(
function
()
{
if
(
!
isTimeOut
)
{
console
.
info
(
`case is time out!`
);
expect
(
isTimeOut
).
assertTrue
();
}
done
();
},
TIME_OUT
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_2700
* @tc.name : 027.play->stop->seek->reset->play
* @tc.desc : Audio playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level 3
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_2700
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
STOP_STATE
,
SEEK_STATE
,
SEEK_TIME
,
ERROR_STATE
,
RESET_STATE
,
SRC_STATE
,
PLAY_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
);
audioPlayer
.
src
=
AUDIO_SOURCE
;
setTimeout
(
function
()
{
if
(
!
isTimeOut
)
{
console
.
info
(
`case is time out!`
);
expect
(
isTimeOut
).
assertTrue
();
}
done
();
},
TIME_OUT
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_2800
* @tc.name : 028.play->seek(duration)
* @tc.desc : Audio playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_2800
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
SEEK_STATE
,
DURATION_TIME
,
FINISH_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
);
audioPlayer
.
src
=
AUDIO_SOURCE
;
setTimeout
(
function
()
{
if
(
!
isTimeOut
)
{
console
.
info
(
`case is time out!`
);
expect
(
isTimeOut
).
assertTrue
();
}
done
();
},
TIME_OUT
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_2900
* @tc.name : 029.play->seek(out of duration)
* @tc.desc : Audio playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level 3
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_2900
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
SEEK_STATE
,
DURATION_TIME
+
DELTA_TIME
,
FINISH_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
);
audioPlayer
.
src
=
AUDIO_SOURCE
;
setTimeout
(
function
()
{
if
(
!
isTimeOut
)
{
console
.
info
(
`case is time out!`
);
expect
(
isTimeOut
).
assertTrue
();
}
done
();
},
TIME_OUT
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_3000
* @tc.name : 030.play->->seek(rand)
* @tc.desc : Audio playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_3000
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
SEEK_STATE
,
DURATION_TIME
/
RAND_NUM
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
);
audioPlayer
.
src
=
AUDIO_SOURCE
;
setTimeout
(
function
()
{
if
(
!
isTimeOut
)
{
console
.
info
(
`case is time out!`
);
expect
(
isTimeOut
).
assertTrue
();
}
done
();
},
TIME_OUT
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_3200
* @tc.name : 032.play->pause->seek(0)->play
* @tc.desc : Audio playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_3200
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
SEEK_STATE
,
0
,
PLAY_STATE
,
RESET_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
);
audioPlayer
.
src
=
AUDIO_SOURCE
;
setTimeout
(
function
()
{
if
(
!
isTimeOut
)
{
console
.
info
(
`case is time out!`
);
expect
(
isTimeOut
).
assertTrue
();
}
done
();
},
TIME_OUT
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_3300
* @tc.name : 033.play->pause->seek(duration)->play
* @tc.desc : Audio playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_3300
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
SEEK_STATE
,
DURATION_TIME
,
PLAY_STATE
,
FINISH_STATE
,
RESET_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
);
audioPlayer
.
src
=
AUDIO_SOURCE
;
setTimeout
(
function
()
{
if
(
!
isTimeOut
)
{
console
.
info
(
`case is time out!`
);
expect
(
isTimeOut
).
assertTrue
();
}
done
();
},
TIME_OUT
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_3400
* @tc.name : 034.play->pause->seek(out of duratin)->play
* @tc.desc : Audio playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level 3
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_3400
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
SEEK_STATE
,
DURATION_TIME
+
DELTA_TIME
,
PLAY_STATE
,
FINISH_STATE
,
RESET_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
);
audioPlayer
.
src
=
AUDIO_SOURCE
;
setTimeout
(
function
()
{
if
(
!
isTimeOut
)
{
console
.
info
(
`case is time out!`
);
expect
(
isTimeOut
).
assertTrue
();
}
done
();
},
TIME_OUT
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_3500
* @tc.name : 035.play->seek(out of duratin)->play
* @tc.desc : Audio playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level 3
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_3500
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
SEEK_STATE
,
DURATION_TIME
+
DELTA_TIME
,
FINISH_STATE
,
PLAY_STATE
,
RESET_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
);
audioPlayer
.
src
=
AUDIO_SOURCE
;
setTimeout
(
function
()
{
if
(
!
isTimeOut
)
{
console
.
info
(
`case is time out!`
);
expect
(
isTimeOut
).
assertTrue
();
}
done
();
},
TIME_OUT
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_3600
* @tc.name : 036.Loop Play
* @tc.desc : Audio playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_3600
'
,
0
,
async
function
(
done
)
{
let
playCount
=
0
;
let
seekCount
=
0
;
let
isTimeDone
=
false
;
let
testAudioPlayer
=
media
.
createAudioPlayer
();
testAudioPlayer
.
on
(
'
dataLoad
'
,
()
=>
{
console
.
info
(
`case dataLoad called`
);
expect
(
testAudioPlayer
.
currentTime
).
assertEqual
(
0
);
expect
(
testAudioPlayer
.
duration
).
assertEqual
(
DURATION_TIME
);
expect
(
testAudioPlayer
.
state
).
assertEqual
(
'
paused
'
);
testAudioPlayer
.
loop
=
true
;
testAudioPlayer
.
play
();
});
testAudioPlayer
.
on
(
'
play
'
,
()
=>
{
console
.
info
(
`case play called`
);
console
.
info
(
`case play currentTime is
${
testAudioPlayer
.
currentTime
}
`
);
expect
(
testAudioPlayer
.
duration
).
assertEqual
(
DURATION_TIME
);
expect
(
testAudioPlayer
.
state
).
assertEqual
(
'
playing
'
);
sleep
(
PLAY_TIME
);
expect
(
audioPlayer
.
src
).
assertEqual
(
audioSource
);
expect
(
audioPlayer
.
currentTime
).
assertEqual
(
0
);
expect
(
audioPlayer
.
duration
).
assertEqual
(
DURATION_TIME
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
paused
'
);
expect
(
audioPlayer
.
loop
).
assertEqual
(
false
);
if
(
playCount
>
0
)
{
return
;
}
playCount
++
testAudioPlayer
.
seek
(
DURATION_TIME
);
});
testAudioPlayer
.
on
(
'
timeUpdate
'
,
(
seekDoneTime
)
=>
{
if
(
typeof
(
seekDoneTime
)
==
"
undefined
"
)
{
console
.
info
(
`case seek filed,errcode is
${
seekDoneTime
}
`
);
return
;
}
if
(
seekCount
>
0
)
{
testAudioPlayer
.
reset
();
return
;
}
seekCount
++
console
.
info
(
`case seekDoneTime is
${
seekDoneTime
}
`
);
console
.
info
(
`case seek called`
);
});
testAudioPlayer
.
on
(
'
finish
'
,
()
=>
{
expect
(
testAudioPlayer
.
state
).
assertEqual
(
'
playing
'
);
console
.
info
(
`case finish called`
);
});
testAudioPlayer
.
on
(
'
reset
'
,
()
=>
{
expect
(
testAudioPlayer
.
state
).
assertEqual
(
'
idle
'
);
console
.
info
(
`case reset called`
);
testAudioPlayer
.
release
();
isTimeDone
=
true
;
});
testAudioPlayer
.
src
=
AUDIO_SOURCE
;
setTimeout
(
function
()
{
if
(
!
isTimeDone
)
{
console
.
info
(
`case is time out!`
);
expect
(
isTimeOut
).
assertTrue
();
}
done
();
},
TIME_OUT
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_3700
* @tc.name : 037.set volume 0 to 1
* @tc.desc : Audio playback control test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_AUDIO_Function_04_3700
'
,
0
,
async
function
(
done
)
{
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
VOLUME_STATE
,
0
,
VOLUME_STATE
,
MAX_VOLUME
,
RESET_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
);
audioPlayer
.
src
=
AUDIO_SOURCE
;
setTimeout
(
function
()
{
if
(
!
isTimeOut
)
{
console
.
info
(
`case is time out!`
);
expect
(
isTimeOut
).
assertTrue
();
}
done
();
},
TIME_OUT
);
})
})
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录