Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
8d0569bb
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看板
未验证
提交
8d0569bb
编写于
11月 16, 2022
作者:
O
openharmony_ci
提交者:
Gitee
11月 16, 2022
浏览文件
操作
浏览文件
下载
差异文件
!5875 image用例写法优化
Merge pull request !5875 from 秦莉文/master
上级
90cd996a
17df7ff1
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
82 addition
and
14 deletion
+82
-14
multimedia/image/image_js_standard/image/src/main/js/test/image.test.js
...ge/image_js_standard/image/src/main/js/test/image.test.js
+82
-14
未找到文件。
multimedia/image/image_js_standard/image/src/main/js/test/image.test.js
浏览文件 @
8d0569bb
...
...
@@ -107,6 +107,12 @@ export default function imageJsTest() {
const
Color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
false
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
Color
,
opts
,
(
err
,
pixelmap
)
=>
{
if
(
err
)
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0500 err
'
+
err
);
done
();
return
}
globalpixelmap
=
pixelmap
;
expect
(
pixelmap
!=
undefined
).
assertTrue
();
console
.
info
(
'
SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0500 success
'
);
...
...
@@ -157,11 +163,16 @@ export default function imageJsTest() {
const
Color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
false
,
pixelFormat
:
2
,
size
:
{
height
:
6
,
width
:
8
}
}
image
.
createPixelMap
(
Color
,
opts
,
(
err
,
pixelmap
)
=>
{
if
(
err
)
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0600 err
'
+
err
);
done
();
return
}
globalpixelmap
=
pixelmap
;
expect
(
pixelmap
!=
undefined
).
assertTrue
();
console
.
info
(
'
SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0600 success
'
);
done
();
})
})
...
...
@@ -208,6 +219,12 @@ export default function imageJsTest() {
const
Color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
false
,
pixelFormat
:
0
,
size
:
{
height
:
6
,
width
:
8
}
}
image
.
createPixelMap
(
Color
,
opts
,
(
err
,
pixelmap
)
=>
{
if
(
err
)
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0700 err
'
+
err
);
done
();
return
}
globalpixelmap
=
pixelmap
;
expect
(
pixelmap
!=
undefined
).
assertTrue
();
console
.
info
(
'
SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0700 success
'
);
...
...
@@ -230,6 +247,12 @@ export default function imageJsTest() {
const
Color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
6
,
width
:
8
}
}
image
.
createPixelMap
(
Color
,
opts
,
(
err
,
pixelmap
)
=>
{
if
(
err
)
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0800 err
'
+
err
);
done
();
return
}
globalpixelmap
=
pixelmap
;
expect
(
pixelmap
!=
undefined
).
assertTrue
();
console
.
info
(
'
SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0800 success
'
);
...
...
@@ -252,6 +275,12 @@ export default function imageJsTest() {
const
Color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
2
,
size
:
{
height
:
2
,
width
:
3
}
}
image
.
createPixelMap
(
Color
,
opts
,
(
err
,
pixelmap
)
=>
{
if
(
err
)
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0900 err
'
+
err
);
done
();
return
}
globalpixelmap
=
pixelmap
;
expect
(
pixelmap
!=
undefined
).
assertTrue
();
console
.
info
(
'
SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0900 success
'
);
...
...
@@ -274,9 +303,15 @@ export default function imageJsTest() {
const
Color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
0
,
size
:
{
height
:
-
1
,
width
:
-
1
}
}
image
.
createPixelMap
(
Color
,
opts
,
(
err
,
pixelmap
)
=>
{
if
(
err
)
{
expect
(
true
).
assertTrue
();
console
.
info
(
'
SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_1000 success
'
+
err
);
done
();
return
}
globalpixelmap
=
pixelmap
;
expect
(
pixelmap
==
undefined
).
assertTrue
();
console
.
info
(
'
SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_1000
success
'
);
expect
(
false
).
assertTrue
();
console
.
info
(
'
SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_1000
fail
'
);
done
();
})
})
...
...
@@ -296,6 +331,12 @@ export default function imageJsTest() {
const
Color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
21
,
size
:
{
height
:
6
,
width
:
8
}
}
image
.
createPixelMap
(
Color
,
opts
,
(
err
,
pixelmap
)
=>
{
if
(
err
)
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_1100 err
'
+
err
);
done
();
return
}
globalpixelmap
=
pixelmap
;
expect
(
pixelmap
!=
undefined
).
assertTrue
();
console
.
info
(
'
SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_1100 success
'
);
...
...
@@ -1230,10 +1271,9 @@ export default function imageJsTest() {
it
(
'
SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_URI_0100
'
,
0
,
async
function
(
done
)
{
try
{
await
getFd
(
'
test.jpg
'
);
const
imageSourceApi
=
image
.
createImageSource
(
f
dNumber
);
const
imageSourceApi
=
image
.
createImageSource
(
f
ilePath
);
expect
(
imageSourceApi
!=
undefined
).
assertTrue
();
console
.
info
(
'
SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_URI_0100 success
'
);
fileio
.
closeSync
(
fdNumber
);
done
();
}
catch
(
error
)
{
console
.
info
(
'
SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_URI_0100 error:
'
+
error
);
...
...
@@ -1255,7 +1295,7 @@ export default function imageJsTest() {
it
(
'
SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_URI_0200
'
,
0
,
async
function
(
done
)
{
try
{
await
getFd
(
'
test.bmp
'
);
const
imageSourceApi
=
image
.
createImageSource
(
f
dNumber
);
const
imageSourceApi
=
image
.
createImageSource
(
f
ilePath
);
expect
(
imageSourceApi
!=
undefined
).
assertTrue
();
console
.
info
(
'
SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_UR_0200 success
'
);
done
();
...
...
@@ -1279,7 +1319,7 @@ export default function imageJsTest() {
it
(
'
SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_URI_0300
'
,
0
,
async
function
(
done
)
{
try
{
await
getFd
(
'
test.gif
'
);
const
imageSourceApi
=
image
.
createImageSource
(
f
dNumber
);
const
imageSourceApi
=
image
.
createImageSource
(
f
ilePath
);
expect
(
imageSourceApi
!=
undefined
).
assertTrue
();
console
.
info
(
'
SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_URI_0300 success
'
);
done
();
...
...
@@ -1304,7 +1344,7 @@ export default function imageJsTest() {
it
(
'
SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_URI_0400
'
,
0
,
async
function
(
done
)
{
try
{
await
getFd
(
'
test.png
'
);
const
imageSourceApi
=
image
.
createImageSource
(
f
dNumber
);
const
imageSourceApi
=
image
.
createImageSource
(
f
ilePath
);
expect
(
imageSourceApi
!=
undefined
).
assertTrue
();
console
.
info
(
'
SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_URI_0400 success
'
);
done
();
...
...
@@ -1318,7 +1358,7 @@ export default function imageJsTest() {
/**
* @tc.number : SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_URI_ERROR_SUFFIXFILE_0100
* @tc.name : createImageSource(uri)-wrong suffix file
* @tc.name : createImageSource(uri)-
image with
wrong suffix file
* @tc.desc : 1.call createImageSource(uri)
* 2.Incoming wrong suffix file
* 3.imagesource null
...
...
@@ -1327,10 +1367,32 @@ export default function imageJsTest() {
* @tc.level : Level 0
*/
it
(
'
SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_URI_ERROR_SUFFIXFILE_0100
'
,
0
,
async
function
(
done
)
{
const
imageSourceApi
=
image
.
createImageSource
(
'
file:///data/local/tmp/test.123
'
);
expect
(
imageSourceApi
==
undefined
).
assertTrue
();
try
{
await
getFd
(
'
test.123
'
);
let
imageSourceApi
=
image
.
createImageSource
(
filePath
);
if
(
imageSourceApi
==
undefined
)
{
console
.
info
(
'
SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_URI_ERROR_SUFFIXFILE_0100 create image source failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
imageSourceApi
.
createPixelMap
((
err
,
pixelmap
)
=>
{
if
(
err
){
console
.
info
(
'
SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_URI_ERROR_SUFFIXFILE_0100 create pixelmap failed:
'
+
err
);
expect
(
false
).
assertTrue
();
done
();
return
}
globalpixelmap
=
pixelmap
;
console
.
info
(
'
SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_URI_ERROR_SUFFIXFILE_0100 success
'
);
expect
(
pixelmap
!=
undefined
).
assertTrue
();
done
();
})
}
}
catch
(
error
)
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_URI_ERROR_SUFFIXFILE_0100 err:
'
+
error
);
done
();
}
})
/**
...
...
@@ -2197,6 +2259,12 @@ export default function imageJsTest() {
done
();
}
else
{
imageSourceApi
.
createPixelMap
((
err
,
pixelmap
)
=>
{
if
(
err
){
console
.
info
(
'
SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_JPG_0100 err:
'
+
err
);
expect
(
false
).
assertTrue
();
done
();
return
}
globalpixelmap
=
pixelmap
;
console
.
info
(
'
SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_JPG_0100 success
'
);
expect
(
pixelmap
!=
undefined
).
assertTrue
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录