diff --git a/multimedia/camera/camera_js_standard/Test.json b/multimedia/camera/camera_js_standard/Test.json index 299a6ca6e109bb59dc77cc0fd0f36388bd6744a3..b4f6b4fad2247b2e2725418c9cb63cca014a15e0 100644 --- a/multimedia/camera/camera_js_standard/Test.json +++ b/multimedia/camera/camera_js_standard/Test.json @@ -19,7 +19,11 @@ "power-shell setmode 602" ], "teardown-command":[ - "power-shell setmode 600" + "power-shell setmode 600", + "rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*", + "kill -9 `pidof com.ohos.medialibrary.medialibrarydata`", + "scanner", + "sleep 5" ] }, { 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 7f91638c1192c42cddd2a6419d2c0e3f1e14939f..325b30200beaafba0c1d367dcd74d65269eee252 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