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

!7229 Xts camera error code test case

Merge pull request !7229 from 马利/master
......@@ -131,11 +131,12 @@ export default function CameraErrorCodeUsecaseTest() {
return true;
}
function releaseInput() {
async function releaseInput() {
console.info(TAG + 'Enter releaseInput');
if (!isEmpty(mCameraInput)) {
mCameraInput.close();
await mCameraInput.close();
mCameraInput = null;
}
console.info(TAG + 'Exit releaseInput');
......@@ -177,6 +178,7 @@ export default function CameraErrorCodeUsecaseTest() {
function releaseCameraSessionInstance() {
mCameraSession.release();
mCameraSession = null;
}
async function getPhotoReceiverSurface() {
......@@ -328,6 +330,12 @@ export default function CameraErrorCodeUsecaseTest() {
afterEach(async function () {
console.info('afterEach case');
if (!isEmpty(mCameraInput)) {
await releaseInput();
}
if (!isEmpty(mCameraSession)) {
releaseCameraSessionInstance();
}
})
afterAll(function () {
......@@ -679,8 +687,6 @@ export default function CameraErrorCodeUsecaseTest() {
expect(error.code == cameraObj.CameraErrorCode.INVALID_ARGUMENT).assertTrue();
expect(true).assertTrue();
}
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -703,8 +709,6 @@ export default function CameraErrorCodeUsecaseTest() {
expect(error.code == cameraObj.CameraErrorCode.INVALID_ARGUMENT).assertTrue();
expect(true).assertTrue();
}
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -727,8 +731,6 @@ export default function CameraErrorCodeUsecaseTest() {
expect(error.code == cameraObj.CameraErrorCode.INVALID_ARGUMENT).assertTrue();
expect(true).assertTrue();
}
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -751,8 +753,6 @@ export default function CameraErrorCodeUsecaseTest() {
expect(error.code == cameraObj.CameraErrorCode.INVALID_ARGUMENT).assertTrue();
expect(true).assertTrue();
}
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -775,8 +775,6 @@ export default function CameraErrorCodeUsecaseTest() {
expect(error.code == cameraObj.CameraErrorCode.INVALID_ARGUMENT).assertTrue();
expect(true).assertTrue();
}
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -799,8 +797,6 @@ export default function CameraErrorCodeUsecaseTest() {
expect(error.code == cameraObj.CameraErrorCode.INVALID_ARGUMENT).assertTrue();
expect(true).assertTrue();
}
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -823,8 +819,6 @@ export default function CameraErrorCodeUsecaseTest() {
expect(error.code == cameraObj.CameraErrorCode.INVALID_ARGUMENT).assertTrue();
expect(true).assertTrue();
}
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -847,8 +841,6 @@ export default function CameraErrorCodeUsecaseTest() {
expect(error.code == cameraObj.CameraErrorCode.INVALID_ARGUMENT).assertTrue();
expect(true).assertTrue();
}
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -877,13 +869,8 @@ export default function CameraErrorCodeUsecaseTest() {
console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PHOTOOUTPUT_CAPTURE_0200 FAILED");
console.info(TAG + "ERRORCODE: " + err.code);
expect(err.code == cameraObj.CameraErrorCode.INVALID_ARGUMENT).assertTrue();
expect(true).assertTrue();
}
})
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -913,10 +900,6 @@ export default function CameraErrorCodeUsecaseTest() {
expect(err.code == cameraObj.CameraErrorCode.INVALID_ARGUMENT).assertTrue();
expect(true).assertTrue();
});
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -942,10 +925,6 @@ export default function CameraErrorCodeUsecaseTest() {
expect(true).assertTrue();
}
})
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -969,10 +948,6 @@ export default function CameraErrorCodeUsecaseTest() {
expect(err.code == cameraObj.CameraErrorCode.OPERATION_NOT_ALLOWED).assertTrue();
expect(true).assertTrue();
});
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -996,10 +971,6 @@ export default function CameraErrorCodeUsecaseTest() {
expect(error.code == cameraObj.CameraErrorCode.OPERATION_NOT_ALLOWED).assertTrue();
expect(true).assertTrue();
}
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -1023,10 +994,6 @@ export default function CameraErrorCodeUsecaseTest() {
expect(error.code == cameraObj.CameraErrorCode.OPERATION_NOT_ALLOWED).assertTrue();
expect(true).assertTrue();
}
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -1051,10 +1018,6 @@ export default function CameraErrorCodeUsecaseTest() {
expect(error.code == cameraObj.CameraErrorCode.OPERATION_NOT_ALLOWED).assertTrue();
expect(true).assertTrue();
}
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -1079,10 +1042,6 @@ export default function CameraErrorCodeUsecaseTest() {
expect(error.code == cameraObj.CameraErrorCode.OPERATION_NOT_ALLOWED).assertTrue();
expect(true).assertTrue();
}
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -1111,10 +1070,6 @@ export default function CameraErrorCodeUsecaseTest() {
expect(err.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue();
expect(true).assertTrue();
});
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -1144,10 +1099,6 @@ export default function CameraErrorCodeUsecaseTest() {
expect(err.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue();
}
})
sleep(1000);
releaseInput();
sleep(1000);
releaseCameraSessionInstance();
done();
})
......@@ -1175,10 +1126,6 @@ export default function CameraErrorCodeUsecaseTest() {
console.info(TAG + "cameraObj.CameraErrorCode.SESSION_NOT_CONFIG: " + cameraObj.CameraErrorCode.SESSION_NOT_CONFIG);
expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue();
};
sleep(1000);
releaseInput();
sleep(1000);
releaseCameraSessionInstance();
done();
})
......@@ -1206,10 +1153,6 @@ export default function CameraErrorCodeUsecaseTest() {
expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue();
expect(true).assertTrue();
};
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -1237,10 +1180,6 @@ export default function CameraErrorCodeUsecaseTest() {
expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue();
expect(true).assertTrue();
};
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -1268,10 +1207,34 @@ export default function CameraErrorCodeUsecaseTest() {
expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue();
expect(true).assertTrue();
};
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETFLASHMODE_0101
* @tc.name : capturesession setFlashMode api
* @tc.desc : capturesession setFlashMode api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETFLASHMODE_0101', 0, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETFLASHMODE_0101--------------");
await createInput(0);
createCameraSessionInstance();
mCameraSession.addInput(mCameraInput);
createOutput(0);
mCameraSession.addOutput(mPreviewOutput);
mCameraSession.addOutput(mPhotoOutput);
await commitCameraSessionConfig();
await mCameraSession.start();
try{
mCameraSession.setFlashMode(5);
} catch (error) {
console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETFLASHMODE_0101 FAILED");
console.info(TAG + "ERRORCODE: " + error.code);
expect(error.code != cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue();
};
done();
})
......@@ -1299,10 +1262,6 @@ export default function CameraErrorCodeUsecaseTest() {
expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue();
expect(true).assertTrue();
};
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -1330,10 +1289,6 @@ export default function CameraErrorCodeUsecaseTest() {
expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue();
expect(true).assertTrue();
};
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -1360,10 +1315,34 @@ export default function CameraErrorCodeUsecaseTest() {
console.info(TAG + "ERRORCODE: " + error.code);
expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue();
};
sleep(1000);
releaseInput();
sleep(1000);
releaseCameraSessionInstance();
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETEXPOSUREMODE_0101
* @tc.name : capturesession setExposureMode api
* @tc.desc : capturesession setExposureMode api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETEXPOSUREMODE_0101', 0, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETEXPOSUREMODE_0101--------------");
await createInput(0);
createCameraSessionInstance();
mCameraSession.addInput(mCameraInput);
createOutput(0);
mCameraSession.addOutput(mPreviewOutput);
mCameraSession.addOutput(mPhotoOutput);
await commitCameraSessionConfig();
await mCameraSession.start();
try{
mCameraSession.setExposureMode(5);
} catch (error) {
console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETEXPOSUREMODE_0101 FAILED");
console.info(TAG + "ERRORCODE: " + error.code);
expect(error.code != cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue();
};
done();
})
......@@ -1391,10 +1370,6 @@ export default function CameraErrorCodeUsecaseTest() {
expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue();
expect(true).assertTrue();
};
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -1422,10 +1397,34 @@ export default function CameraErrorCodeUsecaseTest() {
expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue();
expect(true).assertTrue();
};
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETMETERINGPOINT_0101
* @tc.name : capturesession setMeteringPoint api
* @tc.desc : capturesession setMeteringPoint api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETMETERINGPOINT_0101', 0, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETMETERINGPOINT_0101--------------");
await createInput(0);
createCameraSessionInstance();
mCameraSession.addInput(mCameraInput);
createOutput(0);
mCameraSession.addOutput(mPreviewOutput);
mCameraSession.addOutput(mPhotoOutput);
await commitCameraSessionConfig();
await mCameraSession.start();
try{
mCameraSession.setMeteringPoint({x:-1,y:-1});
} catch (error) {
console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETMETERINGPOINT_0101 FAILED");
console.info(TAG + "ERRORCODE: " + error.code);
expect(error.code != cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue();
};
done();
})
......@@ -1453,10 +1452,6 @@ export default function CameraErrorCodeUsecaseTest() {
expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue();
expect(true).assertTrue();
};
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -1485,10 +1480,35 @@ export default function CameraErrorCodeUsecaseTest() {
expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue();
expect(true).assertTrue();
};
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETEXPOSUREBIAS_0101
* @tc.name : capturesession setExposureBias api
* @tc.desc : capturesession setExposureBias api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETEXPOSUREBIAS_0101', 0, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETEXPOSUREBIAS_0101--------------");
await createInput(0);
createCameraSessionInstance();
mCameraSession.addInput(mCameraInput);
createOutput(0);
mCameraSession.addOutput(mPreviewOutput);
mCameraSession.addOutput(mPhotoOutput);
await commitCameraSessionConfig();
await mCameraSession.start();
try{
let range = mCameraSession.getExposureBiasRange();
mCameraSession.setExposureBias(-101);
} catch (error) {
console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETEXPOSUREBIAS_0101 FAILED");
console.info(TAG + "ERRORCODE: " + error.code);
expect(error.code != cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue();
};
done();
})
......@@ -1516,10 +1536,6 @@ export default function CameraErrorCodeUsecaseTest() {
expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue();
expect(true).assertTrue();
};
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -1547,10 +1563,6 @@ export default function CameraErrorCodeUsecaseTest() {
expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue();
expect(true).assertTrue();
};
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -1578,10 +1590,6 @@ export default function CameraErrorCodeUsecaseTest() {
expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue();
expect(true).assertTrue();
};
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -1608,10 +1616,34 @@ export default function CameraErrorCodeUsecaseTest() {
console.info(TAG + "ERRORCODE: " + error.code);
expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue();
};
sleep(1000);
releaseInput();
sleep(1000);
releaseCameraSessionInstance();
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETFOCUSMODE_0101
* @tc.name : capturesession setFocusMode api
* @tc.desc : capturesession setFocusMode api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETFOCUSMODE_0101', 0, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETFOCUSMODE_0101--------------");
await createInput(0);
createCameraSessionInstance();
mCameraSession.addInput(mCameraInput);
createOutput(0);
mCameraSession.addOutput(mPreviewOutput);
mCameraSession.addOutput(mPhotoOutput);
await commitCameraSessionConfig();
await mCameraSession.start();
try{
mCameraSession.setFocusMode(5);
} catch (error) {
console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETFOCUSMODE_0101 FAILED");
console.info(TAG + "ERRORCODE: " + error.code);
expect(error.code != cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue();
};
done();
})
......@@ -1639,10 +1671,34 @@ export default function CameraErrorCodeUsecaseTest() {
expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue();
expect(true).assertTrue();
};
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETFOCUSPOINT_0101
* @tc.name : capturesession setFocusPoint api
* @tc.desc : capturesession setFocusPoint api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETFOCUSPOINT_0101', 0, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETFOCUSPOINT_0101--------------");
await createInput(0);
createCameraSessionInstance();
mCameraSession.addInput(mCameraInput);
createOutput(0);
mCameraSession.addOutput(mPreviewOutput);
mCameraSession.addOutput(mPhotoOutput);
await commitCameraSessionConfig();
await mCameraSession.start();
try{
mCameraSession.setFocusPoint({x:-1,y:-1});
} catch (error) {
console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETFOCUSPOINT_0101 FAILED");
console.info(TAG + "ERRORCODE: " + error.code);
expect(error.code != cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue();
};
done();
})
......@@ -1670,10 +1726,6 @@ export default function CameraErrorCodeUsecaseTest() {
expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue();
expect(true).assertTrue();
};
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -1701,10 +1753,6 @@ export default function CameraErrorCodeUsecaseTest() {
expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue();
expect(true).assertTrue();
};
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -1732,10 +1780,6 @@ export default function CameraErrorCodeUsecaseTest() {
expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue();
expect(true).assertTrue();
};
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -1763,10 +1807,6 @@ export default function CameraErrorCodeUsecaseTest() {
expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue();
expect(true).assertTrue();
};
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -1795,10 +1835,35 @@ export default function CameraErrorCodeUsecaseTest() {
expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue();
expect(true).assertTrue();
};
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETZOOMRATIO_0101
* @tc.name : capturesession setZoomRatio api
* @tc.desc : capturesession setZoomRatio api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETZOOMRATIO_0101', 0, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETZOOMRATIO_0101--------------");
await createInput(0);
createCameraSessionInstance();
mCameraSession.addInput(mCameraInput);
createOutput(0);
mCameraSession.addOutput(mPreviewOutput);
mCameraSession.addOutput(mPhotoOutput);
await commitCameraSessionConfig();
await mCameraSession.start();
try{
let zoomratiorange = mCameraSession.getZoomRatioRange();
mCameraSession.setZoomRatio(-101);
} catch (error) {
console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETZOOMRATIO_0101 FAILED");
console.info(TAG + "ERRORCODE: " + error.code);
expect(error.code != cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue();
};
done();
})
......@@ -1826,10 +1891,6 @@ export default function CameraErrorCodeUsecaseTest() {
expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue();
expect(true).assertTrue();
};
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -1857,10 +1918,6 @@ export default function CameraErrorCodeUsecaseTest() {
expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue();
expect(true).assertTrue();
};
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -1888,10 +1945,34 @@ export default function CameraErrorCodeUsecaseTest() {
expect(error.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue();
expect(true).assertTrue();
};
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETVSTMODE_0101
* @tc.name : capturesession setVideoStabilizationMode api
* @tc.desc : capturesession setVideoStabilizationMode api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETVSTMODE_0101', 0, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETVSTMODE_0101--------------");
await createInput(0);
createCameraSessionInstance();
mCameraSession.addInput(mCameraInput);
createOutput(0);
mCameraSession.addOutput(mPreviewOutput);
mCameraSession.addOutput(mPhotoOutput);
await commitCameraSessionConfig();
await mCameraSession.start();
try{
mCameraSession.setVideoStabilizationMode(5);
} catch (error) {
console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAPTURESESSION_SETVSTMODE_0101 FAILED");
console.info(TAG + "ERRORCODE: " + error.code);
expect(error.code != cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue();
};
done();
})
......@@ -1921,10 +2002,6 @@ export default function CameraErrorCodeUsecaseTest() {
expect(true).assertTrue();
}
})
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -1952,10 +2029,6 @@ export default function CameraErrorCodeUsecaseTest() {
console.info(TAG + "ERRORCODE: " + err.code);
expect(err.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue();
});
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -1995,10 +2068,6 @@ export default function CameraErrorCodeUsecaseTest() {
}
})
}
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -2027,10 +2096,6 @@ export default function CameraErrorCodeUsecaseTest() {
expect(err.code == cameraObj.CameraErrorCode.SESSION_NOT_CONFIG).assertTrue();
});
}
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -2063,10 +2128,6 @@ export default function CameraErrorCodeUsecaseTest() {
}
})
}
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -2097,10 +2158,6 @@ export default function CameraErrorCodeUsecaseTest() {
expect(true).assertTrue();
});
}
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -2121,18 +2178,14 @@ export default function CameraErrorCodeUsecaseTest() {
mCameraSession.addOutput(mPreviewOutput);
mCameraSession.addOutput(mPhotoOutput);
await commitCameraSessionConfig();
await mPhotoOutput.capture().then((result) => {
console.info('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PHOTOOUTPUT_CAPTURE_0500 success :' + result);
}).catch((err) => {
try {
await mPhotoOutput.capture();
} catch (err) {
console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PHOTOOUTPUT_CAPTURE_0500 FAILED");
console.info(TAG + "ERRORCODE: " + err.code);
expect(err.code == cameraObj.CameraErrorCode.SESSION_NOT_RUNNING).assertTrue();
expect(true).assertTrue();
});
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
}
done();
})
......@@ -2161,13 +2214,8 @@ export default function CameraErrorCodeUsecaseTest() {
console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PHOTOOUTPUT_CAPTURE_0600 FAILED");
console.info(TAG + "ERRORCODE: " + err.code);
expect(err.code == cameraObj.CameraErrorCode.SESSION_NOT_RUNNING).assertTrue();
expect(true).assertTrue();
}
})
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -2196,13 +2244,8 @@ export default function CameraErrorCodeUsecaseTest() {
console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PHOTOOUTPUT_CAPTURE_0700 FAILED");
console.info(TAG + "ERRORCODE: " + err.code);
expect(err.code == cameraObj.CameraErrorCode.SESSION_NOT_RUNNING).assertTrue();
expect(true).assertTrue();
}
})
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -2223,18 +2266,14 @@ export default function CameraErrorCodeUsecaseTest() {
mCameraSession.addOutput(mPreviewOutput);
mCameraSession.addOutput(mPhotoOutput);
await commitCameraSessionConfig();
await mPhotoOutput.capture(captureSetting).then((result) => {
console.info('SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PHOTOOUTPUT_CAPTURE_0800 success :' + result);
}).catch((err) => {
try {
await mPhotoOutput.capture(captureSetting);
} catch (err) {
console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_PHOTOOUTPUT_CAPTURE_0800 FAILED");
console.info(TAG + "ERRORCODE: " + err.code);
expect(err.code == cameraObj.CameraErrorCode.SESSION_NOT_RUNNING).assertTrue();
expect(true).assertTrue();
});
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
}
done();
})
......@@ -2259,10 +2298,6 @@ export default function CameraErrorCodeUsecaseTest() {
expect(error.code == cameraObj.CameraErrorCode.SESSION_CONFIG_LOCKED).assertTrue();
expect(true).assertTrue();
}
sleep(100);
releaseInput();
sleep(100);
releaseCameraSessionInstance();
done();
})
......@@ -2300,8 +2335,6 @@ export default function CameraErrorCodeUsecaseTest() {
} else {
console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAMERAINPUT_OPEN_CONFLICT_0100 createCameraInput FAILED");
}
sleep(100);
releaseInput();
done();
})
......@@ -2334,8 +2367,6 @@ export default function CameraErrorCodeUsecaseTest() {
} else {
console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ERROR_CODE_USECASE_CAMERAINPUT_OPEN_CONFLICT_0200 createCameraInput FAILED");
}
sleep(100);
releaseInput();
done();
})
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册