Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
766a2360
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看板
提交
766a2360
编写于
9月 15, 2021
作者:
X
XUXIAOBO
提交者:
Gitee
9月 15, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
media audio format test
Signed-off-by:
N
XUXIAOBO
<
xuxiaobo5@huawei.com
>
上级
5a71af71
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
568 addition
and
1 deletion
+568
-1
multimedia/audio/audio_js_standard/audioPlayer/src/main/js/default/test/List.test.js
...tandard/audioPlayer/src/main/js/default/test/List.test.js
+2
-1
multimedia/audio/audio_js_standard/audioPlayer/src/main/js/default/test/PlayerLocalTestAudioFormat.test.js
...c/main/js/default/test/PlayerLocalTestAudioFormat.test.js
+566
-0
未找到文件。
multimedia/audio/audio_js_standard/audioPlayer/src/main/js/default/test/List.test.js
浏览文件 @
766a2360
...
...
@@ -13,4 +13,5 @@
* limitations under the License.
*/
require
(
'
./PlayerLocalTestAudioFUNC.test.js
'
)
\ No newline at end of file
require
(
'
./PlayerLocalTestAudioFUNC.test.js
'
)
require
(
'
./PlayerLocalTestAudioFormat.test.js
'
)
\ No newline at end of file
multimedia/audio/audio_js_standard/audioPlayer/src/main/js/default/test/PlayerLocalTestAudioFormat.test.js
0 → 100644
浏览文件 @
766a2360
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
media
from
'
@ohos.multimedia.media
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
'
PlayerLocalTestAudioFormat
'
,
function
()
{
const
BASIC_PATH
=
'
file:///data/media/audio/
'
;
const
MAX_VOLUME
=
1
;
const
PLAY_TIME
=
3000
;
const
SEEK_TIME
=
10000
;
// 10s
beforeAll
(
function
()
{
console
.
info
(
'
beforeAll case
'
);
})
beforeEach
(
function
()
{
console
.
info
(
'
beforeEach case
'
);
})
afterEach
(
function
()
{
console
.
info
(
'
afterEach case
'
);
})
afterAll
(
function
()
{
console
.
info
(
'
afterAll case
'
);
})
function
sleep
(
time
)
{
for
(
let
t
=
Date
.
now
();
Date
.
now
()
-
t
<=
time
;);
}
function
playSource
(
audioSource
,
done
)
{
let
audioPlayer
=
media
.
createAudioPlayer
();
let
isToSeek
=
false
;
let
isToDuration
=
false
;
if
(
typeof
(
audioPlayer
)
==
'
undefined
'
)
{
console
.
info
(
'
case create player is faild
'
);
expect
().
assertFail
();
done
();
return
;
}
audioPlayer
.
on
(
'
dataLoad
'
,
()
=>
{
console
.
info
(
'
case set source success
'
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
paused
'
);
expect
(
audioPlayer
.
currentTime
).
assertEqual
(
0
);
audioPlayer
.
play
();
});
audioPlayer
.
on
(
'
play
'
,
()
=>
{
console
.
info
(
'
case start to play
'
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
playing
'
);
sleep
(
PLAY_TIME
);
if
(
!
isToSeek
)
{
audioPlayer
.
pause
();
}
else
{
audioPlayer
.
seek
(
SEEK_TIME
);
}
});
audioPlayer
.
on
(
'
pause
'
,
()
=>
{
console
.
info
(
'
case now is paused
'
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
paused
'
);
audioPlayer
.
setVolume
(
MAX_VOLUME
);
});
audioPlayer
.
on
(
'
reset
'
,
()
=>
{
console
.
info
(
'
case reset success
'
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
idle
'
);
audioPlayer
.
release
();
audioPlayer
=
undefined
;
done
();
});
audioPlayer
.
on
(
'
stop
'
,
()
=>
{
console
.
info
(
'
case stop success
'
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
stopped
'
);
audioPlayer
.
reset
();
});
audioPlayer
.
on
(
'
timeUpdate
'
,
(
seekDoneTime
)
=>
{
if
(
typeof
(
seekDoneTime
)
==
"
undefined
"
)
{
console
.
info
(
`case seek filed,errcode is
${
seekDoneTime
}
`
);
audioPlayer
.
release
();
expect
().
assertFail
();
done
();
return
;
}
console
.
info
(
'
case seek success, and seek time is
'
+
seekDoneTime
);
if
(
!
isToDuration
)
{
expect
(
SEEK_TIME
).
assertEqual
(
seekDoneTime
);
isToDuration
=
true
;
sleep
(
PLAY_TIME
);
audioPlayer
.
seek
(
audioPlayer
.
duration
);
}
else
{
expect
(
audioPlayer
.
duration
).
assertEqual
(
seekDoneTime
);
}
});
audioPlayer
.
on
(
'
volumeChange
'
,
()
=>
{
console
.
info
(
'
case set volume value to
'
+
MAX_VOLUME
);
audioPlayer
.
play
();
isToSeek
=
true
;
});
audioPlayer
.
on
(
'
finish
'
,
()
=>
{
console
.
info
(
'
case play end
'
);
expect
(
audioPlayer
.
state
).
assertEqual
(
'
stopped
'
);
audioPlayer
.
stop
();
});
audioPlayer
.
on
(
'
error
'
,
(
err
)
=>
{
console
.
info
(
`case error called,errName is
${
err
.
name
}
`
);
console
.
info
(
`case error called,errCode is
${
err
.
code
}
`
);
console
.
info
(
`case error called,errMessage is
${
err
.
message
}
`
);
audioPlayer
.
release
();
expect
().
assertFail
();
done
();
});
audioPlayer
.
src
=
audioSource
;
}
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP3_01_0100
* @tc.name : 001.Playing mp3 streams
* @tc.desc : Format : MP3
Codec : MP3
Samplerate : 48000
Bitrate : 32
Channel : 1
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_Format_MP3_01_0100
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
01.mp3
'
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP3_01_0200
* @tc.name : 002.Playing mp3 streams
* @tc.desc : Format : MP3
Codec : MP3
Samplerate : 48000
Bitrate : 16/32
Channel : 2
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_Format_MP3_01_0200
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
02.mp3
'
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP3_01_0300
* @tc.name : 003.Playing mp3 streams
* @tc.desc : Format : MP3
Codec : MP3
Samplerate : 48000
Bitrate : 32
Channel : 2
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_Format_MP3_01_0300
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
03.mp3
'
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP3_01_0400
* @tc.name : 004.Playing mp3 streams
* @tc.desc : Format : MP3
Codec : MP3
Samplerate : 48000
Bitrate : 64
Channel : 2
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_Format_MP3_01_0400
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
04.mp3
'
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0100
* @tc.name : 001.Playing mp4 streams
* @tc.desc : Format : MP4
Codec : AAC LC
Samplerate : 48000
Bitrate : 32
Channel : 1
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0100
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
47.mp4
'
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0200
* @tc.name : 002.Playing mp4 streams
* @tc.desc : Format : MP4
Codec : AAC LC
Samplerate : 48000
Bitrate : 16
Channel : 2
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0200
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
48.mp4
'
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0300
* @tc.name : 003.Playing mp4 streams
* @tc.desc : Format : MP4
Codec : AAC LC
Samplerate : 48000
Bitrate : 64
Channel : 2
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0300
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
49.mp4
'
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0400
* @tc.name : 004.Playing mp4 streams
* @tc.desc : Format : MP4
Codec : AAC LC
Samplerate : 48000
Bitrate : 32
Channel : 2
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0400
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
50.mp4
'
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0500
* @tc.name : 005.Playing mp4 streams
* @tc.desc : Format : MP4
Codec : AAC LC
Samplerate : 96000
Bitrate : 32
Channel : 1
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0500
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
51.mp4
'
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0600
* @tc.name : 006.Playing mp4 streams
* @tc.desc : Format : MP4
Codec : AAC LC
Samplerate : 96000
Bitrate : 64
Channel : 2
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0600
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
54.mp4
'
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0700
* @tc.name : 007.Playing mp4 streams
* @tc.desc : Format : MP4
Codec : MP3
Samplerate : 48000
Bitrate : 32
Channel : 1
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0700
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
64.mp4
'
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0800
* @tc.name : 008.Playing mp4 streams
* @tc.desc : Format : MP4
Codec : MP3
Samplerate : 48000
Bitrate : 16
Channel : 2
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0800
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
65.mp4
'
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0900
* @tc.name : 009.Playing mp4 streams
* @tc.desc : Format : MP4
Codec : MP3
Samplerate : 48000
Bitrate : 64
Channel : 2
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_0900
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
66.mp4
'
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1000
* @tc.name : 010.Playing mp4 streams
* @tc.desc : Format : MP4
Codec : MP3
Samplerate : 48000
Bitrate : 32
Channel : 2
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1000
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
67.mp4
'
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1100
* @tc.name : 011.Playing mp4 streams
* @tc.desc : Format : MP4
Codec : Vorbis
Samplerate : 48000
Bitrate : 16
Channel : 2
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1100
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
92.mp4
'
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1200
* @tc.name : 012.Playing mp4 streams
* @tc.desc : Format : MP4
Codec : Vorbis
Samplerate : 48000
Bitrate : 64
Channel : 2
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1200
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
93.mp4
'
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1300
* @tc.name : 013.Playing mp4 streams
* @tc.desc : Format : MP4
Codec : Vorbis
Samplerate : 48000
Bitrate : 32
Channel : 2
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1300
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
94.mp4
'
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1400
* @tc.name : 014.Playing mp4 streams
* @tc.desc : Format : MP4
Codec : Vorbis
Samplerate : 96000
Bitrate : 16
Channel : 2
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1400
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
96.mp4
'
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1500
* @tc.name : 015.Playing mp4 streams
* @tc.desc : Format : MP4
Codec : Vorbis
Samplerate : 96000
Bitrate : 32
Channel : 2
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1500
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
97.mp4
'
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1600
* @tc.name : 016.Playing mp4 streams
* @tc.desc : Format : MP4
Codec : Vorbis
Samplerate : 96000
Bitrate : 64
Channel : 2
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_Format_MP4_01_1600
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
98.mp4
'
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0100
* @tc.name : 001.Playing m4a streams
* @tc.desc : Format : M4A
Codec : AAC LC
Samplerate : 48000
Bitrate : 32
Channel : 1
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0100
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
55.m4a
'
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0200
* @tc.name : 002.Playing m4a streams
* @tc.desc : Format : M4A
Codec : AAC LC
Samplerate : 48000
Bitrate : 16
Channel : 2
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0200
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
56.m4a
'
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0300
* @tc.name : 003.Playing m4a streams
* @tc.desc : Format : M4A
Codec : AAC LC
Samplerate : 48000
Bitrate : 64
Channel : 2
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0300
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
57.m4a
'
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0400
* @tc.name : 004.Playing m4a streams
* @tc.desc : Format : M4A
Codec : AAC LC
Samplerate : 48000
Bitrate : 32
Channel : 2
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0400
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
58.m4a
'
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0500
* @tc.name : 005.Playing m4a streams
* @tc.desc : Format : M4A
Codec : AAC LC
Samplerate : 96000
Bitrate : 32
Channel : 1
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0500
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
59.m4a
'
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0600
* @tc.name : 006.Playing m4a streams
* @tc.desc : Format : M4A
Codec : AAC LC
Samplerate : 96000
Bitrate : 32
Channel : 2
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0600
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
61.m4a
'
,
done
);
})
/* *
* @tc.number : SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0700
* @tc.name : 007.Playing m4a streams
* @tc.desc : Format : M4A
Codec : AAC LC
Samplerate : 96000
Bitrate : 64
Channel : 2
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_PLAYER_LOCAL_Format_M4A_01_0700
'
,
0
,
async
function
(
done
)
{
playSource
(
BASIC_PATH
+
'
62.m4a
'
,
done
);
})
})
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录