diff --git a/multimedia/camera/camera_js_standard/BUILD.gn b/multimedia/camera/camera_js_standard/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..375b7dcf64f0087e46f547561797210e6f4625e7 --- /dev/null +++ b/multimedia/camera/camera_js_standard/BUILD.gn @@ -0,0 +1,35 @@ +# Copyright (C) 2021 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("camera_standard_ets_hap") { + hap_profile = "./src/main/config.json" + deps = [] + + # shared_libraries = [ + # "//third_party/giflib:libgif", + # "//third_party/libpng:libpng", + # ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "CameraStandardETSTest" + + # part_name = "prebuilt_hap" + # subsystem_name = "xts" +} +ohos_js_assets("camera_standard_ets_assets") { + source_dir = "./src/main/ets/default" +} +ohos_resources("camera_standard_ets_resources") { + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" +} diff --git a/multimedia/camera/camera_js_standard/Test.json b/multimedia/camera/camera_js_standard/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..d76409f1870765db967659329199f8909a48045f --- /dev/null +++ b/multimedia/camera/camera_js_standard/Test.json @@ -0,0 +1,29 @@ +{ + "description": "Configuration for camerastandard Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "1000000", + "package": "com.example.cameramoduletestetsv2", + "shell-timeout": "60000" + }, + "kits": [ + { + "type": "ShellKit", + "run-command": [ + "touch /data/media/01.mp4", + "chmod -R 777 /data/media", + "setenforce 0" + ], + "teardown-command":[ + "setenforce 1" + ] + }, + { + "test-file-name": [ + "CameraStandardETSTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} \ No newline at end of file diff --git a/multimedia/camera/camera_js_standard/signature/openharmony_sx.p7b b/multimedia/camera/camera_js_standard/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/multimedia/camera/camera_js_standard/signature/openharmony_sx.p7b differ diff --git a/multimedia/camera/camera_js_standard/src/main/config.json b/multimedia/camera/camera_js_standard/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..70bf94f4f753a8b9faee64931f4c98992bdcffbe --- /dev/null +++ b/multimedia/camera/camera_js_standard/src/main/config.json @@ -0,0 +1,92 @@ +{ + "app": { + "bundleName": "com.example.cameramoduletestetsv2", + "vendor": "example", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.cameramoduletestetsv2", + "name": ".MyApplication", + "mainAbility": "com.example.cameramoduletestetsv2.MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "visible": true, + "name": "com.example.cameramoduletestetsv2.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ], + "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.CAMERA", + "reason" : "use ohos.permission.CAMERA" + }, + { + "name" : "ohos.permission.MICROPHONE", + "reason" : "use ohos.permission.MICROPHONE" + }, + { + "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" + } + ] + } +} \ No newline at end of file diff --git a/multimedia/camera/camera_js_standard/src/main/ets/default/app.ets b/multimedia/camera/camera_js_standard/src/main/ets/default/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..a9f8218978fad817d4519aa1b715da0e3f8ebbfc --- /dev/null +++ b/multimedia/camera/camera_js_standard/src/main/ets/default/app.ets @@ -0,0 +1,23 @@ +/* + * 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('Application onCreate') + }, + onDestroy() { + console.info('Application onDestroy') + }, +} diff --git a/multimedia/camera/camera_js_standard/src/main/ets/default/pages/index.ets b/multimedia/camera/camera_js_standard/src/main/ets/default/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..4e2254a87c2ffb71ce039aa3fae559964f3a5af3 --- /dev/null +++ b/multimedia/camera/camera_js_standard/src/main/ets/default/pages/index.ets @@ -0,0 +1,119 @@ +/* + * 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 {Core, ExpectExtend} from "deccjsunit/index" +//import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index" +import cameraKit from "../test/Camera.test" +import featureAbility from "@ohos.ability.featureAbility" +//import {PreviewArea} from '../view/PreviewArea.ets' + +let TAG = 'CameraModuleTest: ' +var mXComponentController: XComponentController = new XComponentController() +var surfaceId: any + +@Entry +@Component +struct CameraIndex { + @State isShowSettings: boolean = false + @State previewSize: string = '75%' + + aboutToAppear() { + console.info('--------------aboutToAppear--------------') +// featureAbility.getWant() +// .then((Want) => { +// const core = Core.getInstance() +//// const instrumentLog = new InstrumentLog({ +//// 'id': 'report', 'unity': 'true' +//// }) +//// console.info(TAG + 'Entering instrumentLog') +// const expectExtend = new ExpectExtend({ +// 'id': 'extend' +// }) +// console.info(TAG + 'Entering expectExtend') +// core.addService('expect', expectExtend) +//// core.addService('report', instrumentLog) +// console.info(TAG + 'Entering addService') +// core.init() +// console.info(TAG + 'Entering core.init()') +//// core.subscribeEvent('spec', instrumentLog) +//// core.subscribeEvent('suite', instrumentLog) +//// core.subscribeEvent('task', instrumentLog) +// console.info(TAG + 'Entering subscribeEvent') +// const configService = core.getDefaultService('config') +// configService.setConfig(Want.parameters) +// console.info(TAG + 'Entering configService') +// cameraKit(surfaceId) +//// console.info(TAG + 'Entering PreviewArea') +//// PreviewArea({ +//// previewSize: $previewSize +//// }) +// core.execute() +// console.info(TAG + 'Operation successful. Data: ' + JSON.stringify(Want)); +// }) +// .catch((error) => { +// console.error(TAG + 'Operation failed. Cause: ' + JSON.stringify(error)); +// }) + } + + /*build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + }*/ + build() { + Flex() { + XComponent({ + id: '', + type: 'surface', + libraryname: '', + source: '', + controller: mXComponentController + }) + .onLoad(() => { + console.info('CameraModuleTest: OnLoad() is called!') + surfaceId = mXComponentController.getXComponentSurfaceId() + console.info('CameraModuleTest: XComponent onLoad surfaceId: ' + surfaceId) + featureAbility.getWant() + .then((Want) => { + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + console.info(TAG + 'Entering expectExtend') + core.addService('expect', expectExtend) + console.info(TAG + 'Entering addService') + core.init() + console.info(TAG + 'Entering core.init()') + console.info(TAG + 'Entering subscribeEvent') + const configService = core.getDefaultService('config') + configService.setConfig(Want.parameters) + console.info(TAG + 'Entering configService') + cameraKit(surfaceId) + core.execute() + console.info(TAG + 'Operation successful. Data: ' + JSON.stringify(Want)); + }) + .catch((error) => { + console.error(TAG + 'Operation failed. Cause: ' + JSON.stringify(error)); + }) + }) + .width('640px') + .height('480px') + } + } +} \ No newline at end of file diff --git a/multimedia/camera/camera_js_standard/src/main/ets/default/test/Camera.test.ets b/multimedia/camera/camera_js_standard/src/main/ets/default/test/Camera.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..0fc452e02e1740918bdf5c608567b75c0ffc0673 --- /dev/null +++ b/multimedia/camera/camera_js_standard/src/main/ets/default/test/Camera.test.ets @@ -0,0 +1,29 @@ +/* + * 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 cameraTestCase from '../test/CameraJSUnitPhotoPromise.test' +import cameraTestCase from '../test/CameraJSUnitVideoPromise.test' +import cameraTestCase from '../test/CameraJSUnitCameraFormat.test' +import cameraTestCase from '../test/CameraJSUnitPhotoAsync.test' +import cameraTestCase from '../test/CameraJSUnitVideoAsync.test' + +let TAG = 'CameraModuleTest: ' + +export default function cameraKit(surfaceId:any) { + console.info(TAG + 'Entering cameraKit') + console.info(TAG + 'surfaceId: ' +surfaceId) + cameraTestCase(surfaceId) +// cameraService() +} \ No newline at end of file diff --git a/multimedia/camera/camera_js_standard/src/main/ets/default/test/CameraJSUnitCameraFormat.test.ets b/multimedia/camera/camera_js_standard/src/main/ets/default/test/CameraJSUnitCameraFormat.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..1c57724d074619c288c3516a495358404df8e275 --- /dev/null +++ b/multimedia/camera/camera_js_standard/src/main/ets/default/test/CameraJSUnitCameraFormat.test.ets @@ -0,0 +1,4845 @@ +/* + * 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 cameraObj from '@ohos.multimedia.camera'; +import image from '@ohos.multimedia.image'; +import fileio from '@ohos.fileio'; +import abilityAccessCtrl from '@ohos.abilityAccessCtrl' +import bundle from '@ohos.bundle' + +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; + +const TAG = "CameraModuleTest: "; + +// Define global variables + +var cameraManager; +var surfaceId1; + +// CAMERA-0 Variables +var camera0Input, camera0InputPosBack, camera0InputPosFront; +var camera0InputPromise, camera0InputPromisePosBack, camera0InputPromisePosFront; +// CAMERA-1 Variables +var camera1Input, camera1InputPosBack, camera1InputPosFront; +var camera1InputPromise, camera1InputPromisePosBack, camera1InputPromisePosFront; +// CAMERA-2 Variables +var camera2Input, camera2InputPosBack, camera2InputPosFront; +var camera2InputPromise, camera2InputPromisePosBack, camera2InputPromisePosFront; +// CAMERA-3 Variables +var camera3Input, camera3InputPosBack, camera3InputPosFront; +var camera3InputPromise, camera3InputPromisePosBack, camera3InputPromisePosFront; + +var PermissionFlag = { + PERMISSION_USER_SET: 1, + PERMISSION_USER_FIXED: 2, + PERMISSION_SYSTEM_FIXED: 3 +}; + +const RESULT_FAIL = -1 +const TIMEOUT = 1000; +const DEFAULT_PERMISSION_FALG = 0 +var permissionNameUser = "ohos.permission.CAMERA"; +var tokenID = undefined + + +export default function cameraTestCase(surfaceId:any) { + + async function getImageReceiverSurfaceId() { + console.log(TAG + 'Entering create Image receiver') + var receiver = image.createImageReceiver(640, 480, 4, 8) + console.log(TAG + 'before receiver check') + if (receiver !== undefined) { + console.log(TAG + 'Receiver is ok') + surfaceId1 = await receiver.getReceivingSurfaceId() + console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) + } else { + console.log(TAG + 'Receiver is not ok') + } + } + +describe('CreateCamera_CameraFormat_Size', function () { + var camerasArray; + + console.log('##########start AccessTokenTests'); + beforeAll(async function (done){ + var appInfo = await bundle.getApplicationInfo('com.example.cameramoduletestetsv2',0 ,100); + tokenID = appInfo.accessTokenId; + console.info(TAG + "AccessTokenTest accessTokenId:" + appInfo.accessTokenId + ", name:"+ appInfo.name + + ", bundleName:" + appInfo.bundleName) + sleep(TIMEOUT); + console.info(TAG + "Grant permission start"); + var atManager = abilityAccessCtrl.createAtManager(); + var result = await atManager.grantUserGrantedPermission(tokenID, permissionNameUser, + PermissionFlag.PERMISSION_USER_FIXED); + console.info(TAG + "Grant permission finish, result:" + result + ", TokenID:" + tokenID); + done(); + }) + afterEach(function(){ + }) + + function sleep(ms) { + console.info(TAG + "Entering sleep -> Promise constructor"); + return new Promise(resolve => setTimeout(resolve, ms)); + } + + /** + * @tc.number : GET_CAMERA_MANAGER_TC_001 + * @tc.name : Create camera manager instance async api + * @tc.desc : Create camera manager instance async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_CAMERA_MANAGER_TC_001', 0, async function (done) { + console.info("--------------GET_CAMERA_MANAGER_TC_001--------------"); + cameraObj.getCameraManager(null, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_CAMERA_MANAGER_TC_001 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering GET_CAMERA_MANAGER_TC_001 data is not null || undefined"); + cameraManager = data; + expect(true).assertTrue(); + console.info(TAG + "Entering GET_CAMERA_MANAGER_TC_001 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_CAMERA_MANAGER_TC_001 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_CAMERA_MANAGER_TC_001 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_CAMERA_MANAGER_PROMISE_TC_002 + * @tc.name : Create camera manager instance promise api + * @tc.desc : Create camera manager instance promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_CAMERA_MANAGER_PROMISE_TC_002', 0, async function (done) { + console.info("--------------GET_CAMERA_MANAGER_PROMISE_TC_002--------------"); + var cameraManagerPromise = await cameraObj.getCameraManager(null); + console.info(TAG + "Entering GET_CAMERA_MANAGER_PROMISE_TC_002 cameraManagerPromise: " + JSON.stringify(cameraManagerPromise)); + if (cameraManagerPromise != null && cameraManagerPromise != undefined) { + expect(true).assertTrue(); + console.info(TAG + "Entering GET_CAMERA_MANAGER_PROMISE_TC_002 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_CAMERA_MANAGER_PROMISE_TC_002 FAILED"); + } + console.info(TAG + "Entering GET_CAMERA_MANAGER_PROMISE_TC_002 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_CAMERAS_TC_003 + * @tc.name : Get camera from cameramanager to get array of camera async api + * @tc.desc : Get camera from cameramanager to get array of camera async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_CAMERAS_TC_003', 0, async function (done) { + console.info("--------------GET_CAMERAS_TC_003--------------"); + cameraManager.getCameras(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_CAMERAS_TC_003 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering GET_CAMERAS_TC_003 data is not null || undefined"); + camerasArray = data; + if (camerasArray != null && camerasArray.length > 0) { + for (var i = 0; i < camerasArray.length; i++) { + // Get the variables from camera object + var cameraId = camerasArray[i].cameraId; + console.info(TAG + "Entering GET_CAMERAS_TC_003 camera" + i + "Id: " + cameraId); + var cameraPosition = camerasArray[i].cameraPosition; + console.info(TAG + "Entering GET_CAMERAS_TC_003 camera" + i + "Position: " + cameraPosition); + var cameraType = camerasArray[i].cameraType; + console.info(TAG + "Entering GET_CAMERAS_TC_003 camera" + i + "Type: " + cameraType); + var connectionType = camerasArray[i].connectionType + console.info(TAG + "Entering GET_CAMERAS_TC_003 connection" + i + "Type: " + connectionType); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_CAMERAS_TC_003 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_CAMERAS_TC_003 FAILED cameraArray is null || undefined"); + } + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_CAMERAS_TC_003 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_CAMERAS_TC_003 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_CAMERAS_PROMISE_TC_004 + * @tc.name : Get camera from cameramanager to get array of camera promise api + * @tc.desc : Get camera from cameramanager to get array of camera promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_CAMERAS_PROMISE_TC_004', 0, async function (done) { + console.info("--------------GET_CAMERAS_PROMISE_TC_004--------------"); + var camerasArrayPromise = await cameraManager.getCameras(); + console.info(TAG + "Entering GET_CAMERAS_PROMISE_TC_004: " + JSON.stringify(camerasArrayPromise)); + if (camerasArrayPromise != null && camerasArrayPromise.length > 0) { + console.info(TAG + "Entering GET_CAMERAS_PROMISE_TC_004 success"); + for (var i = 0; i < camerasArrayPromise.length; i++) { + // Get the variables from camera object + var cameraId = camerasArrayPromise[i].cameraId; + console.info(TAG + "Entering GET_CAMERAS_PROMISE_TC_004 camera" + i + "Id: " + cameraId); + var cameraPosition = camerasArrayPromise[i].cameraPosition; + console.info(TAG + "Entering GET_CAMERAS_PROMISE_TC_004 camera" + i + "Position: " + cameraPosition); + var cameraType = camerasArrayPromise[i].cameraType; + console.info(TAG + "Entering GET_CAMERAS_PROMISE_TC_004 camera" + i + "Type: " + cameraType); + var connectionType = camerasArrayPromise[i].connectionType + console.info(TAG + "Entering GET_CAMERAS_PROMISE_TC_004 connection" + i + "Type: " + connectionType); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_CAMERAS_PROMISE_TC_004 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_CAMERAS_PROMISE_TC_004 FAILED"); + } + console.info(TAG + "Entering GET_CAMERAS_PROMISE_TC_004 ends here"); + await sleep(1000); + done(); + }) + + /*CAMERA-0 Scripts*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_TC_005 + * @tc.name : Create camerainput from camera-0 cameraId async api + * @tc.desc : Create camerainput from camera-0 cameraId async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_TC_005', 0, async function (done) { + console.info("--------------CAMERA-0 STARTS HERE--------------"); + console.info("--------------CREATE_CAMERA_INPUT_TC_005--------------"); + cameraManager.createCameraInput(camerasArray[0].cameraId, async (err, data) => { + if (!err) { + if (data != null && data != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_005 data is not null || undefined"); + camera0Input = data; + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_005 PASSED with CameraID :" + camerasArray[0].cameraId); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_005 FAILED: " + err.message); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_005 ends here"); + camera0Input.release(); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_PROMISE_TC_006 + * @tc.name : Create camerainput from camera-0 cameraId promise api + * @tc.desc : Create camerainput from camera-0 cameraId promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_PROMISE_TC_006', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_PROMISE_TC_006--------------"); + camera0InputPromise = await cameraManager.createCameraInput(camerasArray[0].cameraId); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_006 camera0InputPromise: " + JSON.stringify(camera0InputPromise)); + if (camera0InputPromise != null && camera0InputPromise != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_006 camera0InputPromise is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_006 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_006 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_006 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POSITION_TYPE_TC_007 + * @tc.name : Create camerainput from camera-0 cameraposition & cameratype async api + * @tc.desc : Create camerainput from camera-0 cameraposition & cameratype async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POSITION_TYPE_TC_007', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POSITION_TYPE_TC_007--------------"); + cameraManager.createCameraInput(camerasArray[0].cameraPosition, camerasArray[0].cameraType, async (err, data) => { + if (!err || err.message != "Failed to get create camera input arguments!") { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_007 success"); + if (data == null || data == undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_007 data is null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_007 PASSED"); + } else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_007 FAILED: " + err.message); + expect().assertFail(); + } + } else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_007 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_007 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_008 + * @tc.name : Create camerainput from camera-0 cameraposition & cameratype promise api + * @tc.desc : Create camerainput from camera-0 cameraposition & cameratype promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_008', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_008--------------"); + var cameraInputPromise = await cameraManager.createCameraInput(camerasArray[0].cameraPosition, camerasArray[0].cameraType); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_008 cameraInputPromise: " + JSON.stringify(cameraInputPromise)); + if (cameraInputPromise == undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_008 cameraInputPromise is null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_008 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_008 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_008 ends here"); + await sleep(1000); + done(); + }) + + /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_TC_009 + * @tc.name : Get supported preview formats from camera-0 camerainput async api + * @tc.desc : Get supported preview formats from camera-0 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_TC_009', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_TC_009--------------"); + camera0InputPromise.getSupportedPreviewFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_009 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_009 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_009 cameraFormat: " + data[i]); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_009 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_009 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_009 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_010 + * @tc.name : Get supported preview formats from camera-0 camerainput promise api + * @tc.desc : Get supported preview formats from camera-0 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_010', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_010--------------"); + var cam0FormatPromise = await camera0InputPromise.getSupportedPreviewFormats(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_010: " + JSON.stringify(cam0FormatPromise)); + if (cam0FormatPromise != null && cam0FormatPromise.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_010 is not null || undefined"); + for (var i = 0; i < cam0FormatPromise.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_010 cam0FormatPromise: " + cam0FormatPromise[i]); + } + expect(true).assertTrue(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_010 PASSED"); + } else { + expect().assertFail(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_010 FAILED"); + } + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_010 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_011 + * @tc.name : Get supported sizes using camera-0 cameraformat & camerainput async api + * @tc.desc : Get supported sizes using camera-0 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_011', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_011--------------"); + camera0InputPromise.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YCRCb_420_SP, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_011 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_011 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_011 sizeArray: width * height - " +data[i].width + " * " +data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_011 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_011 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_011 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_012 + * @tc.name : Get supported sizes using camera-0 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes using camera-0 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_012', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_012--------------"); + var sizeArrayPromise = await camera0InputPromise.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YCRCb_420_SP); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_012 sizeArrayPromise"); + if (sizeArrayPromise != null && sizeArrayPromise.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_012 size0ArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_012 size0ArrayPromise: width * height - " +sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_012 PASSED"); + } else { + expect().assertFail(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_012 FAILED"); + } + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_012 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_TC_013 + * @tc.name : Get supported photo format from camera-0 camerainput async api + * @tc.desc : Get supported photo format from camera-0 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_TC_013', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_TC_013--------------"); + camera0InputPromise.getSupportedPhotoFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_013 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_013 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_013 cameraFormat: " + data[i]); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_013 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_013 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_013 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_014 + * @tc.name : Get supported photo format from camera-0 camerainput promise api + * @tc.desc : Get supported photo format from camera-0 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_014', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_014--------------"); + var cam0FormatPromise = await camera0InputPromise.getSupportedPhotoFormats(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_014: " + JSON.stringify(cam0FormatPromise)); + if (cam0FormatPromise != null && cam0FormatPromise.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_014 is not null || undefined"); + for (var i = 0; i < cam0FormatPromise.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_014 cam0FormatPromise: " + cam0FormatPromise[i]); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_014 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_014 FAILED"); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_014 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_015 + * @tc.name : Get supported sizes from camera-0 cameraformat & camerainput async api + * @tc.desc : Get supported sizes from camera-0 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_015', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_015--------------"); + camera0InputPromise.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_015 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_015 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_015 sizeArray: width * height - " +data[i].width + " * " +data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_015 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_015 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_015 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_016 + * @tc.name : Get supported sizes from camera-0 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes from camera-0 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_016', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_016--------------"); + var sizeArrayPromise = await camera0InputPromise.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_016: "); + if (sizeArrayPromise != null && sizeArrayPromise != undefined) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_016 sizeArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_016 sizeArrayPromise: width * height - " +sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_016 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_016 FAILED"); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_016 ends here"); + await sleep(1000); + done(); + }) + + /*CREATE CAMERAINPUT WITH POSITION BACK & TYPE UNSPECIFIED*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_017 + * @tc.name : Create camerainput from camera-0 cameraposition back & cameratype unspecified async api + * @tc.desc : Create camerainput from camera-0 cameraposition back & cameratype unspecified async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_017', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_017--------------"); + camera0InputPromise.release(); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_017 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_017 data is not null || undefined"); + camera0InputPosBack = data; + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_017 PASSED"); + } + } else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_017 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_017 ends here"); + camera0InputPosBack.release(); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_018 + * @tc.name : Create camerainput from camera-0 cameraposition back & cameratype unspecified promise api + * @tc.desc : Create camerainput from camera-0 cameraposition back & cameratype unspecified promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_018', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_018--------------"); + camera0InputPromisePosBack = await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_018 camera0InputPromisePosBack: " + JSON.stringify(camera0InputPromisePosBack)); + if (camera0InputPromisePosBack != null && camera0InputPromisePosBack != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_018 camera0InputPromisePosBack is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_018 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_018 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_018 ends here"); + await sleep(1000); + done(); + }) + + /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_TC_019 + * @tc.name : Get supported preview formats from camera-0 camerainput async api + * @tc.desc : Get supported preview formats from camera-0 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_TC_019', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_TC_019--------------"); + camera0InputPromisePosBack.getSupportedPreviewFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_019 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_019 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_019 cameraFormat: " + data[i]); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_019 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_019 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_019 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_020 + * @tc.name : Get supported preview formats from camera-0 camerainput promise api + * @tc.desc : Get supported preview formats from camera-0 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_020', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_020--------------"); + var cam0FormatPromisePosBack = await camera0InputPromisePosBack.getSupportedPreviewFormats(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_020: " + JSON.stringify(cam0FormatPromisePosBack)); + if (cam0FormatPromisePosBack != null && cam0FormatPromisePosBack.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_020 is not null || undefined"); + for (var i = 0; i < cam0FormatPromisePosBack.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_020 cam0FormatPromisePosBack: " + cam0FormatPromisePosBack[i]); + } + expect(true).assertTrue(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_020 PASSED"); + } else { + expect().assertFail(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_020 FAILED"); + } + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_020 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_021 + * @tc.name : Get supported sizes using camera-0 cameraformat & camerainput async api + * @tc.desc : Get supported sizes using camera-0 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_021', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_021--------------"); + camera0InputPromisePosBack.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YCRCb_420_SP, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_021 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_021 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_021 sizeArray: width * height - " +data[i].width + " * " +data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_021 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_021 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_021 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_022 + * @tc.name : Get supported sizes using camera-0 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes using camera-0 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_022', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_022--------------"); + var sizeArrayPromise = await camera0InputPromisePosBack.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YCRCb_420_SP); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_022 sizeArrayPromise: "); + if (sizeArrayPromise != null && sizeArrayPromise.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_022 size0ArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_022 size0ArrayPromise: width * height - " +sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_022 PASSED"); + } else { + expect().assertFail(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_022 FAILED"); + } + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_022 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_TC_023 + * @tc.name : Get supported photo format from camera-0 camerainput async api + * @tc.desc : Get supported photo format from camera-0 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_TC_023', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_TC_023--------------"); + camera0InputPromisePosBack.getSupportedPhotoFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_023 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_023 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_023 cameraFormat: " + data[i]); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_023 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_023 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_023 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_024 + * @tc.name : Get supported photo format from camera-0 camerainput promise api + * @tc.desc : Get supported photo format from camera-0 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_024', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_024--------------"); + var cam0FormatPromisePosBack = await camera0InputPromisePosBack.getSupportedPhotoFormats(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_024: " + JSON.stringify(cam0FormatPromisePosBack)); + if (cam0FormatPromisePosBack != null && cam0FormatPromisePosBack.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_024 is not null || undefined"); + for (var i = 0; i < cam0FormatPromisePosBack.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_024 cam0FormatPromisePosBack: " + cam0FormatPromisePosBack[i]); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_024 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_024 FAILED"); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_024 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_025 + * @tc.name : Get supported sizes from camera-0 cameraformat & camerainput async api + * @tc.desc : Get supported sizes from camera-0 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_025', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_025--------------"); + camera0InputPromisePosBack.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_025 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_025 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_025 sizeArray: width * height - " +data[i].width + " * " +data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_025 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_025 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_025 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_026 + * @tc.name : Get supported sizes from camera-0 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes from camera-0 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_026', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_026--------------"); + var sizeArrayPromise = await camera0InputPromisePosBack.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_026: "); + if (sizeArrayPromise != null && sizeArrayPromise != undefined) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_026 sizeArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_026 sizeArrayPromise: width * height - " +sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_026 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_026 FAILED"); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_026 ends here"); + await sleep(1000); + done(); + }) + + /*CREATE CAMERAINPUT WITH POSITION FRONT & TYPE UNSPECIFIED*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_027 + * @tc.name : Create camerainput from camera-0 cameraposition front & cameratype unspecified async api + * @tc.desc : Create camerainput from camera-0 cameraposition front & cameratype unspecified async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_027', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_027--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_027 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_027 data is not null || undefined"); + camera0InputPosFront = data; + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_027 PASSED"); + } + } else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_027 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_027 ends here"); + camera0InputPosFront.release(); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_028 + * @tc.name : Create camerainput from camera-0 cameraposition front & cameratype unspecified promise api + * @tc.desc : Create camerainput from camera-0 cameraposition front & cameratype unspecified promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_028', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_028--------------"); + camera0InputPromisePosFront = await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_028 camera0InputPromisePosFront: " + JSON.stringify(camera0InputPromisePosFront)); + if (camera0InputPromisePosFront != null && camera0InputPromisePosFront != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_028 camera0InputPromisePosFront is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_028 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_028 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_028 ends here"); + await sleep(1000); + done(); + }) + + /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_TC_029 + * @tc.name : Get supported preview formats from camera-0 camerainput async api + * @tc.desc : Get supported preview formats from camera-0 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_TC_029', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_TC_029--------------"); + camera0InputPromisePosFront.getSupportedPreviewFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_029 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_029 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_029 cameraFormat: " + data[i]); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_029 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_029 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_029 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_030 + * @tc.name : Get supported preview formats from camera-0 camerainput promise api + * @tc.desc : Get supported preview formats from camera-0 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_030', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_030--------------"); + var cam0FormatPromisePosFront = await camera0InputPromisePosFront.getSupportedPreviewFormats(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_030: " + JSON.stringify(cam0FormatPromisePosFront)); + if (cam0FormatPromisePosFront != null && cam0FormatPromisePosFront.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_030 is not null || undefined"); + for (var i = 0; i < cam0FormatPromisePosFront.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_030 cam0FormatPromisePosFront: " + cam0FormatPromisePosFront[i]); + } + expect(true).assertTrue(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_030 PASSED"); + } else { + expect().assertFail(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_030 FAILED"); + } + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_030 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_031 + * @tc.name : Get supported sizes using camera-0 cameraformat & camerainput async api + * @tc.desc : Get supported sizes using camera-0 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_031', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_031--------------"); + camera0InputPromisePosFront.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YCRCb_420_SP, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_031 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_031 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_031 sizeArray: width * height - " +data[i].width + " * " +data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_031 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_031 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_031 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_032 + * @tc.name : Get supported sizes using camera-0 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes using camera-0 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_032', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_032--------------"); + var sizeArrayPromise = await camera0InputPromisePosFront.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YCRCb_420_SP); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_032 sizeArrayPromise: "); + if (sizeArrayPromise != null && sizeArrayPromise.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_032 size0ArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_032 size0ArrayPromise: width * height - " +sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_032 PASSED"); + } else { + expect().assertFail(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_032 FAILED"); + } + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_032 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_TC_033 + * @tc.name : Get supported photo format from camera-0 camerainput async api + * @tc.desc : Get supported photo format from camera-0 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_TC_033', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_TC_033--------------"); + camera0InputPromisePosFront.getSupportedPhotoFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_033 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_033 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_033 cameraFormat: " + data[i]); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_033 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_033 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_033 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_034 + * @tc.name : Get supported photo format from camera-0 camerainput promise api + * @tc.desc : Get supported photo format from camera-0 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_034', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_034--------------"); + var cam0FormatPromisePosFront = await camera0InputPromisePosFront.getSupportedPhotoFormats(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_034: " + JSON.stringify(cam0FormatPromisePosFront)); + if (cam0FormatPromisePosFront != null && cam0FormatPromisePosFront.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_034 is not null || undefined"); + for (var i = 0; i < cam0FormatPromisePosFront.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_034 cam0FormatPromisePosFront: " + cam0FormatPromisePosFront[i]); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_034 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_034 FAILED"); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_034 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_035 + * @tc.name : Get supported sizes from camera-0 cameraformat & camerainput async api + * @tc.desc : Get supported sizes from camera-0 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_035', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_035--------------"); + camera0InputPromisePosFront.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_035 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_035 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_035 sizeArray: width * height - " +data[i].width + " * " +data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_035 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_035 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_035 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_036 + * @tc.name : Get supported sizes from camera-0 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes from camera-0 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_036', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_036--------------"); + var sizeArrayPromise = await camera0InputPromisePosFront.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_036: "); + if (sizeArrayPromise != null && sizeArrayPromise != undefined) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_036 sizeArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_036 sizeArrayPromise: width * height - " +sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_036 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_036 FAILED"); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_036 ends here"); + console.info("--------------CAMERA-0 ENDS HERE--------------"); + await sleep(1000); + done(); + }) + + /*CAMERA-1 Scripts*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_TC_037 + * @tc.name : Create camerainput from camera-1 cameraId async api + * @tc.desc : Create camerainput from camera-1 cameraId async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_TC_037', 0, async function (done) { + console.info("--------------CAMERA-1 STARTS HERE--------------"); + console.info("--------------CREATE_CAMERA_INPUT_TC_037--------------"); + cameraManager.createCameraInput(camerasArray[1].cameraId, async (err, data) => { + if (!err) { + if (data != null && data != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_037 data is not null || undefined"); + camera0Input = data; + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_037 PASSED with CameraID :" + camerasArray[1].cameraId); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_037 FAILED: " + err.message); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_037 ends here"); + await sleep(5000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_PROMISE_TC_038 + * @tc.name : Create camerainput from camera-1 cameraId promise api + * @tc.desc : Create camerainput from camera-1 cameraId promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_PROMISE_TC_038', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_PROMISE_TC_038--------------"); + camera1InputPromise = await cameraManager.createCameraInput(camerasArray[1].cameraId); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_038 camera1InputPromise: " + JSON.stringify(camera1InputPromise)); + if (camera1InputPromise != null && camera1InputPromise != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_038 camera1InputPromise is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_038 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_038 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_038 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POSITION_TYPE_TC_039 + * @tc.name : Create camerainput from camera-1 cameraposition & cameratype async api + * @tc.desc : Create camerainput from camera-1 cameraposition & cameratype async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POSITION_TYPE_TC_039', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POSITION_TYPE_TC_039--------------"); + cameraManager.createCameraInput(camerasArray[1].cameraPosition, camerasArray[1].cameraType, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_039 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_039 data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_039 PASSED"); + } + } else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_039 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_039 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_040 + * @tc.name : Create camerainput from camera-1 cameraposition & cameratype promise api + * @tc.desc : Create camerainput from camera-1 cameraposition & cameratype promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_040', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_040--------------"); + var cameraInputPromise = await cameraManager.createCameraInput(camerasArray[1].cameraPosition, camerasArray[1].cameraType); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_040 cameraInputPromise: " + JSON.stringify(cameraInputPromise)); + if (cameraInputPromise != null && cameraInputPromise != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_040 cameraInputPromise is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_040 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_040 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_040 ends here"); + await sleep(1000); + done(); + }) + + /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_TC_041 + * @tc.name : Get supported preview formats from camera-1 camerainput async api + * @tc.desc : Get supported preview formats from camera-1 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_TC_041', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_TC_041--------------"); + camera1InputPromise.getSupportedPreviewFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_041 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_041 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_041 cameraFormat: " + data[i]); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_041 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_041 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_041 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_042 + * @tc.name : Get supported preview formats from camera-1 camerainput promise api + * @tc.desc : Get supported preview formats from camera-1 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_042', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_042--------------"); + var cam1FormatPromise = await camera1InputPromise.getSupportedPreviewFormats(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_042: " + JSON.stringify(cam1FormatPromise)); + if (cam1FormatPromise != null && cam1FormatPromise.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_042 is not null || undefined"); + for (var i = 0; i < cam1FormatPromise.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_042 cam1FormatPromise: " + cam1FormatPromise[i]); + } + expect(true).assertTrue(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_042 PASSED"); + } else { + expect().assertFail(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_042 FAILED"); + } + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_042 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_043 + * @tc.name : Get supported sizes using camera-1 cameraformat & camerainput async api + * @tc.desc : Get supported sizes using camera-1 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_043', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_043--------------"); + camera1InputPromise.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YCRCb_420_SP, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_043 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_043 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_043 sizeArray: width * height - " +data[i].width + " * " +data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_043 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_043 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_043 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_044 + * @tc.name : Get supported sizes using camera-1 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes using camera-1 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_044', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_044--------------"); + var sizeArrayPromise = await camera1InputPromise.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YCRCb_420_SP); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_044 sizeArrayPromise: "); + if (sizeArrayPromise != null && sizeArrayPromise.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_044 size0ArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_044 sizeArrayPromise: width * height - " +sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_044 PASSED"); + } else { + expect().assertFail(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_044 FAILED"); + } + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_044 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_TC_045 + * @tc.name : Get supported photo format from camera-1 camerainput async api + * @tc.desc : Get supported photo format from camera-1 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_TC_045', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_TC_045--------------"); + camera1InputPromise.getSupportedPhotoFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_045 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_045 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_045 cameraFormat: " + data[i]); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_045 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_045 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_045 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_046 + * @tc.name : Get supported photo format from camera-1 camerainput promise api + * @tc.desc : Get supported photo format from camera-1 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_046', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_046--------------"); + var cam1FormatPromise = await camera1InputPromise.getSupportedPhotoFormats(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_046: " + JSON.stringify(cam1FormatPromise)); + if (cam1FormatPromise != null && cam1FormatPromise.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_046 is not null || undefined"); + for (var i = 0; i < cam1FormatPromise.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_046 cam1FormatPromise: " + cam1FormatPromise[i]); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_046 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_046 FAILED"); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_046 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_047 + * @tc.name : Get supported sizes from camera-1 cameraformat & camerainput async api + * @tc.desc : Get supported sizes from camera-1 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_047', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_047--------------"); + camera1InputPromise.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_047 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_047 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_047 sizeArray: width * height - " +data[i].width + " * " +data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_047 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_047 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_047 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_048 + * @tc.name : Get supported sizes from camera-1 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes from camera-1 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_048', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_048--------------"); + var sizeArrayPromise = await camera1InputPromise.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_048: "); + if (sizeArrayPromise != null && sizeArrayPromise != undefined) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_048 sizeArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_048 sizeArrayPromise: width * height - " +sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_048 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_048 FAILED"); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_048 ends here"); + await sleep(1000); + done(); + }) + + /*CREATE CAMERAINPUT WITH POSITION BACK & TYPE UNSPECIFIED*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_049 + * @tc.name : Create camerainput from camera-1 cameraposition back & cameratype unspecified async api + * @tc.desc : Create camerainput from camera-1 cameraposition back & cameratype unspecified async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_049', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_049--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_049 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_049 data is not null || undefined"); + camera1InputPosBack = data; + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_049 PASSED"); + } + } else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_049 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_049 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_050 + * @tc.name : Create camerainput from camera-1 cameraposition back & cameratype unspecified promise api + * @tc.desc : Create camerainput from camera-1 cameraposition back & cameratype unspecified promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_050', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_050--------------"); + camera1InputPromisePosBack = await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_050 camera1InputPromisePosBack: " + JSON.stringify(camera1InputPromisePosBack)); + if (camera1InputPromisePosBack != null && camera1InputPromisePosBack != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_050 camera1InputPromisePosBack is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_050 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_050 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_050 ends here"); + await sleep(1000); + done(); + }) + + /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_TC_051 + * @tc.name : Get supported preview formats from camera-1 camerainput async api + * @tc.desc : Get supported preview formats from camera-1 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_TC_051', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_TC_051--------------"); + camera1InputPromisePosBack.getSupportedPreviewFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_051 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_051 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_051 cameraFormat: " + data[i]); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_051 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_051 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_051 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_052 + * @tc.name : Get supported preview formats from camera-1 camerainput promise api + * @tc.desc : Get supported preview formats from camera-1 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_052', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_052--------------"); + var cam1FormatPromisePosBack = await camera1InputPromisePosBack.getSupportedPreviewFormats(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_052: " + JSON.stringify(cam1FormatPromisePosBack)); + if (cam1FormatPromisePosBack != null && cam1FormatPromisePosBack.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_052 is not null || undefined"); + for (var i = 0; i < cam1FormatPromisePosBack.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_052 cam1FormatPromisePosBack: " + cam1FormatPromisePosBack[i]); + } + expect(true).assertTrue(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_052 PASSED"); + } else { + expect().assertFail(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_052 FAILED"); + } + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_052 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_053 + * @tc.name : Get supported sizes using camera-1 cameraformat & camerainput async api + * @tc.desc : Get supported sizes using camera-1 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_053', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_053--------------"); + camera1InputPromisePosBack.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YCRCb_420_SP, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_053 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_053 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_053 sizeArray: width * height - " +data[i].width + " * " +data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_053 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_053 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_053 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_054 + * @tc.name : Get supported sizes using camera-1 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes using camera-1 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_054', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_054--------------"); + var sizeArrayPromise = await camera1InputPromisePosBack.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YCRCb_420_SP); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_054 sizeArrayPromise: "); + if (sizeArrayPromise != null && sizeArrayPromise.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_054 size0ArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_054 size0ArrayPromise: width * height - " +sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_054 PASSED"); + } else { + expect().assertFail(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_054 FAILED"); + } + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_054 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_TC_055 + * @tc.name : Get supported photo format from camera-1 camerainput async api + * @tc.desc : Get supported photo format from camera-1 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_TC_055', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_TC_055--------------"); + camera1InputPromisePosBack.getSupportedPhotoFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_055 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_055 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_055 cameraFormat: " + data[i]); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_055 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_055 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_055 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_056 + * @tc.name : Get supported photo format from camera-1 camerainput promise api + * @tc.desc : Get supported photo format from camera-1 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_056', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_056--------------"); + var cam1FormatPromisePosBack = await camera1InputPromisePosBack.getSupportedPhotoFormats(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_056: " + JSON.stringify(cam1FormatPromisePosBack)); + if (cam1FormatPromisePosBack != null && cam1FormatPromisePosBack.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_056 is not null || undefined"); + for (var i = 0; i < cam1FormatPromisePosBack.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_056 cam1FormatPromisePosBack: " + cam1FormatPromisePosBack[i]); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_056 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_056 FAILED"); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_056 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_057 + * @tc.name : Get supported sizes from camera-1 cameraformat & camerainput async api + * @tc.desc : Get supported sizes from camera-1 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_057', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_057--------------"); + camera1InputPromisePosBack.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_057 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_057 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_057 sizeArray: width * height - " +data[i].width + " * " +data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_057 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_057 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_057 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_058 + * @tc.name : Get supported sizes from camera-1 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes from camera-1 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_058', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_058--------------"); + var sizeArrayPromise = await camera1InputPromisePosBack.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_058: "); + if (sizeArrayPromise != null && sizeArrayPromise != undefined) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_058 sizeArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_058 sizeArrayPromise: width * height - " +sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_058 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_058 FAILED"); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_058 ends here"); + await sleep(1000); + done(); + }) + + /*CREATE CAMERAINPUT WITH POSITION FRONT & TYPE UNSPECIFIED*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_059 + * @tc.name : Create camerainput from camera-1 cameraposition front & cameratype unspecified async api + * @tc.desc : Create camerainput from camera-1 cameraposition front & cameratype unspecified async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_059', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_059--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_059 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_059 data is not null || undefined"); + camera1InputPosFront = data; + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_059 PASSED"); + } + } else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_059 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_059 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_060 + * @tc.name : Create camerainput from camera-1 cameraposition front & cameratype unspecified promise api + * @tc.desc : Create camerainput from camera-1 cameraposition front & cameratype unspecified promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_060', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_060--------------"); + camera1InputPromisePosFront = await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_060 camera1InputPromisePosFront: " + JSON.stringify(camera1InputPromisePosFront)); + if (camera1InputPromisePosFront != null && camera1InputPromisePosFront != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_060 camera1InputPromisePosFront is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_060 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_060 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_060 ends here"); + await sleep(1000); + done(); + }) + + /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_TC_061 + * @tc.name : Get supported preview formats from camera-1 camerainput async api + * @tc.desc : Get supported preview formats from camera-1 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_TC_061', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_TC_061--------------"); + camera1InputPromisePosFront.getSupportedPreviewFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_061 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_061 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_061 cameraFormat: " + data[i]); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_061 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_061 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_061 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_062 + * @tc.name : Get supported preview formats from camera-1 camerainput promise api + * @tc.desc : Get supported preview formats from camera-1 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_062', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_062--------------"); + var cam1FormatPromisePosFront = await camera1InputPromisePosFront.getSupportedPreviewFormats(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_062: " + JSON.stringify(cam1FormatPromisePosFront)); + if (cam1FormatPromisePosFront != null && cam1FormatPromisePosFront.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_062 is not null || undefined"); + for (var i = 0; i < cam1FormatPromisePosFront.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_062 cam1FormatPromisePosFront: " + cam1FormatPromisePosFront[i]); + } + expect(true).assertTrue(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_062 PASSED"); + } else { + expect().assertFail(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_062 FAILED"); + } + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_062 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_063 + * @tc.name : Get supported sizes using camera-1 cameraformat & camerainput async api + * @tc.desc : Get supported sizes using camera-1 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_063', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_063--------------"); + camera1InputPromisePosFront.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YCRCb_420_SP, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_063 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_063 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_063 sizeArray: width * height - " +data[i].width + " * " +data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_063 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_063 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_063 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_064 + * @tc.name : Get supported sizes using camera-1 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes using camera-1 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_064', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_064--------------"); + var sizeArrayPromise = await camera1InputPromisePosFront.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YCRCb_420_SP); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_064 sizeArrayPromise: "); + if (sizeArrayPromise != null && sizeArrayPromise.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_064 size0ArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_064 size0ArrayPromise: width * height - " +sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_064 PASSED"); + } else { + expect().assertFail(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_064 FAILED"); + } + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_064 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_TC_065 + * @tc.name : Get supported photo format from camera-1 camerainput async api + * @tc.desc : Get supported photo format from camera-1 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_TC_065', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_TC_065--------------"); + camera1InputPromisePosFront.getSupportedPhotoFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_065 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_065 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_065 cameraFormat: " + data[i]); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_065 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_065 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_065 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_066 + * @tc.name : Get supported photo format from camera-1 camerainput promise api + * @tc.desc : Get supported photo format from camera-1 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_066', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_066--------------"); + var cam1FormatPromisePosFront = await camera1InputPromisePosFront.getSupportedPhotoFormats(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_066: " + JSON.stringify(cam1FormatPromisePosFront)); + if (cam1FormatPromisePosFront != null && cam1FormatPromisePosFront.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_066 is not null || undefined"); + for (var i = 0; i < cam1FormatPromisePosFront.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_066 cam1FormatPromisePosFront: " + cam1FormatPromisePosFront[i]); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_066 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_066 FAILED"); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_066 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_067 + * @tc.name : Get supported sizes from camera-1 cameraformat & camerainput async api + * @tc.desc : Get supported sizes from camera-1 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_067', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_067--------------"); + camera1InputPromisePosFront.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_067 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_067 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_067 sizeArray: width * height - " +data[i].width + " * " +data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_067 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_067 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_067 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_068 + * @tc.name : Get supported sizes from camera-1 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes from camera-1 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_068', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_068--------------"); + var sizeArrayPromise = await camera1InputPromisePosFront.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_068: "); + if (sizeArrayPromise != null && sizeArrayPromise != undefined) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_068 sizeArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_068 sizeArrayPromise: width * height - " +sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_068 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_068 FAILED"); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_068 ends here"); + console.info("--------------CAMERA-1 ENDS HERE--------------"); + await sleep(1000); + done(); + }) + + /*CAMERA-2 Scripts*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_TC_069 + * @tc.name : Create camerainput from camera-2 cameraId async api + * @tc.desc : Create camerainput from camera-2 cameraId async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_TC_069', 0, async function (done) { + console.info("--------------CAMERA-2 STARTS HERE--------------"); + console.info("--------------CREATE_CAMERA_INPUT_TC_069--------------"); + cameraManager.createCameraInput(camerasArray[2].cameraId, async (err, data) => { + if (!err) { + if (data != null && data != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_069 data is not null || undefined"); + camera0Input = data; + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_069 PASSED with CameraID :" + camerasArray[2].cameraId); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_069 FAILED: " + err.message); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_069 ends here"); + await sleep(5000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_PROMISE_TC_070 + * @tc.name : Create camerainput from camera-2 cameraId promise api + * @tc.desc : Create camerainput from camera-2 cameraId promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_PROMISE_TC_070', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_PROMISE_TC_070--------------"); + camera2InputPromise = await cameraManager.createCameraInput(camerasArray[2].cameraId); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_070 camera2InputPromise: " + JSON.stringify(camera2InputPromise)); + if (camera2InputPromise != null && camera2InputPromise != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_070 camera2InputPromise is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_070 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_070 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_070 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POSITION_TYPE_TC_071 + * @tc.name : Create camerainput from camera-2 cameraposition & cameratype async api + * @tc.desc : Create camerainput from camera-2 cameraposition & cameratype async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POSITION_TYPE_TC_071', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POSITION_TYPE_TC_071--------------"); + cameraManager.createCameraInput(camerasArray[2].cameraPosition, camerasArray[2].cameraType, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_071 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_071 data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_071 PASSED"); + } + } else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_071 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_071 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_072 + * @tc.name : Create camerainput from camera-2 cameraposition & cameratype promise api + * @tc.desc : Create camerainput from camera-2 cameraposition & cameratype promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_072', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_072--------------"); + var cameraInputPromise = await cameraManager.createCameraInput(camerasArray[2].cameraPosition, camerasArray[2].cameraType); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_072 cameraInputPromise: " + JSON.stringify(cameraInputPromise)); + if (cameraInputPromise != null && cameraInputPromise != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_072 cameraInputPromise is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_072 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_072 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_072 ends here"); + await sleep(1000); + done(); + }) + + /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_TC_073 + * @tc.name : Get supported preview formats from camera-2 camerainput async api + * @tc.desc : Get supported preview formats from camera-2 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_TC_073', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_TC_073--------------"); + camera2InputPromise.getSupportedPreviewFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_073 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_073 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_073 cameraFormat: " + data[i]); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_073 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_073 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_073 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_074 + * @tc.name : Get supported preview formats from camera-2 camerainput promise api + * @tc.desc : Get supported preview formats from camera-2 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_074', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_074--------------"); + var cam2FormatPromise = await camera2InputPromise.getSupportedPreviewFormats(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_074: " + JSON.stringify(cam2FormatPromise)); + if (cam2FormatPromise != null && cam2FormatPromise.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_074 is not null || undefined"); + for (var i = 0; i < cam2FormatPromise.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_074 cam2FormatPromise: " + cam2FormatPromise[i]); + } + expect(true).assertTrue(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_074 PASSED"); + } else { + expect().assertFail(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_074 FAILED"); + } + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_074 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_075 + * @tc.name : Get supported sizes using camera-2 cameraformat & camerainput async api + * @tc.desc : Get supported sizes using camera-2 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_075', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_075--------------"); + camera2InputPromise.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YCRCb_420_SP, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_075 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_075 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_075 sizeArray: width * height - " +data[i].width + " * " +data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_075 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_075 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_075 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_076 + * @tc.name : Get supported sizes using camera-2 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes using camera-2 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_076', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_076--------------"); + var sizeArrayPromise = await camera2InputPromise.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YCRCb_420_SP); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_076 sizeArrayPromise: "); + if (sizeArrayPromise != null && sizeArrayPromise.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_076 size0ArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_076 sizeArrayPromise: width * height - " +sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_076 PASSED"); + } else { + expect().assertFail(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_076 FAILED"); + } + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_076 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_TC_077 + * @tc.name : Get supported photo format from camera-2 camerainput async api + * @tc.desc : Get supported photo format from camera-2 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_TC_077', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_TC_077--------------"); + camera2InputPromise.getSupportedPhotoFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_077 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_077 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_077 cameraFormat: " + data[i]); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_077 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_077 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_077 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_078 + * @tc.name : Get supported photo format from camera-2 camerainput promise api + * @tc.desc : Get supported photo format from camera-2 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_078', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_078--------------"); + var cam2FormatPromise = await camera2InputPromise.getSupportedPhotoFormats(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_078: " + JSON.stringify(cam2FormatPromise)); + if (cam2FormatPromise != null && cam2FormatPromise.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_078 is not null || undefined"); + for (var i = 0; i < cam2FormatPromise.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_078 cam2FormatPromise: " + cam2FormatPromise[i]); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_078 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_078 FAILED"); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_078 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_079 + * @tc.name : Get supported sizes from camera-2 cameraformat & camerainput async api + * @tc.desc : Get supported sizes from camera-2 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_079', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_079--------------"); + camera2InputPromise.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_079 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_079 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_079 sizeArray: width * height - " +data[i].width + " * " +data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_079 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_079 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_079 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_080 + * @tc.name : Get supported sizes from camera-2 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes from camera-2 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_080', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_080--------------"); + var sizeArrayPromise = await camera2InputPromise.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_080: "); + if (sizeArrayPromise != null && sizeArrayPromise != undefined) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_080 sizeArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_080 sizeArrayPromise: width * height - " +sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_080 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_080 FAILED"); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_080 ends here"); + await sleep(1000); + done(); + }) + + /*CREATE CAMERAINPUT WITH POSITION BACK & TYPE UNSPECIFIED*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_081 + * @tc.name : Create camerainput from camera-2 cameraposition back & cameratype unspecified async api + * @tc.desc : Create camerainput from camera-2 cameraposition back & cameratype unspecified async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_081', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_081--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_081 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_081 data is not null || undefined"); + camera2InputPosBack = data; + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_081 PASSED"); + } + } else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_081 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_081 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_082 + * @tc.name : Create camerainput from camera-2 cameraposition back & cameratype unspecified promise api + * @tc.desc : Create camerainput from camera-2 cameraposition back & cameratype unspecified promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_082', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_082--------------"); + camera2InputPromisePosBack = await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_082 camera2InputPromisePosBack: " + JSON.stringify(camera2InputPromisePosBack)); + if (camera2InputPromisePosBack != null && camera2InputPromisePosBack != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_082 camera2InputPromisePosBack is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_082 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_082 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_082 ends here"); + await sleep(1000); + done(); + }) + + /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_TC_083 + * @tc.name : Get supported preview formats from camera-2 camerainput async api + * @tc.desc : Get supported preview formats from camera-2 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_TC_083', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_TC_083--------------"); + camera2InputPromisePosBack.getSupportedPreviewFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_083 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_083 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_083 cameraFormat: " + data[i]); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_083 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_083 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_083 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_084 + * @tc.name : Get supported preview formats from camera-2 camerainput promise api + * @tc.desc : Get supported preview formats from camera-2 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_084', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_084--------------"); + var cam2FormatPromisePosBack = await camera2InputPromisePosBack.getSupportedPreviewFormats(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_084: " + JSON.stringify(cam2FormatPromisePosBack)); + if (cam2FormatPromisePosBack != null && cam2FormatPromisePosBack.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_084 is not null || undefined"); + for (var i = 0; i < cam2FormatPromisePosBack.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_084 cam2FormatPromisePosBack: " + cam2FormatPromisePosBack[i]); + } + expect(true).assertTrue(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_084 PASSED"); + } else { + expect().assertFail(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_084 FAILED"); + } + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_084 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_085 + * @tc.name : Get supported sizes using camera-2 cameraformat & camerainput async api + * @tc.desc : Get supported sizes using camera-2 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_085', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_085--------------"); + camera2InputPromisePosBack.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YCRCb_420_SP, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_085 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_085 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_085 sizeArray: width * height - " +data[i].width + " * " +data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_085 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_085 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_085 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_086 + * @tc.name : Get supported sizes using camera-2 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes using camera-2 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_086', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_086--------------"); + var sizeArrayPromise = await camera2InputPromisePosBack.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YCRCb_420_SP); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_086 sizeArrayPromise: "); + if (sizeArrayPromise != null && sizeArrayPromise.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_086 size0ArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_086 size0ArrayPromise: width * height - " +sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_086 PASSED"); + } else { + expect().assertFail(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_086 FAILED"); + } + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_086 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_TC_087 + * @tc.name : Get supported photo format from camera-2 camerainput async api + * @tc.desc : Get supported photo format from camera-2 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_TC_087', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_TC_087--------------"); + camera2InputPromisePosBack.getSupportedPhotoFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_087 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_087 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_087 cameraFormat: " + data[i]); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_087 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_087 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_087 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_088 + * @tc.name : Get supported photo format from camera-2 camerainput promise api + * @tc.desc : Get supported photo format from camera-2 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_088', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_088--------------"); + var cam2FormatPromisePosBack = await camera2InputPromisePosBack.getSupportedPhotoFormats(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_088: " + JSON.stringify(cam2FormatPromisePosBack)); + if (cam2FormatPromisePosBack != null && cam2FormatPromisePosBack.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_088 is not null || undefined"); + for (var i = 0; i < cam2FormatPromisePosBack.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_088 cam2FormatPromisePosBack: " + cam2FormatPromisePosBack[i]); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_088 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_088 FAILED"); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_088 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_089 + * @tc.name : Get supported sizes from camera-2 cameraformat & camerainput async api + * @tc.desc : Get supported sizes from camera-2 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_089', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_089--------------"); + camera2InputPromisePosBack.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_089 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_089 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_089 sizeArray: width * height - " +data[i].width + " * " +data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_089 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_089 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_089 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_090 + * @tc.name : Get supported sizes from camera-2 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes from camera-2 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_090', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_090--------------"); + var sizeArrayPromise = await camera2InputPromisePosBack.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_090: "); + if (sizeArrayPromise != null && sizeArrayPromise != undefined) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_090 sizeArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_090 sizeArrayPromise: width * height - " +sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_090 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_090 FAILED"); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_090 ends here"); + await sleep(1000); + done(); + }) + + /*CREATE CAMERAINPUT WITH POSITION FRONT & TYPE UNSPECIFIED*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_091 + * @tc.name : Create camerainput from camera-2 cameraposition front & cameratype unspecified async api + * @tc.desc : Create camerainput from camera-2 cameraposition front & cameratype unspecified async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_091', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_091--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_091 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_091 data is not null || undefined"); + camera2InputPosFront = data; + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_091 PASSED"); + } + } else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_091 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_091 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_092 + * @tc.name : Create camerainput from camera-2 cameraposition front & cameratype unspecified promise api + * @tc.desc : Create camerainput from camera-2 cameraposition front & cameratype unspecified promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_092', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_092--------------"); + camera2InputPromisePosFront = await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_092 camera2InputPromisePosFront: " + JSON.stringify(camera2InputPromisePosFront)); + if (camera2InputPromisePosFront != null && camera2InputPromisePosFront != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_092 camera2InputPromisePosFront is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_092 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_092 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_092 ends here"); + await sleep(1000); + done(); + }) + + /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_TC_093 + * @tc.name : Get supported preview formats from camera-2 camerainput async api + * @tc.desc : Get supported preview formats from camera-2 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_TC_093', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_TC_093--------------"); + camera2InputPromisePosFront.getSupportedPreviewFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_093 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_093 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_093 cameraFormat: " + data[i]); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_093 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_093 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_093 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_094 + * @tc.name : Get supported preview formats from camera-2 camerainput promise api + * @tc.desc : Get supported preview formats from camera-2 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_094', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_094--------------"); + var cam2FormatPromisePosFront = await camera2InputPromisePosFront.getSupportedPreviewFormats(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_094: " + JSON.stringify(cam2FormatPromisePosFront)); + if (cam2FormatPromisePosFront != null && cam2FormatPromisePosFront.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_094 is not null || undefined"); + for (var i = 0; i < cam2FormatPromisePosFront.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_094 cam2FormatPromisePosFront: " + cam2FormatPromisePosFront[i]); + } + expect(true).assertTrue(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_094 PASSED"); + } else { + expect().assertFail(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_094 FAILED"); + } + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_094 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_095 + * @tc.name : Get supported sizes using camera-2 cameraformat & camerainput async api + * @tc.desc : Get supported sizes using camera-2 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_095', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_095--------------"); + camera2InputPromisePosFront.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YCRCb_420_SP, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_095 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_095 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_095 sizeArray: width * height - " +data[i].width + " * " +data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_095 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_095 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_095 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_096 + * @tc.name : Get supported sizes using camera-2 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes using camera-2 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_096', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_096--------------"); + var sizeArrayPromise = await camera2InputPromisePosFront.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YCRCb_420_SP); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_096 sizeArrayPromise: "); + if (sizeArrayPromise != null && sizeArrayPromise.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_096 size0ArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_096 size0ArrayPromise: width * height - " +sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_096 PASSED"); + } else { + expect().assertFail(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_096 FAILED"); + } + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_096 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_TC_097 + * @tc.name : Get supported photo format from camera-2 camerainput async api + * @tc.desc : Get supported photo format from camera-2 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_TC_097', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_TC_097--------------"); + camera2InputPromisePosFront.getSupportedPhotoFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_097 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_097 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_097 cameraFormat: " + data[i]); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_097 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_097 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_097 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_098 + * @tc.name : Get supported photo format from camera-2 camerainput promise api + * @tc.desc : Get supported photo format from camera-2 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_098', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_098--------------"); + var cam2FormatPromisePosFront = await camera2InputPromisePosFront.getSupportedPhotoFormats(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_098: " + JSON.stringify(cam2FormatPromisePosFront)); + if (cam2FormatPromisePosFront != null && cam2FormatPromisePosFront.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_098 is not null || undefined"); + for (var i = 0; i < cam2FormatPromisePosFront.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_098 cam2FormatPromisePosFront: " + cam2FormatPromisePosFront[i]); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_098 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_098 FAILED"); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_098 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_099 + * @tc.name : Get supported sizes from camera-2 cameraformat & camerainput async api + * @tc.desc : Get supported sizes from camera-2 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_099', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_099--------------"); + camera2InputPromisePosFront.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_099 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_099 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_099 sizeArray: width * height - " +data[i].width + " * " +data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_099 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_099 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_099 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_100 + * @tc.name : Get supported sizes from camera-2 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes from camera-2 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_100', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_100--------------"); + var sizeArrayPromise = await camera2InputPromisePosFront.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_100: "); + if (sizeArrayPromise != null && sizeArrayPromise != undefined) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_100 sizeArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_100 sizeArrayPromise: width * height - " +sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_100 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_100 FAILED"); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_100 ends here"); + console.info("--------------CAMERA-2 ENDS HERE--------------"); + await sleep(1000); + done(); + }) + + /*CAMERA-3 Scripts*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_TC_101 + * @tc.name : Create camerainput from camera-3 cameraId async api + * @tc.desc : Create camerainput from camera-3 cameraId async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_TC_101', 0, async function (done) { + console.info("--------------CAMERA-3 STARTS HERE--------------"); + console.info("--------------CREATE_CAMERA_INPUT_TC_101--------------"); + cameraManager.createCameraInput(camerasArray[3].cameraId, async (err, data) => { + if (!err) { + if (data != null && data != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_101 data is not null || undefined"); + camera0Input = data; + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_101 PASSED with CameraID :" + camerasArray[3].cameraId); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_101 FAILED: " + err.message); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_101 ends here"); + await sleep(5000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_PROMISE_TC_102 + * @tc.name : Create camerainput from camera-3 cameraId promise api + * @tc.desc : Create camerainput from camera-3 cameraId promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_PROMISE_TC_102', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_PROMISE_TC_102--------------"); + camera3InputPromise = await cameraManager.createCameraInput(camerasArray[3].cameraId); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_102 camera3InputPromise: " + JSON.stringify(camera3InputPromise)); + if (camera3InputPromise != null && camera3InputPromise != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_102 camera3InputPromise is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_102 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_102 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_102 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POSITION_TYPE_TC_103 + * @tc.name : Create camerainput from camera-3 cameraposition & cameratype async api + * @tc.desc : Create camerainput from camera-3 cameraposition & cameratype async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POSITION_TYPE_TC_103', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POSITION_TYPE_TC_103--------------"); + cameraManager.createCameraInput(camerasArray[3].cameraPosition, camerasArray[3].cameraType, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_103 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_103 data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_103 PASSED"); + } + } else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_103 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_103 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_104 + * @tc.name : Create camerainput from camera-3 cameraposition & cameratype promise api + * @tc.desc : Create camerainput from camera-3 cameraposition & cameratype promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_104', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_104--------------"); + var cameraInputPromise = await cameraManager.createCameraInput(camerasArray[3].cameraPosition, camerasArray[3].cameraType); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_104 cameraInputPromise: " + JSON.stringify(cameraInputPromise)); + if (cameraInputPromise != null && cameraInputPromise != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_104 cameraInputPromise is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_104 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_104 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_104 ends here"); + await sleep(1000); + done(); + }) + + /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_TC_105 + * @tc.name : Get supported preview formats from camera-3 camerainput async api + * @tc.desc : Get supported preview formats from camera-3 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_TC_105', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_TC_105--------------"); + camera3InputPromise.getSupportedPreviewFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_105 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_105 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_105 cameraFormat: " + data[i]); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_105 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_105 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_105 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_106 + * @tc.name : Get supported preview formats from camera-3 camerainput promise api + * @tc.desc : Get supported preview formats from camera-3 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_106', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_106--------------"); + var cam3FormatPromise = await camera3InputPromise.getSupportedPreviewFormats(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_106: " + JSON.stringify(cam3FormatPromise)); + if (cam3FormatPromise != null && cam3FormatPromise.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_106 is not null || undefined"); + for (var i = 0; i < cam3FormatPromise.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_106 cam3FormatPromise: " + cam3FormatPromise[i]); + } + expect(true).assertTrue(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_106 PASSED"); + } else { + expect().assertFail(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_106 FAILED"); + } + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_106 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_107 + * @tc.name : Get supported sizes using camera-3 cameraformat & camerainput async api + * @tc.desc : Get supported sizes using camera-3 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_107', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_107--------------"); + camera3InputPromise.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YCRCb_420_SP, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_107 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_107 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_107 sizeArray: width * height - " +data[i].width + " * " +data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_107 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_107 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_107 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_108 + * @tc.name : Get supported sizes using camera-3 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes using camera-3 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_108', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_108--------------"); + var sizeArrayPromise = await camera3InputPromise.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YCRCb_420_SP); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_108 sizeArrayPromise: "); + if (sizeArrayPromise != null && sizeArrayPromise.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_108 size0ArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_108 sizeArrayPromise: width * height - " +sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_108 PASSED"); + } else { + expect().assertFail(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_108 FAILED"); + } + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_108 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_TC_109 + * @tc.name : Get supported photo format from camera-3 camerainput async api + * @tc.desc : Get supported photo format from camera-3 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_TC_109', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_TC_109--------------"); + camera3InputPromise.getSupportedPhotoFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_109 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_109 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_109 cameraFormat: " + data[i]); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_109 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_109 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_109 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_110 + * @tc.name : Get supported photo format from camera-3 camerainput promise api + * @tc.desc : Get supported photo format from camera-3 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_110', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_110--------------"); + var cam3FormatPromise = await camera3InputPromise.getSupportedPhotoFormats(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_110: " + JSON.stringify(cam3FormatPromise)); + if (cam3FormatPromise != null && cam3FormatPromise.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_110 is not null || undefined"); + for (var i = 0; i < cam3FormatPromise.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_110 cam3FormatPromise: " + cam3FormatPromise[i]); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_110 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_110 FAILED"); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_110 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_111 + * @tc.name : Get supported sizes from camera-3 cameraformat & camerainput async api + * @tc.desc : Get supported sizes from camera-3 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_111', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_111--------------"); + camera3InputPromise.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_111 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_111 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_111 sizeArray: width * height - " +data[i].width + " * " +data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_111 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_111 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_111 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_112 + * @tc.name : Get supported sizes from camera-3 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes from camera-3 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_112', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_112--------------"); + var sizeArrayPromise = await camera3InputPromise.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_112: "); + if (sizeArrayPromise != null && sizeArrayPromise != undefined) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_112 sizeArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_112 sizeArrayPromise: width * height - " +sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_112 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_112 FAILED"); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_112 ends here"); + await sleep(1000); + done(); + }) + + /*CREATE CAMERAINPUT WITH POSITION BACK & TYPE UNSPECIFIED*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_113 + * @tc.name : Create camerainput from camera-3 cameraposition back & cameratype unspecified async api + * @tc.desc : Create camerainput from camera-3 cameraposition back & cameratype unspecified async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_113', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_113--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_113 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_113 data is not null || undefined"); + camera3InputPosBack = data; + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_113 PASSED"); + } + } else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_113 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_113 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_114 + * @tc.name : Create camerainput from camera-3 cameraposition back & cameratype unspecified promise api + * @tc.desc : Create camerainput from camera-3 cameraposition back & cameratype unspecified promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_114', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_114--------------"); + camera3InputPromisePosBack = await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_114 camera3InputPromisePosBack: " + JSON.stringify(camera3InputPromisePosBack)); + if (camera3InputPromisePosBack != null && camera3InputPromisePosBack != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_114 camera3InputPromisePosBack is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_114 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_114 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_114 ends here"); + await sleep(1000); + done(); + }) + + /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_TC_115 + * @tc.name : Get supported preview formats from camera-3 camerainput async api + * @tc.desc : Get supported preview formats from camera-3 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_TC_115', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_TC_115--------------"); + camera3InputPromisePosBack.getSupportedPreviewFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_115 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_115 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_115 cameraFormat: " + data[i]); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_115 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_115 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_115 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_116 + * @tc.name : Get supported preview formats from camera-3 camerainput promise api + * @tc.desc : Get supported preview formats from camera-3 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_116', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_116--------------"); + var cam3FormatPromisePosBack = await camera3InputPromisePosBack.getSupportedPreviewFormats(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_116: " + JSON.stringify(cam3FormatPromisePosBack)); + if (cam3FormatPromisePosBack != null && cam3FormatPromisePosBack.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_116 is not null || undefined"); + for (var i = 0; i < cam3FormatPromisePosBack.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_116 cam3FormatPromisePosBack: " + cam3FormatPromisePosBack[i]); + } + expect(true).assertTrue(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_116 PASSED"); + } else { + expect().assertFail(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_116 FAILED"); + } + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_116 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_117 + * @tc.name : Get supported sizes using camera-3 cameraformat & camerainput async api + * @tc.desc : Get supported sizes using camera-3 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_117', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_117--------------"); + camera3InputPromisePosBack.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YCRCb_420_SP, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_117 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_117 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_117 sizeArray: width * height - " +data[i].width + " * " +data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_117 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_117 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_117 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_118 + * @tc.name : Get supported sizes using camera-3 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes using camera-3 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_118', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_118--------------"); + var sizeArrayPromise = await camera3InputPromisePosBack.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YCRCb_420_SP); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_118 sizeArrayPromise: "); + if (sizeArrayPromise != null && sizeArrayPromise.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_118 size0ArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_118 size0ArrayPromise: width * height - " +sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_118 PASSED"); + } else { + expect().assertFail(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_118 FAILED"); + } + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_118 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_TC_119 + * @tc.name : Get supported photo format from camera-3 camerainput async api + * @tc.desc : Get supported photo format from camera-3 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_TC_119', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_TC_119--------------"); + camera3InputPromisePosBack.getSupportedPhotoFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_119 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_119 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_119 cameraFormat: " + data[i]); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_119 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_119 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_119 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_120 + * @tc.name : Get supported photo format from camera-3 camerainput promise api + * @tc.desc : Get supported photo format from camera-3 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_120', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_120--------------"); + var cam3FormatPromisePosBack = await camera3InputPromisePosBack.getSupportedPhotoFormats(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_120: " + JSON.stringify(cam3FormatPromisePosBack)); + if (cam3FormatPromisePosBack != null && cam3FormatPromisePosBack.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_120 is not null || undefined"); + for (var i = 0; i < cam3FormatPromisePosBack.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_120 cam3FormatPromisePosBack: " + cam3FormatPromisePosBack[i]); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_120 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_120 FAILED"); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_120 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_121 + * @tc.name : Get supported sizes from camera-3 cameraformat & camerainput async api + * @tc.desc : Get supported sizes from camera-3 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_121', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_121--------------"); + camera3InputPromisePosBack.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_121 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_121 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_121 sizeArray: width * height - " +data[i].width + " * " +data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_121 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_121 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_121 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_122 + * @tc.name : Get supported sizes from camera-3 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes from camera-3 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_122', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_122--------------"); + var sizeArrayPromise = await camera3InputPromisePosBack.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_122: "); + if (sizeArrayPromise != null && sizeArrayPromise != undefined) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_122 sizeArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_122 sizeArrayPromise: width * height - " +sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_122 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_122 FAILED"); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_122 ends here"); + await sleep(1000); + done(); + }) + + /*CREATE CAMERAINPUT WITH POSITION FRONT & TYPE UNSPECIFIED*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_123 + * @tc.name : Create camerainput from camera-3 cameraposition front & cameratype unspecified async api + * @tc.desc : Create camerainput from camera-3 cameraposition front & cameratype unspecified async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_123', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_123--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_123 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_123 data is not null || undefined"); + camera3InputPosFront = data; + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_123 PASSED"); + } + } else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_123 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_123 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_124 + * @tc.name : Create camerainput from camera-3 cameraposition front & cameratype unspecified promise api + * @tc.desc : Create camerainput from camera-3 cameraposition front & cameratype unspecified promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_124', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_124--------------"); + camera3InputPromisePosFront = await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_124 camera3InputPromisePosFront: " + JSON.stringify(camera3InputPromisePosFront)); + if (camera3InputPromisePosFront != null && camera3InputPromisePosFront != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_124 camera3InputPromisePosFront is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_124 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_124 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_124 ends here"); + await sleep(1000); + done(); + }) + + /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_TC_125 + * @tc.name : Get supported preview formats from camera-3 camerainput async api + * @tc.desc : Get supported preview formats from camera-3 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_TC_125', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_TC_125--------------"); + camera3InputPromisePosFront.getSupportedPreviewFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_125 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_125 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_125 cameraFormat: " + data[i]); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_125 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_125 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_125 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_126 + * @tc.name : Get supported preview formats from camera-3 camerainput promise api + * @tc.desc : Get supported preview formats from camera-3 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_126', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_126--------------"); + var cam3FormatPromisePosFront = await camera3InputPromisePosFront.getSupportedPreviewFormats(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_126: " + JSON.stringify(cam3FormatPromisePosFront)); + if (cam3FormatPromisePosFront != null && cam3FormatPromisePosFront.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_126 is not null || undefined"); + for (var i = 0; i < cam3FormatPromisePosFront.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_126 cam3FormatPromisePosFront: " + cam3FormatPromisePosFront[i]); + } + expect(true).assertTrue(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_126 PASSED"); + } else { + expect().assertFail(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_126 FAILED"); + } + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_126 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_127 + * @tc.name : Get supported sizes using camera-3 cameraformat & camerainput async api + * @tc.desc : Get supported sizes using camera-3 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_127', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_127--------------"); + camera3InputPromisePosFront.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YCRCb_420_SP, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_127 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_127 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_127 sizeArray: width * height - " +data[i].width + " * " +data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_127 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_127 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_TC_127 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_128 + * @tc.name : Get supported sizes using camera-3 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes using camera-3 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_128', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_128--------------"); + var sizeArrayPromise = await camera3InputPromisePosFront.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YCRCb_420_SP); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_128 sizeArrayPromise: "); + if (sizeArrayPromise != null && sizeArrayPromise.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_128 size0ArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_128 size0ArrayPromise: width * height - " +sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_128 PASSED"); + } else { + expect().assertFail(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_128 FAILED"); + } + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YCRCb_420_SP_PROMISE_TC_128 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_TC_129 + * @tc.name : Get supported photo format from camera-3 camerainput async api + * @tc.desc : Get supported photo format from camera-3 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_TC_129', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_TC_129--------------"); + camera3InputPromisePosFront.getSupportedPhotoFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_129 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_129 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_129 cameraFormat: " + data[i]); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_129 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_129 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_129 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_130 + * @tc.name : Get supported photo format from camera-3 camerainput promise api + * @tc.desc : Get supported photo format from camera-3 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_130', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_130--------------"); + var cam3FormatPromisePosFront = await camera3InputPromisePosFront.getSupportedPhotoFormats(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_130: " + JSON.stringify(cam3FormatPromisePosFront)); + if (cam3FormatPromisePosFront != null && cam3FormatPromisePosFront.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_130 is not null || undefined"); + for (var i = 0; i < cam3FormatPromisePosFront.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_130 cam3FormatPromisePosFront: " + cam3FormatPromisePosFront[i]); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_130 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_130 FAILED"); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_130 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_131 + * @tc.name : Get supported sizes from camera-3 cameraformat & camerainput async api + * @tc.desc : Get supported sizes from camera-3 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_131', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_131--------------"); + camera3InputPromisePosFront.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_131 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_131 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_131 sizeArray: width * height - " +data[i].width + " * " +data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_131 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_131 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_131 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_132 + * @tc.name : Get supported sizes from camera-3 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes from camera-3 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_132', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_132--------------"); + var sizeArrayPromise = await camera3InputPromisePosFront.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_132: "); + if (sizeArrayPromise != null && sizeArrayPromise != undefined) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_132 sizeArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_132 sizeArrayPromise: width * height - " +sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_132 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_132 FAILED"); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_132 ends here"); + console.info("--------------CAMERA-3 ENDS HERE--------------"); + await sleep(1000); + done(); + }) + + /*CREATE CAMERAINPUT WITH POSITION UNSPECIFIED & TYPE UNSPECIFIED*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_TC_133 + * @tc.name : Create camerainput from cameraposition unspecified & cameratype unspecified async api + * @tc.desc : Create camerainput from cameraposition unspecified & cameratype unspecified async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_TC_133', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_TC_133--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_TC_133 success: "); + if (data == undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_TC_133 data is null || undefined"); + var camInput = data; + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_TC_133 camInput: " + JSON.stringify(camInput)); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_TC_133 PASSED"); + } + } else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_TC_133 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_TC_133 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_PROMISE_TC_134 + * @tc.name : Create camerainput from cameraposition unspecified & cameratype unspecified promise api + * @tc.desc : Create camerainput from cameraposition unspecified & cameratype unspecified promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_PROMISE_TC_134', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_PROMISE_TC_134--------------"); + var camInputPromise = await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_PROMISE_TC_134 camInputPromise: " + JSON.stringify(camInputPromise)); + if (camInputPromise == undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_PROMISE_TC_134 camInputPromise is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_PROMISE_TC_134 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_PROMISE_TC_134 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_PROMISE_TC_134 ends here"); + await sleep(1000); + done(); + }) + + /*CREATE CAMERAINPUT WITH POSITION UNSPECIFIED & TYPE WIDE ANGLE*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_TC_135 + * @tc.name : Create camerainput from cameraposition unspecified & cameratype wide angle async api + * @tc.desc : Create camerainput from cameraposition unspecified & cameratype wide angle async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_TC_135', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_TC_135--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED, cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_TC_135 success"); + if (data == undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_TC_135 data is null || undefined"); + var camInput = data; + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_TC_135 camInput: " + JSON.stringify(camInput)); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_TC_135 PASSED"); + } + } else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_TC_135 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_TC_135 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_PROMISE_TC_136 + * @tc.name : Create camerainput from cameraposition unspecified & cameratype wide angle promise api + * @tc.desc : Create camerainput from cameraposition unspecified & cameratype wide angle promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_PROMISE_TC_136', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_PROMISE_TC_136--------------"); + var camInputPromise = await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED, cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_PROMISE_TC_136 camInputPromise: " + JSON.stringify(camInputPromise)); + if (camInputPromise == undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_PROMISE_TC_136 camInputPromise is null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_PROMISE_TC_136 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_PROMISE_TC_136 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_PROMISE_TC_136 ends here"); + await sleep(1000); + done(); + }) + + /*CREATE CAMERAINPUT WITH POSITION UNSPECIFIED & TYPE ULTRA ANGLE*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_TC_137 + * @tc.name : Create camerainput from cameraposition unspecified & cameratype ultra wide async api + * @tc.desc : Create camerainput from cameraposition unspecified & cameratype ultra wide async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_TC_137', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_TC_137--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED, cameraObj.CameraType.CAMERA_TYPE_ULTRA_WIDE, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_TC_137 success"); + if (data == undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_TC_137 data null || undefined"); + var camInput = data; + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_TC_137 camInput: " + JSON.stringify(camInput)); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_TC_137 PASSED"); + } + } else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_TC_137 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_TC_137 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_PROMISE_TC_138 + * @tc.name : Create camerainput from cameraposition unspecified & cameratype ultra wide promise api + * @tc.desc : Create camerainput from cameraposition unspecified & cameratype ultra wide promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_PROMISE_TC_138', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_PROMISE_TC_138--------------"); + var camInputPromise = await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED, cameraObj.CameraType.CAMERA_TYPE_ULTRA_WIDE); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_PROMISE_TC_138 camInputPromise: " + JSON.stringify(camInputPromise)); + if (camInputPromise == undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_PROMISE_TC_138 camInputPromise is null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_PROMISE_TC_138 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_PROMISE_TC_138 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_PROMISE_TC_138 ends here"); + await sleep(1000); + done(); + }) + + /*CREATE CAMERAINPUT WITH POSITION UNSPECIFIED & TYPE TELEPHOTO*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_TC_139 + * @tc.name : Create camerainput from cameraposition unspecified & cameratype telephoto async api + * @tc.desc : Create camerainput from cameraposition unspecified & cameratype telephoto async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_TC_139', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_TC_139--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED, cameraObj.CameraType.CAMERA_TYPE_TELEPHOTO, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_TC_139 success"); + if (data == undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_TC_139 data is null || undefined"); + var camInput = data; + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_TC_139 camInput: " + JSON.stringify(camInput)); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_TC_139 PASSED"); + } + } else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_TC_139 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_TC_139 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_PROMISE_TC_140 + * @tc.name : Create camerainput from cameraposition unspecified & cameratype telephoto promise api + * @tc.desc : Create camerainput from cameraposition unspecified & cameratype telephoto promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_PROMISE_TC_140', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_PROMISE_TC_140--------------"); + var camInputPromise = await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED, cameraObj.CameraType.CAMERA_TYPE_TELEPHOTO); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_PROMISE_TC_140 camInputPromise: " + JSON.stringify(camInputPromise)); + if (camInputPromise == undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_PROMISE_TC_140 camInputPromise is null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_PROMISE_TC_140 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_PROMISE_TC_140 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_PROMISE_TC_140 ends here"); + await sleep(1000); + done(); + }) + + /*CREATE CAMERAINPUT WITH POSITION UNSPECIFIED & TYPE TRUE DEAPTH*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_TC_141 + * @tc.name : Create camerainput from cameraposition unspecified & cameratype true deapth async api + * @tc.desc : Create camerainput from cameraposition unspecified & cameratype true deapth async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_TC_141', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_TC_141--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED, cameraObj.CameraType.CAMERA_TYPE_TRUE_DEAPTH, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_TC_141 success"); + if (data == undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_TC_141 data is null || undefined"); + var camInput = data; + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_TC_141 camInput: " + JSON.stringify(camInput)); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_TC_141 PASSED"); + } + } else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_TC_141 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_TC_141 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_PROMISE_TC_142 + * @tc.name : Create camerainput from cameraposition unspecified & cameratype true deapth promise api + * @tc.desc : Create camerainput from cameraposition unspecified & cameratype true deapth promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_PROMISE_TC_142', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_PROMISE_TC_142--------------"); + var camInputPromise = await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED, cameraObj.CameraType.CAMERA_TYPE_TRUE_DEAPTH); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_PROMISE_TC_142 camInputPromise: " + JSON.stringify(camInputPromise)); + if (camInputPromise == undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_PROMISE_TC_142 camInputPromise is null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_PROMISE_TC_142 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_PROMISE_TC_142 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_PROMISE_TC_142 ends here"); + await sleep(1000); + done(); + }) + + /*CREATE CAMERAINPUT WITH POSITION BACK & TYPE WIDE ANGLE*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_TC_143 + * @tc.name : Create camerainput from cameraposition back & cameratype wide angle async api + * @tc.desc : Create camerainput from cameraposition back & cameratype wide angle async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_TC_143', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_TC_143--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_TC_143 success"); + if (data == undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_TC_143 data is null || undefined"); + var camInput = data; + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_TC_143 camInput: " + JSON.stringify(camInput)); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_TC_143 PASSED"); + } + } else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_TC_143 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_TC_143 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_PROMISE_TC_144 + * @tc.name : Create camerainput from cameraposition back & cameratype wide angle promise api + * @tc.desc : Create camerainput from cameraposition back & cameratype wide angle promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_PROMISE_TC_144', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_PROMISE_TC_144--------------"); + var camInputPromise = await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_PROMISE_TC_144 camInputPromise: " + JSON.stringify(camInputPromise)); + if (camInputPromise == undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_PROMISE_TC_144 camInputPromise is null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_PROMISE_TC_144 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_PROMISE_TC_144 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_PROMISE_TC_144 ends here"); + await sleep(1000); + done(); + }) + + /*CREATE CAMERAINPUT WITH POSITION BACK & TYPE ULTRA ANGLE*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_TC_145 + * @tc.name : Create camerainput from cameraposition back & cameratype ultra wide async api + * @tc.desc : Create camerainput from cameraposition back & cameratype ultra wide async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_TC_145', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_TC_145--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_ULTRA_WIDE, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_TC_145 success"); + if (data == undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_TC_145 data is null || undefined"); + var camInput = data; + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_TC_145 camInput: " + JSON.stringify(camInput)); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_TC_145 PASSED"); + } + } else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_TC_145 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_TC_145 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_PROMISE_TC_146 + * @tc.name : Create camerainput from cameraposition back & cameratype ultra wide promise api + * @tc.desc : Create camerainput from cameraposition back & cameratype ultra wide promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_PROMISE_TC_146', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_PROMISE_TC_146--------------"); + var camInputPromise = await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_ULTRA_WIDE); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_PROMISE_TC_146 camInputPromise: " + JSON.stringify(camInputPromise)); + if (camInputPromise == undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_PROMISE_TC_146 camInputPromise isnull || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_PROMISE_TC_146 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_PROMISE_TC_146 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_PROMISE_TC_146 ends here"); + await sleep(1000); + done(); + }) + + /*CREATE CAMERAINPUT WITH POSITION BACK & TYPE TELEPHOTO*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_TC_147 + * @tc.name : Create camerainput from cameraposition back & cameratype telephoto async api + * @tc.desc : Create camerainput from cameraposition back & cameratype telephoto async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_TC_147', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_TC_147--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_TELEPHOTO, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_TC_147 success"); + if (data == undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_TC_147 data is null || undefined"); + var camInput = data; + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_TC_147 camInput: " + JSON.stringify(camInput)); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_TC_147 PASSED"); + } + } else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_TC_147 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_TC_147 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_PROMISE_TC_148 + * @tc.name : Create camerainput from cameraposition back & cameratype telephoto promise api + * @tc.desc : Create camerainput from cameraposition back & cameratype telephoto promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_PROMISE_TC_148', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_PROMISE_TC_148--------------"); + var camInputPromise = await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_TELEPHOTO); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_PROMISE_TC_148 camInputPromise: " + JSON.stringify(camInputPromise)); + if (camInputPromise == undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_PROMISE_TC_148 camInputPromise is null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_PROMISE_TC_148 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_PROMISE_TC_148 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_PROMISE_TC_148 ends here"); + await sleep(1000); + done(); + }) + + /*CREATE CAMERAINPUT WITH POSITION BACK & TYPE TRUE DEAPTH*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_TC_149 + * @tc.name : Create camerainput from cameraposition back & cameratype true deapth async api + * @tc.desc : Create camerainput from cameraposition back & cameratype true deapth async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_TC_149', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_TC_149--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_TRUE_DEAPTH, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_TC_149 success"); + if (data == undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_TC_149 data is null || undefined"); + var camInput = data; + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_TC_149 camInput: " + JSON.stringify(camInput)); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_TC_149 PASSED"); + } + } else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_TC_149 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_TC_149 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_PROMISE_TC_150 + * @tc.name : Create camerainput from cameraposition back & cameratype true deapth promise api + * @tc.desc : Create camerainput from cameraposition back & cameratype true deapth promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_PROMISE_TC_150', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_PROMISE_TC_150--------------"); + var camInputPromise = await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_TRUE_DEAPTH); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_PROMISE_TC_150 camInputPromise: " + JSON.stringify(camInputPromise)); + if (camInputPromise == undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_PROMISE_TC_150 camInputPromise is null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_PROMISE_TC_150 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_PROMISE_TC_150 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_PROMISE_TC_150 ends here"); + await sleep(1000); + done(); + }) + + /*CREATE CAMERAINPUT WITH POSITION FRONT & TYPE WIDE ANGLE*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_TC_151 + * @tc.name : Create camerainput from cameraposition front & cameratype wide angle async api + * @tc.desc : Create camerainput from cameraposition front & cameratype wide angle async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_TC_151', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_TC_151--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_TC_151 success"); + if (data == undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_TC_151 data is null || undefined"); + var camInput = data; + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_TC_151 camInput: " + JSON.stringify(camInput)); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_TC_151 PASSED"); + } + } else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_TC_151 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_TC_151 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_PROMISE_TC_152 + * @tc.name : Create camerainput from cameraposition front & cameratype wide angle promise api + * @tc.desc : Create camerainput from cameraposition front & cameratype wide angle promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_PROMISE_TC_152', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_PROMISE_TC_152--------------"); + var camInputPromise = await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_PROMISE_TC_152 camInputPromise: " + JSON.stringify(camInputPromise)); + if (camInputPromise == undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_PROMISE_TC_152 camInputPromise is null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_PROMISE_TC_152 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_PROMISE_TC_152 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_PROMISE_TC_152 ends here"); + await sleep(1000); + done(); + }) + + /*CREATE CAMERAINPUT WITH POSITION FRONT & TYPE ULTRA ANGLE*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_TC_153 + * @tc.name : Create camerainput from cameraposition front & cameratype ultra wide async api + * @tc.desc : Create camerainput from cameraposition front & cameratype ultra wide async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_TC_153', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_TC_153--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_ULTRA_WIDE, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_TC_153 success"); + if (data == undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_TC_153 data is null || undefined"); + var camInput = data; + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_TC_153 camInput: " + JSON.stringify(camInput)); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_TC_153 PASSED"); + } + } else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_TC_153 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_TC_153 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_PROMISE_TC_154 + * @tc.name : Create camerainput from cameraposition front & cameratype ultra wide promise api + * @tc.desc : Create camerainput from cameraposition front & cameratype ultra wide promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_PROMISE_TC_154', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_PROMISE_TC_154--------------"); + var camInputPromise = await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_ULTRA_WIDE); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_PROMISE_TC_154 camInputPromise: " + JSON.stringify(camInputPromise)); + if (camInputPromise == undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_PROMISE_TC_154 camInputPromise is null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_PROMISE_TC_154 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_PROMISE_TC_154 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_PROMISE_TC_154 ends here"); + await sleep(1000); + done(); + }) + + /*CREATE CAMERAINPUT WITH POSITION FRONT & TYPE TELEPHOTO*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_TC_155 + * @tc.name : Create camerainput from cameraposition front & cameratype telephoto async api + * @tc.desc : Create camerainput from cameraposition front & cameratype telephoto async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_TC_155', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_TC_155--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_TELEPHOTO, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_TC_155 success"); + if (data == undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_TC_155 data is null || undefined"); + var camInput = data; + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_TC_155 camInput: " + JSON.stringify(camInput)); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_TC_155 PASSED"); + } + } else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_TC_155 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_TC_155 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_PROMISE_TC_156 + * @tc.name : Create camerainput from cameraposition front & cameratype telephoto promise api + * @tc.desc : Create camerainput from cameraposition front & cameratype telephoto promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_PROMISE_TC_156', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_PROMISE_TC_156--------------"); + var camInputPromise = await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_TELEPHOTO); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_PROMISE_TC_156 camInputPromise: " + JSON.stringify(camInputPromise)); + if (camInputPromise == undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_PROMISE_TC_156 camInputPromise is null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_PROMISE_TC_156 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_PROMISE_TC_156 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_PROMISE_TC_156 ends here"); + await sleep(1000); + done(); + }) + + /*CREATE CAMERAINPUT WITH POSITION FRONT & TYPE TRUE DEAPTH*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_TC_157 + * @tc.name : Create camerainput from cameraposition front & cameratype true deapth async api + * @tc.desc : Create camerainput from cameraposition front & cameratype true deapth async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_TC_157', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_TC_157--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_TRUE_DEAPTH, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_TC_157 success"); + if (data == undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_TC_157 data is null || undefined"); + var camInput = data; + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_TC_157 camInput: " + JSON.stringify(camInput)); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_TC_157 PASSED"); + } + } else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_TC_157 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_TC_157 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_PROMISE_TC_158 + * @tc.name : Create camerainput from cameraposition front & cameratype true deapth promise api + * @tc.desc : Create camerainput from cameraposition front & cameratype true deapth promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_PROMISE_TC_158', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_PROMISE_TC_158--------------"); + var camInputPromise = await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_TRUE_DEAPTH); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_PROMISE_TC_158 camInputPromise: " + JSON.stringify(camInputPromise)); + if (camInputPromise == undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_PROMISE_TC_158 camInputPromise is null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_PROMISE_TC_158 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_PROMISE_TC_158 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_PROMISE_TC_158 ends here"); + await sleep(1000); + done(); + }) + +}) +} \ No newline at end of file diff --git a/multimedia/camera/camera_js_standard/src/main/ets/default/test/CameraJSUnitPhotoAsync.test.ets b/multimedia/camera/camera_js_standard/src/main/ets/default/test/CameraJSUnitPhotoAsync.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..2a8b6c2801e88cea667fba82762b96b14b85cb57 --- /dev/null +++ b/multimedia/camera/camera_js_standard/src/main/ets/default/test/CameraJSUnitPhotoAsync.test.ets @@ -0,0 +1,1859 @@ +/* + * 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 cameraObj from '@ohos.multimedia.camera'; +import image from '@ohos.multimedia.image'; +import fileio from '@ohos.fileio'; +import abilityAccessCtrl from '@ohos.abilityAccessCtrl' +import bundle from '@ohos.bundle' + +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; + +const TAG = "CameraModuleTest: "; + +// Define global variables +var camera0Input; +var cameraManager; +var previewOutputAsync; +var photoOutputAsync; +var captureSession; +var surfaceId1; + +var photosettings1 = { + rotation: 0, + quality: 0, + } +var photosettings2 = { + rotation: 90, + quality: 1, + } +var photosettings3 = { + rotation: 180, + quality: 2, + } +var photosettings4 = { + rotation: 270 + } + +var PermissionFlag = { + PERMISSION_USER_SET: 1, + PERMISSION_USER_FIXED: 2, + PERMISSION_SYSTEM_FIXED: 3 +}; + +const RESULT_FAIL = -1 +const TIMEOUT = 1000; +const DEFAULT_PERMISSION_FALG = 0 +var permissionNameUser = "ohos.permission.CAMERA"; +var tokenID = undefined + +export default function cameraTestCase(surfaceId:any) { + + async function getImageReceiverSurfaceId() { + console.log(TAG + 'Entering create Image receiver') + var receiver = image.createImageReceiver(640, 480, 4, 8) + console.log(TAG + 'before receiver check') + if (receiver !== undefined) { + console.log(TAG + 'Receiver is ok') + surfaceId1 = await receiver.getReceivingSurfaceId() + console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) + } else { + console.log(TAG + 'Receiver is not ok') + } + } + +describe('PhotoModeAsync', function () { + // Define local variables + var camerasArray; + +console.log('##########start AccessTokenTests'); + beforeAll(async function (done){ + var appInfo = await bundle.getApplicationInfo('com.example.cameramoduletestetsv2',0 ,100); + tokenID = appInfo.accessTokenId; + console.info(TAG + "AccessTokenTest accessTokenId:" + appInfo.accessTokenId + ", name:"+ appInfo.name + + ", bundleName:" + appInfo.bundleName) + sleep(TIMEOUT); + console.info(TAG + "Grant permission start"); + var atManager = abilityAccessCtrl.createAtManager(); + var result = await atManager.grantUserGrantedPermission(tokenID, permissionNameUser, + PermissionFlag.PERMISSION_USER_FIXED); + console.info(TAG + "Grant permission finish, result:" + result + ", TokenID:" + tokenID); + done(); + }) + afterEach(function(){ + }) + + + function sleep(ms) { + console.info(TAG + "Entering sleep -> Promise constructor"); + return new Promise(resolve => setTimeout(resolve, ms)); + } + + console.info(TAG + "----------Camera-PhotoMode-Async-------------"); + /** + * @tc.number : GET_CAMERA_MANAGER_TC_001 + * @tc.name : Create camera manager instance async api + * @tc.desc : Create camera manager instance async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_CAMERA_MANAGER_TC_001', 0, async function (done) { + console.info("--------------GET_CAMERA_MANAGER_TC_001--------------"); + cameraObj.getCameraManager(null, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_CAMERA_MANAGER_TC_001 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering GET_CAMERA_MANAGER_TC_001 data is not null || undefined"); + cameraManager = data; + expect(true).assertTrue(); + console.info(TAG + "Entering GET_CAMERA_MANAGER_TC_001 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_CAMERA_MANAGER_TC_001 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_CAMERA_MANAGER_TC_001 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_CAMERAS_TC_002 + * @tc.name : Get camera from cameramanager to get array of camera async api + * @tc.desc : Get camera from cameramanager to get array of camera async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_CAMERAS_TC_002', 0, async function (done) { + console.info("--------------GET_CAMERAS_TC_002--------------"); + cameraManager.getCameras(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_CAMERAS_TC_002 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering GET_CAMERAS_TC_002 data is not null || undefined"); + camerasArray = data; + if (camerasArray != null && camerasArray.length > 0) { + for (var i = 0; i < camerasArray.length; i++) { + // Get the variables from camera object + var cameraId = camerasArray[i].cameraId; + console.info(TAG + "Entering GET_CAMERAS_TC_002 camera" + i + "Id: " + cameraId); + var cameraPosition = camerasArray[i].cameraPosition; + console.info(TAG + "Entering GET_CAMERAS_TC_002 camera" + i + "Position: " + cameraPosition); + var cameraType = camerasArray[i].cameraType; + console.info(TAG + "Entering GET_CAMERAS_TC_002 camera" + i + "Type: " + cameraType); + var connectionType = camerasArray[i].connectionType + console.info(TAG + "Entering GET_CAMERAS_TC_002 connection" + i + "Type: " + connectionType); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_CAMERAS_TC_002 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_CAMERAS_TC_002 FAILED cameraArray is null || undefined"); + } + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_CAMERAS_TC_002 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_CAMERAS_TC_002 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /*CAMERA-0 Scripts*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_TC_003 + * @tc.name : Create camerainput from camera-0 cameraId async api + * @tc.desc : Create camerainput from camera-0 cameraId async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_TC_003', 0, async function (done) { + console.info("--------------CAMERA-0 STARTS HERE--------------"); + console.info("--------------CREATE_CAMERA_INPUT_TC_003--------------"); + cameraManager.createCameraInput(camerasArray[0].cameraId, async (err, data) => { + if (!err) { + if (data != null && data != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_003 data is not null || undefined"); + camera0Input = data; + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_003 PASSED with CameraID :" + camerasArray[0].cameraId); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_003 FAILED: " + err.message); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_003 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /*PreviewOutput APIs test script*/ + /** + * @tc.number : CREATE_PREVIEW_OUTPUT_SUCCESS_TC_004 + * @tc.name : Create PreviewOutput instance api + * @tc.desc : Create PreviewOutput instance api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + + it('CREATE_PREVIEW_OUTPUT_SUCCESS_TC_004', 0, async function (done) { + console.info(TAG + " Entering CREATE_PREVIEW_OUTPUT_SUCCESS_TC_004 to operate"); + cameraObj.createPreviewOutput(surfaceId, async (err, data) => { + if(!err){ + console.info(TAG + " Entering createPreviewOutput success"); + if (data != null || data != undefined) { + console.info(TAG + " Entering createPreviewOutput data is not null || undefined"); + previewOutputAsync = data; + expect(true).assertTrue(); + console.info(TAG + "Entering createPreviewOutput PASSED" + previewOutputAsync); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering createPreviewOutput FAILED" + err.message); + console.info(TAG + "Entering createPreviewOutput ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /*PhotoOutput APIs test script*/ + /** + * @tc.number : CREATE_PHOTO_OUTPUT_SUCCESS_TC_005 + * @tc.name : Create PhotoOutput instance api + * @tc.desc : Create PhotoOutput instance api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + + it('CREATE_PHOTO_OUTPUT_SUCCESS_TC_005', 0, async function (done) { + console.info(TAG + "Entering CREATE_PHOTO_OUTPUT_SUCCESS_TC_005 to operate"); + console.info(TAG + 'Entering getImageReceiverSurfaceId') + await getImageReceiverSurfaceId() + await sleep(1000) + cameraObj.createPhotoOutput(surfaceId1, async (err, data) => { + if(!err){ + console.info(TAG + "Entering createPhotoOutput success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering createPhotoOutput data is not null || undefined"); + photoOutputAsync = data; + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_PHOTO_OUTPUT_SUCCESS_TC_005 PASSED"); + } + }else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_PHOTO_OUTPUT_SUCCESS_TC_005 FAILED"); + console.info(TAG + "Entering createPhotoOutput ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /*CaptureSession APIs test script*/ + /** + * @tc.number : CREATE_CAPTURE_SESSION_SUCCESS_TC_006 + * @tc.name : Create CaptureSession instance api + * @tc.desc : Create CaptureSession instance api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAPTURE_SESSION_SUCCESS_TC_006', 0, async function (done) { + console.info(TAG + "Entering CREATE_CAPTURE_SESSION_SUCCESS_TC_006 to operate"); + cameraObj.createCaptureSession(null, async (err, data) => { + if(!err){ + console.info(TAG + "Entering createCaptureSession success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering createCaptureSession data is not null || undefined"); + captureSession = data; + expect(true).assertTrue(); + console.info(TAG + "Entering createCaptureSession PASSED"); + } + }else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAPTURE_SESSION_SUCCESS_TC_006 FAILED" +err.message); + console.info(TAG + "Entering createCaptureSession ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /*CaptureSession APIs*/ + /** + * @tc.number : CREATE_BEGIN_CONFIG_SUCCESS_TC_007 + * @tc.name : CaptureSession_Begin config api + * @tc.desc : CaptureSession_Begin config api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_BEGIN_CONFIG_SUCCESS_TC_007', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + "Entering CREATE_BEGIN_CONFIG_SUCCESS captureSession == null || undefined"); + } else { + console.info(TAG + "Entering CREATE_BEGIN_CONFIG_SUCCESS_TC_007 to operate"); + captureSession.beginConfig(async (err, data) => { + if(!err){ + console.info(TAG + "Entering beginConfig success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering CREATE_BEGIN_CONFIG beginConfig data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_BEGIN_CONFIG_SUCCESS_TC_007 beginConfig PASSED"); + } + }else { + expect().assertFail(); + console.info(TAG + "Entering beginConfig FAILED" + err.message); + console.info(TAG + "Entering beginConfig ends here"); + } + await sleep(1000); + done(); + }) + + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : ADD_INPUT_SUCCESS_008 + * @tc.name : Add Input with camera0Input api + * @tc.desc : Add Input with camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ADD_INPUT_SUCCESS_008', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + "Entering ADD_INPUT_SUCCESS_008 captureSession == null || undefined"); + } else { + console.info(TAG + "Entering ADD_INPUT_SUCCESS_008 to operate"); + captureSession.addInput(camera0Input, async (err, data) => { + if(!err){ + console.info(TAG + "Entering ADD_INPUT_SUCCESS_008 addInput success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering ADD_INPUT_SUCCESS_008 addInput data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering ADD_INPUT_SUCCESS_008 addInput PASSED"); + } + }else { + expect().assertFail(); + console.info(TAG + "Entering ADD_INPUT_SUCCESS_008 FAILED: " + err.message); + console.info(TAG + "Entering ADD_INPUT_SUCCESS_008 ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : ADD_OUTPUT_PREVIEW_SUCCESS_009 + * @tc.name : Add output with camera0Input api + * @tc.desc : Add output with camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ADD_OUTPUT_PREVIEW_SUCCESS_009', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS_009 captureSession == null || undefined"); + } else { + console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS_009 to operate"); + captureSession.addOutput(previewOutputAsync, async (err, data) => { + if(!err){ + console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS_009 : Success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS_009 data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS_009 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS_009 FAILED" + err.message); + console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS_009 ends here"); + } + await sleep(1000); + done(); + }) + } + }) + + /** + * @tc.number : ADD_OUTPUT_PHOTO_SUCCESS_010 + * @tc.name : Add output with photo output api + * @tc.desc : Add output with photo output api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ADD_OUTPUT_PHOTO_SUCCESS_010', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS_010 captureSession == null || undefined"); + } else { + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS_010 to operate"); + captureSession.addOutput(photoOutputAsync, async (err, data) => { + if (!err) { + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS_010 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS_010 data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS_010 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS_010 FAILED: " + err.message); + } + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS_010 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : COMMIT_CONFIG_SUCCESS_011 + * @tc.name : commit config api + * @tc.desc : commit config api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('COMMIT_CONFIG_SUCCESS_011', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS_011 captureSession == null || undefined"); + } else { + console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS_011 to operate"); + captureSession.commitConfig(async (err, data) => { + if(!err){ + console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS_011 commitConfig success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS_011 data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS_011 commitConfig PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS_011 commitConfig FAILED" + err.message); + console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS_011 commitConfig ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + +// callback related API + + //preview callback + + /** + * @tc.number : PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_012 + * @tc.name : Preview output callback on frame start api + * @tc.desc : Preview output callback on frame start api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_012', 0, async function (done) { + if (previewOutputAsync == null || previewOutputAsync == undefined) { + console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_012 previewOutput == null || undefined"); + } else { + console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_012 to operate"); + previewOutputAsync.on("frameStart", async (err, data) => { + if (!err) { + console.info(TAG + "PreviewStart frameStart Callback is success"); + if (data != null || data != undefined) { + expect(true).assertTrue(); + } + } else { + expect().assertFail() + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_013 + * @tc.name : Preview capture callback on frame end api + * @tc.desc : Preview capture callback on frame end api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_013', 0, async function (done) { + if (previewOutputAsync == null || previewOutputAsync == undefined) { + console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_013 previewOutput == null || undefined"); + } else { + console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_013 to operate"); + previewOutputAsync.on("frameEnd", async (err, data) => { + if (!err) { + console.info(TAG + "PreviewStop frameEnd Callback is success"); + if (data != null || data != undefined) { + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : PREVIEW_OUTPUT_CALLBACK_ON_ERROR_014 + * @tc.name : Preview output callback on error api + * @tc.desc : Preview output callback on error api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PREVIEW_OUTPUT_CALLBACK_ON_ERROR_014', 0, async function (done) { + if (previewOutputAsync == null || previewOutputAsync == undefined) { + console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_ERROR_014 previewOutput == null || undefined"); + } else { + console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_ERROR_014 to operate"); + previewOutputAsync.on("error", async (err, data) => { + if (!err) { + console.info(TAG + "PreviewOutputError callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "Error during PreviewOutput with ErrorCode: " + data.code); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + //Capture callback + /** + * @tc.number : PHOTO_CAP_CALLBACK_ON_CAPTURE_START_015 + * @tc.name : Photo capture callback on capture start api + * @tc.desc : Photo capture callback on capture start api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTO_CAP_CALLBACK_ON_CAPTURE_START_015', 0, async function (done) { + if (photoOutputAsync == null || photoOutputAsync == undefined) { + console.info(TAG + "Entering PHOTO_CAP_CALLBACK_ON_CAPTURE_START_015 photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTO_CAP_CALLBACK_ON_CAPTURE_START_015 to operate"); + photoOutputAsync.on("captureStart", async (err, data) => { + if (!err) { + console.info(TAG + "CaptureStart Callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "captureStart success with captureId: " + data); + expect(true).assertTrue(); + } + } else { + expect().assertFail() + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : PHOTO_CAP_CALLBACK_ON_CAPTURE_END_016 + * @tc.name : Photo capture callback on capture end api + * @tc.desc : Photo capture callback on capture end api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTO_CAP_CALLBACK_ON_CAPTURE_END_016', 0, async function (done) { + if (photoOutputAsync == null || photoOutputAsync == undefined) { + console.info(TAG + "Entering PHOTO_CAP_CALLBACK_ON_CAPTURE_END_016 photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTO_CAP_CALLBACK_ON_CAPTURE_END_016 to operate"); + photoOutputAsync.on("captureEnd", async (err, data) => { + if (!err) { + console.info(TAG + "captureEnd callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "captureEnd callback with captureId: " + data.captureId); + console.info(TAG + "captureEnd callback with frameCount: " + data.frameCount); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_017 + * @tc.name : Photo capture callback on frame shutter api + * @tc.desc : Photo capture callback on frame shutter api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_017', 0, async function (done) { + if (photoOutputAsync == null || photoOutputAsync == undefined) { + console.info(TAG + "Entering PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_017 photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_017 to operate"); + photoOutputAsync.on("frameShutter", async (err, data) => { + if (!err) { + console.info(TAG + "frameShutter callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "frameShutter callback with captureId: " + data.captureId); + console.info(TAG + "frameShutter callback with timestamp: " + data.timestamp); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : PHOTO_OUTPUT_CALLBACK_ON_ERROR_018 + * @tc.name : Photo output callback on error api + * @tc.desc : Photo output callback on error api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTO_OUTPUT_CALLBACK_ON_ERROR_018', 0, async function (done) { + if (photoOutputAsync == null || photoOutputAsync == undefined) { + console.info(TAG + "Entering PHOTO_OUTPUT_CALLBACK_ON_ERROR_018 photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTO_OUTPUT_CALLBACK_ON_ERROR_018 to operate"); + photoOutputAsync.on("error", async (err, data) => { + if (!err) { + console.info(TAG + "PhotoOutputError callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "Error during PhotoOutput with ErrorCode: " + data.code); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + //Capturesession callback + /** + * @tc.number : CAP_SES_CALLBACK_ON_ERROR_019 + * @tc.name : CaptureSession callback on error api + * @tc.desc : CaptureSession callback on error api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAP_SES_CALLBACK_ON_ERROR_019', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + "Entering CAP_SES_CALLBACK_ON_ERROR_019 captureSession == null || undefined"); + } else { + console.info(TAG + "Entering CAP_SES_CALLBACK_ON_ERROR_019 to operate"); + captureSession.on("error", async (err, data) => { + if (!err) { + console.info(TAG + " captureSession errorcallback is success"); + if (data != null || data != undefined) { + console.info(TAG + "Error in CaptureSessioncallback with ErrorCode: " + data.code); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + //FocusState callback + /** + * @tc.number : FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT0_020 + * @tc.name : focus state change callback on camera0Input api + * @tc.desc : Preview capture callback on frame end api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ +// it('FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT0_020', 0, async function (done) { +// if (camera0Input == null || camera0Input == undefined) { +// console.info(TAG + "Entering FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT0_020 previewOutput == null || undefined"); +// } else { +// console.info(TAG + "Entering FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT0_020 to operate"); +// camera0Input.on("focusStateChange", async (err, data) => { +// if (!err) { +// console.info(TAG + "FocusState callback is success"); +// if (data != null || data != undefined) { +// console.info(TAG + "Current FocusState is: " + data); +// expect(true).assertTrue(); +// } +// } else { +// expect().assertFail(); +// } +// await sleep(1000); +// done(); +// }) +// await sleep(1000); +// done(); +// } +// }) + + /** + * @tc.number : CAPTURE_SESSION_START_SUCCESS_021 + * @tc.name : capture session start api + * @tc.desc : capture session start api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAPTURE_SESSION_START_SUCCESS_021', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + "Entering CAPTURE_SESSION_START_SUCCESS_021 captureSession == null || undefined"); + } else { + console.info(TAG + "Entering CAPTURE_SESSION_START_SUCCESS_021 to operate"); + captureSession.start(async (err, data) => { + console.info(TAG + "Entering captureSession.start success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering CAPTURE_SESSION_START_SUCCESS_021 data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CAPTURE_SESSION_START_SUCCESS_021 PASSED"); + } + console.info(TAG + "Entering CAPTURE_SESSION_START_SUCCESS_021 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + //FLASH Function API scripts + /** + * @tc.number : HAS_FLASH_TC_022 + * @tc.name : check if has flash-camera0Input api + * @tc.desc : check if has flash-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('HAS_FLASH_TC_022', 0, async function (done) { + console.info("--------------HAS_FLASH_TC_022--------------"); + console.info(TAG + 'hasFlash called.') + camera0Input.hasFlash(async (err, data) => { + if (!err) { + console.info(TAG + "Entering HAS_FLASH success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering HAS_FLASH data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering HAS_FLASH PASSED with HAS_FLASH is: " +data); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering HAS_FLASH FAILED" + err.message); + } + console.info(TAG + "Entering HAS_FLASH_TC_022 ends here"); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : IS_FLASH_MODE_OPEN_SUPPORTED_023 + * @tc.name : check if flash mode open is supported-camera0Input api + * @tc.desc : check if flash mode open is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FLASH_MODE_OPEN_SUPPORTED_023', 0, async function (done) { + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED_023 to operate"); + camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_OPEN, async (err, data) => { + if (!err) { + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED_023 SUCCESS "); + if (data != null || data != undefined) { + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED data is not null || undefined"); + console.info(TAG + "FLASH_MODE_OPEN supported is: " +data); + expect(true).assertTrue(); + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED PASSED"); + } + } else { + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED FAILED" + err.message); + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED ends here"); + } + await sleep(1000); + done(); + }) + + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_FLASH_MODE_OPEN_024 + * @tc.name : set flash mode open camera0 api + * @tc.desc : set flash mode open camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FLASH_MODE_OPEN_024', 0, async function (done) { + console.info(TAG + "Entering SET_FLASH_MODE_OPEN_024 to operate"); + camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_OPEN, async (err, data) => { + if (!err) { + console.info(TAG + "Entering SET_FLASH_MODE_OPEN_024 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_OPEN); + if (data != null || data != undefined) { + console.info(TAG + "Entering SET_FLASH_MODE_OPEN_024 PASSED") + expect(true).assertTrue() + } + } else { + expect().assertFail(); + console.info(TAG + "Entering SET_FLASH_MODE_OPEN_024 FAILED" + err.message); + console.info(TAG + "Entering SET_FLASH_MODE_OPEN_024 ends here"); + } + await sleep(1000); + done(); + }) + + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_FLASH_MODE_OPEN_025 + * @tc.name : get flash mode open camera0 api + * @tc.desc : get flash mode open camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + + it('GET_FLASH_MODE_OPEN_025', 0, async function (done) { + console.info(TAG + "Entering GET_FLASH_MODE_OPEN_025 to operate"); + camera0Input.getFlashMode(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_FLASH_MODE_OPEN success"); + if (data == 1) { + console.info(TAG + "GET_FLASH_MODE_OPEN data is not null || undefined: "); + console.info(TAG + "Current FlashMode is: " +data); + expect(true).assertTrue(); + console.info(TAG + "GET_FLASH_MODE_OPEN_025 PASSED"); + + } + } + else { + expect().assertFail(); + console.info(TAG + "GET_FLASH_MODE_OPEN_025 FAILED" + err.message); + console.info(TAG + "GET_FLASH_MODE_OPEN_025 ends here"); + } + await sleep(1000); + done(); + + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_026 + * @tc.name : check if flash mode always open is supported-camera0Input api + * @tc.desc : check if flash mode always open is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_026', 0, async function (done) { + console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_026 to operate"); + camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN, async (err, data) => { + if (!err) { + console.info(TAG + "Entering FLASH_MODE_ALWAYS_OPEN SUCCESS "); + if (data != null || data != undefined) { + console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "FLASH_MODE_ALWAYS_OPEN supported is: " +data); + console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_026 PASSED"); + } + } else { + console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_026 FAILED" + err.message); + console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_026 ends here"); + } + await sleep(1000); + done(); + }) + + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_FLASH_MODE_ALWAYS_OPEN_027 + * @tc.name : set flash mode always open camera0 api + * @tc.desc : set flash mode always open camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FLASH_MODE_ALWAYS_OPEN_027', 0, async function (done) { + console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN_027 to operate"); + camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN, async (err, data) => { + if (!err) { + console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN_027 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); + if (data != null || data != undefined) { + console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN_027 PASSED") + expect(true).assertTrue() + } + } else { + expect().assertFail(); + console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN_027 FAILED" + err.message); + console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN_027 ends here"); + } + await sleep(1000); + done(); + }) + + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_FLASH_MODE_ALWAYS_OPEN_028 + * @tc.name : get flash mode always open camera0 api + * @tc.desc : get flash mode always open camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + + it('GET_FLASH_MODE_ALWAYS_OPEN_028', 0, async function (done) { + console.info(TAG + "Entering GET_FLASH_MODE_ALWAYS_OPEN_028 to operate"); + camera0Input.getFlashMode(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_FLASH_MODE_ALWAYS_OPEN success"); + if (data == 3) { + console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN data is not null || undefined: "); + expect(true).assertTrue(); + console.info(TAG + "Current FlashMode is: " +data); + console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN_028 PASSED"); + } + } + else { + expect().assertFail(); + console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN_028 FAILED" + err.message); + console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN_028 ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_029 + * @tc.name : Photo output capture without photosettings api + * @tc.desc : Photo output capture without photosettings api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_029', 0, async function (done) { + if (photoOutputAsync == null || photoOutputAsync == undefined) { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_029 photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_029 to operate"); + photoOutputAsync.capture(async (err, data) => { + if (!err) { + console.info(TAG + "Entering photoOutput capture without photosettings success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); + console.info(TAG + "Entering photoOutput capture without photosettings PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering photoOutput capture without photosettings FAILED" + err.message); + console.info(TAG + "Entering photoOutput capture without photosettings ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : IS_FLASH_MODE_CLOSE_SUPPORTED_030 + * @tc.name : check if flash mode close is supported-camera0Input api + * @tc.desc : check if flash mode close is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FLASH_MODE_CLOSE_SUPPORTED_030', 0, async function (done) { + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED_030 to operate"); + camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_CLOSE, async (err, data) => { + if (!err) { + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED_030 SUCCESS "); + if (data != null || data != undefined) { + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "FLASH_MODE_CLOSE supported is: " +data); + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED PASSED"); + } + } else { + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED FAILED" + err.message); + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED ends here"); + } + await sleep(1000); + done(); + }) + + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_FLASH_MODE_CLOSE_031 + * @tc.name : set flash mode close camera0 api + * @tc.desc : set flash mode close camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FLASH_MODE_CLOSE_031', 0, async function (done) { + console.info(TAG + "Entering SET_FLASH_MODE_CLOSE_031 to operate"); + camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_CLOSE, async (err, data) => { + if (!err) { + console.info(TAG + "Entering SET_FLASH_MODE_CLOSE_031 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_CLOSE); + if (data != null || data != undefined) { + console.info(TAG + "Entering SET_FLASH_MODE_CLOSE_031 PASSED") + expect(true).assertTrue() + } + } else { + expect().assertFail(); + console.info(TAG + "Entering SET_FLASH_MODE_CLOSE_031 FAILED" + err.message); + console.info(TAG + "Entering SET_FLASH_MODE_CLOSE_031 ends here"); + } + await sleep(1000); + done(); + }) + + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_FLASH_MODE_CLOSE_032 + * @tc.name : get flash mode close camera0 api + * @tc.desc : get flash mode close camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + + it('GET_FLASH_MODE_CLOSE_032', 0, async function (done) { + console.info(TAG + "Entering GET_FLASH_MODE_CLOSE_032 to operate"); + camera0Input.getFlashMode(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_FLASH_MODE_CLOSE_032 success"); + if (data == 0) { + console.info(TAG + "GET_FLASH_MODE_CLOSE data is not null || undefined: "); + console.info(TAG + "Current FlashMode is: " +data); + expect(true).assertTrue(); + console.info(TAG + "GET_FLASH_MODE_CLOSE_032 PASSED"); + } + } + else { + expect().assertFail(); + console.info(TAG + "GET_FLASH_MODE_CLOSE_032 FAILED" + err.message); + console.info(TAG + "GET_FLASH_MODE_CLOSE_032 ends here"); + } + await sleep(1000) + done(); + + }) + await sleep(1000) + done() + }) + + // FOCUS API's + + /** + * @tc.number : IS_FOCUS_MODE_MANUAL_SUPPORTED_033 + * @tc.name : check if focus mode manual is supported-camera0Input api + * @tc.desc : check if focus mode manual is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FOCUS_MODE_MANUAL_SUPPORTED_033', 0, async function (done) { + console.info(TAG + "Entering IS_FOCUS_MODE_MANUAL_SUPPORTED_033 to operate"); + camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_MANUAL, async (err, data) => { + if (!err) { + console.info(TAG + "Entering IS_FOCUS_MODE_MANUAL_SUPPORTED_033 SUCCESS " ); + if (data != null || data != undefined) { + console.info(TAG + "Entering IS_FOCUS_MODE_MANUAL_SUPPORTED_033 data is not null || undefined"); + console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " +data ); + expect(true).assertTrue(); + console.info(TAG + "Entering IS_FOCUS_MODE_MANUAL_SUPPORTED_033 PASSED: "); + } + } else { + console.info(TAG + "IS_FOCUS_MODE_MANUAL_SUPPORTED_033 FAILED" + err.message); + expect().assertFail(); + console.info(TAG + "IS_FOCUS_MODE_MANUAL_SUPPORTED_033 ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_FOCUS_MODE_MANUAL_034 + * @tc.name : set focus mode manual camera0 api + * @tc.desc : set focus mode manual camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FOCUS_MODE_MANUAL_034', 0, async function (done) { + console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL_034 to operate"); + camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_MANUAL, async (err, data) => { + if (!err) { + console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL_034 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); + if (data != null || data != undefined) { + console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL_034 PASSED") + expect(true).assertTrue() + } + } else { + expect().assertFail(); + console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL_034 FAILED" + err.message); + console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL_034 ends here"); + } + await sleep(1000); + done(); + }) + + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_FOCUS_MODE_MANUAL_035 + * @tc.name : get focus mode manual camera0 api + * @tc.desc : get focus mode manual camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + + it('GET_FOCUS_MODE_MANUAL_035', 0, async function (done) { + console.info(TAG + "Entering GET_FOCUS_MODE_MANUAL_035 to operate"); + camera0Input.getFocusMode(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_FOCUS_MODE_MANUAL_035 SUCCESS"); + if (data == 0) { + console.info(TAG + "GET_FOCUS_MODE_MANUAL data is not null || undefined: "); + console.info(TAG + "Current FocusMode is: " +data); + expect(true).assertTrue(); + console.info(TAG + "GET_FOCUS_MODE_MANUAL_035 PASSED"); + + } + } + else { + expect().assertFail(); + console.info(TAG + "GET_FOCUS_MODE_MANUAL_035 FAILED" + err.message); + console.info(TAG + "GET_FOCUS_MODE_MANUAL_035 ends here"); + } + await sleep(1000); + done(); + + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_036 + * @tc.name : check if focus mode continuous is supported-camera0Input api + * @tc.desc : check if focus mode continuous is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_036', 0, async function (done) { + console.info(TAG + "Entering IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_036 to operate"); + camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO, async (err, data) => { + if (!err) { + console.info(TAG + "Entering IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_036 SUCCESS " ); + if (data != null || data != undefined) { + console.info(TAG + "Entering IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_036 data is not null || undefined"); + console.info(TAG + "FOCUS_MODE_CONTINOUS_SUPPORTED is: " +data ); + expect(true).assertTrue(); + console.info(TAG + "Entering IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_036 PASSED: "); + } + } else { + console.info(TAG + "IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_036 FAILED" + err.message); + expect().assertFail(); + console.info(TAG + "IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_036 ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_FOCUS_MODE_CONTINUOUS_037 + * @tc.name : set focus mode continuous camera0 api + * @tc.desc : set focus mode continuous camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FOCUS_MODE_CONTINUOUS_037', 0, async function (done) { + console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS_037 to operate"); + camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO, async (err, data) => { + if (!err) { + console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS_037 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); + if (data != null || data != undefined) { + expect(true).assertTrue() + console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS_037 PASSED") + } + } else { + expect().assertFail(); + console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS_037 FAILED" + err.message); + console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS_037 ends here"); + } + await sleep(1000); + done(); + }) + + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_FOCUS_MODE_CONTINUOUS_038 + * @tc.name : get focus mode continuous camera0 api + * @tc.desc : get focus mode continuous camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + + it('GET_FOCUS_MODE_CONTINUOUS_038', 0, async function (done) { + console.info(TAG + "Entering GET_FOCUS_MODE_CONTINUOUS_038 to operate"); + camera0Input.getFocusMode(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_FOCUS_MODE_CONTINUOUS_038 SUCCESS"); + if (data == 1) { + console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS data is not null || undefined: "); + console.info(TAG + "Current FocusMode is: " +data); + expect(true).assertTrue(); + console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS_038 PASSED"); + + } + } + else { + expect().assertFail(); + console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS_038 FAILED" + err.message); + console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS_038 ends here"); + } + await sleep(1000); + done(); + + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : IS_FOCUS_MODE_AUTO_SUPPORTED_039 + * @tc.name : check if focus mode auto is supported-camera0Input api + * @tc.desc : check if focus mode auto is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FOCUS_MODE_AUTO_SUPPORTED_039', 0, async function (done) { + console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED_039 to operate"); + camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO, async (err, data) => { + if (!err) { + console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED_039 SUCCESS " ); + if (data != null || data != undefined) { + console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED_039 data is not null || undefined"); + console.info(TAG + "FOCUS_MODE_AUTO_SUPPORTED is: " + data ); + expect(true).assertTrue(); + console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED_039 PASSED: "); + } + } else { + console.info(TAG + "IS_FOCUS_MODE_AUTO_SUPPORTED_039 FAILED" + err.message); + expect().assertFail(); + console.info(TAG + "IS_FOCUS_MODE_AUTO_SUPPORTED_039 ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : IS_FOCUS_MODE_AUTO_SUPPORTED_040 + * @tc.name : set focus mode auto camera0 api + * @tc.desc : set focus mode auto camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + + it('IS_FOCUS_MODE_AUTO_SUPPORTED_040', 0, async function (done) { + console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED_040 to operate"); + camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO, async (err, data) => { + if (!err) { + console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED_040 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_AUTO); + if (data != null || data != undefined) { + expect(true).assertTrue() + console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED_040 PASSED") + } + } else { + expect().assertFail(); + console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED_040 FAILED" + err.message); + console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED_040 ends here"); + } + await sleep(1000); + done(); + }) + + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_FOCUS_MODE_AUTO_041 + * @tc.name : get focus mode auto camera0 api + * @tc.desc : get focus mode auto camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FOCUS_MODE_AUTO_041', 0, async function (done) { + console.info(TAG + "Entering GET_FOCUS_MODE_AUTO_041 to operate"); + camera0Input.getFocusMode(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_FOCUS_MODE_AUTO_041 SUCCESS"); + if (data == 2) { + console.info(TAG + "GET_FOCUS_MODE_AUTO data is not null || undefined: "); + console.info(TAG + "Current FocusMode is: " +data); + expect(true).assertTrue(); + console.info(TAG + "GET_FOCUS_MODE_AUTO_041 PASSED"); + + } + } + else { + expect().assertFail(); + console.info(TAG + "GET_FOCUS_MODE_AUTO_041 FAILED" + err.message); + console.info(TAG + "GET_FOCUS_MODE_AUTO_041 ends here"); + } + await sleep(1000); + done(); + + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS_042 Rotation-0 & Quality-0 + * @tc.name : Photo output capture with photosettings api + * @tc.desc : Photo output capture with photosettings api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS_042', 0, async function (done) { + if (photoOutputAsync == null || photoOutputAsync == undefined) { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS_042 photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS_042 to operate"); + photoOutputAsync.capture(photosettings1, async (err, data) => { + if (!err) { + console.info(TAG + "Entering photoOutput capture with photosettings1 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering photoOutput capture with photosettings1 data is not null || undefined"); + console.info(TAG + "Entering photoOutput capture with photosettings1 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering photoOutput capture with photosettings1 FAILED" + err.message); + console.info(TAG + "Entering photoOutput capture with photosettings1 ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS_043 with Rotation-90 & Quality-1 + * @tc.name : Photo output capture with photosettings api + * @tc.desc : Photo output capture with photosettings api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS_043', 0, async function (done) { + if (photoOutputAsync == null || photoOutputAsync == undefined) { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS_043 photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS_043 to operate"); + photoOutputAsync.capture(photosettings2, async (err, data) => { + if (!err) { + console.info(TAG + "Entering photoOutput capture with photosettings2 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering photoOutput capture with photosettings2 data is not null || undefined"); + console.info(TAG + "Entering photoOutput capture with photosettings2 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering photoOutput capture with photosettings2 FAILED" + err.message); + console.info(TAG + "Entering photoOutput capture with photosettings2 ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS_044 with Rotation-180 & Quality-2 + * @tc.name : Photo output capture with photosettings api + * @tc.desc : Photo output capture with photosettings api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS_044', 0, async function (done) { + if (photoOutputAsync == null || photoOutputAsync == undefined) { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS_044 photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS_044 to operate"); + photoOutputAsync.capture(photosettings3, async (err, data) => { + if (!err) { + console.info(TAG + "Entering photoOutput capture with photosettings3 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering photoOutput capture with photosettings3 data is not null || undefined"); + console.info(TAG + "Entering photoOutput capture with photosettings3 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering photoOutput capture with photosettings3 FAILED" + err.message); + console.info(TAG + "Entering photoOutput capture with photosettings3 ends here"); + } + }) + await sleep(1000); + done(); + } + }) + + +//ZOOM Function + + /** + * @tc.number : GET_ZOOM_RATIO_TC_045 + * @tc.name : get zoom ratio camera-0 cameraId api + * @tc.desc : get zoom ratio camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_ZOOM_RATIO_TC_045', 0, async function (done) { + console.info("--------------GET_ZOOM_RATIO_TC_045--------------"); + camera0Input.getZoomRatioRange(async (err,data) => { + if (!err) { + if (data != null && data != undefined) { + console.info(TAG + "Entering GET_ZOOM_RATIO_TC_045 data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering GET_ZOOM_RATIO_TC_045 Success " +data) + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_ZOOM_RATIO_TC_045 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_ZOOM_RATIO_TC_045 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + + /** + * @tc.number : SET_GET_ZOOM_1_ASYNC_TC_046 + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_1_ASYNC_TC_046', 0, async function (done) { + camera0Input.setZoomRatio(1, (err,data)=>{ + if(!err){ + console.info(TAG + "setZoomRatio success: 1"); + console.info(TAG + "getZoomRatio called") + camera0Input.getZoomRatio((err,data1) => { + if(!err){ + console.info(TAG + "getZoomRatio success : "+data1); + expect(data1).assertEqual(1); + console.info(TAG + "SET_GET_ZOOM_1_ASYNC_TC_046 PASSED "); + } + else { + expect().assertFail(); + console.info(TAG + "SET_GET_ZOOM_1_ASYNC_TC_046 FAILED" + err.message); + } + }) + } + }) + await sleep(1000); + done(); + }) + + + /** + * @tc.number : SET_GET_ZOOM_2_ASYNC_TC_047 + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_2_ASYNC_TC_047', 0, async function (done) { + camera0Input.setZoomRatio(2, (err,data)=>{ + if(!err){ + console.info(TAG + "setZoomRatio success: 2"); + console.info(TAG + "getZoomRatio called") + camera0Input.getZoomRatio((err,data1) => { + if(!err){ + console.info(TAG + "getZoomRatio success : "+data1); + expect(data1).assertEqual(2); + console.info(TAG + "SET_GET_ZOOM_2_ASYNC_TC_047 PASSED "); + } + else { + expect().assertFail(); + console.info(TAG + "SET_GET_ZOOM_2_ASYNC_TC_047 FAILED" + err.message); + } + }) + } + }) + await sleep(1000); + done(); + }) + + + + /** + * @tc.number : SET_GET_ZOOM_3_ASYNC_TC_048 + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_3_ASYNC_TC_048', 0, async function (done) { + camera0Input.setZoomRatio(3, (err,data)=>{ + if(!err){ + console.info(TAG + "setZoomRatio success: 3"); + console.info(TAG + "getZoomRatio called") + camera0Input.getZoomRatio((err,data1) => { + if(!err){ + console.info(TAG + "getZoomRatio success : "+data1); + expect(data1).assertEqual(3); + console.info(TAG + "SET_GET_ZOOM_3_ASYNC_TC_048 PASSED "); + } + else { + expect().assertFail(); + console.info(TAG + "SET_GET_ZOOM_3_ASYNC_TC_048 FAILED" + err.message); + } + }) + } + }) + await sleep(1000); + done(); + }) + + + /** + * @tc.number : SET_GET_ZOOM_4_ASYNC_TC_049 + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_4_ASYNC_TC_049', 0, async function (done) { + camera0Input.setZoomRatio(4, (err,data)=>{ + if(!err){ + console.info(TAG + "setZoomRatio success: 4"); + console.info(TAG + "getZoomRatio called") + camera0Input.getZoomRatio((err,data1) => { + if(!err){ + console.info(TAG + "getZoomRatio success : "+data1); + expect(data1).assertEqual(4); + console.info(TAG + "SET_GET_ZOOM_4_ASYNC_TC_049 PASSED "); + } + else { + expect().assertFail(); + console.info(TAG + "SET_GET_ZOOM_4_ASYNC_TC_049 FAILED" + err.message); + } + }) + } + }) + await sleep(1000); + done(); + }) + + + /** + * @tc.number : SET_GET_ZOOM_5_ASYNC_TC_050 + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_5_ASYNC_TC_050', 0, async function (done) { + camera0Input.setZoomRatio(5, (err,data)=>{ + if(!err){ + console.info(TAG + "setZoomRatio success: 5"); + console.info(TAG + "getZoomRatio called") + camera0Input.getZoomRatio((err,data1) => { + if(!err){ + console.info(TAG + "getZoomRatio success : "+data1); + expect(data1).assertEqual(5); + console.info(TAG + "SET_GET_ZOOM_5_ASYNC_TC_050 PASSED "); + } + else { + expect().assertFail(); + console.info(TAG + "SET_GET_ZOOM_5_ASYNC_TC_050 FAILED" + err.message); + } + }) + } + }) + await sleep(1000); + done(); + }) + + + + /** + * @tc.number : SET_GET_ZOOM_6_ASYNC_TC_051 + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_6_ASYNC_TC_051', 0, async function (done) { + camera0Input.setZoomRatio(6, (err,data)=>{ + if(!err){ + console.info(TAG + "setZoomRatio success: 6"); + console.info(TAG + "getZoomRatio called") + camera0Input.getZoomRatio((err,data1) => { + if(!err){ + console.info(TAG + "getZoomRatio success : "+data1); + expect(data1).assertEqual(6); + console.info(TAG + "SET_GET_ZOOM_6_ASYNC_TC_051 PASSED "); + } + else { + expect().assertFail(); + console.info(TAG + "SET_GET_ZOOM_6_ASYNC_TC_051 FAILED" + err.message); + } + }) + } + }) + await sleep(1000); + done(); + }) + +/** + * @tc.number : PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS_052 with Rotation-270 + * @tc.name : Photo output capture with photosettings api + * @tc.desc : Photo output capture with photosettings api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS_052', 0, async function (done) { + if (photoOutputAsync == null || photoOutputAsync == undefined) { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS_052 photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS_052 to operate"); + photoOutputAsync.capture(photosettings4, async (err, data) => { + if (!err) { + console.info(TAG + "Entering photoOutput capture with photosettings4 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering photoOutput capture with photosettings4 data is not null || undefined"); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS_052 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS_052 FAILED" + err.message); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS_052 ends here"); + } + }) + await sleep(1000); + done(); + } + }) + + + + + /*CaptureSession APIs test script*/ + /** + * @tc.number : CAPTURE_SESSION_STOP_SUCCESS_053 + * @tc.name : capture session stop api + * @tc.desc : capture session stop api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAPTURE_SESSION_STOP_SUCCESS_053', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + "Entering CAPTURE_SESSION_STOP_SUCCESS_053 captureSession == null || undefined"); + } else { + console.info(TAG + "Entering CAPTURE_SESSION_STOP_SUCCESS_053 to operate"); + captureSession.stop(async (err, data) => { + if(!err){ + console.info(TAG + "Entering CAPTURE_SESSION_STOP_SUCCESS_053 captureSession.stop success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering captureSession.stop data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CAPTURE_SESSION_STOP_SUCCESS_053 captureSession.stop PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering captureSession.stop FAILED" + err.message); + console.info(TAG + "Entering captureSession.stop ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : CAPTURE_SESSION_RELEASE_SUCCESS_054 + * @tc.name : capture session release api + * @tc.desc : capture session release api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAPTURE_SESSION_RELEASE_SUCCESS_054', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + "Entering CAPTURE_SESSION_RELEASE_SUCCESS_054 captureSession == null || undefined"); + } else { + console.info(TAG + "Entering CAPTURE_SESSION_RELEASE_SUCCESS_054 to operate"); + captureSession.release(async (err, data) => { + if(!err){ + console.info(TAG + "Entering captureSession.release success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering captureSession.release data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering captureSession.release PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering CAPTURE_SESSION_RELEASE_SUCCESS_054 FAILED: " + err.message); + console.info(TAG + "Entering captureSession.release ends here"); + await sleep(1000); + done(); + } + }) + await sleep(1000); + done(); + } + }) +}) +} \ No newline at end of file diff --git a/multimedia/camera/camera_js_standard/src/main/ets/default/test/CameraJSUnitPhotoPromise.test.ets b/multimedia/camera/camera_js_standard/src/main/ets/default/test/CameraJSUnitPhotoPromise.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..74decbb10336f4d712073e376615b3d0ce55d070 --- /dev/null +++ b/multimedia/camera/camera_js_standard/src/main/ets/default/test/CameraJSUnitPhotoPromise.test.ets @@ -0,0 +1,1653 @@ +/* + * 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 cameraObj from '@ohos.multimedia.camera'; +import image from '@ohos.multimedia.image'; +import fileio from '@ohos.fileio'; +import abilityAccessCtrl from '@ohos.abilityAccessCtrl' +import bundle from '@ohos.bundle' + +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; + +const TAG = "CameraModuleTest: "; + +// Define global variables +var camera0InputPromise; +var cameraManagerPromise; +var previewOutputPromise; +var photoOutputPromise; +var CaptureSessionPromise; +var surfaceId1; + +var photosettings1 = { + rotation: 0, + quality: 0, +} +var photosettings2 = { + rotation: 90, + quality: 1, +} +var photosettings3 = { + rotation: 180, + quality: 2, +} +var photosettings4 = { + rotation: 270 +} + +var PermissionFlag = { + PERMISSION_USER_SET: 1, + PERMISSION_USER_FIXED: 2, + PERMISSION_SYSTEM_FIXED: 3 +}; + +const RESULT_FAIL = -1 +const TIMEOUT = 1000; +const DEFAULT_PERMISSION_FALG = 0 +var permissionNameUser = "ohos.permission.CAMERA"; +var tokenID = undefined + +export default function cameraTestCase(surfaceId:any) { + + async function getImageReceiverSurfaceId() { + console.log(TAG + 'Entering create Image receiver') + var receiver = image.createImageReceiver(640, 480, 4, 8) + console.log(TAG + 'before receiver check') + if (receiver !== undefined) { + console.log(TAG + 'Receiver is ok') + surfaceId1 = await receiver.getReceivingSurfaceId() + console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) + } else { + console.log(TAG + 'Receiver is not ok') + } + } + + describe('PhotoModePromise', function () { + // Define local variables + var camerasArrayPromise; + + var camerasArray; + console.log('##########start AccessTokenTests'); + beforeAll(async function (done){ + var appInfo = await bundle.getApplicationInfo('com.example.cameramoduletestetsv2',0 ,100); + tokenID = appInfo.accessTokenId; + console.info(TAG + "AccessTokenTest accessTokenId:" + appInfo.accessTokenId + ", name:"+ appInfo.name + + ", bundleName:" + appInfo.bundleName) + sleep(TIMEOUT); + console.info(TAG + "Grant permission start"); + var atManager = abilityAccessCtrl.createAtManager(); + var result = await atManager.grantUserGrantedPermission(tokenID, permissionNameUser, + PermissionFlag.PERMISSION_USER_FIXED); + console.info(TAG + "Grant permission finish, result:" + result + ", TokenID:" + tokenID); + done(); + }) + afterEach(function(){ + }) + + function sleep(ms) { + console.info(TAG + "Entering sleep -> Promise constructor"); + return new Promise(resolve => setTimeout(resolve, ms)); + } + + console.info(TAG + "----------Camera-PhotoMode-Promise-------------"); + /** + * @tc.number : GET_CAMERA_MANAGER_PROMISE_TC_001 + * @tc.name : Create camera manager instance promise api + * @tc.desc : Create camera manager instance promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_CAMERA_MANAGER_PROMISE_TC_001', 0, async function (done) { + console.info("--------------GET_CAMERA_MANAGER_PROMISE_TC_001--------------"); + cameraManagerPromise = await cameraObj.getCameraManager(null); + console.info(TAG + "Entering GET_CAMERA_MANAGER_PROMISE_TC_001 cameraManagerPromise: " + JSON.stringify(cameraManagerPromise)); + if (cameraManagerPromise != null && cameraManagerPromise != undefined) { + expect(true).assertTrue(); + console.info(TAG + "Entering GET_CAMERA_MANAGER_PROMISE_TC_001 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_CAMERA_MANAGER_PROMISE_TC_001 FAILED"); + } + console.info(TAG + "Entering GET_CAMERA_MANAGER_PROMISE_TC_001 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_CAMERAS_PROMISE_TC_002 + * @tc.name : Get camera from cameramanager to get array of camera promise api + * @tc.desc : Get camera from cameramanager to get array of camera promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_CAMERAS_PROMISE_TC_002', 0, async function (done) { + console.info("--------------GET_CAMERAS_PROMISE_TC_002--------------"); + camerasArrayPromise = await cameraManagerPromise.getCameras(); + console.info(TAG + "Entering GET_CAMERAS_PROMISE_TC_002: " + JSON.stringify(camerasArrayPromise)); + if (camerasArrayPromise != null && camerasArrayPromise.length > 0) { + console.info(TAG + "Entering GET_CAMERAS_PROMISE_TC_002 success"); + for (var i = 0; i < camerasArrayPromise.length; i++) { + // Get the variables from camera object + var cameraId = camerasArrayPromise[i].cameraId; + console.info(TAG + "Entering GET_CAMERAS_PROMISE_TC_002 camera" + i + "Id: " + cameraId); + var cameraPosition = camerasArrayPromise[i].cameraPosition; + console.info(TAG + "Entering GET_CAMERAS_PROMISE_TC_002 camera" + i + "Position: " + cameraPosition); + var cameraType = camerasArrayPromise[i].cameraType; + console.info(TAG + "Entering GET_CAMERAS_PROMISE_TC_002 camera" + i + "Type: " + cameraType); + var connectionType = camerasArrayPromise[i].connectionType + console.info(TAG + "Entering GET_CAMERAS_PROMISE_TC_002 connection" + i + "Type: " + connectionType); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_CAMERAS_PROMISE_TC_002 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_CAMERAS_PROMISE_TC_002 FAILED"); + } + console.info(TAG + "Entering GET_CAMERAS_PROMISE_TC_002 ends here"); + await sleep(1000); + done(); + }) + + /*CAMERA-0 Scripts*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_PROMISE_TC_003 + * @tc.name : Create camerainput from camera-0 cameraId promise api + * @tc.desc : Create camerainput from camera-0 cameraId promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_PROMISE_TC_003', 0, async function (done) { + console.info("--------------CAMERA-0 STARTS HERE--------------"); + console.info("--------------CREATE_CAMERA_INPUT_PROMISE_TC_003--------------"); + camera0InputPromise = await cameraManagerPromise.createCameraInput(camerasArrayPromise[0].cameraId); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_003 camera0InputPromise: " + JSON.stringify(camera0InputPromise)); + if (camera0InputPromise != null && camera0InputPromise != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_003 camera0InputPromise is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_003 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_003 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_003 ends here"); + await sleep(1000); + done(); + }) + + /*PreviewOutput APIs test script*/ + /** + * @tc.number : CREATE_PREVIEW_OUTPUT_SUCCESS_PROMISE_TC_004 + * @tc.name : Create PreviewOutput instance promise api + * @tc.desc : Create PreviewOutput instance promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_PREVIEW_OUTPUT_SUCCESS_TC_004', 0, async function (done) { + console.info(TAG + " Entering CREATE_PREVIEW_OUTPUT_SUCCESS_PROMISE_TC_004 to operate"); + previewOutputPromise = await cameraObj.createPreviewOutput(surfaceId); + console.info(TAG + " Entering createPreviewOutput success"); + if (previewOutputPromise != null || previewOutputPromise != undefined) { + expect(true).assertTrue(); + console.info(TAG + "Entering createPreviewOutput PASSED: " + JSON.stringify(previewOutputPromise)); + } + else { + expect().assertFail(); + console.info(TAG + "Entering createPreviewOutput FAILED"); + console.info(TAG + "Entering createPreviewOutput ends here"); + } + await sleep(1000); + done(); + }) + + /*PhotoOutput APIs test script*/ + /** + * @tc.number : CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_TC_005 + * @tc.name : Create PhotoOutput instance promise api + * @tc.desc : Create PhotoOutput instance promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_TC_005', 0, async function (done) { + console.info(TAG + "Entering CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_TC_005 to operate"); + console.info(TAG + 'Entering getImageReceiverSurfaceId') + await getImageReceiverSurfaceId() + await sleep(1000) + photoOutputPromise = await cameraObj.createPhotoOutput(surfaceId1); + console.info(TAG + "Entering createPhotoOutput success"); + if (photoOutputPromise != null || photoOutputPromise != undefined) { + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_TC_005 PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_TC_005 FAILED"); + console.info(TAG + "Entering createPhotoOutput ends here"); + } + await sleep(1000); + done(); + }) + + /*CaptureSession APIs test script*/ + /** + * @tc.number : CREATE_CAPTURE_SESSION_SUCCESS_PROMISE_TC_006 + * @tc.name : Create CaptureSession instance promise api + * @tc.desc : Create Capturesession instance promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAPTURE_SESSION_SUCCESS_PROMISE_TC_006', 0, async function (done) { + console.info(TAG + "Entering CREATE_CAPTURE_SESSION_SUCCESS_PROMISE_TC_006 to operate"); + CaptureSessionPromise = await cameraObj.createCaptureSession(null); + console.info(TAG + "Entering createCaptureSession success"); + if (CaptureSessionPromise != null || CaptureSessionPromise != undefined) { + console.info(TAG + "Entering createCaptureSession data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering createCaptureSession PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAPTURE_SESSION_SUCCESS_PROMISE_TC_006 FAILED"); + console.info(TAG + "Entering createCaptureSession ends here"); + } + await sleep(1000); + done(); + }) + + /*CaptureSession APIs*/ + /** + * @tc.number : CREATE_BEGIN_CONFIG_SUCCESS_PROMISE_TC_007 + * @tc.name : CaptureSession_Begin config promise api + * @tc.desc : CaptureSession_Begin config promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_BEGIN_CONFIG_SUCCESS_PROMISE_TC_007', 0, async function (done) { + if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { + console.info(TAG + "Entering CREATE_BEGIN_CONFIG_SUCCESS captureSession == null || undefined"); + } else { + console.info(TAG + "Entering CREATE_BEGIN_CONFIG_SUCCESS_PROMISE_TC_007 to operate"); + const promise = await CaptureSessionPromise.beginConfig(); + console.info(TAG + "Entering beginConfig success"); + if (promise != null || promise != undefined) { + console.info(TAG + "Entering CREATE_BEGIN_CONFIG beginConfig data is not null || undefined: " + JSON.stringify(promise)); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_BEGIN_CONFIG_SUCCESS_PROMISE_TC_007 beginConfig PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering beginConfig FAILED"); + } + console.info(TAG + "Entering beginConfig ends here"); + await sleep(1000); + done(); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : ADD_INPUT_SUCCESS_PROMISE_008 + * @tc.name : Add Input with camera0Input api + * @tc.desc : Add Input with camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ADD_INPUT_SUCCESS_PROMISE_008', 0, async function (done) { + if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { + console.info(TAG + "Entering ADD_INPUT_SUCCESS_PROMISE_008 captureSession == null || undefined"); + } else { + console.info(TAG + "Entering ADD_INPUT_SUCCESS_PROMISE_008 to operate"); + const Promise = await CaptureSessionPromise.addInput(camera0InputPromise); + console.info(TAG + "Entering ADD_INPUT_SUCCESS_PROMISE_008 addInput success"); + if (Promise != null || Promise != undefined) { + console.info(TAG + "Entering ADD_INPUT_SUCCESS_PROMISE_008 addInput data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering ADD_INPUT_SUCCESS_PROMISE_008 addInput PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering ADD_INPUT_SUCCESS_PROMISE_008 FAILED: "); + } + console.info(TAG + "Entering ADD_INPUT_SUCCESS_PROMISE_008 ends here"); + await sleep(1000); + done(); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_009 + * @tc.name : Add output with camera0Input api + * @tc.desc : Add output with camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ADD_OUTPUT_PREVIEW_SUCCESS_009', 0, async function (done) { + if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { + console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS_009 captureSession == null || undefined"); + } else { + console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS_009 to operate"); + const promise = await CaptureSessionPromise.addOutput(previewOutputPromise); + console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS_009 : Success"); + if (promise != null || promise != undefined) { + console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS_009 data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS_009 PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS_009 FAILED"); + } + console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS_009 ends here"); + await sleep(1000); + done(); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : ADD_OUTPUT_PHOTO_SUCCESS_010 + * @tc.name : Add output with photo output api + * @tc.desc : Add output with photo output api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ADD_OUTPUT_PHOTO_SUCCESS_010', 0, async function (done) { + if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS_010 captureSession == null || undefined"); + } else { + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS_010 to operate"); + const promise = await CaptureSessionPromise.addOutput(photoOutputPromise); + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS_010 success"); + if (promise != null || promise != undefined) { + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS_010 data is not null || undefined" ); + expect(true).assertTrue(); + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS_010 PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS_010 FAILED: "); + } + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS_010 ends here"); + await sleep(1000); + done(); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : COMMIT_CONFIG_SUCCESS_011 + * @tc.name : commit config api + * @tc.desc : commit config api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('COMMIT_CONFIG_SUCCESS_011', 0, async function (done) { + if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { + console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS_011 captureSession == null || undefined"); + } else { + console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS_011 to operate"); + const promise = await CaptureSessionPromise.commitConfig(); + console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS_011 commitConfig success"); + if (promise != null || promise != undefined) { + console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS_011 data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS_011 commitConfig PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS_011 commitConfig FAILED"); + console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS_011 commitConfig ends here"); + } + await sleep(1000); + done(); + } + await sleep(1000); + done(); + }) + + // callback related API + + //preview callback + + /** + * @tc.number : PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_012 + * @tc.name : Preview output callback on frame start api + * @tc.desc : Preview output callback on frame start api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_012', 0, async function (done) { + if (previewOutputPromise == null || previewOutputPromise == undefined) { + console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_012 previewOutput == null || undefined"); + } else { + console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_012 to operate"); + previewOutputPromise.on("frameStart", async (err, data) => { + if (!err) { + console.info(TAG + "Preview frameStart Callback is success"); + if (data != null || data != undefined) { + expect(true).assertTrue(); + } + } else { + expect().assertFail() + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_013 + * @tc.name : Preview capture callback on frame end api + * @tc.desc : Preview capture callback on frame end api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_013', 0, async function (done) { + if (previewOutputPromise == null || previewOutputPromise == undefined) { + console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_013 previewOutput == null || undefined"); + } else { + console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_013 to operate"); + previewOutputPromise.on("frameEnd", async (err, data) => { + if (!err) { + console.info(TAG + "Preview frameEnd Callback is success"); + if (data != null || data != undefined) { + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : PREVIEW_OUTPUT_CALLBACK_ON_ERROR_014 + * @tc.name : Preview output callback on error api + * @tc.desc : Preview output callback on error api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PREVIEW_OUTPUT_CALLBACK_ON_ERROR_014', 0, async function (done) { + if (previewOutputPromise == null || previewOutputPromise == undefined) { + console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_ERROR_014 previewOutput == null || undefined"); + } else { + console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_ERROR_014 to operate"); + previewOutputPromise.on("error", async (err, data) => { + if (!err) { + console.info(TAG + "PreviewOutputError callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "Error during PreviewOutput with ErrorCode: " + data.code); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + //Capture callback + /** + * @tc.number : PHOTO_CAP_CALLBACK_ON_CAPTURE_START_015 + * @tc.name : Photo capture callback on capture start api + * @tc.desc : Photo capture callback on capture start api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTO_CAP_CALLBACK_ON_CAPTURE_START_015', 0, async function (done) { + if (photoOutputPromise == null || photoOutputPromise == undefined) { + console.info(TAG + "Entering PHOTO_CAP_CALLBACK_ON_CAPTURE_START_015 photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTO_CAP_CALLBACK_ON_CAPTURE_START_015 to operate"); + photoOutputPromise.on("captureStart", async (err, data) => { + if (!err) { + console.info(TAG + "CaptureStart Callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "captureStart success with captureId: " + data); + expect(true).assertTrue(); + } + } else { + expect().assertFail() + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : PHOTO_CAP_CALLBACK_ON_CAPTURE_END_016 + * @tc.name : Photo capture callback on capture end api + * @tc.desc : Photo capture callback on capture end api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTO_CAP_CALLBACK_ON_CAPTURE_END_016', 0, async function (done) { + if (photoOutputPromise == null || photoOutputPromise == undefined) { + console.info(TAG + "Entering PHOTO_CAP_CALLBACK_ON_CAPTURE_END_016 photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTO_CAP_CALLBACK_ON_CAPTURE_END_016 to operate"); + photoOutputPromise.on("captureEnd", async (err, data) => { + if (!err) { + console.info(TAG + "captureEnd callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "captureEnd callback with captureId: " + data.captureId); + console.info(TAG + "captureEnd callback with frameCount: " + data.frameCount); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_017 + * @tc.name : Photo capture callback on frame shutter api + * @tc.desc : Photo capture callback on frame shutter api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_017', 0, async function (done) { + if (photoOutputPromise == null || photoOutputPromise == undefined) { + console.info(TAG + "Entering PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_017 photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_017 to operate"); + photoOutputPromise.on("frameShutter", async (err, data) => { + if (!err) { + console.info(TAG + "frameShutter callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "frameShutter callback with captureId: " + data.captureId); + console.info(TAG + "frameShutter callback with timestamp: " + data.timestamp); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : PHOTO_OUTPUT_CALLBACK_ON_ERROR_018 + * @tc.name : Photo output callback on error api + * @tc.desc : Photo output callback on error api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTO_OUTPUT_CALLBACK_ON_ERROR_018', 0, async function (done) { + if (photoOutputPromise == null || photoOutputPromise == undefined) { + console.info(TAG + "Entering PHOTO_OUTPUT_CALLBACK_ON_ERROR_018 photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTO_OUTPUT_CALLBACK_ON_ERROR_018 to operate"); + photoOutputPromise.on("error", async (err, data) => { + if (!err) { + console.info(TAG + "PhotoOutputError callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "Error during PhotoOutput with ErrorCode: " + data.code); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + //Capturesession callback + /** + * @tc.number : CAP_SES_CALLBACK_ON_ERROR_019 + * @tc.name : CaptureSession callback on error api + * @tc.desc : CaptureSession callback on error api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAP_SES_CALLBACK_ON_ERROR_019', 0, async function (done) { + if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { + console.info(TAG + "Entering CAP_SES_CALLBACK_ON_ERROR_019 captureSession == null || undefined"); + } else { + console.info(TAG + "Entering CAP_SES_CALLBACK_ON_ERROR_019 to operate"); + CaptureSessionPromise.on("error", async (err, data) => { + if (!err) { + console.info(TAG + " captureSession errorcallback is success"); + if (data != null || data != undefined) { + console.info(TAG + "Error in CaptureSessioncallback with ErrorCode: " + data.code); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + //FocusState callback + /** + * @tc.number : FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT0_020 + * @tc.name : focus state change callback on camera0Input api + * @tc.desc : Preview capture callback on frame end api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ +// it('FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT0_020', 0, async function (done) { +// if (camera0InputPromise == null || camera0InputPromise == undefined) { +// console.info(TAG + "Entering FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT0_020 previewOutput == null || undefined"); +// } else { +// console.info(TAG + "Entering FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT0_020 to operate"); +// camera0InputPromise.on("focusStateChange", async (err, data) => { +// if (!err) { +// console.info(TAG + "FocusState callback is success"); +// if (data != null || data != undefined) { +// console.info(TAG + "Current FocusState is: " + data); +// expect(true).assertTrue(); +// } +// } else { +// expect().assertFail(); +// } +// await sleep(1000); +// done(); +// }) +// await sleep(1000); +// done(); +// } +// }) + + /** + * @tc.number : CAPTURE_SESSION_START_SUCCESS_021 + * @tc.name : capture session start api + * @tc.desc : capture session start api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAPTURE_SESSION_START_SUCCESS_021', 0, async function (done) { + if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { + console.info(TAG + "Entering CAPTURE_SESSION_START_SUCCESS_021 captureSession == null || undefined"); + } else { + console.info(TAG + "Entering CAPTURE_SESSION_START_SUCCESS_021 to operate"); + const promise = await CaptureSessionPromise.start(); + console.info(TAG + "Entering captureSession start success"); + if (promise != null || promise != undefined) { + console.info(TAG + "Entering CAPTURE_SESSION_START_SUCCESS_021 data is not null || undefined" + promise); + expect(true).assertTrue(); + console.info(TAG + "Entering CAPTURE_SESSION_START_SUCCESS_021 PASSED"); + } + console.info(TAG + "Entering CAPTURE_SESSION_START_SUCCESS_021 ends here"); + await sleep(1000); + done(); + } + await sleep(1000); + done(); + }) + + //FLASH Function API scripts + /** + * @tc.number : HAS_FLASH_TC_022 + * @tc.name : check if has flash-camera0Input api + * @tc.desc : check if has flash-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('HAS_FLASH_TC_022', 0, async function (done) { + console.info("--------------HAS_FLASH_TC_022--------------"); + console.info(TAG + 'hasFlash called.') + var hasFlashPromise = await camera0InputPromise.hasFlash(); + console.info(TAG + "Entering HAS_FLASH success"); + if (hasFlashPromise != null || hasFlashPromise != undefined) { + console.info(TAG + "Entering HAS_FLASH data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering HAS_FLASH PASSED with HAS_FLASH is: " + JSON.stringify(hasFlashPromise)); + } + else { + expect().assertFail(); + console.info(TAG + "Entering HAS_FLASH FAILED"); + } + console.info(TAG + "Entering HAS_FLASH_TC_022 ends here"); + await sleep(1000) + done(); + }) + + /** + * @tc.number : IS_FLASH_MODE_OPEN_SUPPORTED_023 + * @tc.name : check if flash mode open is supported-camera0Input api + * @tc.desc : check if flash mode open is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FLASH_MODE_OPEN_SUPPORTED_023', 0, async function (done) { + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED_023 to operate"); + var isFMOpenSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_OPEN); + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED_023 SUCCESS "); + if (isFMOpenSupported != null || isFMOpenSupported != undefined) { + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED data is not null || undefined"); + console.info(TAG + "FLASH_MODE_OPEN supported is: " + JSON.stringify(isFMOpenSupported)); + expect(true).assertTrue(); + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED PASSED"); + } + else { + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED FAILED"); + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED ends here"); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_FLASH_MODE_OPEN_024 + * @tc.name : set flash mode open camera0 api + * @tc.desc : set flash mode open camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FLASH_MODE_OPEN_024', 0, async function (done) { + console.info(TAG + "Entering SET_FLASH_MODE_OPEN_024 to operate"); + var SetFMOpen = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_OPEN); + console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMOpen)) + if (SetFMOpen == undefined) { + console.info(TAG + "Entering SET_FLASH_MODE_OPEN_024 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_OPEN); + console.info(TAG + "Entering SET_FLASH_MODE_OPEN_024 PASSED") + expect(true).assertTrue() + } else { + expect().assertFail(); + console.info(TAG + "Entering SET_FLASH_MODE_OPEN_024 FAILED"); + console.info(TAG + "Entering SET_FLASH_MODE_OPEN_024 ends here"); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_FLASH_MODE_OPEN_025 + * @tc.name : get flash mode open camera0 api + * @tc.desc : get flash mode open camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FLASH_MODE_OPEN_025', 0, async function (done) { + console.info(TAG + "Entering GET_FLASH_MODE_OPEN_025 to operate"); + var GetFMOpen = await camera0InputPromise.getFlashMode(); + console.info(TAG + "Entering GET_FLASH_MODE_OPEN success: " + JSON.stringify(GetFMOpen)); + if (GetFMOpen == 1) { + console.info(TAG + "GET_FLASH_MODE_OPEN data is not null || undefined: "); + console.info(TAG + "Current FlashMode is: " + JSON.stringify(GetFMOpen)); + expect(true).assertTrue(); + console.info(TAG + "GET_FLASH_MODE_OPEN_025 PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_FLASH_MODE_OPEN_025 FAILED"); + console.info(TAG + "GET_FLASH_MODE_OPEN_025 ends here"); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_026 + * @tc.name : check if flash mode always open is supported-camera0Input api + * @tc.desc : check if flash mode always open is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_026', 0, async function (done) { + console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_026 to operate"); + var isFMAlwaysOpenSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); + console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_026 SUCCESS "); + if (isFMAlwaysOpenSupported != null || isFMAlwaysOpenSupported != undefined) { + console.info(TAG + "Entering FLASH_MODE_ALWAYS_OPEN data is not null || undefined"); + console.info(TAG + "FLASH_MODE_OPEN supported is: " + isFMAlwaysOpenSupported); + expect(true).assertTrue(); + console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_026 PASSED"); + } + else { + console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_026 FAILED"); + console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_026 ends here"); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_FLASH_MODE_ALWAYS_OPEN_027 + * @tc.name : set flash mode always open camera0 api + * @tc.desc : set flash mode always open camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FLASH_MODE_ALWAYS_OPEN_027', 0, async function (done) { + console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN_027 to operate"); + var SetFMAlwaysOpen = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); + console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMAlwaysOpen)) + if (SetFMAlwaysOpen == undefined) { + console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN_027 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); + console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN_027 PASSED") + expect(true).assertTrue() + } else { + expect().assertFail(); + console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN_027 FAILED"); + console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN_027 ends here"); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_FLASH_MODE_ALWAYS_OPEN_028 + * @tc.name : get flash mode always open camera0 api + * @tc.desc : get flash mode always open camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + + it('GET_FLASH_MODE_ALWAYS_OPEN_028', 0, async function (done) { + console.info(TAG + "Entering GET_FLASH_MODE_ALWAYS_OPEN_028 to operate"); + var GetFMAlwaysOpen = await camera0InputPromise.getFlashMode(); + console.info(TAG + "Entering GET_FLASH_MODE_ALWAYS_OPEN_028 success"); + if (GetFMAlwaysOpen == 3) { + console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN_028 data is not null || undefined: "); + console.info(TAG + "Current FlashMode is: " + GetFMAlwaysOpen); + expect(true).assertTrue(); + console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN_028 PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN_028 FAILED"); + console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN_028 ends here"); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS_29 Rotation-0 & Quality-0 + * @tc.name : Photo output capture with photosettings api + * @tc.desc : Photo output capture with photosettings api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS_029', 0, async function (done) { + if (photoOutputPromise == null || photoOutputPromise == undefined) { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS_029 photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS_029 to operate"); + const promise = photoOutputPromise.capture(photosettings1); + console.info(TAG + "Entering photoOutput capture with photosettings1 success"); + if (promise != null || promise != undefined) { + console.info(TAG + "Entering photoOutput capture with photosettings1 data is not null || undefined"); + console.info(TAG + "Entering photoOutput capture with photosettings1 PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering photoOutput capture with photosettings1 FAILED"); + console.info(TAG + "Entering photoOutput capture with photosettings1 ends here"); + } + await sleep(1000); + done(); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : IS_FLASH_MODE_CLOSE_SUPPORTED_030 + * @tc.name : check if flash mode close is supported-camera0Input api + * @tc.desc : check if flash mode close is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FLASH_MODE_CLOSE_SUPPORTED_030', 0, async function (done) { + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED_030 to operate"); + var isFMCloseSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_CLOSE); + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED_030 SUCCESS "); + if (isFMCloseSupported != null || isFMCloseSupported != undefined) { + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED_030 data is not null || undefined"); + console.info(TAG + "FLASH_MODE_CLOSE supported is: " + isFMCloseSupported); + expect(true).assertTrue(); + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED_030 PASSED"); + } + else { + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED_030 FAILED"); + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED_030 ends here"); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_FLASH_MODE_CLOSE_031 + * @tc.name : set flash mode close camera0 api + * @tc.desc : set flash mode close camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FLASH_MODE_CLOSE_031', 0, async function (done) { + console.info(TAG + "Entering SET_FLASH_MODE_CLOSE_031 to operate"); + var SetFMClose = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_CLOSE); + console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMClose)) + if (SetFMClose == undefined) { + console.info(TAG + "Entering SET_FLASH_MODE_CLOSE_031 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_CLOSE); + console.info(TAG + "Entering SET_FLASH_MODE_CLOSE_031 PASSED") + expect(true).assertTrue() + } else { + expect().assertFail(); + console.info(TAG + "Entering SET_FLASH_MODE_CLOSE_031 FAILED"); + console.info(TAG + "Entering SET_FLASH_MODE_CLOSE_031 ends here"); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_FLASH_MODE_CLOSE_032 + * @tc.name : get flash mode close camera0 api + * @tc.desc : get flash mode close camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + + it('GET_FLASH_MODE_CLOSE_032', 0, async function (done) { + console.info(TAG + "Entering GET_FLASH_MODE_CLOSE_032 to operate"); + var GetFMClose = await camera0InputPromise.getFlashMode(); + console.info(TAG + "Entering GET_FLASH_MODE_CLOSE success"); + if (GetFMClose == 0) { + console.info(TAG + "GET_FLASH_MODE_CLOSE data is not null || undefined: "); + console.info(TAG + "Current FlashMode is: " + GetFMClose); + expect(true).assertTrue(); + console.info(TAG + "GET_FLASH_MODE_CLOSE_032 PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_FLASH_MODE_CLOSE_032 FAILED"); + console.info(TAG + "GET_FLASH_MODE_CLOSE_032 ends here"); + } + await sleep(1000); + done(); + }) + + // FOCUS promise API's + + it('IS_FOCUS_MODE_MANUAL_SUPPORTED_033', 0, async function (done) { + console.info(TAG + "Entering IS_FOCUS_MODE_MANUAL_SUPPORTED_033 to operate"); + var isFMmanualSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_MANUAL); + if (isFMmanualSupportedpromise != null || isFMmanualSupportedpromise != undefined) { + console.info(TAG + "Entering IS_FOCUS_MODE_MANUAL_SUPPORTED_033 data is not null || undefined"); + console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + isFMmanualSupportedpromise); + expect(true).assertTrue(); + console.info(TAG + "Entering IS_FOCUS_MODE_MANUAL_SUPPORTED_033 PASSED: "); + } + else { + console.info(TAG + "IS_FOCUS_MODE_MANUAL_SUPPORTED_033 FAILED"); + expect().assertFail(); + console.info(TAG + "IS_FOCUS_MODE_MANUAL_SUPPORTED_033 ends here"); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_FOCUS_MODE_MANUAL_034 + * @tc.name : set focus mode manual camera0 api + * @tc.desc : set focus mode manual camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + + it('SET_FOCUS_MODE_MANUAL_034', 0, async function (done) { + console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL_034 to operate"); + var setFocusManual = await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_MANUAL); + console.info(TAG + "setFocusManual: " + JSON.stringify(setFocusManual)) + if (setFocusManual == undefined) { + console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL_034 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); + console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL_034 PASSED") + expect(true).assertTrue() + } + else { + expect().assertFail(); + console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL_034 FAILED"); + console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL_034 ends here"); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_FOCUS_MODE_MANUAL_035 + * @tc.name : get focus mode manual camera0 api + * @tc.desc : get focus mode manual camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + + it('GET_FOCUS_MODE_MANUAL_035', 0, async function (done) { + console.info(TAG + "Entering GET_FOCUS_MODE_MANUAL_035 to operate"); + var getfocusmodepromise = await camera0InputPromise.getFocusMode(); + console.info(TAG + "Entering GET_FOCUS_MODE_MANUAL_035 SUCCESS"); + if (getfocusmodepromise == 0) { + console.info(TAG + "Current FocusMode is: " + getfocusmodepromise); + expect(true).assertTrue(); + console.info(TAG + "GET_FOCUS_MODE_MANUAL_035 PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_FOCUS_MODE_MANUAL_035 FAILED"); + console.info(TAG + "GET_FOCUS_MODE_MANUAL_035 ends here"); + } + await sleep(1000); + done(); + + }) + + /** + * @tc.number : IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_036 + * @tc.name : check if focus mode continuous is supported-camera0Input api + * @tc.desc : check if focus mode continuous is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_036', 0, async function (done) { + console.info(TAG + "Entering IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_036 to operate"); + var isFMContinuousSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); + if (isFMContinuousSupportedpromise != null || isFMContinuousSupportedpromise != undefined) { + console.info(TAG + "Entering IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_036 data is not null || undefined"); + console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + isFMContinuousSupportedpromise); + expect(true).assertTrue(); + console.info(TAG + "Entering IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_036 PASSED: "); + } + else { + console.info(TAG + "IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_036 FAILED"); + expect().assertFail(); + console.info(TAG + "IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_036 ends here"); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_FOCUS_MODE_CONTINUOUS_037 + * @tc.name : set focus mode continuous camera0 api + * @tc.desc : set focus mode continuous camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + + it('SET_FOCUS_MODE_CONTINUOUS_037', 0, async function (done) { + console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS_037 to operate"); + var setFocusCont = await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); + console.info(TAG + "setFocusCont: " + JSON.stringify(setFocusCont)) + if (setFocusCont == undefined) { + console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS_037 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); + console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS_037 PASSED") + expect(true).assertTrue() + } + else { + expect().assertFail(); + console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS_037 FAILED"); + console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS_037 ends here"); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_FOCUS_MODE_CONTINUOUS_038 + * @tc.name : get focus mode continuous camera0 api + * @tc.desc : get focus mode continuous camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + + it('GET_FOCUS_MODE_CONTINUOUS_038', 0, async function (done) { + console.info(TAG + "Entering GET_FOCUS_MODE_CONTINUOUS_038 to operate"); + var getfocusmodepromise = await camera0InputPromise.getFocusMode(); + console.info(TAG + "Entering GET_FOCUS_MODE_CONTINUOUS_038 SUCCESS"); + if (getfocusmodepromise == 1) { + console.info(TAG + "Current FocusMode is: " + getfocusmodepromise); + expect(true).assertTrue(); + console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS_038 PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS_038 FAILED"); + console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS_038 ends here"); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : IS_FOCUS_MODE_AUTO_SUPPORTED_039 + * @tc.name : check if focus mode auto is supported-camera0Input api + * @tc.desc : check if focus mode auto is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FOCUS_MODE_AUTO_SUPPORTED_039', 0, async function (done) { + console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED_039 to operate"); + var isFMAutoSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO); + if (isFMAutoSupportedpromise != null || isFMAutoSupportedpromise != undefined) { + console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED_039 data is not null || undefined"); + console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + isFMAutoSupportedpromise); + expect(true).assertTrue(); + console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED_039 PASSED: "); + } + else { + console.info(TAG + "IS_FOCUS_MODE_AUTO_SUPPORTED_039 FAILED"); + expect().assertFail(); + console.info(TAG + "IS_FOCUS_MODE_AUTO_SUPPORTED_039 ends here"); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_FOCUS_MODE_AUTO_040 + * @tc.name : set focus mode auto camera0 api + * @tc.desc : set focus mode auto camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FOCUS_MODE_AUTO_040', 0, async function (done) { + console.info(TAG + "Entering SET_FOCUS_MODE_AUTO_040 to operate"); + var setFocusAuto = await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO); + console.info(TAG + "setFocusAuto: " + JSON.stringify(setFocusAuto)) + if (setFocusAuto == undefined) { + console.info(TAG + "Entering SET_FOCUS_MODE_AUTO_040 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_AUTO); + console.info(TAG + "Entering SET_FOCUS_MODE_AUTO_040 PASSED") + expect(true).assertTrue() + } + else { + expect().assertFail(); + console.info(TAG + "Entering SET_FOCUS_MODE_AUTO_040 FAILED"); + console.info(TAG + "Entering SET_FOCUS_MODE_AUTO_040 ends here"); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_FOCUS_MODE_AUTO_041 + * @tc.name : get focus mode auto camera0 api + * @tc.desc : get focus mode auto camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + + it('GET_FOCUS_MODE_AUTO_041', 0, async function (done) { + console.info(TAG + "Entering GET_FOCUS_MODE_AUTO_041 to operate"); + var getfocusmodepromise = await camera0InputPromise.getFocusMode(); + console.info(TAG + "Entering GET_FOCUS_MODE_AUTO_041 SUCCESS"); + if (getfocusmodepromise == 2) { + console.info(TAG + "Current FocusMode is: " + getfocusmodepromise); + expect(true).assertTrue(); + console.info(TAG + "GET_FOCUS_MODE_AUTO_041 PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_FOCUS_MODE_AUTO_041 FAILED"); + console.info(TAG + "GET_FOCUS_MODE_AUTO_041 ends here"); + } + await sleep(1000); + done(); + }) + + + /** + * @tc.number : PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS_042 with Rotation-90 & Quality-1 + * @tc.name : Photo output capture with photosettings api + * @tc.desc : Photo output capture with photosettings api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS_042', 0, async function (done) { + if (photoOutputPromise == null || photoOutputPromise == undefined) { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS_042 photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS_042 to operate"); + const promise = photoOutputPromise.capture(photosettings2); + console.info(TAG + "Entering photoOutput capture with photosettings2 success"); + if (promise != null || promise != undefined) { + console.info(TAG + "Entering photoOutput capture with photosettings2 data is not null || undefined"); + console.info(TAG + "Entering photoOutput capture with photosettings2 PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering photoOutput capture with photosettings2 FAILED"); + console.info(TAG + "Entering photoOutput capture with photosettings2 ends here"); + } + await sleep(1000); + done(); + } + await sleep(1000); + done(); + }) + + + /** + * @tc.number : PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS_043 with Rotation-180 & Quality-2 + * @tc.name : Photo output capture with photosettings api + * @tc.desc : Photo output capture with photosettings api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS_043', 0, async function (done) { + if (photoOutputPromise == null || photoOutputPromise == undefined) { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS_043 photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS_043 to operate"); + const promise = photoOutputPromise.capture(photosettings3); + console.info(TAG + "Entering photoOutput capture with photosettings3 success"); + if (promise != null || promise != undefined) { + console.info(TAG + "Entering photoOutput capture with photosettings3 data is not null || undefined"); + console.info(TAG + "Entering photoOutput capture with photosettings3 PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering photoOutput capture with photosettings3 FAILED"); + console.info(TAG + "Entering photoOutput capture with photosettings3 ends here"); + } + await sleep(1000); + done(); + } + await sleep(1000); + done(); + }) + + + /** + * @tc.number : PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS_044 with Rotation-270 + * @tc.name : Photo output capture with photosettings api + * @tc.desc : Photo output capture with photosettings api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS_044', 0, async function (done) { + if (photoOutputPromise == null || photoOutputPromise == undefined) { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS_044 photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS_044 to operate"); + const promise = photoOutputPromise.capture(photosettings4); + console.info(TAG + "Entering photoOutput capture with photosettings4 success"); + if (promise != null || promise != undefined) { + console.info(TAG + "Entering photoOutput capture with photosettings4 data is not null || undefined"); + console.info(TAG + "Entering photoOutput capture with photosettings4 PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering photoOutput capture with photosettings4 FAILED"); + console.info(TAG + "Entering photoOutput capture with photosettings4 ends here"); + } + await sleep(1000); + done(); + } + await sleep(1000); + done(); + }) + + + //ZOOM Function + +/** + * @tc.number : GET_ZOOM_RATIO_PROMISE_TC_045 + * @tc.name : get zoom ratio camera-0 cameraId api promise api + * @tc.desc : get zoom ratio camera-0 cameraId api promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_ZOOM_RATIO_PROMISE_TC_045', 0, async function (done) { + console.info("--------------GET_ZOOM_RATIO_PROMISE_TC_045--------------"); + var getZoomRatioPromise = await camera0InputPromise.getZoomRatioRange(); + console.info(TAG + "Entering GET_ZOOM_RATIO_PROMISE_TC_045 getZoomRatioPromise: " + JSON.stringify(getZoomRatioPromise)); + if (getZoomRatioPromise != null && getZoomRatioPromise != undefined) { + console.info(TAG + "Entering GET_ZOOM_RATIO_PROMISE_TC_045 setZoomRatioPromise is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering GET_ZOOM_RATIO_PROMISE_TC_045 success: " + JSON.stringify(getZoomRatioPromise)); + console.info(TAG + "Entering GET_ZOOM_RATIO_PROMISE_TC_045 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_ZOOM_RATIO_PROMISE_TC_045 FAILED"); + } + console.info(TAG + "Entering GET_ZOOM_RATIO_PROMISE_TC_045 ends here"); + await sleep(1000); + done(); + }) + + + /** + * @tc.number : SET_GET_ZOOM_1_PROMISE_TC_046 + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_1_PROMISE_TC_046', 0, async function (done) { + var setpromise = await camera0InputPromise.setZoomRatio(1); + console.info(TAG + "setZoomRatio success: 1"); + console.info(TAG + "getZoomRatio called") + var getpromise1 = await camera0InputPromise.getZoomRatio(); + console.info(TAG + "getZoomRatio success: "+getpromise1); + if(getpromise1 !=null && getpromise1 != undefined) { + expect(getpromise1).assertEqual(1); + console.info(TAG + "SET_GET_ZOOM_1_PROMISE_TC_046 PASSED "); + } + else { + expect().assertFail(); + console.info(TAG + "SET_GET_ZOOM_1_PROMISE_TC_046 FAILED" ); + } + await sleep(1000); + done(); + }) + + + /** + * @tc.number : SET_GET_ZOOM_2_PROMISE_TC_047 + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_2_PROMISE_TC_047', 0, async function (done) { + var setpromise = await camera0InputPromise.setZoomRatio(2); + console.info(TAG + "setZoomRatio success: 2"); + console.info(TAG + "getZoomRatio called") + var getpromise2 = await camera0InputPromise.getZoomRatio(); + console.info(TAG + "getZoomRatio success: "+getpromise2); + if(getpromise2 !=null && getpromise2 != undefined) { + expect(getpromise2).assertEqual(2); + console.info(TAG + "SET_GET_ZOOM_2_PROMISE_TC_047 PASSED "); + } + else { + expect().assertFail(); + console.info(TAG + "SET_GET_ZOOM_2_PROMISE_TC_047 FAILED" ); + } + await sleep(1000); + done(); + }) + + + /** + * @tc.number : SET_GET_ZOOM_3_PROMISE_TC_048 + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_3_PROMISE_TC_048', 0, async function (done) { + var setpromise = await camera0InputPromise.setZoomRatio(3); + console.info(TAG + "setZoomRatio success: 3"); + console.info(TAG + "getZoomRatio called") + var getpromise3 = await camera0InputPromise.getZoomRatio(); + console.info(TAG + "getZoomRatio success: "+getpromise3); + if(getpromise3 !=null && getpromise3 != undefined) { + expect(getpromise3).assertEqual(3); + console.info(TAG + "SET_GET_ZOOM_3_PROMISE_TC_048 PASSED "); + } + else { + expect().assertFail(); + console.info(TAG + "SET_GET_ZOOM_3_PROMISE_TC_048 FAILED" ); + } + await sleep(1000); + done(); + }) + + + /** + * @tc.number : SET_GET_ZOOM_4_PROMISE_TC_049 + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_4_PROMISE_TC_049', 0, async function (done) { + var setpromise = await camera0InputPromise.setZoomRatio(4); + console.info(TAG + "setZoomRatio success: 4"); + console.info(TAG + "getZoomRatio called") + var getpromise4 = await camera0InputPromise.getZoomRatio(); + console.info(TAG + "getZoomRatio success: "+getpromise4); + if(getpromise4 !=null && getpromise4 != undefined) { + expect(getpromise4).assertEqual(4); + console.info(TAG + "SET_GET_ZOOM_4_PROMISE_TC_049 PASSED "); + } + else { + expect().assertFail(); + console.info(TAG + "SET_GET_ZOOM_4_PROMISE_TC_049 FAILED" ); + } + await sleep(1000); + done(); + }) + + + /** + * @tc.number : SET_GET_ZOOM_5_PROMISE_TC_050 + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_5_PROMISE_TC_050', 0, async function (done) { + var setpromise = await camera0InputPromise.setZoomRatio(5); + console.info(TAG + "setZoomRatio success: 5"); + console.info(TAG + "getZoomRatio called") + var getpromise5 = await camera0InputPromise.getZoomRatio(); + console.info(TAG + "getZoomRatio success: "+getpromise5); + if(getpromise5 !=null && getpromise5 != undefined) { + expect(getpromise5).assertEqual(5); + console.info(TAG + "SET_GET_ZOOM_5_PROMISE_TC_050 PASSED "); + } + else { + expect().assertFail(); + console.info(TAG + "SET_GET_ZOOM_5_PROMISE_TC_050 FAILED" ); + } + await sleep(1000); + done(); + }) + + + /** + * @tc.number : SET_GET_ZOOM_6_PROMISE_TC_051 + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_6_PROMISE_TC_051', 0, async function (done) { + var setpromise = await camera0InputPromise.setZoomRatio(6); + console.info(TAG + "setZoomRatio success: 6"); + console.info(TAG + "getZoomRatio called") + var getpromise6 = await camera0InputPromise.getZoomRatio(); + console.info(TAG + "getZoomRatio success: "+getpromise6); + if(getpromise6 !=null && getpromise6 != undefined) { + expect(getpromise6).assertEqual(6); + console.info(TAG + "SET_GET_ZOOM_6_PROMISE_TC_051 PASSED "); + } + else { + expect().assertFail(); + console.info(TAG + "SET_GET_ZOOM_6_PROMISE_TC_051 FAILED" ); + } + await sleep(1000); + done(); + }) + + + + /** + * @tc.number : PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS_052 + * @tc.name : Photo output capture with photosettings api + * @tc.desc : Photo output capture with photosettings api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS_052', 0, async function (done) { + if (photoOutputPromise == null || photoOutputPromise == undefined) { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS_052 photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS_052 to operate"); + const promise = photoOutputPromise.capture(photosettings1); + console.info(TAG + "Entering photoOutput capture with photosettings1 success"); + if (promise != null || promise != undefined) { + console.info(TAG + "Entering photoOutput capture with photosettings1 data is not null || undefined"); + console.info(TAG + "Entering photoOutput capture with photosettings1 PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering photoOutput capture with photosettings1 FAILED"); + } + console.info(TAG + "Entering photoOutput capture with photosettings1 ends here"); + await sleep(1000); + done(); + } + await sleep(1000); + done(); + }) + + /*CaptureSession APIs test script*/ + /** + * @tc.number : CAPTURE_SESSION_STOP_SUCCESS_PROMISE_053 + * @tc.name : capture session stop api + * @tc.desc : capture session stop api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAPTURE_SESSION_STOP_SUCCESS_PROMISE_053', 0, async function (done) { + if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { + console.info(TAG + "Entering CAPTURE_SESSION_STOP_SUCCESS_PROMISE_053 captureSession == null || undefined"); + } else { + console.info(TAG + "Entering CAPTURE_SESSION_STOP_SUCCESS_PROMISE_053 to operate"); + const promise = await CaptureSessionPromise.stop(); + console.info(TAG + "Entering CAPTURE_SESSION_STOP_SUCCESS_PROMISE_053 captureSession.stop promise: " + JSON.stringify(promise)); + if (promise != null || promise != undefined) { + expect(true).assertTrue(); + console.info(TAG + "Entering CAPTURE_SESSION_STOP_SUCCESS_PROMISE_053 captureSession.stop PASSED"); + } + console.info(TAG + "Entering CAPTURE_SESSION_STOP_SUCCESS_PROMISE_053 captureSession.stop ends here"); + await sleep(1000); + done(); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE_054 + * @tc.name : capture session release api + * @tc.desc : capture session release api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE_054', 0, async function (done) { + if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { + console.info(TAG + "Entering CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE_054 captureSession == null || undefined"); + } else { + console.info(TAG + "Entering CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE_054 to operate"); + const promise = await CaptureSessionPromise.release(); + console.info(TAG + "Entering captureSession.release promise: " + JSON.stringify(promise)); + if (promise != null || promise != undefined) { + expect(true).assertTrue(); + console.info(TAG + "Entering captureSession.release PASSED"); + } + console.info(TAG + "Entering captureSession.release ends here"); + await sleep(1000); + done(); + } + await sleep(1000); + done(); + }) + }); +} \ No newline at end of file diff --git a/multimedia/camera/camera_js_standard/src/main/ets/default/test/CameraJSUnitVideoAsync.test.ets b/multimedia/camera/camera_js_standard/src/main/ets/default/test/CameraJSUnitVideoAsync.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ce8c3f7e7270b416ae0ee775ed92506a8e12c50b --- /dev/null +++ b/multimedia/camera/camera_js_standard/src/main/ets/default/test/CameraJSUnitVideoAsync.test.ets @@ -0,0 +1,1796 @@ +/* + * 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 cameraObj from '@ohos.multimedia.camera' +import media from '@ohos.multimedia.media' +import fileio from '@ohos.fileio'; +import abilityAccessCtrl from '@ohos.abilityAccessCtrl' +import bundle from '@ohos.bundle' + +// @ts-nocheck +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; + +let TAG = 'CameraModuleTest: ' +var cameraManager +var camerasArray +var camera0Input +var previewOutput +var videoRecorder +var videoProfile = { + audioBitrate: 48000, + audioChannels: 2, + audioCodec: 'audio/mp4a-latm', + audioSampleRate: 48000, + durationTime: 1000, + fileFormat: 'mp4', + videoBitrate: 48000, + videoCodec: 'video/mp4v-es', + videoFrameWidth: 640, + videoFrameHeight: 480, + videoFrameRate: 30 +} +var videoConfig = { + audioSourceType: 1, + videoSourceType: 0, + profile: videoProfile, + url: 'file:///data/media/01.mp4', + orientationHint: 0, + location: { latitude: 30, longitude: 130 }, + maxSize: 100, + maxDuration: 500 +} +var videoId +var videoOutput +var captureSession +var surfaceId1 + +var PermissionFlag = { + PERMISSION_USER_SET: 1, + PERMISSION_USER_FIXED: 2, + PERMISSION_SYSTEM_FIXED: 3 +}; + +const RESULT_FAIL = -1 +const TIMEOUT = 1000; +const DEFAULT_PERMISSION_FALG = 0 +var permissionNameUser = "ohos.permission.CAMERA"; +var tokenID = undefined + + +export default function cameraTestCase(surfaceId: any) { + function sleep(time) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve(1) + }, time * 1000) + }).then(() => { + console.info(`sleep ${time} over...`) + }) + } + + async function getvideosurface() { + media.createVideoRecorder((err, recorder) => { + console.info(TAG + 'createVideoRecorder called') + videoRecorder = recorder + console.info(TAG + 'videoRecorder is :' + JSON.stringify(videoRecorder)) + + console.info(TAG + 'videoRecorder.prepare called.') + videoRecorder.prepare(videoConfig, (err) => { + console.info(TAG + 'videoRecorder.prepare success.') + }) + + videoRecorder.getInputSurface((err, id) => { + console.info(TAG + 'getInputSurface called') + videoId = id + console.info(TAG + 'getInputSurface surfaceId: ' + JSON.stringify(videoId)) + }) + }) + } + + + describe('VideoModeAsync', function () { + + console.log('##########start AccessTokenTests'); + beforeAll(async function (done){ + var appInfo = await bundle.getApplicationInfo('com.example.cameramoduletestetsv2',0 ,100); + tokenID = appInfo.accessTokenId; + console.info(TAG + "AccessTokenTest accessTokenId:" + appInfo.accessTokenId + ", name:"+ appInfo.name + + ", bundleName:" + appInfo.bundleName) + sleep(TIMEOUT); + console.info(TAG + "Grant permission start"); + var atManager = abilityAccessCtrl.createAtManager(); + var result = await atManager.grantUserGrantedPermission(tokenID, permissionNameUser, + PermissionFlag.PERMISSION_USER_FIXED); + console.info(TAG + "Grant permission finish, result:" + result + ", TokenID:" + tokenID); + done(); + }) + afterEach(function(){ + }) + + console.info(TAG + 'Entering it() initial point') + /** + * @tc.number : GET_CAMERA_MANAGER_TC_001 + * @tc.name : Create camera manager instance async api + * @tc.desc : Create camera manager instance async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_CAMERA_MANAGER_TC_001', 0, async function (done) { + console.info('--------------GET_CAMERA_MANAGER_TC_001--------------') + await sleep(1) + cameraObj.getCameraManager(null, (err, data) => { + if (!err) { + console.info(TAG + 'Entering GET_CAMERA_MANAGER_TC_001 success') + if (data != null || data != undefined) { + console.info(TAG + 'Entering GET_CAMERA_MANAGER_TC_001 data is not null || undefined') + cameraManager = data + expect(true).assertTrue() + console.info(TAG + 'Entering GET_CAMERA_MANAGER_TC_001 PASSED') + } + } else { + expect().assertFail() + console.info(TAG + 'Entering GET_CAMERA_MANAGER_TC_001 FAILED: ' + err.message) + } + console.info(TAG + 'Entering GET_CAMERA_MANAGER_TC_001 ends here') + done() + }) + + await sleep(1) + done() + }) + + /** + * @tc.number : GET_CAMERAS_TC_002 + * @tc.name : Create camera manager instance async api + * @tc.desc : Create camera manager instance async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_CAMERAS_TC_002', 0, async function (done) { + console.info('--------------GET_CAMERAS_TC_002--------------') + await sleep(1) + cameraManager.getCameras((err, data) => { + if (!err) { + console.info(TAG + 'Entering GET_CAMERAS_TC_002 success') + if (data != null || data != undefined) { + console.info(TAG + 'Entering GET_CAMERAS_TC_002 data is not null || undefined') + camerasArray = data + if (camerasArray != null && camerasArray.length > 0) { + for (var i = 0; i < camerasArray.length; i++) { + // Get the variables from camera object + var cameraId = camerasArray[i].cameraId + console.info(TAG + 'Entering GET_CAMERAS_TC_002 camera' + i + 'Id: ' + cameraId) + var cameraPosition = camerasArray[i].cameraPosition + console.info(TAG + 'Entering GET_CAMERAS_TC_002 camera' + i + 'Position: ' + cameraPosition) + var cameraType = camerasArray[i].cameraType + console.info(TAG + 'Entering GET_CAMERAS_TC_002 camera' + i + 'Type: ' + cameraType) + var connectionType = camerasArray[i].connectionType + console.info(TAG + 'Entering GET_CAMERAS_TC_002 connection' + i + 'Type: ' + connectionType) + } + expect(true).assertTrue() + console.info(TAG + 'Entering GET_CAMERAS_TC_002 PASSED') + } else { + expect().assertFail() + console.info(TAG + 'Entering GET_CAMERAS_TC_002 FAILED cameraArray is null || undefined') + } + } + } else { + expect().assertFail() + console.info(TAG + 'Entering GET_CAMERAS_TC_002 FAILED: ' + err.message) + } + console.info(TAG + 'Entering GET_CAMERAS_TC_002 ends here') + done() + }) + + await sleep(1) + done() + }) + + /*CAMERA-0 Scripts*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_TC_003 + * @tc.name : Create camerainput from camera-0 cameraId async api + * @tc.desc : Create camerainput from camera-0 cameraId async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_TC_003', 0, async function (done) { + console.info('--------------CAMERA-0 STARTS HERE--------------') + console.info('--------------CREATE_CAMERA_INPUT_TC_003--------------') + await sleep(1) + cameraManager.createCameraInput(camerasArray[0].cameraId, (err, data) => { + if (!err) { + if (data != null && data != undefined) { + console.info(TAG + 'Entering CREATE_CAMERA_INPUT_TC_003 data is not null || undefined') + camera0Input = data + expect(true).assertTrue() + console.info(TAG + 'Entering CREATE_CAMERA_INPUT_TC_003 PASSED with CameraID :' + camerasArray[0].cameraId) + } + } else { + expect().assertFail() + console.info(TAG + 'Entering CREATE_CAMERA_INPUT_TC_003 FAILED: ' + err.message) + } + console.info(TAG + 'Entering CREATE_CAMERA_INPUT_TC_003 ends here') + done() + }) + await sleep(1) + done() + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POSITION_TYPE_TC_004 + * @tc.name : Create camerainput from camera-0 cameraposition & cameratype async api + * @tc.desc : Create camerainput from camera-0 cameraposition & cameratype async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POSITION_TYPE_TC_004', 0, async function (done) { + console.info('--------------CREATE_CAMERA_INPUT_POSITION_TYPE_TC_004--------------') + await sleep(1) + cameraManager.createCameraInput(camerasArray[0].cameraPosition, camerasArray[0].cameraType, (err, data) => { + if (!err || err.message != 'Failed to get arguments!') { + console.info(TAG + 'Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_004 success') + if (data != null || data != undefined) { + console.info(TAG + 'Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_004 data is not null || undefined') + expect(true).assertTrue() + console.info(TAG + 'Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_004 PASSED') + } else { + console.info(TAG + 'Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_004 FAILED: ' + err.message) + expect().assertFail() + } + } else { + console.info(TAG + 'Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_004 FAILED: ' + err.message) + expect().assertFail() + } + console.info(TAG + 'Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_004 ends here') + done() + }) + await sleep(1) + done() + }) + + /** + * @tc.number : CREATE_PREVIEW_OUTPUT_TC_005 + * @tc.name : Create previewoutput async api + * @tc.desc : Create previewoutput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_PREVIEW_OUTPUT_TC_005', 0, async function (done) { + console.info(TAG + 'Entering CREATE_PREVIEW_OUTPUT_TC_005 to operate') + await sleep(1) + cameraObj.createPreviewOutput(surfaceId, (err, data) => { + if (!err) { + console.info(TAG + 'Entering CREATE_PREVIEW_OUTPUT_TC_005 success') + if (data != null || data != undefined) { + console.info(TAG + 'Entering CREATE_PREVIEW_OUTPUT_TC_005 data is not null || undefined') + previewOutput = data + expect(true).assertTrue() + console.info(TAG + 'Entering CREATE_PREVIEW_OUTPUT_TC_005 PASSED') + } + } else { + console.info(TAG + 'Entering CREATE_PREVIEW_OUTPUT_TC_005 FAILED: ' + err.message) + } + console.info(TAG + 'Entering CREATE_PREVIEW_OUTPUT_TC_005 ends here') + done() + }) + + await sleep(1) + done() + }) + + /** + * @tc.number : CREATE_VIDEO_OUTPUT_TC_006 + * @tc.name : Create videooutput async api + * @tc.desc : Create videooutput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_VIDEO_OUTPUT_TC_006', 0, async function (done) { + console.info(TAG + 'Entering CREATE_VIDEO_OUTPUT_TC_006 to operate') + await getvideosurface() + await sleep(1) + cameraObj.createVideoOutput(videoId, (err, data) => { + console.info(TAG + 'Entering CREATE_VIDEO_OUTPUT_TC_006 success') + if (data != null || data != undefined) { + console.info(TAG + 'Entering CREATE_VIDEO_OUTPUT_TC_006 data is not null || undefined') + videoOutput = data + expect(true).assertTrue() + console.info(TAG + 'Entering CREATE_VIDEO_OUTPUT_TC_006 PASSED') + } else { + expect().assertFail() + console.info(TAG + 'Entering CREATE_VIDEO_OUTPUT_TC_006 FAILED: ' + err.message) + } + console.info(TAG + 'Entering CREATE_VIDEO_OUTPUT_TC_006 ends here') + done() + }) + + await sleep(1) + done() + }) + + /** + * @tc.number : CREATE_CAPTURE_SESSION_TC_007 + * @tc.name : Create capturesession async api + * @tc.desc : Create capturesession async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAPTURE_SESSION_TC_007', 0, async function (done) { + console.info(TAG + 'Entering CREATE_CAPTURE_SESSION_TC_007 to operate') + await sleep(1) + cameraObj.createCaptureSession(null, (err, data) => { + if (!err) { + console.info(TAG + 'Entering CREATE_CAPTURE_SESSION_TC_007 success') + if (data != null || data != undefined) { + console.info(TAG + 'Entering CREATE_CAPTURE_SESSION_TC_007 data is not null || undefined') + captureSession = data + expect(true).assertTrue() + console.info(TAG + 'Entering CREATE_CAPTURE_SESSION_TC_007 PASSED') + } + } else { + console.info(TAG + 'Entering CREATE_CAPTURE_SESSION_TC_007 FAILED: ' + err.message) + } + console.info(TAG + 'Entering CREATE_CAPTURE_SESSION_TC_007 ends here') + done() + }) + + await sleep(1) + done() + }) + + /** + * @tc.number : BEGIN_CONFIG_TC_008 + * @tc.name : Create capturesession async api + * @tc.desc : Create capturesession async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('BEGIN_CONFIG_TC_008', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + 'Entering BEGIN_CONFIG_TC_008 captureSession == null || undefined') + } else { + console.info(TAG + 'Entering BEGIN_CONFIG_TC_008 to operate') + await sleep(1) + captureSession.beginConfig((err, data) => { + if (!err) { + console.info(TAG + 'Entering BEGIN_CONFIG_TC_008 success') + if (data != null || data != undefined) { + console.info(TAG + 'Entering BEGIN_CONFIG_TC_008 data is not null || undefined') + expect(true).assertTrue() + console.info(TAG + 'Entering BEGIN_CONFIG_TC_008 PASSED') + } + } else { + console.info(TAG + 'Entering BEGIN_CONFIG_TC_008 FAILED: ' + err.message) + } + console.info(TAG + 'Entering BEGIN_CONFIG_TC_008 ends here') + done() + }) + + await sleep(1) + done() + } + }) + + /** + * @tc.number : ADD_INPUT_TC_009 + * @tc.name : AddInput async api + * @tc.desc : AddInput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ADD_INPUT_TC_009', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + 'Entering ADD_INPUT_TC_009 captureSession == null || undefined') + } else { + console.info(TAG + 'Entering ADD_INPUT_TC_009 to operate') + await sleep(1) + captureSession.addInput(camera0Input, (err, data) => { + if (!err) { + console.info(TAG + 'Entering ADD_INPUT_TC_009 success') + if (data != null || data != undefined) { + console.info(TAG + 'Entering ADD_INPUT_TC_009 data is not null || undefined') + expect(true).assertTrue() + console.info(TAG + 'Entering ADD_INPUT_TC_009 PASSED') + } + } else { + console.info(TAG + 'Entering ADD_INPUT_TC_009 FAILED: ' + err.message) + } + console.info(TAG + 'Entering ADD_INPUT_TC_009 ends here') + done() + }) + + await sleep(1) + done() + } + }) + + /** + * @tc.number : ADD_OUTPUT_PREVIEW_TC_010 + * @tc.name : AddOutput preview async api + * @tc.desc : AddOutput preview async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ADD_OUTPUT_PREVIEW_TC_010', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW_TC_010 captureSession == null || undefined') + } else { + console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW_TC_010 to operate') + await sleep(1) + captureSession.addOutput(previewOutput, (err, data) => { + if (!err) { + console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW_TC_010 success') + if (data != null || data != undefined) { + console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW_TC_010 data is not null || undefined') + expect(true).assertTrue() + console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW_TC_010 PASSED') + } + } else { + console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW_TC_010 FAILED: ' + err.message) + } + console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW_TC_010 ends here') + done() + }) + + await sleep(1) + done() + } + }) + + /** + * @tc.number : ADD_OUTPUT_VIDEO_TC_011 + * @tc.name : AddOutput video async api + * @tc.desc : AddOutput video async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ADD_OUTPUT_VIDEO_TC_011', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + 'Entering ADD_OUTPUT_VIDEO_TC_011 captureSession == null || undefined') + } else { + console.info(TAG + 'Entering ADD_OUTPUT_VIDEO_TC_011 to operate') + await sleep(1) + captureSession.addOutput(videoOutput, (err, data) => { + if (!err) { + console.info(TAG + 'Entering ADD_OUTPUT_VIDEO_TC_011 success') + if (data != null || data != undefined) { + console.info(TAG + 'Entering ADD_OUTPUT_VIDEO_TC_011 data is not null || undefined') + expect(true).assertTrue() + console.info(TAG + 'Entering ADD_OUTPUT_VIDEO_TC_011 PASSED') + } + } else { + console.info(TAG + 'Entering ADD_OUTPUT_VIDEO_TC_011 FAILED: ' + err.message) + } + console.info(TAG + 'Entering ADD_OUTPUT_VIDEO_TC_011 ends here') + done() + }) + + await sleep(1) + done() + } + }) + + /** + * @tc.number : COMMIT_CONFIG_TC_012 + * @tc.name : CommitConfig async api + * @tc.desc : CommitConfig async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('COMMIT_CONFIG_TC_012', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + 'Entering COMMIT_CONFIG_TC_012 captureSession == null || undefined') + } else { + console.info(TAG + 'Entering COMMIT_CONFIG_TC_012 to operate') + await sleep(1) + captureSession.commitConfig((err, data) => { + if (!err) { + console.info(TAG + 'Entering COMMIT_CONFIG_TC_012 success') + if (data != null || data != undefined) { + console.info(TAG + 'Entering COMMIT_CONFIG_TC_012 data is not null || undefined') + expect(true).assertTrue() + console.info(TAG + 'Entering COMMIT_CONFIG_TC_012 PASSED') + } + } else { + console.info(TAG + 'Entering COMMIT_CONFIG_TC_012 FAILED: ' + err.message) + } + console.info(TAG + 'Entering COMMIT_CONFIG_TC_012 ends here') + done() + }) + + await sleep(1) + done() + } + }) + + //callback API + + /** + * @tc.number : CAP_SES_CALLBACK_ON_ERROR_013 + * @tc.name : CaptureSession callback on error api + * @tc.desc : CaptureSession callback on error api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAP_SES_CALLBACK_ON_ERROR_013', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + "Entering CAP_SES_CALLBACK_ON_ERROR_013 captureSession == null || undefined"); + } else { + console.info(TAG + "Entering CAP_SES_CALLBACK_ON_ERROR_013 to operate"); + captureSession.on("error", async (err, data) => { + if (!err) { + console.info(TAG + " captureSession errorcallback is success"); + if (data != null || data != undefined) { + console.info(TAG + "Error in CaptureSessioncallback with ErrorCode: " + data.code); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_014 + * @tc.name : Preview output callback on frame start api + * @tc.desc : Preview output callback on frame start api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_014', 0, async function (done) { + if (previewOutput == null || previewOutput == undefined) { + console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_014 previewOutput == null || undefined"); + } else { + console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_014 to operate"); + previewOutput.on("frameStart", async (err, data) => { + if (!err) { + console.info(TAG + "PreviewStart frameStart Callback is success"); + if (data != null || data != undefined) { + expect(true).assertTrue(); + } + } else { + expect().assertFail() + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_015 + * @tc.name : Preview capture callback on frame end api + * @tc.desc : Preview capture callback on frame end api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_015', 0, async function (done) { + if (previewOutput == null || previewOutput == undefined) { + console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_015 previewOutput == null || undefined"); + } else { + console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_015 to operate"); + previewOutput.on("frameEnd", async (err, data) => { + if (!err) { + console.info(TAG + "PreviewStop frameEnd Callback is success"); + if (data != null || data != undefined) { + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : PREVIEW_OUTPUT_CALLBACK_ON_ERROR_016 + * @tc.name : Preview output callback on error api + * @tc.desc : Preview output callback on error api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PREVIEW_OUTPUT_CALLBACK_ON_ERROR_016', 0, async function (done) { + if (previewOutput == null || previewOutput == undefined) { + console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_ERROR_016 previewOutput == null || undefined"); + } else { + console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_ERROR_016 to operate"); + previewOutput.on("error", async (err, data) => { + if (!err) { + console.info(TAG + "PreviewOutputError callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "Error during PreviewOutput with ErrorCode: " + data.code); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : VIDEO_OUTPUT_CALLBACK_ON_FRAME_START_TC_017 + * @tc.name : VideoOutput callback onframestart async api + * @tc.desc : VideoOutput callback onframestart async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('VIDEO_OUTPUT_CALLBACK_ON_FRAME_START_TC_017', 0, async function (done) { + if (videoOutput == null || videoOutput == undefined) { + console.info(TAG + "Entering VIDEO_OUTPUT_CALLBACK_ON_FRAME_START_TC_017 videoOutput == null || undefined"); + } else { + console.info(TAG + "Entering VIDEO_OUTPUT_CALLBACK_ON_FRAME_START_TC_017 to operate"); + videoOutput.on("frameStart", async (err, data) => { + if (!err) { + console.info(TAG + "Video frameStart Callback is success"); + if (data != null || data != undefined) { + expect(true).assertTrue(); + } + } else { + expect().assertFail() + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : VIDEO_OUTPUT_CALLBACK_ON_FRAME_END_TC_018 + * @tc.name : VideoOutput callback onframeend async api + * @tc.desc : VideoOutput callback onframeend async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('VIDEO_OUTPUT_CALLBACK_ON_FRAME_END_TC_018', 0, async function (done) { + if (videoOutput == null || videoOutput == undefined) { + console.info(TAG + 'Entering VIDEO_OUTPUT_CALLBACK_ON_FRAME_END_TC_018 videoOutput == null || undefined') + } else { + console.info(TAG + 'Entering VIDEO_OUTPUT_CALLBACK_ON_FRAME_END_TC_018 to operate') + await sleep(1) + videoOutput.on('frameEnd', async (err, data) => { + if (!err) { + console.info(TAG + 'Video frameEnd callback is success') + if (data != null || data != undefined) { + expect(true).assertTrue() + } + } else { + expect().assertFail() + } + await sleep(1); + done(); + }) + + await sleep(1); + done(); + } + }) + + /** + * @tc.number : VIDEO_OUTPUT_CALLBACK_ON_ERROR_TC_019 + * @tc.name : VideoOutput callback onerror async api + * @tc.desc : VideoOutput callback onerror async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('VIDEO_OUTPUT_CALLBACK_ON_ERROR_TC_019', 0, async function (done) { + if (videoOutput == null || videoOutput == undefined) { + console.info(TAG + 'Entering VIDEO_OUTPUT_CALLBACK_ON_ERROR_TC_019 videoOutput == null || undefined') + } else { + console.info(TAG + 'Entering VIDEO_OUTPUT_CALLBACK_ON_ERROR_TC_019 to operate') + await sleep(1) + videoOutput.on('error', async (err, data) => { + if (!err) { + console.info(TAG + 'VideoOutput Errorcallback is success') + if (data != null || data != undefined) { + console.info(TAG + "Error during videoOutput with ErrorCode: " + data.code); + expect(true).assertTrue() + } + } else { + expect().assertFail() + } + await sleep(1) + done() + }) + + await sleep(1) + done(); + } + }) + + /** + * @tc.number : CAPTURE_SESSION_START_TC_020 + * @tc.name : CaptureSession start async api + * @tc.desc : CaptureSession start async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAPTURE_SESSION_START_TC_020', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + 'Entering CAPTURE_SESSION_START_TC_020 captureSession == null || undefined') + } else { + console.info(TAG + 'Entering CAPTURE_SESSION_START_TC_020 to operate') + await sleep(1) + captureSession.start((err, data) => { + if (!err) { + console.info(TAG + 'Entering CAPTURE_SESSION_START_TC_020 success') + if (data != null || data != undefined) { + console.info(TAG + 'Entering CAPTURE_SESSION_START_TC_020 data is not null || undefined') + expect(true).assertTrue() + console.info(TAG + 'Entering CAPTURE_SESSION_START_TC_020 PASSED') + } + } else { + console.info(TAG + 'Entering CAPTURE_SESSION_START_TC_020 FAILED: ' + err.message) + } + console.info(TAG + 'Entering CAPTURE_SESSION_START_TC_020 ends here') + done() + }) + + await sleep(1) + done() + } + }) + + //FLASH Function API scripts + /** + * @tc.number : HAS_FLASH_TC_021 + * @tc.name : check if has flash-camera0Input api + * @tc.desc : check if has flash-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('HAS_FLASH_TC_021', 0, async function (done) { + console.info("--------------HAS_FLASH_TC_021--------------"); + console.info(TAG + 'hasFlash called.') + camera0Input.hasFlash(async (err, data) => { + if (!err) { + console.info(TAG + "Entering HAS_FLASH success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering HAS_FLASH data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering HAS_FLASH PASSED with HAS_FLASH is: " +data); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering HAS_FLASH FAILED" + err.message); + } + console.info(TAG + "Entering HAS_FLASH_TC_021 ends here"); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : IS_FLASH_MODE_OPEN_SUPPORTED_022 + * @tc.name : check if flash mode open is supported-camera0Input api + * @tc.desc : check if flash mode open is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FLASH_MODE_OPEN_SUPPORTED_022', 0, async function (done) { + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED_022 to operate"); + camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_OPEN, async (err, data) => { + if (!err) { + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED_022 SUCCESS "); + if (data != null || data != undefined) { + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED data is not null || undefined"); + console.info(TAG + "FLASH_MODE_OPEN supported is: " +data); + expect(true).assertTrue(); + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED PASSED"); + } + } else { + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED FAILED" + err.message); + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED ends here"); + } + await sleep(1); + done(); + }) + + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FLASH_MODE_OPEN_023 + * @tc.name : set flash mode open camera0 api + * @tc.desc : set flash mode open camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FLASH_MODE_OPEN_023', 0, async function (done) { + console.info(TAG + "Entering SET_FLASH_MODE_OPEN_023 to operate"); + camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_OPEN, async (err, data) => { + if (!err) { + console.info(TAG + "Entering SET_FLASH_MODE_OPEN_023 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_OPEN); + if (data != null || data != undefined) { + console.info(TAG + "Entering SET_FLASH_MODE_OPEN_023 PASSED") + expect(true).assertTrue() + } + } else { + expect().assertFail(); + console.info(TAG + "Entering SET_FLASH_MODE_OPEN_023 FAILED" + err.message); + console.info(TAG + "Entering SET_FLASH_MODE_OPEN_023 ends here"); + } + await sleep(1); + done(); + }) + + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_FLASH_MODE_OPEN_024 + * @tc.name : get flash mode open camera0 api + * @tc.desc : get flash mode open camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + + it('GET_FLASH_MODE_OPEN_024', 0, async function (done) { + console.info(TAG + "Entering GET_FLASH_MODE_OPEN_024 to operate"); + camera0Input.getFlashMode(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_FLASH_MODE_OPEN success"); + if (data == 1) { + console.info(TAG + "GET_FLASH_MODE_OPEN data is not null || undefined: "); + console.info(TAG + "Current FlashMode is: " +data); + expect(true).assertTrue(); + console.info(TAG + "GET_FLASH_MODE_OPEN_024 PASSED"); + + } + } + else { + expect().assertFail(); + console.info(TAG + "GET_FLASH_MODE_OPEN_024 FAILED" + err.message); + console.info(TAG + "GET_FLASH_MODE_OPEN_024 ends here"); + } + await sleep(1); + done(); + + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_025 + * @tc.name : check if flash mode always open is supported-camera0Input api + * @tc.desc : check if flash mode always open is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_025', 0, async function (done) { + console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_025 to operate"); + camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN, async (err, data) => { + if (!err) { + console.info(TAG + "Entering FLASH_MODE_ALWAYS_OPEN SUCCESS "); + if (data != null || data != undefined) { + console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "FLASH_MODE_ALWAYS_OPEN supported is: " +data); + console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_025 PASSED"); + } + } else { + console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_025 FAILED" + err.message); + console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_025 ends here"); + } + await sleep(1); + done(); + }) + + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FLASH_MODE_ALWAYS_OPEN_026 + * @tc.name : set flash mode always open camera0 api + * @tc.desc : set flash mode always open camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FLASH_MODE_ALWAYS_OPEN_026', 0, async function (done) { + console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN_026 to operate"); + camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN, async (err, data) => { + if (!err) { + console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); + if (data != null || data != undefined) { + console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN_026 PASSED") + expect(true).assertTrue() + } + } else { + expect().assertFail(); + console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN_026 FAILED" + err.message); + console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN_026 ends here"); + } + await sleep(1); + done(); + }) + + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_FLASH_MODE_ALWAYS_OPEN_027 + * @tc.name : get flash mode always open camera0 api + * @tc.desc : get flash mode always open camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + + it('GET_FLASH_MODE_ALWAYS_OPEN_027', 0, async function (done) { + console.info(TAG + "Entering GET_FLASH_MODE_ALWAYS_OPEN_027 to operate"); + camera0Input.getFlashMode(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_FLASH_MODE_ALWAYS_OPEN success"); + if (data == 3) { + console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN data is not null || undefined: "); + expect(true).assertTrue(); + console.info(TAG + "Current FlashMode is: " +data); + console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN_027 PASSED"); + } + } + else { + expect().assertFail(); + console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN_027 FAILED" + err.message); + console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN_027 ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : IS_FLASH_MODE_CLOSE_SUPPORTED_028 + * @tc.name : check if flash mode close is supported-camera0Input api + * @tc.desc : check if flash mode close is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FLASH_MODE_CLOSE_SUPPORTED_028', 0, async function (done) { + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED_028 to operate"); + camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_CLOSE, async (err, data) => { + if (!err) { + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED_028 SUCCESS "); + if (data != null || data != undefined) { + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "FLASH_MODE_CLOSE supported is: " +data); + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED PASSED"); + } + } else { + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED FAILED" + err.message); + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED ends here"); + } + await sleep(1); + done(); + }) + + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FLASH_MODE_CLOSE_029 + * @tc.name : set flash mode close camera0 api + * @tc.desc : set flash mode close camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FLASH_MODE_CLOSE_029', 0, async function (done) { + console.info(TAG + "Entering SET_FLASH_MODE_CLOSE_029 to operate"); + camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_CLOSE, async (err, data) => { + if (!err) { + console.info(TAG + "Entering SET_FLASH_MODE_CLOSE_029 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_CLOSE); + if (data != null || data != undefined) { + console.info(TAG + "Entering SET_FLASH_MODE_CLOSE_029 PASSED") + expect(true).assertTrue() + } + } else { + expect().assertFail(); + console.info(TAG + "Entering SET_FLASH_MODE_CLOSE_029 FAILED" + err.message); + console.info(TAG + "Entering SET_FLASH_MODE_CLOSE_029 ends here"); + } + await sleep(1); + done(); + }) + + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_FLASH_MODE_CLOSE_030 + * @tc.name : get flash mode close camera0 api + * @tc.desc : get flash mode close camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + + it('GET_FLASH_MODE_CLOSE_030', 0, async function (done) { + console.info(TAG + "Entering GET_FLASH_MODE_CLOSE_030 to operate"); + camera0Input.getFlashMode(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_FLASH_MODE_CLOSE_030 success"); + if (data == 0) { + console.info(TAG + "GET_FLASH_MODE_CLOSE data is not null || undefined: "); + console.info(TAG + "Current FlashMode is: " +data); + expect(true).assertTrue(); + console.info(TAG + "GET_FLASH_MODE_CLOSE_030 PASSED"); + } + } + else { + expect().assertFail(); + console.info(TAG + "GET_FLASH_MODE_CLOSE_030 FAILED" + err.message); + console.info(TAG + "GET_FLASH_MODE_CLOSE_030 ends here"); + } + await sleep(1) + done(); + + }) + await sleep(1) + done() + }) + + // FOCUS API's + + /** + * @tc.number : IS_FOCUS_MODE_MANUAL_SUPPORTED_031 + * @tc.name : check if focus mode manual is supported-camera0Input api + * @tc.desc : check if focus mode manual is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FOCUS_MODE_MANUAL_SUPPORTED_031', 0, async function (done) { + console.info(TAG + "Entering IS_FOCUS_MODE_MANUAL_SUPPORTED_031 to operate"); + camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_MANUAL, async (err, data) => { + if (!err) { + console.info(TAG + "Entering IS_FOCUS_MODE_MANUAL_SUPPORTED_031 SUCCESS " ); + if (data != null || data != undefined) { + console.info(TAG + "Entering IS_FOCUS_MODE_MANUAL_SUPPORTED_031 data is not null || undefined"); + console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " +data ); + expect(true).assertTrue(); + console.info(TAG + "Entering IS_FOCUS_MODE_MANUAL_SUPPORTED_031 PASSED: "); + } + } else { + console.info(TAG + "IS_FOCUS_MODE_MANUAL_SUPPORTED_031 FAILED" + err.message); + expect().assertFail(); + console.info(TAG + "IS_FOCUS_MODE_MANUAL_SUPPORTED_031 ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FOCUS_MODE_MANUAL_032 + * @tc.name : set focus mode manual camera0 api + * @tc.desc : set focus mode manual camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + + it('SET_FOCUS_MODE_MANUAL_032', 0, async function (done) { + console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL_032 to operate"); + camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_MANUAL, async (err, data) => { + if (!err) { + console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL_032 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); + if (data != null || data != undefined) { + console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL_032 PASSED") + expect(true).assertTrue() + } + } else { + expect().assertFail(); + console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL_032 FAILED" + err.message); + console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL_032 ends here"); + } + await sleep(1); + done(); + }) + + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_FOCUS_MODE_MANUAL_033 + * @tc.name : get focus mode manual camera0 api + * @tc.desc : get focus mode manual camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + + it('GET_FOCUS_MODE_MANUAL_033', 0, async function (done) { + console.info(TAG + "Entering GET_FOCUS_MODE_MANUAL_033 to operate"); + camera0Input.getFocusMode(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_FOCUS_MODE_MANUAL_033 SUCCESS"); + if (data == 0) { + console.info(TAG + "GET_FOCUS_MODE_MANUAL data is not null || undefined: "); + console.info(TAG + "Current FocusMode is: " +data); + expect(true).assertTrue(); + console.info(TAG + "GET_FOCUS_MODE_MANUAL_033 PASSED"); + } + } + else { + expect().assertFail(); + console.info(TAG + "GET_FOCUS_MODE_MANUAL_033 FAILED" + err.message); + console.info(TAG + "GET_FOCUS_MODE_MANUAL_033 ends here"); + } + await sleep(1); + done(); + + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_034 + * @tc.name : check if focus mode continuous is supported-camera0Input api + * @tc.desc : check if focus mode continuous is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_034', 0, async function (done) { + console.info(TAG + "Entering IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_034 to operate"); + camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO, async (err, data) => { + if (!err) { + console.info(TAG + "Entering IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_034 SUCCESS " ); + if (data != null || data != undefined) { + console.info(TAG + "Entering IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_034 data is not null || undefined"); + console.info(TAG + "FOCUS_MODE_CONTINOUS_SUPPORTED is: " +data ); + expect(true).assertTrue(); + console.info(TAG + "Entering IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_034 PASSED: "); + } + } else { + console.info(TAG + "IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_034 FAILED" + err.message); + expect().assertFail(); + console.info(TAG + "IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_034 ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FOCUS_MODE_CONTINUOUS_035 + * @tc.name : set focus mode continuous camera0 api + * @tc.desc : set focus mode continuous camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FOCUS_MODE_CONTINUOUS_035', 0, async function (done) { + console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS_035 to operate"); + camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO, async (err, data) => { + if (!err) { + console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS_035 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); + if (data != null || data != undefined) { + expect(true).assertTrue() + console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS_035 PASSED") + } + } else { + expect().assertFail(); + console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS_035 FAILED" + err.message); + console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS_035 ends here"); + } + await sleep(1); + done(); + }) + + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_FOCUS_MODE_CONTINUOUS_036 + * @tc.name : get focus mode continuous camera0 api + * @tc.desc : get focus mode continuous camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + + it('GET_FOCUS_MODE_CONTINUOUS_036', 0, async function (done) { + console.info(TAG + "Entering GET_FOCUS_MODE_CONTINUOUS_036 to operate"); + camera0Input.getFocusMode(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_FOCUS_MODE_CONTINUOUS_036 SUCCESS"); + if (data == 1) { + console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS data is not null || undefined: "); + console.info(TAG + "Current FocusMode is: " +data); + expect(true).assertTrue(); + console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS_036 PASSED"); + + } + } + else { + expect().assertFail(); + console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS_036 FAILED" + err.message); + console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS_036 ends here"); + } + await sleep(1); + done(); + + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : IS_FOCUS_MODE_AUTO_SUPPORTED_037 + * @tc.name : check if focus mode auto is supported-camera0Input api + * @tc.desc : check if focus mode auto is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FOCUS_MODE_AUTO_SUPPORTED_037', 0, async function (done) { + console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED_037 to operate"); + camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO, async (err, data) => { + if (!err) { + console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED_037 SUCCESS " ); + if (data != null || data != undefined) { + console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED_037 data is not null || undefined"); + console.info(TAG + "FOCUS_MODE_AUTO_SUPPORTED is: " + data ); + expect(true).assertTrue(); + console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED_037 PASSED: "); + } + } else { + console.info(TAG + "IS_FOCUS_MODE_AUTO_SUPPORTED_037 FAILED" + err.message); + expect().assertFail(); + console.info(TAG + "IS_FOCUS_MODE_AUTO_SUPPORTED_037 ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FOCUS_MODE_AUTO_039 + * @tc.name : set focus mode auto camera0 api + * @tc.desc : set focus mode auto camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + + it('SET_FOCUS_MODE_AUTO_039', 0, async function (done) { + console.info(TAG + "Entering SET_FOCUS_MODE_AUTO_039 to operate"); + camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO, async (err, data) => { + if (!err) { + console.info(TAG + "Entering SET_FOCUS_MODE_AUTO_039 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_AUTO); + if (data != null || data != undefined) { + expect(true).assertTrue() + console.info(TAG + "Entering SET_FOCUS_MODE_AUTO_039 PASSED") + } + } else { + expect().assertFail(); + console.info(TAG + "Entering SET_FOCUS_MODE_AUTO_039 FAILED" + err.message); + console.info(TAG + "Entering SET_FOCUS_MODE_AUTO_039 ends here"); + } + await sleep(1); + done(); + }) + + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_FOCUS_MODE_AUTO_040 + * @tc.name : get focus mode auto camera0 api + * @tc.desc : get focus mode auto camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FOCUS_MODE_AUTO_040', 0, async function (done) { + console.info(TAG + "Entering GET_FOCUS_MODE_AUTO_040 to operate"); + camera0Input.getFocusMode(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_FOCUS_MODE_AUTO_040 SUCCESS"); + if (data == 2) { + console.info(TAG + "GET_FOCUS_MODE_AUTO data is not null || undefined: "); + console.info(TAG + "Current FocusMode is: " +data); + expect(true).assertTrue(); + console.info(TAG + "GET_FOCUS_MODE_AUTO_040 PASSED"); + + } + } + else { + expect().assertFail(); + console.info(TAG + "GET_FOCUS_MODE_AUTO_040 FAILED" + err.message); + console.info(TAG + "GET_FOCUS_MODE_AUTO_040 ends here"); + } + await sleep(1); + done(); + + }) + await sleep(1); + done(); + }) + + + + + //ZOOM Function + + /** + * @tc.number : GET_ZOOM_RATIO_TC_041 + * @tc.name : get zoom ratio camera-0 cameraId api + * @tc.desc : get zoom ratio camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_ZOOM_RATIO_TC_041', 0, async function (done) { + console.info("--------------GET_ZOOM_RATIO_TC_041--------------"); + camera0Input.getZoomRatioRange(async (err,data) => { + if (!err) { + if (data != null && data != undefined) { + console.info(TAG + "Entering GET_ZOOM_RATIO_TC_041 data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering GET_ZOOM_RATIO_TC_041 Success: " + data ); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_ZOOM_RATIO_TC_041 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_ZOOM_RATIO_TC_041 ends here"); + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + + /** + * @tc.number : SET_GET_ZOOM_1_ASYNC_TC_042 + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_1_ASYNC_TC_042', 0, async function (done) { + camera0Input.setZoomRatio(1, (err,data)=>{ + if(!err){ + console.info(TAG + "setZoomRatio success: 1"); + console.info(TAG + "getZoomRatio called") + camera0Input.getZoomRatio((err,data1) => { + if(!err){ + console.info(TAG + "getZoomRatio success : "+data1); + expect(data1).assertEqual(1); + console.info(TAG + "SET_GET_ZOOM_1_ASYNC_TC_042 PASSED "); + } + else { + expect().assertFail(); + console.info(TAG + "SET_GET_ZOOM_1_ASYNC_TC_042 FAILED" + err.message); + } + }) + } + }) + await sleep(1); + done(); + }) + + + /** + * @tc.number : SET_GET_ZOOM_2_ASYNC_TC_043 + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_2_ASYNC_TC_043', 0, async function (done) { + camera0Input.setZoomRatio(2, (err,data)=>{ + if(!err){ + console.info(TAG + "setZoomRatio success: 2"); + console.info(TAG + "getZoomRatio called") + camera0Input.getZoomRatio((err,data1) => { + if(!err){ + console.info(TAG + "getZoomRatio success : "+data1); + expect(data1).assertEqual(2); + console.info(TAG + "SET_GET_ZOOM_2_ASYNC_TC_043 PASSED "); + } + else { + expect().assertFail(); + console.info(TAG + "SET_GET_ZOOM_2_ASYNC_TC_043 FAILED" + err.message); + } + }) + } + }) + await sleep(1); + done(); + }) + + + + /** + * @tc.number : SET_GET_ZOOM_3_ASYNC_TC_044 + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_3_ASYNC_TC_044', 0, async function (done) { + camera0Input.setZoomRatio(3, (err,data)=>{ + if(!err){ + console.info(TAG + "setZoomRatio success: 3"); + console.info(TAG + "getZoomRatio called") + camera0Input.getZoomRatio((err,data1) => { + if(!err){ + console.info(TAG + "getZoomRatio success : "+data1); + expect(data1).assertEqual(3); + console.info(TAG + "SET_GET_ZOOM_3_ASYNC_TC_044 PASSED "); + } + else { + expect().assertFail(); + console.info(TAG + "SET_GET_ZOOM_3_ASYNC_TC_044 FAILED" + err.message); + } + }) + } + }) + await sleep(1); + done(); + }) + + + /** + * @tc.number : SET_GET_ZOOM_4_ASYNC_TC_045 + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_4_ASYNC_TC_045', 0, async function (done) { + camera0Input.setZoomRatio(4, (err,data)=>{ + if(!err){ + console.info(TAG + "setZoomRatio success: 4"); + console.info(TAG + "getZoomRatio called") + camera0Input.getZoomRatio((err,data1) => { + if(!err){ + console.info(TAG + "getZoomRatio success : "+data1); + expect(data1).assertEqual(4); + console.info(TAG + "SET_GET_ZOOM_4_ASYNC_TC_045 PASSED "); + } + else { + expect().assertFail(); + console.info(TAG + "SET_GET_ZOOM_4_ASYNC_TC_045 FAILED" + err.message); + } + }) + } + }) + await sleep(1); + done(); + }) + + + /** + * @tc.number : SET_GET_ZOOM_5_ASYNC_TC_046 + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_5_ASYNC_TC_046', 0, async function (done) { + camera0Input.setZoomRatio(5, (err,data)=>{ + if(!err){ + console.info(TAG + "setZoomRatio success: 5"); + console.info(TAG + "getZoomRatio called") + camera0Input.getZoomRatio((err,data1) => { + if(!err){ + console.info(TAG + "getZoomRatio success : "+data1); + expect(data1).assertEqual(5); + console.info(TAG + "SET_GET_ZOOM_5_ASYNC_TC_046 PASSED "); + } + else { + expect().assertFail(); + console.info(TAG + "SET_GET_ZOOM_5_ASYNC_TC_046 FAILED" + err.message); + } + }) + } + }) + await sleep(1); + done(); + }) + + + + /** + * @tc.number : SET_GET_ZOOM_6_ASYNC_TC_047 + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_6_ASYNC_TC_047', 0, async function (done) { + camera0Input.setZoomRatio(6, (err,data)=>{ + if(!err){ + console.info(TAG + "setZoomRatio success: 6"); + console.info(TAG + "getZoomRatio called") + camera0Input.getZoomRatio((err,data1) => { + if(!err){ + console.info(TAG + "getZoomRatio success : "+data1); + expect(data1).assertEqual(6); + console.info(TAG + "SET_GET_ZOOM_6_ASYNC_TC_047 PASSED "); + } + else { + expect().assertFail(); + console.info(TAG + "SET_GET_ZOOM_6_ASYNC_TC_047 FAILED" + err.message); + } + }) + } + }) + await sleep(1); + done(); + }) + + + /** + * @tc.number : VIDEO_OUTPUT_START_TC_048 + * @tc.name : VideoOutput start async api + * @tc.desc : VideoOutput start async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('VIDEO_OUTPUT_START_TC_048', 0, async function (done) { + if (videoOutput == null || videoOutput == undefined) { + console.info(TAG + 'Entering VIDEO_OUTPUT_START_TC_048 videoOutput == null || undefined') + } else { + console.info(TAG + 'Entering VIDEO_OUTPUT_START_TC_048 to operate') + await sleep(1) + videoOutput.start(async (err, data) => { + console.info(TAG + 'Entering VIDEO_OUTPUT_START_TC_048 success: '+JSON.stringify(data)) + if (data == undefined) { + expect(true).assertTrue(); + } else { + expect().assertFail() + } + }) + + await sleep(1) + done() + } + await sleep(1) + done() + }) + + /** + * @tc.number : VIDEO_RECORDER_START_TC_049 + * @tc.name : VideoRecorder start async api + * @tc.desc : VideoRecorder start async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('VIDEO_RECORDER_START_TC_049', 0, async function (done) { + if (videoRecorder == null || videoRecorder == undefined) { + console.info(TAG + 'Entering VIDEO_RECORDER_START_TC_049 videoRecorder == null || undefined') + } else { + console.info(TAG + 'Entering VIDEO_RECORDER_START_TC_049 to operate') + videoRecorder.start() + console.info(TAG + 'VIDEO_RECORDER_START_TC_049 called'); + sleep(3); + console.info(TAG + 'VIDEO_RECORDER_START_TC_049 done.') + expect(true).assertTrue() + console.info(TAG + 'Entering VIDEO_RECORDER_START_TC_049 PASSED') + console.info(TAG + 'Entering VIDEO_RECORDER_START_TC_049 ends here') + await sleep(1) + done() + } + + await sleep(1) + done() + }) + + /** + * @tc.number : VIDEO_OUTPUT_STOP_TC_050 + * @tc.name : VideoOutput stop async api + * @tc.desc : VideoOutput stop async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('VIDEO_OUTPUT_STOP_TC_050', 0, async function (done) { + if (videoOutput == null || videoOutput == undefined) { + console.info(TAG + 'Entering VIDEO_OUTPUT_STOP_TC_050 videoOutput == null || undefined') + } else { + console.info(TAG + 'Entering VIDEO_OUTPUT_STOP_TC_050 to operate') + await sleep(1) + videoOutput.stop(async (err, data) => { + console.info(TAG + 'Entering VIDEO_OUTPUT_STOP_TC_050 success: '+JSON.stringify(data)) + if (data == undefined) { + expect(true).assertTrue() + } else { + expect().assertFail() + } + console.info(TAG + 'Entering VIDEO_OUTPUT_STOP_TC_050 ends here') + await sleep(1) + done() + }) + + await sleep(1) + done() + } + }) + + /** + * @tc.number : VIDEO_RECORDER_STOP_RELEASE_TC_051 + * @tc.name : VideoRecorder stop async api + * @tc.desc : VideoRecorder stop async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('VIDEO_RECORDER_STOP_RELEASE_TC_051', 0, async function (done) { + if (videoRecorder == null || videoRecorder == undefined) { + console.info(TAG + 'Entering VIDEO_RECORDER_STOP_RELEASE_TC_051 videoRecorder == null || undefined') + } else { + console.info(TAG + 'Entering VIDEO_RECORDER_STOP_RELEASE_TC_051 to operate') + await sleep(1) + videoRecorder.stop() + console.info(TAG + 'VIDEO_RECORDER_STOP_RELEASE_TC_051 stopVideo done.') + videoOutput.release() + videoRecorder.release() + console.info(TAG + 'VIDEO_RECORDER_STOP_RELEASE_TC_051 releaseVideo done.') + console.info(TAG + 'Entering VIDEO_RECORDER_STOP_RELEASE_TC_051 PASSED') + console.info(TAG + 'Entering VIDEO_RECORDER_STOP_RELEASE_TC_051 ends here') + + await sleep(1) + done() + } + }) + + /** + * @tc.number : CAPTURE_SESSION_STOP_TC_052 + * @tc.name : CaptureSession stop async api + * @tc.desc : CaptureSession stop async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAPTURE_SESSION_STOP_TC_052', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + 'Entering CAPTURE_SESSION_STOP_TC_052 captureSession == null || undefined') + } else { + console.info(TAG + 'Entering CAPTURE_SESSION_STOP_TC_052 to operate') + await sleep(1) + captureSession.stop((err, data) => { + if (!err) { + console.info(TAG + 'Entering CAPTURE_SESSION_STOP_TC_052 success') + if (data != null || data != undefined) { + console.info(TAG + 'Entering CAPTURE_SESSION_STOP_TC_052 data is not null || undefined') + expect(true).assertTrue() + console.info(TAG + 'Entering CAPTURE_SESSION_STOP_TC_052 PASSED') + } + } else { + console.info(TAG + 'Entering CAPTURE_SESSION_STOP_TC_052 FAILED: ' + err.message) + } + console.info(TAG + 'Entering CAPTURE_SESSION_STOP_TC_052 ends here') + done() + }) + + await sleep(1) + done() + } + }) + + /** + * @tc.number : CAPTURE_SESSION_RELEASE_TC_053 + * @tc.name : CaptureSession release async api + * @tc.desc : CaptureSession release async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAPTURE_SESSION_RELEASE_TC_053', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + 'Entering CAPTURE_SESSION_RELEASE_TC_053 captureSession == null || undefined') + } else { + console.info(TAG + 'Entering CAPTURE_SESSION_RELEASE_TC_053 to operate') + await sleep(1) + captureSession.release((err, data) => { + if (!err) { + console.info(TAG + 'Entering CAPTURE_SESSION_RELEASE_TC_053 success') + if (data != null || data != undefined) { + console.info(TAG + 'Entering CAPTURE_SESSION_RELEASE_TC_053 data is not null || undefined') + expect(true).assertTrue() + console.info(TAG + 'Entering CAPTURE_SESSION_RELEASE_TC_053 PASSED') + } + } else { + console.info(TAG + 'Entering CAPTURE_SESSION_RELEASE_TC_053 FAILED: ' + err.message) + } + console.info(TAG + 'Entering CAPTURE_SESSION_RELEASE_TC_053 ends here') + done() + }) + + await sleep(1) + done() + } + }) + }) +} \ No newline at end of file diff --git a/multimedia/camera/camera_js_standard/src/main/ets/default/test/CameraJSUnitVideoPromise.test.ets b/multimedia/camera/camera_js_standard/src/main/ets/default/test/CameraJSUnitVideoPromise.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..8c66feabaa132fc3851f08dc21735d215929604c --- /dev/null +++ b/multimedia/camera/camera_js_standard/src/main/ets/default/test/CameraJSUnitVideoPromise.test.ets @@ -0,0 +1,1558 @@ +/* + * 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 cameraObj from '@ohos.multimedia.camera' +import media from '@ohos.multimedia.media' +import fileio from '@ohos.fileio'; +import abilityAccessCtrl from '@ohos.abilityAccessCtrl' +import bundle from '@ohos.bundle' + +// @ts-nocheck +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; + +let TAG = 'CameraModuleTest: ' +var cameraManagerPromise +var camerasArrayPromise +var camera0InputPromise +var previewOutputPromise +var videoRecorderPromise +var videoProfilePromise = { + audioBitrate: 48000, + audioChannels: 2, + audioCodec: 'audio/mp4a-latm', + audioSampleRate: 48000, + durationTime: 1000, + fileFormat: 'mp4', + videoBitrate: 48000, + videoCodec: 'video/mp4v-es', + videoFrameWidth: 640, + videoFrameHeight: 480, + videoFrameRate: 30 +} +var videoConfigPromise = { + audioSourceType: 1, + videoSourceType: 0, + profile: videoProfilePromise, + url: 'file:///data/media/01.mp4', + orientationHint: 0, + location: { latitude: 30, longitude: 130 }, + maxSize: 100, + maxDuration: 500 +} +var videoId +var videoOutputPromise +var captureSessionPromise + +var PermissionFlag = { + PERMISSION_USER_SET: 1, + PERMISSION_USER_FIXED: 2, + PERMISSION_SYSTEM_FIXED: 3 +}; + +const RESULT_FAIL = -1 +const TIMEOUT = 1000; +const DEFAULT_PERMISSION_FALG = 0 +var permissionNameUser = "ohos.permission.CAMERA"; +var tokenID = undefined + +export default function cameraTestCase(surfaceId: any) { + function sleep(time) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve(1) + }, time * 1000) + }).then(() => { + console.info(`sleep ${time} over...`) + }) + } + + async function getvideosurface() { + media.createVideoRecorder((err, recorder) => { + if (!err) + console.info(TAG + 'createVideoRecorder called') + videoRecorderPromise = recorder + console.info(TAG + 'videoRecorder is :' + JSON.stringify(videoRecorderPromise)) + + console.info(TAG + 'videoRecorder.prepare called.') + videoRecorderPromise.prepare(videoConfigPromise, (err) => { + console.info(TAG + 'videoRecorder.prepare success.') + }) + + videoRecorderPromise.getInputSurface((err, id) => { + console.info(TAG + 'getInputSurface called') + videoId = id + console.info(TAG + 'getInputSurface surfaceId: ' + JSON.stringify(videoId)) + }) + }) + } + + describe('VideoModePromise', function () { + console.info(TAG + '----------Camera-VideoMode-Promise--------------') + + console.log('##########start AccessTokenTests'); + beforeAll(async function (done){ + var appInfo = await bundle.getApplicationInfo('com.example.cameramoduletestetsv2',0 ,100); + tokenID = appInfo.accessTokenId; + console.info(TAG + "AccessTokenTest accessTokenId:" + appInfo.accessTokenId + ", name:"+ appInfo.name + + ", bundleName:" + appInfo.bundleName) + sleep(TIMEOUT); + console.info(TAG + "Grant permission start"); + var atManager = abilityAccessCtrl.createAtManager(); + var result = await atManager.grantUserGrantedPermission(tokenID, permissionNameUser, + PermissionFlag.PERMISSION_USER_FIXED); + console.info(TAG + "Grant permission finish, result:" + result + ", TokenID:" + tokenID); + done(); + }) + afterEach(function(){ + }) + + /** + * @tc.number : GET_CAMERA_MANAGER_PROMISE_TC_001 + * @tc.name : Create camera manager instance promise api + * @tc.desc : Create camera manager instance promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_CAMERA_MANAGER_PROMISE_TC_001', 0, async function (done) { + console.info('--------------GET_CAMERA_MANAGER_PROMISE_TC_001--------------') + cameraManagerPromise = await cameraObj.getCameraManager(null) + console.info(TAG + 'Entering GET_CAMERA_MANAGER_PROMISE_TC_001 cameraManagerPromise: ' + cameraManagerPromise) + if (cameraManagerPromise != null && cameraManagerPromise != undefined) { + expect(true).assertTrue() + console.info(TAG + 'Entering GET_CAMERA_MANAGER_PROMISE_TC_001 PASSED') + } else { + expect().assertFail() + console.info(TAG + 'Entering GET_CAMERA_MANAGER_PROMISE_TC_001 FAILED') + } + console.info(TAG + 'Entering GET_CAMERA_MANAGER_PROMISE_TC_001 ends here') + await sleep(1) + done() + }) + + /** + * @tc.number : GET_CAMERAS_PROMISE_TC_002 + * @tc.name : Create camera manager instance promise api + * @tc.desc : Create camera manager instance promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_CAMERAS_PROMISE_TC_002', 0, async function (done) { + console.info('--------------GET_CAMERAS_PROMISE_TC_002--------------') + camerasArrayPromise = await cameraManagerPromise.getCameras() + console.info(TAG + 'Entering GET_CAMERAS_PROMISE_TC_002: ' + JSON.stringify(camerasArrayPromise)) + if (camerasArrayPromise != null && camerasArrayPromise.length > 0) { + console.info(TAG + 'Entering GET_CAMERAS_PROMISE_TC_002 success') + for (var i = 0; i < camerasArrayPromise.length; i++) { + // Get the variables from camera object + var cameraId = camerasArrayPromise[i].cameraId + console.info(TAG + 'Entering GET_CAMERAS_PROMISE_TC_002 camera' + i + 'Id: ' + cameraId) + var cameraPosition = camerasArrayPromise[i].cameraPosition + console.info(TAG + 'Entering GET_CAMERAS_PROMISE_TC_002 camera' + i + 'Position: ' + cameraPosition) + var cameraType = camerasArrayPromise[i].cameraType + console.info(TAG + 'Entering GET_CAMERAS_PROMISE_TC_002 camera' + i + 'Type: ' + cameraType) + var connectionType = camerasArrayPromise[i].connectionType + console.info(TAG + 'Entering GET_CAMERAS_PROMISE_TC_002 connection' + i + 'Type: ' + connectionType) + } + expect(true).assertTrue() + console.info(TAG + 'Entering GET_CAMERAS_PROMISE_TC_002 PASSED') + } else { + expect().assertFail() + console.info(TAG + 'Entering GET_CAMERAS_PROMISE_TC_002 FAILED') + } + console.info(TAG + 'Entering GET_CAMERAS_PROMISE_TC_002 ends here') + await sleep(1) + done() + }) + + /*CAMERA-0 Scripts*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_PROMISE_TC_003 + * @tc.name : Create camerainput from camera-0 cameraId promise api + * @tc.desc : Create camerainput from camera-0 cameraId promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_PROMISE_TC_003', 0, async function (done) { + console.info('--------------CREATE_CAMERA_INPUT_PROMISE_TC_003--------------') + camera0InputPromise = await cameraManagerPromise.createCameraInput(camerasArrayPromise[0].cameraId) + console.info(TAG + 'Entering CREATE_CAMERA_INPUT_PROMISE_TC_003 camera0InputPromise: ' + JSON.stringify(camera0InputPromise)) + if (camera0InputPromise != null && camera0InputPromise != undefined) { + console.info(TAG + 'Entering CREATE_CAMERA_INPUT_PROMISE_TC_003 camera0InputPromise is not null || undefined') + expect(true).assertTrue() + console.info(TAG + 'Entering CREATE_CAMERA_INPUT_PROMISE_TC_003 PASSED') + } else { + expect().assertFail() + console.info(TAG + 'Entering CREATE_CAMERA_INPUT_PROMISE_TC_003 FAILED') + } + console.info(TAG + 'Entering CREATE_CAMERA_INPUT_PROMISE_TC_003 ends here') + await sleep(1) + done() + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_004 + * @tc.name : Create camerainput from camera-0 cameraposition & cameratype promise api + * @tc.desc : Create camerainput from camera-0 cameraposition & cameratype promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_004', 0, async function (done) { + console.info('--------------CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_004--------------') + var cameraInputPromise = await cameraManagerPromise.createCameraInput(camerasArrayPromise[0].cameraPosition, camerasArrayPromise[0].cameraType) + console.info(TAG + 'Entering CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_004 cameraInputPromise: ' + JSON.stringify(cameraInputPromise)) + if (cameraInputPromise == undefined) { + console.info(TAG + 'Entering CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_004 cameraInputPromise is undefined') + expect(true).assertTrue() + console.info(TAG + 'Entering CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_004 PASSED') + } else { + expect().assertFail() + console.info(TAG + 'Entering CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_004 FAILED') + } + console.info(TAG + 'Entering CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_004 ends here') + await sleep(1) + done() + }) + + /** + * @tc.number : CREATE_PREVIEW_OUTPUT_PROMISE_TC_005 + * @tc.name : Create previewoutput promise api + * @tc.desc : Create previewoutput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_PREVIEW_OUTPUT_PROMISE_TC_005', 0, async function (done) { + console.info('--------------CREATE_PREVIEW_OUTPUT_PROMISE_TC_005--------------') + previewOutputPromise = await cameraObj.createPreviewOutput(surfaceId) + console.info(TAG + 'Entering CREATE_PREVIEW_OUTPUT_PROMISE_TC_005 previewOutputPromise: ' + JSON.stringify(previewOutputPromise)) + if (previewOutputPromise != null && previewOutputPromise != undefined) { + console.info(TAG + 'Entering CREATE_PREVIEW_OUTPUT_PROMISE_TC_005 previewOutputPromise is not null || undefined') + expect(true).assertTrue() + console.info(TAG + 'Entering CREATE_PREVIEW_OUTPUT_PROMISE_TC_005 PASSED') + } else { + expect().assertFail() + console.info(TAG + 'Entering CREATE_PREVIEW_OUTPUT_PROMISE_TC_005 FAILED') + } + console.info(TAG + 'Entering CREATE_PREVIEW_OUTPUT_PROMISE_TC_005 ends here') + await sleep(1) + done() + }) + + /** + * @tc.number : CREATE_VIDEO_OUTPUT_PROMISE_TC_006 + * @tc.name : Create videooutput promise api + * @tc.desc : Create videooutput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_VIDEO_OUTPUT_PROMISE_TC_006', 0, async function (done) { + console.info(TAG + 'Entering CREATE_VIDEO_OUTPUT_PROMISE_TC_006 to operate') + await getvideosurface() + await sleep(1) + videoOutputPromise = await cameraObj.createVideoOutput(videoId) + console.info(TAG + 'Entering CREATE_VIDEO_OUTPUT_PROMISE_TC_006: ' + videoOutputPromise) + if (videoOutputPromise != null && videoOutputPromise != undefined) { + expect(true).assertTrue() + console.info(TAG + 'Entering CREATE_VIDEO_OUTPUT_PROMISE_TC_006 PASSED') + } else { + expect(true).assertTrue() + console.info(TAG + 'Entering CREATE_VIDEO_OUTPUT_PROMISE_TC_006 PASSED') + } + console.info(TAG + 'Entering CREATE_VIDEO_OUTPUT_PROMISE_TC_006 ends here'); + await sleep(1); + done(); + }) + + /** + * @tc.number : CREATE_CAPTURE_SESSION_PROMISE_TC_007 + * @tc.name : Create capturesession promise api + * @tc.desc : Create capturesession promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAPTURE_SESSION_PROMISE_TC_007', 0, async function (done) { + console.info(TAG + 'Entering CREATE_CAPTURE_SESSION_PROMISE_TC_007 to operate') + captureSessionPromise = await cameraObj.createCaptureSession(null) + console.info(TAG + 'Entering CREATE_CAPTURE_SESSION_PROMISE_TC_007: ' + captureSessionPromise) + if (captureSessionPromise != null && captureSessionPromise != undefined) { + expect(true).assertTrue() + console.info(TAG + 'Entering CREATE_CAPTURE_SESSION_PROMISE_TC_007 PASSED') + } else { + expect(true).assertTrue() + console.info(TAG + 'Entering CREATE_CAPTURE_SESSION_PROMISE_TC_007 PASSED') + } + console.info(TAG + 'Entering CREATE_CAPTURE_SESSION_PROMISE_TC_007 ends here'); + await sleep(1); + done(); + }) + + /** + * @tc.number : BEGIN_CONFIG_PROMISE_TC_008 + * @tc.name : CaptureSession begin config promise api + * @tc.desc : CaptureSession begin config promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('BEGIN_CONFIG_PROMISE_TC_008', 0, async function (done) { + if (captureSessionPromise == null || captureSessionPromise == undefined) { + console.info(TAG + 'Entering BEGIN_CONFIG_PROMISE_TC_008 captureSessionPromise == null || undefined') + } else { + console.info(TAG + 'Entering BEGIN_CONFIG_PROMISE_TC_008 to operate') + await captureSessionPromise.beginConfig() + expect(true).assertTrue() + console.info(TAG + 'Entering BEGIN_CONFIG_PROMISE_TC_008 PASSED') + console.info(TAG + 'Entering BEGIN_CONFIG_PROMISE_TC_008 ends here') + await sleep(1) + done() + } + + await sleep(1) + done() + }) + + /** + * @tc.number : ADD_INPUT_PROMISE_TC_009 + * @tc.name : AddInput promise api + * @tc.desc : AddInput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ADD_INPUT_PROMISE_TC_009', 0, async function (done) { + if (captureSessionPromise == null || captureSessionPromise == undefined) { + console.info(TAG + 'Entering ADD_INPUT_PROMISE_TC_009 captureSessionPromise == null || undefined') + } else { + console.info(TAG + 'Entering ADD_INPUT_PROMISE_TC_009 to operate') + await captureSessionPromise.addInput(camera0InputPromise) + expect(true).assertTrue() + console.info(TAG + 'Entering ADD_INPUT_PROMISE_TC_009 PASSED') + console.info(TAG + 'Entering ADD_INPUT_PROMISE_TC_009 ends here') + await sleep(1) + done() + } + + await sleep(1) + done() + }) + + /** + * @tc.number : ADD_OUTPUT_PREVIEW_PROMISE_TC_010 + * @tc.name : AddOutput preview promise api + * @tc.desc : AddOutput preview promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ADD_OUTPUT_PREVIEW_PROMISE_TC_010', 0, async function (done) { + if (captureSessionPromise == null || captureSessionPromise == undefined) { + console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW_PROMISE_TC_010 captureSessionPromise == null || undefined') + } else { + console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW_PROMISE_TC_010 to operate') + await captureSessionPromise.addOutput(previewOutputPromise) + expect(true).assertTrue() + console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW_PROMISE_TC_010 PASSED') + console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW_PROMISE_TC_010 ends here') + await sleep(1) + done() + } + + await sleep(1) + done() + }) + + /** + * @tc.number : ADD_OUTPUT_VIDEO_PROMISE_TC_011 + * @tc.name : AddOutput video promise api + * @tc.desc : AddOutput video promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ADD_OUTPUT_VIDEO_PROMISE_TC_011', 0, async function (done) { + if (captureSessionPromise == null || captureSessionPromise == undefined) { + console.info(TAG + 'Entering ADD_OUTPUT_VIDEO_PROMISE_TC_011 captureSessionPromise == null || undefined') + } else { + console.info(TAG + 'Entering ADD_OUTPUT_VIDEO_PROMISE_TC_011 to operate') + await captureSessionPromise.addOutput(videoOutputPromise) + expect(true).assertTrue() + console.info(TAG + 'Entering ADD_OUTPUT_VIDEO_PROMISE_TC_011 PASSED') + console.info(TAG + 'Entering ADD_OUTPUT_VIDEO_PROMISE_TC_011 ends here') + await sleep(1) + done() + } + + await sleep(1) + done() + }) + + /** + * @tc.number : COMMIT_CONFIG_PROMISE_TC_012 + * @tc.name : CommitConfig promise api + * @tc.desc : CommitConfig promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('COMMIT_CONFIG_PROMISE_TC_012', 0, async function (done) { + if (captureSessionPromise == null || captureSessionPromise == undefined) { + console.info(TAG + 'Entering COMMIT_CONFIG_PROMISE_TC_012 captureSessionPromise == null || undefined') + } else { + console.info(TAG + 'Entering COMMIT_CONFIG_PROMISE_TC_012 to operate') + await captureSessionPromise.commitConfig() + expect(true).assertTrue() + console.info(TAG + 'Entering COMMIT_CONFIG_PROMISE_TC_012 PASSED') + console.info(TAG + 'Entering COMMIT_CONFIG_PROMISE_TC_012 ends here') + await sleep(1) + done() + } + + await sleep(1) + done() + }) + + /** + * @tc.number : CAP_SES_CALLBACK_ON_ERROR_TC_013 + * @tc.name : CaptureSession callback onerror async api + * @tc.desc : CaptureSession callback onerror async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAP_SES_CALLBACK_ON_ERROR_TC_013', 0, async function (done) { + if (captureSessionPromise == null || captureSessionPromise == undefined) { + console.info(TAG + 'Entering CAP_SES_CALLBACK_ON_ERROR_TC_013 captureSessionPromise == null || undefined') + } else { + console.info(TAG + 'Entering CAP_SES_CALLBACK_ON_ERROR_TC_013 to operate') + await sleep(1) + captureSessionPromise.on('error', async (err, data) => { + if (!err) { + console.info(TAG + " captureSession errorcallback is success"); + if (data != null || data != undefined) { + console.info(TAG + "Error in CaptureSessioncallback with ErrorCode: " + data.code); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_TC_014 + * @tc.name : PreviewOutput callback onframestart async api + * @tc.desc : PreviewOutput callback onframestart async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_TC_014', 0, async function (done) { + if (previewOutputPromise == null || previewOutputPromise == undefined) { + console.info(TAG + 'Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_TC_014 previewOutputPromise == null || undefined') + } else { + console.info(TAG + 'Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_TC_014 to operate') + await sleep(1) + previewOutputPromise.on('frameStart', async (err, data) => { + if (!err) { + console.info(TAG + "PreviewStart frameStart Callback is success"); + if (data != null || data != undefined) { + expect(true).assertTrue(); + } + } else { + expect().assertFail() + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_TC_015 + * @tc.name : PreviewOutput callback onframeend async api + * @tc.desc : PreviewOutput callback onframeend async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_TC_015', 0, async function (done) { + if (previewOutputPromise == null || previewOutputPromise == undefined) { + console.info(TAG + 'Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_TC_015 previewOutputPromise == null || undefined') + } else { + console.info(TAG + 'Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_TC_015 to operate') + await sleep(1) + previewOutputPromise.on('frameEnd', async (err, data) => { + if (!err) { + console.info(TAG + "PreviewStop frameEnd Callback is success"); + if (data != null || data != undefined) { + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : PREVIEW_OUTPUT_CALLBACK_ON_ERROR_TC_016 + * @tc.name : PreviewOutput callback onerror async api + * @tc.desc : PreviewOutput callback onerror async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PREVIEW_OUTPUT_CALLBACK_ON_ERROR_TC_016', 0, async function (done) { + if (previewOutputPromise == null || previewOutputPromise == undefined) { + console.info(TAG + 'Entering PREVIEW_OUTPUT_CALLBACK_ON_ERROR_TC_016 previewOutputPromise == null || undefined') + } else { + console.info(TAG + 'Entering PREVIEW_OUTPUT_CALLBACK_ON_ERROR_TC_016 to operate') + await sleep(1) + previewOutputPromise.on('error', async (err, data) => { + if (!err) { + console.info(TAG + "PreviewOutputError callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "Error during PreviewOutput with ErrorCode: " + data.code); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : VIDEO_OUTPUT_CALLBACK_ON_FRAME_START_TC_017 + * @tc.name : VideoOutput callback onframestart async api + * @tc.desc : VideoOutput callback onframestart async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('VIDEO_OUTPUT_CALLBACK_ON_FRAME_START_TC_017', 0, async function (done) { + if (videoOutputPromise == null || videoOutputPromise == undefined) { + console.info(TAG + 'Entering VIDEO_OUTPUT_CALLBACK_ON_FRAME_START_TC_017 videoOutputPromise == null || undefined') + } else { + console.info(TAG + 'Entering VIDEO_OUTPUT_CALLBACK_ON_FRAME_START_TC_017 to operate') + await sleep(1) + videoOutputPromise.on('frameStart', async (err, data) => { + if (!err) { + console.info(TAG + "Video frameStart Callback is success"); + if (data != null || data != undefined) { + expect(true).assertTrue(); + } + } else { + expect().assertFail() + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : VIDEO_OUTPUT_CALLBACK_ON_FRAME_END_TC_018 + * @tc.name : VideoOutput callback onframeend async api + * @tc.desc : VideoOutput callback onframeend async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('VIDEO_OUTPUT_CALLBACK_ON_FRAME_END_TC_018', 0, async function (done) { + if (videoOutputPromise == null || videoOutputPromise == undefined) { + console.info(TAG + 'Entering VIDEO_OUTPUT_CALLBACK_ON_FRAME_END_TC_018 videoOutputPromise == null || undefined') + } else { + console.info(TAG + 'Entering VIDEO_OUTPUT_CALLBACK_ON_FRAME_END_TC_018 to operate') + await sleep(1) + videoOutputPromise.on('frameEnd', async (err, data) => { + if (!err) { + console.info(TAG + 'Video frameEnd callback is success') + if (data != null || data != undefined) { + expect(true).assertTrue() + } + } else { + expect().assertFail() + } + await sleep(1); + done(); + }) + + await sleep(1); + done(); + } + }) + + /** + * @tc.number : VIDEO_OUTPUT_CALLBACK_ON_ERROR_TC_019 + * @tc.name : VideoOutput callback onerror async api + * @tc.desc : VideoOutput callback onerror async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('VIDEO_OUTPUT_CALLBACK_ON_ERROR_TC_019', 0, async function (done) { + if (videoOutputPromise == null || videoOutputPromise == undefined) { + console.info(TAG + 'Entering VIDEO_OUTPUT_CALLBACK_ON_ERROR_TC_019 videoOutputPromise == null || undefined') + } else { + console.info(TAG + 'Entering VIDEO_OUTPUT_CALLBACK_ON_ERROR_TC_019 to operate') + await sleep(1) + videoOutputPromise.on('error', async (err, data) => { + if (!err) { + console.info(TAG + 'VideoOutput Errorcallback is success') + if (data != null || data != undefined) { + console.info(TAG + "Error during videoOutput with ErrorCode: " + data.code); + expect(true).assertTrue() + } + } else { + expect().assertFail() + } + await sleep(1) + done() + }) + + await sleep(1) + done(); + } + }) + + //FocusState callback + /** + * @tc.number : FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT0_020 + * @tc.name : focus state change callback on camera0Input api + * @tc.desc : Preview capture callback on frame end api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ +// it('FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT0_020', 0, async function (done) { +// if (camera0InputPromise == null || camera0InputPromise == undefined) { +// console.info(TAG + "Entering FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT0_020 previewOutput == null || undefined"); +// } else { +// console.info(TAG + "Entering FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT0_020 to operate"); +// camera0InputPromise.on("focusStateChange", async (err, data) => { +// if (!err) { +// console.info(TAG + "FocusState callback is success"); +// if (data != null || data != undefined) { +// console.info(TAG + "Current FocusState is: " + data); +// expect(true).assertTrue(); +// } +// } else { +// expect().assertFail(); +// } +// await sleep(1000); +// done(); +// }) +// await sleep(1000); +// done(); +// } +// }) + + + /** + * @tc.number : CAPTURE_SESSION_START_PROMISE_TC_020 + * @tc.name : CaptureSession start promise api + * @tc.desc : CaptureSession start promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAPTURE_SESSION_START_PROMISE_TC_020', 0, async function (done) { + if (captureSessionPromise == null || captureSessionPromise == undefined) { + console.info(TAG + 'Entering CAPTURE_SESSION_START_PROMISE_TC_020 captureSessionPromise == null || undefined') + } else { + console.info(TAG + 'Entering CAPTURE_SESSION_START_PROMISE_TC_020 to operate') + await captureSessionPromise.start() + expect(true).assertTrue() + console.info(TAG + 'Entering CAPTURE_SESSION_START_PROMISE_TC_020 PASSED') + console.info(TAG + 'Entering CAPTURE_SESSION_START_PROMISE_TC_020 ends here') + await sleep(1) + done() + } + + await sleep(1) + done() + }) + + //FLASH Function API scripts + /** + * @tc.number : HAS_FLASH_TC_021 + * @tc.name : check if has flash-camera0Input api + * @tc.desc : check if has flash-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('HAS_FLASH_TC_021', 0, async function (done) { + console.info("--------------HAS_FLASH_TC_021--------------"); + console.info(TAG + 'hasFlash called.') + var hasFlashPromise = await camera0InputPromise.hasFlash(); + console.info(TAG + "Entering HAS_FLASH success"); + if (hasFlashPromise != null || hasFlashPromise != undefined) { + console.info(TAG + "Entering HAS_FLASH data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering HAS_FLASH PASSED with HAS_FLASH is: " + JSON.stringify(hasFlashPromise)); + } + else { + expect().assertFail(); + console.info(TAG + "Entering HAS_FLASH FAILED"); + } + console.info(TAG + "Entering HAS_FLASH_TC_021 ends here"); + await sleep(1) + done(); + }) + + /** + * @tc.number : IS_FLASH_MODE_OPEN_SUPPORTED_022 + * @tc.name : check if flash mode open is supported-camera0Input api + * @tc.desc : check if flash mode open is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FLASH_MODE_OPEN_SUPPORTED_022', 0, async function (done) { + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED_022 to operate"); + var isFMOpenSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_OPEN); + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED_022 SUCCESS "); + if (isFMOpenSupported != null || isFMOpenSupported != undefined) { + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED data is not null || undefined"); + console.info(TAG + "FLASH_MODE_OPEN supported is: " + JSON.stringify(isFMOpenSupported)); + expect(true).assertTrue(); + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED PASSED"); + } + else { + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED FAILED"); + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED ends here"); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FLASH_MODE_OPEN_023 + * @tc.name : set flash mode open camera0 api + * @tc.desc : set flash mode open camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FLASH_MODE_OPEN_023', 0, async function (done) { + console.info(TAG + "Entering SET_FLASH_MODE_OPEN_023 to operate"); + var SetFMOpen = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_OPEN); + console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMOpen)) + if (SetFMOpen == undefined) { + console.info(TAG + "Entering SET_FLASH_MODE_OPEN_023 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_OPEN); + console.info(TAG + "Entering SET_FLASH_MODE_OPEN_023 PASSED") + expect(true).assertTrue() + } else { + expect().assertFail(); + console.info(TAG + "Entering SET_FLASH_MODE_OPEN_023 FAILED"); + console.info(TAG + "Entering SET_FLASH_MODE_OPEN_023 ends here"); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_FLASH_MODE_OPEN_024 + * @tc.name : get flash mode open camera0 api + * @tc.desc : get flash mode open camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FLASH_MODE_OPEN_024', 0, async function (done) { + console.info(TAG + "Entering GET_FLASH_MODE_OPEN_024 to operate"); + var GetFMOpen = await camera0InputPromise.getFlashMode(); + console.info(TAG + "Entering GET_FLASH_MODE_OPEN success: " + JSON.stringify(GetFMOpen)); + if (GetFMOpen == 1) { + console.info(TAG + "GET_FLASH_MODE_OPEN data is not null || undefined: "); + console.info(TAG + "Current FlashMode is: " + JSON.stringify(GetFMOpen)); + expect(true).assertTrue(); + console.info(TAG + "GET_FLASH_MODE_OPEN_024 PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_FLASH_MODE_OPEN_024 FAILED"); + console.info(TAG + "GET_FLASH_MODE_OPEN_024 ends here"); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_025 + * @tc.name : check if flash mode always open is supported-camera0Input api + * @tc.desc : check if flash mode always open is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_025', 0, async function (done) { + console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_025 to operate"); + var isFMAlwaysOpenSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); + console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_025 SUCCESS "); + if (isFMAlwaysOpenSupported != null || isFMAlwaysOpenSupported != undefined) { + console.info(TAG + "Entering FLASH_MODE_ALWAYS_OPEN data is not null || undefined"); + console.info(TAG + "FLASH_MODE_OPEN supported is: " + isFMAlwaysOpenSupported); + expect(true).assertTrue(); + console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_025 PASSED"); + } + else { + console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_025 FAILED"); + console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_025 ends here"); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FLASH_MODE_ALWAYS_OPEN_026 + * @tc.name : set flash mode always open camera0 api + * @tc.desc : set flash mode always open camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FLASH_MODE_ALWAYS_OPEN_026', 0, async function (done) { + console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN_026 to operate"); + var SetFMAlwaysOpen = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); + console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMAlwaysOpen)) + if (SetFMAlwaysOpen == undefined) { + console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN_026 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); + console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN_026 PASSED") + expect(true).assertTrue() + } else { + expect().assertFail(); + console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN_026 FAILED"); + console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN_026 ends here"); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_FLASH_MODE_ALWAYS_OPEN_027 + * @tc.name : get flash mode always open camera0 api + * @tc.desc : get flash mode always open camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + + it('GET_FLASH_MODE_ALWAYS_OPEN_027', 0, async function (done) { + console.info(TAG + "Entering GET_FLASH_MODE_ALWAYS_OPEN_027 to operate"); + var GetFMAlwaysOpen = await camera0InputPromise.getFlashMode(); + console.info(TAG + "Entering GET_FLASH_MODE_ALWAYS_OPEN_027 success"); + if (GetFMAlwaysOpen == 3) { + console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN_027 data is not null || undefined: "); + console.info(TAG + "Current FlashMode is: " + GetFMAlwaysOpen); + expect(true).assertTrue(); + console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN_027 PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN_027 FAILED"); + console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN_027 ends here"); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : IS_FLASH_MODE_CLOSE_SUPPORTED_028 + * @tc.name : check if flash mode close is supported-camera0Input api + * @tc.desc : check if flash mode close is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FLASH_MODE_CLOSE_SUPPORTED_028', 0, async function (done) { + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED_028 to operate"); + var isFMCloseSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_CLOSE); + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED_028 SUCCESS "); + if (isFMCloseSupported != null || isFMCloseSupported != undefined) { + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED_028 data is not null || undefined"); + console.info(TAG + "FLASH_MODE_CLOSE supported is: " + isFMCloseSupported); + expect(true).assertTrue(); + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED_028 PASSED"); + } + else { + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED_028 FAILED"); + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED_028 ends here"); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FLASH_MODE_CLOSE_029 + * @tc.name : set flash mode close camera0 api + * @tc.desc : set flash mode close camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FLASH_MODE_CLOSE_029', 0, async function (done) { + console.info(TAG + "Entering SET_FLASH_MODE_CLOSE_029 to operate"); + var SetFMClose = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_CLOSE); + console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMClose)) + if (SetFMClose == undefined) { + console.info(TAG + "Entering SET_FLASH_MODE_CLOSE_029 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_CLOSE); + console.info(TAG + "Entering SET_FLASH_MODE_CLOSE_029 PASSED") + expect(true).assertTrue() + } else { + expect().assertFail(); + console.info(TAG + "Entering SET_FLASH_MODE_CLOSE_029 FAILED"); + console.info(TAG + "Entering SET_FLASH_MODE_CLOSE_029 ends here"); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_FLASH_MODE_CLOSE_030 + * @tc.name : get flash mode close camera0 api + * @tc.desc : get flash mode close camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + + it('GET_FLASH_MODE_CLOSE_030', 0, async function (done) { + console.info(TAG + "Entering GET_FLASH_MODE_CLOSE_030 to operate"); + var GetFMClose = await camera0InputPromise.getFlashMode(); + console.info(TAG + "Entering GET_FLASH_MODE_CLOSE success"); + if (GetFMClose == 0) { + console.info(TAG + "GET_FLASH_MODE_CLOSE data is not null || undefined: "); + console.info(TAG + "Current FlashMode is: " + GetFMClose); + expect(true).assertTrue(); + console.info(TAG + "GET_FLASH_MODE_CLOSE_030 PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_FLASH_MODE_CLOSE_030 FAILED"); + console.info(TAG + "GET_FLASH_MODE_CLOSE_030 ends here"); + } + await sleep(1); + done(); + }) + + // FOCUS promise API's + + it('IS_FOCUS_MODE_MANUAL_SUPPORTED_031', 0, async function (done) { + console.info(TAG + "Entering IS_FOCUS_MODE_MANUAL_SUPPORTED_031 to operate"); + var isFMmanualSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_MANUAL); + if (isFMmanualSupportedpromise != null || isFMmanualSupportedpromise != undefined) { + console.info(TAG + "Entering IS_FOCUS_MODE_MANUAL_SUPPORTED_031 data is not null || undefined"); + console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + isFMmanualSupportedpromise); + expect(true).assertTrue(); + console.info(TAG + "Entering IS_FOCUS_MODE_MANUAL_SUPPORTED_031 PASSED: "); + } + else { + console.info(TAG + "IS_FOCUS_MODE_MANUAL_SUPPORTED_031 FAILED"); + expect().assertFail(); + console.info(TAG + "IS_FOCUS_MODE_MANUAL_SUPPORTED_031 ends here"); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FOCUS_MODE_MANUAL_032 + * @tc.name : set focus mode manual camera0 api + * @tc.desc : set focus mode manual camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + + it('SET_FOCUS_MODE_MANUAL_032', 0, async function (done) { + console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL_032 to operate"); + var setFocusManual = await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_MANUAL); + console.info(TAG + "setFocusManual: " + JSON.stringify(setFocusManual)) + if (setFocusManual == undefined) { + console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL_032 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); + console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL_032 PASSED") + expect(true).assertTrue() + } + else { + expect().assertFail(); + console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL_032 FAILED"); + console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL_032 ends here"); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_FOCUS_MODE_MANUAL_033 + * @tc.name : get focus mode manual camera0 api + * @tc.desc : get focus mode manual camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + + it('GET_FOCUS_MODE_MANUAL_033', 0, async function (done) { + console.info(TAG + "Entering GET_FOCUS_MODE_MANUAL_033 to operate"); + var getfocusmodepromise = await camera0InputPromise.getFocusMode(); + console.info(TAG + "Entering GET_FOCUS_MODE_MANUAL_033 SUCCESS"); + if (getfocusmodepromise == 0) { + console.info(TAG + "Current FocusMode is: " + getfocusmodepromise); + expect(true).assertTrue(); + console.info(TAG + "GET_FOCUS_MODE_MANUAL_033 PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_FOCUS_MODE_MANUAL_033 FAILED"); + console.info(TAG + "GET_FOCUS_MODE_MANUAL_033 ends here"); + } + await sleep(1); + done(); + + }) + + /** + * @tc.number : IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_034 + * @tc.name : check if focus mode continuous is supported-camera0Input api + * @tc.desc : check if focus mode continuous is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_034', 0, async function (done) { + console.info(TAG + "Entering IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_034 to operate"); + var isFMContinuousSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); + if (isFMContinuousSupportedpromise != null || isFMContinuousSupportedpromise != undefined) { + console.info(TAG + "Entering IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_034 data is not null || undefined"); + console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + isFMContinuousSupportedpromise); + expect(true).assertTrue(); + console.info(TAG + "Entering IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_034 PASSED: "); + } + else { + console.info(TAG + "IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_034 FAILED"); + expect().assertFail(); + console.info(TAG + "IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_034 ends here"); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FOCUS_MODE_CONTINUOUS_035 + * @tc.name : set focus mode continuous camera0 api + * @tc.desc : set focus mode continuous camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + + it('SET_FOCUS_MODE_CONTINUOUS_035', 0, async function (done) { + console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS_035 to operate"); + var setFocusCont = await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); + console.info(TAG + "setFocusCont: " + JSON.stringify(setFocusCont)) + if (setFocusCont == undefined) { + console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS_035 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); + console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS_035 PASSED") + expect(true).assertTrue() + } + else { + expect().assertFail(); + console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS_035 FAILED"); + console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS_035 ends here"); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_FOCUS_MODE_CONTINUOUS_036 + * @tc.name : get focus mode continuous camera0 api + * @tc.desc : get focus mode continuous camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + + it('GET_FOCUS_MODE_CONTINUOUS_036', 0, async function (done) { + console.info(TAG + "Entering GET_FOCUS_MODE_CONTINUOUS_036 to operate"); + var getfocusmodepromise = await camera0InputPromise.getFocusMode(); + console.info(TAG + "Entering GET_FOCUS_MODE_CONTINUOUS_036 SUCCESS"); + if (getfocusmodepromise == 1) { + console.info(TAG + "Current FocusMode is: " + getfocusmodepromise); + expect(true).assertTrue(); + console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS_036 PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS_036 FAILED"); + console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS_036 ends here"); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : IS_FOCUS_MODE_AUTO_SUPPORTED_037 + * @tc.name : check if focus mode auto is supported-camera0Input api + * @tc.desc : check if focus mode auto is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FOCUS_MODE_AUTO_SUPPORTED_037', 0, async function (done) { + console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED_037 to operate"); + var isFMAutoSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO); + if (isFMAutoSupportedpromise != null || isFMAutoSupportedpromise != undefined) { + console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED_037 data is not null || undefined"); + console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + isFMAutoSupportedpromise); + expect(true).assertTrue(); + console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED_037 PASSED: "); + } + else { + console.info(TAG + "IS_FOCUS_MODE_AUTO_SUPPORTED_037 FAILED"); + expect().assertFail(); + console.info(TAG + "IS_FOCUS_MODE_AUTO_SUPPORTED_037 ends here"); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FOCUS_MODE_AUTO_038 + * @tc.name : set focus mode auto camera0 api + * @tc.desc : set focus mode auto camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FOCUS_MODE_AUTO_038', 0, async function (done) { + console.info(TAG + "Entering SET_FOCUS_MODE_AUTO_038 to operate"); + var setFocusAuto = await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO); + console.info(TAG + "setFocusAuto: " + JSON.stringify(setFocusAuto)) + if (setFocusAuto == undefined) { + console.info(TAG + "Entering SET_FOCUS_MODE_AUTO_038 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_AUTO); + console.info(TAG + "Entering SET_FOCUS_MODE_AUTO_038 PASSED") + expect(true).assertTrue() + } + else { + expect().assertFail(); + console.info(TAG + "Entering SET_FOCUS_MODE_AUTO_038 FAILED"); + console.info(TAG + "Entering SET_FOCUS_MODE_AUTO_038 ends here"); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_FOCUS_MODE_AUTO_039 + * @tc.name : get focus mode auto camera0 api + * @tc.desc : get focus mode auto camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + + it('GET_FOCUS_MODE_AUTO_039', 0, async function (done) { + console.info(TAG + "Entering GET_FOCUS_MODE_AUTO_039 to operate"); + var getfocusmodepromise = await camera0InputPromise.getFocusMode(); + console.info(TAG + "Entering GET_FOCUS_MODE_AUTO_039 SUCCESS"); + if (getfocusmodepromise == 2) { + console.info(TAG + "Current FocusMode is: " + getfocusmodepromise); + expect(true).assertTrue(); + console.info(TAG + "GET_FOCUS_MODE_AUTO_039 PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_FOCUS_MODE_AUTO_039 FAILED"); + console.info(TAG + "GET_FOCUS_MODE_AUTO_039 ends here"); + } + await sleep(1); + done(); + }) + + //ZOOM Function + +/** + * @tc.number : GET_ZOOM_RATIO_PROMISE_TC_041 + * @tc.name : get zoom ratio camera-0 cameraId api promise api + * @tc.desc : get zoom ratio camera-0 cameraId api promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_ZOOM_RATIO_PROMISE_TC_041', 0, async function (done) { + console.info("--------------GET_ZOOM_RATIO_PROMISE_TC_041--------------"); + var getZoomRatioPromise = await camera0InputPromise.getZoomRatioRange(); + console.info(TAG + "Entering GET_ZOOM_RATIO_PROMISE_TC_041 getZoomRatioPromise: " + JSON.stringify(getZoomRatioPromise)); + if (getZoomRatioPromise != null && getZoomRatioPromise != undefined) { + console.info(TAG + "Entering GET_ZOOM_RATIO_PROMISE_TC_041 setZoomRatioPromise is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering GET_ZOOM_RATIO_PROMISE_TC_041 success: " + JSON.stringify(getZoomRatioPromise)); + console.info(TAG + "Entering GET_ZOOM_RATIO_PROMISE_TC_041 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_ZOOM_RATIO_PROMISE_TC_041 FAILED"); + } + console.info(TAG + "Entering GET_ZOOM_RATIO_PROMISE_TC_041 ends here"); + await sleep(1); + done(); + }) + + + /** + * @tc.number : SET_GET_ZOOM_1_PROMISE_TC_042 + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_1_PROMISE_TC_042', 0, async function (done) { + var setpromise = await camera0InputPromise.setZoomRatio(1); + console.info(TAG + "setZoomRatio success: 1"); + console.info(TAG + "getZoomRatio called") + var getpromise1 = await camera0InputPromise.getZoomRatio(); + console.info(TAG + "getZoomRatio success: "+getpromise1); + if(getpromise1 !=null && getpromise1 != undefined) { + expect(getpromise1).assertEqual(1); + console.info(TAG + "SET_GET_ZOOM_1_PROMISE_TC_042 PASSED "); + } + else { + expect().assertFail(); + console.info(TAG + "SET_GET_ZOOM_1_PROMISE_TC_042 FAILED" ); + } + await sleep(1); + done(); + }) + + + /** + * @tc.number : SET_GET_ZOOM_2_PROMISE_TC_043 + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_2_PROMISE_TC_043', 0, async function (done) { + var setpromise = await camera0InputPromise.setZoomRatio(2); + console.info(TAG + "setZoomRatio success: 2"); + console.info(TAG + "getZoomRatio called") + var getpromise2 = await camera0InputPromise.getZoomRatio(); + console.info(TAG + "getZoomRatio success: "+getpromise2); + if(getpromise2 !=null && getpromise2 != undefined) { + expect(getpromise2).assertEqual(2); + console.info(TAG + "SET_GET_ZOOM_2_PROMISE_TC_043 PASSED "); + } + else { + expect().assertFail(); + console.info(TAG + "SET_GET_ZOOM_2_PROMISE_TC_043 FAILED" ); + } + await sleep(1); + done(); + }) + + + /** + * @tc.number : SET_GET_ZOOM_3_PROMISE_TC_044 + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_3_PROMISE_TC_044', 0, async function (done) { + var setpromise = await camera0InputPromise.setZoomRatio(3); + console.info(TAG + "setZoomRatio success: 3"); + console.info(TAG + "getZoomRatio called") + var getpromise3 = await camera0InputPromise.getZoomRatio(); + console.info(TAG + "getZoomRatio success: "+getpromise3); + if(getpromise3 !=null && getpromise3 != undefined) { + expect(getpromise3).assertEqual(3); + console.info(TAG + "SET_GET_ZOOM_3_PROMISE_TC_044 PASSED "); + } + else { + expect().assertFail(); + console.info(TAG + "SET_GET_ZOOM_3_PROMISE_TC_044 FAILED" ); + } + await sleep(1); + done(); + }) + + + /** + * @tc.number : SET_GET_ZOOM_4_PROMISE_TC_045 + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_4_PROMISE_TC_045', 0, async function (done) { + var setpromise = await camera0InputPromise.setZoomRatio(4); + console.info(TAG + "setZoomRatio success: 4"); + console.info(TAG + "getZoomRatio called") + var getpromise4 = await camera0InputPromise.getZoomRatio(); + console.info(TAG + "getZoomRatio success: "+getpromise4); + if(getpromise4 !=null && getpromise4 != undefined) { + expect(getpromise4).assertEqual(4); + console.info(TAG + "SET_GET_ZOOM_4_PROMISE_TC_045 PASSED "); + } + else { + expect().assertFail(); + console.info(TAG + "SET_GET_ZOOM_4_PROMISE_TC_045 FAILED" ); + } + await sleep(1); + done(); + }) + + + /** + * @tc.number : SET_GET_ZOOM_5_PROMISE_TC_046 + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_5_PROMISE_TC_046', 0, async function (done) { + var setpromise = await camera0InputPromise.setZoomRatio(5); + console.info(TAG + "setZoomRatio success: 5"); + console.info(TAG + "getZoomRatio called") + var getpromise5 = await camera0InputPromise.getZoomRatio(); + console.info(TAG + "getZoomRatio success: "+getpromise5); + if(getpromise5 !=null && getpromise5 != undefined) { + expect(getpromise5).assertEqual(5); + console.info(TAG + "SET_GET_ZOOM_5_PROMISE_TC_046 PASSED "); + } + else { + expect().assertFail(); + console.info(TAG + "SET_GET_ZOOM_5_PROMISE_TC_046 FAILED" ); + } + await sleep(1); + done(); + }) + + + /** + * @tc.number : SET_GET_ZOOM_6_PROMISE_TC_047 + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_6_PROMISE_TC_047', 0, async function (done) { + var setpromise = await camera0InputPromise.setZoomRatio(6); + console.info(TAG + "setZoomRatio success: 6"); + console.info(TAG + "getZoomRatio called") + var getpromise6 = await camera0InputPromise.getZoomRatio(); + console.info(TAG + "getZoomRatio success: "+getpromise6); + if(getpromise6 !=null && getpromise6 != undefined) { + expect(getpromise6).assertEqual(6); + console.info(TAG + "SET_GET_ZOOM_6_PROMISE_TC_047 PASSED "); + } + else { + expect().assertFail(); + console.info(TAG + "SET_GET_ZOOM_6_PROMISE_TC_047 FAILED" ); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : VIDEO_OUTPUT_START_PROMISE_TC_048 + * @tc.name : VideoOutput start promise api + * @tc.desc : VideoOutput start promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('VIDEO_OUTPUT_START_PROMISE_TC_048', 0, async function (done) { + if (videoOutputPromise == null || videoOutputPromise == undefined) { + console.info(TAG + 'Entering VIDEO_OUTPUT_START_PROMISE_TC_048 videoOutputPromise == null || undefined') + } else { + console.info(TAG + 'Entering VIDEO_OUTPUT_START_PROMISE_TC_048 to operate') + await videoOutputPromise.start() + expect(true).assertTrue() + console.info(TAG + 'Entering VIDEO_OUTPUT_START_PROMISE_TC_048 PASSED') + console.info(TAG + 'Entering VIDEO_OUTPUT_START_PROMISE_TC_048 ends here') + await sleep(1) + done() + } + + await sleep(1) + done() + }) + + + + /** + * @tc.number : VIDEO_RECORDER_START_PROMISE_TC_049 + * @tc.name : VideoOutput start promise api + * @tc.desc : VideoOutput start promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('VIDEO_RECORDER_START_PROMISE_TC_049', 0, async function (done) { + if (videoRecorderPromise == null || videoRecorderPromise == undefined) { + console.info(TAG + 'Entering VIDEO_RECORDER_START_PROMISE_TC_049 videoRecorderPromise == null || undefined') + } else { + console.info(TAG + 'Entering VIDEO_RECORDER_START_PROMISE_TC_049 to operate') + videoRecorderPromise.start() + console.info(TAG + 'VIDEO_RECORDER_START_PROMISE_TC_049 called'); + sleep(3); + console.info(TAG + 'VIDEO_RECORDER_START_PROMISE_TC_049 done.') + expect(true).assertTrue() + console.info(TAG + 'Entering VIDEO_RECORDER_START_PROMISE_TC_049 PASSED') + console.info(TAG + 'Entering VIDEO_RECORDER_START_PROMISE_TC_049 ends here') + await sleep(1) + done() + } + + await sleep(1) + done() + }) + + /** + * @tc.number : VIDEO_OUTPUT_STOP_PROMISE_TC_050 + * @tc.name : VideoOutput stop promise api + * @tc.desc : VideoOutput stop promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('VIDEO_OUTPUT_STOP_PROMISE_TC_050', 0, async function (done) { + if (videoOutputPromise == null || videoOutputPromise == undefined) { + console.info(TAG + 'Entering VIDEO_OUTPUT_STOP_PROMISE_TC_050 videoOutputPromise == null || undefined') + } else { + console.info(TAG + 'Entering VIDEO_OUTPUT_STOP_PROMISE_TC_050 to operate') + await videoOutputPromise.stop() + expect(true).assertTrue() + console.info(TAG + 'Entering VIDEO_OUTPUT_STOP_PROMISE_TC_050 PASSED') + console.info(TAG + 'Entering VIDEO_OUTPUT_STOP_PROMISE_TC_050 ends here') + await sleep(1) + done() + } + + await sleep(1) + done() + }) + + /** + * @tc.number : VIDEO_RECORDER_STOP_RELEASE_PROMISE_TC_051 + * @tc.name : VideoRecorder stop promise api + * @tc.desc : VideoRecorder stop promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('VIDEO_RECORDER_STOP_RELEASE_PROMISE_TC_051', 0, async function (done) { + if (videoOutputPromise == null || videoOutputPromise == undefined) { + console.info(TAG + 'Entering VIDEO_RECORDER_STOP_RELEASE_PROMISE_TC_051 videoOutputPromise == null || undefined') + } else { + console.info(TAG + 'Entering VIDEO_RECORDER_STOP_RELEASE_PROMISE_TC_051 to operate') + videoRecorderPromise.stop() + console.info(TAG + 'VIDEO_RECORDER_STOP done.') + + videoOutputPromise.release() + videoRecorderPromise.release() + console.info(TAG + 'VIDEO_RECORDER_RELEASE done.') + console.info(TAG + 'Entering VIDEO_RECORDER_STOP_RELEASE_PROMISE_TC_051 PASSED') + console.info(TAG + 'Entering VIDEO_RECORDER_STOP_RELEASE_PROMISE_TC_051 ends here') + await sleep(1) + done() + } + await sleep(1) + done() + }) + + /** + * @tc.number : CAPTURE_SESSION_STOP_PROMISE_TC_052 + * @tc.name : CaptureSession stop promise api + * @tc.desc : CaptureSession stop promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAPTURE_SESSION_STOP_PROMISE_TC_052', 0, async function (done) { + if (captureSessionPromise == null || captureSessionPromise == undefined) { + console.info(TAG + 'Entering CAPTURE_SESSION_STOP_PROMISE_TC_052 captureSessionPromise == null || undefined') + } else { + console.info(TAG + 'Entering CAPTURE_SESSION_STOP_PROMISE_TC_052 to operate') + await captureSessionPromise.stop() + expect(true).assertTrue() + console.info(TAG + 'Entering CAPTURE_SESSION_STOP_PROMISE_TC_052 PASSED') + console.info(TAG + 'Entering CAPTURE_SESSION_STOP_PROMISE_TC_052 ends here') + await sleep(1) + done() + } + + await sleep(1) + done() + }) + + /** + * @tc.number : CAPTURE_SESSION_RELEASE_PROMISE_TC_053 + * @tc.name : CaptureSession release promise api + * @tc.desc : CaptureSession release promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAPTURE_SESSION_RELEASE_PROMISE_TC_053', 0, async function (done) { + if (captureSessionPromise == null || captureSessionPromise == undefined) { + console.info(TAG + 'Entering CAPTURE_SESSION_RELEASE_PROMISE_TC_053 captureSessionPromise == null || undefined') + } else { + console.info(TAG + 'Entering CAPTURE_SESSION_RELEASE_PROMISE_TC_053 to operate') + await captureSessionPromise.release() + expect(true).assertTrue() + console.info(TAG + 'Entering CAPTURE_SESSION_RELEASE_PROMISE_TC_053 PASSED') + console.info(TAG + 'Entering CAPTURE_SESSION_RELEASE_PROMISE_TC_053 ends here') + await sleep(1) + done() + } + + await sleep(1) + done() + }) + }) +} \ No newline at end of file