Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
f52203fc
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看板
未验证
提交
f52203fc
编写于
8月 27, 2022
作者:
O
openharmony_ci
提交者:
Gitee
8月 27, 2022
浏览文件
操作
浏览文件
下载
差异文件
!5229 image monthly新增接口用例
Merge pull request !5229 from 秦莉文/monthly_20220816
上级
e6c3baf5
a787cac2
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
135 addition
and
87 deletion
+135
-87
multimedia/image/image_js_standard/image/src/main/js/test/addImage.test.js
...image_js_standard/image/src/main/js/test/addImage.test.js
+135
-87
未找到文件。
multimedia/image/image_js_standard/image/src/main/js/test/addImage.test.js
浏览文件 @
f52203fc
...
...
@@ -60,6 +60,101 @@ export default function addImage() {
})
}
async
function
createIncrementalSourcePromise
(
done
,
testNum
,
type
,
opts
)
{
let
testimagebuffer
=
testPng
;
let
incSouce
;
console
.
info
(
`
${
testNum
}
0001 `
+
testimagebuffer
.
length
);
let
bufferSize
=
5000
;
let
offset
=
0
;
if
(
type
==
'
sourceOpts
'
)
{
console
.
info
(
`
${
testNum
}
have sourceopts`
)
incSouce
=
image
.
createIncrementalSource
(
new
ArrayBuffer
(
1
),
opts
);
}
else
{
console
.
info
(
`
${
testNum
}
no sourceopts`
)
incSouce
=
image
.
createIncrementalSource
(
new
ArrayBuffer
(
1
));
}
let
ret
;
let
isFinished
=
false
;
while
(
offset
<
testimagebuffer
.
length
)
{
var
oneStep
=
testimagebuffer
.
slice
(
offset
,
offset
+
bufferSize
);
console
.
info
(
`
${
testNum
}
0002 `
+
oneStep
.
length
);
if
(
oneStep
.
length
<
bufferSize
)
{
isFinished
=
true
;
}
ret
=
await
incSouce
.
updateData
(
oneStep
,
isFinished
,
0
,
oneStep
.
length
);
if
(
!
ret
)
{
console
.
info
(
`
${
testNum
}
updateData failed`
);
expect
(
ret
).
assertTrue
();
break
;
}
offset
=
offset
+
oneStep
.
length
;
console
.
info
(
`
${
testNum
}
0003 `
+
offset
);
}
if
(
ret
)
{
console
.
info
(
`
${
testNum
}
updateData success `
);
let
decodingOptions
=
{
sampleSize
:
1
};
incSouce
.
createPixelMap
(
decodingOptions
,
(
err
,
pixelmap
)
=>
{
console
.
info
(
`
${
testNum
}
0004`
+
pixelmap
);
expect
(
pixelmap
!=
undefined
).
assertTrue
();
done
();
})
}
else
{
expect
(
false
).
assertTrue
();
done
();
}
}
async
function
createIncrementalSourceCb
(
done
,
testNum
,
type
,
opts
)
{
let
testimagebuffer
=
testPng
;
let
incSouce
;
console
.
info
(
`
${
testNum
}
0001 `
+
testimagebuffer
.
length
);
let
bufferSize
=
5000
;
let
offset
=
0
;
if
(
type
==
'
sourceOpts
'
)
{
incSouce
=
image
.
createIncrementalSource
(
new
ArrayBuffer
(
1
),
opts
);
}
else
{
incSouce
=
image
.
createIncrementalSource
(
new
ArrayBuffer
(
1
));
}
let
ret
;
let
isFinished
=
false
;
while
(
offset
<
testimagebuffer
.
length
)
{
var
oneStep
=
testimagebuffer
.
slice
(
offset
,
offset
+
bufferSize
);
console
.
info
(
`
${
testNum
}
0002 `
+
oneStep
.
length
);
if
(
oneStep
.
length
<
bufferSize
)
{
isFinished
=
true
;
}
ret
=
await
new
Promise
(
res
=>
{
incSouce
.
updateData
(
oneStep
,
isFinished
,
0
,
oneStep
.
length
,
(
err
,
ret
)
=>
{
res
(
ret
);
})
})
if
(
!
ret
)
{
console
.
info
(
`
${
testNum
}
updateData failed`
);
expect
(
ret
).
assertTrue
();
break
;
}
offset
=
offset
+
oneStep
.
length
;
console
.
info
(
`
${
testNum
}
0003 `
+
offset
);
}
if
(
ret
)
{
console
.
info
(
`
${
testNum
}
updateData success `
);
let
decodingOptions
=
{
sampleSize
:
1
};
incSouce
.
createPixelMap
(
decodingOptions
,
(
err
,
pixelmap
)
=>
{
console
.
info
(
`
${
testNum
}
0004`
+
pixelmap
);
expect
(
pixelmap
!=
undefined
).
assertTrue
();
done
();
})
}
else
{
expect
(
false
).
assertTrue
();
done
();
}
}
/**
* @tc.number : addImage_001
* @tc.name : create pixelmap-promise (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer,scaleMode: 1, alphaType: 0)
...
...
@@ -199,48 +294,7 @@ export default function addImage() {
* @tc.level : Level 1
*/
it
(
'
add_053
'
,
0
,
async
function
(
done
)
{
try
{
let
testimagebuffer
=
testPng
;
console
.
info
(
'
add_053 0003
'
+
testimagebuffer
.
length
);
let
bufferSize
=
5000
;
let
offset
=
0
;
const
incSouce
=
image
.
createIncrementalSource
(
new
ArrayBuffer
(
1
));
let
ret
;
let
isFinished
=
false
;
while
(
offset
<
testimagebuffer
.
length
)
{
console
.
info
(
'
add_053 0006
'
+
testimagebuffer
.
length
);
var
oneStep
=
testimagebuffer
.
slice
(
offset
,
offset
+
bufferSize
);
console
.
info
(
'
add_053 0007
'
+
oneStep
.
length
);
if
(
oneStep
.
length
<
bufferSize
)
{
isFinished
=
true
;
}
ret
=
await
incSouce
.
updateData
(
oneStep
,
isFinished
,
0
,
oneStep
.
length
);
if
(
!
ret
)
{
console
.
info
(
'
add_053 updateData failed
'
);
expect
(
ret
).
assertTrue
();
break
;
}
offset
=
offset
+
oneStep
.
length
;
console
.
info
(
'
add_053 0011
'
+
offset
);
}
if
(
ret
)
{
console
.
info
(
'
add_053 updateData success
'
);
let
decodingOptions
=
{
sampleSize
:
1
};
incSouce
.
createPixelMap
(
decodingOptions
,
(
err
,
pixelmap
)
=>
{
console
.
info
(
'
add_053 0014
'
+
pixelmap
);
expect
(
pixelmap
!=
undefined
).
assertTrue
();
done
();
})
}
else
{
expect
(
false
).
assertTrue
();
done
();
}
}
catch
(
error
)
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
add_053 updateData failed
'
+
error
);
}
createIncrementalSourcePromise
(
done
,
'
add_053
'
,
'
noSourceOpts
'
)
})
/**
...
...
@@ -254,51 +308,45 @@ export default function addImage() {
* @tc.level : Level 1
*/
it
(
'
add_053-1
'
,
0
,
async
function
(
done
)
{
try
{
let
testimagebuffer
=
testPng
;
console
.
info
(
'
add_053-1 0001
'
+
testimagebuffer
.
length
);
let
bufferSize
=
5000
;
let
offset
=
0
;
const
incSouce
=
image
.
createIncrementalSource
(
new
ArrayBuffer
(
1
));
let
ret
;
let
isFinished
=
false
;
while
(
offset
<
testimagebuffer
.
length
)
{
var
oneStep
=
testimagebuffer
.
slice
(
offset
,
offset
+
bufferSize
);
console
.
info
(
'
add_053-1 0002
'
+
oneStep
.
length
);
if
(
oneStep
.
length
<
bufferSize
)
{
isFinished
=
true
;
}
ret
=
await
new
Promise
(
res
=>
{
incSouce
.
updateData
(
oneStep
,
isFinished
,
0
,
oneStep
.
length
,
(
err
,
ret
)
=>
{
res
(
ret
);
})
})
if
(
!
ret
)
{
console
.
info
(
'
add_053-1 updateData failed
'
);
expect
(
ret
).
assertTrue
();
break
;
}
offset
=
offset
+
oneStep
.
length
;
console
.
info
(
'
add_053-1 0003
'
+
offset
);
}
if
(
ret
)
{
console
.
info
(
'
add_053-1 updateData success
'
);
let
decodingOptions
=
{
sampleSize
:
1
};
incSouce
.
createPixelMap
(
decodingOptions
,
(
err
,
pixelmap
)
=>
{
console
.
info
(
'
add_053-1 0004
'
+
pixelmap
);
expect
(
pixelmap
!=
undefined
).
assertTrue
();
done
();
})
}
else
{
expect
(
false
).
assertTrue
();
done
();
}
}
catch
(
error
)
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
add_053-1 updateData failed
'
+
error
);
}
createIncrementalSourceCb
(
done
,
'
add_053-1
'
,
'
noSourceOpts
'
)
})
/**
* @tc.number : add_054
* @tc.name : createIncrementalSource-updateData-png-promise
* @tc.desc : 1.create imagesource
* 2.update data
* 3.create pixelmap
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
add_054
'
,
0
,
async
function
(
done
)
{
let
opts
=
{
sourceDensity
:
240
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
};
createIncrementalSourcePromise
(
done
,
'
add_054
'
,
'
sourceOpts
'
,
opts
)
})
/**
* @tc.number : add_055
* @tc.name : createIncrementalSource-updateData-png-callback
* @tc.desc : 1.create imagesource
* 2.update data
* 3.create pixelmap
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
add_055
'
,
0
,
async
function
(
done
)
{
let
opts
=
{
sourceDensity
:
240
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
};
createIncrementalSourceCb
(
done
,
'
add_055
'
,
'
sourceOpts
'
,
opts
)
})
})
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录