From 1e9e0fb15089ed4ec7fe67e20622a0d971b72602 Mon Sep 17 00:00:00 2001 From: wangzx0705 Date: Mon, 28 Aug 2023 06:59:19 +0000 Subject: [PATCH] modify the output deviceinfo cases Signed-off-by: wangzx0705 --- .../ets/test/GetCurrentOutputDevices.test.ets | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/multimedia/audio/audio_js_standard/AudioRendererEnhance/src/main/ets/test/GetCurrentOutputDevices.test.ets b/multimedia/audio/audio_js_standard/AudioRendererEnhance/src/main/ets/test/GetCurrentOutputDevices.test.ets index bb5cddfb9..680046d3b 100644 --- a/multimedia/audio/audio_js_standard/AudioRendererEnhance/src/main/ets/test/GetCurrentOutputDevices.test.ets +++ b/multimedia/audio/audio_js_standard/AudioRendererEnhance/src/main/ets/test/GetCurrentOutputDevices.test.ets @@ -137,10 +137,11 @@ export default function audioRendererTest() { it('SUB_MULTIMEDIA_AUDIO_RENDERER_GETCURRENTOUTPUTDEVICES_PROMISE_0100', 0, async function (done) { 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}`); - expect(data.deviceRole).assertEqual(audio.DeviceRole.OUTPUT_DEVICE); - expect(data.deviceType).assertEqual(audio.DeviceType.SPEAKER); - expect(data.id).assertEqual(env.OUTPUT_NUMBER_1); + console.info(`${TagFrmwkRender}: deviceRole:${data[0].deviceRole}, deviceType:${data[0].deviceType}, id:${data[0].id}, name:${data[0].name}, + address:${data[0].address}, sampleRates:${data[0].sampleRates}, channelCounts:${data[0].channelCounts}, channelMasks:${data[0].channelMasks}`); + expect(data[0].deviceRole).assertEqual(audio.DeviceRole.OUTPUT_DEVICE); + expect(data[0].deviceType).assertEqual(audio.DeviceType.SPEAKER); + expect(data[0].id).assertEqual(env.OUTPUT_NUMBER_1); done(); }).catch((error) => { console.log("${TagFrmwkRender}: getCurrentOutputDevices error = " + error); @@ -166,10 +167,11 @@ export default function audioRendererTest() { try { await renderPlay(); await audioRen.getCurrentOutputDevices().then((data) => { - 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).assertEqual(env.OUTPUT_NUMBER_1); + console.info(`${TagFrmwkRender}: deviceRole:${data[0].deviceRole}, deviceType:${data[0].deviceType}, id:${data[0].id}, + address:${data[0].address}, sampleRates:${data[0].sampleRates}, channelCounts:${data[0].channelCounts}, channelMasks:${data[0].channelMasks}`); + expect(data[0].deviceRole).assertEqual(audio.DeviceRole.OUTPUT_DEVICE); + expect(data[0].deviceType).assertEqual(audio.DeviceType.SPEAKER); + expect(data[0].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`); @@ -207,10 +209,11 @@ export default function audioRendererTest() { 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}`); - expect(data.deviceRole).assertEqual(audio.DeviceRole.OUTPUT_DEVICE); - expect(data.deviceType).assertEqual(audio.DeviceType.SPEAKER); - expect(data.id).assertEqual(env.OUTPUT_NUMBER_1); + console.info(`${TagFrmwkRender}: deviceRole:${data[0].deviceRole}, deviceType:${data[0].deviceType}, id:${data[0].id}, + address:${data[0].address}, sampleRates:${data[0].sampleRates}, channelCounts:${data[0].channelCounts}, channelMasks:${data[0].channelMasks}`); + expect(data[0].deviceRole).assertEqual(audio.DeviceRole.OUTPUT_DEVICE); + expect(data[0].deviceType).assertEqual(audio.DeviceType.SPEAKER); + expect(data[0].id).assertEqual(env.OUTPUT_NUMBER_1); done(); } }); @@ -232,10 +235,11 @@ export default function audioRendererTest() { 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(data.deviceRole).assertEqual(audio.DeviceRole.OUTPUT_DEVICE); - expect(data.deviceType).assertEqual(audio.DeviceType.SPEAKER); - expect(data.id).assertEqual(env.OUTPUT_NUMBER_1); + console.info(`${TagFrmwkRender}: getCurrentOutputDevices :deviceRole:${data[0].deviceRole}, deviceType:${data[0].deviceType}, id:${data[0].id}, + address:${data[0].address}, sampleRates:${data[0].sampleRates}, channelCounts:${data[0].channelCounts}, channelMasks:${data[0].channelMasks}`); + expect(data[0].deviceRole).assertEqual(audio.DeviceRole.OUTPUT_DEVICE); + expect(data[0].deviceType).assertEqual(audio.DeviceType.SPEAKER); + expect(data[0].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`); -- GitLab