From 4fa20e57827e9549884620feb1d85ced362b59ff Mon Sep 17 00:00:00 2001 From: qinliwen Date: Wed, 5 Jul 2023 15:02:23 +0800 Subject: [PATCH] =?UTF-8?q?<=E8=A1=A5=E5=85=85on(cameraStatus)=E7=94=A8?= =?UTF-8?q?=E4=BE=8B=E8=A7=A6=E5=8F=91=E6=9D=A1=E4=BB=B6>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: qinliwen --- .../main/ets/test/CameraManagerTest.test.ets | 49 +++++++++++-------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraManagerTest.test.ets b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraManagerTest.test.ets index 7f91638c1..325b30200 100644 --- a/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraManagerTest.test.ets +++ b/multimedia/camera/camera_js_standard/entry/src/main/ets/test/CameraManagerTest.test.ets @@ -775,27 +775,36 @@ describe('CameraManagerTest', function () { * @tc.level : Level 1 */ it('SUB_MULTIMEDIA_CAMERA_ON_CAMERASTATUS_0100', 1, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_ON_CAMERASTATUS_0100--------------"); - if (isEmpty(mCameraManager)) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ON_CAMERASTATUS_0100 mCameraManager == null || undefined") - expect().assertFail(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ON_CAMERASTATUS_0100 to operate"); - mCameraManager.on('cameraStatus', async (err, data) => { - if (!err) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ON_CAMERASTATUS_0100 success"); + console.info("--------------SUB_MULTIMEDIA_CAMERA_ON_CAMERASTATUS_0100--------------"); + if (isEmpty(mCameraManager)) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ON_CAMERASTATUS_0100 mCameraManager == null || undefined") + expect().assertFail(); } else { - expect().assertFail(); - console.info(TAG + "Error in SUB_MULTIMEDIA_CAMERA_ON_CAMERASTATUS_0100 FAILED: " + err.message); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ON_CAMERASTATUS_0100 to operate"); + mCameraManager.on('cameraStatus', async (err, CameraStatusInfo) => { + if (!err) { + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ON_CAMERASTATUS_0100 camera:" + JSON.stringify(CameraStatusInfo.camera)); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ON_CAMERASTATUS_0100 status:" + JSON.stringify(CameraStatusInfo.status)); + expect(true).assertTrue(); + console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ON_CAMERASTATUS_0100 success"); + } else { + expect().assertFail(); + console.info(TAG + "Error in SUB_MULTIMEDIA_CAMERA_ON_CAMERASTATUS_0100 FAILED: " + err.message); + } + done(); + }) + try { + let camerasArray = mCameraDevicesArray; + let cameraInputPromise = mCameraManager.createCameraInput(camerasArray[0]); + await cameraInputPromise.open() + await sleep(500) + await cameraInputPromise.close() + } catch (err) { + expect().assertFail(); + console.info(TAG + "Error in SUB_MULTIMEDIA_CAMERA_ON_CAMERASTATUS_0100 err: " + JSON.stringify(err)); + done() + } } - await sleep(1000); - done(); - }) - } - await sleep(1000); - done(); - }) - + }) }) } \ No newline at end of file -- GitLab