From 6ef59106087c8774a680a8e6f9a2f5f006084034 Mon Sep 17 00:00:00 2001 From: yygxr Date: Wed, 12 Oct 2022 00:58:41 -0700 Subject: [PATCH] fix camera session and manager test case error Signed-off-by: yygxr --- .../test/CameraJSUnitOutput.test.ets | 4 +- .../test/CameraManagerTest.test.ets | 486 +++++++----------- .../test/CameraSessionBaseTest.test.ets | 98 ---- .../test/CameraSessionExposureTest.test.ets | 4 +- .../test/CameraSessionFlashTest.test.ets | 4 +- .../test/CameraSessionFocusTest.test.ets | 4 +- ...meraSessionVideoStabilizationTest.test.ets | 4 +- .../test/CameraSessionZoomRatioTest.test.ets | 4 +- 8 files changed, 209 insertions(+), 399 deletions(-) mode change 100644 => 100755 multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraJSUnitOutput.test.ets mode change 100644 => 100755 multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraManagerTest.test.ets diff --git a/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraJSUnitOutput.test.ets b/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraJSUnitOutput.test.ets old mode 100644 new mode 100755 index 2d0853ade..342a625dc --- a/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraJSUnitOutput.test.ets +++ b/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraJSUnitOutput.test.ets @@ -43,7 +43,7 @@ let videoConfig = { audioSourceType: 1, videoSourceType: 0, profile: videoProfile, - url: 'file:///data/media/01.mp4', + url: 'file:///data/media/CameraOutput.mp4', orientationHint: 0, location: { latitude: 30, longitude: 130 }, maxSize: 100, @@ -115,7 +115,7 @@ export default function cameraJSUnitOutput(surfaceId: any) { async function getvideosurface() { - await getFd('02.mp4'); + await getFd('CameraOutput.mp4'); videoConfig.url = fdPath; media.createVideoRecorder((err, recorder) => { console.info(TAG + 'createVideoRecorder called') diff --git a/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraManagerTest.test.ets b/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraManagerTest.test.ets old mode 100644 new mode 100755 index 8d772fe99..cb935600d --- a/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraManagerTest.test.ets +++ b/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraManagerTest.test.ets @@ -51,7 +51,7 @@ let videoProfile = { audioSourceType: 1, videoSourceType: 0, profile: videoProfile, - url: 'file:///data/media/01.mp4', + url: 'file:///data/media/CameraManager.mp4', orientationHint: 0, location: { latitude: 30, longitude: 130 }, maxSize: 100, @@ -109,7 +109,7 @@ export default function cameraManagerTest(surfaceId: any) { } async function getvideosurface() { - await getFd('02.mp4'); + await getFd('CameraManager.mp4'); videoConfig.url = fdPath; media.createVideoRecorder((err, recorder) => { console.info(TAG + 'createVideoRecorder called') @@ -140,17 +140,22 @@ export default function cameraManagerTest(surfaceId: any) { } async function getCameraManagerInstance() { - mCameraManager = cameraObj.getCameraManager(null); + console.info('Enter getCameraManagerInstance'); + + mCameraManager = await cameraObj.getCameraManager(null); if (isEmpty(mCameraManager)) { console.info(TAG + "getCameraManager FAILED"); return false; } + await sleep(500); + + console.info('Exit getCameraManagerInstance'); return true; } async function getSupportedOutputCapabilityInCallback(cameraDevice) { if (isEmpty(mCameraManager)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 cameraManager == null || undefined") + console.info(TAG + "Entering getSupportedOutputCapabilityInCallback cameraManager == null || undefined") expect().assertFail(); return undefined; } @@ -162,24 +167,33 @@ export default function cameraManagerTest(surfaceId: any) { outputCapabilityCallback = data; expect(outputCapabilityCallback).assertNotNull(); } + else { + console.info(TAG + "getSupportedOutputCapabilityInCallback FAILED"); + expect().assertFail(); + } } else { console.info(TAG + "getSupportedOutputCapabilityInCallback FAILED: " + err.message); expect().assertFail(); } console.info(TAG + "getSupportedOutputCapabilityInCallback ends here"); }) + await sleep(100); return outputCapabilityCallback; } async function getSupportedOutputCapabilityInPromise(cameraDevice) { if (isEmpty(mCameraManager)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 cameraManager == null || undefined") + console.info(TAG + "Entering getSupportedOutputCapabilityInPromise cameraManager == null || undefined") expect().assertFail(); return undefined; } - let outputCapabilityPromise = mCameraManager.getSupportedOutputCapability(cameraDevice); - console.info("CameraUnitTest: Entering testSupportedOutputCapabilityPromise: " + JSON.stringify(outputCapabilityPromise)); - expect(isEmpty(outputCapabilityPromise)).assertFalse(); + let outputCapabilityPromise = await mCameraManager.getSupportedOutputCapability(cameraDevice); + if (isEmpty(outputCapabilityPromise)) { + console.info(TAG + "Entering getSupportedOutputCapabilityInPromise outputCapabilityPromise == null || undefined") + expect().assertFail(); + } else { + console.info("CameraUnitTest: Entering testSupportedOutputCapabilityPromise: " + JSON.stringify(outputCapabilityPromise)); + } return outputCapabilityPromise; } @@ -326,41 +340,44 @@ describe('CameraManagerTest', function () { expect().assertFail(); } mCameraManager.getSupportedCameras(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 success"); - if (isEmpty(data)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 data is not null || undefined"); - mCameraDevicesArray = data; - if (mCameraDevicesArray != null && 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_CAMERAS_CALLBACK_0100 camera" + i + "Id: " + cameraId); - let cameraPosition = mCameraDevicesArray[i].cameraPosition; - expect(isEmpty(cameraPosition)).assertFalse(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 camera" + i + "Position: " + cameraPosition); - let cameraType = mCameraDevicesArray[i].cameraType; - expect(isEmpty(cameraType)).assertFalse(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 camera" + i + "Type: " + cameraType); - let connectionType = mCameraDevicesArray[i].connectionType - expect(isEmpty(connectionType)).assertFalse(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 connection" + i + "Type: " + connectionType); + if (!err) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 success"); + if (!isEmpty(data)) { + mCameraDevicesArray = data; + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_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_CAMERAS_CALLBACK_0100 camera" + i + "Id: " + cameraId); + let cameraPosition = mCameraDevicesArray[i].cameraPosition; + expect(isEmpty(cameraPosition)).assertFalse(); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 camera" + i + "Position: " + cameraPosition); + let cameraType = mCameraDevicesArray[i].cameraType; + expect(isEmpty(cameraType)).assertFalse(); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 camera" + i + "Type: " + cameraType); + let connectionType = mCameraDevicesArray[i].connectionType + expect(isEmpty(connectionType)).assertFalse(); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 connection" + i + "Type: " + connectionType); + } + expect(true).assertTrue(); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED cameraArray is null || undefined"); } - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 PASSED"); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 ends here"); + await sleep(1000); + done(); } else { expect().assertFail(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED cameraArray is null || undefined"); } + } else { + expect().assertFail(); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED , err = " + err.message); } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); }) await sleep(1000); done(); @@ -425,20 +442,35 @@ describe('CameraManagerTest', function () { let camerasArray = mCameraDevicesArray; for (let i = 0; i < camerasArray.length; i++) { let cameraOutputCap = await getSupportedOutputCapabilityInCallback(camerasArray[i]); + await sleep(100); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_CALLBACK_0100 camera:" + camerasArray[i].cameraId); - expect(isEmpty(cameraOutputCap)).assertFalse(); + if (isEmpty(cameraOutputCap)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_CALLBACK_0100 cameraOutputCap == null || undefined") + expect().assertFail(); + } let previewProfilesArray = cameraOutputCap.previewProfiles; - expect(isEmpty(previewProfilesArray)).assertFalse(); + if (isEmpty(previewProfilesArray)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_CALLBACK_0100 previewProfilesArray == null || undefined") + expect().assertFail(); + } let photoProfilesArray = cameraOutputCap.photoProfiles; - expect(isEmpty(photoProfilesArray)).assertFalse(); + if (isEmpty(photoProfilesArray)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_CALLBACK_0100 photoProfilesArray == null || undefined") + expect().assertFail(); + } - let videoProfilesArray = cameraOutputCap.photoProfiles; - expect(isEmpty(videoProfilesArray)).assertFalse(); + let videoProfilesArray = cameraOutputCap.videoProfiles; + if (isEmpty(videoProfilesArray)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_CALLBACK_0100 videoProfilesArray == null || undefined") + expect().assertFail(); + } let metadataObjectTypesArray = cameraOutputCap.supportedMetadataObjectTypes; - expect(isEmpty(metadataObjectTypesArray)).assertFalse(); + if (isEmpty(metadataObjectTypesArray)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_CALLBACK_0100 metadataObjectTypesArray == null || undefined") + } 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"); @@ -456,24 +488,38 @@ describe('CameraManagerTest', function () { */ it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_PROMISE_0100', 0, async function (done) { console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_PROMISE_0100--------------"); - let camerasArray = mCameraDevicesArray; - for (let i = 0; i < camerasArray.length; i++) { - let cameraOutputCap = await getSupportedOutputCapabilityInPromise(camerasArray[i]); - console.info("Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_PROMISE_0100 camera:" + camerasArray[i].cameraId); - expect(isEmpty(cameraOutputCap)).assertFalse(); + for (let i = 0; i < mCameraDevicesArray.length; i++) { + let cameraOutputCap = await getSupportedOutputCapabilityInPromise(mCameraDevicesArray[i]); + console.info("Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_PROMISE_0100 camera:" + mCameraDevicesArray[i].cameraId); + if (isEmpty(cameraOutputCap)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_PROMISE_0100 cameraOutputCap == null || undefined") + expect().assertFail(); + } let previewProfilesArray = cameraOutputCap.previewProfiles; - expect(isEmpty(previewProfilesArray)).assertFalse(); + if (isEmpty(previewProfilesArray)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_PROMISE_0100 previewProfilesArray == null || undefined") + expect().assertFail(); + } let photoProfilesArray = cameraOutputCap.photoProfiles; - expect(isEmpty(photoProfilesArray)).assertFalse(); + if (isEmpty(photoProfilesArray)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_PROMISE_0100 photoProfilesArray == null || undefined") + expect().assertFail(); + } - let videoProfilesArray = cameraOutputCap.photoProfiles; + let videoProfilesArray = cameraOutputCap.videoProfiles; + if (isEmpty(videoProfilesArray)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_PROMISE_0100 videoProfilesArray == null || undefined") + expect().assertFail(); + } expect(isEmpty(videoProfilesArray)).assertFalse(); let metadataObjectTypesArray = cameraOutputCap.supportedMetadataObjectTypes; - expect(isEmpty(metadataObjectTypesArray)).assertFalse(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_PROMISE_0100 PASSED camera:" + camerasArray[i].cameraId); + if (isEmpty(metadataObjectTypesArray)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_PROMISE_0100 metadataObjectTypesArray == null || undefined") + } + 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); @@ -494,10 +540,16 @@ describe('CameraManagerTest', function () { for (let i = 0; i < camerasArray.length; i++) { let cameraOutputCap = await getSupportedOutputCapabilityInPromise(camerasArray[i]); console.info("Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_PROFILES_0100 camera:" + camerasArray[i].cameraId); - expect(isEmpty(cameraOutputCap)).assertFalse(); + if (isEmpty(cameraOutputCap)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_PROFILES_0100 cameraOutputCap == null || undefined") + expect().assertFail(); + } let previewProfilesArray = cameraOutputCap.previewProfiles; - expect(isEmpty(previewProfilesArray)).assertFalse(); + if (isEmpty(previewProfilesArray)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_PROFILES_0100 previewProfilesArray == null || undefined") + expect().assertFail(); + } for (let i = 0; i < previewProfilesArray.length; i++) { let previewProfilesFormat = previewProfilesArray[i].format; @@ -527,10 +579,16 @@ describe('CameraManagerTest', function () { for (let i = 0; i < camerasArray.length; i++) { let cameraOutputCap = await getSupportedOutputCapabilityInPromise(camerasArray[i]); console.info("Entering SUB_MULTIMEDIA_CAMERA_PHOTO_PROFILES_0100 camera:" + camerasArray[i].cameraId); - expect(isEmpty(cameraOutputCap)).assertFalse(); + if (isEmpty(cameraOutputCap)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_PROFILES_0100 cameraOutputCap == null || undefined") + expect().assertFail(); + } let photoProfilesArray = cameraOutputCap.photoProfiles; - expect(isEmpty(photoProfilesArray)).assertFalse(); + if (isEmpty(cameraOutputCap)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_PROFILES_0100 photoProfilesArray == null || undefined") + expect().assertFail(); + } for (let i = 0; i < photoProfilesArray.length; i++) { let photoProfilesFormat = photoProfilesArray[i].format; @@ -560,10 +618,16 @@ describe('CameraManagerTest', function () { for (let i = 0; i < camerasArray.length; i++) { let cameraOutputCap = await getSupportedOutputCapabilityInPromise(camerasArray[i]); console.info("Entering SUB_MULTIMEDIA_CAMERA_VIDEO_PROFILES_0100 camera:" + camerasArray[i].cameraId); - expect(isEmpty(cameraOutputCap)).assertFalse(); + if (isEmpty(cameraOutputCap)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEO_PROFILES_0100 cameraOutputCap == null || undefined") + expect().assertFail(); + } let videoProfilesArray = cameraOutputCap.videoProfiles; - expect(isEmpty(videoProfilesArray)).assertFalse(); + if (isEmpty(videoProfilesArray)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEO_PROFILES_0100 videoProfilesArray == null || undefined") + expect().assertFail(); + } for (let i = 0; i < videoProfilesArray.length; i++) { let videoProfilesFormat = videoProfilesArray[i].format; @@ -582,36 +646,6 @@ describe('CameraManagerTest', function () { done(); }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_METADATA_OBJECT_TYPES_0100 - * @tc.name : Get supported preview formats from camera-0 camerainput promise api - * @tc.desc : Get supported preview formats from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_METADATA_OBJECT_TYPES_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_METADATA_OBJECT_TYPES_0100--------------"); - let camerasArray = mCameraDevicesArray; - for (let i = 0; i < camerasArray.length; i++) { - let cameraOutputCap = await getSupportedOutputCapabilityInPromise(camerasArray[i]); - console.info("Entering SUB_MULTIMEDIA_CAMERA_METADATA_OBJECT_TYPES_0100 camera:" + camerasArray[i].cameraId); - expect(isEmpty(cameraOutputCap)).assertFalse(); - - let metadataObjectTypesArray = cameraOutputCap.supportedMetadataObjectTypes; - expect(isEmpty(metadataObjectTypesArray)).assertFalse(); - - for (let i = 0; i < metadataObjectTypesArray.length; i++) { - let metadataObjectType = metadataObjectTypesArray[i]; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_METADATA_OBJECT_TYPES_0100 metadataObjectType: " + metadataObjectType); - } - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_METADATA_OBJECT_TYPES_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 @@ -630,7 +664,10 @@ describe('CameraManagerTest', function () { for (let i = 0; i < camerasArray.length; i++) { mCameraManager.createCameraInput(camerasArray[i], async (err, data) => { if (!err) { - expect(isEmpty(data)).assertFalse(); + 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(); @@ -662,7 +699,10 @@ describe('CameraManagerTest', function () { let camerasArray = mCameraDevicesArray; for (let i = 0; i < camerasArray.length; i++) { let cameraInputPromise = await mCameraManager.createCameraInput(camerasArray[i]); - expect(isEmpty(cameraInputPromise)).assertFalse(); + if (isEmpty(cameraInputPromise)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 cameraInputPromise == null || undefined") + expect().assertFail(); + } console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera: " + camerasArray[i].cameraId); } } @@ -671,63 +711,6 @@ describe('CameraManagerTest', function () { 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 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_CALLBACK_0100', 0, 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) { - expect(isEmpty(data)).assertFalse(); - 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(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_PROMISE_0100 - * @tc.name : Create camerainput from camera-0 cameraposition back & cameratype unspecified promise api - * @tc.desc : Create camerainput from camera-0 cameraposition back & cameratype unspecified promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_PROMISE_0100--------------"); - if (isEmpty(mCameraManager)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_PROMISE_0100 cameraManager == null || undefined") - expect().assertFail(); - } else { - let camerasArray = mCameraDevicesArray; - for (let i = 0; i < camerasArray.length; i++) { - let cameraInputPromiseByType = await mCameraManager.createCameraInput(camerasArray[i].cameraPosition, camerasArray[i].cameraType); - expect(isEmpty(cameraInputPromiseByType)).assertFalse(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_PROMISE_0100 camera: " + camerasArray[i].cameraId); - } - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) /*CREATE CAMERAOUTPUT*/ /** @@ -747,10 +730,16 @@ describe('CameraManagerTest', function () { expect(isEmpty(cameraOutputCap)).assertFalse(); let previewProfilesArray = cameraOutputCap.previewProfiles; - expect(isEmpty(previewProfilesArray)).assertFalse(); + if (isEmpty(previewProfilesArray)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PREVIEW_OUTPUT_CALLBACK_0100 previewProfilesArray == null || undefined") + expect().assertFail(); + } for (let j = 0; j < previewProfilesArray.length; j++) { mCameraManager.createPreviewOutput(previewProfilesArray[j], surfaceId, async (err, data) => { - expect(isEmpty(data)).assertFalse(); + if (isEmpty(data)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PREVIEW_OUTPUT_CALLBACK_0100 data == null || undefined") + expect().assertFail(); + } }) await sleep(10); done(); @@ -775,18 +764,27 @@ describe('CameraManagerTest', function () { for (let i = 0; i < camerasArray.length; i++) { let cameraOutputCap = await getSupportedOutputCapabilityInPromise(camerasArray[i]); console.info("SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PREVIEW_OUTPUT_PROMISE_0100 camera:" + camerasArray[i].cameraId); - expect(isEmpty(cameraOutputCap)).assertFalse(); + if (isEmpty(cameraOutputCap)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PREVIEW_OUTPUT_PROMISE_0100 cameraOutputCap == null || undefined") + expect().assertFail(); + } let previewProfilesArray = cameraOutputCap.previewProfiles; - expect(isEmpty(previewProfilesArray)).assertFalse(); + if (isEmpty(previewProfilesArray)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PREVIEW_OUTPUT_PROMISE_0100 previewProfilesArray == null || undefined") + expect().assertFail(); + } for (let j = 0; j < previewProfilesArray.length; j++) { let previewOutputPromise = await mCameraManager.createPreviewOutput(previewProfilesArray[j], surfaceId); - expect(isEmpty(previewOutputPromise)).assertFalse(); + if (isEmpty(previewOutputPromise)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PREVIEW_OUTPUT_PROMISE_0100 previewOutputPromise == null || undefined") + expect().assertFail(); + } await sleep(10); done(); } } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PREVIEW_OUTPUT_CALLBACK_0100 PASS"); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PREVIEW_OUTPUT_PROMISE_0100 PASS"); await sleep(1000); done(); }) @@ -805,13 +803,22 @@ describe('CameraManagerTest', function () { 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); - expect(isEmpty(cameraOutputCap)).assertFalse(); + if (isEmpty(cameraOutputCap)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PHOTO_OUTPUT_CALLBACK_0100 cameraOutputCap == null || undefined") + expect().assertFail(); + } let photoProfilesArray = cameraOutputCap.photoProfiles; - expect(isEmpty(photoProfilesArray)).assertFalse(); + if (isEmpty(photoProfilesArray)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PHOTO_OUTPUT_CALLBACK_0100 photoProfilesArray == null || undefined") + expect().assertFail(); + } for (let j = 0; j < photoProfilesArray.length; j++) { mCameraManager.createPhotoOutput(photoProfilesArray[j], photoSurfaceId, async (err, data) => { - expect(isEmpty(data)).assertFalse(); + if (isEmpty(data)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PHOTO_OUTPUT_CALLBACK_0100 data == null || undefined") + expect().assertFail(); + } }) await sleep(10); done(); @@ -836,13 +843,22 @@ describe('CameraManagerTest', function () { for (let i = 0; i < camerasArray.length; i++) { let cameraOutputCap = await getSupportedOutputCapabilityInPromise(camerasArray[i]); console.info("SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PHOTO_OUTPUT_PROMISE_0100 camera:" + camerasArray[i].cameraId); - expect(isEmpty(cameraOutputCap)).assertFalse(); + if (isEmpty(cameraOutputCap)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PHOTO_OUTPUT_PROMISE_0100 cameraOutputCap == null || undefined") + expect().assertFail(); + } let photoProfilesArray = cameraOutputCap.photoProfiles; - expect(isEmpty(photoProfilesArray)).assertFalse(); + if (isEmpty(photoProfilesArray)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PHOTO_OUTPUT_PROMISE_0100 photoProfilesArray == null || undefined") + expect().assertFail(); + } for (let j = 0; j < photoProfilesArray.length; j++) { let photoOutputPromise = await mCameraManager.createPhotoOutput(photoProfilesArray[j], photoSurfaceId); - expect(isEmpty(photoOutputPromise)).assertFalse(); + if (isEmpty(photoOutputPromise)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PHOTO_OUTPUT_PROMISE_0100 photoOutputPromise == null || undefined") + expect().assertFail(); + } await sleep(10); done(); } @@ -852,128 +868,6 @@ describe('CameraManagerTest', function () { 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 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_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_VIDEO_OUTPUT_CALLBACK_0100 camera:" + camerasArray[i].cameraId); - expect(isEmpty(cameraOutputCap)).assertFalse(); - - let videoProfilesArray = cameraOutputCap.videoProfiles; - expect(isEmpty(videoProfilesArray)).assertFalse(); - for (let j = 0; j < videoProfilesArray.length; j++) { - mCameraManager.createVideoOutput(videoProfilesArray[j], videoSurfaceId, async (err, data) => { - expect(isEmpty(data)).assertFalse(); - }) - await sleep(10); - done(); - } - } - 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 - * @tc.name : Create camerainput from camera-0 cameraposition front & cameratype unspecified async api - * @tc.desc : Create camerainput from camera-0 cameraposition front & cameratype unspecified async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_PROMISE_0100', 0, async function (done) { - 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]); - console.info("SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_PROMISE_0100 camera:" + camerasArray[i].cameraId); - expect(isEmpty(cameraOutputCap)).assertFalse(); - - let videoProfilesArray = cameraOutputCap.videoProfiles; - expect(isEmpty(videoProfilesArray)).assertFalse(); - for (let j = 0; j < videoProfilesArray.length; j++) { - let videoOutputPromise = await mCameraManager.createVideoOutput(videoProfilesArray[j], videoSurfaceId); - expect(isEmpty(videoOutputPromise)).assertFalse(); - await sleep(10); - done(); - } - } - 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 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_CALLBACK_0100', 0, 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); - expect(isEmpty(cameraOutputCap)).assertFalse(); - - let metadataObjectTypeArray = cameraOutputCap.supportedMetadataObjectTypes; - expect(isEmpty(metadataObjectTypeArray)).assertFalse(); - for (let j = 0; j < metadataObjectTypeArray.length; j++) { - mCameraManager.createMetadataOutput(metadataObjectTypeArray[j], async (err, data) => { - expect(isEmpty(data)).assertFalse(); - }) - await sleep(10); - done(); - } - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_CALLBACK_0100 PASS"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_PROMISE_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 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_PROMISE_0100', 0, async function (done) { - 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]); - console.info("SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_PROMISE_0100 camera:" + camerasArray[i].cameraId); - expect(isEmpty(cameraOutputCap)).assertFalse(); - - let metadataObjectTypeArray = cameraOutputCap.supportedMetadataObjectTypes; - expect(isEmpty(metadataObjectTypeArray)).assertFalse(); - for (let j = 0; j < metadataObjectTypeArray.length; j++) { - let metadataOutputPromise = await mCameraManager.createMetadataOutput(metadataObjectTypeArray[j]); - expect(isEmpty(metadataOutputPromise)).assertFalse(); - await sleep(10); - done(); - } - } - 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 @@ -982,13 +876,19 @@ describe('CameraManagerTest', function () { * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100', 0, async function (done) { + it('SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100', 0, async function (done) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100 to operate"); - mCameraManager.createCaptureSession(null, async (err, data) => { + let cameraSession; + mCameraManager.createCaptureSession(async (err, data) => { if (!err) { console.info(TAG + "Entering createCaptureSession success"); - expect(isEmpty(data)).assertFalse(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100 PASSED"); + if (isEmpty(data)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100 data == null || undefined") + expect().assertFail(); + } else { + cameraSession = data; + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100 PASSED"); + } } else { expect().assertFail(); console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100 FAILED : " + err.message); @@ -998,6 +898,7 @@ describe('CameraManagerTest', function () { done(); }) await sleep(1000); + await cameraSession.release(); done(); }) @@ -1011,10 +912,14 @@ describe('CameraManagerTest', function () { */ it('SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100', 0, async function (done) { console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 to operate"); - let captureSessionPromise = await mCameraManager.createCaptureSession(null); - expect(isEmpty(captureSessionPromise)).assertFalse(); + let captureSessionPromise = await 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(); }) @@ -1035,7 +940,10 @@ describe('CameraManagerTest', function () { mCameraManager.on('cameraStatus', async (err, data) => { if (!err) { console.info(TAG + "Camera status Callback on cameraManager is success"); - expect(isEmpty(data)).assertFalse(); + 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 { diff --git a/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionBaseTest.test.ets b/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionBaseTest.test.ets index d00b58071..b6e686790 100755 --- a/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionBaseTest.test.ets +++ b/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionBaseTest.test.ets @@ -873,104 +873,6 @@ export default function cameraSessionTest(surfaceId: any) { } }) - /** - * @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--------------"); - - if (isEmpty(mCameraInputArray)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_CALLBACK_0100 FAILED with NoCamera"); - expect().assertFail(); - done(); - } - else { - for (let i = 0; i < mCameraInputArray.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_CALLBACK_0100 start for camera[" + i + "]"); - - await startCameraSession(i); - - 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(i); - - 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"); - 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.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_PROMISE_0100--------------"); - - if (isEmpty(mCameraInputArray)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_PROMISE_0100 FAILED with NoCamera"); - expect().assertFail(); - done(); - } - else { - for (let i = 0; i < mCameraInputArray.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_PROMISE_0100 start for camera[" + i + "]"); - - await startCameraSession(i); - - 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(i); - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_PROMISE_0100 end for camera[" + i + "]"); - } - - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_PROMISE_0100 ends here"); - done(); - } - }) - /** * @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_INPUT_CALLBACK_0100 * @tc.name : Check capture session add/remove input with callback or not diff --git a/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionExposureTest.test.ets b/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionExposureTest.test.ets index 521c5d3d3..85ca0bfe7 100755 --- a/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionExposureTest.test.ets +++ b/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionExposureTest.test.ets @@ -594,7 +594,7 @@ export default function cameraSessionExposureTest(surfaceId: any) { sleep(100); await applyPermission(); await getPhotoReceiverSurface(); - //await getVideoReceiveSurface(); + await getVideoReceiveSurface(); await getCameraManagerInstance(); await getCameraSupportDevicesArray(); await createCameraSessionInstance(); @@ -618,7 +618,7 @@ export default function cameraSessionExposureTest(surfaceId: any) { afterAll(function () { releaseInputs(); releaseOutputs(); - //releaseVideoReceiveSurface(); + releaseVideoReceiveSurface(); releaseCameraSessionInstance(); sleep(100); console.info('afterAll case'); diff --git a/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionFlashTest.test.ets b/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionFlashTest.test.ets index f64a30f8b..6cd9f106f 100755 --- a/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionFlashTest.test.ets +++ b/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionFlashTest.test.ets @@ -545,7 +545,7 @@ export default function cameraSessionFlashTest(surfaceId: any) { sleep(100); await applyPermission(); await getPhotoReceiverSurface(); - //await getVideoReceiveSurface(); + await getVideoReceiveSurface(); await mgetCameraManagerInstance(); await getCameraSupportDevicesArray(); await createCameraSessionInstance(); @@ -569,7 +569,7 @@ export default function cameraSessionFlashTest(surfaceId: any) { afterAll(function () { releaseInputs(); releaseOutputs(); - //releaseVideoReceiveSurface(); + releaseVideoReceiveSurface(); releaseCameraSessionInstance(); sleep(100); console.info('afterAll case'); diff --git a/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionFocusTest.test.ets b/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionFocusTest.test.ets index 550b0818e..5da2193d4 100755 --- a/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionFocusTest.test.ets +++ b/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionFocusTest.test.ets @@ -590,7 +590,7 @@ export default function cameraSessionFocusTest(surfaceId: any) { sleep(100); await applyPermission(); await getPhotoReceiverSurface(); - //await getVideoReceiveSurface(); + await getVideoReceiveSurface(); await getCameraManagerInstance(); await getCameraSupportDevicesArray(); await createCameraSessionInstance(); @@ -614,7 +614,7 @@ export default function cameraSessionFocusTest(surfaceId: any) { afterAll(function () { releaseInputs(); releaseOutputs(); - //releaseVideoReceiveSurface(); + releaseVideoReceiveSurface(); releaseCameraSessionInstance(); sleep(100); console.info('afterAll case'); diff --git a/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionVideoStabilizationTest.test.ets b/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionVideoStabilizationTest.test.ets index 62390d073..8edfaa938 100755 --- a/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionVideoStabilizationTest.test.ets +++ b/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionVideoStabilizationTest.test.ets @@ -543,7 +543,7 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) { sleep(100); await applyPermission(); await getPhotoReceiverSurface(); - //await getVideoReceiveSurface(); + await getVideoReceiveSurface(); await getCameraManagerInstance(); await getCameraSupportDevicesArray(); await createCameraSessionInstance(); @@ -567,7 +567,7 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) { afterAll(function () { releaseInputs(); releaseOutputs(); - //releaseVideoReceiveSurface(); + releaseVideoReceiveSurface(); releaseCameraSessionInstance(); sleep(100); console.info('afterAll case'); diff --git a/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionZoomRatioTest.test.ets b/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionZoomRatioTest.test.ets index 056edd367..e93e50c85 100755 --- a/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionZoomRatioTest.test.ets +++ b/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionZoomRatioTest.test.ets @@ -548,7 +548,7 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) { await applyPermission(); await getPhotoReceiverSurface(); - //await getVideoReceiveSurface(); + await getVideoReceiveSurface(); await getCameraManagerInstance(); await getCameraSupportDevicesArray(); await createCameraSessionInstance(); @@ -572,7 +572,7 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) { afterAll(function () { releaseInputs(); releaseOutputs(); - //releaseVideoReceiveSurface(); + releaseVideoReceiveSurface(); releaseCameraSessionInstance(); sleep(100); console.info('afterAll case'); -- GitLab