Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
4335ba88
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看板
提交
4335ba88
编写于
10月 12, 2022
作者:
Y
yygxr
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix camera session and manager test case error
Signed-off-by:
N
yygxr
<
wuhao30@huawei.com
>
上级
6ef59106
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
60 addition
and
50 deletion
+60
-50
multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraManagerTest.test.ets
.../src/main/ets/MainAbility/test/CameraManagerTest.test.ets
+50
-40
multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionBaseTest.test.ets
.../main/ets/MainAbility/test/CameraSessionBaseTest.test.ets
+5
-5
multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionExposureTest.test.ets
...n/ets/MainAbility/test/CameraSessionExposureTest.test.ets
+1
-1
multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionFlashTest.test.ets
...main/ets/MainAbility/test/CameraSessionFlashTest.test.ets
+1
-1
multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionFocusTest.test.ets
...main/ets/MainAbility/test/CameraSessionFocusTest.test.ets
+1
-1
multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionVideoStabilizationTest.test.ets
...Ability/test/CameraSessionVideoStabilizationTest.test.ets
+1
-1
multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionZoomRatioTest.test.ets
.../ets/MainAbility/test/CameraSessionZoomRatioTest.test.ets
+1
-1
未找到文件。
multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraManagerTest.test.ets
浏览文件 @
4335ba88
...
@@ -26,40 +26,38 @@ const TAG = "CameraUnitTest: ";
...
@@ -26,40 +26,38 @@ const TAG = "CameraUnitTest: ";
// Define global variables
// Define global variables
let
mCameraManager
;
let
mCameraManager
;
let
photoSurfaceId
;
let
mPhotoSurfaceId
;
let
videoSurfaceId
;
let
mCameraDevicesArray
;
let
mCameraDevicesArray
;
let
fdPath
;
let
mVideoSurface
;
let
fileAsset
;
let
mVideoRecorder
;
let
fdNumber
;
let
mFdPath
;
let
mFileAsset
;
let
mFdNumber
;
// 创建视频录制的参数
let
mVideoProfileCfg
=
{
let
videoProfile
=
{
audioBitrate
:
48000
,
audioBitrate
:
48000
,
audioChannels
:
2
,
audioChannels
:
2
,
audioCodec
:
'audio/mp4a-latm'
,
audioCodec
:
'audio/mp4a-latm'
,
audioSampleRate
:
48000
,
audioSampleRate
:
48000
,
durationTime
:
1000
,
fileFormat
:
'mp4'
,
fileFormat
:
'mp4'
,
videoBitrate
:
48000
,
videoBitrate
:
48000
,
videoCodec
:
'video/mp4v-es'
,
videoCodec
:
'video/mp4v-es'
,
videoFrameWidth
:
640
,
videoFrameWidth
:
640
,
videoFrameHeight
:
480
,
videoFrameHeight
:
480
,
videoFrameRate
:
30
videoFrameRate
:
30
}
}
let
v
ideoConfig
=
{
let
mV
ideoConfig
=
{
audioSourceType
:
1
,
audioSourceType
:
1
,
videoSourceType
:
0
,
videoSourceType
:
0
,
profile
:
videoProfile
,
profile
:
mVideoProfileCfg
,
url
:
'file:///data/media/CameraManager.mp4'
,
url
:
'file:///data/media/CameraManager.mp4'
,
orientationHint
:
0
,
orientationHint
:
0
,
location
:
{
latitude
:
30
,
longitude
:
130
},
location
:
{
latitude
:
30
,
longitude
:
130
},
maxSize
:
100
,
maxSize
:
100
,
maxDuration
:
500
maxDuration
:
500
}
}
// 创建录像输出流
let
videoRecorder
export
default
function
cameraManagerTest
(
surfaceId
:
any
)
{
export
default
function
cameraManagerTest
(
surfaceId
:
any
)
{
...
@@ -69,8 +67,8 @@ export default function cameraManagerTest(surfaceId: any) {
...
@@ -69,8 +67,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'
)
p
hotoSurfaceId
=
await
receiver
.
getReceivingSurfaceId
()
mP
hotoSurfaceId
=
await
receiver
.
getReceivingSurfaceId
()
console
.
log
(
TAG
+
'Received id: '
+
JSON
.
stringify
(
p
hotoSurfaceId
))
console
.
log
(
TAG
+
'Received id: '
+
JSON
.
stringify
(
mP
hotoSurfaceId
))
}
else
{
}
else
{
console
.
log
(
TAG
+
'Receiver is not ok'
)
console
.
log
(
TAG
+
'Receiver is not ok'
)
}
}
...
@@ -90,15 +88,15 @@ export default function cameraManagerTest(surfaceId: any) {
...
@@ -90,15 +88,15 @@ export default function cameraManagerTest(surfaceId: any) {
selectionArgs
:
[
args
],
selectionArgs
:
[
args
],
}
}
let
fetchFileResult
=
await
mediaTest
.
getFileAssets
(
fetchOp
);
let
fetchFileResult
=
await
mediaTest
.
getFileAssets
(
fetchOp
);
f
ileAsset
=
await
fetchFileResult
.
getAllObject
();
mF
ileAsset
=
await
fetchFileResult
.
getAllObject
();
fdNumber
=
await
f
ileAsset
[
0
]
.
open
(
'Rw'
);
mFdNumber
=
await
mF
ileAsset
[
0
]
.
open
(
'Rw'
);
fdPath
=
"fd://"
+
f
dNumber
.
toString
();
mFdPath
=
"fd://"
+
mF
dNumber
.
toString
();
}
}
}
}
async
function
closeFd
()
{
async
function
closeFd
()
{
if
(
f
ileAsset
!=
null
)
{
if
(
mF
ileAsset
!=
null
)
{
await
fileAsset
[
0
]
.
close
(
f
dNumber
)
.
then
(()
=>
{
await
mFileAsset
[
0
]
.
close
(
mF
dNumber
)
.
then
(()
=>
{
console
.
info
(
'[mediaLibrary] case close fd success'
);
console
.
info
(
'[mediaLibrary] case close fd success'
);
})
.
catch
((
err
)
=>
{
})
.
catch
((
err
)
=>
{
console
.
info
(
'[mediaLibrary] case close fd failed'
);
console
.
info
(
'[mediaLibrary] case close fd failed'
);
...
@@ -108,24 +106,35 @@ export default function cameraManagerTest(surfaceId: any) {
...
@@ -108,24 +106,35 @@ export default function cameraManagerTest(surfaceId: any) {
}
}
}
}
async
function
getvideosurface
()
{
async
function
getVideoReceiveSurface
()
{
console
.
log
(
TAG
+
'Entering getVideoReceiveSurface'
)
await
getFd
(
'CameraManager.mp4'
);
await
getFd
(
'CameraManager.mp4'
);
videoConfig
.
url
=
f
dPath
;
mVideoConfig
.
url
=
mF
dPath
;
media
.
createVideoRecorder
((
err
,
recorder
)
=>
{
media
.
createVideoRecorder
((
err
,
recorder
)
=>
{
console
.
info
(
TAG
+
'createVideoRecorder called
'
)
console
.
info
(
TAG
+
'Entering create video receiver
'
)
v
ideoRecorder
=
recorder
mV
ideoRecorder
=
recorder
console
.
info
(
TAG
+
'videoRecorder is :'
+
JSON
.
stringify
(
v
ideoRecorder
))
console
.
info
(
TAG
+
'videoRecorder is :'
+
JSON
.
stringify
(
mV
ideoRecorder
))
console
.
info
(
TAG
+
'videoRecorder.prepare called.'
)
console
.
info
(
TAG
+
'videoRecorder.prepare called.'
)
videoRecorder
.
prepare
(
v
ideoConfig
,
(
err
)
=>
{
mVideoRecorder
.
prepare
(
mV
ideoConfig
,
(
err
)
=>
{
console
.
info
(
TAG
+
'videoRecorder.prepare success.'
)
console
.
info
(
TAG
+
'videoRecorder.prepare success.'
)
})
mVideoRecorder
.
getInputSurface
((
err
,
id
)
=>
{
videoRecorder
.
getInputSurface
((
err
,
id
)
=>
{
console
.
info
(
TAG
+
'getInputSurface called'
)
console
.
info
(
TAG
+
'getInputSurface called'
)
mVideoSurface
=
id
videoSurfaceId
=
id
console
.
info
(
TAG
+
'getInputSurface surfaceId: '
+
JSON
.
stringify
(
mVideoSurface
))
console
.
info
(
TAG
+
'getInputSurface surfaceId: '
+
JSON
.
stringify
(
videoSurfaceId
)
)
}
)
})
})
})
})
}
console
.
log
(
TAG
+
'Exit getVideoReceiveSurface'
)
}
async
function
releaseVideoReceiveSurface
()
{
console
.
log
(
TAG
+
'Entering releaseVideoReceiveSurface'
)
mVideoRecorder
.
release
((
err
)
=>
{
console
.
info
(
TAG
+
'Entering release video receiver'
)
})
await
closeFd
();
console
.
log
(
TAG
+
'Exit releaseVideoReceiveSurface'
)
}
function
sleep
(
ms
)
{
function
sleep
(
ms
)
{
console
.
info
(
TAG
+
"Entering sleep -> Promise constructor"
);
console
.
info
(
TAG
+
"Entering sleep -> Promise constructor"
);
...
@@ -264,7 +273,7 @@ describe('CameraManagerTest', function () {
...
@@ -264,7 +273,7 @@ describe('CameraManagerTest', function () {
await
applyPermission
();
await
applyPermission
();
await
getCameraManagerInstance
();
await
getCameraManagerInstance
();
await
getImageReceiverSurfaceId
();
await
getImageReceiverSurfaceId
();
await
get
videos
urface
();
await
get
VideoReceiveS
urface
();
console
.
info
(
'beforeAll case'
);
console
.
info
(
'beforeAll case'
);
})
})
...
@@ -278,7 +287,8 @@ describe('CameraManagerTest', function () {
...
@@ -278,7 +287,8 @@ describe('CameraManagerTest', function () {
})
})
afterAll
(
function
()
{
afterAll
(
function
()
{
closeFd
();
releaseVideoReceiveSurface
();
sleep
(
1000
);
console
.
info
(
'afterAll case'
);
console
.
info
(
'afterAll case'
);
})
})
...
@@ -814,7 +824,7 @@ describe('CameraManagerTest', function () {
...
@@ -814,7 +824,7 @@ 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
],
p
hotoSurfaceId
,
async
(
err
,
data
)
=>
{
mCameraManager
.
createPhotoOutput
(
photoProfilesArray
[
j
],
mP
hotoSurfaceId
,
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
();
...
@@ -854,7 +864,7 @@ describe('CameraManagerTest', function () {
...
@@ -854,7 +864,7 @@ 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
],
p
hotoSurfaceId
);
let
photoOutputPromise
=
await
mCameraManager
.
createPhotoOutput
(
photoProfilesArray
[
j
],
mP
hotoSurfaceId
);
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
();
...
...
multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionBaseTest.test.ets
浏览文件 @
4335ba88
...
@@ -576,12 +576,12 @@ export default function cameraSessionTest(surfaceId: any) {
...
@@ -576,12 +576,12 @@ export default function cameraSessionTest(surfaceId: any) {
await
sleep
(
100
);
await
sleep
(
100
);
})
})
afterAll
(
async
function
()
{
afterAll
(
function
()
{
await
releaseInputs
();
releaseInputs
();
await
releaseOutputs
();
releaseOutputs
();
await
releaseVideoReceiveSurface
();
releaseVideoReceiveSurface
();
releaseCameraSessionInstance
();
releaseCameraSessionInstance
();
await
sleep
(
1
00
);
sleep
(
10
00
);
console
.
info
(
'afterAll case'
);
console
.
info
(
'afterAll case'
);
})
})
...
...
multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionExposureTest.test.ets
浏览文件 @
4335ba88
...
@@ -620,7 +620,7 @@ export default function cameraSessionExposureTest(surfaceId: any) {
...
@@ -620,7 +620,7 @@ export default function cameraSessionExposureTest(surfaceId: any) {
releaseOutputs
();
releaseOutputs
();
releaseVideoReceiveSurface
();
releaseVideoReceiveSurface
();
releaseCameraSessionInstance
();
releaseCameraSessionInstance
();
sleep
(
100
);
sleep
(
100
0
);
console
.
info
(
'afterAll case'
);
console
.
info
(
'afterAll case'
);
})
})
...
...
multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionFlashTest.test.ets
浏览文件 @
4335ba88
...
@@ -571,7 +571,7 @@ export default function cameraSessionFlashTest(surfaceId: any) {
...
@@ -571,7 +571,7 @@ export default function cameraSessionFlashTest(surfaceId: any) {
releaseOutputs
();
releaseOutputs
();
releaseVideoReceiveSurface
();
releaseVideoReceiveSurface
();
releaseCameraSessionInstance
();
releaseCameraSessionInstance
();
sleep
(
100
);
sleep
(
100
0
);
console
.
info
(
'afterAll case'
);
console
.
info
(
'afterAll case'
);
})
})
...
...
multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionFocusTest.test.ets
浏览文件 @
4335ba88
...
@@ -616,7 +616,7 @@ export default function cameraSessionFocusTest(surfaceId: any) {
...
@@ -616,7 +616,7 @@ export default function cameraSessionFocusTest(surfaceId: any) {
releaseOutputs
();
releaseOutputs
();
releaseVideoReceiveSurface
();
releaseVideoReceiveSurface
();
releaseCameraSessionInstance
();
releaseCameraSessionInstance
();
sleep
(
100
);
sleep
(
100
0
);
console
.
info
(
'afterAll case'
);
console
.
info
(
'afterAll case'
);
})
})
...
...
multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionVideoStabilizationTest.test.ets
浏览文件 @
4335ba88
...
@@ -569,7 +569,7 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) {
...
@@ -569,7 +569,7 @@ export default function cameraSessionVideoStabilizationTest(surfaceId: any) {
releaseOutputs
();
releaseOutputs
();
releaseVideoReceiveSurface
();
releaseVideoReceiveSurface
();
releaseCameraSessionInstance
();
releaseCameraSessionInstance
();
sleep
(
100
);
sleep
(
100
0
);
console
.
info
(
'afterAll case'
);
console
.
info
(
'afterAll case'
);
})
})
...
...
multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraSessionZoomRatioTest.test.ets
浏览文件 @
4335ba88
...
@@ -574,7 +574,7 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) {
...
@@ -574,7 +574,7 @@ export default function cameraSessionZoomRatioTest(surfaceId: any) {
releaseOutputs
();
releaseOutputs
();
releaseVideoReceiveSurface
();
releaseVideoReceiveSurface
();
releaseCameraSessionInstance
();
releaseCameraSessionInstance
();
sleep
(
100
);
sleep
(
100
0
);
console
.
info
(
'afterAll case'
);
console
.
info
(
'afterAll case'
);
})
})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录