未验证 提交 c082720f 编写于 作者: O openharmony_ci 提交者: Gitee

!6466 Fix camera framework xts case error

Merge pull request !6466 from wuhao/master
......@@ -163,7 +163,7 @@ export default function CameraInputTest(surfaceId) {
}
})
await sleep(10);
await sleep(30);
console.info('Exit beginCameraSessionConfig');
......@@ -406,12 +406,15 @@ export default function CameraInputTest(surfaceId) {
await startCameraSession(i);
mCameraInput.on('error', async (err, data) => {
mCameraInput.on('error', mCameraDevicesArray[i], async (err, data) => {
if (!err) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_0100 callback");
if (data != null || data != undefined) {
console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_0100 PASSED: " + data);
nfyFlag = true;
} else {
expect().assertFail();
console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_0100 FAILED with data is empty");
}
} else {
expect().assertFail();
......@@ -437,120 +440,6 @@ export default function CameraInputTest(surfaceId) {
done();
}
});
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_FOCUS_STATE_CHANGE_0100
* @tc.name : camera status callback on CameraInput async api for focusStateChange
* @tc.desc : camera status callback on CameraInput async api for focusStateChange
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_FOCUS_STATE_CHANGE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_FOCUS_STATE_CHANGE_0100--------------");
if (mCameraNum == 0) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_FOCUS_STATE_CHANGE_0100 FAILED with NoCamera");
expect().assertFail();
done();
} else {
for (let i = 0; i < mCameraNum; i++) {
let nfyFlag = false;
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_FOCUS_STATE_CHANGE_0100 start for camera[" + i + "]");
await startCameraSession(i);
mCameraInput.on('focusStateChange', async (err, data) => {
if (!err) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_FOCUS_STATE_CHANGE_0100 callback");
if (data != null || data != undefined) {
console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_FOCUS_STATE_CHANGE_0100 PASSED: " + data);
nfyFlag = true;
}
} else {
expect().assertFail();
console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_FOCUS_STATE_CHANGE_0100 FAILED: " + err.message);
}
await sleep(1);
})
mCameraSession.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO);
await sleep(300);
if (nfyFlag == false) {
//expect().assertFail();
//console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_FOCUS_STATE_CHANGE_0100 FAILED without any nofity!");
}
await beginCameraSessionConfig();
await stopCameraSession();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_FOCUS_STATE_CHANGE_0100 end for camera[" + i + "]");
}
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_FOCUS_STATE_CHANGE_0100 ends here");
done();
}
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_EXPOSURE_STATE_CHANGE_0100
* @tc.name : camera status callback on CameraInput async api for exposureStateChange
* @tc.desc : camera status callback on CameraInput async api for exposureStateChange
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_EXPOSURE_STATE_CHANGE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_EXPOSURE_STATE_CHANGE_0100--------------");
if (mCameraNum == 0) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_EXPOSURE_STATE_CHANGE_0100 FAILED with NoCamera");
expect().assertFail();
done();
} else {
for (let i = 0; i < mCameraNum; i++) {
let nfyFlag = false;
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_EXPOSURE_STATE_CHANGE_0100 start for camera[" + i + "]");
await startCameraSession(i);
mCameraInput.on('exposureStateChange', async (err, data) => {
if (!err) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_EXPOSURE_STATE_CHANGE_0100 callback");
if (data != null || data != undefined) {
console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_EXPOSURE_STATE_CHANGE_0100 PASSED: " + data);
nfyFlag = true;
}
} else {
expect().assertFail();
console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_EXPOSURE_STATE_CHANGE_0100 FAILED: " + err.message);
}
await sleep(1);
})
mCameraSession.setExposureMode(cameraObj.ExposureMode.EXPOSURE_MODE_AUTO);
await sleep(300);
if (nfyFlag == false) {
//expect().assertFail();
//console.info(TAG + "SUB_MULTIMEDIA_CAMERA_INPUT_STATUS_CALLBACK_0101 FAILED without any nofity!");
}
await beginCameraSessionConfig();
await stopCameraSession();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_EXPOSURE_STATE_CHANGE_0100 end for camera[" + i + "]");
}
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_EXPOSURE_STATE_CHANGE_0100 ends here");
done();
}
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_CALLBACK_0100
......@@ -568,36 +457,42 @@ export default function CameraInputTest(surfaceId) {
} else {
let camerasArray = mCameraDevicesArray;
for (let i = 0; i < camerasArray.length; i++) {
let successFlag = true;
let successFlag = false;
console.info(TAG + "Entering createCameraInput with camera: " + camerasArray[i].cameraId);
await mCameraManager.createCameraInput(camerasArray[i]).then(async (cameraInput) => {
expect(isEmpty(cameraInput)).assertFalse();
await cameraInput.open(async (err) => {
if (!err) {
console.info(TAG + " PASSED open with CameraID :" + camerasArray[i].cameraId);
successFlag = true;
console.info(TAG + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_CALLBACK_0100 PASSED open with CameraID :" + camerasArray[i].cameraId);
} else {
successFlag = false;
console.info(TAG + " open FAILED: " + err.message);
console.info(TAG + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_CALLBACK_0100 open FAILED: " + err.message);
}
});
await sleep(400);
successFlag = false;
await cameraInput.close(async (err) => {
if (!err) {
console.info(TAG + " PASSED close with CameraID :" + camerasArray[i].cameraId);
successFlag = true;
console.info(TAG + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_CALLBACK_0100 PASSED close with CameraID :" + camerasArray[i].cameraId);
} else {
successFlag = false;
console.info(TAG + " close FAILED: " + err.message);
console.info(TAG + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_CALLBACK_0100 close FAILED: " + err.message);
}
});
await sleep(100);
successFlag = false;
await cameraInput.release(async (err) => {
if (!err) {
console.info(TAG + " PASSED release with CameraID :" + camerasArray[i].cameraId);
successFlag = true;
console.info(TAG + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_CALLBACK_0100 PASSED release with CameraID :" + camerasArray[i].cameraId);
} else {
successFlag = false;
console.info(TAG + " release FAILED: " + err.message);
console.info(TAG + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_CALLBACK_0100 release FAILED: " + err.message);
}
});
await sleep(100);
expect(successFlag).assertEqual(true);
}).catch((err) => {
expect().assertFail();
......@@ -627,32 +522,38 @@ export default function CameraInputTest(surfaceId) {
} else {
let camerasArray = mCameraDevicesArray;
for (let i = 0; i < camerasArray.length; i++) {
let successFlag = true;
console.info(TAG + functionTag + "Entering createCameraInput with camera: " + camerasArray[i].cameraId);
let successFlag = false;
console.info(TAG + functionTag + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_PROMISE_0100 createCameraInput with camera: " + camerasArray[i].cameraId);
mCameraManager.createCameraInput(camerasArray[i], async (err, cameraInput) => {
if (!err) {
expect(isEmpty(cameraInput)).assertFalse();
console.info(TAG + functionTag + "Entering cameraInput open with camera: " + camerasArray[i].cameraId);
console.info(TAG + functionTag + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_PROMISE_0100 cameraInput open with camera: " + camerasArray[i].cameraId);
await cameraInput.open().then(async () => {
console.info(TAG + functionTag + " PASSED open with CameraID :" + camerasArray[i].cameraId);
successFlag = true;
console.info(TAG + functionTag + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_PROMISE_0100 PASSED open with CameraID :" + camerasArray[i].cameraId);
}).catch((err) => {
successFlag = false;
console.info(TAG + functionTag + " open FAILED: " + err.message);
console.info(TAG + functionTag + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_PROMISE_0100 open FAILED: " + err.message);
});
await sleep(400);
successFlag = false;
await cameraInput.close().then(async () => {
console.info(TAG + functionTag + " PASSED close with CameraID :" + camerasArray[i].cameraId);
successFlag = true;
console.info(TAG + functionTag + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_PROMISE_0100 PASSED close with CameraID :" + camerasArray[i].cameraId);
}).catch((err) => {
successFlag = false;
console.info(TAG + functionTag + " close FAILED: " + err.message);
console.info(TAG + functionTag + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_PROMISE_0100 close FAILED: " + err.message);
});
await sleep(100);
successFlag = false;
await cameraInput.release().then(async () => {
console.info(TAG + functionTag + " PASSED release with CameraID :" + camerasArray[i].cameraId);
successFlag = true;
console.info(TAG + functionTag + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_PROMISE_0100 PASSED release with CameraID :" + camerasArray[i].cameraId);
}).catch((err) => {
successFlag = false;
console.info(TAG + functionTag + " release FAILED: " + err.message);
console.info(TAG + functionTag + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_PROMISE_0100 release FAILED: " + err.message);
});
await sleep(100);
expect(successFlag).assertEqual(true);
} else {
expect().assertFail();
......
......@@ -387,9 +387,9 @@ export default function cameraJSUnitOutput(surfaceId: any) {
}
cameraInput.open(async (err) => {
if (!err) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_OUTPUT_PROMISE_0100 open callback");
expect(true).assertTrue();
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_OUTPUT_PROMISE_0100 FAILED: " + err.message);
expect().assertFail();
}
await sleep(1000);
done();
......@@ -881,7 +881,7 @@ export default function cameraJSUnitOutput(surfaceId: any) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100 captureSession == null || undefined")
expect().assertFail();
} else {
captureSession.start(async (err, data) => {
captureSession.start(async (err) => {
if (!err) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100 success");
expect(true).assertTrue();
......@@ -1204,7 +1204,7 @@ export default function cameraJSUnitOutput(surfaceId: any) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_START_PREVIEW_OUTPUT_CALLBACK_0100 previewOutput == null || undefined")
expect().assertFail();
} else {
previewOutput.start(async (err, data) => {
previewOutput.start(async (err) => {
if (!err) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_START_PREVIEW_OUTPUT_CALLBACK_0100 success");
expect(true).assertTrue();
......@@ -1236,7 +1236,7 @@ export default function cameraJSUnitOutput(surfaceId: any) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_STOP_PREVIEW_OUTPUT_CALLBACK_0100 previewOutput == null || undefined")
expect().assertFail();
} else {
previewOutput.stop(async (err, data) => {
previewOutput.stop(async (err) => {
if (!err) {
expect(true).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_STOP_PREVIEW_OUTPUT_CALLBACK_0100 success");
......@@ -1269,10 +1269,11 @@ export default function cameraJSUnitOutput(surfaceId: any) {
expect().assertFail();
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 to operate");
let count = 0;
previewOutput.on('frameStart', async (err, data) => {
if (!err) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 success");
expect(true).assertTrue();
count++;
} else {
console.info(TAG + "Error in SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 FAILED: " + err.message);
expect().assertFail();
......@@ -1280,6 +1281,11 @@ export default function cameraJSUnitOutput(surfaceId: any) {
await sleep(1000);
done();
})
await sleep(1000);
done();
previewOutput.start();
previewOutput.stop();
// expect(count == 1).assertTrue();
}
await sleep(1000);
done();
......@@ -1302,9 +1308,10 @@ export default function cameraJSUnitOutput(surfaceId: any) {
expect().assertFail();
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 to operate");
let count = 0;
previewOutput.on('frameEnd', async (err, data) => {
if (!err) {
expect(true).assertTrue();
count++
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 success");
} else {
expect().assertFail();
......@@ -1313,6 +1320,8 @@ export default function cameraJSUnitOutput(surfaceId: any) {
await sleep(1000);
done();
})
previewOutput.stop();
// expect(count == 1).assertTrue();
}
await sleep(1000);
done();
......@@ -1336,7 +1345,6 @@ export default function cameraJSUnitOutput(surfaceId: any) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_ERROR_0100 to operate");
previewOutput.on('error', async (err, data) => {
if (!err) {
expect(true).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_ERROR_0100 success");
} else {
expect().assertFail();
......@@ -1433,8 +1441,8 @@ export default function cameraJSUnitOutput(surfaceId: any) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CAPTURE_DEFAULT_PROMISE_0100 photoOutput == null || undefined")
expect().assertFail();
} else {
await photoOutput.capture().then((result) => {
console.info('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CAPTURE_DEFAULT_PROMISE_0100 success :' + result);
await photoOutput.capture().then(() => {
console.info('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CAPTURE_DEFAULT_PROMISE_0100 success');
}).catch((err) => {
console.info('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CAPTURE_DEFAULT_PROMISE_0100 failed :' + err);
expect().assertFail();
......@@ -1559,9 +1567,10 @@ export default function cameraJSUnitOutput(surfaceId: any) {
expect().assertFail();
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_CAPTURE_START_0100 to operate");
let count = 0;
photoOutput.on('captureStart', async (err, data) => {
if (!err) {
expect(true).assertTrue();
count++;
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_CAPTURE_START_0100 success");
} else {
expect().assertFail();
......@@ -1570,6 +1579,8 @@ export default function cameraJSUnitOutput(surfaceId: any) {
await sleep(1000);
done();
})
photoOutput.capture();
// expect(count == 1).assertTrue();
}
await sleep(1000);
done();
......@@ -1592,9 +1603,10 @@ export default function cameraJSUnitOutput(surfaceId: any) {
expect().assertFail();
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_FRAME_SHUTTER_0100 to operate");
let count = 0;
photoOutput.on('frameShutter', async (err, data) => {
if (!err) {
expect(true).assertTrue();
count++;
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_FRAME_SHUTTER_0100 success");
console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_FRAME_SHUTTER_0100, captureId = " + data.captureId);
console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_FRAME_SHUTTER_0100, timestamp = " + data.timestamp);
......@@ -1605,6 +1617,10 @@ export default function cameraJSUnitOutput(surfaceId: any) {
await sleep(1000);
done();
})
await sleep(1000);
done();
photoOutput.capture();
// expect(count == 1).assertTrue();
}
await sleep(1000);
done();
......@@ -1627,9 +1643,10 @@ export default function cameraJSUnitOutput(surfaceId: any) {
expect().assertFail();
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_CAPTURE_END_0100 to operate");
let count = 0;
photoOutput.on('captureEnd', async (err, data) => {
if (!err) {
expect(true).assertTrue();
count++;
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_CAPTURE_END_0100 success");
console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_CAPTURE_END_0100, captureId = " + data.captureId);
console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_CAPTURE_END_0100, frameCount = " + data.frameCount);
......@@ -1640,6 +1657,10 @@ export default function cameraJSUnitOutput(surfaceId: any) {
await sleep(1000);
done();
})
await sleep(1000);
done();
photoOutput.capture();
// expect(count == 1).assertTrue();
}
await sleep(1000);
done();
......@@ -1695,7 +1716,7 @@ export default function cameraJSUnitOutput(surfaceId: any) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_RELEASE_CALLBACK_0100 photoOutput == null || undefined")
expect().assertFail();
} else {
photoOutput.release(async (err, data) => {
photoOutput.release(async (err) => {
if (!err) {
expect(true).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_RELEASE_CALLBACK_0100 success");
......
......@@ -293,7 +293,7 @@ export default function cameraSessionTest(surfaceId: any) {
}
})
await sleep(10);
await sleep(30);
console.info('Exit beginCameraSessionConfig');
......
......@@ -353,7 +353,7 @@ export default function cameraSessionExposureTest(surfaceId: any) {
}
})
await sleep(10);
await sleep(30);
console.info('Exit beginCameraSessionConfig');
......
......@@ -304,7 +304,7 @@ export default function cameraSessionFlashTest(surfaceId: any) {
}
})
await sleep(10);
await sleep(30);
console.info('Exit beginCameraSessionConfig');
......
......@@ -349,7 +349,7 @@ export default function cameraSessionFocusTest(surfaceId: any) {
}
})
await sleep(10);
await sleep(30);
console.info('Exit beginCameraSessionConfig');
......
......@@ -302,7 +302,7 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) {
}
})
await sleep(10);
await sleep(30);
console.info('Exit beginCameraSessionConfig');
......
......@@ -306,7 +306,7 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) {
}
})
await sleep(10);
await sleep(30);
console.info('Exit beginCameraSessionConfig');
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册