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

!8288 【媒体子系统】新增audio覆盖

Merge pull request !8288 from 秦莉文/OpenHarmony-3.2-Release
...@@ -17,7 +17,7 @@ import audio from '@ohos.multimedia.audio'; ...@@ -17,7 +17,7 @@ import audio from '@ohos.multimedia.audio';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
export default function audioManagerApi9() { export default function audioManagerApi9() {
describe('audioManagerApi9', function () { describe('audioManagerApi9', function () {
let TagFrmwk = "audioManagerApi9Test"; let TagFrmwk = "audioManagerApi9Test";
console.info(`${TagFrmwk}: Create AudioManger Object JS Framework`); console.info(`${TagFrmwk}: Create AudioManger Object JS Framework`);
let audioManager = null; let audioManager = null;
...@@ -164,16 +164,16 @@ describe('audioManagerApi9', function () { ...@@ -164,16 +164,16 @@ describe('audioManagerApi9', function () {
*/ */
it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_0100', 3, async function (done) { it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_0100', 3, async function (done) {
let audioVolumeManager = audioManager.getVolumeManager(); let audioVolumeManager = audioManager.getVolumeManager();
audioVolumeManager.getVolumeGroupManager(audio.DEFAULT_VOLUME_GROUP_ID, (err,groupManager)=>{ audioVolumeManager.getVolumeGroupManager(audio.DEFAULT_VOLUME_GROUP_ID, (err, groupManager) => {
if (err) { if (err) {
console.error(`audioManagerApi9Test: failed to getGroupManager: Callback: ${err.message}`); console.error(`audioManagerApi9Test: failed to getGroupManager: Callback: ${err.message}`);
expect(false).assertTrue(); expect(false).assertTrue();
} else { } else {
if((typeof groupManager) == 'object'){ if ((typeof groupManager) == 'object') {
console.info('audioManagerApi9Test: Promise: getGroupManager : PASS'); console.info('audioManagerApi9Test: Promise: getGroupManager : PASS');
expect(true).assertTrue(); expect(true).assertTrue();
} }
else{ else {
console.info('audioManagerApi9Test: Promise: getGroupManager : FAIL'); console.info('audioManagerApi9Test: Promise: getGroupManager : FAIL');
expect(false).assertTrue(); expect(false).assertTrue();
} }
...@@ -192,19 +192,19 @@ describe('audioManagerApi9', function () { ...@@ -192,19 +192,19 @@ describe('audioManagerApi9', function () {
* @tc.level : Level 3 * @tc.level : Level 3
*/ */
it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_0200', 3, async function (done) { it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_0200', 3, async function (done) {
try{ try {
let audioVolumeManager = audioManager.getVolumeManager(); let audioVolumeManager = audioManager.getVolumeManager();
let groupManager = await audioVolumeManager.getVolumeGroupManager(audio.DEFAULT_VOLUME_GROUP_ID); let groupManager = await audioVolumeManager.getVolumeGroupManager(audio.DEFAULT_VOLUME_GROUP_ID);
if((typeof groupManager) == 'object'){ if ((typeof groupManager) == 'object') {
console.info('audioManagerApi9Test: Promise: getGroupManager : PASS'); console.info('audioManagerApi9Test: Promise: getGroupManager : PASS');
expect(true).assertTrue(); expect(true).assertTrue();
} }
else{ else {
console.info('audioManagerApi9Test: Promise: getGroupManager : FAIL'); console.info('audioManagerApi9Test: Promise: getGroupManager : FAIL');
expect(false).assertTrue(); expect(false).assertTrue();
} }
}catch(err){ } catch (err) {
console.info('audioManagerApi9Test: getGroupManager: parameter err:'+ err.message); console.info('audioManagerApi9Test: getGroupManager: parameter err:' + err.message);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
...@@ -221,11 +221,11 @@ describe('audioManagerApi9', function () { ...@@ -221,11 +221,11 @@ describe('audioManagerApi9', function () {
*/ */
it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_GETVOLUME_0100', 3, async function (done) { it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_GETVOLUME_0100', 3, async function (done) {
let groupManager; let groupManager;
try{ try {
let audioVolumeManager = audioManager.getVolumeManager(); let audioVolumeManager = audioManager.getVolumeManager();
groupManager = await audioVolumeManager.getVolumeGroupManager(audio.DEFAULT_VOLUME_GROUP_ID); groupManager = await audioVolumeManager.getVolumeGroupManager(audio.DEFAULT_VOLUME_GROUP_ID);
}catch(err){ } catch (err) {
console.info('audioManagerApi9Test: getVolumeGroupManager : err:'+ err.message); console.info('audioManagerApi9Test: getVolumeGroupManager : err:' + err.message);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
...@@ -255,7 +255,7 @@ describe('audioManagerApi9', function () { ...@@ -255,7 +255,7 @@ describe('audioManagerApi9', function () {
* @tc.level : Level 3 * @tc.level : Level 3
*/ */
it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_GETVOLUME_0200', 3, async function (done) { it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_GETVOLUME_0200', 3, async function (done) {
try{ try {
let audioVolumeManager = audioManager.getVolumeManager(); let audioVolumeManager = audioManager.getVolumeManager();
let groupManager = await audioVolumeManager.getVolumeGroupManager(audio.DEFAULT_VOLUME_GROUP_ID); let groupManager = await audioVolumeManager.getVolumeGroupManager(audio.DEFAULT_VOLUME_GROUP_ID);
let value = await groupManager.getVolume(audio.AudioVolumeType.MEDIA); let value = await groupManager.getVolume(audio.AudioVolumeType.MEDIA);
...@@ -268,8 +268,8 @@ describe('audioManagerApi9', function () { ...@@ -268,8 +268,8 @@ describe('audioManagerApi9', function () {
expect(false).assertTrue(); expect(false).assertTrue();
} }
done(); done();
}catch(err){ } catch (err) {
console.info('audioManagerApi9Test: getVolumeGroupManager : err:'+ err.message); console.info('audioManagerApi9Test: getVolumeGroupManager : err:' + err.message);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
...@@ -284,7 +284,7 @@ describe('audioManagerApi9', function () { ...@@ -284,7 +284,7 @@ describe('audioManagerApi9', function () {
* @tc.level : Level 3 * @tc.level : Level 3
*/ */
it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_GETMAXVOLUME_0100', 3, async function (done) { it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_GETMAXVOLUME_0100', 3, async function (done) {
try{ try {
let audioVolumeManager = audioManager.getVolumeManager(); let audioVolumeManager = audioManager.getVolumeManager();
let groupManager = await audioVolumeManager.getVolumeGroupManager(audio.DEFAULT_VOLUME_GROUP_ID); let groupManager = await audioVolumeManager.getVolumeGroupManager(audio.DEFAULT_VOLUME_GROUP_ID);
groupManager.getMaxVolume(audio.AudioVolumeType.RINGTONE, (err, data) => { groupManager.getMaxVolume(audio.AudioVolumeType.RINGTONE, (err, data) => {
...@@ -304,8 +304,8 @@ describe('audioManagerApi9', function () { ...@@ -304,8 +304,8 @@ describe('audioManagerApi9', function () {
} }
done(); done();
}); });
}catch(err){ } catch (err) {
console.info('audioManagerApi9Test: getVolumeGroupManager : err:'+ err.message); console.info('audioManagerApi9Test: getVolumeGroupManager : err:' + err.message);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
...@@ -320,7 +320,7 @@ describe('audioManagerApi9', function () { ...@@ -320,7 +320,7 @@ describe('audioManagerApi9', function () {
* @tc.level : Level 3 * @tc.level : Level 3
*/ */
it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_GETMAXVOLUME_0200', 3, async function (done) { it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_GETMAXVOLUME_0200', 3, async function (done) {
try{ try {
let audioVolumeManager = audioManager.getVolumeManager(); let audioVolumeManager = audioManager.getVolumeManager();
let groupManager = await audioVolumeManager.getVolumeGroupManager(audio.DEFAULT_VOLUME_GROUP_ID); let groupManager = await audioVolumeManager.getVolumeGroupManager(audio.DEFAULT_VOLUME_GROUP_ID);
let maxVolume = await groupManager.getMaxVolume(audio.AudioVolumeType.RINGTONE); let maxVolume = await groupManager.getMaxVolume(audio.AudioVolumeType.RINGTONE);
...@@ -332,8 +332,8 @@ describe('audioManagerApi9', function () { ...@@ -332,8 +332,8 @@ describe('audioManagerApi9', function () {
console.info('audioManagerApi9Test: promise : Ringtone getMaxVolume: FAIL :' + maxVolume); console.info('audioManagerApi9Test: promise : Ringtone getMaxVolume: FAIL :' + maxVolume);
expect(false).assertTrue(); expect(false).assertTrue();
} }
}catch(err){ } catch (err) {
console.info('audioManagerApi9Test: getVolumeGroupManager : err:'+ err.message); console.info('audioManagerApi9Test: getVolumeGroupManager : err:' + err.message);
expect(false).assertTrue(); expect(false).assertTrue();
} }
done(); done();
...@@ -348,7 +348,7 @@ describe('audioManagerApi9', function () { ...@@ -348,7 +348,7 @@ describe('audioManagerApi9', function () {
* @tc.level : Level 2 * @tc.level : Level 2
*/ */
it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_GETMINVOLUME_0100', 2, async function (done) { it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_GETMINVOLUME_0100', 2, async function (done) {
try{ try {
let audioVolumeManager = audioManager.getVolumeManager(); let audioVolumeManager = audioManager.getVolumeManager();
let groupManager = await audioVolumeManager.getVolumeGroupManager(audio.DEFAULT_VOLUME_GROUP_ID); let groupManager = await audioVolumeManager.getVolumeGroupManager(audio.DEFAULT_VOLUME_GROUP_ID);
groupManager.getMinVolume(audio.AudioVolumeType.RINGTONE, (err, data) => { groupManager.getMinVolume(audio.AudioVolumeType.RINGTONE, (err, data) => {
...@@ -368,8 +368,8 @@ describe('audioManagerApi9', function () { ...@@ -368,8 +368,8 @@ describe('audioManagerApi9', function () {
} }
done(); done();
}); });
}catch(err){ } catch (err) {
console.info('audioManagerApi9Test: getVolumeGroupManager : err:'+ err.message); console.info('audioManagerApi9Test: getVolumeGroupManager : err:' + err.message);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
...@@ -384,7 +384,7 @@ describe('audioManagerApi9', function () { ...@@ -384,7 +384,7 @@ describe('audioManagerApi9', function () {
* @tc.level : Level 3 * @tc.level : Level 3
*/ */
it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_GETMINVOLUME_0200', 3, async function (done) { it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_GETMINVOLUME_0200', 3, async function (done) {
try{ try {
let audioVolumeManager = audioManager.getVolumeManager(); let audioVolumeManager = audioManager.getVolumeManager();
let groupManager = await audioVolumeManager.getVolumeGroupManager(audio.DEFAULT_VOLUME_GROUP_ID); let groupManager = await audioVolumeManager.getVolumeGroupManager(audio.DEFAULT_VOLUME_GROUP_ID);
let minVolume = await groupManager.getMinVolume(audio.AudioVolumeType.RINGTONE); let minVolume = await groupManager.getMinVolume(audio.AudioVolumeType.RINGTONE);
...@@ -396,8 +396,8 @@ describe('audioManagerApi9', function () { ...@@ -396,8 +396,8 @@ describe('audioManagerApi9', function () {
console.info('audioManagerApi9Test: promise : Ringtone getMinVolume: FAIL :' + minVolume); console.info('audioManagerApi9Test: promise : Ringtone getMinVolume: FAIL :' + minVolume);
expect(false).assertTrue(); expect(false).assertTrue();
} }
}catch(err){ } catch (err) {
console.info('audioManagerApi9Test: getVolumeGroupManager : err:'+ err.message); console.info('audioManagerApi9Test: getVolumeGroupManager : err:' + err.message);
expect(false).assertTrue(); expect(false).assertTrue();
} }
done(); done();
...@@ -413,23 +413,23 @@ describe('audioManagerApi9', function () { ...@@ -413,23 +413,23 @@ describe('audioManagerApi9', function () {
*/ */
it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_ISMUTE_0100', 3, async function (done) { it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_ISMUTE_0100', 3, async function (done) {
let groupManager; let groupManager;
try{ try {
let audioVolumeManager = audioManager.getVolumeManager(); let audioVolumeManager = audioManager.getVolumeManager();
groupManager = await audioVolumeManager.getVolumeGroupManager(audio.DEFAULT_VOLUME_GROUP_ID); groupManager = await audioVolumeManager.getVolumeGroupManager(audio.DEFAULT_VOLUME_GROUP_ID);
}catch(err){ } catch (err) {
console.info('audioManagerApi9Test: getGroupManager mute : parameter err:'+ err.message); console.info('audioManagerApi9Test: getGroupManager mute : parameter err:' + err.message);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
groupManager.isMute(audio.AudioVolumeType.RINGTONE, (err, data)=>{ groupManager.isMute(audio.AudioVolumeType.RINGTONE, (err, data) => {
if (err) { if (err) {
console.error(`audioManagerApi9Test: failed to isMute : Callback: ${err.message}`); console.error(`audioManagerApi9Test: failed to isMute : Callback: ${err.message}`);
expect(false).assertTrue(); expect(false).assertTrue();
} }
else { else {
console.log(`audioManagerApi9Test: Promise: console.log(`audioManagerApi9Test: Promise:
Is Stream GroupManager Mute RINGTONE: FALSE: PASS:`+data); Is Stream GroupManager Mute RINGTONE: FALSE: PASS:`+ data);
expect(true).assertTrue(); expect(true).assertTrue();
} }
done(); done();
...@@ -445,12 +445,12 @@ describe('audioManagerApi9', function () { ...@@ -445,12 +445,12 @@ describe('audioManagerApi9', function () {
* @tc.level : Level 3 * @tc.level : Level 3
*/ */
it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_ISMUTE_0200', 3, async function (done) { it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_ISMUTE_0200', 3, async function (done) {
try{ try {
let audioVolumeManager = audioManager.getVolumeManager(); let audioVolumeManager = audioManager.getVolumeManager();
let groupManager = await audioVolumeManager.getVolumeGroupManager(audio.DEFAULT_VOLUME_GROUP_ID); let groupManager = await audioVolumeManager.getVolumeGroupManager(audio.DEFAULT_VOLUME_GROUP_ID);
await groupManager.isMute(audio.AudioVolumeType.RINGTONE).then(function (data) { await groupManager.isMute(audio.AudioVolumeType.RINGTONE).then(function (data) {
console.log(`audioManagerApi9Test: Promise: console.log(`audioManagerApi9Test: Promise:
Is Stream GroupManager Mute RINGTONE: FALSE: PASS:`+data); Is Stream GroupManager Mute RINGTONE: FALSE: PASS:`+ data);
expect(true).assertTrue(); expect(true).assertTrue();
done(); done();
}).catch((err) => { }).catch((err) => {
...@@ -459,8 +459,8 @@ describe('audioManagerApi9', function () { ...@@ -459,8 +459,8 @@ describe('audioManagerApi9', function () {
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
}); });
}catch(err){ } catch (err) {
console.info('audioManagerApi9Test: getGroupManager ismute : parameter err:'+ err.message); console.info('audioManagerApi9Test: getGroupManager ismute : parameter err:' + err.message);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
...@@ -468,17 +468,25 @@ describe('audioManagerApi9', function () { ...@@ -468,17 +468,25 @@ describe('audioManagerApi9', function () {
/** /**
*@tc.number : SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_ON_VOLUMECHANGE_0100 *@tc.number : SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_ON_VOLUMECHANGE_0100
*@tc.name : OnVolumeChange - setVolume - MEDIA *@tc.name : OnVolumeChange - setVolume - RINGTONE
*@tc.desc : OnVolumeChange - setVolume - MEDIA *@tc.desc : OnVolumeChange - setVolume - RINGTONE
*@tc.size : MEDIUM *@tc.size : MEDIUM
*@tc.type : Function *@tc.type : Function
*@tc.level : Level 3 *@tc.level : Level 3
*/ */
it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_ON_VOLUMECHANGE_0100', 3, async function (done) { it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_ON_VOLUMECHANGE_0100', 3, async function (done) {
let audioVolumeManager = audioManager.getVolumeManager(); let audioVolumeManager = audioManager.getVolumeManager();
audioVolumeManager.on('volumeChange', (VolumeEvent) => {}); await audioManager.setVolume(audio.AudioVolumeType.RINGTONE, 7);
expect(true).assertTrue(); audioVolumeManager.on('volumeChange', (VolumeEvent) => {
console.info('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_ON_VOLUMECHANGE_0100 AudioVolumeType is ' + VolumeEvent.volumeType)
console.info('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_ON_VOLUMECHANGE_0100 volume is ' + VolumeEvent.volume)
console.info('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_ON_VOLUMECHANGE_0100 updateUi is ' + VolumeEvent.updateUi)
expect(VolumeEvent.volumeType).assertEqual(2);
expect(VolumeEvent.volume).assertEqual(11);
expect(VolumeEvent.updateUi).assertEqual(false);
done(); done();
});
await audioManager.setVolume(audio.AudioVolumeType.RINGTONE, 11);
}) })
/** /**
...@@ -491,30 +499,30 @@ describe('audioManagerApi9', function () { ...@@ -491,30 +499,30 @@ describe('audioManagerApi9', function () {
*/ */
it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_GETRINGERMODE_0100', 3, async function (done) { it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_GETRINGERMODE_0100', 3, async function (done) {
let groupManager; let groupManager;
try{ try {
let audioVolumeManager = audioManager.getVolumeManager(); let audioVolumeManager = audioManager.getVolumeManager();
groupManager = await audioVolumeManager.getVolumeGroupManager(audio.DEFAULT_VOLUME_GROUP_ID); groupManager = await audioVolumeManager.getVolumeGroupManager(audio.DEFAULT_VOLUME_GROUP_ID);
}catch(err){ } catch (err) {
console.info('audioManagerApi9Test: getGroupManager mute : parameter err:'+ err.message); console.info('audioManagerApi9Test: getGroupManager mute : parameter err:' + err.message);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
groupManager.getRingerMode((err, data)=>{ groupManager.getRingerMode((err, data) => {
if (err) { if (err) {
console.error(`audioManagerApi9Test: failed to getRingerMode : Callback: ${err.message}`); console.error(`audioManagerApi9Test: failed to getRingerMode : Callback: ${err.message}`);
expect(false).assertTrue(); expect(false).assertTrue();
} }
else { else {
if( data == audio.AudioRingMode.RINGER_MODE_SILENT || if (data == audio.AudioRingMode.RINGER_MODE_SILENT ||
data == audio.AudioRingMode.RINGER_MODE_VIBRATE || data == audio.AudioRingMode.RINGER_MODE_VIBRATE ||
data == audio.AudioRingMode.RINGER_MODE_NORMAL){ data == audio.AudioRingMode.RINGER_MODE_NORMAL) {
console.log(`audioManagerApi9Test: Promise: console.log(`audioManagerApi9Test: Promise:
getRingerMode : PASS:`+data); getRingerMode : PASS:`+ data);
expect(true).assertTrue(); expect(true).assertTrue();
} }
else{ else {
console.log(`audioManagerApi9Test: Promise: console.log(`audioManagerApi9Test: Promise:
getRingerMode : FAIL: `+data); getRingerMode : FAIL: `+ data);
expect(false).assertTrue(); expect(false).assertTrue();
} }
} }
...@@ -563,7 +571,7 @@ describe('audioManagerApi9', function () { ...@@ -563,7 +571,7 @@ describe('audioManagerApi9', function () {
try { try {
let audioVolumeManager = audioManager.getVolumeManager(); let audioVolumeManager = audioManager.getVolumeManager();
let groupManager = await audioVolumeManager.getVolumeGroupManager(audio.DEFAULT_VOLUME_GROUP_ID); let groupManager = await audioVolumeManager.getVolumeGroupManager(audio.DEFAULT_VOLUME_GROUP_ID);
groupManager.on('ringerModeChange', (AudioRingMode) => {}); groupManager.on('ringerModeChange', (AudioRingMode) => { });
expect(true).assertTrue(); expect(true).assertTrue();
done(); done();
} catch (err) { } catch (err) {
...@@ -584,13 +592,13 @@ describe('audioManagerApi9', function () { ...@@ -584,13 +592,13 @@ describe('audioManagerApi9', function () {
it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_SETMICROPHONEMUTE_0100', 3, async function (done) { it('SUB_MULTIMEDIA_AUDIO_VOLUME_GROUP_MANAGER_SETMICROPHONEMUTE_0100', 3, async function (done) {
let audioVolumeManager = audioManager.getVolumeManager(); let audioVolumeManager = audioManager.getVolumeManager();
let groupManager = await audioVolumeManager.getVolumeGroupManager(audio.DEFAULT_VOLUME_GROUP_ID); let groupManager = await audioVolumeManager.getVolumeGroupManager(audio.DEFAULT_VOLUME_GROUP_ID);
groupManager.setMicrophoneMute(true,(err, data)=>{ groupManager.setMicrophoneMute(true, (err, data) => {
if (err) { if (err) {
console.error(`audioManagerApi9Test: failed to setMicrophoneMute : Callback: ${err.message}`); console.error(`audioManagerApi9Test: failed to setMicrophoneMute : Callback: ${err.message}`);
expect(false).assertTrue(); expect(false).assertTrue();
} }
else { else {
groupManager.isMicrophoneMute((err, data)=>{ groupManager.isMicrophoneMute((err, data) => {
if (err) { if (err) {
console.error(`audioManagerApi9Test: failed to isMicrophoneMute : Callback: ${err.message}`); console.error(`audioManagerApi9Test: failed to isMicrophoneMute : Callback: ${err.message}`);
expect(false).assertTrue(); expect(false).assertTrue();
...@@ -663,7 +671,7 @@ describe('audioManagerApi9', function () { ...@@ -663,7 +671,7 @@ describe('audioManagerApi9', function () {
if (MicStateChangeEvent.mute == true) { if (MicStateChangeEvent.mute == true) {
console.info(`${TagFrmwk}: MEDIA CallBack : PASS : ${MicStateChangeEvent.mute}`); console.info(`${TagFrmwk}: MEDIA CallBack : PASS : ${MicStateChangeEvent.mute}`);
expect(true).assertTrue(); expect(true).assertTrue();
}else{ } else {
console.info(`${TagFrmwk}: Audio MicStateChangeEvent is : ${MicStateChangeEvent}`); console.info(`${TagFrmwk}: Audio MicStateChangeEvent is : ${MicStateChangeEvent}`);
expect(false).assertTrue(); expect(false).assertTrue();
} }
...@@ -747,7 +755,7 @@ describe('audioManagerApi9', function () { ...@@ -747,7 +755,7 @@ describe('audioManagerApi9', function () {
console.info(`SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_SETCOMMUNICATIONDEVICE_0100 console.info(`SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_SETCOMMUNICATIONDEVICE_0100
outputDeviceDescription is ${JSON.stringify(outputDeviceDescription)}`); outputDeviceDescription is ${JSON.stringify(outputDeviceDescription)}`);
if (outputDeviceDescription.length == 1 && if (outputDeviceDescription.length == 1 &&
outputDeviceDescription[0].deviceType== audio.DeviceType.SPEAKER) { outputDeviceDescription[0].deviceType == audio.DeviceType.SPEAKER) {
flag = false; flag = false;
} }
await AudioRoutingManager.setCommunicationDevice(2, false).then(() => { await AudioRoutingManager.setCommunicationDevice(2, false).then(() => {
...@@ -757,17 +765,17 @@ describe('audioManagerApi9', function () { ...@@ -757,17 +765,17 @@ describe('audioManagerApi9', function () {
await AudioRoutingManager.isCommunicationDeviceActive(audio.ActiveDeviceType.SPEAKER).then(function (value) { await AudioRoutingManager.isCommunicationDeviceActive(audio.ActiveDeviceType.SPEAKER).then(function (value) {
if (flag == true && value == false) { if (flag == true && value == false) {
console.info(`SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_SETCOMMUNICATIONDEVICE_0100 console.info(`SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_SETCOMMUNICATIONDEVICE_0100
isCommunicationDeviceActive : SPEAKER: Deactivate : PASS :${value } flag is ${flag}`); isCommunicationDeviceActive : SPEAKER: Deactivate : PASS :${value} flag is ${flag}`);
expect(true).assertTrue(); expect(true).assertTrue();
} }
else if (flag == false && value == true) { else if (flag == false && value == true) {
console.info(`SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_SETCOMMUNICATIONDEVICE_0100 console.info(`SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_SETCOMMUNICATIONDEVICE_0100
isCommunicationDeviceActive : SPEAKER: Deactivate : PASS :${value } flag is ${flag}`); isCommunicationDeviceActive : SPEAKER: Deactivate : PASS :${value} flag is ${flag}`);
expect(true).assertTrue(); expect(true).assertTrue();
} }
else { else {
console.info(`SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_SETCOMMUNICATIONDEVICE_0100 console.info(`SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_SETCOMMUNICATIONDEVICE_0100
isCommunicationDeviceActive : SPEAKER: Deactivate : fail :${value } flag is ${flag}`); isCommunicationDeviceActive : SPEAKER: Deactivate : fail :${value} flag is ${flag}`);
expect(false).assertTrue(); expect(false).assertTrue();
} }
}).catch((err) => { }).catch((err) => {
...@@ -789,7 +797,7 @@ describe('audioManagerApi9', function () { ...@@ -789,7 +797,7 @@ describe('audioManagerApi9', function () {
*@tc.type : Function *@tc.type : Function
*@tc.level : Level 2 *@tc.level : Level 2
*/ */
it('SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_SETCOMMUNICATIONDEVICE_0200', 2,async function (done) { it('SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_SETCOMMUNICATIONDEVICE_0200', 2, async function (done) {
let flag = true let flag = true
let AudioRoutingManager = audioManager.getRoutingManager(); let AudioRoutingManager = audioManager.getRoutingManager();
let outputDeviceDescription = await AudioRoutingManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG); let outputDeviceDescription = await AudioRoutingManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG);
...@@ -810,14 +818,14 @@ describe('audioManagerApi9', function () { ...@@ -810,14 +818,14 @@ describe('audioManagerApi9', function () {
console.error(`${TagFrmwk}: Device Test: Callback : isCommunicationDeviceActive : SPEAKER: Deactivate: Error: ${err.message}`); console.error(`${TagFrmwk}: Device Test: Callback : isCommunicationDeviceActive : SPEAKER: Deactivate: Error: ${err.message}`);
expect(false).assertTrue(); expect(false).assertTrue();
} else if (value == false && flag == true) { } else if (value == false && flag == true) {
console.info(`${TagFrmwk}: Device Test: Callback : isCommunicationDeviceActive : SPEAKER: Deactivate : PASS :${value } flag is ${flag}`); console.info(`${TagFrmwk}: Device Test: Callback : isCommunicationDeviceActive : SPEAKER: Deactivate : PASS :${value} flag is ${flag}`);
expect(true).assertTrue(); expect(true).assertTrue();
} else if (value == true && flag == false) { } else if (value == true && flag == false) {
console.info(`${TagFrmwk}: Device Test: Callback : isCommunicationDeviceActive : SPEAKER: Deactivate : PASS :${value } flag is ${flag}`); console.info(`${TagFrmwk}: Device Test: Callback : isCommunicationDeviceActive : SPEAKER: Deactivate : PASS :${value} flag is ${flag}`);
expect(true).assertTrue(); expect(true).assertTrue();
} }
else { else {
console.info(`SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_SETCOMMUNICATIONDEVICE_0200 ${TagFrmwk}: Device Test: Callback : isCommunicationDeviceActive : SPEAKER: Deactivate : FAIL :${value } flag is ${flag}`); console.info(`SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_SETCOMMUNICATIONDEVICE_0200 ${TagFrmwk}: Device Test: Callback : isCommunicationDeviceActive : SPEAKER: Deactivate : FAIL :${value} flag is ${flag}`);
expect(false).assertTrue(); expect(false).assertTrue();
} }
done(); done();
...@@ -968,5 +976,5 @@ describe('audioManagerApi9', function () { ...@@ -968,5 +976,5 @@ describe('audioManagerApi9', function () {
done(); done();
}) })
}) })
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册