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

!6185 Add xts case for metadata output

Merge pull request !6185 from wuhao/master
......@@ -23,49 +23,27 @@ const TAG = "CameraInputTest: ";
// Define global variables
let mCameraManager;
let surfaceId1;
let mCameraDevicesArray;
let mCameraSession;
let mCameraNum;
let mCameraInput;
let mPreviewOutput;
export default function CameraInputTest(surfaceId) {
async function getImageReceiverSurfaceId() {
console.log(TAG + 'Entering create Image receiver');
let receiver = image.createImageReceiver(640, 480, 4, 8);
console.log(TAG + 'before receiver check');
if (receiver !== undefined) {
console.log(TAG + 'Receiver is ok');
surfaceId1 = await receiver.getReceivingSurfaceId();
console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1));
} else {
console.log(TAG + 'Receiver is not ok');
}
function sleep(ms) {
console.info(TAG + "Entering sleep -> Promise constructor");
return new Promise(resolve => setTimeout(resolve, ms));
}
const sleep = (delay) => new Promise(resolve => setTimeout(resolve, delay));
function isEmpty(data) {
if (data == null || data == undefined) {
return true;
}
return false;
}
async function getCameraInputTestInstance() {
mCameraManager = await cameraObj.getCameraManager(null);
if (isEmpty(mCameraManager)) {
console.info(TAG + "getCameraManager FAILED");
return false;
}
return true;
}
async function getSupportedCamerasArray() {
if (isEmpty(mCameraManager)) {
console.info(TAG + "getCameraManager FAILED");
} else {
mCameraDevicesArray = await mCameraManager.getSupportedCameras();
console.info(TAG + "getSupportedCamerasArray start " + mCameraDevicesArray.length);
if (mCameraDevicesArray != null && mCameraDevicesArray.length > 0) {
console.info(TAG + "mCameraDevicesArray is not null");
}
}
console.info(TAG + "getSupportedCamerasArray end");
}
async function applyPermission() {
let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100);
let atManager = abilityAccessCtrl.createAtManager();
......@@ -77,6 +55,9 @@ export default function CameraInputTest(surfaceId) {
let permissionName3 = 'ohos.permission.MEDIA_LOCATION';
let permissionName4 = 'ohos.permission.READ_MEDIA';
let permissionName5 = 'ohos.permission.WRITE_MEDIA';
let permissionName6 = 'ohos.permission.START_ABILIIES_FROM_BACKGROUND';
let permissionName7 = 'ohos.permission.START_INVISIBLE_ABILITY';
let permissionName8 = 'ohos.permission.ABILITY_BACKGROUND_COMMUNICATION';
await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
......@@ -102,17 +83,292 @@ export default function CameraInputTest(surfaceId) {
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName6, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName7, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName8, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
} else {
console.info('[permission] case apply permission failed, createAtManager failed');
}
}
describe('CameraInputTest', function () {
async function getCameraManagerInstance() {
console.info('Enter getCameraManagerInstance');
mCameraManager = await cameraObj.getCameraManager(null);
if (isEmpty(mCameraManager)) {
console.info(TAG + "getCameraManager FAILED");
return false;
}
console.info('Exit getCameraManagerInstance');
return true;
}
async function getCameraSupportDevicesArray() {
console.info('Enter getCameraSupportDevicesArray');
mCameraDevicesArray = await mCameraManager.getSupportedCameras();
/*
mCameraManager.getSupportedCameras(async (err, data) => {
console.info(TAG + "Entering getCameraSupportDevicesArray callback");
if (!err) {
if (data != null || data != undefined) {
mCameraDevicesArray = data;
console.info(TAG + "Entering getCameraSupportDevicesArray PASSED with CameraDevicesArray is: " + data);
} else {
console.info(TAG + "Entering getCameraSupportDevicesArray FAILED with CameraDevicesArray is: " + data);
}
} else {
console.info(TAG + "Entering getCameraSupportDevicesArray FAILED : " + err.message);
}
})
await sleep(300);
*/
if (isEmpty(mCameraDevicesArray)) {
console.info(TAG + "getSupportedCameras FAILED");
return false;
}
//mCameraNum = 1;
mCameraNum = mCameraDevicesArray.length;
console.info(TAG + "getCameraSupportDevicesArray is: " + mCameraNum);
console.info('Exit getCameraSupportDevicesArray');
return true;
}
async 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(10);
console.info('Exit beginCameraSessionConfig');
return true;
}
async function commitCameraSessionConfig() {
console.info('Enter commitCameraSessionConfig');
mCameraSession.commitConfig(async (err) => {
if (!err) {
console.info(TAG + "Entering commitConfig PASSED");
} else {
console.info(TAG + "Entering commitConfig FAILED : " + err.message);
}
})
await sleep(500);
console.info('Exit commitCameraSessionConfig');
return true;
}
async function createCameraSessionInstance() {
console.info('Enter createCameraSessionInstance');
try {
mCameraSession = await mCameraManager.createCaptureSession();
}
catch {
console.info('createCaptureSession FAILED');
}
if (isEmpty(mCameraSession)) {
console.info(TAG + "createCaptureSession FAILED");
return false;
}
await beginCameraSessionConfig();
console.info('Exit createCameraSessionInstance');
return true;
}
async function releaseCameraSessionInstance() {
await mCameraSession.release();
}
async function createInput(idx:any) {
console.info('Enter createInput');
if (isEmpty(mCameraDevicesArray)) {
console.info(TAG + "Entering createInputs FAILED with NoCamera");
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);
});
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 sleep(100);
console.info(idx + 'th CameraInput is: ' + mCameraInput);
console.info('Exit createInput');
return true;
}
async function releaseInput() {
console.info('Enter releaseInput');
if (!isEmpty(mCameraInput)) {
await mCameraInput.close();
await mCameraInput.release();
}
console.info('Exit releaseInput');
return true;
}
async 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;
});
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], surfaceId);
if (!isEmpty(mPreviewOutput)) {
break;
}
}
if (isEmpty(mPreviewOutput)) {
console.info(TAG + "createPreviewOutput FAILED");
}
console.info(TAG + "createPreviewOutput: " + mPreviewOutput);
}
}
console.info('Exit createOutputs');
return true;
}
async function releaseOutput() {
console.info('Enter releaseOutput');
if (!isEmpty(mPreviewOutput)) {
await mPreviewOutput.stop();
await mPreviewOutput.release();
}
console.info('Exit releaseOutput');
return true;
}
async function startCameraSession(idx:any) {
console.info(TAG + "Enter startCameraSession");
await createInput(idx);
await createOutput(idx);
await sleep(1);
if (!isEmpty(mCameraInput)) {
console.info(TAG + "Start to addInput");
await mCameraSession.addInput(mCameraInput);
}
if (!isEmpty(mPreviewOutput)) {
console.info(TAG + "Start to addOutput mPreviewOutput");
await mCameraSession.addOutput(mPreviewOutput);
}
await sleep(1);
await commitCameraSessionConfig();
console.info(TAG + "Exit startCameraSession");
return true;
}
async function stopCameraSession() {
console.info(TAG + "Enter stopCameraSession");
if (!isEmpty(mCameraInput)) {
console.info(TAG + "Start to removeInput input");
await mCameraSession.removeInput(mCameraInput);
}
if (!isEmpty(mPreviewOutput)) {
console.info(TAG + "Start to removeOutput mPreviewOutput");
await mCameraSession.removeOutput(mPreviewOutput);
}
await releaseInput();
await releaseOutput();
console.info(TAG + "Exit stopCameraSession");
return true;
}
describe('CameraInputTest', function () {
console.info(TAG + '----------CameraInputTest--------------');
beforeAll(async function () {
await applyPermission();
await getCameraInputTestInstance();
await getSupportedCamerasArray();
await getCameraManagerInstance();
await getCameraSupportDevicesArray();
await createCameraSessionInstance();
console.info('beforeAll case');
});
beforeEach(function () {
......@@ -123,42 +379,179 @@ describe('CameraInputTest', function () {
console.info('afterEach case');
});
afterAll(function () {
releaseCameraSessionInstance();
console.info('afterAll case');
});
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_0100
* @tc.name : callback Camera with cameraInput on api
* @tc.desc : callback Camera with cameraInput on api
* @tc.name : camera status callback on CameraInput async api for error
* @tc.desc : camera status callback on CameraInput async api for error
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_0100', 0, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_0100--------------");
if (isEmpty(mCameraManager)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_0100 cameraManager == null || undefined");
if (mCameraNum == 0) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_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_ERROR_0100 start for camera[" + i + "]");
await startCameraSession(i);
mCameraInput.on('error', 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 {
let camerasArray = mCameraDevicesArray;
for (let i = 0; i < camerasArray.length; i++) {
let successFlag = true;
console.info(TAG + "Entering createCameraInput with camera: " + camerasArray[i].cameraId);
await mCameraManager.createCameraInput(camerasArray[i]).then(async (cameraInput) => {
await cameraInput.on("error", (cameraInputError) => {
console.log(`Camera input error code: ${cameraInputError.code}`);
});
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 + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_0100 FAILED: " + err.message);
}
await sleep(1);
})
await sleep(300);
if (nfyFlag == false) {
//expect().assertFail();
//console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_0100 FAILED without any nofity!");
}
await beginCameraSessionConfig();
await stopCameraSession();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_0100 end for camera[" + i + "]");
}
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_0100 ends here");
await sleep(1000);
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
* @tc.name : open/close/release Camera with cameraInput callback api
......@@ -181,34 +574,34 @@ describe('CameraInputTest', function () {
expect(isEmpty(cameraInput)).assertFalse();
await cameraInput.open(async (err) => {
if (!err) {
console.info(TAG + "PASSED open with CameraID :" + camerasArray[i].cameraId);
console.info(TAG + " PASSED open with CameraID :" + camerasArray[i].cameraId);
} else {
successFlag = false;
console.info(TAG + "open FAILED: " + err.message);
console.info(TAG + " open FAILED: " + err.message);
}
});
await sleep(400);
await cameraInput.close(async (err) => {
if (!err) {
console.info(TAG + "PASSED close with CameraID :" + camerasArray[i].cameraId);
console.info(TAG + " PASSED close with CameraID :" + camerasArray[i].cameraId);
} else {
successFlag = false;
console.info(TAG + "close FAILED: " + err.message);
console.info(TAG + " close FAILED: " + err.message);
}
});
await sleep(100);
await cameraInput.release(async (err) => {
if (!err) {
console.info(TAG + "PASSED release with CameraID :" + camerasArray[i].cameraId);
console.info(TAG + " PASSED release with CameraID :" + camerasArray[i].cameraId);
} else {
successFlag = false;
console.info(TAG + "release FAILED: " + err.message);
console.info(TAG + " release FAILED: " + err.message);
}
});
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 + " Failed To create cameraInput cameraId: " + camerasArray[i].cameraId + +JSON.stringify(err));
});
}
}
......@@ -216,19 +609,20 @@ describe('CameraInputTest', function () {
await sleep(1000);
done();
});
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_Promise_0100
* @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.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_RELEASE_PROMISE_0100', 0, async function (done) {
let functionTag = "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_OPEN_CLOSE_RELEASE_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_RELEASE_PROMISE_0100 cameraManager == null || undefined");
expect().assertFail();
} else {
let camerasArray = mCameraDevicesArray;
......@@ -240,24 +634,24 @@ describe('CameraInputTest', function () {
expect(isEmpty(cameraInput)).assertFalse();
console.info(TAG + functionTag + "Entering cameraInput open with camera: " + camerasArray[i].cameraId);
await cameraInput.open().then(async () => {
console.info(TAG + functionTag + "PASSED open with CameraID :" + camerasArray[i].cameraId);
console.info(TAG + functionTag + " PASSED open with CameraID :" + camerasArray[i].cameraId);
}).catch((err) => {
successFlag = false;
console.info(TAG + functionTag + "open FAILED: " + err.message);
});;
console.info(TAG + functionTag + " open FAILED: " + err.message);
});
await sleep(400);
await cameraInput.close().then(async () => {
console.info(TAG + functionTag + "PASSED close with CameraID :" + camerasArray[i].cameraId);
console.info(TAG + functionTag + " PASSED close with CameraID :" + camerasArray[i].cameraId);
}).catch((err) => {
successFlag = false;
console.info(TAG + functionTag + "close FAILED: " + err.message);
console.info(TAG + functionTag + " close FAILED: " + err.message);
});
await sleep(100);
await cameraInput.release().then(async () => {
console.info(TAG + functionTag + "PASSED release with CameraID :" + camerasArray[i].cameraId);
console.info(TAG + functionTag + " PASSED release with CameraID :" + camerasArray[i].cameraId);
}).catch((err) => {
successFlag = false;
console.info(TAG + functionTag + "release FAILED: " + err.message);
console.info(TAG + functionTag + " release FAILED: " + err.message);
});
expect(successFlag).assertEqual(true);
} else {
......@@ -265,11 +659,14 @@ describe('CameraInputTest', function () {
console.info(TAG + functionTag + " FAILED: " + err.message);
}
});
await sleep(600);
}
await sleep(400 * camerasArray.length);
//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_RELEASE_PROMISE_0100 ends here");
done();
});
})
})
}
\ No newline at end of file
......@@ -22,7 +22,17 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from
const TAG = "CameraUnitTest: ";
let captureLocation = {
latitude: 0,
longitude: 0,
altitude: 0,
}
let captureSetting = {
quality: cameraObj.QualityLevel.QUALITY_LEVEL_LOW,
rotation: cameraObj.ImageRotation.ROTATION_0,
location: captureLocation,
mirror: false
}
// 创建视频录制的参数
......@@ -61,11 +71,15 @@ let cameraInput;
let previewOutput;
let photoOutput;
let videoOutput;
let metadataOutput;
let videoSurfaceId;
let fdPath;
let fileAsset;
let fdNumber;
let mMetadataObjectTypeArray;
let mMetadataObjectArray;
export default function cameraJSUnitOutput(surfaceId: any) {
async function getImageReceiverSurfaceId() {
......@@ -461,8 +475,8 @@ export default function cameraJSUnitOutput(surfaceId: any) {
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100
* @tc.name : Create previewOutput instance async api
* @tc.desc : Create previewOutput instance async api
* @tc.name : Create videoOutput instance async api
* @tc.desc : Create videoOutput instance async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
......@@ -499,6 +513,53 @@ export default function cameraJSUnitOutput(surfaceId: any) {
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_METADATA_OUTPUT_CALLBACK_0100
* @tc.name : Create metadataOutput instance async api
* @tc.desc : Create metadataOutput instance async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_MULTIMEDIA_CAMERA_CREATE_METADATA_OUTPUT_CALLBACK_0100', 1, async function (done) {
console.info(TAG + " --------------SUB_MULTIMEDIA_CAMERA_CREATE_METADATA_OUTPUT_CALLBACK_0100--------------");
if (isEmpty(cameraManager)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_METADATA_OUTPUT_CALLBACK_0100 cameraManager == null || undefined")
expect().assertFail();
} else {
let cameraOutputCap = await getSupportedOutputCapabilityInPromise(cameraDevicesArray[0]);
console.info("SUB_MULTIMEDIA_CAMERA_CREATE_METADATA_OUTPUT_CALLBACK_0100 camera:" + cameraDevicesArray[0].cameraId);
expect(isEmpty(cameraOutputCap)).assertFalse();
mMetadataObjectTypeArray = cameraOutputCap.supportedMetadataObjectTypes;
if (isEmpty(mMetadataObjectTypeArray)) {
console.info("SUB_MULTIMEDIA_CAMERA_CREATE_METADATA_OUTPUT_CALLBACK_0100 end with mMetadataObjectTypeArray is null");
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_METADATA_OUTPUT_CALLBACK_0100 start createMetadataOutput")
cameraManager.createMetadataOutput(mMetadataObjectTypeArray, async (err, data) => {
if (!err) {
if (!isEmpty(data)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_METADATA_OUTPUT_CALLBACK_0100 success");
metadataOutput = data;
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_METADATA_OUTPUT_CALLBACK_0100, data == null || undefined");
expect().assertFail();
}
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_METADATA_OUTPUT_CALLBACK_0100 FAILED: " + err.message);
expect().assertFail();
}
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_METADATA_OUTPUT_CALLBACK_0100 ends here");
await sleep(1000);
done();
})
}
}
await sleep(1000);
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100
......@@ -549,7 +610,7 @@ export default function cameraJSUnitOutput(surfaceId: any) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_BEGIN_CONFIG_CALLBACK_0100 captureSession == null || undefined")
expect().assertFail();
} else {
captureSession.beginConfig(async (err, data) => {
captureSession.beginConfig(async (err) => {
if (!err) {
expect(true).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_BEGIN_CONFIG_CALLBACK_0100 success");
......@@ -582,7 +643,7 @@ export default function cameraJSUnitOutput(surfaceId: any) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_INPUT_CALLBACK_0100 captureSession == null || undefined")
expect().assertFail();
} else {
captureSession.addInput(cameraInput, async (err, data) => {
captureSession.addInput(cameraInput, async (err) => {
if (!err) {
expect(true).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_INPUT_CALLBACK_0100 success");
......@@ -619,7 +680,7 @@ export default function cameraJSUnitOutput(surfaceId: any) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_PREVIEW_OUTPUT_CALLBACK_0100 previewOutput == null || undefined")
expect().assertFail();
}
captureSession.addOutput(previewOutput, async (err, data) => {
captureSession.addOutput(previewOutput, async (err) => {
if (!err) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_PREVIEW_OUTPUT_CALLBACK_0100 success");
expect(true).assertTrue();
......@@ -656,7 +717,7 @@ export default function cameraJSUnitOutput(surfaceId: any) {
expect().assertFail();
}
console.info(TAG + "captureSession start add photoOutput")
captureSession.addOutput(photoOutput, async (err, data) => {
captureSession.addOutput(photoOutput, async (err) => {
if (!err) {
expect(true).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_PHOTO_OUTPUT_CALLBACK_0100 success");
......@@ -688,7 +749,7 @@ export default function cameraJSUnitOutput(surfaceId: any) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_VIDEO_OUTPUT_CALLBACK_0100 captureSession == null || undefined")
expect().assertFail();
} else {
captureSession.addOutput(videoOutput, async (err, data) => {
captureSession.addOutput(videoOutput, async (err) => {
if (!err) {
expect(true).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_VIDEO_OUTPUT_CALLBACK_0100 success");
......@@ -706,6 +767,40 @@ export default function cameraJSUnitOutput(surfaceId: any) {
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_METADATA_OUTPUT_CALLBACK_0100
* @tc.name : captureSession add metadataOutput
* @tc.desc : captureSession add metadataOutput
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_METADATA_OUTPUT_CALLBACK_0100', 1, async function (done) {
console.info(TAG + " --------------SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_METADATA_OUTPUT_CALLBACK_0100--------------");
if (isEmpty(captureSession)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_METADATA_OUTPUT_CALLBACK_0100 captureSession == null || undefined")
expect().assertFail();
} else {
if (!isEmpty(metadataOutput)) {
captureSession.addOutput(metadataOutput, async (err) => {
if (!err) {
expect(true).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_METADATA_OUTPUT_CALLBACK_0100 success");
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_METADATA_OUTPUT_CALLBACK_0100 FAILED: " + err.message);
expect().assertFail();
}
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_ADD_METADATA_OUTPUT_CALLBACK_0100 ends here");
await sleep(1000);
done();
})
}
}
await sleep(1000);
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_COMMIT_CONFIG_CALLBACK_0100
......@@ -721,7 +816,7 @@ export default function cameraJSUnitOutput(surfaceId: any) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_COMMIT_CONFIG_CALLBACK_0100 captureSession == null || undefined")
expect().assertFail();
} else {
captureSession.commitConfig(async (err, data) => {
captureSession.commitConfig(async (err) => {
if (!err) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_COMMIT_CONFIG_CALLBACK_0100 success");
expect(true).assertTrue();
......@@ -739,6 +834,38 @@ export default function cameraJSUnitOutput(surfaceId: any) {
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ON_AVAILABLE_METADATA_OUTPUT_CALLBACK_0100
* @tc.name : Start metadataOutput type async api
* @tc.desc : Start metadataOutput type async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_MULTIMEDIA_CAMERA_ON_AVAILABLE_METADATA_OUTPUT_CALLBACK_0100', 1, async function (done) {
console.info(TAG + " --------------SUB_MULTIMEDIA_CAMERA_ON_AVAILABLE_METADATA_OUTPUT_CALLBACK_0100--------------");
if (isEmpty(metadataOutput)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ON_AVAILABLE_METADATA_OUTPUT_CALLBACK_0100 metadataOutput == null || undefined")
} else {
metadataOutput.on('metadataObjectsAvailable', async (err, data) => {
if (!err) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ON_AVAILABLE_METADATA_OUTPUT_CALLBACK_0100 is not error");
expect(isEmpty(data)).assertFalse();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ON_AVAILABLE_METADATA_OUTPUT_CALLBACK_0100 success");
mMetadataObjectArray = data;
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ON_AVAILABLE_METADATA_OUTPUT_CALLBACK_0100 FAILED: " + err.message);
expect().assertFail();
}
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ON_AVAILABLE_METADATA_OUTPUT_CALLBACK_0100 ends here");
await sleep(1000);
})
}
await sleep(1000);
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100
......@@ -772,6 +899,248 @@ export default function cameraJSUnitOutput(surfaceId: any) {
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_START_METADATA_OUTPUT_CALLBACK_0100
* @tc.name : Start metadataOutput type async api
* @tc.desc : Start metadataOutput type async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_MULTIMEDIA_CAMERA_START_METADATA_OUTPUT_CALLBACK_0100', 1, async function (done) {
console.info(TAG + " --------------SUB_MULTIMEDIA_CAMERA_START_METADATA_OUTPUT_CALLBACK_0100--------------");
if (isEmpty(metadataOutput)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_START_METADATA_OUTPUT_CALLBACK_0100 metadataOutput == null || undefined")
} else {
metadataOutput.start(async (err) => {
if (!err) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_START_METADATA_OUTPUT_CALLBACK_0100 success");
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_START_METADATA_OUTPUT_CALLBACK_0100 FAILED: " + err.message);
expect().assertFail();
}
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_START_METADATA_OUTPUT_CALLBACK_0100 ends here");
await sleep(1000);
})
}
await sleep(1000);
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_GET_METADATA_TYPE_CALLBACK_0100
* @tc.name : Start metadataOutput type async api
* @tc.desc : Start metadataOutput type async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_MULTIMEDIA_CAMERA_GET_METADATA_TYPE_CALLBACK_0100', 1, async function (done) {
console.info(TAG + " --------------SUB_MULTIMEDIA_CAMERA_GET_METADATA_TYPE_CALLBACK_0100--------------");
if (isEmpty(mMetadataObjectArray)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_TYPE_CALLBACK_0100 mMetadataObjectArray == null || undefined")
} else {
mMetadataObjectArray[0].getType(async (err, data) => {
if (!err) {
if (!isEmpty(data)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_TYPE_CALLBACK_0100 success, data : " + data);
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_TYPE_CALLBACK_0100 FAILED, data == null || undefined");
expect().assertFail();
}
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_TYPE_CALLBACK_0100 FAILED: " + err.message);
expect().assertFail();
}
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_TYPE_CALLBACK_0100 ends here");
await sleep(1000);
})
}
await sleep(1000);
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_GET_METADATA_TYPE_PROMISE_0100
* @tc.name : Start metadataOutput type async api
* @tc.desc : Start metadataOutput type async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_MULTIMEDIA_CAMERA_GET_METADATA_TYPE_PROMISE_0100', 1, async function (done) {
console.info(TAG + " --------------SUB_MULTIMEDIA_CAMERA_GET_METADATA_TYPE_PROMISE_0100--------------");
if (isEmpty(mMetadataObjectArray)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_TYPE_PROMISE_0100 mMetadataObjectArray == null || undefined")
} else {
let type = mMetadataObjectArray[0].getType().then((result) => {
console.info('SUB_MULTIMEDIA_CAMERA_GET_METADATA_TYPE_PROMISE_0100 success :' + result);
}).catch((err) => {
console.info('SUB_MULTIMEDIA_CAMERA_GET_METADATA_TYPE_PROMISE_0100 failed :' + err);
expect().assertFail();
});
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_TYPE_PROMISE_0100 success, type : " + type);
}
await sleep(1000);
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_GET_METADATA_TIMESTAMP_CALLBACK_0100
* @tc.name : Start metadataOutput timestamp async api
* @tc.desc : Start metadataOutput timestamp async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_MULTIMEDIA_CAMERA_GET_METADATA_TIMESTAMP_CALLBACK_0100', 1, async function (done) {
console.info(TAG + " --------------SUB_MULTIMEDIA_CAMERA_GET_METADATA_TIMESTAMP_CALLBACK_0100--------------");
if (isEmpty(mMetadataObjectArray)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_TIMESTAMP_CALLBACK_0100 mMetadataObjectArray == null || undefined")
} else {
mMetadataObjectArray[0].getTimestamp(async (err, data) => {
if (!err) {
if (!isEmpty(data)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_TIMESTAMP_CALLBACK_0100 success, data : " + data);
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_TIMESTAMP_CALLBACK_0100 FAILED, data == null || undefined");
expect().assertFail();
}
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_TIMESTAMP_CALLBACK_0100 FAILED: " + err.message);
expect().assertFail();
}
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_TIMESTAMP_CALLBACK_0100 ends here");
await sleep(1000);
})
}
await sleep(1000);
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_GET_METADATA_TIMESTAMP_PROMISE_0100
* @tc.name : Start metadataOutput timestamp async api
* @tc.desc : Start metadataOutput timestamp async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_MULTIMEDIA_CAMERA_GET_METADATA_TIMESTAMP_PROMISE_0100', 1, async function (done) {
console.info(TAG + " --------------SUB_MULTIMEDIA_CAMERA_GET_METADATA_TIMESTAMP_PROMISE_0100--------------");
if (isEmpty(mMetadataObjectArray)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_TIMESTAMP_PROMISE_0100 mMetadataObjectArray == null || undefined")
} else {
let timeStamp = mMetadataObjectArray[0].getTimestamp().then((result) => {
console.info('SUB_MULTIMEDIA_CAMERA_GET_METADATA_TIMESTAMP_PROMISE_0100 success :' + result);
}).catch((err) => {
console.info('SUB_MULTIMEDIA_CAMERA_GET_METADATA_TIMESTAMP_PROMISE_0100 failed :' + err);
expect().assertFail();
});
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_TIMESTAMP_PROMISE_0100 success, timeStamp : " + timeStamp);
}
await sleep(1000);
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_GET_METADATA_BOUNDING_BOX_CALLBACK_0100
* @tc.name : Start metadataOutput bounding box async api
* @tc.desc : Start metadataOutput bounding box async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_MULTIMEDIA_CAMERA_GET_METADATA_BOUNDING_BOX_CALLBACK_0100', 1, async function (done) {
console.info(TAG + " --------------SUB_MULTIMEDIA_CAMERA_GET_METADATA_BOUNDING_BOX_CALLBACK_0100--------------");
if (isEmpty(mMetadataObjectArray)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_BOUNDING_BOX_CALLBACK_0100 mMetadataObjectArray == null || undefined")
} else {
mMetadataObjectArray[0].getBoundingBox(async (err, data) => {
if (!err) {
if (!isEmpty(data)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_BOUNDING_BOX_CALLBACK_0100 success, data : " + data);
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_BOUNDING_BOX_CALLBACK_0100 FAILED, data == null || undefined");
expect().assertFail();
}
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_BOUNDING_BOX_CALLBACK_0100 FAILED: " + err.message);
expect().assertFail();
}
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_METADATA_BOUNDING_BOX_CALLBACK_0100 ends here");
await sleep(1000);
done();
})
}
await sleep(1000);
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_GET_METADATA_BOUNDING_BOX_PROMISE_0100
* @tc.name : Start metadataOutput bounding box async api
* @tc.desc : Start metadataOutput bounding box async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_MULTIMEDIA_CAMERA_GET_METADATA_BOUNDING_BOX_PROMISE_0100', 1, async function (done) {
console.info(TAG + " --------------SUB_MULTIMEDIA_CAMERA_GET_METADATA_BOUNDING_BOX_PROMISE_0100--------------");
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().then((result) => {
console.info('SUB_MULTIMEDIA_CAMERA_GET_METADATA_BOUNDING_BOX_PROMISE_0100 success :' + result);
}).catch((err) => {
console.info('SUB_MULTIMEDIA_CAMERA_GET_METADATA_BOUNDING_BOX_PROMISE_0100 failed :' + err);
expect().assertFail();
});
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);
}
await sleep(1000);
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_STOP_METADATA_OUTPUT_CALLBACK_0100
* @tc.name : Stop metadataOutput type async api
* @tc.desc : Stop metadataOutput type async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_MULTIMEDIA_CAMERA_STOP_METADATA_OUTPUT_CALLBACK_0100', 1, async function (done) {
console.info(TAG + " --------------SUB_MULTIMEDIA_CAMERA_STOP_METADATA_OUTPUT_CALLBACK_0100--------------");
if (isEmpty(metadataOutput)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_STOP_METADATA_OUTPUT_CALLBACK_0100 metadataOutput == null || undefined")
} else {
metadataOutput.stop(async (err) => {
if (!err) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_STOP_METADATA_OUTPUT_CALLBACK_0100 success");
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_STOP_METADATA_OUTPUT_CALLBACK_0100 FAILED: " + err.message);
expect().assertFail();
}
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_STOP_METADATA_OUTPUT_CALLBACK_0100 ends here");
await sleep(1000);
done();
})
}
await sleep(1000);
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_START_PREVIEW_OUTPUT_PROMISE_0100
......@@ -982,6 +1351,101 @@ export default function cameraJSUnitOutput(surfaceId: any) {
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_IS_MIRROR_SUPPORTED_PROMISE_0100
* @tc.name : check photoOutput is mirror supported with promise mode
* @tc.desc : check photoOutput is mirror supported with promise mode
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_IS_MIRROR_SUPPORTED_PROMISE_0100', 1, async function (done) {
console.info(TAG + " --------------SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_IS_MIRROR_SUPPORTED_PROMISE_0100--------------");
if (isEmpty(photoOutput)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_IS_MIRROR_SUPPORTED_PROMISE_0100 photoOutput == null || undefined")
expect().assertFail();
} else {
let isMirrorSupportedFlag = await photoOutput.isMirrorSupported().then((result) => {
console.info('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_IS_MIRROR_SUPPORTED_PROMISE_0100 success :' + result);
}).catch((err) => {
console.info('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_IS_MIRROR_SUPPORTED_PROMISE_0100 failed :' + err);
expect().assertFail();
});
console.info('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_IS_MIRROR_SUPPORTED_PROMISE_0100 isMirrorSupportedFlag = ' + isMirrorSupportedFlag);
}
await sleep(1000);
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_IS_MIRROR_SUPPORTED_CALLBACK_0100
* @tc.name : check photoOutput is mirror supported with callback mode
* @tc.desc : check photoOutput is mirror supported with callback mode
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_IS_MIRROR_SUPPORTED_CALLBACK_0100', 1, async function (done) {
console.info(TAG + " --------------SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_IS_MIRROR_SUPPORTED_CALLBACK_0100--------------");
if (isEmpty(photoOutput)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_IS_MIRROR_SUPPORTED_CALLBACK_0100 photoOutput == null || undefined")
expect().assertFail();
} else {
photoOutput.isMirrorSupported(async (err, data) => {
if (!err) {
if (!isEmpty(data)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_IS_MIRROR_SUPPORTED_CALLBACK_0100 success, data = " + data);
expect(true).assertTrue();
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_IS_MIRROR_SUPPORTED_CALLBACK_0100 FAILED, data == null || undefined");
expect().assertFail();
}
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_IS_MIRROR_SUPPORTED_CALLBACK_0100 FAILED: " + err.message);
expect().assertFail();
}
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_IS_MIRROR_SUPPORTED_CALLBACK_0100 ends here");
await sleep(1000);
done();
})
}
await sleep(1000);
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CAPTURE_DEFAULT_PROMISE_0100
* @tc.name : photoOutput capture with promise mode
* @tc.desc : photoOutput capture with promise mode
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CAPTURE_DEFAULT_PROMISE_0100', 1, async function (done) {
console.info(TAG + " --------------SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CAPTURE_DEFAULT_PROMISE_0100--------------");
if (isEmpty(photoOutput)) {
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);
}).catch((err) => {
console.info('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CAPTURE_DEFAULT_PROMISE_0100 failed :' + err);
expect().assertFail();
});
}
await sleep(1000);
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CAPTURE_DEFAULT_CALLBACK_0100
* @tc.name : photoOutput commitConfig
......@@ -996,7 +1460,7 @@ export default function cameraJSUnitOutput(surfaceId: any) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CAPTURE_DEFAULT_CALLBACK_0100 photoOutput == null || undefined")
expect().assertFail();
} else {
photoOutput.capture(async (err, data) => {
photoOutput.capture(async (err) => {
if (!err) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CAPTURE_DEFAULT_CALLBACK_0100 success");
expect(true).assertTrue();
......@@ -1014,6 +1478,39 @@ export default function cameraJSUnitOutput(surfaceId: any) {
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CAPTURE_SETTING_PROMISE_0100
* @tc.name : photoOutput commitConfig
* @tc.desc : captureSession commitConfig
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CAPTURE_SETTING_PROMISE_0100', 1, async function (done) {
console.info(TAG + " --------------SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CAPTURE_SETTING_PROMISE_0100--------------");
if (isEmpty(photoOutput)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CAPTURE_SETTING_PROMISE_0100 photoOutput == null || undefined")
expect().assertFail();
} else {
console.info('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CAPTURE_SETTING_PROMISE_0100 captureSetting.quality = ' + captureSetting.quality);
console.info('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CAPTURE_SETTING_PROMISE_0100 captureSetting.rotation = ' + captureSetting.rotation);
console.info('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CAPTURE_SETTING_PROMISE_0100 captureSetting.location.latitude = ' + captureSetting.location.latitude);
console.info('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CAPTURE_SETTING_PROMISE_0100 captureSetting.location.longitude = ' + captureSetting.location.longitude);
console.info('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CAPTURE_SETTING_PROMISE_0100 captureSetting.location.altitude = ' + captureSetting.location.altitude);
console.info('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CAPTURE_SETTING_PROMISE_0100 captureSetting.mirror = ' + captureSetting.mirror);
await photoOutput.capture(captureSetting).then((result) => {
console.info('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CAPTURE_SETTING_PROMISE_0100 success :' + result);
}).catch((err) => {
console.info('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CAPTURE_SETTING_PROMISE_0100 failed :' + err);
});
}
await sleep(1000);
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CAPTURE_SETTING_CALLBACK_0100
......@@ -1029,7 +1526,7 @@ export default function cameraJSUnitOutput(surfaceId: any) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CAPTURE_SETTING_CALLBACK_0100 photoOutput == null || undefined")
expect().assertFail();
} else {
photoOutput.capture(captureSetting, async (err, data) => {
photoOutput.capture(captureSetting, async (err) => {
if (!err) {
expect(true).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CAPTURE_SETTING_CALLBACK_0100 success");
......@@ -1099,6 +1596,8 @@ export default function cameraJSUnitOutput(surfaceId: any) {
if (!err) {
expect(true).assertTrue();
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);
} else {
expect().assertFail();
console.info(TAG + "Error in SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_FRAME_SHUTTER_0100 FAILED: " + err.message);
......@@ -1132,6 +1631,8 @@ export default function cameraJSUnitOutput(surfaceId: any) {
if (!err) {
expect(true).assertTrue();
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);
} else {
expect().assertFail();
console.info(TAG + "Error in SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_CAPTURE_END_0100 FAILED: " + err.message);
......@@ -1261,6 +1762,56 @@ export default function cameraJSUnitOutput(surfaceId: any) {
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_START_METADATA_OUTPUT_PROMISE_0100
* @tc.name : Start metadataOutput sync api
* @tc.desc : Start metadataOutput sync api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_MULTIMEDIA_CAMERA_START_METADATA_OUTPUT_PROMISE_0100', 1, async function (done) {
console.info(TAG + " --------------SUB_MULTIMEDIA_CAMERA_START_METADATA_OUTPUT_PROMISE_0100--------------");
if (isEmpty(metadataOutput)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_START_METADATA_OUTPUT_PROMISE_0100 metadataOutput == null || undefined")
} else {
metadataOutput.start().then((result) => {
console.info('SUB_MULTIMEDIA_CAMERA_START_METADATA_OUTPUT_PROMISE_0100 success :' + result);
}).catch((err) => {
console.info('SUB_MULTIMEDIA_CAMERA_START_METADATA_OUTPUT_PROMISE_0100 failed :' + err);
});
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_START_METADATA_OUTPUT_PROMISE_0100 ends here");
}
await sleep(1000);
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_STOP_METADATA_OUTPUT_PROMISE_0100
* @tc.name : Stop metadataOutput sync api
* @tc.desc : Stop metadataOutput aync api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it('SUB_MULTIMEDIA_CAMERA_STOP_METADATA_OUTPUT_PROMISE_0100', 1, async function (done) {
console.info(TAG + " --------------SUB_MULTIMEDIA_CAMERA_STOP_METADATA_OUTPUT_PROMISE_0100--------------");
if (isEmpty(metadataOutput)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_STOP_METADATA_OUTPUT_PROMISE_0100 metadataOutput == null || undefined")
} else {
metadataOutput.stop().then((result) => {
console.info('SUB_MULTIMEDIA_CAMERA_STOP_METADATA_OUTPUT_PROMISE_0100 success :' + result);
}).catch((err) => {
console.info('SUB_MULTIMEDIA_CAMERA_STOP_METADATA_OUTPUT_PROMISE_0100 failed :' + err);
});
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_STOP_METADATA_OUTPUT_PROMISE_0100 ends here");
}
await sleep(1000);
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_CALLBACK_0100
......
......@@ -26,14 +26,18 @@ const TAG = "CameraUnitTest: ";
// Define global variables
let mCameraManager;
let mPhotoSurfaceId;
let mCameraDevicesArray;
let mVideoSurface;
let mPhotoSurface;
let mVideoRecorder;
let mFdPath;
let mVideoSurface;
let mFileAsset;
let mFdPath;
let mFdNumber;
// CAMERA-0 letiables
let mCameraNum;
let mVideoProfileCfg = {
audioBitrate: 48000,
audioChannels: 2,
......@@ -67,8 +71,8 @@ export default function cameraManagerTest(surfaceId: any) {
console.log(TAG + 'before receiver check')
if (receiver !== undefined) {
console.log(TAG + 'Receiver is ok')
mPhotoSurfaceId = await receiver.getReceivingSurfaceId()
console.log(TAG + 'Received id: ' + JSON.stringify(mPhotoSurfaceId))
mPhotoSurface = await receiver.getReceivingSurfaceId()
console.log(TAG + 'Received id: ' + JSON.stringify(mPhotoSurface))
} else {
console.log(TAG + 'Receiver is not ok')
}
......@@ -168,9 +172,44 @@ export default function cameraManagerTest(surfaceId: any) {
console.info(TAG + "getCameraManager FAILED");
return false;
}
await sleep(500);
console.info('Exit getCameraManagerInstance');
return true;
}
async function getCameraSupportDevicesArray() {
console.info('Enter getCameraSupportDevicesArray');
mCameraDevicesArray = await mCameraManager.getSupportedCameras();
/*
mCameraManager.getSupportedCameras(async (err, data) => {
console.info(TAG + "Entering getCameraSupportDevicesArray callback");
if (!err) {
if (data != null || data != undefined) {
mCameraDevicesArray = data;
console.info(TAG + "Entering getCameraSupportDevicesArray PASSED with CameraDevicesArray is: " + data);
} else {
console.info(TAG + "Entering getCameraSupportDevicesArray FAILED with CameraDevicesArray is: " + data);
}
} else {
console.info(TAG + "Entering getCameraSupportDevicesArray FAILED : " + err.message);
}
})
await sleep(3000);
*/
if (isEmpty(mCameraDevicesArray)) {
console.info(TAG + "getSupportedCameras FAILED");
return false;
}
//mCameraNum = 1;
mCameraNum = mCameraDevicesArray.length;
console.info(TAG + "getCameraSupportDevicesArray is: " + mCameraNum);
console.info('Exit getCameraSupportDevicesArray');
return true;
}
......@@ -184,17 +223,14 @@ export default function cameraManagerTest(surfaceId: any) {
mCameraManager.getSupportedOutputCapability(cameraDevice, async (err, data) => {
if (!err) {
if (!isEmpty(data)) {
console.info(TAG + "Entering SupportedOutputCapability data is not null || undefined");
console.info(TAG + "getSupportedOutputCapabilityInCallback data is not null || undefined");
outputCapabilityCallback = data;
expect(outputCapabilityCallback).assertNotNull();
}
else {
console.info(TAG + "getSupportedOutputCapabilityInCallback FAILED");
expect().assertFail();
}
} else {
console.info(TAG + "getSupportedOutputCapabilityInCallback FAILED: " + err.message);
expect().assertFail();
}
console.info(TAG + "getSupportedOutputCapabilityInCallback ends here");
})
......@@ -208,12 +244,19 @@ export default function cameraManagerTest(surfaceId: any) {
expect().assertFail();
return undefined;
}
let outputCapabilityPromise = await mCameraManager.getSupportedOutputCapability(cameraDevice);
let outputCapabilityPromise = null;
await mCameraManager.getSupportedOutputCapability(cameraDevice).then((result) => {
console.info('getSupportedOutputCapabilityInPromise success');
outputCapabilityPromise = result;
}).catch((err) => {
console.info('getSupportedOutputCapabilityInPromise failed, err = ' + err.message);
});
if (isEmpty(outputCapabilityPromise)) {
console.info(TAG + "Entering getSupportedOutputCapabilityInPromise outputCapabilityPromise == null || undefined")
expect().assertFail();
} else {
console.info("CameraUnitTest: Entering testSupportedOutputCapabilityPromise: " + JSON.stringify(outputCapabilityPromise));
console.info("CameraUnitTest: getSupportedOutputCapabilityInPromise: " + JSON.stringify(outputCapabilityPromise));
}
return outputCapabilityPromise;
......@@ -286,6 +329,7 @@ describe('CameraManagerTest', function () {
await getCameraManagerInstance();
await getImageReceiverSurfaceId();
await getVideoReceiveSurface();
await getCameraSupportDevicesArray();
console.info('beforeAll case');
})
......@@ -324,7 +368,6 @@ describe('CameraManagerTest', function () {
}
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAMANAGER_CALLBACK_0100 ends here");
await sleep(1000);
done();
})
await sleep(1000);
done();
......@@ -466,11 +509,7 @@ describe('CameraManagerTest', function () {
let cameraOutputCap = await getSupportedOutputCapabilityInCallback(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)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_CALLBACK_0100 cameraOutputCap == null || undefined")
expect().assertFail();
}
if (!isEmpty(cameraOutputCap)) {
let previewProfilesArray = cameraOutputCap.previewProfiles;
if (isEmpty(previewProfilesArray)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_CALLBACK_0100 previewProfilesArray == null || undefined")
......@@ -493,6 +532,8 @@ describe('CameraManagerTest', function () {
if (isEmpty(metadataObjectTypesArray)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_CALLBACK_0100 metadataObjectTypesArray == null || undefined")
}
}
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_CALLBACK_0100 PASSED camera:" + camerasArray[i].cameraId);
}
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_CALLBACK_0100 ends here");
......@@ -513,11 +554,7 @@ describe('CameraManagerTest', function () {
for (let i = 0; i < mCameraDevicesArray.length; i++) {
let cameraOutputCap = await getSupportedOutputCapabilityInPromise(mCameraDevicesArray[i]);
console.info("Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_PROMISE_0100 camera:" + mCameraDevicesArray[i].cameraId);
if (isEmpty(cameraOutputCap)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_PROMISE_0100 cameraOutputCap == null || undefined")
expect().assertFail();
}
if (!isEmpty(cameraOutputCap)) {
let previewProfilesArray = cameraOutputCap.previewProfiles;
if (isEmpty(previewProfilesArray)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_PROMISE_0100 previewProfilesArray == null || undefined")
......@@ -541,6 +578,9 @@ describe('CameraManagerTest', function () {
if (isEmpty(metadataObjectTypesArray)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_PROMISE_0100 metadataObjectTypesArray == null || undefined")
}
}
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_PROMISE_0100 PASSED camera:" + mCameraDevicesArray[i].cameraId);
}
console.info("CameraUnitTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_CAMERA_OUTPUT_CAPABILITY_PROMISE_0100 ends here");
......@@ -562,11 +602,7 @@ describe('CameraManagerTest', function () {
for (let i = 0; i < camerasArray.length; i++) {
let cameraOutputCap = await getSupportedOutputCapabilityInPromise(camerasArray[i]);
console.info("Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_PROFILES_0100 camera:" + camerasArray[i].cameraId);
if (isEmpty(cameraOutputCap)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_PROFILES_0100 cameraOutputCap == null || undefined")
expect().assertFail();
}
if (!isEmpty(cameraOutputCap)) {
let previewProfilesArray = cameraOutputCap.previewProfiles;
if (isEmpty(previewProfilesArray)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_PROFILES_0100 previewProfilesArray == null || undefined")
......@@ -581,6 +617,8 @@ describe('CameraManagerTest', function () {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_PROFILES_0100 height: " + previewProfilesSize.height);
}
expect(true).assertTrue();
}
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_PROFILES_0100 PASSED camera:" + camerasArray[i].cameraId);
}
await sleep(1000);
......@@ -601,11 +639,7 @@ describe('CameraManagerTest', function () {
for (let i = 0; i < camerasArray.length; i++) {
let cameraOutputCap = await getSupportedOutputCapabilityInPromise(camerasArray[i]);
console.info("Entering SUB_MULTIMEDIA_CAMERA_PHOTO_PROFILES_0100 camera:" + camerasArray[i].cameraId);
if (isEmpty(cameraOutputCap)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_PROFILES_0100 cameraOutputCap == null || undefined")
expect().assertFail();
}
if (!isEmpty(cameraOutputCap)) {
let photoProfilesArray = cameraOutputCap.photoProfiles;
if (isEmpty(cameraOutputCap)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_PROFILES_0100 photoProfilesArray == null || undefined")
......@@ -620,6 +654,8 @@ describe('CameraManagerTest', function () {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_PROFILES_0100 height: " + photoProfilesSize.height);
}
expect(true).assertTrue();
}
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_PROFILES_0100 PASSED camera:" + camerasArray[i].cameraId);
}
await sleep(1000);
......@@ -640,11 +676,7 @@ describe('CameraManagerTest', function () {
for (let i = 0; i < camerasArray.length; i++) {
let cameraOutputCap = await getSupportedOutputCapabilityInPromise(camerasArray[i]);
console.info("Entering SUB_MULTIMEDIA_CAMERA_VIDEO_PROFILES_0100 camera:" + camerasArray[i].cameraId);
if (isEmpty(cameraOutputCap)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEO_PROFILES_0100 cameraOutputCap == null || undefined")
expect().assertFail();
}
if (!isEmpty(cameraOutputCap)) {
let videoProfilesArray = cameraOutputCap.videoProfiles;
if (isEmpty(videoProfilesArray)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEO_PROFILES_0100 videoProfilesArray == null || undefined")
......@@ -662,6 +694,8 @@ describe('CameraManagerTest', function () {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEO_PROFILES_0100 max: " + videoProfilesFrameRateRange.max);
}
expect(true).assertTrue();
}
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEO_PROFILES_0100 PASSED camera:" + camerasArray[i].cameraId);
}
await sleep(1000);
......@@ -733,6 +767,70 @@ describe('CameraManagerTest', function () {
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_CALLBACK_0100
* @tc.name : Create camerainput from camera-0 cameraposition back & cameratype unspecified async api
* @tc.desc : Create camerainput from camera-0 cameraposition back & cameratype unspecified async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_CALLBACK_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_CALLBACK_0100--------------");
if (isEmpty(mCameraManager)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_CALLBACK_0100 cameraManager == null || undefined")
expect().assertFail();
} else {
let camerasArray = mCameraDevicesArray;
for (let i = 0; i < camerasArray.length; i++) {
mCameraManager.createCameraInput(camerasArray[i].cameraPosition, camerasArray[i].cameraType, async (err, data) => {
if (!err) {
if (isEmpty(data)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_CALLBACK_0100 data == null || undefined")
expect().assertFail();
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_CALLBACK_0100 success");
}
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_CALLBACK_0100 FAILED: " + err.message);
expect().assertFail();
}
})
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera: " + camerasArray[i].cameraId);
}
}
await sleep(1000);
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_PROMISE_0100
* @tc.name : Create camerainput from camera-0 cameraposition back & cameratype unspecified promise api
* @tc.desc : Create camerainput from camera-0 cameraposition back & cameratype unspecified promise api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_PROMISE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_PROMISE_0100--------------");
if (isEmpty(mCameraManager)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_PROMISE_0100 cameraManager == null || undefined")
expect().assertFail();
} else {
let camerasArray = mCameraDevicesArray;
for (let i = 0; i < camerasArray.length; i++) {
let cameraInputPromiseByType = await mCameraManager.createCameraInput(camerasArray[i].cameraPosition, camerasArray[i].cameraType);
if (isEmpty(cameraInputPromiseByType)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_PROMISE_0100 cameraInputPromiseByType == null || undefined")
expect().assertFail();
}
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_PROMISE_0100 camera: " + camerasArray[i].cameraId);
}
}
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_PROMISE_0100 ends here");
await sleep(1000);
done();
})
/*CREATE CAMERAOUTPUT*/
/**
......@@ -749,13 +847,13 @@ describe('CameraManagerTest', function () {
for (let i = 0; i < camerasArray.length; i++) {
let cameraOutputCap = await getSupportedOutputCapabilityInPromise(camerasArray[i]);
console.info("SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PREVIEW_OUTPUT_CALLBACK_0100 camera:" + camerasArray[i].cameraId);
expect(isEmpty(cameraOutputCap)).assertFalse();
if (!isEmpty(cameraOutputCap)) {
let previewProfilesArray = cameraOutputCap.previewProfiles;
if (isEmpty(previewProfilesArray)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PREVIEW_OUTPUT_CALLBACK_0100 previewProfilesArray == null || undefined")
expect().assertFail();
}
} else {
for (let j = 0; j < previewProfilesArray.length; j++) {
mCameraManager.createPreviewOutput(previewProfilesArray[j], surfaceId, async (err, data) => {
if (isEmpty(data)) {
......@@ -763,8 +861,10 @@ describe('CameraManagerTest', function () {
expect().assertFail();
}
})
await sleep(10);
done();
await sleep(100);
}
}
}
}
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PREVIEW_OUTPUT_CALLBACK_0100 PASS");
......@@ -786,25 +886,24 @@ describe('CameraManagerTest', function () {
for (let i = 0; i < camerasArray.length; i++) {
let cameraOutputCap = await getSupportedOutputCapabilityInPromise(camerasArray[i]);
console.info("SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PREVIEW_OUTPUT_PROMISE_0100 camera:" + camerasArray[i].cameraId);
if (isEmpty(cameraOutputCap)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PREVIEW_OUTPUT_PROMISE_0100 cameraOutputCap == null || undefined")
expect().assertFail();
}
if (!isEmpty(cameraOutputCap)) {
let previewProfilesArray = cameraOutputCap.previewProfiles;
if (isEmpty(previewProfilesArray)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PREVIEW_OUTPUT_PROMISE_0100 previewProfilesArray == null || undefined")
expect().assertFail();
}
} else {
for (let j = 0; j < previewProfilesArray.length; j++) {
let previewOutputPromise = await mCameraManager.createPreviewOutput(previewProfilesArray[j], surfaceId);
if (isEmpty(previewOutputPromise)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PREVIEW_OUTPUT_PROMISE_0100 previewOutputPromise == null || undefined")
expect().assertFail();
}
await sleep(10);
done();
await sleep(100);
}
}
}
}
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PREVIEW_OUTPUT_PROMISE_0100 PASS");
await sleep(1000);
......@@ -825,25 +924,23 @@ describe('CameraManagerTest', function () {
for (let i = 0; i < camerasArray.length; i++) {
let cameraOutputCap = await getSupportedOutputCapabilityInPromise(camerasArray[i]);
console.info("SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PHOTO_OUTPUT_CALLBACK_0100 camera:" + camerasArray[i].cameraId);
if (isEmpty(cameraOutputCap)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PHOTO_OUTPUT_CALLBACK_0100 cameraOutputCap == null || undefined")
expect().assertFail();
}
if (!isEmpty(cameraOutputCap)) {
let photoProfilesArray = cameraOutputCap.photoProfiles;
if (isEmpty(photoProfilesArray)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PHOTO_OUTPUT_CALLBACK_0100 photoProfilesArray == null || undefined")
expect().assertFail();
}
} else {
for (let j = 0; j < photoProfilesArray.length; j++) {
mCameraManager.createPhotoOutput(photoProfilesArray[j], mPhotoSurfaceId, async (err, data) => {
mCameraManager.createPhotoOutput(photoProfilesArray[j], mPhotoSurface, async (err, data) => {
if (isEmpty(data)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PHOTO_OUTPUT_CALLBACK_0100 data == null || undefined")
expect().assertFail();
}
})
await sleep(10);
done();
await sleep(100);
}
}
}
}
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PHOTO_OUTPUT_CALLBACK_0100 PASS");
......@@ -865,24 +962,22 @@ describe('CameraManagerTest', function () {
for (let i = 0; i < camerasArray.length; i++) {
let cameraOutputCap = await getSupportedOutputCapabilityInPromise(camerasArray[i]);
console.info("SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PHOTO_OUTPUT_PROMISE_0100 camera:" + camerasArray[i].cameraId);
if (isEmpty(cameraOutputCap)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PHOTO_OUTPUT_PROMISE_0100 cameraOutputCap == null || undefined")
expect().assertFail();
}
if (!isEmpty(cameraOutputCap)) {
let photoProfilesArray = cameraOutputCap.photoProfiles;
if (isEmpty(photoProfilesArray)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PHOTO_OUTPUT_PROMISE_0100 photoProfilesArray == null || undefined")
expect().assertFail();
}
} else {
for (let j = 0; j < photoProfilesArray.length; j++) {
let photoOutputPromise = await mCameraManager.createPhotoOutput(photoProfilesArray[j], mPhotoSurfaceId);
let photoOutputPromise = await mCameraManager.createPhotoOutput(photoProfilesArray[j], mPhotoSurface);
if (isEmpty(photoOutputPromise)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PHOTO_OUTPUT_PROMISE_0100 photoOutputPromise == null || undefined")
expect().assertFail();
}
await sleep(10);
done();
await sleep(100);
}
}
}
}
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PHOTO_OUTPUT_PROMISE_0100 PASS");
......@@ -901,28 +996,40 @@ describe('CameraManagerTest', function () {
it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_CALLBACK_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_CALLBACK_0100--------------");
let camerasArray = mCameraDevicesArray;
let createVideoOutputFlag;
for (let i = 0; i < camerasArray.length; i++) {
let cameraOutputCap = await getSupportedOutputCapabilityInPromise(camerasArray[i]);
console.info("SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_CALLBACK_0100 camera:" + camerasArray[i].cameraId);
if (isEmpty(cameraOutputCap)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_CALLBACK_0100 cameraOutputCap == null || undefined")
expect().assertFail();
}
if (!isEmpty(cameraOutputCap)) {
let videoProfilesArray = cameraOutputCap.videoProfiles;
if (isEmpty(videoProfilesArray)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_CALLBACK_0100 videoProfilesArray == null || undefined")
expect().assertFail();
}
} else {
createVideoOutputFlag = false;
for (let j = 0; j < videoProfilesArray.length; j++) {
mCameraManager.createVideoOutput(videoProfilesArray[j], mVideoSurface, async (err, data) => {
if (!err) {
if (isEmpty(data)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_CALLBACK_0100 data == null || undefined")
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_CALLBACK_0100 data == null || undefined");
expect().assertFail();
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_CALLBACK_0100 data = " + data);
createVideoOutputFlag = true;
}
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_CALLBACK_0100 failed, err = " + err.message);
expect().assertFail();
}
})
await sleep(10);
done();
await sleep(100);
if (createVideoOutputFlag == true) {
break;
}
}
}
}
}
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_CALLBACK_0100 PASS");
......@@ -944,24 +1051,25 @@ describe('CameraManagerTest', function () {
for (let i = 0; i < camerasArray.length; i++) {
let cameraOutputCap = await getSupportedOutputCapabilityInPromise(camerasArray[i]);
console.info("SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_PROMISE_0100 camera:" + camerasArray[i].cameraId);
if (isEmpty(cameraOutputCap)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_PROMISE_0100 cameraOutputCap == null || undefined")
expect().assertFail();
}
if (!isEmpty(cameraOutputCap)) {
let videoProfilesArray = cameraOutputCap.videoProfiles;
if (isEmpty(videoProfilesArray)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_PROMISE_0100 videoProfilesArray == null || undefined")
expect().assertFail();
}
} else {
for (let j = 0; j < videoProfilesArray.length; j++) {
let videoOutputPromise = await mCameraManager.createVideoOutput(videoProfilesArray[j], mVideoSurface);
if (isEmpty(videoOutputPromise)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_PROMISE_0100 videoOutputPromise == null || undefined")
expect().assertFail();
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_CALLBACK_0100 videoOutputPromise = " + videoOutputPromise);
break;
}
await sleep(10);
done();
await sleep(100);
}
}
}
}
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_PROMISE_0100 PASS");
......@@ -970,7 +1078,85 @@ describe('CameraManagerTest', function () {
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_MANAGER_CREATE_CAPTURE_SESSION_CALLBACK_0100
* @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
* @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_PROMISE_0100', 2, async function (done) {
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]);
console.info("SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_PROMISE_0100 camera:" + camerasArray[i].cameraId);
if (!isEmpty(cameraOutputCap)) {
let metadataObjectTypeArray = cameraOutputCap.supportedMetadataObjectTypes;
if (!isEmpty(metadataObjectTypeArray)) {
let metadataOutputPromise = await mCameraManager.createMetadataOutput(metadataObjectTypeArray);
if (isEmpty(metadataOutputPromise)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_PROMISE_0100 metadataOutputPromise == null || undefined")
expect().assertFail();
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_PROMISE_0100 metadataOutputPromise = " + metadataOutputPromise)
}
await sleep(100);
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_PROMISE_0100 metadataObjectTypeArray == null || undefined")
}
}
}
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_PROMISE_0100 PASS");
await sleep(1000);
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100
* @tc.name : Create CaptureSession instance api
* @tc.desc : Create CaptureSession instance api
* @tc.size : MEDIUM
......@@ -993,10 +1179,9 @@ describe('CameraManagerTest', function () {
} else {
expect().assertFail();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_MANAGER_CREATE_CAPTURE_SESSION_CALLBACK_0100 FAILED : " + err.message);
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_MANAGER_CREATE_CAPTURE_SESSION_CALLBACK_0100 ends here");
}
await sleep(1000);
done();
await sleep(300);
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_MANAGER_CREATE_CAPTURE_SESSION_CALLBACK_0100 ends here");
})
await sleep(1000);
await cameraSession.release();
......@@ -1052,7 +1237,6 @@ describe('CameraManagerTest', function () {
console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 FAILED: " + err.message);
}
await sleep(1000);
done();
})
}
await sleep(1000);
......
......@@ -32,7 +32,7 @@ let mCameraManager;
let mCameraDevicesArray;
let mCameraSession;
let mPhoteSurface;
let mPhotoSurface;
let mVideoRecorder;
let mVideoSurface;
let mFileAsset;
......@@ -183,8 +183,8 @@ export default function cameraSessionTest(surfaceId: any) {
console.log(TAG + 'before receiver check')
if (receiver !== undefined) {
console.log(TAG + 'Photo receiver is created successfully')
mPhoteSurface = await receiver.getReceivingSurfaceId()
console.log(TAG + 'Photo received id: ' + JSON.stringify(mPhoteSurface))
mPhotoSurface = await receiver.getReceivingSurfaceId()
console.log(TAG + 'Photo received id: ' + JSON.stringify(mPhotoSurface))
} else {
console.log(TAG + 'Photo receiver is created failed')
}
......@@ -352,7 +352,14 @@ export default function cameraSessionTest(surfaceId: any) {
return false;
}
mCameraInput = await mCameraManager.createCameraInput(mCameraDevicesArray[idx]);
mCameraInput = null;
await mCameraManager.createCameraInput(mCameraDevicesArray[idx]).then((result) => {
console.info('createCameraInput success');
mCameraInput = result;
}).catch((err) => {
console.info('createCameraInput failed, err = ' + err.message);
});
if (isEmpty(mCameraInput)) {
console.info(TAG + "createCameraInput FAILED");
return false;
......@@ -392,7 +399,17 @@ export default function cameraSessionTest(surfaceId: any) {
async function createOutput(idx:any) {
console.info('Enter createOutput');
let cameraOutputCap = await mCameraManager.getSupportedOutputCapability(mCameraDevicesArray[idx]);
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;
mPhotoOutput = null;
});
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++) {
......@@ -409,12 +426,11 @@ export default function cameraSessionTest(surfaceId: any) {
console.info(TAG + "createPreviewOutput: " + mPreviewOutput);
}
if (!isEmpty(cameraOutputCap.photoProfiles)) {
console.info(TAG + "cameraOutputCap.photoProfiles.length: " + cameraOutputCap.photoProfiles.length);
for (let i = 0; i < cameraOutputCap.photoProfiles.length; i++) {
mPhotoOutput = await mCameraManager.createPhotoOutput(cameraOutputCap.photoProfiles[i], mPhoteSurface);
mPhotoOutput = await mCameraManager.createPhotoOutput(cameraOutputCap.photoProfiles[i], mPhotoSurface);
if (!isEmpty(mPhotoOutput)) {
break;
}
......@@ -448,6 +464,8 @@ export default function cameraSessionTest(surfaceId: any) {
console.info(TAG + "createVideoOutput: " + mVideoOutput);
}
*/
}
console.info('Exit createOutputs');
return true;
......@@ -503,10 +521,12 @@ export default function cameraSessionTest(surfaceId: any) {
await mCameraSession.addOutput(mVideoOutput);
}
*/
await sleep(1);
await sleep(100);
await commitCameraSessionConfig();
await sleep(100);
/*
await mCameraSession.start(async (err) => {
console.info(TAG + "Entering mCameraSession start callback");
......@@ -517,7 +537,7 @@ export default function cameraSessionTest(surfaceId: any) {
}
})
await sleep(1000);
await sleep(100);
*/
console.info(TAG + "Exit startCameraSession");
......@@ -536,7 +556,7 @@ export default function cameraSessionTest(surfaceId: any) {
}
})
await sleep(1000);
await sleep(100);
*/
if (!isEmpty(mCameraInput)) {
......@@ -902,6 +922,108 @@ export default function cameraSessionTest(surfaceId: any) {
}
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_CALLBACK_0100
* @tc.name : Check capture session start/stop with callback or not
* @tc.desc : Check capture session start/stop with callback or not
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_CALLBACK_0100', 0, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_CALLBACK_0100--------------");
if (mCameraNum == 0) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_CALLBACK_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_CALLBACK_0100 start for camera[" + i + "]");
await startCameraSession(i);
if (!isEmpty(mPreviewOutput)) {
mCameraSession.start(async (err) => {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_CALLBACK_0100 start callback");
if (!err) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_CALLBACK_0100 start PASSED");
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_CALLBACK_0100 start FAILED : " + err.message);
expect().assertFail();
}
})
await sleep(2000);
mCameraSession.stop(async (err) => {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_CALLBACK_0100 stop callback");
if (!err) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_CALLBACK_0100 stop PASSED");
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_CALLBACK_0100 stop FAILED : " + err.message);
expect().assertFail();
}
})
await sleep(500);
}
await beginCameraSessionConfig();
await stopCameraSession();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_CALLBACK_0100 end for camera[" + i + "]");
}
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_CALLBACK_0100 ends here");
done();
}
})
/**
* @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.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--------------");
if (mCameraNum == 0) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_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 + "]");
await startCameraSession(i);
if (!isEmpty(mPreviewOutput)) {
await mCameraSession.start();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_PROMISE_0100 start PASSED");
await sleep(2000);
await mCameraSession.stop();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_PROMISE_0100 stop PASSED");
await sleep(500);
}
await beginCameraSessionConfig();
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_PROMISE_0100 ends here");
done();
}
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_INPUT_CALLBACK_0100
* @tc.name : Check capture session add/remove input with callback or not
......@@ -925,6 +1047,7 @@ export default function cameraSessionTest(surfaceId: any) {
await createInput(i);
await createOutput(i);
if (!isEmpty(mPreviewOutput) && !isEmpty(mPhotoOutput)) {
mCameraSession.addInput(mCameraInput, async (err) => {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_INPUT_CALLBACK_0100 callback");
if (!err) {
......@@ -955,6 +1078,7 @@ export default function cameraSessionTest(surfaceId: any) {
await mCameraSession.removeOutput(mPreviewOutput);
await mCameraSession.removeOutput(mPhotoOutput);
await sleep(500);
}
await releaseInput();
await releaseOutput();
......@@ -990,6 +1114,7 @@ export default function cameraSessionTest(surfaceId: any) {
await createInput(i);
await createOutput(i);
if (!isEmpty(mPreviewOutput) && !isEmpty(mPhotoOutput)) {
await mCameraSession.addInput(mCameraInput);
await mCameraSession.addOutput(mPreviewOutput);
await mCameraSession.addOutput(mPhotoOutput);
......@@ -1004,6 +1129,7 @@ export default function cameraSessionTest(surfaceId: any) {
await mCameraSession.removeOutput(mPreviewOutput);
await mCameraSession.removeOutput(mPhotoOutput);
await sleep(500);
}
await releaseInput();
await releaseOutput();
......@@ -1036,7 +1162,7 @@ export default function cameraSessionTest(surfaceId: any) {
await createInput(0);
await createOutput(0);
if (!isEmpty(mPreviewOutput)) {
if (!isEmpty(mPreviewOutput) && !isEmpty(mPhotoOutput)) {
mCameraSession.addOutput(mPreviewOutput, async (err) => {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_CALLBACK_0100 add callback");
if (!err) {
......@@ -1100,7 +1226,7 @@ export default function cameraSessionTest(surfaceId: any) {
await createInput(0);
await createOutput(0);
if (!isEmpty(mPreviewOutput)) {
if (!isEmpty(mPreviewOutput) && !isEmpty(mPhotoOutput)) {
await mCameraSession.addOutput(mPreviewOutput);
await mCameraSession.addOutput(mPhotoOutput);
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_OUTPUT_PROMISE_0100 add PASSED");
......@@ -1416,6 +1542,23 @@ export default function cameraSessionTest(surfaceId: any) {
await startCameraSession(i);
if (!isEmpty(mPreviewOutput)) {
let focusModeSupportedFlag = await mCameraSession.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO);
if (focusModeSupportedFlag == false) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0100 skip camera[" + i + "], for FOCUS_MODE_AUTO");
await beginCameraSessionConfig();
await stopCameraSession();
continue;
}
focusModeSupportedFlag = await mCameraSession.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO);
if (focusModeSupportedFlag == false) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0100 skip camera[" + i + "], for FOCUS_MODE_CONTINUOUS_AUTO");
await beginCameraSessionConfig();
await stopCameraSession();
continue;
}
mCameraSession.on('focusStateChange', async (err, data) => {
if (!err) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0100 callback");
......@@ -1430,15 +1573,32 @@ export default function cameraSessionTest(surfaceId: any) {
await sleep(1);
})
await mCameraSession.start();
await beginCameraSessionConfig();
mCameraSession.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO);
await sleep(3000);
await commitCameraSessionConfig();
await sleep(100);
await beginCameraSessionConfig();
mCameraSession.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO);
await commitCameraSessionConfig();
await sleep(100);
if (nfyFlag == false) {
//expect().assertFail();
//console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0100 FAILED without any nofity!");
}
await mCameraSession.stop();
}
await beginCameraSessionConfig();
await stopCameraSession();
......@@ -1452,8 +1612,8 @@ export default function cameraSessionTest(surfaceId: any) {
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0101
* @tc.name : camera status callback on CaptureSession async api for exposureStateChange
* @tc.desc : camera status callback on CaptureSession async api for exposureStateChange
* @tc.name : camera status callback on CaptureSession async api for error
* @tc.desc : camera status callback on CaptureSession async api for error
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
......@@ -1473,7 +1633,8 @@ export default function cameraSessionTest(surfaceId: any) {
await startCameraSession(i);
mCameraSession.on('exposureStateChange', async (err, data) => {
if (!isEmpty(mPreviewOutput)) {
mCameraSession.on('error', async (err, data) => {
if (!err) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0101 callback");
if (data != null || data != undefined) {
......@@ -1487,15 +1648,17 @@ export default function cameraSessionTest(surfaceId: any) {
await sleep(1);
})
mCameraSession.setExposureMode(cameraObj.ExposureMode.EXPOSURE_MODE_AUTO);
await mCameraSession.start();
await sleep(3000);
await sleep(400);
if (nfyFlag == false) {
//expect().assertFail();
//console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0101 FAILED without any nofity!");
}
await mCameraSession.stop();
}
await beginCameraSessionConfig();
await stopCameraSession();
......@@ -1507,61 +1670,6 @@ export default function cameraSessionTest(surfaceId: any) {
}
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0102
* @tc.name : camera status callback on CaptureSession async api for error
* @tc.desc : camera status callback on CaptureSession async api for error
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0102', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0102--------------");
if (mCameraNum == 0) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0102 FAILED with NoCamera");
expect().assertFail();
done();
} else {
for (let i = 0; i < mCameraNum; i++) {
let nfyFlag = false;
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0102 start for camera[" + i + "]");
await startCameraSession(i);
mCameraSession.on('error', async (err, data) => {
if (!err) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0102 callback");
if (data != null || data != undefined) {
console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0102 PASSED: " + data);
nfyFlag = true;
}
} else {
expect().assertFail();
console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0102 FAILED: " + err.message);
}
await sleep(1);
})
await sleep(3000);
if (nfyFlag == false) {
//expect().assertFail();
//console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0102 FAILED without any nofity!");
}
await beginCameraSessionConfig();
await stopCameraSession();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0102 end for camera[" + i + "]");
}
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0102 ends here");
done();
}
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_RELEASE_CALLBACK_0100
* @tc.name : Check capture session release with callback or not for preview
......
......@@ -32,7 +32,7 @@ let mCameraManager;
let mCameraDevicesArray;
let mCameraSession;
let mPhoteSurface;
let mPhotoSurface;
let mVideoRecorder;
let mVideoSurface;
let mFileAsset;
......@@ -238,8 +238,8 @@ export default function cameraSessionExposureTest(surfaceId: any) {
console.log(TAG + 'before receiver check')
if (receiver !== undefined) {
console.log(TAG + 'Photo receiver is created successfully')
mPhoteSurface = await receiver.getReceivingSurfaceId()
console.log(TAG + 'Photo received id: ' + JSON.stringify(mPhoteSurface))
mPhotoSurface = await receiver.getReceivingSurfaceId()
console.log(TAG + 'Photo received id: ' + JSON.stringify(mPhotoSurface))
} else {
console.log(TAG + 'Photo receiver is created failed')
}
......@@ -412,7 +412,14 @@ export default function cameraSessionExposureTest(surfaceId: any) {
return false;
}
mCameraInput = await mCameraManager.createCameraInput(mCameraDevicesArray[idx]);
mCameraInput = null;
await mCameraManager.createCameraInput(mCameraDevicesArray[idx]).then((result) => {
console.info('createCameraInput success');
mCameraInput = result;
}).catch((err) => {
console.info('createCameraInput failed, err = ' + err.message);
});
if (isEmpty(mCameraInput)) {
console.info(TAG + "createCameraInput FAILED");
return false;
......@@ -452,7 +459,17 @@ export default function cameraSessionExposureTest(surfaceId: any) {
async function createOutput(idx:any) {
console.info('Enter createOutput');
let cameraOutputCap = await mCameraManager.getSupportedOutputCapability(mCameraDevicesArray[idx]);
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;
mPhotoOutput = null;
});
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++) {
......@@ -473,7 +490,7 @@ export default function cameraSessionExposureTest(surfaceId: any) {
console.info(TAG + "cameraOutputCap.photoProfiles.length: " + cameraOutputCap.photoProfiles.length);
for (let i = 0; i < cameraOutputCap.photoProfiles.length; i++) {
mPhotoOutput = await mCameraManager.createPhotoOutput(cameraOutputCap.photoProfiles[i], mPhoteSurface);
mPhotoOutput = await mCameraManager.createPhotoOutput(cameraOutputCap.photoProfiles[i], mPhotoSurface);
if (!isEmpty(mPhotoOutput)) {
break;
}
......@@ -507,13 +524,15 @@ export default function cameraSessionExposureTest(surfaceId: any) {
console.info(TAG + "createVideoOutput: " + mVideoOutput);
}
*/
}
console.info('Exit createOutputs');
return true;
}
async function releaseOutput() {
console.info('Enter createOutput');
console.info('Enter releaseOutput');
if (!isEmpty(mPreviewOutput)) {
await mPreviewOutput.stop();
......@@ -529,7 +548,7 @@ export default function cameraSessionExposureTest(surfaceId: any) {
await mVideoOutput.release();
}
*/
console.info('Exit createOutput');
console.info('Exit releaseOutput');
return true;
}
......@@ -577,7 +596,7 @@ export default function cameraSessionExposureTest(surfaceId: any) {
}
})
await sleep(1000);
await sleep(100);
*/
console.info(TAG + "Exit startCameraSession");
......@@ -596,7 +615,7 @@ export default function cameraSessionExposureTest(surfaceId: any) {
}
})
await sleep(1000);
await sleep(100);
*/
if (!isEmpty(mCameraInput)) {
......@@ -698,7 +717,7 @@ export default function cameraSessionExposureTest(surfaceId: any) {
expect().assertFail();
}
})
await sleep(1000);
await sleep(100);
await stopCameraSession();
......@@ -740,7 +759,7 @@ export default function cameraSessionExposureTest(surfaceId: any) {
expect().assertFail();
}
await sleep(1000);
await sleep(100);
await stopCameraSession();
......@@ -902,7 +921,7 @@ export default function cameraSessionExposureTest(surfaceId: any) {
expect().assertFail();
}
})
await sleep(1000);
await sleep(100);
await stopCameraSession();
......@@ -944,7 +963,7 @@ export default function cameraSessionExposureTest(surfaceId: any) {
expect().assertFail();
}
await sleep(1000);
await sleep(100);
await stopCameraSession();
......@@ -1106,7 +1125,7 @@ export default function cameraSessionExposureTest(surfaceId: any) {
expect().assertFail();
}
})
await sleep(1000);
await sleep(100);
await stopCameraSession();
......@@ -1126,11 +1145,11 @@ export default function cameraSessionExposureTest(surfaceId: any) {
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_PROMISE_0102', 2, async function (done) {
it('SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_PROMISE_0101', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_PROMISE_0102--------------");
if (mCameraNum == 0) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_PROMISE_0102 FAILED with NoCamera");
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_EXPOSURE_MODE_SUPPORT_PROMISE_0101 FAILED with NoCamera");
expect().assertFail();
done();
} else {
......@@ -1148,7 +1167,7 @@ export default function cameraSessionExposureTest(surfaceId: any) {
expect().assertFail();
}
await sleep(1000);
await sleep(100);
await stopCameraSession();
......
......@@ -32,7 +32,7 @@ let mCameraManager;
let mCameraDevicesArray;
let mCameraSession;
let mPhoteSurface;
let mPhotoSurface;
let mVideoRecorder;
let mVideoSurface;
let mFileAsset;
......@@ -189,8 +189,8 @@ export default function cameraSessionFlashTest(surfaceId: any) {
console.log(TAG + 'before receiver check')
if (receiver !== undefined) {
console.log(TAG + 'Photo receiver is created successfully')
mPhoteSurface = await receiver.getReceivingSurfaceId()
console.log(TAG + 'Photo received id: ' + JSON.stringify(mPhoteSurface))
mPhotoSurface = await receiver.getReceivingSurfaceId()
console.log(TAG + 'Photo received id: ' + JSON.stringify(mPhotoSurface))
} else {
console.log(TAG + 'Photo receiver is created failed')
}
......@@ -363,7 +363,14 @@ export default function cameraSessionFlashTest(surfaceId: any) {
return false;
}
mCameraInput = await mCameraManager.createCameraInput(mCameraDevicesArray[idx]);
mCameraInput = null;
await mCameraManager.createCameraInput(mCameraDevicesArray[idx]).then((result) => {
console.info('createCameraInput success');
mCameraInput = result;
}).catch((err) => {
console.info('createCameraInput failed, err = ' + err.message);
});
if (isEmpty(mCameraInput)) {
console.info(TAG + "createCameraInput FAILED");
return false;
......@@ -403,7 +410,17 @@ export default function cameraSessionFlashTest(surfaceId: any) {
async function createOutput(idx:any) {
console.info('Enter createOutput');
let cameraOutputCap = await mCameraManager.getSupportedOutputCapability(mCameraDevicesArray[idx]);
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;
mPhotoOutput = null;
});
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++) {
......@@ -424,7 +441,7 @@ export default function cameraSessionFlashTest(surfaceId: any) {
console.info(TAG + "cameraOutputCap.photoProfiles.length: " + cameraOutputCap.photoProfiles.length);
for (let i = 0; i < cameraOutputCap.photoProfiles.length; i++) {
mPhotoOutput = await mCameraManager.createPhotoOutput(cameraOutputCap.photoProfiles[i], mPhoteSurface);
mPhotoOutput = await mCameraManager.createPhotoOutput(cameraOutputCap.photoProfiles[i], mPhotoSurface);
if (!isEmpty(mPhotoOutput)) {
break;
}
......@@ -458,13 +475,15 @@ export default function cameraSessionFlashTest(surfaceId: any) {
console.info(TAG + "createVideoOutput: " + mVideoOutput);
}
*/
}
console.info('Exit createOutputs');
return true;
}
async function releaseOutput() {
console.info('Enter createOutput');
console.info('Enter releaseOutput');
if (!isEmpty(mPreviewOutput)) {
await mPreviewOutput.stop();
......@@ -480,7 +499,7 @@ export default function cameraSessionFlashTest(surfaceId: any) {
await mVideoOutput.release();
}
*/
console.info('Exit createOutput');
console.info('Exit releaseOutput');
return true;
}
......@@ -528,7 +547,7 @@ export default function cameraSessionFlashTest(surfaceId: any) {
}
})
await sleep(1000);
await sleep(100);
*/
console.info(TAG + "Exit startCameraSession");
......@@ -547,7 +566,7 @@ export default function cameraSessionFlashTest(surfaceId: any) {
}
})
await sleep(1000);
await sleep(100);
*/
if (!isEmpty(mCameraInput)) {
......@@ -649,7 +668,7 @@ export default function cameraSessionFlashTest(surfaceId: any) {
expect().assertFail();
}
})
await sleep(1000);
await sleep(100);
await stopCameraSession();
......@@ -691,7 +710,7 @@ export default function cameraSessionFlashTest(surfaceId: any) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_HAS_FLASH_PROMISE_0100 FAILED with hasFlash is: " + hasFlashPromise);
expect().assertFail();
}
await sleep(1000);
await sleep(100);
await stopCameraSession();
......@@ -742,7 +761,7 @@ export default function cameraSessionFlashTest(surfaceId: any) {
expect().assertFail();
}
})
await sleep(1000);
await sleep(100);
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0100 not support");
}
......@@ -788,7 +807,7 @@ export default function cameraSessionFlashTest(surfaceId: any) {
expect().assertFail();
}
await sleep(1000);
await sleep(100);
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_PROMISE_0100 not support");
}
......@@ -955,7 +974,7 @@ export default function cameraSessionFlashTest(surfaceId: any) {
expect().assertFail();
}
})
await sleep(1000);
await sleep(100);
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0101 not support");
}
......@@ -1001,7 +1020,7 @@ export default function cameraSessionFlashTest(surfaceId: any) {
expect().assertFail();
}
await sleep(1000);
await sleep(100);
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_PROMISE_0101 not support");
}
......@@ -1167,7 +1186,7 @@ export default function cameraSessionFlashTest(surfaceId: any) {
expect().assertFail();
}
})
await sleep(1000);
await sleep(100);
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0102 not support");
}
......@@ -1213,7 +1232,7 @@ export default function cameraSessionFlashTest(surfaceId: any) {
expect().assertFail();
}
await sleep(1000);
await sleep(100);
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_PROMISE_0102 not support");
}
......@@ -1379,7 +1398,7 @@ export default function cameraSessionFlashTest(surfaceId: any) {
expect().assertFail();
}
})
await sleep(1000);
await sleep(100);
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_CALLBACK_0103 not support");
}
......@@ -1425,7 +1444,7 @@ export default function cameraSessionFlashTest(surfaceId: any) {
expect().assertFail();
}
await sleep(1000);
await sleep(100);
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_FLASH_MODE_SUPPORT_PROMISE_0103 not support");
}
......
......@@ -32,7 +32,7 @@ let mCameraManager;
let mCameraDevicesArray;
let mCameraSession;
let mPhoteSurface;
let mPhotoSurface;
let mVideoRecorder;
let mVideoSurface;
let mFileAsset;
......@@ -235,8 +235,8 @@ export default function cameraSessionFocusTest(surfaceId: any) {
console.log(TAG + 'before receiver check')
if (receiver !== undefined) {
console.log(TAG + 'Photo receiver is created successfully')
mPhoteSurface = await receiver.getReceivingSurfaceId()
console.log(TAG + 'Photo received id: ' + JSON.stringify(mPhoteSurface))
mPhotoSurface = await receiver.getReceivingSurfaceId()
console.log(TAG + 'Photo received id: ' + JSON.stringify(mPhotoSurface))
} else {
console.log(TAG + 'Photo receiver is created failed')
}
......@@ -408,7 +408,14 @@ export default function cameraSessionFocusTest(surfaceId: any) {
return false;
}
mCameraInput = await mCameraManager.createCameraInput(mCameraDevicesArray[idx]);
mCameraInput = null;
await mCameraManager.createCameraInput(mCameraDevicesArray[idx]).then((result) => {
console.info('createCameraInput success');
mCameraInput = result;
}).catch((err) => {
console.info('createCameraInput failed, err = ' + err.message);
});
if (isEmpty(mCameraInput)) {
console.info(TAG + "createCameraInput FAILED");
return false;
......@@ -448,7 +455,17 @@ export default function cameraSessionFocusTest(surfaceId: any) {
async function createOutput(idx:any) {
console.info('Enter createOutput');
let cameraOutputCap = await mCameraManager.getSupportedOutputCapability(mCameraDevicesArray[idx]);
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;
mPhotoOutput = null;
});
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++) {
......@@ -469,7 +486,7 @@ export default function cameraSessionFocusTest(surfaceId: any) {
console.info(TAG + "cameraOutputCap.photoProfiles.length: " + cameraOutputCap.photoProfiles.length);
for (let i = 0; i < cameraOutputCap.photoProfiles.length; i++) {
mPhotoOutput = await mCameraManager.createPhotoOutput(cameraOutputCap.photoProfiles[i], mPhoteSurface);
mPhotoOutput = await mCameraManager.createPhotoOutput(cameraOutputCap.photoProfiles[i], mPhotoSurface);
if (!isEmpty(mPhotoOutput)) {
break;
}
......@@ -503,13 +520,15 @@ export default function cameraSessionFocusTest(surfaceId: any) {
console.info(TAG + "createVideoOutput: " + mVideoOutput);
}
*/
}
console.info('Exit createOutputs');
return true;
}
async function releaseOutput() {
console.info('Enter createOutput');
console.info('Enter releaseOutput');
if (!isEmpty(mPreviewOutput)) {
await mPreviewOutput.stop();
......@@ -525,7 +544,7 @@ export default function cameraSessionFocusTest(surfaceId: any) {
await mVideoOutput.release();
}
*/
console.info('Exit createOutput');
console.info('Exit releaseOutput');
return true;
}
......@@ -573,7 +592,7 @@ export default function cameraSessionFocusTest(surfaceId: any) {
}
})
await sleep(1000);
await sleep(100);
*/
console.info(TAG + "Exit startCameraSession");
......@@ -592,7 +611,7 @@ export default function cameraSessionFocusTest(surfaceId: any) {
}
})
await sleep(1000);
await sleep(100);
*/
if (!isEmpty(mCameraInput)) {
......@@ -694,7 +713,7 @@ export default function cameraSessionFocusTest(surfaceId: any) {
expect().assertFail();
}
})
await sleep(1000);
await sleep(100);
await stopCameraSession();
......@@ -736,7 +755,7 @@ export default function cameraSessionFocusTest(surfaceId: any) {
expect().assertFail();
}
await sleep(1000);
await sleep(100);
await stopCameraSession();
......@@ -898,7 +917,7 @@ export default function cameraSessionFocusTest(surfaceId: any) {
expect().assertFail();
}
})
await sleep(1000);
await sleep(100);
await stopCameraSession();
......@@ -940,7 +959,7 @@ export default function cameraSessionFocusTest(surfaceId: any) {
expect().assertFail();
}
await sleep(1000);
await sleep(100);
await stopCameraSession();
......@@ -1102,7 +1121,7 @@ export default function cameraSessionFocusTest(surfaceId: any) {
expect().assertFail();
}
})
await sleep(1000);
await sleep(100);
await stopCameraSession();
......@@ -1144,7 +1163,7 @@ export default function cameraSessionFocusTest(surfaceId: any) {
expect().assertFail();
}
await sleep(1000);
await sleep(100);
await stopCameraSession();
......@@ -1306,7 +1325,7 @@ export default function cameraSessionFocusTest(surfaceId: any) {
expect().assertFail();
}
})
await sleep(1000);
await sleep(100);
await stopCameraSession();
......@@ -1348,7 +1367,7 @@ export default function cameraSessionFocusTest(surfaceId: any) {
expect().assertFail();
}
await sleep(1000);
await sleep(100);
await stopCameraSession();
......@@ -1457,7 +1476,7 @@ export default function cameraSessionFocusTest(surfaceId: any) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_PROMISE_0103 FAILED with FocusMode is: " + focusMode);
expect().assertFail();
}
await sleep(1000);
await sleep(100);
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_SET_GET_FOCUS_MODE_PROMISE_0103 not support");
}
......@@ -2438,7 +2457,7 @@ export default function cameraSessionFocusTest(surfaceId: any) {
expect().assertFail();
}
})
await sleep(1000);
await sleep(100);
await stopCameraSession();
......@@ -2475,7 +2494,7 @@ export default function cameraSessionFocusTest(surfaceId: any) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_GET_FOCAL_LENGTH_PROMISE_0100 finish");
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_GET_FOCAL_LENGTH_PROMISE_0100 PASSED with FocalLength is: " + focalLength);
await sleep(1000);
await sleep(100);
await stopCameraSession();
......
......@@ -32,7 +32,7 @@ let mCameraManager;
let mCameraDevicesArray;
let mCameraSession;
let mPhoteSurface;
let mPhotoSurface;
let mVideoRecorder;
let mVideoSurface;
let mFileAsset;
......@@ -188,8 +188,8 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) {
console.log(TAG + 'before receiver check')
if (receiver !== undefined) {
console.log(TAG + 'Photo receiver is created successfully')
mPhoteSurface = await receiver.getReceivingSurfaceId()
console.log(TAG + 'Photo received id: ' + JSON.stringify(mPhoteSurface))
mPhotoSurface = await receiver.getReceivingSurfaceId()
console.log(TAG + 'Photo received id: ' + JSON.stringify(mPhotoSurface))
} else {
console.log(TAG + 'Photo receiver is created failed')
}
......@@ -361,7 +361,14 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) {
return false;
}
mCameraInput = await mCameraManager.createCameraInput(mCameraDevicesArray[idx]);
mCameraInput = null;
await mCameraManager.createCameraInput(mCameraDevicesArray[idx]).then((result) => {
console.info('createCameraInput success');
mCameraInput = result;
}).catch((err) => {
console.info('createCameraInput failed, err = ' + err.message);
});
if (isEmpty(mCameraInput)) {
console.info(TAG + "createCameraInput FAILED");
return false;
......@@ -401,7 +408,17 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) {
async function createOutput(idx:any) {
console.info('Enter createOutput');
let cameraOutputCap = await mCameraManager.getSupportedOutputCapability(mCameraDevicesArray[idx]);
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;
mPhotoOutput = null;
});
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++) {
......@@ -422,7 +439,7 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) {
console.info(TAG + "cameraOutputCap.photoProfiles.length: " + cameraOutputCap.photoProfiles.length);
for (let i = 0; i < cameraOutputCap.photoProfiles.length; i++) {
mPhotoOutput = await mCameraManager.createPhotoOutput(cameraOutputCap.photoProfiles[i], mPhoteSurface);
mPhotoOutput = await mCameraManager.createPhotoOutput(cameraOutputCap.photoProfiles[i], mPhotoSurface);
if (!isEmpty(mPhotoOutput)) {
break;
}
......@@ -456,13 +473,15 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) {
console.info(TAG + "createVideoOutput: " + mVideoOutput);
}
*/
}
console.info('Exit createOutputs');
return true;
}
async function releaseOutput() {
console.info('Enter createOutput');
console.info('Enter releaseOutput');
if (!isEmpty(mPreviewOutput)) {
await mPreviewOutput.stop();
......@@ -478,7 +497,7 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) {
await mVideoOutput.release();
}
*/
console.info('Exit createOutput');
console.info('Exit releaseOutput');
return true;
}
......@@ -526,7 +545,7 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) {
}
})
await sleep(1000);
await sleep(100);
*/
console.info(TAG + "Exit startCameraSession");
......@@ -545,7 +564,7 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) {
}
})
await sleep(1000);
await sleep(100);
*/
if (!isEmpty(mCameraInput)) {
......@@ -637,12 +656,7 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) {
if (!err) {
if (data != null || data != undefined) {
mIsVideoStabilizationModeSupportedArray[i] = data;
if ((deviceInfo.deviceType != 'default') && (data == false)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0100 FAILED with isVideoStabilizationModeSupported is: " + data);
expect().assertFail();
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0100 PASSED with isVideoStabilizationModeSupported is: " + data);
}
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0100 FAILED with isVideoStabilizationModeSupported is: " + data);
expect().assertFail();
......@@ -652,7 +666,7 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) {
expect().assertFail();
}
})
await sleep(1000);
await sleep(100);
await stopCameraSession();
......@@ -688,18 +702,13 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) {
let isVideoStabilizationModeSupported = await mCameraSession.isVideoStabilizationModeSupported(cameraObj.VideoStabilizationMode.OFF);
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_PROMISE_0100 finish");
if (isVideoStabilizationModeSupported != null || isVideoStabilizationModeSupported != undefined) {
if ((deviceInfo.deviceType != 'default') && (isVideoStabilizationModeSupported == false)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_PROMISE_0100 FAILED with isVideoStabilizationModeSupported is: " + isVideoStabilizationModeSupported);
expect().assertFail();
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_PROMISE_0100 PASSED with isVideoStabilizationModeSupported is: " + isVideoStabilizationModeSupported);
}
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_PROMISE_0100 FAILED with isVideoStabilizationModeSupported is: " + isVideoStabilizationModeSupported);
expect().assertFail();
}
await sleep(1000);
await sleep(100);
await stopCameraSession();
......@@ -851,12 +860,7 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) {
if (!err) {
if (data != null || data != undefined) {
mIsVideoStabilizationModeSupportedArray[i] = data;
if ((deviceInfo.deviceType != 'default') && (data == false)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0101 FAILED with isVideoStabilizationModeSupported is: " + data);
expect().assertFail();
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0101 PASSED with isVideoStabilizationModeSupported is: " + data);
}
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0101 FAILED with isVideoStabilizationModeSupported is: " + data);
expect().assertFail();
......@@ -866,7 +870,7 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) {
expect().assertFail();
}
})
await sleep(1000);
await sleep(100);
await stopCameraSession();
......@@ -902,18 +906,13 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) {
let isVideoStabilizationModeSupported = await mCameraSession.isVideoStabilizationModeSupported(cameraObj.VideoStabilizationMode.LOW);
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_PROMISE_0101 finish");
if (isVideoStabilizationModeSupported != null || isVideoStabilizationModeSupported != undefined) {
if ((deviceInfo.deviceType != 'default') && (isVideoStabilizationModeSupported == false)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_PROMISE_0101 FAILED with isVideoStabilizationModeSupported is: " + isVideoStabilizationModeSupported);
expect().assertFail();
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_PROMISE_0101 PASSED with isVideoStabilizationModeSupported is: " + isVideoStabilizationModeSupported);
}
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_PROMISE_0101 FAILED with isVideoStabilizationModeSupported is: " + isVideoStabilizationModeSupported);
expect().assertFail();
}
await sleep(1000);
await sleep(100);
await stopCameraSession();
......@@ -1065,12 +1064,7 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) {
if (!err) {
if (data != null || data != undefined) {
mIsVideoStabilizationModeSupportedArray[i] = data;
if ((deviceInfo.deviceType != 'default' && deviceInfo.deviceType != 'tablet') && (data == false)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0102 FAILED with isVideoStabilizationModeSupported is: " + data);
expect().assertFail();
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0102 PASSED with isVideoStabilizationModeSupported is: " + data);
}
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0102 FAILED with isVideoStabilizationModeSupported is: " + data);
expect().assertFail();
......@@ -1080,7 +1074,7 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) {
expect().assertFail();
}
})
await sleep(1000);
await sleep(100);
await stopCameraSession();
......@@ -1116,18 +1110,13 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) {
let isVideoStabilizationModeSupported = await mCameraSession.isVideoStabilizationModeSupported(cameraObj.VideoStabilizationMode.MIDDLE);
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_PROMISE_0102 finish");
if (isVideoStabilizationModeSupported != null || isVideoStabilizationModeSupported != undefined) {
if ((deviceInfo.deviceType != 'default' && deviceInfo.deviceType != 'tablet') && (isVideoStabilizationModeSupported == false)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_PROMISE_0102 FAILED with isVideoStabilizationModeSupported is: " + isVideoStabilizationModeSupported);
expect().assertFail();
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_PROMISE_0102 PASSED with isVideoStabilizationModeSupported is: " + isVideoStabilizationModeSupported);
}
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_PROMISE_0102 FAILED with isVideoStabilizationModeSupported is: " + isVideoStabilizationModeSupported);
expect().assertFail();
}
await sleep(1000);
await sleep(100);
await stopCameraSession();
......@@ -1279,12 +1268,7 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) {
if (!err) {
if (data != null || data != undefined) {
mIsVideoStabilizationModeSupportedArray[i] = data;
if ((deviceInfo.deviceType != 'default' && deviceInfo.deviceType != 'tablet') && (data == false)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0103 FAILED with isVideoStabilizationModeSupported is: " + data);
expect().assertFail();
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0103 PASSED with isVideoStabilizationModeSupported is: " + data);
}
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0103 FAILED with isVideoStabilizationModeSupported is: " + data);
expect().assertFail();
......@@ -1294,7 +1278,7 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) {
expect().assertFail();
}
})
await sleep(1000);
await sleep(100);
await stopCameraSession();
......@@ -1330,18 +1314,13 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) {
let isVideoStabilizationModeSupported = await mCameraSession.isVideoStabilizationModeSupported(cameraObj.VideoStabilizationMode.HIGH);
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_PROMISE_0103 finish");
if (isVideoStabilizationModeSupported != null || isVideoStabilizationModeSupported != undefined) {
if ((deviceInfo.deviceType != 'default' && deviceInfo.deviceType != 'tablet') && (isVideoStabilizationModeSupported == false)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_PROMISE_0103 FAILED with isVideoStabilizationModeSupported is: " + isVideoStabilizationModeSupported);
expect().assertFail();
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_PROMISE_0103 PASSED with isVideoStabilizationModeSupported is: " + isVideoStabilizationModeSupported);
}
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_PROMISE_0103 FAILED with isVideoStabilizationModeSupported is: " + isVideoStabilizationModeSupported);
expect().assertFail();
}
await sleep(1000);
await sleep(100);
await stopCameraSession();
......@@ -1493,12 +1472,7 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) {
if (!err) {
if (data != null || data != undefined) {
mIsVideoStabilizationModeSupportedArray[i] = data;
if ((deviceInfo.deviceType != 'default' && deviceInfo.deviceType != 'tablet') && (data == false)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0104 FAILED with isVideoStabilizationModeSupported is: " + data);
expect().assertFail();
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0104 PASSED with isVideoStabilizationModeSupported is: " + data);
}
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_CALLBACK_0104 FAILED with isVideoStabilizationModeSupported is: " + data);
expect().assertFail();
......@@ -1508,7 +1482,7 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) {
expect().assertFail();
}
})
await sleep(1000);
await sleep(100);
await stopCameraSession();
......@@ -1544,18 +1518,13 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) {
let isVideoStabilizationModeSupported = await mCameraSession.isVideoStabilizationModeSupported(cameraObj.VideoStabilizationMode.AUTO);
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_PROMISE_0104 finish");
if (isVideoStabilizationModeSupported != null || isVideoStabilizationModeSupported != undefined) {
if ((deviceInfo.deviceType != 'default' && deviceInfo.deviceType != 'tablet') && (isVideoStabilizationModeSupported == false)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_PROMISE_0104 FAILED with isVideoStabilizationModeSupported is: " + isVideoStabilizationModeSupported);
expect().assertFail();
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_PROMISE_0104 PASSED with isVideoStabilizationModeSupported is: " + isVideoStabilizationModeSupported);
}
} else {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_IS_VIDEO_STABILIZATION_MODE_SUPPORT_PROMISE_0104 FAILED with isVideoStabilizationModeSupported is: " + isVideoStabilizationModeSupported);
expect().assertFail();
}
await sleep(1000);
await sleep(100);
await stopCameraSession();
......
......@@ -32,7 +32,7 @@ let mCameraManager;
let mCameraDevicesArray;
let mCameraSession;
let mPhoteSurface;
let mPhotoSurface;
let mVideoRecorder;
let mVideoSurface;
let mFileAsset;
......@@ -190,8 +190,8 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) {
console.log(TAG + 'before receiver check')
if (receiver !== undefined) {
console.log(TAG + 'Photo receiver is created successfully')
mPhoteSurface = await receiver.getReceivingSurfaceId()
console.log(TAG + 'Photo received id: ' + JSON.stringify(mPhoteSurface))
mPhotoSurface = await receiver.getReceivingSurfaceId()
console.log(TAG + 'Photo received id: ' + JSON.stringify(mPhotoSurface))
} else {
console.log(TAG + 'Photo receiver is created failed')
}
......@@ -365,7 +365,14 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) {
return false;
}
mCameraInput = await mCameraManager.createCameraInput(mCameraDevicesArray[idx]);
mCameraInput = null;
await mCameraManager.createCameraInput(mCameraDevicesArray[idx]).then((result) => {
console.info('createCameraInput success');
mCameraInput = result;
}).catch((err) => {
console.info('createCameraInput failed, err = ' + err.message);
});
if (isEmpty(mCameraInput)) {
console.info(TAG + "createCameraInput FAILED");
return false;
......@@ -405,7 +412,17 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) {
async function createOutput(idx:any) {
console.info('Enter createOutput');
let cameraOutputCap = await mCameraManager.getSupportedOutputCapability(mCameraDevicesArray[idx]);
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;
mPhotoOutput = null;
});
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++) {
......@@ -426,7 +443,7 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) {
console.info(TAG + "cameraOutputCap.photoProfiles.length: " + cameraOutputCap.photoProfiles.length);
for (let i = 0; i < cameraOutputCap.photoProfiles.length; i++) {
mPhotoOutput = await mCameraManager.createPhotoOutput(cameraOutputCap.photoProfiles[i], mPhoteSurface);
mPhotoOutput = await mCameraManager.createPhotoOutput(cameraOutputCap.photoProfiles[i], mPhotoSurface);
if (!isEmpty(mPhotoOutput)) {
break;
}
......@@ -460,13 +477,15 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) {
console.info(TAG + "createVideoOutput: " + mVideoOutput);
}
*/
}
console.info('Exit createOutputs');
return true;
}
async function releaseOutput() {
console.info('Enter createOutput');
console.info('Enter releaseOutput');
if (!isEmpty(mPreviewOutput)) {
await mPreviewOutput.stop();
......@@ -482,7 +501,7 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) {
await mVideoOutput.release();
}
*/
console.info('Exit createOutput');
console.info('Exit releaseOutput');
return true;
}
......@@ -530,7 +549,7 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) {
}
})
await sleep(1000);
await sleep(100);
*/
console.info(TAG + "Exit startCameraSession");
......@@ -549,7 +568,7 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) {
}
})
await sleep(1000);
await sleep(100);
*/
if (!isEmpty(mCameraInput)) {
......@@ -662,7 +681,7 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_GET_ZOOM_RATIO_RANGE_CALLBACK_0100 PASSED : " + err.message);
}
})
await sleep(1000);
await sleep(100);
await stopCameraSession();
......@@ -710,10 +729,10 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) {
}
}
catch {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_GET_ZOOM_RATIO_RANGE_PROMISE_0100 PASSED");
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_GET_ZOOM_RATIO_RANGE_CALLBACK_0100 PASSED");
}
await sleep(1000);
await sleep(100);
await stopCameraSession();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册