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

!7160 【xts】【挑单monthly】接口同步与错误码整改

Merge pull request !7160 from SongChunPeng/monthly_20221018
......@@ -5,7 +5,7 @@
"test-timeout": "3000000",
"bundle-name":"com.open.harmony.multimedia.cameratest",
"package-name": "com.open.harmony.multimedia.cameratest",
"shell-timeout": "60000",
"shell-timeout": "600000",
"testcase-timeout": 100000
},
"kits": [
......
......@@ -22,9 +22,11 @@ import cameraSessionZoomRatioTest from './CameraSessionZoomRatioTest.test.ets'
import cameraSessionVideoStabilizationTest from './CameraSessionVideoStabilizationTest.test.ets'
import cameraSessionBaseTest from './CameraSessionBaseTest.test.ets'
import cameraInputTest from './CameraInputTest.test.ets'
import CameraErrorCodeUsecaseTest from './CameraErrorCodeUsecaseTest.test.ets'
import cameraManagerTest from './CameraManagerTest.test.ets'
import cameraEnumTest from './CameraEnumTest.test.ets'
let TAG = 'CameraModuleTest: '
export default function cameraKit() {
......@@ -37,6 +39,7 @@ export default function cameraKit() {
cameraSessionZoomRatioTest()
cameraSessionVideoStabilizationTest()
cameraSessionBaseTest()
CameraErrorCodeUsecaseTest()
cameraManagerTest()
cameraEnumTest()
}
\ No newline at end of file
......@@ -96,12 +96,12 @@ export default function cameraEnumTest() {
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_CAMERATYPE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_CAMERATYPE_0100--------------");
expect(camera.CameraType.CAMERA_TYPE_UNSPECIFIED == 0).assertTrue();
console.info("CameraType: "+ JSON.stringify(camera.CameraType));
expect(camera.CameraType.CAMERA_TYPE_DEFAULT == 0).assertTrue();
expect(camera.CameraType.CAMERA_TYPE_WIDE_ANGLE == 1).assertTrue();
expect(camera.CameraType.CAMERA_TYPE_ULTRA_WIDE == 2).assertTrue();
expect(camera.CameraType.CAMERA_TYPE_TELEPHOTO == 3).assertTrue();
expect(camera.CameraType.CAMERA_TYPE_TRUE_DEPTH == 4).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_CAMERATYPE_0100 ends here");
done();
})
......@@ -125,28 +125,6 @@ export default function cameraEnumTest() {
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAINPUTERRORCODE_0100
* @tc.name : Camera CameraInputErrorCode Eunm
* @tc.desc : Camera CameraInputErrorCode Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAINPUTERRORCODE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAINPUTERRORCODE_0100--------------");
expect(camera.CameraInputErrorCode.ERROR_UNKNOWN == -1).assertTrue();
expect(camera.CameraInputErrorCode.ERROR_NO_PERMISSION == 0).assertTrue();
expect(camera.CameraInputErrorCode.ERROR_DEVICE_PREEMPTED == 1).assertTrue();
expect(camera.CameraInputErrorCode.ERROR_DEVICE_DISCONNECTED == 2).assertTrue();
expect(camera.CameraInputErrorCode.ERROR_DEVICE_IN_USE == 3).assertTrue();
expect(camera.CameraInputErrorCode.ERROR_DRIVER_ERROR == 4).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAINPUTERRORCODE_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAFORMAT_0100
* @tc.name : Camera CameraFormat Eunm
......@@ -260,45 +238,6 @@ export default function cameraEnumTest() {
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_CAPTURESESSIONERRORCODE_0100
* @tc.name : Camera CaptureSessionErrorCode Eunm
* @tc.desc : Camera CaptureSessionErrorCode Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_CAPTURESESSIONERRORCODE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_CAPTURESESSIONERRORCODE_0100--------------");
expect(camera.CaptureSessionErrorCode.ERROR_UNKNOWN == -1).assertTrue();
expect(camera.CaptureSessionErrorCode.ERROR_INSUFFICIENT_RESOURCES == 0).assertTrue();
expect(camera.CaptureSessionErrorCode.ERROR_TIMEOUT == 1).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_CAPTURESESSIONERRORCODE_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_PREVIEWOUTPUTERRORCODE_0100
* @tc.name : Camera PreviewOutputErrorCode Eunm
* @tc.desc : Camera PreviewOutputErrorCode Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_PREVIEWOUTPUTERRORCODE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_PREVIEWOUTPUTERRORCODE_0100--------------");
expect(camera.PreviewOutputErrorCode.ERROR_UNKNOWN == -1).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_PREVIEWOUTPUTERRORCODE_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_IMAGEROTATION_0100
* @tc.name : Camera ImageRotation Eunm
......@@ -337,48 +276,6 @@ export default function cameraEnumTest() {
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_PHOTOOUTPUTERRORCODE_0100
* @tc.name : Camera PhotoOutputErrorCode Eunm
* @tc.desc : Camera PhotoOutputErrorCode Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_PHOTOOUTPUTERRORCODE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_PHOTOOUTPUTERRORCODE_0100--------------");
expect(camera.PhotoOutputErrorCode.ERROR_UNKNOWN == -1).assertTrue();
expect(camera.PhotoOutputErrorCode.ERROR_DRIVER_ERROR == 0).assertTrue();
expect(camera.PhotoOutputErrorCode.ERROR_INSUFFICIENT_RESOURCES == 1).assertTrue();
expect(camera.PhotoOutputErrorCode.ERROR_TIMEOUT == 2).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_PHOTOOUTPUTERRORCODE_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_VIDEOOUTPUTERRORCODE_0100
* @tc.name : Camera VideoOutputErrorCode Eunm
* @tc.desc : Camera VideoOutputErrorCode Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_VIDEOOUTPUTERRORCODE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_VIDEOOUTPUTERRORCODE_0100--------------");
expect(camera.VideoOutputErrorCode.ERROR_UNKNOWN == -1).assertTrue();
expect(camera.VideoOutputErrorCode.ERROR_DRIVER_ERROR == 0).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_VIDEOOUTPUTERRORCODE_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_METADATAOBJECTTYPE_0100
* @tc.name : Camera MetadataObjectType Eunm
......@@ -396,21 +293,27 @@ export default function cameraEnumTest() {
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_METADATAOUTPUTERRORCODE_0100
* @tc.name : Camera MetadataOutputErrorCode Eunm
* @tc.desc : Camera MetadataOutputErrorCode Eunm
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAERRORCODE_0100
* @tc.name : Camera CameraErrorCode Eunm
* @tc.desc : Camera CameraErrorCode Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_METADATAOUTPUTERRORCODE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_METADATAOUTPUTERRORCODE_0100--------------");
expect(camera.MetadataOutputErrorCode.ERROR_UNKNOWN == -1).assertTrue();
expect(camera.MetadataOutputErrorCode.ERROR_INSUFFICIENT_RESOURCES == 0).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_METADATAOUTPUTERRORCODE_0100 ends here");
it('SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAERRORCODE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAERRORCODE_0100--------------");
expect(camera.CameraErrorCode.INVALID_ARGUMENT == 7400101).assertTrue();
expect(camera.CameraErrorCode.OPERATION_NOT_ALLOWED == 7400102).assertTrue();
expect(camera.CameraErrorCode.SESSION_NOT_CONFIG == 7400103).assertTrue();
expect(camera.CameraErrorCode.SESSION_NOT_RUNNING == 7400104).assertTrue();
expect(camera.CameraErrorCode.SESSION_CONFIG_LOCKED == 7400105).assertTrue();
expect(camera.CameraErrorCode.DEVICE_SETTING_LOCKED == 7400106).assertTrue();
expect(camera.CameraErrorCode.CONFILICT_CAMERA == 7400107).assertTrue();
expect(camera.CameraErrorCode.DEVICE_DISABLED == 7400108).assertTrue();
expect(camera.CameraErrorCode.SERVICE_FATAL_ERROR == 7400201).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAERRORCODE_0100 ends here");
done();
})
})
}
\ No newline at end of file
......@@ -69,10 +69,10 @@ export default function CameraInputTest() {
}
}
async function getCameraManagerInstance() {
function getCameraManagerInstance() {
console.info('Enter getCameraManagerInstance');
mCameraManager = await cameraObj.getCameraManager(null);
mCameraManager = cameraObj.getCameraManager(null);
if (isEmpty(mCameraManager)) {
console.info(TAG + "getCameraManager FAILED");
return false;
......@@ -83,10 +83,10 @@ export default function CameraInputTest() {
return true;
}
async function getCameraSupportDevicesArray() {
function getCameraSupportDevicesArray() {
console.info('Enter getCameraSupportDevicesArray');
mCameraDevicesArray = await mCameraManager.getSupportedCameras();
mCameraDevicesArray = mCameraManager.getSupportedCameras();
/*
mCameraManager.getSupportedCameras(async (err, data) => {
console.info(TAG + "Entering getCameraSupportDevicesArray callback");
......@@ -118,19 +118,12 @@ export default function CameraInputTest() {
return true;
}
async function beginCameraSessionConfig() {
function beginCameraSessionConfig() {
console.info('Enter beginCameraSessionConfig');
mCameraSession.beginConfig(async (err) => {
if (!err) {
console.info(TAG + "Entering beginConfig PASSED");
} else {
console.info(TAG + "Entering beginConfig FAILED : " + err.message);
}
})
await sleep(30);
console.info(TAG + "Entering beginConfig start");
mCameraSession.beginConfig();
console.info(TAG + "Entering beginConfig end");
console.info('Exit beginCameraSessionConfig');
return true;
......@@ -154,11 +147,11 @@ export default function CameraInputTest() {
return true;
}
async function createCameraSessionInstance() {
function createCameraSessionInstance() {
console.info('Enter createCameraSessionInstance');
try {
mCameraSession = await mCameraManager.createCaptureSession();
mCameraSession = mCameraManager.createCaptureSession();
}
catch {
console.info('createCaptureSession FAILED');
......@@ -169,7 +162,7 @@ export default function CameraInputTest() {
return false;
}
await beginCameraSessionConfig();
beginCameraSessionConfig();
console.info('Exit createCameraSessionInstance');
......@@ -188,29 +181,16 @@ export default function CameraInputTest() {
return false;
}
mCameraInput = null;
await mCameraManager.createCameraInput(mCameraDevicesArray[idx]).then((result) => {
console.info('createCameraInput success');
mCameraInput = result;
}).catch((err) => {
console.info('createCameraInput failed, err = ' + err.message);
});
mCameraInput = mCameraManager.createCameraInput(mCameraDevicesArray[idx]);
if (isEmpty(mCameraInput)) {
console.info(TAG + "createCameraInput FAILED");
return false;
}
mCameraInput.open(async (err) => {
console.info(TAG + "Entering mCameraInput open callback");
if (!err) {
console.info(TAG + "Entering mCameraInput open PASSED ");
} else {
console.info(TAG + "Entering mCameraInput open FAILED : " + err.message);
}
})
await mCameraInput.open();
await sleep(100);
sleep(100);
console.info(idx + 'th CameraInput is: ' + mCameraInput);
......@@ -224,7 +204,6 @@ export default function CameraInputTest() {
if (!isEmpty(mCameraInput)) {
await mCameraInput.close();
await mCameraInput.release();
}
console.info('Exit releaseInput');
......@@ -232,23 +211,16 @@ export default function CameraInputTest() {
return true;
}
async function createOutput(idx:any) {
function createOutput(idx:any) {
console.info('Enter createOutput');
let cameraOutputCap = null;
await mCameraManager.getSupportedOutputCapability(mCameraDevicesArray[idx]).then((result) => {
console.info('getSupportedOutputCapability success');
cameraOutputCap = result;
}).catch((err) => {
console.info('getSupportedOutputCapability failed, err = ' + err.message);
mPreviewOutput = null;
});
let cameraOutputCap = mCameraManager.getSupportedOutputCapability(mCameraDevicesArray[idx]);
if (!isEmpty(cameraOutputCap)) {
if (!isEmpty(cameraOutputCap.previewProfiles)) {
console.info(TAG + "cameraOutputCap.previewProfiles.length: " + cameraOutputCap.previewProfiles.length);
for (let i = 0; i < cameraOutputCap.previewProfiles.length; i++) {
mPreviewOutput = await mCameraManager.createPreviewOutput(cameraOutputCap.previewProfiles[i], globalThis.surfaceId);
mPreviewOutput = mCameraManager.createPreviewOutput(cameraOutputCap.previewProfiles[i], globalThis.surfaceId);
if (!isEmpty(mPreviewOutput)) {
break;
}
......@@ -271,7 +243,6 @@ export default function CameraInputTest() {
console.info('Enter releaseOutput');
if (!isEmpty(mPreviewOutput)) {
await mPreviewOutput.stop();
await mPreviewOutput.release();
}
......@@ -284,18 +255,18 @@ export default function CameraInputTest() {
console.info(TAG + "Enter startCameraSession");
await createInput(idx);
await createOutput(idx);
createOutput(idx);
await sleep(1);
if (!isEmpty(mCameraInput)) {
console.info(TAG + "Start to addInput");
await mCameraSession.addInput(mCameraInput);
mCameraSession.addInput(mCameraInput);
}
if (!isEmpty(mPreviewOutput)) {
console.info(TAG + "Start to addOutput mPreviewOutput");
await mCameraSession.addOutput(mPreviewOutput);
mCameraSession.addOutput(mPreviewOutput);
}
await sleep(1);
......@@ -312,12 +283,12 @@ export default function CameraInputTest() {
if (!isEmpty(mCameraInput)) {
console.info(TAG + "Start to removeInput input");
await mCameraSession.removeInput(mCameraInput);
mCameraSession.removeInput(mCameraInput);
}
if (!isEmpty(mPreviewOutput)) {
console.info(TAG + "Start to removeOutput mPreviewOutput");
await mCameraSession.removeOutput(mPreviewOutput);
mCameraSession.removeOutput(mPreviewOutput);
}
await releaseInput();
......@@ -334,9 +305,9 @@ export default function CameraInputTest() {
await getPermission();
sleep(1000);
await driveFn();
await getCameraManagerInstance();
await getCameraSupportDevicesArray();
await createCameraSessionInstance();
getCameraManagerInstance();
getCameraSupportDevicesArray();
createCameraSessionInstance();
console.info('beforeAll case');
});
beforeEach(function () {
......@@ -410,32 +381,32 @@ 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;
for (let i = 0; i < camerasArray.length; i++) {
let successFlag = false;
console.info(TAG + "Entering createCameraInput with camera: " + camerasArray[i].cameraId);
await mCameraManager.createCameraInput(camerasArray[i]).then(async (cameraInput) => {
let cameraInput = mCameraManager.createCameraInput(camerasArray[i]);
expect(isEmpty(cameraInput)).assertFalse();
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);
......@@ -443,97 +414,67 @@ 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);
} 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);
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 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);
}).catch((err) => {
expect().assertFail();
console.info(TAG + " Failed To create cameraInput cameraId: " + camerasArray[i].cameraId + +JSON.stringify(err));
});
}
}
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);
mCameraManager.createCameraInput(camerasArray[i], async (err, cameraInput) => {
if (!err) {
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);
} else {
expect().assertFail();
console.info(TAG + functionTag + " FAILED: " + err.message);
}
});
await sleep(600);
}
//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();
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册