diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioFramework.test.js b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioFramework.test.js index e21d3f860ae14dc4606214105ebf3ef311505de2..089f5e042eaf2b2d81063c6e8ac01a649dd9b478 100755 --- a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioFramework.test.js +++ b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioFramework.test.js @@ -2490,21 +2490,21 @@ describe('audioManager', function () { } else if (value == highVol) { console.info("AudioFrameworkTest: value is " + value); - audioManager.isMute(audioMedia, (err, data) => { - if (err) { - console.error(`AudioFrameworkTest: Callback : FALSE: Media : failed to get Mute Status ${err.message}`); - expect().assertFail(); - } - else if (data == false) { - console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: PASS: ' + data); - expect(true).assertTrue(); - } - else { - console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: FAIL: ' + data); - expect(false).assertTrue(); - } - done(); - }); + audioManager.isMute(audioMedia, (err, data) => { + if (err) { + console.error(`AudioFrameworkTest: Callback : FALSE: Media : failed to get Mute Status ${err.message}`); + expect().assertFail(); + } + else if (data == false) { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: PASS: ' + data); + expect(true).assertTrue(); + } + else { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: FAIL: ' + data); + expect(false).assertTrue(); + } + done(); + }); } else { console.info("AudioFrameworkTest: mute fail"); @@ -2597,20 +2597,20 @@ describe('audioManager', function () { else if (value == highVol) { console.info("AudioFrameworkTest: value is " + value); audioManager.isMute(audioRingtone, (err, data) => { - if (err) { - console.error(`AudioFrameworkTest: Callback : FALSE: Media : failed to get Mute Status ${err.message}`); - expect().assertFail(); - } - else if (data == false) { - console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: PASS: ' + data); - expect(true).assertTrue(); - } - else { - console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: FAIL: ' + data); - expect(false).assertTrue(); - } - done(); - }); + if (err) { + console.error(`AudioFrameworkTest: Callback : FALSE: Media : failed to get Mute Status ${err.message}`); + expect().assertFail(); + } + else if (data == false) { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: PASS: ' + data); + expect(true).assertTrue(); + } + else { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: FAIL: ' + data); + expect(false).assertTrue(); + } + done(); + }); } else { console.info("AudioFrameworkTest: mute fail"); @@ -2702,20 +2702,20 @@ describe('audioManager', function () { else if (value == highVol) { console.info("AudioFrameworkTest: value is " + value); audioManager.isMute(audio.AudioVolumeType.MEDIA, (err, data) => { - if (err) { - console.error(`AudioFrameworkTest: Callback : FALSE: Media : failed to get Mute Status ${err.message}`); - expect().assertFail(); - } - else if (data == false) { - console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: PASS: ' + data); - expect(true).assertTrue(); - } - else { - console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: FAIL: ' + data); - expect(false).assertTrue(); - } - done(); - }); + if (err) { + console.error(`AudioFrameworkTest: Callback : FALSE: Media : failed to get Mute Status ${err.message}`); + expect().assertFail(); + } + else if (data == false) { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: PASS: ' + data); + expect(true).assertTrue(); + } + else { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: FAIL: ' + data); + expect(false).assertTrue(); + } + done(); + }); } else { console.info("AudioFrameworkTest: mute fail"); @@ -2808,20 +2808,20 @@ describe('audioManager', function () { else if (value == highVol) { console.info("AudioFrameworkTest: value is " + value); audioManager.isMute(audio.AudioVolumeType.RINGTONE, (err, data) => { - if (err) { - console.error(`AudioFrameworkTest: Callback : FALSE: Media : failed to get Mute Status ${err.message}`); - expect().assertFail(); - } - else if (data == false) { - console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: PASS: ' + data); - expect(true).assertTrue(); - } - else { - console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: FAIL: ' + data); - expect(false).assertTrue(); - } - done(); - }); + if (err) { + console.error(`AudioFrameworkTest: Callback : FALSE: Media : failed to get Mute Status ${err.message}`); + expect().assertFail(); + } + else if (data == false) { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: PASS: ' + data); + expect(true).assertTrue(); + } + else { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: FAIL: ' + data); + expect(false).assertTrue(); + } + done(); + }); } else { console.info("AudioFrameworkTest: mute fail"); @@ -2913,20 +2913,20 @@ describe('audioManager', function () { else if (value == highVol) { console.info("AudioFrameworkTest: value is " + value); audioManager.isMute(audio.AudioVolumeType.VOICE_CALL, (err, data) => { - if (err) { - console.error(`AudioFrameworkTest: Callback : FALSE: VOICE_CALL : failed to get Mute Status ${err.message}`); - expect().assertFail(); - } - else if (data == false) { - console.log('AudioFrameworkTest: Callback : Is Stream Mute VOICE_CALL: FALSE: PASS: ' + data); - expect(true).assertTrue(); - } - else { - console.log('AudioFrameworkTest: Callback : Is Stream Mute VOICE_CALL: FALSE: FAIL: ' + data); - expect(false).assertTrue(); - } - done(); - }); + if (err) { + console.error(`AudioFrameworkTest: Callback : FALSE: VOICE_CALL : failed to get Mute Status ${err.message}`); + expect().assertFail(); + } + else if (data == false) { + console.log('AudioFrameworkTest: Callback : Is Stream Mute VOICE_CALL: FALSE: PASS: ' + data); + expect(true).assertTrue(); + } + else { + console.log('AudioFrameworkTest: Callback : Is Stream Mute VOICE_CALL: FALSE: FAIL: ' + data); + expect(false).assertTrue(); + } + done(); + }); } else { console.info("AudioFrameworkTest: mute fail"); @@ -3018,20 +3018,20 @@ describe('audioManager', function () { else if (value == highVol) { console.info("AudioFrameworkTest: value is " + value); audioManager.isMute(audio.AudioVolumeType.VOICE_ASSISTANT, (err, data) => { - if (err) { - console.error(`AudioFrameworkTest: Callback : FALSE: VOICE_ASSISTANT : failed to get Mute Status ${err.message}`); - expect().assertFail(); - } - else if (data == false) { - console.log('AudioFrameworkTest: Callback : Is Stream Mute VOICE_ASSISTANT: FALSE: PASS: ' + data); - expect(true).assertTrue(); - } - else { - console.log('AudioFrameworkTest: Callback : Is Stream Mute VOICE_ASSISTANT: FALSE: FAIL: ' + data); - expect(false).assertTrue(); - } - done(); - }); + if (err) { + console.error(`AudioFrameworkTest: Callback : FALSE: VOICE_ASSISTANT : failed to get Mute Status ${err.message}`); + expect().assertFail(); + } + else if (data == false) { + console.log('AudioFrameworkTest: Callback : Is Stream Mute VOICE_ASSISTANT: FALSE: PASS: ' + data); + expect(true).assertTrue(); + } + else { + console.log('AudioFrameworkTest: Callback : Is Stream Mute VOICE_ASSISTANT: FALSE: FAIL: ' + data); + expect(false).assertTrue(); + } + done(); + }); } else { console.info("AudioFrameworkTest: mute fail"); @@ -3161,21 +3161,21 @@ describe('audioManager', function () { else if (value == 0) { console.info("AudioFrameworkTest: value is " + value); await audioManager.setVolume(audioMedia, highVol); - audioManager.isMute(audioMedia, (err, data) => { - if (err) { - console.error(`AudioFrameworkTest: Callback : SetVolume: Media : failed to get Mute Status ${err.message}`); - expect().assertFail(); - } - else if (data == false) { - console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: SetVolume: PASS: ' + data); - expect(true).assertTrue(); - } - else { - console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: SetVolume: FAIL: ' + data); - expect(false).assertTrue(); - } - done(); - }); + audioManager.isMute(audioMedia, (err, data) => { + if (err) { + console.error(`AudioFrameworkTest: Callback : SetVolume: Media : failed to get Mute Status ${err.message}`); + expect().assertFail(); + } + else if (data == false) { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: SetVolume: PASS: ' + data); + expect(true).assertTrue(); + } + else { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: SetVolume: FAIL: ' + data); + expect(false).assertTrue(); + } + done(); + }); } else { console.info("AudioFrameworkTest: mute fail"); @@ -3255,21 +3255,21 @@ describe('audioManager', function () { else if (value == 0) { console.info("AudioFrameworkTest: value is " + value); await audioManager.setVolume(audioRingtone, lowVol); - audioManager.isMute(audioRingtone, (err, data) => { - if (err) { - console.error(`AudioFrameworkTest: Callback : SetVolume: Ringtone : failed to get Mute Status ${err.message}`); - expect().assertFail(); - } - else if (data == false) { - console.log('AudioFrameworkTest: Callback : Is Stream Mute Ringtone: SetVolume: PASS: ' + data); - expect(true).assertTrue(); - } - else { - console.log('AudioFrameworkTest: Callback : Is Stream Mute Ringtone: SetVolume: FAIL: ' + data); - expect(false).assertTrue(); - } - done(); - }); + audioManager.isMute(audioRingtone, (err, data) => { + if (err) { + console.error(`AudioFrameworkTest: Callback : SetVolume: Ringtone : failed to get Mute Status ${err.message}`); + expect().assertFail(); + } + else if (data == false) { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Ringtone: SetVolume: PASS: ' + data); + expect(true).assertTrue(); + } + else { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Ringtone: SetVolume: FAIL: ' + data); + expect(false).assertTrue(); + } + done(); + }); } else { console.info("AudioFrameworkTest: mute fail"); @@ -3349,21 +3349,21 @@ describe('audioManager', function () { else if (value == 0) { console.info("AudioFrameworkTest: value is " + value); await audioManager.setVolume(audio.AudioVolumeType.VOICE_CALL, lowVol); - audioManager.isMute(audio.AudioVolumeType.VOICE_CALL, (err, data) => { - if (err) { - console.error(`AudioFrameworkTest: Callback : SetVolume: VOICE_CALL : failed to get Mute Status ${err.message}`); - expect().assertFail(); - } - else if (data == false) { - console.log('AudioFrameworkTest: Callback : Is Stream Mute VOICE_CALL: SetVolume: PASS: ' + data); - expect(true).assertTrue(); - } - else { - console.log('AudioFrameworkTest: Callback : Is Stream Mute VOICE_CALL: SetVolume: FAIL: ' + data); - expect(false).assertTrue(); - } - done(); - }); + audioManager.isMute(audio.AudioVolumeType.VOICE_CALL, (err, data) => { + if (err) { + console.error(`AudioFrameworkTest: Callback : SetVolume: VOICE_CALL : failed to get Mute Status ${err.message}`); + expect().assertFail(); + } + else if (data == false) { + console.log('AudioFrameworkTest: Callback : Is Stream Mute VOICE_CALL: SetVolume: PASS: ' + data); + expect(true).assertTrue(); + } + else { + console.log('AudioFrameworkTest: Callback : Is Stream Mute VOICE_CALL: SetVolume: FAIL: ' + data); + expect(false).assertTrue(); + } + done(); + }); } else { console.info("AudioFrameworkTest: mute fail"); @@ -3439,21 +3439,21 @@ describe('audioManager', function () { if (value == 0) { console.info("AudioFrameworkTest: value is " + value); await audioManager.setVolume(audio.AudioVolumeType.VOICE_ASSISTANT, lowVol); - audioManager.isMute(audio.AudioVolumeType.VOICE_ASSISTANT, (err, data) => { - if (err) { - console.error(`AudioFrameworkTest: Callback : SetVolume: VOICE_ASSISTANT : failed to get Mute Status ${err.message}`); - expect().assertFail(); - } - else if (data == false) { - console.log('AudioFrameworkTest: Callback : Is Stream Mute VOICE_ASSISTANT: SetVolume: PASS: ' + data); - expect(true).assertTrue(); - } - else { - console.log('AudioFrameworkTest: Callback : Is Stream Mute VOICE_ASSISTANT: SetVolume: FAIL: ' + data); - expect(false).assertTrue(); - } - done(); - }); + audioManager.isMute(audio.AudioVolumeType.VOICE_ASSISTANT, (err, data) => { + if (err) { + console.error(`AudioFrameworkTest: Callback : SetVolume: VOICE_ASSISTANT : failed to get Mute Status ${err.message}`); + expect().assertFail(); + } + else if (data == false) { + console.log('AudioFrameworkTest: Callback : Is Stream Mute VOICE_ASSISTANT: SetVolume: PASS: ' + data); + expect(true).assertTrue(); + } + else { + console.log('AudioFrameworkTest: Callback : Is Stream Mute VOICE_ASSISTANT: SetVolume: FAIL: ' + data); + expect(false).assertTrue(); + } + done(); + }); } else { expect(false).assertTrue(); @@ -5109,28 +5109,28 @@ describe('audioManager', function () { */ it('SUB_AUDIO_MANAGER_DeviceType_001', 0, async function (done) { expect(audio.DeviceType.INVALID).assertEqual(0); - console.info("audio.DeviceType.INVALID:"+audio.DeviceType.INVALID); + console.info("audio.DeviceType.INVALID:" + audio.DeviceType.INVALID); expect(audio.DeviceType.EARPIECE).assertEqual(1); - console.info("audio.DeviceType.EARPIECE:"+audio.DeviceType.EARPIECE); + console.info("audio.DeviceType.EARPIECE:" + audio.DeviceType.EARPIECE); expect(audio.DeviceType.SPEAKER).assertEqual(2); - console.info("audio.DeviceType.SPEAKER:"+audio.DeviceType.SPEAKER); + console.info("audio.DeviceType.SPEAKER:" + audio.DeviceType.SPEAKER); expect(audio.DeviceType.WIRED_HEADSET).assertEqual(3); - console.info("audio.DeviceType.WIRED_HEADSET:"+audio.DeviceType.WIRED_HEADSET); + console.info("audio.DeviceType.WIRED_HEADSET:" + audio.DeviceType.WIRED_HEADSET); expect(audio.DeviceType.WIRED_HEADPHONES).assertEqual(4); - console.info("audio.DeviceType.WIRED_HEADPHONES:"+audio.DeviceType.WIRED_HEADPHONES); + console.info("audio.DeviceType.WIRED_HEADPHONES:" + audio.DeviceType.WIRED_HEADPHONES); expect(audio.DeviceType.BLUETOOTH_SCO).assertEqual(7); - console.info("audio.DeviceType.BLUETOOTH_SCO:"+audio.DeviceType.BLUETOOTH_SCO); + console.info("audio.DeviceType.BLUETOOTH_SCO:" + audio.DeviceType.BLUETOOTH_SCO); expect(audio.DeviceType.BLUETOOTH_A2DP).assertEqual(8); - console.info("audio.DeviceType.BLUETOOTH_A2DP:"+audio.DeviceType.BLUETOOTH_A2DP); + console.info("audio.DeviceType.BLUETOOTH_A2DP:" + audio.DeviceType.BLUETOOTH_A2DP); expect(audio.DeviceType.MIC).assertEqual(15); - console.info("audio.DeviceType.MIC:"+audio.DeviceType.MIC); + console.info("audio.DeviceType.MIC:" + audio.DeviceType.MIC); expect(audio.DeviceType.USB_HEADSET).assertEqual(22); - console.info("audio.DeviceType.USB_HEADSET:"+audio.DeviceType.USB_HEADSET); + console.info("audio.DeviceType.USB_HEADSET:" + audio.DeviceType.USB_HEADSET); await sleep(50); done(); }) - - /* * + + /* * * @tc.number : SUB_AUDIO_MANAGER_DeviceRole_001 * @tc.name : DeviceRole - ALL Device Role * @tc.desc : DeviceRole - ALL Device Role @@ -5140,14 +5140,14 @@ describe('audioManager', function () { */ it('SUB_AUDIO_MANAGER_DeviceRole_001', 0, async function (done) { expect(audio.DeviceRole.INPUT_DEVICE).assertEqual(1); - console.info("audio.DeviceRole.INPUT_DEVICE :"+audio.DeviceRole.INPUT_DEVICE); + console.info("audio.DeviceRole.INPUT_DEVICE :" + audio.DeviceRole.INPUT_DEVICE); expect(audio.DeviceRole.OUTPUT_DEVICE).assertEqual(2); - console.info("audio.DeviceRole.OUTPUT_DEVICE :"+audio.DeviceRole.OUTPUT_DEVICE); + console.info("audio.DeviceRole.OUTPUT_DEVICE :" + audio.DeviceRole.OUTPUT_DEVICE); await sleep(50); done(); }) - - /* * + + /* * * @tc.number : SUB_AUDIO_ROUTING_MANAGER_getDevices_001 * @tc.name : getDevices - Output device - Callback * @tc.desc : getDevices - Output device @@ -5178,7 +5178,7 @@ describe('audioManager', function () { value.forEach(displayDeviceProp); if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && - cMask != null) { + cMask != null) { console.info('AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : PASS'); expect(true).assertTrue(); } @@ -5222,7 +5222,7 @@ describe('audioManager', function () { console.info('AudioFrameworkTest: Callback: getDevices INPUT_DEVICES_FLAG'); value.forEach(displayDeviceProp); - if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null + if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && cMask != null) { console.info('AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: PASS'); expect(true).assertTrue(); @@ -5267,7 +5267,7 @@ describe('audioManager', function () { console.info('AudioFrameworkTest: Callback: getDevices ALL_DEVICES_FLAG'); value.forEach(displayDeviceProp); - if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && + if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && cMask != null) { console.info('AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: PASS'); expect(true).assertTrue(); @@ -5308,7 +5308,7 @@ describe('audioManager', function () { else { console.info('AudioFrameworkTest: Callback: getDevices OUTPUT_DEVICES_FLAG'); value.forEach(displayDeviceProp); - if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && + if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && cMask != null) { console.info('AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : PASS'); expect(true).assertTrue(); @@ -5350,7 +5350,7 @@ describe('audioManager', function () { console.info('AudioFrameworkTest: Callback: getDevices INPUT_DEVICES_FLAG'); value.forEach(displayDeviceProp); - if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && + if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && cMask != null) { console.info('AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: PASS'); expect(true).assertTrue(); @@ -5391,7 +5391,7 @@ describe('audioManager', function () { else { console.info('AudioFrameworkTest: Callback: getDevices ALL_DEVICES_FLAG'); value.forEach(displayDeviceProp); - if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && + if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && cMask != null) { console.info('AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: PASS'); expect(true).assertTrue(); @@ -5404,7 +5404,7 @@ describe('audioManager', function () { done(); }); }) - + /* * * @tc.number : SUB_AUDIO_ROUTING_MANAGER_getDevices_008 * @tc.name : getDevices - OUTPUT device - Promise - ENAME @@ -5427,7 +5427,7 @@ describe('audioManager', function () { console.info('AudioFrameworkTest: Promise: getDevices OUTPUT_DEVICES_FLAG'); value.forEach(displayDeviceProp); if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && - cMask != null) { + cMask != null) { console.info('AudioFrameworkTest: Promise: getDevices:OUTPUT_DEVICES_FLAG : PASS'); expect(true).assertTrue(); } @@ -5455,7 +5455,7 @@ describe('audioManager', function () { sRate = null; cCount = null; cMask = null; - audioManager.getRoutingManager(async (err,AudioRoutingManager)=>{ + audioManager.getRoutingManager(async (err, AudioRoutingManager) => { if (err) { console.error(`AudioFrameworkTest: Callback: failed to get RoutingManager ${err.message}`); expect().assertFail(); @@ -5465,7 +5465,7 @@ describe('audioManager', function () { value.forEach(displayDeviceProp); if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && - cMask != null) { + cMask != null) { console.info('AudioFrameworkTest: Promise: getDevices : INPUT_DEVICES_FLAG : PASS'); expect(true).assertTrue(); } @@ -5495,17 +5495,17 @@ describe('audioManager', function () { sRate = null; cCount = null; cMask = null; - audioManager.getRoutingManager(async (err,AudioRoutingManager)=>{ + audioManager.getRoutingManager(async (err, AudioRoutingManager) => { if (err) { console.error(`AudioFrameworkTest:Callback:failed to get RoutingManager ${err.message}`); - expect().assertFail(); + expect().assertFail(); } else { let value = await AudioRoutingManager.getDevices(audio.DeviceFlag.ALL_DEVICES_FLAG) console.info('AudioFrameworkTest: Promise: getDevices ALL_DEVICES_FLAG'); value.forEach(displayDeviceProp); if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && - cMask != null) { + cMask != null) { console.info('AudioFrameworkTest: Promise: getDevices : ALL_DEVICES_FLAG : PASS'); expect(true).assertTrue(); } @@ -5533,8 +5533,8 @@ describe('audioManager', function () { await sleep(50); done(); }) - - /* * + + /* * * @tc.number : SUB_AUDIO_SAMPLE_FORMAT_F32LE_001 * @tc.name : SAMPLE_FORMAT_F32LE * @tc.desc : SAMPLE_FORMAT_F32LE