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

!6251 【媒体子系统】camera新增属性覆盖

Merge pull request !6251 from liuxueqi/monthly_20221018
......@@ -23,6 +23,7 @@ import cameraSessionVideoStabilizationTest from './CameraSessionVideoStabilizati
import cameraSessionBaseTest from './CameraSessionBaseTest.test.ets'
import cameraInputTest from './CameraInputTest.test.ets'
import cameraManagerTest from './CameraManagerTest.test.ets'
import cameraEnumTest from './CameraEnumTest.test.ets'
let TAG = 'CameraModuleTest: '
......@@ -39,4 +40,5 @@ export default function cameraKit(surfaceId: any) {
cameraSessionVideoStabilizationTest(surfaceId)
cameraSessionBaseTest(surfaceId)
cameraManagerTest(surfaceId)
cameraEnumTest(surfaceId)
}
\ No newline at end of file
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import camera from '@ohos.multimedia.camera';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
const TAG = "CameraEnumTest: ";
export default function cameraEnumTest(surfaceId: any) {
function isEmpty(data) {
if (data == null || data == undefined) {
return true;
}
return false;
}
describe('CameraEnumTest', function () {
console.info(TAG + '----------CameraEnumTest--------------');
beforeAll(async function () {
console.info('beforeAll case');
})
beforeEach(function () {
console.info('beforeEach case');
})
afterEach(async function () {
console.info('afterEach case');
})
afterAll(function () {
console.info('afterAll case');
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_CAMERASTATUS_0100
* @tc.name : Camera CameraStatus Eunm
* @tc.desc : Camera CameraStatus Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_CAMERASTATUS_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_CAMERASTATUS_0100--------------");
expect(camera.CameraStatus.CAMERA_STATUS_APPEAR == 0).assertTrue();
expect(camera.CameraStatus.CAMERA_STATUS_DISAPPEAR == 1).assertTrue();
expect(camera.CameraStatus.CAMERA_STATUS_AVAILABLE == 2).assertTrue();
expect(camera.CameraStatus.CAMERA_STATUS_UNAVAILABLE == 3).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_CAMERASTATUS_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAPOSITION_0100
* @tc.name : Camera CameraPosition Eunm
* @tc.desc : Camera CameraPosition Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAPOSITION_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAPOSITION_0100--------------");
expect(camera.CameraPosition.CAMERA_POSITION_UNSPECIFIED == 0).assertTrue();
expect(camera.CameraPosition.CAMERA_POSITION_BACK == 1).assertTrue();
expect(camera.CameraPosition.CAMERA_POSITION_FRONT == 2).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAPOSITION_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_CAMERATYPE_0100
* @tc.name : Camera CameraType Eunm
* @tc.desc : Camera CameraType Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_CAMERATYPE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_CAMERATYPE_0100--------------");
expect(camera.CameraType.CAMERA_TYPE_UNSPECIFIED == 0).assertTrue();
expect(camera.CameraType.CAMERA_TYPE_WIDE_ANGLE == 1).assertTrue();
expect(camera.CameraType.CAMERA_TYPE_ULTRA_WIDE == 2).assertTrue();
expect(camera.CameraType.CAMERA_TYPE_TELEPHOTO == 3).assertTrue();
expect(camera.CameraType.CAMERA_TYPE_TRUE_DEPTH == 4).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_CAMERATYPE_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_CONNECTIONTYPE_0100
* @tc.name : Camera ConnectionType Eunm
* @tc.desc : Camera ConnectionType Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_CONNECTIONTYPE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_CONNECTIONTYPE_0100--------------");
expect(camera.ConnectionType.CAMERA_CONNECTION_BUILT_IN == 0).assertTrue();
expect(camera.ConnectionType.CAMERA_CONNECTION_USB_PLUGIN == 1).assertTrue();
expect(camera.ConnectionType.CAMERA_CONNECTION_REMOTE == 2).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_CONNECTIONTYPE_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAINPUTERRORCODE_0100
* @tc.name : Camera CameraInputErrorCode Eunm
* @tc.desc : Camera CameraInputErrorCode Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAINPUTERRORCODE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAINPUTERRORCODE_0100--------------");
expect(camera.CameraInputErrorCode.ERROR_UNKNOWN == -1).assertTrue();
expect(camera.CameraInputErrorCode.ERROR_NO_PERMISSION == 0).assertTrue();
expect(camera.CameraInputErrorCode.ERROR_DEVICE_PREEMPTED == 1).assertTrue();
expect(camera.CameraInputErrorCode.ERROR_DEVICE_DISCONNECTED == 2).assertTrue();
expect(camera.CameraInputErrorCode.ERROR_DEVICE_IN_USE == 3).assertTrue();
expect(camera.CameraInputErrorCode.ERROR_DRIVER_ERROR == 4).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAINPUTERRORCODE_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAFORMAT_0100
* @tc.name : Camera CameraFormat Eunm
* @tc.desc : Camera CameraFormat Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAFORMAT_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAFORMAT_0100--------------");
expect(camera.CameraFormat.CAMERA_FORMAT_RGBA_8888 == 3).assertTrue();
expect(camera.CameraFormat.CAMERA_FORMAT_YUV_420_SP == 1003).assertTrue();
expect(camera.CameraFormat.CAMERA_FORMAT_JPEG == 2000).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAFORMAT_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_FLASHMODE_0100
* @tc.name : Camera FlashMode Eunm
* @tc.desc : Camera FlashMode Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_FLASHMODE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_FLASHMODE_0100--------------");
expect(camera.FlashMode.FLASH_MODE_CLOSE == 0).assertTrue();
expect(camera.FlashMode.FLASH_MODE_OPEN == 1).assertTrue();
expect(camera.FlashMode.FLASH_MODE_AUTO == 2).assertTrue();
expect(camera.FlashMode.FLASH_MODE_ALWAYS_OPEN == 3).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_FLASHMODE_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_EXPOSUREMODE_0100
* @tc.name : Camera ExposureMode Eunm
* @tc.desc : CameraExposureMode Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_EXPOSUREMODE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_EXPOSUREMODE_0100--------------");
expect(camera.ExposureMode.EXPOSURE_MODE_LOCKED == 0).assertTrue();
expect(camera.ExposureMode.EXPOSURE_MODE_AUTO == 1).assertTrue();
expect(camera.ExposureMode.EXPOSURE_MODE_CONTINUOUS_AUTO == 2).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_EXPOSUREMODE_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_FOCUSMODE_0100
* @tc.name : Camera FocusMode Eunm
* @tc.desc : Camera FocusMode Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_FOCUSMODE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_FOCUSMODE_0100--------------");
expect(camera.FocusMode.FOCUS_MODE_MANUAL == 0).assertTrue();
expect(camera.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO == 1).assertTrue();
expect(camera.FocusMode.FOCUS_MODE_AUTO == 2).assertTrue();
expect(camera.FocusMode.FOCUS_MODE_LOCKED == 3).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_FOCUSMODE_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_FOCUSSTATE_0100
* @tc.name : Camera FocusState Eunm
* @tc.desc : Camera FocusState Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_FOCUSSTATE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_FOCUSSTATE_0100--------------");
expect(camera.FocusState.FOCUS_STATE_SCAN == 0).assertTrue();
expect(camera.FocusState.FOCUS_STATE_FOCUSED == 1).assertTrue();
expect(camera.FocusState.FOCUS_STATE_UNFOCUSED == 2).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_FOCUSSTATE_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_VIDEOSTABILIZATIONMODE_0100
* @tc.name : Camera VideoStabilizationMode Eunm
* @tc.desc : Camera VideoStabilizationMode Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_VIDEOSTABILIZATIONMODE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_VIDEOSTABILIZATIONMODE_0100--------------");
expect(camera.VideoStabilizationMode.OFF == 0).assertTrue();
expect(camera.VideoStabilizationMode.LOW == 1).assertTrue();
expect(camera.VideoStabilizationMode.MIDDLE == 2).assertTrue();
expect(camera.VideoStabilizationMode.HIGH == 3).assertTrue();
expect(camera.VideoStabilizationMode.AUTO == 4).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_VIDEOSTABILIZATIONMODE_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_CAPTURESESSIONERRORCODE_0100
* @tc.name : Camera CaptureSessionErrorCode Eunm
* @tc.desc : Camera CaptureSessionErrorCode Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_CAPTURESESSIONERRORCODE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_CAPTURESESSIONERRORCODE_0100--------------");
expect(camera.CaptureSessionErrorCode.ERROR_UNKNOWN == -1).assertTrue();
expect(camera.CaptureSessionErrorCode.ERROR_INSUFFICIENT_RESOURCES == 0).assertTrue();
expect(camera.CaptureSessionErrorCode.ERROR_TIMEOUT == 1).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_CAPTURESESSIONERRORCODE_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_PREVIEWOUTPUTERRORCODE_0100
* @tc.name : Camera PreviewOutputErrorCode Eunm
* @tc.desc : Camera PreviewOutputErrorCode Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_PREVIEWOUTPUTERRORCODE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_PREVIEWOUTPUTERRORCODE_0100--------------");
expect(camera.PreviewOutputErrorCode.ERROR_UNKNOWN == -1).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_PREVIEWOUTPUTERRORCODE_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_IMAGEROTATION_0100
* @tc.name : Camera ImageRotation Eunm
* @tc.desc : Camera ImageRotation Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_IMAGEROTATION_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_IMAGEROTATION_0100--------------");
expect(camera.ImageRotation.ROTATION_0 == 0).assertTrue();
expect(camera.ImageRotation.ROTATION_90 == 90).assertTrue();
expect(camera.ImageRotation.ROTATION_180 == 180).assertTrue();
expect(camera.ImageRotation.ROTATION_270 == 270).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_IMAGEROTATION_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_QUALITYLEVEL_0100
* @tc.name : Camera QualityLevel Eunm
* @tc.desc : Camera QualityLevel Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_QUALITYLEVEL_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_QUALITYLEVEL_0100--------------");
expect(camera.QualityLevel.QUALITY_LEVEL_HIGH == 0).assertTrue();
expect(camera.QualityLevel.QUALITY_LEVEL_MEDIUM == 1).assertTrue();
expect(camera.QualityLevel.QUALITY_LEVEL_LOW == 2).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_QUALITYLEVEL_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_PHOTOOUTPUTERRORCODE_0100
* @tc.name : Camera PhotoOutputErrorCode Eunm
* @tc.desc : Camera PhotoOutputErrorCode Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_PHOTOOUTPUTERRORCODE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_PHOTOOUTPUTERRORCODE_0100--------------");
expect(camera.PhotoOutputErrorCode.ERROR_UNKNOWN == -1).assertTrue();
expect(camera.PhotoOutputErrorCode.ERROR_DRIVER_ERROR == 0).assertTrue();
expect(camera.PhotoOutputErrorCode.ERROR_INSUFFICIENT_RESOURCES == 1).assertTrue();
expect(camera.PhotoOutputErrorCode.ERROR_TIMEOUT == 2).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_PHOTOOUTPUTERRORCODE_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_VIDEOOUTPUTERRORCODE_0100
* @tc.name : Camera VideoOutputErrorCode Eunm
* @tc.desc : Camera VideoOutputErrorCode Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_VIDEOOUTPUTERRORCODE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_VIDEOOUTPUTERRORCODE_0100--------------");
expect(camera.VideoOutputErrorCode.ERROR_UNKNOWN == -1).assertTrue();
expect(camera.VideoOutputErrorCode.ERROR_DRIVER_ERROR == 0).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_VIDEOOUTPUTERRORCODE_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_METADATAOBJECTTYPE_0100
* @tc.name : Camera MetadataObjectType Eunm
* @tc.desc : Camera MetadataObjectType Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_METADATAOBJECTTYPE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_METADATAOBJECTTYPE_0100--------------");
expect(camera.MetadataObjectType.FACE_DETECTION == 0).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_METADATAOBJECTTYPE_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_METADATAOUTPUTERRORCODE_0100
* @tc.name : Camera MetadataOutputErrorCode Eunm
* @tc.desc : Camera MetadataOutputErrorCode Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_METADATAOUTPUTERRORCODE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_METADATAOUTPUTERRORCODE_0100--------------");
expect(camera.MetadataOutputErrorCode.ERROR_UNKNOWN == -1).assertTrue();
expect(camera.MetadataOutputErrorCode.ERROR_INSUFFICIENT_RESOURCES == 0).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_METADATAOUTPUTERRORCODE_0100 ends here");
done();
})
})
}
\ No newline at end of file
......@@ -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;
}
......@@ -286,6 +325,7 @@ describe('CameraManagerTest', function () {
await getCameraManagerInstance();
await getImageReceiverSurfaceId();
await getVideoReceiveSurface();
await getCameraSupportDevicesArray();
console.info('beforeAll case');
})
......@@ -324,7 +364,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();
......@@ -733,6 +772,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*/
/**
......@@ -763,8 +866,7 @@ 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");
......@@ -802,8 +904,7 @@ describe('CameraManagerTest', function () {
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");
......@@ -836,14 +937,13 @@ describe('CameraManagerTest', function () {
expect().assertFail();
}
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");
......@@ -876,13 +976,12 @@ describe('CameraManagerTest', function () {
expect().assertFail();
}
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,6 +1000,7 @@ 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);
......@@ -914,15 +1014,29 @@ describe('CameraManagerTest', function () {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_CALLBACK_0100 videoProfilesArray == null || undefined")
expect().assertFail();
}
createVideoOutputFlag = false;
for (let j = 0; j < videoProfilesArray.length; j++) {
mCameraManager.createVideoOutput(videoProfilesArray[j], mVideoSurface, async (err, data) => {
if (isEmpty(data)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_CALLBACK_0100 data == null || undefined")
if (!err) {
if (isEmpty(data)) {
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");
......@@ -959,9 +1073,11 @@ describe('CameraManagerTest', function () {
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 +1086,92 @@ 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)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_CALLBACK_0100 cameraOutputCap == null || undefined")
expect().assertFail();
}
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(1000);
}
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)) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_PROMISE_0100 cameraOutputCap == null || undefined")
expect().assertFail();
}
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
......@@ -996,7 +1197,6 @@ describe('CameraManagerTest', function () {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_MANAGER_CREATE_CAPTURE_SESSION_CALLBACK_0100 ends here");
}
await sleep(1000);
done();
})
await sleep(1000);
await cameraSession.release();
......@@ -1052,7 +1252,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')
}
......@@ -409,12 +409,11 @@ export default function cameraSessionTest(surfaceId: any) {
console.info(TAG + "createPreviewOutput: " + mPreviewOutput);
}
if (!isEmpty(cameraOutputCap.photoProfiles)) {
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;
}
......@@ -503,9 +502,11 @@ 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) => {
......@@ -902,6 +903,104 @@ 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);
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);
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
......@@ -1415,6 +1514,22 @@ export default function cameraSessionTest(surfaceId: any) {
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0100 start for camera[" + i + "]");
await startCameraSession(i);
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) {
......@@ -1429,16 +1544,31 @@ export default function cameraSessionTest(surfaceId: any) {
}
await sleep(1);
})
await mCameraSession.start();
await beginCameraSessionConfig();
mCameraSession.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO);
await commitCameraSessionConfig();
await sleep(1000);
await beginCameraSessionConfig();
await sleep(3000);
mCameraSession.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO);
await commitCameraSessionConfig();
await sleep(1000);
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 +1582,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
......@@ -1469,11 +1599,11 @@ export default function cameraSessionTest(surfaceId: any) {
for (let i = 0; i < mCameraNum; i++) {
let nfyFlag = false;
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0101 start for camera[" + i + "]");
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0101 start for camera[" + i + "]");
await startCameraSession(i);
mCameraSession.on('exposureStateChange', async (err, data) => {
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 +1617,13 @@ export default function cameraSessionTest(surfaceId: any) {
await sleep(1);
})
mCameraSession.setExposureMode(cameraObj.ExposureMode.EXPOSURE_MODE_AUTO);
await sleep(3000);
if (nfyFlag == false) {
//expect().assertFail();
//console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0101 FAILED without any nofity!");
}
await beginCameraSessionConfig();
await stopCameraSession();
......@@ -1507,61 +1635,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')
}
......@@ -473,7 +473,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;
}
......
......@@ -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')
}
......@@ -424,7 +424,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;
}
......
......@@ -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')
}
......@@ -469,7 +469,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;
}
......
......@@ -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')
}
......@@ -422,7 +422,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;
}
......
......@@ -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')
}
......@@ -426,7 +426,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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册