From 8c45263d20eb59d3eda9c5c4ef3912936b190d4f Mon Sep 17 00:00:00 2001 From: yygxr Date: Wed, 2 Nov 2022 00:47:56 -0700 Subject: [PATCH] fix xts case error for musl Signed-off-by: yygxr --- .../MainAbility/test/CameraInputTest.test.ets | 9 +- .../test/CameraSessionBaseTest.test.ets | 204 ++++++++++-------- .../test/CameraSessionExposureTest.test.ets | 13 +- .../test/CameraSessionFlashTest.test.ets | 13 +- .../test/CameraSessionFocusTest.test.ets | 13 +- ...meraSessionVideoStabilizationTest.test.ets | 13 +- .../test/CameraSessionZoomRatioTest.test.ets | 13 +- 7 files changed, 168 insertions(+), 110 deletions(-) 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 c60ba54e3..ce7cb07a6 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 f9d10dfaa..dbf2ae936 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 f29a38734..fd966201b 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 050e2f879..7d4e781d1 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 399274108..16c5f8cb2 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 28ca56596..8c39b3f5d 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 3a3a37ff1..840fa73b4 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; } -- GitLab