提交 4d911162 编写于 作者: W wangzx0705

modifty final acts testcase

Signed-off-by: Nwangzx0705 <wangzx0705@thundersoft.com>
上级 37100992
...@@ -23,3 +23,4 @@ export const OUTPUT_NUMBER_1 = 1; ...@@ -23,3 +23,4 @@ export const OUTPUT_NUMBER_1 = 1;
export const INVALID_INPUT_PARAMETER_401 = 401; export const INVALID_INPUT_PARAMETER_401 = 401;
export const INVALID_INPUT_PARAMETER_6800101 = 6800101; export const INVALID_INPUT_PARAMETER_6800101 = 6800101;
export const UNSUPORTED_OPTION_6800104 = 6800104; export const UNSUPORTED_OPTION_6800104 = 6800104;
export const DEAFULT_MEDIA_DB = 0.08370080590248108;
\ No newline at end of file
...@@ -14,9 +14,6 @@ ...@@ -14,9 +14,6 @@
*/ */
import isVolumeUnadjustable from './IsVolumeUnadjustable.test.ets'; import isVolumeUnadjustable from './IsVolumeUnadjustable.test.ets';
import getSystemVolumeInDb from './GetSystemVolumeInDb.test.ets'; import getSystemVolumeInDb from './GetSystemVolumeInDb.test.ets';
import adjustVolumeByStep from './AdjustVolumeByStep.test.ets';
import adjustSystemVolumeByStep from './AdjustSystemVolumeByStep.test.ets';
import getDefaultVolume from './GetDefaultVolume.test.ets';
import getMax_Minvolume from './GetMax_Minvolume.test.ets'; import getMax_Minvolume from './GetMax_Minvolume.test.ets';
export default function testsuite() { export default function testsuite() {
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
{ {
"type": "ShellKit", "type": "ShellKit",
"run-command": [ "run-command": [
"power-shell wakeup",
"mkdir -p /data/app/el2/100/base/com.example.xts_test_case/haps/entry/files", "mkdir -p /data/app/el2/100/base/com.example.xts_test_case/haps/entry/files",
"chmod 777 -R /data/app/el2/100/base/com.example.xts_test_case/haps/entry" "chmod 777 -R /data/app/el2/100/base/com.example.xts_test_case/haps/entry"
], ],
......
...@@ -654,6 +654,5 @@ export default function audioRendererTest() { ...@@ -654,6 +654,5 @@ export default function audioRendererTest() {
} }
}); });
}); });
}) })
} }
\ No newline at end of file
...@@ -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 = {
...@@ -138,21 +138,17 @@ export default function audioRendererTest() { ...@@ -138,21 +138,17 @@ export default function audioRendererTest() {
try { try {
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 {
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);
} catch (error) {
console.log('${TagFrmwkRender}: assertion get output deviceinfo failure');
}
done(); done();
}).catch((error) => { }).catch((error) => {
console.log("${TagFrmwkRender}: getCurrentOutputDevices : error = " + error); console.log("${TagFrmwkRender}: getCurrentOutputDevices error = " + error);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
}); });
} catch (error) { } catch (error) {
console.log("SUB_MULTIMEDIA_AUDIO_RENDERER_GETCURRENTOUTPUTDEVICES_PROMISE_0100: catch error = " + error); console.info(`get current output deviceinfo unknown errro: [${error.code}, ${error.message}]`);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
...@@ -173,7 +169,19 @@ export default function audioRendererTest() { ...@@ -173,7 +169,19 @@ export default function audioRendererTest() {
console.info(`${TagFrmwkRender}: deviceRole:${data.deviceRole}, deviceType:${data.deviceType}, id:${data.id}, address:${data.address}, sampleRates:${data.sampleRates}, channelCounts:${data.channelCounts}, channelMasks:${data.channelMasks}`); console.info(`${TagFrmwkRender}: deviceRole:${data.deviceRole}, deviceType:${data.deviceType}, id:${data.id}, address:${data.address}, sampleRates:${data.sampleRates}, channelCounts:${data.channelCounts}, channelMasks:${data.channelMasks}`);
expect(data.deviceRole).assertEqual(audio.DeviceRole.OUTPUT_DEVICE); expect(data.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(env.OUTPUT_NUMBER_0);
console.info(`${TagFrmwkRender}: Renderer get current output device SUCCESS, now stop audiorender`);
audioRen.drain().then(() => {
console.info(`${TagFrmwkRender}: Renderer drain : SUCCESS, stop audiorender`);
audioRen.stop().then(() => {
console.info(`${TagFrmwkRender}: Renderer stopp : SUCCESS`);
done();
}).catch((err) => {
console.info(`${TagFrmwkRender}: Renderer stop:ERROR : ${err.message}`);
});
}).catch((err) => {
console.error(`${TagFrmwkRender}: Renderer drain: ERROR : ${err.message}`);
});
}).catch((error) => { }).catch((error) => {
console.log("${TagFrmwkRender}: getCurrentOutputDevices : error = " + error); console.log("${TagFrmwkRender}: getCurrentOutputDevices : error = " + error);
expect(false).assertTrue(); expect(false).assertTrue();
...@@ -183,17 +191,6 @@ export default function audioRendererTest() { ...@@ -183,17 +191,6 @@ export default function audioRendererTest() {
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
await audioRen.drain().then(() => {
console.info(`${TagFrmwkRender}: Renderer drained : SUCCESS`);
}).catch((err) => {
console.error(`${TagFrmwkRender}: Renderer drain: ERROR : ${err.message}`);
});
await audioRen.stop().then(() => {
console.info(`${TagFrmwkRender}: Renderer stopped : SUCCESS`);
}).catch((err) => {
console.info(`${TagFrmwkRender}: Renderer stop:ERROR : ${err.message}`);
});
done();
}); });
/** /**
...@@ -205,27 +202,18 @@ export default function audioRendererTest() { ...@@ -205,27 +202,18 @@ export default function audioRendererTest() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETCURRENTOUTPUTDEVICES_CALLBACK_0100', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETCURRENTOUTPUTDEVICES_CALLBACK_0100', 0, async function (done) {
try { audioRen.getCurrentOutputDevices((err, data) => {
await audioRen.getCurrentOutputDevices((err,data) => {
if (err) { if (err) {
console.info(`${TagFrmwkRender}: ####getCurrentOutputDevices : ERROR : code: ${err.code}, mesage: ${err.message}`); console.info(`${TagFrmwkRender}: getCurrentOutputDevices ERROR ! code: ${err.code}, mesage: ${err.message}`);
expect(false).assertTrue(); expect(false).assertTrue();
} 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 {
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);
} catch (error){ done();
console.log('${TagFrmwkRender}: ######assertion failure');
}
} }
}); });
}catch (error){
console.info(`SUB_MULTIMEDIA_AUDIO_RENDERER_GETCURRENTOUTPUTDEVICES_CALLBACK_0100: catch error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue();
};
done();
}); });
/** /**
...@@ -237,36 +225,31 @@ export default function audioRendererTest() { ...@@ -237,36 +225,31 @@ export default function audioRendererTest() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETCURRENTOUTPUTDEVICES_CALLBACK_0200', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETCURRENTOUTPUTDEVICES_CALLBACK_0200', 0, async function (done) {
try {
await renderPlay(); await renderPlay();
await audioRen.getCurrentOutputDevices((err,data) => { audioRen.getCurrentOutputDevices((err, data) => {
if (err) { if (err) {
console.info(`${TagFrmwkRender}: ####getCurrentOutputDevices : ERROR : code: ${err.code}, mesage: ${err.message}`); console.info(`${TagFrmwkRender}: getCurrentOutputDevices ERROR! error: ${err.code}, mesage: ${err.message}`);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} else { } else {
console.info(`${TagFrmwkRender}: ####getCurrentOutputDevices :deviceRole:${data.deviceRole}, deviceType:${data.deviceType}, id:${data.id}, address:${data.address}, sampleRates:${data.sampleRates}, channelCounts:${data.channelCounts}, channelMasks:${data.channelMasks}`); console.info(`${TagFrmwkRender}: getCurrentOutputDevices :deviceRole:${data.deviceRole}, deviceType:${data.deviceType}, id:${data.id}, address:${data.address}, sampleRates:${data.sampleRates}, channelCounts:${data.channelCounts}, channelMasks:${data.channelMasks}`);
expect(true).assertTrue(); expect(data.deviceRole).assertEqual(audio.DeviceRole.OUTPUT_DEVICE);
} expect(data.deviceType).assertEqual(audio.DeviceType.SPEAKER);
}); expect(data.id).assertLargerOrEqual(env.OUTPUT_NUMBER_0);
}catch (error){ console.info(`${TagFrmwkRender}: Renderer getCurrentOutputDevices SUCCESS! now stop the audiorenderer`);
console.info(`SUB_MULTIMEDIA_AUDIO_RENDERER_GETCURRENTOUTPUTDEVICES_CALLBACK_0200: catch error, error: [${error.code}, ${error.message}]`); audioRen.drain().then(() => {
expect(false).assertTrue(); console.info(`${TagFrmwkRender}: Renderer drain, stop the audiorenderer`);
audioRen.stop().then(() => {
console.info(`${TagFrmwkRender}: Renderer stopp SUCCESS, testcase SUCCESS!`);
done(); done();
};
await audioRen.drain().then(() => {
console.info(`${TagFrmwkRender}: Renderer drained : SUCCESS`);
}).catch((err) => { }).catch((err) => {
console.error(`${TagFrmwkRender}: Renderer drain: ERROR : ${err.message}`); console.info(`${TagFrmwkRender}: Renderer stop:ERROR : ${err.message}`);
}); });
await audioRen.stop().then(() => {
console.info(`${TagFrmwkRender}: Renderer stopped : SUCCESS`);
}).catch((err) => { }).catch((err) => {
console.info(`${TagFrmwkRender}: Renderer stop:ERROR : ${err.message}`); console.error(`${TagFrmwkRender}: Renderer drain: ERROR : ${err.message}`);
});
}
}); });
done();
}); });
}) })
} }
...@@ -175,16 +175,16 @@ export default function audioRendererTest() { ...@@ -175,16 +175,16 @@ export default function audioRendererTest() {
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMAXSTREAMVOLUME_PROMISE_0100', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMAXSTREAMVOLUME_PROMISE_0100', 0, async function (done) {
try{ try{
await audioRen.getMaxStreamVolume().then((data) => { await audioRen.getMaxStreamVolume().then((data) => {
console.info(`${TagFrmwkRender}: #####getMaxStreamVolume :SUCCESS ${data}`); console.info(`${TagFrmwkRender}:getMaxStreamVolume :SUCCESS ${data}`);
expect(data).assertEqual(env.OUTPUT_NUMBER_1); expect(data).assertEqual(env.OUTPUT_NUMBER_1);
done(); done();
}).catch ((error)=>{ }).catch ((error)=>{
console.log("${TagFrmwkRender}: #####getMaxStreamVolume : error = " + error); console.log("${TagFrmwkRender}:getMaxStreamVolume : error = " + error);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
}); });
}catch(error){ }catch(error){
console.log("SUB_MULTIMEDIA_AUDIO_RENDERER_GETMAXSTREAMVOLUME_PROMISE_0100: catch error = " + error); console.log("GETMAXSTREAMVOLUME catch error = " + error);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
...@@ -202,10 +202,10 @@ export default function audioRendererTest() { ...@@ -202,10 +202,10 @@ export default function audioRendererTest() {
try{ try{
await renderPlay(); await renderPlay();
await audioRen.getMaxStreamVolume().then((data) => { await audioRen.getMaxStreamVolume().then((data) => {
console.info(`${TagFrmwkRender}: #####getMaxStreamVolume :SUCCESS ${data}`); console.info(`${TagFrmwkRender}:getMaxStreamVolume :SUCCESS ${data}`);
expect(data).assertEqual(env.OUTPUT_NUMBER_1); expect(data).assertEqual(env.OUTPUT_NUMBER_1);
}).catch ((error)=>{ }).catch ((error)=>{
console.log("${TagFrmwkRender}: #####getMaxStreamVolume : error = " + error); console.log("${TagFrmwkRender}:getMaxStreamVolume : error = " + error);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
}); });
...@@ -221,7 +221,7 @@ export default function audioRendererTest() { ...@@ -221,7 +221,7 @@ export default function audioRendererTest() {
}); });
done(); done();
}catch(error){ }catch(error){
console.log("SUB_MULTIMEDIA_AUDIO_RENDERER_GETMAXSTREAMVOLUME_PROMISE_0200: catch error = " + error); console.log("GETMAXSTREAMVOLUME catch error = " + error);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
...@@ -255,24 +255,25 @@ export default function audioRendererTest() { ...@@ -255,24 +255,25 @@ export default function audioRendererTest() {
streamInfo: AudioStreamInfo, streamInfo: AudioStreamInfo,
rendererInfo: AudioRendererInfo rendererInfo: AudioRendererInfo
} }
try { try {
if (Number(audio.StreamUsage[StreamType]) != 9) {
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);
}); });
} else {
audioRender = audioRen;
}
} catch (error) { } catch (error) {
console.info(`${TagFrmwkRender}: AudioRender Created : catch ERROR : ` + error.code + error.message); console.info(`${TagFrmwkRender}: AudioRender Created : catch ERROR : ` + error.code + error.message);
} }
await audioRender.getMaxStreamVolume().then((data) => { await audioRender.getMaxStreamVolume().then((data) => {
console.info(`${TagFrmwkRender}: ####getMaxStreamVolume:Stream Type: ${StreamType} SUCCESS ${data}`); console.info(`${TagFrmwkRender}:getMaxStreamVolume:Stream Type: ${StreamType} SUCCESS ${data}`);
expect(data).assertEqual(env.OUTPUT_NUMBER_1); expect(data).assertEqual(env.OUTPUT_NUMBER_1);
}).catch ((error)=>{ }).catch ((error)=>{
console.info(`${TagFrmwkRender}: #####getMaxStreamVolume:Stream Type: ${StreamType} ERROR : code: ${error.code}, mesage: ${error.message}`); console.info(`${TagFrmwkRender}:getMaxStreamVolume:Stream Type: ${StreamType} ERROR : code: ${error.code}, mesage: ${error.message}`);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
}); });
...@@ -286,7 +287,7 @@ export default function audioRendererTest() { ...@@ -286,7 +287,7 @@ export default function audioRendererTest() {
} }
done(); done();
}catch (error){ }catch (error){
console.info(`SUB_MULTIMEDIA_AUDIO_RENDERER_GETMAXSTREAMVOLUME_PROMISE_0300:Stream ERROR : code: ${error.code}, mesage: ${error.message}`); console.info(`GETMAXSTREAMVOLUME Stream ERROR : code: ${error.code}, mesage: ${error.message}`);
} }
}); });
...@@ -301,7 +302,7 @@ export default function audioRendererTest() { ...@@ -301,7 +302,7 @@ export default function audioRendererTest() {
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMAXSTREAMVOLUME_PROMISE_0400', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMAXSTREAMVOLUME_PROMISE_0400', 0, async function (done) {
try{ try{
await audioRen.getMaxStreamVolume().then((data) => { await audioRen.getMaxStreamVolume().then((data) => {
console.info(`${TagFrmwkRender}: #####getMaxStreamVolume :SUCCESS ${data}`); console.info(`${TagFrmwkRender}:getMaxStreamVolume :SUCCESS ${data}`);
expect(data).assertEqual(env.OUTPUT_NUMBER_1); expect(data).assertEqual(env.OUTPUT_NUMBER_1);
audioRen.setVolume(data).then(() => { audioRen.setVolume(data).then(() => {
console.info(`${TagFrmwkRender}: setVolume to maxVolume Success! maxVolume: ${data}`); console.info(`${TagFrmwkRender}: setVolume to maxVolume Success! maxVolume: ${data}`);
...@@ -313,12 +314,12 @@ export default function audioRendererTest() { ...@@ -313,12 +314,12 @@ export default function audioRendererTest() {
done(); 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();
}); });
}catch(error){ }catch(error){
console.info(`SUB_MULTIMEDIA_AUDIO_RENDERER_GETMAXSTREAMVOLUME_PROMISE_0400: catch error, error: [${error.code}, ${error.message}]`); console.info(`GETMAXSTREAMVOLUME catch error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
...@@ -335,16 +336,16 @@ export default function audioRendererTest() { ...@@ -335,16 +336,16 @@ export default function audioRendererTest() {
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_PROMISE_0100', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_PROMISE_0100', 0, async function (done) {
try{ try{
await audioRen.getMinStreamVolume().then((data) => { await audioRen.getMinStreamVolume().then((data) => {
console.info(`${TagFrmwkRender}: ####getMinStreamVolume :SUCCESS ${data}`); console.info(`${TagFrmwkRender}:getMinStreamVolume :SUCCESS ${data}`);
expect(data).assertEqual(env.OUTPUT_NUMBER_0); expect(data).assertEqual(env.OUTPUT_NUMBER_0);
done(); 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();
}); });
}catch(error){ }catch(error){
console.info(`SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_PROMISE_0100: catch error, error: [${error.code}, ${error.message}]`); console.info(`GETMINSTREAMVOLUME catch error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
...@@ -362,10 +363,10 @@ export default function audioRendererTest() { ...@@ -362,10 +363,10 @@ export default function audioRendererTest() {
try{ try{
await renderPlay(); await renderPlay();
await audioRen.getMinStreamVolume().then((data) => { await audioRen.getMinStreamVolume().then((data) => {
console.info(`${TagFrmwkRender}: #####getMinStreamVolume :SUCCESS ${data}`); console.info(`${TagFrmwkRender}:getMinStreamVolume :SUCCESS ${data}`);
expect(data).assertEqual(env.OUTPUT_NUMBER_0); expect(data).assertEqual(env.OUTPUT_NUMBER_0);
}).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();
}); });
...@@ -381,7 +382,7 @@ export default function audioRendererTest() { ...@@ -381,7 +382,7 @@ export default function audioRendererTest() {
}); });
done(); done();
}catch(error){ }catch(error){
console.info(`SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_PROMISE_0200: catch error, error: [${error.code}, ${error.message}]`); console.info(`GETMINSTREAMVOLUME catch error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
...@@ -415,23 +416,25 @@ export default function audioRendererTest() { ...@@ -415,23 +416,25 @@ export default function audioRendererTest() {
streamInfo: AudioStreamInfo, streamInfo: AudioStreamInfo,
rendererInfo: AudioRendererInfo rendererInfo: AudioRendererInfo
} }
try { try {
if (Number(audio.StreamUsage[StreamType]) != 9) {
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));
}).catch((err) => { }).catch((err) => {
console.info(`${TagFrmwkRender}: AudioRender Created : ERROR : ` + err.message); console.info(`${TagFrmwkRender}: AudioRender Created : ERROR : ` + err.message);
}); });
} else {
audioRender = audioRen;
}
} catch (error) { } catch (error) {
console.info(`${TagFrmwkRender}: AudioRender Created : catch ERROR : ` + error.code + error.message); console.info(`${TagFrmwkRender}: AudioRender Created : catch ERROR : ` + error.code + error.message);
} }
await audioRender.getMinStreamVolume().then((data) => { await audioRender.getMinStreamVolume().then((data) => {
console.info(`${TagFrmwkRender}: ####getMinStreamVolume:Stream Type: ${StreamType} SUCCESS ${data}`); console.info(`${TagFrmwkRender}:getMinStreamVolume:Stream Type: ${StreamType} SUCCESS ${data}`);
expect(data).assertEqual(env.OUTPUT_NUMBER_0); expect(data).assertEqual(env.OUTPUT_NUMBER_0);
}).catch ((error)=>{ }).catch ((error)=>{
console.info(`${TagFrmwkRender}: #####getMinStreamVolume:Stream Type: ${StreamType} ERROR : code: ${error.code}, mesage: ${error.message}`); console.info(`${TagFrmwkRender}:getMinStreamVolume:Stream Type: ${StreamType} ERROR : code: ${error.code}, mesage: ${error.message}`);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
}); });
...@@ -445,7 +448,7 @@ export default function audioRendererTest() { ...@@ -445,7 +448,7 @@ export default function audioRendererTest() {
} }
done(); done();
}catch (error){ }catch (error){
console.info(`SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_PROMISE_0300:Stream ERROR : code: ${error.code}, mesage: ${error.message}`); console.info(`GETMINSTREAMVOLUME Stream ERROR : code: ${error.code}, mesage: ${error.message}`);
} }
}); });
...@@ -460,7 +463,7 @@ export default function audioRendererTest() { ...@@ -460,7 +463,7 @@ export default function audioRendererTest() {
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_PROMISE_0400', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_PROMISE_0400', 0, async function (done) {
try{ try{
await audioRen.getMinStreamVolume().then((data) => { await audioRen.getMinStreamVolume().then((data) => {
console.info(`${TagFrmwkRender}: #####getMinStreamVolume :SUCCESS ${data}`); console.info(`${TagFrmwkRender}: getMinStreamVolume :SUCCESS ${data}`);
expect(data).assertEqual(env.OUTPUT_NUMBER_0); expect(data).assertEqual(env.OUTPUT_NUMBER_0);
audioRen.setVolume(data).then(() => { audioRen.setVolume(data).then(() => {
console.info(`${TagFrmwkRender}: setVolume to minVolume Success! minVolume: ${data}`); console.info(`${TagFrmwkRender}: setVolume to minVolume Success! minVolume: ${data}`);
...@@ -472,12 +475,12 @@ export default function audioRendererTest() { ...@@ -472,12 +475,12 @@ export default function audioRendererTest() {
done(); 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();
}); });
}catch(error){ }catch(error){
console.info(`SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_PROMISE_0400: catch error, error: [${error.code}, ${error.message}]`); console.info(`GETMINSTREAMVOLUME catch error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
...@@ -556,19 +559,20 @@ export default function audioRendererTest() { ...@@ -556,19 +559,20 @@ export default function audioRendererTest() {
streamInfo: AudioStreamInfo, streamInfo: AudioStreamInfo,
rendererInfo: AudioRendererInfo rendererInfo: AudioRendererInfo
} }
try { try {
if (Number(audio.StreamUsage[StreamType]) != 9) {
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);
}); });
} else {
audioRender = audioRen;
}
} catch (error) { } catch (error) {
console.info(`${TagFrmwkRender}: AudioRender Created : catch ERROR : ` + error.code + error.message); console.info(`${TagFrmwkRender}: AudioRender Created : catch ERROR : ` + error.code + error.message);
} }
audioRen.getMaxStreamVolume((err, maxVolume) => { audioRen.getMaxStreamVolume((err, maxVolume) => {
if (err) { if (err) {
console.error('${TagFrmwkRender} Get max stream volume Fail: ${err}'); console.error('${TagFrmwkRender} Get max stream volume Fail: ${err}');
...@@ -591,7 +595,7 @@ export default function audioRendererTest() { ...@@ -591,7 +595,7 @@ export default function audioRendererTest() {
done(); done();
}catch(error){ }catch(error){
console.log(`${TagFrmwkRender}: ####getMaxStreamVolume: catch error, error: [${error.code}, ${error.message}]`); console.log(`${TagFrmwkRender}:getMaxStreamVolume: catch error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
...@@ -703,18 +707,20 @@ export default function audioRendererTest() { ...@@ -703,18 +707,20 @@ export default function audioRendererTest() {
streamInfo: AudioStreamInfo, streamInfo: AudioStreamInfo,
rendererInfo: AudioRendererInfo rendererInfo: AudioRendererInfo
} }
try { try {
if (Number(audio.StreamUsage[StreamType]) != 9) {
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));
}).catch((err) => { }).catch((err) => {
console.info(`${TagFrmwkRender}: AudioRender Created : ERROR : ` + err.message); console.info(`${TagFrmwkRender}: AudioRender Created : ERROR : ` + err.message);
}); });
} else {
audioRender = audioRen;
}
} catch (error) { } catch (error) {
console.info(`${TagFrmwkRender}: AudioRender Created : catch ERROR : ` + error.code + error.message); console.info(`${TagFrmwkRender}: AudioRender Created : catch ERROR : ` + error.code + error.message);
} }
audioRen.getMinStreamVolume((err, minVolume) => { audioRen.getMinStreamVolume((err, minVolume) => {
if (err) { if (err) {
console.error('${TagFrmwkRender} Get min stream volume Fail: ${err}'); console.error('${TagFrmwkRender} Get min stream volume Fail: ${err}');
...@@ -735,7 +741,7 @@ export default function audioRendererTest() { ...@@ -735,7 +741,7 @@ export default function audioRendererTest() {
} }
done(); done();
}catch(error){ }catch(error){
console.log(`${TagFrmwkRender}: ####getMinStreamVolume: catch error, error: [${error.code}, ${error.message}]`); console.log(`${TagFrmwkRender}:getMinStreamVolume: catch error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
......
...@@ -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_MUSIC, content: audio.ContentType.CONTENT_TYPE_UNKNOWN,
usage: audio.StreamUsage.STREAM_USAGE_MEDIA, usage: audio.StreamUsage.STREAM_USAGE_MEDIA,
rendererFlags: 0 rendererFlags: 0
} }
...@@ -144,16 +144,16 @@ export default function audioRendererTest() { ...@@ -144,16 +144,16 @@ export default function audioRendererTest() {
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETUNDERFLOWCOUNT_PROMISE_0100', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETUNDERFLOWCOUNT_PROMISE_0100', 0, async function (done) {
try{ try{
await audioRen.getUnderflowCount().then((data) => { await audioRen.getUnderflowCount().then((data) => {
console.info(`${TagFrmwkRender}: ####getUnderflowCount :SUCCESS ${data}`); console.info(`${TagFrmwkRender}:getUnderflowCount :SUCCESS ${data}`);
expect(data).assertLargerOrEqual(env.OUTPUT_NUMBER_0); expect(data).assertLargerOrEqual(env.OUTPUT_NUMBER_0);
done(); done();
}).catch ((error)=>{ }).catch ((error)=>{
console.log("${TagFrmwkRender}: ####getUnderflowCount : error = " + error); console.log("${TagFrmwkRender}:getUnderflowCount : error = " + error);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
}); });
}catch(error){ }catch(error){
console.log("SUB_MULTIMEDIA_AUDIO_RENDERER_GETUNDERFLOWCOUNT_PROMISE_0100: catch error = " + error); console.log("GETUNDERFLOWCOUNT catch unknown error = " + error);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
...@@ -169,29 +169,26 @@ export default function audioRendererTest() { ...@@ -169,29 +169,26 @@ export default function audioRendererTest() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETUNDERFLOWCOUNT_PROMISE_0200', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETUNDERFLOWCOUNT_PROMISE_0200', 0, async function (done) {
try{ try {
await renderPlay(); await renderPlay();
await audioRen.getUnderflowCount().then((data) => { await audioRen.getUnderflowCount().then((data) => {
console.info(`${TagFrmwkRender}: ####getUnderflowCount :SUCCESS ${data}`);
expect(data).assertLargerOrEqual(env.OUTPUT_NUMBER_0); expect(data).assertLargerOrEqual(env.OUTPUT_NUMBER_0);
}).catch ((error)=>{ audioRen.drain().then(() => {
console.log("${TagFrmwkRender}: ####getUnderflowCount : error = " + error); audioRen.stop().then(() => {
expect(false).assertTrue();
done(); done();
});
await audioRen.drain().then(() => {
console.info(`${TagFrmwkRender}: Renderer drained : SUCCESS`);
}).catch((err) => { }).catch((err) => {
console.error(`${TagFrmwkRender}: Renderer drain: ERROR : ${err.message}`); console.info(`${TagFrmwkRender}: Renderer stop:ERROR : ${err.message}`);
}); });
await audioRen.stop().then(() => {
console.info(`${TagFrmwkRender}: Renderer stopped : SUCCESS`);
}).catch((err) => { }).catch((err) => {
console.info(`${TagFrmwkRender}: Renderer stop:ERROR : ${err.message}`); console.error(`${TagFrmwkRender}: Renderer drain: ERROR : ${err.message}`);
}); });
}).catch((error) => {
console.log("${TagFrmwkRender}: getUnderflowCount : error = " + error);
expect(false).assertTrue();
done(); done();
}catch(error){ });
console.log("SUB_MULTIMEDIA_AUDIO_RENDERER_GETUNDERFLOWCOUNT_PROMISE_0200: catch error = " + error); } catch (error) {
console.log("GETUNDERFLOWCOUNT catch unknown error = " + error);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
...@@ -207,7 +204,7 @@ export default function audioRendererTest() { ...@@ -207,7 +204,7 @@ export default function audioRendererTest() {
*/ */
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETUNDERFLOWCOUNT_PROMISE_0300', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETUNDERFLOWCOUNT_PROMISE_0300', 0, async function (done) {
let StreamType; let StreamType;
try{ try {
for (StreamType in audio.StreamUsage) { for (StreamType in audio.StreamUsage) {
let audioRender; let audioRender;
let AudioStreamInfo = { let AudioStreamInfo = {
...@@ -217,46 +214,47 @@ export default function audioRendererTest() { ...@@ -217,46 +214,47 @@ 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: Number(audio.StreamUsage[StreamType]),
rendererFlags: 0 rendererFlags: 0
} }
let AudioRendererOptions = { let AudioRendererOptions = {
streamInfo: AudioStreamInfo, streamInfo: AudioStreamInfo,
rendererInfo: AudioRendererInfo rendererInfo: AudioRendererInfo
} }
try { try {
if (Number(audio.StreamUsage[StreamType]) != 9) {
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}: ${Number(audio.StreamUsage[StreamType])}`);
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.code + err.message);
}); });
} else {
audioRender = audioRen;
}
} catch (error) { } catch (error) {
console.info(`${TagFrmwkRender}: AudioRender Created : catch ERROR : ` + error.code + error.message); console.info(`${TagFrmwkRender}: AudioRender Created : catch ERROR : ` + error.code + error.message);
} }
await audioRender.getUnderflowCount().then((data) => { await audioRender.getUnderflowCount().then((data) => {
console.info(`${TagFrmwkRender}: ####getUnderflowCount:Stream Type: ${StreamType} SUCCESS ${data}`); console.info(`${TagFrmwkRender}: getUnderflowCount SUCCESS! ${StreamType} data ${data}:, now release audiorender`);
expect(data).assertLargerOrEqual(env.OUTPUT_NUMBER_0); expect(data).assertLargerOrEqual(0);
}).catch ((error)=>{ }).catch((error) => {
console.info(`${TagFrmwkRender}: #####getUnderflowCount:Stream Type: ${StreamType} ERROR : code: ${error.code}, mesage: ${error.message}`); console.info(`${TagFrmwkRender}: getUnderflowCount: ERROR : code: ${error.code}, mesage: ${error.message}`);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
}); });
sleep(1000); sleep(1000);
await audioRender.release().then(() => { await audioRender.release().then(() => {
console.info(`${TagFrmwkRender}: Renderer release : SUCCESS`); console.info(`${TagFrmwkRender}: Renderer ${StreamType} release SUCCESS! `);
}).catch((err) => { }).catch((err) => {
console.info(`${TagFrmwkRender}: Renderer release :ERROR : ${err.message}`); console.info(`${TagFrmwkRender}: Renderer release ERROR: ${err.message}`);
}); });
} }
done(); done();
}catch (error){ } catch (error) {
console.info(`SUB_MULTIMEDIA_AUDIO_RENDERER_GETUNDERFLOWCOUNT_PROMISE_0300:Stream ERROR : code: ${error.code}, mesage: ${error.message}`); expect(false).assertTrue();
done();
} }
}); });
...@@ -269,23 +267,17 @@ export default function audioRendererTest() { ...@@ -269,23 +267,17 @@ export default function audioRendererTest() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETUNDERFLOWCOUNT_CALLBACK_0100', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETUNDERFLOWCOUNT_CALLBACK_0100', 0, async function (done) {
try { audioRen.getUnderflowCount((err, data) => {
audioRen.getUnderflowCount((err,data) => {
if (err) { if (err) {
console.info(`${TagFrmwkRender}: ####getUnderflowCount : ERROR : code: ${err.code}, mesage: ${err.message}`); console.info(`${TagFrmwkRender}: getUnderflowCount ERROR! code: ${err.code}, mesage: ${err.message}`);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} else { } else {
console.info(`${TagFrmwkRender}: ####getUnderflowCount : Success ${data}`); console.info(`${TagFrmwkRender}: getUnderflowCount : Success! ${data}`);
expect(data).assertLargerOrEqual(env.OUTPUT_NUMBER_0); expect(data).assertLargerOrEqual(env.OUTPUT_NUMBER_0);
done(); done();
} }
}); });
}catch (error){
console.info(`SUB_MULTIMEDIA_AUDIO_RENDERER_GETUNDERFLOWCOUNT_CALLBACK_0100: catch error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue();
done();
};
}); });
/** /**
...@@ -297,35 +289,31 @@ export default function audioRendererTest() { ...@@ -297,35 +289,31 @@ export default function audioRendererTest() {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETUNDERFLOWCOUNT_CALLBACK_0200', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETUNDERFLOWCOUNT_CALLBACK_0200', 0, async function (done) {
let CallBack:any = (error,data) => { try {
await renderPlay();
audioRen.getUnderflowCount((error, data) => {
if (error) { if (error) {
console.log(`${TagFrmwkRender}: ####CallBack: execution fail,error: [${error.code}, ${error.message}]`); console.log(`${TagFrmwkRender}: getUnderflowCount 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)}`);
expect(data).assertLargerOrEqual(env.OUTPUT_NUMBER_0); expect(data).assertLargerOrEqual(env.OUTPUT_NUMBER_0);
} audioRen.drain().then(() => {
}; audioRen.stop().then(() => {
try{
await renderPlay();
audioRen.getUnderflowCount(CallBack);
}catch(error){
console.log(`${TagFrmwkRender}: ####getUnderflowCount: catch error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue();
done(); done();
};
await audioRen.drain().then(() => {
console.info(`${TagFrmwkRender}: Renderer drained : SUCCESS`);
}).catch((err) => { }).catch((err) => {
console.error(`${TagFrmwkRender}: Renderer drain: ERROR : ${err.message}`); console.info(`${TagFrmwkRender}: Renderer stop:ERROR : ${err.message}`);
}); });
await audioRen.stop().then(() => {
console.info(`${TagFrmwkRender}: Renderer stopped : SUCCESS`);
}).catch((err) => { }).catch((err) => {
console.info(`${TagFrmwkRender}: Renderer stop:ERROR : ${err.message}`); console.error(`${TagFrmwkRender}: Renderer drain: ERROR : ${err.message}`);
});
}
}); });
} catch (error) {
console.log(`${TagFrmwkRender}: getUnderflowCount unknown error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue();
done(); done();
}
}); });
/** /**
...@@ -338,18 +326,7 @@ export default function audioRendererTest() { ...@@ -338,18 +326,7 @@ export default function audioRendererTest() {
*/ */
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETUNDERFLOWCOUNT_CALLBACK_0300', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETUNDERFLOWCOUNT_CALLBACK_0300', 0, async function (done) {
let StreamType; let StreamType;
let CallBack:any = (error,data) => { try {
if (error) {
console.log(`${TagFrmwkRender}: ####CallBack: execution fail,error: [${error.code}, ${error.message}]`);
expect(false).assertTrue();
done();
}else{
console.log(`${TagFrmwkRender}: ####CallBack:StreamType:${StreamType} execution success, data: ${JSON.stringify(data)}`);
expect(data).assertLargerOrEqual(env.OUTPUT_NUMBER_0);
}
};
try{
for (StreamType in audio.StreamUsage) { for (StreamType in audio.StreamUsage) {
let audioRender; let audioRender;
let AudioStreamInfo = { let AudioStreamInfo = {
...@@ -367,36 +344,41 @@ export default function audioRendererTest() { ...@@ -367,36 +344,41 @@ export default function audioRendererTest() {
streamInfo: AudioStreamInfo, streamInfo: AudioStreamInfo,
rendererInfo: AudioRendererInfo rendererInfo: AudioRendererInfo
} }
try { try {
if (Number(audio.StreamUsage[StreamType]) != 9) {
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);
}); });
} else {
audioRender = audioRen;
}
} catch (error) { } catch (error) {
console.info(`${TagFrmwkRender}: AudioRender Created : catch ERROR : ` + error.code + error.message); console.info(`${TagFrmwkRender}: AudioRender Created : catch ERROR : ` + error.code + error.message);
} }
audioRen.getUnderflowCount((error, data) => {
audioRen.getUnderflowCount(CallBack); if (error) {
expect(false).assertTrue();
done();
} else {
console.log(`${TagFrmwkRender}:getUnderflowCount StreamType:${StreamType} execution success, data: ${JSON.stringify(data)}`);
expect(data).assertLargerOrEqual(env.OUTPUT_NUMBER_0);
}
});
sleep(1000); sleep(1000);
await audioRender.release().then(() => { await audioRender.release().then(() => {
console.info(`${TagFrmwkRender}: Renderer release : SUCCESS`); console.info(`${TagFrmwkRender}: Renderer ${StreamType} release : SUCCESS`);
}).catch((err) => { }).catch((err) => {
console.info(`${TagFrmwkRender}: Renderer release :ERROR : ${err.message}`); console.info(`${TagFrmwkRender}: Renderer release :ERROR : ${err.message}`);
}); });
} }
done(); done();
}catch(error){ } catch (error) {
console.log(`${TagFrmwkRender}: ####getUnderflowCount: catch error, error: [${error.code}, ${error.message}]`);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
}); });
}) })
} }
...@@ -34,8 +34,8 @@ export default function audioRendererTest() { ...@@ -34,8 +34,8 @@ export default function audioRendererTest() {
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
} }
let AudioRendererInfo = { let AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH, content: audio.ContentType.CONTENT_TYPE_UNKNOWN,
usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, usage: audio.StreamUsage.STREAM_USAGE_MEDIA,
rendererFlags: 0 rendererFlags: 0
} }
let AudioRendererOptions = { let AudioRendererOptions = {
...@@ -76,26 +76,24 @@ export default function audioRendererTest() { ...@@ -76,26 +76,24 @@ export default function audioRendererTest() {
* @tc.desc : AudioRenderer - on "struct" - promise * @tc.desc : AudioRenderer - on "struct" - promise
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 2
*/ */
it('SUB_MULTIMEDIA_AUDIO_RENDERER_ON_CALLBACK_0100', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_ON_CALLBACK_0100', 0, async function (done) {
let CallBack:any = (error,data) => { try {
audioRen.on(-1, (error, data) => {
if (error) { if (error) {
console.log(`${TagFrmwkRender}: ####CallBack: execution fail,error: [${error.code}, ${error.message}]`); console.log(`${TagFrmwkRender}: On error, 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)}`); expect(false).assertTrue();
expect(true).assertTrue();
done(); done();
} }
}; });
try{ } catch (error) {
audioRen.on(-1, CallBack); if (error) {
}catch(error){ console.log(`${TagFrmwkRender}: On catch error, error: [${error.code}, ${error.message}]`);
if (error.code == env.INVALID_INPUT_PARAMETER_401) { expect(Number(error.code)).assertEqual(INVALID_INPUT_PARAMETER_401);
console.log(`${TagFrmwkRender}: ####on: catch error, error: [${error.code}, ${error.message}]`);
expect(true).assertTrue();
done(); done();
} else { } else {
expect(false).assertTrue(); expect(false).assertTrue();
...@@ -110,26 +108,24 @@ export default function audioRendererTest() { ...@@ -110,26 +108,24 @@ export default function audioRendererTest() {
* @tc.desc : AudioRenderer - on "struct" - promise * @tc.desc : AudioRenderer - on "struct" - promise
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 2
*/ */
it('SUB_MULTIMEDIA_AUDIO_RENDERER_ON_CALLBACK_0200', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_ON_CALLBACK_0200', 0, async function (done) {
let CallBack:any = (error,data) => { try {
audioRen.on('123', (error, data) => {
if (error) { if (error) {
console.log(`${TagFrmwkRender}: ####CallBack: execution fail,error: [${error.code}, ${error.message}]`); console.log(`${TagFrmwkRender}: On error, 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)}`); expect(false).assertTrue();
expect(true).assertTrue();
done(); done();
} }
}; });
try{ } catch (error) {
audioRen.on('123', CallBack); if (error) {
}catch(error){ console.log(`${TagFrmwkRender}: On catch error, error: [${error.code}, ${error.message}]`);
if (error.code == env.INVALID_INPUT_PARAMETER_6800101) { expect(Number(error.code)).assertEqual(INVALID_INPUT_PARAMETER_6800101);
console.log(`${TagFrmwkRender}: ####on: catch error, error: [${error.code}, ${error.message}]`);
expect(true).assertTrue();
done(); done();
} else { } else {
expect(false).assertTrue(); expect(false).assertTrue();
...@@ -144,26 +140,25 @@ export default function audioRendererTest() { ...@@ -144,26 +140,25 @@ export default function audioRendererTest() {
* @tc.desc : AudioRenderer - on "struct" - promise * @tc.desc : AudioRenderer - on "struct" - promise
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 2
*/ */
it('SUB_MULTIMEDIA_AUDIO_RENDERER_ON_CALLBACK_0300', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_ON_CALLBACK_0300', 0, async function (done) {
let CallBack:any = (error,data) => { try {
audioRen.on((error, data) => {
if (error) { if (error) {
console.log(`${TagFrmwkRender}: ####CallBack: execution fail,error: [${error.code}, ${error.message}]`); console.log(`${TagFrmwkRender}: On 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.log(`${TagFrmwkRender}: On execution success, testcase FAIL!`);
expect(true).assertTrue(); expect(false).assertTrue();
done(); done();
} }
}; });
try{ } catch (error) {
audioRen.on(CallBack); if (error) {
}catch(error){ console.log(`${TagFrmwkRender}: On: catch error, error: [${error.code}, ${error.message}]`);
if (error.code == 401) { expect(Number(error.code)).assertEqual(INVALID_INPUT_PARAMETER_401);
console.log(`${TagFrmwkRender}: ####on: catch error, error: [${error.code}, ${error.message}]`);
expect(true).assertTrue();
done(); done();
} else { } else {
expect(false).assertTrue(); expect(false).assertTrue();
...@@ -178,33 +173,31 @@ export default function audioRendererTest() { ...@@ -178,33 +173,31 @@ export default function audioRendererTest() {
* @tc.desc : AudioRenderer - on "struct" - promise * @tc.desc : AudioRenderer - on "struct" - promise
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 2
*/ */
it('SUB_MULTIMEDIA_AUDIO_RENDERER_OFF_CALLBACK_0100', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_OFF_CALLBACK_0100', 0, async function (done) {
let CallBack:any = (error,data) => { try {
audioRen.off(-1, (error, data) => {
if (error) { if (error) {
console.log(`${TagFrmwkRender}: ####CallBack: execution fail,error: [${error.code}, ${error.message}]`); console.log(`${TagFrmwkRender}:Off 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.log(`${TagFrmwkRender}:Off execution success, testcase FAIL! `);
expect(true).assertTrue(); expect(false).assertTrue();
done(); done();
} }
}; });
try{ } catch (error) {
audioRen.off(-1, CallBack); if (error) {
}catch(error){ console.log(`${TagFrmwkRender}:On catch error, error: [${error.code}, ${error.message}]`);
if (error.code == env.INVALID_INPUT_PARAMETER_6800101) { expect(Number(error.code)).assertEqual(INVALID_INPUT_PARAMETER_6800101);
console.log(`${TagFrmwkRender}: ####on: catch error, error: [${error.code}, ${error.message}]`);
expect(true).assertTrue();
done(); done();
} else { } else {
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
} }
}); });
/** /**
...@@ -213,26 +206,25 @@ export default function audioRendererTest() { ...@@ -213,26 +206,25 @@ export default function audioRendererTest() {
* @tc.desc : AudioRenderer - on "struct" - promise * @tc.desc : AudioRenderer - on "struct" - promise
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 2
*/ */
it('SUB_MULTIMEDIA_AUDIO_RENDERER_OFF_CALLBACK_0200', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_OFF_CALLBACK_0200', 0, async function (done) {
let CallBack:any = (error,data) => { try {
audioRen.off('123', (error, data) => {
if (error) { if (error) {
console.log(`${TagFrmwkRender}: ####CallBack: execution fail,error: [${error.code}, ${error.message}]`); console.log(`${TagFrmwkRender}: Off 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.log(`${TagFrmwkRender}: Off execution success, testcase FAIL! `);
expect(true).assertTrue(); expect(true).assertTrue();
done(); done();
} }
}; });
try{ } catch (error) {
audioRen.off('123', CallBack); if (error) {
}catch(error){ console.log(`${TagFrmwkRender}: Off catch error, error: [${error.code}, ${error.message}]`);
if (error.code == env.UNSUPORTED_OPTION_6800104) { expect(Number(error.code)).assertEqual(UNSUPORTED_OPTION_6800104);
console.log(`${TagFrmwkRender}: ####on: catch error, error: [${error.code}, ${error.message}]`);
expect(true).assertTrue();
done(); done();
} else { } else {
expect(false).assertTrue(); expect(false).assertTrue();
...@@ -247,26 +239,25 @@ export default function audioRendererTest() { ...@@ -247,26 +239,25 @@ export default function audioRendererTest() {
* @tc.desc : AudioRenderer - off "struct" - promise * @tc.desc : AudioRenderer - off "struct" - promise
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 2
*/ */
it('SUB_MULTIMEDIA_AUDIO_RENDERER_OFF_CALLBACK_0300', 0, async function (done) { it('SUB_MULTIMEDIA_AUDIO_RENDERER_OFF_CALLBACK_0300', 0, async function (done) {
let CallBack:any = (error,data) => { try {
audioRen.off((error, data) => {
if (error) { if (error) {
console.log(`${TagFrmwkRender}: ####CallBack: execution fail,error: [${error.code}, ${error.message}]`); console.log(`${TagFrmwkRender}: Off 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.log(`${TagFrmwkRender}: Off execution success, testcase FAIL! `);
expect(true).assertTrue(); expect(false).assertTrue();
done(); done();
} }
}; });
try{ } catch (error) {
audioRen.off(CallBack); if (error) {
}catch(error){ console.log(`${TagFrmwkRender}: Off catch error, error: [${error.code}, ${error.message}]`);
if (error.code == env.INVALID_INPUT_PARAMETER_6800101) { expect(Number(error.code)).assertEqual(INVALID_INPUT_PARAMETER_6800101);
console.log(`${TagFrmwkRender}: ####on: catch error, error: [${error.code}, ${error.message}]`);
expect(true).assertTrue();
done(); done();
} else { } else {
expect(false).assertTrue(); expect(false).assertTrue();
...@@ -274,6 +265,5 @@ export default function audioRendererTest() { ...@@ -274,6 +265,5 @@ export default function audioRendererTest() {
} }
} }
}); });
}) })
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册