Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
4d911162
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看板
提交
4d911162
编写于
7月 26, 2023
作者:
W
wangzx0705
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modifty final acts testcase
Signed-off-by:
N
wangzx0705
<
wangzx0705@thundersoft.com
>
上级
37100992
变更
9
展开全部
隐藏空白更改
内联
并排
Showing
9 changed file
with
595 addition
and
1077 deletion
+595
-1077
multimedia/audio/audio_js_standard/AudioManagerEnhance/src/main/ets/test/Const.ets
..._standard/AudioManagerEnhance/src/main/ets/test/Const.ets
+2
-1
multimedia/audio/audio_js_standard/AudioManagerEnhance/src/main/ets/test/GetSystemVolumeInDb.test.ets
...gerEnhance/src/main/ets/test/GetSystemVolumeInDb.test.ets
+279
-720
multimedia/audio/audio_js_standard/AudioManagerEnhance/src/main/ets/test/List.test.ets
...ndard/AudioManagerEnhance/src/main/ets/test/List.test.ets
+0
-3
multimedia/audio/audio_js_standard/AudioRendererEnhance/Test.json
...ia/audio/audio_js_standard/AudioRendererEnhance/Test.json
+1
-0
multimedia/audio/audio_js_standard/AudioRendererEnhance/src/main/ets/test/GetAndSetRendererSamplingRate.test.ets
.../src/main/ets/test/GetAndSetRendererSamplingRate.test.ets
+0
-1
multimedia/audio/audio_js_standard/AudioRendererEnhance/src/main/ets/test/GetCurrentOutputDevices.test.ets
...nhance/src/main/ets/test/GetCurrentOutputDevices.test.ets
+56
-73
multimedia/audio/audio_js_standard/AudioRendererEnhance/src/main/ets/test/GetMaxAndMinStreamVolume.test.ets
...hance/src/main/ets/test/GetMaxAndMinStreamVolume.test.ets
+66
-60
multimedia/audio/audio_js_standard/AudioRendererEnhance/src/main/ets/test/GetUnderflowCount.test.ets
...dererEnhance/src/main/ets/test/GetUnderflowCount.test.ets
+95
-113
multimedia/audio/audio_js_standard/AudioRendererEnhance/src/main/ets/test/OnOffOutputDeviceChange.test.ets
...nhance/src/main/ets/test/OnOffOutputDeviceChange.test.ets
+96
-106
未找到文件。
multimedia/audio/audio_js_standard/AudioManagerEnhance/src/main/ets/test/Const.ets
浏览文件 @
4d911162
...
...
@@ -22,4 +22,5 @@ export const OUTPUT_NUMBER_1 = 1;
//--------------------------------------------------------------
export const INVALID_INPUT_PARAMETER_401 = 401;
export const INVALID_INPUT_PARAMETER_6800101 = 6800101;
export const UNSUPORTED_OPTION_6800104 = 6800104;
\ No newline at end of file
export const UNSUPORTED_OPTION_6800104 = 6800104;
export const DEAFULT_MEDIA_DB = 0.08370080590248108;
\ No newline at end of file
multimedia/audio/audio_js_standard/AudioManagerEnhance/src/main/ets/test/GetSystemVolumeInDb.test.ets
浏览文件 @
4d911162
此差异已折叠。
点击以展开。
multimedia/audio/audio_js_standard/AudioManagerEnhance/src/main/ets/test/List.test.ets
浏览文件 @
4d911162
...
...
@@ -14,9 +14,6 @@
*/
import isVolumeUnadjustable from './IsVolumeUnadjustable.test.ets';
import getSystemVolumeInDb from './GetSystemVolumeInDb.test.ets';
import adjustVolumeByStep from './AdjustVolumeByStep.test.ets';
import adjustSystemVolumeByStep from './AdjustSystemVolumeByStep.test.ets';
import getDefaultVolume from './GetDefaultVolume.test.ets';
import getMax_Minvolume from './GetMax_Minvolume.test.ets';
export default function testsuite() {
...
...
multimedia/audio/audio_js_standard/AudioRendererEnhance/Test.json
浏览文件 @
4d911162
...
...
@@ -19,6 +19,7 @@
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"power-shell wakeup"
,
"mkdir -p /data/app/el2/100/base/com.example.xts_test_case/haps/entry/files"
,
"chmod 777 -R /data/app/el2/100/base/com.example.xts_test_case/haps/entry"
],
...
...
multimedia/audio/audio_js_standard/AudioRendererEnhance/src/main/ets/test/GetAndSetRendererSamplingRate.test.ets
浏览文件 @
4d911162
...
...
@@ -654,6 +654,5 @@ export default function audioRendererTest() {
}
});
});
})
}
\ No newline at end of file
multimedia/audio/audio_js_standard/AudioRendererEnhance/src/main/ets/test/GetCurrentOutputDevices.test.ets
浏览文件 @
4d911162
...
...
@@ -36,8 +36,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
=
{
...
...
@@ -138,21 +138,17 @@ export default function audioRendererTest() {
try
{
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
{
expect
(
data
.
deviceRole
)
.
assertEqual
(
audio
.
DeviceRole
.
OUTPUT_DEVICE
);
expect
(
data
.
deviceType
)
.
assertEqual
(
audio
.
DeviceType
.
SPEAKER
);
expect
(
data
.
id
)
.
assertLargerOrEqual
(
env
.
OUTPUT_NUMBER_0
);
}
catch
(
error
)
{
console
.
log
(
'${TagFrmwkRender}: assertion get output deviceinfo failure'
);
}
expect
(
data
.
deviceRole
)
.
assertEqual
(
audio
.
DeviceRole
.
OUTPUT_DEVICE
);
expect
(
data
.
deviceType
)
.
assertEqual
(
audio
.
DeviceType
.
SPEAKER
);
expect
(
data
.
id
)
.
assertLargerOrEqual
(
env
.
OUTPUT_NUMBER_0
);
done
();
})
.
catch
((
error
)
=>
{
console
.
log
(
"${TagFrmwkRender}: getCurrentOutputDevices
:
error = "
+
error
);
console
.
log
(
"${TagFrmwkRender}: getCurrentOutputDevices error = "
+
error
);
expect
(
false
)
.
assertTrue
();
done
();
});
}
catch
(
error
)
{
console
.
log
(
"SUB_MULTIMEDIA_AUDIO_RENDERER_GETCURRENTOUTPUTDEVICES_PROMISE_0100: catch error = "
+
error
);
console
.
info
(
`get current output deviceinfo unknown errro: [${error.code}, ${error.message}]`
);
expect
(
false
)
.
assertTrue
();
done
();
}
...
...
@@ -173,7 +169,19 @@ export default function audioRendererTest() {
console
.
info
(
`${TagFrmwkRender}: deviceRole:${data.deviceRole}, deviceType:${data.deviceType}, id:${data.id}, address:${data.address}, sampleRates:${data.sampleRates}, channelCounts:${data.channelCounts}, channelMasks:${data.channelMasks}`
);
expect
(
data
.
deviceRole
)
.
assertEqual
(
audio
.
DeviceRole
.
OUTPUT_DEVICE
);
expect
(
data
.
deviceType
)
.
assertEqual
(
audio
.
DeviceType
.
SPEAKER
);
expect
(
data
.
id
)
.
assertLargerOrEqual
(
0
);
expect
(
data
.
id
)
.
assertLargerOrEqual
(
env
.
OUTPUT_NUMBER_0
);
console
.
info
(
`${TagFrmwkRender}: Renderer get current output device SUCCESS, now stop audiorender`
);
audioRen
.
drain
()
.
then
(()
=>
{
console
.
info
(
`${TagFrmwkRender}: Renderer drain : SUCCESS, stop audiorender`
);
audioRen
.
stop
()
.
then
(()
=>
{
console
.
info
(
`${TagFrmwkRender}: Renderer stopp : SUCCESS`
);
done
();
})
.
catch
((
err
)
=>
{
console
.
info
(
`${TagFrmwkRender}: Renderer stop:ERROR : ${err.message}`
);
});
})
.
catch
((
err
)
=>
{
console
.
error
(
`${TagFrmwkRender}: Renderer drain: ERROR : ${err.message}`
);
});
})
.
catch
((
error
)
=>
{
console
.
log
(
"${TagFrmwkRender}: getCurrentOutputDevices : error = "
+
error
);
expect
(
false
)
.
assertTrue
();
...
...
@@ -183,17 +191,6 @@ export default function audioRendererTest() {
expect
(
false
)
.
assertTrue
();
done
();
}
await
audioRen
.
drain
()
.
then
(()
=>
{
console
.
info
(
`${TagFrmwkRender}: Renderer drained : SUCCESS`
);
})
.
catch
((
err
)
=>
{
console
.
error
(
`${TagFrmwkRender}: Renderer drain: ERROR : ${err.message}`
);
});
await
audioRen
.
stop
()
.
then
(()
=>
{
console
.
info
(
`${TagFrmwkRender}: Renderer stopped : SUCCESS`
);
})
.
catch
((
err
)
=>
{
console
.
info
(
`${TagFrmwkRender}: Renderer stop:ERROR : ${err.message}`
);
});
done
();
});
/**
...
...
@@ -205,27 +202,18 @@ export default function audioRendererTest() {
* @tc.level : Level 0
*/
it
(
'SUB_MULTIMEDIA_AUDIO_RENDERER_GETCURRENTOUTPUTDEVICES_CALLBACK_0100'
,
0
,
async
function
(
done
)
{
try
{
await
audioRen
.
getCurrentOutputDevices
((
err
,
data
)
=>
{
if
(
err
)
{
console
.
info
(
`${TagFrmwkRender}: ####getCurrentOutputDevices : ERROR : code: ${err.code}, mesage: ${err.message}`
);
expect
(
false
)
.
assertTrue
();
}
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
{
expect
(
data
.
deviceRole
)
.
assertEqual
(
audio
.
DeviceRole
.
OUTPUT_DEVICE
);
expect
(
data
.
deviceType
)
.
assertEqual
(
audio
.
DeviceType
.
SPEAKER
);
expect
(
data
.
id
)
.
assertLargerOrEqual
(
env
.
OUTPUT_NUMBER_0
);
}
catch
(
error
){
console
.
log
(
'${TagFrmwkRender}: ######assertion failure'
);
}
}
});
}
catch
(
error
){
console
.
info
(
`SUB_MULTIMEDIA_AUDIO_RENDERER_GETCURRENTOUTPUTDEVICES_CALLBACK_0100: catch error, error: [${error.code}, ${error.message}]`
);
expect
(
false
)
.
assertTrue
();
};
done
();
audioRen
.
getCurrentOutputDevices
((
err
,
data
)
=>
{
if
(
err
)
{
console
.
info
(
`${TagFrmwkRender}: getCurrentOutputDevices ERROR ! code: ${err.code}, mesage: ${err.message}`
);
expect
(
false
)
.
assertTrue
();
}
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}`
);
expect
(
data
.
deviceRole
)
.
assertEqual
(
audio
.
DeviceRole
.
OUTPUT_DEVICE
);
expect
(
data
.
deviceType
)
.
assertEqual
(
audio
.
DeviceType
.
SPEAKER
);
expect
(
data
.
id
)
.
assertLargerOrEqual
(
env
.
OUTPUT_NUMBER_0
);
done
();
}
});
});
/**
...
...
@@ -237,36 +225,31 @@ export default function audioRendererTest() {
* @tc.level : Level 0
*/
it
(
'SUB_MULTIMEDIA_AUDIO_RENDERER_GETCURRENTOUTPUTDEVICES_CALLBACK_0200'
,
0
,
async
function
(
done
)
{
try
{
await
renderPlay
();
await
audioRen
.
getCurrentOutputDevices
((
err
,
data
)
=>
{
if
(
err
)
{
console
.
info
(
`${TagFrmwkRender}: ####getCurrentOutputDevices : ERROR : code: ${err.code}, mesage: ${err.message}`
);
expect
(
false
)
.
assertTrue
();
done
();
}
else
{
console
.
info
(
`${TagFrmwkRender}: ####getCurrentOutputDevices :deviceRole:${data.deviceRole}, deviceType:${data.deviceType}, id:${data.id}, address:${data.address}, sampleRates:${data.sampleRates}, channelCounts:${data.channelCounts}, channelMasks:${data.channelMasks}`
);
expect
(
true
)
.
assertTrue
();
}
});
}
catch
(
error
){
console
.
info
(
`SUB_MULTIMEDIA_AUDIO_RENDERER_GETCURRENTOUTPUTDEVICES_CALLBACK_0200: catch error, error: [${error.code}, ${error.message}]`
);
expect
(
false
)
.
assertTrue
();
done
();
};
await
audioRen
.
drain
()
.
then
(()
=>
{
console
.
info
(
`${TagFrmwkRender}: Renderer drained : SUCCESS`
);
})
.
catch
((
err
)
=>
{
console
.
error
(
`${TagFrmwkRender}: Renderer drain: ERROR : ${err.message}`
);
});
await
audioRen
.
stop
()
.
then
(()
=>
{
console
.
info
(
`${TagFrmwkRender}: Renderer stopped : SUCCESS`
);
})
.
catch
((
err
)
=>
{
console
.
info
(
`${TagFrmwkRender}: Renderer stop:ERROR : ${err.message}`
);
await
renderPlay
();
audioRen
.
getCurrentOutputDevices
((
err
,
data
)
=>
{
if
(
err
)
{
console
.
info
(
`${TagFrmwkRender}: getCurrentOutputDevices ERROR! error: ${err.code}, mesage: ${err.message}`
);
expect
(
false
)
.
assertTrue
();
done
();
}
else
{
console
.
info
(
`${TagFrmwkRender}: getCurrentOutputDevices :deviceRole:${data.deviceRole}, deviceType:${data.deviceType}, id:${data.id}, address:${data.address}, sampleRates:${data.sampleRates}, channelCounts:${data.channelCounts}, channelMasks:${data.channelMasks}`
);
expect
(
data
.
deviceRole
)
.
assertEqual
(
audio
.
DeviceRole
.
OUTPUT_DEVICE
);
expect
(
data
.
deviceType
)
.
assertEqual
(
audio
.
DeviceType
.
SPEAKER
);
expect
(
data
.
id
)
.
assertLargerOrEqual
(
env
.
OUTPUT_NUMBER_0
);
console
.
info
(
`${TagFrmwkRender}: Renderer getCurrentOutputDevices SUCCESS! now stop the audiorenderer`
);
audioRen
.
drain
()
.
then
(()
=>
{
console
.
info
(
`${TagFrmwkRender}: Renderer drain, stop the audiorenderer`
);
audioRen
.
stop
()
.
then
(()
=>
{
console
.
info
(
`${TagFrmwkRender}: Renderer stopp SUCCESS, testcase SUCCESS!`
);
done
();
})
.
catch
((
err
)
=>
{
console
.
info
(
`${TagFrmwkRender}: Renderer stop:ERROR : ${err.message}`
);
});
})
.
catch
((
err
)
=>
{
console
.
error
(
`${TagFrmwkRender}: Renderer drain: ERROR : ${err.message}`
);
});
}
});
done
();
});
})
}
multimedia/audio/audio_js_standard/AudioRendererEnhance/src/main/ets/test/GetMaxAndMinStreamVolume.test.ets
浏览文件 @
4d911162
...
...
@@ -175,16 +175,16 @@ export default function audioRendererTest() {
it
(
'SUB_MULTIMEDIA_AUDIO_RENDERER_GETMAXSTREAMVOLUME_PROMISE_0100'
,
0
,
async
function
(
done
)
{
try
{
await
audioRen
.
getMaxStreamVolume
()
.
then
((
data
)
=>
{
console
.
info
(
`${TagFrmwkRender}:
#####
getMaxStreamVolume :SUCCESS ${data}`
);
console
.
info
(
`${TagFrmwkRender}:getMaxStreamVolume :SUCCESS ${data}`
);
expect
(
data
)
.
assertEqual
(
env
.
OUTPUT_NUMBER_1
);
done
();
})
.
catch
((
error
)
=>
{
console
.
log
(
"${TagFrmwkRender}:
#####
getMaxStreamVolume : error = "
+
error
);
console
.
log
(
"${TagFrmwkRender}:getMaxStreamVolume : error = "
+
error
);
expect
(
false
)
.
assertTrue
();
done
();
});
}
catch
(
error
){
console
.
log
(
"
SUB_MULTIMEDIA_AUDIO_RENDERER_GETMAXSTREAMVOLUME_PROMISE_0100:
catch error = "
+
error
);
console
.
log
(
"
GETMAXSTREAMVOLUME
catch error = "
+
error
);
expect
(
false
)
.
assertTrue
();
done
();
}
...
...
@@ -202,10 +202,10 @@ export default function audioRendererTest() {
try
{
await
renderPlay
();
await
audioRen
.
getMaxStreamVolume
()
.
then
((
data
)
=>
{
console
.
info
(
`${TagFrmwkRender}:
#####
getMaxStreamVolume :SUCCESS ${data}`
);
console
.
info
(
`${TagFrmwkRender}:getMaxStreamVolume :SUCCESS ${data}`
);
expect
(
data
)
.
assertEqual
(
env
.
OUTPUT_NUMBER_1
);
})
.
catch
((
error
)
=>
{
console
.
log
(
"${TagFrmwkRender}:
#####
getMaxStreamVolume : error = "
+
error
);
console
.
log
(
"${TagFrmwkRender}:getMaxStreamVolume : error = "
+
error
);
expect
(
false
)
.
assertTrue
();
done
();
});
...
...
@@ -221,7 +221,7 @@ export default function audioRendererTest() {
});
done
();
}
catch
(
error
){
console
.
log
(
"
SUB_MULTIMEDIA_AUDIO_RENDERER_GETMAXSTREAMVOLUME_PROMISE_0200:
catch error = "
+
error
);
console
.
log
(
"
GETMAXSTREAMVOLUME
catch error = "
+
error
);
expect
(
false
)
.
assertTrue
();
done
();
}
...
...
@@ -255,24 +255,25 @@ export default function audioRendererTest() {
streamInfo
:
AudioStreamInfo
,
rendererInfo
:
AudioRendererInfo
}
try
{
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
);
});
if
(
Number
(
audio
.
StreamUsage
[
StreamType
])
!=
9
)
{
await
audio
.
createAudioRenderer
(
AudioRendererOptions
)
.
then
((
data
)
=>
{
audioRender
=
data
;
console
.
info
(
`${TagFrmwkRender}: AudioRender Created : Stream Type: ${StreamType} SUCCESS data state: `
+
Object
.
keys
(
data
));
})
.
catch
((
err
)
=>
{
console
.
info
(
`${TagFrmwkRender}: AudioRender Created : ERROR : `
+
err
.
message
);
});
}
else
{
audioRender
=
audioRen
;
}
}
catch
(
error
)
{
console
.
info
(
`${TagFrmwkRender}: AudioRender Created : catch ERROR : `
+
error
.
code
+
error
.
message
);
}
await
audioRender
.
getMaxStreamVolume
()
.
then
((
data
)
=>
{
console
.
info
(
`${TagFrmwkRender}:
####
getMaxStreamVolume:Stream Type: ${StreamType} SUCCESS ${data}`
);
console
.
info
(
`${TagFrmwkRender}:getMaxStreamVolume:Stream Type: ${StreamType} SUCCESS ${data}`
);
expect
(
data
)
.
assertEqual
(
env
.
OUTPUT_NUMBER_1
);
})
.
catch
((
error
)
=>
{
console
.
info
(
`${TagFrmwkRender}:
#####
getMaxStreamVolume:Stream Type: ${StreamType} ERROR : code: ${error.code}, mesage: ${error.message}`
);
console
.
info
(
`${TagFrmwkRender}:getMaxStreamVolume:Stream Type: ${StreamType} ERROR : code: ${error.code}, mesage: ${error.message}`
);
expect
(
false
)
.
assertTrue
();
done
();
});
...
...
@@ -286,7 +287,7 @@ export default function audioRendererTest() {
}
done
();
}
catch
(
error
){
console
.
info
(
`
SUB_MULTIMEDIA_AUDIO_RENDERER_GETMAXSTREAMVOLUME_PROMISE_0300:
Stream ERROR : code: ${error.code}, mesage: ${error.message}`
);
console
.
info
(
`
GETMAXSTREAMVOLUME
Stream ERROR : code: ${error.code}, mesage: ${error.message}`
);
}
});
...
...
@@ -301,7 +302,7 @@ export default function audioRendererTest() {
it
(
'SUB_MULTIMEDIA_AUDIO_RENDERER_GETMAXSTREAMVOLUME_PROMISE_0400'
,
0
,
async
function
(
done
)
{
try
{
await
audioRen
.
getMaxStreamVolume
()
.
then
((
data
)
=>
{
console
.
info
(
`${TagFrmwkRender}:
#####
getMaxStreamVolume :SUCCESS ${data}`
);
console
.
info
(
`${TagFrmwkRender}:getMaxStreamVolume :SUCCESS ${data}`
);
expect
(
data
)
.
assertEqual
(
env
.
OUTPUT_NUMBER_1
);
audioRen
.
setVolume
(
data
)
.
then
(()
=>
{
console
.
info
(
`${TagFrmwkRender}: setVolume to maxVolume Success! maxVolume: ${data}`
);
...
...
@@ -313,12 +314,12 @@ export default function audioRendererTest() {
done
();
});
})
.
catch
((
error
)
=>
{
console
.
info
(
`${TagFrmwkRender}:
####
getMaxStreamVolume : ERROR : code: ${error.code}, mesage: ${error.message}`
);
console
.
info
(
`${TagFrmwkRender}:getMaxStreamVolume : ERROR : code: ${error.code}, mesage: ${error.message}`
);
expect
(
false
)
.
assertTrue
();
done
();
});
}
catch
(
error
){
console
.
info
(
`
SUB_MULTIMEDIA_AUDIO_RENDERER_GETMAXSTREAMVOLUME_PROMISE_0400:
catch error, error: [${error.code}, ${error.message}]`
);
console
.
info
(
`
GETMAXSTREAMVOLUME
catch error, error: [${error.code}, ${error.message}]`
);
expect
(
false
)
.
assertTrue
();
done
();
}
...
...
@@ -335,16 +336,16 @@ export default function audioRendererTest() {
it
(
'SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_PROMISE_0100'
,
0
,
async
function
(
done
)
{
try
{
await
audioRen
.
getMinStreamVolume
()
.
then
((
data
)
=>
{
console
.
info
(
`${TagFrmwkRender}:
####
getMinStreamVolume :SUCCESS ${data}`
);
console
.
info
(
`${TagFrmwkRender}:getMinStreamVolume :SUCCESS ${data}`
);
expect
(
data
)
.
assertEqual
(
env
.
OUTPUT_NUMBER_0
);
done
();
})
.
catch
((
error
)
=>
{
console
.
info
(
`${TagFrmwkRender}:
#####
getMinStreamVolume : ERROR : code: ${error.code}, mesage: ${error.message}`
);
console
.
info
(
`${TagFrmwkRender}:getMinStreamVolume : ERROR : code: ${error.code}, mesage: ${error.message}`
);
expect
(
false
)
.
assertTrue
();
done
();
});
}
catch
(
error
){
console
.
info
(
`
SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_PROMISE_0100:
catch error, error: [${error.code}, ${error.message}]`
);
console
.
info
(
`
GETMINSTREAMVOLUME
catch error, error: [${error.code}, ${error.message}]`
);
expect
(
false
)
.
assertTrue
();
done
();
}
...
...
@@ -362,10 +363,10 @@ export default function audioRendererTest() {
try
{
await
renderPlay
();
await
audioRen
.
getMinStreamVolume
()
.
then
((
data
)
=>
{
console
.
info
(
`${TagFrmwkRender}:
#####
getMinStreamVolume :SUCCESS ${data}`
);
console
.
info
(
`${TagFrmwkRender}:getMinStreamVolume :SUCCESS ${data}`
);
expect
(
data
)
.
assertEqual
(
env
.
OUTPUT_NUMBER_0
);
})
.
catch
((
error
)
=>
{
console
.
info
(
`${TagFrmwkRender}:
####
getMinStreamVolume : ERROR : code: ${error.code}, mesage: ${error.message}`
);
console
.
info
(
`${TagFrmwkRender}:getMinStreamVolume : ERROR : code: ${error.code}, mesage: ${error.message}`
);
expect
(
false
)
.
assertTrue
();
done
();
});
...
...
@@ -381,7 +382,7 @@ export default function audioRendererTest() {
});
done
();
}
catch
(
error
){
console
.
info
(
`
SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_PROMISE_0200:
catch error, error: [${error.code}, ${error.message}]`
);
console
.
info
(
`
GETMINSTREAMVOLUME
catch error, error: [${error.code}, ${error.message}]`
);
expect
(
false
)
.
assertTrue
();
done
();
}
...
...
@@ -415,23 +416,25 @@ export default function audioRendererTest() {
streamInfo
:
AudioStreamInfo
,
rendererInfo
:
AudioRendererInfo
}
try
{
await
audio
.
createAudioRenderer
(
AudioRendererOptions
)
.
then
((
data
)
=>
{
audioRender
=
data
;
console
.
info
(
`${TagFrmwkRender}: AudioRender Created : Stream Type: ${StreamType} SUCCESS data state: `
+
Object
.
keys
(
data
));
})
.
catch
((
err
)
=>
{
console
.
info
(
`${TagFrmwkRender}: AudioRender Created : ERROR : `
+
err
.
message
);
});
if
(
Number
(
audio
.
StreamUsage
[
StreamType
])
!=
9
)
{
await
audio
.
createAudioRenderer
(
AudioRendererOptions
)
.
then
((
data
)
=>
{
audioRender
=
data
;
console
.
info
(
`${TagFrmwkRender}: AudioRender Created : Stream Type: ${StreamType} SUCCESS data state: `
+
Object
.
keys
(
data
));
})
.
catch
((
err
)
=>
{
console
.
info
(
`${TagFrmwkRender}: AudioRender Created : ERROR : `
+
err
.
message
);
});
}
else
{
audioRender
=
audioRen
;
}
}
catch
(
error
)
{
console
.
info
(
`${TagFrmwkRender}: AudioRender Created : catch ERROR : `
+
error
.
code
+
error
.
message
);
}
await
audioRender
.
getMinStreamVolume
()
.
then
((
data
)
=>
{
console
.
info
(
`${TagFrmwkRender}:
####
getMinStreamVolume:Stream Type: ${StreamType} SUCCESS ${data}`
);
console
.
info
(
`${TagFrmwkRender}:getMinStreamVolume:Stream Type: ${StreamType} SUCCESS ${data}`
);
expect
(
data
)
.
assertEqual
(
env
.
OUTPUT_NUMBER_0
);
})
.
catch
((
error
)
=>
{
console
.
info
(
`${TagFrmwkRender}:
#####
getMinStreamVolume:Stream Type: ${StreamType} ERROR : code: ${error.code}, mesage: ${error.message}`
);
console
.
info
(
`${TagFrmwkRender}:getMinStreamVolume:Stream Type: ${StreamType} ERROR : code: ${error.code}, mesage: ${error.message}`
);
expect
(
false
)
.
assertTrue
();
done
();
});
...
...
@@ -445,7 +448,7 @@ export default function audioRendererTest() {
}
done
();
}
catch
(
error
){
console
.
info
(
`
SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_PROMISE_0300:
Stream ERROR : code: ${error.code}, mesage: ${error.message}`
);
console
.
info
(
`
GETMINSTREAMVOLUME
Stream ERROR : code: ${error.code}, mesage: ${error.message}`
);
}
});
...
...
@@ -460,7 +463,7 @@ export default function audioRendererTest() {
it
(
'SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_PROMISE_0400'
,
0
,
async
function
(
done
)
{
try
{
await
audioRen
.
getMinStreamVolume
()
.
then
((
data
)
=>
{
console
.
info
(
`${TagFrmwkRender}:
#####
getMinStreamVolume :SUCCESS ${data}`
);
console
.
info
(
`${TagFrmwkRender}: getMinStreamVolume :SUCCESS ${data}`
);
expect
(
data
)
.
assertEqual
(
env
.
OUTPUT_NUMBER_0
);
audioRen
.
setVolume
(
data
)
.
then
(()
=>
{
console
.
info
(
`${TagFrmwkRender}: setVolume to minVolume Success! minVolume: ${data}`
);
...
...
@@ -472,12 +475,12 @@ export default function audioRendererTest() {
done
();
});
})
.
catch
((
error
)
=>
{
console
.
info
(
`${TagFrmwkRender}:
####
getMinStreamVolume : ERROR : code: ${error.code}, mesage: ${error.message}`
);
console
.
info
(
`${TagFrmwkRender}:getMinStreamVolume : ERROR : code: ${error.code}, mesage: ${error.message}`
);
expect
(
false
)
.
assertTrue
();
done
();
});
}
catch
(
error
){
console
.
info
(
`
SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_PROMISE_0400:
catch error, error: [${error.code}, ${error.message}]`
);
console
.
info
(
`
GETMINSTREAMVOLUME
catch error, error: [${error.code}, ${error.message}]`
);
expect
(
false
)
.
assertTrue
();
done
();
}
...
...
@@ -556,19 +559,20 @@ export default function audioRendererTest() {
streamInfo
:
AudioStreamInfo
,
rendererInfo
:
AudioRendererInfo
}
try
{
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
);
});
if
(
Number
(
audio
.
StreamUsage
[
StreamType
])
!=
9
)
{
await
audio
.
createAudioRenderer
(
AudioRendererOptions
)
.
then
((
data
)
=>
{
audioRender
=
data
;
console
.
info
(
`${TagFrmwkRender}: AudioRender Created : Stream Type: ${StreamType} SUCCESS data state: `
+
Object
.
keys
(
data
));
})
.
catch
((
err
)
=>
{
console
.
info
(
`${TagFrmwkRender}: AudioRender Created : ERROR : `
+
err
.
message
);
});
}
else
{
audioRender
=
audioRen
;
}
}
catch
(
error
)
{
console
.
info
(
`${TagFrmwkRender}: AudioRender Created : catch ERROR : `
+
error
.
code
+
error
.
message
);
}
audioRen
.
getMaxStreamVolume
((
err
,
maxVolume
)
=>
{
if
(
err
)
{
console
.
error
(
'${TagFrmwkRender} Get max stream volume Fail: ${err}'
);
...
...
@@ -591,7 +595,7 @@ export default function audioRendererTest() {
done
();
}
catch
(
error
){
console
.
log
(
`${TagFrmwkRender}:
####
getMaxStreamVolume: catch error, error: [${error.code}, ${error.message}]`
);
console
.
log
(
`${TagFrmwkRender}:getMaxStreamVolume: catch error, error: [${error.code}, ${error.message}]`
);
expect
(
false
)
.
assertTrue
();
done
();
}
...
...
@@ -703,18 +707,20 @@ export default function audioRendererTest() {
streamInfo
:
AudioStreamInfo
,
rendererInfo
:
AudioRendererInfo
}
try
{
await
audio
.
createAudioRenderer
(
AudioRendererOptions
)
.
then
((
data
)
=>
{
audioRender
=
data
;
console
.
info
(
`${TagFrmwkRender}: AudioRender Created : Stream Type: ${StreamType} SUCCESS data state: `
+
Object
.
keys
(
data
));
})
.
catch
((
err
)
=>
{
console
.
info
(
`${TagFrmwkRender}: AudioRender Created : ERROR : `
+
err
.
message
);
});
if
(
Number
(
audio
.
StreamUsage
[
StreamType
])
!=
9
)
{
await
audio
.
createAudioRenderer
(
AudioRendererOptions
)
.
then
((
data
)
=>
{
audioRender
=
data
;
console
.
info
(
`${TagFrmwkRender}: AudioRender Created : Stream Type: ${StreamType} SUCCESS data state: `
+
Object
.
keys
(
data
));
})
.
catch
((
err
)
=>
{
console
.
info
(
`${TagFrmwkRender}: AudioRender Created : ERROR : `
+
err
.
message
);
});
}
else
{
audioRender
=
audioRen
;
}
}
catch
(
error
)
{
console
.
info
(
`${TagFrmwkRender}: AudioRender Created : catch ERROR : `
+
error
.
code
+
error
.
message
);
}
audioRen
.
getMinStreamVolume
((
err
,
minVolume
)
=>
{
if
(
err
)
{
console
.
error
(
'${TagFrmwkRender} Get min stream volume Fail: ${err}'
);
...
...
@@ -735,7 +741,7 @@ export default function audioRendererTest() {
}
done
();
}
catch
(
error
){
console
.
log
(
`${TagFrmwkRender}:
####
getMinStreamVolume: catch error, error: [${error.code}, ${error.message}]`
);
console
.
log
(
`${TagFrmwkRender}:getMinStreamVolume: catch error, error: [${error.code}, ${error.message}]`
);
expect
(
false
)
.
assertTrue
();
done
();
}
...
...
multimedia/audio/audio_js_standard/AudioRendererEnhance/src/main/ets/test/GetUnderflowCount.test.ets
浏览文件 @
4d911162
...
...
@@ -36,7 +36,7 @@ export default function audioRendererTest() {
encodingType
:
audio
.
AudioEncodingType
.
ENCODING_TYPE_RAW
}
let
AudioRendererInfo
=
{
content
:
audio
.
ContentType
.
CONTENT_TYPE_
MUSIC
,
content
:
audio
.
ContentType
.
CONTENT_TYPE_
UNKNOWN
,
usage
:
audio
.
StreamUsage
.
STREAM_USAGE_MEDIA
,
rendererFlags
:
0
}
...
...
@@ -144,16 +144,16 @@ export default function audioRendererTest() {
it
(
'SUB_MULTIMEDIA_AUDIO_RENDERER_GETUNDERFLOWCOUNT_PROMISE_0100'
,
0
,
async
function
(
done
)
{
try
{
await
audioRen
.
getUnderflowCount
()
.
then
((
data
)
=>
{
console
.
info
(
`${TagFrmwkRender}:
####
getUnderflowCount :SUCCESS ${data}`
);
console
.
info
(
`${TagFrmwkRender}:getUnderflowCount :SUCCESS ${data}`
);
expect
(
data
)
.
assertLargerOrEqual
(
env
.
OUTPUT_NUMBER_0
);
done
();
})
.
catch
((
error
)
=>
{
console
.
log
(
"${TagFrmwkRender}:
####
getUnderflowCount : error = "
+
error
);
console
.
log
(
"${TagFrmwkRender}:getUnderflowCount : error = "
+
error
);
expect
(
false
)
.
assertTrue
();
done
();
});
}
catch
(
error
){
console
.
log
(
"
SUB_MULTIMEDIA_AUDIO_RENDERER_GETUNDERFLOWCOUNT_PROMISE_0100: catch
error = "
+
error
);
console
.
log
(
"
GETUNDERFLOWCOUNT catch unknown
error = "
+
error
);
expect
(
false
)
.
assertTrue
();
done
();
}
...
...
@@ -169,29 +169,26 @@ export default function audioRendererTest() {
* @tc.level : Level 0
*/
it
(
'SUB_MULTIMEDIA_AUDIO_RENDERER_GETUNDERFLOWCOUNT_PROMISE_0200'
,
0
,
async
function
(
done
)
{
try
{
try
{
await
renderPlay
();
await
audioRen
.
getUnderflowCount
()
.
then
((
data
)
=>
{
console
.
info
(
`${TagFrmwkRender}: ####getUnderflowCount :SUCCESS ${data}`
);
expect
(
data
)
.
assertLargerOrEqual
(
env
.
OUTPUT_NUMBER_0
);
})
.
catch
((
error
)
=>
{
console
.
log
(
"${TagFrmwkRender}: ####getUnderflowCount : error = "
+
error
);
audioRen
.
drain
()
.
then
(()
=>
{
audioRen
.
stop
()
.
then
(()
=>
{
done
();
})
.
catch
((
err
)
=>
{
console
.
info
(
`${TagFrmwkRender}: Renderer stop:ERROR : ${err.message}`
);
});
})
.
catch
((
err
)
=>
{
console
.
error
(
`${TagFrmwkRender}: Renderer drain: ERROR : ${err.message}`
);
});
})
.
catch
((
error
)
=>
{
console
.
log
(
"${TagFrmwkRender}: getUnderflowCount : error = "
+
error
);
expect
(
false
)
.
assertTrue
();
done
();
});
await
audioRen
.
drain
()
.
then
(()
=>
{
console
.
info
(
`${TagFrmwkRender}: Renderer drained : SUCCESS`
);
})
.
catch
((
err
)
=>
{
console
.
error
(
`${TagFrmwkRender}: Renderer drain: ERROR : ${err.message}`
);
});
await
audioRen
.
stop
()
.
then
(()
=>
{
console
.
info
(
`${TagFrmwkRender}: Renderer stopped : SUCCESS`
);
})
.
catch
((
err
)
=>
{
console
.
info
(
`${TagFrmwkRender}: Renderer stop:ERROR : ${err.message}`
);
});
done
();
}
catch
(
error
){
console
.
log
(
"SUB_MULTIMEDIA_AUDIO_RENDERER_GETUNDERFLOWCOUNT_PROMISE_0200: catch error = "
+
error
);
}
catch
(
error
)
{
console
.
log
(
"GETUNDERFLOWCOUNT catch unknown error = "
+
error
);
expect
(
false
)
.
assertTrue
();
done
();
}
...
...
@@ -207,7 +204,7 @@ export default function audioRendererTest() {
*/
it
(
'SUB_MULTIMEDIA_AUDIO_RENDERER_GETUNDERFLOWCOUNT_PROMISE_0300'
,
0
,
async
function
(
done
)
{
let
StreamType
;
try
{
try
{
for
(
StreamType
in
audio
.
StreamUsage
)
{
let
audioRender
;
let
AudioStreamInfo
=
{
...
...
@@ -217,46 +214,47 @@ export default function audioRendererTest() {
encodingType
:
audio
.
AudioEncodingType
.
ENCODING_TYPE_RAW
}
let
AudioRendererInfo
=
{
content
:
audio
.
ContentType
.
CONTENT_TYPE_
SPEECH
,
usage
:
StreamType
,
content
:
audio
.
ContentType
.
CONTENT_TYPE_
UNKNOWN
,
usage
:
Number
(
audio
.
StreamUsage
[
StreamType
])
,
rendererFlags
:
0
}
let
AudioRendererOptions
=
{
streamInfo
:
AudioStreamInfo
,
rendererInfo
:
AudioRendererInfo
}
try
{
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
);
});
if
(
Number
(
audio
.
StreamUsage
[
StreamType
])
!=
9
)
{
await
audio
.
createAudioRenderer
(
AudioRendererOptions
)
.
then
((
data
)
=>
{
audioRender
=
data
;
console
.
info
(
`${TagFrmwkRender}: AudioRender Created : Stream Type: ${StreamType}: ${Number(audio.StreamUsage[StreamType])}`
);
})
.
catch
((
err
)
=>
{
console
.
info
(
`${TagFrmwkRender}: AudioRender Created : ERROR : `
+
err
.
code
+
err
.
message
);
});
}
else
{
audioRender
=
audioRen
;
}
}
catch
(
error
)
{
console
.
info
(
`${TagFrmwkRender}: AudioRender Created : catch ERROR : `
+
error
.
code
+
error
.
message
);
}
await
audioRender
.
getUnderflowCount
()
.
then
((
data
)
=>
{
console
.
info
(
`${TagFrmwkRender}:
####getUnderflowCount:Stream Type: ${StreamType} SUCCESS ${data}
`
);
expect
(
data
)
.
assertLargerOrEqual
(
env
.
OUTPUT_NUMBER_
0
);
})
.
catch
((
error
)
=>
{
console
.
info
(
`${TagFrmwkRender}:
#####getUnderflowCount:Stream Type: ${StreamType}
ERROR : code: ${error.code}, mesage: ${error.message}`
);
console
.
info
(
`${TagFrmwkRender}:
getUnderflowCount SUCCESS! ${StreamType} data ${data}:, now release audiorender
`
);
expect
(
data
)
.
assertLargerOrEqual
(
0
);
})
.
catch
((
error
)
=>
{
console
.
info
(
`${TagFrmwkRender}:
getUnderflowCount:
ERROR : code: ${error.code}, mesage: ${error.message}`
);
expect
(
false
)
.
assertTrue
();
done
();
});
sleep
(
1000
);
await
audioRender
.
release
()
.
then
(()
=>
{
console
.
info
(
`${TagFrmwkRender}: Renderer
release : SUCCESS
`
);
console
.
info
(
`${TagFrmwkRender}: Renderer
${StreamType} release SUCCESS!
`
);
})
.
catch
((
err
)
=>
{
console
.
info
(
`${TagFrmwkRender}: Renderer release
:ERROR
: ${err.message}`
);
console
.
info
(
`${TagFrmwkRender}: Renderer release
ERROR
: ${err.message}`
);
});
}
done
();
}
catch
(
error
){
console
.
info
(
`SUB_MULTIMEDIA_AUDIO_RENDERER_GETUNDERFLOWCOUNT_PROMISE_0300:Stream ERROR : code: ${error.code}, mesage: ${error.message}`
);
}
catch
(
error
)
{
expect
(
false
)
.
assertTrue
();
done
();
}
});
...
...
@@ -269,23 +267,17 @@ export default function audioRendererTest() {
* @tc.level : Level 0
*/
it
(
'SUB_MULTIMEDIA_AUDIO_RENDERER_GETUNDERFLOWCOUNT_CALLBACK_0100'
,
0
,
async
function
(
done
)
{
try
{
audioRen
.
getUnderflowCount
((
err
,
data
)
=>
{
if
(
err
)
{
console
.
info
(
`${TagFrmwkRender}: ####getUnderflowCount : ERROR : code: ${err.code}, mesage: ${err.message}`
);
expect
(
false
)
.
assertTrue
();
done
();
}
else
{
console
.
info
(
`${TagFrmwkRender}: ####getUnderflowCount : Success ${data}`
);
expect
(
data
)
.
assertLargerOrEqual
(
env
.
OUTPUT_NUMBER_0
);
done
();
}
});
}
catch
(
error
){
console
.
info
(
`SUB_MULTIMEDIA_AUDIO_RENDERER_GETUNDERFLOWCOUNT_CALLBACK_0100: catch error, error: [${error.code}, ${error.message}]`
);
expect
(
false
)
.
assertTrue
();
done
();
};
audioRen
.
getUnderflowCount
((
err
,
data
)
=>
{
if
(
err
)
{
console
.
info
(
`${TagFrmwkRender}: getUnderflowCount ERROR! code: ${err.code}, mesage: ${err.message}`
);
expect
(
false
)
.
assertTrue
();
done
();
}
else
{
console
.
info
(
`${TagFrmwkRender}: getUnderflowCount : Success! ${data}`
);
expect
(
data
)
.
assertLargerOrEqual
(
env
.
OUTPUT_NUMBER_0
);
done
();
}
});
});
/**
...
...
@@ -297,35 +289,31 @@ export default function audioRendererTest() {
* @tc.level : Level 0
*/
it
(
'SUB_MULTIMEDIA_AUDIO_RENDERER_GETUNDERFLOWCOUNT_CALLBACK_0200'
,
0
,
async
function
(
done
)
{
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: execution success, data: ${JSON.stringify(data)}`
);
expect
(
data
)
.
assertLargerOrEqual
(
env
.
OUTPUT_NUMBER_0
);
}
};
try
{
try
{
await
renderPlay
();
audioRen
.
getUnderflowCount
(
CallBack
);
}
catch
(
error
){
console
.
log
(
`${TagFrmwkRender}: ####getUnderflowCount: catch error, error: [${error.code}, ${error.message}]`
);
audioRen
.
getUnderflowCount
((
error
,
data
)
=>
{
if
(
error
)
{
console
.
log
(
`${TagFrmwkRender}: getUnderflowCount execution fail,error: [${error.code}, ${error.message}]`
);
expect
(
false
)
.
assertTrue
();
done
();
}
else
{
expect
(
data
)
.
assertLargerOrEqual
(
env
.
OUTPUT_NUMBER_0
);
audioRen
.
drain
()
.
then
(()
=>
{
audioRen
.
stop
()
.
then
(()
=>
{
done
();
})
.
catch
((
err
)
=>
{
console
.
info
(
`${TagFrmwkRender}: Renderer stop:ERROR : ${err.message}`
);
});
})
.
catch
((
err
)
=>
{
console
.
error
(
`${TagFrmwkRender}: Renderer drain: ERROR : ${err.message}`
);
});
}
});
}
catch
(
error
)
{
console
.
log
(
`${TagFrmwkRender}: getUnderflowCount unknown error, error: [${error.code}, ${error.message}]`
);
expect
(
false
)
.
assertTrue
();
done
();
};
await
audioRen
.
drain
()
.
then
(()
=>
{
console
.
info
(
`${TagFrmwkRender}: Renderer drained : SUCCESS`
);
})
.
catch
((
err
)
=>
{
console
.
error
(
`${TagFrmwkRender}: Renderer drain: ERROR : ${err.message}`
);
});
await
audioRen
.
stop
()
.
then
(()
=>
{
console
.
info
(
`${TagFrmwkRender}: Renderer stopped : SUCCESS`
);
})
.
catch
((
err
)
=>
{
console
.
info
(
`${TagFrmwkRender}: Renderer stop:ERROR : ${err.message}`
);
});
done
();
}
});
/**
...
...
@@ -338,18 +326,7 @@ export default function audioRendererTest() {
*/
it
(
'SUB_MULTIMEDIA_AUDIO_RENDERER_GETUNDERFLOWCOUNT_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
)
.
assertLargerOrEqual
(
env
.
OUTPUT_NUMBER_0
);
}
};
try
{
try
{
for
(
StreamType
in
audio
.
StreamUsage
)
{
let
audioRender
;
let
AudioStreamInfo
=
{
...
...
@@ -367,36 +344,41 @@ export default function audioRendererTest() {
streamInfo
:
AudioStreamInfo
,
rendererInfo
:
AudioRendererInfo
}
try
{
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
);
});
if
(
Number
(
audio
.
StreamUsage
[
StreamType
])
!=
9
)
{
await
audio
.
createAudioRenderer
(
AudioRendererOptions
)
.
then
((
data
)
=>
{
audioRender
=
data
;
console
.
info
(
`${TagFrmwkRender}: AudioRender Created : Stream Type: ${StreamType} SUCCESS data state: `
+
Object
.
keys
(
data
));
})
.
catch
((
err
)
=>
{
console
.
info
(
`${TagFrmwkRender}: AudioRender Created : ERROR : `
+
err
.
message
);
});
}
else
{
audioRender
=
audioRen
;
}
}
catch
(
error
)
{
console
.
info
(
`${TagFrmwkRender}: AudioRender Created : catch ERROR : `
+
error
.
code
+
error
.
message
);
}
audioRen
.
getUnderflowCount
(
CallBack
);
audioRen
.
getUnderflowCount
((
error
,
data
)
=>
{
if
(
error
)
{
expect
(
false
)
.
assertTrue
();
done
();
}
else
{
console
.
log
(
`${TagFrmwkRender}:getUnderflowCount StreamType:${StreamType} execution success, data: ${JSON.stringify(data)}`
);
expect
(
data
)
.
assertLargerOrEqual
(
env
.
OUTPUT_NUMBER_0
);
}
});
sleep
(
1000
);
await
audioRender
.
release
()
.
then
(()
=>
{
console
.
info
(
`${TagFrmwkRender}: Renderer release : SUCCESS`
);
console
.
info
(
`${TagFrmwkRender}: Renderer
${StreamType}
release : SUCCESS`
);
})
.
catch
((
err
)
=>
{
console
.
info
(
`${TagFrmwkRender}: Renderer release :ERROR : ${err.message}`
);
});
}
done
();
}
catch
(
error
){
console
.
log
(
`${TagFrmwkRender}: ####getUnderflowCount: catch error, error: [${error.code}, ${error.message}]`
);
}
catch
(
error
)
{
expect
(
false
)
.
assertTrue
();
done
();
}
});
})
}
multimedia/audio/audio_js_standard/AudioRendererEnhance/src/main/ets/test/OnOffOutputDeviceChange.test.ets
浏览文件 @
4d911162
...
...
@@ -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 = {
...
...
@@ -76,26 +76,24 @@ export default function audioRendererTest() {
* @tc.desc : AudioRenderer - on "struct" - promise
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level
0
* @tc.level : Level
2
*/
it('SUB_MULTIMEDIA_AUDIO_RENDERER_ON_CALLBACK_0100', 0, async function (done) {
let CallBack:any = (error,data) => {
try {
audioRen.on(-1, (error, data) => {
if (error) {
console.log(`${TagFrmwkRender}: On error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue();
done();
} else {
expect(false).assertTrue();
done();
}
});
} catch (error) {
if (error) {
console.log(`${TagFrmwkRender}: ####CallBack: execution fail,error: [${error.code}, ${error.message}]`);
expect(false).assertTrue();
done();
}else{
console.log(`${TagFrmwkRender}: ####CallBack: execution success, data: ${JSON.stringify(data)}`);
expect(true).assertTrue();
done();
}
};
try{
audioRen.on(-1, CallBack);
}catch(error){
if (error.code == env.INVALID_INPUT_PARAMETER_401) {
console.log(`${TagFrmwkRender}: ####on: catch error, error: [${error.code}, ${error.message}]`);
expect(true).assertTrue();
console.log(`${TagFrmwkRender}: On catch error, error: [${error.code}, ${error.message}]`);
expect(Number(error.code)).assertEqual(INVALID_INPUT_PARAMETER_401);
done();
} else {
expect(false).assertTrue();
...
...
@@ -110,26 +108,24 @@ export default function audioRendererTest() {
* @tc.desc : AudioRenderer - on "struct" - promise
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level
0
* @tc.level : Level
2
*/
it('SUB_MULTIMEDIA_AUDIO_RENDERER_ON_CALLBACK_0200', 0, async function (done) {
let CallBack:any = (error,data) => {
try {
audioRen.on('123', (error, data) => {
if (error) {
console.log(`${TagFrmwkRender}: On error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue();
done();
} else {
expect(false).assertTrue();
done();
}
});
} catch (error) {
if (error) {
console.log(`${TagFrmwkRender}: ####CallBack: execution fail,error: [${error.code}, ${error.message}]`);
expect(false).assertTrue();
done();
}else{
console.log(`${TagFrmwkRender}: ####CallBack: execution success, data: ${JSON.stringify(data)}`);
expect(true).assertTrue();
done();
}
};
try{
audioRen.on('123', CallBack);
}catch(error){
if (error.code == env.INVALID_INPUT_PARAMETER_6800101) {
console.log(`${TagFrmwkRender}: ####on: catch error, error: [${error.code}, ${error.message}]`);
expect(true).assertTrue();
console.log(`${TagFrmwkRender}: On catch error, error: [${error.code}, ${error.message}]`);
expect(Number(error.code)).assertEqual(INVALID_INPUT_PARAMETER_6800101);
done();
} else {
expect(false).assertTrue();
...
...
@@ -144,26 +140,25 @@ export default function audioRendererTest() {
* @tc.desc : AudioRenderer - on "struct" - promise
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level
0
* @tc.level : Level
2
*/
it('SUB_MULTIMEDIA_AUDIO_RENDERER_ON_CALLBACK_0300', 0, async function (done) {
let CallBack:any = (error,data) => {
try {
audioRen.on((error, data) => {
if (error) {
console.log(`${TagFrmwkRender}: On execution fail,error: [${error.code}, ${error.message}]`);
expect(false).assertTrue();
done();
} else {
console.log(`${TagFrmwkRender}: On execution success, testcase FAIL!`);
expect(false).assertTrue();
done();
}
});
} catch (error) {
if (error) {
console.log(`${TagFrmwkRender}: ####CallBack: execution fail,error: [${error.code}, ${error.message}]`);
expect(false).assertTrue();
done();
}else{
console.log(`${TagFrmwkRender}: ####CallBack: execution success, data: ${JSON.stringify(data)}`);
expect(true).assertTrue();
done();
}
};
try{
audioRen.on(CallBack);
}catch(error){
if (error.code == 401) {
console.log(`${TagFrmwkRender}: ####on: catch error, error: [${error.code}, ${error.message}]`);
expect(true).assertTrue();
console.log(`${TagFrmwkRender}: On: catch error, error: [${error.code}, ${error.message}]`);
expect(Number(error.code)).assertEqual(INVALID_INPUT_PARAMETER_401);
done();
} else {
expect(false).assertTrue();
...
...
@@ -178,33 +173,31 @@ export default function audioRendererTest() {
* @tc.desc : AudioRenderer - on "struct" - promise
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level
0
* @tc.level : Level
2
*/
it('SUB_MULTIMEDIA_AUDIO_RENDERER_OFF_CALLBACK_0100', 0, async function (done) {
let CallBack:any = (error,data) => {
try {
audioRen.off(-1, (error, data) => {
if (error) {
console.log(`${TagFrmwkRender}:Off execution fail,error: [${error.code}, ${error.message}]`);
expect(false).assertTrue();
done();
} else {
console.log(`${TagFrmwkRender}:Off execution success, testcase FAIL! `);
expect(false).assertTrue();
done();
}
});
} catch (error) {
if (error) {
console.log(`${TagFrmwkRender}: ####CallBack: execution fail,error: [${error.code}, ${error.message}]`);
expect(false).assertTrue();
done();
}else{
console.log(`${TagFrmwkRender}: ####CallBack: execution success, data: ${JSON.stringify(data)}`);
expect(true).assertTrue();
done();
}
};
try{
audioRen.off(-1, CallBack);
}catch(error){
if (error.code == env.INVALID_INPUT_PARAMETER_6800101) {
console.log(`${TagFrmwkRender}: ####on: catch error, error: [${error.code}, ${error.message}]`);
expect(true).assertTrue();
console.log(`${TagFrmwkRender}:On catch error, error: [${error.code}, ${error.message}]`);
expect(Number(error.code)).assertEqual(INVALID_INPUT_PARAMETER_6800101);
done();
} else {
expect(false).assertTrue();
done();
}
}
});
/**
...
...
@@ -213,26 +206,25 @@ export default function audioRendererTest() {
* @tc.desc : AudioRenderer - on "struct" - promise
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level
0
* @tc.level : Level
2
*/
it('SUB_MULTIMEDIA_AUDIO_RENDERER_OFF_CALLBACK_0200', 0, async function (done) {
let CallBack:any = (error,data) => {
try {
audioRen.off('123', (error, data) => {
if (error) {
console.log(`${TagFrmwkRender}: Off execution fail,error: [${error.code}, ${error.message}]`);
expect(false).assertTrue();
done();
} else {
console.log(`${TagFrmwkRender}: Off execution success, testcase FAIL! `);
expect(true).assertTrue();
done();
}
});
} catch (error) {
if (error) {
console.log(`${TagFrmwkRender}: ####CallBack: execution fail,error: [${error.code}, ${error.message}]`);
expect(false).assertTrue();
done();
}else{
console.log(`${TagFrmwkRender}: ####CallBack: execution success, data: ${JSON.stringify(data)}`);
expect(true).assertTrue();
done();
}
};
try{
audioRen.off('123', CallBack);
}catch(error){
if (error.code == env.UNSUPORTED_OPTION_6800104) {
console.log(`${TagFrmwkRender}: ####on: catch error, error: [${error.code}, ${error.message}]`);
expect(true).assertTrue();
console.log(`${TagFrmwkRender}: Off catch error, error: [${error.code}, ${error.message}]`);
expect(Number(error.code)).assertEqual(UNSUPORTED_OPTION_6800104);
done();
} else {
expect(false).assertTrue();
...
...
@@ -247,26 +239,25 @@ export default function audioRendererTest() {
* @tc.desc : AudioRenderer - off "struct" - promise
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level
0
* @tc.level : Level
2
*/
it('SUB_MULTIMEDIA_AUDIO_RENDERER_OFF_CALLBACK_0300', 0, async function (done) {
let CallBack:any = (error,data) => {
try {
audioRen.off((error, data) => {
if (error) {
console.log(`${TagFrmwkRender}: Off execution fail,error: [${error.code}, ${error.message}]`);
expect(false).assertTrue();
done();
} else {
console.log(`${TagFrmwkRender}: Off execution success, testcase FAIL! `);
expect(false).assertTrue();
done();
}
});
} catch (error) {
if (error) {
console.log(`${TagFrmwkRender}: ####CallBack: execution fail,error: [${error.code}, ${error.message}]`);
expect(false).assertTrue();
done();
}else{
console.log(`${TagFrmwkRender}: ####CallBack: execution success, data: ${JSON.stringify(data)}`);
expect(true).assertTrue();
done();
}
};
try{
audioRen.off(CallBack);
}catch(error){
if (error.code == env.INVALID_INPUT_PARAMETER_6800101) {
console.log(`${TagFrmwkRender}: ####on: catch error, error: [${error.code}, ${error.message}]`);
expect(true).assertTrue();
console.log(`${TagFrmwkRender}: Off catch error, error: [${error.code}, ${error.message}]`);
expect(Number(error.code)).assertEqual(INVALID_INPUT_PARAMETER_6800101);
done();
} else {
expect(false).assertTrue();
...
...
@@ -274,6 +265,5 @@ export default function audioRendererTest() {
}
}
});
})
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录