Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
1e285b60
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看板
未验证
提交
1e285b60
编写于
9月 09, 2022
作者:
O
openharmony_ci
提交者:
Gitee
9月 09, 2022
浏览文件
操作
浏览文件
下载
差异文件
!5416 modify webp getfd
Merge pull request !5416 from caochuan/image/raw
上级
735270b2
ba50f67c
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
992 addition
and
987 deletion
+992
-987
multimedia/image/image_js_standard/imageWebp/src/main/js/test/webp.test.js
...image_js_standard/imageWebp/src/main/js/test/webp.test.js
+992
-987
未找到文件。
multimedia/image/image_js_standard/imageWebp/src/main/js/test/webp.test.js
浏览文件 @
1e285b60
...
...
@@ -13,55 +13,41 @@
* limitations under the License.
*/
import
image
from
'
@ohos.multimedia.image
'
import
fileio
from
'
@ohos.fileio
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
import
featureAbility
from
'
@ohos.ability.featureAbility
'
import
image
from
"
@ohos.multimedia.image
"
;
import
fileio
from
"
@ohos.fileio
"
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
"
@ohos/hypium
"
;
import
featureAbility
from
"
@ohos.ability.featureAbility
"
;
export
default
function
imageWebp
()
{
describe
(
'
imageWebp
'
,
function
()
{
describe
(
"
imageWebp
"
,
function
()
{
let
filePath
;
let
fdNumber
;
async
function
getFd
(
fileName
)
{
let
context
=
await
featureAbility
.
getContext
();
await
context
.
getFilesDir
().
then
((
data
)
=>
{
filePath
=
data
+
'
/
'
+
fileName
;
console
.
info
(
'
image case filePath is
'
+
filePath
);
})
await
fileio
.
open
(
filePath
).
then
((
data
)
=>
{
fdNumber
=
data
;
console
.
info
(
"
image case open fd success
"
+
fdNumber
);
},
(
err
)
=>
{
console
.
info
(
"
image cese open fd fail
"
+
err
)
}).
catch
((
err
)
=>
{
console
.
info
(
"
image case open fd err
"
+
err
);
})
filePath
=
data
+
"
/
"
+
fileName
;
console
.
info
(
"
image case filePath is
"
+
filePath
);
});
}
beforeAll
(
async
function
()
{
console
.
info
(
'
beforeAll case
'
);
})
console
.
info
(
"
beforeAll case
"
);
});
beforeEach
(
function
()
{
console
.
info
(
'
beforeEach case
'
);
})
console
.
info
(
"
beforeEach case
"
);
});
afterEach
(
async
function
()
{
await
fileio
.
close
(
fdNumber
).
then
(
function
(){
console
.
info
(
"
close file succeed
"
);
}).
catch
(
function
(
err
){
console
.
info
(
"
close file failed with error:
"
+
err
);
console
.
info
(
"
afterEach case
"
);
});
console
.
info
(
'
afterEach case
'
);
})
afterAll
(
async
function
()
{
console
.
info
(
'
afterAll case
'
);
})
console
.
info
(
"
afterAll case
"
);
});
async
function
createPixMapCbErr
(
done
,
testNum
,
arg
)
{
await
getFd
(
'
test_large.webp
'
);
const
imageSourceApi
=
image
.
createImageSource
(
fdNumber
);
await
getFd
(
"
test_large.webp
"
);
let
imageSourceApi
=
image
.
createImageSource
(
filePath
);
if
(
imageSourceApi
==
undefined
)
{
console
.
info
(
`
${
testNum
}
create image source failed`
);
expect
(
false
).
assertTrue
();
...
...
@@ -76,14 +62,13 @@ describe('imageWebp', function () {
expect
(
false
).
assertTrue
();
done
();
}
})
});
}
}
async
function
createPixMapCb
(
done
,
testNum
,
arg
)
{
await
getFd
(
'
test_large.webp
'
);
const
imageSourceApi
=
image
.
createImageSource
(
fdNumber
);
await
getFd
(
"
test_large.webp
"
);
let
imageSourceApi
=
image
.
createImageSource
(
filePath
);
if
(
imageSourceApi
==
undefined
)
{
console
.
info
(
`
${
testNum
}
create image source failed`
);
expect
(
false
).
assertTrue
();
...
...
@@ -91,79 +76,95 @@ describe('imageWebp', function () {
}
else
{
imageSourceApi
.
createPixelMap
(
arg
,
(
err
,
pixelmap
)
=>
{
if
(
err
)
{
console
.
info
(
`
${
testNum
}
- fail
`
);
console
.
info
(
`
${
testNum
}
- fail
${
err
}
`
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
pixelmap
.
getImageInfo
().
then
((
imageInfo
)
=>
{
pixelmap
.
getImageInfo
()
.
then
((
imageInfo
)
=>
{
expect
(
imageInfo
.
size
.
height
==
2
).
assertTrue
();
expect
(
imageInfo
.
size
.
width
==
1
).
assertTrue
();
console
.
info
(
`
${
testNum
}
- success `
);
console
.
info
(
"
imageInfo height :
"
+
imageInfo
.
size
.
height
+
"
width :
"
+
imageInfo
.
size
.
width
);
console
.
info
(
"
imageInfo height :
"
+
imageInfo
.
size
.
height
+
"
width :
"
+
imageInfo
.
size
.
width
);
done
();
}).
catch
((
err
)
=>
{
console
.
info
(
`
${
testNum
}
getimageInfo err `
+
JSON
.
stringify
(
err
));
})
.
catch
((
err
)
=>
{
console
.
info
(
`
${
testNum
}
getimageInfo err `
+
JSON
.
stringify
(
err
));
});
}
})
});
}
}
async
function
createPixMapPromiseErr
(
done
,
testNum
,
arg
)
{
await
getFd
(
'
test_large.webp
'
);
const
imageSourceApi
=
image
.
createImageSource
(
fdNumber
);
await
getFd
(
"
test_large.webp
"
);
let
imageSourceApi
=
image
.
createImageSource
(
filePath
);
if
(
imageSourceApi
==
undefined
)
{
console
.
info
(
`
${
testNum
}
create image source failed`
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
imageSourceApi
.
createPixelMap
(
arg
).
then
(
pixelmap
=>
{
imageSourceApi
.
createPixelMap
(
arg
)
.
then
((
pixelmap
)
=>
{
console
.
log
(
`
${
testNum
}
failed`
);
expect
().
assertFail
();
done
();
}).
catch
(
error
=>
{
})
.
catch
((
error
)
=>
{
console
.
log
(
`
${
testNum
}
success `
);
expect
(
true
).
assertTrue
();
done
();
})
});
}
}
async
function
createPixMapPromise
(
done
,
testNum
,
arg
)
{
await
getFd
(
'
test_large.webp
'
);
const
imageSourceApi
=
image
.
createImageSource
(
fdNumber
);
await
getFd
(
"
test_large.webp
"
);
let
imageSourceApi
=
image
.
createImageSource
(
filePath
);
if
(
imageSourceApi
==
undefined
)
{
console
.
info
(
`
${
testNum
}
create image source failed`
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
imageSourceApi
.
createPixelMap
(
arg
).
then
(
pixelmap
=>
{
pixelmap
.
getImageInfo
().
then
((
imageInfo
)
=>
{
imageSourceApi
.
createPixelMap
(
arg
)
.
then
((
pixelmap
)
=>
{
pixelmap
.
getImageInfo
()
.
then
((
imageInfo
)
=>
{
expect
(
imageInfo
.
size
.
height
==
2
).
assertTrue
();
expect
(
imageInfo
.
size
.
width
==
1
).
assertTrue
();
console
.
info
(
`
${
testNum
}
- success `
);
console
.
info
(
"
imageInfo height :
"
+
imageInfo
.
size
.
height
+
"
width :
"
+
imageInfo
.
size
.
width
);
console
.
info
(
"
imageInfo height :
"
+
imageInfo
.
size
.
height
+
"
width :
"
+
imageInfo
.
size
.
width
);
done
();
}).
catch
((
err
)
=>
{
})
.
catch
((
err
)
=>
{
console
.
info
(
`
${
testNum
}
getimageInfo err `
+
JSON
.
stringify
(
err
));
});
})
}).
catch
(
error
=>
{
.
catch
((
error
)
=>
{
console
.
log
(
`
${
testNum
}
fail `
);
expect
(
flase
).
assertTrue
();
done
();
})
});
}
}
async
function
packingPromise
(
done
,
testNum
,
arg
)
{
console
.
info
(
`
${
testNum
}
enter`
);
var
height
=
4
var
width
=
6
var
pixelSize
=
4
var
widthSize
=
width
*
pixelSize
var
bufferSize
=
height
*
widthSize
var
height
=
4
;
var
width
=
6
;
var
pixelSize
=
4
;
var
widthSize
=
width
*
pixelSize
;
var
bufferSize
=
height
*
widthSize
;
const
color
=
new
ArrayBuffer
(
bufferSize
);
var
colorArr
=
new
Uint8Array
(
color
);
for
(
var
h
=
0
;
h
<
height
/
2
;
h
++
)
{
for
(
var
w
=
0
;
w
<
width
/
2
;
w
++
)
{
var
pos
=
widthSize
*
h
+
pixelSize
*
w
var
pos
=
widthSize
*
h
+
pixelSize
*
w
;
colorArr
[
pos
+
0
]
=
255
;
// r
colorArr
[
pos
+
1
]
=
0
;
colorArr
[
pos
+
2
]
=
0
;
...
...
@@ -172,7 +173,7 @@ describe('imageWebp', function () {
}
for
(
var
h
=
0
;
h
<
height
/
2
;
h
++
)
{
for
(
var
w
=
width
/
2
;
w
<
width
;
w
++
)
{
var
pos
=
widthSize
*
h
+
pixelSize
*
w
var
pos
=
widthSize
*
h
+
pixelSize
*
w
;
colorArr
[
pos
+
0
]
=
0
;
colorArr
[
pos
+
1
]
=
255
;
// g
colorArr
[
pos
+
2
]
=
0
;
...
...
@@ -181,7 +182,7 @@ describe('imageWebp', function () {
}
for
(
var
h
=
height
/
2
;
h
<
height
;
h
++
)
{
for
(
var
w
=
0
;
w
<
width
/
2
;
w
++
)
{
var
pos
=
widthSize
*
h
+
pixelSize
*
w
var
pos
=
widthSize
*
h
+
pixelSize
*
w
;
colorArr
[
pos
+
0
]
=
0
;
colorArr
[
pos
+
1
]
=
0
;
colorArr
[
pos
+
2
]
=
255
;
// b
...
...
@@ -190,7 +191,7 @@ describe('imageWebp', function () {
}
for
(
var
h
=
height
/
2
;
h
<
height
;
h
++
)
{
for
(
var
w
=
width
/
2
;
w
<
width
;
w
++
)
{
var
pos
=
widthSize
*
h
+
pixelSize
*
w
var
pos
=
widthSize
*
h
+
pixelSize
*
w
;
colorArr
[
pos
+
0
]
=
0
;
colorArr
[
pos
+
1
]
=
0
;
colorArr
[
pos
+
2
]
=
0
;
...
...
@@ -198,12 +199,11 @@ describe('imageWebp', function () {
}
}
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
)
.
then
(
pixelmap
=>
{
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
};
image
.
createPixelMap
(
color
,
opts
).
then
((
pixelmap
)
=>
{
if
(
pixelmap
==
undefined
)
{
console
.
info
(
'
${testNum} create pixelmap failed
'
);
expect
(
false
).
assertTrue
()
console
.
info
(
"
${testNum} create pixelmap failed
"
);
expect
(
false
).
assertTrue
()
;
done
();
}
else
{
const
imagePackerApi
=
image
.
createImagePacker
();
...
...
@@ -212,8 +212,9 @@ describe('imageWebp', function () {
expect
(
false
).
assertTrue
();
done
();
}
else
{
imagePackerApi
.
packing
(
pixelmap
,
arg
)
.
then
(
data
=>
{
imagePackerApi
.
packing
(
pixelmap
,
arg
)
.
then
((
data
)
=>
{
console
.
info
(
`
${
testNum
}
success`
);
expect
(
data
!=
undefined
).
assertTrue
();
var
dataArr
=
new
Uint8Array
(
data
);
...
...
@@ -222,29 +223,30 @@ describe('imageWebp', function () {
console
.
info
(
`dataArr[`
+
i
+
`]=`
+
dataArr
[
i
]);
}
done
();
}).
catch
(
error
=>
{
})
.
catch
((
error
)
=>
{
console
.
log
(
`
${
testNum
}
error: `
+
error
);
expect
(
false
).
assertFail
();
done
();
})
})
;
}
}
})
})
;
console
.
info
(
`
${
testNum
}
leave`
);
}
async
function
packingCb
(
done
,
testNum
,
arg
)
{
console
.
info
(
`
${
testNum
}
enter`
);
var
height
=
4
var
width
=
6
var
pixelSize
=
4
var
widthSize
=
width
*
pixelSize
var
bufferSize
=
height
*
widthSize
var
height
=
4
;
var
width
=
6
;
var
pixelSize
=
4
;
var
widthSize
=
width
*
pixelSize
;
var
bufferSize
=
height
*
widthSize
;
const
color
=
new
ArrayBuffer
(
bufferSize
);
var
colorArr
=
new
Uint8Array
(
color
);
for
(
var
h
=
0
;
h
<
height
/
2
;
h
++
)
{
for
(
var
w
=
0
;
w
<
width
/
2
;
w
++
)
{
var
pos
=
widthSize
*
h
+
pixelSize
*
w
var
pos
=
widthSize
*
h
+
pixelSize
*
w
;
colorArr
[
pos
+
0
]
=
255
;
// r
colorArr
[
pos
+
1
]
=
0
;
colorArr
[
pos
+
2
]
=
0
;
...
...
@@ -253,7 +255,7 @@ describe('imageWebp', function () {
}
for
(
var
h
=
0
;
h
<
height
/
2
;
h
++
)
{
for
(
var
w
=
width
/
2
;
w
<
width
;
w
++
)
{
var
pos
=
widthSize
*
h
+
pixelSize
*
w
var
pos
=
widthSize
*
h
+
pixelSize
*
w
;
colorArr
[
pos
+
0
]
=
0
;
colorArr
[
pos
+
1
]
=
255
;
// g
colorArr
[
pos
+
2
]
=
0
;
...
...
@@ -262,7 +264,7 @@ describe('imageWebp', function () {
}
for
(
var
h
=
height
/
2
;
h
<
height
;
h
++
)
{
for
(
var
w
=
0
;
w
<
width
/
2
;
w
++
)
{
var
pos
=
widthSize
*
h
+
pixelSize
*
w
var
pos
=
widthSize
*
h
+
pixelSize
*
w
;
colorArr
[
pos
+
0
]
=
0
;
colorArr
[
pos
+
1
]
=
0
;
colorArr
[
pos
+
2
]
=
255
;
// b
...
...
@@ -271,7 +273,7 @@ describe('imageWebp', function () {
}
for
(
var
h
=
height
/
2
;
h
<
height
;
h
++
)
{
for
(
var
w
=
width
/
2
;
w
<
width
;
w
++
)
{
var
pos
=
widthSize
*
h
+
pixelSize
*
w
var
pos
=
widthSize
*
h
+
pixelSize
*
w
;
colorArr
[
pos
+
0
]
=
0
;
colorArr
[
pos
+
1
]
=
0
;
colorArr
[
pos
+
2
]
=
0
;
...
...
@@ -279,12 +281,13 @@ describe('imageWebp', function () {
}
}
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
)
.
then
(
pixelmap
=>
{
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
};
image
.
createPixelMap
(
color
,
opts
)
.
then
((
pixelmap
)
=>
{
if
(
pixelmap
==
undefined
)
{
console
.
info
(
'
${testNum} create pixelmap failed
'
);
expect
(
false
).
assertTrue
()
console
.
info
(
"
${testNum} create pixelmap failed
"
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
const
imagePackerApi
=
image
.
createImagePacker
();
...
...
@@ -302,29 +305,30 @@ describe('imageWebp', function () {
console
.
info
(
`dataArr[`
+
i
+
`]=`
+
dataArr
[
i
]);
}
done
();
})
});
}
}
}).
catch
(
error
=>
{
})
.
catch
((
error
)
=>
{
console
.
log
(
`
${
testNum
}
error: `
+
error
);
expect
(
false
).
assertFail
();
done
();
})
});
console
.
info
(
`
${
testNum
}
leave`
);
}
async
function
packingPromiseErr
(
done
,
testNum
,
arg
)
{
console
.
info
(
`
${
testNum
}
enter`
);
var
height
=
4
var
width
=
6
var
pixelSize
=
4
var
widthSize
=
width
*
pixelSize
var
bufferSize
=
height
*
widthSize
var
height
=
4
;
var
width
=
6
;
var
pixelSize
=
4
;
var
widthSize
=
width
*
pixelSize
;
var
bufferSize
=
height
*
widthSize
;
const
color
=
new
ArrayBuffer
(
bufferSize
);
var
colorArr
=
new
Uint8Array
(
color
);
for
(
var
h
=
0
;
h
<
height
/
2
;
h
++
)
{
for
(
var
w
=
0
;
w
<
width
/
2
;
w
++
)
{
var
pos
=
widthSize
*
h
+
pixelSize
*
w
var
pos
=
widthSize
*
h
+
pixelSize
*
w
;
colorArr
[
pos
+
0
]
=
255
;
// r
colorArr
[
pos
+
1
]
=
0
;
colorArr
[
pos
+
2
]
=
0
;
...
...
@@ -333,7 +337,7 @@ describe('imageWebp', function () {
}
for
(
var
h
=
0
;
h
<
height
/
2
;
h
++
)
{
for
(
var
w
=
width
/
2
;
w
<
width
;
w
++
)
{
var
pos
=
widthSize
*
h
+
pixelSize
*
w
var
pos
=
widthSize
*
h
+
pixelSize
*
w
;
colorArr
[
pos
+
0
]
=
0
;
colorArr
[
pos
+
1
]
=
255
;
// g
colorArr
[
pos
+
2
]
=
0
;
...
...
@@ -342,7 +346,7 @@ describe('imageWebp', function () {
}
for
(
var
h
=
height
/
2
;
h
<
height
;
h
++
)
{
for
(
var
w
=
0
;
w
<
width
/
2
;
w
++
)
{
var
pos
=
widthSize
*
h
+
pixelSize
*
w
var
pos
=
widthSize
*
h
+
pixelSize
*
w
;
colorArr
[
pos
+
0
]
=
0
;
colorArr
[
pos
+
1
]
=
0
;
colorArr
[
pos
+
2
]
=
255
;
// b
...
...
@@ -351,7 +355,7 @@ describe('imageWebp', function () {
}
for
(
var
h
=
height
/
2
;
h
<
height
;
h
++
)
{
for
(
var
w
=
width
/
2
;
w
<
width
;
w
++
)
{
var
pos
=
widthSize
*
h
+
pixelSize
*
w
var
pos
=
widthSize
*
h
+
pixelSize
*
w
;
colorArr
[
pos
+
0
]
=
0
;
colorArr
[
pos
+
1
]
=
0
;
colorArr
[
pos
+
2
]
=
0
;
...
...
@@ -359,12 +363,11 @@ describe('imageWebp', function () {
}
}
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
)
.
then
(
pixelmap
=>
{
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
};
image
.
createPixelMap
(
color
,
opts
).
then
((
pixelmap
)
=>
{
if
(
pixelmap
==
undefined
)
{
console
.
info
(
'
${testNum} create pixelmap failed
'
);
expect
(
false
).
assertTrue
()
console
.
info
(
"
${testNum} create pixelmap failed
"
);
expect
(
false
).
assertTrue
()
;
done
();
}
else
{
const
imagePackerApi
=
image
.
createImagePacker
();
...
...
@@ -373,33 +376,35 @@ describe('imageWebp', function () {
expect
(
false
).
assertTrue
();
done
();
}
else
{
imagePackerApi
.
packing
(
pixelmap
,
arg
)
.
then
(
data
=>
{
imagePackerApi
.
packing
(
pixelmap
,
arg
)
.
then
((
data
)
=>
{
expect
(
data
==
undefined
).
assertTrue
();
done
();
}).
catch
(
error
=>
{
})
.
catch
((
error
)
=>
{
console
.
log
(
`
${
testNum
}
error: `
+
error
);
expect
(
true
).
assertTrue
();
done
();
})
})
;
}
}
})
})
;
console
.
info
(
`
${
testNum
}
leave`
);
}
async
function
packingCbErr
(
done
,
testNum
,
arg
)
{
console
.
info
(
`
${
testNum
}
enter`
);
var
height
=
4
var
width
=
6
var
pixelSize
=
4
var
widthSize
=
width
*
pixelSize
var
bufferSize
=
height
*
widthSize
var
height
=
4
;
var
width
=
6
;
var
pixelSize
=
4
;
var
widthSize
=
width
*
pixelSize
;
var
bufferSize
=
height
*
widthSize
;
const
color
=
new
ArrayBuffer
(
bufferSize
);
var
colorArr
=
new
Uint8Array
(
color
);
for
(
var
h
=
0
;
h
<
height
/
2
;
h
++
)
{
for
(
var
w
=
0
;
w
<
width
/
2
;
w
++
)
{
var
pos
=
widthSize
*
h
+
pixelSize
*
w
var
pos
=
widthSize
*
h
+
pixelSize
*
w
;
colorArr
[
pos
+
0
]
=
255
;
// r
colorArr
[
pos
+
1
]
=
0
;
colorArr
[
pos
+
2
]
=
0
;
...
...
@@ -408,7 +413,7 @@ describe('imageWebp', function () {
}
for
(
var
h
=
0
;
h
<
height
/
2
;
h
++
)
{
for
(
var
w
=
width
/
2
;
w
<
width
;
w
++
)
{
var
pos
=
widthSize
*
h
+
pixelSize
*
w
var
pos
=
widthSize
*
h
+
pixelSize
*
w
;
colorArr
[
pos
+
0
]
=
0
;
colorArr
[
pos
+
1
]
=
255
;
// g
colorArr
[
pos
+
2
]
=
0
;
...
...
@@ -417,7 +422,7 @@ describe('imageWebp', function () {
}
for
(
var
h
=
height
/
2
;
h
<
height
;
h
++
)
{
for
(
var
w
=
0
;
w
<
width
/
2
;
w
++
)
{
var
pos
=
widthSize
*
h
+
pixelSize
*
w
var
pos
=
widthSize
*
h
+
pixelSize
*
w
;
colorArr
[
pos
+
0
]
=
0
;
colorArr
[
pos
+
1
]
=
0
;
colorArr
[
pos
+
2
]
=
255
;
// b
...
...
@@ -426,7 +431,7 @@ describe('imageWebp', function () {
}
for
(
var
h
=
height
/
2
;
h
<
height
;
h
++
)
{
for
(
var
w
=
width
/
2
;
w
<
width
;
w
++
)
{
var
pos
=
widthSize
*
h
+
pixelSize
*
w
var
pos
=
widthSize
*
h
+
pixelSize
*
w
;
colorArr
[
pos
+
0
]
=
0
;
colorArr
[
pos
+
1
]
=
0
;
colorArr
[
pos
+
2
]
=
0
;
...
...
@@ -434,12 +439,13 @@ describe('imageWebp', function () {
}
}
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
)
.
then
(
pixelmap
=>
{
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
};
image
.
createPixelMap
(
color
,
opts
)
.
then
((
pixelmap
)
=>
{
if
(
pixelmap
==
undefined
)
{
console
.
info
(
'
${testNum} create pixelmap failed
'
);
expect
(
false
).
assertTrue
()
console
.
info
(
"
${testNum} create pixelmap failed
"
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
const
imagePackerApi
=
image
.
createImagePacker
();
...
...
@@ -452,14 +458,15 @@ describe('imageWebp', function () {
console
.
info
(
`
${
testNum
}
success`
);
expect
(
data
==
undefined
).
assertTrue
();
done
();
})
});
}
}
}).
catch
(
error
=>
{
})
.
catch
((
error
)
=>
{
console
.
log
(
`
${
testNum
}
error: `
+
error
);
expect
(
true
).
assertTrue
();
done
();
})
});
console
.
info
(
`
${
testNum
}
leave`
);
}
...
...
@@ -474,12 +481,12 @@ describe('imageWebp', function () {
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0100
'
,
0
,
async
function
(
done
)
{
it
(
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0100
"
,
0
,
async
function
(
done
)
{
try
{
await
getFd
(
'
test_large.webp
'
);
const
imageSourceApi
=
image
.
createImageSource
(
fdNumber
);
await
getFd
(
"
test_large.webp
"
);
let
imageSourceApi
=
image
.
createImageSource
(
filePath
);
if
(
imageSourceApi
==
undefined
)
{
console
.
info
(
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0100 create image source failed
'
);
console
.
info
(
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0100 create image source failed
"
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
...
...
@@ -490,27 +497,26 @@ describe('imageWebp', function () {
rotate
:
10
,
desiredPixelFormat
:
2
,
desiredRegion
:
{
size
:
{
height
:
1
,
width
:
2
},
x
:
0
,
y
:
0
},
index
:
0
index
:
0
,
};
imageSourceApi
.
createPixelMap
(
decodingOptions
).
then
(
pixelmap
=>
{
imageSourceApi
.
createPixelMap
(
decodingOptions
).
then
((
pixelmap
)
=>
{
if
(
pixelmap
!=
undefined
)
{
expect
(
true
).
assertTrue
();
console
.
info
(
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0100 success
'
);
console
.
info
(
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0100 success
"
);
done
();
}
else
{
expect
(
false
).
assertTrue
();
done
();
}
})
});
}
}
catch
(
error
)
{
console
.
info
(
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0100 error:
'
+
error
);
console
.
info
(
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0100 error:
"
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
})
});
/**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0100
...
...
@@ -523,12 +529,12 @@ describe('imageWebp', function () {
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0100
'
,
0
,
async
function
(
done
)
{
it
(
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0100
"
,
0
,
async
function
(
done
)
{
try
{
await
getFd
(
'
test_large.webp
'
);
const
imageSourceApi
=
image
.
createImageSource
(
fdNumber
);
await
getFd
(
"
test_large.webp
"
);
let
imageSourceApi
=
image
.
createImageSource
(
filePath
);
if
(
imageSourceApi
==
undefined
)
{
console
.
info
(
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0100 create image source failed
'
);
console
.
info
(
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0100 create image source failed
"
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
...
...
@@ -539,27 +545,26 @@ describe('imageWebp', function () {
rotate
:
10
,
desiredPixelFormat
:
2
,
desiredRegion
:
{
size
:
{
height
:
1
,
width
:
2
},
x
:
0
,
y
:
0
},
index
:
0
index
:
0
,
};
imageSourceApi
.
createPixelMap
(
decodingOptions
,
(
err
,
pixelmap
)
=>
{
if
(
pixelmap
!=
undefined
)
{
expect
(
true
).
assertTrue
();
console
.
info
(
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0100 success
'
);
console
.
info
(
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0100 success
"
);
done
();
}
else
{
expect
(
false
).
assertTrue
();
done
();
}
})
});
}
}
catch
(
error
)
{
console
.
info
(
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0100 error:
'
+
error
);
console
.
info
(
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0100 error:
"
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
})
});
/**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0200
...
...
@@ -572,30 +577,32 @@ describe('imageWebp', function () {
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0200
'
,
0
,
async
function
(
done
)
{
it
(
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0200
"
,
0
,
async
function
(
done
)
{
try
{
await
getFd
(
'
test_large.webp
'
);
const
imageSourceApi
=
image
.
createImageSource
(
fdNumber
);
await
getFd
(
"
test_large.webp
"
);
let
imageSourceApi
=
image
.
createImageSource
(
filePath
);
if
(
imageSourceApi
==
undefined
)
{
console
.
info
(
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0200 create image source failed
'
);
console
.
info
(
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0200 create image source failed
"
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
imageSourceApi
.
createPixelMap
().
then
(
pixelmap
=>
{
imageSourceApi
.
createPixelMap
()
.
then
((
pixelmap
)
=>
{
expect
(
pixelmap
!=
undefined
).
assertTrue
();
console
.
info
(
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0200 success
'
);
console
.
info
(
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0200 success
"
);
done
();
}).
catch
(
error
=>
{
console
.
log
(
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0200 error:
'
+
error
);
})
.
catch
((
error
)
=>
{
console
.
log
(
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0200 error:
"
+
error
);
expect
().
assertFail
();
done
();
})
});
}
}
catch
(
error
)
{
console
.
info
(
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0200 err
'
+
error
);
console
.
info
(
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0200 err
"
+
error
);
}
})
});
/**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0200
...
...
@@ -608,26 +615,25 @@ describe('imageWebp', function () {
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0200
'
,
0
,
async
function
(
done
)
{
it
(
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0200
"
,
0
,
async
function
(
done
)
{
try
{
await
getFd
(
'
test_large.webp
'
);
const
imageSourceApi
=
image
.
createImageSource
(
fdNumber
);
await
getFd
(
"
test_large.webp
"
);
let
imageSourceApi
=
image
.
createImageSource
(
filePath
);
if
(
imageSourceApi
==
undefined
)
{
console
.
info
(
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0200 create image source failed
'
);
console
.
info
(
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0200 create image source failed
"
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
imageSourceApi
.
createPixelMap
((
err
,
pixelmap
)
=>
{
expect
(
pixelmap
!=
undefined
).
assertTrue
();
console
.
info
(
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0200 success
'
);
console
.
info
(
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0200 success
"
);
done
();
})
});
}
}
catch
(
error
)
{
console
.
info
(
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0200 err
'
+
error
);
console
.
info
(
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0200 err
"
+
error
);
}
})
});
/**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0300
...
...
@@ -640,7 +646,7 @@ describe('imageWebp', function () {
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0300
'
,
0
,
async
function
(
done
)
{
it
(
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0300
"
,
0
,
async
function
(
done
)
{
let
decodingOptions
=
{
sampleSize
:
-
1
,
editable
:
true
,
...
...
@@ -648,10 +654,10 @@ describe('imageWebp', function () {
rotate
:
10
,
desiredPixelFormat
:
2
,
desiredRegion
:
{
size
:
{
height
:
1
,
width
:
2
},
x
:
0
,
y
:
0
},
index
:
0
index
:
0
,
};
createPixMapCbErr
(
done
,
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0300
'
,
decodingOptions
)
})
createPixMapCbErr
(
done
,
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0300
"
,
decodingOptions
);
});
/**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0400
...
...
@@ -664,7 +670,7 @@ describe('imageWebp', function () {
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0400
'
,
0
,
async
function
(
done
)
{
it
(
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0400
"
,
0
,
async
function
(
done
)
{
let
decodingOptions
=
{
sampleSize
:
1
,
editable
:
true
,
...
...
@@ -672,10 +678,10 @@ describe('imageWebp', function () {
rotate
:
10
,
desiredPixelFormat
:
0
,
desiredRegion
:
{
size
:
{
height
:
1
,
width
:
2
},
x
:
0
,
y
:
0
},
index
:
-
1
index
:
-
1
,
};
createPixMapCbErr
(
done
,
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0400
'
,
decodingOptions
)
})
createPixMapCbErr
(
done
,
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0400
"
,
decodingOptions
);
});
/**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0500
...
...
@@ -688,7 +694,7 @@ describe('imageWebp', function () {
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0500
'
,
0
,
async
function
(
done
)
{
it
(
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0500
"
,
0
,
async
function
(
done
)
{
let
decodingOptions
=
{
sampleSize
:
1
,
editable
:
true
,
...
...
@@ -696,10 +702,10 @@ describe('imageWebp', function () {
rotate
:
500
,
desiredPixelFormat
:
3
,
desiredRegion
:
{
size
:
{
height
:
1
,
width
:
2
},
x
:
0
,
y
:
0
},
index
:
0
index
:
0
,
};
createPixMapCbErr
(
done
,
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0500
'
,
decodingOptions
)
})
createPixMapCbErr
(
done
,
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0500
"
,
decodingOptions
);
});
/**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0600
...
...
@@ -712,7 +718,7 @@ describe('imageWebp', function () {
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0600
'
,
0
,
async
function
(
done
)
{
it
(
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0600
"
,
0
,
async
function
(
done
)
{
let
decodingOptions
=
{
sampleSize
:
1
,
editable
:
true
,
...
...
@@ -720,10 +726,10 @@ describe('imageWebp', function () {
rotate
:
-
10
,
desiredPixelFormat
:
3
,
desiredRegion
:
{
size
:
{
height
:
1
,
width
:
2
},
x
:
0
,
y
:
0
},
index
:
0
index
:
0
,
};
createPixMapCbErr
(
done
,
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0600
'
,
decodingOptions
)
})
createPixMapCbErr
(
done
,
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0600
"
,
decodingOptions
);
});
/**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0700
...
...
@@ -736,7 +742,7 @@ describe('imageWebp', function () {
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0700
'
,
0
,
async
function
(
done
)
{
it
(
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0700
"
,
0
,
async
function
(
done
)
{
let
decodingOptions
=
{
sampleSize
:
1
,
editable
:
false
,
...
...
@@ -744,10 +750,10 @@ describe('imageWebp', function () {
rotate
:
10
,
desiredPixelFormat
:
33
,
desiredRegion
:
{
size
:
{
height
:
1
,
width
:
2
},
x
:
0
,
y
:
0
},
index
:
0
index
:
0
,
};
createPixMapCbErr
(
done
,
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0700
'
,
decodingOptions
)
})
createPixMapCbErr
(
done
,
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0700
"
,
decodingOptions
);
});
/**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0800
...
...
@@ -760,7 +766,7 @@ describe('imageWebp', function () {
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0800
'
,
0
,
async
function
(
done
)
{
it
(
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0800
"
,
0
,
async
function
(
done
)
{
let
decodingOptions
=
{
sampleSize
:
1
,
editable
:
true
,
...
...
@@ -768,10 +774,10 @@ describe('imageWebp', function () {
rotate
:
10
,
desiredPixelFormat
:
2
,
desiredRegion
:
{
size
:
{
height
:
1
,
width
:
2
},
x
:
-
1
,
y
:
-
1
},
index
:
0
index
:
0
,
};
createPixMapCbErr
(
done
,
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0800
'
,
decodingOptions
)
})
createPixMapCbErr
(
done
,
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0800
"
,
decodingOptions
);
});
/**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0900
...
...
@@ -784,7 +790,7 @@ describe('imageWebp', function () {
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0900
'
,
0
,
async
function
(
done
)
{
it
(
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0900
"
,
0
,
async
function
(
done
)
{
let
decodingOptions
=
{
sampleSize
:
1
,
editable
:
true
,
...
...
@@ -792,10 +798,10 @@ describe('imageWebp', function () {
rotate
:
10
,
desiredPixelFormat
:
3
,
desiredRegion
:
{
size
:
{
height
:
10000
,
width
:
10000
},
x
:
0
,
y
:
0
},
index
:
0
index
:
0
,
};
createPixMapCb
(
done
,
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0900
'
,
decodingOptions
)
})
createPixMapCb
(
done
,
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0900
"
,
decodingOptions
);
});
/**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1000
...
...
@@ -808,7 +814,7 @@ describe('imageWebp', function () {
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1000
'
,
0
,
async
function
(
done
)
{
it
(
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1000
"
,
0
,
async
function
(
done
)
{
let
decodingOptions
=
{
sampleSize
:
-
1
,
editable
:
true
,
...
...
@@ -816,10 +822,10 @@ describe('imageWebp', function () {
rotate
:
10
,
desiredPixelFormat
:
2
,
desiredRegion
:
{
size
:
{
height
:
1
,
width
:
2
},
x
:
0
,
y
:
0
},
index
:
0
index
:
0
,
};
createPixMapPromiseErr
(
done
,
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1000
'
,
decodingOptions
)
})
createPixMapPromiseErr
(
done
,
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1000
"
,
decodingOptions
);
});
/**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1100
...
...
@@ -832,7 +838,7 @@ describe('imageWebp', function () {
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1100
'
,
0
,
async
function
(
done
)
{
it
(
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1100
"
,
0
,
async
function
(
done
)
{
let
decodingOptions
=
{
sampleSize
:
1
,
editable
:
true
,
...
...
@@ -840,10 +846,10 @@ describe('imageWebp', function () {
rotate
:
10
,
desiredPixelFormat
:
2
,
desiredRegion
:
{
size
:
{
height
:
1
,
width
:
2
},
x
:
0
,
y
:
0
},
index
:
-
1
index
:
-
1
,
};
createPixMapPromiseErr
(
done
,
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1100
'
,
decodingOptions
)
})
createPixMapPromiseErr
(
done
,
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1100
"
,
decodingOptions
);
});
/**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1200
...
...
@@ -856,7 +862,7 @@ describe('imageWebp', function () {
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1200
'
,
0
,
async
function
(
done
)
{
it
(
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1200
"
,
0
,
async
function
(
done
)
{
let
decodingOptions
=
{
sampleSize
:
2
,
editable
:
true
,
...
...
@@ -864,11 +870,10 @@ describe('imageWebp', function () {
rotate
:
500
,
desiredPixelFormat
:
1
,
desiredRegion
:
{
size
:
{
height
:
1
,
width
:
2
},
x
:
0
,
y
:
0
},
index
:
0
index
:
0
,
};
createPixMapPromiseErr
(
done
,
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1200
'
,
decodingOptions
)
})
createPixMapPromiseErr
(
done
,
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1200
"
,
decodingOptions
);
});
/**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1300
...
...
@@ -881,7 +886,7 @@ describe('imageWebp', function () {
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1300
'
,
0
,
async
function
(
done
)
{
it
(
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1300
"
,
0
,
async
function
(
done
)
{
let
decodingOptions
=
{
sampleSize
:
1
,
editable
:
true
,
...
...
@@ -889,10 +894,10 @@ describe('imageWebp', function () {
rotate
:
10
,
desiredPixelFormat
:
3
,
desiredRegion
:
{
size
:
{
height
:
1
,
width
:
2
},
x
:
-
1
,
y
:
-
1
},
index
:
0
index
:
0
,
};
createPixMapPromiseErr
(
done
,
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1300
'
,
decodingOptions
)
})
createPixMapPromiseErr
(
done
,
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1300
"
,
decodingOptions
);
});
/**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1400
...
...
@@ -905,7 +910,7 @@ describe('imageWebp', function () {
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1400
'
,
0
,
async
function
(
done
)
{
it
(
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1400
"
,
0
,
async
function
(
done
)
{
let
decodingOptions
=
{
sampleSize
:
1
,
editable
:
true
,
...
...
@@ -913,10 +918,10 @@ describe('imageWebp', function () {
rotate
:
10
,
desiredPixelFormat
:
2
,
desiredRegion
:
{
size
:
{
height
:
10000
,
width
:
10000
},
x
:
0
,
y
:
0
},
index
:
0
index
:
0
,
};
createPixMapPromise
(
done
,
'
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1400
'
,
decodingOptions
)
})
createPixMapPromise
(
done
,
"
SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1400
"
,
decodingOptions
);
});
/**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_0100
...
...
@@ -928,10 +933,10 @@ describe('imageWebp', function () {
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_0100
'
,
0
,
async
function
(
done
)
{
let
packOpts
=
{
format
:
[
"
image/webp
"
],
quality
:
90
}
packingCb
(
done
,
'
SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_0100
'
,
packOpts
)
})
it
(
"
SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_0100
"
,
0
,
async
function
(
done
)
{
let
packOpts
=
{
format
:
[
"
image/webp
"
],
quality
:
90
};
packingCb
(
done
,
"
SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_0100
"
,
packOpts
);
});
/**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_0100
...
...
@@ -943,10 +948,10 @@ describe('imageWebp', function () {
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_0100
'
,
0
,
async
function
(
done
)
{
let
packOpts
=
{
format
:
[
"
image/webp
"
],
quality
:
100
}
packingPromise
(
done
,
'
SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_0100
'
,
packOpts
)
})
it
(
"
SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_0100
"
,
0
,
async
function
(
done
)
{
let
packOpts
=
{
format
:
[
"
image/webp
"
],
quality
:
100
};
packingPromise
(
done
,
"
SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_0100
"
,
packOpts
);
});
/**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0100
...
...
@@ -958,10 +963,10 @@ describe('imageWebp', function () {
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0100
'
,
0
,
async
function
(
done
)
{
let
packOpts
=
{
format
:
[
"
image/webp
"
],
quality
:
123
}
packingPromiseErr
(
done
,
'
SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0100
'
,
packOpts
)
})
it
(
"
SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0100
"
,
0
,
async
function
(
done
)
{
let
packOpts
=
{
format
:
[
"
image/webp
"
],
quality
:
123
};
packingPromiseErr
(
done
,
"
SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0100
"
,
packOpts
);
});
/**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0200
...
...
@@ -973,10 +978,10 @@ describe('imageWebp', function () {
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0200
'
,
0
,
async
function
(
done
)
{
let
packOpts
=
{
format
:
[
"
image/gif
"
],
quality
:
90
}
packingPromiseErr
(
done
,
'
SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0200
'
,
packOpts
)
})
it
(
"
SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0200
"
,
0
,
async
function
(
done
)
{
let
packOpts
=
{
format
:
[
"
image/gif
"
],
quality
:
90
};
packingPromiseErr
(
done
,
"
SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0200
"
,
packOpts
);
});
/**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0300
...
...
@@ -988,10 +993,10 @@ describe('imageWebp', function () {
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0300
'
,
0
,
async
function
(
done
)
{
let
packOpts
=
{
quality
:
90
}
packingPromiseErr
(
done
,
'
SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0300
'
,
packOpts
)
})
it
(
"
SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0300
"
,
0
,
async
function
(
done
)
{
let
packOpts
=
{
quality
:
90
};
packingPromiseErr
(
done
,
"
SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0300
"
,
packOpts
);
});
/**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0400
...
...
@@ -1003,10 +1008,10 @@ describe('imageWebp', function () {
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0400
'
,
0
,
async
function
(
done
)
{
let
packOpts
=
{
format
:
[
"
image/jpeg
"
]
}
packingPromiseErr
(
done
,
'
SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0400
'
,
packOpts
)
})
it
(
"
SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0400
"
,
0
,
async
function
(
done
)
{
let
packOpts
=
{
format
:
[
"
image/jpeg
"
]
};
packingPromiseErr
(
done
,
"
SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0400
"
,
packOpts
);
});
/**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0100
...
...
@@ -1018,10 +1023,10 @@ describe('imageWebp', function () {
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0100
'
,
0
,
async
function
(
done
)
{
let
packOpts
=
{
format
:
[
"
image/gif
"
],
quality
:
100
}
packingCbErr
(
done
,
'
SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0100
'
,
packOpts
)
})
it
(
"
SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0100
"
,
0
,
async
function
(
done
)
{
let
packOpts
=
{
format
:
[
"
image/gif
"
],
quality
:
100
};
packingCbErr
(
done
,
"
SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0100
"
,
packOpts
);
});
/**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0200
...
...
@@ -1033,10 +1038,10 @@ describe('imageWebp', function () {
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0200
'
,
0
,
async
function
(
done
)
{
let
packOpts
=
{
format
:
[
"
image/jpeg
"
],
quality
:
112
}
packingCbErr
(
done
,
'
SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0200
'
,
packOpts
)
})
it
(
"
SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0200
"
,
0
,
async
function
(
done
)
{
let
packOpts
=
{
format
:
[
"
image/jpeg
"
],
quality
:
112
};
packingCbErr
(
done
,
"
SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0200
"
,
packOpts
);
});
/**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0300
...
...
@@ -1048,10 +1053,10 @@ describe('imageWebp', function () {
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0300
'
,
0
,
async
function
(
done
)
{
let
packOpts
=
{
format
:
[
"
image/jpeg
"
]
}
packingCbErr
(
done
,
'
SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0300
'
,
packOpts
)
})
it
(
"
SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0300
"
,
0
,
async
function
(
done
)
{
let
packOpts
=
{
format
:
[
"
image/jpeg
"
]
};
packingCbErr
(
done
,
"
SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0300
"
,
packOpts
);
});
/**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0400
...
...
@@ -1063,10 +1068,10 @@ describe('imageWebp', function () {
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0400
'
,
0
,
async
function
(
done
)
{
let
packOpts
=
{
quality
:
90
}
packingCbErr
(
done
,
'
SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0400
'
,
packOpts
)
})
it
(
"
SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0400
"
,
0
,
async
function
(
done
)
{
let
packOpts
=
{
quality
:
90
};
packingCbErr
(
done
,
"
SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0400
"
,
packOpts
);
});
/**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0500
...
...
@@ -1078,10 +1083,10 @@ describe('imageWebp', function () {
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0500
'
,
0
,
async
function
(
done
)
{
let
packOpts
=
{
format
:
[
"
image/jpeg
"
],
quality
:
-
1
}
packingCbErr
(
done
,
'
SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0500
'
,
packOpts
)
})
it
(
"
SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0500
"
,
0
,
async
function
(
done
)
{
let
packOpts
=
{
format
:
[
"
image/jpeg
"
],
quality
:
-
1
};
packingCbErr
(
done
,
"
SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0500
"
,
packOpts
);
});
/**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0500
...
...
@@ -1093,11 +1098,10 @@ describe('imageWebp', function () {
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0500
'
,
0
,
async
function
(
done
)
{
let
packOpts
=
{
format
:
[
"
image/jpeg
"
],
quality
:
-
1
}
packingPromiseErr
(
done
,
'
SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0500
'
,
packOpts
)
})
it
(
"
SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0500
"
,
0
,
async
function
(
done
)
{
let
packOpts
=
{
format
:
[
"
image/jpeg
"
],
quality
:
-
1
};
packingPromiseErr
(
done
,
"
SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0500
"
,
packOpts
);
});
/**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_0200
...
...
@@ -1109,10 +1113,10 @@ describe('imageWebp', function () {
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_0200
'
,
0
,
async
function
(
done
)
{
let
packOpts
=
{
format
:
[
"
image/jpeg
"
],
quality
:
0
}
packingCb
(
done
,
'
SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_0200
'
,
packOpts
)
})
it
(
"
SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_0200
"
,
0
,
async
function
(
done
)
{
let
packOpts
=
{
format
:
[
"
image/jpeg
"
],
quality
:
0
};
packingCb
(
done
,
"
SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_0200
"
,
packOpts
);
});
/**
* @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_0200
...
...
@@ -1124,8 +1128,9 @@ describe('imageWebp', function () {
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_0200
'
,
0
,
async
function
(
done
)
{
let
packOpts
=
{
format
:
[
"
image/jpeg
"
],
quality
:
0
}
packingPromise
(
done
,
'
SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_0200
'
,
packOpts
)
})
})}
it
(
"
SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_0200
"
,
0
,
async
function
(
done
)
{
let
packOpts
=
{
format
:
[
"
image/jpeg
"
],
quality
:
0
};
packingPromise
(
done
,
"
SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_0200
"
,
packOpts
);
});
});
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录