提交 f92fcbff 编写于 作者: M mali

sync supplement

Signed-off-by: Nmali <mali81@huawei.com>
上级 1ee89b24
......@@ -214,7 +214,6 @@ export default function CameraInputTest() {
if (!isEmpty(mCameraInput)) {
await mCameraInput.close();
await mCameraInput.release();
}
console.info('Exit releaseInput');
......@@ -393,17 +392,17 @@ export default function CameraInputTest() {
});
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_CALLBACK_0100
* @tc.name : open/close/release Camera with cameraInput callback api
* @tc.desc : open/close/release Camera with cameraInput callback api
* @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_CALLBACK_0100
* @tc.name : open/close Camera with cameraInput callback api
* @tc.desc : open/close Camera with cameraInput callback api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_CALLBACK_0100', 0, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_CALLBACK_0100--------------");
it('SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_CALLBACK_0100', 0, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_CALLBACK_0100--------------");
if (isEmpty(mCameraManager)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_CALLBACK_0100 cameraManager == null || undefined");
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_CALLBACK_0100 cameraManager == null || undefined");
expect().assertFail();
} else {
let camerasArray = mCameraDevicesArray;
......@@ -415,10 +414,10 @@ export default function CameraInputTest() {
await cameraInput.open(async (err) => {
if (!err) {
successFlag = true;
console.info(TAG + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_CALLBACK_0100 PASSED open with CameraID :" + camerasArray[i].cameraId);
console.info(TAG + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_CALLBACK_0100 PASSED open with CameraID :" + camerasArray[i].cameraId);
} else {
successFlag = false;
console.info(TAG + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_CALLBACK_0100 open FAILED: " + err.message);
console.info(TAG + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_CALLBACK_0100 open FAILED: " + err.message);
}
});
await sleep(400);
......@@ -426,79 +425,59 @@ export default function CameraInputTest() {
await cameraInput.close(async (err) => {
if (!err) {
successFlag = true;
console.info(TAG + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_CALLBACK_0100 PASSED close with CameraID :" + camerasArray[i].cameraId);
console.info(TAG + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_CALLBACK_0100 PASSED close with CameraID :" + camerasArray[i].cameraId);
} else {
successFlag = false;
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) {
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 + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_CALLBACK_0100 release FAILED: " + err.message);
console.info(TAG + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_CALLBACK_0100 close FAILED: " + err.message);
}
});
await sleep(100);
expect(successFlag).assertEqual(true);
}
}
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_CALLBACK_0100 ends here");
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_CALLBACK_0100 ends here");
await sleep(1000);
done();
});
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_PROMISE_0100
* @tc.name : open/close/release Camera with cameraInput promise api
* @tc.desc : open/close/release Camera with cameraInput promise api
* @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_PROMISE_0100
* @tc.name : open/close Camera with cameraInput promise api
* @tc.desc : open/close Camera with cameraInput promise api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_PROMISE_0100', 0, async function (done) {
let functionTag = "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_PROMISE_0100";
it('SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_PROMISE_0100', 0, async function (done) {
let functionTag = "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_PROMISE_0100";
console.info(functionTag);
if (isEmpty(mCameraManager)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_PROMISE_0100 cameraManager == null || undefined");
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_PROMISE_0100 cameraManager == null || undefined");
expect().assertFail();
} else {
let camerasArray = mCameraDevicesArray;
for (let i = 0; i < camerasArray.length; i++) {
let successFlag = false;
console.info(TAG + functionTag + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_PROMISE_0100 createCameraInput with camera: " + camerasArray[i].cameraId);
console.info(TAG + functionTag + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_PROMISE_0100 createCameraInput with camera: " + camerasArray[i].cameraId);
let cameraInput = mCameraManager.createCameraInput(camerasArray[i]);
expect(isEmpty(cameraInput)).assertFalse();
console.info(TAG + functionTag + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_PROMISE_0100 cameraInput open with camera: " + camerasArray[i].cameraId);
console.info(TAG + functionTag + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_PROMISE_0100 cameraInput open with camera: " + camerasArray[i].cameraId);
await cameraInput.open().then(async () => {
successFlag = true;
console.info(TAG + functionTag + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_PROMISE_0100 PASSED open with CameraID :" + camerasArray[i].cameraId);
console.info(TAG + functionTag + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_PROMISE_0100 PASSED open with CameraID :" + camerasArray[i].cameraId);
}).catch((err) => {
successFlag = false;
console.info(TAG + functionTag + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_PROMISE_0100 open FAILED: " + err.message);
console.info(TAG + functionTag + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_PROMISE_0100 open FAILED: " + err.message);
});
await sleep(400);
successFlag = false;
await cameraInput.close().then(async () => {
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 + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_PROMISE_0100 close FAILED: " + err.message);
});
await sleep(100);
successFlag = false;
await cameraInput.release().then(async () => {
successFlag = true;
console.info(TAG + functionTag + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_PROMISE_0100 PASSED release with CameraID :" + camerasArray[i].cameraId);
console.info(TAG + functionTag + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_PROMISE_0100 PASSED close with CameraID :" + camerasArray[i].cameraId);
}).catch((err) => {
successFlag = false;
console.info(TAG + functionTag + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_PROMISE_0100 release FAILED: " + err.message);
console.info(TAG + functionTag + " SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_PROMISE_0100 close FAILED: " + err.message);
});
await sleep(100);
expect(successFlag).assertEqual(true);
......@@ -506,7 +485,7 @@ export default function CameraInputTest() {
}
//await sleep(400 * camerasArray.length);
}
console.info(TAG + functionTag + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_PROMISE_0100 ends here");
console.info(TAG + functionTag + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_PROMISE_0100 ends here");
done();
});
......
......@@ -159,7 +159,6 @@ export default function cameraJSUnitOutput() {
async function release() {
console.log(TAG + "start release");
await cameraInput.release();
await captureSession.release();
console.log(TAG + "release end")
}
......@@ -661,6 +660,38 @@ export default function cameraJSUnitOutput() {
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_METADATA_OUTPUT_CALLBACK_ON_ERROR_0100
* @tc.name : metadata output callback on error api
* @tc.desc : metadata output callback on error api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_MULTIMEDIA_CAMERA_METADATA_OUTPUT_CALLBACK_ON_ERROR_0100', 1, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_METADATA_OUTPUT_CALLBACK_ON_ERROR_0100--------------");
if (isEmpty(metadataOutput)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_METADATA_OUTPUT_CALLBACK_ON_ERROR_0100 metadataOutput == null || undefined")
expect().assertFail();
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_METADATA_OUTPUT_CALLBACK_ON_ERROR_0100 to operate");
metadataOutput.on('error', async (err, data) => {
if (!err) {
expect(true).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_METADATA_OUTPUT_CALLBACK_ON_ERROR_0100 success");
} else {
expect().assertFail();
console.info(TAG + "Error in SUB_MULTIMEDIA_CAMERA_METADATA_OUTPUT_CALLBACK_ON_ERROR_0100 FAILED: " + err.message);
}
await sleep(1000);
done();
})
}
await sleep(1000);
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100
* @tc.name : captureSession start
......@@ -734,7 +765,7 @@ export default function cameraJSUnitOutput() {
if (isEmpty(mMetadataObjectArray)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_TYPE_PROMISE_0100 mMetadataObjectArray == null || undefined")
} else {
let type = mMetadataObjectArray[0].getType();
let type = mMetadataObjectArray[0].type;
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_TYPE_PROMISE_0100 success, type : " + type);
}
await sleep(1000);
......@@ -755,7 +786,7 @@ export default function cameraJSUnitOutput() {
if (isEmpty(mMetadataObjectArray)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_TIMESTAMP_PROMISE_0100 mMetadataObjectArray == null || undefined")
} else {
let timeStamp = mMetadataObjectArray[0].getTimestamp();
let timeStamp = mMetadataObjectArray[0].timestamp;
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_TIMESTAMP_PROMISE_0100 success, timeStamp : " + timeStamp);
}
await sleep(1000);
......@@ -776,9 +807,13 @@ export default function cameraJSUnitOutput() {
if (isEmpty(mMetadataObjectArray)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_BOUNDING_BOX_PROMISE_0100 mMetadataObjectArray == null || undefined")
} else {
let boundingBox = mMetadataObjectArray[0].getBoundingBox();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_BOUNDING_BOX_PROMISE_0100 success, boundingBox : " + boundingBox.width + "x" + boundingBox.height);
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_BOUNDING_BOX_PROMISE_0100 success, boundingBox : " + boundingBox.topLeftX + "x" + boundingBox.topLeftY);
let boundingBox = mMetadataObjectArray[0].boundingBox;
let w = boundingBox.width;
let h = boundingBox.height;
let tx = boundingBox.topLeftX;
let ty = boundingBox.topLeftY;
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_BOUNDING_BOX_PROMISE_0100 success, boundingBox : " + w + "x" + h);
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_BOUNDING_BOX_PROMISE_0100 success, boundingBox : " + tx + "x" + ty);
}
await sleep(1000);
done();
......
......@@ -210,34 +210,22 @@ export default function cameraManagerTest() {
return true;
}
async function getSupportedOutputCapabilityInCallback(cameraDevice) {
async function getSupportedOutputCapability(cameraDevice) {
if (isEmpty(mCameraManager)) {
console.info(TAG + "Entering getSupportedOutputCapabilityInCallback cameraManager == null || undefined")
expect().assertFail();
return undefined;
}
let outputCapabilityCallback =
mCameraManager.getSupportedOutputCapability(cameraDevice);
await sleep(100);
return outputCapabilityCallback;
}
async function getSupportedOutputCapabilityInPromise(cameraDevice) {
if (isEmpty(mCameraManager)) {
console.info(TAG + "Entering getSupportedOutputCapabilityInPromise cameraManager == null || undefined")
console.info(TAG + "Entering getSupportedOutputCapability cameraManager == null || undefined")
expect().assertFail();
return undefined;
}
let outputCapabilityPromise = mCameraManager.getSupportedOutputCapability(cameraDevice);
let outputCapability = mCameraManager.getSupportedOutputCapability(cameraDevice);
if (isEmpty(outputCapabilityPromise)) {
console.info(TAG + "Entering getSupportedOutputCapabilityInPromise outputCapabilityPromise == null || undefined")
if (isEmpty(outputCapability)) {
console.info(TAG + "Entering getSupportedOutputCapability outputCapability == null || undefined")
} else {
console.info("CameraUnitTest: getSupportedOutputCapabilityInPromise: " + JSON.stringify(outputCapabilityPromise));
console.info("CameraUnitTest: getSupportedOutputCapability: " + JSON.stringify(outputCapability));
}
return outputCapabilityPromise;
return outputCapability;
}
describe('CameraManagerTest', function () {
......@@ -343,7 +331,7 @@ describe('CameraManagerTest', function () {
console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_CALLBACK_0100--------------");
let camerasArray = mCameraDevicesArray;
for (let i = 0; i < camerasArray.length; i++) {
let cameraOutputCap = await getSupportedOutputCapabilityInCallback(camerasArray[i]);
let cameraOutputCap = await getSupportedOutputCapability(camerasArray[i]);
await sleep(100);
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_CALLBACK_0100 camera:" + camerasArray[i].cameraId);
if (!isEmpty(cameraOutputCap)) {
......@@ -389,7 +377,7 @@ describe('CameraManagerTest', function () {
it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_PROMISE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_PROMISE_0100--------------");
for (let i = 0; i < mCameraDevicesArray.length; i++) {
let cameraOutputCap = await getSupportedOutputCapabilityInPromise(mCameraDevicesArray[i]);
let cameraOutputCap = await getSupportedOutputCapability(mCameraDevicesArray[i]);
console.info("Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_PROMISE_0100 camera:" + mCameraDevicesArray[i].cameraId);
if (!isEmpty(cameraOutputCap)) {
let previewProfilesArray = cameraOutputCap.previewProfiles;
......@@ -437,7 +425,7 @@ describe('CameraManagerTest', function () {
console.info("--------------SUB_MULTIMEDIA_CAMERA_PREVIEW_PROFILES_0100--------------");
let camerasArray = mCameraDevicesArray;
for (let i = 0; i < camerasArray.length; i++) {
let cameraOutputCap = await getSupportedOutputCapabilityInPromise(camerasArray[i]);
let cameraOutputCap = await getSupportedOutputCapability(camerasArray[i]);
console.info("Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_PROFILES_0100 camera:" + camerasArray[i].cameraId);
if (!isEmpty(cameraOutputCap)) {
let previewProfilesArray = cameraOutputCap.previewProfiles;
......@@ -474,7 +462,7 @@ describe('CameraManagerTest', function () {
console.info("--------------SUB_MULTIMEDIA_CAMERA_PHOTO_PROFILES_0100--------------");
let camerasArray = mCameraDevicesArray;
for (let i = 0; i < camerasArray.length; i++) {
let cameraOutputCap = await getSupportedOutputCapabilityInPromise(camerasArray[i]);
let cameraOutputCap = await getSupportedOutputCapability(camerasArray[i]);
console.info("Entering SUB_MULTIMEDIA_CAMERA_PHOTO_PROFILES_0100 camera:" + camerasArray[i].cameraId);
if (!isEmpty(cameraOutputCap)) {
let photoProfilesArray = cameraOutputCap.photoProfiles;
......@@ -511,7 +499,7 @@ describe('CameraManagerTest', function () {
console.info("--------------SUB_MULTIMEDIA_CAMERA_VIDEO_PROFILES_0100--------------");
let camerasArray = mCameraDevicesArray;
for (let i = 0; i < camerasArray.length; i++) {
let cameraOutputCap = await getSupportedOutputCapabilityInPromise(camerasArray[i]);
let cameraOutputCap = await getSupportedOutputCapability(camerasArray[i]);
console.info("Entering SUB_MULTIMEDIA_CAMERA_VIDEO_PROFILES_0100 camera:" + camerasArray[i].cameraId);
if (!isEmpty(cameraOutputCap)) {
let videoProfilesArray = cameraOutputCap.videoProfiles;
......@@ -609,7 +597,7 @@ describe('CameraManagerTest', function () {
console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PREVIEW_OUTPUT_PROMISE_0100--------------");
let camerasArray = mCameraDevicesArray;
for (let i = 0; i < camerasArray.length; i++) {
let cameraOutputCap = await getSupportedOutputCapabilityInPromise(camerasArray[i]);
let cameraOutputCap = await getSupportedOutputCapability(camerasArray[i]);
console.info("SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PREVIEW_OUTPUT_PROMISE_0100 camera:" + camerasArray[i].cameraId);
if (!isEmpty(cameraOutputCap)) {
let previewProfilesArray = cameraOutputCap.previewProfiles;
......@@ -647,7 +635,7 @@ describe('CameraManagerTest', function () {
console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PHOTO_OUTPUT_PROMISE_0100--------------");
let camerasArray = mCameraDevicesArray;
for (let i = 0; i < camerasArray.length; i++) {
let cameraOutputCap = await getSupportedOutputCapabilityInPromise(camerasArray[i]);
let cameraOutputCap = await getSupportedOutputCapability(camerasArray[i]);
console.info("SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PHOTO_OUTPUT_PROMISE_0100 camera:" + camerasArray[i].cameraId);
if (!isEmpty(cameraOutputCap)) {
let photoProfilesArray = cameraOutputCap.photoProfiles;
......@@ -685,7 +673,7 @@ describe('CameraManagerTest', function () {
console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_PROMISE_0100--------------");
let camerasArray = mCameraDevicesArray;
for (let i = 0; i < camerasArray.length; i++) {
let cameraOutputCap = await getSupportedOutputCapabilityInPromise(camerasArray[i]);
let cameraOutputCap = await getSupportedOutputCapability(camerasArray[i]);
console.info("SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_PROMISE_0100 camera:" + camerasArray[i].cameraId);
if (!isEmpty(cameraOutputCap)) {
let videoProfilesArray = cameraOutputCap.videoProfiles;
......@@ -713,49 +701,6 @@ describe('CameraManagerTest', function () {
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_CALLBACK_0100
* @tc.name : Create camerainput from camera-0 cameraposition front & cameratype unspecified async api
* @tc.desc : Create camerainput from camera-0 cameraposition front & cameratype unspecified async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_CALLBACK_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_CALLBACK_0100--------------");
let camerasArray = mCameraDevicesArray;
for (let i = 0; i < camerasArray.length; i++) {
let cameraOutputCap = await getSupportedOutputCapabilityInPromise(camerasArray[i]);
console.info("SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_CALLBACK_0100 camera:" + camerasArray[i].cameraId);
if (!isEmpty(cameraOutputCap)) {
let metadataObjectTypeArray = cameraOutputCap.supportedMetadataObjectTypes;
if (!isEmpty(metadataObjectTypeArray)) {
mCameraManager.createMetadataOutput(metadataObjectTypeArray, async (err, data) => {
if (!err) {
if (isEmpty(data)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_CALLBACK_0100 data == null || undefined")
expect().assertFail();
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_CALLBACK_0100 data = " + data)
}
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_CALLBACK_0100 err = " + err.message)
expect().assertFail();
}
})
await sleep(100);
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_CALLBACK_0100 metadataObjectTypeArray == null || undefined")
}
await sleep(300);
}
}
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_CALLBACK_0100 PASS");
await sleep(1000);
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_PROMISE_0100
* @tc.name : Create camerainput from camera-0 cameraposition front & cameratype unspecified async api
......@@ -768,7 +713,7 @@ describe('CameraManagerTest', function () {
console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_PROMISE_0100--------------");
let camerasArray = mCameraDevicesArray;
for (let i = 0; i < camerasArray.length; i++) {
let cameraOutputCap = await getSupportedOutputCapabilityInPromise(camerasArray[i]);
let cameraOutputCap = await getSupportedOutputCapability(camerasArray[i]);
console.info("SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_PROMISE_0100 camera:" + camerasArray[i].cameraId);
if (!isEmpty(cameraOutputCap)) {
let metadataObjectTypeArray = cameraOutputCap.supportedMetadataObjectTypes;
......@@ -838,5 +783,37 @@ describe('CameraManagerTest', function () {
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ON_CAMERASTATUS_0100
* @tc.name : camera manager on cameraStatus api
* @tc.desc : camera manager on cameraStatus api
* @tc.size : MEDIUM
* @tc.type : 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");
} else {
expect().assertFail();
console.info(TAG + "Error in SUB_MULTIMEDIA_CAMERA_ON_CAMERASTATUS_0100 FAILED: " + err.message);
}
await sleep(1000);
done();
})
}
await sleep(1000);
done();
})
})
}
\ No newline at end of file
......@@ -307,7 +307,6 @@ export default function cameraSessionTest() {
if (!isEmpty(mCameraInput)) {
await mCameraInput.close();
await mCameraInput.release();
}
console.info('Exit releaseInput');
......@@ -395,7 +394,6 @@ export default function cameraSessionTest() {
}
if (!isEmpty(mVideoOutput)) {
//await mVideoOutput.stop();
await mVideoOutput.release();
}
......@@ -620,13 +618,15 @@ export default function cameraSessionTest() {
}
else {
try {
await mCameraSession.beginConfig();
} catch {
mCameraSession.beginConfig();
} catch(error) {
expect().assertFail();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_BEGIN_CONFIG_DUPLICATED_PROMISE_0100 with a error, ingore it");
}
try {
await mCameraSession.beginConfig();
} catch {
mCameraSession.beginConfig();
} catch(error) {
expect().assertFail();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_BEGIN_CONFIG_DUPLICATED_PROMISE_0100 with a error, ingore it");
}
......@@ -658,15 +658,16 @@ export default function cameraSessionTest() {
else {
try {
await mCameraSession.commitConfig();
} catch {
} catch(error) {
expect().assertFail();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_COMMIT_CONFIG_DUPLICATED_PROMISE_0100 with a error, ingore it");
}
try {
await mCameraSession.commitConfig();
} catch {
} catch(error) {
expect().assertFail();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_COMMIT_CONFIG_DUPLICATED_PROMISE_0100 with a error, ingore it");
}
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_COMMIT_CONFIG_DUPLICATED_PROMISE_0100 PASSED");
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_COMMIT_CONFIG_DUPLICATED_PROMISE_0100 ends here");
......@@ -677,34 +678,38 @@ export default function cameraSessionTest() {
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_PROMISE_0100
* @tc.name : Check capture session start/stop output with promise or not
* @tc.desc : Check capture session start/stop output with promise or not
* @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_RELEASE_PROMISE_0100
* @tc.name : Check capture session start/stop/release output with promise or not
* @tc.desc : Check capture session start/stop/release output with promise or not
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_PROMISE_0100', 0, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_PROMISE_0100--------------");
it('SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_RELEASE_PROMISE_0100', 0, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_RELEASE_PROMISE_0100--------------");
if (mCameraNum == 0) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_PROMISE_0100 FAILED with NoCamera");
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_RELEASE_PROMISE_0100 FAILED with NoCamera");
expect().assertFail();
done();
}
else {
for (let i = 0; i < mCameraNum; i++) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_PROMISE_0100 start for camera[" + i + "]");
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_RELEASE_PROMISE_0100 start for camera[" + i + "]");
await startCameraSession(i);
if (!isEmpty(mPreviewOutput)) {
await mCameraSession.start();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_PROMISE_0100 start PASSED");
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_RELEASE_PROMISE_0100 start PASSED");
await sleep(2000);
await mCameraSession.stop();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_PROMISE_0100 stop PASSED");
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_RELEASE_PROMISE_0100 stop PASSED");
await sleep(500);
await mCameraSession.release();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_RELEASE_PROMISE_0100 release PASSED");
await sleep(500);
}
......@@ -712,10 +717,10 @@ export default function cameraSessionTest() {
await stopCameraSession();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_PROMISE_0100 end for camera[" + i + "]");
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_RELEASE_PROMISE_0100 end for camera[" + i + "]");
}
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_PROMISE_0100 ends here");
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_RELEASE_PROMISE_0100 ends here");
done();
}
})
......
......@@ -374,7 +374,6 @@ export default function cameraSessionExposureTest() {
if (!isEmpty(mCameraInput)) {
await mCameraInput.close();
await mCameraInput.release();
}
console.info('Exit releaseInput');
......
......@@ -325,7 +325,6 @@ export default function cameraSessionFlashTest() {
if (!isEmpty(mCameraInput)) {
await mCameraInput.close();
await mCameraInput.release();
}
console.info('Exit releaseInput');
......
......@@ -370,7 +370,6 @@ export default function cameraSessionFocusTest() {
if (!isEmpty(mCameraInput)) {
await mCameraInput.close();
await mCameraInput.release();
}
console.info('Exit releaseInput');
......@@ -1444,7 +1443,71 @@ export default function cameraSessionFocusTest() {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_GET_FOCAL_LENGTH_PROMISE_0100 ends here");
done();
}
})
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ON_FOCUSSTATECHANGE_0100
* @tc.name : camera session focusstatechange api
* @tc.desc : camera session focusstatechange api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_MULTIMEDIA_CAMERA_ON_FOCUSSTATECHANGE_0100', 1, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ON_FOCUSSTATECHANGE_0100--------------");
if (isEmpty(mCameraSession)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ON_FOCUSSTATECHANGE_0100 mCameraSession == null || undefined")
expect().assertFail();
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ON_FOCUSSTATECHANGE_0100 to operate");
mCameraSession.on('focusStateChange', async (err, data) => {
if (!err) {
expect(true).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ON_FOCUSSTATECHANGE_0100 success");
} else {
expect().assertFail();
console.info(TAG + "Error in SUB_MULTIMEDIA_CAMERA_ON_FOCUSSTATECHANGE_0100 FAILED: " + err.message);
}
await sleep(1000);
done();
})
}
await sleep(1000);
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_SESSION_ON_ERROR_0100
* @tc.name : camera session callback on error
* @tc.desc : camera session callback on error
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_MULTIMEDIA_CAMERA_CAMERA_SESSION_ON_ERROR_0100', 1, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_CAMERA_SESSION_ON_ERROR_0100--------------");
if (isEmpty(mCameraSession)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_SESSION_ON_ERROR_0100 previewOutput == null || undefined")
expect().assertFail();
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_SESSION_ON_ERROR_0100 to operate");
mCameraSession.on('error', async (err, data) => {
if (!err) {
expect(true).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_SESSION_ON_ERROR_0100 success");
} else {
expect().assertFail();
console.info(TAG + "Error in SUB_MULTIMEDIA_CAMERA_CAMERA_SESSION_ON_ERROR_0100 FAILED: " + err.message);
}
await sleep(1000);
done();
})
}
await sleep(1000);
done();
})
})
}
\ No newline at end of file
......@@ -323,7 +323,6 @@ export default function cameraSessionVideoStabilizationTest() {
if (!isEmpty(mCameraInput)) {
await mCameraInput.close();
await mCameraInput.release();
}
console.info('Exit releaseInput');
......
......@@ -327,7 +327,6 @@ export default function cameraSessionZoomRatioTest() {
if (!isEmpty(mCameraInput)) {
await mCameraInput.close();
await mCameraInput.release();
}
console.info('Exit releaseInput');
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册