Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
b958c2b0
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看板
提交
b958c2b0
编写于
6月 29, 2022
作者:
Q
qinliwen
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'pr_3971'
上级
b9d2a2a7
f4fcdf74
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
134 addition
and
81 deletion
+134
-81
multimedia/image/image_js_standard/imageReceiver/src/main/js/test/receiver.test.js
..._standard/imageReceiver/src/main/js/test/receiver.test.js
+134
-81
未找到文件。
multimedia/image/image_js_standard/imageReceiver/src/main/js/test/receiver.test.js
浏览文件 @
b958c2b0
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
image
from
'
@ohos.multimedia.image
'
import
image
from
'
@ohos.multimedia.image
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
...
@@ -25,6 +11,8 @@ describe('ImageReceiver', function () {
...
@@ -25,6 +11,8 @@ describe('ImageReceiver', function () {
const
HEIGHT
=
8
;
const
HEIGHT
=
8
;
const
FORMAT
=
4
;
const
FORMAT
=
4
;
const
CAPACITY
=
8
;
const
CAPACITY
=
8
;
const
YCBCR_422_SP
=
1000
;
const
FORMATJPEG
=
2000
;
beforeAll
(
function
()
{
beforeAll
(
function
()
{
console
.
info
(
'
beforeAll case
'
);
console
.
info
(
'
beforeAll case
'
);
...
@@ -63,19 +51,21 @@ describe('ImageReceiver', function () {
...
@@ -63,19 +51,21 @@ describe('ImageReceiver', function () {
var
receiver
=
image
.
createImageReceiver
(
WIDTH
,
HEIGHT
,
FORMAT
,
CAPACITY
)
var
receiver
=
image
.
createImageReceiver
(
WIDTH
,
HEIGHT
,
FORMAT
,
CAPACITY
)
if
(
receiver
==
undefined
)
{
if
(
receiver
==
undefined
)
{
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
done
();
done
()
}
else
{
return
;
}
else
{
receiver
.
on
(
'
imageArrival
'
,
()
=>
{
receiver
.
on
(
'
imageArrival
'
,
()
=>
{
expect
(
true
).
assertTrue
();
expect
(
true
).
assertTrue
();
})
})
var
dummy
=
receiver
.
test
var
dummy
=
receiver
.
test
receiver
.
readLatestImage
(
async
(
err
,
img
)
=>
{
receiver
.
readLatestImage
(
async
(
err
,
img
)
=>
{
if
(
img
==
undefined
)
{
if
(
img
==
undefined
)
{
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
done
();
done
()
}
else
{
return
;
}
else
{
expect
(
img
.
size
.
width
==
WIDTH
).
assertTrue
();
expect
(
img
.
size
.
width
==
WIDTH
).
assertTrue
();
expect
(
img
.
size
.
height
==
HEIGHT
).
assertTrue
();
expect
(
img
.
size
.
height
==
HEIGHT
).
assertTrue
();
expect
(
img
.
format
==
12
).
assertTrue
();
expect
(
img
.
format
==
12
).
assertTrue
();
...
@@ -85,34 +75,36 @@ describe('ImageReceiver', function () {
...
@@ -85,34 +75,36 @@ describe('ImageReceiver', function () {
expect
(
img
.
clipRect
.
y
==
0
).
assertTrue
();
expect
(
img
.
clipRect
.
y
==
0
).
assertTrue
();
try
{
try
{
await
img
.
getComponent
(
param
);
await
img
.
getComponent
(
param
);
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
catch
(
error
)
{
}
catch
(
error
)
{
expect
(
error
.
code
==
1
).
assertTrue
();
expect
(
error
.
code
==
1
).
assertTrue
();
console
.
log
(
`
${
testNum
}
error msg: `
+
error
);
console
.
log
(
`
${
testNum
}
error msg: `
+
error
);
done
();
done
();
}
}
}
}
})
})
}
}
}
}
async
function
getComponentCbErr
(
done
,
testNum
,
param
)
{
async
function
getComponentCbErr
(
done
,
testNum
,
param
)
{
var
receiver
=
image
.
createImageReceiver
(
WIDTH
,
HEIGHT
,
FORMAT
,
CAPACITY
)
var
receiver
=
image
.
createImageReceiver
(
WIDTH
,
HEIGHT
,
FORMAT
,
CAPACITY
)
if
(
receiver
==
undefined
)
{
if
(
receiver
==
undefined
)
{
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
done
();
done
()
}
else
{
return
;
}
else
{
receiver
.
on
(
'
imageArrival
'
,
()
=>
{
receiver
.
on
(
'
imageArrival
'
,
()
=>
{
expect
(
true
).
assertTrue
();
expect
(
true
).
assertTrue
();
})
})
var
dummy
=
receiver
.
test
var
dummy
=
receiver
.
test
receiver
.
readLatestImage
(
async
(
err
,
img
)
=>
{
receiver
.
readLatestImage
(
async
(
err
,
img
)
=>
{
if
(
img
==
undefined
)
{
if
(
img
==
undefined
)
{
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
done
();
done
()
}
else
{
return
;
}
else
{
expect
(
img
.
size
.
width
==
WIDTH
).
assertTrue
();
expect
(
img
.
size
.
width
==
WIDTH
).
assertTrue
();
expect
(
img
.
size
.
height
==
HEIGHT
).
assertTrue
();
expect
(
img
.
size
.
height
==
HEIGHT
).
assertTrue
();
expect
(
img
.
format
==
12
).
assertTrue
();
expect
(
img
.
format
==
12
).
assertTrue
();
...
@@ -120,7 +112,7 @@ describe('ImageReceiver', function () {
...
@@ -120,7 +112,7 @@ describe('ImageReceiver', function () {
expect
(
img
.
clipRect
.
size
.
height
==
HEIGHT
).
assertTrue
();
expect
(
img
.
clipRect
.
size
.
height
==
HEIGHT
).
assertTrue
();
expect
(
img
.
clipRect
.
x
==
0
).
assertTrue
();
expect
(
img
.
clipRect
.
x
==
0
).
assertTrue
();
expect
(
img
.
clipRect
.
y
==
0
).
assertTrue
();
expect
(
img
.
clipRect
.
y
==
0
).
assertTrue
();
try
{
try
{
img
.
getComponent
(
param
,
(
err
,
component
)
=>
{
img
.
getComponent
(
param
,
(
err
,
component
)
=>
{
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
...
@@ -130,15 +122,16 @@ describe('ImageReceiver', function () {
...
@@ -130,15 +122,16 @@ describe('ImageReceiver', function () {
console
.
log
(
`
${
testNum
}
error msg: `
+
error
);
console
.
log
(
`
${
testNum
}
error msg: `
+
error
);
done
();
done
();
}
}
}
}
})
})
}
}
}
}
async
function
getComponentP
(
done
,
testNum
,
param
)
{
async
function
getComponentP
(
done
,
testNum
,
param
)
{
var
receiver
=
image
.
createImageReceiver
(
WIDTH
,
HEIGHT
,
FORMAT
,
CAPACITY
)
var
receiver
=
image
.
createImageReceiver
(
WIDTH
,
HEIGHT
,
FORMAT
,
CAPACITY
)
if
(
receiver
==
undefined
)
{
if
(
receiver
==
undefined
)
{
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
done
();
done
()
return
;
}
}
receiver
.
on
(
'
imageArrival
'
,
()
=>
{
receiver
.
on
(
'
imageArrival
'
,
()
=>
{
...
@@ -151,7 +144,8 @@ describe('ImageReceiver', function () {
...
@@ -151,7 +144,8 @@ describe('ImageReceiver', function () {
if
(
err
)
{
if
(
err
)
{
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
done
();
done
();
}
else
{
return
;
}
else
{
expect
(
img
.
size
.
width
==
WIDTH
).
assertTrue
();
expect
(
img
.
size
.
width
==
WIDTH
).
assertTrue
();
expect
(
img
.
size
.
height
==
HEIGHT
).
assertTrue
();
expect
(
img
.
size
.
height
==
HEIGHT
).
assertTrue
();
expect
(
img
.
format
==
12
).
assertTrue
();
expect
(
img
.
format
==
12
).
assertTrue
();
...
@@ -159,22 +153,25 @@ describe('ImageReceiver', function () {
...
@@ -159,22 +153,25 @@ describe('ImageReceiver', function () {
expect
(
img
.
clipRect
.
size
.
height
==
HEIGHT
).
assertTrue
();
expect
(
img
.
clipRect
.
size
.
height
==
HEIGHT
).
assertTrue
();
expect
(
img
.
clipRect
.
x
==
0
).
assertTrue
();
expect
(
img
.
clipRect
.
x
==
0
).
assertTrue
();
expect
(
img
.
clipRect
.
y
==
0
).
assertTrue
();
expect
(
img
.
clipRect
.
y
==
0
).
assertTrue
();
img
.
getComponent
(
param
).
then
(
component
=>
{
img
.
getComponent
(
param
).
then
(
component
=>
{
if
(
component
==
undefined
)
{
if
(
component
==
undefined
)
{
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
done
();
done
();
}
else
{
return
;
}
else
{
expect
(
component
.
componentType
==
param
).
assertTrue
();
expect
(
component
.
componentType
==
param
).
assertTrue
();
expect
(
component
.
byteBuffer
!=
undefined
).
assertTrue
();
expect
(
component
.
byteBuffer
!=
undefined
).
assertTrue
();
expect
(
component
.
rowStride
==
0
).
assertTrue
();
expect
(
component
.
pixelStride
==
0
).
assertTrue
();
done
();
done
();
}
}
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
log
(
`
${
testNum
}
error:`
+
error
)
console
.
log
(
`
${
testNum
}
error:`
+
error
)
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
done
();
done
();
})
})
}
}
})
})
}
}
...
@@ -182,7 +179,8 @@ describe('ImageReceiver', function () {
...
@@ -182,7 +179,8 @@ describe('ImageReceiver', function () {
var
receiver
=
image
.
createImageReceiver
(
WIDTH
,
HEIGHT
,
FORMAT
,
CAPACITY
)
var
receiver
=
image
.
createImageReceiver
(
WIDTH
,
HEIGHT
,
FORMAT
,
CAPACITY
)
if
(
receiver
==
undefined
)
{
if
(
receiver
==
undefined
)
{
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
done
();
done
()
return
;
}
}
receiver
.
on
(
'
imageArrival
'
,
()
=>
{
receiver
.
on
(
'
imageArrival
'
,
()
=>
{
...
@@ -195,7 +193,8 @@ describe('ImageReceiver', function () {
...
@@ -195,7 +193,8 @@ describe('ImageReceiver', function () {
if
(
err
)
{
if
(
err
)
{
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
done
();
done
();
}
else
{
return
;
}
else
{
expect
(
img
.
size
.
width
==
WIDTH
).
assertTrue
();
expect
(
img
.
size
.
width
==
WIDTH
).
assertTrue
();
expect
(
img
.
size
.
height
==
HEIGHT
).
assertTrue
();
expect
(
img
.
size
.
height
==
HEIGHT
).
assertTrue
();
expect
(
img
.
format
==
12
).
assertTrue
();
expect
(
img
.
format
==
12
).
assertTrue
();
...
@@ -203,19 +202,21 @@ describe('ImageReceiver', function () {
...
@@ -203,19 +202,21 @@ describe('ImageReceiver', function () {
expect
(
img
.
clipRect
.
size
.
height
==
HEIGHT
).
assertTrue
();
expect
(
img
.
clipRect
.
size
.
height
==
HEIGHT
).
assertTrue
();
expect
(
img
.
clipRect
.
x
==
0
).
assertTrue
();
expect
(
img
.
clipRect
.
x
==
0
).
assertTrue
();
expect
(
img
.
clipRect
.
y
==
0
).
assertTrue
();
expect
(
img
.
clipRect
.
y
==
0
).
assertTrue
();
img
.
getComponent
(
param
,
(
err
,
component
)
=>
{
img
.
getComponent
(
param
,
(
err
,
component
)
=>
{
if
(
err
)
{
if
(
err
)
{
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
console
.
log
(
`
${
testNum
}
geterror: `
+
err
)
console
.
log
(
`
${
testNum
}
geterror: `
+
err
)
}
else
{
}
else
{
expect
(
component
!=
undefined
).
assertTrue
();
expect
(
component
!=
undefined
).
assertTrue
();
expect
(
component
.
componentType
==
param
).
assertTrue
();
expect
(
component
.
componentType
==
param
).
assertTrue
();
expect
(
component
.
byteBuffer
!=
undefined
).
assertTrue
();
expect
(
component
.
byteBuffer
!=
undefined
).
assertTrue
();
expect
(
component
.
rowStride
==
0
).
assertTrue
();
expect
(
component
.
pixelStride
==
0
).
assertTrue
();
done
();
done
();
}
}
})
})
}
}
})
})
}
}
...
@@ -225,7 +226,8 @@ describe('ImageReceiver', function () {
...
@@ -225,7 +226,8 @@ describe('ImageReceiver', function () {
if
(
receiver
==
undefined
)
{
if
(
receiver
==
undefined
)
{
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
done
();
done
();
}
else
{
return
;
}
else
{
try
{
try
{
receiver
.
on
(
param
,
()
=>
{
receiver
.
on
(
param
,
()
=>
{
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
...
@@ -237,11 +239,11 @@ describe('ImageReceiver', function () {
...
@@ -237,11 +239,11 @@ describe('ImageReceiver', function () {
}
}
var
dummy
=
receiver
.
test
var
dummy
=
receiver
.
test
}
}
}
}
function
isString
(
value
)
{
function
isString
(
value
)
{
return
typeof
value
===
'
string
'
;
return
typeof
value
===
'
string
'
;
}
}
/**
/**
...
@@ -254,7 +256,7 @@ describe('ImageReceiver', function () {
...
@@ -254,7 +256,7 @@ describe('ImageReceiver', function () {
* @tc.type : Functional
* @tc.type : Functional
* @tc.level : Level 0
* @tc.level : Level 0
*/
*/
it
(
'
Receiver_001
'
,
0
,
async
function
(
done
)
{
it
(
'
Receiver_001
'
,
0
,
async
function
(
done
)
{
var
receiver
=
image
.
createImageReceiver
(
WIDTH
,
HEIGHT
,
FORMAT
,
CAPACITY
)
var
receiver
=
image
.
createImageReceiver
(
WIDTH
,
HEIGHT
,
FORMAT
,
CAPACITY
)
if
(
receiver
==
undefined
)
{
if
(
receiver
==
undefined
)
{
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
...
@@ -395,6 +397,56 @@ describe('ImageReceiver', function () {
...
@@ -395,6 +397,56 @@ describe('ImageReceiver', function () {
createRecriver
(
done
,
'
Receiver_001-9
'
,
WIDTH
,
HEIGHT
,
'
form.
'
,
CAPACITY
)
createRecriver
(
done
,
'
Receiver_001-9
'
,
WIDTH
,
HEIGHT
,
'
form.
'
,
CAPACITY
)
})
})
/**
* @tc.number : Receiver_001-10
* @tc.name : createImageReceiver
* @tc.desc : 1.set width,height,format,capacity
* 2.create ImageReceiver
* 3.return ImageReceiver not empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
Receiver_001-10
'
,
0
,
async
function
(
done
)
{
var
receiver
=
image
.
createImageReceiver
(
WIDTH
,
HEIGHT
,
FORMATJPEG
,
CAPACITY
)
if
(
receiver
==
undefined
)
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
Receiver_001-10 undefined
'
)
done
();
}
else
{
expect
(
receiver
.
size
.
width
==
WIDTH
).
assertTrue
();
expect
(
receiver
.
size
.
height
==
HEIGHT
).
assertTrue
();
expect
(
receiver
.
capacity
==
CAPACITY
).
assertTrue
();
expect
(
receiver
.
format
==
FORMATJPEG
).
assertTrue
();
done
();
}
})
/**
* @tc.number : Receiver_001-11
* @tc.name : createImageReceiver
* @tc.desc : 1.set width,height,format,capacity
* 2.create ImageReceiver
* 3.return ImageReceiver not empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
Receiver_001-11
'
,
0
,
async
function
(
done
)
{
var
receiver
=
image
.
createImageReceiver
(
WIDTH
,
HEIGHT
,
YCBCR_422_SP
,
CAPACITY
)
if
(
receiver
==
undefined
)
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
Receiver_001-11 undefined
'
)
done
();
}
else
{
expect
(
receiver
.
size
.
width
==
WIDTH
).
assertTrue
();
expect
(
receiver
.
size
.
height
==
HEIGHT
).
assertTrue
();
expect
(
receiver
.
capacity
==
CAPACITY
).
assertTrue
();
expect
(
receiver
.
format
==
YCBCR_422_SP
).
assertTrue
();
done
();
}
})
/**
/**
* @tc.number : Receiver_002
* @tc.number : Receiver_002
* @tc.name : getReceivingSurfaceId-promise
* @tc.name : getReceivingSurfaceId-promise
...
@@ -491,7 +543,7 @@ describe('ImageReceiver', function () {
...
@@ -491,7 +543,7 @@ describe('ImageReceiver', function () {
if
(
err
)
{
if
(
err
)
{
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
console
.
info
(
'
Receiver_005 release fail
'
);
console
.
info
(
'
Receiver_005 release fail
'
);
done
()
;
done
()
}
else
{
}
else
{
console
.
info
(
'
Receiver_005 release call back
'
);
console
.
info
(
'
Receiver_005 release call back
'
);
expect
(
true
).
assertTrue
();
expect
(
true
).
assertTrue
();
...
@@ -501,7 +553,7 @@ describe('ImageReceiver', function () {
...
@@ -501,7 +553,7 @@ describe('ImageReceiver', function () {
}
else
{
}
else
{
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
console
.
info
(
'
Receiver_005 finished
'
);
console
.
info
(
'
Receiver_005 finished
'
);
done
()
;
done
()
}
}
})
})
...
@@ -531,7 +583,7 @@ describe('ImageReceiver', function () {
...
@@ -531,7 +583,7 @@ describe('ImageReceiver', function () {
}
else
{
}
else
{
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
console
.
info
(
'
Receiver_006 finished
'
);
console
.
info
(
'
Receiver_006 finished
'
);
done
()
;
done
()
}
}
})
})
...
@@ -579,7 +631,7 @@ describe('ImageReceiver', function () {
...
@@ -579,7 +631,7 @@ describe('ImageReceiver', function () {
receiver
.
readNextImage
().
then
(
img
=>
{
receiver
.
readNextImage
().
then
(
img
=>
{
console
.
info
(
'
Receiver_008 readNextImage Success
'
);
console
.
info
(
'
Receiver_008 readNextImage Success
'
);
expect
(
img
!=
undefined
).
assertTrue
();
expect
(
img
!=
undefined
).
assertTrue
();
done
()
;
done
()
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
log
(
'
Receiver_008 error:
'
+
error
);
console
.
log
(
'
Receiver_008 error:
'
+
error
);
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
...
@@ -607,14 +659,14 @@ describe('ImageReceiver', function () {
...
@@ -607,14 +659,14 @@ describe('ImageReceiver', function () {
var
dummy
=
receiver
.
test
;
var
dummy
=
receiver
.
test
;
if
(
receiver
!=
undefined
)
{
if
(
receiver
!=
undefined
)
{
receiver
.
readNextImage
((
err
,
img
)
=>
{
receiver
.
readNextImage
((
err
,
img
)
=>
{
if
(
err
)
{
if
(
err
)
{
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
}
else
{
}
else
{
console
.
info
(
'
Receiver_009 readNextImage call back Success
'
);
console
.
info
(
'
Receiver_009 readNextImage call back Success
'
);
expect
(
img
!=
undefined
).
assertTrue
();
expect
(
img
!=
undefined
).
assertTrue
();
done
();
done
();
}
}
})
})
}
else
{
}
else
{
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
...
@@ -697,7 +749,6 @@ describe('ImageReceiver', function () {
...
@@ -697,7 +749,6 @@ describe('ImageReceiver', function () {
it
(
'
Receiver_010_4
'
,
0
,
async
function
(
done
)
{
it
(
'
Receiver_010_4
'
,
0
,
async
function
(
done
)
{
getComponentCb
(
done
,
'
Receiver_010_4
'
,
JPEG
)
getComponentCb
(
done
,
'
Receiver_010_4
'
,
JPEG
)
})
})
/**
/**
* @tc.number : Receiver_010_5
* @tc.number : Receiver_010_5
* @tc.name : getComponent-YUV_Y
* @tc.name : getComponent-YUV_Y
...
@@ -712,7 +763,6 @@ describe('ImageReceiver', function () {
...
@@ -712,7 +763,6 @@ describe('ImageReceiver', function () {
it
(
'
Receiver_010_5
'
,
0
,
async
function
(
done
)
{
it
(
'
Receiver_010_5
'
,
0
,
async
function
(
done
)
{
getComponentCb
(
done
,
'
Receiver_010_5
'
,
YUV_Y
)
getComponentCb
(
done
,
'
Receiver_010_5
'
,
YUV_Y
)
})
})
/**
/**
* @tc.number : Receiver_010_6
* @tc.number : Receiver_010_6
* @tc.name : getComponent-YUV_V
* @tc.name : getComponent-YUV_V
...
@@ -727,7 +777,6 @@ describe('ImageReceiver', function () {
...
@@ -727,7 +777,6 @@ describe('ImageReceiver', function () {
it
(
'
Receiver_010_6
'
,
0
,
async
function
(
done
)
{
it
(
'
Receiver_010_6
'
,
0
,
async
function
(
done
)
{
getComponentCb
(
done
,
'
Receiver_010_6
'
,
YUV_V
)
getComponentCb
(
done
,
'
Receiver_010_6
'
,
YUV_V
)
})
})
/**
/**
* @tc.number : Receiver_010_7
* @tc.number : Receiver_010_7
* @tc.name : getComponent-YUV_U
* @tc.name : getComponent-YUV_U
...
@@ -742,34 +791,34 @@ describe('ImageReceiver', function () {
...
@@ -742,34 +791,34 @@ describe('ImageReceiver', function () {
it
(
'
Receiver_010_7
'
,
0
,
async
function
(
done
)
{
it
(
'
Receiver_010_7
'
,
0
,
async
function
(
done
)
{
getComponentCb
(
done
,
'
Receiver_010_7
'
,
YUV_U
)
getComponentCb
(
done
,
'
Receiver_010_7
'
,
YUV_U
)
})
})
/**
/**
* @tc.number : Receiver_011
* @tc.number : Receiver_011
* @tc.name : on
* @tc.name : on
* @tc.desc : 1.create ImageReceiver
* @tc.desc : 1.create ImageReceiver
* 2.call on
* 2.call on
* @tc.size : MEDIUM
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.type : Functional
* @tc.level : Level 0
* @tc.level : Level 0
*/
*/
it
(
'
Receiver_011
'
,
0
,
async
function
(
done
)
{
it
(
'
Receiver_011
'
,
0
,
async
function
(
done
)
{
var
receiver
=
image
.
createImageReceiver
(
WIDTH
,
HEIGHT
,
FORMAT
,
CAPACITY
)
var
receiver
=
image
.
createImageReceiver
(
WIDTH
,
HEIGHT
,
FORMAT
,
CAPACITY
)
if
(
receiver
==
undefined
)
{
if
(
receiver
==
undefined
)
{
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
done
();
done
();
}
else
{
return
;
}
else
{
let
pass
=
false
;
let
pass
=
false
;
receiver
.
on
(
'
imageArrival
'
,
(
err
)
=>
{
receiver
.
on
(
'
imageArrival
'
,
(
err
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
info
(
'
Receiver_011 on err
'
+
err
);
console
.
info
(
'
Receiver_011 on err
'
+
err
);
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
done
();
done
();
}
else
{
}
else
{
pass
=
true
;
pass
=
true
;
console
.
info
(
'
Receiver_011 on call back IN
'
);
console
.
info
(
'
Receiver_011 on call back IN
'
);
}
}
})
})
var
dummy
=
receiver
.
test
var
dummy
=
receiver
.
test
await
sleep
(
2000
)
await
sleep
(
2000
)
expect
(
pass
).
assertTrue
();
expect
(
pass
).
assertTrue
();
...
@@ -789,11 +838,12 @@ describe('ImageReceiver', function () {
...
@@ -789,11 +838,12 @@ describe('ImageReceiver', function () {
* @tc.type : Functional
* @tc.type : Functional
* @tc.level : Level 0
* @tc.level : Level 0
*/
*/
it
(
'
Receiver_012
'
,
0
,
async
function
(
done
)
{
it
(
'
Receiver_012
'
,
0
,
async
function
(
done
)
{
var
receiver
=
image
.
createImageReceiver
(
WIDTH
,
HEIGHT
,
FORMAT
,
CAPACITY
)
var
receiver
=
image
.
createImageReceiver
(
WIDTH
,
HEIGHT
,
FORMAT
,
CAPACITY
)
if
(
receiver
==
undefined
)
{
if
(
receiver
==
undefined
)
{
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
done
();
done
();
return
;
}
}
receiver
.
on
(
'
imageArrival
'
,
()
=>
{
receiver
.
on
(
'
imageArrival
'
,
()
=>
{
...
@@ -806,6 +856,7 @@ describe('ImageReceiver', function () {
...
@@ -806,6 +856,7 @@ describe('ImageReceiver', function () {
if
(
img
==
undefined
)
{
if
(
img
==
undefined
)
{
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
done
();
done
();
return
;
}
else
{
}
else
{
expect
(
img
.
size
.
width
==
WIDTH
).
assertTrue
();
expect
(
img
.
size
.
width
==
WIDTH
).
assertTrue
();
expect
(
img
.
size
.
height
==
HEIGHT
).
assertTrue
();
expect
(
img
.
size
.
height
==
HEIGHT
).
assertTrue
();
...
@@ -848,6 +899,7 @@ describe('ImageReceiver', function () {
...
@@ -848,6 +899,7 @@ describe('ImageReceiver', function () {
if
(
receiver
==
undefined
)
{
if
(
receiver
==
undefined
)
{
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
done
();
done
();
return
;
}
}
receiver
.
on
(
'
imageArrival
'
,
()
=>
{
receiver
.
on
(
'
imageArrival
'
,
()
=>
{
...
@@ -856,10 +908,11 @@ describe('ImageReceiver', function () {
...
@@ -856,10 +908,11 @@ describe('ImageReceiver', function () {
var
dummy
=
receiver
.
test
var
dummy
=
receiver
.
test
receiver
.
readLatestImage
((
err
,
img
)
=>
{
receiver
.
readLatestImage
((
err
,
img
)
=>
{
if
(
img
==
undefined
)
{
if
(
img
==
undefined
)
{
expect
(
false
).
assertTrue
();
expect
(
false
).
assertTrue
();
done
();
done
()
return
;
}
}
expect
(
img
.
size
.
width
==
WIDTH
).
assertTrue
();
expect
(
img
.
size
.
width
==
WIDTH
).
assertTrue
();
...
@@ -1001,7 +1054,7 @@ describe('ImageReceiver', function () {
...
@@ -1001,7 +1054,7 @@ describe('ImageReceiver', function () {
it
(
'
Receiver_021
'
,
0
,
async
function
(
done
)
{
it
(
'
Receiver_021
'
,
0
,
async
function
(
done
)
{
getComponentProErr
(
done
,
'
Receiver_021
'
,
{
a
:
1
})
getComponentProErr
(
done
,
'
Receiver_021
'
,
{
a
:
1
})
})
})
/**
/**
* @tc.number : Receiver_022
* @tc.number : Receiver_022
* @tc.name : on-1
* @tc.name : on-1
...
@@ -1053,4 +1106,4 @@ describe('ImageReceiver', function () {
...
@@ -1053,4 +1106,4 @@ describe('ImageReceiver', function () {
it
(
'
Receiver_025
'
,
0
,
async
function
(
done
)
{
it
(
'
Receiver_025
'
,
0
,
async
function
(
done
)
{
onErr
(
done
,
'
Receiver_025
'
,
'
a
'
)
onErr
(
done
,
'
Receiver_025
'
,
'
a
'
)
})
})
})
})
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录