Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
b8fb3aec
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看板
未验证
提交
b8fb3aec
编写于
4月 11, 2022
作者:
O
openharmony_ci
提交者:
Gitee
4月 11, 2022
浏览文件
操作
浏览文件
下载
差异文件
!2965 公共操作提取,用例执行前增加文件读取是否成功的判断
Merge pull request !2965 from NOBUGGERS/r00514670_0408
上级
1e90ebb8
b3fd2270
变更
11
展开全部
隐藏空白更改
内联
并排
Showing
11 changed file
with
478 addition
and
681 deletion
+478
-681
multimedia/media/media_js_standard/MediaTestBase.js
multimedia/media/media_js_standard/MediaTestBase.js
+10
-2
multimedia/media/media_js_standard/audioPlayer/Test.json
multimedia/media/media_js_standard/audioPlayer/Test.json
+25
-25
multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioAPI.test.js
...ioPlayer/src/main/js/test/PlayerLocalTestAudioAPI.test.js
+60
-46
multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFUNC.test.js
...oPlayer/src/main/js/test/PlayerLocalTestAudioFUNC.test.js
+85
-60
multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFormat.test.js
...layer/src/main/js/test/PlayerLocalTestAudioFormat.test.js
+35
-45
multimedia/media/media_js_standard/videoPlayer/Test.json
multimedia/media/media_js_standard/videoPlayer/Test.json
+2
-2
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/List.test.js
...dia_js_standard/videoPlayer/src/main/js/test/List.test.js
+1
-0
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerAPICallbackTest.test.js
...layer/src/main/js/test/VideoPlayerAPICallbackTest.test.js
+130
-272
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js
...ayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js
+36
-79
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js
...layer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js
+76
-131
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerTestBase.js
...ndard/videoPlayer/src/main/js/test/VideoPlayerTestBase.js
+18
-19
未找到文件。
multimedia/media/media_js_standard/
audioPlayer/src/main/js/test/PlayerLocal
TestBase.js
→
multimedia/media/media_js_standard/
Media
TestBase.js
浏览文件 @
b8fb3aec
...
...
@@ -14,12 +14,12 @@
*/
import
resourceManager
from
'
@ohos.resourceManager
'
;
import
{
expect
}
from
'
deccjsunit/index
'
export
async
function
getFileDescriptor
(
fileName
)
{
let
fileDescriptor
;
let
fileDescriptor
=
undefined
;
await
resourceManager
.
getResourceManager
().
then
(
async
(
mgr
)
=>
{
await
mgr
.
getRawFileDescriptor
(
fileName
).
then
(
value
=>
{
console
.
log
(
'
case getRawFileDescriptor fd:
'
+
value
.
fd
);
fileDescriptor
=
{
fd
:
value
.
fd
,
offset
:
value
.
offset
,
length
:
value
.
length
};
}).
catch
(
error
=>
{
console
.
log
(
'
case getRawFileDescriptor err:
'
+
error
);
...
...
@@ -37,3 +37,11 @@ export async function closeFileDescriptor(fileName) {
});
});
}
export
function
isFileOpen
(
fileDescriptor
,
done
)
{
if
(
fileDescriptor
==
undefined
)
{
expect
().
assertFail
();
console
.
info
(
'
case error fileDescriptor undefined, open file fail
'
);
done
();
}
}
\ No newline at end of file
multimedia/media/media_js_standard/audioPlayer/Test.json
浏览文件 @
b8fb3aec
...
...
@@ -17,40 +17,40 @@
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"mkdir -p /data/app/el1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile"
"mkdir -p /data/app/el1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile"
],
"teardown-command"
:[
]
},
{
{
"type"
:
"PushKit"
,
"pre-push"
:
[
],
"push"
:
[
"./resource/audio/01.mp3 ->/data/app/el1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile/"
,
"./resource/audio/02.mp3 ->/data/a
ccounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer
/"
,
"./resource/audio/03.mp3 ->/data/a
ccounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer
/"
,
"./resource/audio/04.mp3 ->/data/a
ccounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer
/"
,
"./resource/audio/47.mp4 ->/data/a
ccounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer
/"
,
"./resource/audio/49.mp4 ->/data/a
ccounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer
/"
,
"./resource/audio/50.mp4 ->/data/a
ccounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer
/"
,
"./resource/audio/51.mp4 ->/data/a
ccounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer
/"
,
"./resource/audio/54.mp4 ->/data/a
ccounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer
/"
,
"./resource/audio/55.m4a ->/data/a
ccounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer
/"
,
"./resource/audio/57.m4a ->/data/a
ccounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer
/"
,
"./resource/audio/58.m4a ->/data/a
ccounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer
/"
,
"./resource/audio/59.m4a ->/data/a
ccounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer
/"
,
"./resource/audio/62.m4a ->/data/a
ccounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer
/"
,
"./resource/audio/64.mp4 ->/data/a
ccounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer
/"
,
"./resource/audio/65.mp4 ->/data/a
ccounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer
/"
,
"./resource/audio/66.mp4 ->/data/a
ccounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer
/"
,
"./resource/audio/67.mp4 ->/data/a
ccounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer
/"
,
"./resource/audio/92.mp4 ->/data/a
ccounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer
/"
,
"./resource/audio/93.mp4 ->/data/a
ccounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer
/"
,
"./resource/audio/94.mp4 ->/data/a
ccounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer
/"
,
"./resource/audio/96.mp4 ->/data/a
ccounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer
/"
,
"./resource/audio/97.mp4 ->/data/a
ccounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer
/"
,
"./resource/audio/98.mp4 ->/data/a
ccounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer
/"
"./resource/audio/02.mp3 ->/data/a
pp/el1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/03.mp3 ->/data/a
pp/el1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/04.mp3 ->/data/a
pp/el1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/47.mp4 ->/data/a
pp/el1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/49.mp4 ->/data/a
pp/el1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/50.mp4 ->/data/a
pp/el1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/51.mp4 ->/data/a
pp/el1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/54.mp4 ->/data/a
pp/el1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/55.m4a ->/data/a
pp/el1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/57.m4a ->/data/a
pp/el1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/58.m4a ->/data/a
pp/el1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/59.m4a ->/data/a
pp/el1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/62.m4a ->/data/a
pp/el1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/64.mp4 ->/data/a
pp/el1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/65.mp4 ->/data/a
pp/el1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/66.mp4 ->/data/a
pp/el1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/67.mp4 ->/data/a
pp/el1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/92.mp4 ->/data/a
pp/el1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/93.mp4 ->/data/a
pp/el1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/94.mp4 ->/data/a
pp/el1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/96.mp4 ->/data/a
pp/el1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/97.mp4 ->/data/a
pp/el1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
,
"./resource/audio/98.mp4 ->/data/a
pp/el1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile
/"
]
}
]
...
...
multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioAPI.test.js
浏览文件 @
b8fb3aec
...
...
@@ -14,14 +14,14 @@
*/
import
media
from
'
@ohos.multimedia.media
'
import
fileIO
from
'
@ohos.fileio
'
import
{
getFileDescriptor
,
closeFileDescriptor
,
isFileOpen
}
from
'
../../../../../MediaTestBase.js
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
'
PlayerLocalTestAudioAPI
'
,
function
()
{
let
audioPlayer
=
media
.
createAudioPlayer
();
let
loopValue
=
false
;
let
isTimeOut
=
false
;
const
AUDIO_SOURCE
=
'
/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/
01.mp3
'
;
const
AUDIO_SOURCE
=
'
01.mp3
'
;
const
PLAY_TIME
=
3000
;
const
END_STATE
=
0
;
const
SRC_STATE
=
1
;
...
...
@@ -39,13 +39,14 @@ describe('PlayerLocalTestAudioAPI', function () {
const
SEEK_TIME
=
5000
;
const
DELTA_TIME
=
1000
;
const
SECOND_INDEX
=
1
;
const
TIME_OUT
=
20000
;
const
VOLUME_VALUE
=
0.5
;
let
fd
Path
;
let
f
dValue
;
let
fd
Head
=
'
fd://
'
;
let
f
ileDescriptor
=
undefined
;
beforeAll
(
async
function
()
{
await
getFd
();
await
getFileDescriptor
(
AUDIO_SOURCE
).
then
((
res
)
=>
{
fileDescriptor
=
res
;
});
console
.
info
(
'
beforeAll case
'
);
})
...
...
@@ -59,7 +60,7 @@ describe('PlayerLocalTestAudioAPI', function () {
})
afterAll
(
async
function
()
{
await
fileIO
.
close
(
fdValue
);
await
closeFileDescriptor
(
AUDIO_SOURCE
);
console
.
info
(
'
afterAll case
'
);
})
...
...
@@ -67,19 +68,6 @@ describe('PlayerLocalTestAudioAPI', function () {
for
(
let
t
=
Date
.
now
();
Date
.
now
()
-
t
<=
time
;);
}
async
function
getFd
()
{
fdPath
=
'
fd://
'
;
await
fileIO
.
open
(
AUDIO_SOURCE
).
then
((
fdNumber
)
=>
{
fdPath
=
fdPath
+
''
+
fdNumber
;
fdValue
=
fdNumber
;
console
.
info
(
'
[fileIO]case open fd success,fdPath is
'
+
fdPath
);
},
(
err
)
=>
{
console
.
info
(
'
[fileIO]case open fd failed
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
[fileIO]case catch open fd failed
'
);
});
}
function
initAudioPlayer
()
{
if
(
typeof
(
audioPlayer
)
!=
'
undefined
'
)
{
audioPlayer
.
release
();
...
...
@@ -92,7 +80,7 @@ describe('PlayerLocalTestAudioAPI', function () {
}
}
function
nextStep
(
mySteps
,
done
)
{
function
nextStep
(
mySteps
,
done
)
{
if
(
mySteps
[
0
]
==
END_STATE
)
{
done
();
console
.
info
(
'
case to done
'
);
...
...
@@ -101,7 +89,7 @@ describe('PlayerLocalTestAudioAPI', function () {
switch
(
mySteps
[
0
])
{
case
SRC_STATE
:
console
.
info
(
`case to prepare`
);
audioPlayer
.
src
=
fd
Path
;
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
break
;
case
PLAY_STATE
:
console
.
info
(
`case to play`
);
...
...
@@ -263,11 +251,12 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Play_API_0100
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
console
.
info
(
`case update`
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
PLAY_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Path
;
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
})
/* *
...
...
@@ -279,10 +268,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Play_API_0200
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
STOP_STATE
,
PLAY_STATE
,
ERROR_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Path
;
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
})
/* *
...
...
@@ -294,10 +284,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Play_API_0300
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
SEEK_STATE
,
SEEK_TIME
,
PLAY_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Path
;
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
})
/* *
...
...
@@ -309,10 +300,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Play_API_0400
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
RESET_STATE
,
PLAY_STATE
,
ERROR_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Path
;
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
})
/* *
...
...
@@ -324,6 +316,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Pause_API_0100
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
PAUSE_STATE
,
ERROR_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
...
...
@@ -339,10 +332,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Pause_API_0200
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Path
;
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
})
/* *
...
...
@@ -354,10 +348,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Pause_API_0300
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
PLAY_STATE
,
STOP_STATE
,
PAUSE_STATE
,
ERROR_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Path
;
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
})
/* *
...
...
@@ -369,10 +364,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Pause_API_0400
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
SEEK_STATE
,
SEEK_TIME
,
PAUSE_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Path
;
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
})
/* *
...
...
@@ -384,10 +380,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Stop_API_0100
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
STOP_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Path
;
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
})
/* *
...
...
@@ -399,10 +396,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Stop_API_0200
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
STOP_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Path
;
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
})
/* *
...
...
@@ -414,10 +412,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Stop_API_0300
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
SEEK_STATE
,
SEEK_TIME
,
STOP_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Path
;
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
})
/* *
...
...
@@ -429,10 +428,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Seek_API_0100
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
SEEK_STATE
,
SEEK_TIME
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Path
;
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
})
/* *
...
...
@@ -444,10 +444,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Seek_API_0200
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
SEEK_STATE
,
SEEK_TIME
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Path
;
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
})
/* *
...
...
@@ -459,10 +460,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Seek_API_0300
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
SEEK_STATE
,
0
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Path
;
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
})
/* *
...
...
@@ -474,10 +476,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Reset_API_0100
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
RESET_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Path
;
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
})
/* *
...
...
@@ -489,10 +492,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Reset_API_0200
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
RESET_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Path
;
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
})
/* *
...
...
@@ -504,6 +508,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_SetVolume_API_0100
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
var
mySteps
=
new
Array
(
VOLUME_STATE
,
VOLUME_VALUE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
...
...
@@ -519,10 +524,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_SetVolume_API_0200
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
var
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
VOLUME_STATE
,
VOLUME_VALUE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Path
;
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
})
/* *
...
...
@@ -534,10 +540,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_SetVolume_API_0300
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
var
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
VOLUME_STATE
,
VOLUME_VALUE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Path
;
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
})
/* *
...
...
@@ -549,10 +556,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Release_API_0100
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
RELEASE_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Path
;
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
})
/* *
...
...
@@ -564,10 +572,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Release_API_0200
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
PAUSE_STATE
,
RELEASE_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Path
;
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
})
/* *
...
...
@@ -579,10 +588,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Release_API_0300
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
STOP_STATE
,
RELEASE_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Path
;
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
})
/* *
...
...
@@ -594,10 +604,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Release_API_0400
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
SEEK_STATE
,
SEEK_TIME
,
RELEASE_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Path
;
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
})
/* *
...
...
@@ -609,10 +620,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Release_API_0400
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
let
mySteps
=
new
Array
(
SRC_STATE
,
PLAY_STATE
,
RESET_STATE
,
RELEASE_STATE
,
END_STATE
);
initAudioPlayer
();
setCallback
(
mySteps
,
done
);
audioPlayer
.
src
=
fd
Path
;
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
})
/* *
...
...
@@ -624,6 +636,7 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Time_API_0100
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
initAudioPlayer
();
expect
(
audioPlayer
.
src
).
assertEqual
(
undefined
);
expect
(
audioPlayer
.
duration
).
assertEqual
(
undefined
);
...
...
@@ -642,10 +655,11 @@ describe('PlayerLocalTestAudioAPI', function () {
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_PLAYER_AudioPlayer_Time_API_0200
'
,
0
,
async
function
(
done
)
{
isFileOpen
(
fileDescriptor
,
done
);
initAudioPlayer
();
audioPlayer
.
src
=
fd
Path
;
audioPlayer
.
src
=
fd
Head
+
fileDescriptor
.
fd
;
sleep
(
PLAY_TIME
);
expect
(
audioPlayer
.
src
).
assertEqual
(
fd
Path
);
expect
(
audioPlayer
.
src
).
assertEqual
(
fd
Head
+
fileDescriptor
.
fd
);
expect
(
audioPlayer
.
currentTime
).
assertEqual
(
0
);
expect
(
audioPlayer
.
duration
).
assertEqual
(
DURATION_TIME
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
paused
'
);
...
...
multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFUNC.test.js
浏览文件 @
b8fb3aec
此差异已折叠。
点击以展开。
multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFormat.test.js
浏览文件 @
b8fb3aec
...
...
@@ -14,18 +14,17 @@
*/
import
media
from
'
@ohos.multimedia.media
'
import
fileIO
from
'
@ohos.fileio
'
import
{
getFileDescriptor
,
closeFileDescriptor
,
isFileOpen
}
from
'
../../../../../MediaTestBase.js
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
'
PlayerLocalTestAudioFormat
'
,
function
()
{
const
BASIC_PATH
=
'
/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audioplayer/
'
;
let
audioSource
=
'
01.mp3
'
;
const
MAX_VOLUME
=
1
;
const
PLAY_TIME
=
3000
;
const
SEEK_TIME
=
10000
;
// 10s
let
isToSeek
=
false
;
let
isToDuration
=
false
;
let
fdPath
;
let
fdValue
;
let
fileDescriptor
=
undefined
;
beforeAll
(
function
()
{
console
.
info
(
'
beforeAll case
'
);
...
...
@@ -42,7 +41,7 @@ describe('PlayerLocalTestAudioFormat', function () {
})
afterAll
(
async
function
()
{
await
fileIO
.
close
(
fdValu
e
);
await
closeFileDescriptor
(
audioSourc
e
);
console
.
info
(
'
afterAll case
'
);
})
...
...
@@ -50,23 +49,14 @@ describe('PlayerLocalTestAudioFormat', function () {
for
(
let
t
=
Date
.
now
();
Date
.
now
()
-
t
<=
time
;);
}
async
function
getFd
(
pathName
)
{
fdPath
=
'
fd://
'
;
await
fileIO
.
open
(
pathName
).
then
((
fdNumber
)
=>
{
fdPath
=
fdPath
+
''
+
fdNumber
;
fdValue
=
fdNumber
;
console
.
info
(
'
[fileIO]case open fd success,fdPath is
'
+
fdPath
);
},
(
err
)
=>
{
console
.
info
(
'
[fileIO]case open fd failed
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
[fileIO]case catch open fd failed
'
);
});
}
async
function
playSource
(
audioSource
,
done
)
{
async
function
playSource
(
audioFile
,
done
)
{
let
audioPlayer
=
media
.
createAudioPlayer
();
await
getFd
(
audioSource
);
audioPlayer
.
src
=
fdPath
;
audioSource
=
audioFile
;
await
getFileDescriptor
(
audioSource
).
then
((
res
)
=>
{
fileDescriptor
=
res
;
});
isFileOpen
(
fileDescriptor
,
done
);
audioPlayer
.
src
=
'
fd://
'
+
fileDescriptor
.
fd
;
audioPlayer
.
on
(
'
dataLoad
'
,
()
=>
{
console
.
info
(
'
case set source success
'
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
paused
'
);
...
...
@@ -151,7 +141,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP3_0100
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
01.mp3
'
,
done
);
playSource
(
'
01.mp3
'
,
done
);
})
/* *
...
...
@@ -167,7 +157,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP3_0200
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
02.mp3
'
,
done
);
playSource
(
'
02.mp3
'
,
done
);
})
/* *
...
...
@@ -183,7 +173,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP3_0300
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
03.mp3
'
,
done
);
playSource
(
'
03.mp3
'
,
done
);
})
/* *
...
...
@@ -199,7 +189,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP3_0400
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
04.mp3
'
,
done
);
playSource
(
'
04.mp3
'
,
done
);
})
/* *
...
...
@@ -215,7 +205,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_0100
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
47.mp4
'
,
done
);
playSource
(
'
47.mp4
'
,
done
);
})
...
...
@@ -232,7 +222,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_0300
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
49.mp4
'
,
done
);
playSource
(
'
49.mp4
'
,
done
);
})
/* *
...
...
@@ -248,7 +238,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_0400
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
50.mp4
'
,
done
);
playSource
(
'
50.mp4
'
,
done
);
})
/* *
...
...
@@ -264,7 +254,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_0500
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
51.mp4
'
,
done
);
playSource
(
'
51.mp4
'
,
done
);
})
/* *
...
...
@@ -280,7 +270,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_0600
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
54.mp4
'
,
done
);
playSource
(
'
54.mp4
'
,
done
);
})
/* *
...
...
@@ -296,7 +286,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_0700
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
64.mp4
'
,
done
);
playSource
(
'
64.mp4
'
,
done
);
})
/* *
...
...
@@ -312,7 +302,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_0800
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
65.mp4
'
,
done
);
playSource
(
'
65.mp4
'
,
done
);
})
/* *
...
...
@@ -328,7 +318,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_0900
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
66.mp4
'
,
done
);
playSource
(
'
66.mp4
'
,
done
);
})
/* *
...
...
@@ -344,7 +334,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_1000
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
67.mp4
'
,
done
);
playSource
(
'
67.mp4
'
,
done
);
})
/* *
...
...
@@ -360,7 +350,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_1100
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
92.mp4
'
,
done
);
playSource
(
'
92.mp4
'
,
done
);
})
/* *
...
...
@@ -376,7 +366,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_1200
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
93.mp4
'
,
done
);
playSource
(
'
93.mp4
'
,
done
);
})
/* *
...
...
@@ -392,7 +382,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_1300
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
94.mp4
'
,
done
);
playSource
(
'
94.mp4
'
,
done
);
})
/* *
...
...
@@ -408,7 +398,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_1400
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
96.mp4
'
,
done
);
playSource
(
'
96.mp4
'
,
done
);
})
/* *
...
...
@@ -424,7 +414,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_1500
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
97.mp4
'
,
done
);
playSource
(
'
97.mp4
'
,
done
);
})
/* *
...
...
@@ -440,7 +430,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_FORMAT_MP4_1600
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
98.mp4
'
,
done
);
playSource
(
'
98.mp4
'
,
done
);
})
/* *
...
...
@@ -456,7 +446,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_FORMAT_M4A_0100
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
55.m4a
'
,
done
);
playSource
(
'
55.m4a
'
,
done
);
})
...
...
@@ -473,7 +463,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_FORMAT_M4A_0300
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
57.m4a
'
,
done
);
playSource
(
'
57.m4a
'
,
done
);
})
/* *
...
...
@@ -489,7 +479,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_FORMAT_M4A_0400
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
58.m4a
'
,
done
);
playSource
(
'
58.m4a
'
,
done
);
})
/* *
...
...
@@ -505,7 +495,7 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_FORMAT_M4A_0500
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
59.m4a
'
,
done
);
playSource
(
'
59.m4a
'
,
done
);
})
/* *
...
...
@@ -521,6 +511,6 @@ describe('PlayerLocalTestAudioFormat', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_FORMAT_M4A_0700
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
62.m4a
'
,
done
);
playSource
(
'
62.m4a
'
,
done
);
})
})
multimedia/media/media_js_standard/videoPlayer/Test.json
浏览文件 @
b8fb3aec
...
...
@@ -17,12 +17,12 @@
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"mkdir -p /data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile"
"mkdir -p /data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile"
],
"teardown-command"
:[
]
},
{
{
"type"
:
"PushKit"
,
"pre-push"
:
[
],
...
...
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/List.test.js
浏览文件 @
b8fb3aec
...
...
@@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require
(
'
./VideoPlayerFuncCallbackTest.test.js
'
)
require
(
'
./VideoPlayerFuncPromiseTest.test.js
'
)
require
(
'
./VideoPlayerAPICallbackTest.test.js
'
)
...
...
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerAPICallbackTest.test.js
浏览文件 @
b8fb3aec
此差异已折叠。
点击以展开。
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js
浏览文件 @
b8fb3aec
...
...
@@ -14,8 +14,8 @@
*/
import
media
from
'
@ohos.multimedia.media
'
import
router
from
'
@system.router
'
import
{
getFileDescriptor
,
closeFileDescriptor
}
from
'
./VideoPlayer
TestBase.js
'
;
import
{
toNewPage
,
clearRouter
}
from
'
./VideoPlayerTestBase.js
'
;
import
{
getFileDescriptor
,
closeFileDescriptor
,
isFileOpen
}
from
'
../../../../../Media
TestBase.js
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
'
VideoPlayerFuncCallbackTest
'
,
function
()
{
...
...
@@ -46,8 +46,8 @@ describe('VideoPlayerFuncCallbackTest', function () {
const
NEXT_FRAME_TIME
=
8333
;
const
PREV_FRAME_TIME
=
4166
;
let
surfaceID
=
''
;
let
fileDescriptor
;
let
temp
=
0
;
let
fileDescriptor
=
undefined
;
let
page
=
0
;
let
events
=
require
(
'
events
'
);
let
eventEmitter
=
new
events
.
EventEmitter
();
...
...
@@ -59,14 +59,16 @@ describe('VideoPlayerFuncCallbackTest', function () {
})
beforeEach
(
async
function
()
{
await
toNewPage
();
await
msleep
(
1000
).
then
(()
=>
{
},
failureCallback
).
catch
(
catchCallback
);
await
toNewPage
(
page
);
page
=
(
page
+
1
)
%
2
;
await
msleep
(
1000
).
then
(()
=>
{},
failureCallback
).
catch
(
catchCallback
);
surfaceID
=
globalThis
.
value
;
console
.
info
(
'
case new surfaceID is
'
+
surfaceID
);
console
.
info
(
'
beforeEach case
'
);
})
afterEach
(
async
function
()
{
await
router
.
clea
r
();
await
clearRoute
r
();
console
.
info
(
'
afterEach case
'
);
})
...
...
@@ -93,25 +95,6 @@ describe('VideoPlayerFuncCallbackTest', function () {
return
new
Promise
((
resolve
)
=>
setTimeout
(
resolve
,
ms
));
}
async
function
toNewPage
()
{
let
path
=
''
;
if
(
temp
==
0
)
{
path
=
'
pages/surfaceTest/surfaceTest
'
;
temp
=
1
;
}
else
{
path
=
'
pages/surfaceTest/surfaceTest2
'
;
temp
=
0
;
}
let
options
=
{
uri
:
path
,
}
try
{
let
result
=
await
router
.
push
(
options
);
}
catch
{
console
.
info
(
'
case route failed
'
);
}
}
function
printfError
(
error
,
done
)
{
expect
().
assertFail
();
console
.
info
(
`case error called,errMessage is
${
error
.
message
}
`
);
...
...
@@ -432,8 +415,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_0100
'
,
0
,
async
function
(
done
)
{
surfaceID
=
globalThis
.
value
;
console
.
info
(
'
case new surfaceID is
'
+
surfaceID
);
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
RELEASE_EVENT
,
END_EVENT
);
...
...
@@ -449,8 +431,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_0200
'
,
0
,
async
function
(
done
)
{
surfaceID
=
globalThis
.
value
;
console
.
info
(
'
case new surfaceID is
'
+
surfaceID
);
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
PAUSE_EVENT
,
RELEASE_EVENT
,
END_EVENT
);
...
...
@@ -466,8 +447,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_0300
'
,
0
,
async
function
(
done
)
{
surfaceID
=
globalThis
.
value
;
console
.
info
(
'
case new surfaceID is
'
+
surfaceID
);
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
PAUSE_EVENT
,
PLAY_EVENT
,
RELEASE_EVENT
,
END_EVENT
);
...
...
@@ -483,8 +463,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_0400
'
,
0
,
async
function
(
done
)
{
surfaceID
=
globalThis
.
value
;
console
.
info
(
'
case new surfaceID is
'
+
surfaceID
);
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
STOP_EVENT
,
RELEASE_EVENT
,
END_EVENT
);
...
...
@@ -500,8 +479,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_0500
'
,
0
,
async
function
(
done
)
{
surfaceID
=
globalThis
.
value
;
console
.
info
(
'
case new surfaceID is
'
+
surfaceID
);
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
RESET_EVENT
,
RELEASE_EVENT
,
END_EVENT
);
...
...
@@ -517,8 +495,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_0600
'
,
0
,
async
function
(
done
)
{
surfaceID
=
globalThis
.
value
;
console
.
info
(
'
case new surfaceID is
'
+
surfaceID
);
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
SEEK_EVENT
,
SEEK_TIME
,
RELEASE_EVENT
,
END_EVENT
);
...
...
@@ -534,8 +511,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_0700
'
,
0
,
async
function
(
done
)
{
surfaceID
=
globalThis
.
value
;
console
.
info
(
'
case new surfaceID is
'
+
surfaceID
);
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
SEEK_MODE_EVENT
,
SEEK_TIME
,
media
.
SeekMode
.
SEEK_NEXT_SYNC
,
...
...
@@ -552,8 +528,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_0800
'
,
0
,
async
function
(
done
)
{
surfaceID
=
globalThis
.
value
;
console
.
info
(
'
case new surfaceID is
'
+
surfaceID
);
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
SETVOLUME_EVENT
,
VOLUME_VALUE
,
RELEASE_EVENT
,
END_EVENT
);
...
...
@@ -569,8 +544,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_0900
'
,
0
,
async
function
(
done
)
{
surfaceID
=
globalThis
.
value
;
console
.
info
(
'
case new surfaceID is
'
+
surfaceID
);
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
SETSPEED_EVENT
,
SPEED_VALUE
,
RELEASE_EVENT
,
END_EVENT
);
...
...
@@ -586,8 +560,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_1000
'
,
0
,
async
function
(
done
)
{
surfaceID
=
globalThis
.
value
;
console
.
info
(
'
case new surfaceID is
'
+
surfaceID
);
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
GETDESCRIPTION
,
RELEASE_EVENT
,
END_EVENT
);
...
...
@@ -603,8 +576,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level1
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_1200
'
,
0
,
async
function
(
done
)
{
surfaceID
=
globalThis
.
value
;
console
.
info
(
'
case new surfaceID is
'
+
surfaceID
);
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
PAUSE_EVENT
,
STOP_EVENT
,
RELEASE_EVENT
,
END_EVENT
);
...
...
@@ -620,8 +592,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level1
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_1300
'
,
0
,
async
function
(
done
)
{
surfaceID
=
globalThis
.
value
;
console
.
info
(
'
case new surfaceID is
'
+
surfaceID
);
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
PAUSE_EVENT
,
RESET_EVENT
,
RELEASE_EVENT
,
END_EVENT
);
...
...
@@ -637,8 +608,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level1
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_1400
'
,
0
,
async
function
(
done
)
{
surfaceID
=
globalThis
.
value
;
console
.
info
(
'
case new surfaceID is
'
+
surfaceID
);
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
PAUSE_EVENT
,
SEEK_EVENT
,
SEEK_TIME
,
PLAY_EVENT
,
RELEASE_EVENT
,
END_EVENT
);
...
...
@@ -654,8 +624,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level1
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_1500
'
,
0
,
async
function
(
done
)
{
surfaceID
=
globalThis
.
value
;
console
.
info
(
'
case new surfaceID is
'
+
surfaceID
);
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
PAUSE_EVENT
,
SEEK_MODE_EVENT
,
SEEK_TIME
,
media
.
SeekMode
.
SEEK_NEXT_SYNC
,
...
...
@@ -672,8 +641,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level1
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_1600
'
,
0
,
async
function
(
done
)
{
surfaceID
=
globalThis
.
value
;
console
.
info
(
'
case new surfaceID is
'
+
surfaceID
);
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
PAUSE_EVENT
,
SETVOLUME_EVENT
,
VOLUME_VALUE
,
PLAY_EVENT
,
RELEASE_EVENT
,
END_EVENT
);
...
...
@@ -689,8 +657,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level1
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_1700
'
,
0
,
async
function
(
done
)
{
surfaceID
=
globalThis
.
value
;
console
.
info
(
'
case new surfaceID is
'
+
surfaceID
);
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
PAUSE_EVENT
,
SETSPEED_EVENT
,
SPEED_VALUE
,
PLAY_EVENT
,
RELEASE_EVENT
,
END_EVENT
);
...
...
@@ -706,8 +673,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level1
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_1800
'
,
0
,
async
function
(
done
)
{
surfaceID
=
globalThis
.
value
;
console
.
info
(
'
case new surfaceID is
'
+
surfaceID
);
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
STOP_EVENT
,
RESET_EVENT
,
RELEASE_EVENT
,
END_EVENT
);
...
...
@@ -723,8 +689,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level1
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_1900
'
,
0
,
async
function
(
done
)
{
surfaceID
=
globalThis
.
value
;
console
.
info
(
'
case new surfaceID is
'
+
surfaceID
);
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
STOP_EVENT
,
RESET_EVENT
,
SRC_PREPARE_EVENT
,
...
...
@@ -741,8 +706,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level1
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_2000
'
,
0
,
async
function
(
done
)
{
surfaceID
=
globalThis
.
value
;
console
.
info
(
'
case new surfaceID is
'
+
surfaceID
);
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
SEEK_EVENT
,
0
,
PAUSE_EVENT
,
STOP_EVENT
,
RELEASE_EVENT
,
END_EVENT
);
...
...
@@ -758,8 +722,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level1
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_2100
'
,
0
,
async
function
(
done
)
{
surfaceID
=
globalThis
.
value
;
console
.
info
(
'
case new surfaceID is
'
+
surfaceID
);
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
SEEK_MODE_EVENT
,
0
,
media
.
SeekMode
.
SEEK_NEXT_SYNC
,
...
...
@@ -776,8 +739,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level1
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_2200
'
,
0
,
async
function
(
done
)
{
surfaceID
=
globalThis
.
value
;
console
.
info
(
'
case new surfaceID is
'
+
surfaceID
);
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
SEEK_EVENT
,
DURATION_TIME
,
RELEASE_EVENT
,
END_EVENT
);
...
...
@@ -793,8 +755,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level1
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_2300
'
,
0
,
async
function
(
done
)
{
surfaceID
=
globalThis
.
value
;
console
.
info
(
'
case new surfaceID is
'
+
surfaceID
);
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
SEEK_MODE_EVENT
,
DURATION_TIME
,
media
.
SeekMode
.
SEEK_PREV_SYNC
,
...
...
@@ -811,8 +772,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_2400
'
,
0
,
async
function
(
done
)
{
surfaceID
=
globalThis
.
value
;
console
.
info
(
'
case new surfaceID is
'
+
surfaceID
);
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
SEEK_EVENT
,
DURATION_TIME
+
1
,
RELEASE_EVENT
,
END_EVENT
);
...
...
@@ -828,8 +788,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_2500
'
,
0
,
async
function
(
done
)
{
surfaceID
=
globalThis
.
value
;
console
.
info
(
'
case new surfaceID is
'
+
surfaceID
);
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
SEEK_MODE_EVENT
,
DURATION_TIME
+
1
,
media
.
SeekMode
.
SEEK_PREV_SYNC
,
...
...
@@ -846,8 +805,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_2600
'
,
0
,
async
function
(
done
)
{
surfaceID
=
globalThis
.
value
;
console
.
info
(
'
case new surfaceID is
'
+
surfaceID
);
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
SETVOLUME_EVENT
,
0
,
SETVOLUME_EVENT
,
0.2
,
SETVOLUME_EVENT
,
0.4
,
SETVOLUME_EVENT
,
0.6
,
...
...
@@ -864,8 +822,7 @@ describe('VideoPlayerFuncCallbackTest', function () {
* @tc.level : Level2
*/
it
(
'
SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_2700
'
,
0
,
async
function
(
done
)
{
surfaceID
=
globalThis
.
value
;
console
.
info
(
'
case new surfaceID is
'
+
surfaceID
);
isFileOpen
(
fileDescriptor
,
done
);
let
videoPlayer
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
SETSURFACE_EVENT
,
PREPARE_EVENT
,
PLAY_EVENT
,
SETSPEED_EVENT
,
media
.
PlaybackSpeed
.
SPEED_FORWARD_2_00_X
,
RELEASE_EVENT
,
END_EVENT
);
...
...
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js
浏览文件 @
b8fb3aec
此差异已折叠。
点击以展开。
multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerTestBase.js
浏览文件 @
b8fb3aec
...
...
@@ -13,26 +13,25 @@
* limitations under the License.
*/
import
r
esourceManager
from
'
@ohos.resourceManager
'
;
import
r
outer
from
'
@system.router
'
export
async
function
getFileDescriptor
(
fileName
)
{
let
fileDescriptor
;
await
resourceManager
.
getResourceManager
().
then
(
async
(
mgr
)
=>
{
await
mgr
.
getRawFileDescriptor
(
fileName
).
then
(
value
=>
{
fileDescriptor
=
{
fd
:
value
.
fd
,
offset
:
value
.
offset
,
length
:
value
.
length
};
}).
catch
(
error
=>
{
console
.
log
(
'
case getRawFileDescriptor err:
'
+
error
);
});
});
return
fileDescriptor
;
export
async
function
toNewPage
(
page
)
{
let
path
=
''
;
if
(
page
==
0
)
{
path
=
'
pages/surfaceTest/surfaceTest
'
;
}
else
{
path
=
'
pages/surfaceTest/surfaceTest2
'
;
}
let
options
=
{
uri
:
path
,
}
try
{
await
router
.
push
(
options
);
}
catch
{
console
.
info
(
'
case route failed
'
);
}
}
export
async
function
closeFileDescriptor
(
fileName
)
{
await
resourceManager
.
getResourceManager
().
then
(
async
(
mgr
)
=>
{
await
mgr
.
closeRawFileDescriptor
(
fileName
).
then
(
value
=>
{
console
.
log
(
'
case closeRawFileDescriptor
'
+
value
);
}).
catch
(
error
=>
{
console
.
log
(
'
case closeRawFileDescriptor err:
'
+
error
);
});
});
export
async
function
clearRouter
()
{
await
router
.
clear
();
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录