Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
094ca6c6
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看板
提交
094ca6c6
编写于
2月 09, 2022
作者:
F
fulizhong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add camera in recorder cases Signed-off-by: FULIZHONG<fulizhong@huawei.com>
Signed-off-by:
N
fulizhong
<
fulizhong@huawei.com
>
上级
1f8e44d1
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
433 addition
and
394 deletion
+433
-394
multimedia/media/media_js_standard/videoRecorder/src/main/js/test/VideoRecorderAPICallbackTest.test.js
...der/src/main/js/test/VideoRecorderAPICallbackTest.test.js
+147
-126
multimedia/media/media_js_standard/videoRecorder/src/main/js/test/VideoRecorderFuncCallbackTest.test.js
...er/src/main/js/test/VideoRecorderFuncCallbackTest.test.js
+81
-31
multimedia/media/media_js_standard/videoRecorder/src/main/js/test/VideoRecorderFuncPromiseTest.test.js
...der/src/main/js/test/VideoRecorderFuncPromiseTest.test.js
+205
-237
未找到文件。
multimedia/media/media_js_standard/videoRecorder/src/main/js/test/VideoRecorderAPICallbackTest.test.js
浏览文件 @
094ca6c6
此差异已折叠。
点击以展开。
multimedia/media/media_js_standard/videoRecorder/src/main/js/test/VideoRecorderFuncCallbackTest.test.js
浏览文件 @
094ca6c6
...
...
@@ -14,7 +14,8 @@
*/
import
media
from
'
@ohos.multimedia.media
'
import
mediademo
from
'
@ohos.multimedia.mediademo
'
import
camera
from
'
@ohos.multimedia.camera
'
import
mediaLibrary
from
'
@ohos.multimedia.mediaLibrary
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
'
RecorderLocalTestVideoFUNC
'
,
function
()
{
...
...
@@ -31,7 +32,11 @@ describe('RecorderLocalTestVideoFUNC', function () {
const
STOP_EVENT
=
'
stop
'
;
const
RESET_EVENT
=
'
reset
'
;
const
RELEASE_EVENT
=
'
release
'
;
let
mediaTest
=
null
;
let
cameraManager
;
let
cameras
;
let
captureSession
;
let
videoOutput
;
let
surfaceID
;
let
configFile
=
{
audioBitrate
:
48000
,
audioChannels
:
2
,
...
...
@@ -41,8 +46,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
fileFormat
:
'
mp4
'
,
videoBitrate
:
48000
,
videoCodec
:
'
video/mp4v-es
'
,
videoFrameWidth
:
12
0
,
videoFrameHeight
:
12
0
,
videoFrameWidth
:
64
0
,
videoFrameHeight
:
48
0
,
videoFrameRate
:
10
}
// orientationHint 0, 90, 180, 270
...
...
@@ -62,8 +67,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
fileFormat
:
'
mp4
'
,
videoBitrate
:
48000
,
videoCodec
:
'
video/mp4v-es
'
,
videoFrameWidth
:
12
0
,
videoFrameHeight
:
12
0
,
videoFrameWidth
:
64
0
,
videoFrameHeight
:
48
0
,
videoFrameRate
:
10
}
...
...
@@ -79,14 +84,13 @@ describe('RecorderLocalTestVideoFUNC', function () {
function
sleep
(
time
)
{
for
(
let
t
=
Date
.
now
();
Date
.
now
()
-
t
<=
time
;);
}
;
}
beforeAll
(
function
()
{
console
.
info
(
'
beforeAll case
'
);
})
beforeEach
(
function
()
{
mediaTest
=
null
;
console
.
info
(
'
beforeEach case
'
);
})
...
...
@@ -98,6 +102,43 @@ describe('RecorderLocalTestVideoFUNC', function () {
console
.
info
(
'
afterAll case
'
);
})
async
function
initCamera
()
{
cameraManager
=
await
camera
.
getCameraManager
(
null
);
if
(
cameraManager
!=
null
)
{
console
.
info
(
'
[camera] case getCameraManager success
'
);
}
else
{
console
.
info
(
'
[camera] case getCameraManager failed
'
);
return
;
}
cameras
=
await
cameraManager
.
getCameras
();
if
(
cameras
!=
null
)
{
console
.
info
(
'
[camera] case getCameras success
'
);
}
else
{
console
.
info
(
'
[camera] case getCameras failed
'
);
}
}
async
function
initCaptureSession
(
videoOutPut
)
{
let
cameraInput
=
await
cameraManager
.
createCameraInput
(
cameras
[
0
].
cameraId
);
if
(
cameraInput
!=
null
)
{
console
.
info
(
'
[camera] case createCameraInput success
'
);
}
else
{
console
.
info
(
'
[camera] case createCameraInput failed
'
);
return
;
}
captureSession
=
await
camera
.
createCaptureSession
(
null
);
await
captureSession
.
beginConfig
();
await
captureSession
.
addInput
(
cameraInput
);
await
captureSession
.
addOutput
(
videoOutPut
);
await
captureSession
.
commitConfig
();
await
captureSession
.
start
();
}
async
function
stopCaptureSession
()
{
await
captureSession
.
stop
();
await
captureSession
.
release
();
}
function
printfError
(
error
,
done
)
{
expect
().
assertFail
();
console
.
info
(
`case error called,errMessage is
${
error
.
message
}
`
);
...
...
@@ -128,7 +169,7 @@ describe('RecorderLocalTestVideoFUNC', function () {
});
}
eventEmitter
.
on
(
CREATE_EVENT
,
(
videoRecorder
,
steps
,
done
)
=>
{
eventEmitter
.
on
(
CREATE_EVENT
,
async
(
videoRecorder
,
steps
,
done
)
=>
{
steps
.
shift
();
media
.
createVideoRecorder
((
err
,
recorder
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
...
...
@@ -143,13 +184,12 @@ describe('RecorderLocalTestVideoFUNC', function () {
});
});
eventEmitter
.
on
(
PREPARE_EVENT
,
(
videoRecorder
,
steps
,
done
)
=>
{
eventEmitter
.
on
(
PREPARE_EVENT
,
async
(
videoRecorder
,
steps
,
done
)
=>
{
steps
.
shift
();
videoRecorder
.
prepare
(
videoConfig
,
(
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
console
.
info
(
'
case prepare success
'
);
expect
(
videoRecorder
.
state
).
assertEqual
(
'
prepared
'
);
mediaTest
=
mediademo
.
createMediaTest
();
toNextStep
(
videoRecorder
,
steps
,
done
);
}
else
{
printfError
(
err
,
done
);
...
...
@@ -157,13 +197,12 @@ describe('RecorderLocalTestVideoFUNC', function () {
});
});
eventEmitter
.
on
(
PREPARE_OLNYVIDEO_EVENT
,
(
videoRecorder
,
steps
,
done
)
=>
{
eventEmitter
.
on
(
PREPARE_OLNYVIDEO_EVENT
,
async
(
videoRecorder
,
steps
,
done
)
=>
{
steps
.
shift
();
videoRecorder
.
prepare
(
onlyVideoConfig
,
(
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
console
.
info
(
'
case prepare success
'
);
expect
(
videoRecorder
.
state
).
assertEqual
(
'
prepared
'
);
mediaTest
=
mediademo
.
createMediaTest
();
toNextStep
(
videoRecorder
,
steps
,
done
);
}
else
{
printfError
(
err
,
done
);
...
...
@@ -171,15 +210,13 @@ describe('RecorderLocalTestVideoFUNC', function () {
});
});
eventEmitter
.
on
(
GETSURFACE_EVENT
,
(
videoRecorder
,
steps
,
done
)
=>
{
eventEmitter
.
on
(
GETSURFACE_EVENT
,
async
(
videoRecorder
,
steps
,
done
)
=>
{
steps
.
shift
();
videoRecorder
.
getInputSurface
((
err
,
surfaceID
)
=>
{
videoRecorder
.
getInputSurface
((
err
,
outPutsurface
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
console
.
info
(
'
case getInputSurface success
'
);
expect
(
videoRecorder
.
state
).
assertEqual
(
'
prepared
'
);
mediaTest
.
isExit
=
0
;
mediaTest
.
isStart
=
1
;
mediaTest
.
startStream
(
surfaceID
);
surfaceID
=
outPutsurface
;
console
.
info
(
'
case getInputSurface success :
'
+
surfaceID
);
toNextStep
(
videoRecorder
,
steps
,
done
);
}
else
{
printfError
(
err
,
done
);
...
...
@@ -187,8 +224,18 @@ describe('RecorderLocalTestVideoFUNC', function () {
});
});
eventEmitter
.
on
(
START_EVENT
,
(
videoRecorder
,
steps
,
done
)
=>
{
eventEmitter
.
on
(
START_EVENT
,
async
(
videoRecorder
,
steps
,
done
)
=>
{
steps
.
shift
();
videoOutput
=
await
camera
.
createVideoOutput
(
surfaceID
);
if
(
videoOutput
==
null
)
{
console
.
info
(
'
case createVideoOutput failed
'
);
}
else
{
console
.
info
(
'
case createVideoOutput success
'
);
}
await
initCaptureSession
(
videoOutput
);
await
videoOutput
.
start
().
then
(()
=>
{
console
.
info
(
'
case videoOutput start success
'
);
});
videoRecorder
.
start
((
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
console
.
info
(
'
case start success
'
);
...
...
@@ -201,15 +248,12 @@ describe('RecorderLocalTestVideoFUNC', function () {
});
});
eventEmitter
.
on
(
PAUSE_EVENT
,
(
videoRecorder
,
steps
,
done
)
=>
{
eventEmitter
.
on
(
PAUSE_EVENT
,
async
(
videoRecorder
,
steps
,
done
)
=>
{
steps
.
shift
();
mediaTest
.
isPause
=
1
;
sleep
(
100
);
videoRecorder
.
pause
((
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
console
.
info
(
'
case pause success
'
);
expect
(
videoRecorder
.
state
).
assertEqual
(
'
paused
'
);
mediaTest
.
isPause
=
0
;
sleep
(
PAUSE_TIME
);
toNextStep
(
videoRecorder
,
steps
,
done
);
}
else
{
...
...
@@ -218,9 +262,8 @@ describe('RecorderLocalTestVideoFUNC', function () {
});
});
eventEmitter
.
on
(
RESUME_EVENT
,
(
videoRecorder
,
steps
,
done
)
=>
{
eventEmitter
.
on
(
RESUME_EVENT
,
async
(
videoRecorder
,
steps
,
done
)
=>
{
steps
.
shift
();
mediaTest
.
isStart
=
1
;
videoRecorder
.
resume
((
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
console
.
info
(
'
case resume success
'
);
...
...
@@ -233,7 +276,7 @@ describe('RecorderLocalTestVideoFUNC', function () {
});
});
eventEmitter
.
on
(
STOP_EVENT
,
(
videoRecorder
,
steps
,
done
)
=>
{
eventEmitter
.
on
(
STOP_EVENT
,
async
(
videoRecorder
,
steps
,
done
)
=>
{
steps
.
shift
();
videoRecorder
.
stop
((
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
...
...
@@ -246,7 +289,7 @@ describe('RecorderLocalTestVideoFUNC', function () {
});
});
eventEmitter
.
on
(
RESET_EVENT
,
(
videoRecorder
,
steps
,
done
)
=>
{
eventEmitter
.
on
(
RESET_EVENT
,
async
(
videoRecorder
,
steps
,
done
)
=>
{
steps
.
shift
();
videoRecorder
.
reset
((
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
...
...
@@ -259,10 +302,16 @@ describe('RecorderLocalTestVideoFUNC', function () {
});
});
eventEmitter
.
on
(
RELEASE_EVENT
,
(
videoRecorder
,
steps
,
done
)
=>
{
eventEmitter
.
on
(
RELEASE_EVENT
,
async
(
videoRecorder
,
steps
,
done
)
=>
{
steps
.
shift
();
mediaTest
.
isExit
=
1
;
mediaTest
.
closeStream
();
await
videoOutput
.
stop
().
then
(()
=>
{
console
.
info
(
'
case videoOutput stop success
'
);
});
await
videoOutput
.
release
().
then
(()
=>
{
console
.
info
(
'
case videoOutput release success
'
);
});
videoOutput
=
undefined
;
await
stopCaptureSession
();
videoRecorder
.
release
((
err
)
=>
{
if
(
typeof
(
err
)
==
'
undefined
'
)
{
expect
(
videoRecorder
.
state
).
assertEqual
(
'
idle
'
);
...
...
@@ -283,6 +332,7 @@ describe('RecorderLocalTestVideoFUNC', function () {
* @tc.level : Level0
*/
it
(
'
SUB_MEDIA_VIDEO_RECORDER_FUNCTION_CALLBACK_0100
'
,
0
,
async
function
(
done
)
{
await
initCamera
();
videoConfig
.
url
=
'
file:///data/media/19.mp4
'
;
let
videoRecorder
=
null
;
let
mySteps
=
new
Array
(
CREATE_EVENT
,
PREPARE_EVENT
,
GETSURFACE_EVENT
,
START_EVENT
,
RELEASE_EVENT
,
END_EVENT
);
...
...
multimedia/media/media_js_standard/videoRecorder/src/main/js/test/VideoRecorderFuncPromiseTest.test.js
浏览文件 @
094ca6c6
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录