提交 838f3009 编写于 作者: N NOBUGGERS

recorder profile xts testcase Signed-off-by: NOBUGGERS <ruanmeng@huawei.com>

Signed-off-by: NNOBUGGERS <ruanmeng@huawei.com>
上级 0da8a211
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import media from '@ohos.multimedia.media'
import {checkAudioArray, checkVideoArray} from './ProfileTestBase.js';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('ProfileFuncCallbackTest', function () {
beforeAll(function() {
console.info('beforeAll case');
})
beforeEach(async function() {
console.info('beforeEach case');
})
afterEach(function() {
console.info('afterEach case');
})
afterAll(function() {
console.info('afterAll case');
})
async function getAudioRecorderCapsTest(done) {
media.getMediaCapability((err, mediaCaps) => {
expect(err).assertUndefined();
console.info('getMediaCapability success');
if (typeof (mediaCaps) != 'undefined') {
mediaCaps.getAudioRecorderCaps((err, audioCapsArray) => {
expect(err).assertUndefined();
console.info('getAudioRecorderCaps success');
if (typeof (audioCapsArray) != 'undefined') {
checkAudioArray(audioCapsArray, done);
} else {
console.info('audioCaps is not defined');
expect().assertFail();
done();
}
})
} else {
console.info('mediaCaps is not defined');
expect().assertFail();
done();
}
})
}
async function getVideoRecorderCapsTest(done) {
media.getMediaCapability((err, mediaCaps) => {
expect(err).assertUndefined();
console.info('getMediaCapability success');
if (typeof (mediaCaps) != 'undefined') {
mediaCaps.getVideoRecorderCaps((err, videoCapsArray) => {
expect(err).assertUndefined();
console.info('getVideoRecorderCapsTest success');
if (typeof (videoCapsArray) != 'undefined') {
checkVideoArray(videoCapsArray, done);
} else {
console.info('videoCaps is not defined');
expect().assertFail();
done();
}
})
} else {
console.info('mediaCaps is not defined');
expect().assertFail();
done();
}
})
}
/* *
* @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_0100
* @tc.name : 01.test getAudioRecorderCaps
* @tc.desc : outputFormat/audioEncoderMime/sampleRates/bitrateRange/channelRange
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_PROFILE_FUNCTION_CALLBACK_0100', 0, async function (done) {
console.info("test getAudioRecorderCaps");
getAudioRecorderCapsTest(done);
console.info("test getAudioRecorderCaps 111 ");
})
/* *
* @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_0200
* @tc.name : 02.test getVideoRecorderCapsTest
* @tc.desc : audioEncoderMime/sampleRates/bitrateRange/channelRange
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_PROFILE_FUNCTION_CALLBACK_0200', 0, async function (done) {
console.info("test getAudioRecorderCaps");
getVideoRecorderCapsTest(done);
})
})
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import media from '@ohos.multimedia.media'
import {checkAudioArray, checkVideoArray} from './ProfileTestBase.js';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('ProfileFuncPromiseTest', function () {
beforeAll(function() {
console.info('beforeAll case');
})
beforeEach(async function() {
console.info('beforeEach case');
})
afterEach(function() {
console.info('afterEach case');
})
afterAll(function() {
console.info('afterAll case');
})
async function getAudioRecorderCapsTest(done) {
await media.getMediaCapability().then(async (mediaCaps) => {
console.info('getMediaCapability success');
if (typeof (mediaCaps) != 'undefined') {
await mediaCaps.getAudioRecorderCaps().then(async (audioCapsArray) => {
console.info('getAudioRecorderCaps success');
if (typeof (audioCapsArray) != 'undefined') {
return audioCapsArray;
} else {
console.info('audioCaps is not defined');
expect().assertFail();
done();
}
})
} else {
console.info('mediaCaps is not defined');
expect().assertFail();
done();
}
})
}
/* *
* @tc.number : SUB_PROFILE_FUNCTION_PROMISE_0100
* @tc.name : 01.test getAudioRecorderCaps
* @tc.desc : outputFormat/audioEncoderMime/sampleRates/bitrateRange/channelRange
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_PROFILE_FUNCTION_PROMISE_0100', 0, async function (done) {
console.info("test getAudioRecorderCaps");
let audioCapsArray = getAudioRecorderCapsTest(done);
checkAudioArray(audioCapsArray, done);
console.info("test getAudioRecorderCaps 111 ");
})
})
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import media from '@ohos.multimedia.media'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('VideoRecorderProfileAbnormalCallback', function () {
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_0100
* @tc.name : 01.test getVideoRecorderProfile
* @tc.desc : sourceId -1 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_PROFILE_ABNORMAL_CALLBACK_0100', 0, async function (done) {
console.info("test getVideoRecorderProfile");
media.getMediaCapability((err, mediaCaps) => {
expect(err).assertUndefined();
console.info('getMediaCapability success');
if (typeof (mediaCaps) != 'undefined') {
mediaCaps.getVideoRecorderProfile(-1, 0, (err, videoCapsArray) => {
expect(err).assertUndefined();
console.info('getVideoRecorderProfile success');
done();
})
} else {
console.info('mediaCaps is not defined');
done();
}
})
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_0200
* @tc.name : 02.test getVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel -1
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_PROFILE_ABNORMAL_CALLBACK_0200', 0, async function (done) {
console.info("test getVideoRecorderProfile");
media.getMediaCapability((err, mediaCaps) => {
expect(err).assertUndefined();
console.info('getMediaCapability success');
if (typeof (mediaCaps) != 'undefined') {
mediaCaps.getVideoRecorderProfile(0, -1, (err, videoCapsArray) => {
expect(err).assertUndefined();
console.info('getVideoRecorderProfile success');
done();
})
} else {
console.info('mediaCaps is not defined');
done();
}
})
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_0300
* @tc.name : 03.test getVideoRecorderProfile
* @tc.desc : sourceId 100000 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_PROFILE_ABNORMAL_CALLBACK_0300', 0, async function (done) {
console.info("test getVideoRecorderProfile");
media.getMediaCapability((err, mediaCaps) => {
expect(err).assertUndefined();
console.info('getMediaCapability success');
if (typeof (mediaCaps) != 'undefined') {
mediaCaps.getVideoRecorderProfile(100000, 0, (err, videoCapsArray) => {
expect(err).assertUndefined();
console.info('getVideoRecorderProfile success');
done();
})
} else {
console.info('mediaCaps is not defined');
done();
}
})
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_0400
* @tc.name : 04.test getVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 100000
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_PROFILE_ABNORMAL_CALLBACK_0400', 0, async function (done) {
console.info("test getVideoRecorderProfile");
media.getMediaCapability((err, mediaCaps) => {
expect(err).assertUndefined();
console.info('getMediaCapability success');
if (typeof (mediaCaps) != 'undefined') {
mediaCaps.getVideoRecorderProfile(0, 100000, (err, videoCapsArray) => {
expect(err).assertUndefined();
console.info('getVideoRecorderProfile success');
done();
})
} else {
console.info('mediaCaps is not defined');
done();
}
})
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_0500
* @tc.name : 05.test isAudioRecoderConfigSupported
* @tc.desc : isAudioRecoderConfigSupported false
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_PROFILE_ABNORMAL_CALLBACK_0500', 0, async function (done) {
console.info("test isAudioRecoderConfigSupported");
let audioProfile = {
"outputFormat": 'aaa',
"audioEncoderMime": media.CodecMimeType.AUDIO_AAC,
"bitrate": 8000,
"sampleRate": 500,
"channel": 1,
}
media.getMediaCapability((err, mediaCaps) => {
expect(err).assertUndefined();
console.info('getMediaCapability success');
if (typeof (mediaCaps) != 'undefined') {
mediaCaps.isAudioRecoderConfigSupported(audioProfile, (err, ean) => {
expect(err).assertUndefined();
expect(ean).assertEqual(false);
console.info('isAudioRecoderConfigSupported: success');
done();
})
} else {
console.info('mediaCaps is not defined');
done();
}
})
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_0600
* @tc.name : 06.test hasVideoRecorderProfile
* @tc.desc : sourceId -1 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_PROFILE_ABNORMAL_CALLBACK_0600', 0, async function (done) {
console.info("test hasVideoRecorderProfile");
media.getMediaCapability((err, mediaCaps) => {
expect(err).assertUndefined();
console.info('getMediaCapability success');
if (typeof (mediaCaps) != 'undefined') {
mediaCaps.hasVideoRecorderProfile(-1, 0, (err, ean) => {
expect(err).assertUndefined();
expect(ean).assertEqual(false);
console.info('hasVideoRecorderProfile success');
done();
})
} else {
console.info('mediaCaps is not defined');
done();
}
})
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_0700
* @tc.name : 07.test hasVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel -1
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_PROFILE_ABNORMAL_CALLBACK_0700', 0, async function (done) {
console.info("test hasVideoRecorderProfile");
media.getMediaCapability((err, mediaCaps) => {
expect(err).assertUndefined();
console.info('getMediaCapability success');
if (typeof (mediaCaps) != 'undefined') {
mediaCaps.hasVideoRecorderProfile(0, -1, (err, ean) => {
expect(err).assertUndefined();
expect(ean).assertEqual(false);
console.info('hasVideoRecorderProfile success');
done();
})
} else {
console.info('mediaCaps is not defined');
done();
}
})
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_0800
* @tc.name : 08.test hasVideoRecorderProfile
* @tc.desc : sourceId 100000 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_PROFILE_ABNORMAL_CALLBACK_0800', 0, async function (done) {
console.info("test hasVideoRecorderProfile");
media.getMediaCapability((err, mediaCaps) => {
expect(err).assertUndefined();
console.info('getMediaCapability success');
if (typeof (mediaCaps) != 'undefined') {
mediaCaps.hasVideoRecorderProfile(100000, 0, (err, ean) => {
expect(err).assertUndefined();
expect(ean).assertEqual(false);
console.info('hasVideoRecorderProfile success');
done();
})
} else {
console.info('mediaCaps is not defined');
done();
}
})
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_0900
* @tc.name : 09.test hasVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 100000
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_PROFILE_ABNORMAL_CALLBACK_0900', 0, async function (done) {
console.info("test hasVideoRecorderProfile");
media.getMediaCapability((err, mediaCaps) => {
expect(err).assertUndefined();
console.info('getMediaCapability success');
if (typeof (mediaCaps) != 'undefined') {
mediaCaps.hasVideoRecorderProfile(0, 100000, (err, ean) => {
expect(err).assertUndefined();
expect(ean).assertEqual(false);
console.info('hasVideoRecorderProfile success');
done();
})
} else {
console.info('mediaCaps is not defined');
done();
}
})
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_1000
* @tc.name : 10.test isAudioRecoderConfigSupported
* @tc.desc : isAudioRecoderConfigSupported false
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_PROFILE_ABNORMAL_CALLBACK_1000', 0, async function (done) {
console.info("test isAudioRecoderConfigSupported");
let audioProfile = {
"outputFormat": media.ContainerFormatType.CFT_MPEG_4A,
"audioEncoderMime": 'aaa',
"bitrate": 8000,
"sampleRate": 500,
"channel": 1,
}
media.getMediaCapability((err, mediaCaps) => {
expect(err).assertUndefined();
console.info('getMediaCapability success');
if (typeof (mediaCaps) != 'undefined') {
mediaCaps.isAudioRecoderConfigSupported(audioProfile, (err, ean) => {
expect(err).assertUndefined();
expect(ean).assertEqual(false);
console.info('isAudioRecoderConfigSupported: success');
done();
})
} else {
console.info('mediaCaps is not defined');
done();
}
})
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_1100
* @tc.name : 11.test isAudioRecoderConfigSupported
* @tc.desc : isAudioRecoderConfigSupported false
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_PROFILE_ABNORMAL_CALLBACK_1100', 0, async function (done) {
console.info("test isAudioRecoderConfigSupported");
let audioProfile = {
"outputFormat": media.ContainerFormatType.CFT_MPEG_4A,
"audioEncoderMime": media.CodecMimeType.AUDIO_AAC,
"bitrate": 1000000,
"sampleRate": 500,
"channel": 1,
}
media.getMediaCapability((err, mediaCaps) => {
expect(err).assertUndefined();
console.info('getMediaCapability success');
if (typeof (mediaCaps) != 'undefined') {
mediaCaps.isAudioRecoderConfigSupported(audioProfile, (err, ean) => {
expect(err).assertUndefined();
expect(ean).assertEqual(false);
console.info('isAudioRecoderConfigSupported: success');
done();
})
} else {
console.info('mediaCaps is not defined');
done();
}
})
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_1200
* @tc.name : 12.test isAudioRecoderConfigSupported
* @tc.desc : isAudioRecoderConfigSupported false
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_PROFILE_ABNORMAL_CALLBACK_1200', 0, async function (done) {
console.info("test isAudioRecoderConfigSupported");
let audioProfile = {
"outputFormat": media.ContainerFormatType.CFT_MPEG_4A,
"audioEncoderMime": media.CodecMimeType.AUDIO_AAC,
"bitrate": 8000,
"sampleRate": 1000000,
"channel": 1,
}
media.getMediaCapability((err, mediaCaps) => {
expect(err).assertUndefined();
console.info('getMediaCapability success');
if (typeof (mediaCaps) != 'undefined') {
mediaCaps.isAudioRecoderConfigSupported(audioProfile, (err, ean) => {
expect(err).assertUndefined();
expect(ean).assertEqual(false);
console.info('isAudioRecoderConfigSupported: success');
done();
})
} else {
console.info('mediaCaps is not defined');
done();
}
})
})
/* *
* @tc.number : SUB_PROFILE_ABNORMAL_CALLBACK_1300
* @tc.name : 13.test isAudioRecoderConfigSupported
* @tc.desc : isAudioRecoderConfigSupported false
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_PROFILE_ABNORMAL_CALLBACK_1300', 0, async function (done) {
console.info("test isAudioRecoderConfigSupported");
let audioProfile = {
"outputFormat": media.ContainerFormatType.CFT_MPEG_4A,
"audioEncoderMime": media.CodecMimeType.AUDIO_AAC,
"bitrate": 8000,
"sampleRate": 500,
"channel": 0,
}
media.getMediaCapability((err, mediaCaps) => {
expect(err).assertUndefined();
console.info('getMediaCapability success');
if (typeof (mediaCaps) != 'undefined') {
mediaCaps.isAudioRecoderConfigSupported(audioProfile, (err, ean) => {
expect(err).assertUndefined();
expect(ean).assertEqual(false);
console.info('isAudioRecoderConfigSupported: success');
done();
})
} else {
console.info('mediaCaps is not defined');
done();
}
})
})
})
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册