未验证 提交 e2e5373e 编写于 作者: O openharmony_ci 提交者: Gitee

!9777 测试代码失败项修复,以及部分测试逻辑优化

Merge pull request !9777 from zvanxu/master
......@@ -23,4 +23,7 @@ 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
export const DEAFULT_MEDIA_DB = 0.08370080590248108;
//---------------AudioVolumeType: not steamapi------------------
export const AudioVolumeType = [0, 2, 3, 4, 5, 9];
\ No newline at end of file
......@@ -85,13 +85,11 @@ export default function audioManagerTest() {
try {
let maxvol;
var maxvol1 = new ArrayList<Number>();
var maxvol2 = [15, 15, 15, 15, 15, 15, 15];
for(let index in audio.AudioVolumeType){
maxvol = await audioVolumeGroupManager.getMaxVolume(audio.AudioVolumeType[index]);
console.info(`${index} max volume : ${maxvol}`);
if(index != 'ALL'){
maxvol1.add(maxvol);
}
var maxvol2 = [15, 15, 15, 15, 15, 15];
for (let index = 0; index < env.AudioVolumeType.length; index++) {
maxvol = await audioVolumeGroupManager.getMaxVolume(env.AudioVolumeType[index]);
console.info(`${env.AudioVolumeType[index]} max volume : ${maxvol}`);
maxvol1.add(maxvol);
}
for(let i =0; i < maxvol1.length; i++){
console.info(`check maxvolume: maxvol1 : ${maxvol1[i]}, maxvol2 : ${maxvol2[i]}`);
......@@ -117,13 +115,11 @@ export default function audioManagerTest() {
try {
let minvol;
var minvol1 = new ArrayList<Number>();
var minvol2 = [1, 1, 0, 0, 0, 1, 1];
for(let index in audio.AudioVolumeType){
minvol = await audioVolumeGroupManager.getMinVolume(audio.AudioVolumeType[index]);
console.info(`${index} min volume : ${minvol}`);
if(index != 'ALL'){
minvol1.add(minvol);
}
var minvol2 = [1, 0, 0, 1, 1, 1];
for (let index = 0; index < env.AudioVolumeType.length; index++) {
minvol = await audioVolumeGroupManager.getMinVolume(env.AudioVolumeType[index]);
console.info(`${env.AudioVolumeType[index]} min volume : ${minvol}`);
minvol1.add(minvol);
}
for(let i =0; i < minvol1.length; i++){
console.info(`check minvolume minvol1 : ${minvol1[i]}, minvol2 : ${minvol2[i]}`);
......
......@@ -116,15 +116,15 @@ export default function audioManagerTest() {
it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_GETSYSTEMVOLUMEINDB_PROMISE_0200', 0, async function (done) {
try {
var db1 = new ArrayList<Number>();
var db2 = [0.06932847946882248, 0.06932847946882248, 0.08370080590248108, 0.08370080590248108, 0.08370080590248108, 0.06932847946882248, 0.06932847946882248, 0.08370080590248108];
for (let index in audio.AudioVolumeType) {
await audioVolumeGroupManager.getSystemVolumeInDb(audio.AudioVolumeType[index], 3, audio.DeviceType.SPEAKER)
var db2 = [0.06932847946882248, 0.08370080590248108, 0.08370080590248108, 0.06932847946882248, 0.06932847946882248, 0.06932847946882248];
for (let index = 0; index < env.AudioVolumeType.length; index++) {
await audioVolumeGroupManager.getSystemVolumeInDb(env.AudioVolumeType[index], 3, audio.DeviceType.SPEAKER)
.then((data) => {
console.info(`${index} getSystemVolumeInDb :SUCCESS ${data}`);
console.info(`${env.AudioVolumeType[index]} getSystemVolumeInDb :SUCCESS ${data}`);
db1.add(data);
})
.catch((error) => {
console.log(`${TagFrmwk}: ${index} getSystemVolumeInDb : error ${error}`);
console.log(`${TagFrmwk}: ${env.AudioVolumeType[index]} getSystemVolumeInDb : error ${error}`);
expect(false).assertTrue();
done();
});
......@@ -520,11 +520,11 @@ export default function audioManagerTest() {
var db2 = new ArrayList<Number>();
var device = [audio.DeviceType.SPEAKER, audio.DeviceType.EARPIECE, audio.DeviceType.WIRED_HEADSET];
for (var deviceIndex = 0; deviceIndex < device.length; deviceIndex++) {
for (let typeIndex in audio.AudioVolumeType) {
let maxVol = await audioVolumeGroupManager.getMaxVolume(audio.AudioVolumeType[typeIndex]);
let minVol = await audioVolumeGroupManager.getMinVolume(audio.AudioVolumeType[typeIndex]);
for (let typeIndex = 0; typeIndex < env.AudioVolumeType.length; typeIndex++) {
let maxVol = await audioVolumeGroupManager.getMaxVolume(env.AudioVolumeType[typeIndex]);
let minVol = await audioVolumeGroupManager.getMinVolume(env.AudioVolumeType[typeIndex]);
for (let volIndex = minVol; volIndex <= maxVol; volIndex++) {
await audioVolumeGroupManager.getSystemVolumeInDb(audio.AudioVolumeType[typeIndex], volIndex, device[deviceIndex], (err, data) => {
await audioVolumeGroupManager.getSystemVolumeInDb(env.AudioVolumeType[typeIndex], volIndex, device[deviceIndex], (err, data) => {
if (err) {
console.info(`getSystemVolumeInDb : error ${err.message} ${err.code}`);
expect(false).assertTrue();
......@@ -533,7 +533,7 @@ export default function audioManagerTest() {
db1.add(data);
}
});
await audioVolumeGroupManager.getSystemVolumeInDb(audio.AudioVolumeType[typeIndex], volIndex, device[deviceIndex], (err, data) => {
await audioVolumeGroupManager.getSystemVolumeInDb(env.AudioVolumeType[typeIndex], volIndex, device[deviceIndex], (err, data) => {
if (err) {
console.info(`getSystemVolumeInDb : error ${err.message} ${err.code}`);
expect(false).assertTrue();
......
......@@ -106,7 +106,7 @@ export default function audioManagerTest() {
it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_ISVOLUMEUNADJUSTABLE_0200', 0, async function (done) {
try {
let bol = await audioVolumeGroupManager.isVolumeUnadjustable();
let vol = await audioVolumeGroupManager.getVolume(audio.AudioVolumeType.MEDIA);
let vol = await audioVolumeGroupManager.getMinVolume(audio.AudioVolumeType.MEDIA);
await audioVolumeGroupManager.setVolume(audio.AudioVolumeType.MEDIA, vol + 1);
let vol1 = await audioVolumeGroupManager.getVolume(audio.AudioVolumeType.MEDIA);
expect(bol).assertEqual(false);
......
......@@ -16,8 +16,12 @@
//public invalid
export const OUTPUT_NUMBER_0 = 0;
export const OUTPUT_NUMBER_1 = 1;
export const OUTPUT_NUMBER_2 = 2;
//--------------------------------------------------------------
export const INVALID_INPUT_PARAMETER_401 = 401;
export const INVALID_INPUT_PARAMETER_6800101 = 6800101;
export const UNSUPORTED_OPTION_6800104 = 6800104;
//----------------StreamUsage: not streamapi--------------------
export const StreamUsage = [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13];
\ No newline at end of file
......@@ -140,7 +140,7 @@ export default function audioRendererTest() {
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}`);
expect(data.deviceRole).assertEqual(audio.DeviceRole.OUTPUT_DEVICE);
expect(data.deviceType).assertEqual(audio.DeviceType.SPEAKER);
expect(data.id).assertLargerOrEqual(env.OUTPUT_NUMBER_0);
expect(data.id).assertEqual(env.OUTPUT_NUMBER_1);
done();
}).catch((error) => {
console.log("${TagFrmwkRender}: getCurrentOutputDevices error = " + error);
......@@ -169,7 +169,7 @@ 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(env.OUTPUT_NUMBER_0);
expect(data.id).assertEqual(env.OUTPUT_NUMBER_1);
console.info(`${TagFrmwkRender}: Renderer get current output device SUCCESS, now stop audiorender`);
audioRen.drain().then(() => {
console.info(`${TagFrmwkRender}: Renderer drain : SUCCESS, stop audiorender`);
......@@ -210,7 +210,7 @@ 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(env.OUTPUT_NUMBER_0);
expect(data.id).assertEqual(env.OUTPUT_NUMBER_1);
done();
}
});
......@@ -235,7 +235,7 @@ export default function audioRendererTest() {
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);
expect(data.id).assertEqual(env.OUTPUT_NUMBER_1);
console.info(`${TagFrmwkRender}: Renderer getCurrentOutputDevices SUCCESS! now stop the audiorenderer`);
audioRen.drain().then(() => {
console.info(`${TagFrmwkRender}: Renderer drain, stop the audiorenderer`);
......
......@@ -236,9 +236,8 @@ export default function audioRendererTest() {
* @tc.level : Level 0
*/
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMAXSTREAMVOLUME_PROMISE_0300', 0, async function (done) {
let StreamType;
try{
for (StreamType in audio.StreamUsage) {
for (let index = 0; index < env.StreamUsage.length; index++) {
let audioRender;
let AudioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100,
......@@ -248,7 +247,7 @@ export default function audioRendererTest() {
}
let AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_UNKNOWN,
usage: StreamType,
usage: env.StreamUsage[index],
rendererFlags: 0
}
let AudioRendererOptions = {
......@@ -256,24 +255,20 @@ export default function audioRendererTest() {
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;
}
await audio.createAudioRenderer(AudioRendererOptions).then((data) => {
audioRender = data;
console.info(`${TagFrmwkRender}: AudioRender Created : Stream Type: ${env.StreamUsage[index]} SUCCESS data state: ` + Object.keys(data));
}).catch((err) => {
console.info(`${TagFrmwkRender}: AudioRender Created : ERROR : ` + err.message);
});
} 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) => {
console.info(`${TagFrmwkRender}:getMaxStreamVolume:Stream Type: ${StreamType} SUCCESS ${data}`);
console.info(`${TagFrmwkRender}:getMaxStreamVolume:Stream Type: ${env.StreamUsage[index]} 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: ${env.StreamUsage[index]} ERROR : code: ${error.code}, mesage: ${error.message}`);
expect(false).assertTrue();
done();
});
......@@ -397,9 +392,8 @@ export default function audioRendererTest() {
* @tc.level : Level 0
*/
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_PROMISE_0300', 0, async function (done) {
let StreamType;
try{
for (StreamType in audio.StreamUsage) {
for (let index = 0; index < env.StreamUsage.length; index++) {
let audioRender;
let AudioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100,
......@@ -409,7 +403,7 @@ export default function audioRendererTest() {
}
let AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_UNKNOWN,
usage: StreamType,
usage: env.StreamUsage[index],
rendererFlags: 0
}
let AudioRendererOptions = {
......@@ -417,24 +411,20 @@ export default function audioRendererTest() {
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;
}
await audio.createAudioRenderer(AudioRendererOptions).then((data) => {
audioRender = data;
console.info(`${TagFrmwkRender}: AudioRender Created : Stream Type: ${env.StreamUsage[index]} SUCCESS data state: ` + Object.keys(data));
}).catch((err) => {
console.info(`${TagFrmwkRender}: AudioRender Created : ERROR : ` + err.message);
});
} 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: ${env.StreamUsage[index]} 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: ${env.StreamUsage[index]} ERROR : code: ${error.code}, mesage: ${error.message}`);
expect(false).assertTrue();
done();
});
......@@ -540,9 +530,8 @@ export default function audioRendererTest() {
* @tc.level : Level 0
*/
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMAXSTREAMVOLUME_CALLBACK_0300', 0, async function (done) {
let StreamType;
try{
for (StreamType in audio.StreamUsage) {
for (let index = 0; index < env.StreamUsage.length; index++) {
let audioRender;
let AudioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100,
......@@ -552,7 +541,7 @@ export default function audioRendererTest() {
}
let AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_UNKNOWN,
usage: StreamType,
usage: env.StreamUsage[index],
rendererFlags: 0
}
let AudioRendererOptions = {
......@@ -560,16 +549,12 @@ export default function audioRendererTest() {
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;
}
await audio.createAudioRenderer(AudioRendererOptions).then((data) => {
audioRender = data;
console.info(`${TagFrmwkRender}: AudioRender Created : Stream Type: ${env.StreamUsage[index]} SUCCESS data state: ` + Object.keys(data));
}).catch((err) => {
console.info(`${TagFrmwkRender}: AudioRender Created : ERROR : ` + err.message);
});
} catch (error) {
console.info(`${TagFrmwkRender}: AudioRender Created : catch ERROR : ` + error.code + error.message);
}
......@@ -687,10 +672,8 @@ export default function audioRendererTest() {
* @tc.level : Level 0
*/
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETMINSTREAMVOLUME_CALLBACK_0300', 0, async function (done) {
let StreamType;
try{
for (StreamType in audio.StreamUsage) {
for (let index = 0; index < env.StreamUsage.length; index++) {
let audioRender;
let AudioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100,
......@@ -700,7 +683,7 @@ export default function audioRendererTest() {
}
let AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_UNKNOWN,
usage: StreamType,
usage: env.StreamUsage[index],
rendererFlags: 0
}
let AudioRendererOptions = {
......@@ -708,16 +691,12 @@ export default function audioRendererTest() {
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;
}
await audio.createAudioRenderer(AudioRendererOptions).then((data) => {
audioRender = data;
console.info(`${TagFrmwkRender}: AudioRender Created : Stream Type: ${env.StreamUsage[index]} SUCCESS data state: ` + Object.keys(data));
}).catch((err) => {
console.info(`${TagFrmwkRender}: AudioRender Created : ERROR : ` + err.message);
});
} catch (error) {
console.info(`${TagFrmwkRender}: AudioRender Created : catch ERROR : ` + error.code + error.message);
}
......
......@@ -145,7 +145,7 @@ export default function audioRendererTest() {
try{
await audioRen.getUnderflowCount().then((data) => {
console.info(`${TagFrmwkRender}:getUnderflowCount :SUCCESS ${data}`);
expect(data).assertLargerOrEqual(env.OUTPUT_NUMBER_0);
expect(data).assertEqual(env.OUTPUT_NUMBER_0);
done();
}).catch ((error)=>{
console.log("${TagFrmwkRender}:getUnderflowCount : error = " + error);
......@@ -172,7 +172,8 @@ export default function audioRendererTest() {
try {
await renderPlay();
await audioRen.getUnderflowCount().then((data) => {
expect(data).assertLargerOrEqual(env.OUTPUT_NUMBER_0);
console.log(`getUnderflowCount :SUCCESS ${data}`);
expect(data).assertEqual(env.OUTPUT_NUMBER_2);
audioRen.drain().then(() => {
audioRen.stop().then(() => {
done();
......@@ -203,9 +204,8 @@ export default function audioRendererTest() {
* @tc.level : Level 0
*/
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETUNDERFLOWCOUNT_PROMISE_0300', 0, async function (done) {
let StreamType;
try {
for (StreamType in audio.StreamUsage) {
for (let index = 0; index < env.StreamUsage.length; index++) {
let audioRender;
let AudioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100,
......@@ -215,7 +215,7 @@ export default function audioRendererTest() {
}
let AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_UNKNOWN,
usage: Number(audio.StreamUsage[StreamType]),
usage: env.StreamUsage[index],
rendererFlags: 0
}
let AudioRendererOptions = {
......@@ -223,22 +223,18 @@ export default function audioRendererTest() {
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}: ${Number(audio.StreamUsage[StreamType])}`);
}).catch((err) => {
console.info(`${TagFrmwkRender}: AudioRender Created : ERROR : ` + err.code + err.message);
});
} else {
audioRender = audioRen;
}
await audio.createAudioRenderer(AudioRendererOptions).then((data) => {
audioRender = data;
console.info(`${TagFrmwkRender}: AudioRender Created : Stream Type: ${env.StreamUsage[index]} success`);
}).catch((err) => {
console.info(`${TagFrmwkRender}: AudioRender Created : ERROR : ` + err.code + err.message);
});
} catch (error) {
console.info(`${TagFrmwkRender}: AudioRender Created : catch ERROR : ` + error.code + error.message);
}
await audioRender.getUnderflowCount().then((data) => {
console.info(`${TagFrmwkRender}: getUnderflowCount SUCCESS! ${StreamType} data ${data}:, now release audiorender`);
expect(data).assertLargerOrEqual(0);
console.info(`${TagFrmwkRender}: getUnderflowCount SUCCESS! ${env.StreamUsage[index]} data ${data}:, now release audiorender`);
expect(data).assertEqual(env.OUTPUT_NUMBER_0);
}).catch((error) => {
console.info(`${TagFrmwkRender}: getUnderflowCount: ERROR : code: ${error.code}, mesage: ${error.message}`);
expect(false).assertTrue();
......@@ -246,7 +242,7 @@ export default function audioRendererTest() {
});
sleep(1000);
await audioRender.release().then(() => {
console.info(`${TagFrmwkRender}: Renderer ${StreamType} release SUCCESS! `);
console.info(`${TagFrmwkRender}: Renderer ${env.StreamUsage[index]} release SUCCESS! `);
}).catch((err) => {
console.info(`${TagFrmwkRender}: Renderer release ERROR: ${err.message}`);
});
......@@ -274,7 +270,7 @@ export default function audioRendererTest() {
done();
} else {
console.info(`${TagFrmwkRender}: getUnderflowCount : Success! ${data}`);
expect(data).assertLargerOrEqual(env.OUTPUT_NUMBER_0);
expect(data).assertEqual(env.OUTPUT_NUMBER_0);
done();
}
});
......@@ -297,7 +293,8 @@ export default function audioRendererTest() {
expect(false).assertTrue();
done();
} else {
expect(data).assertLargerOrEqual(env.OUTPUT_NUMBER_0);
console.log(`getUnderflowCount :SUCCESS ${data}`);
expect(data).assertEqual(env.OUTPUT_NUMBER_2);
audioRen.drain().then(() => {
audioRen.stop().then(() => {
done();
......@@ -325,9 +322,8 @@ export default function audioRendererTest() {
* @tc.level : Level 0
*/
it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETUNDERFLOWCOUNT_CALLBACK_0300', 0, async function (done) {
let StreamType;
try {
for (StreamType in audio.StreamUsage) {
for (let index = 0; index < env.StreamUsage.length; index++) {
let audioRender;
let AudioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100,
......@@ -337,7 +333,7 @@ export default function audioRendererTest() {
}
let AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH,
usage: StreamType,
usage: env.StreamUsage[index],
rendererFlags: 0
}
let AudioRendererOptions = {
......@@ -345,16 +341,12 @@ export default function audioRendererTest() {
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;
}
await audio.createAudioRenderer(AudioRendererOptions).then((data) => {
audioRender = data;
console.info(`${TagFrmwkRender}: AudioRender Created : Stream Type: ${env.StreamUsage[index]} SUCCESS data state: ` + Object.keys(data));
}).catch((err) => {
console.info(`${TagFrmwkRender}: AudioRender Created : ERROR : ` + err.message);
});
} catch (error) {
console.info(`${TagFrmwkRender}: AudioRender Created : catch ERROR : ` + error.code + error.message);
}
......@@ -363,13 +355,13 @@ export default function audioRendererTest() {
expect(false).assertTrue();
done();
} else {
console.log(`${TagFrmwkRender}:getUnderflowCount StreamType:${StreamType} execution success, data: ${JSON.stringify(data)}`);
expect(data).assertLargerOrEqual(env.OUTPUT_NUMBER_0);
console.log(`${TagFrmwkRender}:getUnderflowCount StreamType:${env.StreamUsage[index]} execution success, data: ${JSON.stringify(data)}`);
expect(data).assertEqual(env.OUTPUT_NUMBER_0);
}
});
sleep(1000);
await audioRender.release().then(() => {
console.info(`${TagFrmwkRender}: Renderer ${StreamType} release : SUCCESS`);
console.info(`${TagFrmwkRender}: Renderer ${env.StreamUsage[index]} release : SUCCESS`);
}).catch((err) => {
console.info(`${TagFrmwkRender}: Renderer release :ERROR : ${err.message}`);
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册