Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
17e5a1c2
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看板
未验证
提交
17e5a1c2
编写于
11月 02, 2022
作者:
O
openharmony_ci
提交者:
Gitee
11月 02, 2022
浏览文件
操作
浏览文件
下载
差异文件
!6318 视频录制添加错误码判断用例
Merge pull request !6318 from FULIZHONG/1102flz
上级
47c293e1
446a9434
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
131 addition
and
0 deletion
+131
-0
multimedia/media/media_js_standard/videoRecorder/src/main/js/test/VideoRecorderFuncPromiseTest.test.js
...der/src/main/js/test/VideoRecorderFuncPromiseTest.test.js
+131
-0
未找到文件。
multimedia/media/media_js_standard/videoRecorder/src/main/js/test/VideoRecorderFuncPromiseTest.test.js
浏览文件 @
17e5a1c2
...
@@ -149,6 +149,26 @@ describe('VideoRecorderFuncPromiseTest', function () {
...
@@ -149,6 +149,26 @@ describe('VideoRecorderFuncPromiseTest', function () {
console
.
info
(
'
afterAll case
'
);
console
.
info
(
'
afterAll case
'
);
})
})
function
checkErrorCode
(
errorCode
)
{
let
value
=
false
;
switch
(
errorCode
)
{
case
0
:
case
201
:
case
401
:
case
801
:
case
5400101
:
case
5400102
:
case
5400103
:
case
5400104
:
case
5400105
:
case
5400106
:
value
=
true
;
break
;
}
return
value
;
}
async
function
startVideoOutput
(
videoOutPut
)
{
async
function
startVideoOutput
(
videoOutPut
)
{
if
(
videoOutPut
==
null
)
{
if
(
videoOutPut
==
null
)
{
console
.
info
(
'
[camera] case videoOutPut is null
'
);
console
.
info
(
'
[camera] case videoOutPut is null
'
);
...
@@ -1717,4 +1737,115 @@ describe('VideoRecorderFuncPromiseTest', function () {
...
@@ -1717,4 +1737,115 @@ describe('VideoRecorderFuncPromiseTest', function () {
await
mediaTestBase
.
closeFd
(
fdObject
.
fileAsset
,
fdObject
.
fdNumber
);
await
mediaTestBase
.
closeFd
(
fdObject
.
fileAsset
,
fdObject
.
fdNumber
);
done
();
done
();
})
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_ERRORCODE
* @tc.name : 25.error code (promise)
* @tc.desc : Video recordr control test
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level0
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_VIDEO_RECORDER_FUNCTION_PROMISE_ERRORCODE
'
,
0
,
async
function
(
done
)
{
let
videoRecorder
=
undefined
;
let
surfaceID
=
''
;
let
videoOutput
;
let
previewOutput
;
let
errorCode
=
false
;
fdObject
=
await
mediaTestBase
.
getFd
(
'
recorder_promise_25.mp4
'
);
fdPath
=
"
fd://
"
+
fdObject
.
fdNumber
.
toString
();
videoConfig
.
url
=
''
;
await
media
.
createVideoRecorder
().
then
((
recorder
)
=>
{
console
.
info
(
'
case createVideoRecorder called
'
);
if
(
typeof
(
recorder
)
!=
'
undefined
'
)
{
videoRecorder
=
recorder
;
expect
(
videoRecorder
.
state
).
assertEqual
(
'
idle
'
);
}
else
{
console
.
info
(
'
case recordr is undefined!!
'
);
}
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
videoRecorder
.
on
(
'
error
'
,
(
err
)
=>
{
console
.
info
(
'
case on error called, errMessage is
'
+
err
.
code
);
errorCode
=
checkErrorCode
(
err
.
code
);
expect
(
errorCode
).
assertEqual
(
true
);
});
await
videoRecorder
.
prepare
(
videoConfig
).
then
(()
=>
{
console
.
info
(
'
case recordr prepare called
'
);
expect
(
videoRecorder
.
state
).
assertEqual
(
'
prepared
'
);
},
(
err
)
=>
{
console
.
info
(
'
case promise error called, errMessage is
'
+
err
.
code
);
errorCode
=
checkErrorCode
(
err
.
code
);
expect
(
errorCode
).
assertEqual
(
true
);
}).
catch
(
mediaTestBase
.
catchCallback
);
await
videoRecorder
.
reset
().
then
(()
=>
{
console
.
info
(
'
case recordr reset called
'
);
expect
(
videoRecorder
.
state
).
assertEqual
(
'
idle
'
);
},
(
err
)
=>
{
console
.
info
(
'
case promise error called, errMessage is
'
+
err
.
code
);
errorCode
=
checkErrorCode
(
err
.
code
);
expect
(
errorCode
).
assertEqual
(
true
);
}).
catch
(
mediaTestBase
.
catchCallback
);
videoConfig
.
url
=
fdPath
;
await
videoRecorder
.
prepare
(
videoConfig
).
then
(()
=>
{
console
.
info
(
'
case recordr prepare called
'
);
expect
(
videoRecorder
.
state
).
assertEqual
(
'
prepared
'
);
},
(
err
)
=>
{
expect
(
videoRecorder
.
state
).
assertEqual
(
'
error
'
);
console
.
info
(
'
case promise error called, errMessage is
'
+
err
.
code
);
expect
().
assertFail
();
}).
catch
(
mediaTestBase
.
catchCallback
);
await
videoRecorder
.
getInputSurface
().
then
((
outPutSurface
)
=>
{
console
.
info
(
'
case getInputSurface called
'
);
expect
(
videoRecorder
.
state
).
assertEqual
(
'
prepared
'
);
surfaceID
=
outPutSurface
;
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
videoOutput
=
await
cameraManager
.
createVideoOutput
(
videoProfiles
[
0
],
surfaceID
);
previewOutput
=
await
cameraManager
.
createPreviewOutput
(
previewProfiles
[
0
],
playerSurfaceId
)
captureSession
=
await
videoRecorderBase
.
initCaptureSession
(
videoOutput
,
cameraManager
,
cameras
[
0
],
previewOutput
);
await
startVideoOutput
(
videoOutput
);
await
videoRecorder
.
start
().
then
(()
=>
{
console
.
info
(
'
case recordr play called
'
);
expect
(
videoRecorder
.
state
).
assertEqual
(
'
playing
'
);
},
(
err
)
=>
{
console
.
info
(
'
case promise error called, errMessage is
'
+
err
.
code
);
expect
().
assertFail
();
}).
catch
(
mediaTestBase
.
catchCallback
);
await
videoRecorder
.
start
().
then
(()
=>
{
console
.
info
(
'
case recordr start called
'
);
},
(
err
)
=>
{
console
.
info
(
'
case promise error called, errMessage is
'
+
err
.
code
);
errorCode
=
checkErrorCode
(
err
.
code
);
expect
(
errorCode
).
assertEqual
(
true
);
}).
catch
(
mediaTestBase
.
catchCallback
);
await
videoRecorder
.
prepare
(
videoConfig
).
then
(()
=>
{
console
.
info
(
'
case recordr prepare called
'
);
},
(
err
)
=>
{
console
.
info
(
'
case promise error called, errMessage is
'
+
err
.
code
);
errorCode
=
checkErrorCode
(
err
.
code
);
expect
(
errorCode
).
assertEqual
(
true
);
}).
catch
(
mediaTestBase
.
catchCallback
);
await
videoRecorder
.
release
().
then
(()
=>
{
console
.
info
(
'
case release
'
);
expect
(
videoRecorder
.
state
).
assertEqual
(
'
idle
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
videoOutput
.
stop
();
await
videoRecorderBase
.
stopCaptureSession
(
captureSession
);
await
mediaTestBase
.
closeFd
(
fdObject
.
fileAsset
,
fdObject
.
fdNumber
);
await
videoRecorder
.
prepare
(
videoConfig
).
then
(()
=>
{
console
.
info
(
'
case recordr prepare called
'
);
},
(
err
)
=>
{
console
.
info
(
'
case promise error called, errMessage is
'
+
err
.
code
);
errorCode
=
checkErrorCode
(
err
.
code
);
expect
(
errorCode
).
assertEqual
(
true
);
}).
catch
(
mediaTestBase
.
catchCallback
);
done
();
})
})
})
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录