提交 72afc496 编写于 作者: W wangzx0705

modify the callback code format and update some testcases

Signed-off-by: Nwangzx0705 <wangzx0705@thundersoft.com>
上级 0f1092c4
...@@ -34,8 +34,8 @@ export default function audioRendererTest() { ...@@ -34,8 +34,8 @@ export default function audioRendererTest() {
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
} }
let AudioRendererInfo = { let AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH, content: audio.ContentType.CONTENT_TYPE_UNKNOWN,
usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, usage: audio.StreamUsage.STREAM_USAGE_MEDIA,
rendererFlags: 0 rendererFlags: 0
} }
let AudioRendererOptions = { let AudioRendererOptions = {
...@@ -100,8 +100,8 @@ export default function audioRendererTest() { ...@@ -100,8 +100,8 @@ export default function audioRendererTest() {
done(); done();
}) })
it('SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_PROMISE_0600', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_PROMISE_0500', 0, async function (done) {
let number = `SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_PROMISE_0600` let number = `SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_PROMISE_0500`
let rate = 48000 let rate = 48000
for (let index = 0; index < env.GENERAL_RUN_TIMES; index++){ for (let index = 0; index < env.GENERAL_RUN_TIMES; index++){
try { try {
...@@ -173,9 +173,9 @@ export default function audioRendererTest() { ...@@ -173,9 +173,9 @@ export default function audioRendererTest() {
} }
}) })
it('SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_CALLBACK_0600',0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_CALLBACK_0500',0, async function (done) {
// Defines a test case. This API supports zaro parameters: test case name, filter parameter, and test case function. // 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_0600` let number = `SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_CALLBACK_0500`
let rate = 48000 let rate = 48000
setRendererSamplingRateTest(0) setRendererSamplingRateTest(0)
function setRendererSamplingRateTest(index) { function setRendererSamplingRateTest(index) {
...@@ -215,6 +215,5 @@ export default function audioRendererTest() { ...@@ -215,6 +215,5 @@ export default function audioRendererTest() {
}) })
} }
}) })
}) })
} }
\ No newline at end of file
...@@ -139,12 +139,9 @@ export default function audioRendererTest() { ...@@ -139,12 +139,9 @@ export default function audioRendererTest() {
await audioRen.getCurrentOutputDevices().then((data) => { 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}`); 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 { try {
if(data.sampleRates == 44100 && data.channelCounts == 2){
expect(data.deviceRole).assertEqual(audio.DeviceRole.OUTPUT_DEVICE); expect(data.deviceRole).assertEqual(audio.DeviceRole.OUTPUT_DEVICE);
expect(data.deviceType).assertEqual(audio.DeviceType.SPEAKER); expect(data.deviceType).assertEqual(audio.DeviceType.SPEAKER);
expect(data.id).assertLargerOrEqual(env.OUTPUT_NUMBER_0); expect(data.id).assertLargerOrEqual(env.OUTPUT_NUMBER_0);
expect(data.channelMasks).assertLargerOrEqual(env.OUTPUT_NUMBER_0);
}
} catch (error){ } catch (error){
console.log('${TagFrmwkRender}: ######assertion failure'); console.log('${TagFrmwkRender}: ######assertion failure');
} }
...@@ -304,12 +301,9 @@ export default function audioRendererTest() { ...@@ -304,12 +301,9 @@ export default function audioRendererTest() {
} else { } 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}`); 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 { try {
if(data.sampleRates == 44100 && data.channelCounts == 2){
expect(data.deviceRole).assertEqual(audio.DeviceRole.OUTPUT_DEVICE); expect(data.deviceRole).assertEqual(audio.DeviceRole.OUTPUT_DEVICE);
expect(data.deviceType).assertEqual(audio.DeviceType.SPEAKER); expect(data.deviceType).assertEqual(audio.DeviceType.SPEAKER);
expect(data.id).assertLargerOrEqual(env.OUTPUT_NUMBER_0); expect(data.id).assertLargerOrEqual(env.OUTPUT_NUMBER_0);
expect(data.channelMasks).assertLargerOrEqual(env.OUTPUT_NUMBER_0);
}
} catch (error){ } catch (error){
console.log('${TagFrmwkRender}: ######assertion failure'); console.log('${TagFrmwkRender}: ######assertion failure');
} }
......
...@@ -80,12 +80,9 @@ export default function audioRendererTest() { ...@@ -80,12 +80,9 @@ export default function audioRendererTest() {
try { try {
let data = await audioRen.getCurrentOutputDevices(); let data = await audioRen.getCurrentOutputDevices();
try{ try{
if (data.sampleRates == 44100 && data.channelCounts == 2) {
expect(data.deviceRole).assertEqual(audio.DeviceRole.OUTPUT_DEVICE); expect(data.deviceRole).assertEqual(audio.DeviceRole.OUTPUT_DEVICE);
expect(data.deviceType).assertEqual(audio.DeviceType.SPEAKER); expect(data.deviceType).assertEqual(audio.DeviceType.SPEAKER);
expect(data.id).assertLargerOrEqual(0); expect(data.id).assertLargerOrEqual(0);
expect(data.channelMasks).assertLargerOrEqual(0);
}
}catch (error){ }catch (error){
console.log('${TagFrmwkRender}:######assertion failure'); console.log('${TagFrmwkRender}:######assertion failure');
} }
...@@ -121,12 +118,9 @@ export default function audioRendererTest() { ...@@ -121,12 +118,9 @@ export default function audioRendererTest() {
return; return;
}else{ }else{
try{ try{
if(data.sampleRates == 44100 && data.channelCounts == 2){
expect(data.deviceRole).assertEqual(audio.DeviceRole.OUTPUT_DEVICE); expect(data.deviceRole).assertEqual(audio.DeviceRole.OUTPUT_DEVICE);
expect(data.deviceType).assertEqual(audio.DeviceType.SPEAKER); expect(data.deviceType).assertEqual(audio.DeviceType.SPEAKER);
expect(data.id).assertLargerOrEqual(0); expect(data.id).assertLargerOrEqual(0);
expect(data.channelMasks).assertLargerOrEqual(0);
}
}catch (error){ }catch (error){
console.log('${TagFrmwkRender}: ######assertion failure'); console.log('${TagFrmwkRender}: ######assertion failure');
} }
......
...@@ -36,7 +36,7 @@ export default function audioRendererTest() { ...@@ -36,7 +36,7 @@ export default function audioRendererTest() {
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
} }
let AudioRendererInfo = { let AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH, content: audio.ContentType.CONTENT_TYPE_UNKNOWN,
usage: audio.StreamUsage.STREAM_USAGE_MEDIA, usage: audio.StreamUsage.STREAM_USAGE_MEDIA,
rendererFlags: 0 rendererFlags: 0
} }
...@@ -247,7 +247,7 @@ export default function audioRendererTest() { ...@@ -247,7 +247,7 @@ export default function audioRendererTest() {
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
} }
let AudioRendererInfo = { let AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH, content: audio.ContentType.CONTENT_TYPE_UNKNOWN,
usage: StreamType, usage: StreamType,
rendererFlags: 0 rendererFlags: 0
} }
...@@ -299,20 +299,12 @@ export default function audioRendererTest() { ...@@ -299,20 +299,12 @@ export default function audioRendererTest() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMAXSTREAMVOLUME_PROMISE_0400', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMAXSTREAMVOLUME_PROMISE_0400', 0, async function (done) {
let maxVolume = 0.0;
try{ try{
await audioRen.getMaxStreamVolume().then((data) => { await audioRen.getMaxStreamVolume().then((data) => {
console.info(`${TagFrmwkRender}: #####getMaxStreamVolume :SUCCESS ${data}`); console.info(`${TagFrmwkRender}: #####getMaxStreamVolume :SUCCESS ${data}`);
maxVolume = data;
expect(data).assertEqual(env.OUTPUT_NUMBER_1); expect(data).assertEqual(env.OUTPUT_NUMBER_1);
}).catch ((error)=>{ audioRen.setVolume(data).then(() => {
console.info(`${TagFrmwkRender}: ####getMaxStreamVolume : ERROR : code: ${error.code}, mesage: ${error.message}`); console.info(`${TagFrmwkRender}: setVolume to maxVolume Success! maxVolume: ${data}`);
expect(false).assertTrue();
done();
});
await audioRen.setVolume(maxVolume).then(() => {
console.info(`${TagFrmwkRender}: setVolume to 1 : Success`);
expect(true).assertTrue(); expect(true).assertTrue();
done(); done();
}).catch((err) => { }).catch((err) => {
...@@ -320,7 +312,11 @@ export default function audioRendererTest() { ...@@ -320,7 +312,11 @@ export default function audioRendererTest() {
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
}); });
}).catch ((error)=>{
console.info(`${TagFrmwkRender}: ####getMaxStreamVolume : ERROR : code: ${error.code}, mesage: ${error.message}`);
expect(false).assertTrue();
done();
});
}catch(error){ }catch(error){
console.info(`SUB_MULTIMEDIA_AUDIO_RENDERER_GETMAXSTREAMVOLUME_PROMISE_0400: catch error, error: [${error.code}, ${error.message}]`); console.info(`SUB_MULTIMEDIA_AUDIO_RENDERER_GETMAXSTREAMVOLUME_PROMISE_0400: catch error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue(); expect(false).assertTrue();
...@@ -411,7 +407,7 @@ export default function audioRendererTest() { ...@@ -411,7 +407,7 @@ export default function audioRendererTest() {
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
} }
let AudioRendererInfo = { let AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH, content: audio.ContentType.CONTENT_TYPE_UNKNOWN,
usage: StreamType, usage: StreamType,
rendererFlags: 0 rendererFlags: 0
} }
...@@ -424,7 +420,6 @@ export default function audioRendererTest() { ...@@ -424,7 +420,6 @@ export default function audioRendererTest() {
await audio.createAudioRenderer(AudioRendererOptions).then((data) => { await audio.createAudioRenderer(AudioRendererOptions).then((data) => {
audioRender = 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} 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) => { }).catch((err) => {
console.info(`${TagFrmwkRender}: AudioRender Created : ERROR : ` + err.message); console.info(`${TagFrmwkRender}: AudioRender Created : ERROR : ` + err.message);
}); });
...@@ -463,20 +458,12 @@ export default function audioRendererTest() { ...@@ -463,20 +458,12 @@ export default function audioRendererTest() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_PROMISE_0400', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_PROMISE_0400', 0, async function (done) {
let minVolume = 1.0;
try{ try{
await audioRen.getMinStreamVolume().then((data) => { await audioRen.getMinStreamVolume().then((data) => {
console.info(`${TagFrmwkRender}: #####getMinStreamVolume :SUCCESS ${data}`); console.info(`${TagFrmwkRender}: #####getMinStreamVolume :SUCCESS ${data}`);
minVolume = data;
expect(data).assertEqual(env.OUTPUT_NUMBER_0); expect(data).assertEqual(env.OUTPUT_NUMBER_0);
}).catch ((error)=>{ audioRen.setVolume(data).then(() => {
console.info(`${TagFrmwkRender}: ####getMinStreamVolume : ERROR : code: ${error.code}, mesage: ${error.message}`); console.info(`${TagFrmwkRender}: setVolume to minVolume Success! minVolume: ${data}`);
expect(false).assertTrue();
done();
});
await audioRen.setVolume(minVolume).then(() => {
console.info(`${TagFrmwkRender}: setVolume to 0 : Success`);
expect(true).assertTrue(); expect(true).assertTrue();
done(); done();
}).catch((err) => { }).catch((err) => {
...@@ -484,7 +471,11 @@ export default function audioRendererTest() { ...@@ -484,7 +471,11 @@ export default function audioRendererTest() {
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
}); });
}).catch ((error)=>{
console.info(`${TagFrmwkRender}: ####getMinStreamVolume : ERROR : code: ${error.code}, mesage: ${error.message}`);
expect(false).assertTrue();
done();
});
}catch(error){ }catch(error){
console.info(`SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_PROMISE_0400: catch error, error: [${error.code}, ${error.message}]`); console.info(`SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_PROMISE_0400: catch error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue(); expect(false).assertTrue();
...@@ -501,24 +492,17 @@ export default function audioRendererTest() { ...@@ -501,24 +492,17 @@ export default function audioRendererTest() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMAXSTREAMVOLUME_CALLBACK_0100', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMAXSTREAMVOLUME_CALLBACK_0100', 0, async function (done) {
let CallBack:any = (error,data) => { audioRen.getMaxStreamVolume((err, maxVolume) => {
if (error) { if (err) {
console.log(`${TagFrmwkRender}: ####CallBack: execution fail,error: [${error.code}, ${error.message}]`); console.error('${TagFrmwkRender} Get max stream volume Fail: ${err}');
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
}else{ } else {
console.log(`${TagFrmwkRender}: ####CallBack: execution success, data: ${JSON.stringify(data)}`); console.info('${TagFrmwkRender} Get max stream volume Success! ${maxVolume}');
expect(data).assertEqual(env.OUTPUT_NUMBER_1); 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(); done();
} }
})
}); });
/** /**
...@@ -530,25 +514,18 @@ export default function audioRendererTest() { ...@@ -530,25 +514,18 @@ export default function audioRendererTest() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMAXSTREAMVOLUME_CALLBACK_0200', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMAXSTREAMVOLUME_CALLBACK_0200', 0, async function (done) {
let CallBack:any = (error,data) => { await renderPlay();
if (error) { audioRen.getMaxStreamVolume((err, maxVolume) => {
console.log(`${TagFrmwkRender}: ####CallBack: execution fail,error: [${error.code}, ${error.message}]`); if (err) {
console.error('${TagFrmwkRender} Get max stream volume Fail: ${err}');
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
}else{ } else {
console.log(`${TagFrmwkRender}: ####CallBack: execution success, data: ${JSON.stringify(data)}`); console.info('${TagFrmwkRender} Get max stream volume Success! ${maxVolume}');
expect(data).assertEqual(env.OUTPUT_NUMBER_1); 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(); done();
} }
})
}); });
/** /**
...@@ -561,17 +538,6 @@ export default function audioRendererTest() { ...@@ -561,17 +538,6 @@ export default function audioRendererTest() {
*/ */
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMAXSTREAMVOLUME_CALLBACK_0300', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMAXSTREAMVOLUME_CALLBACK_0300', 0, async function (done) {
let StreamType; 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{ try{
for (StreamType in audio.StreamUsage) { for (StreamType in audio.StreamUsage) {
let audioRender; let audioRender;
...@@ -582,7 +548,7 @@ export default function audioRendererTest() { ...@@ -582,7 +548,7 @@ export default function audioRendererTest() {
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
} }
let AudioRendererInfo = { let AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH, content: audio.ContentType.CONTENT_TYPE_UNKNOWN,
usage: StreamType, usage: StreamType,
rendererFlags: 0 rendererFlags: 0
} }
...@@ -603,12 +569,17 @@ export default function audioRendererTest() { ...@@ -603,12 +569,17 @@ export default function audioRendererTest() {
console.info(`${TagFrmwkRender}: AudioRender Created : catch ERROR : ` + error.code + error.message); console.info(`${TagFrmwkRender}: AudioRender Created : catch ERROR : ` + error.code + error.message);
} }
try{ audioRen.getMaxStreamVolume((err, maxVolume) => {
audioRen.getMaxStreamVolume(); if (err) {
}catch(error){ console.error('${TagFrmwkRender} Get max stream volume Fail: ${err}');
console.log(`${TagFrmwkRender}: ####getMaxStreamVolume: catch error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue(); expect(false).assertTrue();
done();
} else {
console.info('${TagFrmwkRender} Get max stream volume Success! ${maxVolume}');
expect(maxVolume).assertEqual(env.OUTPUT_NUMBER_1);
done();
} }
})
sleep(1000); sleep(1000);
await audioRender.release().then(() => { await audioRender.release().then(() => {
...@@ -636,32 +607,25 @@ export default function audioRendererTest() { ...@@ -636,32 +607,25 @@ export default function audioRendererTest() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMAXSTREAMVOLUME_CALLBACK_0400', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMAXSTREAMVOLUME_CALLBACK_0400', 0, async function (done) {
let maxVolume = 0.0; audioRen.getMaxStreamVolume((err, maxVolume) => {
let CallBack:any = (error,data) => { if (err) {
if (error) { console.error('${TagFrmwkRender} Get max stream volume Fail: ${err}');
console.log(`${TagFrmwkRender}: ####CallBack: execution fail,error: [${error.code}, ${error.message}]`);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
}else{ } else {
console.log(`${TagFrmwkRender}: ####CallBack: execution success, data: ${JSON.stringify(data)}`); console.info(`${TagFrmwkRender} Get max stream volume Success! maxVolume: ${maxVolume}`);
} expect(maxVolume).assertEqual(env.OUTPUT_NUMBER_1);
}; audioRen.setVolume(maxVolume).then(() => {
try{ console.info(`${TagFrmwkRender}: setVolume to maxVolume Success! maxVolume: ${maxVolume}`);
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(); expect(true).assertTrue();
done(); done();
}).catch((err) => { }).catch((err) => {
console.info(`${TagFrmwkRender}: setVolume : ERROR : code: ${err.code}, mesage: ${err.message}`); console.info(`${TagFrmwkRender}: setVolume ERROR! : code: ${err.code}, mesage: ${err.message}`);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
}); });
}
})
}); });
/** /**
...@@ -673,24 +637,17 @@ export default function audioRendererTest() { ...@@ -673,24 +637,17 @@ export default function audioRendererTest() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_CALLBACK_0100', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_CALLBACK_0100', 0, async function (done) {
let CallBack:any = (error,data) => { audioRen.getMinStreamVolume((err, minVolume) => {
if (error) { if (err) {
console.log(`${TagFrmwkRender}: ####CallBack: execution fail,error: [${error.code}, ${error.message}]`); console.error('${TagFrmwkRender} Get min stream volume Fail: ${err}');
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
}else{ } else {
console.log(`${TagFrmwkRender}: ####CallBack: execution success, data: ${JSON.stringify(data)}`); console.info(`${TagFrmwkRender} Get min stream volume Success! minVolume: ${minVolume}`);
expect(data).assertEqual(env.OUTPUT_NUMBER_0); expect(minVolume).assertEqual(env.OUTPUT_NUMBER_0);
done(); 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() { ...@@ -702,27 +659,18 @@ export default function audioRendererTest() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_CALLBACK_0200', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_CALLBACK_0200', 0, async function (done) {
console.info('${TagFrmwkRender}: SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_CALLBACK_0200 IN.\n'); await renderPlay();
let maxVolume = 1.0; audioRen.getMinStreamVolume((err, minVolume) => {
let CallBack:any = (error,data) => { if (err) {
if (error) { console.error('${TagFrmwkRender} Get min stream volume Fail: ${err}');
console.log(`${TagFrmwkRender}: ####CallBack: execution fail,error: [${error.code}, ${error.message}]`);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
}else{ } else {
console.log(`${TagFrmwkRender}: ####CallBack: execution success, data: ${JSON.stringify(data)}`); console.info(`${TagFrmwkRender} Get min stream volume Success! minVolume: ${minVolume}`);
expect(data).assertEqual(env.OUTPUT_NUMBER_0); expect(minVolume).assertEqual(env.OUTPUT_NUMBER_0);
done(); 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() { ...@@ -736,16 +684,6 @@ export default function audioRendererTest() {
*/ */
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_CALLBACK_0300', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_CALLBACK_0300', 0, async function (done) {
let StreamType; 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{ try{
for (StreamType in audio.StreamUsage) { for (StreamType in audio.StreamUsage) {
...@@ -757,7 +695,7 @@ export default function audioRendererTest() { ...@@ -757,7 +695,7 @@ export default function audioRendererTest() {
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
} }
let AudioRendererInfo = { let AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH, content: audio.ContentType.CONTENT_TYPE_UNKNOWN,
usage: StreamType, usage: StreamType,
rendererFlags: 0 rendererFlags: 0
} }
...@@ -770,7 +708,6 @@ export default function audioRendererTest() { ...@@ -770,7 +708,6 @@ export default function audioRendererTest() {
await audio.createAudioRenderer(AudioRendererOptions).then((data) => { await audio.createAudioRenderer(AudioRendererOptions).then((data) => {
audioRender = 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} 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) => { }).catch((err) => {
console.info(`${TagFrmwkRender}: AudioRender Created : ERROR : ` + err.message); console.info(`${TagFrmwkRender}: AudioRender Created : ERROR : ` + err.message);
}); });
...@@ -778,7 +715,16 @@ export default function audioRendererTest() { ...@@ -778,7 +715,16 @@ export default function audioRendererTest() {
console.info(`${TagFrmwkRender}: AudioRender Created : catch ERROR : ` + error.code + error.message); 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); sleep(1000);
await audioRender.release().then(() => { await audioRender.release().then(() => {
...@@ -805,24 +751,16 @@ export default function audioRendererTest() { ...@@ -805,24 +751,16 @@ export default function audioRendererTest() {
*/ */
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_CALLBACK_0400', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_CALLBACK_0400', 0, async function (done) {
let minVolume = 1.0; let minVolume = 1.0;
let CallBack:any = (error,data) => { audioRen.getMinStreamVolume((err, minVolume) => {
if (error) { if (err) {
console.log(`${TagFrmwkRender}: SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_CALLBACK_0400: execution fail,error: [${error.code}, ${error.message}]`); 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)}`);
}
};
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(); expect(false).assertTrue();
done(); done();
}; } else {
await audioRen.setVolume(minVolume).then(() => { console.info(`${TagFrmwkRender} Get min stream volume Success! minVolume: ${minVolume}`);
console.info(`${TagFrmwkRender}: setVolume to 0 : Success`); expect(minVolume).assertEqual(env.OUTPUT_NUMBER_0);
audioRen.setVolume(minVolume).then(() => {
console.info(`${TagFrmwkRender}: setVolume to minVolume Success! minVolume: ${minVolume}`);
expect(true).assertTrue(); expect(true).assertTrue();
done(); done();
}).catch((err) => { }).catch((err) => {
...@@ -830,6 +768,8 @@ export default function audioRendererTest() { ...@@ -830,6 +768,8 @@ export default function audioRendererTest() {
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
}); });
}
})
}); });
}) })
......
...@@ -34,8 +34,8 @@ export default function audioRendererTest() { ...@@ -34,8 +34,8 @@ export default function audioRendererTest() {
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
} }
let AudioRendererInfo = { let AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH, content: audio.ContentType.CONTENT_TYPE_UNKNOWN,
usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, usage: audio.StreamUsage.STREAM_USAGE_MEDIA,
rendererFlags: 0 rendererFlags: 0
} }
let AudioRendererOptions = { let AudioRendererOptions = {
...@@ -79,7 +79,7 @@ export default function audioRendererTest() { ...@@ -79,7 +79,7 @@ export default function audioRendererTest() {
for (let index = 0; index < env.GENERAL_RUN_TIMES; index++) { for (let index = 0; index < env.GENERAL_RUN_TIMES; index++) {
try { try {
let data = await audioRen.getMaxStreamVolume(); let data = await audioRen.getMaxStreamVolume();
expect(data).assertEqual(1.0); expect(data).assertEqual(env.OUTPUT_NUMBER_1);
} catch (error) { } catch (error) {
console.log(`${TagFrmwkRender}: ####getMaxStreamVolume: execution ${index + 1} times error: ${JSON.stringify(error)}`); console.log(`${TagFrmwkRender}: ####getMaxStreamVolume: execution ${index + 1} times error: ${JSON.stringify(error)}`);
expect(false).assertTrue(); expect(false).assertTrue();
...@@ -117,7 +117,7 @@ export default function audioRendererTest() { ...@@ -117,7 +117,7 @@ export default function audioRendererTest() {
for (let index = 0; index < env.GENERAL_RUN_TIMES; index++) { for (let index = 0; index < env.GENERAL_RUN_TIMES; index++) {
try { try {
let data = await audioRen.getMinStreamVolume(); let data = await audioRen.getMinStreamVolume();
expect(data).assertEqual(0.0); expect(data).assertEqual(env.OUTPUT_NUMBER_0);
} catch (error) { } catch (error) {
console.log(`${TagFrmwkRender}: ####getMinStreamVolume: execution ${index + 1} times error: ${JSON.stringify(error)}`); console.log(`${TagFrmwkRender}: ####getMinStreamVolume: execution ${index + 1} times error: ${JSON.stringify(error)}`);
expect(false).assertTrue(); expect(false).assertTrue();
...@@ -164,7 +164,7 @@ export default function audioRendererTest() { ...@@ -164,7 +164,7 @@ export default function audioRendererTest() {
done(); done();
return; return;
}else{ }else{
expect(data).assertEqual(1.0); expect(data).assertEqual(env.OUTPUT_NUMBER_1);
recursive(n-1); recursive(n-1);
} }
}); });
...@@ -223,7 +223,7 @@ export default function audioRendererTest() { ...@@ -223,7 +223,7 @@ export default function audioRendererTest() {
done(); done();
return; return;
}else{ }else{
expect(data).assertEqual(0.0); expect(data).assertEqual(env.OUTPUT_NUMBER_0);
recursive(n-1); recursive(n-1);
} }
}); });
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册