Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
a8ed1434
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
a8ed1434
编写于
10月 29, 2022
作者:
L
lwx1121892
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
<camera新增接口覆盖>
Signed-off-by:
N
lwx1121892
<
liuxueqi3@huawei.com
>
上级
24530ded
变更
9
展开全部
隐藏空白更改
内联
并排
Showing
9 changed file
with
1480 addition
and
304 deletion
+1480
-304
multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraInputTest.test.ets
...rd/src/main/ets/MainAbility/test/CameraInputTest.test.ets
+555
-177
multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraJSUnitOutput.test.ets
...src/main/ets/MainAbility/test/CameraJSUnitOutput.test.ets
+537
-11
multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraManagerTest.test.ets
.../src/main/ets/MainAbility/test/CameraManagerTest.test.ets
+225
-26
multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionBaseTest.test.ets
.../main/ets/MainAbility/test/CameraSessionBaseTest.test.ets
+143
-70
multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionExposureTest.test.ets
...n/ets/MainAbility/test/CameraSessionExposureTest.test.ets
+4
-4
multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionFlashTest.test.ets
...main/ets/MainAbility/test/CameraSessionFlashTest.test.ets
+4
-4
multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionFocusTest.test.ets
...main/ets/MainAbility/test/CameraSessionFocusTest.test.ets
+4
-4
multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionVideoStabilizationTest.test.ets
...Ability/test/CameraSessionVideoStabilizationTest.test.ets
+4
-4
multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionZoomRatioTest.test.ets
.../ets/MainAbility/test/CameraSessionZoomRatioTest.test.ets
+4
-4
未找到文件。
multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraInputTest.test.ets
浏览文件 @
a8ed1434
此差异已折叠。
点击以展开。
multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraJSUnitOutput.test.ets
浏览文件 @
a8ed1434
此差异已折叠。
点击以展开。
multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraManagerTest.test.ets
浏览文件 @
a8ed1434
...
@@ -26,14 +26,18 @@ const TAG = "CameraUnitTest: ";
...
@@ -26,14 +26,18 @@ const TAG = "CameraUnitTest: ";
// Define global variables
// Define global variables
let
mCameraManager
;
let
mCameraManager
;
let
mPhotoSurfaceId
;
let
mCameraDevicesArray
;
let
mCameraDevicesArray
;
let
mVideoSurface
;
let
mPhotoSurface
;
let
mVideoRecorder
;
let
mVideoRecorder
;
let
m
FdPath
;
let
m
VideoSurface
;
let
mFileAsset
;
let
mFileAsset
;
let
mFdPath
;
let
mFdNumber
;
let
mFdNumber
;
// CAMERA-0 letiables
let
mCameraNum
;
let
mVideoProfileCfg
=
{
let
mVideoProfileCfg
=
{
audioBitrate
:
48000
,
audioBitrate
:
48000
,
audioChannels
:
2
,
audioChannels
:
2
,
...
@@ -67,8 +71,8 @@ export default function cameraManagerTest(surfaceId: any) {
...
@@ -67,8 +71,8 @@ export default function cameraManagerTest(surfaceId: any) {
console
.
log
(
TAG
+
'before receiver check'
)
console
.
log
(
TAG
+
'before receiver check'
)
if
(
receiver
!==
undefined
)
{
if
(
receiver
!==
undefined
)
{
console
.
log
(
TAG
+
'Receiver is ok'
)
console
.
log
(
TAG
+
'Receiver is ok'
)
mPhotoSurface
Id
=
await
receiver
.
getReceivingSurfaceId
()
mPhotoSurface
=
await
receiver
.
getReceivingSurfaceId
()
console
.
log
(
TAG
+
'Received id: '
+
JSON
.
stringify
(
mPhotoSurface
Id
))
console
.
log
(
TAG
+
'Received id: '
+
JSON
.
stringify
(
mPhotoSurface
))
}
else
{
}
else
{
console
.
log
(
TAG
+
'Receiver is not ok'
)
console
.
log
(
TAG
+
'Receiver is not ok'
)
}
}
...
@@ -168,9 +172,44 @@ export default function cameraManagerTest(surfaceId: any) {
...
@@ -168,9 +172,44 @@ export default function cameraManagerTest(surfaceId: any) {
console
.
info
(
TAG
+
"getCameraManager FAILED"
);
console
.
info
(
TAG
+
"getCameraManager FAILED"
);
return
false
;
return
false
;
}
}
await
sleep
(
500
);
console
.
info
(
'Exit getCameraManagerInstance'
);
console
.
info
(
'Exit getCameraManagerInstance'
);
return
true
;
}
async
function
getCameraSupportDevicesArray
()
{
console
.
info
(
'Enter getCameraSupportDevicesArray'
);
mCameraDevicesArray
=
await
mCameraManager
.
getSupportedCameras
();
/*
mCameraManager.getSupportedCameras(async (err, data) => {
console.info(TAG + "Entering getCameraSupportDevicesArray callback");
if (!err) {
if (data != null || data != undefined) {
mCameraDevicesArray = data;
console.info(TAG + "Entering getCameraSupportDevicesArray PASSED with CameraDevicesArray is: " + data);
} else {
console.info(TAG + "Entering getCameraSupportDevicesArray FAILED with CameraDevicesArray is: " + data);
}
} else {
console.info(TAG + "Entering getCameraSupportDevicesArray FAILED : " + err.message);
}
})
await sleep(3000);
*/
if
(
isEmpty
(
mCameraDevicesArray
))
{
console
.
info
(
TAG
+
"getSupportedCameras FAILED"
);
return
false
;
}
//mCameraNum = 1;
mCameraNum
=
mCameraDevicesArray
.
length
;
console
.
info
(
TAG
+
"getCameraSupportDevicesArray is: "
+
mCameraNum
);
console
.
info
(
'Exit getCameraSupportDevicesArray'
);
return
true
;
return
true
;
}
}
...
@@ -286,6 +325,7 @@ describe('CameraManagerTest', function () {
...
@@ -286,6 +325,7 @@ describe('CameraManagerTest', function () {
await
getCameraManagerInstance
();
await
getCameraManagerInstance
();
await
getImageReceiverSurfaceId
();
await
getImageReceiverSurfaceId
();
await
getVideoReceiveSurface
();
await
getVideoReceiveSurface
();
await
getCameraSupportDevicesArray
();
console
.
info
(
'beforeAll case'
);
console
.
info
(
'beforeAll case'
);
})
})
...
@@ -324,7 +364,6 @@ describe('CameraManagerTest', function () {
...
@@ -324,7 +364,6 @@ describe('CameraManagerTest', function () {
}
}
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAMANAGER_CALLBACK_0100 ends here"
);
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAMANAGER_CALLBACK_0100 ends here"
);
await
sleep
(
1000
);
await
sleep
(
1000
);
done
();
})
})
await
sleep
(
1000
);
await
sleep
(
1000
);
done
();
done
();
...
@@ -733,6 +772,70 @@ describe('CameraManagerTest', function () {
...
@@ -733,6 +772,70 @@ describe('CameraManagerTest', function () {
done
();
done
();
})
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_CALLBACK_0100
* @tc.name : Create camerainput from camera-0 cameraposition back & cameratype unspecified async api
* @tc.desc : Create camerainput from camera-0 cameraposition back & cameratype unspecified async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it
(
'SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_CALLBACK_0100'
,
2
,
async
function
(
done
)
{
console
.
info
(
"--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_CALLBACK_0100--------------"
);
if
(
isEmpty
(
mCameraManager
))
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_CALLBACK_0100 cameraManager == null || undefined"
)
expect
()
.
assertFail
();
}
else
{
let
camerasArray
=
mCameraDevicesArray
;
for
(
let
i
=
0
;
i
<
camerasArray
.
length
;
i
++
)
{
mCameraManager
.
createCameraInput
(
camerasArray
[
i
]
.
cameraPosition
,
camerasArray
[
i
]
.
cameraType
,
async
(
err
,
data
)
=>
{
if
(
!
err
)
{
if
(
isEmpty
(
data
))
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_CALLBACK_0100 data == null || undefined"
)
expect
()
.
assertFail
();
}
else
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_CALLBACK_0100 success"
);
}
}
else
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_CALLBACK_0100 FAILED: "
+
err
.
message
);
expect
()
.
assertFail
();
}
})
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera: "
+
camerasArray
[
i
]
.
cameraId
);
}
}
await
sleep
(
1000
);
done
();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_PROMISE_0100
* @tc.name : Create camerainput from camera-0 cameraposition back & cameratype unspecified promise api
* @tc.desc : Create camerainput from camera-0 cameraposition back & cameratype unspecified promise api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it
(
'SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_PROMISE_0100'
,
2
,
async
function
(
done
)
{
console
.
info
(
"--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_PROMISE_0100--------------"
);
if
(
isEmpty
(
mCameraManager
))
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_PROMISE_0100 cameraManager == null || undefined"
)
expect
()
.
assertFail
();
}
else
{
let
camerasArray
=
mCameraDevicesArray
;
for
(
let
i
=
0
;
i
<
camerasArray
.
length
;
i
++
)
{
let
cameraInputPromiseByType
=
await
mCameraManager
.
createCameraInput
(
camerasArray
[
i
]
.
cameraPosition
,
camerasArray
[
i
]
.
cameraType
);
if
(
isEmpty
(
cameraInputPromiseByType
))
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_PROMISE_0100 cameraInputPromiseByType == null || undefined"
)
expect
()
.
assertFail
();
}
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_PROMISE_0100 camera: "
+
camerasArray
[
i
]
.
cameraId
);
}
}
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_BY_POSITION_AND_TYPE_PROMISE_0100 ends here"
);
await
sleep
(
1000
);
done
();
})
/*CREATE CAMERAOUTPUT*/
/*CREATE CAMERAOUTPUT*/
/**
/**
...
@@ -763,8 +866,7 @@ describe('CameraManagerTest', function () {
...
@@ -763,8 +866,7 @@ describe('CameraManagerTest', function () {
expect
()
.
assertFail
();
expect
()
.
assertFail
();
}
}
})
})
await
sleep
(
10
);
await
sleep
(
100
);
done
();
}
}
}
}
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PREVIEW_OUTPUT_CALLBACK_0100 PASS"
);
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PREVIEW_OUTPUT_CALLBACK_0100 PASS"
);
...
@@ -802,8 +904,7 @@ describe('CameraManagerTest', function () {
...
@@ -802,8 +904,7 @@ describe('CameraManagerTest', function () {
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PREVIEW_OUTPUT_PROMISE_0100 previewOutputPromise == null || undefined"
)
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PREVIEW_OUTPUT_PROMISE_0100 previewOutputPromise == null || undefined"
)
expect
()
.
assertFail
();
expect
()
.
assertFail
();
}
}
await
sleep
(
10
);
await
sleep
(
100
);
done
();
}
}
}
}
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PREVIEW_OUTPUT_PROMISE_0100 PASS"
);
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PREVIEW_OUTPUT_PROMISE_0100 PASS"
);
...
@@ -836,14 +937,13 @@ describe('CameraManagerTest', function () {
...
@@ -836,14 +937,13 @@ describe('CameraManagerTest', function () {
expect
()
.
assertFail
();
expect
()
.
assertFail
();
}
}
for
(
let
j
=
0
;
j
<
photoProfilesArray
.
length
;
j
++
)
{
for
(
let
j
=
0
;
j
<
photoProfilesArray
.
length
;
j
++
)
{
mCameraManager
.
createPhotoOutput
(
photoProfilesArray
[
j
],
mPhotoSurface
Id
,
async
(
err
,
data
)
=>
{
mCameraManager
.
createPhotoOutput
(
photoProfilesArray
[
j
],
mPhotoSurface
,
async
(
err
,
data
)
=>
{
if
(
isEmpty
(
data
))
{
if
(
isEmpty
(
data
))
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PHOTO_OUTPUT_CALLBACK_0100 data == null || undefined"
)
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PHOTO_OUTPUT_CALLBACK_0100 data == null || undefined"
)
expect
()
.
assertFail
();
expect
()
.
assertFail
();
}
}
})
})
await
sleep
(
10
);
await
sleep
(
100
);
done
();
}
}
}
}
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PHOTO_OUTPUT_CALLBACK_0100 PASS"
);
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PHOTO_OUTPUT_CALLBACK_0100 PASS"
);
...
@@ -876,13 +976,12 @@ describe('CameraManagerTest', function () {
...
@@ -876,13 +976,12 @@ describe('CameraManagerTest', function () {
expect
()
.
assertFail
();
expect
()
.
assertFail
();
}
}
for
(
let
j
=
0
;
j
<
photoProfilesArray
.
length
;
j
++
)
{
for
(
let
j
=
0
;
j
<
photoProfilesArray
.
length
;
j
++
)
{
let
photoOutputPromise
=
await
mCameraManager
.
createPhotoOutput
(
photoProfilesArray
[
j
],
mPhotoSurface
Id
);
let
photoOutputPromise
=
await
mCameraManager
.
createPhotoOutput
(
photoProfilesArray
[
j
],
mPhotoSurface
);
if
(
isEmpty
(
photoOutputPromise
))
{
if
(
isEmpty
(
photoOutputPromise
))
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PHOTO_OUTPUT_PROMISE_0100 photoOutputPromise == null || undefined"
)
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PHOTO_OUTPUT_PROMISE_0100 photoOutputPromise == null || undefined"
)
expect
()
.
assertFail
();
expect
()
.
assertFail
();
}
}
await
sleep
(
10
);
await
sleep
(
100
);
done
();
}
}
}
}
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PHOTO_OUTPUT_PROMISE_0100 PASS"
);
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_PHOTO_OUTPUT_PROMISE_0100 PASS"
);
...
@@ -901,6 +1000,7 @@ describe('CameraManagerTest', function () {
...
@@ -901,6 +1000,7 @@ describe('CameraManagerTest', function () {
it
(
'SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_CALLBACK_0100'
,
2
,
async
function
(
done
)
{
it
(
'SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_CALLBACK_0100'
,
2
,
async
function
(
done
)
{
console
.
info
(
"--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_CALLBACK_0100--------------"
);
console
.
info
(
"--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_CALLBACK_0100--------------"
);
let
camerasArray
=
mCameraDevicesArray
;
let
camerasArray
=
mCameraDevicesArray
;
let
createVideoOutputFlag
;
for
(
let
i
=
0
;
i
<
camerasArray
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
camerasArray
.
length
;
i
++
)
{
let
cameraOutputCap
=
await
getSupportedOutputCapabilityInPromise
(
camerasArray
[
i
]);
let
cameraOutputCap
=
await
getSupportedOutputCapabilityInPromise
(
camerasArray
[
i
]);
console
.
info
(
"SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_CALLBACK_0100 camera:"
+
camerasArray
[
i
]
.
cameraId
);
console
.
info
(
"SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_CALLBACK_0100 camera:"
+
camerasArray
[
i
]
.
cameraId
);
...
@@ -914,15 +1014,29 @@ describe('CameraManagerTest', function () {
...
@@ -914,15 +1014,29 @@ describe('CameraManagerTest', function () {
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_CALLBACK_0100 videoProfilesArray == null || undefined"
)
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_CALLBACK_0100 videoProfilesArray == null || undefined"
)
expect
()
.
assertFail
();
expect
()
.
assertFail
();
}
}
createVideoOutputFlag
=
false
;
for
(
let
j
=
0
;
j
<
videoProfilesArray
.
length
;
j
++
)
{
for
(
let
j
=
0
;
j
<
videoProfilesArray
.
length
;
j
++
)
{
mCameraManager
.
createVideoOutput
(
videoProfilesArray
[
j
],
mVideoSurface
,
async
(
err
,
data
)
=>
{
mCameraManager
.
createVideoOutput
(
videoProfilesArray
[
j
],
mVideoSurface
,
async
(
err
,
data
)
=>
{
if
(
isEmpty
(
data
))
{
if
(
!
err
)
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_CALLBACK_0100 data == null || undefined"
)
if
(
isEmpty
(
data
))
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_CALLBACK_0100 data == null || undefined"
);
expect
()
.
assertFail
();
}
else
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_CALLBACK_0100 data = "
+
data
);
createVideoOutputFlag
=
true
;
}
}
else
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_CALLBACK_0100 failed, err = "
+
err
.
message
);
expect
()
.
assertFail
();
expect
()
.
assertFail
();
}
}
})
})
await
sleep
(
10
);
await
sleep
(
100
);
done
();
if
(
createVideoOutputFlag
==
true
)
{
break
;
}
}
}
}
}
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_CALLBACK_0100 PASS"
);
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_CALLBACK_0100 PASS"
);
...
@@ -959,9 +1073,11 @@ describe('CameraManagerTest', function () {
...
@@ -959,9 +1073,11 @@ describe('CameraManagerTest', function () {
if
(
isEmpty
(
videoOutputPromise
))
{
if
(
isEmpty
(
videoOutputPromise
))
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_PROMISE_0100 videoOutputPromise == null || undefined"
)
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_PROMISE_0100 videoOutputPromise == null || undefined"
)
expect
()
.
assertFail
();
expect
()
.
assertFail
();
}
else
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_CALLBACK_0100 videoOutputPromise = "
+
videoOutputPromise
);
break
;
}
}
await
sleep
(
10
);
await
sleep
(
100
);
done
();
}
}
}
}
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_PROMISE_0100 PASS"
);
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_VIDEO_OUTPUT_PROMISE_0100 PASS"
);
...
@@ -970,7 +1086,92 @@ describe('CameraManagerTest', function () {
...
@@ -970,7 +1086,92 @@ describe('CameraManagerTest', function () {
})
})
/**
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_MANAGER_CREATE_CAPTURE_SESSION_CALLBACK_0100
* @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_CALLBACK_0100
* @tc.name : Create camerainput from camera-0 cameraposition front & cameratype unspecified async api
* @tc.desc : Create camerainput from camera-0 cameraposition front & cameratype unspecified async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it
(
'SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_CALLBACK_0100'
,
2
,
async
function
(
done
)
{
console
.
info
(
"--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_CALLBACK_0100--------------"
);
let
camerasArray
=
mCameraDevicesArray
;
for
(
let
i
=
0
;
i
<
camerasArray
.
length
;
i
++
)
{
let
cameraOutputCap
=
await
getSupportedOutputCapabilityInPromise
(
camerasArray
[
i
]);
console
.
info
(
"SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_CALLBACK_0100 camera:"
+
camerasArray
[
i
]
.
cameraId
);
if
(
isEmpty
(
cameraOutputCap
))
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_CALLBACK_0100 cameraOutputCap == null || undefined"
)
expect
()
.
assertFail
();
}
let
metadataObjectTypeArray
=
cameraOutputCap
.
supportedMetadataObjectTypes
;
if
(
!
isEmpty
(
metadataObjectTypeArray
))
{
mCameraManager
.
createMetadataOutput
(
metadataObjectTypeArray
,
async
(
err
,
data
)
=>
{
if
(
!
err
)
{
if
(
isEmpty
(
data
))
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_CALLBACK_0100 data == null || undefined"
)
expect
()
.
assertFail
();
}
else
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_CALLBACK_0100 data = "
+
data
)
}
}
else
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_CALLBACK_0100 err = "
+
err
.
message
)
expect
()
.
assertFail
();
}
})
await
sleep
(
100
);
}
else
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_CALLBACK_0100 metadataObjectTypeArray == null || undefined"
)
}
await
sleep
(
1000
);
}
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_CALLBACK_0100 PASS"
);
await
sleep
(
1000
);
done
();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_PROMISE_0100
* @tc.name : Create camerainput from camera-0 cameraposition front & cameratype unspecified async api
* @tc.desc : Create camerainput from camera-0 cameraposition front & cameratype unspecified async api
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it
(
'SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_PROMISE_0100'
,
2
,
async
function
(
done
)
{
console
.
info
(
"--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_PROMISE_0100--------------"
);
let
camerasArray
=
mCameraDevicesArray
;
for
(
let
i
=
0
;
i
<
camerasArray
.
length
;
i
++
)
{
let
cameraOutputCap
=
await
getSupportedOutputCapabilityInPromise
(
camerasArray
[
i
]);
console
.
info
(
"SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_PROMISE_0100 camera:"
+
camerasArray
[
i
]
.
cameraId
);
if
(
isEmpty
(
cameraOutputCap
))
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_PROMISE_0100 cameraOutputCap == null || undefined"
)
expect
()
.
assertFail
();
}
let
metadataObjectTypeArray
=
cameraOutputCap
.
supportedMetadataObjectTypes
;
if
(
!
isEmpty
(
metadataObjectTypeArray
))
{
let
metadataOutputPromise
=
await
mCameraManager
.
createMetadataOutput
(
metadataObjectTypeArray
);
if
(
isEmpty
(
metadataOutputPromise
))
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_PROMISE_0100 metadataOutputPromise == null || undefined"
)
expect
()
.
assertFail
();
}
else
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_PROMISE_0100 metadataOutputPromise = "
+
metadataOutputPromise
)
}
await
sleep
(
100
);
}
else
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_PROMISE_0100 metadataObjectTypeArray == null || undefined"
)
}
}
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_METADATA_OUTPUT_PROMISE_0100 PASS"
);
await
sleep
(
1000
);
done
();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100
* @tc.name : Create CaptureSession instance api
* @tc.name : Create CaptureSession instance api
* @tc.desc : Create CaptureSession instance api
* @tc.desc : Create CaptureSession instance api
* @tc.size : MEDIUM
* @tc.size : MEDIUM
...
@@ -996,7 +1197,6 @@ describe('CameraManagerTest', function () {
...
@@ -996,7 +1197,6 @@ describe('CameraManagerTest', function () {
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_MANAGER_CREATE_CAPTURE_SESSION_CALLBACK_0100 ends here"
);
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_MANAGER_CREATE_CAPTURE_SESSION_CALLBACK_0100 ends here"
);
}
}
await
sleep
(
1000
);
await
sleep
(
1000
);
done
();
})
})
await
sleep
(
1000
);
await
sleep
(
1000
);
await
cameraSession
.
release
();
await
cameraSession
.
release
();
...
@@ -1052,7 +1252,6 @@ describe('CameraManagerTest', function () {
...
@@ -1052,7 +1252,6 @@ describe('CameraManagerTest', function () {
console
.
info
(
TAG
+
"SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 FAILED: "
+
err
.
message
);
console
.
info
(
TAG
+
"SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 FAILED: "
+
err
.
message
);
}
}
await
sleep
(
1000
);
await
sleep
(
1000
);
done
();
})
})
}
}
await
sleep
(
1000
);
await
sleep
(
1000
);
...
...
multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionBaseTest.test.ets
浏览文件 @
a8ed1434
...
@@ -32,7 +32,7 @@ let mCameraManager;
...
@@ -32,7 +32,7 @@ let mCameraManager;
let
mCameraDevicesArray
;
let
mCameraDevicesArray
;
let
mCameraSession
;
let
mCameraSession
;
let
mPhot
e
Surface
;
let
mPhot
o
Surface
;
let
mVideoRecorder
;
let
mVideoRecorder
;
let
mVideoSurface
;
let
mVideoSurface
;
let
mFileAsset
;
let
mFileAsset
;
...
@@ -183,8 +183,8 @@ export default function cameraSessionTest(surfaceId: any) {
...
@@ -183,8 +183,8 @@ export default function cameraSessionTest(surfaceId: any) {
console
.
log
(
TAG
+
'before receiver check'
)
console
.
log
(
TAG
+
'before receiver check'
)
if
(
receiver
!==
undefined
)
{
if
(
receiver
!==
undefined
)
{
console
.
log
(
TAG
+
'Photo receiver is created successfully'
)
console
.
log
(
TAG
+
'Photo receiver is created successfully'
)
mPhot
e
Surface
=
await
receiver
.
getReceivingSurfaceId
()
mPhot
o
Surface
=
await
receiver
.
getReceivingSurfaceId
()
console
.
log
(
TAG
+
'Photo received id: '
+
JSON
.
stringify
(
mPhot
e
Surface
))
console
.
log
(
TAG
+
'Photo received id: '
+
JSON
.
stringify
(
mPhot
o
Surface
))
}
else
{
}
else
{
console
.
log
(
TAG
+
'Photo receiver is created failed'
)
console
.
log
(
TAG
+
'Photo receiver is created failed'
)
}
}
...
@@ -409,12 +409,11 @@ export default function cameraSessionTest(surfaceId: any) {
...
@@ -409,12 +409,11 @@ export default function cameraSessionTest(surfaceId: any) {
console
.
info
(
TAG
+
"createPreviewOutput: "
+
mPreviewOutput
);
console
.
info
(
TAG
+
"createPreviewOutput: "
+
mPreviewOutput
);
}
}
if
(
!
isEmpty
(
cameraOutputCap
.
photoProfiles
))
{
if
(
!
isEmpty
(
cameraOutputCap
.
photoProfiles
))
{
console
.
info
(
TAG
+
"cameraOutputCap.photoProfiles.length: "
+
cameraOutputCap
.
photoProfiles
.
length
);
console
.
info
(
TAG
+
"cameraOutputCap.photoProfiles.length: "
+
cameraOutputCap
.
photoProfiles
.
length
);
for
(
let
i
=
0
;
i
<
cameraOutputCap
.
photoProfiles
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
cameraOutputCap
.
photoProfiles
.
length
;
i
++
)
{
mPhotoOutput
=
await
mCameraManager
.
createPhotoOutput
(
cameraOutputCap
.
photoProfiles
[
i
],
mPhot
e
Surface
);
mPhotoOutput
=
await
mCameraManager
.
createPhotoOutput
(
cameraOutputCap
.
photoProfiles
[
i
],
mPhot
o
Surface
);
if
(
!
isEmpty
(
mPhotoOutput
))
{
if
(
!
isEmpty
(
mPhotoOutput
))
{
break
;
break
;
}
}
...
@@ -503,9 +502,11 @@ export default function cameraSessionTest(surfaceId: any) {
...
@@ -503,9 +502,11 @@ export default function cameraSessionTest(surfaceId: any) {
await mCameraSession.addOutput(mVideoOutput);
await mCameraSession.addOutput(mVideoOutput);
}
}
*/
*/
await
sleep
(
1
);
await
sleep
(
1
00
);
await
commitCameraSessionConfig
();
await
commitCameraSessionConfig
();
await
sleep
(
100
);
/*
/*
await mCameraSession.start(async (err) => {
await mCameraSession.start(async (err) => {
...
@@ -902,6 +903,104 @@ export default function cameraSessionTest(surfaceId: any) {
...
@@ -902,6 +903,104 @@ export default function cameraSessionTest(surfaceId: any) {
}
}
})
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_CALLBACK_0100
* @tc.name : Check capture session start/stop with callback or not
* @tc.desc : Check capture session start/stop with callback or not
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_CALLBACK_0100'
,
0
,
async
function
(
done
)
{
console
.
info
(
"--------------SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_CALLBACK_0100--------------"
);
if
(
mCameraNum
==
0
)
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_CALLBACK_0100 FAILED with NoCamera"
);
expect
()
.
assertFail
();
done
();
}
else
{
for
(
let
i
=
0
;
i
<
mCameraNum
;
i
++
)
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_CALLBACK_0100 start for camera["
+
i
+
"]"
);
await
startCameraSession
(
i
);
mCameraSession
.
start
(
async
(
err
)
=>
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_CALLBACK_0100 start callback"
);
if
(
!
err
)
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_CALLBACK_0100 start PASSED"
);
}
else
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_CALLBACK_0100 start FAILED : "
+
err
.
message
);
expect
()
.
assertFail
();
}
})
await
sleep
(
2000
);
mCameraSession
.
stop
(
async
(
err
)
=>
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_CALLBACK_0100 stop callback"
);
if
(
!
err
)
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_CALLBACK_0100 stop PASSED"
);
}
else
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_CALLBACK_0100 stop FAILED : "
+
err
.
message
);
expect
()
.
assertFail
();
}
})
await
sleep
(
500
);
await
beginCameraSessionConfig
();
await
stopCameraSession
();
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_CALLBACK_0100 end for camera["
+
i
+
"]"
);
}
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_CALLBACK_0100 ends here"
);
done
();
}
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_PROMISE_0100
* @tc.name : Check capture session start/stop output with promise or not
* @tc.desc : Check capture session start/stop output with promise or not
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_PROMISE_0100'
,
0
,
async
function
(
done
)
{
console
.
info
(
"--------------SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_PROMISE_0100--------------"
);
if
(
mCameraNum
==
0
)
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_PROMISE_0100 FAILED with NoCamera"
);
expect
()
.
assertFail
();
done
();
}
else
{
for
(
let
i
=
0
;
i
<
mCameraNum
;
i
++
)
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_PROMISE_0100 start for camera["
+
i
+
"]"
);
await
startCameraSession
(
i
);
await
mCameraSession
.
start
();
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_PROMISE_0100 start PASSED"
);
await
sleep
(
2000
);
await
mCameraSession
.
stop
();
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_PROMISE_0100 stop PASSED"
);
await
sleep
(
500
);
await
beginCameraSessionConfig
();
await
stopCameraSession
();
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_PROMISE_0100 end for camera["
+
i
+
"]"
);
}
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_SESSION_START_STOP_PROMISE_0100 ends here"
);
done
();
}
})
/**
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_INPUT_CALLBACK_0100
* @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_ADD_REMOVE_INPUT_CALLBACK_0100
* @tc.name : Check capture session add/remove input with callback or not
* @tc.name : Check capture session add/remove input with callback or not
...
@@ -1415,6 +1514,22 @@ export default function cameraSessionTest(surfaceId: any) {
...
@@ -1415,6 +1514,22 @@ export default function cameraSessionTest(surfaceId: any) {
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0100 start for camera["
+
i
+
"]"
);
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0100 start for camera["
+
i
+
"]"
);
await
startCameraSession
(
i
);
await
startCameraSession
(
i
);
let
focusModeSupportedFlag
=
await
mCameraSession
.
isFocusModeSupported
(
cameraObj
.
FocusMode
.
FOCUS_MODE_AUTO
);
if
(
focusModeSupportedFlag
==
false
)
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0100 skip camera["
+
i
+
"], for FOCUS_MODE_AUTO"
);
await
beginCameraSessionConfig
();
await
stopCameraSession
();
continue
;
}
focusModeSupportedFlag
=
await
mCameraSession
.
isFocusModeSupported
(
cameraObj
.
FocusMode
.
FOCUS_MODE_CONTINUOUS_AUTO
);
if
(
focusModeSupportedFlag
==
false
)
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0100 skip camera["
+
i
+
"], for FOCUS_MODE_CONTINUOUS_AUTO"
);
await
beginCameraSessionConfig
();
await
stopCameraSession
();
continue
;
}
mCameraSession
.
on
(
'focusStateChange'
,
async
(
err
,
data
)
=>
{
mCameraSession
.
on
(
'focusStateChange'
,
async
(
err
,
data
)
=>
{
if
(
!
err
)
{
if
(
!
err
)
{
...
@@ -1429,16 +1544,31 @@ export default function cameraSessionTest(surfaceId: any) {
...
@@ -1429,16 +1544,31 @@ export default function cameraSessionTest(surfaceId: any) {
}
}
await
sleep
(
1
);
await
sleep
(
1
);
})
})
await
mCameraSession
.
start
();
await
beginCameraSessionConfig
();
mCameraSession
.
setFocusMode
(
cameraObj
.
FocusMode
.
FOCUS_MODE_AUTO
);
mCameraSession
.
setFocusMode
(
cameraObj
.
FocusMode
.
FOCUS_MODE_AUTO
);
await
commitCameraSessionConfig
();
await
sleep
(
1000
);
await
beginCameraSessionConfig
();
await
sleep
(
3000
);
mCameraSession
.
setFocusMode
(
cameraObj
.
FocusMode
.
FOCUS_MODE_CONTINUOUS_AUTO
);
await
commitCameraSessionConfig
();
await
sleep
(
1000
);
if
(
nfyFlag
==
false
)
{
if
(
nfyFlag
==
false
)
{
//expect().assertFail();
//expect().assertFail();
//console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0100 FAILED without any nofity!");
//console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0100 FAILED without any nofity!");
}
}
await
mCameraSession
.
stop
();
await
beginCameraSessionConfig
();
await
beginCameraSessionConfig
();
await
stopCameraSession
();
await
stopCameraSession
();
...
@@ -1452,8 +1582,8 @@ export default function cameraSessionTest(surfaceId: any) {
...
@@ -1452,8 +1582,8 @@ export default function cameraSessionTest(surfaceId: any) {
/**
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0101
* @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0101
* @tc.name : camera status callback on CaptureSession async api for e
xposureStateChange
* @tc.name : camera status callback on CaptureSession async api for e
rror
* @tc.desc : camera status callback on CaptureSession async api for e
xposureStateChange
* @tc.desc : camera status callback on CaptureSession async api for e
rror
* @tc.size : MEDIUM
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.type : Function
* @tc.level : Level 2
* @tc.level : Level 2
...
@@ -1469,11 +1599,11 @@ export default function cameraSessionTest(surfaceId: any) {
...
@@ -1469,11 +1599,11 @@ export default function cameraSessionTest(surfaceId: any) {
for
(
let
i
=
0
;
i
<
mCameraNum
;
i
++
)
{
for
(
let
i
=
0
;
i
<
mCameraNum
;
i
++
)
{
let
nfyFlag
=
false
;
let
nfyFlag
=
false
;
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0101 start for camera["
+
i
+
"]"
);
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0101 start for camera["
+
i
+
"]"
);
await
startCameraSession
(
i
);
await
startCameraSession
(
i
);
mCameraSession
.
on
(
'e
xposureStateChange
'
,
async
(
err
,
data
)
=>
{
mCameraSession
.
on
(
'e
rror
'
,
async
(
err
,
data
)
=>
{
if
(
!
err
)
{
if
(
!
err
)
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0101 callback"
);
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0101 callback"
);
if
(
data
!=
null
||
data
!=
undefined
)
{
if
(
data
!=
null
||
data
!=
undefined
)
{
...
@@ -1487,15 +1617,13 @@ export default function cameraSessionTest(surfaceId: any) {
...
@@ -1487,15 +1617,13 @@ export default function cameraSessionTest(surfaceId: any) {
await
sleep
(
1
);
await
sleep
(
1
);
})
})
mCameraSession
.
setExposureMode
(
cameraObj
.
ExposureMode
.
EXPOSURE_MODE_AUTO
);
await
sleep
(
3000
);
await
sleep
(
3000
);
if
(
nfyFlag
==
false
)
{
if
(
nfyFlag
==
false
)
{
//expect().assertFail();
//expect().assertFail();
//console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0101 FAILED without any nofity!");
//console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0101 FAILED without any nofity!");
}
}
await
beginCameraSessionConfig
();
await
beginCameraSessionConfig
();
await
stopCameraSession
();
await
stopCameraSession
();
...
@@ -1507,61 +1635,6 @@ export default function cameraSessionTest(surfaceId: any) {
...
@@ -1507,61 +1635,6 @@ export default function cameraSessionTest(surfaceId: any) {
}
}
})
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0102
* @tc.name : camera status callback on CaptureSession async api for error
* @tc.desc : camera status callback on CaptureSession async api for error
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it
(
'SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0102'
,
2
,
async
function
(
done
)
{
console
.
info
(
"--------------SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0102--------------"
);
if
(
mCameraNum
==
0
)
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0102 FAILED with NoCamera"
);
expect
()
.
assertFail
();
done
();
}
else
{
for
(
let
i
=
0
;
i
<
mCameraNum
;
i
++
)
{
let
nfyFlag
=
false
;
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0102 start for camera["
+
i
+
"]"
);
await
startCameraSession
(
i
);
mCameraSession
.
on
(
'error'
,
async
(
err
,
data
)
=>
{
if
(
!
err
)
{
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0102 callback"
);
if
(
data
!=
null
||
data
!=
undefined
)
{
console
.
info
(
TAG
+
"SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0102 PASSED: "
+
data
);
nfyFlag
=
true
;
}
}
else
{
expect
()
.
assertFail
();
console
.
info
(
TAG
+
"SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0102 FAILED: "
+
err
.
message
);
}
await
sleep
(
1
);
})
await
sleep
(
3000
);
if
(
nfyFlag
==
false
)
{
//expect().assertFail();
//console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0102 FAILED without any nofity!");
}
await
beginCameraSessionConfig
();
await
stopCameraSession
();
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0102 end for camera["
+
i
+
"]"
);
}
console
.
info
(
TAG
+
"Entering SUB_MULTIMEDIA_CAMERA_SESSION_STATUS_CALLBACK_0102 ends here"
);
done
();
}
})
/**
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_RELEASE_CALLBACK_0100
* @tc.number : SUB_MULTIMEDIA_CAMERA_SESSION_RELEASE_CALLBACK_0100
* @tc.name : Check capture session release with callback or not for preview
* @tc.name : Check capture session release with callback or not for preview
...
...
multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionExposureTest.test.ets
浏览文件 @
a8ed1434
...
@@ -32,7 +32,7 @@ let mCameraManager;
...
@@ -32,7 +32,7 @@ let mCameraManager;
let
mCameraDevicesArray
;
let
mCameraDevicesArray
;
let
mCameraSession
;
let
mCameraSession
;
let
mPhot
e
Surface
;
let
mPhot
o
Surface
;
let
mVideoRecorder
;
let
mVideoRecorder
;
let
mVideoSurface
;
let
mVideoSurface
;
let
mFileAsset
;
let
mFileAsset
;
...
@@ -238,8 +238,8 @@ export default function cameraSessionExposureTest(surfaceId: any) {
...
@@ -238,8 +238,8 @@ export default function cameraSessionExposureTest(surfaceId: any) {
console
.
log
(
TAG
+
'before receiver check'
)
console
.
log
(
TAG
+
'before receiver check'
)
if
(
receiver
!==
undefined
)
{
if
(
receiver
!==
undefined
)
{
console
.
log
(
TAG
+
'Photo receiver is created successfully'
)
console
.
log
(
TAG
+
'Photo receiver is created successfully'
)
mPhot
e
Surface
=
await
receiver
.
getReceivingSurfaceId
()
mPhot
o
Surface
=
await
receiver
.
getReceivingSurfaceId
()
console
.
log
(
TAG
+
'Photo received id: '
+
JSON
.
stringify
(
mPhot
e
Surface
))
console
.
log
(
TAG
+
'Photo received id: '
+
JSON
.
stringify
(
mPhot
o
Surface
))
}
else
{
}
else
{
console
.
log
(
TAG
+
'Photo receiver is created failed'
)
console
.
log
(
TAG
+
'Photo receiver is created failed'
)
}
}
...
@@ -473,7 +473,7 @@ export default function cameraSessionExposureTest(surfaceId: any) {
...
@@ -473,7 +473,7 @@ export default function cameraSessionExposureTest(surfaceId: any) {
console
.
info
(
TAG
+
"cameraOutputCap.photoProfiles.length: "
+
cameraOutputCap
.
photoProfiles
.
length
);
console
.
info
(
TAG
+
"cameraOutputCap.photoProfiles.length: "
+
cameraOutputCap
.
photoProfiles
.
length
);
for
(
let
i
=
0
;
i
<
cameraOutputCap
.
photoProfiles
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
cameraOutputCap
.
photoProfiles
.
length
;
i
++
)
{
mPhotoOutput
=
await
mCameraManager
.
createPhotoOutput
(
cameraOutputCap
.
photoProfiles
[
i
],
mPhot
e
Surface
);
mPhotoOutput
=
await
mCameraManager
.
createPhotoOutput
(
cameraOutputCap
.
photoProfiles
[
i
],
mPhot
o
Surface
);
if
(
!
isEmpty
(
mPhotoOutput
))
{
if
(
!
isEmpty
(
mPhotoOutput
))
{
break
;
break
;
}
}
...
...
multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionFlashTest.test.ets
浏览文件 @
a8ed1434
...
@@ -32,7 +32,7 @@ let mCameraManager;
...
@@ -32,7 +32,7 @@ let mCameraManager;
let
mCameraDevicesArray
;
let
mCameraDevicesArray
;
let
mCameraSession
;
let
mCameraSession
;
let
mPhot
e
Surface
;
let
mPhot
o
Surface
;
let
mVideoRecorder
;
let
mVideoRecorder
;
let
mVideoSurface
;
let
mVideoSurface
;
let
mFileAsset
;
let
mFileAsset
;
...
@@ -189,8 +189,8 @@ export default function cameraSessionFlashTest(surfaceId: any) {
...
@@ -189,8 +189,8 @@ export default function cameraSessionFlashTest(surfaceId: any) {
console
.
log
(
TAG
+
'before receiver check'
)
console
.
log
(
TAG
+
'before receiver check'
)
if
(
receiver
!==
undefined
)
{
if
(
receiver
!==
undefined
)
{
console
.
log
(
TAG
+
'Photo receiver is created successfully'
)
console
.
log
(
TAG
+
'Photo receiver is created successfully'
)
mPhot
e
Surface
=
await
receiver
.
getReceivingSurfaceId
()
mPhot
o
Surface
=
await
receiver
.
getReceivingSurfaceId
()
console
.
log
(
TAG
+
'Photo received id: '
+
JSON
.
stringify
(
mPhot
e
Surface
))
console
.
log
(
TAG
+
'Photo received id: '
+
JSON
.
stringify
(
mPhot
o
Surface
))
}
else
{
}
else
{
console
.
log
(
TAG
+
'Photo receiver is created failed'
)
console
.
log
(
TAG
+
'Photo receiver is created failed'
)
}
}
...
@@ -424,7 +424,7 @@ export default function cameraSessionFlashTest(surfaceId: any) {
...
@@ -424,7 +424,7 @@ export default function cameraSessionFlashTest(surfaceId: any) {
console
.
info
(
TAG
+
"cameraOutputCap.photoProfiles.length: "
+
cameraOutputCap
.
photoProfiles
.
length
);
console
.
info
(
TAG
+
"cameraOutputCap.photoProfiles.length: "
+
cameraOutputCap
.
photoProfiles
.
length
);
for
(
let
i
=
0
;
i
<
cameraOutputCap
.
photoProfiles
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
cameraOutputCap
.
photoProfiles
.
length
;
i
++
)
{
mPhotoOutput
=
await
mCameraManager
.
createPhotoOutput
(
cameraOutputCap
.
photoProfiles
[
i
],
mPhot
e
Surface
);
mPhotoOutput
=
await
mCameraManager
.
createPhotoOutput
(
cameraOutputCap
.
photoProfiles
[
i
],
mPhot
o
Surface
);
if
(
!
isEmpty
(
mPhotoOutput
))
{
if
(
!
isEmpty
(
mPhotoOutput
))
{
break
;
break
;
}
}
...
...
multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionFocusTest.test.ets
浏览文件 @
a8ed1434
...
@@ -32,7 +32,7 @@ let mCameraManager;
...
@@ -32,7 +32,7 @@ let mCameraManager;
let
mCameraDevicesArray
;
let
mCameraDevicesArray
;
let
mCameraSession
;
let
mCameraSession
;
let
mPhot
e
Surface
;
let
mPhot
o
Surface
;
let
mVideoRecorder
;
let
mVideoRecorder
;
let
mVideoSurface
;
let
mVideoSurface
;
let
mFileAsset
;
let
mFileAsset
;
...
@@ -235,8 +235,8 @@ export default function cameraSessionFocusTest(surfaceId: any) {
...
@@ -235,8 +235,8 @@ export default function cameraSessionFocusTest(surfaceId: any) {
console
.
log
(
TAG
+
'before receiver check'
)
console
.
log
(
TAG
+
'before receiver check'
)
if
(
receiver
!==
undefined
)
{
if
(
receiver
!==
undefined
)
{
console
.
log
(
TAG
+
'Photo receiver is created successfully'
)
console
.
log
(
TAG
+
'Photo receiver is created successfully'
)
mPhot
e
Surface
=
await
receiver
.
getReceivingSurfaceId
()
mPhot
o
Surface
=
await
receiver
.
getReceivingSurfaceId
()
console
.
log
(
TAG
+
'Photo received id: '
+
JSON
.
stringify
(
mPhot
e
Surface
))
console
.
log
(
TAG
+
'Photo received id: '
+
JSON
.
stringify
(
mPhot
o
Surface
))
}
else
{
}
else
{
console
.
log
(
TAG
+
'Photo receiver is created failed'
)
console
.
log
(
TAG
+
'Photo receiver is created failed'
)
}
}
...
@@ -469,7 +469,7 @@ export default function cameraSessionFocusTest(surfaceId: any) {
...
@@ -469,7 +469,7 @@ export default function cameraSessionFocusTest(surfaceId: any) {
console
.
info
(
TAG
+
"cameraOutputCap.photoProfiles.length: "
+
cameraOutputCap
.
photoProfiles
.
length
);
console
.
info
(
TAG
+
"cameraOutputCap.photoProfiles.length: "
+
cameraOutputCap
.
photoProfiles
.
length
);
for
(
let
i
=
0
;
i
<
cameraOutputCap
.
photoProfiles
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
cameraOutputCap
.
photoProfiles
.
length
;
i
++
)
{
mPhotoOutput
=
await
mCameraManager
.
createPhotoOutput
(
cameraOutputCap
.
photoProfiles
[
i
],
mPhot
e
Surface
);
mPhotoOutput
=
await
mCameraManager
.
createPhotoOutput
(
cameraOutputCap
.
photoProfiles
[
i
],
mPhot
o
Surface
);
if
(
!
isEmpty
(
mPhotoOutput
))
{
if
(
!
isEmpty
(
mPhotoOutput
))
{
break
;
break
;
}
}
...
...
multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionVideoStabilizationTest.test.ets
浏览文件 @
a8ed1434
...
@@ -32,7 +32,7 @@ let mCameraManager;
...
@@ -32,7 +32,7 @@ let mCameraManager;
let
mCameraDevicesArray
;
let
mCameraDevicesArray
;
let
mCameraSession
;
let
mCameraSession
;
let
mPhot
e
Surface
;
let
mPhot
o
Surface
;
let
mVideoRecorder
;
let
mVideoRecorder
;
let
mVideoSurface
;
let
mVideoSurface
;
let
mFileAsset
;
let
mFileAsset
;
...
@@ -188,8 +188,8 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) {
...
@@ -188,8 +188,8 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) {
console
.
log
(
TAG
+
'before receiver check'
)
console
.
log
(
TAG
+
'before receiver check'
)
if
(
receiver
!==
undefined
)
{
if
(
receiver
!==
undefined
)
{
console
.
log
(
TAG
+
'Photo receiver is created successfully'
)
console
.
log
(
TAG
+
'Photo receiver is created successfully'
)
mPhot
e
Surface
=
await
receiver
.
getReceivingSurfaceId
()
mPhot
o
Surface
=
await
receiver
.
getReceivingSurfaceId
()
console
.
log
(
TAG
+
'Photo received id: '
+
JSON
.
stringify
(
mPhot
e
Surface
))
console
.
log
(
TAG
+
'Photo received id: '
+
JSON
.
stringify
(
mPhot
o
Surface
))
}
else
{
}
else
{
console
.
log
(
TAG
+
'Photo receiver is created failed'
)
console
.
log
(
TAG
+
'Photo receiver is created failed'
)
}
}
...
@@ -422,7 +422,7 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) {
...
@@ -422,7 +422,7 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) {
console
.
info
(
TAG
+
"cameraOutputCap.photoProfiles.length: "
+
cameraOutputCap
.
photoProfiles
.
length
);
console
.
info
(
TAG
+
"cameraOutputCap.photoProfiles.length: "
+
cameraOutputCap
.
photoProfiles
.
length
);
for
(
let
i
=
0
;
i
<
cameraOutputCap
.
photoProfiles
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
cameraOutputCap
.
photoProfiles
.
length
;
i
++
)
{
mPhotoOutput
=
await
mCameraManager
.
createPhotoOutput
(
cameraOutputCap
.
photoProfiles
[
i
],
mPhot
e
Surface
);
mPhotoOutput
=
await
mCameraManager
.
createPhotoOutput
(
cameraOutputCap
.
photoProfiles
[
i
],
mPhot
o
Surface
);
if
(
!
isEmpty
(
mPhotoOutput
))
{
if
(
!
isEmpty
(
mPhotoOutput
))
{
break
;
break
;
}
}
...
...
multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionZoomRatioTest.test.ets
浏览文件 @
a8ed1434
...
@@ -32,7 +32,7 @@ let mCameraManager;
...
@@ -32,7 +32,7 @@ let mCameraManager;
let
mCameraDevicesArray
;
let
mCameraDevicesArray
;
let
mCameraSession
;
let
mCameraSession
;
let
mPhot
e
Surface
;
let
mPhot
o
Surface
;
let
mVideoRecorder
;
let
mVideoRecorder
;
let
mVideoSurface
;
let
mVideoSurface
;
let
mFileAsset
;
let
mFileAsset
;
...
@@ -190,8 +190,8 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) {
...
@@ -190,8 +190,8 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) {
console
.
log
(
TAG
+
'before receiver check'
)
console
.
log
(
TAG
+
'before receiver check'
)
if
(
receiver
!==
undefined
)
{
if
(
receiver
!==
undefined
)
{
console
.
log
(
TAG
+
'Photo receiver is created successfully'
)
console
.
log
(
TAG
+
'Photo receiver is created successfully'
)
mPhot
e
Surface
=
await
receiver
.
getReceivingSurfaceId
()
mPhot
o
Surface
=
await
receiver
.
getReceivingSurfaceId
()
console
.
log
(
TAG
+
'Photo received id: '
+
JSON
.
stringify
(
mPhot
e
Surface
))
console
.
log
(
TAG
+
'Photo received id: '
+
JSON
.
stringify
(
mPhot
o
Surface
))
}
else
{
}
else
{
console
.
log
(
TAG
+
'Photo receiver is created failed'
)
console
.
log
(
TAG
+
'Photo receiver is created failed'
)
}
}
...
@@ -426,7 +426,7 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) {
...
@@ -426,7 +426,7 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) {
console
.
info
(
TAG
+
"cameraOutputCap.photoProfiles.length: "
+
cameraOutputCap
.
photoProfiles
.
length
);
console
.
info
(
TAG
+
"cameraOutputCap.photoProfiles.length: "
+
cameraOutputCap
.
photoProfiles
.
length
);
for
(
let
i
=
0
;
i
<
cameraOutputCap
.
photoProfiles
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
cameraOutputCap
.
photoProfiles
.
length
;
i
++
)
{
mPhotoOutput
=
await
mCameraManager
.
createPhotoOutput
(
cameraOutputCap
.
photoProfiles
[
i
],
mPhot
e
Surface
);
mPhotoOutput
=
await
mCameraManager
.
createPhotoOutput
(
cameraOutputCap
.
photoProfiles
[
i
],
mPhot
o
Surface
);
if
(
!
isEmpty
(
mPhotoOutput
))
{
if
(
!
isEmpty
(
mPhotoOutput
))
{
break
;
break
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录