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

!3478 修改audioRecorder 参数赋值方式,使用枚举值赋值

Merge pull request !3478 from FULIZHONG/OpenHarmony-3.1-Release
......@@ -28,21 +28,17 @@ describe('RecorderLocalTestAudioAPI', function () {
const RESET_STATE = 6;
const RELEASE_STATE = 7;
const ERROR_STATE = 8;
const FORMAT_M4A = 6;
const SOURCE_TYPE = 1;
const ENCORDER_AACLC = 3;
const CHANNEL_TWO = 2;
const RECORDER_TIME = 1000;
let fdPath;
let fileAsset;
let fdNumber;
let audioConfig = {
audioSourceType : SOURCE_TYPE,
audioEncoder : ENCORDER_AACLC,
audioEncoder : media.AudioEncoder.AAC_LC,
audioEncodeBitRate : 22050,
audioSampleRate : 22050,
numberOfChannels : CHANNEL_TWO,
format : FORMAT_M4A,
format : media.AudioOutputFormat.AAC_ADTS,
uri : 'file:///data/accounts/account_0/appdata/recorder/testAPI.m4a',
location : { latitude : 1, longitude : 1 },
}
......
......@@ -21,7 +21,6 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '
describe('RecorderLocalTestAudioFUNC', function () {
let audioRecorder = media.createAudioRecorder();
const BASIC_PATH = 'file:///data/accounts/account_0/appdata/recorder/'
const END_STATE = 0;
const PRE_STATE = 1;
const START_STATE = 2;
......@@ -34,15 +33,13 @@ describe('RecorderLocalTestAudioFUNC', function () {
const RECORDER_TIME = 1000;
const CHANNEL_ONE = 1;
const CHANNEL_TWO = 2;
const FORMAT_MP4 = 2;
const FORMAT_M4A = 6;
const SOURCE_TYPE = 1;
const ENCORDER_AACLC = 3;
const FORMAT_MP4 = media.AudioOutputFormat.MPEG_4;
const FORMAT_M4A = media.AudioOutputFormat.AAC_ADTS;
const ENCORDER_AACLC = media.AudioEncoder.AAC_LC;
let fdPath;
let fileAsset;
let fdNumber;
let audioConfig = {
audioSourceType : SOURCE_TYPE,
audioEncoder : ENCORDER_AACLC,
audioEncodeBitRate : 22050,
audioSampleRate : 22050,
......@@ -333,7 +330,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
audioConfig.uri = fdPath;
audioConfig.audioSampleRate = 32000; // samplerate 32000
audioConfig.numberOfChannels = CHANNEL_ONE;
audioConfig.fileFormat = FORMAT_MP4;
audioConfig.format = FORMAT_MP4;
initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, STOP_STATE, RELEASE_STATE, END_STATE);
setCallback(mySteps, done);
......@@ -353,7 +350,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
audioConfig.uri = fdPath;
audioConfig.audioSampleRate = 44100; // samplerate 44100
audioConfig.numberOfChannels = CHANNEL_TWO;
audioConfig.fileFormat = FORMAT_MP4;
audioConfig.format = FORMAT_MP4;
initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, STOP_STATE, RELEASE_STATE, END_STATE);
setCallback(mySteps, done);
......@@ -373,7 +370,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
audioConfig.uri = fdPath;
audioConfig.audioSampleRate = 64000; // samplerate 64000
audioConfig.numberOfChannels = CHANNEL_ONE;
audioConfig.fileFormat = FORMAT_M4A;
audioConfig.format = FORMAT_M4A;
initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, STOP_STATE, RELEASE_STATE, END_STATE);
setCallback(mySteps, done);
......@@ -393,7 +390,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
audioConfig.uri = fdPath;
audioConfig.audioSampleRate = 96000; // samplerate 96000
audioConfig.numberOfChannels = CHANNEL_TWO;
audioConfig.fileFormat = FORMAT_M4A;
audioConfig.format = FORMAT_M4A;
initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, STOP_STATE, RELEASE_STATE, END_STATE);
setCallback(mySteps, done);
......@@ -414,7 +411,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
audioConfig.audioSampleRate = 22050; // samplerate 22050
audioConfig.audioEncodeBitRate = 8000; // encodeBitrate 8000
audioConfig.numberOfChannels = CHANNEL_TWO;
audioConfig.fileFormat = FORMAT_MP4;
audioConfig.format = FORMAT_MP4;
initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, STOP_STATE, RELEASE_STATE, END_STATE);
setCallback(mySteps, done);
......@@ -435,7 +432,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
audioConfig.audioSampleRate = 44100; // samplerate 44100
audioConfig.audioEncodeBitRate = 16000; // encodeBitrate 16000
audioConfig.numberOfChannels = CHANNEL_ONE;
audioConfig.fileFormat = FORMAT_MP4;
audioConfig.format = FORMAT_MP4;
initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, STOP_STATE, RELEASE_STATE, END_STATE);
setCallback(mySteps, done);
......@@ -456,7 +453,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
audioConfig.audioSampleRate = 44100; // samplerate 44100
audioConfig.audioEncodeBitRate = 32000; // encodeBitrate 32000
audioConfig.numberOfChannels = CHANNEL_ONE;
audioConfig.fileFormat = FORMAT_M4A;
audioConfig.format = FORMAT_M4A;
initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, STOP_STATE, RELEASE_STATE, END_STATE);
setCallback(mySteps, done);
......@@ -477,7 +474,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
audioConfig.audioSampleRate = 44100; // samplerate 44100
audioConfig.audioEncodeBitRate = 64000; // encodeBitrate 64000
audioConfig.numberOfChannels = CHANNEL_TWO;
audioConfig.fileFormat = FORMAT_M4A;
audioConfig.format = FORMAT_M4A;
initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, STOP_STATE, RELEASE_STATE, END_STATE);
setCallback(mySteps, done);
......@@ -498,7 +495,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
audioConfig.audioSampleRate = 44100; // samplerate 44100
audioConfig.audioEncodeBitRate = 112000; // encodeBitrate 112000
audioConfig.numberOfChannels = CHANNEL_TWO;
audioConfig.fileFormat = FORMAT_M4A;
audioConfig.format = FORMAT_M4A;
initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, STOP_STATE, RELEASE_STATE, END_STATE);
setCallback(mySteps, done);
......@@ -518,7 +515,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
audioConfig.uri = fdPath;
audioConfig.audioEncodeBitRate = 22050; // samplerate 22050
audioConfig.audioSampleRate = 22050; // encodeBitrate 22050
audioConfig.fileFormat = FORMAT_MP4;
audioConfig.format = FORMAT_MP4;
audioConfig.numberOfChannels = CHANNEL_TWO;
initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, STOP_STATE, RELEASE_STATE, END_STATE);
......@@ -539,7 +536,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
audioConfig.uri = fdPath;
audioConfig.audioEncodeBitRate = 22050; // samplerate 22050
audioConfig.audioSampleRate = 22050; // encodeBitrate 22050
audioConfig.fileFormat = FORMAT_M4A;
audioConfig.format = FORMAT_M4A;
audioConfig.numberOfChannels = CHANNEL_TWO;
initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, STOP_STATE, RELEASE_STATE, END_STATE);
......@@ -558,7 +555,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
it('SUB_MEDIA_RECORDER_AUDIO_FUNCTION_06_0100', 0, async function (done) {
await getFd('test16.m4a');
audioConfig.uri = fdPath;
audioConfig.fileFormat = FORMAT_M4A;
audioConfig.format = FORMAT_M4A;
initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, STOP_STATE, RELEASE_STATE, END_STATE);
setCallback(mySteps, done);
......@@ -576,7 +573,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
it('SUB_MEDIA_RECORDER_AUDIO_FUNCTION_06_0200', 0, async function (done) {
await getFd('test17.m4a');
audioConfig.uri = fdPath;
audioConfig.fileFormat = FORMAT_M4A;
audioConfig.format = FORMAT_M4A;
initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, PAUSE_STATE, STOP_STATE, RELEASE_STATE, END_STATE);
setCallback(mySteps, done);
......@@ -594,7 +591,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
it('SUB_MEDIA_RECORDER_AUDIO_FUNCTION_06_0300', 0, async function (done) {
await getFd('test18.m4a');
audioConfig.uri = fdPath;
audioConfig.fileFormat = FORMAT_M4A;
audioConfig.format = FORMAT_M4A;
initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, PAUSE_STATE, RESUME_STATE,
STOP_STATE, RELEASE_STATE, END_STATE);
......@@ -613,7 +610,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
it('SUB_MEDIA_RECORDER_AUDIO_FUNCTION_06_0500', 0, async function (done) {
await getFd('test19.m4a');
audioConfig.uri = fdPath;
audioConfig.fileFormat = FORMAT_M4A;
audioConfig.format = FORMAT_M4A;
initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, RESET_STATE, RELEASE_STATE, END_STATE);
setCallback(mySteps, done);
......@@ -631,7 +628,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
it('SUB_MEDIA_RECORDER_AUDIO_FUNCTION_06_0600', 0, async function (done) {
await getFd('test20.m4a');
audioConfig.uri = fdPath;
audioConfig.fileFormat = FORMAT_M4A;
audioConfig.format = FORMAT_M4A;
initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, PAUSE_STATE, RESUME_STATE, PAUSE_STATE,
STOP_STATE, RELEASE_STATE, END_STATE);
......@@ -650,7 +647,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
it('SUB_MEDIA_RECORDER_AUDIO_FUNCTION_06_0700', 0, async function (done) {
await getFd('test21.m4a');
audioConfig.uri = fdPath;
audioConfig.fileFormat = FORMAT_M4A;
audioConfig.format = FORMAT_M4A;
initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, PAUSE_STATE, STOP_STATE,
RESET_STATE, RELEASE_STATE, END_STATE);
......@@ -669,7 +666,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
it('SUB_MEDIA_RECORDER_AUDIO_FUNCTION_06_0800', 0, async function (done) {
await getFd('test22.m4a');
audioConfig.uri = fdPath;
audioConfig.fileFormat = FORMAT_M4A;
audioConfig.format = FORMAT_M4A;
initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, PAUSE_STATE, RESUME_STATE, STOP_STATE,
RESET_STATE, RELEASE_STATE, END_STATE);
......@@ -688,7 +685,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
it('SUB_MEDIA_RECORDER_AUDIO_FUNCTION_06_0900', 0, async function (done) {
await getFd('test23.m4a');
audioConfig.uri = fdPath;
audioConfig.fileFormat = FORMAT_M4A;
audioConfig.format = FORMAT_M4A;
initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, RESET_STATE, PRE_STATE, START_STATE,
PAUSE_STATE, RESUME_STATE, STOP_STATE, RESET_STATE, RELEASE_STATE, END_STATE);
......@@ -707,7 +704,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
it('SUB_MEDIA_RECORDER_AUDIO_FUNCTION_06_1000', 0, async function (done) {
await getFd('test24.m4a');
audioConfig.uri = fdPath;
audioConfig.fileFormat = FORMAT_M4A;
audioConfig.format = FORMAT_M4A;
initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, RESET_STATE, PRE_STATE, START_STATE,
PAUSE_STATE, STOP_STATE, RESET_STATE, RELEASE_STATE, END_STATE);
......@@ -726,7 +723,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
it('SUB_MEDIA_RECORDER_AUDIO_FUNCTION_06_1100', 0, async function (done) {
await getFd('test25.mp4');
audioConfig.uri = fdPath;
audioConfig.fileFormat = FORMAT_MP4;
audioConfig.format = FORMAT_MP4;
initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, RESET_STATE, PRE_STATE,
START_STATE, STOP_STATE, RELEASE_STATE, END_STATE);
......@@ -745,7 +742,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
it('SUB_MEDIA_RECORDER_AUDIO_FUNCTION_06_1200', 0, async function (done) {
await getFd('test26.mp4');
audioConfig.uri = fdPath;
audioConfig.fileFormat = FORMAT_MP4;
audioConfig.format = FORMAT_MP4;
initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, PAUSE_STATE, START_STATE, ERROR_STATE,
STOP_STATE, RELEASE_STATE, END_STATE);
......@@ -764,7 +761,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
it('SUB_MEDIA_RECORDER_AUDIO_FUNCTION_06_1300', 0, async function (done) {
await getFd('test27.mp4');
audioConfig.uri = fdPath;
audioConfig.fileFormat = FORMAT_MP4;
audioConfig.format = FORMAT_MP4;
initAudioRecorder();
let mySteps = new Array(PRE_STATE, START_STATE, STOP_STATE, PAUSE_STATE, ERROR_STATE,
RELEASE_STATE, END_STATE);
......@@ -784,7 +781,6 @@ describe('RecorderLocalTestAudioFUNC', function () {
it('SUB_MEDIA_RECORDER_AUDIO_FUNCTION_06_1400', 0, async function (done) {
await getFd('test28.mp4');
let newAudioConfig = {
audioSourceType : SOURCE_TYPE,
audioEncodeBitRate : 22050,
audioSampleRate : 22050,
numberOfChannels : CHANNEL_TWO,
......@@ -812,7 +808,6 @@ describe('RecorderLocalTestAudioFUNC', function () {
it('SUB_MEDIA_RECORDER_AUDIO_FUNCTION_06_1500', 0, async function (done) {
await getFd('test29.mp4');
let newAudioConfig = {
audioSourceType : SOURCE_TYPE,
audioEncodeBitRate : 22050,
audioSampleRate : 22050,
numberOfChannels : CHANNEL_TWO,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册