Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
d11b71da
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看板
提交
d11b71da
编写于
7月 22, 2022
作者:
F
fengzewu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix receiver crash
Signed-off-by:
N
fengzewu
<
fengzewu@huawei.com
>
上级
be51d5fa
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
116 addition
and
106 deletion
+116
-106
multimedia/image/image_js_standard/imageReceiver/src/main/js/test/receiver.test.js
..._standard/imageReceiver/src/main/js/test/receiver.test.js
+116
-106
未找到文件。
multimedia/image/image_js_standard/imageReceiver/src/main/js/test/receiver.test.js
浏览文件 @
d11b71da
...
...
@@ -29,20 +29,19 @@ describe('ImageReceiver', function () {
const
YCBCR_422_SP
=
1000
;
const
FORMATJPEG
=
2000
;
beforeAll
(
function
()
{
beforeAll
(
async
function
()
{
console
.
info
(
'
beforeAll case
'
);
})
beforeEach
(
function
()
{
isTimeOut
=
false
;
console
.
info
(
'
beforeEach case
'
);
})
afterEach
(
function
()
{
afterEach
(
async
function
()
{
console
.
info
(
'
afterEach case
'
);
})
afterAll
(
function
()
{
afterAll
(
async
function
()
{
console
.
info
(
'
afterAll case
'
);
})
...
...
@@ -50,7 +49,7 @@ describe('ImageReceiver', function () {
await
new
Promise
(
res
=>
setTimeout
(()
=>
{
res
()
},
times
));
}
function
createRecriver
(
done
,
testNum
,
wid
,
hei
,
fmt
,
cap
)
{
async
function
createRecriver
(
done
,
testNum
,
wid
,
hei
,
fmt
,
cap
)
{
try
{
image
.
createImageReceiver
(
wid
,
hei
,
fmt
,
cap
);
expect
(
false
).
assertTrue
();
...
...
@@ -63,21 +62,21 @@ describe('ImageReceiver', function () {
}
async
function
getComponentProErr
(
done
,
testNum
,
param
)
{
var
receiver
=
image
.
createImageReceiver
(
WIDTH
,
HEIGHT
,
FORMAT
,
CAPACITY
)
var
receiver
=
image
.
createImageReceiver
(
WIDTH
,
HEIGHT
,
FORMAT
,
CAPACITY
);
let
once
=
false
;
if
(
receiver
==
undefined
)
{
expect
(
false
).
assertTrue
();
done
()
done
()
;
}
else
{
receiver
.
on
(
'
imageArrival
'
,
()
=>
{
expect
(
true
).
assertTrue
();
})
var
dummy
=
receiver
.
test
if
(
once
)
{
return
;
}
once
=
true
;
receiver
.
readLatestImage
(
async
(
err
,
img
)
=>
{
if
(
img
==
undefined
)
{
expect
(
false
).
assertTrue
();
done
()
done
()
;
}
else
{
expect
(
img
.
size
.
width
==
WIDTH
).
assertTrue
();
expect
(
img
.
size
.
height
==
HEIGHT
).
assertTrue
();
...
...
@@ -96,25 +95,70 @@ describe('ImageReceiver', function () {
}
}
})
expect
(
true
).
assertTrue
();
})
var
dummy
=
receiver
.
test
;
}
}
async
function
getComponentCbErr
(
done
,
testNum
,
param
)
{
var
receiver
=
image
.
createImageReceiver
(
WIDTH
,
HEIGHT
,
FORMAT
,
CAPACITY
)
var
receiver
=
image
.
createImageReceiver
(
WIDTH
,
HEIGHT
,
FORMAT
,
CAPACITY
);
let
once
=
false
;
if
(
receiver
==
undefined
)
{
expect
(
false
).
assertTrue
();
done
()
done
()
;
}
else
{
receiver
.
on
(
'
imageArrival
'
,
()
=>
{
if
(
once
)
{
return
;
}
once
=
true
;
receiver
.
readLatestImage
(
async
(
err
,
img
)
=>
{
if
(
img
==
undefined
)
{
expect
(
false
).
assertTrue
();
done
();
}
else
{
expect
(
img
.
size
.
width
==
WIDTH
).
assertTrue
();
expect
(
img
.
size
.
height
==
HEIGHT
).
assertTrue
();
expect
(
img
.
format
==
12
).
assertTrue
();
expect
(
img
.
clipRect
.
size
.
width
==
WIDTH
).
assertTrue
();
expect
(
img
.
clipRect
.
size
.
height
==
HEIGHT
).
assertTrue
();
expect
(
img
.
clipRect
.
x
==
0
).
assertTrue
();
expect
(
img
.
clipRect
.
y
==
0
).
assertTrue
();
try
{
img
.
getComponent
(
param
,
(
err
,
component
)
=>
{
expect
(
false
).
assertTrue
();
})
}
catch
(
error
)
{
expect
(
error
.
code
==
1
).
assertTrue
();
console
.
log
(
`
${
testNum
}
error msg: `
+
error
);
done
();
}
}
})
expect
(
true
).
assertTrue
();
})
var
dummy
=
receiver
.
test
;
}
}
var
dummy
=
receiver
.
test
receiver
.
readLatestImage
(
async
(
err
,
img
)
=>
{
if
(
img
==
undefined
)
{
async
function
getComponentP
(
done
,
testNum
,
param
)
{
var
receiver
=
image
.
createImageReceiver
(
WIDTH
,
HEIGHT
,
FORMAT
,
CAPACITY
);
let
once
=
false
;
if
(
receiver
==
undefined
)
{
expect
(
false
).
assertTrue
();
done
();
return
;
}
receiver
.
on
(
'
imageArrival
'
,
()
=>
{
if
(
once
)
{
return
;
}
once
=
true
;
receiver
.
readLatestImage
((
err
,
img
)
=>
{
if
(
err
)
{
expect
(
false
).
assertTrue
();
done
()
done
()
;
}
else
{
expect
(
img
.
size
.
width
==
WIDTH
).
assertTrue
();
expect
(
img
.
size
.
height
==
HEIGHT
).
assertTrue
();
...
...
@@ -124,108 +168,74 @@ describe('ImageReceiver', function () {
expect
(
img
.
clipRect
.
x
==
0
).
assertTrue
();
expect
(
img
.
clipRect
.
y
==
0
).
assertTrue
();
try
{
i
mg
.
getComponent
(
param
,
(
err
,
component
)
=>
{
img
.
getComponent
(
param
).
then
(
component
=>
{
i
f
(
component
==
undefined
)
{
expect
(
false
).
assertTrue
();
})
}
catch
(
error
)
{
expect
(
error
.
code
==
1
).
assertTrue
();
console
.
log
(
`
${
testNum
}
error msg: `
+
error
);
done
();
}
else
{
expect
(
component
.
componentType
==
param
).
assertTrue
();
expect
(
component
.
byteBuffer
!=
undefined
).
assertTrue
();
expect
(
component
.
rowStride
==
0
).
assertTrue
();
expect
(
component
.
pixelStride
==
0
).
assertTrue
();
done
();
}
}).
catch
(
error
=>
{
console
.
log
(
`
${
testNum
}
error:`
+
error
)
expect
(
false
).
assertTrue
();
done
();
}
}
)
}
})
}
}
async
function
getComponentP
(
done
,
testNum
,
param
)
{
var
receiver
=
image
.
createImageReceiver
(
WIDTH
,
HEIGHT
,
FORMAT
,
CAPACITY
)
if
(
receiver
==
undefined
)
{
expect
(
false
).
assertTrue
();
done
()
return
;
}
receiver
.
on
(
'
imageArrival
'
,
()
=>
{
expect
(
true
).
assertTrue
();
})
var
dummy
=
receiver
.
test
receiver
.
readLatestImage
((
err
,
img
)
=>
{
if
(
err
)
{
expect
(
false
).
assertTrue
();
done
();
}
else
{
expect
(
img
.
size
.
width
==
WIDTH
).
assertTrue
();
expect
(
img
.
size
.
height
==
HEIGHT
).
assertTrue
();
expect
(
img
.
format
==
12
).
assertTrue
();
expect
(
img
.
clipRect
.
size
.
width
==
WIDTH
).
assertTrue
();
expect
(
img
.
clipRect
.
size
.
height
==
HEIGHT
).
assertTrue
();
expect
(
img
.
clipRect
.
x
==
0
).
assertTrue
();
expect
(
img
.
clipRect
.
y
==
0
).
assertTrue
();
img
.
getComponent
(
param
).
then
(
component
=>
{
if
(
component
==
undefined
)
{
expect
(
false
).
assertTrue
();
done
();
}
else
{
expect
(
component
.
componentType
==
param
).
assertTrue
();
expect
(
component
.
byteBuffer
!=
undefined
).
assertTrue
();
expect
(
component
.
rowStride
==
0
).
assertTrue
();
expect
(
component
.
pixelStride
==
0
).
assertTrue
();
done
();
}
}).
catch
(
error
=>
{
console
.
log
(
`
${
testNum
}
error:`
+
error
)
expect
(
false
).
assertTrue
();
done
();
})
}
})
var
dummy
=
receiver
.
test
;
}
async
function
getComponentCb
(
done
,
testNum
,
param
)
{
var
receiver
=
image
.
createImageReceiver
(
WIDTH
,
HEIGHT
,
FORMAT
,
CAPACITY
)
var
receiver
=
image
.
createImageReceiver
(
WIDTH
,
HEIGHT
,
FORMAT
,
CAPACITY
);
let
once
=
false
;
if
(
receiver
==
undefined
)
{
expect
(
false
).
assertTrue
();
done
()
done
()
;
return
;
}
receiver
.
on
(
'
imageArrival
'
,
()
=>
{
expect
(
true
).
assertTrue
();
})
var
dummy
=
receiver
.
test
receiver
.
readLatestImage
((
err
,
img
)
=>
{
if
(
err
)
{
expect
(
false
).
assertTrue
();
done
();
}
else
{
expect
(
img
.
size
.
width
==
WIDTH
).
assertTrue
();
expect
(
img
.
size
.
height
==
HEIGHT
).
assertTrue
();
expect
(
img
.
format
==
12
).
assertTrue
();
expect
(
img
.
clipRect
.
size
.
width
==
WIDTH
).
assertTrue
();
expect
(
img
.
clipRect
.
size
.
height
==
HEIGHT
).
assertTrue
();
expect
(
img
.
clipRect
.
x
==
0
).
assertTrue
();
expect
(
img
.
clipRect
.
y
==
0
).
assertTrue
();
img
.
getComponent
(
param
,
(
err
,
component
)
=>
{
if
(
err
)
{
expect
(
false
).
assertTrue
();
console
.
log
(
`
${
testNum
}
geterror: `
+
err
)
}
else
{
expect
(
component
!=
undefined
).
assertTrue
();
expect
(
component
.
componentType
==
param
).
assertTrue
();
expect
(
component
.
byteBuffer
!=
undefined
).
assertTrue
();
expect
(
component
.
rowStride
==
0
).
assertTrue
();
expect
(
component
.
pixelStride
==
0
).
assertTrue
();
done
();
}
})
if
(
once
)
{
return
;
}
once
=
true
;
receiver
.
readLatestImage
((
err
,
img
)
=>
{
if
(
err
)
{
expect
(
false
).
assertTrue
();
done
();
}
else
{
expect
(
img
.
size
.
width
==
WIDTH
).
assertTrue
();
expect
(
img
.
size
.
height
==
HEIGHT
).
assertTrue
();
expect
(
img
.
format
==
12
).
assertTrue
();
expect
(
img
.
clipRect
.
size
.
width
==
WIDTH
).
assertTrue
();
expect
(
img
.
clipRect
.
size
.
height
==
HEIGHT
).
assertTrue
();
expect
(
img
.
clipRect
.
x
==
0
).
assertTrue
();
expect
(
img
.
clipRect
.
y
==
0
).
assertTrue
();
img
.
getComponent
(
param
,
(
err
,
component
)
=>
{
if
(
err
)
{
expect
(
false
).
assertTrue
();
console
.
log
(
`
${
testNum
}
geterror: `
+
err
)
}
else
{
expect
(
component
!=
undefined
).
assertTrue
();
expect
(
component
.
componentType
==
param
).
assertTrue
();
expect
(
component
.
byteBuffer
!=
undefined
).
assertTrue
();
expect
(
component
.
rowStride
==
0
).
assertTrue
();
expect
(
component
.
pixelStride
==
0
).
assertTrue
();
done
();
}
})
}
})
expect
(
true
).
assertTrue
();
})
var
dummy
=
receiver
.
test
;
}
async
function
onErr
(
done
,
testNum
,
param
)
{
...
...
@@ -244,7 +254,7 @@ describe('ImageReceiver', function () {
console
.
log
(
`
${
testNum
}
error msg: `
+
error
);
done
();
}
var
dummy
=
receiver
.
test
var
dummy
=
receiver
.
test
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录