提交 311b15a4 编写于 作者: N Nagaprasad Shet 提交者: Veeresh Kadasani

camera-xts-acts changes checkin

Signed-off-by: NNagaprasad Shet <nagaprasad@huawei.com>
Signed-off-by: NVeeresh Kadasani <veeresh.kadasani@huawei.com>
上级 aa2988b9
......@@ -14,22 +14,19 @@
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("camera_standard_ets_hap") {
hap_profile = "./src/main/config.json"
deps = []
deps = [
":camera_ets_assets",
":camera_ets_resources",
]
ets2abc = true
# shared_libraries = [
# "//third_party/giflib:libgif",
# "//third_party/libpng:libpng",
# ]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "CameraStandardETSTest"
# part_name = "prebuilt_hap"
# subsystem_name = "xts"
hap_name = "ActsCameraStandardETSTest"
}
ohos_js_assets("camera_standard_ets_assets") {
source_dir = "./src/main/ets/default"
ohos_js_assets("camera_ets_assets") {
source_dir = "./src/main/ets/MainAbility"
}
ohos_resources("camera_standard_ets_resources") {
ohos_resources("camera_ets_resources") {
sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json"
}
......@@ -3,7 +3,7 @@
"driver": {
"type": "JSUnitTest",
"test-timeout": "1000000",
"package": "com.example.cameramoduletestetsv2",
"package": "com.open.harmony.multimedia.cameratest",
"shell-timeout": "60000"
},
"kits": [
......@@ -20,7 +20,7 @@
},
{
"test-file-name": [
"CameraStandardETSTest.hap"
"ActsCameraStandardETSTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
......
{
"app": {
"bundleName": "com.example.cameramoduletestetsv2",
"vendor": "example",
"bundleName": "com.open.harmony.multimedia.cameratest",
"vendor": "open",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 7,
"releaseType": "Release",
"target": 7
}
},
"deviceConfig": {},
"module": {
"package": "com.example.cameramoduletestetsv2",
"package": "com.open.harmony.multimedia.cameratest",
"name": ".MyApplication",
"mainAbility": "com.example.cameramoduletestetsv2.MainAbility",
"mainAbility": "com.open.harmony.multimedia.cameratest.MainAbility",
"deviceType": [
"phone"
],
......@@ -33,59 +38,63 @@
]
}
],
"orientation": "unspecified",
"visible": true,
"name": "com.example.cameramoduletestetsv2.MainAbility",
"srcPath": "MainAbility",
"name": ".MainAbility",
"srcLanguage": "ets",
"icon": "$media:icon",
"description": "$string:mainability_description",
"description": "$string:description_mainability",
"formsEnabled": false,
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"reqPermissions": [
{
"name" : "ohos.permission.GRANT_SENSITIVE_PERMISSIONS",
"reason" : "use ohos.permission.GRANT_SENSITIVE_PERMISSIONS"
"name": "ohos.permission.GRANT_SENSITIVE_PERMISSIONS",
"reason": "use ohos.permission.GRANT_SENSITIVE_PERMISSIONS"
},
{
"name" : "ohos.permission.REVOKE_SENSITIVE_PERMISSIONS",
"reason" : "use ohos.permission.REVOKE_SENSITIVE_PERMISSIONS"
"name": "ohos.permission.REVOKE_SENSITIVE_PERMISSIONS",
"reason": "use ohos.permission.REVOKE_SENSITIVE_PERMISSIONS"
},
{
"name" : "ohos.permission.CAMERA",
"reason" : "use ohos.permission.CAMERA"
"name": "ohos.permission.CAMERA",
"reason": "use ohos.permission.CAMERA"
},
{
"name" : "ohos.permission.MICROPHONE",
"reason" : "use ohos.permission.MICROPHONE"
"name": "ohos.permission.MICROPHONE",
"reason": "use ohos.permission.MICROPHONE"
},
{
"name" : "ohos.permission.MEDIA_LOCATION",
"reason" : "use ohos.permission.MEDIA_LOCATION"
"name": "ohos.permission.MEDIA_LOCATION",
"reason": "use ohos.permission.MEDIA_LOCATION"
},
{
"name" : "ohos.permission.READ_MEDIA",
"reason" : "use ohos.permission.READ_MEDIA"
"name": "ohos.permission.READ_MEDIA",
"reason": "use ohos.permission.READ_MEDIA"
},
{
"name" : "ohos.permission.WRITE_MEDIA",
"reason" : "use ohos.permission.WRITE_MEDIA"
"name": "ohos.permission.WRITE_MEDIA",
"reason": "use ohos.permission.WRITE_MEDIA"
}
],
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
......
/*
* 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.
*/
export default {
onCreate() {
console.info('Application onCreate')
},
onDestroy() {
console.info('Application onDestroy')
},
}
/*
* 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 {Core, ExpectExtend} from "deccjsunit/index"
import cameraKit from "../test/Camera.test"
import featureAbility from "@ohos.ability.featureAbility"
let TAG = 'CameraModuleTest: '
var mXComponentController: XComponentController = new XComponentController()
var surfaceId: any
@Entry
@Component
struct CameraIndex {
@State isShowSettings: boolean = false
@State previewSize: string = '75%'
aboutToAppear() {
console.info('--------------aboutToAppear--------------')
}
build() {
Flex() {
XComponent({
id: '',
type: 'surface',
libraryname: '',
source: '',
controller: mXComponentController
})
.onLoad(() => {
console.info('CameraModuleTest: OnLoad() is called!')
mXComponentController.setXComponentSurfaceSize({ surfaceWidth: 1920, surfaceHeight: 1080 });
surfaceId = mXComponentController.getXComponentSurfaceId()
console.info('CameraModuleTest: XComponent onLoad surfaceId: ' + surfaceId)
featureAbility.getWant()
.then((Want) => {
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
console.info(TAG + 'Entering expectExtend')
core.addService('expect', expectExtend)
console.info(TAG + 'Entering addService')
core.init()
console.info(TAG + 'Entering core.init()')
console.info(TAG + 'Entering subscribeEvent')
const configService = core.getDefaultService('config')
configService.setConfig(Want.parameters)
console.info(TAG + 'Entering configService')
cameraKit(surfaceId)
core.execute()
console.info(TAG + 'Operation successful. Data: ' + JSON.stringify(Want));
})
.catch((error) => {
console.error(TAG + 'Operation failed. Cause: ' + JSON.stringify(error));
})
})
.width('1920px')
.height('1080px')
}
}
}
\ 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 cameraJSUnitEnum from './CameraJSUnitEnum.test.ets'
import cameraJSUnitCameraFormat from './CameraJSUnitCameraFormat.test.ets'
import cameraJSUnitPhotoAsync from './CameraJSUnitPhotoAsync.test.ets'
import cameraJSUnitPhotoPromise from './CameraJSUnitPhotoPromise.test.ets'
import cameraJSUnitVideoAsync from './CameraJSUnitVideoAsync.test.ets'
import cameraJSUnitVideoPromise from './CameraJSUnitVideoPromise.test.ets'
let TAG = 'CameraModuleTest: '
export default function cameraKit(surfaceId: any) {
console.info(TAG + 'Entering cameraKit')
console.info(TAG + 'surfaceId: ' + surfaceId)
cameraJSUnitEnum(surfaceId)
cameraJSUnitCameraFormat(surfaceId)
cameraJSUnitPhotoAsync(surfaceId)
cameraJSUnitPhotoPromise(surfaceId)
cameraJSUnitVideoAsync(surfaceId)
cameraJSUnitVideoPromise(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 cameraObj from '@ohos.multimedia.camera';
import image from '@ohos.multimedia.image';
import fileio from '@ohos.fileio';
import abilityAccessCtrl from '@ohos.abilityAccessCtrl'
import bundle from '@ohos.bundle'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index';
const TAG = "CameraModuleTest: ";
// Define global variables
var cameraManager;
var surfaceId1;
var camerasArray;
// CAMERA-0 Variables
var camera0Input, camera0InputPosBack, camera0InputPosFront;
var camera0InputPromise, camera0InputPromisePosBack, camera0InputPromisePosFront;
// CAMERA-1 Variables
var camera1Input, camera1InputPosBack, camera1InputPosFront;
var camera1InputPromise, camera1InputPromisePosBack, camera1InputPromisePosFront;
// CAMERA-2 Variables
var camera2Input, camera2InputPosBack, camera2InputPosFront;
var camera2InputPromise, camera2InputPromisePosBack, camera2InputPromisePosFront;
// CAMERA-3 Variables
var camera3Input, camera3InputPosBack, camera3InputPosFront;
var camera3InputPromise, camera3InputPromisePosBack, camera3InputPromisePosFront;
export default function cameraJSUnitEnum(surfaceId: any) {
async function getImageReceiverSurfaceId() {
console.log(TAG + 'Entering create Image receiver')
var 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));
}
async function applyPermission() {
let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100);
let atManager = abilityAccessCtrl.createAtManager();
if (atManager != null) {
let tokenID = appInfo.accessTokenId;
console.info('[permission] case accessTokenID is ' + tokenID);
let permissionName1 = 'ohos.permission.CAMERA';
let permissionName2 = 'ohos.permission.MICROPHONE';
let permissionName3 = 'ohos.permission.MEDIA_LOCATION';
let permissionName4 = 'ohos.permission.READ_MEDIA';
let permissionName5 = 'ohos.permission.WRITE_MEDIA';
await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName5, 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('CameraJSUnitEnum', function () {
console.info(TAG + '----------CameraJSUnitEnum--------------')
beforeAll(async function () {
await applyPermission();
console.info('beforeAll case');
})
beforeEach(function () {
sleep(5000);
console.info('beforeEach case');
})
afterEach(async function () {
console.info('afterEach case');
})
afterAll(function () {
console.info('afterAll case');
})
/**
* @tc.number : GET_CAMERA_MANAGER_TC_001
* @tc.name : Create camera manager instance async api
* @tc.desc : Create camera manager instance async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_CAMERA_MANAGER_TC_001', 0, async function (done) {
console.info("--------------GET_CAMERA_MANAGER_TC_001--------------");
cameraObj.getCameraManager(null, async (err, data) => {
if (!err) {
console.info(TAG + "Entering GET_CAMERA_MANAGER_TC_001 success");
if (data != null || data != undefined) {
console.info(TAG + "Entering GET_CAMERA_MANAGER_TC_001 data is not null || undefined");
cameraManager = data;
expect(true).assertTrue();
console.info(TAG + "Entering GET_CAMERA_MANAGER_TC_001 PASSED");
}
} else {
expect().assertFail();
console.info(TAG + "Entering GET_CAMERA_MANAGER_TC_001 FAILED: " + err.message);
}
console.info(TAG + "Entering GET_CAMERA_MANAGER_TC_001 ends here");
await sleep(1000);
done();
})
await sleep(1000);
done();
})
/**
* @tc.number : GET_CAMERAS_TC_003
* @tc.name : Get camera from cameramanager to get array of camera async api
* @tc.desc : Get camera from cameramanager to get array of camera async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_CAMERAS_TC_003', 0, async function (done) {
console.info("--------------GET_CAMERAS_TC_003--------------");
cameraManager.getCameras(async (err, data) => {
if (!err) {
console.info(TAG + "Entering GET_CAMERAS_TC_003 success");
if (data != null || data != undefined) {
console.info(TAG + "Entering GET_CAMERAS_TC_003 data is not null || undefined");
camerasArray = data;
if (camerasArray != null && camerasArray.length > 0) {
for (var i = 0; i < camerasArray.length; i++) {
// Get the variables from camera object
var cameraId = camerasArray[i].cameraId;
console.info(TAG + "Entering GET_CAMERAS_TC_003 camera" + i + "Id: " + cameraId);
var cameraPosition = camerasArray[i].cameraPosition;
console.info(TAG + "Entering GET_CAMERAS_TC_003 camera" + i + "Position: " + cameraPosition);
var cameraType = camerasArray[i].cameraType;
console.info(TAG + "Entering GET_CAMERAS_TC_003 camera" + i + "Type: " + cameraType);
var connectionType = camerasArray[i].connectionType
console.info(TAG + "Entering GET_CAMERAS_TC_003 connection" + i + "Type: " + connectionType);
}
expect(true).assertTrue();
console.info(TAG + "Entering GET_CAMERAS_TC_003 PASSED");
} else {
expect().assertFail();
console.info(TAG + "Entering GET_CAMERAS_TC_003 FAILED cameraArray is null || undefined");
}
}
} else {
expect().assertFail();
console.info(TAG + "Entering GET_CAMERAS_TC_003 FAILED: " + err.message);
}
console.info(TAG + "Entering GET_CAMERAS_TC_003 ends here");
await sleep(1000);
done();
})
await sleep(1000);
done();
})
/*CAMERA-0 Scripts*/
/**
* @tc.number : CREATE_CAMERA_INPUT_TC_005
* @tc.name : Create camerainput from camera-0 cameraId async api
* @tc.desc : Create camerainput from camera-0 cameraId async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CREATE_CAMERA_INPUT_TC_005', 0, async function (done) {
console.info("--------------CAMERA-0 STARTS HERE--------------");
console.info("--------------CREATE_CAMERA_INPUT_TC_005--------------");
cameraManager.createCameraInput(camerasArray[0].cameraId, async (err, data) => {
if (!err) {
if (data != null && data != undefined) {
console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_005 data is not null || undefined");
camera0Input = data;
expect(true).assertTrue();
console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_005 PASSED with CameraID :" + camerasArray[0].cameraId);
}
} else {
expect().assertFail();
console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_005 FAILED: " + err.message);
}
console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_005 ends here");
camera0Input.release();
await sleep(1000);
done();
})
await sleep(1000);
done();
})
/**
* @tc.number : CAMERA_STATUS
* @tc.name : camera status ENAME
* @tc.desc : camera status ENAME
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CAMERA_STATUS', 0, async function (done) {
console.info(TAG + "--------------CameraStatus ------------");
console.info(TAG + "CameraStatus CAMERA_STATUS_APPEAR : " + cameraObj.CameraStatus.CAMERA_STATUS_APPEAR);
expect(cameraObj.CameraStatus.CAMERA_STATUS_APPEAR).assertEqual(0);
console.info(TAG + "CameraStatus CAMERA_STATUS_DISAPPEAR : " + cameraObj.CameraStatus.CAMERA_STATUS_DISAPPEAR);
expect(cameraObj.CameraStatus.CAMERA_STATUS_DISAPPEAR).assertEqual(1);
console.info(TAG + "CameraStatus CAMERA_STATUS_AVAILABLE : " + cameraObj.CameraStatus.CAMERA_STATUS_AVAILABLE)
expect(cameraObj.CameraStatus.CAMERA_STATUS_AVAILABLE).assertEqual(2);
console.info(TAG + "CameraStatus CAMERA_STATUS_UNAVAILABLE : " + cameraObj.CameraStatus.CAMERA_STATUS_UNAVAILABLE)
expect(cameraObj.CameraStatus.CAMERA_STATUS_UNAVAILABLE).assertEqual(3);
await sleep(1000);
done();
})
/**
* @tc.number : CAMERA_POSITION
* @tc.name : Camera position ENAME
* @tc.desc : Camera position ENAME
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CAMERA_POSITION', 0, async function (done) {
console.info(TAG + "--------------CameraPosition ------------")
console.info(TAG + "CameraPosition CAMERA_POSITION_BACK : " + cameraObj.CameraPosition.CAMERA_POSITION_BACK);
expect(cameraObj.CameraPosition.CAMERA_POSITION_BACK).assertEqual(1);
console.info(TAG + "CameraPosition CAMERA_POSITION_FRONT : " + cameraObj.CameraPosition.CAMERA_POSITION_FRONT);
expect(cameraObj.CameraPosition.CAMERA_POSITION_FRONT).assertEqual(2);
console.info(TAG + "CameraPosition CAMERA_POSITION_UNSPECIFIED : " + cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED);
expect(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED).assertEqual(0);
await sleep(1000);
done();
})
/**
* @tc.number : CAMERA_TYPE
* @tc.name : camera type ENAME
* @tc.desc : camera type ENAME
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CAMERA_TYPE', 0, async function (done) {
console.info(TAG + "--------------CameraType ------------")
console.info(TAG + "CameraType CAMERA_TYPE_UNSPECIFIED : " + cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED);
expect(cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED).assertEqual(0);
console.info(TAG + "CameraType CAMERA_TYPE_WIDE_ANGLE : " + cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE);
expect(cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE).assertEqual(1);
console.info(TAG + 'CameraType CAMERA_TYPE_ULTRA_WIDE : ' + cameraObj.CameraType.CAMERA_TYPE_ULTRA_WIDE);
expect(cameraObj.CameraType.CAMERA_TYPE_ULTRA_WIDE).assertEqual(2);
console.info(TAG + 'CameraType CAMERA_TYPE_TELEPHOTO : ' + cameraObj.CameraType.CAMERA_TYPE_TELEPHOTO);
expect(cameraObj.CameraType.CAMERA_TYPE_TELEPHOTO).assertEqual(3);
console.info(TAG + 'CameraType CAMERA_TYPE_TRUE_DEPTH : ' + cameraObj.CameraType.CAMERA_TYPE_TRUE_DEPTH)
expect(cameraObj.CameraType.CAMERA_TYPE_TRUE_DEPTH).assertEqual(4);
await sleep(1000);
done();
})
/**
* @tc.number : CONNECTION_TYPE
* @tc.name : connection type ENAME
* @tc.desc : connection type ENAME
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CONNECTION_TYPE', 0, async function (done) {
console.info(TAG + "--------------ConnectionType ------------")
console.info(TAG + "ConnectionType CAMERA_CONNECTION_BUILT_IN : " + cameraObj.ConnectionType.CAMERA_CONNECTION_BUILT_IN);
expect(cameraObj.ConnectionType.CAMERA_CONNECTION_BUILT_IN).assertEqual(0);
console.info(TAG + "ConnectionType CAMERA_CONNECTION_USB_PLUGIN : " + cameraObj.ConnectionType.CAMERA_CONNECTION_USB_PLUGIN);
expect(cameraObj.ConnectionType.CAMERA_CONNECTION_USB_PLUGIN).assertEqual(1);
console.info(TAG + "ConnectionType CAMERA_CONNECTION_REMOTE : " + cameraObj.ConnectionType.CAMERA_CONNECTION_REMOTE);
expect(cameraObj.ConnectionType.CAMERA_CONNECTION_REMOTE).assertEqual(2);
await sleep(1000);
done();
})
/**
* @tc.number : CAMERA_FORMAT
* @tc.name : Camera Format ENAME
* @tc.desc : Camera Format ENAME
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CAMERA_FORMAT', 0, async function (done) {
console.info(TAG + "--------------CameraFormat ------------")
console.info(TAG + "CameraFormat CAMERA_FORMAT_YCRCb_420_SP : " + cameraObj.CameraFormat.CAMERA_FORMAT_YCRCb_420_SP);
expect(cameraObj.CameraFormat.CAMERA_FORMAT_YCRCb_420_SP).assertEqual(1003);
console.info(TAG + "CameraFormat CAMERA_FORMAT_JPEG : " + cameraObj.CameraFormat.CAMERA_FORMAT_JPEG);
expect(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG).assertEqual(2000);
await sleep(1000);
done();
})
/**
* @tc.number : FLASHMODE
* @tc.name : Flash Mode ENAME
* @tc.desc : Flash Mode ENAME
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('FLASHMODE', 0, async function (done) {
console.info(TAG + "--------------FlashMode ------------")
console.info(TAG + "FlashMode FLASH_MODE_CLOSE : " + cameraObj.FlashMode.FLASH_MODE_CLOSE);
expect(cameraObj.FlashMode.FLASH_MODE_CLOSE).assertEqual(0);
console.info(TAG + "FlashMode FLASH_MODE_OPEN : " + cameraObj.FlashMode.FLASH_MODE_OPEN);
expect(cameraObj.FlashMode.FLASH_MODE_OPEN).assertEqual(1);
console.info(TAG + "FlashMode FLASH_MODE_AUTO : " + cameraObj.FlashMode.FLASH_MODE_AUTO);
expect(cameraObj.FlashMode.FLASH_MODE_AUTO).assertEqual(2);
console.info(TAG + "FlashMode FLASH_MODE_ALWAYS_OPEN : " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN);
expect(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN).assertEqual(3);
await sleep(1000);
done();
})
/**
* @tc.number : FOCUSMODE
* @tc.name : Focus Mode ENAME
* @tc.desc : Focus Mode ENAME
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('FOCUSMODE', 0, async function (done) {
console.info(TAG + "--------------FocusMode ------------")
console.info(TAG + "FocusMode FOCUS_MODE_MANUAL : " + cameraObj.FocusMode.FOCUS_MODE_MANUAL);
expect(cameraObj.FocusMode.FOCUS_MODE_MANUAL).assertEqual(0);
console.info(TAG + "FocusMode FOCUS_MODE_CONTINUOUS_AUTO : " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO);
expect(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO).assertEqual(1);
console.info(TAG + "FocusMode FOCUS_MODE_AUTO : " + cameraObj.FocusMode.FOCUS_MODE_AUTO);
expect(cameraObj.FocusMode.FOCUS_MODE_AUTO).assertEqual(2);
console.info(TAG + "FocusMode FOCUS_MODE_LOCKED : " + cameraObj.FocusMode.FOCUS_MODE_LOCKED);
expect(cameraObj.FocusMode.FOCUS_MODE_LOCKED).assertEqual(3);
await sleep(1000);
done();
})
/**
* @tc.number : FOCUSSTATE
* @tc.name : Focus State ENAME
* @tc.desc : Focus State ENAME
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('FOCUSSTATE', 0, async function (done) {
console.info(TAG + "--------------FocusState ------------")
console.info(TAG + "FocusState FOCUS_STATE_SCAN : " + cameraObj.FocusState.FOCUS_STATE_SCAN);
expect(cameraObj.FocusState.FOCUS_STATE_SCAN).assertEqual(0);
console.info(TAG + "FocusState FOCUS_STATE_FOCUSED : " + cameraObj.FocusState.FOCUS_STATE_FOCUSED);
expect(cameraObj.FocusState.FOCUS_STATE_FOCUSED).assertEqual(1);
console.info(TAG + "FocusState FOCUS_STATE_UNFOCUSED : " + cameraObj.FocusState.FOCUS_STATE_UNFOCUSED);
expect(cameraObj.FocusState.FOCUS_STATE_UNFOCUSED).assertEqual(2);
await sleep(1000);
done();
})
/**
* @tc.number : ImageRotation
* @tc.name : Image Rotation ENAME
* @tc.desc : Image Rotation ENAME
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('ImageRotation', 0, async function (done) {
console.info(TAG + "--------------ImageRotation ------------")
console.info(TAG + "ImageRotation ROTATION_0 : " + cameraObj.ImageRotation.ROTATION_0);
expect(cameraObj.ImageRotation.ROTATION_0).assertEqual(0);
console.info(TAG + "ImageRotation ROTATION_90 : " + cameraObj.ImageRotation.ROTATION_90);
expect(cameraObj.ImageRotation.ROTATION_90).assertEqual(90);
console.info(TAG + "ImageRotation ROTATION_180 : " + cameraObj.ImageRotation.ROTATION_180);
expect(cameraObj.ImageRotation.ROTATION_180).assertEqual(180);
console.info(TAG + "ImageRotation ROTATION_270 : " + cameraObj.ImageRotation.ROTATION_270);
expect(cameraObj.ImageRotation.ROTATION_270).assertEqual(270);
await sleep(1000);
done();
})
/**
* @tc.number : QualityLevel
* @tc.name : Quality Level ENAME
* @tc.desc : Quality Level ENAME
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('QualityLevel', 0, async function (done) {
console.info(TAG + "--------------QualityLevel ------------")
console.info(TAG + "QualityLevel QUALITY_LEVEL_HIGH : " + cameraObj.QualityLevel.QUALITY_LEVEL_HIGH);
expect(cameraObj.QualityLevel.QUALITY_LEVEL_HIGH).assertEqual(0);
console.info(TAG + "QualityLevel QUALITY_LEVEL_MEDIUM : " + cameraObj.QualityLevel.QUALITY_LEVEL_MEDIUM);
expect(cameraObj.QualityLevel.QUALITY_LEVEL_MEDIUM).assertEqual(1);
console.info(TAG + "QualityLevel QUALITY_LEVEL_LOW : " + cameraObj.QualityLevel.QUALITY_LEVEL_LOW);
expect(cameraObj.QualityLevel.QUALITY_LEVEL_LOW).assertEqual(2);
await sleep(1000);
done();
})
})
}
\ 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 cameraObj from '@ohos.multimedia.camera';
import image from '@ohos.multimedia.image';
import fileio from '@ohos.fileio';
import abilityAccessCtrl from '@ohos.abilityAccessCtrl'
import bundle from '@ohos.bundle'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index';
const TAG = "CameraModuleTest: ";
// Define global variables
var camera0Input;
var cameraManager;
var previewOutputAsync;
var photoOutputAsync;
var captureSession;
var surfaceId1;
var camerasArray;
var photosettings1 = {
rotation: 0,
quality: 0,
}
var photosettings2 = {
rotation: 90,
quality: 1,
}
var photosettings3 = {
rotation: 180,
quality: 2,
}
var photosettings4 = {
rotation: 270
}
export default function cameraJSUnitPhotoAsync(surfaceId: any) {
async function getImageReceiverSurfaceId() {
console.log(TAG + 'Entering create Image receiver')
var 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));
}
async function applyPermission() {
let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100);
let atManager = abilityAccessCtrl.createAtManager();
if (atManager != null) {
let tokenID = appInfo.accessTokenId;
console.info('[permission] case accessTokenID is ' + tokenID);
let permissionName1 = 'ohos.permission.CAMERA';
let permissionName2 = 'ohos.permission.MICROPHONE';
let permissionName3 = 'ohos.permission.MEDIA_LOCATION';
let permissionName4 = 'ohos.permission.READ_MEDIA';
let permissionName5 = 'ohos.permission.WRITE_MEDIA';
await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName5, 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('CameraJsUnitPhotoAsync', function () {
console.info(TAG + '----------CameraJsUnitPhotoAsync--------------')
beforeAll(async function () {
await applyPermission();
console.info('beforeAll case');
})
beforeEach(function () {
sleep(5000);
console.info('beforeEach case');
})
afterEach(async function () {
console.info('afterEach case');
})
afterAll(function () {
console.info('afterAll case');
})
console.info(TAG + "----------Camera-PhotoMode-Async-------------");
/**
* @tc.number : GET_CAMERA_MANAGER
* @tc.name : Create camera manager instance async api
* @tc.desc : Create camera manager instance async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_CAMERA_MANAGER', 0, async function (done) {
console.info("--------------GET_CAMERA_MANAGER--------------");
cameraObj.getCameraManager(null, async (err, data) => {
if (!err) {
console.info(TAG + "Entering GET_CAMERA_MANAGER success");
if (data != null || data != undefined) {
console.info(TAG + "Entering GET_CAMERA_MANAGER data is not null || undefined");
cameraManager = data;
expect(true).assertTrue();
console.info(TAG + "Entering GET_CAMERA_MANAGER PASSED");
}
} else {
expect().assertFail();
console.info(TAG + "Entering GET_CAMERA_MANAGER FAILED: " + err.message);
}
console.info(TAG + "Entering GET_CAMERA_MANAGER ends here");
await sleep(1000);
done();
})
await sleep(1000);
done();
})
/**
* @tc.number : CAMERA_STATUS_CALLBACK
* @tc.name : camera status callback on CameraManager async api
* @tc.desc : camera status callback on CameraManager async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CAMERA_STATUS_CALLBACK', 0, async function (done) {
if (cameraManager == null || cameraManager == undefined) {
console.info(TAG + "Entering CAMERA_STATUS_CALLBACK cameraManager == null || undefined")
} else {
console.info(TAG + "Entering CAMERA_STATUS_CALLBACK to operate")
cameraManager.on("cameraStatus", async (err, data) => {
if (!err) {
console.info(TAG + "Camera status Callback on cameraManager is success");
if (data != null || data != undefined) {
console.info(TAG + "Camera status Callback CameraStatusInfo_Camera: " + data.camera);
console.info(TAG + "Camera status Callback CameraStatusInfo_Status: " + data.status);
expect(true).assertTrue();
}
} else {
expect().assertFail();
}
await sleep(1000);
done();
})
}
await sleep(1000);
done();
})
/**
* @tc.number : GET_CAMERAS
* @tc.name : Get camera from cameramanager to get array of camera async api
* @tc.desc : Get camera from cameramanager to get array of camera async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_CAMERAS', 0, async function (done) {
console.info("--------------GET_CAMERAS--------------");
cameraManager.getCameras(async (err, data) => {
if (!err) {
console.info(TAG + "Entering GET_CAMERAS success");
if (data != null || data != undefined) {
console.info(TAG + "Entering GET_CAMERAS data is not null || undefined");
camerasArray = data;
if (camerasArray != null && camerasArray.length > 0) {
for (var i = 0; i < camerasArray.length; i++) {
// Get the variables from camera object
var cameraId = camerasArray[i].cameraId;
console.info(TAG + "Entering GET_CAMERAS camera" + i + "Id: " + cameraId);
var cameraPosition = camerasArray[i].cameraPosition;
console.info(TAG + "Entering GET_CAMERAS camera" + i + "Position: " + cameraPosition);
var cameraType = camerasArray[i].cameraType;
console.info(TAG + "Entering GET_CAMERAS camera" + i + "Type: " + cameraType);
var connectionType = camerasArray[i].connectionType
console.info(TAG + "Entering GET_CAMERAS connection" + i + "Type: " + connectionType);
}
expect(true).assertTrue();
console.info(TAG + "Entering GET_CAMERAS PASSED");
} else {
expect().assertFail();
console.info(TAG + "Entering GET_CAMERAS FAILED cameraArray is null || undefined");
}
}
} else {
expect().assertFail();
console.info(TAG + "Entering GET_CAMERAS FAILED: " + err.message);
}
console.info(TAG + "Entering GET_CAMERAS ends here");
await sleep(1000);
done();
})
await sleep(1000);
done();
})
/*CAMERA-0 Scripts*/
/**
* @tc.number : CREATE_CAMERA_INPUT
* @tc.name : Create camerainput from camera-0 cameraId async api
* @tc.desc : Create camerainput from camera-0 cameraId async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CREATE_CAMERA_INPUT', 0, async function (done) {
cameraManager.createCameraInput(camerasArray[0].cameraId, async (err, data) => {
if (!err) {
if (data != null && data != undefined) {
console.info(TAG + "Entering CREATE_CAMERA_INPUT data is not null || undefined");
camera0Input = data;
expect(true).assertTrue();
console.info(TAG + "Entering CREATE_CAMERA_INPUT PASSED with CameraID :" + camerasArray[0].cameraId);
}
} else {
expect().assertFail();
console.info(TAG + "Entering CREATE_CAMERA_INPUT FAILED: " + err.message);
}
console.info(TAG + "Entering CREATE_CAMERA_INPUT ends here");
await sleep(1000);
done();
})
await sleep(1000);
done();
})
/**
* @tc.number : CAMERA_INPUT_CALLBACK_ON_ERROR
* @tc.name : Photo output callback on error api
* @tc.desc : Photo output callback on error api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CAMERA_INPUT_CALLBACK_ON_ERROR', 0, async function (done) {
if (camera0Input == null || camera0Input == undefined) {
console.info(TAG + "Entering CAMERA_INPUT_CALLBACK_ON_ERROR cameraInput == null || undefined");
} else {
console.info(TAG + "Entering CAMERA_INPUT_CALLBACK_ON_ERROR to operate");
camera0Input.on("error", async (err, data) => {
if (!err) {
console.info(TAG + "cameraInput error callback is success");
if (data != null || data != undefined) {
console.info(TAG + "Error during cameraInput with ErrorCode: " + data.code);
expect(true).assertTrue();
}
} else {
expect().assertFail();
}
await sleep(1000);
done();
})
}
await sleep(1000);
done();
})
/*PreviewOutput APIs test script*/
/**
* @tc.number : CREATE_PREVIEW_OUTPUT_SUCCESS
* @tc.name : Create PreviewOutput instance api
* @tc.desc : Create PreviewOutput instance api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CREATE_PREVIEW_OUTPUT_SUCCESS', 0, async function (done) {
console.info(TAG + " Entering CREATE_PREVIEW_OUTPUT_SUCCESS to operate");
cameraObj.createPreviewOutput(surfaceId, async (err, data) => {
if (!err) {
console.info(TAG + " Entering createPreviewOutput success");
if (data != null || data != undefined) {
console.info(TAG + " Entering createPreviewOutput data is not null || undefined");
previewOutputAsync = data;
expect(true).assertTrue();
console.info(TAG + "Entering CREATE_PREVIEW_OUTPUT_SUCCESS PASSED" + previewOutputAsync);
}
} else {
expect().assertFail();
console.info(TAG + "Entering CREATE_PREVIEW_OUTPUT_SUCCESS FAILED" + err.message);
}
console.info(TAG + "Entering CREATE_PREVIEW_OUTPUT_SUCCESS ends here");
await sleep(1000);
done();
})
await sleep(1000);
done();
})
/**
* @tc.number : PREVIEW_OUTPUT_CALLBACK_ON_ERROR
* @tc.name : Preview output callback on error api
* @tc.desc : Preview output callback on error api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('PREVIEW_OUTPUT_CALLBACK_ON_ERROR', 0, async function (done) {
if (previewOutputAsync == null || previewOutputAsync == undefined) {
console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_ERROR previewOutput == null || undefined");
} else {
console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_ERROR to operate");
previewOutputAsync.on("error", async (err, data) => {
if (!err) {
console.info(TAG + "PreviewOutputError callback is success");
if (data != null || data != undefined) {
console.info(TAG + "Error during PreviewOutput with ErrorCode: " + data.code);
expect(true).assertTrue();
}
} else {
expect().assertFail();
}
await sleep(1000);
done();
})
await sleep(1000);
done();
}
})
/*PhotoOutput APIs test script*/
/**
* @tc.number : CREATE_PHOTO_OUTPUT_SUCCESS
* @tc.name : Create PhotoOutput instance api
* @tc.desc : Create PhotoOutput instance api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CREATE_PHOTO_OUTPUT_SUCCESS', 0, async function (done) {
console.info(TAG + "Entering CREATE_PHOTO_OUTPUT_SUCCESS to operate");
console.info(TAG + 'Entering getImageReceiverSurfaceId')
await getImageReceiverSurfaceId()
await sleep(1000)
cameraObj.createPhotoOutput(surfaceId1, async (err, data) => {
if (!err) {
console.info(TAG + "Entering createPhotoOutput success");
if (data != null || data != undefined) {
console.info(TAG + "Entering createPhotoOutput data is not null || undefined");
photoOutputAsync = data;
expect(true).assertTrue();
console.info(TAG + "Entering CREATE_PHOTO_OUTPUT_SUCCESS PASSED");
}
} else {
expect().assertFail();
console.info(TAG + "Entering CREATE_PHOTO_OUTPUT_SUCCESS FAILED");
console.info(TAG + "Entering createPhotoOutput ends here");
}
await sleep(1000);
done();
})
await sleep(1000);
done();
})
/**
* @tc.number : PHOTO_OUTPUT_CALLBACK_ON_ERROR
* @tc.name : Photo output callback on error api
* @tc.desc : Photo output callback on error api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('PHOTO_OUTPUT_CALLBACK_ON_ERROR', 0, async function (done) {
if (photoOutputAsync == null || photoOutputAsync == undefined) {
console.info(TAG + "Entering PHOTO_OUTPUT_CALLBACK_ON_ERROR photoOutput == null || undefined");
} else {
console.info(TAG + "Entering PHOTO_OUTPUT_CALLBACK_ON_ERROR to operate");
photoOutputAsync.on("error", async (err, data) => {
if (!err) {
console.info(TAG + "PhotoOutputError callback is success");
if (data != null || data != undefined) {
console.info(TAG + "Error during PhotoOutput with ErrorCode: " + data.code);
expect(true).assertTrue();
}
} else {
expect().assertFail();
}
await sleep(1000);
done();
})
await sleep(1000);
done();
}
})
/*CaptureSession APIs test script*/
/**
* @tc.number : CREATE_CAPTURE_SESSION_SUCCESS
* @tc.name : Create CaptureSession instance api
* @tc.desc : Create CaptureSession instance api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CREATE_CAPTURE_SESSION_SUCCESS', 0, async function (done) {
console.info(TAG + "Entering CREATE_CAPTURE_SESSION_SUCCESS to operate");
cameraObj.createCaptureSession(null, async (err, data) => {
if (!err) {
console.info(TAG + "Entering createCaptureSession success");
if (data != null || data != undefined) {
console.info(TAG + "Entering createCaptureSession data is not null || undefined");
captureSession = data;
expect(true).assertTrue();
console.info(TAG + "Entering createCaptureSession PASSED");
}
} else {
expect().assertFail();
console.info(TAG + "Entering CREATE_CAPTURE_SESSION_SUCCESS FAILED" + err.message);
console.info(TAG + "Entering createCaptureSession ends here");
}
await sleep(1000);
done();
})
await sleep(1000);
done();
})
//Capturesession callback
/**
* @tc.number : CAP_SES_CALLBACK_ON_ERROR
* @tc.name : CaptureSession callback on error api
* @tc.desc : CaptureSession callback on error api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CAP_SES_CALLBACK_ON_ERROR', 0, async function (done) {
if (captureSession == null || captureSession == undefined) {
console.info(TAG + "Entering CAP_SES_CALLBACK_ON_ERROR captureSession == null || undefined");
} else {
console.info(TAG + "Entering CAP_SES_CALLBACK_ON_ERROR to operate");
captureSession.on("error", async (err, data) => {
if (!err) {
console.info(TAG + " captureSession errorcallback is success");
if (data != null || data != undefined) {
console.info(TAG + "Error in CaptureSessioncallback with ErrorCode: " + data.code);
expect(true).assertTrue();
}
} else {
expect().assertFail();
}
await sleep(1000);
done();
})
await sleep(1000);
done();
}
})
/*CaptureSession APIs*/
/**
* @tc.number : CREATE_BEGIN_CONFIG_SUCCESS
* @tc.name : CaptureSession_Begin config api
* @tc.desc : CaptureSession_Begin config api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CREATE_BEGIN_CONFIG_SUCCESS', 0, async function (done) {
if (captureSession == null || captureSession == undefined) {
console.info(TAG + "Entering CREATE_BEGIN_CONFIG_SUCCESS captureSession == null || undefined");
} else {
console.info(TAG + "Entering CREATE_BEGIN_CONFIG_SUCCESS to operate");
captureSession.beginConfig(async (err, data) => {
if (!err) {
console.info(TAG + "Entering beginConfig success");
if (data != null || data != undefined) {
console.info(TAG + "Entering CREATE_BEGIN_CONFIG beginConfig data is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "Entering CREATE_BEGIN_CONFIG_SUCCESS beginConfig PASSED");
}
} else {
expect().assertFail();
console.info(TAG + "Entering CREATE_BEGIN_CONFIG_SUCCESS FAILED" + err.message);
console.info(TAG + "Entering CREATE_BEGIN_CONFIG_SUCCESS ends here");
}
await sleep(1000);
done();
})
await sleep(1000);
done();
}
})
/**
* @tc.number : ADD_INPUT_SUCCESS
* @tc.name : Add Input with camera0Input api
* @tc.desc : Add Input with camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('ADD_INPUT_SUCCESS', 0, async function (done) {
if (captureSession == null || captureSession == undefined) {
console.info(TAG + "Entering ADD_INPUT_SUCCESS captureSession == null || undefined");
} else {
console.info(TAG + "Entering ADD_INPUT_SUCCESS to operate");
captureSession.addInput(camera0Input, async (err, data) => {
if (!err) {
console.info(TAG + "Entering ADD_INPUT_SUCCESS addInput success");
if (data != null || data != undefined) {
console.info(TAG + "Entering ADD_INPUT_SUCCESS addInput data is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "Entering ADD_INPUT_SUCCESS addInput PASSED");
}
} else {
expect().assertFail();
console.info(TAG + "Entering ADD_INPUT_SUCCESS FAILED: " + err.message);
console.info(TAG + "Entering ADD_INPUT_SUCCESS ends here");
}
await sleep(1000);
done();
})
await sleep(1000);
done();
}
})
/**
* @tc.number : ADD_OUTPUT_PREVIEW_SUCCESS
* @tc.name : Add output with camera0Input api
* @tc.desc : Add output with camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('ADD_OUTPUT_PREVIEW_SUCCESS', 0, async function (done) {
if (captureSession == null || captureSession == undefined) {
console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS captureSession == null || undefined");
} else {
console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS to operate");
captureSession.addOutput(previewOutputAsync, async (err, data) => {
if (!err) {
console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS : Success");
if (data != null || data != undefined) {
console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS data is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS PASSED");
}
} else {
expect().assertFail();
console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS FAILED" + err.message);
console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS ends here");
}
await sleep(1000);
done();
})
}
})
/**
* @tc.number : ADD_OUTPUT_PHOTO_SUCCESS
* @tc.name : Add output with photo output api
* @tc.desc : Add output with photo output api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('ADD_OUTPUT_PHOTO_SUCCESS', 0, async function (done) {
if (captureSession == null || captureSession == undefined) {
console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS captureSession == null || undefined");
} else {
console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS to operate");
captureSession.addOutput(photoOutputAsync, async (err, data) => {
if (!err) {
console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS success");
if (data != null || data != undefined) {
console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS data is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS PASSED");
}
} else {
expect().assertFail();
console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS FAILED: " + err.message);
}
console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS ends here");
await sleep(1000);
done();
})
await sleep(1000);
done();
}
})
/**
* @tc.number : REMOVE_INPUT_SUCCESS
* @tc.name : remove input api
* @tc.desc : remove input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('REMOVE_INPUT_SUCCESS', 0, async function (done) {
if (captureSession == null || captureSession == undefined) {
console.info(TAG + "Entering REMOVE_INPUT_SUCCESS captureSession == null || undefined");
} else {
console.info(TAG + "Entering REMOVE_INPUT_SUCCESS to operate");
captureSession.removeInput(camera0Input, async (err, data) => {
if (!err) {
console.info(TAG + "Entering remove input success");
expect(true).assertTrue();
console.info(TAG + "Entering REMOVE_INPUT_SUCCESS PASSED");
}
else {
expect().assertFail();
console.info(TAG + "Entering Remove Input FAILED" + err.message);
console.info(TAG + "Entering Remove Input ends here");
}
await sleep(1000);
done();
})
await sleep(1000);
}
done();
})
/**
* @tc.number : REMOVE_PREVIEW_OUTPUT_SUCCESS
* @tc.name : Remove preview Output api
* @tc.desc : Remove preview Output api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('REMOVE_PREVIEW_OUTPUT_SUCCESS', 0, async function (done) {
if (captureSession == null || captureSession == undefined) {
console.info(TAG + "Entering REMOVE_PREVIEW_OUTPUT_SUCCESS captureSession == null || undefined");
} else {
console.info(TAG + "Entering REMOVE_PREVIEW_OUTPUT_SUCCESS to operate");
captureSession.removeOutput(previewOutputAsync, async (err, data) => {
if (!err) {
console.info(TAG + "Entering remove preview Output success");
expect(true).assertTrue();
console.info(TAG + "Entering REMOVE_PREVIEW_OUTPUT_SUCCESS PASSED");
}
else {
expect().assertFail();
console.info(TAG + "Entering Remove preview Output FAILED" + err.message);
console.info(TAG + "Entering Remove Preview Output ends here");
}
await sleep(1000);
done();
})
await sleep(1000);
}
done();
})
/**
* @tc.number : REMOVE_PHOTO_OUTPUT_SUCCESS
* @tc.name : Remove photo Output api
* @tc.desc : Remove photo Output api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('REMOVE_PHOTO_OUTPUT_SUCCESS', 0, async function (done) {
if (captureSession == null || captureSession == undefined) {
console.info(TAG + "Entering REMOVE_PHOTO_OUTPUT_SUCCESS captureSession == null || undefined");
} else {
console.info(TAG + "Entering REMOVE_PHOTO_OUTPUT_SUCCESS to operate");
captureSession.removeOutput(photoOutputAsync, async (err, data) => {
if (!err) {
console.info(TAG + "Entering remove photo Output success");
expect(true).assertTrue();
console.info(TAG + "Entering REMOVE_PHOTO_OUTPUT_SUCCESS PASSED");
}
else {
expect().assertFail();
console.info(TAG + "Entering Remove photo Output FAILED" + err.message);
console.info(TAG + "Entering Remove photo Output ends here");
}
await sleep(1000);
done();
})
await sleep(1000);
}
done();
})
/**
* @tc.number : ADD_INPUT_SUCCESS
* @tc.name : Add Input with camera0Input api
* @tc.desc : Add Input with camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('ADD_INPUT_SUCCESS', 0, async function (done) {
if (captureSession == null || captureSession == undefined) {
console.info(TAG + "Entering ADD_INPUT_SUCCESS captureSession == null || undefined");
} else {
console.info(TAG + "Entering ADD_INPUT_SUCCESS to operate");
captureSession.addInput(camera0Input, async (err, data) => {
if (!err) {
console.info(TAG + "Entering ADD_INPUT_SUCCESS addInput success");
if (data != null || data != undefined) {
console.info(TAG + "Entering ADD_INPUT_SUCCESS addInput data is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "Entering ADD_INPUT_SUCCESS addInput PASSED");
}
} else {
expect().assertFail();
console.info(TAG + "Entering ADD_INPUT_SUCCESS FAILED: " + err.message);
console.info(TAG + "Entering ADD_INPUT_SUCCESS ends here");
}
await sleep(1000);
done();
})
await sleep(1000);
done();
}
})
/**
* @tc.number : ADD_OUTPUT_PREVIEW_SUCCESS
* @tc.name : Add output with camera0Input api
* @tc.desc : Add output with camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('ADD_OUTPUT_PREVIEW_SUCCESS', 0, async function (done) {
if (captureSession == null || captureSession == undefined) {
console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS captureSession == null || undefined");
} else {
console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS to operate");
captureSession.addOutput(previewOutputAsync, async (err, data) => {
if (!err) {
console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS : Success");
if (data != null || data != undefined) {
console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS data is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS PASSED");
}
} else {
expect().assertFail();
console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS FAILED" + err.message);
console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS ends here");
}
await sleep(1000);
done();
})
}
})
/**
* @tc.number : ADD_OUTPUT_PHOTO_SUCCESS
* @tc.name : Add output with photo output api
* @tc.desc : Add output with photo output api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('ADD_OUTPUT_PHOTO_SUCCESS', 0, async function (done) {
if (captureSession == null || captureSession == undefined) {
console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS captureSession == null || undefined");
} else {
console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS to operate");
captureSession.addOutput(photoOutputAsync, async (err, data) => {
if (!err) {
console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS success");
if (data != null || data != undefined) {
console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS data is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS PASSED");
}
} else {
expect().assertFail();
console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS FAILED: " + err.message);
}
console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS ends here");
await sleep(1000);
done();
})
await sleep(1000);
done();
}
})
/**
* @tc.number : COMMIT_CONFIG_SUCCESS
* @tc.name : commit config api
* @tc.desc : commit config api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('COMMIT_CONFIG_SUCCESS', 0, async function (done) {
if (captureSession == null || captureSession == undefined) {
console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS captureSession == null || undefined");
} else {
console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS to operate");
captureSession.commitConfig(async (err, data) => {
if (!err) {
console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS commitConfig success");
if (data != null || data != undefined) {
console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS data is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS commitConfig PASSED");
}
} else {
expect().assertFail();
console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS commitConfig FAILED" + err.message);
console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS commitConfig ends here");
}
await sleep(1000);
done();
})
await sleep(1000);
done();
}
})
//preview callback
/**
* @tc.number : PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START
* @tc.name : Preview output callback on frame start api
* @tc.desc : Preview output callback on frame start api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START', 0, async function (done) {
if (previewOutputAsync == null || previewOutputAsync == undefined) {
console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START previewOutput == null || undefined");
} else {
console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START to operate");
previewOutputAsync.on("frameStart", async (err, data) => {
if (!err) {
console.info(TAG + "PreviewStart frameStart Callback is success");
if (data != null || data != undefined) {
expect(true).assertTrue();
}
} else {
expect().assertFail()
}
await sleep(1000);
done();
})
await sleep(1000);
done();
}
})
/**
* @tc.number : PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END
* @tc.name : Preview capture callback on frame end api
* @tc.desc : Preview capture callback on frame end api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END', 0, async function (done) {
if (previewOutputAsync == null || previewOutputAsync == undefined) {
console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END previewOutput == null || undefined");
} else {
console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END to operate");
previewOutputAsync.on("frameEnd", async (err, data) => {
if (!err) {
console.info(TAG + "PreviewStop frameEnd Callback is success");
if (data != null || data != undefined) {
expect(true).assertTrue();
}
} else {
expect().assertFail();
}
await sleep(1000);
done();
})
await sleep(1000);
done();
}
})
//Capture callback
/**
* @tc.number : PHOTO_CAP_CALLBACK_ON_CAPTURE_START
* @tc.name : Photo capture callback on capture start api
* @tc.desc : Photo capture callback on capture start api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('PHOTO_CAP_CALLBACK_ON_CAPTURE_START', 0, async function (done) {
if (photoOutputAsync == null || photoOutputAsync == undefined) {
console.info(TAG + "Entering PHOTO_CAP_CALLBACK_ON_CAPTURE_START photoOutput == null || undefined");
} else {
console.info(TAG + "Entering PHOTO_CAP_CALLBACK_ON_CAPTURE_START to operate");
photoOutputAsync.on("captureStart", async (err, data) => {
if (!err) {
console.info(TAG + "CaptureStart Callback is success");
if (data != null || data != undefined) {
console.info(TAG + "captureStart success with captureId: " + data);
expect(true).assertTrue();
}
} else {
expect().assertFail()
}
await sleep(1000);
done();
})
await sleep(1000);
done();
}
})
/**
* @tc.number : PHOTO_CAP_CALLBACK_ON_CAPTURE_END
* @tc.name : Photo capture callback on capture end api
* @tc.desc : Photo capture callback on capture end api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('PHOTO_CAP_CALLBACK_ON_CAPTURE_END', 0, async function (done) {
if (photoOutputAsync == null || photoOutputAsync == undefined) {
console.info(TAG + "Entering PHOTO_CAP_CALLBACK_ON_CAPTURE_END photoOutput == null || undefined");
} else {
console.info(TAG + "Entering PHOTO_CAP_CALLBACK_ON_CAPTURE_END to operate");
photoOutputAsync.on("captureEnd", async (err, data) => {
if (!err) {
console.info(TAG + "captureEnd callback is success");
if (data != null || data != undefined) {
console.info(TAG + "captureEnd callback with captureId: " + data.captureId);
console.info(TAG + "captureEnd callback with frameCount: " + data.frameCount);
expect(true).assertTrue();
}
} else {
expect().assertFail();
}
await sleep(1000);
done();
})
await sleep(1000);
done();
}
})
/**
* @tc.number : PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER
* @tc.name : Photo capture callback on frame shutter api
* @tc.desc : Photo capture callback on frame shutter api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER', 0, async function (done) {
if (photoOutputAsync == null || photoOutputAsync == undefined) {
console.info(TAG + "Entering PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER photoOutput == null || undefined");
} else {
console.info(TAG + "Entering PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER to operate");
photoOutputAsync.on("frameShutter", async (err, data) => {
if (!err) {
console.info(TAG + "frameShutter callback is success");
if (data != null || data != undefined) {
console.info(TAG + "frameShutter callback with captureId: " + data.captureId);
console.info(TAG + "frameShutter callback with timestamp: " + data.timestamp);
expect(true).assertTrue();
}
} else {
expect().assertFail();
}
await sleep(1000);
done();
})
await sleep(1000);
done();
}
})
/**
* @tc.number : CAPTURE_SESSION_START_SUCCESS
* @tc.name : capture session start api
* @tc.desc : capture session start api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CAPTURE_SESSION_START_SUCCESS', 0, async function (done) {
if (captureSession == null || captureSession == undefined) {
console.info(TAG + "Entering CAPTURE_SESSION_START_SUCCESS captureSession == null || undefined");
} else {
console.info(TAG + "Entering CAPTURE_SESSION_START_SUCCESS to operate");
captureSession.start(async (err, data) => {
console.info(TAG + "Entering captureSession.start success");
if (data != null || data != undefined) {
console.info(TAG + "Entering CAPTURE_SESSION_START_SUCCESS data is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "Entering CAPTURE_SESSION_START_SUCCESS PASSED");
}
console.info(TAG + "Entering CAPTURE_SESSION_START_SUCCESS ends here");
await sleep(1000);
done();
})
await sleep(1000);
done();
}
})
//FLASH Function API scripts
/**
* @tc.number : HAS_FLASH
* @tc.name : check if has flash-camera0Input api
* @tc.desc : check if has flash-camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('HAS_FLASH', 0, async function (done) {
console.info(TAG + "hasFlash called.")
camera0Input.hasFlash(async (err, data) => {
if (!err) {
console.info(TAG + "Entering HAS_FLASH success");
if (data != null || data != undefined) {
console.info(TAG + "Entering HAS_FLASH data is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "Entering HAS_FLASH PASSED with HAS_FLASH is: " + data);
}
} else {
expect().assertFail();
console.info(TAG + "Entering HAS_FLASH FAILED" + err.message);
}
console.info(TAG + "Entering HAS_FLASH ends here");
})
await sleep(1000);
done();
})
/**
* @tc.number : IS_FLASH_MODE_OPEN_SUPPORTED
* @tc.name : check if flash mode open is supported-camera0Input api
* @tc.desc : check if flash mode open is supported-camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('IS_FLASH_MODE_OPEN_SUPPORTED', 0, async function (done) {
console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED to operate");
camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_OPEN, async (err, data) => {
if (!err) {
console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED SUCCESS ");
if (data != null || data != undefined) {
console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED data is not null || undefined");
console.info(TAG + "FLASH_MODE_OPEN supported is: " + data);
expect(true).assertTrue();
console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED PASSED");
}
} else {
console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED FAILED" + err.message);
console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED ends here");
}
await sleep(1000);
done();
})
await sleep(1000);
done();
})
/**
* @tc.number : SET_FLASH_MODE_OPEN
* @tc.name : set flash mode open camera0 api
* @tc.desc : set flash mode open camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_FLASH_MODE_OPEN', 0, async function (done) {
console.info(TAG + "Entering SET_FLASH_MODE_OPEN to operate");
camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_OPEN, async (err, data) => {
if (!err) {
console.info(TAG + "Entering SET_FLASH_MODE_OPEN SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_OPEN);
console.info(TAG + "Entering SET_FLASH_MODE_OPEN PASSED")
expect(true).assertTrue()
}
else {
expect().assertFail();
console.info(TAG + "Entering SET_FLASH_MODE_OPEN FAILED" + err.message);
console.info(TAG + "Entering SET_FLASH_MODE_OPEN ends here");
}
await sleep(1000);
done();
})
await sleep(1000);
done();
})
/**
* @tc.number : GET_FLASH_MODE_OPEN
* @tc.name : get flash mode open camera0 api
* @tc.desc : get flash mode open camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_FLASH_MODE_OPEN', 0, async function (done) {
console.info(TAG + "Entering GET_FLASH_MODE_OPEN to operate");
camera0Input.getFlashMode(async (err, data) => {
if (!err) {
console.info(TAG + "Entering GET_FLASH_MODE_OPEN success");
if (data == 1) {
console.info(TAG + "GET_FLASH_MODE_OPEN data is not null || undefined: ");
console.info(TAG + "Current FlashMode is: " + data);
expect(true).assertTrue();
console.info(TAG + "GET_FLASH_MODE_OPEN PASSED");
}
}
else {
expect().assertFail();
console.info(TAG + "GET_FLASH_MODE_OPEN FAILED" + err.message);
console.info(TAG + "GET_FLASH_MODE_OPEN ends here");
}
await sleep(1000);
done();
})
await sleep(1000);
done();
})
/**
* @tc.number : IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED
* @tc.name : check if flash mode always open is supported-camera0Input api
* @tc.desc : check if flash mode always open is supported-camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED', 0, async function (done) {
console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED to operate");
camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN, async (err, data) => {
if (!err) {
console.info(TAG + "Entering FLASH_MODE_ALWAYS_OPEN SUCCESS ");
if (data != null || data != undefined) {
console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED data is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "FLASH_MODE_ALWAYS_OPEN supported is: " + data);
console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED PASSED");
}
} else {
console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED FAILED" + err.message);
console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED ends here");
}
await sleep(1000);
done();
})
await sleep(1000);
done();
})
/**
* @tc.number : SET_FLASH_MODE_ALWAYS_OPEN
* @tc.name : set flash mode always open camera0 api
* @tc.desc : set flash mode always open camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_FLASH_MODE_ALWAYS_OPEN', 0, async function (done) {
console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN to operate");
camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN, async (err, data) => {
if (!err) {
console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN);
console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN PASSED")
expect(true).assertTrue()
}
else {
expect().assertFail();
console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN FAILED" + err.message);
console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN ends here");
}
await sleep(1000);
done();
})
await sleep(1000);
done();
})
/**
* @tc.number : GET_FLASH_MODE_ALWAYS_OPEN
* @tc.name : get flash mode always open camera0 api
* @tc.desc : get flash mode always open camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_FLASH_MODE_ALWAYS_OPEN', 0, async function (done) {
console.info(TAG + "Entering GET_FLASH_MODE_ALWAYS_OPEN to operate");
camera0Input.getFlashMode(async (err, data) => {
if (!err) {
console.info(TAG + "Entering GET_FLASH_MODE_ALWAYS_OPEN success");
if (data == 3) {
console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN data is not null || undefined: ");
expect(true).assertTrue();
console.info(TAG + "Current FlashMode is: " + data);
console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN PASSED");
}
}
else {
expect().assertFail();
console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN FAILED" + err.message);
console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN ends here");
}
await sleep(1000);
done();
})
await sleep(1000);
done();
})
/**
* @tc.number : PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS
* @tc.name : Photo output capture without photosettings api
* @tc.desc : Photo output capture without photosettings api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS', 0, async function (done) {
if (photoOutputAsync == null || photoOutputAsync == undefined) {
console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS photoOutput == null || undefined");
} else {
console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS to operate");
photoOutputAsync.capture(async (err, data) => {
if (!err) {
console.info(TAG + "Entering photoOutput capture without photosettings success");
if (data != null || data != undefined) {
console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined");
console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS PASSED");
expect(true).assertTrue();
}
} else {
expect().assertFail();
console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS FAILED" + err.message);
console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS ends here");
}
await sleep(1000);
done();
})
await sleep(1000);
done();
}
})
/**
* @tc.number : IS_FLASH_MODE_CLOSE_SUPPORTED
* @tc.name : check if flash mode close is supported-camera0Input api
* @tc.desc : check if flash mode close is supported-camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('IS_FLASH_MODE_CLOSE_SUPPORTED', 0, async function (done) {
console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED to operate");
camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_CLOSE, async (err, data) => {
if (!err) {
console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED SUCCESS ");
if (data != null || data != undefined) {
console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED data is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "FLASH_MODE_CLOSE supported is: " + data);
console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED PASSED");
}
} else {
expect().assertFail();
console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED FAILED" + err.message);
console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED ends here");
}
await sleep(1000);
done();
})
await sleep(1000);
done();
})
/**
* @tc.number : SET_FLASH_MODE_CLOSE
* @tc.name : set flash mode close camera0 api
* @tc.desc : set flash mode close camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_FLASH_MODE_CLOSE', 0, async function (done) {
console.info(TAG + "Entering SET_FLASH_MODE_CLOSE to operate");
camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_CLOSE, async (err, data) => {
if (!err) {
console.info(TAG + "Entering SET_FLASH_MODE_CLOSE SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_CLOSE);
console.info(TAG + "Entering SET_FLASH_MODE_CLOSE PASSED")
expect(true).assertTrue()
}
else {
expect().assertFail();
console.info(TAG + "Entering SET_FLASH_MODE_CLOSE FAILED" + err.message);
console.info(TAG + "Entering SET_FLASH_MODE_CLOSE ends here");
}
await sleep(1000);
done();
})
await sleep(1000);
done();
})
/**
* @tc.number : GET_FLASH_MODE_CLOSE
* @tc.name : get flash mode close camera0 api
* @tc.desc : get flash mode close camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_FLASH_MODE_CLOSE', 0, async function (done) {
console.info(TAG + "Entering GET_FLASH_MODE_CLOSE to operate");
camera0Input.getFlashMode(async (err, data) => {
if (!err) {
console.info(TAG + "Entering GET_FLASH_MODE_CLOSE success");
if (data == 0) {
console.info(TAG + "GET_FLASH_MODE_CLOSE data is not null || undefined: ");
console.info(TAG + "Current FlashMode is: " + data);
expect(true).assertTrue();
console.info(TAG + "GET_FLASH_MODE_CLOSE PASSED");
}
}
else {
expect().assertFail();
console.info(TAG + "GET_FLASH_MODE_CLOSE FAILED" + err.message);
console.info(TAG + "GET_FLASH_MODE_CLOSE ends here");
}
await sleep(1000)
done();
})
await sleep(1000)
done()
})
/**
* @tc.number : IS_FLASH_MODE_AUTO_SUPPORTED
* @tc.name : check if flash mode auto is supported-camera0Input api
* @tc.desc : check if flash mode auto is supported-camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('IS_FLASH_MODE_AUTO_SUPPORTED', 0, async function (done) {
console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED to operate");
camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_AUTO, async (err, data) => {
if (!err) {
console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED SUCCESS ");
if (data != null || data != undefined) {
console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED data is not null || undefined");
console.info(TAG + "IS_FLASH_MODE_AUTO_SUPPORTED supported is: " + data);
expect(data).assertEqual(false);
console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED PASSED");
}
} else {
expect().assertFail();
console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED FAILED" + err.message);
console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED ends here");
}
await sleep(1000);
done();
})
await sleep(1000);
done();
})
/**
* @tc.number : SET_FLASH_MODE_AUTO
* @tc.name : set flash mode auto camera0 api
* @tc.desc : set flash mode auto camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_FLASH_MODE_AUTO', 0, async function (done) {
console.info(TAG + "Entering SET_FLASH_MODE_AUTO to operate");
camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_AUTO, async (err, data) => {
if (!err) {
console.info(TAG + "Entering SET_FLASH_MODE_AUTO SUCCESS which is not supported: ");
console.info(TAG + "Entering SET_FLASH_MODE_AUTO FAILED")
expect().assertFail();
} else {
expect(true).assertTrue()
console.info(TAG + "Entering SET_FLASH_MODE_AUTO PASSED: " + err.message);
console.info(TAG + "Entering SET_FLASH_MODE_AUTO ends here");
}
await sleep(1000);
done();
})
await sleep(1000);
done();
})
/**
* @tc.number : IS_FOCUS_MODE_LOCKED_SUPPORTED
* @tc.name : check if focus mode locked is supported-camera0Input api
* @tc.desc : check if focus mode locked is supported-camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('IS_FOCUS_MODE_LOCKED_SUPPORTED', 0, async function (done) {
console.info(TAG + "Entering IS_FOCUS_MODE_LOCKED_SUPPORTED to operate");
camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_LOCKED, async (err, data) => {
if (!err) {
console.info(TAG + "Entering IS_FOCUS_MODE_LOCKED_SUPPORTED SUCCESS: " + data);
if (data != null || data != undefined) {
console.info(TAG + "Entering IS_FOCUS_MODE_LOCKED_SUPPORTED data is not null || undefined");
console.info(TAG + "FOCUS_MODE_LOCKED_SUPPORTED is: " + data);
expect(true).assertTrue();
console.info(TAG + "Entering IS_FOCUS_MODE_LOCKED_SUPPORTED PASSED: ");
}
} else {
console.info(TAG + "IS_FOCUS_MODE_LOCKED_SUPPORTED FAILED" + err.message);
expect().assertFail();
console.info(TAG + "IS_FOCUS_MODE_LOCKED_SUPPORTED ends here");
}
await sleep(1000);
done();
})
await sleep(1000);
done();
})
/**
* @tc.number : SET_FOCUS_MODE_LOCKED
* @tc.name : set focus mode locked camera0 api
* @tc.desc : set focus mode locked camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_FOCUS_MODE_LOCKED', 0, async function (done) {
console.info(TAG + "Entering SET_FOCUS_MODE_LOCKED to operate");
camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_LOCKED, async (err, data) => {
if (!err) {
console.info(TAG + "Entering SET_FOCUS_MODE_LOCKED SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_LOCKED);
console.info(TAG + "Entering SET_FOCUS_MODE_LOCKED PASSED")
expect(true).assertTrue()
} else {
expect().assertFail();
console.info(TAG + "Entering SET_FOCUS_MODE_LOCKED FAILED" + err.message);
console.info(TAG + "Entering SET_FOCUS_MODE_LOCKED ends here");
}
await sleep(1000);
done();
})
await sleep(1000);
done();
})
/**
* @tc.number : GET_FOCUS_MODE_LOCKED
* @tc.name : get focus mode locked camera0 api
* @tc.desc : get focus mode locked camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_FOCUS_MODE_LOCKED', 0, async function (done) {
console.info(TAG + "Entering GET_FOCUS_MODE_LOCKED to operate");
camera0Input.getFocusMode(async (err, data) => {
if (!err) {
console.info(TAG + "Entering GET_FOCUS_MODE_LOCKED SUCCESS: " + data);
if (data == 0) {
console.info(TAG + "GET_FOCUS_MODE_LOCKED data is not null || undefined: ");
console.info(TAG + "Current FocusMode is: " + data);
expect(true).assertTrue();
console.info(TAG + "GET_FOCUS_MODE_LOCKED PASSED");
}
}
else {
expect().assertFail();
console.info(TAG + "GET_FOCUS_MODE_LOCKED FAILED" + err.message);
console.info(TAG + "GET_FOCUS_MODE_LOCKED ends here");
}
await sleep(1000);
done();
})
await sleep(1000);
done();
})
/**
* @tc.number : IS_FOCUS_MODE_MANUAL_SUPPORTED
* @tc.name : check if focus mode manual is supported-camera0Input api
* @tc.desc : check if focus mode manual is supported-camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('IS_FOCUS_MODE_MANUAL_SUPPORTED', 0, async function (done) {
console.info(TAG + "Entering IS_FOCUS_MODE_MANUAL_SUPPORTED to operate");
camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_MANUAL, async (err, data) => {
if (!err) {
console.info(TAG + "Entering IS_FOCUS_MODE_MANUAL_SUPPORTED SUCCESS ");
if (data != null || data != undefined) {
console.info(TAG + "Entering IS_FOCUS_MODE_MANUAL_SUPPORTED data is not null || undefined");
console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + data);
expect(true).assertTrue();
console.info(TAG + "Entering IS_FOCUS_MODE_MANUAL_SUPPORTED PASSED: ");
}
} else {
console.info(TAG + "IS_FOCUS_MODE_MANUAL_SUPPORTED FAILED" + err.message);
expect().assertFail();
console.info(TAG + "IS_FOCUS_MODE_MANUAL_SUPPORTED ends here");
}
await sleep(1000);
done();
})
await sleep(1000);
done();
})
/**
* @tc.number : SET_FOCUS_MODE_MANUAL
* @tc.name : set focus mode manual camera0 api
* @tc.desc : set focus mode manual camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_FOCUS_MODE_MANUAL', 0, async function (done) {
console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL to operate");
camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_MANUAL, async (err, data) => {
if (!err) {
console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_MANUAL);
console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL PASSED")
expect(true).assertTrue()
}
else {
expect().assertFail();
console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL FAILED" + err.message);
console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL ends here");
}
await sleep(1000);
done();
})
await sleep(1000);
done();
})
/**
* @tc.number : GET_FOCUS_MODE_MANUAL
* @tc.name : get focus mode manual camera0 api
* @tc.desc : get focus mode manual camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_FOCUS_MODE_MANUAL', 0, async function (done) {
console.info(TAG + "Entering GET_FOCUS_MODE_MANUAL to operate");
camera0Input.getFocusMode(async (err, data) => {
if (!err) {
console.info(TAG + "Entering GET_FOCUS_MODE_MANUAL SUCCESS");
if (data == 0) {
console.info(TAG + "GET_FOCUS_MODE_MANUAL data is not null || undefined: ");
console.info(TAG + "Current FocusMode is: " + data);
expect(true).assertTrue();
console.info(TAG + "GET_FOCUS_MODE_MANUAL PASSED");
}
}
else {
expect().assertFail();
console.info(TAG + "GET_FOCUS_MODE_MANUAL FAILED" + err.message);
console.info(TAG + "GET_FOCUS_MODE_MANUAL ends here");
}
await sleep(1000);
done();
})
await sleep(1000);
done();
})
/**
* @tc.number : IS_FOCUS_MODE_CONTINUOUS_SUPPORTED
* @tc.name : check if focus mode continuous is supported-camera0Input api
* @tc.desc : check if focus mode continuous is supported-camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('IS_FOCUS_MODE_CONTINUOUS_SUPPORTED', 0, async function (done) {
console.info(TAG + "Entering IS_FOCUS_MODE_CONTINUOUS_SUPPORTED to operate");
camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO, async (err, data) => {
if (!err) {
console.info(TAG + "Entering IS_FOCUS_MODE_CONTINUOUS_SUPPORTED SUCCESS ");
if (data != null || data != undefined) {
console.info(TAG + "Entering IS_FOCUS_MODE_CONTINUOUS_SUPPORTED data is not null || undefined");
console.info(TAG + "FOCUS_MODE_CONTINOUS_SUPPORTED is: " + data);
expect(true).assertTrue();
console.info(TAG + "Entering IS_FOCUS_MODE_CONTINUOUS_SUPPORTED PASSED: ");
}
} else {
console.info(TAG + "IS_FOCUS_MODE_CONTINUOUS_SUPPORTED FAILED" + err.message);
expect().assertFail();
console.info(TAG + "IS_FOCUS_MODE_CONTINUOUS_SUPPORTED ends here");
}
await sleep(1000);
done();
})
await sleep(1000);
done();
})
/**
* @tc.number : SET_FOCUS_MODE_CONTINUOUS
* @tc.name : set focus mode continuous camera0 api
* @tc.desc : set focus mode continuous camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_FOCUS_MODE_CONTINUOUS', 0, async function (done) {
console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS to operate");
camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO, async (err, data) => {
if (!err) {
console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO);
expect(true).assertTrue()
console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS PASSED")
}
else {
expect().assertFail();
console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS FAILED" + err.message);
console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS ends here");
}
await sleep(1000);
done();
})
await sleep(1000);
done();
})
/**
* @tc.number : GET_FOCUS_MODE_CONTINUOUS
* @tc.name : get focus mode continuous camera0 api
* @tc.desc : get focus mode continuous camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_FOCUS_MODE_CONTINUOUS', 0, async function (done) {
console.info(TAG + "Entering GET_FOCUS_MODE_CONTINUOUS to operate");
camera0Input.getFocusMode(async (err, data) => {
if (!err) {
console.info(TAG + "Entering GET_FOCUS_MODE_CONTINUOUS SUCCESS");
if (data == 1) {
console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS data is not null || undefined: ");
console.info(TAG + "Current FocusMode is: " + data);
expect(true).assertTrue();
console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS PASSED");
}
}
else {
expect().assertFail();
console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS FAILED" + err.message);
console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS ends here");
}
await sleep(1000);
done();
})
await sleep(1000);
done();
})
/**
* @tc.number : IS_FOCUS_MODE_AUTO_SUPPORTED
* @tc.name : check if focus mode auto is supported-camera0Input api
* @tc.desc : check if focus mode auto is supported-camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('IS_FOCUS_MODE_AUTO_SUPPORTED', 0, async function (done) {
console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED to operate");
camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO, async (err, data) => {
if (!err) {
console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED SUCCESS ");
if (data != null || data != undefined) {
console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED data is not null || undefined");
console.info(TAG + "FOCUS_MODE_AUTO_SUPPORTED is: " + data);
expect(true).assertTrue();
console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED PASSED: ");
}
} else {
console.info(TAG + "IS_FOCUS_MODE_AUTO_SUPPORTED FAILED" + err.message);
expect().assertFail();
console.info(TAG + "IS_FOCUS_MODE_AUTO_SUPPORTED ends here");
}
await sleep(1000);
done();
})
await sleep(1000);
done();
})
/**
* @tc.number : SET_FOCUS_MODE_AUTO
* @tc.name : set focus mode auto camera0 api
* @tc.desc : set focus mode auto camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_FOCUS_MODE_AUTO', 0, async function (done) {
console.info(TAG + "Entering SET_FOCUS_MODE_AUTO to operate");
camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO, async (err, data) => {
if (!err) {
console.info(TAG + "Entering SET_FOCUS_MODE_AUTO SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_AUTO);
if (data != null || data != undefined) {
expect(true).assertTrue()
console.info(TAG + "Entering SET_FOCUS_MODE_AUTO PASSED")
}
} else {
expect().assertFail();
console.info(TAG + "Entering SET_FOCUS_MODE_AUTO FAILED" + err.message);
console.info(TAG + "Entering SET_FOCUS_MODE_AUTO ends here");
}
await sleep(1000);
done();
})
await sleep(1000);
done();
})
/**
* @tc.number : GET_FOCUS_MODE_AUTO
* @tc.name : get focus mode auto camera0 api
* @tc.desc : get focus mode auto camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_FOCUS_MODE_AUTO', 0, async function (done) {
console.info(TAG + "Entering GET_FOCUS_MODE_AUTO to operate");
camera0Input.getFocusMode(async (err, data) => {
if (!err) {
console.info(TAG + "Entering GET_FOCUS_MODE_AUTO SUCCESS");
if (data == 2) {
console.info(TAG + "GET_FOCUS_MODE_AUTO data is not null || undefined: ");
console.info(TAG + "Current FocusMode is: " + data);
expect(true).assertTrue();
console.info(TAG + "GET_FOCUS_MODE_AUTO PASSED");
}
}
else {
expect().assertFail();
console.info(TAG + "GET_FOCUS_MODE_AUTO FAILED" + err.message);
console.info(TAG + "GET_FOCUS_MODE_AUTO ends here");
}
await sleep(1000);
done();
})
await sleep(1000);
done();
})
/**
* @tc.number : PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS Rotation-0 & Quality-0
* @tc.name : Photo output capture with photosettings api
* @tc.desc : Photo output capture with photosettings api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS', 0, async function (done) {
if (photoOutputAsync == null || photoOutputAsync == undefined) {
console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS photoOutput == null || undefined");
} else {
console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS to operate");
photoOutputAsync.capture(photosettings1, async (err, data) => {
if (!err) {
console.info(TAG + "Entering photoOutput capture with Rotation-0 & Quality-0 success");
if (data != null || data != undefined) {
console.info(TAG + "Entering photoOutput capture with photosettings1 data is not null || undefined");
console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS Rotation-0 & Quality-0 PASSED");
expect(true).assertTrue();
}
} else {
expect().assertFail();
console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS Rotation-0 & Quality-0 FAILED" + err.message);
console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS Rotation-0 & Quality-0 ends here");
}
await sleep(1000);
done();
})
await sleep(1000);
done();
}
})
/**
* @tc.number : PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS with Rotation-90 & Quality-1
* @tc.name : Photo output capture with photosettings api
* @tc.desc : Photo output capture with photosettings api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS', 0, async function (done) {
if (photoOutputAsync == null || photoOutputAsync == undefined) {
console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS photoOutput == null || undefined");
} else {
console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS to operate");
photoOutputAsync.capture(photosettings2, async (err, data) => {
if (!err) {
console.info(TAG + "Entering photoOutput capture with Rotation-90 & Quality-1 success");
if (data != null || data != undefined) {
console.info(TAG + "Entering photoOutput capture with photosettings2 data is not null || undefined");
console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS Rotation-90 & Quality-1 PASSED");
expect(true).assertTrue();
}
} else {
expect().assertFail();
console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS Rotation-90 & Quality-1 FAILED" + err.message);
console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS Rotation-90 & Quality-1 ends here");
}
await sleep(1000);
done();
})
await sleep(1000);
done();
}
})
/**
* @tc.number : PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS with Rotation-180 & Quality-2
* @tc.name : Photo output capture with photosettings api
* @tc.desc : Photo output capture with photosettings api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS', 0, async function (done) {
if (photoOutputAsync == null || photoOutputAsync == undefined) {
console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS photoOutput == null || undefined");
} else {
console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS to operate");
photoOutputAsync.capture(photosettings3, async (err, data) => {
if (!err) {
console.info(TAG + "Entering photoOutput capture with Rotation-180 & Quality-2 success");
if (data != null || data != undefined) {
console.info(TAG + "Entering photoOutput capture with photosettings3 data is not null || undefined");
console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS Rotation-180 & Quality-2 PASSED");
expect(true).assertTrue();
}
} else {
expect().assertFail();
console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS Rotation-180 & Quality-2 FAILED" + err.message);
console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS Rotation-180 & Quality-2 ends here");
}
})
await sleep(1000);
done();
}
})
/**
* @tc.number : GET_ZOOM_RATIO
* @tc.name : get zoom ratio camera-0 cameraId api
* @tc.desc : get zoom ratio camera-0 cameraId api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_ZOOM_RATIO', 0, async function (done) {
console.info("--------------GET_ZOOM_RATIO--------------");
camera0Input.getZoomRatioRange(async (err, data) => {
if (!err) {
if (data != null && data != undefined) {
console.info(TAG + "Entering GET_ZOOM_RATIO data is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "Entering GET_ZOOM_RATIO Success " + data)
}
} else {
expect().assertFail();
console.info(TAG + "Entering GET_ZOOM_RATIO FAILED: " + err.message);
}
console.info(TAG + "Entering GET_ZOOM_RATIO ends here");
await sleep(1000);
done();
})
await sleep(1000);
done();
})
/**
* @tc.number : SET_GET_ZOOM_1_ASYNC
* @tc.name : Zoom camera-0 cameraId api
* @tc.desc : Zoom camera-0 cameraId api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_GET_ZOOM_1_ASYNC', 0, async function (done) {
camera0Input.setZoomRatio(1, (err, data) => {
if (!err) {
console.info(TAG + "setZoomRatio success: 1");
console.info(TAG + "getZoomRatio called")
camera0Input.getZoomRatio((err, data1) => {
if (!err) {
console.info(TAG + "getZoomRatio success : " + data1);
expect(data1).assertEqual(1);
console.info(TAG + "SET_GET_ZOOM_1_ASYNC PASSED ");
}
else {
expect().assertFail();
console.info(TAG + "SET_GET_ZOOM_1_ASYNC FAILED" + err.message);
}
})
}
})
await sleep(1000);
done();
})
/**
* @tc.number : SET_GET_ZOOM_2_ASYNC
* @tc.name : Zoom camera-0 cameraId api
* @tc.desc : Zoom camera-0 cameraId api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_GET_ZOOM_2_ASYNC', 0, async function (done) {
camera0Input.setZoomRatio(2, (err, data) => {
if (!err) {
console.info(TAG + "setZoomRatio success: 2");
console.info(TAG + "getZoomRatio called")
camera0Input.getZoomRatio((err, data1) => {
if (!err) {
console.info(TAG + "getZoomRatio success : " + data1);
expect(data1).assertEqual(2);
console.info(TAG + "SET_GET_ZOOM_2_ASYNC PASSED ");
}
else {
expect().assertFail();
console.info(TAG + "SET_GET_ZOOM_2_ASYNC FAILED" + err.message);
}
})
}
})
await sleep(1000);
done();
})
/**
* @tc.number : SET_GET_ZOOM_3_ASYNC
* @tc.name : Zoom camera-0 cameraId api
* @tc.desc : Zoom camera-0 cameraId api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_GET_ZOOM_3_ASYNC', 0, async function (done) {
camera0Input.setZoomRatio(3, (err, data) => {
if (!err) {
console.info(TAG + "setZoomRatio success: 3");
console.info(TAG + "getZoomRatio called")
camera0Input.getZoomRatio((err, data1) => {
if (!err) {
console.info(TAG + "getZoomRatio success : " + data1);
expect(data1).assertEqual(3);
console.info(TAG + "SET_GET_ZOOM_3_ASYNC PASSED ");
}
else {
expect().assertFail();
console.info(TAG + "SET_GET_ZOOM_3_ASYNC FAILED" + err.message);
}
})
}
})
await sleep(1000);
done();
})
/**
* @tc.number : SET_GET_ZOOM_4_ASYNC
* @tc.name : Zoom camera-0 cameraId api
* @tc.desc : Zoom camera-0 cameraId api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_GET_ZOOM_4_ASYNC', 0, async function (done) {
camera0Input.setZoomRatio(4, (err, data) => {
if (!err) {
console.info(TAG + "setZoomRatio success: 4");
console.info(TAG + "getZoomRatio called")
camera0Input.getZoomRatio((err, data1) => {
if (!err) {
console.info(TAG + "getZoomRatio success : " + data1);
expect(data1).assertEqual(4);
console.info(TAG + "SET_GET_ZOOM_4_ASYNC PASSED ");
}
else {
expect().assertFail();
console.info(TAG + "SET_GET_ZOOM_4_ASYNC FAILED" + err.message);
}
})
}
})
await sleep(1000);
done();
})
/**
* @tc.number : SET_GET_ZOOM_5_ASYNC
* @tc.name : Zoom camera-0 cameraId api
* @tc.desc : Zoom camera-0 cameraId api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_GET_ZOOM_5_ASYNC', 0, async function (done) {
camera0Input.setZoomRatio(5, (err, data) => {
if (!err) {
console.info(TAG + "setZoomRatio success: 5");
console.info(TAG + "getZoomRatio called")
camera0Input.getZoomRatio((err, data1) => {
if (!err) {
console.info(TAG + "getZoomRatio success : " + data1);
expect(data1).assertEqual(5);
console.info(TAG + "SET_GET_ZOOM_5_ASYNC PASSED ");
}
else {
expect().assertFail();
console.info(TAG + "SET_GET_ZOOM_5_ASYNC FAILED" + err.message);
}
})
}
})
await sleep(1000);
done();
})
/**
* @tc.number : SET_GET_ZOOM_6_ASYNC
* @tc.name : Zoom camera-0 cameraId api
* @tc.desc : Zoom camera-0 cameraId api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_GET_ZOOM_6_ASYNC', 0, async function (done) {
camera0Input.setZoomRatio(6, (err, data) => {
if (!err) {
console.info(TAG + "setZoomRatio success: 6");
console.info(TAG + "getZoomRatio called")
camera0Input.getZoomRatio((err, data1) => {
if (!err) {
console.info(TAG + "getZoomRatio success : " + data1);
expect(data1).assertEqual(6);
console.info(TAG + "SET_GET_ZOOM_6_ASYNC PASSED ");
}
else {
expect().assertFail();
console.info(TAG + "SET_GET_ZOOM_6_ASYNC FAILED" + err.message);
}
})
}
})
await sleep(1000);
done();
})
/**
* @tc.number : PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS with Rotation-270
* @tc.name : Photo output capture with photosettings api
* @tc.desc : Photo output capture with photosettings api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS', 0, async function (done) {
if (photoOutputAsync == null || photoOutputAsync == undefined) {
console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS photoOutput == null || undefined");
} else {
console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS to operate");
photoOutputAsync.capture(photosettings4, async (err, data) => {
if (!err) {
console.info(TAG + "Entering photoOutput capture with Rotation-270 success");
if (data != null || data != undefined) {
console.info(TAG + "Entering photoOutput capture with photosettings4 data is not null || undefined");
console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS Rotation-270 PASSED");
expect(true).assertTrue();
}
} else {
expect().assertFail();
console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS Rotation-270 FAILED" + err.message);
console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS Rotation-270 ends here");
}
})
await sleep(1000);
done();
}
})
/*CaptureSession APIs test script*/
/**
* @tc.number : CAPTURE_SESSION_STOP
* @tc.name : capture session stop api
* @tc.desc : capture session stop api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CAPTURE_SESSION_STOP', 0, async function (done) {
if (captureSession == null || captureSession == undefined) {
console.info(TAG + "Entering CAPTURE_SESSION_STOP captureSession == null || undefined");
} else {
console.info(TAG + "Entering CAPTURE_SESSION_STOP to operate");
captureSession.stop(async (err, data) => {
if (!err) {
console.info(TAG + "Entering CAPTURE_SESSION_STOP captureSession.stop success");
if (data != null || data != undefined) {
console.info(TAG + "Entering captureSession.stop data is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "Entering CAPTURE_SESSION_STOP captureSession.stop PASSED");
}
} else {
expect().assertFail();
console.info(TAG + "Entering CAPTURE_SESSION_STOP FAILED" + err.message);
console.info(TAG + "Entering CAPTURE_SESSION_STOP ends here");
}
await sleep(1000);
done();
})
await sleep(1000);
done();
}
})
/**
* @tc.number : CAPTURE_SESSION_RELEASE
* @tc.name : capture session release api
* @tc.desc : capture session release api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CAPTURE_SESSION_RELEASE', 0, async function (done) {
if (captureSession == null || captureSession == undefined) {
console.info(TAG + "Entering CAPTURE_SESSION_RELEASE captureSession == null || undefined");
} else {
console.info(TAG + "Entering CAPTURE_SESSION_RELEASE to operate");
captureSession.release(async (err, data) => {
if (!err) {
console.info(TAG + "Entering captureSession.release success");
if (data != null || data != undefined) {
console.info(TAG + "Entering captureSession.release data is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "Entering CAPTURE_SESSION_RELEASE PASSED");
}
} else {
expect().assertFail();
console.info(TAG + "Entering CAPTURE_SESSION_RELEASE FAILED: " + err.message);
console.info(TAG + "Entering CAPTURE_SESSION_RELEASE ends here");
await sleep(1000);
done();
}
})
await sleep(1000);
done();
}
})
/**
* @tc.number : PHOTOOUPUT_RELEASE
* @tc.name : photoOutput release api
* @tc.desc : photoOutput release api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('PHOTOOUPUT_RELEASE', 0, async function (done) {
if (photoOutputAsync == null || photoOutputAsync == undefined) {
console.info(TAG + "Entering PHOTOOUPUT_RELEASE photoOutputAsync == null || undefined");
} else {
console.info(TAG + "Entering PHOTOOUPUT_RELEASE to operate");
photoOutputAsync.release(async (err, data) => {
if (!err) {
console.info(TAG + "Entering photoOutputAsync.release success");
expect(true).assertTrue();
console.info(TAG + "Entering PHOTOOUPUT_RELEASE PASSED");
} else {
expect().assertFail();
console.info(TAG + "Entering PHOTOOUPUT_RELEASE FAILED: " + err.message);
console.info(TAG + "Entering photoOutputAsync.release ends here");
}
await sleep(1000);
done();
})
await sleep(1000);
done();
}
})
/**
* @tc.number : PREVIEWOUPUT_RELEASE
* @tc.name : previewOutput release api
* @tc.desc : previewOutput release api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('PREVIEWOUPUT_RELEASE', 0, async function (done) {
if (previewOutputAsync == null || previewOutputAsync == undefined) {
console.info(TAG + "Entering PREVIEWOUPUT_RELEASE previewOutputAsync == null || undefined");
} else {
console.info(TAG + "Entering PREVIEWOUPUT_RELEASE to operate");
previewOutputAsync.release(async (err, data) => {
if (!err) {
console.info(TAG + "Entering previewOutputAsync.release success");
console.info(TAG + "Entering previewOutputAsync.release data is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "Entering PREVIEWOUPUT_RELEASE PASSED");
} else {
expect().assertFail();
console.info(TAG + "Entering PREVIEWOUPUT_RELEASE FAILED: " + err.message);
console.info(TAG + "Entering PREVIEWOUPUT_RELEASE ends here");
await sleep(1000);
done();
}
})
await sleep(1000);
done();
}
await sleep(1000);
done();
})
/**
* @tc.number : CAMERAINPUT_RELEASE_SUCCESS
* @tc.name : camera Input release api
* @tc.desc : camera Input release api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CAMERAINPUT_RELEASE_SUCCESS', 0, async function (done) {
if (camera0Input == null || camera0Input == undefined) {
console.info(TAG + "Entering CAMERAINPUT_RELEASE_SUCCESS camera0Input == null || undefined");
} else {
console.info(TAG + "Entering CAMERAINPUT_RELEASE_SUCCESS to operate");
camera0Input.release(async (err, data) => {
if (!err) {
console.info(TAG + "Entering camera0Input.release success");
if (data != null || data != undefined) {
console.info(TAG + "Entering camera0Input.release data is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "Entering CAMERAINPUT_RELEASE_SUCCESS PASSED");
}
} else {
expect().assertFail();
console.info(TAG + "Entering CAMERAINPUT_RELEASE_SUCCESS FAILED: " + err.message);
console.info(TAG + "Entering CAMERAINPUT_RELEASE_SUCCESS ends here");
await sleep(1000);
done();
}
})
await sleep(1000);
done();
}
})
})
}
\ 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 cameraObj from '@ohos.multimedia.camera';
import image from '@ohos.multimedia.image';
import fileio from '@ohos.fileio';
import abilityAccessCtrl from '@ohos.abilityAccessCtrl'
import bundle from '@ohos.bundle'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index';
const TAG = "CameraModuleTest: ";
// Define global variables
var camera0InputPromise;
var cameraManagerPromise;
var previewOutputPromise;
var photoOutputPromise;
var CaptureSessionPromise;
var surfaceId1;
var camerasArrayPromise
var photosettings1 = {
rotation: 0,
quality: 0,
}
var photosettings2 = {
rotation: 90,
quality: 1,
}
var photosettings3 = {
rotation: 180,
quality: 2,
}
var photosettings4 = {
rotation: 270
}
export default function cameraJSUnitPhotoPromise(surfaceId: any) {
async function getImageReceiverSurfaceId() {
console.log(TAG + 'Entering create Image receiver')
var 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));
}
async function applyPermission() {
let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100);
let atManager = abilityAccessCtrl.createAtManager();
if (atManager != null) {
let tokenID = appInfo.accessTokenId;
console.info('[permission] case accessTokenID is ' + tokenID);
let permissionName1 = 'ohos.permission.CAMERA';
let permissionName2 = 'ohos.permission.MICROPHONE';
let permissionName3 = 'ohos.permission.MEDIA_LOCATION';
let permissionName4 = 'ohos.permission.READ_MEDIA';
let permissionName5 = 'ohos.permission.WRITE_MEDIA';
await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName5, 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('CameraJsUnitPhotoPromise', function () {
console.info(TAG + '----------CameraJsUnitPhotoPromise--------------')
beforeAll(async function () {
await applyPermission();
console.info('beforeAll case');
})
beforeEach(function () {
sleep(5000);
console.info('beforeEach case');
})
afterEach(async function () {
console.info('afterEach case');
})
afterAll(function () {
console.info('afterAll case');
})
console.info(TAG + "----------Camera-PhotoMode-Promise-------------");
/**
* @tc.number : GET_CAMERA_MANAGER_PROMISE
* @tc.name : Create camera manager instance promise api
* @tc.desc : Create camera manager instance promise api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_CAMERA_MANAGER_PROMISE', 0, async function (done) {
console.info("--------------GET_CAMERA_MANAGER_PROMISE--------------");
cameraManagerPromise = await cameraObj.getCameraManager(null);
console.info(TAG + "Entering GET_CAMERA_MANAGER_PROMISE cameraManagerPromise: " + JSON.stringify(cameraManagerPromise));
if (cameraManagerPromise != null && cameraManagerPromise != undefined) {
expect(true).assertTrue();
console.info(TAG + "Entering GET_CAMERA_MANAGER_PROMISE PASSED");
} else {
expect().assertFail();
console.info(TAG + "Entering GET_CAMERA_MANAGER_PROMISE FAILED");
}
console.info(TAG + "Entering GET_CAMERA_MANAGER_PROMISE ends here");
await sleep(1000);
done();
})
/**
* @tc.number : CAMERA_STATUS_CALLBACK
* @tc.name : camera status callback on CameraManager async api
* @tc.desc : camera status callback on CameraManager async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CAMERA_STATUS_CALLBACK', 0, async function (done) {
if (cameraManagerPromise == null || cameraManagerPromise == undefined) {
console.info(TAG + 'Entering CAMERA_STATUS_CALLBACK cameraManagerPromise == null || undefined')
} else {
console.info(TAG + 'Entering CAMERA_STATUS_CALLBACK to operate')
cameraManagerPromise.on("cameraStatus", async (err, data) => {
if (!err) {
console.info(TAG + "Camera status Callback on cameraManagerPromise is success");
if (data != null || data != undefined) {
console.info(TAG + "Camera status Callback CameraStatusInfo_Camera: " + data.camera);
console.info(TAG + "Camera status Callback CameraStatusInfo_Status: " + data.status);
expect(true).assertTrue();
}
} else {
expect().assertFail();
}
await sleep(1000);
done();
})
await sleep(1000);
done();
}
})
/**
* @tc.number : GET_CAMERAS_PROMISE
* @tc.name : Get camera from cameramanager to get array of camera promise api
* @tc.desc : Get camera from cameramanager to get array of camera promise api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_CAMERAS_PROMISE', 0, async function (done) {
console.info("--------------GET_CAMERAS_PROMISE--------------");
camerasArrayPromise = await cameraManagerPromise.getCameras();
console.info(TAG + "Entering GET_CAMERAS_PROMISE: " + JSON.stringify(camerasArrayPromise));
if (camerasArrayPromise != null && camerasArrayPromise.length > 0) {
console.info(TAG + "Entering GET_CAMERAS_PROMISE success");
for (var i = 0; i < camerasArrayPromise.length; i++) {
// Get the variables from camera object
var cameraId = camerasArrayPromise[i].cameraId;
console.info(TAG + "Entering GET_CAMERAS_PROMISE camera" + i + "Id: " + cameraId);
var cameraPosition = camerasArrayPromise[i].cameraPosition;
console.info(TAG + "Entering GET_CAMERAS_PROMISE camera" + i + "Position: " + cameraPosition);
var cameraType = camerasArrayPromise[i].cameraType;
console.info(TAG + "Entering GET_CAMERAS_PROMISE camera" + i + "Type: " + cameraType);
var connectionType = camerasArrayPromise[i].connectionType
console.info(TAG + "Entering GET_CAMERAS_PROMISE connection" + i + "Type: " + connectionType);
}
expect(true).assertTrue();
console.info(TAG + "Entering GET_CAMERAS_PROMISE PASSED");
} else {
expect().assertFail();
console.info(TAG + "Entering GET_CAMERAS_PROMISE FAILED");
}
console.info(TAG + "Entering GET_CAMERAS_PROMISE ends here");
await sleep(1000);
done();
})
/*CAMERA-0 Scripts*/
/**
* @tc.number : CREATE_CAMERA_INPUT_PROMISE
* @tc.name : Create camerainput from camera-0 cameraId promise api
* @tc.desc : Create camerainput from camera-0 cameraId promise api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CREATE_CAMERA_INPUT_PROMISE', 0, async function (done) {
console.info("--------------CAMERA-0 STARTS HERE--------------");
console.info("--------------CREATE_CAMERA_INPUT_PROMISE--------------");
camera0InputPromise = await cameraManagerPromise.createCameraInput(camerasArrayPromise[0].cameraId);
console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE camera0InputPromise: " + JSON.stringify(camera0InputPromise));
if (camera0InputPromise != null && camera0InputPromise != undefined) {
console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE camera0InputPromise is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE PASSED");
} else {
expect().assertFail();
console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE FAILED");
}
console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE ends here");
await sleep(1000);
done();
})
/**
* @tc.number : CAMERA_INPUT_CALLBACK_ON_ERROR
* @tc.name : Photo output callback on error api
* @tc.desc : Photo output callback on error api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CAMERA_INPUT_CALLBACK_ON_ERROR', 0, async function (done) {
if (camera0InputPromise == null || camera0InputPromise == undefined) {
console.info(TAG + "Entering CAMERA_INPUT_CALLBACK_ON_ERROR camera0InputPromise == null || undefined");
} else {
console.info(TAG + "Entering CAMERA_INPUT_CALLBACK_ON_ERROR to operate");
camera0InputPromise.on("error", async (err, data) => {
if (!err) {
console.info(TAG + "camera0InputPromise error callback is success");
if (data != null || data != undefined) {
console.info(TAG + "Error during camera0InputPromise with ErrorCode: " + data.code);
expect(true).assertTrue();
}
} else {
expect().assertFail();
}
await sleep(1000);
done();
})
await sleep(1000);
done();
}
})
/*PreviewOutput APIs test script*/
/**
* @tc.number : CREATE_PREVIEW_OUTPUT_SUCCESS_PROMISE
* @tc.name : Create PreviewOutput instance promise api
* @tc.desc : Create PreviewOutput instance promise api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CREATE_PREVIEW_OUTPUT_SUCCESS_PROMISE', 0, async function (done) {
console.info(TAG + " Entering CREATE_PREVIEW_OUTPUT_SUCCESS_PROMISE to operate");
previewOutputPromise = await cameraObj.createPreviewOutput(surfaceId);
console.info(TAG + " Entering createPreviewOutput success");
if (previewOutputPromise != null || previewOutputPromise != undefined) {
expect(true).assertTrue();
console.info(TAG + "Entering createPreviewOutput PASSED: " + JSON.stringify(previewOutputPromise));
}
else {
expect().assertFail();
console.info(TAG + "Entering createPreviewOutput FAILED");
console.info(TAG + "Entering createPreviewOutput ends here");
}
await sleep(1000);
done();
})
/**
* @tc.number : PREVIEW_OUTPUT_CALLBACK_ON_ERROR
* @tc.name : Preview output callback on error api
* @tc.desc : Preview output callback on error api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('PREVIEW_OUTPUT_CALLBACK_ON_ERROR', 0, async function (done) {
if (previewOutputPromise == null || previewOutputPromise == undefined) {
console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_ERROR previewOutput == null || undefined");
} else {
console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_ERROR to operate");
previewOutputPromise.on("error", async (err, data) => {
if (!err) {
console.info(TAG + "PreviewOutputError callback is success");
if (data != null || data != undefined) {
console.info(TAG + "Error during PreviewOutput with ErrorCode: " + data.code);
expect(true).assertTrue();
}
} else {
expect().assertFail();
}
await sleep(1000);
done();
})
await sleep(1000);
done();
}
})
/*PhotoOutput APIs test script*/
/**
* @tc.number : CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE
* @tc.name : Create PhotoOutput instance promise api
* @tc.desc : Create PhotoOutput instance promise api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE', 0, async function (done) {
console.info(TAG + "Entering CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE to operate");
console.info(TAG + 'Entering getImageReceiverSurfaceId')
await getImageReceiverSurfaceId()
await sleep(1000)
photoOutputPromise = await cameraObj.createPhotoOutput(surfaceId1);
console.info(TAG + "Entering createPhotoOutput success");
if (photoOutputPromise != null || photoOutputPromise != undefined) {
expect(true).assertTrue();
console.info(TAG + "Entering CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE PASSED");
}
else {
expect().assertFail();
console.info(TAG + "Entering CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE FAILED");
console.info(TAG + "Entering createPhotoOutput ends here");
}
await sleep(1000);
done();
})
/**
* @tc.number : PHOTO_OUTPUT_CALLBACK_ON_ERROR
* @tc.name : Photo output callback on error api
* @tc.desc : Photo output callback on error api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('PHOTO_OUTPUT_CALLBACK_ON_ERROR', 0, async function (done) {
if (photoOutputPromise == null || photoOutputPromise == undefined) {
console.info(TAG + "Entering PHOTO_OUTPUT_CALLBACK_ON_ERROR photoOutput == null || undefined");
} else {
console.info(TAG + "Entering PHOTO_OUTPUT_CALLBACK_ON_ERROR to operate");
photoOutputPromise.on("error", async (err, data) => {
if (!err) {
console.info(TAG + "PhotoOutputError callback is success");
if (data != null || data != undefined) {
console.info(TAG + "Error during PhotoOutput with ErrorCode: " + data.code);
expect(true).assertTrue();
}
} else {
expect().assertFail();
}
await sleep(1000);
done();
})
await sleep(1000);
done();
}
})
/*CaptureSession APIs test script*/
/**
* @tc.number : CREATE_CAPTURE_SESSION_SUCCESS_PROMISE
* @tc.name : Create CaptureSession instance promise api
* @tc.desc : Create Capturesession instance promise api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CREATE_CAPTURE_SESSION_SUCCESS_PROMISE', 0, async function (done) {
console.info(TAG + "Entering CREATE_CAPTURE_SESSION_SUCCESS_PROMISE to operate");
CaptureSessionPromise = await cameraObj.createCaptureSession(null);
console.info(TAG + "Entering createCaptureSession success");
if (CaptureSessionPromise != null || CaptureSessionPromise != undefined) {
console.info(TAG + "Entering createCaptureSession data is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "Entering createCaptureSession PASSED");
}
else {
expect().assertFail();
console.info(TAG + "Entering CREATE_CAPTURE_SESSION_SUCCESS_PROMISE FAILED");
console.info(TAG + "Entering createCaptureSession ends here");
}
await sleep(1000);
done();
})
//Capturesession callback
/**
* @tc.number : CAP_SES_CALLBACK_ON_ERROR
* @tc.name : CaptureSession callback on error api
* @tc.desc : CaptureSession callback on error api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CAP_SES_CALLBACK_ON_ERROR', 0, async function (done) {
if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) {
console.info(TAG + "Entering CAP_SES_CALLBACK_ON_ERROR captureSession == null || undefined");
} else {
console.info(TAG + "Entering CAP_SES_CALLBACK_ON_ERROR to operate");
CaptureSessionPromise.on("error", async (err, data) => {
if (!err) {
console.info(TAG + " captureSession errorcallback is success");
if (data != null || data != undefined) {
console.info(TAG + "Error in CaptureSessioncallback with ErrorCode: " + data.code);
expect(true).assertTrue();
}
} else {
expect().assertFail();
}
await sleep(1000);
done();
})
await sleep(1000);
done();
}
})
/*CaptureSession APIs*/
/**
* @tc.number : CREATE_BEGIN_CONFIG_SUCCESS_PROMISE
* @tc.name : CaptureSession_Begin config promise api
* @tc.desc : CaptureSession_Begin config promise api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CREATE_BEGIN_CONFIG_SUCCESS_PROMISE', 0, async function (done) {
if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) {
console.info(TAG + "Entering CREATE_BEGIN_CONFIG_SUCCESS captureSession == null || undefined");
} else {
console.info(TAG + "Entering CREATE_BEGIN_CONFIG_SUCCESS_PROMISE to operate");
const promise = await CaptureSessionPromise.beginConfig();
console.info(TAG + "Entering beginConfig success");
if (promise != null || promise != undefined) {
console.info(TAG + "Entering CREATE_BEGIN_CONFIG beginConfig data is not null || undefined: " + JSON.stringify(promise));
expect(true).assertTrue();
console.info(TAG + "Entering CREATE_BEGIN_CONFIG_SUCCESS_PROMISE beginConfig PASSED");
}
else {
expect().assertFail();
console.info(TAG + "Entering beginConfig FAILED");
}
console.info(TAG + "Entering beginConfig ends here");
await sleep(1000);
done();
}
await sleep(1000);
done();
})
/**
* @tc.number : ADD_INPUT_SUCCESS_PROMISE
* @tc.name : Add Input with camera0Input api
* @tc.desc : Add Input with camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('ADD_INPUT_SUCCESS_PROMISE', 0, async function (done) {
if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) {
console.info(TAG + "Entering ADD_INPUT_SUCCESS_PROMISE captureSession == null || undefined");
} else {
console.info(TAG + "Entering ADD_INPUT_SUCCESS_PROMISE to operate");
const Promise = await CaptureSessionPromise.addInput(camera0InputPromise);
console.info(TAG + "Entering ADD_INPUT_SUCCESS_PROMISE addInput success");
if (Promise != null || Promise != undefined) {
console.info(TAG + "Entering ADD_INPUT_SUCCESS_PROMISE addInput data is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "Entering ADD_INPUT_SUCCESS_PROMISE addInput PASSED");
}
else {
expect().assertFail();
console.info(TAG + "Entering ADD_INPUT_SUCCESS_PROMISE FAILED: ");
}
console.info(TAG + "Entering ADD_INPUT_SUCCESS_PROMISE ends here");
await sleep(1000);
done();
}
await sleep(1000);
done();
})
/**
* @tc.number : ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE
* @tc.name : Add output with camera0Input api
* @tc.desc : Add output with camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE', 0, async function (done) {
if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) {
console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE captureSession == null || undefined");
} else {
console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE to operate");
const promise = await CaptureSessionPromise.addOutput(previewOutputPromise);
console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE : Success");
if (promise != null || promise != undefined) {
console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE data is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE PASSED");
}
else {
expect().assertFail();
console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE FAILED");
}
console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE ends here");
await sleep(1000);
done();
}
await sleep(1000);
done();
})
/**
* @tc.number : ADD_OUTPUT_PHOTO_SUCCESS
* @tc.name : Add output with photo output api
* @tc.desc : Add output with photo output api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('ADD_OUTPUT_PHOTO_SUCCESS', 0, async function (done) {
if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) {
console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS captureSession == null || undefined");
} else {
console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS to operate");
const promise = await CaptureSessionPromise.addOutput(photoOutputPromise);
console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS success");
if (promise != null || promise != undefined) {
console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS data is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS PASSED");
}
else {
expect().assertFail();
console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS FAILED: ");
}
console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS ends here");
await sleep(1000);
done();
}
await sleep(1000);
done();
})
/**
* @tc.number : REMOVE_INPUT_SUCCESS
* @tc.name : remove input api
* @tc.desc : remove input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('REMOVE_INPUT_SUCCESS', 0, async function (done) {
if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) {
console.info(TAG + "Entering REMOVE_INPUT_SUCCESS captureSession == null || undefined");
} else {
console.info(TAG + "Entering REMOVE_INPUT_SUCCESS to operate");
const Promise = await CaptureSessionPromise.removeInput(camera0InputPromise);
console.info(TAG + "Entering REMOVE_INPUT_SUCCESS success " + Promise);
if (Promise != null || Promise != undefined) {
console.info(TAG + "Entering REMOVE_INPUT_SUCCESS data is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "Entering REMOVE_INPUT_SUCCESS PASSED");
}
else {
expect().assertFail();
console.info(TAG + "Entering REMOVE_INPUT_SUCCESS FAILED: ");
}
console.info(TAG + "Entering REMOVE_INPUT_SUCCESS ends here");
await sleep(1000);
done();
}
await sleep(1000);
done();
})
/**
* @tc.number : REMOVE_PREVIEW_OUTPUT_SUCCESS
* @tc.name : Remove preview Output api
* @tc.desc : Remove preview Output api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('REMOVE_PREVIEW_OUTPUT_SUCCESS', 0, async function (done) {
if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) {
console.info(TAG + "Entering REMOVE_INPUT_SUCCESS captureSession == null || undefined");
} else {
console.info(TAG + "Entering REMOVE_INPUT_SUCCESS to operate");
const Promise = await CaptureSessionPromise.removeOutput(previewOutputPromise);
console.info(TAG + "Entering REMOVE_INPUT_SUCCESS addInput success " + Promise);
if (Promise != null || Promise != undefined) {
console.info(TAG + "Entering REMOVE_INPUT_SUCCESS addInput data is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "Entering REMOVE_INPUT_SUCCESS addInput PASSED");
}
else {
expect().assertFail();
console.info(TAG + "Entering REMOVE_INPUT_SUCCESS FAILED: ");
}
console.info(TAG + "Entering REMOVE_INPUT_SUCCESS ends here");
await sleep(1000);
done();
}
await sleep(1000);
done();
})
/**
* @tc.number : REMOVE_PHOTO_OUTPUT_SUCCESS
* @tc.name : Remove photo Output api
* @tc.desc : Remove photo Output api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('REMOVE_PHOTO_OUTPUT_SUCCESS', 0, async function (done) {
if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) {
console.info(TAG + "Entering REMOVE_INPUT_SUCCESS captureSession == null || undefined");
} else {
console.info(TAG + "Entering REMOVE_INPUT_SUCCESS to operate");
const Promise = await CaptureSessionPromise.removeOutput(photoOutputPromise);
console.info(TAG + "Entering REMOVE_INPUT_SUCCESS addInput success " + Promise);
if (Promise != null || Promise != undefined) {
console.info(TAG + "Entering REMOVE_INPUT_SUCCESS addInput data is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "Entering REMOVE_INPUT_SUCCESS addInput PASSED");
}
else {
expect().assertFail();
console.info(TAG + "Entering REMOVE_INPUT_SUCCESS FAILED: ");
}
console.info(TAG + "Entering REMOVE_INPUT_SUCCESS ends here");
await sleep(1000);
done();
}
await sleep(1000);
done();
})
/**
* @tc.number : ADD_INPUT_SUCCESS_PROMISE
* @tc.name : Add Input with camera0Input api
* @tc.desc : Add Input with camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('ADD_INPUT_SUCCESS_PROMISE', 0, async function (done) {
if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) {
console.info(TAG + "Entering ADD_INPUT_SUCCESS_PROMISE captureSession == null || undefined");
} else {
console.info(TAG + "Entering ADD_INPUT_SUCCESS_PROMISE to operate");
const Promise = await CaptureSessionPromise.addInput(camera0InputPromise);
console.info(TAG + "Entering ADD_INPUT_SUCCESS_PROMISE addInput success");
if (Promise != null || Promise != undefined) {
console.info(TAG + "Entering ADD_INPUT_SUCCESS_PROMISE addInput data is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "Entering ADD_INPUT_SUCCESS_PROMISE addInput PASSED");
}
else {
expect().assertFail();
console.info(TAG + "Entering ADD_INPUT_SUCCESS_PROMISE FAILED: ");
}
console.info(TAG + "Entering ADD_INPUT_SUCCESS_PROMISE ends here");
await sleep(1000);
done();
}
await sleep(1000);
done();
})
/**
* @tc.number : ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE
* @tc.name : Add output with camera0Input api
* @tc.desc : Add output with camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE', 0, async function (done) {
if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) {
console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE captureSession == null || undefined");
} else {
console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE to operate");
const promise = await CaptureSessionPromise.addOutput(previewOutputPromise);
console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE : Success");
if (promise != null || promise != undefined) {
console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE data is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE PASSED");
}
else {
expect().assertFail();
console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE FAILED");
}
console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE ends here");
await sleep(1000);
done();
}
await sleep(1000);
done();
})
/**
* @tc.number : ADD_OUTPUT_PHOTO_SUCCESS
* @tc.name : Add output with photo output api
* @tc.desc : Add output with photo output api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('ADD_OUTPUT_PHOTO_SUCCESS', 0, async function (done) {
if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) {
console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS captureSession == null || undefined");
} else {
console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS to operate");
const promise = await CaptureSessionPromise.addOutput(photoOutputPromise);
console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS success");
if (promise != null || promise != undefined) {
console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS data is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS PASSED");
}
else {
expect().assertFail();
console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS FAILED: ");
}
console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS ends here");
await sleep(1000);
done();
}
await sleep(1000);
done();
})
/**
* @tc.number : COMMIT_CONFIG_SUCCESS
* @tc.name : commit config api
* @tc.desc : commit config api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('COMMIT_CONFIG_SUCCESS', 0, async function (done) {
if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) {
console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS captureSession == null || undefined");
} else {
console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS to operate");
const promise = await CaptureSessionPromise.commitConfig();
console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS commitConfig success");
if (promise != null || promise != undefined) {
console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS data is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS commitConfig PASSED");
}
else {
expect().assertFail();
console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS commitConfig FAILED");
console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS commitConfig ends here");
}
await sleep(1000);
done();
}
await sleep(1000);
done();
})
// callback related API
//preview callback
/**
* @tc.number : PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START
* @tc.name : Preview output callback on frame start api
* @tc.desc : Preview output callback on frame start api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START', 0, async function (done) {
if (previewOutputPromise == null || previewOutputPromise == undefined) {
console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START previewOutput == null || undefined");
} else {
console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START to operate");
previewOutputPromise.on("frameStart", async (err, data) => {
if (!err) {
console.info(TAG + "Preview frameStart Callback is success");
if (data != null || data != undefined) {
expect(true).assertTrue();
}
} else {
expect().assertFail()
}
await sleep(1000);
done();
})
await sleep(1000);
done();
}
})
/**
* @tc.number : PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END
* @tc.name : Preview capture callback on frame end api
* @tc.desc : Preview capture callback on frame end api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END', 0, async function (done) {
if (previewOutputPromise == null || previewOutputPromise == undefined) {
console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END previewOutput == null || undefined");
} else {
console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END to operate");
previewOutputPromise.on("frameEnd", async (err, data) => {
if (!err) {
console.info(TAG + "Preview frameEnd Callback is success");
if (data != null || data != undefined) {
expect(true).assertTrue();
}
} else {
expect().assertFail();
}
await sleep(1000);
done();
})
await sleep(1000);
done();
}
})
//Capture callback
/**
* @tc.number : PHOTO_CAP_CALLBACK_ON_CAPTURE_START
* @tc.name : Photo capture callback on capture start api
* @tc.desc : Photo capture callback on capture start api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('PHOTO_CAP_CALLBACK_ON_CAPTURE_START', 0, async function (done) {
if (photoOutputPromise == null || photoOutputPromise == undefined) {
console.info(TAG + "Entering PHOTO_CAP_CALLBACK_ON_CAPTURE_START photoOutput == null || undefined");
} else {
console.info(TAG + "Entering PHOTO_CAP_CALLBACK_ON_CAPTURE_START to operate");
photoOutputPromise.on("captureStart", async (err, data) => {
if (!err) {
console.info(TAG + "CaptureStart Callback is success");
if (data != null || data != undefined) {
console.info(TAG + "captureStart success with captureId: " + data);
expect(true).assertTrue();
}
} else {
expect().assertFail()
}
await sleep(1000);
done();
})
await sleep(1000);
done();
}
})
/**
* @tc.number : PHOTO_CAP_CALLBACK_ON_CAPTURE_END
* @tc.name : Photo capture callback on capture end api
* @tc.desc : Photo capture callback on capture end api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('PHOTO_CAP_CALLBACK_ON_CAPTURE_END', 0, async function (done) {
if (photoOutputPromise == null || photoOutputPromise == undefined) {
console.info(TAG + "Entering PHOTO_CAP_CALLBACK_ON_CAPTURE_END photoOutput == null || undefined");
} else {
console.info(TAG + "Entering PHOTO_CAP_CALLBACK_ON_CAPTURE_END to operate");
photoOutputPromise.on("captureEnd", async (err, data) => {
if (!err) {
console.info(TAG + "captureEnd callback is success");
if (data != null || data != undefined) {
console.info(TAG + "captureEnd callback with captureId: " + data.captureId);
console.info(TAG + "captureEnd callback with frameCount: " + data.frameCount);
expect(true).assertTrue();
}
} else {
expect().assertFail();
}
await sleep(1000);
done();
})
await sleep(1000);
done();
}
})
/**
* @tc.number : PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER
* @tc.name : Photo capture callback on frame shutter api
* @tc.desc : Photo capture callback on frame shutter api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER', 0, async function (done) {
if (photoOutputPromise == null || photoOutputPromise == undefined) {
console.info(TAG + "Entering PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER photoOutput == null || undefined");
} else {
console.info(TAG + "Entering PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER to operate");
photoOutputPromise.on("frameShutter", async (err, data) => {
if (!err) {
console.info(TAG + "frameShutter callback is success");
if (data != null || data != undefined) {
console.info(TAG + "frameShutter callback with captureId: " + data.captureId);
console.info(TAG + "frameShutter callback with timestamp: " + data.timestamp);
expect(true).assertTrue();
}
} else {
expect().assertFail();
}
await sleep(1000);
done();
})
await sleep(1000);
done();
}
})
/**
* @tc.number : CAPTURE_SESSION_START_SUCCESS
* @tc.name : capture session start api
* @tc.desc : capture session start api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CAPTURE_SESSION_START_SUCCESS', 0, async function (done) {
if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) {
console.info(TAG + "Entering CAPTURE_SESSION_START_SUCCESS captureSession == null || undefined");
} else {
console.info(TAG + "Entering CAPTURE_SESSION_START_SUCCESS to operate");
const promise = await CaptureSessionPromise.start();
console.info(TAG + "Entering captureSession start success");
if (promise != null || promise != undefined) {
console.info(TAG + "Entering CAPTURE_SESSION_START_SUCCESS data is not null || undefined" + promise);
expect(true).assertTrue();
console.info(TAG + "Entering CAPTURE_SESSION_START_SUCCESS PASSED");
}
console.info(TAG + "Entering CAPTURE_SESSION_START_SUCCESS ends here");
await sleep(1000);
done();
}
await sleep(1000);
done();
})
//FLASH Function API scripts
/**
* @tc.number : HAS_FLASH
* @tc.name : check if has flash-camera0Input api
* @tc.desc : check if has flash-camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('HAS_FLASH', 0, async function (done) {
console.info("--------------HAS_FLASH--------------");
console.info(TAG + 'hasFlash called.')
var hasFlashPromise = await camera0InputPromise.hasFlash();
console.info(TAG + "Entering HAS_FLASH success");
if (hasFlashPromise != null || hasFlashPromise != undefined) {
console.info(TAG + "Entering HAS_FLASH data is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "Entering HAS_FLASH PASSED with HAS_FLASH is: " + JSON.stringify(hasFlashPromise));
}
else {
expect().assertFail();
console.info(TAG + "Entering HAS_FLASH FAILED");
}
console.info(TAG + "Entering HAS_FLASH ends here");
await sleep(1000)
done();
})
/**
* @tc.number : IS_FLASH_MODE_OPEN_SUPPORTED
* @tc.name : check if flash mode open is supported-camera0Input api
* @tc.desc : check if flash mode open is supported-camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('IS_FLASH_MODE_OPEN_SUPPORTED', 0, async function (done) {
console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED to operate");
var isFMOpenSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_OPEN);
console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED SUCCESS ");
if (isFMOpenSupported != null || isFMOpenSupported != undefined) {
console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED data is not null || undefined");
console.info(TAG + "FLASH_MODE_OPEN supported is: " + JSON.stringify(isFMOpenSupported));
expect(true).assertTrue();
console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED PASSED");
}
else {
console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED FAILED");
console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED ends here");
}
await sleep(1000);
done();
})
/**
* @tc.number : SET_FLASH_MODE_OPEN
* @tc.name : set flash mode open camera0 api
* @tc.desc : set flash mode open camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_FLASH_MODE_OPEN', 0, async function (done) {
console.info(TAG + "Entering SET_FLASH_MODE_OPEN to operate");
var SetFMOpen = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_OPEN);
console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMOpen))
if (SetFMOpen == undefined) {
console.info(TAG + "Entering SET_FLASH_MODE_OPEN SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_OPEN);
console.info(TAG + "Entering SET_FLASH_MODE_OPEN PASSED")
expect(true).assertTrue()
} else {
expect().assertFail();
console.info(TAG + "Entering SET_FLASH_MODE_OPEN FAILED");
console.info(TAG + "Entering SET_FLASH_MODE_OPEN ends here");
}
await sleep(1000);
done();
})
/**
* @tc.number : GET_FLASH_MODE_OPEN
* @tc.name : get flash mode open camera0 api
* @tc.desc : get flash mode open camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_FLASH_MODE_OPEN', 0, async function (done) {
console.info(TAG + "Entering GET_FLASH_MODE_OPEN to operate");
var GetFMOpen = await camera0InputPromise.getFlashMode();
console.info(TAG + "Entering GET_FLASH_MODE_OPEN success: " + JSON.stringify(GetFMOpen));
if (GetFMOpen == 1) {
console.info(TAG + "GET_FLASH_MODE_OPEN data is not null || undefined: ");
console.info(TAG + "Current FlashMode is: " + JSON.stringify(GetFMOpen));
expect(true).assertTrue();
console.info(TAG + "GET_FLASH_MODE_OPEN PASSED");
}
else {
expect().assertFail();
console.info(TAG + "GET_FLASH_MODE_OPEN FAILED");
console.info(TAG + "GET_FLASH_MODE_OPEN ends here");
}
await sleep(1000);
done();
})
/**
* @tc.number : IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED
* @tc.name : check if flash mode always open is supported-camera0Input api
* @tc.desc : check if flash mode always open is supported-camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED', 0, async function (done) {
console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED to operate");
var isFMAlwaysOpenSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN);
console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED SUCCESS ");
if (isFMAlwaysOpenSupported != null || isFMAlwaysOpenSupported != undefined) {
console.info(TAG + "Entering FLASH_MODE_ALWAYS_OPEN data is not null || undefined");
console.info(TAG + "FLASH_MODE_OPEN supported is: " + isFMAlwaysOpenSupported);
expect(true).assertTrue();
console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED PASSED");
}
else {
console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED FAILED");
console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED ends here");
}
await sleep(1000);
done();
})
/**
* @tc.number : SET_FLASH_MODE_ALWAYS_OPEN
* @tc.name : set flash mode always open camera0 api
* @tc.desc : set flash mode always open camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_FLASH_MODE_ALWAYS_OPEN', 0, async function (done) {
console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN to operate");
var SetFMAlwaysOpen = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN);
console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMAlwaysOpen))
if (SetFMAlwaysOpen == undefined) {
console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN);
console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN PASSED")
expect(true).assertTrue()
} else {
expect().assertFail();
console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN FAILED");
console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN ends here");
}
await sleep(1000);
done();
})
/**
* @tc.number : GET_FLASH_MODE_ALWAYS_OPEN
* @tc.name : get flash mode always open camera0 api
* @tc.desc : get flash mode always open camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_FLASH_MODE_ALWAYS_OPEN', 0, async function (done) {
console.info(TAG + "Entering GET_FLASH_MODE_ALWAYS_OPEN to operate");
var GetFMAlwaysOpen = await camera0InputPromise.getFlashMode();
console.info(TAG + "Entering GET_FLASH_MODE_ALWAYS_OPEN success");
if (GetFMAlwaysOpen == 3) {
console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN data is not null || undefined: ");
console.info(TAG + "Current FlashMode is: " + GetFMAlwaysOpen);
expect(true).assertTrue();
console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN PASSED");
}
else {
expect().assertFail();
console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN FAILED");
console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN ends here");
}
await sleep(1000);
done();
})
/**
* @tc.number : IS_FLASH_MODE_AUTO_SUPPORTED
* @tc.name : check if flash mode always open is supported-camera0Input api
* @tc.desc : check if flash mode always open is supported-camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('IS_FLASH_MODE_AUTO_SUPPORTED', 0, async function (done) {
console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED to operate");
var isFMAutoSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_AUTO);
console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED SUCCESS ");
if (isFMAutoSupported != null || isFMAutoSupported != undefined) {
console.info(TAG + "Entering FLASH_MODE_AUTO data is not null || undefined");
console.info(TAG + "FLASH_MODE_AUTO supported is: " + isFMAutoSupported);
expect(isFMAutoSupported).assertEqual(false);
console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED PASSED");
}
else {
console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED FAILED");
console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED ends here");
}
await sleep(1000);
done();
})
/**
* @tc.number : PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS Rotation-0 & Quality-0
* @tc.name : Photo output capture with photosettings api
* @tc.desc : Photo output capture with photosettings api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS', 0, async function (done) {
if (photoOutputPromise == null || photoOutputPromise == undefined) {
console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS photoOutput == null || undefined");
} else {
console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS to operate");
const promise = photoOutputPromise.capture(photosettings1);
console.info(TAG + "Entering photoOutput capture with photosettings1 success");
if (promise != null || promise != undefined) {
console.info(TAG + "Entering photoOutput capture with photosettings1 data is not null || undefined");
console.info(TAG + "Entering photoOutput capture with photosettings1 PASSED");
expect(true).assertTrue();
}
else {
expect().assertFail();
console.info(TAG + "Entering photoOutput capture with photosettings1 FAILED");
console.info(TAG + "Entering photoOutput capture with photosettings1 ends here");
}
await sleep(1000);
done();
}
await sleep(1000);
done();
})
/**
* @tc.number : IS_FLASH_MODE_CLOSE_SUPPORTED
* @tc.name : check if flash mode close is supported-camera0Input api
* @tc.desc : check if flash mode close is supported-camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('IS_FLASH_MODE_CLOSE_SUPPORTED', 0, async function (done) {
console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED to operate");
var isFMCloseSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_CLOSE);
console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED SUCCESS ");
if (isFMCloseSupported != null || isFMCloseSupported != undefined) {
console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED data is not null || undefined");
console.info(TAG + "FLASH_MODE_CLOSE supported is: " + isFMCloseSupported);
expect(true).assertTrue();
console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED PASSED");
}
else {
console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED FAILED");
console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED ends here");
}
await sleep(1000);
done();
})
/**
* @tc.number : SET_FLASH_MODE_CLOSE
* @tc.name : set flash mode close camera0 api
* @tc.desc : set flash mode close camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_FLASH_MODE_CLOSE', 0, async function (done) {
console.info(TAG + "Entering SET_FLASH_MODE_CLOSE to operate");
var SetFMClose = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_CLOSE);
console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMClose))
if (SetFMClose == undefined) {
console.info(TAG + "Entering SET_FLASH_MODE_CLOSE SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_CLOSE);
console.info(TAG + "Entering SET_FLASH_MODE_CLOSE PASSED")
expect(true).assertTrue()
} else {
expect().assertFail();
console.info(TAG + "Entering SET_FLASH_MODE_CLOSE FAILED");
console.info(TAG + "Entering SET_FLASH_MODE_CLOSE ends here");
}
await sleep(1000);
done();
})
/**
* @tc.number : GET_FLASH_MODE_CLOSE
* @tc.name : get flash mode close camera0 api
* @tc.desc : get flash mode close camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_FLASH_MODE_CLOSE', 0, async function (done) {
console.info(TAG + "Entering GET_FLASH_MODE_CLOSE to operate");
var GetFMClose = await camera0InputPromise.getFlashMode();
console.info(TAG + "Entering GET_FLASH_MODE_CLOSE success");
if (GetFMClose == 0) {
console.info(TAG + "GET_FLASH_MODE_CLOSE data is not null || undefined: ");
console.info(TAG + "Current FlashMode is: " + GetFMClose);
expect(true).assertTrue();
console.info(TAG + "GET_FLASH_MODE_CLOSE PASSED");
}
else {
expect().assertFail();
console.info(TAG + "GET_FLASH_MODE_CLOSE FAILED");
console.info(TAG + "GET_FLASH_MODE_CLOSE ends here");
}
await sleep(1000);
done();
})
// FOCUS promise API's
/**
* @tc.number : IS_FOCUS_MODE_LOCKED_SUPPORTED
* @tc.name : check if flash mode close is supported-camera0Input api
* @tc.desc : check if flash mode close is supported-camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('IS_FOCUS_MODE_LOCKED_SUPPORTED', 0, async function (done) {
console.info(TAG + "Entering IS_FOCUS_MODE_LOCKED_SUPPORTED to operate");
var isFMLockedSupported = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_LOCKED);
console.info(TAG + "Entering IS_FOCUS_MODE_LOCKED_SUPPORTED SUCCESS ");
if (isFMLockedSupported != null || isFMLockedSupported != undefined) {
console.info(TAG + "Entering IS_FOCUS_MODE_LOCKED_SUPPORTED data is not null || undefined");
console.info(TAG + "IS_FOCUS_MODE_LOCKED_SUPPORTED: " + isFMLockedSupported);
expect(true).assertTrue();
console.info(TAG + "Entering IS_FOCUS_MODE_LOCKED_SUPPORTED PASSED");
}
else {
console.info(TAG + "Entering IS_FOCUS_MODE_LOCKED_SUPPORTED FAILED");
console.info(TAG + "Entering IS_FOCUS_MODE_LOCKED_SUPPORTED ends here");
}
await sleep(1000);
done();
})
/**
* @tc.number : SET_FOCUS_MODE_LOCKED
* @tc.name : set focus mode locked camera0 api
* @tc.desc : set focus mode locked camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_FOCUS_MODE_LOCKED', 0, async function (done) {
console.info(TAG + "Entering SET_FOCUS_MODE_LOCKED to operate");
var SetFMLocked = await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_LOCKED);
console.info(TAG + "SetFMLocked: " + JSON.stringify(SetFMLocked))
if (SetFMLocked == undefined) {
console.info(TAG + "Entering SET_FOCUS_MODE_LOCKED SUCCESS, current focusmode is: " + cameraObj.FocusMode.FOCUS_MODE_LOCKED);
console.info(TAG + "Entering SET_FOCUS_MODE_LOCKED PASSED")
expect(true).assertTrue()
} else {
expect().assertFail();
console.info(TAG + "Entering SET_FOCUS_MODE_LOCKED FAILED");
console.info(TAG + "Entering SET_FOCUS_MODE_LOCKED ends here");
}
await sleep(1000);
done();
})
/**
* @tc.number : GET_FOCUS_MODE_LOCKED
* @tc.name : get flash mode close camera0 api
* @tc.desc : get flash mode close camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_FOCUS_MODE_LOCKED', 0, async function (done) {
console.info(TAG + "Entering GET_FOCUS_MODE_LOCKED to operate");
var GetFMLocked = await camera0InputPromise.getFocusMode();
console.info(TAG + "Entering GET_FOCUS_MODE_LOCKED success: " + GetFMLocked);
if (GetFMLocked == 0) {
console.info(TAG + "Current focusmode is: " + GetFMLocked);
expect(true).assertTrue();
console.info(TAG + "GET_FOCUS_MODE_LOCKED PASSED");
}
else {
expect().assertFail();
console.info(TAG + "GET_FOCUS_MODE_LOCKED FAILED");
console.info(TAG + "GET_FOCUS_MODE_LOCKED ends here");
}
await sleep(1000);
done();
})
/**
* @tc.number : IS_FOCUS_MODE_MANUAL_SUPPORTED
* @tc.name : is focusmode manual supported
* @tc.desc : is focusmode manual supported
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('IS_FOCUS_MODE_MANUAL_SUPPORTED', 0, async function (done) {
console.info(TAG + "Entering IS_FOCUS_MODE_MANUAL_SUPPORTED to operate");
var isFMmanualSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_MANUAL);
if (isFMmanualSupportedpromise != null || isFMmanualSupportedpromise != undefined) {
console.info(TAG + "Entering IS_FOCUS_MODE_MANUAL_SUPPORTED data is not null || undefined");
console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + isFMmanualSupportedpromise);
expect(true).assertTrue();
console.info(TAG + "Entering IS_FOCUS_MODE_MANUAL_SUPPORTED PASSED: ");
}
else {
console.info(TAG + "IS_FOCUS_MODE_MANUAL_SUPPORTED FAILED");
expect().assertFail();
console.info(TAG + "IS_FOCUS_MODE_MANUAL_SUPPORTED ends here");
}
await sleep(1000);
done();
})
/**
* @tc.number : SET_FOCUS_MODE_MANUAL
* @tc.name : set focus mode manual camera0 api
* @tc.desc : set focus mode manual camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_FOCUS_MODE_MANUAL', 0, async function (done) {
console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL to operate");
var setFocusManual = await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_MANUAL);
console.info(TAG + "setFocusManual: " + JSON.stringify(setFocusManual))
if (setFocusManual == undefined) {
console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_MANUAL);
console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL PASSED")
expect(true).assertTrue()
}
else {
expect().assertFail();
console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL FAILED");
console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL ends here");
}
await sleep(1000);
done();
})
/**
* @tc.number : GET_FOCUS_MODE_MANUAL
* @tc.name : get focus mode manual camera0 api
* @tc.desc : get focus mode manual camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_FOCUS_MODE_MANUAL', 0, async function (done) {
console.info(TAG + "Entering GET_FOCUS_MODE_MANUAL to operate");
var getfocusmodepromise = await camera0InputPromise.getFocusMode();
console.info(TAG + "Entering GET_FOCUS_MODE_MANUAL SUCCESS");
if (getfocusmodepromise == 0) {
console.info(TAG + "Current FocusMode is: " + getfocusmodepromise);
expect(true).assertTrue();
console.info(TAG + "GET_FOCUS_MODE_MANUAL PASSED");
}
else {
expect().assertFail();
console.info(TAG + "GET_FOCUS_MODE_MANUAL FAILED");
console.info(TAG + "GET_FOCUS_MODE_MANUAL ends here");
}
await sleep(1000);
done();
})
/**
* @tc.number : IS_FOCUS_MODE_CONTINUOUS_SUPPORTED
* @tc.name : check if focus mode continuous is supported-camera0Input api
* @tc.desc : check if focus mode continuous is supported-camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('IS_FOCUS_MODE_CONTINUOUS_SUPPORTED', 0, async function (done) {
console.info(TAG + "Entering IS_FOCUS_MODE_CONTINUOUS_SUPPORTED to operate");
var isFMContinuousSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO);
if (isFMContinuousSupportedpromise != null || isFMContinuousSupportedpromise != undefined) {
console.info(TAG + "Entering IS_FOCUS_MODE_CONTINUOUS_SUPPORTED data is not null || undefined");
console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + isFMContinuousSupportedpromise);
expect(true).assertTrue();
console.info(TAG + "Entering IS_FOCUS_MODE_CONTINUOUS_SUPPORTED PASSED: ");
}
else {
console.info(TAG + "IS_FOCUS_MODE_CONTINUOUS_SUPPORTED FAILED");
expect().assertFail();
console.info(TAG + "IS_FOCUS_MODE_CONTINUOUS_SUPPORTED ends here");
}
await sleep(1000);
done();
})
/**
* @tc.number : SET_FOCUS_MODE_CONTINUOUS
* @tc.name : set focus mode continuous camera0 api
* @tc.desc : set focus mode continuous camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_FOCUS_MODE_CONTINUOUS', 0, async function (done) {
console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS to operate");
var setFocusCont = await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO);
console.info(TAG + "setFocusCont: " + JSON.stringify(setFocusCont))
if (setFocusCont == undefined) {
console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO);
console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS PASSED")
expect(true).assertTrue()
}
else {
expect().assertFail();
console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS FAILED");
console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS ends here");
}
await sleep(1000);
done();
})
/**
* @tc.number : GET_FOCUS_MODE_CONTINUOUS
* @tc.name : get focus mode continuous camera0 api
* @tc.desc : get focus mode continuous camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_FOCUS_MODE_CONTINUOUS', 0, async function (done) {
console.info(TAG + "Entering GET_FOCUS_MODE_CONTINUOUS to operate");
var getfocusmodepromise = await camera0InputPromise.getFocusMode();
console.info(TAG + "Entering GET_FOCUS_MODE_CONTINUOUS SUCCESS");
if (getfocusmodepromise == 1) {
console.info(TAG + "Current FocusMode is: " + getfocusmodepromise);
expect(true).assertTrue();
console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS PASSED");
}
else {
expect().assertFail();
console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS FAILED");
console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS ends here");
}
await sleep(1000);
done();
})
/**
* @tc.number : IS_FOCUS_MODE_AUTO_SUPPORTED
* @tc.name : check if focus mode auto is supported-camera0Input api
* @tc.desc : check if focus mode auto is supported-camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('IS_FOCUS_MODE_AUTO_SUPPORTED', 0, async function (done) {
console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED to operate");
var isFMAutoSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO);
if (isFMAutoSupportedpromise != null || isFMAutoSupportedpromise != undefined) {
console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED data is not null || undefined");
console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + isFMAutoSupportedpromise);
expect(true).assertTrue();
console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED PASSED: ");
}
else {
console.info(TAG + "IS_FOCUS_MODE_AUTO_SUPPORTED FAILED");
expect().assertFail();
console.info(TAG + "IS_FOCUS_MODE_AUTO_SUPPORTED ends here");
}
await sleep(1000);
done();
})
/**
* @tc.number : SET_FOCUS_MODE_AUTO
* @tc.name : set focus mode auto camera0 api
* @tc.desc : set focus mode auto camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_FOCUS_MODE_AUTO', 0, async function (done) {
console.info(TAG + "Entering SET_FOCUS_MODE_AUTO to operate");
var setFocusAuto = await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO);
console.info(TAG + "setFocusAuto: " + JSON.stringify(setFocusAuto))
if (setFocusAuto == undefined) {
console.info(TAG + "Entering SET_FOCUS_MODE_AUTO SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_AUTO);
console.info(TAG + "Entering SET_FOCUS_MODE_AUTO PASSED")
expect(true).assertTrue()
}
else {
expect().assertFail();
console.info(TAG + "Entering SET_FOCUS_MODE_AUTO FAILED");
console.info(TAG + "Entering SET_FOCUS_MODE_AUTO ends here");
}
await sleep(1000);
done();
})
/**
* @tc.number : GET_FOCUS_MODE_AUTO
* @tc.name : get focus mode auto camera0 api
* @tc.desc : get focus mode auto camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_FOCUS_MODE_AUTO', 0, async function (done) {
console.info(TAG + "Entering GET_FOCUS_MODE_AUTO to operate");
var getfocusmodepromise = await camera0InputPromise.getFocusMode();
console.info(TAG + "Entering GET_FOCUS_MODE_AUTO SUCCESS");
if (getfocusmodepromise == 2) {
console.info(TAG + "Current FocusMode is: " + getfocusmodepromise);
expect(true).assertTrue();
console.info(TAG + "GET_FOCUS_MODE_AUTO PASSED");
}
else {
expect().assertFail();
console.info(TAG + "GET_FOCUS_MODE_AUTO FAILED");
console.info(TAG + "GET_FOCUS_MODE_AUTO ends here");
}
await sleep(1000);
done();
})
/**
* @tc.number : PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS with Rotation-90 & Quality-1
* @tc.name : Photo output capture with photosettings api
* @tc.desc : Photo output capture with photosettings api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS', 0, async function (done) {
if (photoOutputPromise == null || photoOutputPromise == undefined) {
console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS photoOutput == null || undefined");
} else {
console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS to operate");
const promise = photoOutputPromise.capture(photosettings2);
console.info(TAG + "Entering photoOutput capture with photosettings2 success");
if (promise != null || promise != undefined) {
console.info(TAG + "Entering photoOutput capture with photosettings2 data is not null || undefined");
console.info(TAG + "Entering photoOutput capture with photosettings2 PASSED");
expect(true).assertTrue();
}
else {
expect().assertFail();
console.info(TAG + "Entering photoOutput capture with photosettings2 FAILED");
console.info(TAG + "Entering photoOutput capture with photosettings2 ends here");
}
await sleep(1000);
done();
}
await sleep(1000);
done();
})
/**
* @tc.number : PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS with Rotation-180 & Quality-2
* @tc.name : Photo output capture with photosettings api
* @tc.desc : Photo output capture with photosettings api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS', 0, async function (done) {
if (photoOutputPromise == null || photoOutputPromise == undefined) {
console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS photoOutput == null || undefined");
} else {
console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS to operate");
const promise = photoOutputPromise.capture(photosettings3);
console.info(TAG + "Entering photoOutput capture with photosettings3 success");
if (promise != null || promise != undefined) {
console.info(TAG + "Entering photoOutput capture with photosettings3 data is not null || undefined");
console.info(TAG + "Entering photoOutput capture with photosettings3 PASSED");
expect(true).assertTrue();
}
else {
expect().assertFail();
console.info(TAG + "Entering photoOutput capture with photosettings3 FAILED");
console.info(TAG + "Entering photoOutput capture with photosettings3 ends here");
}
await sleep(1000);
done();
}
await sleep(1000);
done();
})
/**
* @tc.number : PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS with Rotation-270
* @tc.name : Photo output capture with photosettings api
* @tc.desc : Photo output capture with photosettings api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS', 0, async function (done) {
if (photoOutputPromise == null || photoOutputPromise == undefined) {
console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS photoOutput == null || undefined");
} else {
console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS to operate");
const promise = photoOutputPromise.capture(photosettings4);
console.info(TAG + "Entering photoOutput capture with photosettings4 success");
if (promise != null || promise != undefined) {
console.info(TAG + "Entering photoOutput capture with photosettings4 data is not null || undefined");
console.info(TAG + "Entering photoOutput capture with photosettings4 PASSED");
expect(true).assertTrue();
}
else {
expect().assertFail();
console.info(TAG + "Entering photoOutput capture with photosettings4 FAILED");
console.info(TAG + "Entering photoOutput capture with photosettings4 ends here");
}
await sleep(1000);
done();
}
await sleep(1000);
done();
})
//ZOOM Function
/**
* @tc.number : GET_ZOOM_RATIO_PROMISE
* @tc.name : get zoom ratio camera-0 cameraId api promise api
* @tc.desc : get zoom ratio camera-0 cameraId api promise api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_ZOOM_RATIO_PROMISE', 0, async function (done) {
console.info("--------------GET_ZOOM_RATIO_PROMISE--------------");
var getZoomRatioPromise = await camera0InputPromise.getZoomRatioRange();
console.info(TAG + "Entering GET_ZOOM_RATIO_PROMISE getZoomRatioPromise: " + JSON.stringify(getZoomRatioPromise));
if (getZoomRatioPromise != null && getZoomRatioPromise != undefined) {
console.info(TAG + "Entering GET_ZOOM_RATIO_PROMISE setZoomRatioPromise is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "Entering GET_ZOOM_RATIO_PROMISE success: " + JSON.stringify(getZoomRatioPromise));
console.info(TAG + "Entering GET_ZOOM_RATIO_PROMISE PASSED");
} else {
expect().assertFail();
console.info(TAG + "Entering GET_ZOOM_RATIO_PROMISE FAILED");
}
console.info(TAG + "Entering GET_ZOOM_RATIO_PROMISE ends here");
await sleep(1000);
done();
})
/**
* @tc.number : SET_GET_ZOOM_1_PROMISE
* @tc.name : Zoom camera-0 cameraId api
* @tc.desc : Zoom camera-0 cameraId api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_GET_ZOOM_1_PROMISE', 0, async function (done) {
var setpromise = await camera0InputPromise.setZoomRatio(1);
console.info(TAG + "setZoomRatio success: 1");
console.info(TAG + "getZoomRatio called")
var getpromise1 = await camera0InputPromise.getZoomRatio();
console.info(TAG + "getZoomRatio success: " + getpromise1);
if (getpromise1 != null && getpromise1 != undefined) {
expect(getpromise1).assertEqual(1);
console.info(TAG + "SET_GET_ZOOM_1_PROMISE PASSED ");
}
else {
expect().assertFail();
console.info(TAG + "SET_GET_ZOOM_1_PROMISE FAILED");
}
await sleep(1000);
done();
})
/**
* @tc.number : SET_GET_ZOOM_2_PROMISE
* @tc.name : Zoom camera-0 cameraId api
* @tc.desc : Zoom camera-0 cameraId api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_GET_ZOOM_2_PROMISE', 0, async function (done) {
var setpromise = await camera0InputPromise.setZoomRatio(2);
console.info(TAG + "setZoomRatio success: 2");
console.info(TAG + "getZoomRatio called")
var getpromise2 = await camera0InputPromise.getZoomRatio();
console.info(TAG + "getZoomRatio success: " + getpromise2);
if (getpromise2 != null && getpromise2 != undefined) {
expect(getpromise2).assertEqual(2);
console.info(TAG + "SET_GET_ZOOM_2_PROMISE PASSED ");
}
else {
expect().assertFail();
console.info(TAG + "SET_GET_ZOOM_2_PROMISE FAILED");
}
await sleep(1000);
done();
})
/**
* @tc.number : SET_GET_ZOOM_3_PROMISE
* @tc.name : Zoom camera-0 cameraId api
* @tc.desc : Zoom camera-0 cameraId api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_GET_ZOOM_3_PROMISE', 0, async function (done) {
var setpromise = await camera0InputPromise.setZoomRatio(3);
console.info(TAG + "setZoomRatio success: 3");
console.info(TAG + "getZoomRatio called")
var getpromise3 = await camera0InputPromise.getZoomRatio();
console.info(TAG + "getZoomRatio success: " + getpromise3);
if (getpromise3 != null && getpromise3 != undefined) {
expect(getpromise3).assertEqual(3);
console.info(TAG + "SET_GET_ZOOM_3_PROMISE PASSED ");
}
else {
expect().assertFail();
console.info(TAG + "SET_GET_ZOOM_3_PROMISE FAILED");
}
await sleep(1000);
done();
})
/**
* @tc.number : SET_GET_ZOOM_4_PROMISE
* @tc.name : Zoom camera-0 cameraId api
* @tc.desc : Zoom camera-0 cameraId api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_GET_ZOOM_4_PROMISE', 0, async function (done) {
var setpromise = await camera0InputPromise.setZoomRatio(4);
console.info(TAG + "setZoomRatio success: 4");
console.info(TAG + "getZoomRatio called")
var getpromise4 = await camera0InputPromise.getZoomRatio();
console.info(TAG + "getZoomRatio success: " + getpromise4);
if (getpromise4 != null && getpromise4 != undefined) {
expect(getpromise4).assertEqual(4);
console.info(TAG + "SET_GET_ZOOM_4_PROMISE PASSED ");
}
else {
expect().assertFail();
console.info(TAG + "SET_GET_ZOOM_4_PROMISE FAILED");
}
await sleep(1000);
done();
})
/**
* @tc.number : SET_GET_ZOOM_5_PROMISE
* @tc.name : Zoom camera-0 cameraId api
* @tc.desc : Zoom camera-0 cameraId api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_GET_ZOOM_5_PROMISE', 0, async function (done) {
var setpromise = await camera0InputPromise.setZoomRatio(5);
console.info(TAG + "setZoomRatio success: 5");
console.info(TAG + "getZoomRatio called")
var getpromise5 = await camera0InputPromise.getZoomRatio();
console.info(TAG + "getZoomRatio success: " + getpromise5);
if (getpromise5 != null && getpromise5 != undefined) {
expect(getpromise5).assertEqual(5);
console.info(TAG + "SET_GET_ZOOM_5_PROMISE PASSED ");
}
else {
expect().assertFail();
console.info(TAG + "SET_GET_ZOOM_5_PROMISE FAILED");
}
await sleep(1000);
done();
})
/**
* @tc.number : SET_GET_ZOOM_6_PROMISE
* @tc.name : Zoom camera-0 cameraId api
* @tc.desc : Zoom camera-0 cameraId api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_GET_ZOOM_6_PROMISE', 0, async function (done) {
var setpromise = await camera0InputPromise.setZoomRatio(6);
console.info(TAG + "setZoomRatio success: 6");
console.info(TAG + "getZoomRatio called")
var getpromise6 = await camera0InputPromise.getZoomRatio();
console.info(TAG + "getZoomRatio success: " + getpromise6);
if (getpromise6 != null && getpromise6 != undefined) {
expect(getpromise6).assertEqual(6);
console.info(TAG + "SET_GET_ZOOM_6_PROMISE PASSED ");
}
else {
expect().assertFail();
console.info(TAG + "SET_GET_ZOOM_6_PROMISE FAILED");
}
await sleep(1000);
done();
})
/**
* @tc.number : PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS
* @tc.name : Photo output capture with photosettings api
* @tc.desc : Photo output capture with photosettings api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS', 0, async function (done) {
if (photoOutputPromise == null || photoOutputPromise == undefined) {
console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS photoOutput == null || undefined");
} else {
console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS to operate");
const promise = photoOutputPromise.capture(photosettings1);
console.info(TAG + "Entering photoOutput capture with photosettings1 success");
if (promise != null || promise != undefined) {
console.info(TAG + "Entering photoOutput capture with photosettings1 data is not null || undefined");
console.info(TAG + "Entering photoOutput capture with photosettings1 PASSED");
expect(true).assertTrue();
}
else {
expect().assertFail();
console.info(TAG + "Entering photoOutput capture with photosettings1 FAILED");
}
console.info(TAG + "Entering photoOutput capture with photosettings1 ends here");
await sleep(1000);
done();
}
await sleep(1000);
done();
})
/*CaptureSession APIs test script*/
/**
* @tc.number : CAPTURE_SESSION_STOP_SUCCESS_PROMISE
* @tc.name : capture session stop api
* @tc.desc : capture session stop api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CAPTURE_SESSION_STOP_SUCCESS_PROMISE', 0, async function (done) {
if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) {
console.info(TAG + "Entering CAPTURE_SESSION_STOP_SUCCESS_PROMISE captureSession == null || undefined");
} else {
console.info(TAG + "Entering CAPTURE_SESSION_STOP_SUCCESS_PROMISE to operate");
const promise = await CaptureSessionPromise.stop();
console.info(TAG + "Entering CAPTURE_SESSION_STOP_SUCCESS_PROMISE captureSession.stop promise: " + JSON.stringify(promise));
if (promise != null || promise != undefined) {
expect(true).assertTrue();
console.info(TAG + "Entering CAPTURE_SESSION_STOP_SUCCESS_PROMISE captureSession.stop PASSED");
}
console.info(TAG + "Entering CAPTURE_SESSION_STOP_SUCCESS_PROMISE captureSession.stop ends here");
await sleep(1000);
done();
}
await sleep(1000);
done();
})
/**
* @tc.number : CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE
* @tc.name : capture session release api
* @tc.desc : capture session release api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE', 0, async function (done) {
if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) {
console.info(TAG + "Entering CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE captureSession == null || undefined");
} else {
console.info(TAG + "Entering CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE to operate");
const promise = await CaptureSessionPromise.release();
console.info(TAG + "Entering captureSession.release promise: " + JSON.stringify(promise));
if (promise != null || promise != undefined) {
expect(true).assertTrue();
console.info(TAG + "Entering captureSession.release PASSED");
}
console.info(TAG + "Entering captureSession.release ends here");
await sleep(1000);
done();
}
await sleep(1000);
done();
})
/**
* @tc.number : PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE
* @tc.name : PreviewOutput release api
* @tc.desc : PreviewOutput release api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE', 0, async function (done) {
if (previewOutputPromise == null || previewOutputPromise == undefined) {
console.info(TAG + "Entering PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE previewOutputPromise == null || undefined");
} else {
console.info(TAG + "Entering PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE to operate");
const promise = await previewOutputPromise.release();
console.info(TAG + "Entering previewOutputPromise.release promise: " + JSON.stringify(promise));
if (promise != null || promise != undefined) {
expect(true).assertTrue();
console.info(TAG + "Entering previewOutputPromise.release PASSED");
}
console.info(TAG + "Entering previewOutputPromise.release ends here");
await sleep(1000);
done();
}
await sleep(1000);
done();
})
/**
* @tc.number : PHOTOOUTPUT_RELEASE_SUCCESS_PROMISE
* @tc.name : PhotoOutput release api
* @tc.desc : PhotoOutput release api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('PHOTOOUTPUT_RELEASE_SUCCESS_PROMISE', 0, async function (done) {
if (photoOutputPromise == null || photoOutputPromise == undefined) {
console.info(TAG + "Entering PHOTOOUTPUT_RELEASE_SUCCESS_PROMISE photoOutputPromise == null || undefined");
} else {
console.info(TAG + "Entering PHOTOOUTPUT_RELEASE_SUCCESS_PROMISE to operate");
const promise = await photoOutputPromise.release();
console.info(TAG + "Entering photoOutputPromise.release promise: " + JSON.stringify(promise));
if (promise != null || promise != undefined) {
expect(true).assertTrue();
console.info(TAG + "Entering photoOutputPromise.release PASSED");
}
console.info(TAG + "Entering photoOutputPromise.release ends here");
await sleep(1000);
done();
}
await sleep(1000);
done();
})
/**
* @tc.number : CAMERAINPUT_RELEASE_SUCCESS_PROMISE
* @tc.name : cameraInput release api
* @tc.desc : cameraInput release api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CAMERAINPUT_RELEASE_SUCCESS_PROMISE', 0, async function (done) {
if (camera0InputPromise == null || camera0InputPromise == undefined) {
console.info(TAG + "Entering CAMERAINPUT_RELEASE_SUCCESS_PROMISE camera0InputPromise == null || undefined");
} else {
console.info(TAG + "Entering CAMERAINPUT_RELEASE_SUCCESS_PROMISE to operate");
const promise = await camera0InputPromise.release();
console.info(TAG + "Entering camera0InputPromise.release promise: " + JSON.stringify(promise));
if (promise != null || promise != undefined) {
expect(true).assertTrue();
console.info(TAG + "Entering camera0InputPromise.release PASSED");
}
console.info(TAG + "Entering camera0InputPromise.release ends here");
await sleep(1000);
done();
}
await sleep(1000);
done();
})
});
}
\ 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 cameraObj from '@ohos.multimedia.camera'
import media from '@ohos.multimedia.media'
import mediaLibrary from '@ohos.multimedia.mediaLibrary'
import fileio from '@ohos.fileio';
import abilityAccessCtrl from '@ohos.abilityAccessCtrl'
import bundle from '@ohos.bundle'
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index';
let TAG = 'CameraModuleTest: '
var cameraManager
var camerasArray
var camera0Input
var previewOutput
var videoRecorder
let fdPath;
let fileAsset;
let fdNumber;
let configFile = {
audioBitrate: 48000,
audioChannels: 2,
audioCodec: 'audio/mp4a-latm',
audioSampleRate: 48000,
durationTime: 1000,
fileFormat: 'mp4',
videoBitrate: 48000,
videoCodec: 'video/mp4v-es',
videoFrameWidth: 640,
videoFrameHeight: 480,
videoFrameRate: 10
}
let videoConfig = {
audioSourceType: 1,
videoSourceType: 0,
profile: configFile,
url: 'file:///data/media/01.mp4',
orientationHint: 0,
location: { latitude: 30, longitude: 130 },
maxSize: 100,
maxDuration: 500
}
var videoId
var videoOutput
var captureSession
export default function cameraJSUnitVideoAsync(surfaceId: any) {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve(1)
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
async function applyPermission() {
let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100);
let atManager = abilityAccessCtrl.createAtManager();
if (atManager != null) {
let tokenID = appInfo.accessTokenId;
console.info('[permission] case accessTokenID is ' + tokenID);
let permissionName1 = 'ohos.permission.CAMERA';
let permissionName2 = 'ohos.permission.MICROPHONE';
let permissionName3 = 'ohos.permission.MEDIA_LOCATION';
let permissionName4 = 'ohos.permission.READ_MEDIA';
let permissionName5 = 'ohos.permission.WRITE_MEDIA';
await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName5, 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');
}
}
async function getFd(pathName) {
let displayName = pathName;
const mediaTest = mediaLibrary.getMediaLibrary();
let fileKeyObj = mediaLibrary.FileKey;
let mediaType = mediaLibrary.MediaType.VIDEO;
let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO);
let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath);
if (dataUri != undefined) {
let args = dataUri.id.toString();
let fetchOp = {
selections: fileKeyObj.ID + "=?",
selectionArgs: [args],
}
let fetchFileResult = await mediaTest.getFileAssets(fetchOp);
fileAsset = await fetchFileResult.getAllObject();
fdNumber = await fileAsset[0].open('Rw');
fdPath = "fd://" + fdNumber.toString();
}
}
async function closeFd() {
if (fileAsset != null) {
await fileAsset[0].close(fdNumber).then(() => {
console.info('[mediaLibrary] case close fd success');
}).catch((err) => {
console.info('[mediaLibrary] case close fd failed');
});
} else {
console.info('[mediaLibrary] case fileAsset is null');
}
}
async function getvideosurface() {
await getFd('02.mp4');
videoConfig.url = fdPath;
media.createVideoRecorder((err, recorder) => {
console.info(TAG + 'createVideoRecorder called')
videoRecorder = recorder
console.info(TAG + 'videoRecorder is :' + JSON.stringify(videoRecorder))
console.info(TAG + 'videoRecorder.prepare called.')
videoRecorder.prepare(videoConfig, (err) => {
console.info(TAG + 'videoRecorder.prepare success.')
})
videoRecorder.getInputSurface((err, id) => {
console.info(TAG + 'getInputSurface called')
videoId = id
console.info(TAG + 'getInputSurface surfaceId: ' + JSON.stringify(videoId))
})
})
}
describe('VideoModeAsync', function () {
console.info(TAG + '----------Camera-VideoMode-Async--------------')
beforeAll(async function () {
await applyPermission();
console.info('beforeAll case');
})
beforeEach(function () {
sleep(5);
console.info('beforeEach case');
})
afterEach(async function () {
await closeFd();
console.info('afterEach case');
})
afterAll(function () {
console.info('afterAll case');
})
/**
* @tc.number : GET_CAMERA_MANAGER_TC
* @tc.name : Create camera manager instance async api
* @tc.desc : Create camera manager instance async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_CAMERA_MANAGER_TC', 0, async function (done) {
console.info('--------------GET_CAMERA_MANAGER_TC--------------')
await sleep(1)
cameraObj.getCameraManager(null, (err, data) => {
if (!err) {
console.info(TAG + 'Entering GET_CAMERA_MANAGER_TC success')
if (data != null || data != undefined) {
console.info(TAG + 'Entering GET_CAMERA_MANAGER_TC data is not null || undefined')
cameraManager = data
expect(true).assertTrue()
console.info(TAG + 'Entering GET_CAMERA_MANAGER_TC PASSED')
}
} else {
expect().assertFail()
console.info(TAG + 'Entering GET_CAMERA_MANAGER_TC FAILED: ' + err.message)
}
console.info(TAG + 'Entering GET_CAMERA_MANAGER_TC ends here')
done()
})
await sleep(1)
done()
})
/**
* @tc.number : CAMERA_STATUS_CALLBACK
* @tc.name : camera status callback on CameraManager async api
* @tc.desc : camera status callback on CameraManager async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CAMERA_STATUS_CALLBACK', 0, async function (done) {
if (cameraManager == null || cameraManager == undefined) {
console.info(TAG + 'Entering CAMERA_STATUS_CALLBACK cameraManager == null || undefined')
} else {
console.info(TAG + 'Entering CAMERA_STATUS_CALLBACK to operate')
cameraManager.on("cameraStatus", async (err, data) => {
if (!err) {
console.info(TAG + "Camera status Callback on cameraManager is success");
if (data != null || data != undefined) {
console.info(TAG + "Camera status Callback CameraStatusInfo_Camera: " + data.camera);
console.info(TAG + "Camera status Callback CameraStatusInfo_Status: " + data.status);
expect(true).assertTrue();
}
} else {
expect().assertFail();
}
await sleep(1);
done();
})
await sleep(1);
done();
}
})
/**
* @tc.number : GET_CAMERAS
* @tc.name : Create camera manager instance async api
* @tc.desc : Create camera manager instance async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_CAMERAS', 0, async function (done) {
console.info('--------------GET_CAMERAS--------------')
await sleep(1)
cameraManager.getCameras((err, data) => {
if (!err) {
console.info(TAG + 'Entering GET_CAMERAS success')
if (data != null || data != undefined) {
console.info(TAG + 'Entering GET_CAMERAS data is not null || undefined')
camerasArray = data
if (camerasArray != null && camerasArray.length > 0) {
for (var i = 0; i < camerasArray.length; i++) {
// Get the variables from camera object
var cameraId = camerasArray[i].cameraId
console.info(TAG + 'Entering GET_CAMERAS camera' + i + 'Id: ' + cameraId)
var cameraPosition = camerasArray[i].cameraPosition
console.info(TAG + 'Entering GET_CAMERAS camera' + i + 'Position: ' + cameraPosition)
var cameraType = camerasArray[i].cameraType
console.info(TAG + 'Entering GET_CAMERAS camera' + i + 'Type: ' + cameraType)
var connectionType = camerasArray[i].connectionType
console.info(TAG + 'Entering GET_CAMERAS connection' + i + 'Type: ' + connectionType)
}
expect(true).assertTrue()
console.info(TAG + 'Entering GET_CAMERAS PASSED')
} else {
expect().assertFail()
console.info(TAG + 'Entering GET_CAMERAS FAILED cameraArray is null || undefined')
}
}
} else {
expect().assertFail()
console.info(TAG + 'Entering GET_CAMERAS FAILED: ' + err.message)
}
console.info(TAG + 'Entering GET_CAMERAS ends here')
done()
})
await sleep(1)
done()
})
/*CAMERA-0 Scripts*/
/**
* @tc.number : CREATE_CAMERA_INPUT
* @tc.name : Create camerainput from camera-0 cameraId async api
* @tc.desc : Create camerainput from camera-0 cameraId async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CREATE_CAMERA_INPUT', 0, async function (done) {
console.info('--------------CAMERA-0 STARTS HERE--------------')
console.info('--------------CREATE_CAMERA_INPUT--------------')
await sleep(1)
cameraManager.createCameraInput(camerasArray[0].cameraId, (err, data) => {
if (!err) {
if (data != null && data != undefined) {
console.info(TAG + 'Entering CREATE_CAMERA_INPUT data is not null || undefined')
camera0Input = data
expect(true).assertTrue()
console.info(TAG + 'Entering CREATE_CAMERA_INPUT PASSED with CameraID :' + camerasArray[0].cameraId)
}
} else {
expect().assertFail()
console.info(TAG + 'Entering CREATE_CAMERA_INPUT FAILED: ' + err.message)
}
console.info(TAG + 'Entering CREATE_CAMERA_INPUT ends here')
done()
})
await sleep(1)
done()
})
/**
* @tc.number : CAMERA_INPUT_CALLBACK_ON_ERROR
* @tc.name : Photo output callback on error api
* @tc.desc : Photo output callback on error api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CAMERA_INPUT_CALLBACK_ON_ERROR', 0, async function (done) {
if (camera0Input == null || camera0Input == undefined) {
console.info(TAG + "Entering CAMERA_INPUT_CALLBACK_ON_ERROR camera0Input == null || undefined");
} else {
console.info(TAG + "Entering CAMERA_INPUT_CALLBACK_ON_ERROR to operate");
camera0Input.on("error", async (err, data) => {
if (!err) {
console.info(TAG + "camera0Input error callback is success");
if (data != null || data != undefined) {
console.info(TAG + "Error during camera0Input with ErrorCode: " + data.code);
expect(true).assertTrue();
}
} else {
expect().assertFail();
}
await sleep(1);
done();
})
await sleep(1);
done();
}
})
/**
* @tc.number : CREATE_PREVIEW_OUTPUT
* @tc.name : Create previewoutput async api
* @tc.desc : Create previewoutput async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CREATE_PREVIEW_OUTPUT', 0, async function (done) {
console.info(TAG + 'Entering CREATE_PREVIEW_OUTPUT to operate')
await sleep(1)
cameraObj.createPreviewOutput(surfaceId, (err, data) => {
if (!err) {
console.info(TAG + 'Entering CREATE_PREVIEW_OUTPUT success')
if (data != null || data != undefined) {
console.info(TAG + 'Entering CREATE_PREVIEW_OUTPUT data is not null || undefined')
previewOutput = data
expect(true).assertTrue()
console.info(TAG + 'Entering CREATE_PREVIEW_OUTPUT PASSED')
}
} else {
console.info(TAG + 'Entering CREATE_PREVIEW_OUTPUT FAILED: ' + err.message)
}
console.info(TAG + 'Entering CREATE_PREVIEW_OUTPUT ends here')
done()
})
await sleep(1)
done()
})
/**
* @tc.number : PREVIEW_OUTPUT_CALLBACK_ON_ERROR
* @tc.name : Preview output callback on error api
* @tc.desc : Preview output callback on error api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('PREVIEW_OUTPUT_CALLBACK_ON_ERROR', 0, async function (done) {
if (previewOutput == null || previewOutput == undefined) {
console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_ERROR previewOutput == null || undefined");
} else {
console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_ERROR to operate");
previewOutput.on("error", async (err, data) => {
if (!err) {
console.info(TAG + "PreviewOutputError callback is success");
if (data != null || data != undefined) {
console.info(TAG + "Error during PreviewOutput with ErrorCode: " + data.code);
expect(true).assertTrue();
}
} else {
expect().assertFail();
}
await sleep(1);
done();
})
await sleep(1);
done();
}
})
/**
* @tc.number : CREATE_VIDEO_OUTPUT
* @tc.name : Create videooutput async api
* @tc.desc : Create videooutput async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CREATE_VIDEO_OUTPUT', 0, async function (done) {
console.info(TAG + 'Entering CREATE_VIDEO_OUTPUT to operate')
await getvideosurface()
await sleep(2)
cameraObj.createVideoOutput(videoId, (err, data) => {
console.info(TAG + 'Entering CREATE_VIDEO_OUTPUT success')
if (data != null || data != undefined) {
console.info(TAG + 'Entering CREATE_VIDEO_OUTPUT data is not null || undefined')
videoOutput = data
expect(true).assertTrue()
console.info(TAG + 'Entering CREATE_VIDEO_OUTPUT PASSED')
} else {
expect().assertFail()
console.info(TAG + 'Entering CREATE_VIDEO_OUTPUT FAILED: ' + err.message)
}
console.info(TAG + 'Entering CREATE_VIDEO_OUTPUT ends here')
done()
})
await sleep(1)
done()
})
/**
* @tc.number : VIDEO_OUTPUT_CALLBACK_ON_ERROR
* @tc.name : VideoOutput callback onerror async api
* @tc.desc : VideoOutput callback onerror async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('VIDEO_OUTPUT_CALLBACK_ON_ERROR', 0, async function (done) {
if (videoOutput == null || videoOutput == undefined) {
console.info(TAG + 'Entering VIDEO_OUTPUT_CALLBACK_ON_ERROR videoOutput == null || undefined')
} else {
console.info(TAG + 'Entering VIDEO_OUTPUT_CALLBACK_ON_ERROR to operate')
await sleep(1)
videoOutput.on('error', async (err, data) => {
if (!err) {
console.info(TAG + "VideoOutput Errorcallback is success")
if (data != null || data != undefined) {
console.info(TAG + "Error during videoOutput with ErrorCode: " + data.code);
expect(true).assertTrue()
}
} else {
expect().assertFail()
}
await sleep(1)
done()
})
await sleep(1)
done();
}
})
/**
* @tc.number : CREATE_CAPTURE_SESSION
* @tc.name : Create capturesession async api
* @tc.desc : Create capturesession async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CREATE_CAPTURE_SESSION', 0, async function (done) {
console.info(TAG + 'Entering CREATE_CAPTURE_SESSION to operate')
await sleep(1)
cameraObj.createCaptureSession(null, (err, data) => {
if (!err) {
console.info(TAG + 'Entering CREATE_CAPTURE_SESSION success')
if (data != null || data != undefined) {
console.info(TAG + 'Entering CREATE_CAPTURE_SESSION data is not null || undefined')
captureSession = data
expect(true).assertTrue()
console.info(TAG + 'Entering CREATE_CAPTURE_SESSION PASSED')
}
} else {
console.info(TAG + 'Entering CREATE_CAPTURE_SESSION FAILED: ' + err.message)
}
console.info(TAG + 'Entering CREATE_CAPTURE_SESSION ends here')
done()
})
await sleep(1)
done()
})
/**
* @tc.number : CAP_SES_CALLBACK_ON_ERROR
* @tc.name : CaptureSession callback on error api
* @tc.desc : CaptureSession callback on error api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CAP_SES_CALLBACK_ON_ERROR', 0, async function (done) {
if (captureSession == null || captureSession == undefined) {
console.info(TAG + "Entering CAP_SES_CALLBACK_ON_ERROR captureSession == null || undefined");
} else {
console.info(TAG + "Entering CAP_SES_CALLBACK_ON_ERROR to operate");
captureSession.on("error", async (err, data) => {
if (!err) {
console.info(TAG + " captureSession errorcallback is success");
if (data != null || data != undefined) {
console.info(TAG + "Error in CaptureSessioncallback with ErrorCode: " + data.code);
expect(true).assertTrue();
}
} else {
expect().assertFail();
}
await sleep(1);
done();
})
await sleep(1);
done();
}
})
/**
* @tc.number : BEGIN_CONFIG
* @tc.name : Create capturesession async api
* @tc.desc : Create capturesession async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('BEGIN_CONFIG', 0, async function (done) {
if (captureSession == null || captureSession == undefined) {
console.info(TAG + 'Entering BEGIN_CONFIG captureSession == null || undefined')
} else {
console.info(TAG + 'Entering BEGIN_CONFIG to operate')
await sleep(1)
captureSession.beginConfig((err, data) => {
if (!err) {
console.info(TAG + 'Entering BEGIN_CONFIG success')
if (data != null || data != undefined) {
console.info(TAG + 'Entering BEGIN_CONFIG data is not null || undefined')
expect(true).assertTrue()
console.info(TAG + 'Entering BEGIN_CONFIG PASSED')
}
} else {
console.info(TAG + 'Entering BEGIN_CONFIG FAILED: ' + err.message)
}
console.info(TAG + 'Entering BEGIN_CONFIG ends here')
done()
})
await sleep(1)
done()
}
})
/**
* @tc.number : ADD_INPUT
* @tc.name : AddInput async api
* @tc.desc : AddInput async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('ADD_INPUT', 0, async function (done) {
if (captureSession == null || captureSession == undefined) {
console.info(TAG + 'Entering ADD_INPUT captureSession == null || undefined')
} else {
console.info(TAG + 'Entering ADD_INPUT to operate')
await sleep(1)
captureSession.addInput(camera0Input, (err, data) => {
if (!err) {
console.info(TAG + 'Entering ADD_INPUT success')
if (data != null || data != undefined) {
console.info(TAG + 'Entering ADD_INPUT data is not null || undefined')
expect(true).assertTrue()
console.info(TAG + 'Entering ADD_INPUT PASSED')
}
} else {
console.info(TAG + 'Entering ADD_INPUT FAILED: ' + err.message)
}
console.info(TAG + 'Entering ADD_INPUT ends here')
done()
})
await sleep(1)
done()
}
})
/**
* @tc.number : ADD_OUTPUT_PREVIEW
* @tc.name : AddOutput preview async api
* @tc.desc : AddOutput preview async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('ADD_OUTPUT_PREVIEW', 0, async function (done) {
if (captureSession == null || captureSession == undefined) {
console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW captureSession == null || undefined')
} else {
console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW to operate')
await sleep(1)
captureSession.addOutput(previewOutput, (err, data) => {
if (!err) {
console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW success')
if (data != null || data != undefined) {
console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW data is not null || undefined')
expect(true).assertTrue()
console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW PASSED')
}
} else {
console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW FAILED: ' + err.message)
}
console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW ends here')
done()
})
await sleep(1)
done()
}
})
/**
* @tc.number : ADD_OUTPUT_VIDEO
* @tc.name : AddOutput video async api
* @tc.desc : AddOutput video async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('ADD_OUTPUT_VIDEO', 0, async function (done) {
if (captureSession == null || captureSession == undefined) {
console.info(TAG + 'Entering ADD_OUTPUT_VIDEO captureSession == null || undefined')
} else {
console.info(TAG + 'Entering ADD_OUTPUT_VIDEO to operate')
await sleep(1)
captureSession.addOutput(videoOutput, async (err, data) => {
if (!err) {
console.info(TAG + 'Entering ADD_OUTPUT_VIDEO success')
if (data != null || data != undefined) {
console.info(TAG + 'Entering ADD_OUTPUT_VIDEO data is not null || undefined')
expect(true).assertTrue()
console.info(TAG + 'Entering ADD_OUTPUT_VIDEO PASSED')
}
} else {
console.info(TAG + 'Entering ADD_OUTPUT_VIDEO FAILED: ' + err.message)
}
console.info(TAG + 'Entering ADD_OUTPUT_VIDEO ends here')
await sleep(1);
done()
})
await sleep(1)
done()
}
})
/**
* @tc.number : REMOVE_INPUT_SUCCESS
* @tc.name : remove input api
* @tc.desc : remove input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('REMOVE_INPUT_SUCCESS', 0, async function (done) {
if (captureSession == null || captureSession == undefined) {
console.info(TAG + "Entering REMOVE_INPUT_SUCCESS captureSession == null || undefined");
} else {
console.info(TAG + "Entering REMOVE_INPUT_SUCCESS to operate");
captureSession.removeInput(camera0Input, async (err, data) => {
if (!err) {
console.info(TAG + "Entering remove input success");
expect(true).assertTrue();
console.info(TAG + "Entering REMOVE_INPUT_SUCCESS PASSED");
}
else {
expect().assertFail();
console.info(TAG + "Entering Remove Input FAILED" + err.message);
console.info(TAG + "Entering Remove Input ends here");
}
await sleep(1);
done();
})
await sleep(1);
}
done();
})
/**
* @tc.number : REMOVE_PREVIEW_OUTPUT_SUCCESS
* @tc.name : Remove preview Output api
* @tc.desc : Remove preview Output api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('REMOVE_PREVIEW_OUTPUT_SUCCESS', 0, async function (done) {
if (captureSession == null || captureSession == undefined) {
console.info(TAG + "Entering REMOVE_PREVIEW_OUTPUT_SUCCESS captureSession == null || undefined");
} else {
console.info(TAG + "Entering REMOVE_PREVIEW_OUTPUT_SUCCESS to operate");
captureSession.removeOutput(previewOutput, async (err, data) => {
if (!err) {
console.info(TAG + "Entering remove preview Output success");
expect(true).assertTrue();
console.info(TAG + "Entering REMOVE_PREVIEW_OUTPUT_SUCCESS PASSED");
}
else {
expect().assertFail();
console.info(TAG + "Entering Remove preview Output FAILED" + err.message);
console.info(TAG + "Entering Remove Preview Output ends here");
}
await sleep(1);
done();
})
await sleep(1);
}
done();
})
/**
* @tc.number : REMOVE_VIDEO_OUTPUT_SUCCESS
* @tc.name : Remove video Output api
* @tc.desc : Remove video Output api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('REMOVE_VIDEO_OUTPUT_SUCCESS', 0, async function (done) {
if (captureSession == null || captureSession == undefined) {
console.info(TAG + "Entering REMOVE_VIDEO_OUTPUT_SUCCESS captureSession == null || undefined");
} else {
console.info(TAG + "Entering REMOVE_VIDEO_OUTPUT_SUCCESS to operate");
captureSession.removeOutput(videoOutput, async (err, data) => {
if (!err) {
console.info(TAG + "Entering remove video Output success");
expect(true).assertTrue();
console.info(TAG + "Entering REMOVE_VIDEO_OUTPUT_SUCCESS PASSED");
}
else {
expect().assertFail();
console.info(TAG + "Entering Remove video Output FAILED" + err.message);
console.info(TAG + "Entering Remove video Output ends here");
}
await sleep(1);
done();
})
await sleep(1);
}
done();
})
/**
* @tc.number : ADD_INPUT1
* @tc.name : AddInput async api
* @tc.desc : AddInput async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('ADD_INPUT1', 0, async function (done) {
if (captureSession == null || captureSession == undefined) {
console.info(TAG + 'Entering ADD_INPUT1 captureSession == null || undefined')
} else {
console.info(TAG + 'Entering ADD_INPUT1 to operate')
await sleep(1)
captureSession.addInput(camera0Input, (err, data) => {
if (!err) {
console.info(TAG + 'Entering ADD_INPUT1 success')
if (data != null || data != undefined) {
console.info(TAG + 'Entering ADD_INPUT1 data is not null || undefined')
expect(true).assertTrue()
console.info(TAG + 'Entering ADD_INPUT1 PASSED')
}
} else {
console.info(TAG + 'Entering ADD_INPUT1 FAILED: ' + err.message)
}
console.info(TAG + 'Entering ADD_INPUT1 ends here')
done()
})
await sleep(1)
done()
}
})
/**
* @tc.number : ADD_OUTPUT_PREVIEW1
* @tc.name : AddOutput preview async api
* @tc.desc : AddOutput preview async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('ADD_OUTPUT_PREVIEW1', 0, async function (done) {
if (captureSession == null || captureSession == undefined) {
console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW1 captureSession == null || undefined')
} else {
console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW1 to operate')
await sleep(1)
captureSession.addOutput(previewOutput, (err, data) => {
if (!err) {
console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW1 success')
if (data != null || data != undefined) {
console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW1 data is not null || undefined')
expect(true).assertTrue()
console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW1 PASSED')
}
} else {
console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW1 FAILED: ' + err.message)
}
console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW1 ends here')
done()
})
await sleep(1)
done()
}
})
/**
* @tc.number : ADD_OUTPUT_VIDEO1
* @tc.name : AddOutput video async api
* @tc.desc : AddOutput video async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('ADD_OUTPUT_VIDEO1', 0, async function (done) {
if (captureSession == null || captureSession == undefined) {
console.info(TAG + 'Entering ADD_OUTPUT_VIDEO1 captureSession == null || undefined')
} else {
console.info(TAG + 'Entering ADD_OUTPUT_VIDEO1 to operate')
await sleep(1)
captureSession.addOutput(videoOutput, (err, data) => {
if (!err) {
console.info(TAG + 'Entering ADD_OUTPUT_VIDEO1 success')
if (data != null || data != undefined) {
console.info(TAG + 'Entering ADD_OUTPUT_VIDEO1 data is not null || undefined')
expect(true).assertTrue()
console.info(TAG + 'Entering ADD_OUTPUT_VIDEO1 PASSED')
}
} else {
console.info(TAG + 'Entering ADD_OUTPUT_VIDEO1 FAILED: ' + err.message)
}
console.info(TAG + 'Entering ADD_OUTPUT_VIDEO1 ends here')
done()
})
await sleep(1)
done()
}
})
/**
* @tc.number : COMMIT_CONFIG
* @tc.name : CommitConfig async api
* @tc.desc : CommitConfig async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('COMMIT_CONFIG', 0, async function (done) {
if (captureSession == null || captureSession == undefined) {
console.info(TAG + 'Entering COMMIT_CONFIG captureSession == null || undefined')
} else {
console.info(TAG + 'Entering COMMIT_CONFIG to operate')
await sleep(1)
captureSession.commitConfig((err, data) => {
if (!err) {
console.info(TAG + 'Entering COMMIT_CONFIG success')
if (data != null || data != undefined) {
console.info(TAG + 'Entering COMMIT_CONFIG data is not null || undefined')
expect(true).assertTrue()
console.info(TAG + 'Entering COMMIT_CONFIG PASSED')
}
} else {
console.info(TAG + 'Entering COMMIT_CONFIG FAILED: ' + err.message)
}
console.info(TAG + 'Entering COMMIT_CONFIG ends here')
done()
})
await sleep(1)
done()
}
})
//callback API
/**
* @tc.number : PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START
* @tc.name : Preview output callback on frame start api
* @tc.desc : Preview output callback on frame start api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START', 0, async function (done) {
if (previewOutput == null || previewOutput == undefined) {
console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START previewOutput == null || undefined");
} else {
console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START to operate");
previewOutput.on("frameStart", async (err, data) => {
if (!err) {
console.info(TAG + "PreviewStart frameStart Callback is success");
if (data != null || data != undefined) {
expect(true).assertTrue();
}
} else {
expect().assertFail()
}
await sleep(1);
done();
})
await sleep(1);
done();
}
})
/**
* @tc.number : PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END
* @tc.name : Preview capture callback on frame end api
* @tc.desc : Preview capture callback on frame end api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END', 0, async function (done) {
if (previewOutput == null || previewOutput == undefined) {
console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END previewOutput == null || undefined");
} else {
console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END to operate");
previewOutput.on("frameEnd", async (err, data) => {
if (!err) {
console.info(TAG + "PreviewStop frameEnd Callback is success");
if (data != null || data != undefined) {
expect(true).assertTrue();
}
} else {
expect().assertFail();
}
await sleep(1);
done();
})
await sleep(1);
done();
}
})
/**
* @tc.number : VIDEO_OUTPUT_CALLBACK_ON_FRAME_START
* @tc.name : VideoOutput callback onframestart async api
* @tc.desc : VideoOutput callback onframestart async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('VIDEO_OUTPUT_CALLBACK_ON_FRAME_START', 0, async function (done) {
if (videoOutput == null || videoOutput == undefined) {
console.info(TAG + "Entering VIDEO_OUTPUT_CALLBACK_ON_FRAME_START videoOutput == null || undefined");
} else {
console.info(TAG + "Entering VIDEO_OUTPUT_CALLBACK_ON_FRAME_START to operate");
videoOutput.on("frameStart", async (err, data) => {
if (!err) {
console.info(TAG + "Video frameStart Callback is success");
if (data != null || data != undefined) {
expect(true).assertTrue();
}
} else {
expect().assertFail()
}
await sleep(1);
done();
})
await sleep(1);
done();
}
})
/**
* @tc.number : VIDEO_OUTPUT_CALLBACK_ON_FRAME_END
* @tc.name : VideoOutput callback onframeend async api
* @tc.desc : VideoOutput callback onframeend async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('VIDEO_OUTPUT_CALLBACK_ON_FRAME_END', 0, async function (done) {
if (videoOutput == null || videoOutput == undefined) {
console.info(TAG + 'Entering VIDEO_OUTPUT_CALLBACK_ON_FRAME_END videoOutput == null || undefined')
} else {
console.info(TAG + 'Entering VIDEO_OUTPUT_CALLBACK_ON_FRAME_END to operate')
await sleep(1)
videoOutput.on('frameEnd', async (err, data) => {
if (!err) {
console.info(TAG + 'Video frameEnd callback is success')
if (data != null || data != undefined) {
expect(true).assertTrue()
}
} else {
expect().assertFail()
}
await sleep(1);
done();
})
await sleep(1);
done();
}
})
/**
* @tc.number : CAPTURE_SESSION_START
* @tc.name : CaptureSession start async api
* @tc.desc : CaptureSession start async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CAPTURE_SESSION_START', 0, async function (done) {
if (captureSession == null || captureSession == undefined) {
console.info(TAG + "Entering CAPTURE_SESSION_START captureSession == null || undefined")
} else {
console.info(TAG + "Entering CAPTURE_SESSION_START to operate")
await sleep(1)
captureSession.start((err, data) => {
if (!err) {
console.info(TAG + "Entering CAPTURE_SESSION_START success")
if (data != null || data != undefined) {
console.info(TAG + "Entering CAPTURE_SESSION_START data is not null || undefined")
expect(true).assertTrue()
console.info(TAG + "Entering CAPTURE_SESSION_START PASSED")
}
} else {
console.info(TAG + 'Entering CAPTURE_SESSION_START FAILED: ' + err.message)
}
console.info(TAG + 'Entering CAPTURE_SESSION_START ends here')
done()
})
await sleep(1)
done()
}
})
//FLASH Function API scripts
/**
* @tc.number : HAS_FLASH
* @tc.name : check if has flash-camera0Input api
* @tc.desc : check if has flash-camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('HAS_FLASH', 0, async function (done) {
console.info("--------------HAS_FLASH--------------");
console.info(TAG + "hasFlash called.")
camera0Input.hasFlash(async (err, data) => {
if (!err) {
console.info(TAG + "Entering HAS_FLASH success");
if (data != null || data != undefined) {
console.info(TAG + "Entering HAS_FLASH data is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "Entering HAS_FLASH PASSED with HAS_FLASH is: " + data);
}
} else {
expect().assertFail();
console.info(TAG + "Entering HAS_FLASH FAILED" + err.message);
}
console.info(TAG + "Entering HAS_FLASH ends here");
})
await sleep(1);
done();
})
/**
* @tc.number : IS_FLASH_MODE_OPEN_SUPPORTED
* @tc.name : check if flash mode open is supported-camera0Input api
* @tc.desc : check if flash mode open is supported-camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('IS_FLASH_MODE_OPEN_SUPPORTED', 0, async function (done) {
console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED to operate");
camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_OPEN, async (err, data) => {
if (!err) {
console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED SUCCESS ");
if (data != null || data != undefined) {
console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED data is not null || undefined");
console.info(TAG + "FLASH_MODE_OPEN supported is: " + data);
expect(true).assertTrue();
console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED PASSED");
}
} else {
console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED FAILED" + err.message);
console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED ends here");
expect().assertFail();
}
await sleep(1);
done();
})
await sleep(1);
done();
})
/**
* @tc.number : SET_FLASH_MODE_OPEN
* @tc.name : set flash mode open camera0 api
* @tc.desc : set flash mode open camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_FLASH_MODE_OPEN', 0, async function (done) {
console.info(TAG + "Entering SET_FLASH_MODE_OPEN to operate");
camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_OPEN, async (err, data) => {
if (!err) {
console.info(TAG + "Entering SET_FLASH_MODE_OPEN SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_OPEN);
console.info(TAG + "Entering SET_FLASH_MODE_OPEN PASSED")
expect(true).assertTrue()
}
else {
expect().assertFail();
console.info(TAG + "Entering SET_FLASH_MODE_OPEN FAILED" + err.message);
console.info(TAG + "Entering SET_FLASH_MODE_OPEN ends here");
}
await sleep(1);
done();
})
await sleep(1);
done();
})
/**
* @tc.number : GET_FLASH_MODE_OPEN
* @tc.name : get flash mode open camera0 api
* @tc.desc : get flash mode open camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_FLASH_MODE_OPEN', 0, async function (done) {
console.info(TAG + "Entering GET_FLASH_MODE_OPEN to operate");
camera0Input.getFlashMode(async (err, data) => {
if (!err) {
console.info(TAG + "Entering GET_FLASH_MODE_OPEN success");
if (data == 1) {
console.info(TAG + "GET_FLASH_MODE_OPEN data is not null || undefined: ");
console.info(TAG + "Current FlashMode is: " + data);
expect(true).assertTrue();
console.info(TAG + "GET_FLASH_MODE_OPEN PASSED");
}
}
else {
expect().assertFail();
console.info(TAG + "GET_FLASH_MODE_OPEN FAILED" + err.message);
console.info(TAG + "GET_FLASH_MODE_OPEN ends here");
}
await sleep(1);
done();
})
await sleep(1);
done();
})
/**
* @tc.number : IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED
* @tc.name : check if flash mode always open is supported-camera0Input api
* @tc.desc : check if flash mode always open is supported-camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED', 0, async function (done) {
console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED to operate");
camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN, async (err, data) => {
if (!err) {
console.info(TAG + "Entering FLASH_MODE_ALWAYS_OPEN SUCCESS ");
if (data != null || data != undefined) {
console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED data is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "FLASH_MODE_ALWAYS_OPEN supported is: " + data);
console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED PASSED");
}
} else {
console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED FAILED" + err.message);
console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED ends here");
expect().assertFail();
}
await sleep(1);
done();
})
await sleep(1);
done();
})
/**
* @tc.number : SET_FLASH_MODE_ALWAYS_OPEN
* @tc.name : set flash mode always open camera0 api
* @tc.desc : set flash mode always open camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_FLASH_MODE_ALWAYS_OPEN', 0, async function (done) {
console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN to operate");
camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN, async (err, data) => {
if (!err) {
console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN);
console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN PASSED")
expect(true).assertTrue()
}
else {
expect().assertFail();
console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN FAILED" + err.message);
console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN ends here");
}
await sleep(1);
done();
})
await sleep(1);
done();
})
/**
* @tc.number : GET_FLASH_MODE_ALWAYS_OPEN
* @tc.name : get flash mode always open camera0 api
* @tc.desc : get flash mode always open camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_FLASH_MODE_ALWAYS_OPEN', 0, async function (done) {
console.info(TAG + "Entering GET_FLASH_MODE_ALWAYS_OPEN to operate");
camera0Input.getFlashMode(async (err, data) => {
if (!err) {
console.info(TAG + "Entering GET_FLASH_MODE_ALWAYS_OPEN success");
if (data == 3) {
console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN data is not null || undefined: ");
expect(true).assertTrue();
console.info(TAG + "Current FlashMode is: " + data);
console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN PASSED");
}
}
else {
expect().assertFail();
console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN FAILED" + err.message);
console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN ends here");
}
await sleep(1);
done();
})
await sleep(1);
done();
})
/**
* @tc.number : IS_FLASH_MODE_AUTO_SUPPORTED
* @tc.name : check if flash mode auto is supported-camera0Input api
* @tc.desc : check if flash mode auto is supported-camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('IS_FLASH_MODE_AUTO_SUPPORTED', 0, async function (done) {
console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED to operate");
camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_AUTO, async (err, data) => {
if (!err) {
console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED SUCCESS ");
if (data != null || data != undefined) {
console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED data is not null || undefined");
console.info(TAG + "IS_FLASH_MODE_AUTO_SUPPORTED supported is: " + data);
expect(data).assertEqual(false);
console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED PASSED");
}
} else {
console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED FAILED" + err.message);
console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED ends here");
expect().assertFail();
}
await sleep(1);
done();
})
await sleep(1);
done();
})
/**
* @tc.number : SET_FLASH_MODE_AUTO
* @tc.name : set flash mode auto camera0 api
* @tc.desc : set flash mode auto camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_FLASH_MODE_AUTO', 0, async function (done) {
console.info(TAG + "Entering SET_FLASH_MODE_AUTO to operate");
camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_AUTO, async (err, data) => {
if (!err) {
console.info(TAG + "Entering SET_FLASH_MODE_AUTO SUCCESS which is not supported: ");
console.info(TAG + "Entering SET_FLASH_MODE_AUTO FAILED")
expect().assertFail();
} else {
expect(true).assertTrue()
console.info(TAG + "Entering SET_FLASH_MODE_AUTO PASSED: " + err.message);
console.info(TAG + "Entering SET_FLASH_MODE_AUTO ends here");
}
await sleep(1);
done();
})
await sleep(1);
done();
})
/**
* @tc.number : IS_FLASH_MODE_CLOSE_SUPPORTED
* @tc.name : check if flash mode close is supported-camera0Input api
* @tc.desc : check if flash mode close is supported-camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('IS_FLASH_MODE_CLOSE_SUPPORTED', 0, async function (done) {
console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED to operate");
camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_CLOSE, async (err, data) => {
if (!err) {
console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED SUCCESS ");
if (data != null || data != undefined) {
console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED data is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "FLASH_MODE_CLOSE supported is: " + data);
console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED PASSED");
}
} else {
console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED FAILED" + err.message);
console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED ends here");
expect().assertFail();
}
await sleep(1);
done();
})
await sleep(1);
done();
})
/**
* @tc.number : SET_FLASH_MODE_CLOSE
* @tc.name : set flash mode close camera0 api
* @tc.desc : set flash mode close camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_FLASH_MODE_CLOSE', 0, async function (done) {
console.info(TAG + "Entering SET_FLASH_MODE_CLOSE to operate");
camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_CLOSE, async (err, data) => {
if (!err) {
console.info(TAG + "Entering SET_FLASH_MODE_CLOSE SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_CLOSE);
console.info(TAG + "Entering SET_FLASH_MODE_CLOSE PASSED")
expect(true).assertTrue()
}
else {
expect().assertFail();
console.info(TAG + "Entering SET_FLASH_MODE_CLOSE FAILED" + err.message);
console.info(TAG + "Entering SET_FLASH_MODE_CLOSE ends here");
}
await sleep(1);
done();
})
await sleep(1);
done();
})
/**
* @tc.number : GET_FLASH_MODE_CLOSE
* @tc.name : get flash mode close camera0 api
* @tc.desc : get flash mode close camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_FLASH_MODE_CLOSE', 0, async function (done) {
console.info(TAG + "Entering GET_FLASH_MODE_CLOSE to operate");
camera0Input.getFlashMode(async (err, data) => {
if (!err) {
console.info(TAG + "Entering GET_FLASH_MODE_CLOSE success");
if (data == 0) {
console.info(TAG + "GET_FLASH_MODE_CLOSE data is not null || undefined: ");
console.info(TAG + "Current FlashMode is: " + data);
expect(true).assertTrue();
console.info(TAG + "GET_FLASH_MODE_CLOSE PASSED");
}
}
else {
expect().assertFail();
console.info(TAG + "GET_FLASH_MODE_CLOSE FAILED" + err.message);
console.info(TAG + "GET_FLASH_MODE_CLOSE ends here");
}
await sleep(1)
done();
})
await sleep(1)
done()
})
/**
* @tc.number : IS_FOCUS_MODE_LOCKED_SUPPORTED
* @tc.name : check if focus mode locked is supported-camera0Input api
* @tc.desc : check if focus mode locked is supported-camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('IS_FOCUS_MODE_LOCKED_SUPPORTED', 0, async function (done) {
console.info(TAG + "Entering IS_FOCUS_MODE_LOCKED_SUPPORTED to operate");
camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_LOCKED, async (err, data) => {
if (!err) {
console.info(TAG + "Entering IS_FOCUS_MODE_LOCKED_SUPPORTED SUCCESS: " + data);
if (data != null || data != undefined) {
console.info(TAG + "Entering IS_FOCUS_MODE_LOCKED_SUPPORTED data is not null || undefined");
console.info(TAG + "FOCUS_MODE_LOCKED_SUPPORTED is: " + data);
expect(true).assertTrue();
console.info(TAG + "Entering IS_FOCUS_MODE_LOCKED_SUPPORTED PASSED: ");
}
} else {
console.info(TAG + "IS_FOCUS_MODE_LOCKED_SUPPORTED FAILED" + err.message);
expect().assertFail();
console.info(TAG + "IS_FOCUS_MODE_LOCKED_SUPPORTED ends here");
}
await sleep(1);
done();
})
await sleep(1);
done();
})
/**
* @tc.number : SET_FOCUS_MODE_LOCKED
* @tc.name : set focus mode locked camera0 api
* @tc.desc : set focus mode locked camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_FOCUS_MODE_LOCKED', 0, async function (done) {
console.info(TAG + "Entering SET_FOCUS_MODE_LOCKED to operate");
camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_LOCKED, async (err, data) => {
if (!err) {
console.info(TAG + "Entering SET_FOCUS_MODE_LOCKED SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_LOCKED);
console.info(TAG + "Entering SET_FOCUS_MODE_LOCKED PASSED")
expect(true).assertTrue()
} else {
expect().assertFail();
console.info(TAG + "Entering SET_FOCUS_MODE_LOCKED FAILED" + err.message);
console.info(TAG + "Entering SET_FOCUS_MODE_LOCKED ends here");
}
await sleep(1);
done();
})
await sleep(1);
done();
})
/**
* @tc.number : GET_FOCUS_MODE_LOCKED
* @tc.name : get focus mode locked camera0 api
* @tc.desc : get focus mode locked camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_FOCUS_MODE_LOCKED', 0, async function (done) {
console.info(TAG + "Entering GET_FOCUS_MODE_LOCKED to operate");
camera0Input.getFocusMode(async (err, data) => {
if (!err) {
console.info(TAG + "Entering GET_FOCUS_MODE_LOCKED SUCCESS: " + data);
if (data == 0) {
console.info(TAG + "GET_FOCUS_MODE_LOCKED data is not null || undefined: ");
console.info(TAG + "Current FocusMode is: " + data);
expect(true).assertTrue();
console.info(TAG + "GET_FOCUS_MODE_LOCKED PASSED");
}
}
else {
expect().assertFail();
console.info(TAG + "GET_FOCUS_MODE_LOCKED FAILED" + err.message);
console.info(TAG + "GET_FOCUS_MODE_LOCKED ends here");
}
await sleep(1);
done();
})
await sleep(1);
done();
})
/**
* @tc.number : IS_FOCUS_MODE_MANUAL_SUPPORTED
* @tc.name : check if focus mode manual is supported-camera0Input api
* @tc.desc : check if focus mode manual is supported-camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('IS_FOCUS_MODE_MANUAL_SUPPORTED', 0, async function (done) {
console.info(TAG + "Entering IS_FOCUS_MODE_MANUAL_SUPPORTED to operate");
camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_MANUAL, async (err, data) => {
if (!err) {
console.info(TAG + "Entering IS_FOCUS_MODE_MANUAL_SUPPORTED SUCCESS ");
if (data != null || data != undefined) {
console.info(TAG + "Entering IS_FOCUS_MODE_MANUAL_SUPPORTED data is not null || undefined");
console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + data);
expect(true).assertTrue();
console.info(TAG + "Entering IS_FOCUS_MODE_MANUAL_SUPPORTED PASSED: ");
}
} else {
console.info(TAG + "IS_FOCUS_MODE_MANUAL_SUPPORTED FAILED" + err.message);
expect().assertFail();
console.info(TAG + "IS_FOCUS_MODE_MANUAL_SUPPORTED ends here");
}
await sleep(1);
done();
})
await sleep(1);
done();
})
/**
* @tc.number : SET_FOCUS_MODE_MANUAL
* @tc.name : set focus mode manual camera0 api
* @tc.desc : set focus mode manual camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_FOCUS_MODE_MANUAL', 0, async function (done) {
console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL to operate");
camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_MANUAL, async (err, data) => {
if (!err) {
console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_MANUAL);
console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL PASSED")
expect(true).assertTrue()
}
else {
expect().assertFail();
console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL FAILED" + err.message);
console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL ends here");
}
await sleep(1);
done();
})
await sleep(1);
done();
})
/**
* @tc.number : GET_FOCUS_MODE_MANUAL
* @tc.name : get focus mode manual camera0 api
* @tc.desc : get focus mode manual camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_FOCUS_MODE_MANUAL', 0, async function (done) {
console.info(TAG + "Entering GET_FOCUS_MODE_MANUAL to operate");
camera0Input.getFocusMode(async (err, data) => {
if (!err) {
console.info(TAG + "Entering GET_FOCUS_MODE_MANUAL SUCCESS");
if (data == 0) {
console.info(TAG + "GET_FOCUS_MODE_MANUAL data is not null || undefined: ");
console.info(TAG + "Current FocusMode is: " + data);
expect(true).assertTrue();
console.info(TAG + "GET_FOCUS_MODE_MANUAL PASSED");
}
}
else {
expect().assertFail();
console.info(TAG + "GET_FOCUS_MODE_MANUAL FAILED" + err.message);
console.info(TAG + "GET_FOCUS_MODE_MANUAL ends here");
}
await sleep(1);
done();
})
await sleep(1);
done();
})
/**
* @tc.number : IS_FOCUS_MODE_CONTINUOUS_SUPPORTED
* @tc.name : check if focus mode continuous is supported-camera0Input api
* @tc.desc : check if focus mode continuous is supported-camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_034', 0, async function (done) {
console.info(TAG + "Entering IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_034 to operate");
camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO, async (err, data) => {
if (!err) {
console.info(TAG + "Entering IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_034 SUCCESS ");
if (data != null || data != undefined) {
console.info(TAG + "Entering IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_034 data is not null || undefined");
console.info(TAG + "FOCUS_MODE_CONTINOUS_SUPPORTED is: " + data);
expect(true).assertTrue();
console.info(TAG + "Entering IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_034 PASSED: ");
}
} else {
console.info(TAG + "IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_034 FAILED" + err.message);
expect().assertFail();
console.info(TAG + "IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_034 ends here");
}
await sleep(1);
done();
})
await sleep(1);
done();
})
/**
* @tc.number : SET_FOCUS_MODE_CONTINUOUS
* @tc.name : set focus mode continuous camera0 api
* @tc.desc : set focus mode continuous camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_FOCUS_MODE_CONTINUOUS', 0, async function (done) {
console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS to operate");
camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO, async (err, data) => {
if (!err) {
console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO);
expect(true).assertTrue()
console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS PASSED")
}
else {
expect().assertFail();
console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS FAILED" + err.message);
console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS ends here");
}
await sleep(1);
done();
})
await sleep(1);
done();
})
/**
* @tc.number : GET_FOCUS_MODE_CONTINUOUS
* @tc.name : get focus mode continuous camera0 api
* @tc.desc : get focus mode continuous camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_FOCUS_MODE_CONTINUOUS', 0, async function (done) {
console.info(TAG + "Entering GET_FOCUS_MODE_CONTINUOUS to operate");
camera0Input.getFocusMode(async (err, data) => {
if (!err) {
console.info(TAG + "Entering GET_FOCUS_MODE_CONTINUOUS SUCCESS");
if (data == 1) {
console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS data is not null || undefined: ");
console.info(TAG + "Current FocusMode is: " + data);
expect(true).assertTrue();
console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS PASSED");
}
}
else {
expect().assertFail();
console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS FAILED" + err.message);
console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS ends here");
}
await sleep(1);
done();
})
await sleep(1);
done();
})
/**
* @tc.number : IS_FOCUS_MODE_AUTO_SUPPORTED
* @tc.name : check if focus mode auto is supported-camera0Input api
* @tc.desc : check if focus mode auto is supported-camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('IS_FOCUS_MODE_AUTO_SUPPORTED', 0, async function (done) {
console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED to operate");
camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO, async (err, data) => {
if (!err) {
console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED SUCCESS ");
if (data != null || data != undefined) {
console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED data is not null || undefined");
console.info(TAG + "FOCUS_MODE_AUTO_SUPPORTED is: " + data);
expect(true).assertTrue();
console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED PASSED: ");
}
} else {
console.info(TAG + "IS_FOCUS_MODE_AUTO_SUPPORTED FAILED" + err.message);
expect().assertFail();
console.info(TAG + "IS_FOCUS_MODE_AUTO_SUPPORTED ends here");
}
await sleep(1);
done();
})
await sleep(1);
done();
})
/**
* @tc.number : SET_FOCUS_MODE_AUTO
* @tc.name : set focus mode auto camera0 api
* @tc.desc : set focus mode auto camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_FOCUS_MODE_AUTO', 0, async function (done) {
console.info(TAG + "Entering SET_FOCUS_MODE_AUTO to operate");
camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO, async (err, data) => {
if (!err) {
console.info(TAG + "Entering SET_FOCUS_MODE_AUTO SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_AUTO);
expect(true).assertTrue()
console.info(TAG + "Entering SET_FOCUS_MODE_AUTO PASSED")
}
else {
expect().assertFail();
console.info(TAG + "Entering SET_FOCUS_MODE_AUTO FAILED" + err.message);
console.info(TAG + "Entering SET_FOCUS_MODE_AUTO ends here");
}
await sleep(1);
done();
})
await sleep(1);
done();
})
/**
* @tc.number : GET_FOCUS_MODE_AUTO
* @tc.name : get focus mode auto camera0 api
* @tc.desc : get focus mode auto camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_FOCUS_MODE_AUTO', 0, async function (done) {
console.info(TAG + "Entering GET_FOCUS_MODE_AUTO to operate");
camera0Input.getFocusMode(async (err, data) => {
if (!err) {
console.info(TAG + "Entering GET_FOCUS_MODE_AUTO SUCCESS");
if (data == 2) {
console.info(TAG + "GET_FOCUS_MODE_AUTO data is not null || undefined: ");
console.info(TAG + "Current FocusMode is: " + data);
expect(true).assertTrue();
console.info(TAG + "GET_FOCUS_MODE_AUTO PASSED");
}
}
else {
expect().assertFail();
console.info(TAG + "GET_FOCUS_MODE_AUTO FAILED" + err.message);
console.info(TAG + "GET_FOCUS_MODE_AUTO ends here");
}
await sleep(1);
done();
})
await sleep(1);
done();
})
/**
* @tc.number : GET_ZOOM_RATIO
* @tc.name : get zoom ratio camera-0 cameraId api
* @tc.desc : get zoom ratio camera-0 cameraId api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_ZOOM_RATIO', 0, async function (done) {
console.info("--------------GET_ZOOM_RATIO--------------");
camera0Input.getZoomRatioRange(async (err, data) => {
if (!err) {
if (data != null && data != undefined) {
console.info(TAG + "Entering GET_ZOOM_RATIO data is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "Entering GET_ZOOM_RATIO Success: " + data);
}
} else {
expect().assertFail();
console.info(TAG + "Entering GET_ZOOM_RATIO FAILED: " + err.message);
}
console.info(TAG + "Entering GET_ZOOM_RATIO ends here");
await sleep(1);
done();
})
await sleep(1);
done();
})
/**
* @tc.number : SET_GET_ZOOM_1_ASYNC
* @tc.name : Zoom camera-0 cameraId api
* @tc.desc : Zoom camera-0 cameraId api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_GET_ZOOM_1_ASYNC', 0, async function (done) {
camera0Input.setZoomRatio(1, (err, data) => {
if (!err) {
console.info(TAG + "setZoomRatio success: 1");
console.info(TAG + "getZoomRatio called")
camera0Input.getZoomRatio((err, data1) => {
if (!err) {
console.info(TAG + "getZoomRatio success : " + data1);
expect(data1).assertEqual(1);
console.info(TAG + "SET_GET_ZOOM_1_ASYNC PASSED ");
}
else {
expect().assertFail();
console.info(TAG + "SET_GET_ZOOM_1_ASYNC FAILED" + err.message);
}
})
}
})
await sleep(1);
done();
})
/**
* @tc.number : SET_GET_ZOOM_2_ASYNC
* @tc.name : Zoom camera-0 cameraId api
* @tc.desc : Zoom camera-0 cameraId api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_GET_ZOOM_2_ASYNC', 0, async function (done) {
camera0Input.setZoomRatio(2, (err, data) => {
if (!err) {
console.info(TAG + "setZoomRatio success: 2");
console.info(TAG + "getZoomRatio called")
camera0Input.getZoomRatio((err, data1) => {
if (!err) {
console.info(TAG + "getZoomRatio success : " + data1);
expect(data1).assertEqual(2);
console.info(TAG + "SET_GET_ZOOM_2_ASYNC PASSED ");
}
else {
expect().assertFail();
console.info(TAG + "SET_GET_ZOOM_2_ASYNC FAILED" + err.message);
}
})
}
})
await sleep(1);
done();
})
/**
* @tc.number : SET_GET_ZOOM_3_ASYNC
* @tc.name : Zoom camera-0 cameraId api
* @tc.desc : Zoom camera-0 cameraId api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_GET_ZOOM_3_ASYNC', 0, async function (done) {
camera0Input.setZoomRatio(3, (err, data) => {
if (!err) {
console.info(TAG + "setZoomRatio success: 3");
console.info(TAG + "getZoomRatio called")
camera0Input.getZoomRatio((err, data1) => {
if (!err) {
console.info(TAG + "getZoomRatio success : " + data1);
expect(data1).assertEqual(3);
console.info(TAG + "SET_GET_ZOOM_3_ASYNC PASSED ");
}
else {
expect().assertFail();
console.info(TAG + "SET_GET_ZOOM_3_ASYNC FAILED" + err.message);
}
})
}
})
await sleep(1);
done();
})
/**
* @tc.number : SET_GET_ZOOM_4_ASYNC
* @tc.name : Zoom camera-0 cameraId api
* @tc.desc : Zoom camera-0 cameraId api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_GET_ZOOM_4_ASYNC', 0, async function (done) {
camera0Input.setZoomRatio(4, (err, data) => {
if (!err) {
console.info(TAG + "setZoomRatio success: 4");
console.info(TAG + "getZoomRatio called")
camera0Input.getZoomRatio((err, data1) => {
if (!err) {
console.info(TAG + "getZoomRatio success : " + data1);
expect(data1).assertEqual(4);
console.info(TAG + "SET_GET_ZOOM_4_ASYNC PASSED ");
}
else {
expect().assertFail();
console.info(TAG + "SET_GET_ZOOM_4_ASYNC FAILED" + err.message);
}
})
}
})
await sleep(1);
done();
})
/**
* @tc.number : SET_GET_ZOOM_5_ASYNC
* @tc.name : Zoom camera-0 cameraId api
* @tc.desc : Zoom camera-0 cameraId api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_GET_ZOOM_5_ASYNC', 0, async function (done) {
camera0Input.setZoomRatio(5, (err, data) => {
if (!err) {
console.info(TAG + "setZoomRatio success: 5");
console.info(TAG + "getZoomRatio called")
camera0Input.getZoomRatio((err, data1) => {
if (!err) {
console.info(TAG + "getZoomRatio success : " + data1);
expect(data1).assertEqual(5);
console.info(TAG + "SET_GET_ZOOM_5_ASYNC PASSED ");
}
else {
expect().assertFail();
console.info(TAG + "SET_GET_ZOOM_5_ASYNC FAILED" + err.message);
}
})
}
})
await sleep(1);
done();
})
/**
* @tc.number : SET_GET_ZOOM_6_ASYNC
* @tc.name : Zoom camera-0 cameraId api
* @tc.desc : Zoom camera-0 cameraId api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_GET_ZOOM_6_ASYNC', 0, async function (done) {
camera0Input.setZoomRatio(6, (err, data) => {
if (!err) {
console.info(TAG + "setZoomRatio success: 6");
console.info(TAG + "getZoomRatio called")
camera0Input.getZoomRatio((err, data1) => {
if (!err) {
console.info(TAG + "getZoomRatio success : " + data1);
expect(data1).assertEqual(6);
console.info(TAG + "SET_GET_ZOOM_6_ASYNC PASSED ");
}
else {
expect().assertFail();
console.info(TAG + "SET_GET_ZOOM_6_ASYNC FAILED" + err.message);
}
})
}
})
await sleep(1);
done();
})
/**
* @tc.number : VIDEO_OUTPUT_START
* @tc.name : VideoOutput start async api
* @tc.desc : VideoOutput start async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('VIDEO_OUTPUT_START', 0, async function (done) {
if (videoOutput == null || videoOutput == undefined) {
console.info(TAG + 'Entering VIDEO_OUTPUT_START videoOutput == null || undefined')
} else {
console.info(TAG + 'Entering VIDEO_OUTPUT_START to operate')
await sleep(1)
videoOutput.start(async (err, data) => {
console.info(TAG + 'Entering VIDEO_OUTPUT_START success: ' + JSON.stringify(data))
if (data == undefined) {
expect(true).assertTrue();
} else {
expect().assertFail()
}
})
await sleep(1)
done()
}
await sleep(1)
done()
})
/**
* @tc.number : VIDEO_RECORDER_START
* @tc.name : VideoRecorder start async api
* @tc.desc : VideoRecorder start async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('VIDEO_RECORDER_START', 0, async function (done) {
if (videoRecorder == null || videoRecorder == undefined) {
console.info(TAG + 'Entering VIDEO_RECORDER_START videoRecorder == null || undefined')
} else {
console.info(TAG + 'Entering VIDEO_RECORDER_START to operate')
videoRecorder.start()
console.info(TAG + 'VIDEO_RECORDER_START called');
sleep(3);
console.info(TAG + 'VIDEO_RECORDER_START done.')
expect(true).assertTrue()
console.info(TAG + 'Entering VIDEO_RECORDER_START PASSED')
console.info(TAG + 'Entering VIDEO_RECORDER_START ends here')
await sleep(1)
done()
}
await sleep(1)
done()
})
/**
* @tc.number : VIDEO_OUTPUT_STOP
* @tc.name : VideoOutput stop async api
* @tc.desc : VideoOutput stop async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('VIDEO_OUTPUT_STOP', 0, async function (done) {
if (videoOutput == null || videoOutput == undefined) {
console.info(TAG + 'Entering VIDEO_OUTPUT_STOP videoOutput == null || undefined')
} else {
console.info(TAG + 'Entering VIDEO_OUTPUT_STOP to operate')
await sleep(1)
videoOutput.stop(async (err, data) => {
console.info(TAG + 'Entering VIDEO_OUTPUT_STOP success: ' + JSON.stringify(data))
if (data == undefined) {
expect(true).assertTrue()
} else {
expect().assertFail()
}
console.info(TAG + 'Entering VIDEO_OUTPUT_STOP ends here')
await sleep(1)
done()
})
await sleep(1)
done()
}
})
/**
* @tc.number : VIDEO_RECORDER_STOP
* @tc.name : VideoRecorder stop async api
* @tc.desc : VideoRecorder stop async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('VIDEO_RECORDER_STOP', 0, async function (done) {
if (videoRecorder == null || videoRecorder == undefined) {
console.info(TAG + 'Entering VIDEO_RECORDER_STOP videoRecorder == null || undefined')
} else {
console.info(TAG + 'Entering VIDEO_RECORDER_STOP to operate')
await videoRecorder.stop()
console.info(TAG + 'VIDEO_RECORDER_STOP stopVideo done.')
console.info(TAG + 'Entering VIDEO_RECORDER_STOP PASSED')
expect(true).assertTrue()
}
await sleep(1)
done()
})
/**
* @tc.number : CAPTURE_SESSION_STOP
* @tc.name : CaptureSession stop async api
* @tc.desc : CaptureSession stop async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CAPTURE_SESSION_STOP', 0, async function (done) {
if (captureSession == null || captureSession == undefined) {
console.info(TAG + 'Entering CAPTURE_SESSION_STOP captureSession == null || undefined')
} else {
console.info(TAG + 'Entering CAPTURE_SESSION_STOP to operate')
await sleep(1)
captureSession.stop((err, data) => {
if (!err) {
console.info(TAG + 'Entering CAPTURE_SESSION_STOP success')
if (data != null || data != undefined) {
console.info(TAG + 'Entering CAPTURE_SESSION_STOP data is not null || undefined')
expect(true).assertTrue()
console.info(TAG + 'Entering CAPTURE_SESSION_STOP PASSED')
}
} else {
console.info(TAG + 'Entering CAPTURE_SESSION_STOP FAILED: ' + err.message)
}
console.info(TAG + 'Entering CAPTURE_SESSION_STOP ends here')
done()
})
await sleep(1)
done()
}
})
/**
* @tc.number : CAPTURE_SESSION_RELEASE
* @tc.name : CaptureSession release async api
* @tc.desc : CaptureSession release async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CAPTURE_SESSION_RELEASE', 0, async function (done) {
if (captureSession == null || captureSession == undefined) {
console.info(TAG + 'Entering CAPTURE_SESSION_RELEASE captureSession == null || undefined')
} else {
console.info(TAG + 'Entering CAPTURE_SESSION_RELEASE to operate')
await sleep(1)
captureSession.release((err, data) => {
if (!err) {
console.info(TAG + 'Entering CAPTURE_SESSION_RELEASE success')
if (data != null || data != undefined) {
console.info(TAG + 'Entering CAPTURE_SESSION_RELEASE data is not null || undefined')
expect(true).assertTrue()
console.info(TAG + 'Entering CAPTURE_SESSION_RELEASE PASSED')
}
} else {
console.info(TAG + 'Entering CAPTURE_SESSION_RELEASE FAILED: ' + err.message)
}
console.info(TAG + 'Entering CAPTURE_SESSION_RELEASE ends here')
done()
})
await sleep(1)
done()
}
})
/**
* @tc.number : VIDEOOUPUT_RELEASE_SUCCESS
* @tc.name : videooutput release api
* @tc.desc : videooutput release api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('VIDEOOUPUT_RELEASE_SUCCESS', 0, async function (done) {
if (videoOutput == null || videoOutput == undefined) {
console.info(TAG + "Entering VIDEOOUPUT_RELEASE_SUCCESS previewOutput == null || undefined");
} else {
console.info(TAG + "Entering VIDEOOUPUT_RELEASE_SUCCESS to operate");
videoOutput.release(async (err, data) => {
if (!err) {
console.info(TAG + "Entering videooutput.release success");
if (data != null || data != undefined) {
console.info(TAG + "Entering videooutput.release data is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "Entering videooutput.release PASSED");
}
} else {
expect().assertFail();
console.info(TAG + "Entering VIDEOOUPUT_RELEASE_SUCCESS FAILED: " + err.message);
console.info(TAG + "Entering videooutput.release ends here");
await sleep(1);
done();
}
})
await sleep(1);
done();
}
})
/**
* @tc.number : PREVIEWOUPUT_RELEASE_SUCCESS
* @tc.name : previewOutput release api
* @tc.desc : previewOutput release api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('PREVIEWOUPUT_RELEASE_SUCCESS', 0, async function (done) {
if (previewOutput == null || previewOutput == undefined) {
console.info(TAG + "Entering PREVIEWOUPUT_RELEASE_SUCCESS previewOutput == null || undefined");
} else {
console.info(TAG + "Entering PREVIEWOUPUT_RELEASE_SUCCESS to operate");
previewOutput.release(async (err, data) => {
if (!err) {
console.info(TAG + "Entering previewOutput.release success");
if (data != null || data != undefined) {
console.info(TAG + "Entering previewOutput.release data is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "Entering previewOutput.release PASSED");
}
} else {
expect().assertFail();
console.info(TAG + "Entering PREVIEWOUPUT_RELEASE_SUCCESS FAILED: " + err.message);
console.info(TAG + "Entering previewOutput.release ends here");
await sleep(1);
done();
}
})
await sleep(1);
done();
}
})
/**
* @tc.number : CAMERAINPUT_RELEASE_SUCCESS
* @tc.name : camera Input release api
* @tc.desc : camera Input release api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CAMERAINPUT_RELEASE_SUCCESS', 0, async function (done) {
if (camera0Input == null || camera0Input == undefined) {
console.info(TAG + "Entering CAMERAINPUT_RELEASE_SUCCESS camera0Input == null || undefined");
} else {
console.info(TAG + "Entering CAMERAINPUT_RELEASE_SUCCESS to operate");
camera0Input.release(async (err, data) => {
if (!err) {
console.info(TAG + "Entering camera0Input.release success");
if (data != null || data != undefined) {
console.info(TAG + "Entering camera0Input.release data is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "Entering camera0Input.release PASSED");
}
} else {
expect().assertFail();
console.info(TAG + "Entering CAMERAINPUT_RELEASE_SUCCESS FAILED: " + err.message);
console.info(TAG + "Entering camera0Input.release ends here");
await sleep(1);
done();
}
})
await sleep(1);
done();
}
})
})
}
\ 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 cameraObj from '@ohos.multimedia.camera'
import media from '@ohos.multimedia.media'
import mediaLibrary from '@ohos.multimedia.mediaLibrary'
import fileio from '@ohos.fileio';
import abilityAccessCtrl from '@ohos.abilityAccessCtrl'
import bundle from '@ohos.bundle'
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index';
let TAG = 'CameraModuleTest: '
var cameraManagerPromise
var camerasArrayPromise
var camera0InputPromise
var previewOutputPromise
var videoRecorder
let fdPath;
let fileAsset;
let fdNumber;
let configFile = {
audioBitrate: 48000,
audioChannels: 2,
audioCodec: 'audio/mp4a-latm',
audioSampleRate: 48000,
durationTime: 1000,
fileFormat: 'mp4',
videoBitrate: 48000,
videoCodec: 'video/mp4v-es',
videoFrameWidth: 640,
videoFrameHeight: 480,
videoFrameRate: 10
}
let videoConfig = {
audioSourceType: 1,
videoSourceType: 0,
profile: configFile,
url: 'file:///data/media/01.mp4',
orientationHint: 0,
location: { latitude: 30, longitude: 130 },
maxSize: 100,
maxDuration: 500
}
var videoId
var videoOutputPromise
var captureSessionPromise
export default function cameraJSUnitVideoPromise(surfaceId: any) {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve(1)
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
async function applyPermission() {
let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100);
let atManager = abilityAccessCtrl.createAtManager();
if (atManager != null) {
let tokenID = appInfo.accessTokenId;
console.info('[permission] case accessTokenID is ' + tokenID);
let permissionName1 = 'ohos.permission.CAMERA';
let permissionName2 = 'ohos.permission.MICROPHONE';
let permissionName3 = 'ohos.permission.MEDIA_LOCATION';
let permissionName4 = 'ohos.permission.READ_MEDIA';
let permissionName5 = 'ohos.permission.WRITE_MEDIA';
await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName5, 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');
}
}
async function getFd(pathName) {
let displayName = pathName;
const mediaTest = mediaLibrary.getMediaLibrary();
let fileKeyObj = mediaLibrary.FileKey;
let mediaType = mediaLibrary.MediaType.VIDEO;
let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO);
let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath);
if (dataUri != undefined) {
let args = dataUri.id.toString();
let fetchOp = {
selections: fileKeyObj.ID + "=?",
selectionArgs: [args],
}
let fetchFileResult = await mediaTest.getFileAssets(fetchOp);
fileAsset = await fetchFileResult.getAllObject();
fdNumber = await fileAsset[0].open('Rw');
fdPath = "fd://" + fdNumber.toString();
}
}
async function closeFd() {
if (fileAsset != null) {
await fileAsset[0].close(fdNumber).then(() => {
console.info('[mediaLibrary] case close fd success');
}).catch((err) => {
console.info('[mediaLibrary] case close fd failed');
});
} else {
console.info('[mediaLibrary] case fileAsset is null');
}
}
async function getvideosurface() {
await getFd('01.mp4');
videoConfig.url = fdPath;
media.createVideoRecorder((err, recorder) => {
console.info(TAG + 'createVideoRecorder called')
videoRecorder = recorder
console.info(TAG + 'videoRecorder is :' + JSON.stringify(videoRecorder))
console.info(TAG + 'videoRecorder.prepare called.')
videoRecorder.prepare(videoConfig, (err) => {
console.info(TAG + 'videoRecorder.prepare success.')
})
videoRecorder.getInputSurface((err, id) => {
console.info(TAG + 'getInputSurface called')
videoId = id
console.info(TAG + 'getInputSurface surfaceId: ' + JSON.stringify(videoId))
})
})
}
describe('VideoModePromise', function () {
console.info(TAG + '----------Camera-VideoMode-Promise--------------')
beforeAll(async function () {
await applyPermission();
console.info('beforeAll case');
})
beforeEach(function () {
sleep(5);
console.info('beforeEach case');
})
afterEach(async function () {
await closeFd();
console.info('afterEach case');
})
afterAll(function () {
console.info('afterAll case');
})
/**
* @tc.number : GET_CAMERA_MANAGER_PROMISE
* @tc.name : Create camera manager instance promise api
* @tc.desc : Create camera manager instance promise api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_CAMERA_MANAGER_PROMISE', 0, async function (done) {
console.info('--------------GET_CAMERA_MANAGER_PROMISE--------------')
cameraManagerPromise = await cameraObj.getCameraManager(null)
console.info(TAG + 'Entering GET_CAMERA_MANAGER_PROMISE cameraManagerPromise: ' + cameraManagerPromise)
if (cameraManagerPromise != null && cameraManagerPromise != undefined) {
expect(true).assertTrue()
console.info(TAG + 'Entering GET_CAMERA_MANAGER_PROMISE PASSED')
} else {
expect().assertFail()
console.info(TAG + 'Entering GET_CAMERA_MANAGER_PROMISE FAILED')
}
console.info(TAG + 'Entering GET_CAMERA_MANAGER_PROMISE ends here')
await sleep(1)
done()
})
/**
* @tc.number : CAMERA_STATUS_CALLBACK
* @tc.name : camera status callback on CameraManager async api
* @tc.desc : camera status callback on CameraManager async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CAMERA_STATUS_CALLBACK', 0, async function (done) {
if (cameraManagerPromise == null || cameraManagerPromise == undefined) {
console.info(TAG + 'Entering CAMERA_STATUS_CALLBACK cameraManagerPromise == null || undefined')
} else {
console.info(TAG + 'Entering CAMERA_STATUS_CALLBACK to operate')
await sleep(1)
cameraManagerPromise.on("cameraStatus", async (err, data) => {
if (!err) {
console.info(TAG + "Camera status Callback on cameraManagerPromise is success");
if (data != null || data != undefined) {
console.info(TAG + "Camera status Callback CameraStatusInfo_Camera: " + data.camera);
console.info(TAG + "Camera status Callback CameraStatusInfo_Status: " + data.status);
expect(true).assertTrue();
}
} else {
expect().assertFail();
}
await sleep(1);
done();
})
await sleep(1);
done();
}
})
/**
* @tc.number : GET_CAMERAS_PROMISE
* @tc.name : Create camera manager instance promise api
* @tc.desc : Create camera manager instance promise api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_CAMERAS_PROMISE', 0, async function (done) {
console.info('--------------GET_CAMERAS_PROMISE--------------')
camerasArrayPromise = await cameraManagerPromise.getCameras()
console.info(TAG + 'Entering GET_CAMERAS_PROMISE: ' + JSON.stringify(camerasArrayPromise))
if (camerasArrayPromise != null && camerasArrayPromise.length > 0) {
console.info(TAG + 'Entering GET_CAMERAS_PROMISE success')
for (var i = 0; i < camerasArrayPromise.length; i++) {
// Get the variables from camera object
var cameraId = camerasArrayPromise[i].cameraId
console.info(TAG + 'Entering GET_CAMERAS_PROMISE camera' + i + 'Id: ' + cameraId)
var cameraPosition = camerasArrayPromise[i].cameraPosition
console.info(TAG + 'Entering GET_CAMERAS_PROMISE camera' + i + 'Position: ' + cameraPosition)
var cameraType = camerasArrayPromise[i].cameraType
console.info(TAG + 'Entering GET_CAMERAS_PROMISE camera' + i + 'Type: ' + cameraType)
var connectionType = camerasArrayPromise[i].connectionType
console.info(TAG + 'Entering GET_CAMERAS_PROMISE connection' + i + 'Type: ' + connectionType)
}
expect(true).assertTrue()
console.info(TAG + 'Entering GET_CAMERAS_PROMISE PASSED')
} else {
expect().assertFail()
console.info(TAG + 'Entering GET_CAMERAS_PROMISE FAILED')
}
console.info(TAG + 'Entering GET_CAMERAS_PROMISE ends here')
await sleep(1)
done()
})
/*CAMERA-0 Scripts*/
/**
* @tc.number : CREATE_CAMERA_INPUT_PROMISE
* @tc.name : Create camerainput from camera-0 cameraId promise api
* @tc.desc : Create camerainput from camera-0 cameraId promise api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CREATE_CAMERA_INPUT_PROMISE', 0, async function (done) {
console.info('--------------CREATE_CAMERA_INPUT_PROMISE--------------')
camera0InputPromise = await cameraManagerPromise.createCameraInput(camerasArrayPromise[0].cameraId)
console.info(TAG + 'Entering CREATE_CAMERA_INPUT_PROMISE camera0InputPromise: ' + JSON.stringify(camera0InputPromise))
if (camera0InputPromise != null && camera0InputPromise != undefined) {
console.info(TAG + 'Entering CREATE_CAMERA_INPUT_PROMISE camera0InputPromise is not null || undefined')
expect(true).assertTrue()
console.info(TAG + 'Entering CREATE_CAMERA_INPUT_PROMISE PASSED')
} else {
expect().assertFail()
console.info(TAG + 'Entering CREATE_CAMERA_INPUT_PROMISE FAILED')
}
console.info(TAG + 'Entering CREATE_CAMERA_INPUT_PROMISE ends here')
await sleep(1)
done()
})
/**
* @tc.number : CAMERA_INPUT_CALLBACK_ON_ERROR
* @tc.name : Photo output callback on error api
* @tc.desc : Photo output callback on error api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CAMERA_INPUT_CALLBACK_ON_ERROR', 0, async function (done) {
if (camera0InputPromise == null || camera0InputPromise == undefined) {
console.info(TAG + "Entering CAMERA_INPUT_CALLBACK_ON_ERROR camera0InputPromise == null || undefined");
} else {
console.info(TAG + "Entering CAMERA_INPUT_CALLBACK_ON_ERROR to operate");
camera0InputPromise.on("error", async (err, data) => {
if (!err) {
console.info(TAG + "camera0InputPromise error callback is success");
if (data != null || data != undefined) {
console.info(TAG + "Error during camera0InputPromise with ErrorCode: " + data.code);
expect(true).assertTrue();
}
} else {
expect().assertFail();
}
await sleep(1);
done();
})
await sleep(1);
done();
}
})
/**
* @tc.number : CREATE_PREVIEW_OUTPUT_PROMISE
* @tc.name : Create previewoutput promise api
* @tc.desc : Create previewoutput promise api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CREATE_PREVIEW_OUTPUT_PROMISE', 0, async function (done) {
console.info('--------------CREATE_PREVIEW_OUTPUT_PROMISE--------------')
previewOutputPromise = await cameraObj.createPreviewOutput(surfaceId)
console.info(TAG + 'Entering CREATE_PREVIEW_OUTPUT_PROMISE previewOutputPromise: ' + JSON.stringify(previewOutputPromise))
if (previewOutputPromise != null && previewOutputPromise != undefined) {
console.info(TAG + 'Entering CREATE_PREVIEW_OUTPUT_PROMISE previewOutputPromise is not null || undefined')
expect(true).assertTrue()
console.info(TAG + 'Entering CREATE_PREVIEW_OUTPUT_PROMISE PASSED')
} else {
expect().assertFail()
console.info(TAG + 'Entering CREATE_PREVIEW_OUTPUT_PROMISE FAILED')
}
console.info(TAG + 'Entering CREATE_PREVIEW_OUTPUT_PROMISE ends here')
await sleep(1)
done()
})
/**
* @tc.number : PREVIEW_OUTPUT_CALLBACK_ON_ERROR
* @tc.name : PreviewOutput callback onerror async api
* @tc.desc : PreviewOutput callback onerror async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('PREVIEW_OUTPUT_CALLBACK_ON_ERROR', 0, async function (done) {
if (previewOutputPromise == null || previewOutputPromise == undefined) {
console.info(TAG + 'Entering PREVIEW_OUTPUT_CALLBACK_ON_ERROR previewOutputPromise == null || undefined')
} else {
console.info(TAG + 'Entering PREVIEW_OUTPUT_CALLBACK_ON_ERROR to operate')
await sleep(1)
previewOutputPromise.on('error', async (err, data) => {
if (!err) {
console.info(TAG + "PreviewOutputError callback is success");
if (data != null || data != undefined) {
console.info(TAG + "Error during PreviewOutput with ErrorCode: " + data.code);
expect(true).assertTrue();
}
} else {
expect().assertFail();
}
await sleep(1);
done();
})
await sleep(1);
done();
}
})
/**
* @tc.number : CREATE_VIDEO_OUTPUT_PROMISE
* @tc.name : Create videooutput promise api
* @tc.desc : Create videooutput promise api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CREATE_VIDEO_OUTPUT_PROMISE', 0, async function (done) {
console.info(TAG + 'Entering CREATE_VIDEO_OUTPUT_PROMISE to operate')
await getvideosurface()
await sleep(2)
videoOutputPromise = await cameraObj.createVideoOutput(videoId)
console.info(TAG + 'Entering CREATE_VIDEO_OUTPUT_PROMISE: ' + videoOutputPromise)
if (videoOutputPromise != null && videoOutputPromise != undefined) {
expect(true).assertTrue()
console.info(TAG + 'Entering CREATE_VIDEO_OUTPUT_PROMISE PASSED')
} else {
expect(true).assertTrue()
console.info(TAG + 'Entering CREATE_VIDEO_OUTPUT_PROMISE PASSED')
}
console.info(TAG + 'Entering CREATE_VIDEO_OUTPUT_PROMISE ends here');
await sleep(1);
done();
})
/**
* @tc.number : VIDEO_OUTPUT_CALLBACK_ON_ERROR
* @tc.name : VideoOutput callback onerror async api
* @tc.desc : VideoOutput callback onerror async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('VIDEO_OUTPUT_CALLBACK_ON_ERROR', 0, async function (done) {
if (videoOutputPromise == null || videoOutputPromise == undefined) {
console.info(TAG + 'Entering VIDEO_OUTPUT_CALLBACK_ON_ERROR videoOutputPromise == null || undefined')
} else {
console.info(TAG + 'Entering VIDEO_OUTPUT_CALLBACK_ON_ERROR to operate')
await sleep(1)
videoOutputPromise.on('error', async (err, data) => {
if (!err) {
console.info(TAG + 'VideoOutput Errorcallback is success')
if (data != null || data != undefined) {
console.info(TAG + "Error during videoOutput with ErrorCode: " + data.code);
expect(true).assertTrue()
}
} else {
expect().assertFail()
}
await sleep(1)
done()
})
await sleep(1)
done();
}
})
/**
* @tc.number : CREATE_CAPTURE_SESSION_PROMISE
* @tc.name : Create capturesession promise api
* @tc.desc : Create capturesession promise api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CREATE_CAPTURE_SESSION_PROMISE', 0, async function (done) {
console.info(TAG + 'Entering CREATE_CAPTURE_SESSION_PROMISE to operate')
captureSessionPromise = await cameraObj.createCaptureSession(null)
console.info(TAG + 'Entering CREATE_CAPTURE_SESSION_PROMISE: ' + captureSessionPromise)
if (captureSessionPromise != null && captureSessionPromise != undefined) {
expect(true).assertTrue()
console.info(TAG + 'Entering CREATE_CAPTURE_SESSION_PROMISE PASSED')
} else {
expect(true).assertTrue()
console.info(TAG + 'Entering CREATE_CAPTURE_SESSION_PROMISE PASSED')
}
console.info(TAG + 'Entering CREATE_CAPTURE_SESSION_PROMISE ends here');
await sleep(1);
done();
})
/**
* @tc.number : CAP_SES_CALLBACK_ON_ERROR
* @tc.name : CaptureSession callback onerror async api
* @tc.desc : CaptureSession callback onerror async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CAP_SES_CALLBACK_ON_ERROR', 0, async function (done) {
if (captureSessionPromise == null || captureSessionPromise == undefined) {
console.info(TAG + 'Entering CAP_SES_CALLBACK_ON_ERROR captureSessionPromise == null || undefined')
} else {
console.info(TAG + 'Entering CAP_SES_CALLBACK_ON_ERROR to operate')
await sleep(1)
captureSessionPromise.on('error', async (err, data) => {
if (!err) {
console.info(TAG + " captureSession errorcallback is success");
if (data != null || data != undefined) {
console.info(TAG + "Error in CaptureSessioncallback with ErrorCode: " + data.code);
expect(true).assertTrue();
}
} else {
expect().assertFail();
}
await sleep(1);
done();
})
await sleep(1);
done();
}
})
/**
* @tc.number : BEGIN_CONFIG_PROMISE
* @tc.name : CaptureSession begin config promise api
* @tc.desc : CaptureSession begin config promise api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('BEGIN_CONFIG_PROMISE', 0, async function (done) {
if (captureSessionPromise == null || captureSessionPromise == undefined) {
console.info(TAG + 'Entering BEGIN_CONFIG_PROMISE captureSessionPromise == null || undefined')
} else {
console.info(TAG + 'Entering BEGIN_CONFIG_PROMISE to operate')
await captureSessionPromise.beginConfig()
expect(true).assertTrue()
console.info(TAG + 'Entering BEGIN_CONFIG_PROMISE PASSED')
console.info(TAG + 'Entering BEGIN_CONFIG_PROMISE ends here')
await sleep(1)
done()
}
await sleep(1)
done()
})
/**
* @tc.number : ADD_INPUT_PROMISE
* @tc.name : AddInput promise api
* @tc.desc : AddInput promise api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('ADD_INPUT_PROMISE', 0, async function (done) {
if (captureSessionPromise == null || captureSessionPromise == undefined) {
console.info(TAG + 'Entering ADD_INPUT_PROMISE captureSessionPromise == null || undefined')
} else {
console.info(TAG + 'Entering ADD_INPUT_PROMISE to operate')
await captureSessionPromise.addInput(camera0InputPromise)
expect(true).assertTrue()
console.info(TAG + 'Entering ADD_INPUT_PROMISE PASSED')
console.info(TAG + 'Entering ADD_INPUT_PROMISE ends here')
await sleep(1)
done()
}
await sleep(1)
done()
})
/**
* @tc.number : ADD_OUTPUT_PREVIEW_PROMISE
* @tc.name : AddOutput preview promise api
* @tc.desc : AddOutput preview promise api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('ADD_OUTPUT_PREVIEW_PROMISE', 0, async function (done) {
if (captureSessionPromise == null || captureSessionPromise == undefined) {
console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW_PROMISE captureSessionPromise == null || undefined')
} else {
console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW_PROMISE to operate')
await captureSessionPromise.addOutput(previewOutputPromise)
expect(true).assertTrue()
console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW_PROMISE PASSED')
console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW_PROMISE ends here')
await sleep(1)
done()
}
await sleep(1)
done()
})
/**
* @tc.number : ADD_OUTPUT_VIDEO_PROMISE
* @tc.name : AddOutput video promise api
* @tc.desc : AddOutput video promise api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('ADD_OUTPUT_VIDEO_PROMISE', 0, async function (done) {
if (captureSessionPromise == null || captureSessionPromise == undefined) {
console.info(TAG + 'Entering ADD_OUTPUT_VIDEO_PROMISE captureSessionPromise == null || undefined')
} else {
console.info(TAG + 'Entering ADD_OUTPUT_VIDEO_PROMISE to operate')
await captureSessionPromise.addOutput(videoOutputPromise)
expect(true).assertTrue()
console.info(TAG + 'Entering ADD_OUTPUT_VIDEO_PROMISE PASSED')
console.info(TAG + 'Entering ADD_OUTPUT_VIDEO_PROMISE ends here')
await sleep(1)
done()
}
await sleep(1)
done()
})
/**
* @tc.number : REMOVE_INPUT_SUCCESS
* @tc.name : remove input api
* @tc.desc : remove input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('REMOVE_INPUT_SUCCESS', 0, async function (done) {
if (captureSessionPromise == null || captureSessionPromise == undefined) {
console.info(TAG + "Entering REMOVE_INPUT_SUCCESS captureSession == null || undefined");
} else {
console.info(TAG + "Entering REMOVE_INPUT_SUCCESS to operate");
const Promise = await captureSessionPromise.removeInput(camera0InputPromise);
console.info(TAG + "Entering REMOVE_INPUT_SUCCESS success " + Promise);
if (Promise != null || Promise != undefined) {
console.info(TAG + "Entering REMOVE_INPUT_SUCCESS data is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "Entering REMOVE_INPUT_SUCCESS PASSED");
}
else {
expect().assertFail();
console.info(TAG + "Entering REMOVE_INPUT_SUCCESS FAILED: ");
}
console.info(TAG + "Entering REMOVE_INPUT_SUCCESS ends here");
await sleep(1);
done();
}
await sleep(1);
done();
})
/**
* @tc.number : REMOVE_PREVIEW_OUTPUT_SUCCESS
* @tc.name : Remove preview Output api
* @tc.desc : Remove preview Output api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('REMOVE_PREVIEW_OUTPUT_SUCCESS', 0, async function (done) {
if (captureSessionPromise == null || captureSessionPromise == undefined) {
console.info(TAG + "Entering REMOVE_PREVIEW_OUTPUT_SUCCESS captureSession == null || undefined");
} else {
console.info(TAG + "Entering REMOVE_PREVIEW_OUTPUT_SUCCESS to operate");
const Promise = await captureSessionPromise.removeOutput(previewOutputPromise);
console.info(TAG + "Entering REMOVE_PREVIEW_OUTPUT_SUCCESS addInput success " + Promise);
if (Promise != null || Promise != undefined) {
console.info(TAG + "Entering REMOVE_PREVIEW_OUTPUT_SUCCESS addInput data is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "Entering REMOVE_PREVIEW_OUTPUT_SUCCESS addInput PASSED");
}
else {
expect().assertFail();
console.info(TAG + "Entering REMOVE_PREVIEW_OUTPUT_SUCCESS FAILED: ");
}
console.info(TAG + "Entering REMOVE_PREVIEW_OUTPUT_SUCCESS ends here");
await sleep(1);
done();
}
await sleep(1);
done();
})
/**
* @tc.number : REMOVE_VIDEO_OUTPUT_SUCCESS
* @tc.name : Remove video Output api
* @tc.desc : Remove video Output api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('REMOVE_VIDEO_OUTPUT_SUCCESS', 0, async function (done) {
if (captureSessionPromise == null || captureSessionPromise == undefined) {
console.info(TAG + "Entering REMOVE_VIDEO_OUTPUT_SUCCESS captureSession == null || undefined");
} else {
console.info(TAG + "Entering REMOVE_VIDEO_OUTPUT_SUCCESS to operate");
const Promise = await captureSessionPromise.removeOutput(videoOutputPromise);
console.info(TAG + "Entering REMOVE_VIDEO_OUTPUT_SUCCESS addInput success " + Promise);
if (Promise != null || Promise != undefined) {
console.info(TAG + "Entering REMOVE_VIDEO_OUTPUT_SUCCESS addInput data is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "Entering REMOVE_VIDEO_OUTPUT_SUCCESS addInput PASSED");
}
else {
expect().assertFail();
console.info(TAG + "Entering REMOVE_VIDEO_OUTPUT_SUCCESS FAILED: ");
}
console.info(TAG + "Entering REMOVE_VIDEO_OUTPUT_SUCCESS ends here");
await sleep(1);
done();
}
await sleep(1);
done();
})
/**
* @tc.number : ADD_INPUT_PROMISE1
* @tc.name : AddInput promise api
* @tc.desc : AddInput promise api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('ADD_INPUT_PROMISE1', 0, async function (done) {
if (captureSessionPromise == null || captureSessionPromise == undefined) {
console.info(TAG + 'Entering ADD_INPUT_PROMISE1 captureSessionPromise == null || undefined')
} else {
console.info(TAG + 'Entering ADD_INPUT_PROMISE1 to operate')
await captureSessionPromise.addInput(camera0InputPromise)
expect(true).assertTrue()
console.info(TAG + 'Entering ADD_INPUT_PROMISE1 PASSED')
console.info(TAG + 'Entering ADD_INPUT_PROMISE1 ends here')
await sleep(1)
done()
}
await sleep(1)
done()
})
/**
* @tc.number : ADD_OUTPUT_PREVIEW_PROMISE1
* @tc.name : AddOutput preview promise api
* @tc.desc : AddOutput preview promise api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('ADD_OUTPUT_PREVIEW_PROMISE1', 0, async function (done) {
if (captureSessionPromise == null || captureSessionPromise == undefined) {
console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW_PROMISE1 captureSessionPromise == null || undefined')
} else {
console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW_PROMISE1 to operate')
await captureSessionPromise.addOutput(previewOutputPromise)
expect(true).assertTrue()
console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW_PROMISE1 PASSED')
console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW_PROMISE1 ends here')
await sleep(1)
done()
}
await sleep(1)
done()
})
/**
* @tc.number : ADD_OUTPUT_VIDEO_PROMISE1
* @tc.name : AddOutput video promise api
* @tc.desc : AddOutput video promise api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('ADD_OUTPUT_VIDEO_PROMISE1', 0, async function (done) {
if (captureSessionPromise == null || captureSessionPromise == undefined) {
console.info(TAG + 'Entering ADD_OUTPUT_VIDEO_PROMISE1 captureSessionPromise == null || undefined')
} else {
console.info(TAG + 'Entering ADD_OUTPUT_VIDEO_PROMISE1 to operate')
await captureSessionPromise.addOutput(videoOutputPromise)
expect(true).assertTrue()
console.info(TAG + 'Entering ADD_OUTPUT_VIDEO_PROMISE1 PASSED')
console.info(TAG + 'Entering ADD_OUTPUT_VIDEO_PROMISE1 ends here')
await sleep(1)
done()
}
await sleep(1)
done()
})
/**
* @tc.number : COMMIT_CONFIG_PROMISE
* @tc.name : CommitConfig promise api
* @tc.desc : CommitConfig promise api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('COMMIT_CONFIG_PROMISE', 0, async function (done) {
if (captureSessionPromise == null || captureSessionPromise == undefined) {
console.info(TAG + 'Entering COMMIT_CONFIG_PROMISE captureSessionPromise == null || undefined')
} else {
console.info(TAG + 'Entering COMMIT_CONFIG_PROMISE to operate')
await captureSessionPromise.commitConfig()
expect(true).assertTrue()
console.info(TAG + 'Entering COMMIT_CONFIG_PROMISE PASSED')
console.info(TAG + 'Entering COMMIT_CONFIG_PROMISE ends here')
await sleep(1)
done()
}
await sleep(1)
done()
})
/**
* @tc.number : PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START
* @tc.name : Preview output callback on frame start api
* @tc.desc : Preview output callback on frame start api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START', 0, async function (done) {
if (previewOutputPromise == null || previewOutputPromise == undefined) {
console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START previewOutput == null || undefined");
} else {
console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START to operate");
previewOutputPromise.on("frameStart", async (err, data) => {
if (!err) {
console.info(TAG + "PreviewStart frameStart Callback is success");
if (data != null || data != undefined) {
expect(true).assertTrue();
}
} else {
expect().assertFail()
}
await sleep(1);
done();
})
await sleep(1);
done();
}
})
/**
* @tc.number : PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END
* @tc.name : PreviewOutput callback onframeend async api
* @tc.desc : PreviewOutput callback onframeend async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END', 0, async function (done) {
if (previewOutputPromise == null || previewOutputPromise == undefined) {
console.info(TAG + 'Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END previewOutputPromise == null || undefined')
} else {
console.info(TAG + 'Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END to operate')
await sleep(1)
previewOutputPromise.on('frameEnd', async (err, data) => {
if (!err) {
console.info(TAG + "PreviewStop frameEnd Callback is success");
if (data != null || data != undefined) {
expect(true).assertTrue();
}
} else {
expect().assertFail();
}
await sleep(1);
done();
})
await sleep(1);
done();
}
})
/**
* @tc.number : VIDEO_OUTPUT_CALLBACK_ON_FRAME_START
* @tc.name : VideoOutput callback onframestart async api
* @tc.desc : VideoOutput callback onframestart async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('VIDEO_OUTPUT_CALLBACK_ON_FRAME_START', 0, async function (done) {
if (videoOutputPromise == null || videoOutputPromise == undefined) {
console.info(TAG + 'Entering VIDEO_OUTPUT_CALLBACK_ON_FRAME_START videoOutputPromise == null || undefined')
} else {
console.info(TAG + 'Entering VIDEO_OUTPUT_CALLBACK_ON_FRAME_START to operate')
await sleep(1)
videoOutputPromise.on('frameStart', async (err, data) => {
if (!err) {
console.info(TAG + "Video frameStart Callback is success");
if (data != null || data != undefined) {
expect(true).assertTrue();
}
} else {
expect().assertFail()
}
await sleep(1);
done();
})
await sleep(1);
done();
}
})
/**
* @tc.number : VIDEO_OUTPUT_CALLBACK_ON_FRAME_END
* @tc.name : VideoOutput callback onframeend async api
* @tc.desc : VideoOutput callback onframeend async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('VIDEO_OUTPUT_CALLBACK_ON_FRAME_END', 0, async function (done) {
if (videoOutputPromise == null || videoOutputPromise == undefined) {
console.info(TAG + 'Entering VIDEO_OUTPUT_CALLBACK_ON_FRAME_END videoOutputPromise == null || undefined')
} else {
console.info(TAG + 'Entering VIDEO_OUTPUT_CALLBACK_ON_FRAME_END to operate')
await sleep(1)
videoOutputPromise.on('frameEnd', async (err, data) => {
if (!err) {
console.info(TAG + 'Video frameEnd callback is success')
if (data != null || data != undefined) {
expect(true).assertTrue()
}
} else {
expect().assertFail()
}
await sleep(1);
done();
})
await sleep(1);
done();
}
})
/**
* @tc.number : CAPTURE_SESSION_START_PROMISE
* @tc.name : CaptureSession start promise api
* @tc.desc : CaptureSession start promise api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CAPTURE_SESSION_START_PROMISE', 0, async function (done) {
if (captureSessionPromise == null || captureSessionPromise == undefined) {
console.info(TAG + 'Entering CAPTURE_SESSION_START_PROMISE captureSessionPromise == null || undefined')
} else {
console.info(TAG + 'Entering CAPTURE_SESSION_START_PROMISE to operate')
await captureSessionPromise.start()
expect(true).assertTrue()
console.info(TAG + 'Entering CAPTURE_SESSION_START_PROMISE PASSED')
console.info(TAG + 'Entering CAPTURE_SESSION_START_PROMISE ends here')
await sleep(1)
done()
}
await sleep(1)
done()
})
//FLASH Function API scripts
/**
* @tc.number : HAS_FLASH
* @tc.name : check if has flash-camera0Input api
* @tc.desc : check if has flash-camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('HAS_FLASH', 0, async function (done) {
console.info("--------------HAS_FLASH--------------");
console.info(TAG + 'hasFlash called.')
var hasFlashPromise = await camera0InputPromise.hasFlash();
console.info(TAG + "Entering HAS_FLASH success");
if (hasFlashPromise != null || hasFlashPromise != undefined) {
console.info(TAG + "Entering HAS_FLASH data is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "Entering HAS_FLASH PASSED with HAS_FLASH is: " + JSON.stringify(hasFlashPromise));
}
else {
expect().assertFail();
console.info(TAG + "Entering HAS_FLASH FAILED");
}
console.info(TAG + "Entering HAS_FLASH_TC_021 ends here");
await sleep(1)
done();
})
/**
* @tc.number : IS_FLASH_MODE_OPEN_SUPPORTED
* @tc.name : check if flash mode open is supported-camera0Input api
* @tc.desc : check if flash mode open is supported-camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('IS_FLASH_MODE_OPEN_SUPPORTED', 0, async function (done) {
console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED to operate");
var isFMOpenSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_OPEN);
console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED SUCCESS ");
if (isFMOpenSupported != null || isFMOpenSupported != undefined) {
console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED data is not null || undefined");
console.info(TAG + "FLASH_MODE_OPEN supported is: " + JSON.stringify(isFMOpenSupported));
expect(true).assertTrue();
console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED PASSED");
}
else {
console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED FAILED");
console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED ends here");
}
await sleep(1);
done();
})
/**
* @tc.number : SET_FLASH_MODE_OPEN
* @tc.name : set flash mode open camera0 api
* @tc.desc : set flash mode open camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_FLASH_MODE_OPEN', 0, async function (done) {
console.info(TAG + "Entering SET_FLASH_MODE_OPEN to operate");
var SetFMOpen = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_OPEN);
console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMOpen))
if (SetFMOpen == undefined) {
console.info(TAG + "Entering SET_FLASH_MODE_OPEN SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_OPEN);
console.info(TAG + "Entering SET_FLASH_MODE_OPEN PASSED")
expect(true).assertTrue()
} else {
expect().assertFail();
console.info(TAG + "Entering SET_FLASH_MODE_OPEN FAILED");
console.info(TAG + "Entering SET_FLASH_MODE_OPEN ends here");
}
await sleep(1);
done();
})
/**
* @tc.number : GET_FLASH_MODE_OPEN
* @tc.name : get flash mode open camera0 api
* @tc.desc : get flash mode open camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_FLASH_MODE_OPEN', 0, async function (done) {
console.info(TAG + "Entering GET_FLASH_MODE_OPEN to operate");
var GetFMOpen = await camera0InputPromise.getFlashMode();
console.info(TAG + "Entering GET_FLASH_MODE_OPEN success: " + JSON.stringify(GetFMOpen));
if (GetFMOpen == 1) {
console.info(TAG + "GET_FLASH_MODE_OPEN data is not null || undefined: ");
console.info(TAG + "Current FlashMode is: " + JSON.stringify(GetFMOpen));
expect(true).assertTrue();
console.info(TAG + "GET_FLASH_MODE_OPEN PASSED");
}
else {
expect().assertFail();
console.info(TAG + "GET_FLASH_MODE_OPEN FAILED");
console.info(TAG + "GET_FLASH_MODE_OPEN ends here");
}
await sleep(1);
done();
})
/**
* @tc.number : IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED
* @tc.name : check if flash mode always open is supported-camera0Input api
* @tc.desc : check if flash mode always open is supported-camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED', 0, async function (done) {
console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED to operate");
var isFMAlwaysOpenSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN);
console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED SUCCESS ");
if (isFMAlwaysOpenSupported != null || isFMAlwaysOpenSupported != undefined) {
console.info(TAG + "Entering FLASH_MODE_ALWAYS_OPEN data is not null || undefined");
console.info(TAG + "FLASH_MODE_OPEN supported is: " + isFMAlwaysOpenSupported);
expect(true).assertTrue();
console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED PASSED");
}
else {
console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED FAILED");
console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED ends here");
}
await sleep(1);
done();
})
/**
* @tc.number : SET_FLASH_MODE_ALWAYS_OPEN
* @tc.name : set flash mode always open camera0 api
* @tc.desc : set flash mode always open camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_FLASH_MODE_ALWAYS_OPEN', 0, async function (done) {
console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN to operate");
var SetFMAlwaysOpen = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN);
console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMAlwaysOpen))
if (SetFMAlwaysOpen == undefined) {
console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN);
console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN PASSED")
expect(true).assertTrue()
} else {
expect().assertFail();
console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN FAILED");
console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN ends here");
}
await sleep(1);
done();
})
/**
* @tc.number : GET_FLASH_MODE_ALWAYS_OPEN
* @tc.name : get flash mode always open camera0 api
* @tc.desc : get flash mode always open camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_FLASH_MODE_ALWAYS_OPEN', 0, async function (done) {
console.info(TAG + "Entering GET_FLASH_MODE_ALWAYS_OPEN to operate");
var GetFMAlwaysOpen = await camera0InputPromise.getFlashMode();
console.info(TAG + "Entering GET_FLASH_MODE_ALWAYS_OPEN success");
if (GetFMAlwaysOpen == 3) {
console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN data is not null || undefined: ");
console.info(TAG + "Current FlashMode is: " + GetFMAlwaysOpen);
expect(true).assertTrue();
console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN PASSED");
}
else {
expect().assertFail();
console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN FAILED");
console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN ends here");
}
await sleep(1);
done();
})
/**
* @tc.number : IS_FLASH_MODE_AUTO_SUPPORTED
* @tc.name : check if flash mode always open is supported-camera0Input api
* @tc.desc : check if flash mode always open is supported-camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('IS_FLASH_MODE_AUTO_SUPPORTED', 0, async function (done) {
console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED to operate");
var isFMAutoSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_AUTO);
console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED SUCCESS ");
if (isFMAutoSupported != null || isFMAutoSupported != undefined) {
console.info(TAG + "Entering FLASH_MODE_AUTO data is not null || undefined");
console.info(TAG + "FLASH_MODE_AUTO supported is: " + isFMAutoSupported);
expect(isFMAutoSupported).assertEqual(false);
console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED PASSED");
}
else {
console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED FAILED");
console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED ends here");
}
await sleep(1);
done();
})
/**
* @tc.number : IS_FLASH_MODE_CLOSE_SUPPORTED
* @tc.name : check if flash mode close is supported-camera0Input api
* @tc.desc : check if flash mode close is supported-camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('IS_FLASH_MODE_CLOSE_SUPPORTED', 0, async function (done) {
console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED to operate");
var isFMCloseSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_CLOSE);
console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED SUCCESS ");
if (isFMCloseSupported != null || isFMCloseSupported != undefined) {
console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED data is not null || undefined");
console.info(TAG + "FLASH_MODE_CLOSE supported is: " + isFMCloseSupported);
expect(true).assertTrue();
console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED PASSED");
}
else {
console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED FAILED");
console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED ends here");
}
await sleep(1);
done();
})
/**
* @tc.number : SET_FLASH_MODE_CLOSE
* @tc.name : set flash mode close camera0 api
* @tc.desc : set flash mode close camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_FLASH_MODE_CLOSE', 0, async function (done) {
console.info(TAG + "Entering SET_FLASH_MODE_CLOSE to operate");
var SetFMClose = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_CLOSE);
console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMClose))
if (SetFMClose == undefined) {
console.info(TAG + "Entering SET_FLASH_MODE_CLOSE SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_CLOSE);
console.info(TAG + "Entering SET_FLASH_MODE_CLOSE PASSED")
expect(true).assertTrue()
} else {
expect().assertFail();
console.info(TAG + "Entering SET_FLASH_MODE_CLOSE FAILED");
console.info(TAG + "Entering SET_FLASH_MODE_CLOSE ends here");
}
await sleep(1);
done();
})
/**
* @tc.number : GET_FLASH_MODE_CLOSE
* @tc.name : get flash mode close camera0 api
* @tc.desc : get flash mode close camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_FLASH_MODE_CLOSE', 0, async function (done) {
console.info(TAG + "Entering GET_FLASH_MODE_CLOSE to operate");
var GetFMClose = await camera0InputPromise.getFlashMode();
console.info(TAG + "Entering GET_FLASH_MODE_CLOSE success");
if (GetFMClose == 0) {
console.info(TAG + "GET_FLASH_MODE_CLOSE data is not null || undefined: ");
console.info(TAG + "Current FlashMode is: " + GetFMClose);
expect(true).assertTrue();
console.info(TAG + "GET_FLASH_MODE_CLOSE PASSED");
}
else {
expect().assertFail();
console.info(TAG + "GET_FLASH_MODE_CLOSE FAILED");
console.info(TAG + "GET_FLASH_MODE_CLOSE ends here");
}
await sleep(1);
done();
})
// FOCUS promise API's
/**
* @tc.number : IS_FOCUS_MODE_LOCKED_SUPPORTED
* @tc.name : check if flash mode close is supported-camera0Input api
* @tc.desc : check if flash mode close is supported-camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('IS_FOCUS_MODE_LOCKED_SUPPORTED', 0, async function (done) {
console.info(TAG + "Entering IS_FOCUS_MODE_LOCKED_SUPPORTED to operate");
var isFMLockedSupported = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_LOCKED);
console.info(TAG + "Entering IS_FOCUS_MODE_LOCKED_SUPPORTED SUCCESS ");
if (isFMLockedSupported != null || isFMLockedSupported != undefined) {
console.info(TAG + "Entering IS_FOCUS_MODE_LOCKED_SUPPORTED data is not null || undefined");
console.info(TAG + "IS_FOCUS_MODE_LOCKED_SUPPORTED: " + isFMLockedSupported);
expect(true).assertTrue();
console.info(TAG + "Entering IS_FOCUS_MODE_LOCKED_SUPPORTED PASSED");
}
else {
console.info(TAG + "Entering IS_FOCUS_MODE_LOCKED_SUPPORTED FAILED");
console.info(TAG + "Entering IS_FOCUS_MODE_LOCKED_SUPPORTED ends here");
}
await sleep(1);
done();
})
/**
* @tc.number : SET_FOCUS_MODE_LOCKED
* @tc.name : set focus mode locked camera0 api
* @tc.desc : set focus mode locked camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_FOCUS_MODE_LOCKED', 0, async function (done) {
console.info(TAG + "Entering SET_FOCUS_MODE_LOCKED to operate");
var SetFMLocked = await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_LOCKED);
console.info(TAG + "SetFMLocked: " + JSON.stringify(SetFMLocked))
if (SetFMLocked == undefined) {
console.info(TAG + "Entering SET_FOCUS_MODE_LOCKED SUCCESS, current focusmode is: " + cameraObj.FocusMode.FOCUS_MODE_LOCKED);
console.info(TAG + "Entering SET_FOCUS_MODE_LOCKED PASSED")
expect(true).assertTrue()
} else {
expect().assertFail();
console.info(TAG + "Entering SET_FOCUS_MODE_LOCKED FAILED");
console.info(TAG + "Entering SET_FOCUS_MODE_LOCKED ends here");
}
await sleep(1);
done();
})
/**
* @tc.number : GET_FOCUS_MODE_LOCKED
* @tc.name : get flash mode close camera0 api
* @tc.desc : get flash mode close camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_FOCUS_MODE_LOCKED', 0, async function (done) {
console.info(TAG + "Entering GET_FOCUS_MODE_LOCKED to operate");
var GetFMLocked = await camera0InputPromise.getFocusMode();
console.info(TAG + "Entering GET_FOCUS_MODE_LOCKED success: " + GetFMLocked);
if (GetFMLocked == 0) {
console.info(TAG + "Current focusmode is: " + GetFMLocked);
expect(true).assertTrue();
console.info(TAG + "GET_FOCUS_MODE_LOCKED PASSED");
}
else {
expect().assertFail();
console.info(TAG + "GET_FOCUS_MODE_LOCKED FAILED");
console.info(TAG + "GET_FOCUS_MODE_LOCKED ends here");
}
await sleep(1);
done();
})
/**
* @tc.number : IS_FOCUS_MODE_MANUAL_SUPPORTED
* @tc.name : is focusmode manual supported
* @tc.desc : is focusmode manual supported
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('IS_FOCUS_MODE_MANUAL_SUPPORTED', 0, async function (done) {
console.info(TAG + "Entering IS_FOCUS_MODE_MANUAL_SUPPORTED to operate");
var isFMmanualSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_MANUAL);
if (isFMmanualSupportedpromise != null || isFMmanualSupportedpromise != undefined) {
console.info(TAG + "Entering IS_FOCUS_MODE_MANUAL_SUPPORTED data is not null || undefined");
console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + isFMmanualSupportedpromise);
expect(true).assertTrue();
console.info(TAG + "Entering IS_FOCUS_MODE_MANUAL_SUPPORTED PASSED: ");
}
else {
console.info(TAG + "IS_FOCUS_MODE_MANUAL_SUPPORTED FAILED");
expect().assertFail();
console.info(TAG + "IS_FOCUS_MODE_MANUAL_SUPPORTED ends here");
}
await sleep(1);
done();
})
/**
* @tc.number : SET_FOCUS_MODE_MANUAL
* @tc.name : set focus mode manual camera0 api
* @tc.desc : set focus mode manual camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_FOCUS_MODE_MANUAL', 0, async function (done) {
console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL to operate");
var setFocusManual = await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_MANUAL);
console.info(TAG + "setFocusManual: " + JSON.stringify(setFocusManual))
if (setFocusManual == undefined) {
console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_MANUAL);
console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL PASSED")
expect(true).assertTrue()
}
else {
expect().assertFail();
console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL FAILED");
console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL ends here");
}
await sleep(1);
done();
})
/**
* @tc.number : GET_FOCUS_MODE_MANUAL
* @tc.name : get focus mode manual camera0 api
* @tc.desc : get focus mode manual camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_FOCUS_MODE_MANUAL', 0, async function (done) {
console.info(TAG + "Entering GET_FOCUS_MODE_MANUAL to operate");
var getfocusmodepromise = await camera0InputPromise.getFocusMode();
console.info(TAG + "Entering GET_FOCUS_MODE_MANUAL SUCCESS");
if (getfocusmodepromise == 0) {
console.info(TAG + "Current FocusMode is: " + getfocusmodepromise);
expect(true).assertTrue();
console.info(TAG + "GET_FOCUS_MODE_MANUAL PASSED");
}
else {
expect().assertFail();
console.info(TAG + "GET_FOCUS_MODE_MANUAL FAILED");
console.info(TAG + "GET_FOCUS_MODE_MANUAL ends here");
}
await sleep(1);
done();
})
/**
* @tc.number : IS_FOCUS_MODE_CONTINUOUS_SUPPORTED
* @tc.name : check if focus mode continuous is supported-camera0Input api
* @tc.desc : check if focus mode continuous is supported-camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('IS_FOCUS_MODE_CONTINUOUS_SUPPORTED', 0, async function (done) {
console.info(TAG + "Entering IS_FOCUS_MODE_CONTINUOUS_SUPPORTED to operate");
var isFMContinuousSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO);
if (isFMContinuousSupportedpromise != null || isFMContinuousSupportedpromise != undefined) {
console.info(TAG + "Entering IS_FOCUS_MODE_CONTINUOUS_SUPPORTED data is not null || undefined");
console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + isFMContinuousSupportedpromise);
expect(true).assertTrue();
console.info(TAG + "Entering IS_FOCUS_MODE_CONTINUOUS_SUPPORTED PASSED: ");
}
else {
console.info(TAG + "IS_FOCUS_MODE_CONTINUOUS_SUPPORTED FAILED");
expect().assertFail();
console.info(TAG + "IS_FOCUS_MODE_CONTINUOUS_SUPPORTED ends here");
}
await sleep(1);
done();
})
/**
* @tc.number : SET_FOCUS_MODE_CONTINUOUS
* @tc.name : set focus mode continuous camera0 api
* @tc.desc : set focus mode continuous camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_FOCUS_MODE_CONTINUOUS', 0, async function (done) {
console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS to operate");
var setFocusCont = await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO);
console.info(TAG + "setFocusCont: " + JSON.stringify(setFocusCont))
if (setFocusCont == undefined) {
console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO);
console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS PASSED")
expect(true).assertTrue()
}
else {
expect().assertFail();
console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS FAILED");
console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS ends here");
}
await sleep(1);
done();
})
/**
* @tc.number : GET_FOCUS_MODE_CONTINUOUS
* @tc.name : get focus mode continuous camera0 api
* @tc.desc : get focus mode continuous camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_FOCUS_MODE_CONTINUOUS', 0, async function (done) {
console.info(TAG + "Entering GET_FOCUS_MODE_CONTINUOUS to operate");
var getfocusmodepromise = await camera0InputPromise.getFocusMode();
console.info(TAG + "Entering GET_FOCUS_MODE_CONTINUOUS SUCCESS");
if (getfocusmodepromise == 1) {
console.info(TAG + "Current FocusMode is: " + getfocusmodepromise);
expect(true).assertTrue();
console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS PASSED");
}
else {
expect().assertFail();
console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS FAILED");
console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS ends here");
}
await sleep(1);
done();
})
/**
* @tc.number : IS_FOCUS_MODE_AUTO_SUPPORTED
* @tc.name : check if focus mode auto is supported-camera0Input api
* @tc.desc : check if focus mode auto is supported-camera0Input api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('IS_FOCUS_MODE_AUTO_SUPPORTED', 0, async function (done) {
console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED to operate");
var isFMAutoSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO);
if (isFMAutoSupportedpromise != null || isFMAutoSupportedpromise != undefined) {
console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED data is not null || undefined");
console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + isFMAutoSupportedpromise);
expect(true).assertTrue();
console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED PASSED: ");
}
else {
console.info(TAG + "IS_FOCUS_MODE_AUTO_SUPPORTED FAILED");
expect().assertFail();
console.info(TAG + "IS_FOCUS_MODE_AUTO_SUPPORTED ends here");
}
await sleep(1);
done();
})
/**
* @tc.number : SET_FOCUS_MODE_AUTO
* @tc.name : set focus mode auto camera0 api
* @tc.desc : set focus mode auto camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_FOCUS_MODE_AUTO', 0, async function (done) {
console.info(TAG + "Entering SET_FOCUS_MODE_AUTO to operate");
var setFocusAuto = await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO);
console.info(TAG + "setFocusAuto: " + JSON.stringify(setFocusAuto))
if (setFocusAuto == undefined) {
console.info(TAG + "Entering SET_FOCUS_MODE_AUTO SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_AUTO);
console.info(TAG + "Entering SET_FOCUS_MODE_AUTO PASSED")
expect(true).assertTrue()
}
else {
expect().assertFail();
console.info(TAG + "Entering SET_FOCUS_MODE_AUTO FAILED");
console.info(TAG + "Entering SET_FOCUS_MODE_AUTO ends here");
}
await sleep(1);
done();
})
/**
* @tc.number : GET_FOCUS_MODE_AUTO
* @tc.name : get focus mode auto camera0 api
* @tc.desc : get focus mode auto camera0 api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_FOCUS_MODE_AUTO', 0, async function (done) {
console.info(TAG + "Entering GET_FOCUS_MODE_AUTO to operate");
var getfocusmodepromise = await camera0InputPromise.getFocusMode();
console.info(TAG + "Entering GET_FOCUS_MODE_AUTO SUCCESS");
if (getfocusmodepromise == 2) {
console.info(TAG + "Current FocusMode is: " + getfocusmodepromise);
expect(true).assertTrue();
console.info(TAG + "GET_FOCUS_MODE_AUTO PASSED");
}
else {
expect().assertFail();
console.info(TAG + "GET_FOCUS_MODE_AUTO FAILED");
console.info(TAG + "GET_FOCUS_MODE_AUTO ends here");
}
await sleep(1);
done();
})
//ZOOM Function
/**
* @tc.number : GET_ZOOM_RATIO_PROMISE
* @tc.name : get zoom ratio camera-0 cameraId api promise api
* @tc.desc : get zoom ratio camera-0 cameraId api promise api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('GET_ZOOM_RATIO_PROMISE', 0, async function (done) {
console.info("--------------GET_ZOOM_RATIO_PROMISE--------------");
var getZoomRatioPromise = await camera0InputPromise.getZoomRatioRange();
console.info(TAG + "Entering GET_ZOOM_RATIO_PROMISE getZoomRatioPromise: " + JSON.stringify(getZoomRatioPromise));
if (getZoomRatioPromise != null && getZoomRatioPromise != undefined) {
console.info(TAG + "Entering GET_ZOOM_RATIO_PROMISE setZoomRatioPromise is not null || undefined");
expect(true).assertTrue();
console.info(TAG + "Entering GET_ZOOM_RATIO_PROMISE success: " + JSON.stringify(getZoomRatioPromise));
console.info(TAG + "Entering GET_ZOOM_RATIO_PROMISE PASSED");
} else {
expect().assertFail();
console.info(TAG + "Entering GET_ZOOM_RATIO_PROMISE FAILED");
}
console.info(TAG + "Entering GET_ZOOM_RATIO_PROMISE ends here");
await sleep(1);
done();
})
/**
* @tc.number : SET_GET_ZOOM_1_PROMISE
* @tc.name : Zoom camera-0 cameraId api
* @tc.desc : Zoom camera-0 cameraId api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_GET_ZOOM_1_PROMISE', 0, async function (done) {
var setpromise = await camera0InputPromise.setZoomRatio(1);
console.info(TAG + "setZoomRatio success: 1");
console.info(TAG + "getZoomRatio called")
var getpromise1 = await camera0InputPromise.getZoomRatio();
console.info(TAG + "getZoomRatio success: " + getpromise1);
if (getpromise1 != null && getpromise1 != undefined) {
expect(getpromise1).assertEqual(1);
console.info(TAG + "SET_GET_ZOOM_1_PROMISE PASSED ");
}
else {
expect().assertFail();
console.info(TAG + "SET_GET_ZOOM_1_PROMISE FAILED");
}
await sleep(1);
done();
})
/**
* @tc.number : SET_GET_ZOOM_2_PROMISE
* @tc.name : Zoom camera-0 cameraId api
* @tc.desc : Zoom camera-0 cameraId api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_GET_ZOOM_2_PROMISE', 0, async function (done) {
var setpromise = await camera0InputPromise.setZoomRatio(2);
console.info(TAG + "setZoomRatio success: 2");
console.info(TAG + "getZoomRatio called")
var getpromise2 = await camera0InputPromise.getZoomRatio();
console.info(TAG + "getZoomRatio success: " + getpromise2);
if (getpromise2 != null && getpromise2 != undefined) {
expect(getpromise2).assertEqual(2);
console.info(TAG + "SET_GET_ZOOM_2_PROMISE PASSED ");
}
else {
expect().assertFail();
console.info(TAG + "SET_GET_ZOOM_2_PROMISE FAILED");
}
await sleep(1);
done();
})
/**
* @tc.number : SET_GET_ZOOM_3_PROMISE
* @tc.name : Zoom camera-0 cameraId api
* @tc.desc : Zoom camera-0 cameraId api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_GET_ZOOM_3_PROMISE', 0, async function (done) {
var setpromise = await camera0InputPromise.setZoomRatio(3);
console.info(TAG + "setZoomRatio success: 3");
console.info(TAG + "getZoomRatio called")
var getpromise3 = await camera0InputPromise.getZoomRatio();
console.info(TAG + "getZoomRatio success: " + getpromise3);
if (getpromise3 != null && getpromise3 != undefined) {
expect(getpromise3).assertEqual(3);
console.info(TAG + "SET_GET_ZOOM_3_PROMISE PASSED ");
}
else {
expect().assertFail();
console.info(TAG + "SET_GET_ZOOM_3_PROMISE FAILED");
}
await sleep(1);
done();
})
/**
* @tc.number : SET_GET_ZOOM_4_PROMISE
* @tc.name : Zoom camera-0 cameraId api
* @tc.desc : Zoom camera-0 cameraId api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_GET_ZOOM_4_PROMISE', 0, async function (done) {
var setpromise = await camera0InputPromise.setZoomRatio(4);
console.info(TAG + "setZoomRatio success: 4");
console.info(TAG + "getZoomRatio called")
var getpromise4 = await camera0InputPromise.getZoomRatio();
console.info(TAG + "getZoomRatio success: " + getpromise4);
if (getpromise4 != null && getpromise4 != undefined) {
expect(getpromise4).assertEqual(4);
console.info(TAG + "SET_GET_ZOOM_4_PROMISE PASSED ");
}
else {
expect().assertFail();
console.info(TAG + "SET_GET_ZOOM_4_PROMISE FAILED");
}
await sleep(1);
done();
})
/**
* @tc.number : SET_GET_ZOOM_5_PROMISE
* @tc.name : Zoom camera-0 cameraId api
* @tc.desc : Zoom camera-0 cameraId api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_GET_ZOOM_5_PROMISE', 0, async function (done) {
var setpromise = await camera0InputPromise.setZoomRatio(5);
console.info(TAG + "setZoomRatio success: 5");
console.info(TAG + "getZoomRatio called")
var getpromise5 = await camera0InputPromise.getZoomRatio();
console.info(TAG + "getZoomRatio success: " + getpromise5);
if (getpromise5 != null && getpromise5 != undefined) {
expect(getpromise5).assertEqual(5);
console.info(TAG + "SET_GET_ZOOM_5_PROMISE PASSED ");
}
else {
expect().assertFail();
console.info(TAG + "SET_GET_ZOOM_5_PROMISE FAILED");
}
await sleep(1);
done();
})
/**
* @tc.number : SET_GET_ZOOM_6_PROMISE
* @tc.name : Zoom camera-0 cameraId api
* @tc.desc : Zoom camera-0 cameraId api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SET_GET_ZOOM_6_PROMISE', 0, async function (done) {
var setpromise = await camera0InputPromise.setZoomRatio(6);
console.info(TAG + "setZoomRatio success: 6");
console.info(TAG + "getZoomRatio called")
var getpromise6 = await camera0InputPromise.getZoomRatio();
console.info(TAG + "getZoomRatio success: " + getpromise6);
if (getpromise6 != null && getpromise6 != undefined) {
expect(getpromise6).assertEqual(6);
console.info(TAG + "SET_GET_ZOOM_6_PROMISE PASSED ");
}
else {
expect().assertFail();
console.info(TAG + "SET_GET_ZOOM_6_PROMISE FAILED");
}
await sleep(1);
done();
})
/**
* @tc.number : VIDEO_OUTPUT_START_PROMISE
* @tc.name : VideoOutput start promise api
* @tc.desc : VideoOutput start promise api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('VIDEO_OUTPUT_START_PROMISE', 0, async function (done) {
if (videoOutputPromise == null || videoOutputPromise == undefined) {
console.info(TAG + 'Entering VIDEO_OUTPUT_START_PROMISE videoOutputPromise == null || undefined')
} else {
console.info(TAG + 'Entering VIDEO_OUTPUT_START_PROMISE to operate')
await videoOutputPromise.start()
expect(true).assertTrue()
console.info(TAG + 'Entering VIDEO_OUTPUT_START_PROMISE PASSED')
console.info(TAG + 'Entering VIDEO_OUTPUT_START_PROMISE ends here')
await sleep(1)
done()
}
await sleep(1)
done()
})
/**
* @tc.number : VIDEO_RECORDER_START_PROMISE
* @tc.name : VideoOutput start promise api
* @tc.desc : VideoOutput start promise api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('VIDEO_RECORDER_START_PROMISE', 0, async function (done) {
if (videoRecorder == null || videoRecorder == undefined) {
console.info(TAG + 'Entering VIDEO_RECORDER_START_PROMISE videoRecorderPromise == null || undefined')
} else {
console.info(TAG + 'Entering VIDEO_RECORDER_START_PROMISE to operate')
await videoRecorder.start()
console.info(TAG + 'VIDEO_RECORDER_START_PROMISE called');
sleep(3);
console.info(TAG + 'VIDEO_RECORDER_START_PROMISE done.')
expect(true).assertTrue()
console.info(TAG + 'Entering VIDEO_RECORDER_START_PROMISE PASSED')
console.info(TAG + 'Entering VIDEO_RECORDER_START_PROMISE ends here')
await sleep(1)
done()
}
await sleep(1)
done()
})
/**
* @tc.number : VIDEO_OUTPUT_STOP_PROMISE
* @tc.name : VideoOutput stop promise api
* @tc.desc : VideoOutput stop promise api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('VIDEO_OUTPUT_STOP_PROMISE', 0, async function (done) {
if (videoOutputPromise == null || videoOutputPromise == undefined) {
console.info(TAG + 'Entering VIDEO_OUTPUT_STOP_PROMISE videoOutputPromise == null || undefined')
} else {
console.info(TAG + 'Entering VIDEO_OUTPUT_STOP_PROMISE to operate')
await videoOutputPromise.stop()
expect(true).assertTrue()
console.info(TAG + 'Entering VIDEO_OUTPUT_STOP_PROMISE PASSED')
console.info(TAG + 'Entering VIDEO_OUTPUT_STOP_PROMISE ends here')
await sleep(1)
done()
}
await sleep(1)
done()
})
/**
* @tc.number : VIDEO_RECORDER_STOP_PROMISE
* @tc.name : VideoRecorder stop promise api
* @tc.desc : VideoRecorder stop promise api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('VIDEO_RECORDER_STOP_PROMISE', 0, async function (done) {
if (videoOutputPromise == null || videoOutputPromise == undefined) {
console.info(TAG + 'Entering VIDEO_RECORDER_STOP_PROMISE videoOutputPromise == null || undefined')
} else {
console.info(TAG + 'Entering VIDEO_RECORDER_STOP_PROMISE to operate')
await videoRecorder.stop()
expect(true).assertTrue()
console.info(TAG + 'VIDEO_RECORDER_STOP done.')
console.info(TAG + 'Entering VIDEO_RECORDER_STOP_PROMISE PASSED')
console.info(TAG + 'Entering VIDEO_RECORDER_STOP_PROMISE ends here')
await sleep(1)
done()
}
await sleep(1)
done()
})
/**
* @tc.number : CAPTURE_SESSION_STOP_PROMISE
* @tc.name : CaptureSession stop promise api
* @tc.desc : CaptureSession stop promise api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CAPTURE_SESSION_STOP_PROMISE', 0, async function (done) {
if (captureSessionPromise == null || captureSessionPromise == undefined) {
console.info(TAG + 'Entering CAPTURE_SESSION_STOP_PROMISE captureSessionPromise == null || undefined')
} else {
console.info(TAG + 'Entering CAPTURE_SESSION_STOP_PROMISE to operate')
await captureSessionPromise.stop()
expect(true).assertTrue()
console.info(TAG + 'Entering CAPTURE_SESSION_STOP_PROMISE PASSED')
console.info(TAG + 'Entering CAPTURE_SESSION_STOP_PROMISE ends here')
await sleep(1)
done()
}
await sleep(1)
done()
})
/**
* @tc.number : CAPTURE_SESSION_RELEASE_PROMISE
* @tc.name : CaptureSession release promise api
* @tc.desc : CaptureSession release promise api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CAPTURE_SESSION_RELEASE_PROMISE', 0, async function (done) {
if (captureSessionPromise == null || captureSessionPromise == undefined) {
console.info(TAG + 'Entering CAPTURE_SESSION_RELEASE_PROMISE captureSessionPromise == null || undefined')
} else {
console.info(TAG + 'Entering CAPTURE_SESSION_RELEASE_PROMISE to operate')
await captureSessionPromise.release()
expect(true).assertTrue()
console.info(TAG + 'Entering CAPTURE_SESSION_RELEASE_PROMISE PASSED')
console.info(TAG + 'Entering CAPTURE_SESSION_RELEASE_PROMISE ends here')
await sleep(1)
done()
}
await sleep(1)
done()
})
/**
* @tc.number : VIDEOOUTPUT_RELEASE_SUCCESS_PROMISE
* @tc.name : videoOutput release api
* @tc.desc : videoOutput release api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('VIDEOOUTPUT_RELEASE_SUCCESS_PROMISE', 0, async function (done) {
if (videoOutputPromise == null || videoOutputPromise == undefined) {
console.info(TAG + "Entering VIDEOOUTPUT_RELEASE_SUCCESS_PROMISE previewOutputPromise == null || undefined");
} else {
console.info(TAG + "Entering VIDEOOUTPUT_RELEASE_SUCCESS_PROMISE to operate");
const promise = await videoOutputPromise.release();
console.info(TAG + "Entering VideoOutputPromise.release promise: " + JSON.stringify(promise));
if (promise != null || promise != undefined) {
expect(true).assertTrue();
console.info(TAG + "Entering VideoOutputPromise.release PASSED");
}
console.info(TAG + "Entering VideoOutputPromise.release ends here");
await sleep(1);
done();
}
await sleep(1);
done();
})
/**
* @tc.number : PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE
* @tc.name : PreviewOutput release api
* @tc.desc : PreviewOutput release api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE', 0, async function (done) {
if (previewOutputPromise == null || previewOutputPromise == undefined) {
console.info(TAG + "Entering PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE previewOutputPromise == null || undefined");
} else {
console.info(TAG + "Entering PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE to operate");
const promise = await previewOutputPromise.release();
console.info(TAG + "Entering previewOutputPromise.release promise: " + JSON.stringify(promise));
if (promise != null || promise != undefined) {
expect(true).assertTrue();
console.info(TAG + "Entering previewOutputPromise.release PASSED");
}
console.info(TAG + "Entering previewOutputPromise.release ends here");
await sleep(1);
done();
}
await sleep(1);
done();
})
/**
* @tc.number : CAMERAINPUT_RELEASE_SUCCESS_PROMISE
* @tc.name : cameraInput release api
* @tc.desc : cameraInput release api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('CAMERAINPUT_RELEASE_SUCCESS_PROMISE', 0, async function (done) {
if (camera0InputPromise == null || camera0InputPromise == undefined) {
console.info(TAG + "Entering CAMERAINPUT_RELEASE_SUCCESS_PROMISE camera0InputPromise == null || undefined");
} else {
console.info(TAG + "Entering CAMERAINPUT_RELEASE_SUCCESS_PROMISE to operate");
const promise = await camera0InputPromise.release();
console.info(TAG + "Entering camera0InputPromise.release promise: " + JSON.stringify(promise));
if (promise != null || promise != undefined) {
expect(true).assertTrue();
console.info(TAG + "Entering camera0InputPromise.release PASSED");
}
console.info(TAG + "Entering camera0InputPromise.release ends here");
await sleep(1);
done();
}
await sleep(1);
done();
})
})
}
\ No newline at end of file
{
"string": [
{
"name": "entry_MainAbility",
"value": "entry_MainAbility"
},
{
"name": "description_mainability",
"value": "eTS_Empty Ability"
}
]
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册