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