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

modify the callback code format and update some testcases

Signed-off-by: Nwangzx0705 <wangzx0705@thundersoft.com>
上级 0f1092c4
...@@ -36,8 +36,8 @@ export default function audioRendererTest() { ...@@ -36,8 +36,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 = {
...@@ -48,7 +48,6 @@ export default function audioRendererTest() { ...@@ -48,7 +48,6 @@ export default function audioRendererTest() {
await audio.createAudioRenderer(AudioRendererOptions).then((data) => { await audio.createAudioRenderer(AudioRendererOptions).then((data) => {
audioRen = data; audioRen = data;
console.info('audioRendererEnhanceTest: AudioRender Created : Success : Stream Type: SUCCESS data state: ' + Object.keys(data)); console.info('audioRendererEnhanceTest: AudioRender Created : Success : Stream Type: SUCCESS data state: ' + Object.keys(data));
console.info('audioRendererEnhanceTest: AudioRender Created : Success : Stream Type: SUCCESS data value: ' + JSON.stringify(data));
}).catch((err) => { }).catch((err) => {
console.info('audioRendererEnhanceTest: AudioRender Created : ERROR : ' + err.message); console.info('audioRendererEnhanceTest: AudioRender Created : ERROR : ' + err.message);
}); });
...@@ -152,48 +151,12 @@ export default function audioRendererTest() { ...@@ -152,48 +151,12 @@ export default function audioRendererTest() {
/** /**
* @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_PROMISE_0200 * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_PROMISE_0200
* @tc.name : AudioRenderer - getRendererSamplingRate "uint32" - promise * @tc.name : AudioRenderer - getRendererSamplingRate "uint32" - promise
* @tc.desc : AudioRenderer - setRendererSamplingRate in pprepare ,then get the SamplingRate
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_PROMISE_0200', 0, async function (done) {
let samplingrate = 48000;
try{
await audioRen.setRendererSamplingRate(samplingrate).then((data) => {
console.info(`${TagFrmwkRender}: ####setRendererSamplingRate :set ${samplingrate}, SUCCESS`);
}).catch ((error)=>{
console.log("${TagFrmwkRender}: ####setRendererSamplingRate : error = " + error);
});
}catch(error){
console.log("####setRendererSamplingRate: catch error = " + error);
}
try{
await audioRen.getRendererSamplingRate().then((data) => {
console.info(`${TagFrmwkRender}: #####getRendererSamplingRate :SUCCESS ${data}`);
expect(data).assertEqual(env.SAMPLING_RATE_48000);
done();
}).catch ((error)=>{
console.log("${TagFrmwkRender}: #####getRendererSamplingRate : error = " + error);
expect(false).assertTrue();
done();
});
}catch(error){
console.log("#####getRendererSamplingRate: catch error = " + error);
expect(false).assertTrue();
done();
}
});
/**
* @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_PROMISE_0300
* @tc.name : AudioRenderer - getRendererSamplingRate "uint32" - promise
* @tc.desc : AudioRenderer - setRendererSamplingRate INVALID_INPUT_PARAMETER, then get the default SamplingRate * @tc.desc : AudioRenderer - setRendererSamplingRate INVALID_INPUT_PARAMETER, then get the default SamplingRate
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_PROMISE_0300', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_PROMISE_0200', 0, async function (done) {
let rate = '123'; let rate = '123';
try{ try{
await audioRen.setRendererSamplingRate(rate).then((data) => { await audioRen.setRendererSamplingRate(rate).then((data) => {
...@@ -222,14 +185,14 @@ export default function audioRendererTest() { ...@@ -222,14 +185,14 @@ export default function audioRendererTest() {
} }
}); });
/** /**
* @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_PROMISE_0400 * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_PROMISE_0300
* @tc.name : AudioRenderer - getRendererSamplingRate "uint32" - promise * @tc.name : AudioRenderer - getRendererSamplingRate "uint32" - promise
* @tc.desc : AudioRenderer - set a effective SamplingRate, then set a invalid SamplingRate, can get the effective SamplingRate * @tc.desc : AudioRenderer - set a effective SamplingRate, then set a invalid SamplingRate, can get the effective SamplingRate
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_PROMISE_0400', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_PROMISE_0300', 0, async function (done) {
let samplingrate = 48000; let samplingrate = 48000;
try{ try{
await audioRen.setRendererSamplingRate(samplingrate).then((data) => { await audioRen.setRendererSamplingRate(samplingrate).then((data) => {
...@@ -269,14 +232,14 @@ export default function audioRendererTest() { ...@@ -269,14 +232,14 @@ export default function audioRendererTest() {
} }
}); });
/** /**
* @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_PROMISE_0500 * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_PROMISE_0400
* @tc.name : AudioRenderer - getRendererSamplingRate "uint32" - promise * @tc.name : AudioRenderer - getRendererSamplingRate "uint32" - promise
* @tc.desc : AudioRenderer - getRendererSamplingRate in running * @tc.desc : AudioRenderer - getRendererSamplingRate in running
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_PROMISE_0500', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_PROMISE_0400', 0, async function (done) {
try{ try{
renderPlay(); renderPlay();
await audioRen.getRendererSamplingRate().then((data) => { await audioRen.getRendererSamplingRate().then((data) => {
...@@ -289,7 +252,7 @@ export default function audioRendererTest() { ...@@ -289,7 +252,7 @@ export default function audioRendererTest() {
done(); done();
}); });
}catch(error){ }catch(error){
console.log("#####SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_PROMISE_0500: catch error = " + error); console.log("#####SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_PROMISE_0400: catch error = " + error);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
...@@ -409,40 +372,18 @@ export default function audioRendererTest() { ...@@ -409,40 +372,18 @@ export default function audioRendererTest() {
/** /**
* @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_PROMISE_0400 * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_PROMISE_0400
* @tc.name : AudioRenderer - setRendererSamplingRate "int32" - promise
* @tc.desc : AudioRenderer - setRendererSamplingRate in running
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_PROMISE_0400', 0, async function (done) {
let samplingrate = 48000;
try {
renderPlay();
await audioRen.setRendererSamplingRate(samplingrate);
console.info(`${TagFrmwkRender}: ####setRendererSamplingRate: execution success`);
expect(true).assertTrue();
done();
}catch (error){
console.log("#####setRendererSamplingRate : error = " + error);
expect(false).assertTrue();
done();
};
});
/**
* @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_PROMISE_0500
* @tc.name : AudioRenderer - setRendererSamplingRate "uint32" - promise * @tc.name : AudioRenderer - setRendererSamplingRate "uint32" - promise
* @tc.desc : AudioRenderer - setRendererSamplingRate in running, then getRendererSamplingRate * @tc.desc : AudioRenderer - setRendererSamplingRate in running, then getRendererSamplingRate
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_PROMISE_0500', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_PROMISE_0400', 0, async function (done) {
let samplingrate = 48000; let samplingrate = 48000;
try { try {
renderPlay(); renderPlay();
await audioRen.setRendererSamplingRate(samplingrate); await audioRen.setRendererSamplingRate(samplingrate);
console.info(`SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_PROMISE_0500: execution success`); console.info(`SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_PROMISE_0400: execution success`);
}catch (error){ }catch (error){
console.log("#####setRendererSamplingRate : error = " + error); console.log("#####setRendererSamplingRate : error = " + error);
expect(false).assertTrue(); expect(false).assertTrue();
...@@ -475,196 +416,114 @@ export default function audioRendererTest() { ...@@ -475,196 +416,114 @@ export default function audioRendererTest() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_CALLBACK_0100', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_CALLBACK_0100', 0, async function (done) {
try { audioRen.getRendererSamplingRate((err, data) => {
audioRen.getRendererSamplingRate((err,data) => { if (err) {
if (err) { console.info(`${TagFrmwkRender}: getRendererSamplingRate ERROR! code: ${err.code}, mesage: ${err.message}`);
console.info(`${TagFrmwkRender}: ####getRendererSamplingRate : ERROR : code: ${err.code}, mesage: ${err.message}`); expect(false).assertTrue();
expect(false).assertTrue(); done();
done(); } else {
} else { console.info(`${TagFrmwkRender}: getRendererSamplingRate Success now SamplingRate: ${data}`);
console.info(`${TagFrmwkRender}: ####getRendererSamplingRate : Success ${data}`); expect(data).assertEqual(env.SAMPLING_RATE_44100);
expect(data).assertEqual(env.SAMPLING_RATE_44100); done();
done(); }
} });
});
}catch (error){
console.info(`SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_CALLBACK_0100: catch error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue();
done();
};
}); });
/** /**
* @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_CALLBACK_0200 * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_CALLBACK_0200
* @tc.name : AudioRenderer - getRendererSamplingRate "uint32" - callback * @tc.name : AudioRenderer - getRendererSamplingRate "uint32" - callback
* @tc.desc : AudioRenderer - setRendererSamplingRate, then get the SamplingRate * @tc.desc : AudioRenderer - set a valid SamplingRate, get the default SamplingRate
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_CALLBACK_0200', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_CALLBACK_0200', 0, async function (done) {
let rate = 48000; let rate = '123';
try { audioRen.setRendererSamplingRate(rate, (err) => {
await audioRen.setRendererSamplingRate(rate, (err) => { if (err) {
if (err) { console.info(`${TagFrmwkRender}: setRendererSamplingRate ERROR! code: ${err.code}, mesage: ${err.message}`);
console.info(`${TagFrmwkRender}: ####setRendererSamplingRate : ERROR : code: ${err.code}, mesage: ${err.message}`); audioRen.getRendererSamplingRate((err, data) => {
expect(false).assertTrue(); if (err) {
done(); console.info(`${TagFrmwkRender}: getRendererSamplingRate ERROR! code: ${err.code}, mesage: ${err.message}`);
} else {
console.info(`${TagFrmwkRender}: ####setRendererSamplingRate : set ${rate} SUCCESS`);
try {
audioRen.getRendererSamplingRate((err,data) => {
if (err) {
console.info(`${TagFrmwkRender}: ####getRendererSamplingRate : ERROR : code: ${err.code}, mesage: ${err.message}`);
expect(false).assertTrue();
done();
} else {
console.info(`${TagFrmwkRender}: ####getRendererSamplingRate : Success ${data}`);
expect(data).assertEqual(env.SAMPLING_RATE_48000);
done();
}
});
}catch(error){
console.info(`SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_CALLBACK_0200: catch error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
}; } else {
} console.info(`${TagFrmwkRender}: getRendererSamplingRate Success! SamplingRate: ${data}`);
}); expect(data).assertEqual(env.SAMPLING_RATE_44100);
}catch (error){ done();
console.info(`####setRendererSamplingRate: catch error, error: [${error.code}, ${error.message}]`); }
expect(false).assertTrue(); });
done(); } else {
}; console.info(`${TagFrmwkRender}: setRendererSamplingRate : set ${rate} SUCCESS`);
expect(false).assertTrue();
done();
}
});
}); });
/** /**
* @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_CALLBACK_0300 * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_CALLBACK_0300
* @tc.name : AudioRenderer - getRendererSamplingRate "uint32" - callback * @tc.name : AudioRenderer - getRendererSamplingRate "uint32" - callback
* @tc.desc : AudioRenderer - set a valid SamplingRate, get the default SamplingRate * @tc.desc : AudioRenderer - getRendererSamplingRate
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_CALLBACK_0300', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_CALLBACK_0300', 0, async function (done) {
let rate = '123'; let rate1 = 48000;
try { audioRen.setRendererSamplingRate(rate1, (err) => {
audioRen.setRendererSamplingRate(rate, (err) => { if (err) {
if (err) { console.info(`${TagFrmwkRender}: set rate1 ERROR! code: ${err.code}, mesage: ${err.message}`);
console.info(`${TagFrmwkRender}: ####setRendererSamplingRate : ERROR : code: ${err.code}, mesage: ${err.message}`); expect(false).assertTrue();
} else { done();
console.info(`${TagFrmwkRender}: ####setRendererSamplingRate : set ${rate} SUCCESS`); } else {
} console.info(`${TagFrmwkRender}: set rate1: ${rate1} SUCCESS! begin set rate2`);
}); let rate2 = '123';
} catch (error) { audioRen.setRendererSamplingRate(rate2, (err) => {
console.info(`####setRendererSamplingRate: catch error, error: [${error.code}, ${error.message}]`); if (err) {
}; console.info(`${TagFrmwkRender}: set rate2 ERROR! code: ${err.code}, mesage: ${err.message}`);
audioRen.getRendererSamplingRate((err, data) => {
try { if (err) {
audioRen.getRendererSamplingRate((err, data) => { console.info(`${TagFrmwkRender}: getRendererSamplingRate ERROR! code: ${err.code}, mesage: ${err.message}`);
if (err) { expect(false).assertTrue();
console.info(`${TagFrmwkRender}: ####getRendererSamplingRate : ERROR : code: ${err.code}, mesage: ${err.message}`); done();
expect(false).assertTrue(); } else {
done(); console.info(`${TagFrmwkRender}: getRendererSamplingRate Success now sampling rate: ${data}`);
} else { expect(data).assertEqual(env.SAMPLING_RATE_48000);
console.info(`${TagFrmwkRender}: ####getRendererSamplingRate : Success ${data}`); done();
expect(data).assertEqual(env.SAMPLING_RATE_44100); }
done(); });
} } else {
}); console.info(`${TagFrmwkRender}: set Rate2: ${rate2} SUCCESS! testcase FAIL!`);
} catch (error) { expect(false).assertTrue();
console.info(`####getRendererSamplingRate: catch error, error: [${error.code}, ${error.message}]`); done();
expect(false).assertTrue(); }
done(); });
}; }
});
}); });
/** /**
* @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_CALLBACK_0400 * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_CALLBACK_0400
* @tc.name : AudioRenderer - getRendererSamplingRate "uint32" - callback * @tc.name : AudioRenderer - getRendererSamplingRate "uint32" - callback
* @tc.desc : AudioRenderer - getRendererSamplingRate
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_CALLBACK_0400', 0, async function (done) {
console.info('AudioFrameworkRenderLog: SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_CALLBACK_0400 IN.\n');
let ret = 48000;
try {
audioRen.setRendererSamplingRate(ret, (err) => {
if (err) {
console.info(`${TagFrmwkRender}: ####setRendererSamplingRate1 : ERROR : code: ${err.code}, mesage: ${err.message}`);
expect(false).assertTrue();
done();
} else {
console.info(`${TagFrmwkRender}: ####setRendererSamplingRate1 : set ${ret} SUCCESS`);
}
});
}catch (error){
console.info(`####setRendererSamplingRate1: catch error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue();
done();
};
let rate = '123';
try {
audioRen.setRendererSamplingRate(rate, (err) => {
if (err) {
console.info(`${TagFrmwkRender}: ####setRendererSamplingRate2 : ERROR : code: ${err.code}, mesage: ${err.message}`);
} else {
console.info(`${TagFrmwkRender}: ####setRendererSamplingRate2 : set ${rate} SUCCESS`);
}
});
} catch (error) {
console.info(`####setRendererSamplingRate2: catch error, error: [${error.code}, ${error.message}]`);
};
try {
audioRen.getRendererSamplingRate((err, data) => {
if (err) {
console.info(`${TagFrmwkRender}: ####getRendererSamplingRate : ERROR : code: ${err.code}, mesage: ${err.message}`);
expect(false).assertTrue();
done();
} else {
console.info(`${TagFrmwkRender}: ####getRendererSamplingRate : Success ${data}`);
expect(data).assertEqual(env.SAMPLING_RATE_48000);
done();
}
});
} catch (error) {
console.info(`####getRendererSamplingRate: catch error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue();
done();
};
});
/**
* @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_CALLBACK_0500
* @tc.name : AudioRenderer - getRendererSamplingRate "uint32" - callback
* @tc.desc : AudioRenderer - getRendererSamplingRate "uint32" - callback * @tc.desc : AudioRenderer - getRendererSamplingRate "uint32" - callback
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_CALLBACK_0500', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_CALLBACK_0400', 0, async function (done) {
try { renderPlay();
renderPlay(); audioRen.getRendererSamplingRate((err, data) => {
audioRen.getRendererSamplingRate((err,data) => { if (err) {
if (err) { console.info(`${TagFrmwkRender}:getRendererSamplingRate ERROR! code: ${err.code}, mesage: ${err.message}`);
console.info(`${TagFrmwkRender}: ####getRendererSamplingRate : ERROR : code: ${err.code}, mesage: ${err.message}`); expect(false).assertTrue();
expect(false).assertTrue(); done();
done(); } else {
} else { console.info(`${TagFrmwkRender}:getRendererSamplingRate Success! now samplingRate: ${data}`);
console.info(`${TagFrmwkRender}: ####getRendererSamplingRate : Success ${data}`); expect(data).assertEqual(env.SAMPLING_RATE_44100);
expect(data).assertEqual(env.SAMPLING_RATE_44100); done();
done(); }
} });
});
}catch (error){
console.info(`####getRendererSamplingRate: catch error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue();
done();
};
}); });
/** /**
...@@ -677,38 +536,26 @@ export default function audioRendererTest() { ...@@ -677,38 +536,26 @@ export default function audioRendererTest() {
*/ */
it('SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_CALLBACK_0100', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_CALLBACK_0100', 0, async function (done) {
let rate = 48000; let rate = 48000;
try { audioRen.setRendererSamplingRate(rate, (err) => {
audioRen.setRendererSamplingRate(rate,(err) => { if (err) {
if (err) { console.info(`${TagFrmwkRender}: setRendererSamplingRate ERROR! code: ${err.code}, mesage: ${err.message}`);
console.info(`${TagFrmwkRender}: ####setRendererSamplingRate : ERROR : code: ${err.code}, mesage: ${err.message}`); expect(false).assertTrue();
expect(false).assertTrue(); done();
done(); } else {
} else { console.info(`${TagFrmwkRender}: setRendererSamplingRate : set ${rate} SUCCESS start getting samplingRate`);
console.info(`${TagFrmwkRender}: ####setRendererSamplingRate : set ${rate} SUCCESS`); audioRen.getRendererSamplingRate((err, data) => {
try { if (err) {
audioRen.getRendererSamplingRate((err,data) => { console.info(`${TagFrmwkRender}: getRendererSamplingRate ERROR! code: ${err.code}, mesage: ${err.message}`);
if (err) {
console.info(`${TagFrmwkRender}: ####getRendererSamplingRate : ERROR : code: ${err.code}, mesage: ${err.message}`);
expect(false).assertTrue();
done();
} else {
console.info(`${TagFrmwkRender}: ####getRendererSamplingRate : Success ${data}`);
expect(data).assertEqual(env.SAMPLING_RATE_48000);
done();
}
});
}catch (error){
console.info(`####getRendererSamplingRate: catch error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
}; } else {
} console.info(`${TagFrmwkRender}: getRendererSamplingRate Success! samplingRate: ${data}`);
}); expect(data).assertEqual(env.SAMPLING_RATE_48000);
}catch (error){ done();
console.info(`SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_CALLBACK_0100: catch error, error: [${error.code}, ${error.message}]`); }
expect(false).assertTrue(); });
done(); }
}; });
}); });
/** /**
...@@ -721,38 +568,26 @@ export default function audioRendererTest() { ...@@ -721,38 +568,26 @@ export default function audioRendererTest() {
*/ */
it('SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_CALLBACK_0200', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_CALLBACK_0200', 0, async function (done) {
let rate = 0; let rate = 0;
try { audioRen.setRendererSamplingRate(rate, (err) => {
audioRen.setRendererSamplingRate(rate, (err) => { if (err.code == env.INVALID_INPUT_PARAMETER_6800104) {
if (err.code == env.UNSUPORTED_OPTION_6800104) { console.info(`${TagFrmwkRender}: setRendererSamplingRate ERROR! code: ${err.code}, mesage: ${err.message} start getting samplingRate`);
console.info(`${TagFrmwkRender}: ####setRendererSamplingRate : ERROR : code: ${err.code}, mesage: ${err.message}`); audioRen.getRendererSamplingRate((err, data) => {
try { if (err) {
audioRen.getRendererSamplingRate((err,data) => { console.info(`${TagFrmwkRender}: getRendererSamplingRate ERROR! code: ${err.code}, mesage: ${err.message}`);
if (err) {
console.info(`${TagFrmwkRender}: ####getRendererSamplingRate : ERROR : code: ${err.code}, mesage: ${err.message}`);
expect(false).assertTrue();
done();
} else {
console.info(`${TagFrmwkRender}: ####getRendererSamplingRate : Success ${data}`);
rate = data;
expect(data).assertEqual(env.SAMPLING_RATE_44100);
done();
}
});
}catch (error){
console.info(`####getRendererSamplingRate: catch error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
}; } else {
} else { console.info(`${TagFrmwkRender}: getRendererSamplingRate Success! now samplingRate: ${data}`);
expect(false).assertTrue(); expect(data).assertEqual(env.SAMPLING_RATE_44100);
done(); done();
} }
}); });
}catch (error){ } else {
console.info(`SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_CALLBACK_0200: catch error, error: [${error.code}, ${error.message}]`); console.info(`${TagFrmwkRender}: setRendererSamplingRate Success! testcase FAIL!`);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
}; }
});
}); });
/** /**
...@@ -765,38 +600,26 @@ export default function audioRendererTest() { ...@@ -765,38 +600,26 @@ export default function audioRendererTest() {
*/ */
it('SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_CALLBACK_0300', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_CALLBACK_0300', 0, async function (done) {
let rate = '123'; let rate = '123';
try { audioRen.setRendererSamplingRate(rate, (err) => {
audioRen.setRendererSamplingRate(rate, (err) => { if (err.code == env.INVALID_INPUT_PARAMETER_6800101) {
if (err.code == env.INVALID_INPUT_PARAMETER_6800101) { console.info(`${TagFrmwkRender}: setRendererSamplingRate ERROR! code: ${err.code}, mesage: ${err.message} start getting samplingRate`);
console.info(`${TagFrmwkRender}: ####setRendererSamplingRate : ERROR : code: ${err.code}, mesage: ${err.message}`); audioRen.getRendererSamplingRate((err, data) => {
try { if (err) {
audioRen.getRendererSamplingRate((err,data) => { console.info(`${TagFrmwkRender}:getRendererSamplingRate ERROR! code: ${err.code}, mesage: ${err.message}`);
if (err) {
console.info(`${TagFrmwkRender}: ####getRendererSamplingRate : ERROR : code: ${err.code}, mesage: ${err.message}`);
expect(false).assertTrue();
done();
} else {
console.info(`${TagFrmwkRender}: ####getRendererSamplingRate : Success ${data}`);
rate = data;
expect(data).assertEqual(env.SAMPLING_RATE_44100);
done();
}
});
}catch (error){
console.info(`####getRendererSamplingRate: catch error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
}; } else {
} else { console.info(`${TagFrmwkRender}:getRendererSamplingRate Success! now samplingRate: ${data}`);
expect(false).assertTrue(); expect(data).assertEqual(env.SAMPLING_RATE_44100);
done(); done();
} }
}); });
}catch (error){ } else {
console.info(`SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_CALLBACK_0300: catch error, error: [${error.code}, ${error.message}]`); console.info(`${TagFrmwkRender}: setRendererSamplingRate Success! testcase FAIL!`);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
}; }
});
}); });
/** /**
...@@ -809,69 +632,27 @@ export default function audioRendererTest() { ...@@ -809,69 +632,27 @@ export default function audioRendererTest() {
*/ */
it('SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_CALLBACK_0400', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_CALLBACK_0400', 0, async function (done) {
let rate = 48000; let rate = 48000;
try { renderPlay();
renderPlay(); audioRen.setRendererSamplingRate(rate, (err) => {
audioRen.setRendererSamplingRate(rate, (err) => { if (err) {
if (err) { console.info(`${TagFrmwkRender}:setRendererSamplingRate ERROR! code: ${err.code}, mesage: ${err.message}`);
console.info(`${TagFrmwkRender}: ####setRendererSamplingRate : ERROR : code: ${err.code}, mesage: ${err.message}`); expect(false).assertTrue();
expect(false).assertTrue(); done();
done(); } else {
} else { console.info(`${TagFrmwkRender}:setRendererSamplingRate : set samplingRate:${rate} SUCCESS! start getting samplingRate`);
console.info(`${TagFrmwkRender}: ####setRendererSamplingRate : set ${rate} SUCCESS`); audioRen.getRendererSamplingRate((err, data) => {
expect(true).assertTrue(); if (err) {
done(); console.info(`${TagFrmwkRender}:getRendererSamplingRate : ERROR : code: ${err.code}, mesage: ${err.message}`);
}
});
}catch (error){
console.info(`SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_CALLBACK_0400: catch error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue();
done();
};
});
/**
* @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_CALLBACK_0500
* @tc.name : AudioRenderer - setRendererSamplingRate "uint32" - callback
* @tc.desc : AudioRenderer - setRendererSamplingRate "uint32" - callback
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_CALLBACK_0500', 0, async function (done) {
let rate = 48000;
try {
renderPlay();
audioRen.setRendererSamplingRate(rate,(err) => {
if (err) {
console.info(`${TagFrmwkRender}: ####setRendererSamplingRate : ERROR : code: ${err.code}, mesage: ${err.message}`);
expect(false).assertTrue();
done();
} else {
console.info(`${TagFrmwkRender}: ####setRendererSamplingRate : set ${rate} SUCCESS`);
try {
audioRen.getRendererSamplingRate((err,data) => {
if (err) {
console.info(`${TagFrmwkRender}: ####getRendererSamplingRate : ERROR : code: ${err.code}, mesage: ${err.message}`);
expect(false).assertTrue();
done();
} else {
console.info(`${TagFrmwkRender}: ####getRendererSamplingRate : Success ${data}`);
expect(data).assertEqual(env.SAMPLING_RATE_48000);
done();
}
});
}catch (error){
console.info(`####getRendererSamplingRate: catch error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
}; } else {
} console.info(`${TagFrmwkRender}:getRendererSamplingRate : Success ${data}`);
}); expect(data).assertEqual(env.SAMPLING_RATE_48000);
}catch (error){ done();
console.info(`SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_CALLBACK_0500: catch error, error: [${error.code}, ${error.message}]`); }
expect(false).assertTrue(); });
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 = {
...@@ -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,28 +299,24 @@ export default function audioRendererTest() { ...@@ -299,28 +299,24 @@ 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);
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)=>{ }).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(); expect(false).assertTrue();
done(); 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){ }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,28 +458,24 @@ export default function audioRendererTest() { ...@@ -463,28 +458,24 @@ 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);
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)=>{ }).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(); expect(false).assertTrue();
done(); 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){ }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(); 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() { ...@@ -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(); 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() { ...@@ -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(() => {
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() { ...@@ -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,31 +751,25 @@ export default function audioRendererTest() { ...@@ -805,31 +751,25 @@ 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(); expect(false).assertTrue();
done(); done();
}else{ } else {
console.log(`${TagFrmwkRender}: SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_CALLBACK_0400: execution success, data: ${JSON.stringify(data)}`); 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();
});
}); });
}) })
......
...@@ -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.
先完成此消息的编辑!
想要评论请 注册