提交 2d143284 编写于 作者: N NOBUGGERS

recorderProfile delete Signed-off-by: NOBUGGERS <ruanmeng@huawei.com>

Signed-off-by: NNOBUGGERS <ruanmeng@huawei.com>
上级 d0ac528a
......@@ -43,7 +43,6 @@ group("multimedia") {
"media/media_js_standard/audioPlayer:audio_player_js_hap",
"media/media_js_standard/audioRecorder:audio_recorder_js_hap",
"media/media_js_standard/recorderFormat:recorder_format_js_hap",
"media/media_js_standard/recorderProfile:recorder_profile_js_hap",
"media/media_js_standard/videoPlayer:video_player_js_hap",
"medialibrary/mediaLibrary_album:mediaLibrary_album_hap",
"medialibrary/mediaLibrary_base:mediaLibrary_base_hap",
......
# 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("recorder_profile_js_hap") {
hap_profile = "./src/main/config.json"
js2abc = true
deps = [
":profile_js_assets",
":profile_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsRecorderProfileJsTest"
subsystem_name = "multimedia"
part_name = "multimedia_player_framework"
}
ohos_js_assets("profile_js_assets") {
js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
}
ohos_resources("profile_resources") {
sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json"
}
{
"description": "Configuration for profile Tests",
"driver": {
"type": "OHJSUnitTest",
"test-timeout": "2000000",
"shell-timeout": "2000000",
"testcase-timeout": 60000,
"bundle-name": "ohos.acts.multimedia.recorder.profile",
"package-name": "ohos.acts.multimedia.recorder.profile"
},
"kits": [
{
"test-file-name": [
"ActsRecorderProfileJsTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
\ No newline at end of file
{
"app": {
"apiVersion": {
"compatible": 6,
"releaseType": "Beta1",
"target": 7
},
"vendor": "acts",
"bundleName": "ohos.acts.multimedia.recorder.profile",
"version": {
"code": 1000000,
"name": "1.0.0"
}
},
"deviceConfig": {
"default": {
"debug": true
}
},
"module": {
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"orientation": "unspecified",
"formsEnabled": false,
"name": ".MainAbility",
"srcLanguage": "js",
"srcPath": "MainAbility",
"icon": "$media:icon",
"description": "$string:MainAbility_desc",
"label": "$string:MainAbility_label",
"type": "page",
"visible": true,
"launchType": "standard"
},
{
"orientation": "unspecified",
"formsEnabled": false,
"name": ".TestAbility",
"srcLanguage": "js",
"srcPath": "TestAbility",
"icon": "$media:icon",
"description": "$string:TestAbility_desc",
"label": "$string:TestAbility_label",
"type": "page",
"visible": true,
"launchType": "standard"
}
],
"deviceType": [
"phone",
"tablet",
"tv",
"wearable"
],
"reqPermissions": [
{
"name": "ohos.permission.GRANT_SENSITIVE_PERMISSIONS",
"reason": "use ohos.permission.GRANT_SENSITIVE_PERMISSIONS"
},
{
"name": "ohos.permission.REVOKE_SENSITIVE_PERMISSIONS",
"reason": "use ohos.permission.REVOKE_SENSITIVE_PERMISSIONS"
},
{
"name": "ohos.permission.MEDIA_LOCATION",
"reason": "use ohos.permission.MEDIA_LOCATION"
},
{
"name": "ohos.permission.READ_MEDIA",
"reason": "use ohos.permission.READ_MEDIA"
},
{
"name": "ohos.permission.WRITE_MEDIA",
"reason": "use ohos.permission.WRITE_MEDIA"
}
],
"mainAbility": ".MainAbility",
"distro": {
"moduleType": "entry",
"installationFree": false,
"deliveryWithInstall": true,
"moduleName": "entry"
},
"package": "ohos.acts.multimedia.recorder.profile",
"name": ".entry",
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": true
}
},
{
"pages": [
"pages/index/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"testRunner": {
"name": "OpenHarmonyTestRunner",
"srcPath": "TestRunner"
},
"srcPath": ""
}
}
\ No newline at end of file
/*
* 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.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
/*
* 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.
*/
.container {
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
}
.title {
font-size: 40px;
color: #000000;
opacity: 0.9;
}
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
}
}
@media screen and (device-type: wearable) {
.title {
font-size: 28px;
color: #FFFFFF;
}
}
@media screen and (device-type: tv) {
.container {
background-image: url("/common/images/Wallpaper.png");
background-size: cover;
background-repeat: no-repeat;
background-position: center;
}
.title {
font-size: 100px;
color: #FFFFFF;
}
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
}
}
<!--
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.
-->
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* 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.
*/
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
},
onReady() {
},
}
\ No newline at end of file
/*
* 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
export default {
onCreate() {
console.info('TestApplication onCreate')
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
},
onDestroy() {
console.info("TestApplication onDestroy");
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
},
"Files": {
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
},
"Files": {
}
}
\ No newline at end of file
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
}
}
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
}
}
\ No newline at end of file
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* 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.
*/
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
}
}
/*
* 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
function translateParamsToString(parameters) {
const keySet = new Set([
'-s class', '-s notClass', '-s suite', '-s itName',
'-s level', '-s testType', '-s size', '-s timeout',
'-s package', '-s dryRun'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams += ' ' + key + ' ' + parameters[key]
}
}
return targetParams.trim()
}
export default {
onPrepare() {
console.info('OpenHarmonyTestRunner OnPrepare')
},
onRun() {
console.log('OpenHarmonyTestRunner onRun run')
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility'
var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters)
var debug = abilityDelegatorArguments.parameters["-D"]
console.info('debug value : '+debug)
if (debug == 'true')
{
cmd += ' -D'
}
console.info('cmd : '+cmd)
abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.info('executeShellCommand : err : ' + JSON.stringify(err));
console.info('executeShellCommand : data : ' + data.stdResult);
console.info('executeShellCommand : data : ' + data.exitCode);
})
}
};
/*
* 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 ProfileAbnormalTestCallback from './ProfileAbnormalTestCallback.test.js'
import ProfileAbnormalTestPromise from './ProfileAbnormalTestPromise.test.js'
import ProfileTestCallback from './ProfileTestCallback.test.js'
import ProfileTestPromise from './ProfileTestPromise.test.js'
export default function testsuite() {
ProfileAbnormalTestCallback()
ProfileAbnormalTestPromise()
ProfileTestCallback()
ProfileTestPromise()
}
/*
* 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 * as base from './ProfileTestBase.js';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
export default function ProfileAbnormalTestCallback() {
describe('ProfileAbnormalTestCallback', 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 callbackAbnormalGetVideoProfile(sourceId, qualityLevel, done){
media.getMediaCapability((err, mediaCaps) => {
expect(err).assertUndefined();
console.info('getMediaCapability success');
if (typeof (mediaCaps) != 'undefined') {
mediaCaps.getVideoRecorderProfile(sourceId, qualityLevel, (err, videoCapsArray) => {
expect(err).assertUndefined();
base.checkVideoCapsArray(videoCapsArray);
console.info('getVideoRecorderProfile success');
done();
})
} else {
console.info('mediaCaps is not defined');
expect().assertFail();
done();
}
})
}
async function callbackAbnormalAudioRecorderConfigSupported(audioProfile, done) {
media.getMediaCapability((err, mediaCaps) => {
expect(err).assertUndefined();
console.info('getMediaCapability success');
if (typeof (mediaCaps) != 'undefined') {
mediaCaps.isAudioRecorderConfigSupported(audioProfile, (err, ean) => {
expect(err).assertUndefined();
expect(ean).assertEqual(false);
console.info('isAudioRecorderConfigSupported: success');
done();
})
} else {
console.info('mediaCaps is undefined');
expect().assertFail();
done();
}
})
}
async function callbackAbnormalHasVideoProfile(sourceId, qualityLevel, done) {
media.getMediaCapability((err, mediaCaps) => {
expect(err).assertUndefined();
console.info('getMediaCapability success');
if (typeof (mediaCaps) != 'undefined') {
mediaCaps.hasVideoRecorderProfile(sourceId, qualityLevel, (err, ean) => {
expect(err).assertUndefined();
expect(ean).assertEqual(false);
console.info('hasVideoRecorderProfile success');
done();
})
} else {
console.info('mediaCaps is undefined');
expect().assertFail();
done();
}
})
}
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_0100
* @tc.name : test isAudioRecorderConfigSupported false
* @tc.desc : 5 args all set wrong
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_0100', 0, async function (done) {
console.info("test getAudioRecorderCaps");
callbackAbnormalAudioRecorderConfigSupported(base.audioRecorderAbnormalAll, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_0200
* @tc.name : test isAudioRecorderConfigSupported false
* @tc.desc : FormatType is wrong
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_0200', 0, async function (done) {
console.info("test getAudioRecorderCaps");
callbackAbnormalAudioRecorderConfigSupported(base.audioRecorderAbnormalFormatType, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_0300
* @tc.name : test isAudioRecorderConfigSupported fasle
* @tc.desc : CodecMimeType is wrong
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_0300', 0, async function (done) {
console.info("test getAudioRecorderCaps");
callbackAbnormalAudioRecorderConfigSupported(base.audioRecorderAbnormalCodecMimeType, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_0400
* @tc.name : test isAudioRecorderConfigSupported false
* @tc.desc : bitrate is wrong
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_0400', 0, async function (done) {
console.info("test getAudioRecorderCaps");
callbackAbnormalAudioRecorderConfigSupported(base.audioRecorderAbnormalBitrate, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_0500
* @tc.name : test isAudioRecorderConfigSupported false
* @tc.desc : sampleRate is wrong
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_0500', 0, async function (done) {
console.info("test getAudioRecorderCaps");
callbackAbnormalAudioRecorderConfigSupported(base.audioRecorderAbnormalSampleRate, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_0600
* @tc.name : test isAudioRecorderConfigSupported false
* @tc.desc : channel is wrong
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_0600', 0, async function (done) {
console.info("test getAudioRecorderCaps");
callbackAbnormalAudioRecorderConfigSupported(base.audioRecorderAbnormalSampleChannel, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_0700
* @tc.name : test hasVideoRecorderProfile
* @tc.desc : sourceId 1 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_0700', 0, async function (done) {
console.info('test hasVideoRecorderProfile');
callbackAbnormalHasVideoProfile(1, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_0800
* @tc.name : test hasVideoRecorderProfile sourceId -1
* @tc.desc : sourceId -1 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_0800', 0, async function (done) {
console.info("test hasVideoRecorderProfile");
callbackAbnormalHasVideoProfile(-1, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_0900
* @tc.name : test hasVideoRecorderProfile qualityLevel -1
* @tc.desc : sourceId 0 qualityLevel -1
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_0900', 0, async function (done) {
console.info("test hasVideoRecorderProfile");
callbackAbnormalHasVideoProfile(0, -1, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_1000
* @tc.name : test hasVideoRecorderProfile sourceId 65536
* @tc.desc : sourceId 65535 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_1000', 0, async function (done) {
console.info("test hasVideoRecorderProfile");
callbackAbnormalHasVideoProfile(65535, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_1100
* @tc.name : test hasVideoRecorderProfile sourceId 65536
* @tc.desc : sourceId 65536 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_1100', 0, async function (done) {
console.info("test hasVideoRecorderProfile");
callbackAbnormalHasVideoProfile(65536, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_1200
* @tc.name : test hasVideoRecorderProfile qualityLevel 65536
* @tc.desc : sourceId 0 qualityLevel 65535
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_1200', 0, async function (done) {
console.info("test hasVideoRecorderProfile");
callbackAbnormalHasVideoProfile(0, 65535, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_1300
* @tc.name : test hasVideoRecorderProfile qualityLevel 65536
* @tc.desc : sourceId 0 qualityLevel 65536
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_1300', 0, async function (done) {
console.info("test hasVideoRecorderProfile");
callbackAbnormalHasVideoProfile(0, 65536, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_1400
* @tc.name : test getVideoRecorderProfile sourceId -1
* @tc.desc : sourceId -1 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_1400', 0, async function (done) {
console.info("test getVideoRecorderProfile");
callbackAbnormalGetVideoProfile(-1, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_1500
* @tc.name : test getVideoRecorderProfile qualityLevel -1
* @tc.desc : sourceId 0 qualityLevel -1
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_1500', 0, async function (done) {
console.info("test getVideoRecorderProfile");
callbackAbnormalGetVideoProfile(0, -1, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_1600
* @tc.name : test getVideoRecorderProfile sourceId 65535
* @tc.desc : sourceId 65535 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_1600', 0, async function (done) {
console.info("test getVideoRecorderProfile");
callbackAbnormalGetVideoProfile(65535, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_1700
* @tc.name : test getVideoRecorderProfile sourceId 65536
* @tc.desc : sourceId 65536 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_1700', 0, async function (done) {
console.info("test getVideoRecorderProfile");
callbackAbnormalGetVideoProfile(65536, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_1800
* @tc.name : test getVideoRecorderProfile qualityLevel 65535
* @tc.desc : sourceId 0 qualityLevel 65535
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_1800', 0, async function (done) {
console.info("test getVideoRecorderProfile");
callbackAbnormalGetVideoProfile(0, 65535, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_1900
* @tc.name : test getVideoRecorderProfile qualityLevel 65536
* @tc.desc : sourceId 0 qualityLevel 65536
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_CALLBACK_1900', 0, async function (done) {
console.info("test getVideoRecorderProfile");
callbackAbnormalGetVideoProfile(0, 65536, 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 * as base from './ProfileTestBase.js';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
export default function ProfileAbnormalTestPromise() {
describe('ProfileAbnormalTestPromise', 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 promiseAbnormalGetVideoProfile(sourceId, qualityLevel, done) {
media.getMediaCapability().then(async (mediaCaps) => {
console.info('getMediaCapability success');
if (typeof (mediaCaps) != 'undefined') {
mediaCaps.getVideoRecorderProfile(sourceId, qualityLevel).then(async (videoCapsArray) => {
base.checkVideoCapsArray(videoCapsArray);
console.info('getVideoRecorderProfile success');
done();
}, err => {
expect(err).assertUndefined();
done();
})
} else {
console.info('mediaCaps is undefined');
expect().assertFail();
done();
}
}, err => {
expect(err).assertUndefined();
done();
})
}
async function promiseAbnormalAudioRecoderConfigSupported(audioProfile, done) {
media.getMediaCapability().then(async (mediaCaps) => {
if (typeof (mediaCaps) != 'undefined') {
mediaCaps.isAudioRecoderConfigSupported(audioProfile).then(async (ean) => {
console.info('isAudioRecoderConfigSupported: success' + ean);
expect(ean).assertEqual(false);
console.info('isAudioRecoderConfigSupported: success');
done();
}, err => {
expect(err).assertUndefined();
done();
})
} else {
console.info('mediaCaps is undefined');
expect().assertFail();
done();
}
}, err => {
expect(err).assertUndefined();
done();
})
}
async function promiseAbnormalHasVideoProfile(sourceId, qualityLevel, done) {
media.getMediaCapability().then(async (mediaCaps) => {
console.info('getMediaCapability success');
if (typeof (mediaCaps) != 'undefined') {
mediaCaps.hasVideoRecorderProfile(sourceId, qualityLevel).then(async (ean) => {
expect(ean).assertEqual(false);
console.info('hasVideoRecorderProfile success');
done();
}, err => {
expect(err).assertUndefined();
done();
})
} else {
console.info('mediaCaps is undefined');
expect().assertFail();
done();
}
}, err => {
expect(err).assertUndefined();
done();
})
}
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_0100
* @tc.name : test isAudioRecoderConfigSupported false
* @tc.desc : 5 args all set wrong
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_0100', 0, async function (done) {
console.info("test getAudioRecorderCaps");
promiseAbnormalAudioRecoderConfigSupported(base.audioRecorderAbnormalAll, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_0200
* @tc.name : test isAudioRecoderConfigSupported false
* @tc.desc : FormatType is wrong
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_0200', 0, async function (done) {
console.info("test getAudioRecorderCaps");
promiseAbnormalAudioRecoderConfigSupported(base.audioRecorderAbnormalFormatType, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_0300
* @tc.name : test isAudioRecoderConfigSupported
* @tc.desc : CodecMimeType is wrong
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_0300', 0, async function (done) {
console.info("test getAudioRecorderCaps");
promiseAbnormalAudioRecoderConfigSupported(base.audioRecorderAbnormalCodecMimeType, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_0400
* @tc.name : test isAudioRecoderConfigSupported
* @tc.desc : bitrate is wrong
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_0400', 0, async function (done) {
console.info("test getAudioRecorderCaps");
promiseAbnormalAudioRecoderConfigSupported(base.audioRecorderAbnormalBitrate, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_0500
* @tc.name : test isAudioRecoderConfigSupported
* @tc.desc : sampleRate is wrong
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_0500', 0, async function (done) {
console.info("test getAudioRecorderCaps");
promiseAbnormalAudioRecoderConfigSupported(base.audioRecorderAbnormalSampleRate, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_0600
* @tc.name : test isAudioRecoderConfigSupported
* @tc.desc : channel is wrong
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_0600', 0, async function (done) {
console.info("test getAudioRecorderCaps");
promiseAbnormalAudioRecoderConfigSupported(base.audioRecorderAbnormalSampleChannel, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_0700
* @tc.name : test hasVideoRecorderProfile
* @tc.desc : sourceId 1 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_0700', 0, async function (done) {
console.info('test hasVideoRecorderProfile');
promiseAbnormalHasVideoProfile(1, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_0800
* @tc.name : test hasVideoRecorderProfile sourceId -1
* @tc.desc : sourceId -1 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_0800', 0, async function (done) {
console.info("test hasVideoRecorderProfile");
promiseAbnormalHasVideoProfile(-1, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_0900
* @tc.name : test hasVideoRecorderProfile qualityLevel -1
* @tc.desc : sourceId 0 qualityLevel -1
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_0900', 0, async function (done) {
console.info("test hasVideoRecorderProfile");
promiseAbnormalHasVideoProfile(0, -1, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_1000
* @tc.name : test hasVideoRecorderProfile sourceId 65536
* @tc.desc : sourceId 65535 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_1000', 0, async function (done) {
console.info("test hasVideoRecorderProfile");
promiseAbnormalHasVideoProfile(65535, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_1100
* @tc.name : test hasVideoRecorderProfile sourceId 65536
* @tc.desc : sourceId 65536 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_1100', 0, async function (done) {
console.info("test hasVideoRecorderProfile");
promiseAbnormalHasVideoProfile(65536, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_1200
* @tc.name : test hasVideoRecorderProfile qualityLevel 65536
* @tc.desc : sourceId 0 qualityLevel 65535
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_1200', 0, async function (done) {
console.info("test hasVideoRecorderProfile");
promiseAbnormalHasVideoProfile(0, 65535, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_1300
* @tc.name : test hasVideoRecorderProfile qualityLevel 65536
* @tc.desc : sourceId 0 qualityLevel 65536
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_1300', 0, async function (done) {
console.info("test hasVideoRecorderProfile");
promiseAbnormalHasVideoProfile(0, 65536, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_1400
* @tc.name : test getVideoRecorderProfile sourceId -1
* @tc.desc : sourceId -1 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_1400', 0, async function (done) {
console.info("test getVideoRecorderProfile");
promiseAbnormalGetVideoProfile(-1, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_1500
* @tc.name : test getVideoRecorderProfile qualityLevel -1
* @tc.desc : sourceId 0 qualityLevel -1
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_1500', 0, async function (done) {
console.info("test getVideoRecorderProfile");
promiseAbnormalGetVideoProfile(0, -1, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_1600
* @tc.name : test getVideoRecorderProfile sourceId 65535
* @tc.desc : sourceId 65535 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_1600', 0, async function (done) {
console.info("test getVideoRecorderProfile");
promiseAbnormalGetVideoProfile(65535, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_1700
* @tc.name : test getVideoRecorderProfile sourceId 65536
* @tc.desc : sourceId 65536 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_1700', 0, async function (done) {
console.info("test getVideoRecorderProfile");
promiseAbnormalGetVideoProfile(65536, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_1800
* @tc.name : test getVideoRecorderProfile qualityLevel 65535
* @tc.desc : sourceId 0 qualityLevel 65535
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_1800', 0, async function (done) {
console.info("test getVideoRecorderProfile");
promiseAbnormalGetVideoProfile(0, 65535, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_1900
* @tc.name : test getVideoRecorderProfile qualityLevel 65536
* @tc.desc : sourceId 0 qualityLevel 65536
* @tc.size : MediumTest
* @tc.type : Abnormal test
* @tc.level : Level2
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_RELIABILITY_PROMISE_1900', 0, async function (done) {
console.info("test getVideoRecorderProfile");
promiseAbnormalGetVideoProfile(0, 65536, 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 { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
const audioRecorderCaps = {
outputFormat: media.ContainerFormatType.CFT_MPEG_4A,
audioEncoderMime: media.CodecMimeType.AUDIO_AAC,
sampleRates: [8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000, 64000, 88200, 96000],
bitrateRange: { min: 1, max: 384000 },
channelRange: { min: 1, max: 2 },
}
const audioRecorderCapsArray = [audioRecorderCaps];
const videoRecorderCaps = {
audioRecorderCaps,
outputFormat: media.ContainerFormatType.CFT_MPEG_4,
videoEncoderMime: media.CodecMimeType.VIDEO_MPEG4,
videoWidthRange: { min: 2, max: 1920 },
videoBitrateRange: { min: 1, max: 3000000 },
videoFramerateRange: { min: 1, max: 30 },
videoHeightRange: { min: 2, max: 1080 },
}
const videoRecorderCaps2 = {
audioRecorderCaps,
outputFormat: media.ContainerFormatType.CFT_MPEG_4,
videoEncoderMime: media.CodecMimeType.VIDEO_AVC,
videoWidthRange: { min: 2, max: 1920 },
videoBitrateRange: { min: 1, max: 3000000 },
videoFramerateRange: { min: 1, max: 30 },
videoHeightRange: { min: 2, max: 1080 },
}
const videoRecorderCapsArray = [videoRecorderCaps, videoRecorderCaps2];
export const recorderQualityLowPara = {
audioBitrate: 96000,
audioChannels: 2,
audioCodec: media.CodecMimeType.AUDIO_AAC,
audioSampleRate: 48000,
durationTime: 30,
fileFormat: media.ContainerFormatType.CFT_MPEG_4,
qualityLevel: media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW,
videoBitrate: 192000,
videoCodec: media.CodecMimeType.VIDEO_MPEG4,
videoFrameWidth: 176,
videoFrameHeight: 144,
videoFrameRate: 30
};
export const recorderQualityHighPara = {
audioBitrate: 192000,
audioChannels: 2,
audioCodec: media.CodecMimeType.AUDIO_AAC,
audioSampleRate: 48000,
durationTime: 30,
fileFormat: media.ContainerFormatType.CFT_MPEG_4,
qualityLevel: media.VideoRecorderQualityLevel.RECORDER_QUALITY_HIGH,
videoBitrate: 17000000,
videoCodec: media.CodecMimeType.VIDEO_MPEG4,
videoFrameWidth: 1920,
videoFrameHeight: 1080,
videoFrameRate: 30
};
export const recorderQualityQcifPara = {
audioBitrate: 96000,
audioChannels: 2,
audioCodec: media.CodecMimeType.AUDIO_AAC,
audioSampleRate: 48000,
durationTime: 30,
fileFormat: media.ContainerFormatType.CFT_MPEG_4,
qualityLevel: media.VideoRecorderQualityLevel.RECORDER_QUALITY_QCIF,
videoBitrate: 192000,
videoCodec: media.CodecMimeType.VIDEO_MPEG4,
videoFrameWidth: 176,
videoFrameHeight: 144,
videoFrameRate: 30
};
export const recorderQualityCifPara = {
audioBitrate: 96000,
audioChannels: 2,
audioCodec: media.CodecMimeType.AUDIO_AAC,
audioSampleRate: 48000,
durationTime: 30,
fileFormat: media.ContainerFormatType.CFT_MPEG_4,
qualityLevel: media.VideoRecorderQualityLevel.RECORDER_QUALITY_CIF,
videoBitrate: 1536000,
videoCodec: media.CodecMimeType.VIDEO_MPEG4,
videoFrameWidth: 352,
videoFrameHeight: 288,
videoFrameRate: 30
};
export const recorderQuality480PPara = {
audioBitrate: 96000,
audioChannels: 2,
audioCodec: media.CodecMimeType.AUDIO_AAC,
audioSampleRate: 48000,
durationTime: 30,
fileFormat: media.ContainerFormatType.CFT_MPEG_4,
qualityLevel: media.VideoRecorderQualityLevel.RECORDER_QUALITY_480P,
videoBitrate: 5000000,
videoCodec: media.CodecMimeType.VIDEO_MPEG4,
videoFrameWidth: 640,
videoFrameHeight: 480,
videoFrameRate: 30
};
export const recorderQuality720PPara = {
audioBitrate: 192000,
audioChannels: 2,
audioCodec: media.CodecMimeType.AUDIO_AAC,
audioSampleRate: 48000,
durationTime: 30,
fileFormat: media.ContainerFormatType.CFT_MPEG_4,
qualityLevel: media.VideoRecorderQualityLevel.RECORDER_QUALITY_720P,
videoBitrate: 12000000,
videoCodec: media.CodecMimeType.VIDEO_MPEG4,
videoFrameWidth: 1280,
videoFrameHeight: 720,
videoFrameRate: 30
};
export const recorderQuality1080PPara = {
audioBitrate: 192000,
audioChannels: 2,
audioCodec: media.CodecMimeType.AUDIO_AAC,
audioSampleRate: 48000,
durationTime: 30,
fileFormat: media.ContainerFormatType.CFT_MPEG_4,
qualityLevel: media.VideoRecorderQualityLevel.RECORDER_QUALITY_1080P,
videoBitrate: 17000000,
videoCodec: media.CodecMimeType.VIDEO_MPEG4,
videoFrameWidth: 1920,
videoFrameHeight: 1080,
videoFrameRate: 30
};
export const recorderQualityQvgaPara = {
audioBitrate: 96000,
audioChannels: 2,
audioCodec: media.CodecMimeType.AUDIO_AAC,
audioSampleRate: 48000,
durationTime: 30,
fileFormat: media.ContainerFormatType.CFT_MPEG_4,
qualityLevel: media.VideoRecorderQualityLevel.RECORDER_QUALITY_QVGA,
videoBitrate: 1200000,
videoCodec: media.CodecMimeType.VIDEO_MPEG4,
videoFrameWidth: 320,
videoFrameHeight: 240,
videoFrameRate: 30
};
export const recorderQualityLowParaSourceId1 = {
audioBitrate: 0,
audioChannels: 0,
audioCodec: '',
audioSampleRate: 0,
durationTime: 0,
fileFormat: '',
qualityLevel: media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW,
videoBitrate: 0,
videoCodec: '',
videoFrameWidth: 0,
videoFrameHeight: 0,
videoFrameRate: 0
};
export const audioRecorderPara1 = {
outputFormat: media.ContainerFormatType.CFT_MPEG_4,
audioEncoderMime: media.CodecMimeType.AUDIO_AAC,
bitrate: 96000,
sampleRate: 48000,
channel: 2
};
export const audioRecorderPara2 = {
outputFormat: media.ContainerFormatType.CFT_MPEG_4,
audioEncoderMime: media.CodecMimeType.AUDIO_AAC,
bitrate: 192000,
sampleRate: 48000,
channel: 2
};
export const audioRecorderAbnormalAll = {
outputFormat: 'aaa',
audioEncoderMime: 'aaa',
bitrate: 655360,
sampleRate: 655360,
channel: 0
};
export const audioRecorderAbnormalFormatType = {
outputFormat: 'aaa',
audioEncoderMime: media.CodecMimeType.AUDIO_AAC,
bitrate: 96000,
sampleRate: 48000,
channel: 2
};
export const audioRecorderAbnormalCodecMimeType = {
outputFormat: media.ContainerFormatType.CFT_MPEG_4,
audioEncoderMime: 'aaa',
bitrate: 96000,
sampleRate: 48000,
channel: 2
};
export const audioRecorderAbnormalBitrate = {
outputFormat: media.ContainerFormatType.CFT_MPEG_4,
audioEncoderMime: media.CodecMimeType.AUDIO_AAC,
bitrate: 655360,
sampleRate: 48000,
channel: 2
};
export const audioRecorderAbnormalSampleRate = {
outputFormat: media.ContainerFormatType.CFT_MPEG_4,
audioEncoderMime: media.CodecMimeType.AUDIO_AAC,
bitrate: 96000,
sampleRate: 655360,
channel: 2
};
export const audioRecorderAbnormalSampleChannel = {
outputFormat: media.ContainerFormatType.CFT_MPEG_4,
audioEncoderMime: media.CodecMimeType.AUDIO_AAC,
bitrate: 96000,
sampleRate: 4800,
channel: 0
};
export function checkVideoCapsArray(videoCapsArray) {
let expectProfile = {
audioBitrate: 0,
audioChannels: 0,
audioCodec:'',
audioSampleRate: 0,
durationTime: 0,
fileFormat: '',
qualityLevel: 0,
videoBitrate: 0,
videoCodec: '',
videoFrameWidth: 0,
videoFrameHeight: 0,
videoFrameRate: 0,
};
expect(Object.keys(expectProfile).length).assertEqual(Object.keys(videoCapsArray).length);
let keys = Object.keys(videoCapsArray);
if (keys.length != 0) {
for (let i = 0; i < keys.length; i++) {
let key = keys[i];
expect(videoCapsArray[key]).assertEqual(expectProfile[key]);
console.info('check videoCapsArray success');
}
} else {
console.info('check videoCapsArray failed');
}
}
export function checkAudioArray(audioCapsArray, done) {
expect(audioCapsArray.length).assertEqual(audioRecorderCapsArray.length);
for (let i = 0; i < audioCapsArray.length; i++) {
expect(audioCapsArray[i].outputFormat).assertEqual(audioRecorderCapsArray[i].outputFormat);
expect(audioCapsArray[i].audioEncoderMime).assertEqual(audioRecorderCapsArray[i].audioEncoderMime);
for (let j = 0; j < audioCapsArray[i].sampleRates.length; j++) {
expect(audioCapsArray[i].sampleRates[j]).assertEqual(audioRecorderCapsArray[i].sampleRates[j]);
}
expect(audioCapsArray[i].bitrateRange.min).assertEqual(audioRecorderCapsArray[i].bitrateRange.min);
expect(audioCapsArray[i].bitrateRange.max).assertEqual(audioRecorderCapsArray[i].bitrateRange.max);
expect(audioCapsArray[i].channelRange.min).assertEqual(audioRecorderCapsArray[i].channelRange.min);
expect(audioCapsArray[i].channelRange.max).assertEqual(audioRecorderCapsArray[i].channelRange.max);
}
done();
}
export function checkVideoArray(videoCapsArray, done) {
expect(videoCapsArray.length).assertEqual(videoRecorderCapsArray.length);
for (let i = 0; i < videoCapsArray.length; i++) {
expect(videoCapsArray[i].audioEncoderMime).assertEqual
(videoRecorderCapsArray[i].audioRecorderCaps.audioEncoderMime);
for (let j = 0; j < videoCapsArray[i].audioSampleRates.length; j++) {
expect(videoCapsArray[i].audioSampleRates[j]).assertEqual
(videoRecorderCapsArray[i].audioRecorderCaps.sampleRates[j]);
}
expect(videoCapsArray[i].audioBitrateRange.min).assertEqual
(videoRecorderCapsArray[i].audioRecorderCaps.bitrateRange.min);
expect(videoCapsArray[i].audioBitrateRange.max).assertEqual
(videoRecorderCapsArray[i].audioRecorderCaps.bitrateRange.max);
expect(videoCapsArray[i].audioChannelRange.min).assertEqual
(videoRecorderCapsArray[i].audioRecorderCaps.channelRange.min);
expect(videoCapsArray[i].audioChannelRange.max).assertEqual
(videoRecorderCapsArray[i].audioRecorderCaps.channelRange.max);
expect(videoCapsArray[i].outputFormat).assertEqual
(videoRecorderCapsArray[i].outputFormat);
expect(videoCapsArray[i].videoWidthRange.min).assertEqual
(videoRecorderCapsArray[i].videoWidthRange.min);
expect(videoCapsArray[i].videoWidthRange.max).assertEqual
(videoRecorderCapsArray[i].videoWidthRange.max);
expect(videoCapsArray[i].videoBitrateRange.min).assertEqual
(videoRecorderCapsArray[i].videoBitrateRange.min);
expect(videoCapsArray[i].videoBitrateRange.max).assertEqual
(videoRecorderCapsArray[i].videoBitrateRange.max);
expect(videoCapsArray[i].videoFramerateRange.min).assertEqual
(videoRecorderCapsArray[i].videoFramerateRange.min);
expect(videoCapsArray[i].videoFramerateRange.max).assertEqual
(videoRecorderCapsArray[i].videoFramerateRange.max);
expect(videoCapsArray[i].videoHeightRange.min).assertEqual
(videoRecorderCapsArray[i].videoHeightRange.min);
expect(videoCapsArray[i].videoHeightRange.max).assertEqual
(videoRecorderCapsArray[i].videoHeightRange.max);
expect(videoCapsArray[i].videoEncoderMime).assertEqual
(videoRecorderCapsArray[i].videoEncoderMime);
}
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 * as base from './ProfileTestBase.js';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
export default function ProfileTestCallback() {
describe('ProfileTestCallback', 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') {
base.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') {
base.checkVideoArray(videoCapsArray, done);
} else {
console.info('videoCaps is not defined');
expect().assertFail();
done();
}
})
} else {
console.info('mediaCaps is not defined');
expect().assertFail();
done();
}
})
}
async function callbackGetVideoProfile(sourceId, qualityLevel, expectProfile, done) {
media.getMediaCapability((err, mediaCaps) => {
expect(err).assertUndefined();
console.info('getMediaCapability success');
if (typeof (mediaCaps) != 'undefined') {
mediaCaps.getVideoRecorderProfile(sourceId, qualityLevel, (err, videoCapsArray) => {
expect(err).assertUndefined();
console.info('getVideoRecorderProfile success');
expect(Object.keys(expectProfile).length).assertEqual(Object.keys(videoCapsArray).length);
let keys = Object.keys(videoCapsArray);
for (let i = 0; i < keys.length; i++) {
let key = keys[i];
expect(videoCapsArray[key]).assertEqual(expectProfile[key]);
}
done();
})
} else {
console.info('mediaCaps is undefined');
expect().assertFail();
done();
}
})
}
async function callbackAudioRecoderConfigSupported(audioProfile, done) {
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(true);
console.info('isAudioRecoderConfigSupported: success');
done();
})
} else {
console.info('mediaCaps is undefined');
expect().assertFail();
done();
}
})
}
async function callbackHasVideoProfile(sourceId, qualityLevel, done) {
media.getMediaCapability((err, mediaCaps) => {
expect(err).assertUndefined();
console.info('getMediaCapability success');
if (typeof (mediaCaps) != 'undefined') {
mediaCaps.hasVideoRecorderProfile(sourceId, qualityLevel, (err, ean) => {
expect(err).assertUndefined();
expect(ean).assertEqual(true);
console.info('hasVideoRecorderProfile success');
done();
})
} else {
console.info('mediaCaps is undefined');
expect().assertFail();
done();
}
})
}
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_0100
* @tc.name : test getAudioRecorderCaps
* @tc.desc : outputFormat/audioEncoderMime/sampleRates/bitrateRange/channelRange
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_0100', 0, async function (done) {
console.info("test getAudioRecorderCaps");
getAudioRecorderCapsTest(done);
console.info("test getAudioRecorderCaps success ");
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_0200
* @tc.name : test getVideoRecorderCapsTest
* @tc.desc : outputFormat/audioEncoderMime/audioSampleRates/videoEncoderMime/audioBitrateRange/
audioChannelRange/videoBitrateRange/videoFramerateRange/videoWidthRange/videoHeightRange
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_0200', 0, async function (done) {
console.info("test getAudioRecorderCaps");
getVideoRecorderCapsTest(done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_0300
* @tc.name : test getVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_0300', 0, async function (done) {
console.info("test getAudioRecorderCaps");
callbackGetVideoProfile(0,media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW,
base.recorderQualityLowPara, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_0400
* @tc.name : test getVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 1
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_0400', 0, async function (done) {
console.info("test getAudioRecorderCaps");
callbackGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_HIGH,
base.recorderQualityHighPara, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_0500
* @tc.name : test getVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 2
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_0500', 0, async function (done) {
console.info("test getAudioRecorderCaps");
callbackGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_QCIF,
base.recorderQualityQcifPara, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_0600
* @tc.name : test getVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 3
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_0600', 0, async function (done) {
console.info("test getAudioRecorderCaps");
callbackGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_CIF,
base.recorderQualityCifPara, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_0700
* @tc.name : test getVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 4
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_0700', 0, async function (done) {
console.info("test getAudioRecorderCaps");
callbackGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_480P,
base.recorderQuality480PPara, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_0800
* @tc.name : test getVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 5
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_0800', 0, async function (done) {
console.info("test getAudioRecorderCaps");
callbackGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_720P,
base.recorderQuality720PPara, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_0900
* @tc.name : test getVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 6
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_0900', 0, async function (done) {
console.info("test getAudioRecorderCaps");
callbackGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_1080P,
base.recorderQuality1080PPara, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_1000
* @tc.name : test getVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 7
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_1000', 0, async function (done) {
console.info("test getAudioRecorderCaps");
callbackGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_QVGA,
base.recorderQualityQvgaPara, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_1100
* @tc.name : test getVideoRecorderProfile
* @tc.desc : sourceId 1 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_1100', 0, async function (done) {
console.info("test getAudioRecorderCaps");
callbackGetVideoProfile(1, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW,
base.recorderQualityLowParaSourceId1, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_1200
* @tc.name : test isAudioRecoderConfigSupported
* @tc.desc : isAudioRecoderConfigSupported true
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_1200', 0, async function (done) {
console.info("test getAudioRecorderCaps");
callbackAudioRecoderConfigSupported(base.audioRecorderPara1, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_1300
* @tc.name : test isAudioRecoderConfigSupported
* @tc.desc : isAudioRecoderConfigSupported true
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_1300', 0, async function (done) {
console.info("test getAudioRecorderCaps");
callbackAudioRecoderConfigSupported(base.audioRecorderPara2, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_1400
* @tc.name : test hasVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_CALLBACK_1400', 0, async function (done) {
console.info('test hasVideoRecorderProfile');
callbackHasVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, 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 * as base from './ProfileTestBase.js';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
export default function ProfileTestPromise() {
describe('ProfileTestPromise', 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().then(async (mediaCaps) => {
console.info('getMediaCapability success');
if (typeof (mediaCaps) != 'undefined') {
mediaCaps.getAudioRecorderCaps().then(async (audioCapsArray) => {
console.info('getAudioRecorderCaps success');
if (typeof (audioCapsArray) != 'undefined') {
base.checkAudioArray(audioCapsArray, done);
} else {
console.info('audioCaps is undefined');
expect().assertFail();
done();
}
}, err => {
expect(err).assertUndefined();
done();
})
} else {
console.info('mediaCaps is undefined');
expect().assertFail();
done();
}
}, err => {
expect(err).assertUndefined();
done();
})
}
async function getVideoRecorderCapsTest(done) {
media.getMediaCapability().then(async (mediaCaps) => {
console.info('getMediaCapability success');
if (typeof (mediaCaps) != 'undefined') {
mediaCaps.getVideoRecorderCaps().then(async (videoCapsArray) => {
console.info('getVideoRecorderCaps success');
if (typeof (videoCapsArray) != 'undefined') {
base.checkVideoArray(videoCapsArray, done);
} else {
console.info('audioCaps is undefined');
expect().assertFail();
done();
}
}, err => {
expect(err).assertUndefined();
done();
})
} else {
console.info('mediaCaps is undefined');
expect().assertFail();
done();
}
}, err => {
expect(err).assertUndefined();
done();
})
}
async function promiseGetVideoProfile(sourceId, qualityLevel, expectProfile, done) {
media.getMediaCapability().then(async (mediaCaps) => {
console.info('getMediaCapability success');
if (typeof (mediaCaps) != 'undefined') {
mediaCaps.getVideoRecorderProfile(sourceId, qualityLevel).then(async (videoCapsArray) => {
console.info('getVideoRecorderProfile success');
expect(Object.keys(expectProfile).length).assertEqual(Object.keys(videoCapsArray).length);
let keys = Object.keys(videoCapsArray);
for (let i = 0; i < keys.length; i++) {
let key = keys[i];
expect(videoCapsArray[key]).assertEqual(expectProfile[key]);
}
done();
}, err => {
expect(err).assertUndefined();
done();
})
} else {
console.info('mediaCaps is undefined');
expect().assertFail();
done();
}
}, err => {
expect(err).assertUndefined();
done();
})
}
async function promiseAudioRecoderConfigSupported(audioProfile, done) {
media.getMediaCapability().then(async (mediaCaps) => {
console.info('getMediaCapability success');
if (typeof (mediaCaps) != 'undefined') {
mediaCaps.isAudioRecoderConfigSupported(audioProfile).then(async (ean) => {
console.info('isAudioRecoderConfigSupported: success' + ean);
expect(ean).assertEqual(true);
console.info('isAudioRecoderConfigSupported: success');
done();
}, err => {
expect(err).assertUndefined();
done();
})
} else {
console.info('mediaCaps is undefined');
expect().assertFail();
done();
}
}, err => {
expect(err).assertUndefined();
done();
})
}
async function promiseHasVideoProfile(sourceId, qualityLevel, done) {
media.getMediaCapability().then(async (mediaCaps) => {
console.info('getMediaCapability success');
if (typeof (mediaCaps) != 'undefined') {
mediaCaps.hasVideoRecorderProfile(sourceId, qualityLevel).then(async (ean) => {
expect(ean).assertEqual(true);
console.info('hasVideoRecorderProfile success');
done();
}, err => {
expect(err).assertUndefined();
done();
})
} else {
console.info('mediaCaps is undefined');
expect().assertFail();
done();
}
}, err => {
expect(err).assertUndefined();
done();
})
}
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_0100
* @tc.name : test getAudioRecorderCaps
* @tc.desc : outputFormat/audioEncoderMime/sampleRates/bitrateRange/channelRange
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_0100', 0, async function (done) {
console.info("test getAudioRecorderCaps");
getAudioRecorderCapsTest(done);
console.info("test getAudioRecorderCaps success ");
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_0200
* @tc.name : test getVideoRecorderCapsTest
* @tc.desc : outputFormat/audioEncoderMime/audioSampleRates/videoEncoderMime/audioBitrateRange/
audioChannelRange/videoBitrateRange/videoFramerateRange/videoWidthRange/videoHeightRange
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_0200', 0, async function (done) {
console.info("test getAudioRecorderCaps");
getVideoRecorderCapsTest(done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_0300
* @tc.name : test getVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_0300', 0, async function (done) {
console.info("test getAudioRecorderCaps");
promiseGetVideoProfile(0,media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW,
base.recorderQualityLowPara, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_0400
* @tc.name : test getVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 1
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_0400', 0, async function (done) {
console.info("test getAudioRecorderCaps");
promiseGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_HIGH,
base.recorderQualityHighPara, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_0500
* @tc.name : test getVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 2
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_0500', 0, async function (done) {
console.info("test getAudioRecorderCaps");
promiseGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_QCIF,
base.recorderQualityQcifPara, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_0600
* @tc.name : test getVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 3
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_0600', 0, async function (done) {
console.info("test getAudioRecorderCaps");
promiseGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_CIF,
base.recorderQualityCifPara, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_0700
* @tc.name : test getVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 4
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_0700', 0, async function (done) {
console.info("test getAudioRecorderCaps");
promiseGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_480P,
base.recorderQuality480PPara, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_0800
* @tc.name : test getVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 5
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_0800', 0, async function (done) {
console.info("test getAudioRecorderCaps");
promiseGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_720P,
base.recorderQuality720PPara, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_0900
* @tc.name : test getVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 6
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_0900', 0, async function (done) {
console.info("test getAudioRecorderCaps");
promiseGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_1080P,
base.recorderQuality1080PPara, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_1000
* @tc.name : test getVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 7
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_1000', 0, async function (done) {
console.info("test getAudioRecorderCaps");
promiseGetVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_QVGA,
base.recorderQualityQvgaPara, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_1100
* @tc.name : test getVideoRecorderProfile
* @tc.desc : sourceId 1 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_1100', 0, async function (done) {
console.info("test getAudioRecorderCaps");
promiseGetVideoProfile(1, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW,
base.recorderQualityLowParaSourceId1, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_1200
* @tc.name : test isAudioRecoderConfigSupported
* @tc.desc : isAudioRecoderConfigSupported true
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_1200', 0, async function (done) {
console.info("test getAudioRecorderCaps");
promiseAudioRecoderConfigSupported(base.audioRecorderPara1, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_1300
* @tc.name : test isAudioRecoderConfigSupported
* @tc.desc : isAudioRecoderConfigSupported true
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_1300', 0, async function (done) {
console.info("test getAudioRecorderCaps");
promiseAudioRecoderConfigSupported(base.audioRecorderPara2, done);
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_1400
* @tc.name : test hasVideoRecorderProfile
* @tc.desc : sourceId 0 qualityLevel 0
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level1
*/
it('SUB_MULTIMEDIA_MEDIA_PROFILE_FUNCTION_PROMISE_1400', 0, async function (done) {
console.info('test hasVideoRecorderProfile');
promiseHasVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done);
})
})
}
{
"string": [
{
"name": "entry_MainAbility",
"value": "entry_MainAbility"
},
{
"name": "mainability_description",
"value": "JS_Empty Ability"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "TestAbility_desc",
"value": "description"
},
{
"name": "TestAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册