From c9e5f8246217a5af8178a57edbc2c87c793c8c1b Mon Sep 17 00:00:00 2001 From: yygxr Date: Thu, 13 Oct 2022 03:12:28 -0700 Subject: [PATCH] fix session xts case error Signed-off-by: yygxr --- .../test/CameraSessionBaseTest.test.ets | 69 ++++++++++--------- .../test/CameraSessionExposureTest.test.ets | 8 +++ .../test/CameraSessionFlashTest.test.ets | 8 +++ .../test/CameraSessionFocusTest.test.ets | 8 +++ ...meraSessionVideoStabilizationTest.test.ets | 8 +++ .../test/CameraSessionZoomRatioTest.test.ets | 8 +++ 6 files changed, 75 insertions(+), 34 deletions(-) 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 af9e55aad..1a9518ded 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 @@ -397,39 +397,40 @@ export default function cameraSessionTest(surfaceId: any) { console.info(TAG + "createPreviewOutput FAILED"); } } + } - if (!isEmpty(cameraOutputCap.photoProfiles)) { - console.info(TAG + "cameraOutputCap.photoProfiles.length: " + cameraOutputCap.photoProfiles.length); - - for (let j = 0; j < cameraOutputCap.photoProfiles.length; j++) { - mPhotoOutputArray[i] = await mCameraManager.createPhotoOutput(cameraOutputCap.photoProfiles[j], mPhoteSurface); - if (!isEmpty(mPhotoOutputArray[i])) { - break; - } - } - - if (isEmpty(mPhotoOutputArray[i])) { - console.info(TAG + "createPhotoOutput FAILED"); + let cameraOutputCap = await mCameraManager.getSupportedOutputCapability(mCameraDevicesArray[0]); + if (!isEmpty(cameraOutputCap.photoProfiles)) { + console.info(TAG + "cameraOutputCap.photoProfiles.length: " + cameraOutputCap.photoProfiles.length); + + for (let j = 0; j < cameraOutputCap.photoProfiles.length; j++) { + mPhotoOutputArray[0] = await mCameraManager.createPhotoOutput(cameraOutputCap.photoProfiles[j], mPhoteSurface); + if (!isEmpty(mPhotoOutputArray[0])) { + break; } + } - console.info(TAG + "createPhotoOutput: " + mPhotoOutputArray[i]); + if (isEmpty(mPhotoOutputArray[0])) { + console.info(TAG + "createPhotoOutput FAILED"); } - if (!isEmpty(cameraOutputCap.videoProfiles)) { - console.info(TAG + "cameraOutputCap.videoProfiles.length: " + cameraOutputCap.videoProfiles.length); - for (let j = 0; j < cameraOutputCap.videoProfiles.length; j++) { - mVideoOutputArray[i] = await mCameraManager.createVideoOutput(cameraOutputCap.videoProfiles[j], mVideoSurface); - if (!isEmpty(mVideoOutputArray[i])) { - break; - } - } + console.info(TAG + "createPhotoOutput: " + mPhotoOutputArray[0]); + } - if (isEmpty(mVideoOutputArray[i])) { - console.info(TAG + "createVideoOutput FAILED"); + if (!isEmpty(cameraOutputCap.videoProfiles)) { + console.info(TAG + "cameraOutputCap.videoProfiles.length: " + cameraOutputCap.videoProfiles.length); + for (let j = 0; j < cameraOutputCap.videoProfiles.length; j++) { + mVideoOutputArray[0] = await mCameraManager.createVideoOutput(cameraOutputCap.videoProfiles[j], mVideoSurface); + if (!isEmpty(mVideoOutputArray[0])) { + break; } + } - console.info(TAG + "createVideoOutput: " + mPhotoOutputArray[i]); + if (isEmpty(mVideoOutputArray[0])) { + console.info(TAG + "createVideoOutput FAILED"); } + + console.info(TAG + "createVideoOutput: " + mPhotoOutputArray[0]); } console.info('Exit createOutputs'); @@ -443,16 +444,16 @@ export default function cameraSessionTest(surfaceId: any) { await mPreviewOutputArray[i].close(); await mPreviewOutputArray[i].release(); } - - if (!isEmpty(mPhotoOutputArray[i])) { - await mPhotoOutputArray[i].close(); - await mPhotoOutputArray[i].release(); - } - - if (!isEmpty(mVideoOutputArray[i])) { - await mVideoOutputArray[i].close(); - await mVideoOutputArray[i].release(); - } + } + + if (!isEmpty(mPhotoOutputArray[0])) { + await mPhotoOutputArray[0].close(); + await mPhotoOutputArray[0].release(); + } + + if (!isEmpty(mVideoOutputArray[0])) { + await mVideoOutputArray[0].close(); + await mVideoOutputArray[0].release(); } return true; 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 84b2754b3..e6f2d3821 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 @@ -444,6 +444,7 @@ export default function cameraSessionExposureTest(surfaceId: any) { } } + /* if (!isEmpty(cameraOutputCap.photoProfiles)) { console.info(TAG + "cameraOutputCap.photoProfiles.length: " + cameraOutputCap.photoProfiles.length); @@ -476,6 +477,7 @@ export default function cameraSessionExposureTest(surfaceId: any) { console.info(TAG + "createVideoOutput: " + mPhotoOutputArray[i]); } + */ } console.info('Exit createOutputs'); @@ -490,6 +492,7 @@ export default function cameraSessionExposureTest(surfaceId: any) { await mPreviewOutputArray[i].release(); } + /* if (!isEmpty(mPhotoOutputArray[i])) { await mPhotoOutputArray[i].close(); await mPhotoOutputArray[i].release(); @@ -499,6 +502,7 @@ export default function cameraSessionExposureTest(surfaceId: any) { await mVideoOutputArray[i].close(); await mVideoOutputArray[i].release(); } + */ } return true; @@ -517,6 +521,7 @@ export default function cameraSessionExposureTest(surfaceId: any) { await mCameraSession.addOutput(mPreviewOutputArray[idx]); } + /* if (!isEmpty(mPhotoOutputArray[idx])) { console.info(TAG + "Start to addOutput mPhotoOutput"); await mCameraSession.addOutput(mPhotoOutputArray[idx]); @@ -526,6 +531,7 @@ export default function cameraSessionExposureTest(surfaceId: any) { console.info(TAG + "Start to addOutput mVideoOutput"); await mCameraSession.addOutput(mVideoOutputArray[idx]); } + */ await commitCameraSessionConfig(); await beginCameraSessionConfig(); @@ -572,6 +578,7 @@ export default function cameraSessionExposureTest(surfaceId: any) { await mCameraSession.removeOutput(mPreviewOutputArray[idx]); } + /* if (!isEmpty(mPhotoOutputArray[idx])) { console.info(TAG + "Start to removeOutput mPhotoOutput"); await mCameraSession.removeOutput(mPhotoOutputArray[idx]); @@ -581,6 +588,7 @@ export default function cameraSessionExposureTest(surfaceId: any) { console.info(TAG + "Start to removeOutput mVideoOutput"); await mCameraSession.removeOutput(mVideoOutputArray[idx]); } + */ console.info(TAG + "Exit stopCameraSession"); 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 e919801f6..2ab4daf12 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 @@ -395,6 +395,7 @@ export default function cameraSessionFlashTest(surfaceId: any) { } } + /* if (!isEmpty(cameraOutputCap.photoProfiles)) { console.info(TAG + "cameraOutputCap.photoProfiles.length: " + cameraOutputCap.photoProfiles.length); @@ -427,6 +428,7 @@ export default function cameraSessionFlashTest(surfaceId: any) { console.info(TAG + "createVideoOutput: " + mPhotoOutputArray[i]); } + */ } console.info('Exit createOutputs'); @@ -441,6 +443,7 @@ export default function cameraSessionFlashTest(surfaceId: any) { await mPreviewOutputArray[i].release(); } + /* if (!isEmpty(mPhotoOutputArray[i])) { await mPhotoOutputArray[i].close(); await mPhotoOutputArray[i].release(); @@ -450,6 +453,7 @@ export default function cameraSessionFlashTest(surfaceId: any) { await mVideoOutputArray[i].close(); await mVideoOutputArray[i].release(); } + */ } return true; @@ -468,6 +472,7 @@ export default function cameraSessionFlashTest(surfaceId: any) { await mCameraSession.addOutput(mPreviewOutputArray[idx]); } + /* if (!isEmpty(mPhotoOutputArray[idx])) { console.info(TAG + "Start to addOutput mPhotoOutput"); await mCameraSession.addOutput(mPhotoOutputArray[idx]); @@ -477,6 +482,7 @@ export default function cameraSessionFlashTest(surfaceId: any) { console.info(TAG + "Start to addOutput mVideoOutput"); await mCameraSession.addOutput(mVideoOutputArray[idx]); } + */ await commitCameraSessionConfig(); await beginCameraSessionConfig(); @@ -523,6 +529,7 @@ export default function cameraSessionFlashTest(surfaceId: any) { await mCameraSession.removeOutput(mPreviewOutputArray[idx]); } + /* if (!isEmpty(mPhotoOutputArray[idx])) { console.info(TAG + "Start to removeOutput mPhotoOutput"); await mCameraSession.removeOutput(mPhotoOutputArray[idx]); @@ -532,6 +539,7 @@ export default function cameraSessionFlashTest(surfaceId: any) { console.info(TAG + "Start to removeOutput mVideoOutput"); await mCameraSession.removeOutput(mVideoOutputArray[idx]); } + */ console.info(TAG + "Exit stopCameraSession"); 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 6a80372db..dab67b724 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 @@ -440,6 +440,7 @@ export default function cameraSessionFocusTest(surfaceId: any) { } } + /* if (!isEmpty(cameraOutputCap.photoProfiles)) { console.info(TAG + "cameraOutputCap.photoProfiles.length: " + cameraOutputCap.photoProfiles.length); @@ -472,6 +473,7 @@ export default function cameraSessionFocusTest(surfaceId: any) { console.info(TAG + "createVideoOutput: " + mPhotoOutputArray[i]); } + */ } console.info('Exit createOutputs'); @@ -486,6 +488,7 @@ export default function cameraSessionFocusTest(surfaceId: any) { await mPreviewOutputArray[i].release(); } + /* if (!isEmpty(mPhotoOutputArray[i])) { await mPhotoOutputArray[i].close(); await mPhotoOutputArray[i].release(); @@ -495,6 +498,7 @@ export default function cameraSessionFocusTest(surfaceId: any) { await mVideoOutputArray[i].close(); await mVideoOutputArray[i].release(); } + */ } return true; @@ -513,6 +517,7 @@ export default function cameraSessionFocusTest(surfaceId: any) { await mCameraSession.addOutput(mPreviewOutputArray[idx]); } + /* if (!isEmpty(mPhotoOutputArray[idx])) { console.info(TAG + "Start to addOutput mPhotoOutput"); await mCameraSession.addOutput(mPhotoOutputArray[idx]); @@ -522,6 +527,7 @@ export default function cameraSessionFocusTest(surfaceId: any) { console.info(TAG + "Start to addOutput mVideoOutput"); await mCameraSession.addOutput(mVideoOutputArray[idx]); } + */ await commitCameraSessionConfig(); await beginCameraSessionConfig(); @@ -568,6 +574,7 @@ export default function cameraSessionFocusTest(surfaceId: any) { await mCameraSession.removeOutput(mPreviewOutputArray[idx]); } + /* if (!isEmpty(mPhotoOutputArray[idx])) { console.info(TAG + "Start to removeOutput mPhotoOutput"); await mCameraSession.removeOutput(mPhotoOutputArray[idx]); @@ -577,6 +584,7 @@ export default function cameraSessionFocusTest(surfaceId: any) { console.info(TAG + "Start to removeOutput mVideoOutput"); await mCameraSession.removeOutput(mVideoOutputArray[idx]); } + */ console.info(TAG + "Exit stopCameraSession"); 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 e8f60a687..eb58b6719 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 @@ -393,6 +393,7 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) { } } + /* if (!isEmpty(cameraOutputCap.photoProfiles)) { console.info(TAG + "cameraOutputCap.photoProfiles.length: " + cameraOutputCap.photoProfiles.length); @@ -425,6 +426,7 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) { console.info(TAG + "createVideoOutput: " + mPhotoOutputArray[i]); } + */ } console.info('Exit createOutputs'); @@ -439,6 +441,7 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) { await mPreviewOutputArray[i].release(); } + /* if (!isEmpty(mPhotoOutputArray[i])) { await mPhotoOutputArray[i].close(); await mPhotoOutputArray[i].release(); @@ -448,6 +451,7 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) { await mVideoOutputArray[i].close(); await mVideoOutputArray[i].release(); } + */ } return true; @@ -466,6 +470,7 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) { await mCameraSession.addOutput(mPreviewOutputArray[idx]); } + /* if (!isEmpty(mPhotoOutputArray[idx])) { console.info(TAG + "Start to addOutput mPhotoOutput"); await mCameraSession.addOutput(mPhotoOutputArray[idx]); @@ -475,6 +480,7 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) { console.info(TAG + "Start to addOutput mVideoOutput"); await mCameraSession.addOutput(mVideoOutputArray[idx]); } + */ await commitCameraSessionConfig(); await beginCameraSessionConfig(); @@ -521,6 +527,7 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) { await mCameraSession.removeOutput(mPreviewOutputArray[idx]); } + /* if (!isEmpty(mPhotoOutputArray[idx])) { console.info(TAG + "Start to removeOutput mPhotoOutput"); await mCameraSession.removeOutput(mPhotoOutputArray[idx]); @@ -530,6 +537,7 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) { console.info(TAG + "Start to removeOutput mVideoOutput"); await mCameraSession.removeOutput(mVideoOutputArray[idx]); } + */ console.info(TAG + "Exit stopCameraSession"); 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 c1945c998..abfc4b150 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 @@ -397,6 +397,7 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) { } } + /* if (!isEmpty(cameraOutputCap.photoProfiles)) { console.info(TAG + "cameraOutputCap.photoProfiles.length: " + cameraOutputCap.photoProfiles.length); @@ -429,6 +430,7 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) { console.info(TAG + "createVideoOutput: " + mPhotoOutputArray[i]); } + */ } console.info('Exit createOutputs'); @@ -443,6 +445,7 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) { await mPreviewOutputArray[i].release(); } + /* if (!isEmpty(mPhotoOutputArray[i])) { await mPhotoOutputArray[i].close(); await mPhotoOutputArray[i].release(); @@ -452,6 +455,7 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) { await mVideoOutputArray[i].close(); await mVideoOutputArray[i].release(); } + */ } return true; @@ -470,6 +474,7 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) { await mCameraSession.addOutput(mPreviewOutputArray[idx]); } + /* if (!isEmpty(mPhotoOutputArray[idx])) { console.info(TAG + "Start to addOutput mPhotoOutput"); await mCameraSession.addOutput(mPhotoOutputArray[idx]); @@ -479,6 +484,7 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) { console.info(TAG + "Start to addOutput mVideoOutput"); await mCameraSession.addOutput(mVideoOutputArray[idx]); } + */ await commitCameraSessionConfig(); await beginCameraSessionConfig(); @@ -525,6 +531,7 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) { await mCameraSession.removeOutput(mPreviewOutputArray[idx]); } + /* if (!isEmpty(mPhotoOutputArray[idx])) { console.info(TAG + "Start to removeOutput mPhotoOutput"); await mCameraSession.removeOutput(mPhotoOutputArray[idx]); @@ -534,6 +541,7 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) { console.info(TAG + "Start to removeOutput mVideoOutput"); await mCameraSession.removeOutput(mVideoOutputArray[idx]); } + */ console.info(TAG + "Exit stopCameraSession"); -- GitLab