diff --git a/multimedia/camera/camera_js_standard/Test.json b/multimedia/camera/camera_js_standard/Test.json index 2c119ed7ec7ddf4c82064d00c58884285fa42bdc..299a6ca6e109bb59dc77cc0fd0f36388bd6744a3 100644 --- a/multimedia/camera/camera_js_standard/Test.json +++ b/multimedia/camera/camera_js_standard/Test.json @@ -5,7 +5,7 @@ "test-timeout": "3000000", "bundle-name":"com.open.harmony.multimedia.cameratest", "package-name": "com.open.harmony.multimedia.cameratest", - "shell-timeout": "60000", + "shell-timeout": "600000", "testcase-timeout": 100000 }, "kits": [ diff --git a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/Camera.test.ets b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/Camera.test.ets index 5c4db823b538aa111d556c7be39511f735185417..1c8f2c96daebca591334adbd3a11c1ff169153aa 100644 --- a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/Camera.test.ets +++ b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/Camera.test.ets @@ -22,9 +22,11 @@ import cameraSessionZoomRatioTest from './CameraSessionZoomRatioTest.test.ets' import cameraSessionVideoStabilizationTest from './CameraSessionVideoStabilizationTest.test.ets' import cameraSessionBaseTest from './CameraSessionBaseTest.test.ets' import cameraInputTest from './CameraInputTest.test.ets' +import CameraErrorCodeUsecaseTest from './CameraErrorCodeUsecaseTest.test.ets' import cameraManagerTest from './CameraManagerTest.test.ets' import cameraEnumTest from './CameraEnumTest.test.ets' + let TAG = 'CameraModuleTest: ' export default function cameraKit() { @@ -37,6 +39,7 @@ export default function cameraKit() { cameraSessionZoomRatioTest() cameraSessionVideoStabilizationTest() cameraSessionBaseTest() + CameraErrorCodeUsecaseTest() cameraManagerTest() cameraEnumTest() } \ No newline at end of file diff --git a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraEnumTest.test.ets b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraEnumTest.test.ets index 5ea47b0c698c6d9b9e374b8ae68c348b93db6ec2..b6e1b4b307fad806f2d61506cb3ed79ff4da00fb 100644 --- a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraEnumTest.test.ets +++ b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraEnumTest.test.ets @@ -96,12 +96,12 @@ export default function cameraEnumTest() { */ it('SUB_MULTIMEDIA_CAMERA_ENUM_CAMERATYPE_0100', 2, async function (done) { console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_CAMERATYPE_0100--------------"); - expect(camera.CameraType.CAMERA_TYPE_UNSPECIFIED == 0).assertTrue(); + console.info("CameraType: "+ JSON.stringify(camera.CameraType)); + expect(camera.CameraType.CAMERA_TYPE_DEFAULT == 0).assertTrue(); expect(camera.CameraType.CAMERA_TYPE_WIDE_ANGLE == 1).assertTrue(); expect(camera.CameraType.CAMERA_TYPE_ULTRA_WIDE == 2).assertTrue(); expect(camera.CameraType.CAMERA_TYPE_TELEPHOTO == 3).assertTrue(); expect(camera.CameraType.CAMERA_TYPE_TRUE_DEPTH == 4).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_CAMERATYPE_0100 ends here"); done(); }) @@ -125,28 +125,6 @@ export default function cameraEnumTest() { }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAINPUTERRORCODE_0100 - * @tc.name : Camera CameraInputErrorCode Eunm - * @tc.desc : Camera CameraInputErrorCode Eunm - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAINPUTERRORCODE_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAINPUTERRORCODE_0100--------------"); - expect(camera.CameraInputErrorCode.ERROR_UNKNOWN == -1).assertTrue(); - expect(camera.CameraInputErrorCode.ERROR_NO_PERMISSION == 0).assertTrue(); - expect(camera.CameraInputErrorCode.ERROR_DEVICE_PREEMPTED == 1).assertTrue(); - expect(camera.CameraInputErrorCode.ERROR_DEVICE_DISCONNECTED == 2).assertTrue(); - expect(camera.CameraInputErrorCode.ERROR_DEVICE_IN_USE == 3).assertTrue(); - expect(camera.CameraInputErrorCode.ERROR_DRIVER_ERROR == 4).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAINPUTERRORCODE_0100 ends here"); - done(); - }) - - /** * @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAFORMAT_0100 * @tc.name : Camera CameraFormat Eunm @@ -260,45 +238,6 @@ export default function cameraEnumTest() { }) - - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_CAPTURESESSIONERRORCODE_0100 - * @tc.name : Camera CaptureSessionErrorCode Eunm - * @tc.desc : Camera CaptureSessionErrorCode Eunm - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_ENUM_CAPTURESESSIONERRORCODE_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_CAPTURESESSIONERRORCODE_0100--------------"); - expect(camera.CaptureSessionErrorCode.ERROR_UNKNOWN == -1).assertTrue(); - expect(camera.CaptureSessionErrorCode.ERROR_INSUFFICIENT_RESOURCES == 0).assertTrue(); - expect(camera.CaptureSessionErrorCode.ERROR_TIMEOUT == 1).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_CAPTURESESSIONERRORCODE_0100 ends here"); - done(); - }) - - - - - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_PREVIEWOUTPUTERRORCODE_0100 - * @tc.name : Camera PreviewOutputErrorCode Eunm - * @tc.desc : Camera PreviewOutputErrorCode Eunm - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_ENUM_PREVIEWOUTPUTERRORCODE_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_PREVIEWOUTPUTERRORCODE_0100--------------"); - expect(camera.PreviewOutputErrorCode.ERROR_UNKNOWN == -1).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_PREVIEWOUTPUTERRORCODE_0100 ends here"); - done(); - }) - - /** * @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_IMAGEROTATION_0100 * @tc.name : Camera ImageRotation Eunm @@ -337,48 +276,6 @@ export default function cameraEnumTest() { }) - - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_PHOTOOUTPUTERRORCODE_0100 - * @tc.name : Camera PhotoOutputErrorCode Eunm - * @tc.desc : Camera PhotoOutputErrorCode Eunm - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_ENUM_PHOTOOUTPUTERRORCODE_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_PHOTOOUTPUTERRORCODE_0100--------------"); - expect(camera.PhotoOutputErrorCode.ERROR_UNKNOWN == -1).assertTrue(); - expect(camera.PhotoOutputErrorCode.ERROR_DRIVER_ERROR == 0).assertTrue(); - expect(camera.PhotoOutputErrorCode.ERROR_INSUFFICIENT_RESOURCES == 1).assertTrue(); - expect(camera.PhotoOutputErrorCode.ERROR_TIMEOUT == 2).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_PHOTOOUTPUTERRORCODE_0100 ends here"); - done(); - }) - - - - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_VIDEOOUTPUTERRORCODE_0100 - * @tc.name : Camera VideoOutputErrorCode Eunm - * @tc.desc : Camera VideoOutputErrorCode Eunm - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_ENUM_VIDEOOUTPUTERRORCODE_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_VIDEOOUTPUTERRORCODE_0100--------------"); - expect(camera.VideoOutputErrorCode.ERROR_UNKNOWN == -1).assertTrue(); - expect(camera.VideoOutputErrorCode.ERROR_DRIVER_ERROR == 0).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_VIDEOOUTPUTERRORCODE_0100 ends here"); - done(); - }) - - - - /** * @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_METADATAOBJECTTYPE_0100 * @tc.name : Camera MetadataObjectType Eunm @@ -396,21 +293,27 @@ export default function cameraEnumTest() { /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_METADATAOUTPUTERRORCODE_0100 - * @tc.name : Camera MetadataOutputErrorCode Eunm - * @tc.desc : Camera MetadataOutputErrorCode Eunm + * @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAERRORCODE_0100 + * @tc.name : Camera CameraErrorCode Eunm + * @tc.desc : Camera CameraErrorCode Eunm * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 2 */ - it('SUB_MULTIMEDIA_CAMERA_ENUM_METADATAOUTPUTERRORCODE_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_METADATAOUTPUTERRORCODE_0100--------------"); - expect(camera.MetadataOutputErrorCode.ERROR_UNKNOWN == -1).assertTrue(); - expect(camera.MetadataOutputErrorCode.ERROR_INSUFFICIENT_RESOURCES == 0).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_METADATAOUTPUTERRORCODE_0100 ends here"); + it('SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAERRORCODE_0100', 2, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAERRORCODE_0100--------------"); + expect(camera.CameraErrorCode.INVALID_ARGUMENT == 7400101).assertTrue(); + expect(camera.CameraErrorCode.OPERATION_NOT_ALLOWED == 7400102).assertTrue(); + expect(camera.CameraErrorCode.SESSION_NOT_CONFIG == 7400103).assertTrue(); + expect(camera.CameraErrorCode.SESSION_NOT_RUNNING == 7400104).assertTrue(); + expect(camera.CameraErrorCode.SESSION_CONFIG_LOCKED == 7400105).assertTrue(); + expect(camera.CameraErrorCode.DEVICE_SETTING_LOCKED == 7400106).assertTrue(); + expect(camera.CameraErrorCode.CONFILICT_CAMERA == 7400107).assertTrue(); + expect(camera.CameraErrorCode.DEVICE_DISABLED == 7400108).assertTrue(); + expect(camera.CameraErrorCode.SERVICE_FATAL_ERROR == 7400201).assertTrue(); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAERRORCODE_0100 ends here"); done(); }) - }) } \ No newline at end of file diff --git a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraErrorCodeUsecaseTest.test.ets b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraErrorCodeUsecaseTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..43a7504ed5957e5eed1044828659a873e0428197 --- /dev/null +++ b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraErrorCodeUsecaseTest.test.ets @@ -0,0 +1,2600 @@ +/* + * 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 media from '@ohos.multimedia.media'; +import mediaLibrary from '@ohos.multimedia.mediaLibrary'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'; + +// 创建视频录制的参数 +let videoProfile = { + audioBitrate: 48000, + audioChannels: 2, + audioCodec: 'audio/mp4a-latm', + audioSampleRate: 48000, + fileFormat: 'mp4', + videoBitrate: 48000, + videoCodec: 'video/mp4v-es', + videoFrameWidth: 640, + videoFrameHeight: 480, + videoFrameRate: 30 + } + +let videoConfig = { + audioSourceType: 1, + videoSourceType: 0, + profile: videoProfile, + url: 'file:///data/media/CameraOutput.mp4', + orientationHint: 0, + location: { latitude: 30, longitude: 130 }, + maxSize: 100, + maxDuration: 500 + } + + let captureLocation = { + latitude: 0, + longitude: 0, + altitude: 0, + } + + let captureSetting = { + quality: cameraObj.QualityLevel.QUALITY_LEVEL_LOW, + rotation: cameraObj.ImageRotation.ROTATION_0, + location: captureLocation, + mirror: false + } + +const TAG = "CameraErrorCodeUsecaseTest: "; +let mCameraManager; +let cameraOutputCap; +let mCameraDevicesArray; +let mCameraSession; +let mCameraNum; +let mCameraInput; +let mPreviewOutput; +let mPhotoSurface; +let mPhotoOutput; +let videoOutput; +let videoRecorder; +let videoSurfaceId; +let fdPath; +let fileAsset; +let fdNumber; +let metadataOutput; +let mMetadataObjectTypeArray; + +export default function CameraErrorCodeUsecaseTest() { + function sleep(ms) { + console.info(TAG + "Entering sleep -> Promise constructor"); + return new Promise(resolve => setTimeout(resolve, ms)); + } + + function isEmpty(data) { + if (data == null || data == undefined) { + return true; + } + return false; + } + + function getCameraManagerInstance() { + console.info(TAG + 'Enter getCameraManagerInstance'); + mCameraManager = cameraObj.getCameraManager(null); + if (isEmpty(mCameraManager)) { + console.info(TAG + "getCameraManager FAILED"); + return false; + } + console.info(TAG + 'Exit getCameraManagerInstance'); + return true; + } + + function getCameraSupportDevicesArray() { + console.info(TAG + 'Enter getCameraSupportDevicesArray'); + mCameraDevicesArray = mCameraManager.getSupportedCameras(); + if (isEmpty(mCameraDevicesArray)) { + console.info(TAG + "getSupportedCameras FAILED"); + return false; + } + mCameraNum = mCameraDevicesArray.length; + console.info(TAG + "getCameraSupportDevicesArray is: " + mCameraNum); + console.info(TAG + 'Exit getCameraSupportDevicesArray'); + return true; + } + + async function createInput(idx:any) { + console.info(TAG + 'Enter createInput'); + if (isEmpty(mCameraDevicesArray)) { + console.info(TAG + "Entering createInputs FAILED with NoCamera"); + return false; + } + mCameraInput = mCameraManager.createCameraInput(mCameraDevicesArray[idx]); + if (isEmpty(mCameraInput)) { + console.info(TAG + "createCameraInput FAILED"); + return false; + } + await mCameraInput.open(); + sleep(100); + console.info(idx + 'th CameraInput is: ' + mCameraInput); + console.info(TAG + 'Exit createInput'); + return true; + } + + async function releaseInput() { + console.info(TAG + 'Enter releaseInput'); + + if (!isEmpty(mCameraInput)) { + await mCameraInput.close(); + } + + console.info(TAG + 'Exit releaseInput'); + + return true; + } + + function beginCameraSessionConfig() { + console.info(TAG + 'Enter beginCameraSessionConfig'); + mCameraSession.beginConfig(); + console.info(TAG + 'Exit beginCameraSessionConfig'); + return true; + } + + async function commitCameraSessionConfig() { + console.info(TAG + 'Enter commitCameraSessionConfig'); + await mCameraSession.commitConfig(); + sleep(500); + console.info(TAG + 'Exit commitCameraSessionConfig'); + return true; + } + + function createCameraSessionInstance() { + console.info(TAG + 'Enter createCameraSessionInstance'); + try { + mCameraSession = mCameraManager.createCaptureSession(); + } + catch { + console.info(TAG + 'createCaptureSession FAILED'); + } + if (isEmpty(mCameraSession)) { + console.info(TAG + "createCaptureSession FAILED"); + return false; + } + beginCameraSessionConfig(); + console.info(TAG + 'Exit createCameraSessionInstance'); + return true; + } + + function releaseCameraSessionInstance() { + mCameraSession.release(); + } + + async function getPhotoReceiverSurface() { + console.log(TAG + 'Entering getPhotoReceiverSurface') + let receiver = image.createImageReceiver(640, 480, 4, 8) + console.log(TAG + 'before receiver check') + if (receiver !== undefined) { + console.log(TAG + 'Photo receiver is created successfully') + mPhotoSurface = await receiver.getReceivingSurfaceId() + console.log(TAG + 'Photo received id: ' + JSON.stringify(mPhotoSurface)) + } else { + console.log(TAG + 'Photo receiver is created failed') + } + console.log(TAG + 'Exit getPhotoReceiverSurface') + } + + async function getFd(pathName) { + let displayName = pathName; + const mediaTest = mediaLibrary.getMediaLibrary(); + let fileKeyObj = mediaLibrary.FileKey; + let mediaType = mediaLibrary.MediaType.VIDEO; + let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO); + let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath); + if (dataUri != undefined) { + let args = dataUri.id.toString(); + let fetchOp = { + selections: fileKeyObj.ID + "=?", + selectionArgs: [args], + } + let fetchFileResult = await mediaTest.getFileAssets(fetchOp); + fileAsset = await fetchFileResult.getAllObject(); + fdNumber = await fileAsset[0].open('Rw'); + fdPath = "fd://" + fdNumber.toString(); + } + } + + async function closeFd() { + if (fileAsset != null) { + await fileAsset[0].close(fdNumber).then(() => { + console.info('[mediaLibrary] case close fd success'); + }).catch((err) => { + console.info('[mediaLibrary] case close fd failed'); + }); + } else { + console.info('[mediaLibrary] case fileAsset is null'); + } + } + + async function getvideosurface() { + await getFd('ErrorCodeCameraOutput.mp4'); + videoConfig.url = fdPath; + media.createVideoRecorder((err, recorder) => { + if (!err) { + 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) => { + if (!err) { + console.info(TAG + 'videoRecorder.prepare success.') + videoRecorder.getInputSurface((err, id) => { + console.info(TAG + 'getInputSurface called') + if (!err) { + videoSurfaceId = id + console.info(TAG + 'getInputSurface surfaceId: ' + JSON.stringify(videoSurfaceId)) + } else { + console.info(TAG + 'getInputSurface FAILED') + } + }) + } else { + console.info(TAG + 'prepare FAILED') + } + }) + } + else { + console.info(TAG + 'createVideoRecorder FAILED') + } + }) + } + + async function releaseVideoReceiveSurface() { + console.log(TAG + 'Entering releaseVideoReceiveSurface') + videoRecorder.release((err) => { + console.info(TAG + 'Entering release video receiver') + }) + await closeFd(); + console.log(TAG + 'Exit releaseVideoReceiveSurface') + } + + function createOutput(idx:any) { + console.info(TAG + 'Enter createOutput'); + cameraOutputCap = mCameraManager.getSupportedOutputCapability(mCameraDevicesArray[idx]); + if (!isEmpty(cameraOutputCap)) { + if (!isEmpty(cameraOutputCap.previewProfiles)) { + console.info(TAG + "cameraOutputCap.previewProfiles.length: " + cameraOutputCap.previewProfiles.length); + for (let i = 0; i < cameraOutputCap.previewProfiles.length; i++) { + mPreviewOutput = mCameraManager.createPreviewOutput(cameraOutputCap.previewProfiles[i], globalThis.surfaceId); + if (!isEmpty(mPreviewOutput)) { + break; + } + } + if (isEmpty(mPreviewOutput)) { + console.info(TAG + "createPreviewOutput FAILED"); + } + console.info(TAG + "createPreviewOutput: " + mPreviewOutput); + } + } + if (!isEmpty(cameraOutputCap.photoProfiles)) { + console.info(TAG + "cameraOutputCap.photoProfiles.length: " + cameraOutputCap.photoProfiles.length); + + for (let i = 0; i < cameraOutputCap.photoProfiles.length; i++) { + mPhotoOutput = mCameraManager.createPhotoOutput(cameraOutputCap.photoProfiles[i], mPhotoSurface); + if (!isEmpty(mPhotoOutput)) { + break; + } + } + if (isEmpty(mPhotoOutput)) { + console.info(TAG + "createPhotoOutput FAILED"); + } + console.info(TAG + "createPhotoOutput: " + mPhotoOutput); + } + if (!isEmpty(cameraOutputCap.supportedMetadataObjectTypes)) { + mMetadataObjectTypeArray = cameraOutputCap.supportedMetadataObjectTypes; + if (isEmpty(mMetadataObjectTypeArray)) { + console.info(TAG + "mMetadataObjectTypeArray is null"); + } else { + console.info(TAG + "createMetadataOutput") + metadataOutput = mCameraManager.createMetadataOutput(mMetadataObjectTypeArray); + } + } + console.info(TAG + 'Exit createOutputs'); + return true; + } + + describe('CameraErrorCodeUsecaseTest', function () { + console.info(TAG + '----------CameraErrorCodeUsecaseTest--------------'); + beforeAll(async function () { + await getPhotoReceiverSurface(); + await getvideosurface(); + getCameraManagerInstance(); + getCameraSupportDevicesArray(); + console.info(TAG + 'beforeAll case'); + }) + + beforeEach(function () { + sleep(1000); + console.info('beforeEach case'); + }) + + afterEach(async function () { + console.info('afterEach case'); + }) + + afterAll(function () { + releaseVideoReceiveSurface(); + sleep(1000); + console.info('afterAll case'); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_CAMERA_INPUT_0100 + * @tc.name : createCameraInput api + * @tc.desc : createCameraInput api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_CAMERA_INPUT_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_CAMERA_INPUT_0100--------------"); + if (isEmpty(mCameraManager)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_CAMERA_INPUT_0100 cameraManager == null || undefined") + expect().assertFail(); + done(); + } else { + try { + let camerainput = mCameraManager.createCameraInput(); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_CAMERA_INPUT_0100 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.INVALID_ARGUMENT).assertTrue(); + expect(true).assertTrue(); + } + done(); + } + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_CAMERA_INPUT_0200 + * @tc.name : createCameraInput api + * @tc.desc : createCameraInput api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_CAMERA_INPUT_0200', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_CAMERA_INPUT_0200--------------"); + if (isEmpty(mCameraManager)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_CAMERA_INPUT_0200 cameraManager == null || undefined") + expect().assertFail(); + done(); + } else { + try { + let camerainput = mCameraManager.createCameraInput("cameraInput"); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_CAMERA_INPUT_0200 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.INVALID_ARGUMENT).assertTrue(); + expect(true).assertTrue(); + } + done(); + } + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_CAMERA_INPUT_0300 + * @tc.name : createCameraInput api + * @tc.desc : createCameraInput api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_CAMERA_INPUT_0300', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_CAMERA_INPUT_0300--------------"); + if (isEmpty(mCameraManager)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_CAMERA_INPUT_0300 cameraManager == null || undefined") + expect().assertFail(); + done(); + } else { + try { + let camerainput = mCameraManager.createCameraInput(null,"cameraInput"); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_CAMERA_INPUT_0300 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.INVALID_ARGUMENT).assertTrue(); + expect(true).assertTrue(); + } + done(); + } + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_CAMERA_INPUT_0400 + * @tc.name : createCameraInput api + * @tc.desc : createCameraInput api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_CAMERA_INPUT_0400', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_CAMERA_INPUT_0400--------------"); + if (isEmpty(mCameraManager)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_CAMERA_INPUT_0400 cameraManager == null || undefined") + expect().assertFail(); + done(); + } else { + try { + let camerainput = mCameraManager.createCameraInput(null); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_CAMERA_INPUT_0400 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.INVALID_ARGUMENT).assertTrue(); + expect(true).assertTrue(); + } + done(); + } + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_PREVIEW_OUTPUT_0100 + * @tc.name : createPreviewOutput api + * @tc.desc : createPreviewOutput api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_PREVIEW_OUTPUT_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_PREVIEW_OUTPUT_0100--------------"); + if (isEmpty(mCameraManager)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_PREVIEW_OUTPUT_0100 cameraManager == null || undefined") + expect().assertFail(); + done(); + } else { + try { + let previewoutput = mCameraManager.createPreviewOutput(null); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_PREVIEW_OUTPUT_0100 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.INVALID_ARGUMENT).assertTrue(); + expect(true).assertTrue(); + } + done(); + } + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_PREVIEW_OUTPUT_0200 + * @tc.name : createPreviewOutput api + * @tc.desc : createPreviewOutput api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_PREVIEW_OUTPUT_0200', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_PREVIEW_OUTPUT_0200--------------"); + if (isEmpty(mCameraManager)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_PREVIEW_OUTPUT_0200 cameraManager == null || undefined") + expect().assertFail(); + done(); + } else { + try { + let previewoutput = mCameraManager.createPreviewOutput(null,"createoutput"); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_PREVIEW_OUTPUT_0200 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.INVALID_ARGUMENT).assertTrue(); + expect(true).assertTrue(); + } + done(); + } + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_PHOTO_OUTPUT_0100 + * @tc.name : createPhotoOutput api + * @tc.desc : createPhotoOutput api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_PHOTO_OUTPUT_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_PHOTO_OUTPUT_0100--------------"); + if (isEmpty(mCameraManager)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_PHOTO_OUTPUT_0100 cameraManager == null || undefined") + expect().assertFail(); + done(); + } else { + try { + let photooutput = mCameraManager.createPhotoOutput(null,"createoutput"); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_PHOTO_OUTPUT_0100 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.INVALID_ARGUMENT).assertTrue(); + expect(true).assertTrue(); + } + done(); + } + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_PHOTO_OUTPUT_0200 + * @tc.name : createPhotoOutput api + * @tc.desc : createPhotoOutput api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_PHOTO_OUTPUT_0200', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_PHOTO_OUTPUT_0200--------------"); + if (isEmpty(mCameraManager)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_PHOTO_OUTPUT_0200 cameraManager == null || undefined") + expect().assertFail(); + done(); + } else { + try { + let photooutput = mCameraManager.createPhotoOutput(null); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_PHOTO_OUTPUT_0200 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.INVALID_ARGUMENT).assertTrue(); + expect(true).assertTrue(); + } + done(); + } + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_VIDEO_OUTPUT_0100 + * @tc.name : createVideoOutput api + * @tc.desc : createVideoOutput api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_VIDEO_OUTPUT_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_VIDEO_OUTPUT_0100--------------"); + if (isEmpty(mCameraManager)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_VIDEO_OUTPUT_0100 cameraManager == null || undefined") + expect().assertFail(); + done(); + } else { + try { + let videooutput = mCameraManager.createVideoOutput(null); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_VIDEO_OUTPUT_0100 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.INVALID_ARGUMENT).assertTrue(); + expect(true).assertTrue(); + } + done(); + } + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_VIDEO_OUTPUT_0200 + * @tc.name : createVideoOutput api + * @tc.desc : createVideoOutput api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_VIDEO_OUTPUT_0200', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_VIDEO_OUTPUT_0200--------------"); + if (isEmpty(mCameraManager)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_VIDEO_OUTPUT_0200 cameraManager == null || undefined") + expect().assertFail(); + done(); + } else { + try { + let videooutput = mCameraManager.createVideoOutput(null,"createoutput"); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_VIDEO_OUTPUT_0200 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.INVALID_ARGUMENT).assertTrue(); + expect(true).assertTrue(); + } + done(); + } + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_METADATA_OUTPUT_0100 + * @tc.name : createMetadataOutput api + * @tc.desc : createMetadataOutput api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_METADATA_OUTPUT_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_METADATA_OUTPUT_0100--------------"); + if (isEmpty(mCameraManager)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_METADATA_OUTPUT_0100 cameraManager == null || undefined") + expect().assertFail(); + done(); + } else { + try { + let videooutput = mCameraManager.createMetadataOutput(null); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_METADATA_OUTPUT_0100 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.INVALID_ARGUMENT).assertTrue(); + expect(true).assertTrue(); + } + done(); + } + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_METADATA_OUTPUT_0200 + * @tc.name : createMetadataOutput api + * @tc.desc : createMetadataOutput api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_METADATA_OUTPUT_0200', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_METADATA_OUTPUT_0200--------------"); + if (isEmpty(mCameraManager)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_METADATA_OUTPUT_0200 cameraManager == null || undefined") + expect().assertFail(); + done(); + } else { + try { + let metadataoutput = mCameraManager.createMetadataOutput(); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CREATE_METADATA_OUTPUT_0200 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.INVALID_ARGUMENT).assertTrue(); + expect(true).assertTrue(); + } + done(); + } + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_ADD_INPUT_0100 + * @tc.name : addInput api + * @tc.desc : addInput api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_ADD_INPUT_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_ADD_INPUT_0100--------------"); + createCameraSessionInstance(); + try { + mCameraSession.addInput(null); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_ADD_INPUT_0100 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.INVALID_ARGUMENT).assertTrue(); + expect(true).assertTrue(); + } + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_ADD_INPUT_0200 + * @tc.name : addInput api + * @tc.desc : addInput api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_ADD_INPUT_0200', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_ADD_INPUT_0200--------------"); + createCameraSessionInstance(); + try { + mCameraSession.addInput(); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_ADD_INPUT_0200 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.INVALID_ARGUMENT).assertTrue(); + expect(true).assertTrue(); + } + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_REMOVE_INPUT_0100 + * @tc.name : removeInput api + * @tc.desc : removeInput api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_REMOVE_INPUT_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_REMOVE_INPUT_0100--------------"); + createCameraSessionInstance(); + try { + mCameraSession.removeInput(); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_REMOVE_INPUT_0100 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.INVALID_ARGUMENT).assertTrue(); + expect(true).assertTrue(); + } + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_REMOVE_INPUT_0200 + * @tc.name : removeInput api + * @tc.desc : removeInput api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_REMOVE_INPUT_0200', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_REMOVE_INPUT_0200--------------"); + createCameraSessionInstance(); + try { + mCameraSession.removeInput(null); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_REMOVE_INPUT_0200 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.INVALID_ARGUMENT).assertTrue(); + expect(true).assertTrue(); + } + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_ADD_OUTPUT_0100 + * @tc.name : addOutput api + * @tc.desc : addOutput api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_ADD_OUTPUT_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_ADD_OUTPUT_0100--------------"); + createCameraSessionInstance(); + try { + mCameraSession.addOutput(); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_ADD_OUTPUT_0100 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.INVALID_ARGUMENT).assertTrue(); + expect(true).assertTrue(); + } + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_ADD_OUTPUT_0200 + * @tc.name : addOutput api + * @tc.desc : addOutput api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_ADD_OUTPUT_0200', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_ADD_OUTPUT_0200--------------"); + createCameraSessionInstance(); + try { + mCameraSession.addOutput(null); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_ADD_OUTPUT_0200 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.INVALID_ARGUMENT).assertTrue(); + expect(true).assertTrue(); + } + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_REMOVE_OUTPUT_0100 + * @tc.name : removeOutput api + * @tc.desc : removeOutput api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_REMOVE_OUTPUT_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_REMOVE_OUTPUT_0100--------------"); + createCameraSessionInstance(); + try { + mCameraSession.removeOutput(); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_REMOVE_OUTPUT_0100 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.INVALID_ARGUMENT).assertTrue(); + expect(true).assertTrue(); + } + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_REMOVE_OUTPUT_0200 + * @tc.name : removeOutput api + * @tc.desc : removeOutput api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_REMOVE_OUTPUT_0200', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_REMOVE_OUTPUT_0200--------------"); + createCameraSessionInstance(); + try { + mCameraSession.removeOutput(null); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_REMOVE_OUTPUT_0200 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.INVALID_ARGUMENT).assertTrue(); + expect(true).assertTrue(); + } + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PHOTOOUTPUT_CAPTURE_0200 + * @tc.name : photoOutput capture api + * @tc.desc : photoOutput capture api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PHOTOOUTPUT_CAPTURE_0200', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PHOTOOUTPUT_CAPTURE_0200--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + await commitCameraSessionConfig(); + await mCameraSession.start(); + mPhotoOutput.capture({},async (err) => { + if (!err) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PHOTOOUTPUT_CAPTURE_0200 success"); + } else { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PHOTOOUTPUT_CAPTURE_0200 FAILED"); + console.info(TAG + "ERRORCODE: " + err.code); + expect(err.code == cameraObj.CameraErrorCode.INVALID_ARGUMENT).assertTrue(); + + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + } + }) + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PHOTOOUTPUT_CAPTURE_0400 + * @tc.name : photoOutput capture api + * @tc.desc : photoOutput capture api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PHOTOOUTPUT_CAPTURE_0400', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PHOTOOUTPUT_CAPTURE_0400--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + await commitCameraSessionConfig(); + await mCameraSession.start(); + await mPhotoOutput.capture({}).then((result) => { + console.info('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PHOTOOUTPUT_CAPTURE_0400 success :' + result); + }).catch((err) => { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PHOTOOUTPUT_CAPTURE_0400 FAILED"); + console.info(TAG + "ERRORCODE: " + err.code); + expect(err.code == cameraObj.CameraErrorCode.INVALID_ARGUMENT).assertTrue(); + expect(true).assertTrue(); + }); + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_COMMITCONFIG_0100 + * @tc.name : commitConfig api + * @tc.desc : commitConfig api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_COMMITCONFIG_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_COMMITCONFIG_0100--------------"); + await createInput(0); + mCameraSession = mCameraManager.createCaptureSession(); + mCameraSession.commitConfig(async (err) => { + if (!err) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_COMMITCONFIG_0100 success"); + } else { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_COMMITCONFIG_0100 FAILED"); + console.info(TAG + "ERRORCODE: " + err.code); + expect(err.code == cameraObj.CameraErrorCode.OPERATION_NOT_ALLOWED).assertTrue(); + expect(true).assertTrue(); + } + }) + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_COMMITCONFIG_0200 + * @tc.name : commitConfig api + * @tc.desc : commitConfig api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_COMMITCONFIG_0200', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_COMMITCONFIG_0200--------------"); + await createInput(0); + mCameraSession = mCameraManager.createCaptureSession(); + await mCameraSession.commitConfig().then((result) => { + console.info('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_COMMITCONFIG_0200 success :' + result); + }).catch((err) => { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_COMMITCONFIG_0200 FAILED"); + console.info(TAG + "ERRORCODE: " + err.code); + expect(err.code == cameraObj.CameraErrorCode.OPERATION_NOT_ALLOWED).assertTrue(); + expect(true).assertTrue(); + }); + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_ADD_INPUT_0300 + * @tc.name : addInput api + * @tc.desc : addInput api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_ADD_INPUT_0300', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_ADD_INPUT_0300--------------"); + await createInput(0); + mCameraSession = mCameraManager.createCaptureSession(); + try { + mCameraSession.addInput(mCameraInput); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_ADD_INPUT_0300 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.OPERATION_NOT_ALLOWED).assertTrue(); + expect(true).assertTrue(); + } + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_REMOVE_INPUT_0300 + * @tc.name : removeInput api + * @tc.desc : removeInput api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_REMOVE_INPUT_0300', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_REMOVE_INPUT_0300--------------"); + await createInput(0); + mCameraSession = mCameraManager.createCaptureSession(); + try { + mCameraSession.removeInput(mCameraInput); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_REMOVE_INPUT_0300 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.OPERATION_NOT_ALLOWED).assertTrue(); + expect(true).assertTrue(); + } + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_ADD_OUTPUT_0300 + * @tc.name : addOutput api + * @tc.desc : addOutput api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_ADD_OUTPUT_0300', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_ADD_OUTPUT_0300--------------"); + await createInput(0); + mCameraSession = mCameraManager.createCaptureSession(); + createOutput(0); + try { + mCameraSession.addOutput(mPreviewOutput); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_ADD_OUTPUT_0300 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.OPERATION_NOT_ALLOWED).assertTrue(); + expect(true).assertTrue(); + } + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_REMOVE_OUTPUT_0300 + * @tc.name : removeOutput api + * @tc.desc : removeOutput api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_REMOVE_OUTPUT_0300', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_REMOVE_OUTPUT_0300--------------"); + await createInput(0); + mCameraSession = mCameraManager.createCaptureSession(); + createOutput(0); + try { + mCameraSession.removeOutput(mPreviewOutput); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_REMOVE_OUTPUT_0300 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.OPERATION_NOT_ALLOWED).assertTrue(); + expect(true).assertTrue(); + } + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_START_0100 + * @tc.name : capturesession start api + * @tc.desc : capturesession start api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_START_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_START_0100--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + mCameraSession.start().then((result) => { + console.info('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_START_0100 success :' + result); + }).catch((err) => { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_START_0100 FAILED"); + console.info(TAG + "ERRORCODE: " + err.code); + console.info(TAG + "cameraObj.CameraErrorCode.SESSION_NOT_CONFIG: " + cameraObj.CameraErrorCode.SESSION_NOT_CONFIG); + expect(err.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue(); + expect(true).assertTrue(); + }); + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_START_0200 + * @tc.name : capturesession start api + * @tc.desc : capturesession start api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_START_0200', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_START_0200--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + mCameraSession.start(async (err) => { + if (!err) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_START_0200 success"); + } else { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_START_0200 FAILED"); + console.info(TAG + "ERRORCODE: " + err.code); + console.info(TAG + "cameraObj.CameraErrorCode.SESSION_NOT_CONFIG: " + cameraObj.CameraErrorCode.SESSION_NOT_CONFIG); + expect(err.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue(); + } + }) + sleep(1000); + await releaseInput(); + sleep(1000); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_HASFLASH_0100 + * @tc.name : capturesession hasFlash api + * @tc.desc : capturesession hasFlash api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_HASFLASH_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_HASFLASH_0100--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + try{ + let isFlash = mCameraSession.hasFlash(); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_HASFLASH_0100 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + console.info(TAG + "cameraObj.CameraErrorCode.SESSION_NOT_CONFIG: " + cameraObj.CameraErrorCode.SESSION_NOT_CONFIG); + expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue(); + }; + sleep(1000); + await releaseInput(); + sleep(1000); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_ISFLASHMODESUPPORTED_0100 + * @tc.name : capturesession isFlashModeSupported api + * @tc.desc : capturesession isFlashModeSupported api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_ISFLASHMODESUPPORTED_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_ISFLASHMODESUPPORTED_0100--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + try{ + let isFlashmodesupported = mCameraSession.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_AUTO); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_ISFLASHMODESUPPORTED_0100 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue(); + expect(true).assertTrue(); + }; + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETFLASHMODE_0100 + * @tc.name : capturesession getFlashMode api + * @tc.desc : capturesession getFlashMode api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETFLASHMODE_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETFLASHMODE_0100--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + try{ + let flashmode = mCameraSession.getFlashMode(); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETFLASHMODE_0100 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue(); + expect(true).assertTrue(); + }; + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETFLASHMODE_0100 + * @tc.name : capturesession setFlashMode api + * @tc.desc : capturesession setFlashMode api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETFLASHMODE_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETFLASHMODE_0100--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + try{ + mCameraSession.setFlashMode(cameraObj.FlashMode.FLASH_MODE_AUTO); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETFLASHMODE_0100 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue(); + expect(true).assertTrue(); + }; + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETFLASHMODE_0101 + * @tc.name : capturesession setFlashMode api + * @tc.desc : capturesession setFlashMode api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETFLASHMODE_0101', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETFLASHMODE_0101--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + await commitCameraSessionConfig(); + await mCameraSession.start(); + try{ + mCameraSession.setFlashMode(5); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETFLASHMODE_0101 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code != cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue(); + }; + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_ISEXPOSUREMODESUPPORTED_0100 + * @tc.name : capturesession isExposureModeSupported api + * @tc.desc : capturesession isExposureModeSupported api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_ISEXPOSUREMODESUPPORTED_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_ISEXPOSUREMODESUPPORTED_0100--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + try{ + let issupported = mCameraSession.isExposureModeSupported(cameraObj.ExposureMode.EXPOSURE_MODE_AUTO); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_ISEXPOSUREMODESUPPORTED_0100 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue(); + expect(true).assertTrue(); + }; + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETEXPOSUREMODE_0100 + * @tc.name : capturesession getExposureMode api + * @tc.desc : capturesession getExposureMode api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETEXPOSUREMODE_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETEXPOSUREMODE_0100--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + try{ + let exposure = mCameraSession.getExposureMode(); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETEXPOSUREMODE_0100 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue(); + expect(true).assertTrue(); + }; + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETEXPOSUREMODE_0100 + * @tc.name : capturesession setExposureMode api + * @tc.desc : capturesession setExposureMode api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETEXPOSUREMODE_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETEXPOSUREMODE_0100--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + try{ + mCameraSession.setExposureMode(cameraObj.ExposureMode.EXPOSURE_MODE_AUTO); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETEXPOSUREMODE_0100 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue(); + }; + sleep(1000); + await releaseInput(); + sleep(1000); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETEXPOSUREMODE_0101 + * @tc.name : capturesession setExposureMode api + * @tc.desc : capturesession setExposureMode api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETEXPOSUREMODE_0101', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETEXPOSUREMODE_0101--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + await commitCameraSessionConfig(); + await mCameraSession.start(); + try{ + mCameraSession.setExposureMode(5); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETEXPOSUREMODE_0101 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code != cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue(); + }; + sleep(1000); + await releaseInput(); + sleep(1000); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETMETERINGPOINT_0100 + * @tc.name : capturesession getMeteringPoint api + * @tc.desc : capturesession getMeteringPoint api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETMETERINGPOINT_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETMETERINGPOINT_0100--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + try{ + let point = mCameraSession.getMeteringPoint(); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETMETERINGPOINT_0100 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue(); + expect(true).assertTrue(); + }; + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETMETERINGPOINT_0100 + * @tc.name : capturesession setMeteringPoint api + * @tc.desc : capturesession setMeteringPoint api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETMETERINGPOINT_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETMETERINGPOINT_0100--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + try{ + mCameraSession.setMeteringPoint({x:1,y:1}); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETMETERINGPOINT_0100 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue(); + expect(true).assertTrue(); + }; + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETMETERINGPOINT_0101 + * @tc.name : capturesession setMeteringPoint api + * @tc.desc : capturesession setMeteringPoint api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETMETERINGPOINT_0101', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETMETERINGPOINT_0101--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + await commitCameraSessionConfig(); + await mCameraSession.start(); + try{ + mCameraSession.setMeteringPoint({x:-1,y:-1}); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETMETERINGPOINT_0101 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code != cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue(); + }; + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETEXPOSUREBIASRANGE_0100 + * @tc.name : capturesession getExposureBiasRange api + * @tc.desc : capturesession getExposureBiasRange api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETEXPOSUREBIASRANGE_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETEXPOSUREBIASRANGE_0100--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + try{ + let range = mCameraSession.getExposureBiasRange(); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETEXPOSUREBIASRANGE_0100 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue(); + expect(true).assertTrue(); + }; + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETEXPOSUREBIAS_0100 + * @tc.name : capturesession setExposureBias api + * @tc.desc : capturesession setExposureBias api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETEXPOSUREBIAS_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETEXPOSUREBIAS_0100--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + try{ + let range = mCameraSession.getExposureBiasRange(); + mCameraSession.setExposureBias(range[0]); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETEXPOSUREBIAS_0100 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue(); + expect(true).assertTrue(); + }; + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETEXPOSUREBIAS_0101 + * @tc.name : capturesession setExposureBias api + * @tc.desc : capturesession setExposureBias api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETEXPOSUREBIAS_0101', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETEXPOSUREBIAS_0101--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + await commitCameraSessionConfig(); + await mCameraSession.start(); + try{ + let range = mCameraSession.getExposureBiasRange(); + mCameraSession.setExposureBias(-101); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETEXPOSUREBIAS_0101 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code != cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue(); + }; + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETEXPOSUREVALUE_0100 + * @tc.name : capturesession getExposureValue api + * @tc.desc : capturesession getExposureValue api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETEXPOSUREVALUE_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETEXPOSUREVALUE_0100--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + try{ + let value = mCameraSession.getExposureValue(); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETEXPOSUREVALUE_0100 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue(); + expect(true).assertTrue(); + }; + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_ISFOCUSMODESUPPORTED_0100 + * @tc.name : capturesession isFocusModeSupported api + * @tc.desc : capturesession isFocusModeSupported api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_ISFOCUSMODESUPPORTED_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_ISFOCUSMODESUPPORTED_0100--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + try{ + let issupported = mCameraSession.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_ISFOCUSMODESUPPORTED_0100 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue(); + expect(true).assertTrue(); + }; + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETFOCUSMODE_0100 + * @tc.name : capturesession getFocusMode api + * @tc.desc : capturesession getFocusMode api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETFOCUSMODE_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETFOCUSMODE_0100--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + try{ + let focusmode = mCameraSession.getFocusMode(); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETFOCUSMODE_0100 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue(); + expect(true).assertTrue(); + }; + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETFOCUSMODE_0100 + * @tc.name : capturesession setFocusMode api + * @tc.desc : capturesession setFocusMode api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETFOCUSMODE_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETFOCUSMODE_0100--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + try{ + mCameraSession.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_MANUAL); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETFOCUSMODE_0100 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue(); + }; + sleep(1000); + await releaseInput(); + sleep(1000); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETFOCUSMODE_0101 + * @tc.name : capturesession setFocusMode api + * @tc.desc : capturesession setFocusMode api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETFOCUSMODE_0101', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETFOCUSMODE_0101--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + await commitCameraSessionConfig(); + await mCameraSession.start(); + try{ + mCameraSession.setFocusMode(5); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETFOCUSMODE_0101 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code != cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue(); + }; + sleep(1000); + await releaseInput(); + sleep(1000); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETFOCUSPOINT_0100 + * @tc.name : capturesession setFocusPoint api + * @tc.desc : capturesession setFocusPoint api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETFOCUSPOINT_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETFOCUSPOINT_0100--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + try{ + mCameraSession.setFocusPoint({x:1,y:1}); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETFOCUSPOINT_0100 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue(); + expect(true).assertTrue(); + }; + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETFOCUSPOINT_0101 + * @tc.name : capturesession setFocusPoint api + * @tc.desc : capturesession setFocusPoint api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETFOCUSPOINT_0101', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETFOCUSPOINT_0101--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + await commitCameraSessionConfig(); + await mCameraSession.start(); + try{ + mCameraSession.setFocusPoint({x:-1,y:-1}); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETFOCUSPOINT_0101 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code != cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue(); + }; + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETFOCUSPOINT_0100 + * @tc.name : capturesession getFocusPoint api + * @tc.desc : capturesession getFocusPoint api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETFOCUSPOINT_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETFOCUSPOINT_0100--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + try{ + let point = mCameraSession.getFocusPoint(); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETFOCUSPOINT_0100 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue(); + expect(true).assertTrue(); + }; + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETFOCUSLENGTH_0100 + * @tc.name : capturesession getFocalLength api + * @tc.desc : capturesession getFocalLength api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETFOCUSLENGTH_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETFOCUSLENGTH_0100--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + try{ + let length = mCameraSession.getFocalLength(); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETFOCUSLENGTH_0100 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue(); + expect(true).assertTrue(); + }; + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETZOOMRATIORANG_0100 + * @tc.name : capturesession getZoomRatioRange api + * @tc.desc : capturesession getZoomRatioRange api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETZOOMRATIORANG_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETZOOMRATIORANG_0100--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + try{ + let zoomratiorange = mCameraSession.getZoomRatioRange(); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETZOOMRATIORANG_0100 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue(); + expect(true).assertTrue(); + }; + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETZOOMRATIO_0100 + * @tc.name : capturesession getZoomRatio api + * @tc.desc : capturesession getZoomRatio api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETZOOMRATIO_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETZOOMRATIO_0100--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + try{ + let zoomratio = mCameraSession.getZoomRatio(); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_GETZOOMRATIO_0100 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue(); + expect(true).assertTrue(); + }; + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETZOOMRATIO_0100 + * @tc.name : capturesession setZoomRatio api + * @tc.desc : capturesession setZoomRatio api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETZOOMRATIO_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETZOOMRATIO_0100--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + try{ + let zoomratiorange = mCameraSession.getZoomRatioRange(); + mCameraSession.setZoomRatio(zoomratiorange[0]); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETZOOMRATIO_0100 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue(); + expect(true).assertTrue(); + }; + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETZOOMRATIO_0101 + * @tc.name : capturesession setZoomRatio api + * @tc.desc : capturesession setZoomRatio api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETZOOMRATIO_0101', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETZOOMRATIO_0101--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + await commitCameraSessionConfig(); + await mCameraSession.start(); + try{ + let zoomratiorange = mCameraSession.getZoomRatioRange(); + mCameraSession.setZoomRatio(-101); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETZOOMRATIO_0101 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code != cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue(); + }; + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_ISVSMS_0100 + * @tc.name : capturesession isVideoStabilizationModeSupported api + * @tc.desc : capturesession isVideoStabilizationModeSupported api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_ISVSMS_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_ISVSMS_0100--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + try{ + let isVSMS = mCameraSession.isVideoStabilizationModeSupported(cameraObj.VideoStabilizationMode.LOW); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_ISVSMS_0100 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue(); + expect(true).assertTrue(); + }; + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_AVSTMODE_0100 + * @tc.name : capturesession getActiveVideoStabilizationMode api + * @tc.desc : capturesession getActiveVideoStabilizationMode api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_AVSTMODE_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_AVSTMODE_0100--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + try{ + let avstmode = mCameraSession.getActiveVideoStabilizationMode(); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_AVSTMODE_0100 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue(); + expect(true).assertTrue(); + }; + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETVSTMODE_0100 + * @tc.name : capturesession setVideoStabilizationMode api + * @tc.desc : capturesession setVideoStabilizationMode api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETVSTMODE_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETVSTMODE_0100--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + try{ + mCameraSession.setVideoStabilizationMode(cameraObj.VideoStabilizationMode.LOW); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETVSTMODE_0100 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue(); + expect(true).assertTrue(); + }; + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETVSTMODE_0101 + * @tc.name : capturesession setVideoStabilizationMode api + * @tc.desc : capturesession setVideoStabilizationMode api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETVSTMODE_0101', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETVSTMODE_0101--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + await commitCameraSessionConfig(); + await mCameraSession.start(); + try{ + mCameraSession.setVideoStabilizationMode(5); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETVSTMODE_0101 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code != cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue(); + }; + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PREVIEW_START_0100 + * @tc.name : PreviewOutput start api + * @tc.desc : PreviewOutput start api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PREVIEW_START_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PREVIEW_START_0100--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + mPreviewOutput.start(async (err) => { + if (!err) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PREVIEW_START_0100 success"); + } else { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PREVIEW_START_0100 FAILED"); + console.info(TAG + "ERRORCODE: " + err.code); + expect(err.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue(); + expect(true).assertTrue(); + } + }) + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PREVIEW_START_0200 + * @tc.name : PreviewOutput start api + * @tc.desc : PreviewOutput start api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PREVIEW_START_0200', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PREVIEW_START_0200--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + + await mPreviewOutput.start().then((result) => { + console.info('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PREVIEW_START_0200 success :' + result); + }).catch((err) => { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PREVIEW_START_0200 FAILED"); + console.info(TAG + "ERRORCODE: " + err.code); + expect(err.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue(); + }); + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_VIDEO_START_0100 + * @tc.name : videooutput start api + * @tc.desc : videooutput start api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_VIDEO_START_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_VIDEO_START_0100--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + if (!isEmpty(cameraOutputCap.videoProfiles)) { + for (let i = 0; i < cameraOutputCap.videoProfiles.length; i++) { + videoOutput = mCameraManager.createVideoOutput(cameraOutputCap.videoProfiles[i], videoSurfaceId); + if (!isEmpty(videoOutput)) { + break; + } + } + } + mCameraSession.addOutput(mPreviewOutput); + if (!isEmpty(videoOutput)) { + mCameraSession.addOutput(videoOutput); + videoOutput.start(async (err) => { + if (!err) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_VIDEO_START_0100 success"); + } else { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_VIDEO_START_0100 FAILED"); + console.info(TAG + "ERRORCODE: " + err.code); + expect(err.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue(); + expect(true).assertTrue(); + } + }) + } + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_VIDEO_START_0200 + * @tc.name : videooutput start api + * @tc.desc : videooutput start api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_VIDEO_START_0200', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_VIDEO_START_0200--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + if (!isEmpty(videoOutput)) { + mCameraSession.addOutput(videoOutput); + await videoOutput.start().then((result) => { + console.info('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_VIDEO_START_0200 success :' + result); + }).catch((err) => { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_VIDEO_START_0200 FAILED"); + console.info(TAG + "ERRORCODE: " + err.code); + expect(err.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue(); + }); + } + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_METADATAOUTPUT_START_0100 + * @tc.name : MetadataOutput start api + * @tc.desc : MetadataOutput start api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_METADATAOUTPUT_START_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_METADATAOUTPUT_START_0100--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + if (isEmpty(metadataOutput)) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_METADATAOUTPUT_START_0100 metadataOutput IS NULL"); + } else { + mCameraSession.addOutput(metadataOutput); + metadataOutput.start(async (err) => { + if (!err) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_METADATAOUTPUT_START_0100 success"); + } else { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_METADATAOUTPUT_START_0100 FAILED"); + console.info(TAG + "ERRORCODE: " + err.code); + expect(err.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue(); + expect(true).assertTrue(); + } + }) + } + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_METADATAOUTPUT_START_0200 + * @tc.name : metadataOutput start api + * @tc.desc : metadataOutput start api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_METADATAOUTPUT_START_0200', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_METADATAOUTPUT_START_0200--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + if (isEmpty(metadataOutput)) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_METADATAOUTPUT_START_0200 metadataOutput IS NULL"); + } else { + mCameraSession.addOutput(metadataOutput); + await metadataOutput.start().then((result) => { + console.info('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_METADATAOUTPUT_START_0200 success :' + result); + }).catch((err) => { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_METADATAOUTPUT_START_0200 FAILED"); + console.info(TAG + "ERRORCODE: " + err.code); + expect(err.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue(); + expect(true).assertTrue(); + }); + } + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PHOTOOUTPUT_CAPTURE_0500 + * @tc.name : photoOutput capture api + * @tc.desc : photoOutput capture api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PHOTOOUTPUT_CAPTURE_0500', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PHOTOOUTPUT_CAPTURE_0500--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + await commitCameraSessionConfig(); + try { + await mPhotoOutput.capture(); + } catch (err) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PHOTOOUTPUT_CAPTURE_0500 FAILED"); + console.info(TAG + "ERRORCODE: " + err.code); + expect(err.code == cameraObj.CameraErrorCode.SESSION_NOT_RUNNING).assertTrue(); + expect(true).assertTrue(); + } + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PHOTOOUTPUT_CAPTURE_0600 + * @tc.name : photoOutput capture api + * @tc.desc : photoOutput capture api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PHOTOOUTPUT_CAPTURE_0600', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PHOTOOUTPUT_CAPTURE_0600--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + await commitCameraSessionConfig(); + mPhotoOutput.capture(async (err) => { + if (!err) { + expect(true).assertTrue(); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PHOTOOUTPUT_CAPTURE_0600 success"); + } else { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PHOTOOUTPUT_CAPTURE_0600 FAILED"); + console.info(TAG + "ERRORCODE: " + err.code); + expect(err.code == cameraObj.CameraErrorCode.SESSION_NOT_RUNNING).assertTrue(); + + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + } + }) + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PHOTOOUTPUT_CAPTURE_0700 + * @tc.name : photoOutput capture api + * @tc.desc : photoOutput capture api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PHOTOOUTPUT_CAPTURE_0700', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PHOTOOUTPUT_CAPTURE_0700--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + await commitCameraSessionConfig(); + mPhotoOutput.capture(captureSetting,async (err) => { + if (!err) { + expect(true).assertTrue(); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PHOTOOUTPUT_CAPTURE_0700 success"); + } else { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PHOTOOUTPUT_CAPTURE_0700 FAILED"); + console.info(TAG + "ERRORCODE: " + err.code); + expect(err.code == cameraObj.CameraErrorCode.SESSION_NOT_RUNNING).assertTrue(); + + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + } + }) + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PHOTOOUTPUT_CAPTURE_0800 + * @tc.name : photoOutput capture api + * @tc.desc : photoOutput capture api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PHOTOOUTPUT_CAPTURE_0800', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PHOTOOUTPUT_CAPTURE_0800--------------"); + await createInput(0); + createCameraSessionInstance(); + mCameraSession.addInput(mCameraInput); + createOutput(0); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + await commitCameraSessionConfig(); + try { + await mPhotoOutput.capture(captureSetting); + } catch (err) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PHOTOOUTPUT_CAPTURE_0800 FAILED"); + console.info(TAG + "ERRORCODE: " + err.code); + expect(err.code == cameraObj.CameraErrorCode.SESSION_NOT_RUNNING).assertTrue(); + expect(true).assertTrue(); + } + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_BEGINCONFIG_0100 + * @tc.name : capturesession beginConfig api + * @tc.desc : capturesession beginConfig api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_BEGINCONFIG_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_BEGINCONFIG_0100--------------"); + await createInput(0); + mCameraSession = mCameraManager.createCaptureSession(); + mCameraSession.beginConfig(); + try { + mCameraSession.beginConfig(); + } catch (error) { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_BEGINCONFIG_0100 FAILED"); + console.info(TAG + "ERRORCODE: " + error.code); + expect(error.code == cameraObj.CameraErrorCode.SESSION_CONFIG_LOCKED).assertTrue(); + expect(true).assertTrue(); + } + sleep(100); + await releaseInput(); + sleep(100); + releaseCameraSessionInstance(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAMERAINPUT_OPEN_CONFLICT_0100 + * @tc.name : CameraInput open api + * @tc.desc : CameraInput open api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAMERAINPUT_OPEN_CONFLICT_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAMERAINPUT_OPEN_CONFLICT_0100--------------"); + mCameraInput = mCameraManager.createCameraInput(mCameraDevicesArray[0]); + if (!isEmpty(mCameraInput)) { + mCameraInput.open(async (err) => { + console.info(TAG + "Entering mCameraInput open callback"); + if (!err) { + console.info(TAG + "Entering mCameraInput open PASSED "); + } else { + console.info(TAG + "Entering mCameraInput open FAILED : " + err.message); + } + }) + mCameraInput.open(async (err) => { + console.info(TAG + "Entering mCameraInput open callback"); + if (!err) { + console.info(TAG + "Entering mCameraInput open PASSED "); + } else { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAMERAINPUT_OPEN_CONFLICT_0100 FAILED"); + console.info(TAG + "ERRORCODE: " + err.code); + expect(err.code == cameraObj.CameraErrorCode.CONFILICT_CAMERA).assertTrue(); + expect(true).assertTrue(); + } + }) + } else { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAMERAINPUT_OPEN_CONFLICT_0100 createCameraInput FAILED"); + } + sleep(100); + await releaseInput(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAMERAINPUT_OPEN_CONFLICT_0200 + * @tc.name : CameraInput open api + * @tc.desc : CameraInput open api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAMERAINPUT_OPEN_CONFLICT_0200', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAMERAINPUT_OPEN_CONFLICT_0200--------------"); + mCameraInput = mCameraManager.createCameraInput(mCameraDevicesArray[0]); + if (!isEmpty(mCameraInput)) { + await mCameraInput.open().then((result) => { + console.info('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAMERAINPUT_OPEN_CONFLICT_0200 success :' + result); + }).catch((err) => { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAMERAINPUT_OPEN_CONFLICT_0200 FAILED"); + console.info(TAG + "ERRORCODE: " + err.code); + }); + await mCameraInput.open().then((result) => { + console.info('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAMERAINPUT_OPEN_CONFLICT_0200 success :' + result); + }).catch((err) => { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAMERAINPUT_OPEN_CONFLICT_0200 FAILED"); + console.info(TAG + "ERRORCODE: " + err.code); + expect(err.code == cameraObj.CameraErrorCode.CONFILICT_CAMERA).assertTrue(); + expect(true).assertTrue(); + }); + } else { + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAMERAINPUT_OPEN_CONFLICT_0200 createCameraInput FAILED"); + } + sleep(100); + await releaseInput(); + done(); + }) + }) +} \ No newline at end of file diff --git a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraInputTest.test.ets b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraInputTest.test.ets index dced6f3bcfdee2c8f03bf470b584387d7f45d08d..9f19017a2a11f820047afc31ccbdd6810837ed4c 100644 --- a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraInputTest.test.ets +++ b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraInputTest.test.ets @@ -69,10 +69,10 @@ export default function CameraInputTest() { } } - async function getCameraManagerInstance() { + function getCameraManagerInstance() { console.info('Enter getCameraManagerInstance'); - mCameraManager = await cameraObj.getCameraManager(null); + mCameraManager = cameraObj.getCameraManager(null); if (isEmpty(mCameraManager)) { console.info(TAG + "getCameraManager FAILED"); return false; @@ -83,10 +83,10 @@ export default function CameraInputTest() { return true; } - async function getCameraSupportDevicesArray() { + function getCameraSupportDevicesArray() { console.info('Enter getCameraSupportDevicesArray'); - mCameraDevicesArray = await mCameraManager.getSupportedCameras(); + mCameraDevicesArray = mCameraManager.getSupportedCameras(); /* mCameraManager.getSupportedCameras(async (err, data) => { console.info(TAG + "Entering getCameraSupportDevicesArray callback"); @@ -118,19 +118,12 @@ export default function CameraInputTest() { return true; } - async function beginCameraSessionConfig() { + function beginCameraSessionConfig() { console.info('Enter beginCameraSessionConfig'); - mCameraSession.beginConfig(async (err) => { - if (!err) { - console.info(TAG + "Entering beginConfig PASSED"); - } else { - console.info(TAG + "Entering beginConfig FAILED : " + err.message); - } - }) - - await sleep(30); - + console.info(TAG + "Entering beginConfig start"); + mCameraSession.beginConfig(); + console.info(TAG + "Entering beginConfig end"); console.info('Exit beginCameraSessionConfig'); return true; @@ -154,11 +147,11 @@ export default function CameraInputTest() { return true; } - async function createCameraSessionInstance() { + function createCameraSessionInstance() { console.info('Enter createCameraSessionInstance'); try { - mCameraSession = await mCameraManager.createCaptureSession(); + mCameraSession = mCameraManager.createCaptureSession(); } catch { console.info('createCaptureSession FAILED'); @@ -169,7 +162,7 @@ export default function CameraInputTest() { return false; } - await beginCameraSessionConfig(); + beginCameraSessionConfig(); console.info('Exit createCameraSessionInstance'); @@ -188,29 +181,16 @@ export default function CameraInputTest() { return false; } - mCameraInput = null; - await mCameraManager.createCameraInput(mCameraDevicesArray[idx]).then((result) => { - console.info('createCameraInput success'); - mCameraInput = result; - }).catch((err) => { - console.info('createCameraInput failed, err = ' + err.message); - }); + mCameraInput = mCameraManager.createCameraInput(mCameraDevicesArray[idx]); if (isEmpty(mCameraInput)) { console.info(TAG + "createCameraInput FAILED"); return false; } - mCameraInput.open(async (err) => { - console.info(TAG + "Entering mCameraInput open callback"); - if (!err) { - console.info(TAG + "Entering mCameraInput open PASSED "); - } else { - console.info(TAG + "Entering mCameraInput open FAILED : " + err.message); - } - }) + await mCameraInput.open(); - await sleep(100); + sleep(100); console.info(idx + 'th CameraInput is: ' + mCameraInput); @@ -224,7 +204,6 @@ export default function CameraInputTest() { if (!isEmpty(mCameraInput)) { await mCameraInput.close(); - await mCameraInput.release(); } console.info('Exit releaseInput'); @@ -232,23 +211,16 @@ export default function CameraInputTest() { return true; } - async function createOutput(idx:any) { + function createOutput(idx:any) { console.info('Enter createOutput'); - let cameraOutputCap = null; - await mCameraManager.getSupportedOutputCapability(mCameraDevicesArray[idx]).then((result) => { - console.info('getSupportedOutputCapability success'); - cameraOutputCap = result; - }).catch((err) => { - console.info('getSupportedOutputCapability failed, err = ' + err.message); - mPreviewOutput = null; - }); + let cameraOutputCap = mCameraManager.getSupportedOutputCapability(mCameraDevicesArray[idx]); if (!isEmpty(cameraOutputCap)) { if (!isEmpty(cameraOutputCap.previewProfiles)) { console.info(TAG + "cameraOutputCap.previewProfiles.length: " + cameraOutputCap.previewProfiles.length); for (let i = 0; i < cameraOutputCap.previewProfiles.length; i++) { - mPreviewOutput = await mCameraManager.createPreviewOutput(cameraOutputCap.previewProfiles[i], globalThis.surfaceId); + mPreviewOutput = mCameraManager.createPreviewOutput(cameraOutputCap.previewProfiles[i], globalThis.surfaceId); if (!isEmpty(mPreviewOutput)) { break; } @@ -271,7 +243,6 @@ export default function CameraInputTest() { console.info('Enter releaseOutput'); if (!isEmpty(mPreviewOutput)) { - await mPreviewOutput.stop(); await mPreviewOutput.release(); } @@ -284,18 +255,18 @@ export default function CameraInputTest() { console.info(TAG + "Enter startCameraSession"); await createInput(idx); - await createOutput(idx); + createOutput(idx); await sleep(1); if (!isEmpty(mCameraInput)) { console.info(TAG + "Start to addInput"); - await mCameraSession.addInput(mCameraInput); + mCameraSession.addInput(mCameraInput); } if (!isEmpty(mPreviewOutput)) { console.info(TAG + "Start to addOutput mPreviewOutput"); - await mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPreviewOutput); } await sleep(1); @@ -312,12 +283,12 @@ export default function CameraInputTest() { if (!isEmpty(mCameraInput)) { console.info(TAG + "Start to removeInput input"); - await mCameraSession.removeInput(mCameraInput); + mCameraSession.removeInput(mCameraInput); } if (!isEmpty(mPreviewOutput)) { console.info(TAG + "Start to removeOutput mPreviewOutput"); - await mCameraSession.removeOutput(mPreviewOutput); + mCameraSession.removeOutput(mPreviewOutput); } await releaseInput(); @@ -334,9 +305,9 @@ export default function CameraInputTest() { await getPermission(); sleep(1000); await driveFn(); - await getCameraManagerInstance(); - await getCameraSupportDevicesArray(); - await createCameraSessionInstance(); + getCameraManagerInstance(); + getCameraSupportDevicesArray(); + createCameraSessionInstance(); console.info('beforeAll case'); }); beforeEach(function () { @@ -410,130 +381,100 @@ export default function CameraInputTest() { }); /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_CALLBACK_0100 - * @tc.name : open/close/release Camera with cameraInput callback api - * @tc.desc : open/close/release Camera with cameraInput callback api + * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_CALLBACK_0100 + * @tc.name : open/close Camera with cameraInput callback api + * @tc.desc : open/close Camera with cameraInput callback api * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_CALLBACK_0100--------------"); + it('SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_CALLBACK_0100', 0, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_CALLBACK_0100--------------"); if (isEmpty(mCameraManager)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_CALLBACK_0100 cameraManager == null || undefined"); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_CALLBACK_0100 cameraManager == null || undefined"); expect().assertFail(); } else { let camerasArray = mCameraDevicesArray; for (let i = 0; i < camerasArray.length; i++) { let successFlag = false; console.info(TAG + "Entering createCameraInput with camera: " + camerasArray[i].cameraId); - await mCameraManager.createCameraInput(camerasArray[i]).then(async (cameraInput) => { - expect(isEmpty(cameraInput)).assertFalse(); - await cameraInput.open(async (err) => { - if (!err) { - successFlag = true; - console.info(TAG + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_CALLBACK_0100 PASSED open with CameraID :" + camerasArray[i].cameraId); - } else { - successFlag = false; - console.info(TAG + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_CALLBACK_0100 open FAILED: " + err.message); - } - }); - await sleep(400); - successFlag = false; - await cameraInput.close(async (err) => { - if (!err) { - successFlag = true; - console.info(TAG + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_CALLBACK_0100 PASSED close with CameraID :" + camerasArray[i].cameraId); - } else { - successFlag = false; - console.info(TAG + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_CALLBACK_0100 close FAILED: " + err.message); - } - }); - await sleep(100); - successFlag = false; - await cameraInput.release(async (err) => { - if (!err) { - successFlag = true; - console.info(TAG + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_CALLBACK_0100 PASSED release with CameraID :" + camerasArray[i].cameraId); - } else { - successFlag = false; - console.info(TAG + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_CALLBACK_0100 release FAILED: " + err.message); - } - }); - await sleep(100); - expect(successFlag).assertEqual(true); - }).catch((err) => { - expect().assertFail(); - console.info(TAG + " Failed To create cameraInput cameraId: " + camerasArray[i].cameraId + +JSON.stringify(err)); + let cameraInput = mCameraManager.createCameraInput(camerasArray[i]); + expect(isEmpty(cameraInput)).assertFalse(); + await cameraInput.open(async (err) => { + if (!err) { + successFlag = true; + console.info(TAG + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_CALLBACK_0100 PASSED open with CameraID :" + camerasArray[i].cameraId); + } else { + successFlag = false; + console.info(TAG + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_CALLBACK_0100 open FAILED: " + err.message); + } }); - } + await sleep(400); + successFlag = false; + await cameraInput.close(async (err) => { + if (!err) { + successFlag = true; + console.info(TAG + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_CALLBACK_0100 PASSED close with CameraID :" + camerasArray[i].cameraId); + } else { + successFlag = false; + console.info(TAG + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_CALLBACK_0100 close FAILED: " + err.message); + } + }); + await sleep(100); + expect(successFlag).assertEqual(true); } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_CALLBACK_0100 ends here"); + } + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_CALLBACK_0100 ends here"); await sleep(1000); done(); }); /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_PROMISE_0100 - * @tc.name : open/close/release Camera with cameraInput promise api - * @tc.desc : open/close/release Camera with cameraInput promise api + * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_PROMISE_0100 + * @tc.name : open/close Camera with cameraInput promise api + * @tc.desc : open/close Camera with cameraInput promise api * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_PROMISE_0100', 0, async function (done) { - let functionTag = "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_PROMISE_0100"; + it('SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_PROMISE_0100', 0, async function (done) { + let functionTag = "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_PROMISE_0100"; console.info(functionTag); if (isEmpty(mCameraManager)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_PROMISE_0100 cameraManager == null || undefined"); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_PROMISE_0100 cameraManager == null || undefined"); expect().assertFail(); } else { let camerasArray = mCameraDevicesArray; for (let i = 0; i < camerasArray.length; i++) { let successFlag = false; - console.info(TAG + functionTag + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_PROMISE_0100 createCameraInput with camera: " + camerasArray[i].cameraId); - mCameraManager.createCameraInput(camerasArray[i], async (err, cameraInput) => { - if (!err) { - expect(isEmpty(cameraInput)).assertFalse(); - console.info(TAG + functionTag + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_PROMISE_0100 cameraInput open with camera: " + camerasArray[i].cameraId); - await cameraInput.open().then(async () => { - successFlag = true; - console.info(TAG + functionTag + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_PROMISE_0100 PASSED open with CameraID :" + camerasArray[i].cameraId); - }).catch((err) => { - successFlag = false; - console.info(TAG + functionTag + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_PROMISE_0100 open FAILED: " + err.message); - }); - await sleep(400); - successFlag = false; - await cameraInput.close().then(async () => { - successFlag = true; - console.info(TAG + functionTag + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_PROMISE_0100 PASSED close with CameraID :" + camerasArray[i].cameraId); - }).catch((err) => { - successFlag = false; - console.info(TAG + functionTag + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_PROMISE_0100 close FAILED: " + err.message); - }); - await sleep(100); - successFlag = false; - await cameraInput.release().then(async () => { - successFlag = true; - console.info(TAG + functionTag + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_PROMISE_0100 PASSED release with CameraID :" + camerasArray[i].cameraId); - }).catch((err) => { - successFlag = false; - console.info(TAG + functionTag + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_PROMISE_0100 release FAILED: " + err.message); - }); - await sleep(100); - expect(successFlag).assertEqual(true); - } else { - expect().assertFail(); - console.info(TAG + functionTag + " FAILED: " + err.message); - } + console.info(TAG + functionTag + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_PROMISE_0100 createCameraInput with camera: " + camerasArray[i].cameraId); + let cameraInput = mCameraManager.createCameraInput(camerasArray[i]); + + expect(isEmpty(cameraInput)).assertFalse(); + console.info(TAG + functionTag + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_PROMISE_0100 cameraInput open with camera: " + camerasArray[i].cameraId); + await cameraInput.open().then(async () => { + successFlag = true; + console.info(TAG + functionTag + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_PROMISE_0100 PASSED open with CameraID :" + camerasArray[i].cameraId); + }).catch((err) => { + successFlag = false; + console.info(TAG + functionTag + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_PROMISE_0100 open FAILED: " + err.message); }); - + await sleep(400); + successFlag = false; + await cameraInput.close().then(async () => { + successFlag = true; + console.info(TAG + functionTag + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_PROMISE_0100 PASSED close with CameraID :" + camerasArray[i].cameraId); + }).catch((err) => { + successFlag = false; + console.info(TAG + functionTag + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_PROMISE_0100 close FAILED: " + err.message); + }); + await sleep(100); + expect(successFlag).assertEqual(true); await sleep(600); } //await sleep(400 * camerasArray.length); } - console.info(TAG + functionTag + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_PROMISE_0100 ends here"); + console.info(TAG + functionTag + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_PROMISE_0100 ends here"); done(); }); diff --git a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraJSUnitOutput.test.ets b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraJSUnitOutput.test.ets index ee1bed92bd1fe051916ec541b0c70586752b6a03..0007ce5202a84e629e7924c958f908976baec3ad 100644 --- a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraJSUnitOutput.test.ets +++ b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraJSUnitOutput.test.ets @@ -159,7 +159,6 @@ export default function cameraJSUnitOutput() { async function release() { console.log(TAG + "start release"); - await cameraInput.release(); await captureSession.release(); console.log(TAG + "release end") } @@ -229,19 +228,7 @@ export default function cameraJSUnitOutput() { console.info(TAG + "Entering GET_CAMERA_MANAGER cameraManager == null || undefined") expect().assertFail(); } else { - cameraObj.getCameraManager(null, async (err, data) => { - if (!err) { - expect(isEmpty(data)).assertFalse(); - console.info(TAG + "Entering GET_CAMERA_MANAGER success"); - cameraManager = data; - } else { - expect().assertFail(); - console.info(TAG + "Entering GET_CAMERA_MANAGER FAILED: " + err.message); - } - console.info(TAG + "Entering GET_CAMERA_MANAGER ends here"); - await sleep(1000); - done(); - }) + cameraManager = cameraObj.getCameraManager(null); await sleep(1000); done(); } @@ -262,43 +249,33 @@ export default function cameraJSUnitOutput() { console.info(TAG + "Entering GET_CAMERAS cameraManager == null || undefined") expect().assertFail(); } - cameraManager.getSupportedCameras(async (err, data) => { - if (!err) { - console.info(TAG + "Entering GET_CAMERAS success"); - if (isEmpty(data)) { - expect().assertFail(); - console.info(TAG + "Entering GET_CAMERAS FAILED cameraArray is null || undefined"); - } else { - console.info(TAG + "Entering GET_CAMERAS data is not null || undefined"); - cameraDevicesArray = data; - if (cameraDevicesArray != null && cameraDevicesArray.length > 0) { - for (let i = 0; i < cameraDevicesArray.length; i++) { - // Get the variables from camera object - let cameraId = cameraDevicesArray[i].cameraId; - expect(isEmpty(cameraId)).assertFalse(); - console.info(TAG + "Entering GET_CAMERAS camera" + i + "Id: " + cameraId); - let cameraPosition = cameraDevicesArray[i].cameraPosition; - expect(isEmpty(cameraPosition)).assertFalse(); - console.info(TAG + "Entering GET_CAMERAS camera" + i + "Position: " + cameraPosition); - let cameraType = cameraDevicesArray[i].cameraType; - expect(isEmpty(cameraType)).assertFalse(); - console.info(TAG + "Entering GET_CAMERAS camera" + i + "Type: " + cameraType); - let connectionType = cameraDevicesArray[i].connectionType - expect(isEmpty(connectionType)).assertFalse(); - console.info(TAG + "Entering GET_CAMERAS connection" + i + "Type: " + connectionType); - } - expect(true).assertTrue(); - console.info(TAG + "Entering GET_CAMERAS PASSED"); - } + cameraDevicesArray = cameraManager.getSupportedCameras(); + + if (isEmpty(cameraDevicesArray)) { + expect().assertFail(); + console.info(TAG + "Entering GET_CAMERAS FAILED cameraArray is null || undefined"); + } else { + console.info(TAG + "Entering GET_CAMERAS data is not null || undefined"); + if (cameraDevicesArray != null && cameraDevicesArray.length > 0) { + for (let i = 0; i < cameraDevicesArray.length; i++) { + // Get the variables from camera object + let cameraId = cameraDevicesArray[i].cameraId; + expect(isEmpty(cameraId)).assertFalse(); + console.info(TAG + "Entering GET_CAMERAS camera" + i + "Id: " + cameraId); + let cameraPosition = cameraDevicesArray[i].cameraPosition; + expect(isEmpty(cameraPosition)).assertFalse(); + console.info(TAG + "Entering GET_CAMERAS camera" + i + "Position: " + cameraPosition); + let cameraType = cameraDevicesArray[i].cameraType; + expect(isEmpty(cameraType)).assertFalse(); + console.info(TAG + "Entering GET_CAMERAS camera" + i + "Type: " + cameraType); + let connectionType = cameraDevicesArray[i].connectionType + expect(isEmpty(connectionType)).assertFalse(); + console.info(TAG + "Entering GET_CAMERAS connection" + i + "Type: " + connectionType); } - } else { - expect().assertFail(); - console.info(TAG + "Entering GET_CAMERAS FAILED: " + err.message); + expect(true).assertTrue(); + console.info(TAG + "Entering GET_CAMERAS PASSED"); } - console.info(TAG + "Entering GET_CAMERAS ends here"); - await sleep(1000); - done(); - }) + } await sleep(1000); done(); }) @@ -313,15 +290,15 @@ export default function cameraJSUnitOutput() { * @tc.type : Function * @tc.level : Level 2 */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_OUTPUT_PROMISE_0100', 2, async function (done) { - console.info(TAG + " --------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_OUTPUT_PROMISE_0100--------------"); + it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100', 2, async function (done) { + console.info(TAG + " --------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100--------------"); if (isEmpty(cameraManager)) { console.info(TAG + "Entering CREATE_CAMERA_INPUT cameraManager == null || undefined") expect().assertFail(); } else { - cameraInput = await cameraManager.createCameraInput(cameraDevicesArray[0]); + cameraInput = cameraManager.createCameraInput(cameraDevicesArray[0]); if (isEmpty(cameraInput)) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_OUTPUT_PROMISE_0100 FAILED"); + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 FAILED"); } cameraInput.open(async (err) => { if (!err) { @@ -345,35 +322,21 @@ export default function cameraJSUnitOutput() { * @tc.type : Function * @tc.level : Level 1 */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100', 1, async function (done) { + it('SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_0100', 1, async function (done) { console.info(TAG + " --------------SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100--------------"); if (isEmpty(cameraManager)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100 cameraManager == null || undefined") expect().assertFail(); } else { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100") - let cameraOutputCap = await getSupportedOutputCapabilityInPromise(cameraDevicesArray[0]); + let cameraOutputCap = getSupportedOutputCapabilityInPromise(cameraDevicesArray[0]); let previewProfilesArray = cameraOutputCap.previewProfiles; if (isEmpty(previewProfilesArray)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100 previewProfilesArray == null || undefined") expect(isEmpty(previewProfilesArray)).assertFalse(); } - cameraManager.createPreviewOutput(previewProfilesArray[0], globalThis.surfaceId, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100 is not error"); - expect(isEmpty(data)).assertFalse(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100 success"); - previewOutput = data; - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) + previewOutput = cameraManager.createPreviewOutput(previewProfilesArray[0], globalThis.surfaceId); } - await sleep(1000); done(); }) @@ -393,19 +356,18 @@ export default function cameraJSUnitOutput() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_PROMISE_0100 cameraManager == null || undefined") expect().assertFail(); } else { - let cameraOutputCap = await getSupportedOutputCapabilityInPromise(cameraDevicesArray[0]); + let cameraOutputCap = getSupportedOutputCapabilityInPromise(cameraDevicesArray[0]); let photoProfilesArray = cameraOutputCap.photoProfiles; if (isEmpty(photoProfilesArray)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_PROMISE_0100 previewProfilesArray == null || undefined") expect().assertFalse(); } - photoOutput = await cameraManager.createPhotoOutput(photoProfilesArray[0], surfaceId1); + photoOutput = cameraManager.createPhotoOutput(photoProfilesArray[0], surfaceId1); if (isEmpty(photoOutput)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_PROMISE_0100 data is empty"); expect().assertFalse(); } } - await sleep(1000); done(); }) @@ -419,34 +381,20 @@ export default function cameraJSUnitOutput() { * @tc.type : Function * @tc.level : Level 1 */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100', 1, async function (done) { + it('SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_0100', 1, async function (done) { console.info(TAG + " --------------SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100--------------"); if (isEmpty(cameraManager)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100 cameraManager == null || undefined") expect().assertFail(); } else { - let cameraOutputCap = await getSupportedOutputCapabilityInPromise(cameraDevicesArray[0]); + let cameraOutputCap = getSupportedOutputCapabilityInPromise(cameraDevicesArray[0]); console.info("SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100 camera:" + cameraDevicesArray[0].cameraId); expect(isEmpty(cameraOutputCap)).assertFalse(); let videoProfilesArray = cameraOutputCap.videoProfiles; expect(isEmpty(videoProfilesArray)).assertFalse(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100 start createVideoOutput") - cameraManager.createVideoOutput(videoProfilesArray[0], videoSurfaceId, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100 is not error"); - expect(isEmpty(data)).assertFalse(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100 success"); - videoOutput = data; - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) + videoOutput = cameraManager.createVideoOutput(videoProfilesArray[0], videoSurfaceId); } - await sleep(1000); done(); }) @@ -459,13 +407,13 @@ export default function cameraJSUnitOutput() { * @tc.type : Function * @tc.level : Level 1 */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_METADATA_OUTPUT_CALLBACK_0100', 1, async function (done) { + it('SUB_MULTIMEDIA_CAMERA_CREATE_METADATA_OUTPUT_0100', 1, async function (done) { console.info(TAG + " --------------SUB_MULTIMEDIA_CAMERA_CREATE_METADATA_OUTPUT_CALLBACK_0100--------------"); if (isEmpty(cameraManager)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_METADATA_OUTPUT_CALLBACK_0100 cameraManager == null || undefined") expect().assertFail(); } else { - let cameraOutputCap = await getSupportedOutputCapabilityInPromise(cameraDevicesArray[0]); + let cameraOutputCap = getSupportedOutputCapabilityInPromise(cameraDevicesArray[0]); console.info("SUB_MULTIMEDIA_CAMERA_CREATE_METADATA_OUTPUT_CALLBACK_0100 camera:" + cameraDevicesArray[0].cameraId); expect(isEmpty(cameraOutputCap)).assertFalse(); mMetadataObjectTypeArray = cameraOutputCap.supportedMetadataObjectTypes; @@ -473,27 +421,9 @@ export default function cameraJSUnitOutput() { console.info("SUB_MULTIMEDIA_CAMERA_CREATE_METADATA_OUTPUT_CALLBACK_0100 end with mMetadataObjectTypeArray is null"); } else { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_METADATA_OUTPUT_CALLBACK_0100 start createMetadataOutput") - cameraManager.createMetadataOutput(mMetadataObjectTypeArray, async (err, data) => { - if (!err) { - if (!isEmpty(data)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_METADATA_OUTPUT_CALLBACK_0100 success"); - metadataOutput = data; - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_METADATA_OUTPUT_CALLBACK_0100, data == null || undefined"); - expect().assertFail(); - } - - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_METADATA_OUTPUT_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_METADATA_OUTPUT_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) + metadataOutput = cameraManager.createMetadataOutput(mMetadataObjectTypeArray); } } - await sleep(1000); done(); }) @@ -507,29 +437,15 @@ export default function cameraJSUnitOutput() { * @tc.type : Function * @tc.level : Level 1 */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100', 1, async function (done) { + it('SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_0100', 1, async function (done) { console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100--------------"); if (isEmpty(cameraManager)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100 cameraManager == null || undefined") expect().assertFail(); } else { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100") - cameraManager.createCaptureSession(async (err, data) => { - if (!err) { - console.info(TAG + "Entering createCaptureSession is not error"); - expect(isEmpty(data)).assertFalse(); - captureSession = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100 PASSED"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) + captureSession = cameraManager.createCaptureSession(); } - await sleep(1000); done(); }) @@ -542,26 +458,14 @@ export default function cameraJSUnitOutput() { * @tc.type : Function * @tc.level : Level 1 */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_BEGIN_CONFIG_CALLBACK_0100', 1, async function (done) { + it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_BEGIN_CONFIG_0100', 1, async function (done) { console.info(TAG + " --------------SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_BEGIN_CONFIG_CALLBACK_0100--------------"); if (isEmpty(captureSession)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_BEGIN_CONFIG_CALLBACK_0100 captureSession == null || undefined") expect().assertFail(); } else { - captureSession.beginConfig(async (err) => { - if (!err) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_BEGIN_CONFIG_CALLBACK_0100 success"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_BEGIN_CONFIG_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_BEGIN_CONFIG_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) + captureSession.beginConfig(); } - await sleep(1000); done(); }) @@ -575,26 +479,14 @@ export default function cameraJSUnitOutput() { * @tc.type : Function * @tc.level : Level 1 */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_INPUT_CALLBACK_0100', 1, async function (done) { + it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_INPUT_0100', 1, async function (done) { console.info(TAG + " --------------SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_INPUT_CALLBACK_0100--------------"); if (isEmpty(captureSession)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_INPUT_CALLBACK_0100 captureSession == null || undefined") expect().assertFail(); } else { - captureSession.addInput(cameraInput, async (err) => { - if (!err) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_INPUT_CALLBACK_0100 success"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_INPUT_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_INPUT_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) + captureSession.addInput(cameraInput) } - await sleep(1000); done(); }) @@ -608,30 +500,18 @@ export default function cameraJSUnitOutput() { * @tc.type : Function * @tc.level : Level 1 */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_PREVIEW_OUTPUT_CALLBACK_0100', 1, async function (done) { - console.info(TAG + " --------------SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_PREVIEW_OUTPUT_CALLBACK_0100--------------"); + it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_PREVIEW_OUTPUT_0100', 1, async function (done) { + console.info(TAG + " --------------SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_PREVIEW_OUTPUT_0100--------------"); if (isEmpty(captureSession)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_PREVIEW_OUTPUT_CALLBACK_0100 captureSession == null || undefined") + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_PREVIEW_OUTPUT_0100 captureSession == null || undefined") expect().assertFail(); } else { if (isEmpty(previewOutput)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_PREVIEW_OUTPUT_CALLBACK_0100 previewOutput == null || undefined") + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_PREVIEW_OUTPUT_0100 previewOutput == null || undefined") expect().assertFail(); } - captureSession.addOutput(previewOutput, async (err) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_PREVIEW_OUTPUT_CALLBACK_0100 success"); - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_PREVIEW_OUTPUT_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_PREVIEW_OUTPUT_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) + captureSession.addOutput(previewOutput) } - await sleep(1000); done(); }) @@ -644,7 +524,7 @@ export default function cameraJSUnitOutput() { * @tc.type : Function * @tc.level : Level 1 */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_PHOTO_OUTPUT_CALLBACK_0100', 1, async function (done) { + it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_PHOTO_OUTPUT_0100', 1, async function (done) { console.info(TAG + " --------------SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_PHOTO_OUTPUT_CALLBACK_0100--------------"); if (isEmpty(captureSession)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_PHOTO_OUTPUT_CALLBACK_0100 captureSession == null || undefined") @@ -655,20 +535,8 @@ export default function cameraJSUnitOutput() { expect().assertFail(); } console.info(TAG + "captureSession start add photoOutput") - captureSession.addOutput(photoOutput, async (err) => { - if (!err) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_PHOTO_OUTPUT_CALLBACK_0100 success"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_PHOTO_OUTPUT_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_PHOTO_OUTPUT_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) + captureSession.addOutput(photoOutput) } - await sleep(1000); done(); }) @@ -681,26 +549,14 @@ export default function cameraJSUnitOutput() { * @tc.type : Function * @tc.level : Level 1 */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_VIDEO_OUTPUT_CALLBACK_0100', 1, async function (done) { + it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_VIDEO_OUTPUT_0100', 1, async function (done) { console.info(TAG + " --------------SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_VIDEO_OUTPUT_CALLBACK_0100--------------"); if (isEmpty(captureSession)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_VIDEO_OUTPUT_CALLBACK_0100 captureSession == null || undefined") expect().assertFail(); } else { - captureSession.addOutput(videoOutput, async (err) => { - if (!err) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_VIDEO_OUTPUT_CALLBACK_0100 success"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_VIDEO_OUTPUT_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_VIDEO_OUTPUT_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) + captureSession.addOutput(videoOutput) } - await sleep(1000); done(); }) @@ -713,27 +569,15 @@ export default function cameraJSUnitOutput() { * @tc.type : Function * @tc.level : Level 1 */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_METADATA_OUTPUT_CALLBACK_0100', 1, async function (done) { + it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_METADATA_OUTPUT_0100', 1, async function (done) { console.info(TAG + " --------------SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_METADATA_OUTPUT_CALLBACK_0100--------------"); if (isEmpty(captureSession)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_METADATA_OUTPUT_CALLBACK_0100 captureSession == null || undefined") expect().assertFail(); } else { if (!isEmpty(metadataOutput)) { - captureSession.addOutput(metadataOutput, async (err) => { - if (!err) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_METADATA_OUTPUT_CALLBACK_0100 success"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_METADATA_OUTPUT_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_METADATA_OUTPUT_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) + captureSession.addOutput(metadataOutput) } - } await sleep(1000); done(); @@ -805,6 +649,37 @@ export default function cameraJSUnitOutput() { }) + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_METADATA_OUTPUT_CALLBACK_ON_ERROR_0100 + * @tc.name : metadata output callback on error api + * @tc.desc : metadata output callback on error api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_CAMERA_METADATA_OUTPUT_CALLBACK_ON_ERROR_0100', 1, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_METADATA_OUTPUT_CALLBACK_ON_ERROR_0100--------------"); + if (isEmpty(metadataOutput)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_METADATA_OUTPUT_CALLBACK_ON_ERROR_0100 metadata is not support") + } else { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_METADATA_OUTPUT_CALLBACK_ON_ERROR_0100 to operate"); + metadataOutput.on('error', async (err, data) => { + if (!err) { + expect(true).assertTrue(); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_METADATA_OUTPUT_CALLBACK_ON_ERROR_0100 success"); + } else { + expect().assertFail(); + console.info(TAG + "Error in SUB_MULTIMEDIA_CAMERA_METADATA_OUTPUT_CALLBACK_ON_ERROR_0100 FAILED: " + err.message); + } + await sleep(1000); + done(); + }) + } + await sleep(1000); + done(); + }) + + /** * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100 * @tc.name : captureSession start @@ -865,42 +740,6 @@ export default function cameraJSUnitOutput() { done(); }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_METADATA_TYPE_CALLBACK_0100 - * @tc.name : Start metadataOutput type async api - * @tc.desc : Start metadataOutput type async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 1 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_METADATA_TYPE_CALLBACK_0100', 1, async function (done) { - console.info(TAG + " --------------SUB_MULTIMEDIA_CAMERA_GET_METADATA_TYPE_CALLBACK_0100--------------"); - if (isEmpty(mMetadataObjectArray)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_TYPE_CALLBACK_0100 mMetadataObjectArray == null || undefined") - } else { - mMetadataObjectArray[0].getType(async (err, data) => { - if (!err) { - if (!isEmpty(data)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_TYPE_CALLBACK_0100 success, data : " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_TYPE_CALLBACK_0100 FAILED, data == null || undefined"); - expect().assertFail(); - } - - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_TYPE_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_TYPE_CALLBACK_0100 ends here"); - await sleep(1000); - }) - } - await sleep(1000); - done(); - }) - - /** * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_METADATA_TYPE_PROMISE_0100 * @tc.name : Start metadataOutput type async api @@ -914,12 +753,7 @@ export default function cameraJSUnitOutput() { if (isEmpty(mMetadataObjectArray)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_TYPE_PROMISE_0100 mMetadataObjectArray == null || undefined") } else { - let type = mMetadataObjectArray[0].getType().then((result) => { - console.info('SUB_MULTIMEDIA_CAMERA_GET_METADATA_TYPE_PROMISE_0100 success :' + result); - }).catch((err) => { - console.info('SUB_MULTIMEDIA_CAMERA_GET_METADATA_TYPE_PROMISE_0100 failed :' + err); - expect().assertFail(); - }); + let type = mMetadataObjectArray[0].type; console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_TYPE_PROMISE_0100 success, type : " + type); } await sleep(1000); @@ -927,40 +761,6 @@ export default function cameraJSUnitOutput() { }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_METADATA_TIMESTAMP_CALLBACK_0100 - * @tc.name : Start metadataOutput timestamp async api - * @tc.desc : Start metadataOutput timestamp async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 1 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_METADATA_TIMESTAMP_CALLBACK_0100', 1, async function (done) { - console.info(TAG + " --------------SUB_MULTIMEDIA_CAMERA_GET_METADATA_TIMESTAMP_CALLBACK_0100--------------"); - if (isEmpty(mMetadataObjectArray)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_TIMESTAMP_CALLBACK_0100 mMetadataObjectArray == null || undefined") - } else { - mMetadataObjectArray[0].getTimestamp(async (err, data) => { - if (!err) { - if (!isEmpty(data)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_TIMESTAMP_CALLBACK_0100 success, data : " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_TIMESTAMP_CALLBACK_0100 FAILED, data == null || undefined"); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_TIMESTAMP_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_TIMESTAMP_CALLBACK_0100 ends here"); - await sleep(1000); - }) - } - await sleep(1000); - done(); - }) - - /** * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_METADATA_TIMESTAMP_PROMISE_0100 * @tc.name : Start metadataOutput timestamp async api @@ -974,12 +774,7 @@ export default function cameraJSUnitOutput() { if (isEmpty(mMetadataObjectArray)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_TIMESTAMP_PROMISE_0100 mMetadataObjectArray == null || undefined") } else { - let timeStamp = mMetadataObjectArray[0].getTimestamp().then((result) => { - console.info('SUB_MULTIMEDIA_CAMERA_GET_METADATA_TIMESTAMP_PROMISE_0100 success :' + result); - }).catch((err) => { - console.info('SUB_MULTIMEDIA_CAMERA_GET_METADATA_TIMESTAMP_PROMISE_0100 failed :' + err); - expect().assertFail(); - }); + let timeStamp = mMetadataObjectArray[0].timestamp; console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_TIMESTAMP_PROMISE_0100 success, timeStamp : " + timeStamp); } await sleep(1000); @@ -987,42 +782,6 @@ export default function cameraJSUnitOutput() { }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_METADATA_BOUNDING_BOX_CALLBACK_0100 - * @tc.name : Start metadataOutput bounding box async api - * @tc.desc : Start metadataOutput bounding box async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 1 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_METADATA_BOUNDING_BOX_CALLBACK_0100', 1, async function (done) { - console.info(TAG + " --------------SUB_MULTIMEDIA_CAMERA_GET_METADATA_BOUNDING_BOX_CALLBACK_0100--------------"); - if (isEmpty(mMetadataObjectArray)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_BOUNDING_BOX_CALLBACK_0100 mMetadataObjectArray == null || undefined") - } else { - mMetadataObjectArray[0].getBoundingBox(async (err, data) => { - if (!err) { - if (!isEmpty(data)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_BOUNDING_BOX_CALLBACK_0100 success, data : " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_BOUNDING_BOX_CALLBACK_0100 FAILED, data == null || undefined"); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_BOUNDING_BOX_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_BOUNDING_BOX_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - - } - await sleep(1000); - done(); - }) - - /** * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_METADATA_BOUNDING_BOX_PROMISE_0100 * @tc.name : Start metadataOutput bounding box async api @@ -1036,14 +795,13 @@ export default function cameraJSUnitOutput() { if (isEmpty(mMetadataObjectArray)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_BOUNDING_BOX_PROMISE_0100 mMetadataObjectArray == null || undefined") } else { - let boundingBox = mMetadataObjectArray[0].getBoundingBox().then((result) => { - console.info('SUB_MULTIMEDIA_CAMERA_GET_METADATA_BOUNDING_BOX_PROMISE_0100 success :' + result); - }).catch((err) => { - console.info('SUB_MULTIMEDIA_CAMERA_GET_METADATA_BOUNDING_BOX_PROMISE_0100 failed :' + err); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_BOUNDING_BOX_PROMISE_0100 success, boundingBox : " + boundingBox.width + "x" + boundingBox.height); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_BOUNDING_BOX_PROMISE_0100 success, boundingBox : " + boundingBox.topLeftX + "x" + boundingBox.topLeftY); + let boundingBox = mMetadataObjectArray[0].boundingBox; + let w = boundingBox.width; + let h = boundingBox.height; + let tx = boundingBox.topLeftX; + let ty = boundingBox.topLeftY; + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_BOUNDING_BOX_PROMISE_0100 success, boundingBox : " + w + "x" + h); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_BOUNDING_BOX_PROMISE_0100 success, boundingBox : " + tx + "x" + ty); } await sleep(1000); done(); @@ -1312,12 +1070,7 @@ export default function cameraJSUnitOutput() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_IS_MIRROR_SUPPORTED_PROMISE_0100 photoOutput == null || undefined") expect().assertFail(); } else { - let isMirrorSupportedFlag = await photoOutput.isMirrorSupported().then((result) => { - console.info('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_IS_MIRROR_SUPPORTED_PROMISE_0100 success :' + result); - }).catch((err) => { - console.info('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_IS_MIRROR_SUPPORTED_PROMISE_0100 failed :' + err); - expect().assertFail(); - }); + let isMirrorSupportedFlag = photoOutput.isMirrorSupported(); console.info('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_IS_MIRROR_SUPPORTED_PROMISE_0100 isMirrorSupportedFlag = ' + isMirrorSupportedFlag); } @@ -1326,44 +1079,6 @@ export default function cameraJSUnitOutput() { }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_IS_MIRROR_SUPPORTED_CALLBACK_0100 - * @tc.name : check photoOutput is mirror supported with callback mode - * @tc.desc : check photoOutput is mirror supported with callback mode - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 1 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_IS_MIRROR_SUPPORTED_CALLBACK_0100', 1, async function (done) { - console.info(TAG + " --------------SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_IS_MIRROR_SUPPORTED_CALLBACK_0100--------------"); - if (isEmpty(photoOutput)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_IS_MIRROR_SUPPORTED_CALLBACK_0100 photoOutput == null || undefined") - expect().assertFail(); - } else { - photoOutput.isMirrorSupported(async (err, data) => { - if (!err) { - if (!isEmpty(data)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_IS_MIRROR_SUPPORTED_CALLBACK_0100 success, data = " + data); - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_IS_MIRROR_SUPPORTED_CALLBACK_0100 FAILED, data == null || undefined"); - expect().assertFail(); - } - - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_IS_MIRROR_SUPPORTED_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_IS_MIRROR_SUPPORTED_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - } - await sleep(1000); - done(); - }) - - /** * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CAPTURE_DEFAULT_PROMISE_0100 @@ -1506,14 +1221,9 @@ export default function cameraJSUnitOutput() { } else { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_CAPTURE_START_0100 to operate"); let count = 0; - photoOutput.on('captureStart', async (err, data) => { - if (!err) { - count++; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_CAPTURE_START_0100 success"); - } else { - expect().assertFail(); - console.info(TAG + "Error in SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_CAPTURE_START_0100 FAILED: " + err.message); - } + photoOutput.on('captureStart', async (data) => { + count++; + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_CAPTURE_START_0100 success"); await sleep(1000); done(); }) @@ -1582,18 +1292,13 @@ export default function cameraJSUnitOutput() { } else { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_CAPTURE_END_0100 to operate"); let count = 0; - photoOutput.on('captureEnd', async (err, data) => { - if (!err) { - count++; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_CAPTURE_END_0100 success"); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_CAPTURE_END_0100, captureId = " + data.captureId); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_CAPTURE_END_0100, frameCount = " + data.frameCount); - } else { - expect().assertFail(); - console.info(TAG + "Error in SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_CAPTURE_END_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); + photoOutput.on('captureEnd', async (data) => { + count++; + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_CAPTURE_END_0100 success"); + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_CAPTURE_END_0100, captureId = " + data.captureId); + console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_CAPTURE_END_0100, frameCount = " + data.frameCount); + await sleep(1000); + done(); }) await sleep(1000); done(); diff --git a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraManagerTest.test.ets b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraManagerTest.test.ets index 7c06bf62e5ca46602452c7462eea03368fa24fe5..e2e7cc76ef3bb3535ebf6c79f0f4067b58bef6df 100644 --- a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraManagerTest.test.ets +++ b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraManagerTest.test.ets @@ -161,10 +161,10 @@ export default function cameraManagerTest() { return false; } - async function getCameraManagerInstance() { + function getCameraManagerInstance() { console.info('Enter getCameraManagerInstance'); - mCameraManager = await cameraObj.getCameraManager(null); + mCameraManager = cameraObj.getCameraManager(null); if (isEmpty(mCameraManager)) { console.info(TAG + "getCameraManager FAILED"); return false; @@ -175,10 +175,10 @@ export default function cameraManagerTest() { return true; } - async function getCameraSupportDevicesArray() { + function getCameraSupportDevicesArray() { console.info('Enter getCameraSupportDevicesArray'); - mCameraDevicesArray = await mCameraManager.getSupportedCameras(); + mCameraDevicesArray = mCameraManager.getSupportedCameras(); /* mCameraManager.getSupportedCameras(async (err, data) => { console.info(TAG + "Entering getCameraSupportDevicesArray callback"); @@ -210,63 +210,32 @@ export default function cameraManagerTest() { return true; } - async function getSupportedOutputCapabilityInCallback(cameraDevice) { + function getSupportedOutputCapability(cameraDevice) { if (isEmpty(mCameraManager)) { - console.info(TAG + "Entering getSupportedOutputCapabilityInCallback cameraManager == null || undefined") + console.info(TAG + "Entering getSupportedOutputCapability cameraManager == null || undefined") expect().assertFail(); return undefined; } - let outputCapabilityCallback = null; - mCameraManager.getSupportedOutputCapability(cameraDevice, async (err, data) => { - if (!err) { - if (!isEmpty(data)) { - console.info(TAG + "getSupportedOutputCapabilityInCallback data is not null || undefined"); - outputCapabilityCallback = data; - } - else { - console.info(TAG + "getSupportedOutputCapabilityInCallback FAILED"); - } - } else { - console.info(TAG + "getSupportedOutputCapabilityInCallback FAILED: " + err.message); - } - console.info(TAG + "getSupportedOutputCapabilityInCallback ends here"); - }) - await sleep(100); - return outputCapabilityCallback; - } - async function getSupportedOutputCapabilityInPromise(cameraDevice) { - if (isEmpty(mCameraManager)) { - console.info(TAG + "Entering getSupportedOutputCapabilityInPromise cameraManager == null || undefined") - expect().assertFail(); - return undefined; - } + let outputCapability = mCameraManager.getSupportedOutputCapability(cameraDevice); - let outputCapabilityPromise = null; - await mCameraManager.getSupportedOutputCapability(cameraDevice).then((result) => { - console.info('getSupportedOutputCapabilityInPromise success'); - outputCapabilityPromise = result; - }).catch((err) => { - console.info('getSupportedOutputCapabilityInPromise failed, err = ' + err.message); - }); - - if (isEmpty(outputCapabilityPromise)) { - console.info(TAG + "Entering getSupportedOutputCapabilityInPromise outputCapabilityPromise == null || undefined") + if (isEmpty(outputCapability)) { + console.info(TAG + "Entering getSupportedOutputCapability outputCapability == null || undefined") } else { - console.info("CameraUnitTest: getSupportedOutputCapabilityInPromise: " + JSON.stringify(outputCapabilityPromise)); + console.info("CameraUnitTest: getSupportedOutputCapability: " + JSON.stringify(outputCapability)); } - return outputCapabilityPromise; + return outputCapability; } describe('CameraManagerTest', function () { console.info(TAG + '----------CameraManagerTest--------------') beforeAll(async function () { - await getCameraManagerInstance(); + getCameraManagerInstance(); await getImageReceiverSurfaceId(); await getVideoReceiveSurface(); - await getCameraSupportDevicesArray(); + getCameraSupportDevicesArray(); console.info('beforeAll case'); }) @@ -285,30 +254,7 @@ describe('CameraManagerTest', function () { console.info('afterAll case'); }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAMANAGER_CALLBACK_0100 - * @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 2 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAMANAGER_CALLBACK_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAMANAGER_CALLBACK_0100--------------"); - cameraObj.getCameraManager(null, async (err, data) => { - if (!err) { - expect(isEmpty(data)).assertFalse(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAMANAGER_CALLBACK_0100 success"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAMANAGER_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAMANAGER_CALLBACK_0100 ends here"); - await sleep(1000); - }) - await sleep(1000); - done(); - }) + /** * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 @@ -320,68 +266,9 @@ describe('CameraManagerTest', function () { */ it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100', 2, async function (done) { console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100--------------"); - let cameraManagerPromise = await cameraObj.getCameraManager(null); + let cameraManagerPromise = cameraObj.getCameraManager(null); expect(isEmpty(cameraManagerPromise)).assertFalse(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 cameraManagerPromise: " + JSON.stringify(cameraManagerPromise)); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERAS_CALLBACK_0100 - * @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 2 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERAS_CALLBACK_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERAS_CALLBACK_0100--------------"); - if (isEmpty(mCameraManager)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERAS_CALLBACK_0100 cameraManager == null || undefined") - expect().assertFail(); - } - mCameraManager.getSupportedCameras(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERAS_CALLBACK_0100 success"); - if (!isEmpty(data)) { - mCameraDevicesArray = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERAS_CALLBACK_0100 data is " + mCameraDevicesArray.length); - if (mCameraDevicesArray.length > 0) { - for (let i = 0; i < mCameraDevicesArray.length; i++) { - // Get the variables from camera object - let cameraId = mCameraDevicesArray[i].cameraId; - expect(isEmpty(cameraId)).assertFalse(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERAS_CALLBACK_0100 camera" + i + "Id: " + cameraId); - let cameraPosition = mCameraDevicesArray[i].cameraPosition; - expect(isEmpty(cameraPosition)).assertFalse(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERAS_CALLBACK_0100 camera" + i + "Position: " + cameraPosition); - let cameraType = mCameraDevicesArray[i].cameraType; - expect(isEmpty(cameraType)).assertFalse(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERAS_CALLBACK_0100 camera" + i + "Type: " + cameraType); - let connectionType = mCameraDevicesArray[i].connectionType - expect(isEmpty(connectionType)).assertFalse(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERAS_CALLBACK_0100 connection" + i + "Type: " + connectionType); - } - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERAS_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERAS_CALLBACK_0100 FAILED cameraArray is null || undefined"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERAS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERAS_CALLBACK_0100 FAILED cameraArray is null || undefined"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERAS_CALLBACK_0100 FAILED , err = " + err.message); - } - }) - await sleep(1000); done(); }) @@ -399,7 +286,7 @@ describe('CameraManagerTest', function () { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 cameraManager == null || undefined") expect().assertFail(); } else { - let mCameraDevicesArrayPromise = await mCameraManager.getSupportedCameras(); + let mCameraDevicesArrayPromise = mCameraManager.getSupportedCameras(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100: " + JSON.stringify(mCameraDevicesArrayPromise)); if (mCameraDevicesArrayPromise != null && mCameraDevicesArrayPromise.length > 0) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 success"); @@ -443,8 +330,7 @@ describe('CameraManagerTest', function () { console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_CALLBACK_0100--------------"); let camerasArray = mCameraDevicesArray; for (let i = 0; i < camerasArray.length; i++) { - let cameraOutputCap = await getSupportedOutputCapabilityInCallback(camerasArray[i]); - await sleep(100); + let cameraOutputCap = getSupportedOutputCapability(camerasArray[i]); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_CALLBACK_0100 camera:" + camerasArray[i].cameraId); if (!isEmpty(cameraOutputCap)) { let previewProfilesArray = cameraOutputCap.previewProfiles; @@ -474,7 +360,6 @@ describe('CameraManagerTest', function () { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_CALLBACK_0100 PASSED camera:" + camerasArray[i].cameraId); } console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_CALLBACK_0100 ends here"); - await sleep(1000); done(); }) @@ -489,7 +374,7 @@ describe('CameraManagerTest', function () { it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_PROMISE_0100', 2, async function (done) { console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_PROMISE_0100--------------"); for (let i = 0; i < mCameraDevicesArray.length; i++) { - let cameraOutputCap = await getSupportedOutputCapabilityInPromise(mCameraDevicesArray[i]); + let cameraOutputCap = getSupportedOutputCapability(mCameraDevicesArray[i]); console.info("Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_PROMISE_0100 camera:" + mCameraDevicesArray[i].cameraId); if (!isEmpty(cameraOutputCap)) { let previewProfilesArray = cameraOutputCap.previewProfiles; @@ -521,7 +406,6 @@ describe('CameraManagerTest', function () { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_PROMISE_0100 PASSED camera:" + mCameraDevicesArray[i].cameraId); } console.info("CameraUnitTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_PROMISE_0100 ends here"); - await sleep(1000); done(); }) @@ -537,7 +421,7 @@ describe('CameraManagerTest', function () { console.info("--------------SUB_MULTIMEDIA_CAMERA_PREVIEW_PROFILES_0100--------------"); let camerasArray = mCameraDevicesArray; for (let i = 0; i < camerasArray.length; i++) { - let cameraOutputCap = await getSupportedOutputCapabilityInPromise(camerasArray[i]); + let cameraOutputCap = getSupportedOutputCapability(camerasArray[i]); console.info("Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_PROFILES_0100 camera:" + camerasArray[i].cameraId); if (!isEmpty(cameraOutputCap)) { let previewProfilesArray = cameraOutputCap.previewProfiles; @@ -558,7 +442,6 @@ describe('CameraManagerTest', function () { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_PROFILES_0100 PASSED camera:" + camerasArray[i].cameraId); } - await sleep(1000); done(); }) @@ -574,7 +457,7 @@ describe('CameraManagerTest', function () { console.info("--------------SUB_MULTIMEDIA_CAMERA_PHOTO_PROFILES_0100--------------"); let camerasArray = mCameraDevicesArray; for (let i = 0; i < camerasArray.length; i++) { - let cameraOutputCap = await getSupportedOutputCapabilityInPromise(camerasArray[i]); + let cameraOutputCap = getSupportedOutputCapability(camerasArray[i]); console.info("Entering SUB_MULTIMEDIA_CAMERA_PHOTO_PROFILES_0100 camera:" + camerasArray[i].cameraId); if (!isEmpty(cameraOutputCap)) { let photoProfilesArray = cameraOutputCap.photoProfiles; @@ -595,7 +478,6 @@ describe('CameraManagerTest', function () { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_PROFILES_0100 PASSED camera:" + camerasArray[i].cameraId); } - await sleep(1000); done(); }) @@ -611,7 +493,7 @@ describe('CameraManagerTest', function () { console.info("--------------SUB_MULTIMEDIA_CAMERA_VIDEO_PROFILES_0100--------------"); let camerasArray = mCameraDevicesArray; for (let i = 0; i < camerasArray.length; i++) { - let cameraOutputCap = await getSupportedOutputCapabilityInPromise(camerasArray[i]); + let cameraOutputCap = getSupportedOutputCapability(camerasArray[i]); console.info("Entering SUB_MULTIMEDIA_CAMERA_VIDEO_PROFILES_0100 camera:" + camerasArray[i].cameraId); if (!isEmpty(cameraOutputCap)) { let videoProfilesArray = cameraOutputCap.videoProfiles; @@ -635,43 +517,6 @@ describe('CameraManagerTest', function () { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEO_PROFILES_0100 PASSED camera:" + camerasArray[i].cameraId); } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 - * @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 2 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100--------------"); - if (isEmpty(mCameraManager)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 cameraManager == null || undefined") - expect().assertFail(); - } else { - let camerasArray = mCameraDevicesArray; - for (let i = 0; i < camerasArray.length; i++) { - mCameraManager.createCameraInput(camerasArray[i], async (err, data) => { - if (!err) { - if (isEmpty(data)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 data == null || undefined") - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 PASSED with CameraID :" + mCameraDevicesArray[0].cameraId); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 camera: " + camerasArray[i].cameraId); - }) - } - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 ends here"); - await sleep(1000); done(); }) @@ -691,7 +536,7 @@ describe('CameraManagerTest', function () { } else { let camerasArray = mCameraDevicesArray; for (let i = 0; i < camerasArray.length; i++) { - let cameraInputPromise = await mCameraManager.createCameraInput(camerasArray[i]); + let cameraInputPromise = mCameraManager.createCameraInput(camerasArray[i]); if (isEmpty(cameraInputPromise)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 cameraInputPromise == null || undefined") expect().assertFail(); @@ -700,43 +545,6 @@ describe('CameraManagerTest', function () { } } console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_CALLBACK_0100 - * @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 2 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_CALLBACK_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_CALLBACK_0100--------------"); - if (isEmpty(mCameraManager)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_CALLBACK_0100 cameraManager == null || undefined") - expect().assertFail(); - } else { - let camerasArray = mCameraDevicesArray; - for (let i = 0; i < camerasArray.length; i++) { - mCameraManager.createCameraInput(camerasArray[i].cameraPosition, camerasArray[i].cameraType, async (err, data) => { - if (!err) { - if (isEmpty(data)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_CALLBACK_0100 data == null || undefined") - expect().assertFail(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_CALLBACK_0100 success"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - }) - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera: " + camerasArray[i].cameraId); - } - } - await sleep(1000); done(); }) @@ -756,7 +564,7 @@ describe('CameraManagerTest', function () { } else { let camerasArray = mCameraDevicesArray; for (let i = 0; i < camerasArray.length; i++) { - let cameraInputPromiseByType = await mCameraManager.createCameraInput(camerasArray[i].cameraPosition, camerasArray[i].cameraType); + let cameraInputPromiseByType = mCameraManager.createCameraInput(camerasArray[i].cameraPosition, camerasArray[i].cameraType); if (isEmpty(cameraInputPromiseByType)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_PROMISE_0100 cameraInputPromiseByType == null || undefined") expect().assertFail(); @@ -765,47 +573,6 @@ describe('CameraManagerTest', function () { } } console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CREATE CAMERAOUTPUT*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PREVIEW_OUTPUT_CALLBACK_0100 - * @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 2 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PREVIEW_OUTPUT_CALLBACK_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PREVIEW_OUTPUT_CALLBACK_0100--------------"); - let camerasArray = mCameraDevicesArray; - for (let i = 0; i < camerasArray.length; i++) { - let cameraOutputCap = await getSupportedOutputCapabilityInPromise(camerasArray[i]); - console.info("SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PREVIEW_OUTPUT_CALLBACK_0100 camera:" + camerasArray[i].cameraId); - - if (!isEmpty(cameraOutputCap)) { - let previewProfilesArray = cameraOutputCap.previewProfiles; - if (isEmpty(previewProfilesArray)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PREVIEW_OUTPUT_CALLBACK_0100 previewProfilesArray == null || undefined") - expect().assertFail(); - } else { - for (let j = 0; j < previewProfilesArray.length; j++) { - mCameraManager.createPreviewOutput(previewProfilesArray[j], globalThis.surfaceId, async (err, data) => { - if (isEmpty(data)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PREVIEW_OUTPUT_CALLBACK_0100 data == null || undefined") - expect().assertFail(); - } - }) - await sleep(100); - } - } - - } - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PREVIEW_OUTPUT_CALLBACK_0100 PASS"); - await sleep(1000); done(); }) @@ -821,7 +588,7 @@ describe('CameraManagerTest', function () { console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PREVIEW_OUTPUT_PROMISE_0100--------------"); let camerasArray = mCameraDevicesArray; for (let i = 0; i < camerasArray.length; i++) { - let cameraOutputCap = await getSupportedOutputCapabilityInPromise(camerasArray[i]); + let cameraOutputCap = getSupportedOutputCapability(camerasArray[i]); console.info("SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PREVIEW_OUTPUT_PROMISE_0100 camera:" + camerasArray[i].cameraId); if (!isEmpty(cameraOutputCap)) { let previewProfilesArray = cameraOutputCap.previewProfiles; @@ -830,12 +597,11 @@ describe('CameraManagerTest', function () { expect().assertFail(); } else { for (let j = 0; j < previewProfilesArray.length; j++) { - let previewOutputPromise = await mCameraManager.createPreviewOutput(previewProfilesArray[j], globalThis.surfaceId); + let previewOutputPromise = mCameraManager.createPreviewOutput(previewProfilesArray[j], globalThis.surfaceId); if (isEmpty(previewOutputPromise)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PREVIEW_OUTPUT_PROMISE_0100 previewOutputPromise == null || undefined") expect().assertFail(); - } - await sleep(100); + } } } @@ -847,44 +613,6 @@ describe('CameraManagerTest', function () { done(); }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PHOTO_OUTPUT_CALLBACK_0100 - * @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 2 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PHOTO_OUTPUT_CALLBACK_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PHOTO_OUTPUT_CALLBACK_0100--------------"); - let camerasArray = mCameraDevicesArray; - for (let i = 0; i < camerasArray.length; i++) { - let cameraOutputCap = await getSupportedOutputCapabilityInPromise(camerasArray[i]); - console.info("SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PHOTO_OUTPUT_CALLBACK_0100 camera:" + camerasArray[i].cameraId); - if (!isEmpty(cameraOutputCap)) { - let photoProfilesArray = cameraOutputCap.photoProfiles; - if (isEmpty(photoProfilesArray)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PHOTO_OUTPUT_CALLBACK_0100 photoProfilesArray == null || undefined") - expect().assertFail(); - } else { - for (let j = 0; j < photoProfilesArray.length; j++) { - mCameraManager.createPhotoOutput(photoProfilesArray[j], mPhotoSurface, async (err, data) => { - if (isEmpty(data)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PHOTO_OUTPUT_CALLBACK_0100 data == null || undefined") - expect().assertFail(); - } - }) - await sleep(100); - } - } - - } - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PHOTO_OUTPUT_CALLBACK_0100 PASS"); - await sleep(1000); - done(); - }) - /** * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PHOTO_OUTPUT_PROMISE_0100 * @tc.name : Create camerainput from camera-0 cameraposition front & cameratype unspecified async api @@ -897,7 +625,7 @@ describe('CameraManagerTest', function () { console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PHOTO_OUTPUT_PROMISE_0100--------------"); let camerasArray = mCameraDevicesArray; for (let i = 0; i < camerasArray.length; i++) { - let cameraOutputCap = await getSupportedOutputCapabilityInPromise(camerasArray[i]); + let cameraOutputCap = getSupportedOutputCapability(camerasArray[i]); console.info("SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PHOTO_OUTPUT_PROMISE_0100 camera:" + camerasArray[i].cameraId); if (!isEmpty(cameraOutputCap)) { let photoProfilesArray = cameraOutputCap.photoProfiles; @@ -906,73 +634,20 @@ describe('CameraManagerTest', function () { expect().assertFail(); } else { for (let j = 0; j < photoProfilesArray.length; j++) { - let photoOutputPromise = await mCameraManager.createPhotoOutput(photoProfilesArray[j], mPhotoSurface); + let photoOutputPromise = mCameraManager.createPhotoOutput(photoProfilesArray[j], mPhotoSurface); if (isEmpty(photoOutputPromise)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PHOTO_OUTPUT_PROMISE_0100 photoOutputPromise == null || undefined") expect().assertFail(); - } - await sleep(100); + } } } } } console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PHOTO_OUTPUT_PROMISE_0100 PASS"); - await sleep(1000); done(); }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_CALLBACK_0100 - * @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 2 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_CALLBACK_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_CALLBACK_0100--------------"); - let camerasArray = mCameraDevicesArray; - let createVideoOutputFlag; - for (let i = 0; i < camerasArray.length; i++) { - let cameraOutputCap = await getSupportedOutputCapabilityInPromise(camerasArray[i]); - console.info("SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_CALLBACK_0100 camera:" + camerasArray[i].cameraId); - if (!isEmpty(cameraOutputCap)) { - let videoProfilesArray = cameraOutputCap.videoProfiles; - if (isEmpty(videoProfilesArray)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_CALLBACK_0100 videoProfilesArray == null || undefined") - expect().assertFail(); - } else { - createVideoOutputFlag = false; - for (let j = 0; j < videoProfilesArray.length; j++) { - mCameraManager.createVideoOutput(videoProfilesArray[j], mVideoSurface, async (err, data) => { - if (!err) { - if (isEmpty(data)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_CALLBACK_0100 data == null || undefined"); - expect().assertFail(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_CALLBACK_0100 data = " + data); - createVideoOutputFlag = true; - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_CALLBACK_0100 failed, err = " + err.message); - expect().assertFail(); - } - - }) - await sleep(100); - - if (createVideoOutputFlag == true) { - break; - } - } - } - } - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_CALLBACK_0100 PASS"); - await sleep(1000); - done(); - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_PROMISE_0100 @@ -986,7 +661,7 @@ describe('CameraManagerTest', function () { console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_PROMISE_0100--------------"); let camerasArray = mCameraDevicesArray; for (let i = 0; i < camerasArray.length; i++) { - let cameraOutputCap = await getSupportedOutputCapabilityInPromise(camerasArray[i]); + let cameraOutputCap = getSupportedOutputCapability(camerasArray[i]); console.info("SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_PROMISE_0100 camera:" + camerasArray[i].cameraId); if (!isEmpty(cameraOutputCap)) { let videoProfilesArray = cameraOutputCap.videoProfiles; @@ -995,7 +670,7 @@ describe('CameraManagerTest', function () { expect().assertFail(); } else { for (let j = 0; j < videoProfilesArray.length; j++) { - let videoOutputPromise = await mCameraManager.createVideoOutput(videoProfilesArray[j], mVideoSurface); + let videoOutputPromise = mCameraManager.createVideoOutput(videoProfilesArray[j], mVideoSurface); if (isEmpty(videoOutputPromise)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_PROMISE_0100 videoOutputPromise == null || undefined") expect().assertFail(); @@ -1003,57 +678,12 @@ describe('CameraManagerTest', function () { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_CALLBACK_0100 videoOutputPromise = " + videoOutputPromise); break; } - await sleep(100); } } } } console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_PROMISE_0100 PASS"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_CALLBACK_0100 - * @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 2 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_CALLBACK_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_CALLBACK_0100--------------"); - let camerasArray = mCameraDevicesArray; - for (let i = 0; i < camerasArray.length; i++) { - let cameraOutputCap = await getSupportedOutputCapabilityInPromise(camerasArray[i]); - console.info("SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_CALLBACK_0100 camera:" + camerasArray[i].cameraId); - if (!isEmpty(cameraOutputCap)) { - let metadataObjectTypeArray = cameraOutputCap.supportedMetadataObjectTypes; - if (!isEmpty(metadataObjectTypeArray)) { - mCameraManager.createMetadataOutput(metadataObjectTypeArray, async (err, data) => { - if (!err) { - if (isEmpty(data)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_CALLBACK_0100 data == null || undefined") - expect().assertFail(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_CALLBACK_0100 data = " + data) - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_CALLBACK_0100 err = " + err.message) - expect().assertFail(); - } - - }) - await sleep(100); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_CALLBACK_0100 metadataObjectTypeArray == null || undefined") - } - await sleep(300); - } - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_CALLBACK_0100 PASS"); - await sleep(1000); done(); }) @@ -1069,59 +699,24 @@ describe('CameraManagerTest', function () { console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_PROMISE_0100--------------"); let camerasArray = mCameraDevicesArray; for (let i = 0; i < camerasArray.length; i++) { - let cameraOutputCap = await getSupportedOutputCapabilityInPromise(camerasArray[i]); + let cameraOutputCap = getSupportedOutputCapability(camerasArray[i]); console.info("SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_PROMISE_0100 camera:" + camerasArray[i].cameraId); if (!isEmpty(cameraOutputCap)) { let metadataObjectTypeArray = cameraOutputCap.supportedMetadataObjectTypes; if (!isEmpty(metadataObjectTypeArray)) { - let metadataOutputPromise = await mCameraManager.createMetadataOutput(metadataObjectTypeArray); + let metadataOutputPromise = mCameraManager.createMetadataOutput(metadataObjectTypeArray); if (isEmpty(metadataOutputPromise)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_PROMISE_0100 metadataOutputPromise == null || undefined") expect().assertFail(); } else { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_PROMISE_0100 metadataOutputPromise = " + metadataOutputPromise) } - await sleep(100); } else { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_PROMISE_0100 metadataObjectTypeArray == null || undefined") } } } console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_PROMISE_0100 PASS"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100 - * @tc.name : Create CaptureSession instance api - * @tc.desc : Create CaptureSession instance api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_MANAGER_CREATE_CAPTURE_SESSION_CALLBACK_0100', 2, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_MANAGER_CREATE_CAPTURE_SESSION_CALLBACK_0100 to operate"); - let cameraSession; - mCameraManager.createCaptureSession(async (err, data) => { - if (!err) { - console.info(TAG + "Entering createCaptureSession success"); - if (isEmpty(data)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_MANAGER_CREATE_CAPTURE_SESSION_CALLBACK_0100 data == null || undefined") - expect().assertFail(); - } else { - cameraSession = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_MANAGER_CREATE_CAPTURE_SESSION_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_MANAGER_CREATE_CAPTURE_SESSION_CALLBACK_0100 FAILED : " + err.message); - } - await sleep(300); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_MANAGER_CREATE_CAPTURE_SESSION_CALLBACK_0100 ends here"); - }) - await sleep(1000); - await cameraSession.release(); done(); }) @@ -1135,50 +730,15 @@ describe('CameraManagerTest', function () { */ it('SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100', 2, async function (done) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 to operate"); - let captureSessionPromise = await mCameraManager.createCaptureSession(); + let captureSessionPromise = mCameraManager.createCaptureSession(); if (isEmpty(captureSessionPromise)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 captureSessionPromise == null || undefined") expect().assertFail(); } console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 PASSED"); - await sleep(1000); await captureSessionPromise.release(); done(); }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 - * @tc.name : camera status callback on CameraManager async api - * @tc.desc : camera status callback on CameraManager async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100', 2, async function (done) { - if (isEmpty(mCameraManager)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 cameraManager == null || undefined") - expect().assertFail(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 to operate") - mCameraManager.on('cameraStatus', async (err, data) => { - if (!err) { - console.info(TAG + "Camera status Callback on cameraManager is success"); - if (isEmpty(data)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 data == null || undefined") - expect().assertFail(); - } - console.info(TAG + "Camera status Callback CameraStatusInfo_Camera: " + data.camera); - console.info(TAG + "Camera status Callback CameraStatusInfo_Status: " + data.status); - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1000); - }) - } - await sleep(1000); - done(); - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_CAMERA_MUTED_0100 @@ -1202,9 +762,40 @@ describe('CameraManagerTest', function () { console.log(TAG + "isCameraMuted has failed for " + err.message); expect().assertFail(); } - await sleep(1000); done(); }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ON_CAMERASTATUS_0100 + * @tc.name : camera manager on cameraStatus api + * @tc.desc : camera manager on cameraStatus api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_CAMERA_ON_CAMERASTATUS_0100', 1, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ON_CAMERASTATUS_0100--------------"); + if (isEmpty(mCameraManager)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ON_CAMERASTATUS_0100 mCameraManager == null || undefined") + expect().assertFail(); + } else { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ON_CAMERASTATUS_0100 to operate"); + mCameraManager.on('cameraStatus', async (err, data) => { + if (!err) { + expect(true).assertTrue(); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ON_CAMERASTATUS_0100 success"); + } else { + expect().assertFail(); + console.info(TAG + "Error in SUB_MULTIMEDIA_CAMERA_ON_CAMERASTATUS_0100 FAILED: " + err.message); + } + await sleep(1000); + done(); + }) + } + await sleep(1000); + done(); + }) + }) } \ No newline at end of file diff --git a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionBaseTest.test.ets b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionBaseTest.test.ets index 7d7462dbdd097763f138c4c07a1a705a1a33e924..1e722e3d1b999a5241812a7cd652d004fb1dd230 100644 --- a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionBaseTest.test.ets +++ b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionBaseTest.test.ets @@ -171,10 +171,10 @@ export default function cameraSessionTest() { console.log(TAG + 'Exit releaseVideoReceiveSurface') } - async function getCameraManagerInstance() { + function getCameraManagerInstance() { console.info('Enter getCameraManagerInstance'); - mCameraManager = await cameraObj.getCameraManager(null); + mCameraManager = cameraObj.getCameraManager(null); if (isEmpty(mCameraManager)) { console.info(TAG + "getCameraManager FAILED"); return false; @@ -185,26 +185,9 @@ export default function cameraSessionTest() { return true; } - async function getCameraSupportDevicesArray() { + function getCameraSupportDevicesArray() { console.info('Enter getCameraSupportDevicesArray'); - - mCameraDevicesArray = await mCameraManager.getSupportedCameras(); - /* - mCameraManager.getSupportedCameras(async (err, data) => { - console.info(TAG + "Entering getCameraSupportDevicesArray callback"); - if (!err) { - if (data != null || data != undefined) { - mCameraDevicesArray = data; - console.info(TAG + "Entering getCameraSupportDevicesArray PASSED with CameraDevicesArray is: " + data); - } else { - console.info(TAG + "Entering getCameraSupportDevicesArray FAILED with CameraDevicesArray is: " + data); - } - } else { - console.info(TAG + "Entering getCameraSupportDevicesArray FAILED : " + err.message); - } - }) - await sleep(3000); - */ + mCameraDevicesArray = mCameraManager.getSupportedCameras(); if (isEmpty(mCameraDevicesArray)) { console.info(TAG + "getSupportedCameras FAILED"); return false; @@ -220,47 +203,11 @@ export default function cameraSessionTest() { return true; } - async function beginCameraSessionConfig() { - console.info('Enter beginCameraSessionConfig'); - - mCameraSession.beginConfig(async (err) => { - if (!err) { - console.info(TAG + "Entering beginConfig PASSED"); - } else { - console.info(TAG + "Entering beginConfig FAILED : " + err.message); - } - }) - - await sleep(30); - - console.info('Exit beginCameraSessionConfig'); - - return true; - } - - async function commitCameraSessionConfig() { - console.info('Enter commitCameraSessionConfig'); - - mCameraSession.commitConfig(async (err) => { - if (!err) { - console.info(TAG + "Entering commitConfig PASSED"); - } else { - console.info(TAG + "Entering commitConfig FAILED : " + err.message); - } - }) - - await sleep(500); - - console.info('Exit commitCameraSessionConfig'); - - return true; - } - - async function createCameraSessionInstance() { + function createCameraSessionInstance() { console.info('Enter createCameraSessionInstance'); try { - mCameraSession = await mCameraManager.createCaptureSession(); + mCameraSession = mCameraManager.createCaptureSession(); } catch { console.info('createCaptureSession FAILED'); @@ -271,7 +218,7 @@ export default function cameraSessionTest() { return false; } - await beginCameraSessionConfig(); + // mCameraSession.beginConfig(); console.info('Exit createCameraSessionInstance'); @@ -289,28 +236,10 @@ export default function cameraSessionTest() { console.info(TAG + "Entering createInputs FAILED with NoCamera"); return false; } - - mCameraInput = null; - await mCameraManager.createCameraInput(mCameraDevicesArray[idx]).then((result) => { - console.info('createCameraInput success'); - mCameraInput = result; - }).catch((err) => { - console.info('createCameraInput failed, err = ' + err.message); - }); - - if (isEmpty(mCameraInput)) { - console.info(TAG + "createCameraInput FAILED"); - return false; - } + + mCameraInput = mCameraManager.createCameraInput(mCameraDevicesArray[idx]); - mCameraInput.open(async (err) => { - console.info(TAG + "Entering mCameraInput open callback"); - if (!err) { - console.info(TAG + "Entering mCameraInput open PASSED "); - } else { - console.info(TAG + "Entering mCameraInput open FAILED : " + err.message); - } - }) + await mCameraInput.open(); await sleep(100); @@ -326,7 +255,6 @@ export default function cameraSessionTest() { if (!isEmpty(mCameraInput)) { await mCameraInput.close(); - await mCameraInput.release(); } console.info('Exit releaseInput'); @@ -334,24 +262,16 @@ export default function cameraSessionTest() { return true; } - async function createOutput(idx:any) { + function createOutput(idx:any) { console.info('Enter createOutput'); - let cameraOutputCap = null; - await mCameraManager.getSupportedOutputCapability(mCameraDevicesArray[idx]).then((result) => { - console.info('getSupportedOutputCapability success'); - cameraOutputCap = result; - }).catch((err) => { - console.info('getSupportedOutputCapability failed, err = ' + err.message); - mPreviewOutput = null; - mPhotoOutput = null; - }); + let cameraOutputCap = mCameraManager.getSupportedOutputCapability(mCameraDevicesArray[idx]); if (!isEmpty(cameraOutputCap)) { if (!isEmpty(cameraOutputCap.previewProfiles)) { console.info(TAG + "cameraOutputCap.previewProfiles.length: " + cameraOutputCap.previewProfiles.length); for (let i = 0; i < cameraOutputCap.previewProfiles.length; i++) { - mPreviewOutput = await mCameraManager.createPreviewOutput(cameraOutputCap.previewProfiles[i], globalThis.surfaceId); + mPreviewOutput = mCameraManager.createPreviewOutput(cameraOutputCap.previewProfiles[i], globalThis.surfaceId); if (!isEmpty(mPreviewOutput)) { break; } @@ -368,7 +288,7 @@ export default function cameraSessionTest() { console.info(TAG + "cameraOutputCap.photoProfiles.length: " + cameraOutputCap.photoProfiles.length); for (let i = 0; i < cameraOutputCap.photoProfiles.length; i++) { - mPhotoOutput = await mCameraManager.createPhotoOutput(cameraOutputCap.photoProfiles[i], mPhotoSurface); + mPhotoOutput = mCameraManager.createPhotoOutput(cameraOutputCap.photoProfiles[i], mPhotoSurface); if (!isEmpty(mPhotoOutput)) { break; } @@ -380,12 +300,12 @@ export default function cameraSessionTest() { console.info(TAG + "createPhotoOutput: " + mPhotoOutput); } - /* + if (!isEmpty(cameraOutputCap.videoProfiles)) { console.info(TAG + "cameraOutputCap.videoProfiles.length: " + cameraOutputCap.videoProfiles.length); for (let i = 0; i < cameraOutputCap.videoProfiles.length; i++) { try { - mVideoOutput = await mCameraManager.createVideoOutput(cameraOutputCap.videoProfiles[i], mVideoSurface); + mVideoOutput = mCameraManager.createVideoOutput(cameraOutputCap.videoProfiles[i], mVideoSurface); if (!isEmpty(mVideoOutput)) { break; } @@ -401,7 +321,7 @@ export default function cameraSessionTest() { console.info(TAG + "createVideoOutput: " + mVideoOutput); } - */ + } console.info('Exit createOutputs'); @@ -413,7 +333,6 @@ export default function cameraSessionTest() { console.info('Enter releaseOutput'); if (!isEmpty(mPreviewOutput)) { - await mPreviewOutput.stop(); await mPreviewOutput.release(); } @@ -422,7 +341,6 @@ export default function cameraSessionTest() { } if (!isEmpty(mVideoOutput)) { - //await mVideoOutput.stop(); await mVideoOutput.release(); } @@ -435,23 +353,23 @@ export default function cameraSessionTest() { console.info(TAG + "Enter startCameraSession"); await createInput(idx); - await createOutput(idx); + createOutput(idx); await sleep(1); if (!isEmpty(mCameraInput)) { console.info(TAG + "Start to addInput"); - await mCameraSession.addInput(mCameraInput); + mCameraSession.addInput(mCameraInput); } if (!isEmpty(mPreviewOutput)) { console.info(TAG + "Start to addOutput mPreviewOutput"); - await mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPreviewOutput); } if (!isEmpty(mPhotoOutput)) { console.info(TAG + "Start to addOutput mPhotoOutput"); - await mCameraSession.addOutput(mPhotoOutput); + mCameraSession.addOutput(mPhotoOutput); } /* if (!isEmpty(mVideoOutput)) { @@ -461,7 +379,7 @@ export default function cameraSessionTest() { */ await sleep(100); - await commitCameraSessionConfig(); + await mCameraSession.commitConfig(); await sleep(100); @@ -484,6 +402,9 @@ export default function cameraSessionTest() { async function stopCameraSession() { console.info(TAG + "Enter stopCameraSession"); + + mCameraSession.beginConfig(); + /* mCameraSession.stop(async (err) => { console.info(TAG + "Entering mCameraSession stop callback"); @@ -499,17 +420,17 @@ export default function cameraSessionTest() { if (!isEmpty(mCameraInput)) { console.info(TAG + "Start to removeInput input"); - await mCameraSession.removeInput(mCameraInput); + mCameraSession.removeInput(mCameraInput); } if (!isEmpty(mPreviewOutput)) { console.info(TAG + "Start to removeOutput mPreviewOutput"); - await mCameraSession.removeOutput(mPreviewOutput); + mCameraSession.removeOutput(mPreviewOutput); } if (!isEmpty(mPhotoOutput)) { console.info(TAG + "Start to removeOutput mPhotoOutput"); - await mCameraSession.removeOutput(mPhotoOutput); + mCameraSession.removeOutput(mPhotoOutput); } /* if (!isEmpty(mVideoOutput)) { @@ -532,9 +453,9 @@ export default function cameraSessionTest() { sleep(100); await getPhotoReceiverSurface(); await getVideoReceiveSurface(); - await getCameraManagerInstance(); - await getCameraSupportDevicesArray(); - await createCameraSessionInstance(); + getCameraManagerInstance(); + getCameraSupportDevicesArray(); + createCameraSessionInstance(); console.info('Device type = ' + deviceInfo.deviceType); @@ -559,373 +480,152 @@ export default function cameraSessionTest() { console.info('afterAll case'); }) + + /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_CONFIG_CALLBACK_0100 - * @tc.name : Check capture session begin and commit config with callback or not - * @tc.desc : Check capture session begin and commit config with callback or not + * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_BEGIN_CONFIG_0100 + * @tc.name : Check capture session begin config + * @tc.desc : Check capture session begin config * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 2 */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_CONFIG_CALLBACK_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_CONFIG_CALLBACK_0100--------------"); + it('SUB_MULTIMEDIA_CAMERA_SESSION_BEGIN_CONFIG_0100', 2, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_BEGIN_CONFIG_0100--------------"); if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_CONFIG_CALLBACK_0100 FAILED with NoCamera"); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_BEGIN_CONFIG_0100 FAILED with NoCamera"); expect().assertFail(); done(); } else { - await createInput(0); - await createOutput(0); - - if (!isEmpty(mCameraInput)) { - console.info(TAG + "Start to addInput"); - try { - await mCameraSession.addInput(mCameraInput); - } - catch { - console.info(TAG + "addInput failed!"); - } - } - - if (!isEmpty(mPreviewOutput)) { - console.info(TAG + "Start to addOutput mPreviewOutput"); - try { - await mCameraSession.addOutput(mPreviewOutput); - } - catch { - console.info(TAG + "addOutput failed!"); - } - } - - await sleep(500); - - mCameraSession.commitConfig(async (err) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_CONFIG_CALLBACK_0100 PASSED"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_CONFIG_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - mCameraSession.beginConfig(async (err) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_CONFIG_CALLBACK_0100 PASSED"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_CONFIG_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - if (!isEmpty(mCameraInput)) { - console.info(TAG + "Start to removeInput"); - await mCameraSession.removeInput(mCameraInput); - } - - if (!isEmpty(mPreviewOutput)) { - console.info(TAG + "Start to removeOutput mPreviewOutput"); - await mCameraSession.removeOutput(mPreviewOutput); - } - - await releaseInput(); - await releaseOutput(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_CONFIG_CALLBACK_0100 ends here"); - done(); + mCameraSession.beginConfig(); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_BEGIN_CONFIG_0100 PASSED"); + done(); } }) + + /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_CONFIG_PROMISE_0100 - * @tc.name : Check capture session begin and commit config with promise or not - * @tc.desc : Check capture session begin and commit config with promise or not + * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_COMMIT_CONFIG_0100 + * @tc.name : Check capture session commit config + * @tc.desc : Check capture session commit config * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 2 */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_CONFIG_PROMISE_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_CONFIG_PROMISE_0100--------------"); + it('SUB_MULTIMEDIA_CAMERA_SESSION_COMMIT_CONFIG_0100', 2, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_COMMIT_CONFIG_0100--------------"); if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_CONFIG_PROMISE_0100 FAILED with NoCamera"); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_COMMIT_CONFIG_0100 FAILED with NoCamera"); expect().assertFail(); done(); } else { await createInput(0); - await createOutput(0); - + createOutput(0); if (!isEmpty(mCameraInput)) { console.info(TAG + "Start to addInput"); - await mCameraSession.addInput(mCameraInput); + mCameraSession.addInput(mCameraInput); } if (!isEmpty(mPreviewOutput)) { console.info(TAG + "Start to addOutput mPreviewOutput"); - await mCameraSession.addOutput(mPreviewOutput); - } - - await sleep(500); - - try { - await mCameraSession.commitConfig(); - } catch { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_CONFIG_PROMISE_0100 commitConfig with a error"); - expect().assertFail(); + mCameraSession.addOutput(mPreviewOutput); } - try { - await mCameraSession.beginConfig(); - } catch { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_CONFIG_PROMISE_0100 beginConfig with a error"); - expect().assertFail(); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_CONFIG_PROMISE_0100 PASSED"); - - if (!isEmpty(mCameraInput)) { - console.info(TAG + "Start to removeInput"); - await mCameraSession.removeInput(mCameraInput); + if (!isEmpty(mPhotoOutput)) { + console.info(TAG + "Start to addOutput mPhotoOutput"); + mCameraSession.addOutput(mPhotoOutput); } + await mCameraSession.commitConfig(); - if (!isEmpty(mPreviewOutput)) { - console.info(TAG + "Start to removeOutput mPreviewOutput"); - await mCameraSession.removeOutput(mPreviewOutput); - } - - await releaseInput(); - await releaseOutput(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_CONFIG_PROMISE_0100 ends here"); + await stopCameraSession(); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_COMMIT_CONFIG_0100 PASSED"); done(); } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_BEGIN_CONFIG_DUPLICATED_CALLBACK_0100 - * @tc.name : Check capture session begin config duplicated with callback or not - * @tc.desc : Check capture session begin config duplicated with callback or not - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_BEGIN_CONFIG_DUPLICATED_CALLBACK_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_BEGIN_CONFIG_DUPLICATED_CALLBACK_0100--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_BEGIN_CONFIG_DUPLICATED_CALLBACK_0100 FAILED with NoCamera"); - expect().assertFail(); - done(); - } - else { - mCameraSession.beginConfig(async (err) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_BEGIN_CONFIG_DUPLICATED_CALLBACK_0100 FAILED"); - expect().assertFail(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_BEGIN_CONFIG_DUPLICATED_CALLBACK_0100 PASSED : " + err.message); - } - }) - await sleep(500); - - mCameraSession.beginConfig(async (err) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_BEGIN_CONFIG_DUPLICATED_CALLBACK_0100 FAILED"); - expect().assertFail(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_BEGIN_CONFIG_DUPLICATED_CALLBACK_0100 PASSED : " + err.message); - } - }) - await sleep(500); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_BEGIN_CONFIG_DUPLICATED_CALLBACK_0100 ends here"); - done(); - } - }) /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_BEGIN_CONFIG_DUPLICATED_PROMISE_0100 - * @tc.name : Check capture session begin config duplicated with promise or not - * @tc.desc : Check capture session begin config duplicated with promise or not + * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_INPUT_PROMISE_0100 + * @tc.name : Check capture session can add input with promise or not + * @tc.desc : Check capture session can add input with promise or not * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 2 */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_BEGIN_CONFIG_DUPLICATED_PROMISE_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_BEGIN_CONFIG_DUPLICATED_PROMISE_0100--------------"); - + it('SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_INPUT_PROMISE_0100', 2, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_INPUT_PROMISE_0100--------------"); if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_BEGIN_CONFIG_DUPLICATED_PROMISE_0100 FAILED with NoCamera"); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_INPUT_PROMISE_0100 FAILED with NoCamera"); expect().assertFail(); done(); } else { - try { - await mCameraSession.beginConfig(); - } catch { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_BEGIN_CONFIG_DUPLICATED_PROMISE_0100 with a error, ingore it"); - } - try { - await mCameraSession.beginConfig(); - } catch { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_BEGIN_CONFIG_DUPLICATED_PROMISE_0100 with a error, ingore it"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_BEGIN_CONFIG_DUPLICATED_PROMISE_0100 PASSED"); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_BEGIN_CONFIG_DUPLICATED_PROMISE_0100 ends here"); - done(); - } - }) + for (let i = 0; i < mCameraNum; i++) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_INPUT_PROMISE_0100 start for camera[" + i + "]"); - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_COMMIT_CONFIG_DUPLICATED_CALLBACK_0100 - * @tc.name : Check capture session begin config duplicated with callback or not - * @tc.desc : Check capture session begin config duplicated with callback or not - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_COMMIT_CONFIG_DUPLICATED_CALLBACK_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_COMMIT_CONFIG_DUPLICATED_CALLBACK_0100--------------"); + await createInput(i); + mCameraSession.addInput(mCameraInput); + mCameraSession.removeInput(mCameraInput); - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_COMMIT_CONFIG_DUPLICATED_CALLBACK_0100 FAILED with NoCamera"); - expect().assertFail(); + await releaseInput(); + + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_INPUT_PROMISE_0100 end for camera[" + i + "]"); + } + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_INPUT_PROMISE_0100 ends here"); done(); } - else { - mCameraSession.commitConfig(async (err) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_COMMIT_CONFIG_DUPLICATED_CALLBACK_0100 FAILED"); - expect().assertFail(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_COMMIT_CONFIG_DUPLICATED_CALLBACK_0100 PASSED : " + err.message); - } - }) - await sleep(500); - - mCameraSession.commitConfig(async (err) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_COMMIT_CONFIG_DUPLICATED_CALLBACK_0100 FAILED"); - expect().assertFail(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_COMMIT_CONFIG_DUPLICATED_CALLBACK_0100 PASSED : " + err.message); - } - }) - await sleep(500); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_COMMIT_CONFIG_DUPLICATED_CALLBACK_0100 ends here"); - done(); - } }) + + /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_COMMIT_CONFIG_DUPLICATED_PROMISE_0100 - * @tc.name : Check capture session begin config duplicated with promise or not - * @tc.desc : Check capture session begin config duplicated with promise or not + * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_PROMISE_0100 + * @tc.name : Check capture session can add output with promise or not for preview + * @tc.desc : Check capture session can add output with promise or not for preview * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 2 */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_COMMIT_CONFIG_DUPLICATED_PROMISE_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_COMMIT_CONFIG_DUPLICATED_PROMISE_0100--------------"); + it('SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_PROMISE_0100', 2, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_PROMISE_0100--------------"); if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_COMMIT_CONFIG_DUPLICATED_PROMISE_0100 FAILED with NoCamera"); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_PROMISE_0100 FAILED with NoCamera"); expect().assertFail(); done(); } else { - try { - await mCameraSession.commitConfig(); - } catch { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_COMMIT_CONFIG_DUPLICATED_PROMISE_0100 with a error, ingore it"); - } - try { - await mCameraSession.commitConfig(); - } catch { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_COMMIT_CONFIG_DUPLICATED_PROMISE_0100 with a error, ingore it"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_COMMIT_CONFIG_DUPLICATED_PROMISE_0100 PASSED"); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_COMMIT_CONFIG_DUPLICATED_PROMISE_0100 ends here"); - done(); - } - }) + createOutput(0); - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_CALLBACK_0100 - * @tc.name : Check capture session start/stop with callback or not - * @tc.desc : Check capture session start/stop with callback or not - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_CALLBACK_0100--------------"); + mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPhotoOutput); + mCameraSession.addOutput(mVideoOutput); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_PROMISE_0100 add PASSED"); - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_CALLBACK_0100 FAILED with NoCamera"); - expect().assertFail(); - done(); - } - else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_CALLBACK_0100 start for camera[" + i + "]"); - - await startCameraSession(i); - - if (!isEmpty(mPreviewOutput)) { - mCameraSession.start(async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_CALLBACK_0100 start callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_CALLBACK_0100 start PASSED"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_CALLBACK_0100 start FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(2000); - - mCameraSession.stop(async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_CALLBACK_0100 stop callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_CALLBACK_0100 stop PASSED"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_CALLBACK_0100 stop FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - } - - await beginCameraSessionConfig(); - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_CALLBACK_0100 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_CALLBACK_0100 ends here"); + mCameraSession.removeOutput(mPreviewOutput); + mCameraSession.removeOutput(mPhotoOutput); + mCameraSession.removeOutput(mVideoOutput); + await releaseOutput(); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_PROMISE_0100 ends here"); done(); } }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_PROMISE_0100 - * @tc.name : Check capture session start/stop output with promise or not - * @tc.desc : Check capture session start/stop output with promise or not + * @tc.name : Check capture session start/stop/release output with promise or not + * @tc.desc : Check capture session start/stop/release output with promise or not * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_PROMISE_0100', 0, async function (done) { + it('SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_PROMISE_0100', 0, async function (done) { console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_PROMISE_0100--------------"); if (mCameraNum == 0) { @@ -936,23 +636,17 @@ export default function cameraSessionTest() { else { for (let i = 0; i < mCameraNum; i++) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_PROMISE_0100 start for camera[" + i + "]"); - await startCameraSession(i); - - if (!isEmpty(mPreviewOutput)) { - await mCameraSession.start(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_PROMISE_0100 start PASSED"); - await sleep(2000); - await mCameraSession.stop(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_PROMISE_0100 stop PASSED"); - await sleep(500); - } + await mCameraSession.start(); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_PROMISE_0100 start PASSED"); + await sleep(2000); + + await mCameraSession.stop(); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_PROMISE_0100 stop PASSED"); + await sleep(500); - await beginCameraSessionConfig(); - await stopCameraSession(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_PROMISE_0100 end for camera[" + i + "]"); } @@ -961,670 +655,6 @@ export default function cameraSessionTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_INPUT_CALLBACK_0100 - * @tc.name : Check capture session add/remove input with callback or not - * @tc.desc : Check capture session add/remove input with callback or not - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_INPUT_CALLBACK_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_INPUT_CALLBACK_0100--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_INPUT_CALLBACK_0100 FAILED with NoCamera"); - expect().assertFail(); - done(); - } - else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_INPUT_CALLBACK_0100 start for camera[" + i + "]"); - - await createInput(i); - await createOutput(i); - - if (!isEmpty(mPreviewOutput) && !isEmpty(mPhotoOutput)) { - mCameraSession.addInput(mCameraInput, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_INPUT_CALLBACK_0100 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_INPUT_CALLBACK_0100 PASSED"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_INPUT_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - } - }) - await mCameraSession.addOutput(mPreviewOutput); - await mCameraSession.addOutput(mPhotoOutput); - await sleep(500); - - await commitCameraSessionConfig(); - await sleep(1); - await beginCameraSessionConfig(); - await sleep(1); - - mCameraSession.removeInput(mCameraInput, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_INPUT_CALLBACK_0100 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_INPUT_CALLBACK_0100 PASSED"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_INPUT_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - } - }) - await mCameraSession.removeOutput(mPreviewOutput); - await mCameraSession.removeOutput(mPhotoOutput); - await sleep(500); - } - - await releaseInput(); - await releaseOutput(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_INPUT_CALLBACK_0100 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_INPUT_CALLBACK_0100 ends here"); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_INPUT_PROMISE_0100 - * @tc.name : Check capture session can add input with promise or not - * @tc.desc : Check capture session can add input with promise or not - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_INPUT_PROMISE_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_INPUT_PROMISE_0100--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_INPUT_PROMISE_0100 FAILED with NoCamera"); - expect().assertFail(); - done(); - } - else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_INPUT_PROMISE_0100 start for camera[" + i + "]"); - - await createInput(i); - await createOutput(i); - - if (!isEmpty(mPreviewOutput) && !isEmpty(mPhotoOutput)) { - await mCameraSession.addInput(mCameraInput); - await mCameraSession.addOutput(mPreviewOutput); - await mCameraSession.addOutput(mPhotoOutput); - await sleep(500); - - await commitCameraSessionConfig(); - await sleep(1); - await beginCameraSessionConfig(); - await sleep(1); - - await mCameraSession.removeInput(mCameraInput); - await mCameraSession.removeOutput(mPreviewOutput); - await mCameraSession.removeOutput(mPhotoOutput); - await sleep(500); - } - - await releaseInput(); - await releaseOutput(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_INPUT_PROMISE_0100 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_INPUT_PROMISE_0100 ends here"); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_CALLBACK_0100 - * @tc.name : Check capture session add/remove output with callback or not for preview - * @tc.desc : Check capture session add/remove output with callback or not for preview - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_CALLBACK_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_CALLBACK_0100--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_CALLBACK_0100 FAILED with NoCamera"); - expect().assertFail(); - done(); - } - else { - await createInput(0); - await createOutput(0); - - if (!isEmpty(mPreviewOutput) && !isEmpty(mPhotoOutput)) { - mCameraSession.addOutput(mPreviewOutput, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_CALLBACK_0100 add callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_CALLBACK_0100 add PASSED"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_CALLBACK_0100 add FAILED : " + err.message); - expect().assertFail(); - } - }) - await mCameraSession.addOutput(mPhotoOutput); - await mCameraSession.addInput(mCameraInput); - await sleep(500); - - await commitCameraSessionConfig(); - await sleep(1); - await beginCameraSessionConfig(); - await sleep(1); - - mCameraSession.removeOutput(mPreviewOutput, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_CALLBACK_0100 remove callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_CALLBACK_0100 remove PASSED"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_CALLBACK_0100 remove FAILED : " + err.message); - expect().assertFail(); - } - }) - await mCameraSession.removeOutput(mPhotoOutput); - await mCameraSession.removeInput(mCameraInput); - await sleep(500); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_CALLBACK_0100 FAILED"); - expect().assertFail(); - } - - await releaseInput(); - await releaseOutput(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_CALLBACK_0100 ends here"); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_PROMISE_0100 - * @tc.name : Check capture session can add output with promise or not for preview - * @tc.desc : Check capture session can add output with promise or not for preview - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_PROMISE_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_PROMISE_0100--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_PROMISE_0100 FAILED with NoCamera"); - expect().assertFail(); - done(); - } - else { - await createInput(0); - await createOutput(0); - - if (!isEmpty(mPreviewOutput) && !isEmpty(mPhotoOutput)) { - await mCameraSession.addOutput(mPreviewOutput); - await mCameraSession.addOutput(mPhotoOutput); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_PROMISE_0100 add PASSED"); - await mCameraSession.addInput(mCameraInput); - await sleep(500); - - await commitCameraSessionConfig(); - await sleep(1); - await beginCameraSessionConfig(); - await sleep(1); - - await sleep(500); - - await mCameraSession.removeOutput(mPreviewOutput); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_PROMISE_0100 remove PASSED"); - await mCameraSession.removeOutput(mPhotoOutput); - await mCameraSession.removeInput(mCameraInput); - await sleep(500); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_PROMISE_0100 FAILED"); - expect().assertFail(); - } - - await releaseInput(); - await releaseOutput(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_PROMISE_0100 ends here"); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_CALLBACK_0101 - * @tc.name : Check capture session add/remove output with callback or not for photo - * @tc.desc : Check capture session add/remove output with callback or not for photo - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_CALLBACK_0101', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_CALLBACK_0101--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_CALLBACK_0101 FAILED with NoCamera"); - expect().assertFail(); - done(); - } - else { - await createInput(0); - await createOutput(0); - - if (!isEmpty(mPhotoOutput)) { - if (!isEmpty(mPreviewOutput)) { - console.info(TAG + "Start to addOutput mPreviewOutput"); - await mCameraSession.addOutput(mPreviewOutput); - } - mCameraSession.addOutput(mPhotoOutput, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_CALLBACK_0101 add callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_CALLBACK_0101 add PASSED"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_CALLBACK_0101 add FAILED : " + err.message); - expect().assertFail(); - } - }) - await mCameraSession.addInput(mCameraInput); - await sleep(500); - - await commitCameraSessionConfig(); - await sleep(1); - await beginCameraSessionConfig(); - await sleep(1); - - await sleep(500); - - if (!isEmpty(mPreviewOutput)) { - console.info(TAG + "Start to removeOutput mPreviewOutput"); - await mCameraSession.removeOutput(mPreviewOutput); - } - mCameraSession.removeOutput(mPhotoOutput, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_CALLBACK_0101 remove callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_CALLBACK_0101 remove PASSED"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_CALLBACK_0101 remove FAILED : " + err.message); - expect().assertFail(); - } - }) - await mCameraSession.removeInput(mCameraInput); - await sleep(500); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_CALLBACK_0101 FAILED"); - expect().assertFail(); - } - - await releaseInput(); - await releaseOutput(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_CALLBACK_0101 ends here"); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_PROMISE_0101 - * @tc.name : Check capture session can add/remove output with promise or not for photo - * @tc.desc : Check capture session can add/remove output with promise or not for photo - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_PROMISE_0101', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_PROMISE_0101--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_PROMISE_0101 FAILED with NoCamera"); - expect().assertFail(); - done(); - } - else { - await createInput(0); - await createOutput(0); - - if (!isEmpty(mPhotoOutput)) { - if (!isEmpty(mPreviewOutput)) { - console.info(TAG + "Start to addOutput mPreviewOutput"); - await mCameraSession.addOutput(mPreviewOutput); - } - await mCameraSession.addOutput(mPhotoOutput); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_PROMISE_0101 add PASSED"); - await mCameraSession.addInput(mCameraInput); - await sleep(500); - - await commitCameraSessionConfig(); - await sleep(1); - await beginCameraSessionConfig(); - await sleep(1); - - await sleep(500); - - if (!isEmpty(mPreviewOutput)) { - console.info(TAG + "Start to removeOutput mPreviewOutput"); - await mCameraSession.removeOutput(mPreviewOutput); - } - await mCameraSession.removeOutput(mPhotoOutput); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_PROMISE_0101 remove PASSED"); - await mCameraSession.removeInput(mCameraInput); - await sleep(500); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_PROMISE_0101 FAILED"); - expect().assertFail(); - } - - await releaseInput(); - await releaseOutput(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_PROMISE_0101 ends here"); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_CALLBACK_0102 - * @tc.name : Check capture session add/remove output with callback or not for video - * @tc.desc : Check capture session add/remove output with callback or not for video - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_CALLBACK_0102', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_CALLBACK_0102--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_CALLBACK_0102 FAILED with NoCamera"); - expect().assertFail(); - done(); - } - else { - await createInput(0); - await createOutput(0); - - if (!isEmpty(mVideoOutput)) { - - mCameraSession.addOutput(mVideoOutput, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_CALLBACK_0102 add callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_CALLBACK_0102 add PASSED"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_CALLBACK_0102 add FAILED : " + err.message); - expect().assertFail(); - } - }) - if (!isEmpty(mPreviewOutput)) { - console.info(TAG + "Start to addOutput mPreviewOutput"); - await mCameraSession.addOutput(mPreviewOutput); - } - await mCameraSession.addInput(mCameraInput); - await sleep(500); - - await commitCameraSessionConfig(); - await sleep(1); - await beginCameraSessionConfig(); - await sleep(1); - - await sleep(500); - - mCameraSession.removeOutput(mVideoOutput, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_CALLBACK_0102 remove callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_CALLBACK_0102 remove PASSED"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_CALLBACK_0102 remove FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(100); - if (!isEmpty(mPreviewOutput)) { - console.info(TAG + "Start to removeOutput mPreviewOutput"); - await mCameraSession.removeOutput(mPreviewOutput); - } - await mCameraSession.removeInput(mCameraInput); - await sleep(500); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_CALLBACK_0102 FAILED"); - } - - await releaseInput(); - await releaseOutput(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_CALLBACK_0102 ends here"); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_PROMISE_0102 - * @tc.name : Check capture session can add/remove output with promise or not for video - * @tc.desc : Check capture session can add/remove output with promise or not for video - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_PROMISE_0102', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_PROMISE_0102--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_PROMISE_0102 FAILED with NoCamera"); - expect().assertFail(); - done(); - } - else { - await createInput(0); - await createOutput(0); - - if (!isEmpty(mVideoOutput)) { - if (!isEmpty(mPreviewOutput)) { - console.info(TAG + "Start to addOutput mPreviewOutput"); - await mCameraSession.addOutput(mPreviewOutput); - } - await mCameraSession.addOutput(mVideoOutput); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_PROMISE_0102 PASSED"); - await mCameraSession.addInput(mCameraInput); - await sleep(500); - - await commitCameraSessionConfig(); - await sleep(1); - await beginCameraSessionConfig(); - await sleep(1); - - await sleep(500); - - if (!isEmpty(mPreviewOutput)) { - console.info(TAG + "Start to removeOutput mPreviewOutput"); - await mCameraSession.removeOutput(mPreviewOutput); - } - await sleep(100); - await mCameraSession.removeOutput(mVideoOutput); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_PROMISE_0102 remove PASSED"); - await mCameraSession.removeInput(mCameraInput); - await sleep(500); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_PROMISE_0102 FAILED"); - } - - await releaseInput(); - await releaseOutput(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_PROMISE_0102 ends here"); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0100 - * @tc.name : camera status callback on CaptureSession async api for focusStateChange - * @tc.desc : camera status callback on CaptureSession async api for focusStateChange - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0100--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0100 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - let nfyFlag = false; - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0100 start for camera[" + i + "]"); - - await startCameraSession(i); - - if (!isEmpty(mPreviewOutput)) { - let focusModeSupportedFlag = await mCameraSession.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO); - if (focusModeSupportedFlag == false) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0100 skip camera[" + i + "], for FOCUS_MODE_AUTO"); - await beginCameraSessionConfig(); - await stopCameraSession(); - continue; - } - - focusModeSupportedFlag = await mCameraSession.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - if (focusModeSupportedFlag == false) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0100 skip camera[" + i + "], for FOCUS_MODE_CONTINUOUS_AUTO"); - await beginCameraSessionConfig(); - await stopCameraSession(); - continue; - } - - mCameraSession.on('focusStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0100 callback"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0100 PASSED: " + data); - nfyFlag = true; - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - }) - - await mCameraSession.start(); - - await mCameraSession.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO); - await mCameraSession.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - - await sleep(100); - - if (nfyFlag == false) { - //expect().assertFail(); - //console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0100 FAILED without any nofity!"); - } - - await mCameraSession.stop(); - } - - await beginCameraSessionConfig(); - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0100 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0100 ends here"); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0101 - * @tc.name : camera status callback on CaptureSession async api for error - * @tc.desc : camera status callback on CaptureSession async api for error - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0101', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0101--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0101 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - let nfyFlag = false; - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0101 start for camera[" + i + "]"); - - await startCameraSession(i); - - if (!isEmpty(mPreviewOutput)) { - mCameraSession.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0101 callback"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0101 PASSED: " + data); - nfyFlag = true; - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0101 FAILED: " + err.message); - } - await sleep(1); - }) - - await mCameraSession.start(); - - await sleep(400); - - if (nfyFlag == false) { - //expect().assertFail(); - //console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0101 FAILED without any nofity!"); - } - - await mCameraSession.stop(); - } - await beginCameraSessionConfig(); - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0101 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0101 ends here"); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_RELEASE_CALLBACK_0100 - * @tc.name : Check capture session release with callback or not for preview - * @tc.desc : Check capture session release with callback or not for preview - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_RELEASE_CALLBACK_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_RELEASE_CALLBACK_0100--------------"); - - await mCameraSession.release(async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_RELEASE_CALLBACK_0100 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_RELEASE_CALLBACK_0100 PASSED"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_RELEASE_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - await createCameraSessionInstance(); - await sleep(500); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_RELEASE_CALLBACK_0100 ends here"); - done(); - }) - /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_RELEASE_PROMISE_0100 * @tc.name : Check capture session release with promise or not @@ -1636,11 +666,9 @@ export default function cameraSessionTest() { it('SUB_MULTIMEDIA_CAMERA_SESSION_RELEASE_PROMISE_0100', 2, async function (done) { console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_RELEASE_PROMISE_0100--------------"); - await mCameraSession.release() - await sleep(500); + await mCameraSession.release(); - await createCameraSessionInstance(); - await sleep(500); + // createCameraSessionInstance(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_RELEASE_PROMISE_0100 ends here"); done(); diff --git a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionExposureTest.test.ets b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionExposureTest.test.ets index c23c07678fa133a1f55e5e24db9a29bbda1e7991..27d515a30a9315b14418b442da0c90ca0c0e2b56 100644 --- a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionExposureTest.test.ets +++ b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionExposureTest.test.ets @@ -74,12 +74,12 @@ let mVideoConfig = { maxDuration: 500 } -let mPicWidthMax = 8192; -let mPicHeightMax = 8192; +let mPicWidthMax = 1; +let mPicHeightMax = 1; let mMETERINGPoint = { - x: mPicWidthMax / 2, - y: mPicHeightMax / 2, + x: mPicWidthMax / 2.0, + y: mPicHeightMax / 2.0, } let mMETERINGPointLT = { @@ -226,10 +226,10 @@ export default function cameraSessionExposureTest() { console.log(TAG + 'Exit releaseVideoReceiveSurface') } - async function getCameraManagerInstance() { + function getCameraManagerInstance() { console.info('Enter getCameraManagerInstance'); - mCameraManager = await cameraObj.getCameraManager(null); + mCameraManager = cameraObj.getCameraManager(null); if (isEmpty(mCameraManager)) { console.info(TAG + "getCameraManager FAILED"); return false; @@ -240,10 +240,10 @@ export default function cameraSessionExposureTest() { return true; } - async function getCameraSupportDevicesArray() { + function getCameraSupportDevicesArray() { console.info('Enter getCameraSupportDevicesArray'); - mCameraDevicesArray = await mCameraManager.getSupportedCameras(); + mCameraDevicesArray = mCameraManager.getSupportedCameras(); /* mCameraManager.getSupportedCameras(async (err, data) => { console.info(TAG + "Entering getCameraSupportDevicesArray callback"); @@ -280,47 +280,11 @@ export default function cameraSessionExposureTest() { return true; } - async function beginCameraSessionConfig() { - console.info('Enter beginCameraSessionConfig'); - - mCameraSession.beginConfig(async (err) => { - if (!err) { - console.info(TAG + "Entering beginConfig PASSED"); - } else { - console.info(TAG + "Entering beginConfig FAILED : " + err.message); - } - }) - - await sleep(30); - - console.info('Exit beginCameraSessionConfig'); - - return true; - } - - async function commitCameraSessionConfig() { - console.info('Enter commitCameraSessionConfig'); - - mCameraSession.commitConfig(async (err) => { - if (!err) { - console.info(TAG + "Entering commitConfig PASSED"); - } else { - console.info(TAG + "Entering commitConfig FAILED : " + err.message); - } - }) - - await sleep(500); - - console.info('Exit commitCameraSessionConfig'); - - return true; - } - - async function createCameraSessionInstance() { + function createCameraSessionInstance() { console.info('Enter createCameraSessionInstance'); try { - mCameraSession = await mCameraManager.createCaptureSession(); + mCameraSession = mCameraManager.createCaptureSession(); } catch { console.info('createCaptureSession FAILED'); @@ -331,7 +295,7 @@ export default function cameraSessionExposureTest() { return false; } - await beginCameraSessionConfig(); + mCameraSession.beginConfig(); console.info('Exit createCameraSessionInstance'); @@ -349,28 +313,15 @@ export default function cameraSessionExposureTest() { console.info(TAG + "Entering createInputs FAILED with NoCamera"); return false; } - - mCameraInput = null; - await mCameraManager.createCameraInput(mCameraDevicesArray[idx]).then((result) => { - console.info('createCameraInput success'); - mCameraInput = result; - }).catch((err) => { - console.info('createCameraInput failed, err = ' + err.message); - }); + + mCameraInput = mCameraManager.createCameraInput(mCameraDevicesArray[idx]); if (isEmpty(mCameraInput)) { console.info(TAG + "createCameraInput FAILED"); return false; } - mCameraInput.open(async (err) => { - console.info(TAG + "Entering mCameraInput open callback"); - if (!err) { - console.info(TAG + "Entering mCameraInput open PASSED "); - } else { - console.info(TAG + "Entering mCameraInput open FAILED : " + err.message); - } - }) + await mCameraInput.open(); await sleep(100); @@ -386,7 +337,6 @@ export default function cameraSessionExposureTest() { if (!isEmpty(mCameraInput)) { await mCameraInput.close(); - await mCameraInput.release(); } console.info('Exit releaseInput'); @@ -394,24 +344,16 @@ export default function cameraSessionExposureTest() { return true; } - async function createOutput(idx:any) { + function createOutput(idx:any) { console.info('Enter createOutput'); - let cameraOutputCap = null; - await mCameraManager.getSupportedOutputCapability(mCameraDevicesArray[idx]).then((result) => { - console.info('getSupportedOutputCapability success'); - cameraOutputCap = result; - }).catch((err) => { - console.info('getSupportedOutputCapability failed, err = ' + err.message); - mPreviewOutput = null; - mPhotoOutput = null; - }); + let cameraOutputCap = mCameraManager.getSupportedOutputCapability(mCameraDevicesArray[idx]); if (!isEmpty(cameraOutputCap)) { if (!isEmpty(cameraOutputCap.previewProfiles)) { console.info(TAG + "cameraOutputCap.previewProfiles.length: " + cameraOutputCap.previewProfiles.length); for (let i = 0; i < cameraOutputCap.previewProfiles.length; i++) { - mPreviewOutput = await mCameraManager.createPreviewOutput(cameraOutputCap.previewProfiles[i], globalThis.surfaceId); + mPreviewOutput = mCameraManager.createPreviewOutput(cameraOutputCap.previewProfiles[i], globalThis.surfaceId); if (!isEmpty(mPreviewOutput)) { break; } @@ -428,7 +370,7 @@ export default function cameraSessionExposureTest() { console.info(TAG + "cameraOutputCap.photoProfiles.length: " + cameraOutputCap.photoProfiles.length); for (let i = 0; i < cameraOutputCap.photoProfiles.length; i++) { - mPhotoOutput = await mCameraManager.createPhotoOutput(cameraOutputCap.photoProfiles[i], mPhotoSurface); + mPhotoOutput = mCameraManager.createPhotoOutput(cameraOutputCap.photoProfiles[i], mPhotoSurface); if (!isEmpty(mPhotoOutput)) { break; } @@ -473,7 +415,6 @@ export default function cameraSessionExposureTest() { console.info('Enter releaseOutput'); if (!isEmpty(mPreviewOutput)) { - await mPreviewOutput.stop(); await mPreviewOutput.release(); } @@ -495,23 +436,23 @@ export default function cameraSessionExposureTest() { console.info(TAG + "Enter startCameraSession"); await createInput(idx); - await createOutput(idx); + createOutput(idx); await sleep(1); if (!isEmpty(mCameraInput)) { console.info(TAG + "Start to addInput"); - await mCameraSession.addInput(mCameraInput); + mCameraSession.addInput(mCameraInput); } if (!isEmpty(mPreviewOutput)) { console.info(TAG + "Start to addOutput mPreviewOutput"); - await mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPreviewOutput); } if (!isEmpty(mPhotoOutput)) { console.info(TAG + "Start to addOutput mPhotoOutput"); - await mCameraSession.addOutput(mPhotoOutput); + mCameraSession.addOutput(mPhotoOutput); } /* if (!isEmpty(mVideoOutput)) { @@ -521,8 +462,7 @@ export default function cameraSessionExposureTest() { */ await sleep(1); - await commitCameraSessionConfig(); - await beginCameraSessionConfig(); + await mCameraSession.commitConfig(); /* await mCameraSession.start(async (err) => { @@ -543,6 +483,9 @@ export default function cameraSessionExposureTest() { async function stopCameraSession() { console.info(TAG + "Enter stopCameraSession"); + + mCameraSession.beginConfig(); + /* mCameraSession.stop(async (err) => { console.info(TAG + "Entering mCameraSession stop callback"); @@ -558,17 +501,17 @@ export default function cameraSessionExposureTest() { if (!isEmpty(mCameraInput)) { console.info(TAG + "Start to removeInput input"); - await mCameraSession.removeInput(mCameraInput); + mCameraSession.removeInput(mCameraInput); } if (!isEmpty(mPreviewOutput)) { console.info(TAG + "Start to removeOutput mPreviewOutput"); - await mCameraSession.removeOutput(mPreviewOutput); + mCameraSession.removeOutput(mPreviewOutput); } if (!isEmpty(mPhotoOutput)) { console.info(TAG + "Start to removeOutput mPhotoOutput"); - await mCameraSession.removeOutput(mPhotoOutput); + mCameraSession.removeOutput(mPhotoOutput); } /* if (!isEmpty(mVideoOutput)) { @@ -591,9 +534,9 @@ export default function cameraSessionExposureTest() { sleep(100); await getPhotoReceiverSurface(); await getVideoReceiveSurface(); - await getCameraManagerInstance(); - await getCameraSupportDevicesArray(); - await createCameraSessionInstance(); + getCameraManagerInstance(); + getCameraSupportDevicesArray(); + createCameraSessionInstance(); console.info('Device type = ' + deviceInfo.deviceType); @@ -616,55 +559,7 @@ export default function cameraSessionExposureTest() { console.info('afterAll case'); }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_CALLBACK_0100 - * @tc.name : Check capture session support exposure locked mode with callback or not - * @tc.desc : Check capture session support exposure locked mode with callback or not - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_CALLBACK_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_CALLBACK_0100--------------"); - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_CALLBACK_0100 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_CALLBACK_0100 start for camera[" + i + "]"); - - await startCameraSession(i); - - mIsExposureModeSupportedArray[i] = false; - - mCameraSession.isExposureModeSupported(cameraObj.ExposureMode.EXPOSURE_MODE_LOCKED, async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_CALLBACK_0100 callback"); - if (!err) { - if (data != null || data != undefined) { - mIsExposureModeSupportedArray[i] = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_CALLBACK_0100 PASSED with isExposureModeSupported is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_CALLBACK_0100 FAILED with isExposureModeSupported is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(100); - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_CALLBACK_0100 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_CALLBACK_0100 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_PROMISE_0100 @@ -687,16 +582,14 @@ export default function cameraSessionExposureTest() { await startCameraSession(i); - let isExposureModeSupported = await mCameraSession.isExposureModeSupported(cameraObj.ExposureMode.EXPOSURE_MODE_LOCKED); + let isExposureModeSupported = mCameraSession.isExposureModeSupported(cameraObj.ExposureMode.EXPOSURE_MODE_LOCKED); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_PROMISE_0100 finish"); if (isExposureModeSupported != null || isExposureModeSupported != undefined) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_PROMISE_0100 PASSED with isExposureModeSupported is: " + isExposureModeSupported); } else { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_PROMISE_0100 FAILED with isExposureModeSupported is: " + isExposureModeSupported); expect().assertFail(); - } - - await sleep(100); + } await stopCameraSession(); @@ -708,67 +601,7 @@ export default function cameraSessionExposureTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0100 - * @tc.name : Check capture session set exposure locked mode with callback - * @tc.desc : Check capture session set exposure locked mode with callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0100--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0100 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0100 start for camera[" + i + "]"); - - await startCameraSession(i); - - if (mIsExposureModeSupportedArray[i] == true) { - mCameraSession.setExposureMode(cameraObj.ExposureMode.EXPOSURE_MODE_LOCKED, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0100 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0100 PASSED with ExposureMode is: " + cameraObj.ExposureMode.EXPOSURE_MODE_LOCKED); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - mCameraSession.getExposureMode(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0100 callback"); - if (!err) { - if (data == cameraObj.ExposureMode.EXPOSURE_MODE_LOCKED) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0100 PASSED with ExposureMode is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0100 FAILED with ExposureMode is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0100 not support"); - } - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0100 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0100 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_PROMISE_0100 @@ -792,12 +625,10 @@ export default function cameraSessionExposureTest() { await startCameraSession(i); if (mIsExposureModeSupportedArray[i] == true) { - await mCameraSession.setExposureMode(cameraObj.ExposureMode.EXPOSURE_MODE_LOCKED); + mCameraSession.setExposureMode(cameraObj.ExposureMode.EXPOSURE_MODE_LOCKED); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_PROMISE_0100 finish"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_PROMISE_0100 PASSED with ExposureMode is: " + cameraObj.ExposureMode.EXPOSURE_MODE_LOCKED); - await sleep(500); - - let exposureMode = await mCameraSession.getExposureMode(); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_PROMISE_0100 PASSED with ExposureMode is: " + cameraObj.ExposureMode.EXPOSURE_MODE_LOCKED); + let exposureMode = mCameraSession.getExposureMode(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_PROMISE_0100 finish"); if (exposureMode == cameraObj.ExposureMode.EXPOSURE_MODE_LOCKED) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_PROMISE_0100 PASSED with ExposureMode is: " + exposureMode); @@ -805,7 +636,6 @@ export default function cameraSessionExposureTest() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_PROMISE_0100 FAILED with ExposureMode is: " + exposureMode); expect().assertFail(); } - await sleep(500); } else { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_PROMISE_0100 not support"); } @@ -820,55 +650,7 @@ export default function cameraSessionExposureTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_CALLBACK_0101 - * @tc.name : Check capture session support exposure auto mode with callback or not - * @tc.desc : Check capture session support exposure auto mode with callback or not - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_CALLBACK_0101', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_CALLBACK_0101--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_CALLBACK_0101 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_CALLBACK_0101 start for camera[" + i + "]"); - - await startCameraSession(i); - - mIsExposureModeSupportedArray[i] = false; - - mCameraSession.isExposureModeSupported(cameraObj.ExposureMode.EXPOSURE_MODE_AUTO, async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_CALLBACK_0101 callback"); - if (!err) { - if (data != null || data != undefined) { - mIsExposureModeSupportedArray[i] = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_CALLBACK_0101 PASSED with isExposureModeSupported is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_CALLBACK_0101 FAILED with isExposureModeSupported is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_CALLBACK_0101 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(100); - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_CALLBACK_0101 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_CALLBACK_0101 ends here"); - done(); - } - }) + /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_PROMISE_0101 @@ -891,16 +673,14 @@ export default function cameraSessionExposureTest() { await startCameraSession(i); - let isExposureModeSupported = await mCameraSession.isExposureModeSupported(cameraObj.ExposureMode.EXPOSURE_MODE_AUTO); + let isExposureModeSupported = mCameraSession.isExposureModeSupported(cameraObj.ExposureMode.EXPOSURE_MODE_AUTO); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_PROMISE_0101 finish"); if (isExposureModeSupported != null || isExposureModeSupported != undefined) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_PROMISE_0101 PASSED with isExposureModeSupported is: " + isExposureModeSupported); } else { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_PROMISE_0101 FAILED with isExposureModeSupported is: " + isExposureModeSupported); expect().assertFail(); - } - - await sleep(100); + } await stopCameraSession(); @@ -912,67 +692,7 @@ export default function cameraSessionExposureTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0101 - * @tc.name : Check capture session set exposure auto mode with callback - * @tc.desc : Check capture session set exposure auto mode with callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0101', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0101--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0101 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0101 start for camera[" + i + "]"); - - await startCameraSession(i); - - if (mIsExposureModeSupportedArray[i] == true) { - mCameraSession.setExposureMode(cameraObj.ExposureMode.EXPOSURE_MODE_AUTO, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0101 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0101 PASSED with ExposureMode is: " + cameraObj.ExposureMode.EXPOSURE_MODE_AUTO); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0101 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - mCameraSession.getExposureMode(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0101 callback"); - if (!err) { - if (data == cameraObj.ExposureMode.EXPOSURE_MODE_AUTO) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0101 PASSED with ExposureMode is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0101 FAILED with ExposureMode is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0101 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0101 not support"); - } - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0101 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0101 ends here"); - done(); - } - }) + /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_PROMISE_0101 @@ -996,12 +716,11 @@ export default function cameraSessionExposureTest() { await startCameraSession(i); if (mIsExposureModeSupportedArray[i] == true) { - await mCameraSession.setExposureMode(cameraObj.ExposureMode.EXPOSURE_MODE_AUTO); + mCameraSession.setExposureMode(cameraObj.ExposureMode.EXPOSURE_MODE_AUTO); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_PROMISE_0101 finish"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_PROMISE_0101 PASSED with ExposureMode is: " + cameraObj.ExposureMode.EXPOSURE_MODE_AUTO); - await sleep(500); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_PROMISE_0101 PASSED with ExposureMode is: " + cameraObj.ExposureMode.EXPOSURE_MODE_AUTO); - let exposureMode = await mCameraSession.getExposureMode(); + let exposureMode = mCameraSession.getExposureMode(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_PROMISE_0101 finish"); if (exposureMode == cameraObj.ExposureMode.EXPOSURE_MODE_AUTO) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_PROMISE_0101 PASSED with ExposureMode is: " + exposureMode); @@ -1009,7 +728,6 @@ export default function cameraSessionExposureTest() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_PROMISE_0101 FAILED with ExposureMode is: " + exposureMode); expect().assertFail(); } - await sleep(500); } else { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_PROMISE_0101 not support"); } @@ -1024,55 +742,7 @@ export default function cameraSessionExposureTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_CALLBACK_0102 - * @tc.name : Check capture session support exposure continuous auto mode with callback or not - * @tc.desc : Check capture session support exposure continuous auto mode with callback or not - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_CALLBACK_0102', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_CALLBACK_0102--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_CALLBACK_0102 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_CALLBACK_0102 start for camera[" + i + "]"); - - await startCameraSession(i); - - mIsExposureModeSupportedArray[i] = false; - - mCameraSession.isExposureModeSupported(cameraObj.ExposureMode.EXPOSURE_MODE_CONTINUOUS_AUTO, async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_CALLBACK_0102 callback"); - if (!err) { - if (data != null || data != undefined) { - mIsExposureModeSupportedArray[i] = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_CALLBACK_0102 PASSED with isExposureModeSupported is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_CALLBACK_0102 FAILED with isExposureModeSupported is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_CALLBACK_0102 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(100); - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_CALLBACK_0102 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_CALLBACK_0102 ends here"); - done(); - } - }) + /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_PROMISE_0102 @@ -1095,16 +765,14 @@ export default function cameraSessionExposureTest() { await startCameraSession(i); - let isExposureModeSupported = await mCameraSession.isExposureModeSupported(cameraObj.ExposureMode.EXPOSURE_MODE_CONTINUOUS_AUTO); + let isExposureModeSupported = mCameraSession.isExposureModeSupported(cameraObj.ExposureMode.EXPOSURE_MODE_CONTINUOUS_AUTO); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_PROMISE_0102 finish"); if (isExposureModeSupported != null || isExposureModeSupported != undefined) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_PROMISE_0102 PASSED with isExposureModeSupported is: " + isExposureModeSupported); } else { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_PROMISE_0102 FAILED with isExposureModeSupported is: " + isExposureModeSupported); expect().assertFail(); - } - - await sleep(100); + } await stopCameraSession(); @@ -1116,67 +784,7 @@ export default function cameraSessionExposureTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0102 - * @tc.name : Check capture session set exposure continuous auto mode with callback - * @tc.desc : Check capture session set exposure continuous auto mode with callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0102', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0102--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0102 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0102 start for camera[" + i + "]"); - - await startCameraSession(i); - - if (mIsExposureModeSupportedArray[i] == true) { - mCameraSession.setExposureMode(cameraObj.ExposureMode.EXPOSURE_MODE_CONTINUOUS_AUTO, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0102 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0102 PASSED with ExposureMode is: " + cameraObj.ExposureMode.EXPOSURE_MODE_CONTINUOUS_AUTO); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0102 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - mCameraSession.getExposureMode(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0102 callback"); - if (!err) { - if (data == cameraObj.ExposureMode.EXPOSURE_MODE_CONTINUOUS_AUTO) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0102 PASSED with ExposureMode is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0102 FAILED with ExposureMode is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0102 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0102 not support"); - } - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0102 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_CALLBACK_0102 ends here"); - done(); - } - }) + /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_PROMISE_0102 @@ -1200,12 +808,11 @@ export default function cameraSessionExposureTest() { await startCameraSession(i); if (mIsExposureModeSupportedArray[i] == true) { - await mCameraSession.setExposureMode(cameraObj.ExposureMode.EXPOSURE_MODE_CONTINUOUS_AUTO); + mCameraSession.setExposureMode(cameraObj.ExposureMode.EXPOSURE_MODE_CONTINUOUS_AUTO); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_PROMISE_0102 finish"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_PROMISE_0102 PASSED with ExposureMode is: " + cameraObj.ExposureMode.EXPOSURE_MODE_CONTINUOUS_AUTO); - await sleep(500); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_PROMISE_0102 PASSED with ExposureMode is: " + cameraObj.ExposureMode.EXPOSURE_MODE_CONTINUOUS_AUTO); - let exposureMode = await mCameraSession.getExposureMode(); + let exposureMode = mCameraSession.getExposureMode(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_PROMISE_0102 finish"); if (exposureMode == cameraObj.ExposureMode.EXPOSURE_MODE_CONTINUOUS_AUTO) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_PROMISE_0102 PASSED with ExposureMode is: " + exposureMode); @@ -1213,7 +820,6 @@ export default function cameraSessionExposureTest() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_PROMISE_0102 FAILED with ExposureMode is: " + exposureMode); expect().assertFail(); } - await sleep(500); } else { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_MODE_PROMISE_0102 not support"); } @@ -1228,91 +834,34 @@ export default function cameraSessionExposureTest() { } }) + + /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0100 - * @tc.name : Check capture session set METERING point with callback - * @tc.desc : Check capture session set METERING point with callback + * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0100 + * @tc.name : Check capture session set METERING point with promise + * @tc.desc : Check capture session set METERING point with promise * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 2 */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0100--------------"); + it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0100', 2, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0100--------------"); if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0100 FAILED with NoCamera"); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0100 FAILED with NoCamera"); expect().assertFail(); done(); } else { for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0100 start for camera[" + i + "]"); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0100 start for camera[" + i + "]"); await startCameraSession(i); - mCameraSession.setMeteringPoint(mMETERINGPoint, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0100 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0100 PASSED with METERINGPoint is: " + mMETERINGPoint.x + ", " + mMETERINGPoint.y); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - mCameraSession.getMeteringPoint(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0100 callback"); - if (!err) { - if ((data.x == mMETERINGPoint.x) && (data.y == mMETERINGPoint.y)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0100 PASSED with METERINGPoint is: " + data.x + ", " + data.y); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0100 FAILED with METERINGPoint is: " + data.x + ", " + data.y); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0100 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0100 ends here"); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0100 - * @tc.name : Check capture session set METERING point with promise - * @tc.desc : Check capture session set METERING point with promise - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0100--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0100 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0100 start for camera[" + i + "]"); - - await startCameraSession(i); - - await mCameraSession.setMeteringPoint(mMETERINGPoint); + mCameraSession.setMeteringPoint(mMETERINGPoint); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0100 finish"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0100 PASSED with METERINGPoint is: " + mMETERINGPoint.x + ", " + mMETERINGPoint.y); - await sleep(500); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0100 PASSED with METERINGPoint is: " + mMETERINGPoint.x + ", " + mMETERINGPoint.y); - let METERINGPoint = await mCameraSession.getMeteringPoint(); + let METERINGPoint = mCameraSession.getMeteringPoint(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0100 finish"); if ((METERINGPoint.x == mMETERINGPoint.x) && (METERINGPoint.y == mMETERINGPoint.y)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0100 PASSED with METERINGPoint is: " + METERINGPoint.x + ", " + METERINGPoint.y); @@ -1320,10 +869,7 @@ export default function cameraSessionExposureTest() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0100 FAILED with METERINGPoint is: " + METERINGPoint.x + ", " + METERINGPoint.y); expect().assertFail(); } - await sleep(500); - await stopCameraSession(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0100 end for camera[" + i + "]"); } @@ -1332,63 +878,7 @@ export default function cameraSessionExposureTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0101 - * @tc.name : Check capture session set METERING point with callback(left-top point) - * @tc.desc : Check capture session set METERING point with callback(left-top point) - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0101', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0101--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0101 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0101 start for camera[" + i + "]"); - - await startCameraSession(i); - - mCameraSession.setMeteringPoint(mMETERINGPointLT, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0101 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0101 PASSED with METERINGPoint is: " + mMETERINGPointLT.x + ", " + mMETERINGPointLT.y); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0101 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - mCameraSession.getMeteringPoint(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0101 callback"); - if (!err) { - if ((data.x == mMETERINGPointLT.x) && (data.y == mMETERINGPointLT.y)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0101 PASSED with METERINGPoint is: " + data.x + ", " + data.y); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0101 FAILED with METERINGPoint is: " + data.x + ", " + data.y); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0101 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0101 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0101 ends here"); - done(); - } - }) + /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0101 @@ -1408,15 +898,14 @@ export default function cameraSessionExposureTest() { } else { for (let i = 0; i < mCameraNum; i++) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0101 start for camera[" + i + "]"); - + await startCameraSession(i); - - await mCameraSession.setMeteringPoint(mMETERINGPointLT); + + mCameraSession.setMeteringPoint(mMETERINGPointLT); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0101 finish"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0101 PASSED with METERINGPoint is: " + mMETERINGPointLT.x + ", " + mMETERINGPointLT.y); - await sleep(500); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0101 PASSED with METERINGPoint is: " + mMETERINGPointLT.x + ", " + mMETERINGPointLT.y); - let METERINGPoint = await mCameraSession.getMeteringPoint(); + let METERINGPoint = mCameraSession.getMeteringPoint(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0101 finish"); if ((METERINGPoint.x == mMETERINGPointLT.x) && (METERINGPoint.y == mMETERINGPointLT.y)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0101 PASSED with METERINGPoint is: " + METERINGPoint.x + ", " + METERINGPoint.y); @@ -1424,7 +913,6 @@ export default function cameraSessionExposureTest() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0101 FAILED with METERINGPoint is: " + METERINGPoint.x + ", " + METERINGPoint.y); expect().assertFail(); } - await sleep(500); await stopCameraSession(); @@ -1436,63 +924,7 @@ export default function cameraSessionExposureTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0102 - * @tc.name : Check capture session set METERING point with callback(right-top point) - * @tc.desc : Check capture session set METERING point with callback(right-top point) - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0102', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0102--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0102 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0102 start for camera[" + i + "]"); - - await startCameraSession(i); - - mCameraSession.setMeteringPoint(mMETERINGPointRT, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0102 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0102 PASSED with METERINGPoint is: " + mMETERINGPointRT.x + ", " + mMETERINGPointRT.y); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0102 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - mCameraSession.getMeteringPoint(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0102 callback"); - if (!err) { - if ((data.x == mMETERINGPointRT.x) && (data.y == mMETERINGPointRT.y)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0102 PASSED with METERINGPoint is: " + data.x + ", " + data.y); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0102 FAILED with METERINGPoint is: " + data.x + ", " + data.y); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0102 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0102 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0102 ends here"); - done(); - } - }) + /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0102 @@ -1515,12 +947,11 @@ export default function cameraSessionExposureTest() { await startCameraSession(i); - await mCameraSession.setMeteringPoint(mMETERINGPointRT); + mCameraSession.setMeteringPoint(mMETERINGPointRT); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0102 finish"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0102 PASSED with METERINGPoint is: " + mMETERINGPointRT.x + ", " + mMETERINGPointRT.y); - await sleep(500); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0102 PASSED with METERINGPoint is: " + mMETERINGPointRT.x + ", " + mMETERINGPointRT.y); - let METERINGPoint = await mCameraSession.getMeteringPoint(); + let METERINGPoint = mCameraSession.getMeteringPoint(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0102 finish"); if ((METERINGPoint.x == mMETERINGPointRT.x) && (METERINGPoint.y == mMETERINGPointRT.y)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0102 PASSED with METERINGPoint is: " + METERINGPoint.x + ", " + METERINGPoint.y); @@ -1528,7 +959,6 @@ export default function cameraSessionExposureTest() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0102 FAILED with METERINGPoint is: " + METERINGPoint.x + ", " + METERINGPoint.y); expect().assertFail(); } - await sleep(500); await stopCameraSession(); @@ -1540,63 +970,6 @@ export default function cameraSessionExposureTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0103 - * @tc.name : Check capture session set METERING point with callback(left-bottom point) - * @tc.desc : Check capture session set METERING point with callback(left-bottom point) - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0103', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0103--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0103 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0103 start for camera[" + i + "]"); - - await startCameraSession(i); - - mCameraSession.setMeteringPoint(mMETERINGPointLB, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0103 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0103 PASSED with METERINGPoint is: " + mMETERINGPointLB.x + ", " + mMETERINGPointRB.y); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0103 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - mCameraSession.getMeteringPoint(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0103 callback"); - if (!err) { - if ((data.x == mMETERINGPointLB.x) && (data.y == mMETERINGPointLB.y)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0103 PASSED with METERINGPoint is: " + data.x + ", " + data.y); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0103 FAILED with METERINGPoint is: " + data.x + ", " + data.y); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0103 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0103 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0103 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0103 @@ -1619,12 +992,11 @@ export default function cameraSessionExposureTest() { await startCameraSession(i); - await mCameraSession.setMeteringPoint(mMETERINGPointLB); + mCameraSession.setMeteringPoint(mMETERINGPointLB); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0103 finish"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0103 PASSED with METERINGPoint is: " + mMETERINGPointLB.x + ", " + mMETERINGPointRB.y); - await sleep(500); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0103 PASSED with METERINGPoint is: " + mMETERINGPointLB.x + ", " + mMETERINGPointRB.y); - let METERINGPoint = await mCameraSession.getMeteringPoint(); + let METERINGPoint = mCameraSession.getMeteringPoint(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0103 finish"); if ((METERINGPoint.x == mMETERINGPointLB.x) && (METERINGPoint.y == mMETERINGPointLB.y)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0103 PASSED with METERINGPoint is: " + METERINGPoint.x + ", " + METERINGPoint.y); @@ -1632,7 +1004,6 @@ export default function cameraSessionExposureTest() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0103 FAILED with METERINGPoint is: " + METERINGPoint.x + ", " + METERINGPoint.y); expect().assertFail(); } - await sleep(500); await stopCameraSession(); @@ -1644,63 +1015,7 @@ export default function cameraSessionExposureTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0104 - * @tc.name : Check capture session set METERING point with callback(right-bottom point) - * @tc.desc : Check capture session set METERING point with callback(right-bottom point) - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0104', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0104--------------"); - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0104 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0104 start for camera[" + i + "]"); - - await startCameraSession(i); - - mCameraSession.setMeteringPoint(mMETERINGPointRB, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0104 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0104 PASSED with METERINGPoint is: " + mMETERINGPointRB.x + ", " + mMETERINGPointRB.y); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0104 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - mCameraSession.getMeteringPoint(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0104 callback"); - if (!err) { - if ((data.x == mMETERINGPointRB.x) && (data.y == mMETERINGPointRB.y)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0104 PASSED with METERINGPoint is: " + data.x + ", " + data.y); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0104 FAILED with METERINGPoint is: " + data.x + ", " + data.y); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0104 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0104 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0104 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0104 @@ -1723,12 +1038,11 @@ export default function cameraSessionExposureTest() { await startCameraSession(i); - await mCameraSession.setMeteringPoint(mMETERINGPointRB); + mCameraSession.setMeteringPoint(mMETERINGPointRB); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0104 finish"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0104 PASSED with METERINGPoint is: " + mMETERINGPointRB.x + ", " + mMETERINGPointRB.y); - await sleep(500); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0104 PASSED with METERINGPoint is: " + mMETERINGPointRB.x + ", " + mMETERINGPointRB.y); - let METERINGPoint = await mCameraSession.getMeteringPoint(); + let METERINGPoint = mCameraSession.getMeteringPoint(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0104 finish"); if ((METERINGPoint.x == mMETERINGPointRB.x) && (METERINGPoint.y == mMETERINGPointRB.y)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0104 PASSED with METERINGPoint is: " + METERINGPoint.x + ", " + METERINGPoint.y); @@ -1736,9 +1050,6 @@ export default function cameraSessionExposureTest() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0104 FAILED with METERINGPoint is: " + METERINGPoint.x + ", " + METERINGPoint.y); expect().assertFail(); } - - await sleep(500); - await stopCameraSession(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0104 end for camera[" + i + "]"); @@ -1749,63 +1060,7 @@ export default function cameraSessionExposureTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0105 - * @tc.name : Check capture session set METERING point with callback(left-top invalid point) - * @tc.desc : Check capture session set METERING point with callback(left-top invalid point) - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0105', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0105--------------"); - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0105 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0105 start for camera[" + i + "]"); - - await startCameraSession(i); - - mCameraSession.setMeteringPoint(mMETERINGPointInvalidLT, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0105 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0105 PASSED with METERINGPoint is: " + mMETERINGPointInvalidLT.x + ", " + mMETERINGPointInvalidLT.y); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0105 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - mCameraSession.getMeteringPoint(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0105 callback"); - if (!err) { - if (((data.x != mMETERINGPointInvalidLT.x) && (data.y != mMETERINGPointInvalidLT.y)) || (mEnableCheckInvalidMETERINGPoint == false)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0105 PASSED with METERINGPoint is: " + data.x + ", " + data.y); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0105 FAILED with METERINGPoint is: " + data.x + ", " + data.y); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0105 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0105 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0105 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0105 @@ -1828,12 +1083,11 @@ export default function cameraSessionExposureTest() { await startCameraSession(i); - await mCameraSession.setMeteringPoint(mMETERINGPointInvalidLT); + mCameraSession.setMeteringPoint(mMETERINGPointInvalidLT); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0105 finish"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0105 PASSED with METERINGPoint is: " + mMETERINGPointInvalidLT.x + ", " + mMETERINGPointInvalidLT.y); - await sleep(500); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0105 PASSED with METERINGPoint is: " + mMETERINGPointInvalidLT.x + ", " + mMETERINGPointInvalidLT.y); - let METERINGPoint = await mCameraSession.getMeteringPoint(); + let METERINGPoint = mCameraSession.getMeteringPoint(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0105 finish"); if (((METERINGPoint.x != mMETERINGPointInvalidLT.x) && (METERINGPoint.y != mMETERINGPointInvalidLT.y)) || (mEnableCheckInvalidMETERINGPoint == false)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0105 PASSED with METERINGPoint is: " + METERINGPoint.x + ", " + METERINGPoint.y); @@ -1841,7 +1095,6 @@ export default function cameraSessionExposureTest() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0105 FAILED with METERINGPoint is: " + METERINGPoint.x + ", " + METERINGPoint.y); expect().assertFail(); } - await sleep(500); await stopCameraSession(); @@ -1853,63 +1106,7 @@ export default function cameraSessionExposureTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0106 - * @tc.name : Check capture session set METERING point with callback(right-top invalid point) - * @tc.desc : Check capture session set METERING point with callback(right-top invalid point) - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0106', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0106--------------"); - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0106 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0106 start for camera[" + i + "]"); - - await startCameraSession(i); - - mCameraSession.setMeteringPoint(mMETERINGPointInvalidRT, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0106 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0106 PASSED with METERINGPoint is: " + mMETERINGPointInvalidRT.x + ", " + mMETERINGPointInvalidRT.y); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0106 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - mCameraSession.getMeteringPoint(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0106 callback"); - if (!err) { - if (((data.x != mMETERINGPointInvalidRT.x) && (data.y != mMETERINGPointInvalidRT.y)) || (mEnableCheckInvalidMETERINGPoint == false)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0106 PASSED with METERINGPoint is: " + data.x + ", " + data.y); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0106 FAILED with METERINGPoint is: " + data.x + ", " + data.y); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0106 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0106 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0106 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0106 @@ -1932,12 +1129,11 @@ export default function cameraSessionExposureTest() { await startCameraSession(i); - await mCameraSession.setMeteringPoint(mMETERINGPointInvalidRT); + mCameraSession.setMeteringPoint(mMETERINGPointInvalidRT); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0106 finish"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0106 PASSED with METERINGPoint is: " + mMETERINGPointInvalidRT.x + ", " + mMETERINGPointInvalidRT.y); - await sleep(500); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0106 PASSED with METERINGPoint is: " + mMETERINGPointInvalidRT.x + ", " + mMETERINGPointInvalidRT.y); - let METERINGPoint = await mCameraSession.getMeteringPoint(); + let METERINGPoint = mCameraSession.getMeteringPoint(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0106 finish"); if (((METERINGPoint.x != mMETERINGPointInvalidRT.x) && (METERINGPoint.y != mMETERINGPointInvalidRT.y)) || (mEnableCheckInvalidMETERINGPoint == false)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0106 PASSED with METERINGPoint is: " + METERINGPoint.x + ", " + METERINGPoint.y); @@ -1945,7 +1141,6 @@ export default function cameraSessionExposureTest() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0106 FAILED with METERINGPoint is: " + METERINGPoint.x + ", " + METERINGPoint.y); expect().assertFail(); } - await sleep(500); await stopCameraSession(); @@ -1957,63 +1152,7 @@ export default function cameraSessionExposureTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0107 - * @tc.name : Check capture session set METERING point with callback(left-bottom invalid point) - * @tc.desc : Check capture session set METERING point with callback(left-bottom invalid point) - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0107', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0107--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0107 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0107 start for camera[" + i + "]"); - - await startCameraSession(i); - - mCameraSession.setMeteringPoint(mMETERINGPointInvalidLB, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0107 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0107 PASSED with METERINGPoint is: " + mMETERINGPointInvalidLB.x + ", " + mMETERINGPointInvalidRB.y); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0107 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - mCameraSession.getMeteringPoint(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0107 callback"); - if (!err) { - if (((data.x != mMETERINGPointInvalidLB.x) && (data.y != mMETERINGPointInvalidLB.y)) || (mEnableCheckInvalidMETERINGPoint == false)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0107 PASSED with METERINGPoint is: " + data.x + ", " + data.y); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0107 FAILED with METERINGPoint is: " + data.x + ", " + data.y); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0107 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0107 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0107 ends here"); - done(); - } - }) + /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0107 @@ -2036,12 +1175,11 @@ export default function cameraSessionExposureTest() { await startCameraSession(i); - await mCameraSession.setMeteringPoint(mMETERINGPointInvalidLB); + mCameraSession.setMeteringPoint(mMETERINGPointInvalidLB); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0107 finish"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0107 PASSED with METERINGPoint is: " + mMETERINGPointInvalidLB.x + ", " + mMETERINGPointInvalidRB.y); - await sleep(500); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0107 PASSED with METERINGPoint is: " + mMETERINGPointInvalidLB.x + ", " + mMETERINGPointInvalidRB.y); - let METERINGPoint = await mCameraSession.getMeteringPoint(); + let METERINGPoint = mCameraSession.getMeteringPoint(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0107 finish"); if (((METERINGPoint.x != mMETERINGPointInvalidLB.x) && (METERINGPoint.y != mMETERINGPointInvalidLB.y)) || (mEnableCheckInvalidMETERINGPoint == false)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0107 PASSED with METERINGPoint is: " + METERINGPoint.x + ", " + METERINGPoint.y); @@ -2049,7 +1187,6 @@ export default function cameraSessionExposureTest() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0107 FAILED with METERINGPoint is: " + METERINGPoint.x + ", " + METERINGPoint.y); expect().assertFail(); } - await sleep(500); await stopCameraSession(); @@ -2061,63 +1198,6 @@ export default function cameraSessionExposureTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0108 - * @tc.name : Check capture session set METERING point with callback(right-bottom invalid point) - * @tc.desc : Check capture session set METERING point with callback(right-bottom invalid point) - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0108', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0108--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0108 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0108 start for camera[" + i + "]"); - - await startCameraSession(i); - - mCameraSession.setMeteringPoint(mMETERINGPointInvalidRB, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0108 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0108 PASSED with METERINGPoint is: " + mMETERINGPointInvalidRB.x + ", " + mMETERINGPointInvalidRB.y); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0108 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - mCameraSession.getMeteringPoint(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0108 callback"); - if (!err) { - if (((data.x != mMETERINGPointInvalidRB.x) && (data.y != mMETERINGPointInvalidRB.y)) || (mEnableCheckInvalidMETERINGPoint == false)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0108 PASSED with METERINGPoint is: " + data.x + ", " + data.y); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0108 FAILED with METERINGPoint is: " + data.x + ", " + data.y); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0108 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0108 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_CALLBACK_0108 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0108 @@ -2140,12 +1220,11 @@ export default function cameraSessionExposureTest() { await startCameraSession(i); - await mCameraSession.setMeteringPoint(mMETERINGPointInvalidRB); + mCameraSession.setMeteringPoint(mMETERINGPointInvalidRB); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0108 finish"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0108 PASSED with METERINGPoint is: " + mMETERINGPointInvalidRB.x + ", " + mMETERINGPointInvalidRB.y); - await sleep(500); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0108 PASSED with METERINGPoint is: " + mMETERINGPointInvalidRB.x + ", " + mMETERINGPointInvalidRB.y); - let METERINGPoint = await mCameraSession.getMeteringPoint(); + let METERINGPoint = mCameraSession.getMeteringPoint(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0108 finish"); if (((METERINGPoint.x != mMETERINGPointInvalidRB.x) && (METERINGPoint.y != mMETERINGPointInvalidRB.y)) || (mEnableCheckInvalidMETERINGPoint == false)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0108 PASSED with METERINGPoint is: " + METERINGPoint.x + ", " + METERINGPoint.y); @@ -2153,7 +1232,6 @@ export default function cameraSessionExposureTest() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_METERING_POINT_PROMISE_0108 FAILED with METERINGPoint is: " + METERINGPoint.x + ", " + METERINGPoint.y); expect().assertFail(); } - await sleep(500); await stopCameraSession(); @@ -2165,66 +1243,7 @@ export default function cameraSessionExposureTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_GET_EXPOSURE_BIAS_RANGE_CALLBACK_0100 - * @tc.name : Check capture session get exposure bias range with callback - * @tc.desc : Check capture session get exposure bias range with callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_GET_EXPOSURE_BIAS_RANGE_CALLBACK_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_GET_EXPOSURE_BIAS_RANGE_CALLBACK_0100--------------"); - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_GET_EXPOSURE_BIAS_RANGE_CALLBACK_0100 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_GET_EXPOSURE_BIAS_RANGE_CALLBACK_0100 start for camera[" + i + "]"); - - await startCameraSession(i); - - mCameraSession.getExposureBiasRange(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_GET_EXPOSURE_BIAS_RANGE_CALLBACK_0100 callback"); - if (!err) { - if (data.length > 0) { - mExposureBiasRangeArray[i] = data; - console.info(TAG + i + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_GET_EXPOSURE_BIAS_RANGE_CALLBACK_0100 PASSED with ExposureBiasRange length is: " + data.length); - for (let j = 0; j < mExposureBiasRangeArray[i].length; j++) { - console.info(TAG + j + "th, exposure bias is: " + data[j] + ", " + mExposureBiasRangeArray[i][j]); - - if ((mExposureBiasMaxArray[i] == undefined) || (mExposureBiasMaxArray[i] < mExposureBiasRangeArray[i][j])) { - mExposureBiasMaxArray[i] = mExposureBiasRangeArray[i][j] - } - - if ((mExposureBiasMinArray[i] == undefined) || (mExposureBiasMinArray[i] > mExposureBiasRangeArray[i][j])) { - mExposureBiasMinArray[i] = mExposureBiasRangeArray[i][j] - } - } - - console.info(TAG + "Exposure bias max is: " + mExposureBiasMaxArray[i] + ", min is: " + mExposureBiasMinArray[i]); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_GET_EXPOSURE_BIAS_RANGE_CALLBACK_0100 FAILED with ExposureBiasRange length is: " + data.length); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_GET_EXPOSURE_BIAS_RANGE_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_GET_EXPOSURE_BIAS_RANGE_CALLBACK_0100 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_GET_EXPOSURE_BIAS_RANGE_CALLBACK_0100 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_GET_EXPOSURE_BIAS_RANGE_PROMISE_0100 @@ -2247,7 +1266,10 @@ export default function cameraSessionExposureTest() { await startCameraSession(i); - let exposureBiasRange = await mCameraSession.getExposureBiasRange(); + let exposureBiasRange = mCameraSession.getExposureBiasRange(); + mExposureBiasRangeArray[i] = exposureBiasRange; + mExposureBiasMaxArray[i] = exposureBiasRange[exposureBiasRange.length -1]; + mExposureBiasMinArray[i] = exposureBiasRange[0]; console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_GET_EXPOSURE_BIAS_RANGE_PROMISE_0100 finish"); if (exposureBiasRange.length > 0) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_GET_EXPOSURE_BIAS_RANGE_PROMISE_0100 PASSED with ExposureBiasRange length is: " + exposureBiasRange.length); @@ -2259,8 +1281,6 @@ export default function cameraSessionExposureTest() { for (let j = 0; j < exposureBiasRange.length; j++) { console.info(TAG + j + "th, exposure bias is: " + exposureBiasRange[j]); } - - await sleep(500); await stopCameraSession(); @@ -2272,63 +1292,7 @@ export default function cameraSessionExposureTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0100 - * @tc.name : Check capture session set exposure bias with callback - * @tc.desc : Check capture session set exposure bias with callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0100--------------"); - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0100 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0100 start for camera[" + i + "]"); - - await startCameraSession(i); - - mCameraSession.setExposureBias(mExposureBiasRangeArray[i][0], async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0100 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0100 PASSED with ExposureBias is: " + mExposureBiasRangeArray[i][0]); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - mCameraSession.getExposureValue(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0100 callback"); - if (!err) { - if (data == mExposureBiasRangeArray[i][0]) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0100 PASSED with ExposureValue is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0100 FAILED with ExposureValue is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0100 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0100 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0100 @@ -2348,26 +1312,25 @@ export default function cameraSessionExposureTest() { } else { for (let i = 0; i < mCameraNum; i++) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0100 start for camera[" + i + "]"); - - await startCameraSession(i); - - await mCameraSession.setExposureBias(mExposureBiasRangeArray[i][0]); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0100 finish"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0100 PASSED with ExposureBias is: " + mExposureBiasRangeArray[i][0]); - await sleep(500); - - let exposureValue = await mCameraSession.getExposureValue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0100 finish"); - if (exposureValue == mExposureBiasRangeArray[i][0]) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0100 PASSED with ExposureValue is: " + exposureValue); + let exposureBias = mExposureBiasRangeArray[i][0]; + if (exposureBias == 0) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0100 exposureBias is 0"); } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0100 FAILED with ExposureValue is: " + exposureValue); - expect().assertFail(); + await startCameraSession(i); + mCameraSession.setExposureBias(exposureBias); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0100 finish"); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0100 PASSED with ExposureBias is: " + mExposureBiasRangeArray[i][0]); + + let exposureValue = mCameraSession.getExposureValue(); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0100 finish"); + if (exposureValue == mExposureBiasRangeArray[i][0]) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0100 PASSED with ExposureValue is: " + exposureValue); + } else { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0100 FAILED with ExposureValue is: " + exposureValue); + expect().assertFail(); + } + await stopCameraSession(); } - await sleep(500); - - await stopCameraSession(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0100 end for camera[" + i + "]"); } @@ -2376,63 +1339,7 @@ export default function cameraSessionExposureTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0101 - * @tc.name : Check capture session set exposure bias with callback(invalid value, min - 1) - * @tc.desc : Check capture session set exposure bias with callback(invalid value, min - 1) - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0101', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0101--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0101 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0101 start for camera[" + i + "]"); - - await startCameraSession(i); - - mCameraSession.setExposureBias(mExposureBiasMinArray[i] - 1, async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0101 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0101 PASSED with ExposureBias is: " + (mExposureBiasMinArray[i] - 1)); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0101 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - mCameraSession.getExposureValue(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0101 callback"); - if (!err) { - if (data != (mExposureBiasMinArray[i] - 1)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0101 PASSED with ExposureValue is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0101 FAILED with ExposureValue is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0101 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0101 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0101 ends here"); - done(); - } - }) + /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0101 @@ -2452,26 +1359,27 @@ export default function cameraSessionExposureTest() { } else { for (let i = 0; i < mCameraNum; i++) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0101 start for camera[" + i + "]"); - - await startCameraSession(i); - - await mCameraSession.setExposureBias(mExposureBiasMinArray[i] - 1); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0101 finish"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0101 PASSED with ExposureBias is: " + (mExposureBiasMinArray[i] - 1)); - await sleep(500); - - let exposureValue = await mCameraSession.getExposureValue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0101 finish"); - if (exposureValue != (mExposureBiasMinArray[i] - 1)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0101 PASSED with ExposureValue is: " + exposureValue); + let exposureBias =mExposureBiasMinArray[i]; + if (exposureBias == 0) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0101 exposureBias is 0"); } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0101 FAILED with ExposureValue is: " + exposureValue); - expect().assertFail(); + await startCameraSession(i); + mCameraSession.setExposureBias(exposureBias - 1); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0101 finish"); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0101 PASSED with ExposureBias is: " + (mExposureBiasMinArray[i] - 1)); + + let exposureValue = mCameraSession.getExposureValue(); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0101 finish"); + if (exposureValue != (exposureBias - 1)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0101 PASSED with ExposureValue is: " + exposureValue); + } else { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0101 FAILED with ExposureValue is: " + exposureValue); + expect().assertFail(); + } + await sleep(500); + + await stopCameraSession(); } - await sleep(500); - - await stopCameraSession(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0101 end for camera[" + i + "]"); } @@ -2480,63 +1388,7 @@ export default function cameraSessionExposureTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0102 - * @tc.name : Check capture session set exposure bias with callback(invalid value, min - 0.1) - * @tc.desc : Check capture session set exposure bias with callback(invalid value, min - 0.1) - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0102', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0102--------------"); - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0102 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0102 start for camera[" + i + "]"); - - await startCameraSession(i); - - mCameraSession.setExposureBias(mExposureBiasMinArray[i] - 0.1, async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0102 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0102 PASSED with ExposureBias is: " + (mExposureBiasMinArray[i] - 0.1)); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0102 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - mCameraSession.getExposureValue(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0102 callback"); - if (!err) { - if (data != (mExposureBiasMinArray[i] - 0.1)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0102 PASSED with ExposureValue is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0102 FAILED with ExposureValue is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0102 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0102 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0102 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0102 @@ -2556,26 +1408,24 @@ export default function cameraSessionExposureTest() { } else { for (let i = 0; i < mCameraNum; i++) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0102 start for camera[" + i + "]"); - - await startCameraSession(i); - - await mCameraSession.setExposureBias(mExposureBiasMinArray[i] - 0.1); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0102 finish"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0102 PASSED with ExposureBias is: " + (mExposureBiasMinArray[i] - 0.1)); - await sleep(500); - - let exposureValue = await mCameraSession.getExposureValue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0102 finish"); - if (exposureValue != (mExposureBiasMinArray[i] - 0.1)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0102 PASSED with ExposureValue is: " + exposureValue); + let exposureBias =mExposureBiasMinArray[i]; + if (exposureBias == 0) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0102 exposureBias is 0"); } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0102 FAILED with ExposureValue is: " + exposureValue); - expect().assertFail(); + await startCameraSession(i); + mCameraSession.setExposureBias(exposureBias - 0.1); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0102 finish"); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0102 PASSED with ExposureBias is: " + (mExposureBiasMinArray[i] - 0.1)); + let exposureValue = mCameraSession.getExposureValue(); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0102 finish"); + if (exposureValue != (exposureBias - 0.1)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0102 PASSED with ExposureValue is: " + exposureValue); + } else { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0102 FAILED with ExposureValue is: " + exposureValue); + expect().assertFail(); + } + await stopCameraSession(); } - await sleep(500); - - await stopCameraSession(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0102 end for camera[" + i + "]"); } @@ -2584,63 +1434,7 @@ export default function cameraSessionExposureTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0103 - * @tc.name : Check capture session set exposure bias with callback(invalid value, max + 1) - * @tc.desc : Check capture session set exposure bias with callback(invalid value, max + 1) - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0103', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0103--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0103 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0103 start for camera[" + i + "]"); - - await startCameraSession(i); - - mCameraSession.setExposureBias(mExposureBiasMaxArray[i] + 1, async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0103 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0103 PASSED with ExposureBias is: " + (mExposureBiasMaxArray[i] + 1)); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0103 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - mCameraSession.getExposureValue(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0103 callback"); - if (!err) { - if (data != (mExposureBiasMaxArray[i] + 1)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0103 PASSED with ExposureValue is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0103 FAILED with ExposureValue is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0103 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0103 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0103 ends here"); - done(); - } - }) + /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0103 @@ -2660,25 +1454,28 @@ export default function cameraSessionExposureTest() { } else { for (let i = 0; i < mCameraNum; i++) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0103 start for camera[" + i + "]"); + let exposureBias = mExposureBiasMaxArray[i]; + if (exposureBias == 0) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0103 exposureBias is 0"); + } else { + await startCameraSession(i); - await startCameraSession(i); + mCameraSession.setExposureBias(exposureBias + 1); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0103 finish"); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0103 PASSED with ExposureBias is: " + (mExposureBiasMaxArray[i] + 1)); - await mCameraSession.setExposureBias(mExposureBiasMaxArray[i] + 1); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0103 finish"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0103 PASSED with ExposureBias is: " + (mExposureBiasMaxArray[i] + 1)); - await sleep(500); - - let exposureValue = await mCameraSession.getExposureValue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0103 finish"); - if (exposureValue != (mExposureBiasMaxArray[i] + 1)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0103 PASSED with ExposureValue is: " + exposureValue); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0103 FAILED with ExposureValue is: " + exposureValue); - expect().assertFail(); + let exposureValue = mCameraSession.getExposureValue(); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0103 finish"); + if (exposureValue != (exposureBias + 1)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0103 PASSED with ExposureValue is: " + exposureValue); + } else { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0103 FAILED with ExposureValue is: " + exposureValue); + expect().assertFail(); + } + + await stopCameraSession(); } - await sleep(500); - - await stopCameraSession(); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0103 end for camera[" + i + "]"); } @@ -2688,63 +1485,6 @@ export default function cameraSessionExposureTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0104 - * @tc.name : Check capture session set exposure bias with callback(invalid value, max + 0.1) - * @tc.desc : Check capture session set exposure bias with callback(invalid value, max + 0.1) - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0104', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0104--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0104 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0104 start for camera[" + i + "]"); - - await startCameraSession(i); - - mCameraSession.setExposureBias(mExposureBiasMaxArray[i] + 0.1, async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0104 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0104 PASSED with ExposureBias is: " + (mExposureBiasMaxArray[i] + 0.1)); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0104 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - mCameraSession.getExposureValue(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0104 callback"); - if (!err) { - if (data != (mExposureBiasMaxArray[i] + 0.1)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0104 PASSED with ExposureValue is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0104 FAILED with ExposureValue is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0104 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0104 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_CALLBACK_0104 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0104 @@ -2764,25 +1504,28 @@ export default function cameraSessionExposureTest() { } else { for (let i = 0; i < mCameraNum; i++) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0104 start for camera[" + i + "]"); + let exposureBias = mExposureBiasMaxArray[i]; + if (exposureBias == 0) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0104 exposureBias is 0"); + } else { + await startCameraSession(i); - await startCameraSession(i); + mCameraSession.setExposureBias(exposureBias + 0.1); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0104 finish"); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0104 PASSED with ExposureBias is: " + (mExposureBiasMaxArray[i] + 0.1)); - await mCameraSession.setExposureBias(mExposureBiasMaxArray[i] + 0.1); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0104 finish"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0104 PASSED with ExposureBias is: " + (mExposureBiasMaxArray[i] + 0.1)); - await sleep(500); - - let exposureValue = await mCameraSession.getExposureValue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0104 finish"); - if (exposureValue != (mExposureBiasMaxArray[i] + 0.1)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0104 PASSED with ExposureValue is: " + exposureValue); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0104 FAILED with ExposureValue is: " + exposureValue); - expect().assertFail(); + let exposureValue = mCameraSession.getExposureValue(); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0104 finish"); + if (exposureValue != (exposureBias + 0.1)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0104 PASSED with ExposureValue is: " + exposureValue); + } else { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0104 FAILED with ExposureValue is: " + exposureValue); + expect().assertFail(); + } + + await stopCameraSession(); } - await sleep(500); - - await stopCameraSession(); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_EXPOSURE_BIAS_PROMISE_0104 end for camera[" + i + "]"); } diff --git a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionFlashTest.test.ets b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionFlashTest.test.ets index 84c14cebf8ecebf96a3dd3e5661e9a73753429db..7ba5839129815733c02194e4909009afb2fc6195 100644 --- a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionFlashTest.test.ets +++ b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionFlashTest.test.ets @@ -179,10 +179,10 @@ export default function cameraSessionFlashTest() { console.log(TAG + 'Exit releaseVideoReceiveSurface') } - async function mgetCameraManagerInstance() { + function mgetCameraManagerInstance() { console.info('Enter mgetCameraManagerInstance'); - mCameraManager = await cameraObj.getCameraManager(null); + mCameraManager = cameraObj.getCameraManager(null); if (isEmpty(mCameraManager)) { console.info(TAG + "getCameraManager FAILED"); return false; @@ -193,10 +193,10 @@ export default function cameraSessionFlashTest() { return true; } - async function getCameraSupportDevicesArray() { + function getCameraSupportDevicesArray() { console.info('Enter getCameraSupportDevicesArray'); - mCameraDevicesArray = await mCameraManager.getSupportedCameras(); + mCameraDevicesArray = mCameraManager.getSupportedCameras(); /* mCameraManager.getSupportedCameras(async (err, data) => { console.info(TAG + "Entering getCameraSupportDevicesArray callback"); @@ -231,47 +231,11 @@ export default function cameraSessionFlashTest() { return true; } - async function beginCameraSessionConfig() { - console.info('Enter beginCameraSessionConfig'); - - mCameraSession.beginConfig(async (err) => { - if (!err) { - console.info(TAG + "Entering beginConfig PASSED"); - } else { - console.info(TAG + "Entering beginConfig FAILED : " + err.message); - } - }) - - await sleep(30); - - console.info('Exit beginCameraSessionConfig'); - - return true; - } - - async function commitCameraSessionConfig() { - console.info('Enter commitCameraSessionConfig'); - - mCameraSession.commitConfig(async (err) => { - if (!err) { - console.info(TAG + "Entering commitConfig PASSED"); - } else { - console.info(TAG + "Entering commitConfig FAILED : " + err.message); - } - }) - - await sleep(500); - - console.info('Exit commitCameraSessionConfig'); - - return true; - } - - async function createCameraSessionInstance() { + function createCameraSessionInstance() { console.info('Enter createCameraSessionInstance'); try { - mCameraSession = await mCameraManager.createCaptureSession(); + mCameraSession = mCameraManager.createCaptureSession(); } catch { console.info('createCaptureSession FAILED'); @@ -282,7 +246,7 @@ export default function cameraSessionFlashTest() { return false; } - await beginCameraSessionConfig(); + mCameraSession.beginConfig(); console.info('Exit createCameraSessionInstance'); @@ -295,33 +259,20 @@ export default function cameraSessionFlashTest() { async function createInput(idx:any) { console.info('Enter createInput'); - + if (isEmpty(mCameraDevicesArray)) { console.info(TAG + "Entering createInputs FAILED with NoCamera"); return false; } - mCameraInput = null; - await mCameraManager.createCameraInput(mCameraDevicesArray[idx]).then((result) => { - console.info('createCameraInput success'); - mCameraInput = result; - }).catch((err) => { - console.info('createCameraInput failed, err = ' + err.message); - }); + mCameraInput = mCameraManager.createCameraInput(mCameraDevicesArray[idx]); if (isEmpty(mCameraInput)) { console.info(TAG + "createCameraInput FAILED"); return false; } - mCameraInput.open(async (err) => { - console.info(TAG + "Entering mCameraInput open callback"); - if (!err) { - console.info(TAG + "Entering mCameraInput open PASSED "); - } else { - console.info(TAG + "Entering mCameraInput open FAILED : " + err.message); - } - }) + await mCameraInput.open(); await sleep(100); @@ -337,7 +288,6 @@ export default function cameraSessionFlashTest() { if (!isEmpty(mCameraInput)) { await mCameraInput.close(); - await mCameraInput.release(); } console.info('Exit releaseInput'); @@ -345,24 +295,16 @@ export default function cameraSessionFlashTest() { return true; } - async function createOutput(idx:any) { + function createOutput(idx:any) { console.info('Enter createOutput'); - let cameraOutputCap = null; - await mCameraManager.getSupportedOutputCapability(mCameraDevicesArray[idx]).then((result) => { - console.info('getSupportedOutputCapability success'); - cameraOutputCap = result; - }).catch((err) => { - console.info('getSupportedOutputCapability failed, err = ' + err.message); - mPreviewOutput = null; - mPhotoOutput = null; - }); + let cameraOutputCap = mCameraManager.getSupportedOutputCapability(mCameraDevicesArray[idx]); if (!isEmpty(cameraOutputCap)) { if (!isEmpty(cameraOutputCap.previewProfiles)) { console.info(TAG + "cameraOutputCap.previewProfiles.length: " + cameraOutputCap.previewProfiles.length); for (let i = 0; i < cameraOutputCap.previewProfiles.length; i++) { - mPreviewOutput = await mCameraManager.createPreviewOutput(cameraOutputCap.previewProfiles[i], globalThis.surfaceId); + mPreviewOutput = mCameraManager.createPreviewOutput(cameraOutputCap.previewProfiles[i], globalThis.surfaceId); if (!isEmpty(mPreviewOutput)) { break; } @@ -379,7 +321,7 @@ export default function cameraSessionFlashTest() { console.info(TAG + "cameraOutputCap.photoProfiles.length: " + cameraOutputCap.photoProfiles.length); for (let i = 0; i < cameraOutputCap.photoProfiles.length; i++) { - mPhotoOutput = await mCameraManager.createPhotoOutput(cameraOutputCap.photoProfiles[i], mPhotoSurface); + mPhotoOutput = mCameraManager.createPhotoOutput(cameraOutputCap.photoProfiles[i], mPhotoSurface); if (!isEmpty(mPhotoOutput)) { break; } @@ -424,7 +366,6 @@ export default function cameraSessionFlashTest() { console.info('Enter releaseOutput'); if (!isEmpty(mPreviewOutput)) { - await mPreviewOutput.stop(); await mPreviewOutput.release(); } @@ -446,23 +387,23 @@ export default function cameraSessionFlashTest() { console.info(TAG + "Enter startCameraSession"); await createInput(idx); - await createOutput(idx); + createOutput(idx); await sleep(1); if (!isEmpty(mCameraInput)) { console.info(TAG + "Start to addInput"); - await mCameraSession.addInput(mCameraInput); + mCameraSession.addInput(mCameraInput); } if (!isEmpty(mPreviewOutput)) { console.info(TAG + "Start to addOutput mPreviewOutput"); - await mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPreviewOutput); } if (!isEmpty(mPhotoOutput)) { console.info(TAG + "Start to addOutput mPhotoOutput"); - await mCameraSession.addOutput(mPhotoOutput); + mCameraSession.addOutput(mPhotoOutput); } /* if (!isEmpty(mVideoOutput)) { @@ -472,8 +413,8 @@ export default function cameraSessionFlashTest() { */ await sleep(1); - await commitCameraSessionConfig(); - await beginCameraSessionConfig(); + await mCameraSession.commitConfig(); + /* await mCameraSession.start(async (err) => { @@ -494,6 +435,9 @@ export default function cameraSessionFlashTest() { async function stopCameraSession() { console.info(TAG + "Enter stopCameraSession"); + + mCameraSession.beginConfig(); + /* mCameraSession.stop(async (err) => { console.info(TAG + "Entering mCameraSession stop callback"); @@ -509,18 +453,20 @@ export default function cameraSessionFlashTest() { if (!isEmpty(mCameraInput)) { console.info(TAG + "Start to removeInput input"); - await mCameraSession.removeInput(mCameraInput); + mCameraSession.removeInput(mCameraInput); } if (!isEmpty(mPreviewOutput)) { console.info(TAG + "Start to removeOutput mPreviewOutput"); - await mCameraSession.removeOutput(mPreviewOutput); + mCameraSession.removeOutput(mPreviewOutput); } if (!isEmpty(mPhotoOutput)) { console.info(TAG + "Start to removeOutput mPhotoOutput"); - await mCameraSession.removeOutput(mPhotoOutput); + mCameraSession.removeOutput(mPhotoOutput); } + + // await mCameraSession.commitConfig(); /* if (!isEmpty(mVideoOutput)) { console.info(TAG + "Start to removeOutput mVideoOutput"); @@ -529,7 +475,7 @@ export default function cameraSessionFlashTest() { */ await releaseInput(); await releaseOutput(); - + console.info(TAG + "Exit stopCameraSession"); return true; @@ -542,9 +488,9 @@ export default function cameraSessionFlashTest() { sleep(100); await getPhotoReceiverSurface(); await getVideoReceiveSurface(); - await mgetCameraManagerInstance(); - await getCameraSupportDevicesArray(); - await createCameraSessionInstance(); + mgetCameraManagerInstance(); + getCameraSupportDevicesArray(); + createCameraSessionInstance(); console.info('Device type = ' + deviceInfo.deviceType); @@ -567,55 +513,7 @@ export default function cameraSessionFlashTest() { console.info('afterAll case'); }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_HAS_FLASH_CALLBACK_0100 - * @tc.name : Check capture session has flash with callback or not - * @tc.desc : Check capture session has flash with callback or not - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_HAS_FLASH_CALLBACK_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_HAS_FLASH_CALLBACK_0100--------------"); - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_HAS_FLASH_CALLBACK_0100 FAILED with NoCamera"); - expect().assertFail(); - done(); - } - else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_HAS_FLASH_CALLBACK_0100 start for camera[" + i + "]"); - - await startCameraSession(i); - mHasFlashArray[i] = false; - - mCameraSession.hasFlash(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_HAS_FLASH_CALLBACK_0100 callback"); - if (!err) { - if (data != null || data != undefined) { - mHasFlashArray[i] = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_HAS_FLASH_CALLBACK_0100 PASSED with hasFlash is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_HAS_FLASH_CALLBACK_0100 FAILED with hasFlash is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_HAS_FLASH_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(100); - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_HAS_FLASH_CALLBACK_0100 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_HAS_FLASH_CALLBACK_0100 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_HAS_FLASH_PROMISE_0100 @@ -639,7 +537,7 @@ export default function cameraSessionFlashTest() { await startCameraSession(i); - let hasFlashPromise = await mCameraSession.hasFlash(); + let hasFlashPromise = mCameraSession.hasFlash(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_HAS_FLASH_PROMISE_0100 finish"); if (hasFlashPromise != null || hasFlashPromise != undefined) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_HAS_FLASH_PROMISE_0100 PASSED with hasFlash is: " + hasFlashPromise); @@ -659,59 +557,6 @@ export default function cameraSessionFlashTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0100 - * @tc.name : Check capture session support flash close mode with callback or not - * @tc.desc : Check capture session support flash close mode with callback or not - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0100--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0100 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0100 start for camera[" + i + "]"); - - await startCameraSession(i); - - mIsFlashModeSupportedArray[i] = false; - - if (mHasFlashArray[i] == true) { - mCameraSession.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_CLOSE, async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0100 callback"); - if (!err) { - if (data != null || data != undefined) { - mIsFlashModeSupportedArray[i] = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0100 PASSED with isFlashModeSupported is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0100 FAILED with isFlashModeSupported is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(100); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0100 not support"); - } - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0100 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0100 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_PROMISE_0100 @@ -735,7 +580,7 @@ export default function cameraSessionFlashTest() { await startCameraSession(i); if (mHasFlashArray[i] == true) { - let isFlashModeSupported = await mCameraSession.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_CLOSE); + let isFlashModeSupported = mCameraSession.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_CLOSE); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_PROMISE_0100 finish"); if (isFlashModeSupported != null || isFlashModeSupported != undefined) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_PROMISE_0100 PASSED with isFlashModeSupported is: " + isFlashModeSupported); @@ -760,67 +605,7 @@ export default function cameraSessionFlashTest() { }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0100 - * @tc.name : Check capture session set flash close mode with callback - * @tc.desc : Check capture session set flash close mode with callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0100--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0100 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0100 start for camera[" + i + "]"); - - await startCameraSession(i); - - if ((mHasFlashArray[i] == true) && (mIsFlashModeSupportedArray[i] == true)) { - mCameraSession.setFlashMode(cameraObj.FlashMode.FLASH_MODE_CLOSE, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0100 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0100 PASSED with FlashMode is: " + cameraObj.FlashMode.FLASH_MODE_CLOSE); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - mCameraSession.getFlashMode(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0100 callback"); - if (!err) { - if (data == cameraObj.FlashMode.FLASH_MODE_CLOSE) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0100 PASSED with FlaseMode is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0100 FAILED with FlaseMode is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0100 not support"); - } - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0100 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0100 ends here"); - done(); - } - }) + /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_PROMISE_0100 @@ -844,12 +629,11 @@ export default function cameraSessionFlashTest() { await startCameraSession(i); if ((mHasFlashArray[i] == true) && (mIsFlashModeSupportedArray[i] == true)) { - await mCameraSession.setFlashMode(cameraObj.FlashMode.FLASH_MODE_CLOSE); + mCameraSession.setFlashMode(cameraObj.FlashMode.FLASH_MODE_CLOSE); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_PROMISE_0100 finish"); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_PROMISE_0100 PASSED with FlashMode is: " + cameraObj.FlashMode.FLASH_MODE_CLOSE); - await sleep(500); - let flashMode = await mCameraSession.getFlashMode(); + let flashMode = mCameraSession.getFlashMode(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_PROMISE_0100 finish"); if (flashMode == cameraObj.FlashMode.FLASH_MODE_CLOSE) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_PROMISE_0100 PASSED with FlaseMode is: " + flashMode); @@ -857,7 +641,6 @@ export default function cameraSessionFlashTest() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_PROMISE_0100 FAILED with FlaseMode is: " + flashMode); expect().assertFail(); } - await sleep(500); } else { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_PROMISE_0100 not support"); } @@ -872,59 +655,7 @@ export default function cameraSessionFlashTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0101 - * @tc.name : Check capture session support flash open mode with callback or not - * @tc.desc : Check capture session support flash open mode with callback or not - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0101', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0101--------------"); - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0101 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0101 start for camera[" + i + "]"); - - await startCameraSession(i); - - mIsFlashModeSupportedArray[i] = false; - - if (mHasFlashArray[i] == true) { - mCameraSession.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_OPEN, async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0101 callback"); - if (!err) { - if (data != null || data != undefined) { - mIsFlashModeSupportedArray[i] = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0101 PASSED with isFlashModeSupported is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0101 FAILED with isFlashModeSupported is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0101 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(100); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0101 not support"); - } - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0101 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0101 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_PROMISE_0101 @@ -948,16 +679,14 @@ export default function cameraSessionFlashTest() { await startCameraSession(i); if (mHasFlashArray[i] == true) { - let isFlashModeSupported = await mCameraSession.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_OPEN); + let isFlashModeSupported = mCameraSession.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_OPEN); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_PROMISE_0101 finish"); if (isFlashModeSupported != null || isFlashModeSupported != undefined) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_PROMISE_0101 PASSED with isFlashModeSupported is: " + isFlashModeSupported); } else { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_PROMISE_0101 FAILED with isFlashModeSupported is: " + isFlashModeSupported); expect().assertFail(); - } - - await sleep(100); + } } else { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_PROMISE_0101 not support"); } @@ -972,67 +701,7 @@ export default function cameraSessionFlashTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0101 - * @tc.name : Check capture session set flash open mode with callback - * @tc.desc : Check capture session set flash open mode with callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0101', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0101--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0101 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0101 start for camera[" + i + "]"); - - await startCameraSession(i); - - if ((mHasFlashArray[i] == true) && (mIsFlashModeSupportedArray[i] == true)) { - mCameraSession.setFlashMode(cameraObj.FlashMode.FLASH_MODE_OPEN, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0101 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0101 PASSED with FlashMode is: " + cameraObj.FlashMode.FLASH_MODE_OPEN); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0101 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - mCameraSession.getFlashMode(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0101 callback"); - if (!err) { - if (data == cameraObj.FlashMode.FLASH_MODE_OPEN) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0101 PASSED with FlaseMode is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0101 FAILED with FlaseMode is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0101 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0101 not support"); - } - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0101 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0101 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_PROMISE_0101 @@ -1056,12 +725,11 @@ export default function cameraSessionFlashTest() { await startCameraSession(i); if ((mHasFlashArray[i] == true) && (mIsFlashModeSupportedArray[i] == true)) { - await mCameraSession.setFlashMode(cameraObj.FlashMode.FLASH_MODE_OPEN); + mCameraSession.setFlashMode(cameraObj.FlashMode.FLASH_MODE_OPEN); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_PROMISE_0101 finish"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_PROMISE_0101 PASSED with FlashMode is: " + cameraObj.FlashMode.FLASH_MODE_OPEN); - await sleep(500); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_PROMISE_0101 PASSED with FlashMode is: " + cameraObj.FlashMode.FLASH_MODE_OPEN); - let flashMode = await mCameraSession.getFlashMode(); + let flashMode = mCameraSession.getFlashMode(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_PROMISE_0101 finish"); if (flashMode == cameraObj.FlashMode.FLASH_MODE_OPEN) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_PROMISE_0101 PASSED with FlaseMode is: " + flashMode); @@ -1069,7 +737,6 @@ export default function cameraSessionFlashTest() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_PROMISE_0101 FAILED with FlaseMode is: " + flashMode); expect().assertFail(); } - await sleep(500); } else { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_PROMISE_0101 not support"); } @@ -1084,59 +751,7 @@ export default function cameraSessionFlashTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0102 - * @tc.name : Check capture session support flash auto mode with callback or not - * @tc.desc : Check capture session support flash auto mode with callback or not - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0102', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0102--------------"); - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0102 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0102 start for camera[" + i + "]"); - - await startCameraSession(i); - - mIsFlashModeSupportedArray[i] = false; - - if (mHasFlashArray[i] == true) { - mCameraSession.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_AUTO, async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0102 callback"); - if (!err) { - if (data != null || data != undefined) { - mIsFlashModeSupportedArray[i] = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0102 PASSED with isFlashModeSupported is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0102 FAILED with isFlashModeSupported is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0102 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(100); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0102 not support"); - } - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0102 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0102 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_PROMISE_0102 @@ -1160,16 +775,14 @@ export default function cameraSessionFlashTest() { await startCameraSession(i); if (mHasFlashArray[i] == true) { - let isFlashModeSupported = await mCameraSession.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_AUTO); + let isFlashModeSupported = mCameraSession.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_AUTO); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_PROMISE_0102 finish"); if (isFlashModeSupported != null || isFlashModeSupported != undefined) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_PROMISE_0102 PASSED with isFlashModeSupported is: " + isFlashModeSupported); } else { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_PROMISE_0102 FAILED with isFlashModeSupported is: " + isFlashModeSupported); expect().assertFail(); - } - - await sleep(100); + } } else { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_PROMISE_0102 not support"); } @@ -1184,67 +797,7 @@ export default function cameraSessionFlashTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0102 - * @tc.name : Check capture session set flash auto mode with callback - * @tc.desc : Check capture session set flash auto mode with callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0102', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0102--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0102 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0102 start for camera[" + i + "]"); - - await startCameraSession(i); - - if ((mHasFlashArray[i] == true) && (mIsFlashModeSupportedArray[i] == true)) { - mCameraSession.setFlashMode(cameraObj.FlashMode.FLASH_MODE_AUTO, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0102 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0102 PASSED with FlashMode is: " + cameraObj.FlashMode.FLASH_MODE_AUTO); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0102 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - mCameraSession.getFlashMode(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0102 callback"); - if (!err) { - if (data == cameraObj.FlashMode.FLASH_MODE_AUTO) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0102 PASSED with FlaseMode is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0102 FAILED with FlaseMode is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0102 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0102 not support"); - } - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0102 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0102 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_PROMISE_0102 @@ -1268,12 +821,10 @@ export default function cameraSessionFlashTest() { await startCameraSession(i); if ((mHasFlashArray[i] == true) && (mIsFlashModeSupportedArray[i] == true)) { - await mCameraSession.setFlashMode(cameraObj.FlashMode.FLASH_MODE_AUTO); + mCameraSession.setFlashMode(cameraObj.FlashMode.FLASH_MODE_AUTO); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_PROMISE_0102 finish"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_PROMISE_0102 PASSED with FlashMode is: " + cameraObj.FlashMode.FLASH_MODE_AUTO); - await sleep(500); - - let flashMode = await mCameraSession.getFlashMode(); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_PROMISE_0102 PASSED with FlashMode is: " + cameraObj.FlashMode.FLASH_MODE_AUTO); + let flashMode = mCameraSession.getFlashMode(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_PROMISE_0102 finish"); if (flashMode == cameraObj.FlashMode.FLASH_MODE_AUTO) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_PROMISE_0102 PASSED with FlaseMode is: " + flashMode); @@ -1281,11 +832,9 @@ export default function cameraSessionFlashTest() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_PROMISE_0102 FAILED with FlaseMode is: " + flashMode); expect().assertFail(); } - await sleep(500); } else { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_PROMISE_0102 not support"); } - await stopCameraSession(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_PROMISE_0102 end for camera[" + i + "]"); @@ -1296,59 +845,6 @@ export default function cameraSessionFlashTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0103 - * @tc.name : Check capture session support flash always open mode with callback or not - * @tc.desc : Check capture session support flash always open mode with callback or not - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0103', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0103--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0103 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0103 start for camera[" + i + "]"); - - await startCameraSession(i); - - mIsFlashModeSupportedArray[i] = false; - - if (mHasFlashArray[i] == true) { - mCameraSession.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN, async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0103 callback"); - if (!err) { - if (data != null || data != undefined) { - mIsFlashModeSupportedArray[i] = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0103 PASSED with isFlashModeSupported is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0103 FAILED with isFlashModeSupported is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0103 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(100); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0103 not support"); - } - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0103 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0103 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_PROMISE_0103 @@ -1372,16 +868,14 @@ export default function cameraSessionFlashTest() { await startCameraSession(i); if (mHasFlashArray[i] == true) { - let isFlashModeSupported = await mCameraSession.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); + let isFlashModeSupported = mCameraSession.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_PROMISE_0103 finish"); if (isFlashModeSupported != null || isFlashModeSupported != undefined) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_PROMISE_0103 PASSED with hasFlash is: " + isFlashModeSupported); } else { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_PROMISE_0103 FAILED with hasFlash is: " + isFlashModeSupported); expect().assertFail(); - } - - await sleep(100); + } } else { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_PROMISE_0103 not support"); } @@ -1396,67 +890,7 @@ export default function cameraSessionFlashTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0103 - * @tc.name : Check capture session set flash always open mode with callback - * @tc.desc : Check capture session set flash always open mode with callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0103', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0103--------------"); - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0103 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0103 start for camera[" + i + "]"); - - await startCameraSession(i); - - if ((mHasFlashArray[i] == true) && (mIsFlashModeSupportedArray[i] == true)) { - mCameraSession.setFlashMode(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0103 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0103 PASSED with FlashMode is: " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0103 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - mCameraSession.getFlashMode(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0103 callback"); - if (!err) { - if (data == cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0103 PASSED with FlaseMode is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0103 FAILED with FlaseMode is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0103 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0103 not support"); - } - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0103 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_CALLBACK_0103 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_PROMISE_0103 @@ -1480,12 +914,10 @@ export default function cameraSessionFlashTest() { await startCameraSession(i); if ((mHasFlashArray[i] == true) && (mIsFlashModeSupportedArray[i] == true)) { - await mCameraSession.setFlashMode(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); + mCameraSession.setFlashMode(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_PROMISE_0103 finish"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_PROMISE_0103 PASSED with FlashMode is: " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - await sleep(500); - - let flashMode = await mCameraSession.getFlashMode(); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_PROMISE_0103 PASSED with FlashMode is: " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); + let flashMode = mCameraSession.getFlashMode(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_PROMISE_0103 finish"); if (flashMode == cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_PROMISE_0103 PASSED with FlaseMode is: " + flashMode); @@ -1493,8 +925,6 @@ export default function cameraSessionFlashTest() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_PROMISE_0103 FAILED with FlaseMode is: " + flashMode); expect().assertFail(); } - - await sleep(500); } else { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FLASH_MODE_PROMISE_0103 not support"); } diff --git a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionFocusTest.test.ets b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionFocusTest.test.ets index 2accf72e34f13c28b0cd5895f30ecb5e50670425..a044ecfc3e2867672691053596df6ccec8c3a0e4 100644 --- a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionFocusTest.test.ets +++ b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionFocusTest.test.ets @@ -71,12 +71,12 @@ let mVideoConfig = { maxDuration: 500 } -let mPicWidthMax = 8192; -let mPicHeightMax = 8192; +let mPicWidthMax = 1; +let mPicHeightMax = 1; let mFocusPoint = { - x: mPicWidthMax / 2, - y: mPicHeightMax / 2, + x: mPicWidthMax / 2.0, + y: mPicHeightMax / 2.0, } let mFocusPointLT = { @@ -225,10 +225,10 @@ export default function cameraSessionFocusTest() { console.log(TAG + 'Exit releaseVideoReceiveSurface') } - async function getCameraManagerInstance() { + function getCameraManagerInstance() { console.info('Enter getCameraManagerInstance'); - mCameraManager = await cameraObj.getCameraManager(null); + mCameraManager = cameraObj.getCameraManager(null); if (isEmpty(mCameraManager)) { console.info(TAG + "getCameraManager FAILED"); return false; @@ -239,32 +239,17 @@ export default function cameraSessionFocusTest() { return true; } - async function getCameraSupportDevicesArray() { + function getCameraSupportDevicesArray() { console.info('Enter getCameraSupportDevicesArray'); - mCameraDevicesArray = await mCameraManager.getSupportedCameras(); - /* - mCameraManager.getSupportedCameras(async (err, data) => { - console.info(TAG + "Entering getCameraSupportDevicesArray callback"); - if (!err) { - if (data != null || data != undefined) { - mCameraDevicesArray = data; - console.info(TAG + "Entering getCameraSupportDevicesArray PASSED with CameraDevicesArray is: " + data); - } else { - console.info(TAG + "Entering getCameraSupportDevicesArray FAILED with CameraDevicesArray is: " + data); - } - } else { - console.info(TAG + "Entering getCameraSupportDevicesArray FAILED : " + err.message); - } - }) - await sleep(3000); - */ + mCameraDevicesArray = mCameraManager.getSupportedCameras(); + if (isEmpty(mCameraDevicesArray)) { console.info(TAG + "getSupportedCameras FAILED"); return false; } - //mCameraNum = 1; + mCameraNum = mCameraDevicesArray.length; console.info(TAG + "getCameraSupportDevicesArray is: " + mCameraNum); @@ -276,47 +261,11 @@ export default function cameraSessionFocusTest() { return true; } - async function beginCameraSessionConfig() { - console.info('Enter beginCameraSessionConfig'); - - mCameraSession.beginConfig(async (err) => { - if (!err) { - console.info(TAG + "Entering beginConfig PASSED"); - } else { - console.info(TAG + "Entering beginConfig FAILED : " + err.message); - } - }) - - await sleep(30); - - console.info('Exit beginCameraSessionConfig'); - - return true; - } - - async function commitCameraSessionConfig() { - console.info('Enter commitCameraSessionConfig'); - - mCameraSession.commitConfig(async (err, data) => { - if (!err) { - console.info(TAG + "Entering commitConfig PASSED"); - } else { - console.info(TAG + "Entering commitConfig FAILED : " + err.message); - } - }) - - await sleep(500); - - console.info('Exit commitCameraSessionConfig'); - - return true; - } - - async function createCameraSessionInstance() { + function createCameraSessionInstance() { console.info('Enter createCameraSessionInstance'); try { - mCameraSession = await mCameraManager.createCaptureSession(); + mCameraSession = mCameraManager.createCaptureSession(); } catch { console.info('createCaptureSession FAILED'); @@ -327,7 +276,7 @@ export default function cameraSessionFocusTest() { return false; } - await beginCameraSessionConfig(); + mCameraSession.beginConfig(); console.info('Exit createCameraSessionInstance'); @@ -345,28 +294,15 @@ export default function cameraSessionFocusTest() { console.info(TAG + "Entering createInputs FAILED with NoCamera"); return false; } - - mCameraInput = null; - await mCameraManager.createCameraInput(mCameraDevicesArray[idx]).then((result) => { - console.info('createCameraInput success'); - mCameraInput = result; - }).catch((err) => { - console.info('createCameraInput failed, err = ' + err.message); - }); - + + mCameraInput = await mCameraManager.createCameraInput(mCameraDevicesArray[idx]); + if (isEmpty(mCameraInput)) { console.info(TAG + "createCameraInput FAILED"); return false; } - mCameraInput.open(async (err) => { - console.info(TAG + "Entering mCameraInput open callback"); - if (!err) { - console.info(TAG + "Entering mCameraInput open PASSED "); - } else { - console.info(TAG + "Entering mCameraInput open FAILED : " + err.message); - } - }) + await mCameraInput.open(); await sleep(100); @@ -382,7 +318,6 @@ export default function cameraSessionFocusTest() { if (!isEmpty(mCameraInput)) { await mCameraInput.close(); - await mCameraInput.release(); } console.info('Exit releaseInput'); @@ -390,24 +325,16 @@ export default function cameraSessionFocusTest() { return true; } - async function createOutput(idx:any) { + function createOutput(idx:any) { console.info('Enter createOutput'); - let cameraOutputCap = null; - await mCameraManager.getSupportedOutputCapability(mCameraDevicesArray[idx]).then((result) => { - console.info('getSupportedOutputCapability success'); - cameraOutputCap = result; - }).catch((err) => { - console.info('getSupportedOutputCapability failed, err = ' + err.message); - mPreviewOutput = null; - mPhotoOutput = null; - }); + let cameraOutputCap = mCameraManager.getSupportedOutputCapability(mCameraDevicesArray[idx]); if (!isEmpty(cameraOutputCap)) { if (!isEmpty(cameraOutputCap.previewProfiles)) { console.info(TAG + "cameraOutputCap.previewProfiles.length: " + cameraOutputCap.previewProfiles.length); for (let i = 0; i < cameraOutputCap.previewProfiles.length; i++) { - mPreviewOutput = await mCameraManager.createPreviewOutput(cameraOutputCap.previewProfiles[i], globalThis.surfaceId); + mPreviewOutput = mCameraManager.createPreviewOutput(cameraOutputCap.previewProfiles[i], globalThis.surfaceId); if (!isEmpty(mPreviewOutput)) { break; } @@ -424,7 +351,7 @@ export default function cameraSessionFocusTest() { console.info(TAG + "cameraOutputCap.photoProfiles.length: " + cameraOutputCap.photoProfiles.length); for (let i = 0; i < cameraOutputCap.photoProfiles.length; i++) { - mPhotoOutput = await mCameraManager.createPhotoOutput(cameraOutputCap.photoProfiles[i], mPhotoSurface); + mPhotoOutput = mCameraManager.createPhotoOutput(cameraOutputCap.photoProfiles[i], mPhotoSurface); if (!isEmpty(mPhotoOutput)) { break; } @@ -469,7 +396,6 @@ export default function cameraSessionFocusTest() { console.info('Enter releaseOutput'); if (!isEmpty(mPreviewOutput)) { - await mPreviewOutput.stop(); await mPreviewOutput.release(); } @@ -491,23 +417,23 @@ export default function cameraSessionFocusTest() { console.info(TAG + "Enter startCameraSession"); await createInput(idx); - await createOutput(idx); + createOutput(idx); await sleep(1); if (!isEmpty(mCameraInput)) { console.info(TAG + "Start to addInput"); - await mCameraSession.addInput(mCameraInput); + mCameraSession.addInput(mCameraInput); } if (!isEmpty(mPreviewOutput)) { console.info(TAG + "Start to addOutput mPreviewOutput"); - await mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPreviewOutput); } if (!isEmpty(mPhotoOutput)) { console.info(TAG + "Start to addOutput mPhotoOutput"); - await mCameraSession.addOutput(mPhotoOutput); + mCameraSession.addOutput(mPhotoOutput); } /* if (!isEmpty(mVideoOutput)) { @@ -517,8 +443,7 @@ export default function cameraSessionFocusTest() { */ await sleep(1); - await commitCameraSessionConfig(); - await beginCameraSessionConfig(); + await mCameraSession.commitConfig(); /* await mCameraSession.start(async (err) => { @@ -539,6 +464,8 @@ export default function cameraSessionFocusTest() { async function stopCameraSession() { console.info(TAG + "Enter stopCameraSession"); + + mCameraSession.beginConfig(); /* mCameraSession.stop(async (err) => { console.info(TAG + "Entering mCameraSession stop callback"); @@ -554,17 +481,17 @@ export default function cameraSessionFocusTest() { if (!isEmpty(mCameraInput)) { console.info(TAG + "Start to removeInput input"); - await mCameraSession.removeInput(mCameraInput); + mCameraSession.removeInput(mCameraInput); } if (!isEmpty(mPreviewOutput)) { console.info(TAG + "Start to removeOutput mPreviewOutput"); - await mCameraSession.removeOutput(mPreviewOutput); + mCameraSession.removeOutput(mPreviewOutput); } if (!isEmpty(mPhotoOutput)) { console.info(TAG + "Start to removeOutput mPhotoOutput"); - await mCameraSession.removeOutput(mPhotoOutput); + mCameraSession.removeOutput(mPhotoOutput); } /* if (!isEmpty(mVideoOutput)) { @@ -587,9 +514,9 @@ export default function cameraSessionFocusTest() { sleep(100); await getPhotoReceiverSurface(); await getVideoReceiveSurface(); - await getCameraManagerInstance(); - await getCameraSupportDevicesArray(); - await createCameraSessionInstance(); + getCameraManagerInstance(); + getCameraSupportDevicesArray(); + createCameraSessionInstance(); console.info('Device type = ' + deviceInfo.deviceType); @@ -612,55 +539,7 @@ export default function cameraSessionFocusTest() { console.info('afterAll case'); }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0100 - * @tc.name : Check capture session support focus manual mode with callback or not - * @tc.desc : Check capture session support focus manual mode with callback or not - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0100--------------"); - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0100 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0100 start for camera[" + i + "]"); - - await startCameraSession(i); - - mIsFocusModeSupportedArray[i] = false; - - mCameraSession.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_MANUAL, async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0100 callback"); - if (!err) { - if (data != null || data != undefined) { - mIsFocusModeSupportedArray[i] = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0100 PASSED with isFocusModeSupported is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0100 FAILED with isFocusModeSupported is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(100); - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0100 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0100 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_PROMISE_0100 @@ -683,17 +562,14 @@ export default function cameraSessionFocusTest() { await startCameraSession(i); - let isFocusModeSupported = await mCameraSession.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_MANUAL); + let isFocusModeSupported = mCameraSession.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_MANUAL); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_PROMISE_0100 finish"); if (isFocusModeSupported != null || isFocusModeSupported != undefined) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_PROMISE_0100 PASSED with isFocusModeSupported is: " + isFocusModeSupported); } else { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_PROMISE_0100 FAILED with isFocusModeSupported is: " + isFocusModeSupported); expect().assertFail(); - } - - await sleep(100); - + } await stopCameraSession(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_PROMISE_0100 end for camera[" + i + "]"); @@ -704,67 +580,7 @@ export default function cameraSessionFocusTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0100 - * @tc.name : Check capture session set focus manual mode with callback - * @tc.desc : Check capture session set focus manual mode with callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0100--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0100 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0100 start for camera[" + i + "]"); - - await startCameraSession(i); - - if (mIsFocusModeSupportedArray[i] == true) { - mCameraSession.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_MANUAL, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0100 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0100 PASSED with FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - mCameraSession.getFocusMode(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0100 callback"); - if (!err) { - if (data == cameraObj.FocusMode.FOCUS_MODE_MANUAL) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0100 PASSED with FocusMode is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0100 FAILED with FocusMode is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0100 not support"); - } - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0100 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0100 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_PROMISE_0100 @@ -788,12 +604,11 @@ export default function cameraSessionFocusTest() { await startCameraSession(i); if (mIsFocusModeSupportedArray[i] == true) { - await mCameraSession.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_MANUAL); + mCameraSession.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_MANUAL); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_PROMISE_0100 finish"); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_PROMISE_0100 PASSED with FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); - await sleep(500); - let focusMode = await mCameraSession.getFocusMode(); + let focusMode = mCameraSession.getFocusMode(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_PROMISE_0100 finish"); if (focusMode == cameraObj.FocusMode.FOCUS_MODE_MANUAL) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_PROMISE_0100 PASSED with FocusMode is: " + focusMode); @@ -801,7 +616,6 @@ export default function cameraSessionFocusTest() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_PROMISE_0100 FAILED with FocusMode is: " + focusMode); expect().assertFail(); } - await sleep(500); } else { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_PROMISE_0100 not support"); } @@ -816,55 +630,7 @@ export default function cameraSessionFocusTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0101 - * @tc.name : Check capture session support focus continuous auto mode with callback or not - * @tc.desc : Check capture session support focus continuous auto mode with callback or not - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0101', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0101--------------"); - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0101 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0101 start for camera[" + i + "]"); - - await startCameraSession(i); - - mIsFocusModeSupportedArray[i] = false; - - mCameraSession.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO, async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0101 callback"); - if (!err) { - if (data != null || data != undefined) { - mIsFocusModeSupportedArray[i] = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0101 PASSED with isFocusModeSupported is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0101 FAILED with isFocusModeSupported is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0101 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(100); - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0101 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0101 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_PROMISE_0101 @@ -887,16 +653,14 @@ export default function cameraSessionFocusTest() { await startCameraSession(i); - let isFocusModeSupported = await mCameraSession.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); + let isFocusModeSupported = mCameraSession.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_PROMISE_0101 finish"); if (isFocusModeSupported != null || isFocusModeSupported != undefined) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_PROMISE_0101 PASSED with isFocusModeSupported is: " + isFocusModeSupported); } else { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_PROMISE_0101 FAILED with isFocusModeSupported is: " + isFocusModeSupported); expect().assertFail(); - } - - await sleep(100); + } await stopCameraSession(); @@ -908,67 +672,7 @@ export default function cameraSessionFocusTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0101 - * @tc.name : Check capture session set focus continuous auto mode with callback - * @tc.desc : Check capture session set focus continuous auto mode with callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0101', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0101--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0101 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0101 start for camera[" + i + "]"); - - await startCameraSession(i); - - if (mIsFocusModeSupportedArray[i] == true) { - mCameraSession.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0101 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0101 PASSED with FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0101 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - mCameraSession.getFocusMode(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0101 callback"); - if (!err) { - if (data == cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0101 PASSED with FocusMode is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0101 FAILED with FocusMode is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0101 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0101 not support"); - } - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0101 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0101 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_PROMISE_0101 @@ -992,12 +696,11 @@ export default function cameraSessionFocusTest() { await startCameraSession(i); if (mIsFocusModeSupportedArray[i] == true) { - await mCameraSession.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); + mCameraSession.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_PROMISE_0101 finish"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_PROMISE_0101 PASSED with FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - await sleep(500); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_PROMISE_0101 PASSED with FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - let focusMode = await mCameraSession.getFocusMode(); + let focusMode = mCameraSession.getFocusMode(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_PROMISE_0101 finish"); if (focusMode == cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_PROMISE_0101 PASSED with FocusMode is: " + focusMode); @@ -1005,7 +708,6 @@ export default function cameraSessionFocusTest() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_PROMISE_0101 FAILED with FocusMode is: " + focusMode); expect().assertFail(); } - await sleep(500); } else { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_PROMISE_0101 not support"); } @@ -1020,55 +722,7 @@ export default function cameraSessionFocusTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0102 - * @tc.name : Check capture session support focus auto mode with callback or not - * @tc.desc : Check capture session support focus auto mode with callback or not - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0102', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0102--------------"); - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0102 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0102 start for camera[" + i + "]"); - - await startCameraSession(i); - - mIsFocusModeSupportedArray[i] = false; - - mCameraSession.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO, async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0102 callback"); - if (!err) { - if (data != null || data != undefined) { - mIsFocusModeSupportedArray[i] = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0102 PASSED with isFocusModeSupported is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0102 FAILED with isFocusModeSupported is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0102 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(100); - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0102 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0102 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_PROMISE_0102 @@ -1091,7 +745,7 @@ export default function cameraSessionFocusTest() { await startCameraSession(i); - let isFocusModeSupported = await mCameraSession.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO); + let isFocusModeSupported = mCameraSession.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_PROMISE_0102 finish"); if (isFocusModeSupported != null || isFocusModeSupported != undefined) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_PROMISE_0102 PASSED with isFocusModeSupported is: " + isFocusModeSupported); @@ -1112,67 +766,7 @@ export default function cameraSessionFocusTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0102 - * @tc.name : Check capture session set focus auto mode with callback - * @tc.desc : Check capture session set focus auto mode with callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0102', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0102--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0102 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0102 start for camera[" + i + "]"); - - await startCameraSession(i); - - if (mIsFocusModeSupportedArray[i] == true) { - mCameraSession.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0102 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0102 PASSED with FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_AUTO); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0102 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - mCameraSession.getFocusMode(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0102 callback"); - if (!err) { - if (data == cameraObj.FocusMode.FOCUS_MODE_AUTO) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0102 PASSED with FocusMode is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0102 FAILED with FocusMode is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0102 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0102 not support"); - } - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0102 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0102 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_PROMISE_0102 @@ -1196,12 +790,11 @@ export default function cameraSessionFocusTest() { await startCameraSession(i); if (mIsFocusModeSupportedArray[i] == true) { - await mCameraSession.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO); + mCameraSession.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_PROMISE_0102 finish"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_PROMISE_0102 PASSED with FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_AUTO); - await sleep(500); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_PROMISE_0102 PASSED with FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_AUTO); - let focusMode = await mCameraSession.getFocusMode(); + let focusMode = mCameraSession.getFocusMode(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_PROMISE_0102 finish"); if (focusMode == cameraObj.FocusMode.FOCUS_MODE_AUTO) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_PROMISE_0102 PASSED with FocusMode is: " + focusMode); @@ -1209,7 +802,6 @@ export default function cameraSessionFocusTest() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_PROMISE_0102 FAILED with FocusMode is: " + focusMode); expect().assertFail(); } - await sleep(500); } else { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_PROMISE_0102 not support"); } @@ -1224,91 +816,41 @@ export default function cameraSessionFocusTest() { } }) + + /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0103 - * @tc.name : Check capture session support focus locked mode with callback or not - * @tc.desc : Check capture session support focus locked mode with callback or not + * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_PROMISE_0103 + * @tc.name : Check capture session support focus locked mode with promise or not + * @tc.desc : Check capture session support focus locked mode with promise or not * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 2 */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0103', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0103--------------"); + it('SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_PROMISE_0103', 2, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_PROMISE_0103--------------"); if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0103 FAILED with NoCamera"); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_PROMISE_0103 FAILED with NoCamera"); expect().assertFail(); done(); } else { for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0103 start for camera[" + i + "]"); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_PROMISE_0103 start for camera[" + i + "]"); await startCameraSession(i); - mIsFocusModeSupportedArray[i] = false; - - mCameraSession.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_LOCKED, async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0103 callback"); - if (!err) { - if (data != null || data != undefined) { - mIsFocusModeSupportedArray[i] = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0103 PASSED with isFocusModeSupported is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0103 FAILED with isFocusModeSupported is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0103 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(100); + let isFocusModeSupported = mCameraSession.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_LOCKED); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_PROMISE_0103 finish"); + if (isFocusModeSupported != null || isFocusModeSupported != undefined) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_PROMISE_0103 PASSED with isFocusModeSupported is: " + isFocusModeSupported); + } else { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_PROMISE_0103 FAILED with isFocusModeSupported is: " + isFocusModeSupported); + expect().assertFail(); + } await stopCameraSession(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0103 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_CALLBACK_0103 ends here"); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_PROMISE_0103 - * @tc.name : Check capture session support focus locked mode with promise or not - * @tc.desc : Check capture session support focus locked mode with promise or not - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_PROMISE_0103', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_PROMISE_0103--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_PROMISE_0103 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_PROMISE_0103 start for camera[" + i + "]"); - - await startCameraSession(i); - - let isFocusModeSupported = await mCameraSession.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_LOCKED); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_PROMISE_0103 finish"); - if (isFocusModeSupported != null || isFocusModeSupported != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_PROMISE_0103 PASSED with isFocusModeSupported is: " + isFocusModeSupported); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_PROMISE_0103 FAILED with isFocusModeSupported is: " + isFocusModeSupported); - expect().assertFail(); - } - - await sleep(100); - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_PROMISE_0103 end for camera[" + i + "]"); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_PROMISE_0103 end for camera[" + i + "]"); } console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FOCUS_MODE_SUPPORT_PROMISE_0103 ends here"); @@ -1316,67 +858,7 @@ export default function cameraSessionFocusTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0103 - * @tc.name : Check capture session set focus locked mode with callback - * @tc.desc : Check capture session set focus locked mode with callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0103', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0103--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0103 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0103 start for camera[" + i + "]"); - - await startCameraSession(i); - - if (mIsFocusModeSupportedArray[i] == true) { - mCameraSession.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_LOCKED, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0103 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0103 PASSED with FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_LOCKED); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0103 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - mCameraSession.getFocusMode(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0103 callback"); - if (!err) { - if (data == cameraObj.FocusMode.FOCUS_MODE_LOCKED) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0103 PASSED with FocusMode is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0103 FAILED with FocusMode is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0103 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0103 not support"); - } - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0103 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_CALLBACK_0103 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_PROMISE_0103 @@ -1400,12 +882,11 @@ export default function cameraSessionFocusTest() { await startCameraSession(i); if (mIsFocusModeSupportedArray[i] == true) { - await mCameraSession.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_LOCKED); + mCameraSession.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_LOCKED); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_PROMISE_0103 finish"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_PROMISE_0103 PASSED with FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_LOCKED); - await sleep(500); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_PROMISE_0103 PASSED with FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_LOCKED); - let focusMode = await mCameraSession.getFocusMode(); + let focusMode = mCameraSession.getFocusMode(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_PROMISE_0103 finish"); if (focusMode == cameraObj.FocusMode.FOCUS_MODE_LOCKED) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_PROMISE_0103 PASSED with FocusMode is: " + focusMode); @@ -1413,7 +894,6 @@ export default function cameraSessionFocusTest() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_PROMISE_0103 FAILED with FocusMode is: " + focusMode); expect().assertFail(); } - await sleep(100); } else { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_PROMISE_0103 not support"); } @@ -1428,63 +908,7 @@ export default function cameraSessionFocusTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0100 - * @tc.name : Check capture session set focus point with callback - * @tc.desc : Check capture session set focus point with callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0100--------------"); - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0100 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0100 start for camera[" + i + "]"); - - await startCameraSession(i); - - mCameraSession.setFocusPoint(mFocusPoint, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0100 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0100 PASSED with FocusPoint is: " + mFocusPoint.x + ", " + mFocusPoint.y); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - mCameraSession.getFocusPoint(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0100 callback"); - if (!err) { - if ((data.x == mFocusPoint.x) && (data.y == mFocusPoint.y)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0100 PASSED with FocusPoint is: " + data.x + ", " + data.y); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0100 FAILED with FocusPoint is: " + data.x + ", " + data.y); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0100 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0100 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0100 @@ -1507,12 +931,11 @@ export default function cameraSessionFocusTest() { await startCameraSession(i); - await mCameraSession.setFocusPoint(mFocusPoint); + mCameraSession.setFocusPoint(mFocusPoint); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0100 finish"); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0100 PASSED with FocusPoint is: " + mFocusPoint.x + ", " + mFocusPoint.y); - await sleep(500); - let focusPoint = await mCameraSession.getFocusPoint(); + let focusPoint = mCameraSession.getFocusPoint(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0100 finish"); if ((focusPoint.x == mFocusPoint.x) && (focusPoint.y == mFocusPoint.y)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0100 PASSED with FocusPoint is: " + focusPoint.x + ", " + focusPoint.y); @@ -1520,7 +943,6 @@ export default function cameraSessionFocusTest() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0100 FAILED with FocusPoint is: " + focusPoint.x + ", " + focusPoint.y); expect().assertFail(); } - await sleep(500); await stopCameraSession(); @@ -1532,63 +954,7 @@ export default function cameraSessionFocusTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0101 - * @tc.name : Check capture session set focus point with callback(left-top point) - * @tc.desc : Check capture session set focus point with callback(left-top point) - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0101', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0101--------------"); - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0101 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0101 start for camera[" + i + "]"); - - await startCameraSession(i); - - mCameraSession.setFocusPoint(mFocusPointLT, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0101 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0101 PASSED with FocusPoint is: " + mFocusPointLT.x + ", " + mFocusPointLT.y); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0101 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - mCameraSession.getFocusPoint(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0101 callback"); - if (!err) { - if ((data.x == mFocusPointLT.x) && (data.y == mFocusPointLT.y)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0101 PASSED with FocusPoint is: " + data.x + ", " + data.y); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0101 FAILED with FocusPoint is: " + data.x + ", " + data.y); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0101 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0101 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0101 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0101 @@ -1611,12 +977,11 @@ export default function cameraSessionFocusTest() { await startCameraSession(i); - await mCameraSession.setFocusPoint(mFocusPointLT); + mCameraSession.setFocusPoint(mFocusPointLT); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0101 finish"); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0101 PASSED with FocusPoint is: " + mFocusPointLT.x + ", " + mFocusPointLT.y); - await sleep(500); - let focusPoint = await mCameraSession.getFocusPoint(); + let focusPoint = mCameraSession.getFocusPoint(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0101 finish"); if ((focusPoint.x == mFocusPointLT.x) && (focusPoint.y == mFocusPointLT.y)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0101 PASSED with FocusPoint is: " + focusPoint.x + ", " + focusPoint.y); @@ -1624,7 +989,6 @@ export default function cameraSessionFocusTest() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0101 FAILED with FocusPoint is: " + focusPoint.x + ", " + focusPoint.y); expect().assertFail(); } - await sleep(500); await stopCameraSession(); @@ -1636,63 +1000,7 @@ export default function cameraSessionFocusTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0102 - * @tc.name : Check capture session set focus point with callback(right-top point) - * @tc.desc : Check capture session set focus point with callback(right-top point) - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0102', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0102--------------"); - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0102 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0102 start for camera[" + i + "]"); - - await startCameraSession(i); - - mCameraSession.setFocusPoint(mFocusPointRT, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0102 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0102 PASSED with FocusPoint is: " + mFocusPointRT.x + ", " + mFocusPointRT.y); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0102 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - mCameraSession.getFocusPoint(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0102 callback"); - if (!err) { - if ((data.x == mFocusPointRT.x) && (data.y == mFocusPointRT.y)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0102 PASSED with FocusPoint is: " + data.x + ", " + data.y); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0102 FAILED with FocusPoint is: " + data.x + ", " + data.y); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0102 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0102 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0102 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0102 @@ -1715,12 +1023,11 @@ export default function cameraSessionFocusTest() { await startCameraSession(i); - await mCameraSession.setFocusPoint(mFocusPointRT); + mCameraSession.setFocusPoint(mFocusPointRT); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0102 finish"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0102 PASSED with FocusPoint is: " + mFocusPointRT.x + ", " + mFocusPointRT.y); - await sleep(500); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0102 PASSED with FocusPoint is: " + mFocusPointRT.x + ", " + mFocusPointRT.y); - let focusPoint = await mCameraSession.getFocusPoint(); + let focusPoint = mCameraSession.getFocusPoint(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0102 finish"); if ((focusPoint.x == mFocusPointRT.x) && (focusPoint.y == mFocusPointRT.y)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0102 PASSED with FocusPoint is: " + focusPoint.x + ", " + focusPoint.y); @@ -1728,7 +1035,6 @@ export default function cameraSessionFocusTest() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0102 FAILED with FocusPoint is: " + focusPoint.x + ", " + focusPoint.y); expect().assertFail(); } - await sleep(500); await stopCameraSession(); @@ -1740,63 +1046,7 @@ export default function cameraSessionFocusTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0103 - * @tc.name : Check capture session set focus point with callback(left-bottom point) - * @tc.desc : Check capture session set focus point with callback(left-bottom point) - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0103', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0103--------------"); - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0103 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0103 start for camera[" + i + "]"); - - await startCameraSession(i); - - mCameraSession.setFocusPoint(mFocusPointLB, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0103 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0103 PASSED with FocusPoint is: " + mFocusPointLB.x + ", " + mFocusPointLB.y); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0103 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - mCameraSession.getFocusPoint(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0103 callback"); - if (!err) { - if ((data.x == mFocusPointLB.x) && (data.y == mFocusPointLB.y)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0103 PASSED with FocusPoint is: " + data.x + ", " + data.y); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0103 FAILED with FocusPoint is: " + data.x + ", " + data.y); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0103 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0103 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0103 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0103 @@ -1819,12 +1069,11 @@ export default function cameraSessionFocusTest() { await startCameraSession(i); - await mCameraSession.setFocusPoint(mFocusPointLB); + mCameraSession.setFocusPoint(mFocusPointLB); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0103 finish"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0103 PASSED with FocusPoint is: " + mFocusPointLB.x + ", " + mFocusPointLB.y); - await sleep(500); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0103 PASSED with FocusPoint is: " + mFocusPointLB.x + ", " + mFocusPointLB.y); - let focusPoint = await mCameraSession.getFocusPoint(); + let focusPoint = mCameraSession.getFocusPoint(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0103 finish"); if ((focusPoint.x == mFocusPointLB.x) && (focusPoint.y == mFocusPointLB.y)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0103 PASSED with FocusPoint is: " + focusPoint.x + ", " + focusPoint.y); @@ -1832,7 +1081,6 @@ export default function cameraSessionFocusTest() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0103 FAILED with FocusPoint is: " + focusPoint.x + ", " + focusPoint.y); expect().assertFail(); } - await sleep(500); await stopCameraSession(); @@ -1844,63 +1092,7 @@ export default function cameraSessionFocusTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0104 - * @tc.name : Check capture session set focus point with callback(right-bottom point) - * @tc.desc : Check capture session set focus point with callback(right-bottom point) - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0104', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0104--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0104 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0104 start for camera[" + i + "]"); - - await startCameraSession(i); - - mCameraSession.setFocusPoint(mFocusPointRB, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0104 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0104 PASSED with FocusPoint is: " + mFocusPointRB.x + ", " + mFocusPointRB.y); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0104 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - mCameraSession.getFocusPoint(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0104 callback"); - if (!err) { - if ((data.x == mFocusPointRB.x) && (data.y == mFocusPointRB.y)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0104 PASSED with FocusPoint is: " + data.x + ", " + data.y); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0104 FAILED with FocusPoint is: " + data.x + ", " + data.y); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0104 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0104 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0104 ends here"); - done(); - } - }) + /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0104 @@ -1923,12 +1115,11 @@ export default function cameraSessionFocusTest() { await startCameraSession(i); - await mCameraSession.setFocusPoint(mFocusPointRB); + mCameraSession.setFocusPoint(mFocusPointRB); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0104 finish"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0104 PASSED with FocusPoint is: " + mFocusPointRB.x + ", " + mFocusPointRB.y); - await sleep(500); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0104 PASSED with FocusPoint is: " + mFocusPointRB.x + ", " + mFocusPointRB.y); - let focusPoint = await mCameraSession.getFocusPoint(); + let focusPoint = mCameraSession.getFocusPoint(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0104 finish"); if ((focusPoint.x == mFocusPointRB.x) && (focusPoint.y == mFocusPointRB.y)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0104 PASSED with FocusPoint is: " + focusPoint.x + ", " + focusPoint.y); @@ -1936,7 +1127,6 @@ export default function cameraSessionFocusTest() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0104 FAILED with FocusPoint is: " + focusPoint.x + ", " + focusPoint.y); expect().assertFail(); } - await sleep(500); await stopCameraSession(); @@ -1948,63 +1138,7 @@ export default function cameraSessionFocusTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0105 - * @tc.name : Check capture session set focus point with callback(left-top invalid point) - * @tc.desc : Check capture session set focus point with callback(left-top invalid point) - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0105', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0105--------------"); - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0105 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0105 start for camera[" + i + "]"); - - await startCameraSession(i); - - mCameraSession.setFocusPoint(mFocusPointInvalidLT, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0105 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0105 PASSED with FocusPoint is: " + mFocusPointInvalidLT.x + ", " + mFocusPointInvalidLT.y); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0105 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - mCameraSession.getFocusPoint(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0105 callback"); - if (!err) { - if (((data.x != mFocusPointInvalidLT.x) && (data.y != mFocusPointInvalidLT.y)) || (mEnableCheckInvalidFocusPoint == false)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0105 PASSED with FocusPoint is: " + data.x + ", " + data.y); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0105 FAILED with FocusPoint is: " + data.x + ", " + data.y); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0105 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0105 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0105 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0105 @@ -2027,12 +1161,11 @@ export default function cameraSessionFocusTest() { await startCameraSession(i); - await mCameraSession.setFocusPoint(mFocusPointInvalidLT); + mCameraSession.setFocusPoint(mFocusPointInvalidLT); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0105 finish"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0105 PASSED with FocusPoint is: " + mFocusPointInvalidLT.x + ", " + mFocusPointInvalidLT.y); - await sleep(500); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0105 PASSED with FocusPoint is: " + mFocusPointInvalidLT.x + ", " + mFocusPointInvalidLT.y); - let focusPoint = await mCameraSession.getFocusPoint(); + let focusPoint = mCameraSession.getFocusPoint(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0105 finish"); if (((focusPoint.x != mFocusPointInvalidLT.x) && (focusPoint.y != mFocusPointInvalidLT.y)) || (mEnableCheckInvalidFocusPoint == false)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0105 PASSED with FocusPoint is: " + focusPoint.x + ", " + focusPoint.y); @@ -2040,7 +1173,6 @@ export default function cameraSessionFocusTest() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0105 FAILED with FocusPoint is: " + focusPoint.x + ", " + focusPoint.y); expect().assertFail(); } - await sleep(500); await stopCameraSession(); @@ -2052,63 +1184,6 @@ export default function cameraSessionFocusTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0106 - * @tc.name : Check capture session set focus point with callback(right-top invalid point) - * @tc.desc : Check capture session set focus point with callback(right-top invalid point) - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0106', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0106--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0106 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0106 start for camera[" + i + "]"); - - await startCameraSession(i); - - mCameraSession.setFocusPoint(mFocusPointInvalidRT, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0106 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0106 PASSED with FocusPoint is: " + mFocusPointInvalidRT.x + ", " + mFocusPointInvalidRT.y); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0106 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - mCameraSession.getFocusPoint(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0106 callback"); - if (!err) { - if (((data.x != mFocusPointInvalidRT.x) && (data.y != mFocusPointInvalidRT.y)) || (mEnableCheckInvalidFocusPoint == false)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0106 PASSED with FocusPoint is: " + data.x + ", " + data.y); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0106 FAILED with FocusPoint is: " + data.x + ", " + data.y); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0106 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0106 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0106 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0106 @@ -2131,12 +1206,11 @@ export default function cameraSessionFocusTest() { await startCameraSession(i); - await mCameraSession.setFocusPoint(mFocusPointInvalidRT); + mCameraSession.setFocusPoint(mFocusPointInvalidRT); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0106 finish"); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0106 PASSED with FocusPoint is: " + mFocusPointInvalidRT.x + ", " + mFocusPointInvalidRT.y); - await sleep(500); - let focusPoint = await mCameraSession.getFocusPoint(); + let focusPoint = mCameraSession.getFocusPoint(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0106 finish"); if (((focusPoint.x != mFocusPointInvalidRT.x) && (focusPoint.y != mFocusPointInvalidRT.y)) || (mEnableCheckInvalidFocusPoint == false)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0106 PASSED with FocusPoint is: " + focusPoint.x + ", " + focusPoint.y); @@ -2144,7 +1218,6 @@ export default function cameraSessionFocusTest() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0106 FAILED with FocusPoint is: " + focusPoint.x + ", " + focusPoint.y); expect().assertFail(); } - await sleep(500); await stopCameraSession(); @@ -2156,63 +1229,7 @@ export default function cameraSessionFocusTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0107 - * @tc.name : Check capture session set focus point with callback(left-bottom invalid point) - * @tc.desc : Check capture session set focus point with callback(left-bottom invalid point) - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0107', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0107--------------"); - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0107 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0107 start for camera[" + i + "]"); - - await startCameraSession(i); - - mCameraSession.setFocusPoint(mFocusPointInvalidLB, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0107 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0107 PASSED with FocusPoint is: " + mFocusPointInvalidLB.x + ", " + mFocusPointInvalidLB.y); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0107 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - mCameraSession.getFocusPoint(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0107 callback"); - if (!err) { - if (((data.x != mFocusPointInvalidLB.x) && (data.y != mFocusPointInvalidLB.y)) || (mEnableCheckInvalidFocusPoint == false)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0107 PASSED with FocusPoint is: " + data.x + ", " + data.y); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0107 FAILED with FocusPoint is: " + data.x + ", " + data.y); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0107 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0107 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0107 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0107 @@ -2235,12 +1252,11 @@ export default function cameraSessionFocusTest() { await startCameraSession(i); - await mCameraSession.setFocusPoint(mFocusPointInvalidLB); + mCameraSession.setFocusPoint(mFocusPointInvalidLB); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0107 finish"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0107 PASSED with FocusPoint is: " + mFocusPointInvalidLB.x + ", " + mFocusPointInvalidLB.y); - await sleep(500); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0107 PASSED with FocusPoint is: " + mFocusPointInvalidLB.x + ", " + mFocusPointInvalidLB.y); - let focusPoint = await mCameraSession.getFocusPoint(); + let focusPoint = mCameraSession.getFocusPoint(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0107 finish"); if (((focusPoint.x != mFocusPointInvalidLB.x) && (focusPoint.y != mFocusPointInvalidLB.y)) || (mEnableCheckInvalidFocusPoint == false)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0107 PASSED with FocusPoint is: " + focusPoint.x + ", " + focusPoint.y); @@ -2248,7 +1264,6 @@ export default function cameraSessionFocusTest() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0107 FAILED with FocusPoint is: " + focusPoint.x + ", " + focusPoint.y); expect().assertFail(); } - await sleep(500); await stopCameraSession(); @@ -2260,63 +1275,7 @@ export default function cameraSessionFocusTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0108 - * @tc.name : Check capture session set focus point with callback(right-bottom invalid point) - * @tc.desc : Check capture session set focus point with callback(right-bottom invalid point) - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0108', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0108--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0108 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0108 start for camera[" + i + "]"); - - await startCameraSession(i); - - mCameraSession.setFocusPoint(mFocusPointInvalidRB, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0108 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0108 PASSED with FocusPoint is: " + mFocusPointInvalidRB.x + ", " + mFocusPointInvalidRB.y); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0108 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - mCameraSession.getFocusPoint(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0108 callback"); - if (!err) { - if (((data.x != mFocusPointInvalidRB.x) && (data.y != mFocusPointInvalidRB.y)) || (mEnableCheckInvalidFocusPoint == false)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0108 PASSED with FocusPoint is: " + data.x + ", " + data.y); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0108 FAILED with FocusPoint is: " + data.x + ", " + data.y); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0108 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0108 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_CALLBACK_0108 ends here"); - done(); - } - }) + /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0108 @@ -2339,12 +1298,11 @@ export default function cameraSessionFocusTest() { await startCameraSession(i); - await mCameraSession.setFocusPoint(mFocusPointInvalidRB); + mCameraSession.setFocusPoint(mFocusPointInvalidRB); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0108 finish"); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0108 PASSED with FocusPoint is: " + mFocusPointInvalidRB.x + ", " + mFocusPointInvalidRB.y); - await sleep(500); - let focusPoint = await mCameraSession.getFocusPoint(); + let focusPoint = mCameraSession.getFocusPoint(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0108 finish"); if (((focusPoint.x != mFocusPointInvalidRB.x) && (focusPoint.y != mFocusPointInvalidRB.y)) || (mEnableCheckInvalidFocusPoint == false)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0108 PASSED with FocusPoint is: " + focusPoint.x + ", " + focusPoint.y); @@ -2352,7 +1310,6 @@ export default function cameraSessionFocusTest() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_POINT_PROMISE_0108 FAILED with FocusPoint is: " + focusPoint.x + ", " + focusPoint.y); expect().assertFail(); } - await sleep(500); await stopCameraSession(); @@ -2364,47 +1321,7 @@ export default function cameraSessionFocusTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_GET_FOCAL_LENGTH_CALLBACK_0100 - * @tc.name : Check capture session get focal length with callback - * @tc.desc : Check capture session get focal length with callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_GET_FOCAL_LENGTH_CALLBACK_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_GET_FOCAL_LENGTH_CALLBACK_0100--------------"); - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_GET_FOCAL_LENGTH_CALLBACK_0100 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_GET_FOCAL_LENGTH_CALLBACK_0100 start for camera[" + i + "]"); - - await startCameraSession(i); - - mCameraSession.getFocalLength(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_GET_FOCAL_LENGTH_CALLBACK_0100 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_GET_FOCAL_LENGTH_CALLBACK_0100 PASSED with FocalLength is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_GET_FOCAL_LENGTH_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(100); - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_GET_FOCAL_LENGTH_CALLBACK_0100 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_GET_FOCAL_LENGTH_CALLBACK_0100 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_GET_FOCAL_LENGTH_PROMISE_0100 @@ -2427,11 +1344,9 @@ export default function cameraSessionFocusTest() { await startCameraSession(i); - let focalLength = await mCameraSession.getFocalLength(); + let focalLength = mCameraSession.getFocalLength(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_GET_FOCAL_LENGTH_PROMISE_0100 finish"); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_GET_FOCAL_LENGTH_PROMISE_0100 PASSED with FocalLength is: " + focalLength); - - await sleep(100); await stopCameraSession(); @@ -2441,7 +1356,71 @@ export default function cameraSessionFocusTest() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_GET_FOCAL_LENGTH_PROMISE_0100 ends here"); done(); } - }) + }) + + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_ON_FOCUSSTATECHANGE_0100 + * @tc.name : camera session focusstatechange api + * @tc.desc : camera session focusstatechange api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_CAMERA_ON_FOCUSSTATECHANGE_0100', 1, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_ON_FOCUSSTATECHANGE_0100--------------"); + if (isEmpty(mCameraSession)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ON_FOCUSSTATECHANGE_0100 mCameraSession == null || undefined") + expect().assertFail(); + } else { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ON_FOCUSSTATECHANGE_0100 to operate"); + mCameraSession.on('focusStateChange', async (err, data) => { + if (!err) { + expect(true).assertTrue(); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ON_FOCUSSTATECHANGE_0100 success"); + } else { + expect().assertFail(); + console.info(TAG + "Error in SUB_MULTIMEDIA_CAMERA_ON_FOCUSSTATECHANGE_0100 FAILED: " + err.message); + } + await sleep(1000); + done(); + }) + } + await sleep(1000); + done(); + }) + + + /** + * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_SESSION_ON_ERROR_0100 + * @tc.name : camera session callback on error + * @tc.desc : camera session callback on error + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_CAMERA_CAMERA_SESSION_ON_ERROR_0100', 1, async function (done) { + console.info("--------------SUB_MULTIMEDIA_CAMERA_CAMERA_SESSION_ON_ERROR_0100--------------"); + if (isEmpty(mCameraSession)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_SESSION_ON_ERROR_0100 previewOutput == null || undefined") + expect().assertFail(); + } else { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_SESSION_ON_ERROR_0100 to operate"); + mCameraSession.on('error', async (err, data) => { + if (!err) { + expect(true).assertTrue(); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_SESSION_ON_ERROR_0100 success"); + } else { + expect().assertFail(); + console.info(TAG + "Error in SUB_MULTIMEDIA_CAMERA_CAMERA_SESSION_ON_ERROR_0100 FAILED: " + err.message); + } + await sleep(1000); + done(); + }) + } + await sleep(1000); + done(); + }) }) } \ No newline at end of file diff --git a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionVideoStabilizationTest.test.ets b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionVideoStabilizationTest.test.ets index 89b9c06831e393572cbacb7c88207a406cfa1b3f..ffff459a779b59b62632362f89080b32713bc572 100644 --- a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionVideoStabilizationTest.test.ets +++ b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionVideoStabilizationTest.test.ets @@ -178,10 +178,10 @@ export default function cameraSessionVideoStabilizationTest() { console.log(TAG + 'Exit releaseVideoReceiveSurface') } - async function getCameraManagerInstance() { + function getCameraManagerInstance() { console.info('Enter getCameraManagerInstance'); - mCameraManager = await cameraObj.getCameraManager(null); + mCameraManager = cameraObj.getCameraManager(null); if (isEmpty(mCameraManager)) { console.info(TAG + "getCameraManager FAILED"); return false; @@ -192,10 +192,10 @@ export default function cameraSessionVideoStabilizationTest() { return true; } - async function getCameraSupportDevicesArray() { + function getCameraSupportDevicesArray() { console.info('Enter getCameraSupportDevicesArray'); - mCameraDevicesArray = await mCameraManager.getSupportedCameras(); + mCameraDevicesArray = mCameraManager.getSupportedCameras(); /* mCameraManager.getSupportedCameras(async (err, data) => { console.info(TAG + "Entering getCameraSupportDevicesArray callback"); @@ -229,47 +229,11 @@ export default function cameraSessionVideoStabilizationTest() { return true; } - async function beginCameraSessionConfig() { - console.info('Enter beginCameraSessionConfig'); - - mCameraSession.beginConfig(async (err) => { - if (!err) { - console.info(TAG + "Entering beginConfig PASSED"); - } else { - console.info(TAG + "Entering beginConfig FAILED : " + err.message); - } - }) - - await sleep(30); - - console.info('Exit beginCameraSessionConfig'); - - return true; - } - - async function commitCameraSessionConfig() { - console.info('Enter commitCameraSessionConfig'); - - mCameraSession.commitConfig(async (err) => { - if (!err) { - console.info(TAG + "Entering commitConfig PASSED"); - } else { - console.info(TAG + "Entering commitConfig FAILED : " + err.message); - } - }) - - await sleep(500); - - console.info('Exit commitCameraSessionConfig'); - - return true; - } - - async function createCameraSessionInstance() { + function createCameraSessionInstance() { console.info('Enter createCameraSessionInstance'); try { - mCameraSession = await mCameraManager.createCaptureSession(); + mCameraSession = mCameraManager.createCaptureSession(); } catch { console.info('createCaptureSession FAILED'); @@ -280,7 +244,7 @@ export default function cameraSessionVideoStabilizationTest() { return false; } - await beginCameraSessionConfig(); + mCameraSession.beginConfig(); console.info('Exit createCameraSessionInstance'); @@ -299,27 +263,14 @@ export default function cameraSessionVideoStabilizationTest() { return false; } - mCameraInput = null; - await mCameraManager.createCameraInput(mCameraDevicesArray[idx]).then((result) => { - console.info('createCameraInput success'); - mCameraInput = result; - }).catch((err) => { - console.info('createCameraInput failed, err = ' + err.message); - }); + mCameraInput = mCameraManager.createCameraInput(mCameraDevicesArray[idx]); if (isEmpty(mCameraInput)) { console.info(TAG + "createCameraInput FAILED"); return false; } - mCameraInput.open(async (err) => { - console.info(TAG + "Entering mCameraInput open callback"); - if (!err) { - console.info(TAG + "Entering mCameraInput open PASSED "); - } else { - console.info(TAG + "Entering mCameraInput open FAILED : " + err.message); - } - }) + await mCameraInput.open(); await sleep(100); @@ -335,7 +286,6 @@ export default function cameraSessionVideoStabilizationTest() { if (!isEmpty(mCameraInput)) { await mCameraInput.close(); - await mCameraInput.release(); } console.info('Exit releaseInput'); @@ -343,24 +293,16 @@ export default function cameraSessionVideoStabilizationTest() { return true; } - async function createOutput(idx:any) { + function createOutput(idx:any) { console.info('Enter createOutput'); - let cameraOutputCap = null; - await mCameraManager.getSupportedOutputCapability(mCameraDevicesArray[idx]).then((result) => { - console.info('getSupportedOutputCapability success'); - cameraOutputCap = result; - }).catch((err) => { - console.info('getSupportedOutputCapability failed, err = ' + err.message); - mPreviewOutput = null; - mPhotoOutput = null; - }); + let cameraOutputCap = mCameraManager.getSupportedOutputCapability(mCameraDevicesArray[idx]); if (!isEmpty(cameraOutputCap)) { if (!isEmpty(cameraOutputCap.previewProfiles)) { console.info(TAG + "cameraOutputCap.previewProfiles.length: " + cameraOutputCap.previewProfiles.length); for (let i = 0; i < cameraOutputCap.previewProfiles.length; i++) { - mPreviewOutput = await mCameraManager.createPreviewOutput(cameraOutputCap.previewProfiles[i], globalThis.surfaceId); + mPreviewOutput = mCameraManager.createPreviewOutput(cameraOutputCap.previewProfiles[i], globalThis.surfaceId); if (!isEmpty(mPreviewOutput)) { break; } @@ -377,7 +319,7 @@ export default function cameraSessionVideoStabilizationTest() { console.info(TAG + "cameraOutputCap.photoProfiles.length: " + cameraOutputCap.photoProfiles.length); for (let i = 0; i < cameraOutputCap.photoProfiles.length; i++) { - mPhotoOutput = await mCameraManager.createPhotoOutput(cameraOutputCap.photoProfiles[i], mPhotoSurface); + mPhotoOutput = mCameraManager.createPhotoOutput(cameraOutputCap.photoProfiles[i], mPhotoSurface); if (!isEmpty(mPhotoOutput)) { break; } @@ -386,7 +328,7 @@ export default function cameraSessionVideoStabilizationTest() { if (isEmpty(mPhotoOutput)) { console.info(TAG + "createPhotoOutput FAILED"); } - + console.info(TAG + "createPhotoOutput: " + mPhotoOutput); } /* @@ -422,7 +364,6 @@ export default function cameraSessionVideoStabilizationTest() { console.info('Enter releaseOutput'); if (!isEmpty(mPreviewOutput)) { - await mPreviewOutput.stop(); await mPreviewOutput.release(); } @@ -444,23 +385,23 @@ export default function cameraSessionVideoStabilizationTest() { console.info(TAG + "Enter startCameraSession"); await createInput(idx); - await createOutput(idx); + createOutput(idx); await sleep(1); if (!isEmpty(mCameraInput)) { console.info(TAG + "Start to addInput"); - await mCameraSession.addInput(mCameraInput); + mCameraSession.addInput(mCameraInput); } if (!isEmpty(mPreviewOutput)) { console.info(TAG + "Start to addOutput mPreviewOutput"); - await mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPreviewOutput); } if (!isEmpty(mPhotoOutput)) { console.info(TAG + "Start to addOutput mPhotoOutput"); - await mCameraSession.addOutput(mPhotoOutput); + mCameraSession.addOutput(mPhotoOutput); } /* if (!isEmpty(mVideoOutput)) { @@ -470,8 +411,7 @@ export default function cameraSessionVideoStabilizationTest() { */ await sleep(1); - await commitCameraSessionConfig(); - await beginCameraSessionConfig(); + await mCameraSession.commitConfig(); /* await mCameraSession.start(async (err) => { @@ -492,6 +432,8 @@ export default function cameraSessionVideoStabilizationTest() { async function stopCameraSession() { console.info(TAG + "Enter stopCameraSession"); + + mCameraSession.beginConfig(); /* mCameraSession.stop(async (err) => { console.info(TAG + "Entering mCameraSession stop callback"); @@ -540,9 +482,9 @@ export default function cameraSessionVideoStabilizationTest() { sleep(100); await getPhotoReceiverSurface(); await getVideoReceiveSurface(); - await getCameraManagerInstance(); - await getCameraSupportDevicesArray(); - await createCameraSessionInstance(); + getCameraManagerInstance(); + getCameraSupportDevicesArray(); + createCameraSessionInstance(); console.info('Device type = ' + deviceInfo.deviceType); @@ -565,55 +507,7 @@ export default function cameraSessionVideoStabilizationTest() { console.info('afterAll case'); }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0100 - * @tc.name : Check capture session support video stabilization off mode with callback or not - * @tc.desc : Check capture session support video stabilization off mode with callback or not - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0100--------------"); - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUmCameraNumPPORT_CALLBACK_0100 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0100 start for camera[" + i + "]"); - - await startCameraSession(i); - - mIsVideoStabilizationModeSupportedArray[i] = false; - - mCameraSession.isVideoStabilizationModeSupported(cameraObj.VideoStabilizationMode.OFF, async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0100 callback"); - if (!err) { - if (data != null || data != undefined) { - mIsVideoStabilizationModeSupportedArray[i] = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0100 PASSED with isVideoStabilizationModeSupported is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0100 FAILED with isVideoStabilizationModeSupported is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(100); - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0100 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0100 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_PROMISE_0100 @@ -636,16 +530,14 @@ export default function cameraSessionVideoStabilizationTest() { await startCameraSession(i); - let isVideoStabilizationModeSupported = await mCameraSession.isVideoStabilizationModeSupported(cameraObj.VideoStabilizationMode.OFF); + let isVideoStabilizationModeSupported = mCameraSession.isVideoStabilizationModeSupported(cameraObj.VideoStabilizationMode.OFF); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_PROMISE_0100 finish"); if (isVideoStabilizationModeSupported != null || isVideoStabilizationModeSupported != undefined) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_PROMISE_0100 PASSED with isVideoStabilizationModeSupported is: " + isVideoStabilizationModeSupported); } else { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_PROMISE_0100 FAILED with isVideoStabilizationModeSupported is: " + isVideoStabilizationModeSupported); expect().assertFail(); - } - - await sleep(100); + } await stopCameraSession(); @@ -657,67 +549,7 @@ export default function cameraSessionVideoStabilizationTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0100 - * @tc.name : Check capture session set video stabilization off mode with callback - * @tc.desc : Check capture session set video stabilization off mode with callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0100--------------"); - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0100 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0100 start for camera[" + i + "]"); - - await startCameraSession(i); - - if (mIsVideoStabilizationModeSupportedArray[i] == true) { - mCameraSession.setVideoStabilizationMode(cameraObj.VideoStabilizationMode.OFF, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0100 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0100 PASSED with VideoStabilizationMode is: " + cameraObj.VideoStabilizationMode.OFF); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - mCameraSession.getActiveVideoStabilizationMode(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0100 callback"); - if (!err) { - if (data == cameraObj.VideoStabilizationMode.OFF) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0100 PASSED with VideoStabilizationMode is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0100 FAILED with VideoStabilizationMode is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0100 PASSED"); - } - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0100 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0100 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_PROMISE_0100 @@ -741,12 +573,11 @@ export default function cameraSessionVideoStabilizationTest() { await startCameraSession(i); if (mIsVideoStabilizationModeSupportedArray[i] == true) { - await mCameraSession.setVideoStabilizationMode(cameraObj.VideoStabilizationMode.OFF); + mCameraSession.setVideoStabilizationMode(cameraObj.VideoStabilizationMode.OFF); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_PROMISE_0100 finish"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_PROMISE_0100 PASSED with VideoStabilizationMode is: " + cameraObj.VideoStabilizationMode.OFF); - await sleep(500); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_PROMISE_0100 PASSED with VideoStabilizationMode is: " + cameraObj.VideoStabilizationMode.OFF); - let vdeoStabilizationMode = await mCameraSession.getActiveVideoStabilizationMode(); + let vdeoStabilizationMode = mCameraSession.getActiveVideoStabilizationMode(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_PROMISE_0100 finish"); if (vdeoStabilizationMode == cameraObj.VideoStabilizationMode.OFF) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_PROMISE_0100 PASSED with VideoStabilizationMode is: " + vdeoStabilizationMode); @@ -754,7 +585,6 @@ export default function cameraSessionVideoStabilizationTest() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_PROMISE_0100 FAILED with VideoStabilizationMode is: " + vdeoStabilizationMode); expect().assertFail(); } - await sleep(500); } else { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_PROMISE_0100 PASSED"); } @@ -769,56 +599,7 @@ export default function cameraSessionVideoStabilizationTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0101 - * @tc.name : Check capture session support video stabilization low mode with callback or not - * @tc.desc : Check capture session support video stabilization low mode with callback or not - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0101', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0101--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0101 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0101 start for camera[" + i + "]"); - - await startCameraSession(i); - - mIsVideoStabilizationModeSupportedArray[i] = false; - - mCameraSession.isVideoStabilizationModeSupported(cameraObj.VideoStabilizationMode.LOW, async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0101 callback"); - if (!err) { - if (data != null || data != undefined) { - mIsVideoStabilizationModeSupportedArray[i] = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0101 PASSED with isVideoStabilizationModeSupported is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0101 FAILED with isVideoStabilizationModeSupported is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0101 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(100); - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0101 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0101 ends here"); - done(); - } - }) - + /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_PROMISE_0101 * @tc.name : Check capture session support video stabilization low mode with promise or not @@ -840,16 +621,14 @@ export default function cameraSessionVideoStabilizationTest() { await startCameraSession(i); - let isVideoStabilizationModeSupported = await mCameraSession.isVideoStabilizationModeSupported(cameraObj.VideoStabilizationMode.LOW); + let isVideoStabilizationModeSupported = mCameraSession.isVideoStabilizationModeSupported(cameraObj.VideoStabilizationMode.LOW); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_PROMISE_0101 finish"); if (isVideoStabilizationModeSupported != null || isVideoStabilizationModeSupported != undefined) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_PROMISE_0101 PASSED with isVideoStabilizationModeSupported is: " + isVideoStabilizationModeSupported); } else { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_PROMISE_0101 FAILED with isVideoStabilizationModeSupported is: " + isVideoStabilizationModeSupported); expect().assertFail(); - } - - await sleep(100); + } await stopCameraSession(); @@ -861,67 +640,7 @@ export default function cameraSessionVideoStabilizationTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0101 - * @tc.name : Check capture session set video stabilization low mode with callback - * @tc.desc : Check capture session set video stabilization low mode with callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0101', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0101--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0101 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0101 start for camera[" + i + "]"); - - await startCameraSession(i); - - if (mIsVideoStabilizationModeSupportedArray[i] == true) { - mCameraSession.setVideoStabilizationMode(cameraObj.VideoStabilizationMode.LOW, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0101 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0101 PASSED with VideoStabilizationMode is: " + cameraObj.VideoStabilizationMode.LOW); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0101 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - mCameraSession.getActiveVideoStabilizationMode(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0101 callback"); - if (!err) { - if (data == cameraObj.VideoStabilizationMode.LOW) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0101 PASSED with VideoStabilizationMode is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0101 FAILED with VideoStabilizationMode is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0101 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0101 PASSED"); - } - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0101 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0101 ends here"); - done(); - } - }) + /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_PROMISE_0101 @@ -945,12 +664,11 @@ export default function cameraSessionVideoStabilizationTest() { await startCameraSession(i); if (mIsVideoStabilizationModeSupportedArray[i] == true) { - await mCameraSession.setVideoStabilizationMode(cameraObj.VideoStabilizationMode.LOW); + mCameraSession.setVideoStabilizationMode(cameraObj.VideoStabilizationMode.LOW); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_PROMISE_0101 finish"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_PROMISE_0101 PASSED with VideoStabilizationMode is: " + cameraObj.VideoStabilizationMode.LOW); - await sleep(500); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_PROMISE_0101 PASSED with VideoStabilizationMode is: " + cameraObj.VideoStabilizationMode.LOW); - let vdeoStabilizationMode = await mCameraSession.getActiveVideoStabilizationMode(); + let vdeoStabilizationMode = mCameraSession.getActiveVideoStabilizationMode(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_PROMISE_0101 finish"); if (vdeoStabilizationMode == cameraObj.VideoStabilizationMode.LOW) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_PROMISE_0101 PASSED with VideoStabilizationMode is: " + vdeoStabilizationMode); @@ -958,7 +676,6 @@ export default function cameraSessionVideoStabilizationTest() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_PROMISE_0101 FAILED with VideoStabilizationMode is: " + vdeoStabilizationMode); expect().assertFail(); } - await sleep(500); } else { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_PROMISE_0101 PASSED"); } @@ -973,55 +690,7 @@ export default function cameraSessionVideoStabilizationTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0102 - * @tc.name : Check capture session support video stabilization middle mode with callback or not - * @tc.desc : Check capture session support video stabilization middle mode with callback or not - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0102', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0102--------------"); - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0102 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0102 start for camera[" + i + "]"); - - await startCameraSession(i); - - mIsVideoStabilizationModeSupportedArray[i] = false; - - mCameraSession.isVideoStabilizationModeSupported(cameraObj.VideoStabilizationMode.MIDDLE, async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0102 callback"); - if (!err) { - if (data != null || data != undefined) { - mIsVideoStabilizationModeSupportedArray[i] = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0102 PASSED with isVideoStabilizationModeSupported is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0102 FAILED with isVideoStabilizationModeSupported is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0102 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(100); - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0102 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0102 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_PROMISE_0102 @@ -1044,16 +713,14 @@ export default function cameraSessionVideoStabilizationTest() { await startCameraSession(i); - let isVideoStabilizationModeSupported = await mCameraSession.isVideoStabilizationModeSupported(cameraObj.VideoStabilizationMode.MIDDLE); + let isVideoStabilizationModeSupported = mCameraSession.isVideoStabilizationModeSupported(cameraObj.VideoStabilizationMode.MIDDLE); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_PROMISE_0102 finish"); if (isVideoStabilizationModeSupported != null || isVideoStabilizationModeSupported != undefined) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_PROMISE_0102 PASSED with isVideoStabilizationModeSupported is: " + isVideoStabilizationModeSupported); } else { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_PROMISE_0102 FAILED with isVideoStabilizationModeSupported is: " + isVideoStabilizationModeSupported); expect().assertFail(); - } - - await sleep(100); + } await stopCameraSession(); @@ -1065,67 +732,7 @@ export default function cameraSessionVideoStabilizationTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0102 - * @tc.name : Check capture session set video stabilization middle mode with callback - * @tc.desc : Check capture session set video stabilization middle mode with callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0102', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0102--------------"); - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0102 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0102 start for camera[" + i + "]"); - - await startCameraSession(i); - - if (mIsVideoStabilizationModeSupportedArray[i] == true) { - mCameraSession.setVideoStabilizationMode(cameraObj.VideoStabilizationMode.MIDDLE, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0102 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0102 PASSED with VideoStabilizationMode is: " + cameraObj.VideoStabilizationMode.MIDDLE); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0102 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - mCameraSession.getActiveVideoStabilizationMode(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0102 callback"); - if (!err) { - if (data == cameraObj.VideoStabilizationMode.MIDDLE) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0102 PASSED with VideoStabilizationMode is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0102 FAILED with VideoStabilizationMode is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0102 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0102 PASSED"); - } - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0102 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0102 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_PROMISE_0102 @@ -1149,12 +756,11 @@ export default function cameraSessionVideoStabilizationTest() { await startCameraSession(i); if (mIsVideoStabilizationModeSupportedArray[i] == true) { - await mCameraSession.setVideoStabilizationMode(cameraObj.VideoStabilizationMode.MIDDLE); + mCameraSession.setVideoStabilizationMode(cameraObj.VideoStabilizationMode.MIDDLE); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_PROMISE_0102 finish"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_PROMISE_0102 PASSED with VideoStabilizationMode is: " + cameraObj.VideoStabilizationMode.MIDDLE); - await sleep(500); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_PROMISE_0102 PASSED with VideoStabilizationMode is: " + cameraObj.VideoStabilizationMode.MIDDLE); - let vdeoStabilizationMode = await mCameraSession.getActiveVideoStabilizationMode(); + let vdeoStabilizationMode = mCameraSession.getActiveVideoStabilizationMode(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_PROMISE_0102 finish"); if (vdeoStabilizationMode == cameraObj.VideoStabilizationMode.MIDDLE) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_PROMISE_0102 PASSED with VideoStabilizationMode is: " + vdeoStabilizationMode); @@ -1162,7 +768,6 @@ export default function cameraSessionVideoStabilizationTest() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_PROMISE_0102 FAILED with VideoStabilizationMode is: " + vdeoStabilizationMode); expect().assertFail(); } - await sleep(500); } else { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_PROMISE_0102 PASSED"); } @@ -1177,55 +782,7 @@ export default function cameraSessionVideoStabilizationTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0103 - * @tc.name : Check capture session support video stabilization high mode with callback or not - * @tc.desc : Check capture session support video stabilization high mode with callback or not - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0103', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0103--------------"); - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0103 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0103 start for camera[" + i + "]"); - - await startCameraSession(i); - - mIsVideoStabilizationModeSupportedArray[i] = false; - - mCameraSession.isVideoStabilizationModeSupported(cameraObj.VideoStabilizationMode.HIGH, async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0103 callback"); - if (!err) { - if (data != null || data != undefined) { - mIsVideoStabilizationModeSupportedArray[i] = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0103 PASSED with isVideoStabilizationModeSupported is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0103 FAILED with isVideoStabilizationModeSupported is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0103 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(100); - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0103 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0103 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_PROMISE_0103 @@ -1248,16 +805,14 @@ export default function cameraSessionVideoStabilizationTest() { await startCameraSession(i); - let isVideoStabilizationModeSupported = await mCameraSession.isVideoStabilizationModeSupported(cameraObj.VideoStabilizationMode.HIGH); + let isVideoStabilizationModeSupported = mCameraSession.isVideoStabilizationModeSupported(cameraObj.VideoStabilizationMode.HIGH); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_PROMISE_0103 finish"); if (isVideoStabilizationModeSupported != null || isVideoStabilizationModeSupported != undefined) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_PROMISE_0103 PASSED with isVideoStabilizationModeSupported is: " + isVideoStabilizationModeSupported); } else { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_PROMISE_0103 FAILED with isVideoStabilizationModeSupported is: " + isVideoStabilizationModeSupported); expect().assertFail(); - } - - await sleep(100); + } await stopCameraSession(); @@ -1269,67 +824,7 @@ export default function cameraSessionVideoStabilizationTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0103 - * @tc.name : Check capture session set video stabilization high mode with callback - * @tc.desc : Check capture session set video stabilization high mode with callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0103', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0103--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0103 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0103 start for camera[" + i + "]"); - - await startCameraSession(i); - - if (mIsVideoStabilizationModeSupportedArray[i] == true) { - mCameraSession.setVideoStabilizationMode(cameraObj.VideoStabilizationMode.HIGH, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0103 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0103 PASSED with VideoStabilizationMode is: " + cameraObj.VideoStabilizationMode.HIGH); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0103 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - mCameraSession.getActiveVideoStabilizationMode(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0103 callback"); - if (!err) { - if (data == cameraObj.VideoStabilizationMode.HIGH) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0103 PASSED with VideoStabilizationMode is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0103 FAILED with VideoStabilizationMode is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0103 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0103 PASSED"); - } - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0103 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0103 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_PROMISE_0103 @@ -1353,12 +848,11 @@ export default function cameraSessionVideoStabilizationTest() { await startCameraSession(i); if (mIsVideoStabilizationModeSupportedArray[i] == true) { - await mCameraSession.setVideoStabilizationMode(cameraObj.VideoStabilizationMode.HIGH); + mCameraSession.setVideoStabilizationMode(cameraObj.VideoStabilizationMode.HIGH); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_PROMISE_0103 finish"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_PROMISE_0103 PASSED with VideoStabilizationMode is: " + cameraObj.VideoStabilizationMode.HIGH); - await sleep(500); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_PROMISE_0103 PASSED with VideoStabilizationMode is: " + cameraObj.VideoStabilizationMode.HIGH); - let vdeoStabilizationMode = await mCameraSession.getActiveVideoStabilizationMode(); + let vdeoStabilizationMode = mCameraSession.getActiveVideoStabilizationMode(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_PROMISE_0103 finish"); if (vdeoStabilizationMode == cameraObj.VideoStabilizationMode.HIGH) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_PROMISE_0103 PASSED with VideoStabilizationMode is: " + vdeoStabilizationMode); @@ -1366,7 +860,6 @@ export default function cameraSessionVideoStabilizationTest() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_PROMISE_0103 FAILED with VideoStabilizationMode is: " + vdeoStabilizationMode); expect().assertFail(); } - await sleep(500); } else { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_PROMISE_0103 PASSED"); } @@ -1381,55 +874,7 @@ export default function cameraSessionVideoStabilizationTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0104 - * @tc.name : Check capture session support video stabilization auto mode with callback or not - * @tc.desc : Check capture session support video stabilization auto mode with callback or not - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0104', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0104--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0104 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0104 start for camera[" + i + "]"); - - await startCameraSession(i); - - mIsVideoStabilizationModeSupportedArray[i] = false; - - mCameraSession.isVideoStabilizationModeSupported(cameraObj.VideoStabilizationMode.AUTO, async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0104 callback"); - if (!err) { - if (data != null || data != undefined) { - mIsVideoStabilizationModeSupportedArray[i] = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0104 PASSED with isVideoStabilizationModeSupported is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0104 FAILED with isVideoStabilizationModeSupported is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0104 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(100); - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0104 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0104 ends here"); - done(); - } - }) + /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_PROMISE_0104 @@ -1452,16 +897,14 @@ export default function cameraSessionVideoStabilizationTest() { await startCameraSession(i); - let isVideoStabilizationModeSupported = await mCameraSession.isVideoStabilizationModeSupported(cameraObj.VideoStabilizationMode.AUTO); + let isVideoStabilizationModeSupported = mCameraSession.isVideoStabilizationModeSupported(cameraObj.VideoStabilizationMode.AUTO); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_PROMISE_0104 finish"); if (isVideoStabilizationModeSupported != null || isVideoStabilizationModeSupported != undefined) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_PROMISE_0104 PASSED with isVideoStabilizationModeSupported is: " + isVideoStabilizationModeSupported); } else { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_PROMISE_0104 FAILED with isVideoStabilizationModeSupported is: " + isVideoStabilizationModeSupported); expect().assertFail(); - } - - await sleep(100); + } await stopCameraSession(); @@ -1473,68 +916,7 @@ export default function cameraSessionVideoStabilizationTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0104 - * @tc.name : Check capture session set video stabilization auto mode with callback - * @tc.desc : Check capture session set video stabilization auto mode with callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0104', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0104--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0104 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0104 start for camera[" + i + "]"); - - await startCameraSession(i); - - if (mIsVideoStabilizationModeSupportedArray[i] == true) { - mCameraSession.setVideoStabilizationMode(cameraObj.VideoStabilizationMode.AUTO, async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0104 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0104 PASSED with VideoStabilizationMode is: " + cameraObj.VideoStabilizationMode.AUTO); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0104 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - mCameraSession.getActiveVideoStabilizationMode(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0104 callback"); - if (!err) { - if (data == cameraObj.VideoStabilizationMode.AUTO) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0104 PASSED with VideoStabilizationMode is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0104 FAILED with VideoStabilizationMode is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0104 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0104 PASSED"); - } - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0104 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_CALLBACK_0104 ends here"); - done(); - } - }) - + /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_PROMISE_0104 * @tc.name : Check capture session set video stabilization auto mode with promise @@ -1557,12 +939,11 @@ export default function cameraSessionVideoStabilizationTest() { await startCameraSession(i); if (mIsVideoStabilizationModeSupportedArray[i] == true) { - await mCameraSession.setVideoStabilizationMode(cameraObj.VideoStabilizationMode.AUTO); + mCameraSession.setVideoStabilizationMode(cameraObj.VideoStabilizationMode.AUTO); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_PROMISE_0104 finish"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_PROMISE_0104 PASSED with VideoStabilizationMode is: " + cameraObj.VideoStabilizationMode.AUTO); - await sleep(500); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_PROMISE_0104 PASSED with VideoStabilizationMode is: " + cameraObj.VideoStabilizationMode.AUTO); - let vdeoStabilizationMode = await mCameraSession.getActiveVideoStabilizationMode(); + let vdeoStabilizationMode = mCameraSession.getActiveVideoStabilizationMode(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_PROMISE_0104 finish"); if (vdeoStabilizationMode == cameraObj.VideoStabilizationMode.AUTO) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_PROMISE_0104 PASSED with VideoStabilizationMode is: " + vdeoStabilizationMode); @@ -1570,7 +951,6 @@ export default function cameraSessionVideoStabilizationTest() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_PROMISE_0104 FAILED with VideoStabilizationMode is: " + vdeoStabilizationMode); expect().assertFail(); } - await sleep(500); } else { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_VIDEO_STABILIZATION_MODE_PROMISE_0104 PASSED"); } diff --git a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionZoomRatioTest.test.ets b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionZoomRatioTest.test.ets index e46bd9f52ae6df26ab1db8ee1fe34bc0e7bc5dfe..103ca7370ad95bade17ad1a452e2fd76458884d3 100644 --- a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionZoomRatioTest.test.ets +++ b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraSessionZoomRatioTest.test.ets @@ -180,10 +180,10 @@ export default function cameraSessionZoomRatioTest() { console.log(TAG + 'Exit releaseVideoReceiveSurface') } - async function getCameraManagerInstance() { + function getCameraManagerInstance() { console.info('Enter getCameraManagerInstance'); - mCameraManager = await cameraObj.getCameraManager(null); + mCameraManager = cameraObj.getCameraManager(null); if (isEmpty(mCameraManager)) { console.info(TAG + "getCameraManager FAILED"); return false; @@ -194,10 +194,10 @@ export default function cameraSessionZoomRatioTest() { return true; } - async function getCameraSupportDevicesArray() { + function getCameraSupportDevicesArray() { console.info('Enter getCameraSupportDevicesArray'); - mCameraDevicesArray = await mCameraManager.getSupportedCameras(); + mCameraDevicesArray = mCameraManager.getSupportedCameras(); /* mCameraManager.getSupportedCameras(async (err, data) => { console.info(TAG + "Entering getCameraSupportDevicesArray callback"); @@ -233,47 +233,11 @@ export default function cameraSessionZoomRatioTest() { return true; } - async function beginCameraSessionConfig() { - console.info('Enter beginCameraSessionConfig'); - - mCameraSession.beginConfig(async (err) => { - if (!err) { - console.info(TAG + "Entering beginConfig PASSED"); - } else { - console.info(TAG + "Entering beginConfig FAILED : " + err.message); - } - }) - - await sleep(30); - - console.info('Exit beginCameraSessionConfig'); - - return true; - } - - async function commitCameraSessionConfig() { - console.info('Enter commitCameraSessionConfig'); - - mCameraSession.commitConfig(async (err) => { - if (!err) { - console.info(TAG + "Entering commitConfig PASSED"); - } else { - console.info(TAG + "Entering commitConfig FAILED : " + err.message); - } - }) - - await sleep(500); - - console.info('Exit commitCameraSessionConfig'); - - return true; - } - - async function createCameraSessionInstance() { + function createCameraSessionInstance() { console.info('Enter createCameraSessionInstance'); try { - mCameraSession = await mCameraManager.createCaptureSession(); + mCameraSession = mCameraManager.createCaptureSession(); } catch { console.info('createCaptureSession FAILED'); @@ -284,7 +248,7 @@ export default function cameraSessionZoomRatioTest() { return false; } - await beginCameraSessionConfig(); + mCameraSession.beginConfig(); console.info('Exit createCameraSessionInstance'); @@ -303,27 +267,14 @@ export default function cameraSessionZoomRatioTest() { return false; } - mCameraInput = null; - await mCameraManager.createCameraInput(mCameraDevicesArray[idx]).then((result) => { - console.info('createCameraInput success'); - mCameraInput = result; - }).catch((err) => { - console.info('createCameraInput failed, err = ' + err.message); - }); + mCameraInput = mCameraManager.createCameraInput(mCameraDevicesArray[idx]); if (isEmpty(mCameraInput)) { console.info(TAG + "createCameraInput FAILED"); return false; } - mCameraInput.open(async (err) => { - console.info(TAG + "Entering mCameraInput open callback"); - if (!err) { - console.info(TAG + "Entering mCameraInput open PASSED "); - } else { - console.info(TAG + "Entering mCameraInput open FAILED : " + err.message); - } - }) + await mCameraInput.open(); await sleep(100); @@ -339,7 +290,6 @@ export default function cameraSessionZoomRatioTest() { if (!isEmpty(mCameraInput)) { await mCameraInput.close(); - await mCameraInput.release(); } console.info('Exit releaseInput'); @@ -350,15 +300,7 @@ export default function cameraSessionZoomRatioTest() { async function createOutput(idx:any) { console.info('Enter createOutput'); - let cameraOutputCap = null; - await mCameraManager.getSupportedOutputCapability(mCameraDevicesArray[idx]).then((result) => { - console.info('getSupportedOutputCapability success'); - cameraOutputCap = result; - }).catch((err) => { - console.info('getSupportedOutputCapability failed, err = ' + err.message); - mPreviewOutput = null; - mPhotoOutput = null; - }); + let cameraOutputCap = await mCameraManager.getSupportedOutputCapability(mCameraDevicesArray[idx]); if (!isEmpty(cameraOutputCap)) { if (!isEmpty(cameraOutputCap.previewProfiles)) { @@ -426,7 +368,6 @@ export default function cameraSessionZoomRatioTest() { console.info('Enter releaseOutput'); if (!isEmpty(mPreviewOutput)) { - await mPreviewOutput.stop(); await mPreviewOutput.release(); } @@ -448,23 +389,26 @@ export default function cameraSessionZoomRatioTest() { console.info(TAG + "Enter startCameraSession"); await createInput(idx); - await createOutput(idx); + createOutput(idx); + + console.info(TAG + "Start to addInput"); + await sleep(1); if (!isEmpty(mCameraInput)) { console.info(TAG + "Start to addInput"); - await mCameraSession.addInput(mCameraInput); + mCameraSession.addInput(mCameraInput); } if (!isEmpty(mPreviewOutput)) { console.info(TAG + "Start to addOutput mPreviewOutput"); - await mCameraSession.addOutput(mPreviewOutput); + mCameraSession.addOutput(mPreviewOutput); } if (!isEmpty(mPhotoOutput)) { console.info(TAG + "Start to addOutput mPhotoOutput"); - await mCameraSession.addOutput(mPhotoOutput); + mCameraSession.addOutput(mPhotoOutput); } /* if (!isEmpty(mVideoOutput)) { @@ -474,8 +418,9 @@ export default function cameraSessionZoomRatioTest() { */ await sleep(1); - await commitCameraSessionConfig(); - await beginCameraSessionConfig(); + await mCameraSession.commitConfig(); + + console.info(TAG + "Entering startCameraSession start session begin"); /* await mCameraSession.start(async (err) => { @@ -496,6 +441,8 @@ export default function cameraSessionZoomRatioTest() { async function stopCameraSession() { console.info(TAG + "Enter stopCameraSession"); + + mCameraSession.beginConfig(); /* mCameraSession.stop(async (err) => { console.info(TAG + "Entering mCameraSession stop callback"); @@ -509,19 +456,20 @@ export default function cameraSessionZoomRatioTest() { await sleep(100); */ + // await commitCameraSessionConfig(); if (!isEmpty(mCameraInput)) { console.info(TAG + "Start to removeInput input"); - await mCameraSession.removeInput(mCameraInput); + mCameraSession.removeInput(mCameraInput); } if (!isEmpty(mPreviewOutput)) { console.info(TAG + "Start to removeOutput mPreviewOutput"); - await mCameraSession.removeOutput(mPreviewOutput); + mCameraSession.removeOutput(mPreviewOutput); } if (!isEmpty(mPhotoOutput)) { console.info(TAG + "Start to removeOutput mPhotoOutput"); - await mCameraSession.removeOutput(mPhotoOutput); + mCameraSession.removeOutput(mPhotoOutput); } /* if (!isEmpty(mVideoOutput)) { @@ -529,6 +477,7 @@ export default function cameraSessionZoomRatioTest() { await mCameraSession.removeOutput(mVideoOutput); } */ + await releaseInput(); await releaseOutput(); @@ -544,9 +493,9 @@ export default function cameraSessionZoomRatioTest() { sleep(100); await getPhotoReceiverSurface(); await getVideoReceiveSurface(); - await getCameraManagerInstance(); - await getCameraSupportDevicesArray(); - await createCameraSessionInstance(); + getCameraManagerInstance(); + getCameraSupportDevicesArray(); + createCameraSessionInstance(); console.info('Device type = ' + deviceInfo.deviceType); @@ -569,65 +518,7 @@ export default function cameraSessionZoomRatioTest() { console.info('afterAll case'); }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_GET_ZOOM_RATIO_RANGE_CALLBACK_0100 - * @tc.name : Check capture session get zoom ratio range with callback - * @tc.desc : Check capture session get zoom ratio range with callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_GET_ZOOM_RATIO_RANGE_CALLBACK_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_GET_ZOOM_RATIO_RANGE_CALLBACK_0100--------------"); - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_GET_ZOOM_RATIO_RANGE_CALLBACK_0100 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_GET_ZOOM_RATIO_RANGE_CALLBACK_0100 start for camera[" + i + "]"); - - await startCameraSession(i); - - mCameraSession.getZoomRatioRange(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_GET_ZOOM_RATIO_RANGE_CALLBACK_0100 callback"); - if (!err) { - if (data.length > 0) { - mZoomRatioRangeArray[i] = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_GET_ZOOM_RATIO_RANGE_CALLBACK_0100 PASSED with ZoomRatioRange length is: " + data.length); - for (let j = 0; j < mZoomRatioRangeArray[i].length; j++) { - console.info(TAG + j + "th, zoom ratio is: " + data[j] + ", " + mZoomRatioRangeArray[i][j]); - - if ((mZoomRatioMaxArray[i] == undefined) || (mZoomRatioMaxArray[i] < mZoomRatioRangeArray[i][j])) { - mZoomRatioMaxArray[i] = mZoomRatioRangeArray[i][j] - } - - if ((mZoomRatioMinArray[i] == undefined) || (mZoomRatioMinArray[i] > mZoomRatioRangeArray[i][j])) { - mZoomRatioMinArray[i] = mZoomRatioRangeArray[i][j] - } - } - - console.info(TAG + "Zoom ratio max is: " + mZoomRatioMaxArray[i] + ", min is: " + mZoomRatioMinArray[i]); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_GET_ZOOM_RATIO_RANGE_CALLBACK_0100 FAILED with ZoomRatioRange length is: " + data.length); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_GET_ZOOM_RATIO_RANGE_CALLBACK_0100 PASSED : " + err.message); - } - }) - await sleep(100); - - await stopCameraSession(); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_GET_ZOOM_RATIO_RANGE_CALLBACK_0100 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_GET_ZOOM_RATIO_RANGE_CALLBACK_0100 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_GET_ZOOM_RATIO_RANGE_PROMISE_0100 @@ -651,7 +542,7 @@ export default function cameraSessionZoomRatioTest() { await startCameraSession(i); try { - let zoomRatioRange = await mCameraSession.getZoomRatioRange(); + let zoomRatioRange = mCameraSession.getZoomRatioRange(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_GET_ZOOM_RATIO_RANGE_PROMISE_0100 finish"); if (zoomRatioRange.length > 0) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_GET_ZOOM_RATIO_RANGE_PROMISE_0100 PASSED with ZoomRatioRange length is: " + zoomRatioRange.length); @@ -667,8 +558,6 @@ export default function cameraSessionZoomRatioTest() { catch { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_GET_ZOOM_RATIO_RANGE_CALLBACK_0100 PASSED"); } - - await sleep(100); await stopCameraSession(); @@ -680,65 +569,7 @@ export default function cameraSessionZoomRatioTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0100 - * @tc.name : Check capture session zoom ratio with callback - * @tc.desc : Check capture session zoom ratio with callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0100', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0100--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0100 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0100 start for camera[" + i + "]"); - - if (!isEmpty(mZoomRatioRangeArray[i])) { - await startCameraSession(i); - - mCameraSession.setZoomRatio(mZoomRatioRangeArray[i][0], async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0100 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0100 PASSED with ZoomRatio is: " + mZoomRatioRangeArray[i][0]); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - mCameraSession.getZoomRatio(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0100 callback"); - if (!err) { - if (data == mZoomRatioRangeArray[i][0]) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0100 PASSED with ZoomRatioRange is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0100 FAILED with ZoomRatioRange is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - await stopCameraSession(); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0100 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0100 ends here"); - done(); - } - }) + /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_PROMISE_0100 @@ -762,12 +593,11 @@ export default function cameraSessionZoomRatioTest() { if (!isEmpty(mZoomRatioRangeArray[i])) { await startCameraSession(i); - await mCameraSession.setZoomRatio(mZoomRatioRangeArray[i][0]); + mCameraSession.setZoomRatio(mZoomRatioRangeArray[i][0]); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_PROMISE_0100 finish"); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_PROMISE_0100 PASSED with ZoomRatio is: " + mZoomRatioRangeArray[i][0]); - await sleep(500); - let zoomRatio = await mCameraSession.getZoomRatio(); + let zoomRatio = mCameraSession.getZoomRatio(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_PROMISE_0100 finish"); if (zoomRatio == mZoomRatioRangeArray[i][0]) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_PROMISE_0100 PASSED with ZoomRatio is: " + zoomRatio); @@ -775,7 +605,6 @@ export default function cameraSessionZoomRatioTest() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_PROMISE_0100 FAILED with ZoomRatio is: " + zoomRatio); expect().assertFail(); } - await sleep(500); await stopCameraSession(); } @@ -788,66 +617,7 @@ export default function cameraSessionZoomRatioTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0101 - * @tc.name : Check capture session zoom ratio with callback(invalid value, max + 1) - * @tc.desc : Check capture session zoom ratio with callback(invalid value, max + 1) - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0101', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0101--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0101 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0101 start for camera[" + i + "]"); - - if (!isEmpty(mZoomRatioRangeArray[i])) { - await startCameraSession(i); - - mCameraSession.setZoomRatio((mZoomRatioMaxArray[i] + 1), async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0101 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0101 PASSED with ZoomRatio is: " + (mZoomRatioMaxArray[i] + 1)); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0101 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - mCameraSession.getZoomRatio(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0101 callback"); - if (!err) { - if (data != (mZoomRatioMaxArray[i] + 1)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0101 PASSED with ZoomRatio is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0101 FAILED with ZoomRatio is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0101 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - await stopCameraSession(); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0101 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0101 ends here"); - done(); - } - }) - + /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_PROMISE_0101 * @tc.name : Check capture session set zoom ratio with promise(invalid value, max + 1) @@ -870,12 +640,11 @@ export default function cameraSessionZoomRatioTest() { if (!isEmpty(mZoomRatioRangeArray[i])) { await startCameraSession(i); - await mCameraSession.setZoomRatio((mZoomRatioMaxArray[i] + 1)); + mCameraSession.setZoomRatio((mZoomRatioMaxArray[i] + 1)); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_PROMISE_0101 finish"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_PROMISE_0101 PASSED with ZoomRatio is: " + (mZoomRatioMaxArray[i] + 1)); - await sleep(500); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_PROMISE_0101 PASSED with ZoomRatio is: " + (mZoomRatioMaxArray[i] + 1)); - let zoomRatio = await mCameraSession.getZoomRatio(); + let zoomRatio = mCameraSession.getZoomRatio(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_PROMISE_0101 finish"); if (zoomRatio != (mZoomRatioMaxArray[i] + 1)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_PROMISE_0101 PASSED with ZoomRatio is: " + zoomRatio); @@ -883,7 +652,6 @@ export default function cameraSessionZoomRatioTest() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_PROMISE_0101 FAILED with ZoomRatio is: " + zoomRatio); expect().assertFail(); } - await sleep(500); await stopCameraSession(); } @@ -896,65 +664,7 @@ export default function cameraSessionZoomRatioTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0102 - * @tc.name : Check capture session zoom ratio with callback(invalid value, max + 0.1) - * @tc.desc : Check capture session zoom ratio with callback(invalid value, max + 0.1) - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0102', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0102--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0102 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0102 start for camera[" + i + "]"); - - if (!isEmpty(mZoomRatioRangeArray[i])) { - await startCameraSession(i); - - mCameraSession.setZoomRatio((mZoomRatioMaxArray[i] + 0.1), async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0102 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0102 PASSED with ZoomRatio is: " + (mZoomRatioMaxArray[i] + 0.1)); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0102 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - mCameraSession.getZoomRatio(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0102 callback"); - if (!err) { - if (data != (mZoomRatioMaxArray[i] + 0.1)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0102 PASSED with ZoomRatio is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0102 FAILED with ZoomRatio is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0102 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - await stopCameraSession(); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0102 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0102 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_PROMISE_0102 @@ -978,12 +688,11 @@ export default function cameraSessionZoomRatioTest() { if (!isEmpty(mZoomRatioRangeArray[i])) { await startCameraSession(i); - await mCameraSession.setZoomRatio((mZoomRatioMaxArray[i] + 0.1)); + mCameraSession.setZoomRatio((mZoomRatioMaxArray[i] + 0.1)); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_PROMISE_0102 finish"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_PROMISE_0102 PASSED with ZoomRatio is: " + (mZoomRatioMaxArray[i] + 0.1)); - await sleep(500); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_PROMISE_0102 PASSED with ZoomRatio is: " + (mZoomRatioMaxArray[i] + 0.1)); - let zoomRatio = await mCameraSession.getZoomRatio(); + let zoomRatio = mCameraSession.getZoomRatio(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_PROMISE_0102 finish"); if (zoomRatio != (mZoomRatioMaxArray[i] + 0.1)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_PROMISE_0102 PASSED with ZoomRatio is: " + zoomRatio); @@ -991,7 +700,6 @@ export default function cameraSessionZoomRatioTest() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_PROMISE_0102 FAILED with ZoomRatio is: " + zoomRatio); expect().assertFail(); } - await sleep(500); await stopCameraSession(); } @@ -1004,65 +712,7 @@ export default function cameraSessionZoomRatioTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0103 - * @tc.name : Check capture session zoom ratio with callback(invalid value, min - 1) - * @tc.desc : Check capture session zoom ratio with callback(invalid value, min - 1) - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0103', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0103--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0103 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0103 start for camera[" + i + "]"); - - if (!isEmpty(mZoomRatioRangeArray[i])) { - await startCameraSession(i); - - mCameraSession.setZoomRatio((mZoomRatioMinArray[i] - 1), async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0103 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0103 PASSED with ZoomRatio is: " + (mZoomRatioMaxArray[i] - 1)); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0103 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - mCameraSession.getZoomRatio(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0103 callback"); - if (!err) { - if (data != (mZoomRatioMinArray[i] - 1)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0103 PASSED with ZoomRatio is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0103 FAILED with ZoomRatio is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0103 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - await stopCameraSession(); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0103 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0103 ends here"); - done(); - } - }) /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_PROMISE_0103 @@ -1086,12 +736,11 @@ export default function cameraSessionZoomRatioTest() { if (!isEmpty(mZoomRatioRangeArray[i])) { await startCameraSession(i); - await mCameraSession.setZoomRatio((mZoomRatioMinArray[i] - 1)); + mCameraSession.setZoomRatio((mZoomRatioMinArray[i] - 1)); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_PROMISE_0103 finish"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_PROMISE_0103 PASSED with ZoomRatio is: " + (mZoomRatioMaxArray[i] - 1)); - await sleep(500); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_PROMISE_0103 PASSED with ZoomRatio is: " + (mZoomRatioMaxArray[i] - 1)); - let zoomRatio = await mCameraSession.getZoomRatio(); + let zoomRatio = mCameraSession.getZoomRatio(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_PROMISE_0103 finish"); if (zoomRatio != (mZoomRatioMinArray[i] - 1)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_PROMISE_0103 PASSED with ZoomRatio is: " + zoomRatio); @@ -1099,7 +748,6 @@ export default function cameraSessionZoomRatioTest() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_PROMISE_0103 FAILED with ZoomRatio is: " + zoomRatio); expect().assertFail(); } - await sleep(500); await stopCameraSession(); } @@ -1112,65 +760,7 @@ export default function cameraSessionZoomRatioTest() { } }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0104 - * @tc.name : Check capture session zoom ratio with callback(invalid value, min - 0.1) - * @tc.desc : Check capture session zoom ratio with callback(invalid value, min - 0.1) - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0104', 2, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0104--------------"); - - if (mCameraNum == 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0104 FAILED with NoCamera"); - expect().assertFail(); - done(); - } else { - for (let i = 0; i < mCameraNum; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0104 start for camera[" + i + "]"); - - if (!isEmpty(mZoomRatioRangeArray[i])) { - await startCameraSession(i); - - mCameraSession.setZoomRatio((mZoomRatioMaxArray[i] - 0.1), async (err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0104 callback"); - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0104 PASSED with ZoomRatio is: " + (mZoomRatioMaxArray[i] - 0.1)); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0104 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - mCameraSession.getZoomRatio(async (err, data) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0104 callback"); - if (!err) { - if (data != (mZoomRatioMaxArray[i] - 0.1)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0104 PASSED with ZoomRatio is: " + data); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0104 FAILED with ZoomRatio is: " + data); - expect().assertFail(); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0104 FAILED : " + err.message); - expect().assertFail(); - } - }) - await sleep(500); - - await stopCameraSession(); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0104 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_CALLBACK_0104 ends here"); - done(); - } - }) + /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_PROMISE_0104 @@ -1194,12 +784,11 @@ export default function cameraSessionZoomRatioTest() { if (!isEmpty(mZoomRatioRangeArray[i])) { await startCameraSession(i); - await mCameraSession.setZoomRatio((mZoomRatioMinArray[i] - 0.1)); + mCameraSession.setZoomRatio((mZoomRatioMinArray[i] - 0.1)); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_PROMISE_0104 finish"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_PROMISE_0104 PASSED with ZoomRatio is: " + (mZoomRatioMaxArray[i] - 0.1)); - await sleep(500); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_PROMISE_0104 PASSED with ZoomRatio is: " + (mZoomRatioMaxArray[i] - 0.1)); - let zoomRatio = await mCameraSession.getZoomRatio(); + let zoomRatio = mCameraSession.getZoomRatio(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_PROMISE_0104 finish"); if (zoomRatio != (mZoomRatioMinArray[i] - 0.1)) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_PROMISE_0104 PASSED with ZoomRatio is: " + zoomRatio); @@ -1207,7 +796,6 @@ export default function cameraSessionZoomRatioTest() { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_ZOOM_RATIO_PROMISE_0104 FAILED with ZoomRatio is: " + zoomRatio); expect().assertFail(); } - await sleep(500); await stopCameraSession(); } diff --git a/multimedia/camera/camera_js_standard/signature/openharmony_sx.p7b b/multimedia/camera/camera_js_standard/signature/openharmony_sx.p7b index 213210f95effdfdc405d437507054e273b75377c..38ccaaf4f810da90bfcb46740a3300bfdd12a4a8 100644 Binary files a/multimedia/camera/camera_js_standard/signature/openharmony_sx.p7b and b/multimedia/camera/camera_js_standard/signature/openharmony_sx.p7b differ