提交 7f1676ba 编写于 作者: Q qinliwen

<Audio新增修改枚举接口用例>

Signed-off-by: Nqinliwen <qinliwen3@huawei.com>
上级 77f9ed81
...@@ -5544,4 +5544,18 @@ describe('audioManager', function () { ...@@ -5544,4 +5544,18 @@ describe('audioManager', function () {
await sleep(50); await sleep(50);
done(); done();
}) })
/* *
* @tc.number : SUB_AUDIO_SAMPLE_FORMAT_F32LE_001
* @tc.name : SAMPLE_FORMAT_F32LE
* @tc.desc : SAMPLE_FORMAT_F32LE
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_SAMPLE_FORMAT_F32LE_001', 0, async function (done) {
expect(audio.AudioSampleFormat.SAMPLE_FORMAT_F32LE).assertEqual(4);
await sleep(50);
done();
})
}) })
\ No newline at end of file
...@@ -7377,13 +7377,13 @@ describe('audioRenderer', function () { ...@@ -7377,13 +7377,13 @@ describe('audioRenderer', function () {
done(); done();
}) })
/* /*
* @tc.name:SetInterruptMode_001 * @tc.name:SUB_AUDIO_SetInterruptMode_001
* @tc.desc:SetInterruptMode mode 0 callback,is public share mode * @tc.desc:SetInterruptMode mode 0 callback,is public share mode
* @tc.type: FUNC * @tc.type: FUNC
* @tc.require: Issue Number * @tc.require: Issue Number
*/ */
it("SetInterruptMode_001", 0,async function (done) { it("SUB_AUDIO_SetInterruptMode_001", 0, async function (done) {
var audioStreamInfo = { var audioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000,
channels: audio.AudioChannel.CHANNEL_1, channels: audio.AudioChannel.CHANNEL_1,
...@@ -7400,24 +7400,25 @@ describe('audioRenderer', function () { ...@@ -7400,24 +7400,25 @@ describe('audioRenderer', function () {
rendererInfo: audioRendererInfo rendererInfo: audioRendererInfo
} }
let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); let audioRenderer = await audio.createAudioRenderer(audioRendererOptions);
let mode = 0; let mode = audio.InterruptMode.SHARE_MODE;
audioRenderer.setInterruptMode(mode,(err,data)=>{ audioRenderer.setInterruptMode(mode, (err, data) => {
if(err){ if (err) {
expect(true).assertEqual(false); expect(false).assertTrue();
return done(); done();
return;
} }
expect(true).assertEqual(true); expect(true).assertTrue();
done(); done();
}) })
}) })
/* /*
* @tc.name:SetInterruptMode_002 * @tc.name:SUB_AUDIO_SetInterruptMode_002
* @tc.desc:SetInterruptMode mode 1 callback,is independent mode * @tc.desc:SetInterruptMode mode 1 callback,is independent mode
* @tc.type: FUNC * @tc.type: FUNC
* @tc.require: Issue Number * @tc.require: Issue Number
*/ */
it("SetInterruptMode_002", 0,async function (done) { it("SUB_AUDIO_SetInterruptMode_002", 0, async function (done) {
var audioStreamInfo = { var audioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000,
channels: audio.AudioChannel.CHANNEL_1, channels: audio.AudioChannel.CHANNEL_1,
...@@ -7434,24 +7435,25 @@ describe('audioRenderer', function () { ...@@ -7434,24 +7435,25 @@ describe('audioRenderer', function () {
rendererInfo: audioRendererInfo rendererInfo: audioRendererInfo
} }
let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); let audioRenderer = await audio.createAudioRenderer(audioRendererOptions);
let mode = 1; let mode = audio.InterruptMode.INDEPENDENT_MODE;
audioRenderer.setInterruptMode(mode,(err,data)=>{ audioRenderer.setInterruptMode(mode, (err, data) => {
if(err){ if (err) {
expect(true).assertEqual(false); expect(false).assertTrue();
return done(); done();
return;
} }
expect(true).assertEqual(true); expect(true).assertTrue();
done(); done();
}) })
}) })
/* /*
* @tc.name:SetInterruptMode_003 * @tc.name:SUB_AUDIO_SetInterruptMode_003
* @tc.desc:SetInterruptMode mode 0 promise,is public share mode * @tc.desc:SetInterruptMode mode 0 promise,is public share mode
* @tc.type: FUNC * @tc.type: FUNC
* @tc.require: Issue Number * @tc.require: Issue Number
*/ */
it("SetInterruptMode_003", 0,async function (done) { it("SUB_AUDIO_SetInterruptMode_003", 0, async function (done) {
var audioStreamInfo = { var audioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000,
channels: audio.AudioChannel.CHANNEL_1, channels: audio.AudioChannel.CHANNEL_1,
...@@ -7468,23 +7470,23 @@ describe('audioRenderer', function () { ...@@ -7468,23 +7470,23 @@ describe('audioRenderer', function () {
rendererInfo: audioRendererInfo rendererInfo: audioRendererInfo
} }
let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); let audioRenderer = await audio.createAudioRenderer(audioRendererOptions);
let mode = 0; let mode = audio.InterruptMode.SHARE_MODE;
audioRenderer.setInterruptMode(mode).then(data=>{ audioRenderer.setInterruptMode(mode).then(data => {
expect(true).assertEqual(true); expect(true).assertTrue();
done(); done();
}).catch(err=>{ }).catch(err => {
expect(true).assertEqual(false); expect(false).assertTrue();
done(); done();
}) })
}) })
/* /*
* @tc.name:SetInterruptMode_004 * @tc.name:SUB_AUDIO_SetInterruptMode_004
* @tc.desc:SetInterruptMode mode 1 promise,is independent mode * @tc.desc:SetInterruptMode mode 1 promise,is independent mode
* @tc.type: FUNC * @tc.type: FUNC
* @tc.require: Issue Number * @tc.require: Issue Number
*/ */
it("SetInterruptMode_004", 0,async function (done) { it("SUB_AUDIO_SetInterruptMode_004", 0, async function (done) {
var audioStreamInfo = { var audioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000,
channels: audio.AudioChannel.CHANNEL_1, channels: audio.AudioChannel.CHANNEL_1,
...@@ -7501,23 +7503,23 @@ describe('audioRenderer', function () { ...@@ -7501,23 +7503,23 @@ describe('audioRenderer', function () {
rendererInfo: audioRendererInfo rendererInfo: audioRendererInfo
} }
let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); let audioRenderer = await audio.createAudioRenderer(audioRendererOptions);
let mode = 1; let mode = audio.InterruptMode.INDEPENDENT_MODE;
audioRenderer.setInterruptMode(mode).then(data=>{ audioRenderer.setInterruptMode(mode).then(data => {
expect(true).assertEqual(true); expect(true).assertTrue();
done(); done();
}).catch(err=>{ }).catch(err => {
expect(true).assertEqual(false); expect(false).assertTrue();
done(); done();
}) })
}) })
/* /*
* @tc.name:SetInterruptMode_005 * @tc.name:SUB_AUDIO_SetInterruptMode_005
* @tc.desc:SetInterruptMode mode '1',will catch error with type error * @tc.desc:SetInterruptMode mode '1',will catch error with type error
* @tc.type: FUNC * @tc.type: FUNC
* @tc.require: Issue Number * @tc.require: Issue Number
*/ */
it("SetInterruptMode_005", 0,async function (done) { it("SUB_AUDIO_SetInterruptMode_005", 0, async function (done) {
var audioStreamInfo = { var audioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000,
channels: audio.AudioChannel.CHANNEL_1, channels: audio.AudioChannel.CHANNEL_1,
...@@ -7535,23 +7537,23 @@ describe('audioRenderer', function () { ...@@ -7535,23 +7537,23 @@ describe('audioRenderer', function () {
} }
let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); let audioRenderer = await audio.createAudioRenderer(audioRendererOptions);
let mode = '1'; let mode = '1';
try{ try {
let data = await audioRenderer.setInterruptMode(mode); let data = await audioRenderer.setInterruptMode(mode);
expect(false).assertEqual(false); expect(false).assertTrue();
done(); done();
}catch(err){ } catch (err) {
expect('assertion (false) failed: type mismatch').assertEqual(err.message); expect('assertion (false) failed: type mismatch').assertEqual(err.message);
done(); done();
} }
}) })
/* /*
* @tc.name: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,will catch error with out of border
* @tc.type: FUNC * @tc.type: FUNC
* @tc.require: Issue Number * @tc.require: Issue Number
*/ */
it("SetInterruptMode_006", 0,async function (done) { it("SUB_AUDIO_SetInterruptMode_006", 0, async function (done) {
var audioStreamInfo = { var audioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000,
channels: audio.AudioChannel.CHANNEL_1, channels: audio.AudioChannel.CHANNEL_1,
...@@ -7569,11 +7571,11 @@ describe('audioRenderer', function () { ...@@ -7569,11 +7571,11 @@ 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(true).assertEqual(true); expect(false).assertTrue();
done(); done();
}catch(err){ } catch (err) {
expect(err).assertEqual(undefined); expect(err).assertEqual(undefined);
done(); done();
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册