提交 500e234a 编写于 作者: L lwx1121892

<audio新增接口>

Signed-off-by: Nlwx1121892 <liuxueqi3@huawei.com>
上级 828d5131
......@@ -2415,6 +2415,108 @@ describe('audioCapturer', function () {
done();
})
/**
*@tc.number : SUB_MULTIMEDIA_AUDIO_REC_PR_VOICE_CHAT_GET_CAPTURER_StreamId_ENUM_0100
*@tc.name : AudioRec-Set1
*@tc.desc : record audio with parameter set 1
*@tc.size : MEDIUM
*@tc.type : Function
*@tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AUDIO_REC_PR_VOICE_CHAT_GET_CAPTURER_StreamId_ENUM_0100', 2, async function (done) {
let audioStreamInfo44100 = {
samplingRate: 44100,
channels: 1,
sampleFormat: 1,
encodingType: 0,
};
let audioCapturerInfo44100 = {
source: 0,
capturerFlags: 0
}
let AudioCapturerOptions = {
streamInfo: audioStreamInfo44100,
capturerInfo: audioCapturerInfo44100,
}
let audioCap;
try {
audioCap = await audio.createAudioCapturer(AudioCapturerOptions);
} catch (err) {
console.log(`${Tag} createAudioCapturer err: ${JSON.stringify(err)}`);
expect(false).assertTrue();
return done();
}
try {
let audioParamsGet = await audioCap.getAudioStreamId();
console.info(`${Tag} SUB_MULTIMEDIA_AUDIO_REC_PR_VOICE_CHAT_GET_CAPTURER_StreamId_ENUM_0100: Capturer CapturerInfo: ${JSON.stringify(audioParamsGet)}`);
} catch (err) {
console.log(`${Tag} SUB_MULTIMEDIA_AUDIO_REC_PR_VOICE_CHAT_GET_CAPTURER_StreamId_ENUM_0100 err: ${JSON.stringify(err)}`);
expect(false).assertTrue();
}
try {
await audioCap.release();
} catch (err) {
console.log(`${Tag} SUB_MULTIMEDIA_AUDIO_REC_PR_VOICE_CHAT_GET_CAPTURER_StreamId_ENUM_0100 err: ${JSON.stringify(err)}`);
expect(false).assertTrue();
}
done();
})
/**
*@tc.number : SUB_MULTIMEDIA_AUDIO_REC_PR_VOICE_CHAT_GET_CAPTURER_StreamId_ENUM_0200
*@tc.name : AudioRec-Set1
*@tc.desc : record audio with parameter set 1
*@tc.size : MEDIUM
*@tc.type : Function
*@tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AUDIO_REC_PR_VOICE_CHAT_GET_CAPTURER_StreamId_ENUM_0200', 2, async function (done) {
let audioStreamInfo44100 = {
samplingRate: 44100,
channels: 1,
sampleFormat: 1,
encodingType: 0,
};
let audioCapturerInfo44100 = {
source: 0,
capturerFlags: 0
}
let AudioCapturerOptions = {
streamInfo: audioStreamInfo44100,
capturerInfo: audioCapturerInfo44100,
}
let audioCap;
try {
audioCap = await audio.createAudioCapturer(AudioCapturerOptions);
} catch (err) {
console.log(`${Tag} createAudioCapturer err: ${JSON.stringify(err)}`);
expect(false).assertTrue();
return done();
}
await audioCap.getAudioStreamId((err, data) => {
if (err) {
console.info(`${TagFrmwkRender}: SUB_MULTIMEDIA_AUDIO_REC_PR_VOICE_CHAT_GET_CAPTURER_StreamId_ENUM_0200 CALLBACK: error: ${err.message}`);
expect(false).assertTrue();
done();
return;
}
console.info(`${TagFrmwkRender}:SUB_MULTIMEDIA_AUDIO_REC_PR_VOICE_CHAT_GET_CAPTURER_StreamId_ENUM_0200 CALLBACK: SUCCESS ${data}`);
expect(true).assertTrue();
done();
})
try {
await audioCap.release();
} catch (err) {
console.log(`${Tag} SUB_MULTIMEDIA_AUDIO_REC_PR_VOICE_CHAT_GET_CAPTURER_StreamId_ENUM_0200 err: ${JSON.stringify(err)}`);
expect(false).assertTrue();
}
done();
})
/**
*@tc.number : SUB_MULTIMEDIA_AUDIO_REC_VOICE_CHAT_PR_ENUM_AUDIO_STREAM_INFO_INVALID_0100
*@tc.name : AudioRec-Set1
......
......@@ -8137,4 +8137,76 @@ describe('audioRenderer', function () {
done();
}
})
/*
* @tc.name:SUB_MULTIMEDIA_AUDIO_getAudioStreamId_0600
* @tc.desc:getAudioStreamId mode 2,set it to default SHARE_MODE
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it("SUB_MULTIMEDIA_AUDIO_getAudioStreamId_0100", 2, async function (done) {
let audioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000,
channels: audio.AudioChannel.CHANNEL_1,
sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE,
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
}
let audioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_MUSIC,
usage: audio.StreamUsage.STREAM_USAGE_MEDIA,
rendererFlags: 0
}
let audioRendererOptions = {
streamInfo: audioStreamInfo,
rendererInfo: audioRendererInfo
}
let audioRenderer = await audio.createAudioRenderer(audioRendererOptions);
try {
let data = await audioRenderer.getAudioStreamId();
console.info(`${TagFrmwkRender}: SUB_MULTIMEDIA_AUDIO_getAudioStreamId_0100 OUT OF BORDER PROMISE: SUCCESS ${data}`);
expect(true).assertTrue();
done();
} catch (err) {
console.info(`${TagFrmwkRender}: SUB_MULTIMEDIA_AUDIO_getAudioStreamId_0100 OUT OF BORDER PROMISE: ERROR: ${err.message}`);
expect(false).assertTrue();
done();
}
})
/*
* @tc.name:SUB_MULTIMEDIA_AUDIO_getAudioStreamId_0200
* @tc.desc:getAudioStreamId callback,is independent mode
* @tc.type: FUNC
* @tc.require: Issue Number
*/
it("SUB_MULTIMEDIA_AUDIO_getAudioStreamId_0200", 2, async function (done) {
let audioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000,
channels: audio.AudioChannel.CHANNEL_1,
sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE,
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
}
let audioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_MUSIC,
usage: audio.StreamUsage.STREAM_USAGE_MEDIA,
rendererFlags: 0
}
let audioRendererOptions = {
streamInfo: audioStreamInfo,
rendererInfo: audioRendererInfo
}
let audioRenderer = await audio.createAudioRenderer(audioRendererOptions);
await audioRenderer.getAudioStreamId((err, data) => {
if (err) {
console.info(`${TagFrmwkRender}: SetInterruptMode INDEPENDENT_MODE CALLBACK: error: ${err.message}`);
expect(false).assertTrue();
done();
return;
}
console.info(`${TagFrmwkRender}: SetInterruptMode INDEPENDENT_MODE CALLBACK: SUCCESS ${data}`);
expect(true).assertTrue();
done();
})
})
})
\ No newline at end of file
......@@ -1058,5 +1058,31 @@ describe('CameraManagerTest', function () {
await sleep(1000);
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_IS_CAMERA_MUTED_0100
* @tc.name : Get camera mute
* @tc.desc : Get camera mute
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_IS_CAMERA_MUTED_0100', 2, async function (done) {
console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_IS_CAMERA_MUTED_0100--------------");
if (isEmpty(mCameraManager)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_CAMERA_MUTED_0100 cameraManager == null || undefined")
expect().assertFail();
}
try {
let isCameraMuted = mCameraManager.isCameraMuted();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_CAMERA_MUTED_0100 isCameraMuted : " + isCameraMuted);
expect(isEmpty(isCameraMuted)).assertFalse();
} catch (err) {
console.log(TAG + "isCameraMuted has failed for " + err.message);
expect().assertFail();
}
await sleep(1000);
done();
})
})
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册