Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
72afc496
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看板
提交
72afc496
编写于
7月 19, 2023
作者:
W
wangzx0705
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify the callback code format and update some testcases
Signed-off-by:
N
wangzx0705
<
wangzx0705@thundersoft.com
>
上级
0f1092c4
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
277 addition
and
569 deletion
+277
-569
multimedia/audio/audio_js_standard/AudioRendererEnhance/src/main/ets/test/GetAndSetRendererSamplingRate.test.ets
.../src/main/ets/test/GetAndSetRendererSamplingRate.test.ets
+159
-378
multimedia/audio/audio_js_standard/AudioRendererEnhance/src/main/ets/test/GetAndSetRendererSamplingRatePerf.test.ets
.../main/ets/test/GetAndSetRendererSamplingRatePerf.test.ets
+6
-7
multimedia/audio/audio_js_standard/AudioRendererEnhance/src/main/ets/test/GetCurrentOutputDevices.test.ets
...nhance/src/main/ets/test/GetCurrentOutputDevices.test.ets
+0
-6
multimedia/audio/audio_js_standard/AudioRendererEnhance/src/main/ets/test/GetCurrentOutputDevicesPerf.test.ets
...ce/src/main/ets/test/GetCurrentOutputDevicesPerf.test.ets
+0
-6
multimedia/audio/audio_js_standard/AudioRendererEnhance/src/main/ets/test/GetMaxAndMinStreamVolume.test.ets
...hance/src/main/ets/test/GetMaxAndMinStreamVolume.test.ets
+106
-166
multimedia/audio/audio_js_standard/AudioRendererEnhance/src/main/ets/test/GetMaxAndMinStreamVolumePerf.test.ets
...e/src/main/ets/test/GetMaxAndMinStreamVolumePerf.test.ets
+6
-6
未找到文件。
multimedia/audio/audio_js_standard/AudioRendererEnhance/src/main/ets/test/GetAndSetRendererSamplingRate.test.ets
浏览文件 @
72afc496
此差异已折叠。
点击以展开。
multimedia/audio/audio_js_standard/AudioRendererEnhance/src/main/ets/test/GetAndSetRendererSamplingRatePerf.test.ets
浏览文件 @
72afc496
...
...
@@ -34,8 +34,8 @@ export default function audioRendererTest() {
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
}
let AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_
SPEECH
,
usage: audio.StreamUsage.STREAM_USAGE_
VOICE_COMMUNICATION
,
content: audio.ContentType.CONTENT_TYPE_
UNKNOWN
,
usage: audio.StreamUsage.STREAM_USAGE_
MEDIA
,
rendererFlags: 0
}
let AudioRendererOptions = {
...
...
@@ -100,8 +100,8 @@ export default function audioRendererTest() {
done();
})
it('SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_PROMISE_0
6
00', 0, async function (done) {
let number = `SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_PROMISE_0
6
00`
it('SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_PROMISE_0
5
00', 0, async function (done) {
let number = `SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_PROMISE_0
5
00`
let rate = 48000
for (let index = 0; index < env.GENERAL_RUN_TIMES; index++){
try {
...
...
@@ -173,9 +173,9 @@ export default function audioRendererTest() {
}
})
it('SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_CALLBACK_0
6
00',0, async function (done) {
it('SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_CALLBACK_0
5
00',0, async function (done) {
// Defines a test case. This API supports zaro parameters: test case name, filter parameter, and test case function.
let number = `SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_CALLBACK_0
6
00`
let number = `SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_CALLBACK_0
5
00`
let rate = 48000
setRendererSamplingRateTest(0)
function setRendererSamplingRateTest(index) {
...
...
@@ -215,6 +215,5 @@ export default function audioRendererTest() {
})
}
})
})
}
\ No newline at end of file
multimedia/audio/audio_js_standard/AudioRendererEnhance/src/main/ets/test/GetCurrentOutputDevices.test.ets
浏览文件 @
72afc496
...
...
@@ -139,12 +139,9 @@ export default function audioRendererTest() {
await
audioRen
.
getCurrentOutputDevices
()
.
then
((
data
)
=>
{
console
.
info
(
`${TagFrmwkRender}: deviceRole:${data.deviceRole}, deviceType:${data.deviceType}, id:${data.id}, name:${data.name}, address:${data.address}, sampleRates:${data.sampleRates}, channelCounts:${data.channelCounts}, channelMasks:${data.channelMasks}`
);
try
{
if
(
data
.
sampleRates
==
44100
&&
data
.
channelCounts
==
2
){
expect
(
data
.
deviceRole
)
.
assertEqual
(
audio
.
DeviceRole
.
OUTPUT_DEVICE
);
expect
(
data
.
deviceType
)
.
assertEqual
(
audio
.
DeviceType
.
SPEAKER
);
expect
(
data
.
id
)
.
assertLargerOrEqual
(
env
.
OUTPUT_NUMBER_0
);
expect
(
data
.
channelMasks
)
.
assertLargerOrEqual
(
env
.
OUTPUT_NUMBER_0
);
}
}
catch
(
error
){
console
.
log
(
'${TagFrmwkRender}: ######assertion failure'
);
}
...
...
@@ -304,12 +301,9 @@ export default function audioRendererTest() {
}
else
{
console
.
info
(
`${TagFrmwkRender}: deviceRole:${data.deviceRole}, deviceType:${data.deviceType}, id:${data.id}, address:${data.address}, sampleRates:${data.sampleRates}, channelCounts:${data.channelCounts}, channelMasks:${data.channelMasks}`
);
try
{
if
(
data
.
sampleRates
==
44100
&&
data
.
channelCounts
==
2
){
expect
(
data
.
deviceRole
)
.
assertEqual
(
audio
.
DeviceRole
.
OUTPUT_DEVICE
);
expect
(
data
.
deviceType
)
.
assertEqual
(
audio
.
DeviceType
.
SPEAKER
);
expect
(
data
.
id
)
.
assertLargerOrEqual
(
env
.
OUTPUT_NUMBER_0
);
expect
(
data
.
channelMasks
)
.
assertLargerOrEqual
(
env
.
OUTPUT_NUMBER_0
);
}
}
catch
(
error
){
console
.
log
(
'${TagFrmwkRender}: ######assertion failure'
);
}
...
...
multimedia/audio/audio_js_standard/AudioRendererEnhance/src/main/ets/test/GetCurrentOutputDevicesPerf.test.ets
浏览文件 @
72afc496
...
...
@@ -80,12 +80,9 @@ export default function audioRendererTest() {
try {
let data = await audioRen.getCurrentOutputDevices();
try{
if (data.sampleRates == 44100 && data.channelCounts == 2) {
expect(data.deviceRole).assertEqual(audio.DeviceRole.OUTPUT_DEVICE);
expect(data.deviceType).assertEqual(audio.DeviceType.SPEAKER);
expect(data.id).assertLargerOrEqual(0);
expect(data.channelMasks).assertLargerOrEqual(0);
}
}catch (error){
console.log('${TagFrmwkRender}:######assertion failure');
}
...
...
@@ -121,12 +118,9 @@ export default function audioRendererTest() {
return;
}else{
try{
if(data.sampleRates == 44100 && data.channelCounts == 2){
expect(data.deviceRole).assertEqual(audio.DeviceRole.OUTPUT_DEVICE);
expect(data.deviceType).assertEqual(audio.DeviceType.SPEAKER);
expect(data.id).assertLargerOrEqual(0);
expect(data.channelMasks).assertLargerOrEqual(0);
}
}catch (error){
console.log('${TagFrmwkRender}: ######assertion failure');
}
...
...
multimedia/audio/audio_js_standard/AudioRendererEnhance/src/main/ets/test/GetMaxAndMinStreamVolume.test.ets
浏览文件 @
72afc496
...
...
@@ -36,7 +36,7 @@ export default function audioRendererTest() {
encodingType
:
audio
.
AudioEncodingType
.
ENCODING_TYPE_RAW
}
let
AudioRendererInfo
=
{
content
:
audio
.
ContentType
.
CONTENT_TYPE_
SPEECH
,
content
:
audio
.
ContentType
.
CONTENT_TYPE_
UNKNOWN
,
usage
:
audio
.
StreamUsage
.
STREAM_USAGE_MEDIA
,
rendererFlags
:
0
}
...
...
@@ -247,7 +247,7 @@ export default function audioRendererTest() {
encodingType
:
audio
.
AudioEncodingType
.
ENCODING_TYPE_RAW
}
let
AudioRendererInfo
=
{
content
:
audio
.
ContentType
.
CONTENT_TYPE_
SPEECH
,
content
:
audio
.
ContentType
.
CONTENT_TYPE_
UNKNOWN
,
usage
:
StreamType
,
rendererFlags
:
0
}
...
...
@@ -299,28 +299,24 @@ export default function audioRendererTest() {
* @tc.level : Level 0
*/
it
(
'SUB_MULTIMEDIA_AUDIO_RENDERER_GETMAXSTREAMVOLUME_PROMISE_0400'
,
0
,
async
function
(
done
)
{
let
maxVolume
=
0.0
;
try
{
await
audioRen
.
getMaxStreamVolume
()
.
then
((
data
)
=>
{
console
.
info
(
`${TagFrmwkRender}: #####getMaxStreamVolume :SUCCESS ${data}`
);
maxVolume
=
data
;
expect
(
data
)
.
assertEqual
(
env
.
OUTPUT_NUMBER_1
);
audioRen
.
setVolume
(
data
)
.
then
(()
=>
{
console
.
info
(
`${TagFrmwkRender}: setVolume to maxVolume Success! maxVolume: ${data}`
);
expect
(
true
)
.
assertTrue
();
done
();
})
.
catch
((
err
)
=>
{
console
.
info
(
`${TagFrmwkRender}: setVolume : ERROR : code: ${err.code}, mesage: ${err.message}`
);
expect
(
false
)
.
assertTrue
();
done
();
});
})
.
catch
((
error
)
=>
{
console
.
info
(
`${TagFrmwkRender}: ####getMaxStreamVolume : ERROR : code: ${error.code}, mesage: ${error.message}`
);
expect
(
false
)
.
assertTrue
();
done
();
});
await
audioRen
.
setVolume
(
maxVolume
)
.
then
(()
=>
{
console
.
info
(
`${TagFrmwkRender}: setVolume to 1 : Success`
);
expect
(
true
)
.
assertTrue
();
done
();
})
.
catch
((
err
)
=>
{
console
.
info
(
`${TagFrmwkRender}: setVolume : ERROR : code: ${err.code}, mesage: ${err.message}`
);
expect
(
false
)
.
assertTrue
();
done
();
});
}
catch
(
error
){
console
.
info
(
`SUB_MULTIMEDIA_AUDIO_RENDERER_GETMAXSTREAMVOLUME_PROMISE_0400: catch error, error: [${error.code}, ${error.message}]`
);
expect
(
false
)
.
assertTrue
();
...
...
@@ -411,7 +407,7 @@ export default function audioRendererTest() {
encodingType
:
audio
.
AudioEncodingType
.
ENCODING_TYPE_RAW
}
let
AudioRendererInfo
=
{
content
:
audio
.
ContentType
.
CONTENT_TYPE_
SPEECH
,
content
:
audio
.
ContentType
.
CONTENT_TYPE_
UNKNOWN
,
usage
:
StreamType
,
rendererFlags
:
0
}
...
...
@@ -424,7 +420,6 @@ export default function audioRendererTest() {
await
audio
.
createAudioRenderer
(
AudioRendererOptions
)
.
then
((
data
)
=>
{
audioRender
=
data
;
console
.
info
(
`${TagFrmwkRender}: AudioRender Created : Stream Type: ${StreamType} SUCCESS data state: `
+
Object
.
keys
(
data
));
console
.
info
(
`${TagFrmwkRender}: AudioRender Created : Stream Type: ${StreamType} STREAM_USAGE_MEDIA SUCCESS data value: `
+
JSON
.
stringify
(
data
));
})
.
catch
((
err
)
=>
{
console
.
info
(
`${TagFrmwkRender}: AudioRender Created : ERROR : `
+
err
.
message
);
});
...
...
@@ -463,28 +458,24 @@ export default function audioRendererTest() {
* @tc.level : Level 0
*/
it
(
'SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_PROMISE_0400'
,
0
,
async
function
(
done
)
{
let
minVolume
=
1.0
;
try
{
await
audioRen
.
getMinStreamVolume
()
.
then
((
data
)
=>
{
console
.
info
(
`${TagFrmwkRender}: #####getMinStreamVolume :SUCCESS ${data}`
);
minVolume
=
data
;
expect
(
data
)
.
assertEqual
(
env
.
OUTPUT_NUMBER_0
);
audioRen
.
setVolume
(
data
)
.
then
(()
=>
{
console
.
info
(
`${TagFrmwkRender}: setVolume to minVolume Success! minVolume: ${data}`
);
expect
(
true
)
.
assertTrue
();
done
();
})
.
catch
((
err
)
=>
{
console
.
info
(
`${TagFrmwkRender}: setVolume : ERROR : code: ${err.code}, mesage: ${err.message}`
);
expect
(
false
)
.
assertTrue
();
done
();
});
})
.
catch
((
error
)
=>
{
console
.
info
(
`${TagFrmwkRender}: ####getMinStreamVolume : ERROR : code: ${error.code}, mesage: ${error.message}`
);
expect
(
false
)
.
assertTrue
();
done
();
});
await
audioRen
.
setVolume
(
minVolume
)
.
then
(()
=>
{
console
.
info
(
`${TagFrmwkRender}: setVolume to 0 : Success`
);
expect
(
true
)
.
assertTrue
();
done
();
})
.
catch
((
err
)
=>
{
console
.
info
(
`${TagFrmwkRender}: setVolume : ERROR : code: ${err.code}, mesage: ${err.message}`
);
expect
(
false
)
.
assertTrue
();
done
();
});
}
catch
(
error
){
console
.
info
(
`SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_PROMISE_0400: catch error, error: [${error.code}, ${error.message}]`
);
expect
(
false
)
.
assertTrue
();
...
...
@@ -501,24 +492,17 @@ export default function audioRendererTest() {
* @tc.level : Level 0
*/
it
(
'SUB_MULTIMEDIA_AUDIO_RENDERER_GETMAXSTREAMVOLUME_CALLBACK_0100'
,
0
,
async
function
(
done
)
{
let
CallBack
:
any
=
(
error
,
data
)
=>
{
if
(
err
or
)
{
console
.
log
(
`${TagFrmwkRender}: ####CallBack: execution fail,error: [${error.code}, ${error.message}]`
);
audioRen
.
getMaxStreamVolume
((
err
,
maxVolume
)
=>
{
if
(
err
)
{
console
.
error
(
'${TagFrmwkRender} Get max stream volume Fail: ${err}'
);
expect
(
false
)
.
assertTrue
();
done
();
}
else
{
console
.
log
(
`${TagFrmwkRender}: ####CallBack: execution success, data: ${JSON.stringify(data)}`
);
expect
(
data
)
.
assertEqual
(
env
.
OUTPUT_NUMBER_1
);
}
else
{
console
.
info
(
'${TagFrmwkRender} Get max stream volume Success! ${maxVolume}'
);
expect
(
maxVolume
)
.
assertEqual
(
env
.
OUTPUT_NUMBER_1
);
done
();
}
};
try
{
audioRen
.
getMaxStreamVolume
(
CallBack
);
}
catch
(
error
){
console
.
log
(
`${TagFrmwkRender}: ####getMaxStreamVolume: catch error, error: [${error.code}, ${error.message}]`
);
expect
(
true
)
.
assertTrue
();
done
();
}
})
});
/**
...
...
@@ -530,25 +514,18 @@ export default function audioRendererTest() {
* @tc.level : Level 0
*/
it
(
'SUB_MULTIMEDIA_AUDIO_RENDERER_GETMAXSTREAMVOLUME_CALLBACK_0200'
,
0
,
async
function
(
done
)
{
let
CallBack
:
any
=
(
error
,
data
)
=>
{
if
(
error
)
{
console
.
log
(
`${TagFrmwkRender}: ####CallBack: execution fail,error: [${error.code}, ${error.message}]`
);
await
renderPlay
();
audioRen
.
getMaxStreamVolume
((
err
,
maxVolume
)
=>
{
if
(
err
)
{
console
.
error
(
'${TagFrmwkRender} Get max stream volume Fail: ${err}'
);
expect
(
false
)
.
assertTrue
();
done
();
}
else
{
console
.
log
(
`${TagFrmwkRender}: ####CallBack: execution success, data: ${JSON.stringify(data)}`
);
expect
(
data
)
.
assertEqual
(
env
.
OUTPUT_NUMBER_1
);
}
else
{
console
.
info
(
'${TagFrmwkRender} Get max stream volume Success! ${maxVolume}'
);
expect
(
maxVolume
)
.
assertEqual
(
env
.
OUTPUT_NUMBER_1
);
done
();
}
};
try
{
await
renderPlay
();
audioRen
.
getMaxStreamVolume
(
CallBack
);
}
catch
(
error
){
console
.
log
(
`${TagFrmwkRender}: ####getMaxStreamVolume: catch error, error: [${error.code}, ${error.message}]`
);
expect
(
true
)
.
assertTrue
();
done
();
}
})
});
/**
...
...
@@ -561,17 +538,6 @@ export default function audioRendererTest() {
*/
it
(
'SUB_MULTIMEDIA_AUDIO_RENDERER_GETMAXSTREAMVOLUME_CALLBACK_0300'
,
0
,
async
function
(
done
)
{
let
StreamType
;
let
CallBack
:
any
=
(
error
,
data
)
=>
{
if
(
error
)
{
console
.
log
(
`${TagFrmwkRender}: ####CallBack: execution fail,error: [${error.code}, ${error.message}]`
);
expect
(
false
)
.
assertTrue
();
done
();
}
else
{
console
.
log
(
`${TagFrmwkRender}: ####CallBack:StreamType:${StreamType} execution success, data: ${JSON.stringify(data)}`
);
expect
(
data
)
.
assertEqual
(
env
.
OUTPUT_NUMBER_1
);
}
};
try
{
for
(
StreamType
in
audio
.
StreamUsage
)
{
let
audioRender
;
...
...
@@ -582,7 +548,7 @@ export default function audioRendererTest() {
encodingType
:
audio
.
AudioEncodingType
.
ENCODING_TYPE_RAW
}
let
AudioRendererInfo
=
{
content
:
audio
.
ContentType
.
CONTENT_TYPE_
SPEECH
,
content
:
audio
.
ContentType
.
CONTENT_TYPE_
UNKNOWN
,
usage
:
StreamType
,
rendererFlags
:
0
}
...
...
@@ -603,12 +569,17 @@ export default function audioRendererTest() {
console
.
info
(
`${TagFrmwkRender}: AudioRender Created : catch ERROR : `
+
error
.
code
+
error
.
message
);
}
try
{
audioRen
.
getMaxStreamVolume
();
}
catch
(
error
){
console
.
log
(
`${TagFrmwkRender}: ####getMaxStreamVolume: catch error, error: [${error.code}, ${error.message}]`
);
expect
(
false
)
.
assertTrue
();
}
audioRen
.
getMaxStreamVolume
((
err
,
maxVolume
)
=>
{
if
(
err
)
{
console
.
error
(
'${TagFrmwkRender} Get max stream volume Fail: ${err}'
);
expect
(
false
)
.
assertTrue
();
done
();
}
else
{
console
.
info
(
'${TagFrmwkRender} Get max stream volume Success! ${maxVolume}'
);
expect
(
maxVolume
)
.
assertEqual
(
env
.
OUTPUT_NUMBER_1
);
done
();
}
})
sleep
(
1000
);
await
audioRender
.
release
()
.
then
(()
=>
{
...
...
@@ -636,32 +607,25 @@ export default function audioRendererTest() {
* @tc.level : Level 0
*/
it
(
'SUB_MULTIMEDIA_AUDIO_RENDERER_GETMAXSTREAMVOLUME_CALLBACK_0400'
,
0
,
async
function
(
done
)
{
let
maxVolume
=
0.0
;
let
CallBack
:
any
=
(
error
,
data
)
=>
{
if
(
error
)
{
console
.
log
(
`${TagFrmwkRender}: ####CallBack: execution fail,error: [${error.code}, ${error.message}]`
);
audioRen
.
getMaxStreamVolume
((
err
,
maxVolume
)
=>
{
if
(
err
)
{
console
.
error
(
'${TagFrmwkRender} Get max stream volume Fail: ${err}'
);
expect
(
false
)
.
assertTrue
();
done
();
}
else
{
console
.
log
(
`${TagFrmwkRender}: ####CallBack: execution success, data: ${JSON.stringify(data)}`
);
}
else
{
console
.
info
(
`${TagFrmwkRender} Get max stream volume Success! maxVolume: ${maxVolume}`
);
expect
(
maxVolume
)
.
assertEqual
(
env
.
OUTPUT_NUMBER_1
);
audioRen
.
setVolume
(
maxVolume
)
.
then
(()
=>
{
console
.
info
(
`${TagFrmwkRender}: setVolume to maxVolume Success! maxVolume: ${maxVolume}`
);
expect
(
true
)
.
assertTrue
();
done
();
})
.
catch
((
err
)
=>
{
console
.
info
(
`${TagFrmwkRender}: setVolume ERROR! : code: ${err.code}, mesage: ${err.message}`
);
expect
(
false
)
.
assertTrue
();
done
();
});
}
};
try
{
audioRen
.
getMaxStreamVolume
(
CallBack
);
}
catch
(
error
){
console
.
log
(
`${TagFrmwkRender}: ####getMaxStreamVolume: catch error, error: [${error.code}, ${error.message}]`
);
expect
(
false
)
.
assertTrue
();
}
await
audioRen
.
setVolume
(
maxVolume
)
.
then
(()
=>
{
console
.
info
(
`${TagFrmwkRender}: setVolume to 1 : Success`
);
expect
(
true
)
.
assertTrue
();
done
();
})
.
catch
((
err
)
=>
{
console
.
info
(
`${TagFrmwkRender}: setVolume : ERROR : code: ${err.code}, mesage: ${err.message}`
);
expect
(
false
)
.
assertTrue
();
done
();
});
})
});
/**
...
...
@@ -673,24 +637,17 @@ export default function audioRendererTest() {
* @tc.level : Level 0
*/
it
(
'SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_CALLBACK_0100'
,
0
,
async
function
(
done
)
{
let
CallBack
:
any
=
(
error
,
data
)
=>
{
if
(
err
or
)
{
console
.
log
(
`${TagFrmwkRender}: ####CallBack: execution fail,error: [${error.code}, ${error.message}]`
);
audioRen
.
getMinStreamVolume
((
err
,
minVolume
)
=>
{
if
(
err
)
{
console
.
error
(
'${TagFrmwkRender} Get min stream volume Fail: ${err}'
);
expect
(
false
)
.
assertTrue
();
done
();
}
else
{
console
.
log
(
`${TagFrmwkRender}: ####CallBack: execution success, data: ${JSON.stringify(data)
}`
);
expect
(
data
)
.
assertEqual
(
env
.
OUTPUT_NUMBER_0
);
}
else
{
console
.
info
(
`${TagFrmwkRender} Get min stream volume Success! minVolume: ${minVolume
}`
);
expect
(
minVolume
)
.
assertEqual
(
env
.
OUTPUT_NUMBER_0
);
done
();
}
};
try
{
audioRen
.
getMinStreamVolume
(
CallBack
);
}
catch
(
error
){
console
.
log
(
`SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_CALLBACK_0100: catch error, error: [${error.code}, ${error.message}]`
);
expect
(
false
)
.
assertTrue
();
done
();
};
})
});
/**
...
...
@@ -702,27 +659,18 @@ export default function audioRendererTest() {
* @tc.level : Level 0
*/
it
(
'SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_CALLBACK_0200'
,
0
,
async
function
(
done
)
{
console
.
info
(
'${TagFrmwkRender}: SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_CALLBACK_0200 IN.\n'
);
let
maxVolume
=
1.0
;
let
CallBack
:
any
=
(
error
,
data
)
=>
{
if
(
error
)
{
console
.
log
(
`${TagFrmwkRender}: ####CallBack: execution fail,error: [${error.code}, ${error.message}]`
);
await
renderPlay
();
audioRen
.
getMinStreamVolume
((
err
,
minVolume
)
=>
{
if
(
err
)
{
console
.
error
(
'${TagFrmwkRender} Get min stream volume Fail: ${err}'
);
expect
(
false
)
.
assertTrue
();
done
();
}
else
{
console
.
log
(
`${TagFrmwkRender}: ####CallBack: execution success, data: ${JSON.stringify(data)
}`
);
expect
(
data
)
.
assertEqual
(
env
.
OUTPUT_NUMBER_0
);
}
else
{
console
.
info
(
`${TagFrmwkRender} Get min stream volume Success! minVolume: ${minVolume
}`
);
expect
(
minVolume
)
.
assertEqual
(
env
.
OUTPUT_NUMBER_0
);
done
();
}
};
try
{
await
renderPlay
();
audioRen
.
getMinStreamVolume
(
CallBack
,
maxVolume
);
}
catch
(
error
){
console
.
log
(
`${TagFrmwkRender}: ####getMinStreamVolume: catch error, error: [${error.code}, ${error.message}]`
);
expect
(
false
)
.
assertTrue
();
done
();
};
})
});
...
...
@@ -736,16 +684,6 @@ export default function audioRendererTest() {
*/
it
(
'SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_CALLBACK_0300'
,
0
,
async
function
(
done
)
{
let
StreamType
;
let
CallBack
:
any
=
(
error
,
data
)
=>
{
if
(
error
)
{
console
.
log
(
`${TagFrmwkRender}: ####CallBack: execution fail,error: [${error.code}, ${error.message}]`
);
expect
(
false
)
.
assertTrue
();
done
();
}
else
{
console
.
log
(
`${TagFrmwkRender}: ####CallBack:StreamType:${StreamType} execution success, data: ${JSON.stringify(data)}`
);
expect
(
data
)
.
assertEqual
(
env
.
OUTPUT_NUMBER_0
);
}
};
try
{
for
(
StreamType
in
audio
.
StreamUsage
)
{
...
...
@@ -757,7 +695,7 @@ export default function audioRendererTest() {
encodingType
:
audio
.
AudioEncodingType
.
ENCODING_TYPE_RAW
}
let
AudioRendererInfo
=
{
content
:
audio
.
ContentType
.
CONTENT_TYPE_
SPEECH
,
content
:
audio
.
ContentType
.
CONTENT_TYPE_
UNKNOWN
,
usage
:
StreamType
,
rendererFlags
:
0
}
...
...
@@ -770,7 +708,6 @@ export default function audioRendererTest() {
await
audio
.
createAudioRenderer
(
AudioRendererOptions
)
.
then
((
data
)
=>
{
audioRender
=
data
;
console
.
info
(
`${TagFrmwkRender}: AudioRender Created : Stream Type: ${StreamType} SUCCESS data state: `
+
Object
.
keys
(
data
));
console
.
info
(
`${TagFrmwkRender}: AudioRender Created : Stream Type: ${StreamType} STREAM_USAGE_MEDIA SUCCESS data value: `
+
JSON
.
stringify
(
data
));
})
.
catch
((
err
)
=>
{
console
.
info
(
`${TagFrmwkRender}: AudioRender Created : ERROR : `
+
err
.
message
);
});
...
...
@@ -778,7 +715,16 @@ export default function audioRendererTest() {
console
.
info
(
`${TagFrmwkRender}: AudioRender Created : catch ERROR : `
+
error
.
code
+
error
.
message
);
}
audioRen
.
getMinStreamVolume
(
CallBack
);
audioRen
.
getMinStreamVolume
((
err
,
minVolume
)
=>
{
if
(
err
)
{
console
.
error
(
'${TagFrmwkRender} Get min stream volume Fail: ${err}'
);
expect
(
false
)
.
assertTrue
();
done
();
}
else
{
console
.
info
(
`${TagFrmwkRender} Get min stream volume Success! minVolume: ${minVolume}`
);
expect
(
minVolume
)
.
assertEqual
(
env
.
OUTPUT_NUMBER_0
);
}
})
sleep
(
1000
);
await
audioRender
.
release
()
.
then
(()
=>
{
...
...
@@ -805,31 +751,25 @@ export default function audioRendererTest() {
*/
it
(
'SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_CALLBACK_0400'
,
0
,
async
function
(
done
)
{
let
minVolume
=
1.0
;
let
CallBack
:
any
=
(
error
,
data
)
=>
{
if
(
err
or
)
{
console
.
log
(
`${TagFrmwkRender}: SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_CALLBACK_0400: execution fail,error: [${error.code}, ${error.message}]`
);
audioRen
.
getMinStreamVolume
((
err
,
minVolume
)
=>
{
if
(
err
)
{
console
.
error
(
'${TagFrmwkRender} Get min stream volume Fail: ${err}'
);
expect
(
false
)
.
assertTrue
();
done
();
}
else
{
console
.
log
(
`${TagFrmwkRender}: SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_CALLBACK_0400: execution success, data: ${JSON.stringify(data)}`
);
}
else
{
console
.
info
(
`${TagFrmwkRender} Get min stream volume Success! minVolume: ${minVolume}`
);
expect
(
minVolume
)
.
assertEqual
(
env
.
OUTPUT_NUMBER_0
);
audioRen
.
setVolume
(
minVolume
)
.
then
(()
=>
{
console
.
info
(
`${TagFrmwkRender}: setVolume to minVolume Success! minVolume: ${minVolume}`
);
expect
(
true
)
.
assertTrue
();
done
();
})
.
catch
((
err
)
=>
{
console
.
info
(
`${TagFrmwkRender}: setVolume : ERROR : code: ${err.code}, mesage: ${err.message}`
);
expect
(
false
)
.
assertTrue
();
done
();
});
}
};
try
{
audioRen
.
getMinStreamVolume
(
CallBack
);
}
catch
(
error
){
console
.
log
(
`${TagFrmwkRender}: SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_CALLBACK_0400: catch error, error: [${error.code}, ${error.message}]`
);
expect
(
false
)
.
assertTrue
();
done
();
};
await
audioRen
.
setVolume
(
minVolume
)
.
then
(()
=>
{
console
.
info
(
`${TagFrmwkRender}: setVolume to 0 : Success`
);
expect
(
true
)
.
assertTrue
();
done
();
})
.
catch
((
err
)
=>
{
console
.
info
(
`${TagFrmwkRender}: setVolume : ERROR : code: ${err.code}, mesage: ${err.message}`
);
expect
(
false
)
.
assertTrue
();
done
();
});
})
});
})
...
...
multimedia/audio/audio_js_standard/AudioRendererEnhance/src/main/ets/test/GetMaxAndMinStreamVolumePerf.test.ets
浏览文件 @
72afc496
...
...
@@ -34,8 +34,8 @@ export default function audioRendererTest() {
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
}
let AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_
SPEECH
,
usage: audio.StreamUsage.STREAM_USAGE_
VOICE_COMMUNICATION
,
content: audio.ContentType.CONTENT_TYPE_
UNKNOWN
,
usage: audio.StreamUsage.STREAM_USAGE_
MEDIA
,
rendererFlags: 0
}
let AudioRendererOptions = {
...
...
@@ -79,7 +79,7 @@ export default function audioRendererTest() {
for (let index = 0; index < env.GENERAL_RUN_TIMES; index++) {
try {
let data = await audioRen.getMaxStreamVolume();
expect(data).assertEqual(
1.0
);
expect(data).assertEqual(
env.OUTPUT_NUMBER_1
);
} catch (error) {
console.log(`${TagFrmwkRender}: ####getMaxStreamVolume: execution ${index + 1} times error: ${JSON.stringify(error)}`);
expect(false).assertTrue();
...
...
@@ -117,7 +117,7 @@ export default function audioRendererTest() {
for (let index = 0; index < env.GENERAL_RUN_TIMES; index++) {
try {
let data = await audioRen.getMinStreamVolume();
expect(data).assertEqual(
0.
0);
expect(data).assertEqual(
env.OUTPUT_NUMBER_
0);
} catch (error) {
console.log(`${TagFrmwkRender}: ####getMinStreamVolume: execution ${index + 1} times error: ${JSON.stringify(error)}`);
expect(false).assertTrue();
...
...
@@ -164,7 +164,7 @@ export default function audioRendererTest() {
done();
return;
}else{
expect(data).assertEqual(
1.0
);
expect(data).assertEqual(
env.OUTPUT_NUMBER_1
);
recursive(n-1);
}
});
...
...
@@ -223,7 +223,7 @@ export default function audioRendererTest() {
done();
return;
}else{
expect(data).assertEqual(
0.
0);
expect(data).assertEqual(
env.OUTPUT_NUMBER_
0);
recursive(n-1);
}
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录