diff --git a/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraInputTest.test.ets b/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraInputTest.test.ets index c60ba54e3fc496f50e37e366667a2ca2dc51ca72..ce7cb07a611bb0ee3b72681cb36699df71b2f088 100755 --- a/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraInputTest.test.ets +++ b/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraInputTest.test.ets @@ -222,7 +222,14 @@ export default function CameraInputTest(surfaceId) { return false; } - mCameraInput = await mCameraManager.createCameraInput(mCameraDevicesArray[idx]); + 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; 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 f9d10dfaa709e782bfcf3d40b4c631aab0be7c9e..dbf2ae93630bf293b88ebf700aa75ae78b7a0108 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 @@ -352,7 +352,14 @@ export default function cameraSessionTest(surfaceId: any) { return false; } - mCameraInput = await mCameraManager.createCameraInput(mCameraDevicesArray[idx]); + 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; @@ -935,28 +942,30 @@ export default function cameraSessionTest(surfaceId: any) { 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); - + 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(); @@ -991,13 +1000,15 @@ export default function cameraSessionTest(surfaceId: any) { await startCameraSession(i); - await mCameraSession.start(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_PROMISE_0100 start PASSED"); - await sleep(2000); + 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.stop(); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_PROMISE_0100 stop PASSED"); + await sleep(500); + } await beginCameraSessionConfig(); @@ -1525,60 +1536,63 @@ export default function cameraSessionTest(surfaceId: any) { await startCameraSession(i); - 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; - } + 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); + 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; } - await sleep(1); - }) + + 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.start(); - await beginCameraSessionConfig(); - - mCameraSession.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO); + await beginCameraSessionConfig(); + + mCameraSession.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO); - await commitCameraSessionConfig(); + await commitCameraSessionConfig(); - await sleep(100); + await sleep(100); - await beginCameraSessionConfig(); - - mCameraSession.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); + await beginCameraSessionConfig(); + + mCameraSession.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - await commitCameraSessionConfig(); - - await sleep(100); - - if (nfyFlag == false) { - //expect().assertFail(); - //console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0100 FAILED without any nofity!"); + await commitCameraSessionConfig(); + + 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 mCameraSession.stop(); + await beginCameraSessionConfig(); await stopCameraSession(); @@ -1613,30 +1627,32 @@ export default function cameraSessionTest(surfaceId: any) { await startCameraSession(i); - 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; + 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); } - } 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 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 mCameraSession.stop(); await beginCameraSessionConfig(); await stopCameraSession(); 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 f29a3873479dc13b5c259d5079861b7934407ea0..fd966201bbcec6b7db95e8dedaaf9ac01942c81a 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 @@ -412,7 +412,14 @@ export default function cameraSessionExposureTest(surfaceId: any) { return false; } - mCameraInput = await mCameraManager.createCameraInput(mCameraDevicesArray[idx]); + 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; @@ -523,7 +530,7 @@ export default function cameraSessionExposureTest(surfaceId: any) { } async function releaseOutput() { - console.info('Enter createOutput'); + console.info('Enter releaseOutput'); if (!isEmpty(mPreviewOutput)) { await mPreviewOutput.stop(); @@ -539,7 +546,7 @@ export default function cameraSessionExposureTest(surfaceId: any) { await mVideoOutput.release(); } */ - console.info('Exit createOutput'); + console.info('Exit releaseOutput'); return true; } 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 050e2f87999c4ab78ac04896aedccf6a0854d71e..7d4e781d1b6cc0a105cd616dd0d1a46217bde231 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 @@ -363,7 +363,14 @@ export default function cameraSessionFlashTest(surfaceId: any) { return false; } - mCameraInput = await mCameraManager.createCameraInput(mCameraDevicesArray[idx]); + 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; @@ -474,7 +481,7 @@ export default function cameraSessionFlashTest(surfaceId: any) { } async function releaseOutput() { - console.info('Enter createOutput'); + console.info('Enter releaseOutput'); if (!isEmpty(mPreviewOutput)) { await mPreviewOutput.stop(); @@ -490,7 +497,7 @@ export default function cameraSessionFlashTest(surfaceId: any) { await mVideoOutput.release(); } */ - console.info('Exit createOutput'); + console.info('Exit releaseOutput'); return true; } 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 3992741088b18afd1f47d2a353059e4310e6d0bc..16c5f8cb2096e910182e8582960fac6fc4fa0d29 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 @@ -408,7 +408,14 @@ export default function cameraSessionFocusTest(surfaceId: any) { return false; } - mCameraInput = await mCameraManager.createCameraInput(mCameraDevicesArray[idx]); + 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; @@ -519,7 +526,7 @@ export default function cameraSessionFocusTest(surfaceId: any) { } async function releaseOutput() { - console.info('Enter createOutput'); + console.info('Enter releaseOutput'); if (!isEmpty(mPreviewOutput)) { await mPreviewOutput.stop(); @@ -535,7 +542,7 @@ export default function cameraSessionFocusTest(surfaceId: any) { await mVideoOutput.release(); } */ - console.info('Exit createOutput'); + console.info('Exit releaseOutput'); return true; } 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 28ca56596753afc66d874024faf26e1113e928e6..8c39b3f5d4d164971f4884a643fb1b333ecd8210 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 @@ -361,7 +361,14 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) { return false; } - mCameraInput = await mCameraManager.createCameraInput(mCameraDevicesArray[idx]); + 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; @@ -472,7 +479,7 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) { } async function releaseOutput() { - console.info('Enter createOutput'); + console.info('Enter releaseOutput'); if (!isEmpty(mPreviewOutput)) { await mPreviewOutput.stop(); @@ -488,7 +495,7 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) { await mVideoOutput.release(); } */ - console.info('Exit createOutput'); + console.info('Exit releaseOutput'); return true; } 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 3a3a37ff179412d27b9b3654737a0c4d8c13d7e7..840fa73b4e7b25c55f0c6e2d1b388bd15340b84d 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 @@ -365,7 +365,14 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) { return false; } - mCameraInput = await mCameraManager.createCameraInput(mCameraDevicesArray[idx]); + 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; @@ -476,7 +483,7 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) { } async function releaseOutput() { - console.info('Enter createOutput'); + console.info('Enter releaseOutput'); if (!isEmpty(mPreviewOutput)) { await mPreviewOutput.stop(); @@ -492,7 +499,7 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) { await mVideoOutput.release(); } */ - console.info('Exit createOutput'); + console.info('Exit releaseOutput'); return true; }