提交 3b5d5f2d 编写于 作者: Q qinliwen

<audio xts修改>

Signed-off-by: Nqinliwen <qinliwen3@huawei.com>
上级 b5ba4a85
...@@ -3150,7 +3150,7 @@ describe('audioManager', function () { ...@@ -3150,7 +3150,7 @@ describe('audioManager', function () {
} }
else { else {
console.log('AudioFrameworkTest: Set Stream Mute: Media: Callback : TRUE'); console.log('AudioFrameworkTest: Set Stream Mute: Media: Callback : TRUE');
audioManager.getVolume(audioMedia, (err, value) => { audioManager.getVolume(audioMedia, async (err, value) => {
if (err) { if (err) {
console.error(`Failed to obtain the volume. ${err.message}`); console.error(`Failed to obtain the volume. ${err.message}`);
expect(false).assertTrue(); expect(false).assertTrue();
...@@ -3242,7 +3242,7 @@ describe('audioManager', function () { ...@@ -3242,7 +3242,7 @@ describe('audioManager', function () {
} }
else { else {
console.log('AudioFrameworkTest: Set Stream Mute: Ringtone: Callback : SetVolume'); console.log('AudioFrameworkTest: Set Stream Mute: Ringtone: Callback : SetVolume');
audioManager.getVolume(audioRingtone, (err, value) => { audioManager.getVolume(audioRingtone, async (err, value) => {
if (err) { if (err) {
console.error(`Failed to obtain the volume. ${err.message}`); console.error(`Failed to obtain the volume. ${err.message}`);
expect(false).assertTrue(); expect(false).assertTrue();
...@@ -3334,7 +3334,7 @@ describe('audioManager', function () { ...@@ -3334,7 +3334,7 @@ describe('audioManager', function () {
} }
else { else {
console.log('AudioFrameworkTest: Set Stream Mute: VOICE_CALL: Callback : SetVolume'); console.log('AudioFrameworkTest: Set Stream Mute: VOICE_CALL: Callback : SetVolume');
audioManager.getVolume(audio.AudioVolumeType.VOICE_CALL, (err, value) => { audioManager.getVolume(audio.AudioVolumeType.VOICE_CALL, async (err, value) => {
if (err) { if (err) {
console.error(`Failed to obtain the volume. ${err.message}`); console.error(`Failed to obtain the volume. ${err.message}`);
expect(false).assertTrue(); expect(false).assertTrue();
...@@ -3428,6 +3428,13 @@ describe('audioManager', function () { ...@@ -3428,6 +3428,13 @@ describe('audioManager', function () {
console.log('AudioFrameworkTest: Set Stream Mute: VOICE_ASSISTANT: Callback : SetVolume'); console.log('AudioFrameworkTest: Set Stream Mute: VOICE_ASSISTANT: Callback : SetVolume');
await audioManager.getVolume(audio.AudioVolumeType.VOICE_ASSISTANT).then((value) => { await audioManager.getVolume(audio.AudioVolumeType.VOICE_ASSISTANT).then((value) => {
if (value == 0) { if (value == 0) {
console.info("AudioFrameworkTest: value is " + value);
expect(true).assertTrue();
}
else {
expect(false).assertTrue();
}
});
await audioManager.setVolume(audio.AudioVolumeType.VOICE_ASSISTANT, lowVol); await audioManager.setVolume(audio.AudioVolumeType.VOICE_ASSISTANT, lowVol);
audioManager.isMute(audio.AudioVolumeType.VOICE_ASSISTANT, (err, data) => { audioManager.isMute(audio.AudioVolumeType.VOICE_ASSISTANT, (err, data) => {
if (err) { if (err) {
...@@ -3442,12 +3449,7 @@ describe('audioManager', function () { ...@@ -3442,12 +3449,7 @@ describe('audioManager', function () {
console.log('AudioFrameworkTest: Callback : Is Stream Mute VOICE_ASSISTANT: SetVolume: FAIL: ' + data); console.log('AudioFrameworkTest: Callback : Is Stream Mute VOICE_ASSISTANT: SetVolume: FAIL: ' + data);
expect(false).assertTrue(); expect(false).assertTrue();
} }
}); done();
}
else {
console.info(`AudioFrameworkTest: mute fail: value ${value}`);
expect(false).assertTrue();
}
}); });
} }
done(); done();
......
...@@ -7206,7 +7206,6 @@ describe('audioRenderer', function () { ...@@ -7206,7 +7206,6 @@ describe('audioRenderer', function () {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_AUDIO_RENDERER_Play_audio_108', 0, async function (done) { it('SUB_AUDIO_RENDERER_Play_audio_108', 0, async function (done) {
expect(audio.AudioState.STATE_INVALID).assertEqual(-1); expect(audio.AudioState.STATE_INVALID).assertEqual(-1);
await sleep(50); await sleep(50);
done(); done();
...@@ -7221,7 +7220,6 @@ describe('audioRenderer', function () { ...@@ -7221,7 +7220,6 @@ describe('audioRenderer', function () {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_AUDIO_RENDERER_Play_audio_109', 0, async function (done) { it('SUB_AUDIO_RENDERER_Play_audio_109', 0, async function (done) {
expect(audio.AudioState.STATE_NEW).assertEqual(0); expect(audio.AudioState.STATE_NEW).assertEqual(0);
await sleep(50); await sleep(50);
done(); done();
...@@ -7236,7 +7234,6 @@ describe('audioRenderer', function () { ...@@ -7236,7 +7234,6 @@ describe('audioRenderer', function () {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_AUDIO_RENDERER_Play_audio_110', 0, async function (done) { it('SUB_AUDIO_RENDERER_Play_audio_110', 0, async function (done) {
expect(audio.AudioSampleFormat.SAMPLE_FORMAT_INVALID).assertEqual(-1); expect(audio.AudioSampleFormat.SAMPLE_FORMAT_INVALID).assertEqual(-1);
await sleep(50); await sleep(50);
done(); done();
...@@ -7251,7 +7248,6 @@ describe('audioRenderer', function () { ...@@ -7251,7 +7248,6 @@ describe('audioRenderer', function () {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_AUDIO_RENDERER_Play_audio_111', 0, async function (done) { it('SUB_AUDIO_RENDERER_Play_audio_111', 0, async function (done) {
expect(audio.SourceType.SOURCE_TYPE_INVALID).assertEqual(-1); expect(audio.SourceType.SOURCE_TYPE_INVALID).assertEqual(-1);
await sleep(50); await sleep(50);
done(); done();
...@@ -7371,7 +7367,6 @@ describe('audioRenderer', function () { ...@@ -7371,7 +7367,6 @@ describe('audioRenderer', function () {
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_AUDIO_RENDERER_Play_audio_114', 0, async function (done) { it('SUB_AUDIO_RENDERER_Play_audio_114', 0, async function (done) {
expect(audio.AudioEncodingType.ENCODING_TYPE_INVALID).assertEqual(-1); expect(audio.AudioEncodingType.ENCODING_TYPE_INVALID).assertEqual(-1);
await sleep(50); await sleep(50);
done(); done();
...@@ -7403,10 +7398,12 @@ describe('audioRenderer', function () { ...@@ -7403,10 +7398,12 @@ describe('audioRenderer', function () {
let mode = audio.InterruptMode.SHARE_MODE; let mode = audio.InterruptMode.SHARE_MODE;
audioRenderer.setInterruptMode(mode, (err, data) => { audioRenderer.setInterruptMode(mode, (err, data) => {
if (err) { if (err) {
console.info(`AudioFrameworkRenderLog: SetInterruptMode SHARE_MODE CALLBACK: error: ${err.message}`);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
return; return;
} }
console.info(`AudioFrameworkRenderLog: SetInterruptMode SHARE_MODE CALLBACK: SUCCESS`);
expect(true).assertTrue(); expect(true).assertTrue();
done(); done();
}) })
...@@ -7438,10 +7435,12 @@ describe('audioRenderer', function () { ...@@ -7438,10 +7435,12 @@ describe('audioRenderer', function () {
let mode = audio.InterruptMode.INDEPENDENT_MODE; let mode = audio.InterruptMode.INDEPENDENT_MODE;
audioRenderer.setInterruptMode(mode, (err, data) => { audioRenderer.setInterruptMode(mode, (err, data) => {
if (err) { if (err) {
console.info(`AudioFrameworkRenderLog: SetInterruptMode INDEPENDENT_MODE CALLBACK: error: ${err.message}`);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
return; return;
} }
console.info(`AudioFrameworkRenderLog: SetInterruptMode INDEPENDENT_MODE CALLBACK: SUCCESS`);
expect(true).assertTrue(); expect(true).assertTrue();
done(); done();
}) })
...@@ -7472,9 +7471,11 @@ describe('audioRenderer', function () { ...@@ -7472,9 +7471,11 @@ describe('audioRenderer', function () {
let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); let audioRenderer = await audio.createAudioRenderer(audioRendererOptions);
let mode = audio.InterruptMode.SHARE_MODE; let mode = audio.InterruptMode.SHARE_MODE;
audioRenderer.setInterruptMode(mode).then(data => { audioRenderer.setInterruptMode(mode).then(data => {
console.info(`AudioFrameworkRenderLog: SetInterruptMode SHARE_MODE PROMISE: SUCCESS`);
expect(true).assertTrue(); expect(true).assertTrue();
done(); done();
}).catch(err => { }).catch(err => {
console.info(`AudioFrameworkRenderLog: SetInterruptMode SHARE_MODE PROMISE: error: ${err.message}`);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
}) })
...@@ -7505,9 +7506,11 @@ describe('audioRenderer', function () { ...@@ -7505,9 +7506,11 @@ describe('audioRenderer', function () {
let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); let audioRenderer = await audio.createAudioRenderer(audioRendererOptions);
let mode = audio.InterruptMode.INDEPENDENT_MODE; let mode = audio.InterruptMode.INDEPENDENT_MODE;
audioRenderer.setInterruptMode(mode).then(data => { audioRenderer.setInterruptMode(mode).then(data => {
console.info(`AudioFrameworkRenderLog: SetInterruptMode INDEPENDENT_MODE PROMISE: SUCCESS`);
expect(true).assertTrue(); expect(true).assertTrue();
done(); done();
}).catch(err => { }).catch(err => {
console.info(`AudioFrameworkRenderLog: SetInterruptMode INDEPENDENT_MODE PROMISE: error: ${err.message}`);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
}) })
...@@ -7539,17 +7542,19 @@ describe('audioRenderer', function () { ...@@ -7539,17 +7542,19 @@ describe('audioRenderer', function () {
let mode = '1'; let mode = '1';
try { try {
let data = await audioRenderer.setInterruptMode(mode); let data = await audioRenderer.setInterruptMode(mode);
console.info(`AudioFrameworkRenderLog: SetInterruptMode STRING PROMISE: SUCCESS`);
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} catch (err) { } catch (err) {
expect('assertion (false) failed: type mismatch').assertEqual(err.message); console.info(`AudioFrameworkRenderLog: SetInterruptMode STRING PROMISE: error: ${err.message}`);
expect(true).assertTrue();
done(); done();
} }
}) })
/* /*
* @tc.name:SUB_AUDIO_SetInterruptMode_006 * @tc.name:SUB_AUDIO_SetInterruptMode_006
* @tc.desc:SetInterruptMode mode 2,will catch error with out of border * @tc.desc:SetInterruptMode mode 2,set it to default SHARE_MODE
* @tc.type: FUNC * @tc.type: FUNC
* @tc.require: Issue Number * @tc.require: Issue Number
*/ */
...@@ -7572,11 +7577,13 @@ describe('audioRenderer', function () { ...@@ -7572,11 +7577,13 @@ describe('audioRenderer', function () {
let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); let audioRenderer = await audio.createAudioRenderer(audioRendererOptions);
let mode = 2; let mode = 2;
try { try {
let data = await audioRenderer.setInterruptMode(mode) let data = await audioRenderer.setInterruptMode(mode);
expect(false).assertTrue(); console.info(`AudioFrameworkRenderLog: SetInterruptMode OUT OF BORDER PROMISE: SUCCESS`);
expect(true).assertTrue();
done(); done();
} catch (err) { } catch (err) {
expect(err).assertEqual(undefined); console.info(`AudioFrameworkRenderLog: SetInterruptMode OUT OF BORDER PROMISE: ERROR: ${err.message}`);
expect(false).assertTrue();
done(); done();
} }
}) })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册