提交 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() {
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 = {
......@@ -48,7 +48,6 @@ export default function audioRendererTest() {
await audio.createAudioRenderer(AudioRendererOptions).then((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 value: ' + JSON.stringify(data));
}).catch((err) => {
console.info('audioRendererEnhanceTest: AudioRender Created : ERROR : ' + err.message);
});
......@@ -152,48 +151,12 @@ export default function audioRendererTest() {
/**
* @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_PROMISE_0200
* @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.size : MEDIUM
* @tc.type : Function
* @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';
try{
await audioRen.setRendererSamplingRate(rate).then((data) => {
......@@ -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.desc : AudioRenderer - set a effective SamplingRate, then set a invalid SamplingRate, can get the effective SamplingRate
* @tc.size : MEDIUM
* @tc.type : Function
* @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;
try{
await audioRen.setRendererSamplingRate(samplingrate).then((data) => {
......@@ -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.desc : AudioRenderer - getRendererSamplingRate in running
* @tc.size : MEDIUM
* @tc.type : Function
* @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{
renderPlay();
await audioRen.getRendererSamplingRate().then((data) => {
......@@ -289,7 +252,7 @@ export default function audioRendererTest() {
done();
});
}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();
done();
}
......@@ -409,40 +372,18 @@ export default function audioRendererTest() {
/**
* @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.desc : AudioRenderer - setRendererSamplingRate in running, then getRendererSamplingRate
* @tc.size : MEDIUM
* @tc.type : Function
* @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;
try {
renderPlay();
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){
console.log("#####setRendererSamplingRate : error = " + error);
expect(false).assertTrue();
......@@ -475,196 +416,114 @@ export default function audioRendererTest() {
* @tc.level : Level 0
*/
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_CALLBACK_0100', 0, async function (done) {
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_44100);
done();
}
});
}catch (error){
console.info(`SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_CALLBACK_0100: catch error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue();
done();
};
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 now SamplingRate: ${data}`);
expect(data).assertEqual(env.SAMPLING_RATE_44100);
done();
}
});
});
/**
* @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_CALLBACK_0200
* @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.type : Function
* @tc.level : Level 0
*/
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_CALLBACK_0200', 0, async function (done) {
let rate = 48000;
try {
await 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(`SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_CALLBACK_0200: catch error, error: [${error.code}, ${error.message}]`);
let rate = '123';
audioRen.setRendererSamplingRate(rate, (err) => {
if (err) {
console.info(`${TagFrmwkRender}: setRendererSamplingRate ERROR! code: ${err.code}, mesage: ${err.message}`);
audioRen.getRendererSamplingRate((err, data) => {
if (err) {
console.info(`${TagFrmwkRender}: getRendererSamplingRate ERROR! code: ${err.code}, mesage: ${err.message}`);
expect(false).assertTrue();
done();
};
}
});
}catch (error){
console.info(`####setRendererSamplingRate: catch error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue();
done();
};
} else {
console.info(`${TagFrmwkRender}: getRendererSamplingRate Success! SamplingRate: ${data}`);
expect(data).assertEqual(env.SAMPLING_RATE_44100);
done();
}
});
} else {
console.info(`${TagFrmwkRender}: setRendererSamplingRate : set ${rate} SUCCESS`);
expect(false).assertTrue();
done();
}
});
});
/**
* @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_CALLBACK_0300
* @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.type : Function
* @tc.level : Level 0
*/
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_CALLBACK_0300', 0, async function (done) {
let rate = '123';
try {
audioRen.setRendererSamplingRate(rate, (err) => {
if (err) {
console.info(`${TagFrmwkRender}: ####setRendererSamplingRate : ERROR : code: ${err.code}, mesage: ${err.message}`);
} else {
console.info(`${TagFrmwkRender}: ####setRendererSamplingRate : set ${rate} SUCCESS`);
}
});
} catch (error) {
console.info(`####setRendererSamplingRate: 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_44100);
done();
}
});
} catch (error) {
console.info(`####getRendererSamplingRate: catch error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue();
done();
};
let rate1 = 48000;
audioRen.setRendererSamplingRate(rate1, (err) => {
if (err) {
console.info(`${TagFrmwkRender}: set rate1 ERROR! code: ${err.code}, mesage: ${err.message}`);
expect(false).assertTrue();
done();
} else {
console.info(`${TagFrmwkRender}: set rate1: ${rate1} SUCCESS! begin set rate2`);
let rate2 = '123';
audioRen.setRendererSamplingRate(rate2, (err) => {
if (err) {
console.info(`${TagFrmwkRender}: set rate2 ERROR! code: ${err.code}, mesage: ${err.message}`);
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 now sampling rate: ${data}`);
expect(data).assertEqual(env.SAMPLING_RATE_48000);
done();
}
});
} else {
console.info(`${TagFrmwkRender}: set Rate2: ${rate2} SUCCESS! testcase FAIL!`);
expect(false).assertTrue();
done();
}
});
}
});
});
/**
* @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_CALLBACK_0400
* @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.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_CALLBACK_0500', 0, async function (done) {
try {
renderPlay();
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_44100);
done();
}
});
}catch (error){
console.info(`####getRendererSamplingRate: catch error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue();
done();
};
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETRENDERERSAMPLINGRATE_CALLBACK_0400', 0, async function (done) {
renderPlay();
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! now samplingRate: ${data}`);
expect(data).assertEqual(env.SAMPLING_RATE_44100);
done();
}
});
});
/**
......@@ -677,38 +536,26 @@ export default function audioRendererTest() {
*/
it('SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_CALLBACK_0100', 0, async function (done) {
let rate = 48000;
try {
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}]`);
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 start getting samplingRate`);
audioRen.getRendererSamplingRate((err, data) => {
if (err) {
console.info(`${TagFrmwkRender}: getRendererSamplingRate ERROR! code: ${err.code}, mesage: ${err.message}`);
expect(false).assertTrue();
done();
};
}
});
}catch (error){
console.info(`SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_CALLBACK_0100: catch error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue();
done();
};
} else {
console.info(`${TagFrmwkRender}: getRendererSamplingRate Success! samplingRate: ${data}`);
expect(data).assertEqual(env.SAMPLING_RATE_48000);
done();
}
});
}
});
});
/**
......@@ -721,38 +568,26 @@ export default function audioRendererTest() {
*/
it('SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_CALLBACK_0200', 0, async function (done) {
let rate = 0;
try {
audioRen.setRendererSamplingRate(rate, (err) => {
if (err.code == env.UNSUPORTED_OPTION_6800104) {
console.info(`${TagFrmwkRender}: ####setRendererSamplingRate : ERROR : code: ${err.code}, mesage: ${err.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}`);
rate = data;
expect(data).assertEqual(env.SAMPLING_RATE_44100);
done();
}
});
}catch (error){
console.info(`####getRendererSamplingRate: catch error, error: [${error.code}, ${error.message}]`);
audioRen.setRendererSamplingRate(rate, (err) => {
if (err.code == env.INVALID_INPUT_PARAMETER_6800104) {
console.info(`${TagFrmwkRender}: setRendererSamplingRate ERROR! code: ${err.code}, mesage: ${err.message} start getting samplingRate`);
audioRen.getRendererSamplingRate((err, data) => {
if (err) {
console.info(`${TagFrmwkRender}: getRendererSamplingRate ERROR! code: ${err.code}, mesage: ${err.message}`);
expect(false).assertTrue();
done();
};
} else {
expect(false).assertTrue();
done();
}
});
}catch (error){
console.info(`SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_CALLBACK_0200: catch error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue();
done();
};
} else {
console.info(`${TagFrmwkRender}: getRendererSamplingRate Success! now samplingRate: ${data}`);
expect(data).assertEqual(env.SAMPLING_RATE_44100);
done();
}
});
} else {
console.info(`${TagFrmwkRender}: setRendererSamplingRate Success! testcase FAIL!`);
expect(false).assertTrue();
done();
}
});
});
/**
......@@ -765,38 +600,26 @@ export default function audioRendererTest() {
*/
it('SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_CALLBACK_0300', 0, async function (done) {
let rate = '123';
try {
audioRen.setRendererSamplingRate(rate, (err) => {
if (err.code == env.INVALID_INPUT_PARAMETER_6800101) {
console.info(`${TagFrmwkRender}: ####setRendererSamplingRate : ERROR : code: ${err.code}, mesage: ${err.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}`);
rate = data;
expect(data).assertEqual(env.SAMPLING_RATE_44100);
done();
}
});
}catch (error){
console.info(`####getRendererSamplingRate: catch error, error: [${error.code}, ${error.message}]`);
audioRen.setRendererSamplingRate(rate, (err) => {
if (err.code == env.INVALID_INPUT_PARAMETER_6800101) {
console.info(`${TagFrmwkRender}: setRendererSamplingRate ERROR! code: ${err.code}, mesage: ${err.message} start getting samplingRate`);
audioRen.getRendererSamplingRate((err, data) => {
if (err) {
console.info(`${TagFrmwkRender}:getRendererSamplingRate ERROR! code: ${err.code}, mesage: ${err.message}`);
expect(false).assertTrue();
done();
};
} else {
expect(false).assertTrue();
done();
}
});
}catch (error){
console.info(`SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_CALLBACK_0300: catch error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue();
done();
};
} else {
console.info(`${TagFrmwkRender}:getRendererSamplingRate Success! now samplingRate: ${data}`);
expect(data).assertEqual(env.SAMPLING_RATE_44100);
done();
}
});
} else {
console.info(`${TagFrmwkRender}: setRendererSamplingRate Success! testcase FAIL!`);
expect(false).assertTrue();
done();
}
});
});
/**
......@@ -809,69 +632,27 @@ export default function audioRendererTest() {
*/
it('SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_CALLBACK_0400', 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`);
expect(true).assertTrue();
done();
}
});
}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}]`);
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 samplingRate:${rate} SUCCESS! start getting samplingRate`);
audioRen.getRendererSamplingRate((err, data) => {
if (err) {
console.info(`${TagFrmwkRender}:getRendererSamplingRate : ERROR : code: ${err.code}, mesage: ${err.message}`);
expect(false).assertTrue();
done();
};
}
});
}catch (error){
console.info(`SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_CALLBACK_0500: catch error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue();
done();
};
} else {
console.info(`${TagFrmwkRender}:getRendererSamplingRate : Success ${data}`);
expect(data).assertEqual(env.SAMPLING_RATE_48000);
done();
}
});
}
});
});
})
......
......@@ -34,8 +34,8 @@ export default function audioRendererTest() {
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
}
let AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH,
usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION,
content: audio.ContentType.CONTENT_TYPE_UNKNOWN,
usage: audio.StreamUsage.STREAM_USAGE_MEDIA,
rendererFlags: 0
}
let AudioRendererOptions = {
......@@ -100,8 +100,8 @@ export default function audioRendererTest() {
done();
})
it('SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_PROMISE_0600', 0, async function (done) {
let number = `SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_PROMISE_0600`
it('SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_PROMISE_0500', 0, async function (done) {
let number = `SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_PROMISE_0500`
let rate = 48000
for (let index = 0; index < env.GENERAL_RUN_TIMES; index++){
try {
......@@ -173,9 +173,9 @@ export default function audioRendererTest() {
}
})
it('SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_CALLBACK_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.
let number = `SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_CALLBACK_0600`
let number = `SUB_MULTIMEDIA_AUDIO_RENDERER_SETRENDERERSAMPLINGRATE_CALLBACK_0500`
let rate = 48000
setRendererSamplingRateTest(0)
function setRendererSamplingRateTest(index) {
......@@ -215,6 +215,5 @@ export default function audioRendererTest() {
})
}
})
})
}
\ No newline at end of file
......@@ -139,12 +139,9 @@ export default function audioRendererTest() {
await audioRen.getCurrentOutputDevices().then((data) => {
console.info(`${TagFrmwkRender}: deviceRole:${data.deviceRole}, deviceType:${data.deviceType}, id:${data.id}, name:${data.name}, address:${data.address}, sampleRates:${data.sampleRates}, channelCounts:${data.channelCounts}, channelMasks:${data.channelMasks}`);
try {
if(data.sampleRates == 44100 && data.channelCounts == 2){
expect(data.deviceRole).assertEqual(audio.DeviceRole.OUTPUT_DEVICE);
expect(data.deviceType).assertEqual(audio.DeviceType.SPEAKER);
expect(data.id).assertLargerOrEqual(env.OUTPUT_NUMBER_0);
expect(data.channelMasks).assertLargerOrEqual(env.OUTPUT_NUMBER_0);
}
} catch (error){
console.log('${TagFrmwkRender}: ######assertion failure');
}
......@@ -304,12 +301,9 @@ export default function audioRendererTest() {
} else {
console.info(`${TagFrmwkRender}: deviceRole:${data.deviceRole}, deviceType:${data.deviceType}, id:${data.id}, address:${data.address}, sampleRates:${data.sampleRates}, channelCounts:${data.channelCounts}, channelMasks:${data.channelMasks}`);
try {
if(data.sampleRates == 44100 && data.channelCounts == 2){
expect(data.deviceRole).assertEqual(audio.DeviceRole.OUTPUT_DEVICE);
expect(data.deviceType).assertEqual(audio.DeviceType.SPEAKER);
expect(data.id).assertLargerOrEqual(env.OUTPUT_NUMBER_0);
expect(data.channelMasks).assertLargerOrEqual(env.OUTPUT_NUMBER_0);
}
} catch (error){
console.log('${TagFrmwkRender}: ######assertion failure');
}
......
......@@ -80,12 +80,9 @@ export default function audioRendererTest() {
try {
let data = await audioRen.getCurrentOutputDevices();
try{
if (data.sampleRates == 44100 && data.channelCounts == 2) {
expect(data.deviceRole).assertEqual(audio.DeviceRole.OUTPUT_DEVICE);
expect(data.deviceType).assertEqual(audio.DeviceType.SPEAKER);
expect(data.id).assertLargerOrEqual(0);
expect(data.channelMasks).assertLargerOrEqual(0);
}
}catch (error){
console.log('${TagFrmwkRender}:######assertion failure');
}
......@@ -121,12 +118,9 @@ export default function audioRendererTest() {
return;
}else{
try{
if(data.sampleRates == 44100 && data.channelCounts == 2){
expect(data.deviceRole).assertEqual(audio.DeviceRole.OUTPUT_DEVICE);
expect(data.deviceType).assertEqual(audio.DeviceType.SPEAKER);
expect(data.id).assertLargerOrEqual(0);
expect(data.channelMasks).assertLargerOrEqual(0);
}
}catch (error){
console.log('${TagFrmwkRender}: ######assertion failure');
}
......
......@@ -36,7 +36,7 @@ export default function audioRendererTest() {
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
}
let AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH,
content: audio.ContentType.CONTENT_TYPE_UNKNOWN,
usage: audio.StreamUsage.STREAM_USAGE_MEDIA,
rendererFlags: 0
}
......@@ -247,7 +247,7 @@ export default function audioRendererTest() {
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
}
let AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH,
content: audio.ContentType.CONTENT_TYPE_UNKNOWN,
usage: StreamType,
rendererFlags: 0
}
......@@ -299,28 +299,24 @@ export default function audioRendererTest() {
* @tc.level : Level 0
*/
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMAXSTREAMVOLUME_PROMISE_0400', 0, async function (done) {
let maxVolume = 0.0;
try{
await audioRen.getMaxStreamVolume().then((data) => {
console.info(`${TagFrmwkRender}: #####getMaxStreamVolume :SUCCESS ${data}`);
maxVolume = data;
expect(data).assertEqual(env.OUTPUT_NUMBER_1);
audioRen.setVolume(data).then(() => {
console.info(`${TagFrmwkRender}: setVolume to maxVolume Success! maxVolume: ${data}`);
expect(true).assertTrue();
done();
}).catch((err) => {
console.info(`${TagFrmwkRender}: setVolume : ERROR : code: ${err.code}, mesage: ${err.message}`);
expect(false).assertTrue();
done();
});
}).catch ((error)=>{
console.info(`${TagFrmwkRender}: ####getMaxStreamVolume : ERROR : code: ${error.code}, mesage: ${error.message}`);
expect(false).assertTrue();
done();
});
await audioRen.setVolume(maxVolume).then(() => {
console.info(`${TagFrmwkRender}: setVolume to 1 : Success`);
expect(true).assertTrue();
done();
}).catch((err) => {
console.info(`${TagFrmwkRender}: setVolume : ERROR : code: ${err.code}, mesage: ${err.message}`);
expect(false).assertTrue();
done();
});
}catch(error){
console.info(`SUB_MULTIMEDIA_AUDIO_RENDERER_GETMAXSTREAMVOLUME_PROMISE_0400: catch error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue();
......@@ -411,7 +407,7 @@ export default function audioRendererTest() {
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
}
let AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH,
content: audio.ContentType.CONTENT_TYPE_UNKNOWN,
usage: StreamType,
rendererFlags: 0
}
......@@ -424,7 +420,6 @@ export default function audioRendererTest() {
await audio.createAudioRenderer(AudioRendererOptions).then((data) => {
audioRender = data;
console.info(`${TagFrmwkRender}: AudioRender Created : Stream Type: ${StreamType} SUCCESS data state: ` + Object.keys(data));
console.info(`${TagFrmwkRender}: AudioRender Created : Stream Type: ${StreamType} STREAM_USAGE_MEDIA SUCCESS data value: ` + JSON.stringify(data));
}).catch((err) => {
console.info(`${TagFrmwkRender}: AudioRender Created : ERROR : ` + err.message);
});
......@@ -463,28 +458,24 @@ export default function audioRendererTest() {
* @tc.level : Level 0
*/
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_PROMISE_0400', 0, async function (done) {
let minVolume = 1.0;
try{
await audioRen.getMinStreamVolume().then((data) => {
console.info(`${TagFrmwkRender}: #####getMinStreamVolume :SUCCESS ${data}`);
minVolume = data;
expect(data).assertEqual(env.OUTPUT_NUMBER_0);
audioRen.setVolume(data).then(() => {
console.info(`${TagFrmwkRender}: setVolume to minVolume Success! minVolume: ${data}`);
expect(true).assertTrue();
done();
}).catch((err) => {
console.info(`${TagFrmwkRender}: setVolume : ERROR : code: ${err.code}, mesage: ${err.message}`);
expect(false).assertTrue();
done();
});
}).catch ((error)=>{
console.info(`${TagFrmwkRender}: ####getMinStreamVolume : ERROR : code: ${error.code}, mesage: ${error.message}`);
expect(false).assertTrue();
done();
});
await audioRen.setVolume(minVolume).then(() => {
console.info(`${TagFrmwkRender}: setVolume to 0 : Success`);
expect(true).assertTrue();
done();
}).catch((err) => {
console.info(`${TagFrmwkRender}: setVolume : ERROR : code: ${err.code}, mesage: ${err.message}`);
expect(false).assertTrue();
done();
});
}catch(error){
console.info(`SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_PROMISE_0400: catch error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue();
......@@ -501,24 +492,17 @@ export default function audioRendererTest() {
* @tc.level : Level 0
*/
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMAXSTREAMVOLUME_CALLBACK_0100', 0, async function (done) {
let CallBack:any = (error,data) => {
if (error) {
console.log(`${TagFrmwkRender}: ####CallBack: execution fail,error: [${error.code}, ${error.message}]`);
audioRen.getMaxStreamVolume((err, maxVolume) => {
if (err) {
console.error('${TagFrmwkRender} Get max stream volume Fail: ${err}');
expect(false).assertTrue();
done();
}else{
console.log(`${TagFrmwkRender}: ####CallBack: execution success, data: ${JSON.stringify(data)}`);
expect(data).assertEqual(env.OUTPUT_NUMBER_1);
} else {
console.info('${TagFrmwkRender} Get max stream volume Success! ${maxVolume}');
expect(maxVolume).assertEqual(env.OUTPUT_NUMBER_1);
done();
}
};
try{
audioRen.getMaxStreamVolume(CallBack);
}catch(error){
console.log(`${TagFrmwkRender}: ####getMaxStreamVolume: catch error, error: [${error.code}, ${error.message}]`);
expect(true).assertTrue();
done();
}
})
});
/**
......@@ -530,25 +514,18 @@ export default function audioRendererTest() {
* @tc.level : Level 0
*/
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMAXSTREAMVOLUME_CALLBACK_0200', 0, async function (done) {
let CallBack:any = (error,data) => {
if (error) {
console.log(`${TagFrmwkRender}: ####CallBack: execution fail,error: [${error.code}, ${error.message}]`);
await renderPlay();
audioRen.getMaxStreamVolume((err, maxVolume) => {
if (err) {
console.error('${TagFrmwkRender} Get max stream volume Fail: ${err}');
expect(false).assertTrue();
done();
}else{
console.log(`${TagFrmwkRender}: ####CallBack: execution success, data: ${JSON.stringify(data)}`);
expect(data).assertEqual(env.OUTPUT_NUMBER_1);
} else {
console.info('${TagFrmwkRender} Get max stream volume Success! ${maxVolume}');
expect(maxVolume).assertEqual(env.OUTPUT_NUMBER_1);
done();
}
};
try{
await renderPlay();
audioRen.getMaxStreamVolume(CallBack);
}catch(error){
console.log(`${TagFrmwkRender}: ####getMaxStreamVolume: catch error, error: [${error.code}, ${error.message}]`);
expect(true).assertTrue();
done();
}
})
});
/**
......@@ -561,17 +538,6 @@ export default function audioRendererTest() {
*/
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMAXSTREAMVOLUME_CALLBACK_0300', 0, async function (done) {
let StreamType;
let CallBack:any = (error,data) => {
if (error) {
console.log(`${TagFrmwkRender}: ####CallBack: execution fail,error: [${error.code}, ${error.message}]`);
expect(false).assertTrue();
done();
}else{
console.log(`${TagFrmwkRender}: ####CallBack:StreamType:${StreamType} execution success, data: ${JSON.stringify(data)}`);
expect(data).assertEqual(env.OUTPUT_NUMBER_1);
}
};
try{
for (StreamType in audio.StreamUsage) {
let audioRender;
......@@ -582,7 +548,7 @@ export default function audioRendererTest() {
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
}
let AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH,
content: audio.ContentType.CONTENT_TYPE_UNKNOWN,
usage: StreamType,
rendererFlags: 0
}
......@@ -603,12 +569,17 @@ export default function audioRendererTest() {
console.info(`${TagFrmwkRender}: AudioRender Created : catch ERROR : ` + error.code + error.message);
}
try{
audioRen.getMaxStreamVolume();
}catch(error){
console.log(`${TagFrmwkRender}: ####getMaxStreamVolume: catch error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue();
}
audioRen.getMaxStreamVolume((err, maxVolume) => {
if (err) {
console.error('${TagFrmwkRender} Get max stream volume Fail: ${err}');
expect(false).assertTrue();
done();
} else {
console.info('${TagFrmwkRender} Get max stream volume Success! ${maxVolume}');
expect(maxVolume).assertEqual(env.OUTPUT_NUMBER_1);
done();
}
})
sleep(1000);
await audioRender.release().then(() => {
......@@ -636,32 +607,25 @@ export default function audioRendererTest() {
* @tc.level : Level 0
*/
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMAXSTREAMVOLUME_CALLBACK_0400', 0, async function (done) {
let maxVolume = 0.0;
let CallBack:any = (error,data) => {
if (error) {
console.log(`${TagFrmwkRender}: ####CallBack: execution fail,error: [${error.code}, ${error.message}]`);
audioRen.getMaxStreamVolume((err, maxVolume) => {
if (err) {
console.error('${TagFrmwkRender} Get max stream volume Fail: ${err}');
expect(false).assertTrue();
done();
}else{
console.log(`${TagFrmwkRender}: ####CallBack: execution success, data: ${JSON.stringify(data)}`);
} else {
console.info(`${TagFrmwkRender} Get max stream volume Success! maxVolume: ${maxVolume}`);
expect(maxVolume).assertEqual(env.OUTPUT_NUMBER_1);
audioRen.setVolume(maxVolume).then(() => {
console.info(`${TagFrmwkRender}: setVolume to maxVolume Success! maxVolume: ${maxVolume}`);
expect(true).assertTrue();
done();
}).catch((err) => {
console.info(`${TagFrmwkRender}: setVolume ERROR! : code: ${err.code}, mesage: ${err.message}`);
expect(false).assertTrue();
done();
});
}
};
try{
audioRen.getMaxStreamVolume(CallBack);
}catch(error){
console.log(`${TagFrmwkRender}: ####getMaxStreamVolume: catch error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue();
}
await audioRen.setVolume(maxVolume).then(() => {
console.info(`${TagFrmwkRender}: setVolume to 1 : Success`);
expect(true).assertTrue();
done();
}).catch((err) => {
console.info(`${TagFrmwkRender}: setVolume : ERROR : code: ${err.code}, mesage: ${err.message}`);
expect(false).assertTrue();
done();
});
})
});
/**
......@@ -673,24 +637,17 @@ export default function audioRendererTest() {
* @tc.level : Level 0
*/
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_CALLBACK_0100', 0, async function (done) {
let CallBack:any = (error,data) => {
if (error) {
console.log(`${TagFrmwkRender}: ####CallBack: execution fail,error: [${error.code}, ${error.message}]`);
audioRen.getMinStreamVolume((err, minVolume) => {
if (err) {
console.error('${TagFrmwkRender} Get min stream volume Fail: ${err}');
expect(false).assertTrue();
done();
}else{
console.log(`${TagFrmwkRender}: ####CallBack: execution success, data: ${JSON.stringify(data)}`);
expect(data).assertEqual(env.OUTPUT_NUMBER_0);
} else {
console.info(`${TagFrmwkRender} Get min stream volume Success! minVolume: ${minVolume}`);
expect(minVolume).assertEqual(env.OUTPUT_NUMBER_0);
done();
}
};
try{
audioRen.getMinStreamVolume(CallBack);
}catch(error){
console.log(`SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_CALLBACK_0100: catch error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue();
done();
};
})
});
/**
......@@ -702,27 +659,18 @@ export default function audioRendererTest() {
* @tc.level : Level 0
*/
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_CALLBACK_0200', 0, async function (done) {
console.info('${TagFrmwkRender}: SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_CALLBACK_0200 IN.\n');
let maxVolume = 1.0;
let CallBack:any = (error,data) => {
if (error) {
console.log(`${TagFrmwkRender}: ####CallBack: execution fail,error: [${error.code}, ${error.message}]`);
await renderPlay();
audioRen.getMinStreamVolume((err, minVolume) => {
if (err) {
console.error('${TagFrmwkRender} Get min stream volume Fail: ${err}');
expect(false).assertTrue();
done();
}else{
console.log(`${TagFrmwkRender}: ####CallBack: execution success, data: ${JSON.stringify(data)}`);
expect(data).assertEqual(env.OUTPUT_NUMBER_0);
} else {
console.info(`${TagFrmwkRender} Get min stream volume Success! minVolume: ${minVolume}`);
expect(minVolume).assertEqual(env.OUTPUT_NUMBER_0);
done();
}
};
try{
await renderPlay();
audioRen.getMinStreamVolume(CallBack,maxVolume);
}catch(error){
console.log(`${TagFrmwkRender}: ####getMinStreamVolume: catch error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue();
done();
};
})
});
......@@ -736,16 +684,6 @@ export default function audioRendererTest() {
*/
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_CALLBACK_0300', 0, async function (done) {
let StreamType;
let CallBack:any = (error,data) => {
if (error) {
console.log(`${TagFrmwkRender}: ####CallBack: execution fail,error: [${error.code}, ${error.message}]`);
expect(false).assertTrue();
done();
}else{
console.log(`${TagFrmwkRender}: ####CallBack:StreamType:${StreamType} execution success, data: ${JSON.stringify(data)}`);
expect(data).assertEqual(env.OUTPUT_NUMBER_0);
}
};
try{
for (StreamType in audio.StreamUsage) {
......@@ -757,7 +695,7 @@ export default function audioRendererTest() {
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
}
let AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH,
content: audio.ContentType.CONTENT_TYPE_UNKNOWN,
usage: StreamType,
rendererFlags: 0
}
......@@ -770,7 +708,6 @@ export default function audioRendererTest() {
await audio.createAudioRenderer(AudioRendererOptions).then((data) => {
audioRender = data;
console.info(`${TagFrmwkRender}: AudioRender Created : Stream Type: ${StreamType} SUCCESS data state: ` + Object.keys(data));
console.info(`${TagFrmwkRender}: AudioRender Created : Stream Type: ${StreamType} STREAM_USAGE_MEDIA SUCCESS data value: ` + JSON.stringify(data));
}).catch((err) => {
console.info(`${TagFrmwkRender}: AudioRender Created : ERROR : ` + err.message);
});
......@@ -778,7 +715,16 @@ export default function audioRendererTest() {
console.info(`${TagFrmwkRender}: AudioRender Created : catch ERROR : ` + error.code + error.message);
}
audioRen.getMinStreamVolume(CallBack);
audioRen.getMinStreamVolume((err, minVolume) => {
if (err) {
console.error('${TagFrmwkRender} Get min stream volume Fail: ${err}');
expect(false).assertTrue();
done();
} else {
console.info(`${TagFrmwkRender} Get min stream volume Success! minVolume: ${minVolume}`);
expect(minVolume).assertEqual(env.OUTPUT_NUMBER_0);
}
})
sleep(1000);
await audioRender.release().then(() => {
......@@ -805,31 +751,25 @@ export default function audioRendererTest() {
*/
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_CALLBACK_0400', 0, async function (done) {
let minVolume = 1.0;
let CallBack:any = (error,data) => {
if (error) {
console.log(`${TagFrmwkRender}: SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_CALLBACK_0400: execution fail,error: [${error.code}, ${error.message}]`);
audioRen.getMinStreamVolume((err, minVolume) => {
if (err) {
console.error('${TagFrmwkRender} Get min stream volume Fail: ${err}');
expect(false).assertTrue();
done();
}else{
console.log(`${TagFrmwkRender}: SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_CALLBACK_0400: execution success, data: ${JSON.stringify(data)}`);
} else {
console.info(`${TagFrmwkRender} Get min stream volume Success! minVolume: ${minVolume}`);
expect(minVolume).assertEqual(env.OUTPUT_NUMBER_0);
audioRen.setVolume(minVolume).then(() => {
console.info(`${TagFrmwkRender}: setVolume to minVolume Success! minVolume: ${minVolume}`);
expect(true).assertTrue();
done();
}).catch((err) => {
console.info(`${TagFrmwkRender}: setVolume : ERROR : code: ${err.code}, mesage: ${err.message}`);
expect(false).assertTrue();
done();
});
}
};
try{
audioRen.getMinStreamVolume(CallBack);
}catch(error){
console.log(`${TagFrmwkRender}: SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_CALLBACK_0400: catch error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue();
done();
};
await audioRen.setVolume(minVolume).then(() => {
console.info(`${TagFrmwkRender}: setVolume to 0 : Success`);
expect(true).assertTrue();
done();
}).catch((err) => {
console.info(`${TagFrmwkRender}: setVolume : ERROR : code: ${err.code}, mesage: ${err.message}`);
expect(false).assertTrue();
done();
});
})
});
})
......
......@@ -34,8 +34,8 @@ export default function audioRendererTest() {
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
}
let AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH,
usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION,
content: audio.ContentType.CONTENT_TYPE_UNKNOWN,
usage: audio.StreamUsage.STREAM_USAGE_MEDIA,
rendererFlags: 0
}
let AudioRendererOptions = {
......@@ -79,7 +79,7 @@ export default function audioRendererTest() {
for (let index = 0; index < env.GENERAL_RUN_TIMES; index++) {
try {
let data = await audioRen.getMaxStreamVolume();
expect(data).assertEqual(1.0);
expect(data).assertEqual(env.OUTPUT_NUMBER_1);
} catch (error) {
console.log(`${TagFrmwkRender}: ####getMaxStreamVolume: execution ${index + 1} times error: ${JSON.stringify(error)}`);
expect(false).assertTrue();
......@@ -117,7 +117,7 @@ export default function audioRendererTest() {
for (let index = 0; index < env.GENERAL_RUN_TIMES; index++) {
try {
let data = await audioRen.getMinStreamVolume();
expect(data).assertEqual(0.0);
expect(data).assertEqual(env.OUTPUT_NUMBER_0);
} catch (error) {
console.log(`${TagFrmwkRender}: ####getMinStreamVolume: execution ${index + 1} times error: ${JSON.stringify(error)}`);
expect(false).assertTrue();
......@@ -164,7 +164,7 @@ export default function audioRendererTest() {
done();
return;
}else{
expect(data).assertEqual(1.0);
expect(data).assertEqual(env.OUTPUT_NUMBER_1);
recursive(n-1);
}
});
......@@ -223,7 +223,7 @@ export default function audioRendererTest() {
done();
return;
}else{
expect(data).assertEqual(0.0);
expect(data).assertEqual(env.OUTPUT_NUMBER_0);
recursive(n-1);
}
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册