Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
53660364
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看板
提交
53660364
编写于
8月 04, 2022
作者:
L
lwx1121892
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
<liuxueqi3@huawei.com>
Signed-off-by:
N
lwx1121892
<
liuxueqi3@huawei.com
>
上级
0045d8c2
变更
20
隐藏空白更改
内联
并排
Showing
20 changed file
with
2126 addition
and
1958 deletion
+2126
-1958
multimedia/image/image_js_standard/image/Test.json
multimedia/image/image_js_standard/image/Test.json
+9
-3
multimedia/image/image_js_standard/image/src/main/js/test/List.test.js
...age/image_js_standard/image/src/main/js/test/List.test.js
+3
-0
multimedia/image/image_js_standard/image/src/main/js/test/addImage.test.js
...image_js_standard/image/src/main/js/test/addImage.test.js
+304
-0
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
+1264
-0
multimedia/image/image_js_standard/image/src/main/js/test/testImg.js
...image/image_js_standard/image/src/main/js/test/testImg.js
+11
-1
multimedia/image/image_js_standard/imageColorspace/Test.json
multimedia/image/image_js_standard/imageColorspace/Test.json
+8
-0
multimedia/image/image_js_standard/imageDecodeOptions/Test.json
...edia/image/image_js_standard/imageDecodeOptions/Test.json
+8
-0
multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/test/image.test.js
...tandard/imageDecodeOptions/src/main/js/test/image.test.js
+1
-442
multimedia/image/image_js_standard/imageExif/Test.json
multimedia/image/image_js_standard/imageExif/Test.json
+8
-0
multimedia/image/image_js_standard/imageExif/src/main/js/test/List.test.js
...image_js_standard/imageExif/src/main/js/test/List.test.js
+0
-1
multimedia/image/image_js_standard/imageExif/src/main/js/test/addImage.test.js
...e_js_standard/imageExif/src/main/js/test/addImage.test.js
+0
-302
multimedia/image/image_js_standard/imageExif/src/main/js/test/image.test.js
...mage_js_standard/imageExif/src/main/js/test/image.test.js
+1
-1151
multimedia/image/image_js_standard/imageExif/src/main/js/test/testImg.js
...e/image_js_standard/imageExif/src/main/js/test/testImg.js
+0
-22
multimedia/image/image_js_standard/imagePacking/Test.json
multimedia/image/image_js_standard/imagePacking/Test.json
+19
-8
multimedia/image/image_js_standard/imagePacking/src/main/js/test/packing.test.js
...js_standard/imagePacking/src/main/js/test/packing.test.js
+460
-0
multimedia/image/image_js_standard/imagePixelMapFramework/Test.json
.../image/image_js_standard/imagePixelMapFramework/Test.json
+8
-0
multimedia/image/image_js_standard/imageReceiver/Test.json
multimedia/image/image_js_standard/imageReceiver/Test.json
+5
-15
multimedia/image/image_js_standard/imageWebp/Test.json
multimedia/image/image_js_standard/imageWebp/Test.json
+2
-1
multimedia/image/image_js_standard/imageYUV/Test.json
multimedia/image/image_js_standard/imageYUV/Test.json
+7
-11
multimedia/image/image_js_standard/image_ndk_test/Test.json
multimedia/image/image_js_standard/image_ndk_test/Test.json
+8
-1
未找到文件。
multimedia/image/image_js_standard/image/Test.json
浏览文件 @
53660364
...
...
@@ -22,9 +22,7 @@
"mkdir -p /data/app/el2/100/base/ohos.acts.multimedia.image/haps/entry/files/"
,
"chmod -R 666 /data/app/el2/100/base/ohos.acts.multimedia.image/haps/entry/files/*"
],
"teardown-command"
:[
]
"teardown-command"
:
[]
},
{
"type"
:
"PushKit"
,
...
...
@@ -37,6 +35,14 @@
"./resource/image/test.jpg ->/data/app/el2/100/base/ohos.acts.multimedia.image/haps/entry/files"
,
"./resource/image/moving_test.gif ->/data/app/el2/100/base/ohos.acts.multimedia.image/haps/entry/files"
]
},
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"hilog -Q pidoff"
,
"hilog -b D"
],
"teardown-command"
:
[]
}
]
}
\ No newline at end of file
multimedia/image/image_js_standard/image/src/main/js/test/List.test.js
浏览文件 @
53660364
...
...
@@ -14,6 +14,9 @@
*/
import
imageJsTest
from
'
./image.test.js
'
import
addImage
from
'
./addImage.test.js
'
export
default
function
testsuite
()
{
imageJsTest
()
addImage
()
}
multimedia/image/image_js_standard/image/src/main/js/test/addImage.test.js
0 → 100644
浏览文件 @
53660364
/*
* Copyright (C) 2022 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
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
{
testPng
}
from
'
./testImg
'
export
default
function
addImage
()
{
describe
(
'
addImage
'
,
function
()
{
beforeAll
(
async
function
()
{
console
.
info
(
'
beforeAll case
'
);
})
beforeEach
(
function
()
{
console
.
info
(
'
beforeEach case
'
);
})
afterEach
(
async
function
()
{
console
.
info
(
'
afterEach case
'
);
})
afterAll
(
async
function
()
{
console
.
info
(
'
afterAll case
'
);
})
function
createPixMapPromise
(
done
,
testNum
,
opts
)
{
const
Color
=
new
ArrayBuffer
(
96
);
image
.
createPixelMap
(
Color
,
opts
)
.
then
(
pixelmap
=>
{
expect
(
pixelmap
!=
undefined
).
assertTrue
();
console
.
info
(
`
${
testNum
}
success`
);
done
();
})
.
catch
(
error
=>
{
console
.
log
(
`
${
testNum
}
error: `
+
error
);
expect
(
false
).
assertTrue
();
done
();
})
}
function
createPixMapCb
(
done
,
testNum
,
opts
)
{
const
Color
=
new
ArrayBuffer
(
96
);
image
.
createPixelMap
(
Color
,
opts
,
(
err
,
pixelmap
)
=>
{
expect
(
pixelmap
!=
undefined
).
assertTrue
();
console
.
info
(
`
${
testNum
}
success`
);
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)
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixeFormat,size
* 3.using color and opts create newPixelMap
* 4.return newpixelmap not empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
add_01_001
'
,
0
,
async
function
(
done
)
{
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
},
scaleMode
:
1
,
alphaType
:
0
}
createPixMapPromise
(
done
,
'
add_01_001
'
,
opts
);
})
/**
* @tc.number : add_01_002
* @tc.name : create pixelmap-promise (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer,scaleMode: 1, alphaType: 1)
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixeFormat,size
* 3.using color and opts create newPixelMap
* 4.return newpixelmap not empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
add_01_002
'
,
0
,
async
function
(
done
)
{
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
},
scaleMode
:
1
,
alphaType
:
1
}
createPixMapPromise
(
done
,
'
add_01_002
'
,
opts
);
})
/**
* @tc.number : add_01_003
* @tc.name : create pixelmap-promise (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer,scaleMode: 0, alphaType: 2)
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixeFormat,size
* 3.using color and opts create newPixelMap
* 4.return newpixelmap not empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
add_01_003
'
,
0
,
async
function
(
done
)
{
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
},
scaleMode
:
0
,
alphaType
:
2
}
createPixMapPromise
(
done
,
'
add_01_003
'
,
opts
);
})
/**
* @tc.number : add_01_004
* @tc.name : create pixelmap-promise (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer,scaleMode: 0, alphaType: 3)
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixeFormat,size
* 3.using color and opts create newPixelMap
* 4.return newpixelmap not empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
add_01_004
'
,
0
,
async
function
(
done
)
{
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
},
scaleMode
:
0
,
alphaType
:
3
}
createPixMapPromise
(
done
,
'
add_01_004
'
,
opts
);
})
/**
* @tc.number : add_02_001
* @tc.name : create pixelmap-callback (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer,scaleMode: 0, alphaType: 0)
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixeFormat,size
* 3.using color and opts create newPixelMap
* 4.return newpixelmap not empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
add_02_001
'
,
0
,
async
function
(
done
)
{
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
},
scaleMode
:
0
,
alphaType
:
0
}
createPixMapCb
(
done
,
'
add_02_001
'
,
opts
);
})
/**
* @tc.number : add_02_002
* @tc.name : create pixelmap-callback (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer,scaleMode: 0, alphaType: 1)
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixeFormat,size
* 3.using color and opts create newPixelMap
* 4.return newpixelmap not empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
add_02_002
'
,
0
,
async
function
(
done
)
{
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
},
scaleMode
:
0
,
alphaType
:
1
}
createPixMapCb
(
done
,
'
add_02_002
'
,
opts
);
})
/**
* @tc.number : add_02_003
* @tc.name : create pixelmap-callback (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer,scaleMode: 1, alphaType: 2)
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixeFormat,size
* 3.using color and opts create newPixelMap
* 4.return newpixelmap not empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
add_02_003
'
,
0
,
async
function
(
done
)
{
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
},
scaleMode
:
1
,
alphaType
:
2
}
createPixMapCb
(
done
,
'
add_02_003
'
,
opts
);
})
/**
* @tc.number : add_02_004
* @tc.name : create pixelmap-callback (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer,scaleMode: 1, alphaType: 3)
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixeFormat,size
* 3.using color and opts create newPixelMap
* 4.return newpixelmap not empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
add_02_004
'
,
0
,
async
function
(
done
)
{
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
},
scaleMode
:
1
,
alphaType
:
3
}
createPixMapCb
(
done
,
'
add_02_004
'
,
opts
);
})
/**
* @tc.number : add_053
* @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_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
);
}
})
/**
* @tc.number : add_053-1
* @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_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
);
}
})
})
}
\ No newline at end of file
multimedia/image/image_js_standard/image/src/main/js/test/image.test.js
浏览文件 @
53660364
...
...
@@ -17,6 +17,7 @@ import image from '@ohos.multimedia.image'
import
fileio
from
'
@ohos.fileio
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
import
{
testPng
,
testJpg
}
from
'
./testImg
'
import
{
tc_020Buf
,
tc_020_1Buf
,
tc_021Buf
,
tc_021_1Buf
,
tc_022Buf
}
from
'
./testImg
'
import
featureAbility
from
'
@ohos.ability.featureAbility
'
export
default
function
imageJsTest
()
{
...
...
@@ -63,6 +64,1155 @@ export default function imageJsTest() {
console
.
info
(
'
afterAll case
'
);
})
/**
* @tc.number : TC_001
* @tc.name : create pixelmap-promise (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer)
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixeFormat,size
* 3.using color and opts create newPixelMap
* 4.return newpixelmap not empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
TC_001
'
,
0
,
async
function
(
done
)
{
const
Color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
Color
,
opts
)
.
then
(
pixelmap
=>
{
globalpixelmap
=
pixelmap
;
expect
(
pixelmap
!=
undefined
).
assertTrue
();
console
.
info
(
'
TC_001 success
'
);
done
();
})
.
catch
(
error
=>
{
console
.
log
(
'
TC_001 error:
'
+
error
);
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number : TC_001-1
* @tc.name : create pixelmap-callback (editable: false, pixelFormat: RGBA_8888, size: { height: 4, width: 6 },bytes = buffer)
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixelFormat,size
* 3.using colorand opts create newPixelMap
* 4.return newpixelmap not empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
TC_001-1
'
,
0
,
async
function
(
done
)
{
const
Color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
false
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
Color
,
opts
,
(
err
,
pixelmap
)
=>
{
globalpixelmap
=
pixelmap
;
expect
(
pixelmap
!=
undefined
).
assertTrue
();
console
.
info
(
'
TC_001-1 success
'
);
done
();
})
})
/**
* @tc.number : TC_001-2
* @tc.name : createpixelmap-promise (editable: true, pixelFormat: RGB_565, size: { height: 6, width: 8 },bytes = buffer)
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixelFormat,size
* 3.using colorand opts create newPixelMap
* 4.return newpixelmap not empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
TC_001-2
'
,
0
,
async
function
(
done
)
{
const
Color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
2
,
size
:
{
height
:
6
,
width
:
8
}
}
image
.
createPixelMap
(
Color
,
opts
)
.
then
(
pixelmap
=>
{
globalpixelmap
=
pixelmap
;
expect
(
pixelmap
!=
undefined
).
assertTrue
();
console
.
info
(
'
TC_001-2 success
'
);
done
();
})
.
catch
(
error
=>
{
console
.
log
(
'
TC_001-2 error:
'
+
error
);
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number : TC_001-3
* @tc.name : createpixelmap-callback (editable: false, pixelFormat: RGB_565, size: { height: 6, width: 8 },bytes = buffer)
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixelFormat,size
* 3.using colorand opts create newPixelMap
* 4.return newpixelmap not empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
TC_001-3
'
,
0
,
async
function
(
done
)
{
const
Color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
false
,
pixelFormat
:
2
,
size
:
{
height
:
6
,
width
:
8
}
}
image
.
createPixelMap
(
Color
,
opts
,
(
err
,
pixelmap
)
=>
{
globalpixelmap
=
pixelmap
;
expect
(
pixelmap
!=
undefined
).
assertTrue
();
console
.
info
(
'
TC_001-3 success
'
);
done
();
})
})
/**
* @tc.number : TC_001-4
* @tc.name : createpixelmap-promise(editable: true, pixelFormat: unkonwn, size: { height: 6, width: 8 })
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixelFormat,size
* 3.using colorand opts create newPixelMap
* 4.return newpixelmap not empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
TC_001-4
'
,
0
,
async
function
(
done
)
{
const
Color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
0
,
size
:
{
height
:
6
,
width
:
8
}
}
image
.
createPixelMap
(
Color
,
opts
)
.
then
(
pixelmap
=>
{
globalpixelmap
=
pixelmap
;
expect
(
pixelmap
!=
undefined
).
assertTrue
();
console
.
info
(
'
TC_001-4 success
'
);
done
();
})
.
catch
(
error
=>
{
console
.
log
(
'
TC_001-4 error:
'
+
error
);
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number : TC_001-5
* @tc.name : create pixelmap-callback(editable: false, pixelFormat: unkonwn, size: { height: 6, width: 8 })
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixelFormat,size
* 3.using colorand opts create newPixelMap
* 4.return newpixelmap not empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
TC_001-5
'
,
0
,
async
function
(
done
)
{
const
Color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
false
,
pixelFormat
:
0
,
size
:
{
height
:
6
,
width
:
8
}
}
image
.
createPixelMap
(
Color
,
opts
,
(
err
,
pixelmap
)
=>
{
globalpixelmap
=
pixelmap
;
expect
(
pixelmap
!=
undefined
).
assertTrue
();
console
.
info
(
'
TC_001-5 success
'
);
done
();
})
})
/**
* @tc.number : TC_001-6
* @tc.name : create pixelmap-callback(editable: true, pixelFormat: RGBA_8888, size: { height: 6, width: 8 } bytes > buffer )
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixeFormat,size
* 3.using color and opts create newPixelMap
* 4.return newpixelmap not empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
TC_001-6
'
,
0
,
async
function
(
done
)
{
const
Color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
6
,
width
:
8
}
}
image
.
createPixelMap
(
Color
,
opts
,
(
err
,
pixelmap
)
=>
{
globalpixelmap
=
pixelmap
;
expect
(
pixelmap
!=
undefined
).
assertTrue
();
console
.
info
(
'
TC_001-6 success
'
);
done
();
})
})
/**
* @tc.number : TC_001-7
* @tc.name : create pixelmap-callback(editable: true, pixelFormat: RGB_565, size: { height: 2, width: 3 }, bytes < buffer)
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixeFormat,size
* 3.using color and opts create newPixelMap
* 4.return newpixelmap not empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
TC_001-7
'
,
0
,
async
function
(
done
)
{
const
Color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
2
,
size
:
{
height
:
2
,
width
:
3
}
}
image
.
createPixelMap
(
Color
,
opts
,
(
err
,
pixelmap
)
=>
{
globalpixelmap
=
pixelmap
;
expect
(
pixelmap
!=
undefined
).
assertTrue
();
console
.
info
(
'
TC_001-7 success
'
);
done
();
})
})
/**
* @tc.number : TC_001-8
* @tc.name : create pixelmap-callback(editable: true, pixelFormat: unkonwn, size: { height: -1, width: -1 })
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixeFormat,size
* 3.using color and opts create newPixelMap
* 4.return newpixelmap empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
TC_001-8
'
,
0
,
async
function
(
done
)
{
const
Color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
0
,
size
:
{
height
:
-
1
,
width
:
-
1
}
}
image
.
createPixelMap
(
Color
,
opts
,
(
err
,
pixelmap
)
=>
{
globalpixelmap
=
pixelmap
;
expect
(
pixelmap
==
undefined
).
assertTrue
();
console
.
info
(
'
TC_001-8 success
'
);
done
();
})
})
/**
* @tc.number : TC_001-9
* @tc.name : create pixelmap-callback(editable: true, pixelFormat: unsupported format, size: { height: 6, width: 8 })
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixeFormat,size(Unsupported formats are converted to RGBA_8888)
* 3.using color and opts create newPixelMap
* 4.return newpixelmap empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
TC_001-9
'
,
0
,
async
function
(
done
)
{
const
Color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
21
,
size
:
{
height
:
6
,
width
:
8
}
}
image
.
createPixelMap
(
Color
,
opts
,
(
err
,
pixelmap
)
=>
{
globalpixelmap
=
pixelmap
;
expect
(
pixelmap
!=
undefined
).
assertTrue
();
console
.
info
(
'
TC_001-9 success
'
);
done
();
})
})
/**
* @tc.number : TC_020
* @tc.name : readPixelsToBuffer-promise
* @tc.desc : read all pixels to an buffer
* 1.create PixelMap,buffer
* 2.call readPixelsToBuffer
* 3.return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_020
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
TC_020 in
'
);
const
color
=
new
ArrayBuffer
(
96
);
var
bufferArr
=
new
Uint8Array
(
color
);
for
(
var
i
=
0
;
i
<
bufferArr
.
length
;
i
++
)
{
bufferArr
[
i
]
=
i
+
1
;
}
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
)
.
then
(
pixelmap
=>
{
globalpixelmap
=
pixelmap
;
if
(
pixelmap
==
undefined
)
{
console
.
info
(
'
TC_020 createPixelMap failed
'
);
expect
(
false
).
assertTrue
()
done
();
}
const
readBuffer
=
new
ArrayBuffer
(
96
);
pixelmap
.
readPixelsToBuffer
(
readBuffer
).
then
(()
=>
{
var
bufferArr2
=
new
Uint8Array
(
readBuffer
);
var
res
=
true
;
for
(
var
i
=
0
;
i
<
bufferArr2
.
length
;
i
++
)
{
if
(
bufferArr2
[
i
]
!=
tc_020Buf
[
i
])
{
res
=
false
;
console
.
info
(
'
TC_20_buffer
'
+
bufferArr2
[
i
]);
console
.
info
(
'
TC_020 failed
'
);
expect
(
false
).
assertTrue
();
done
();
break
;
}
}
if
(
res
)
{
console
.
info
(
'
TC_020 success
'
);
expect
(
true
).
assertTrue
()
done
();
}
}).
catch
(
error
=>
{
console
.
log
(
'
TC_020 read error:
'
+
error
);
expect
().
assertFail
();
done
();
})
}).
catch
(
error
=>
{
console
.
log
(
'
TC_020 error:
'
+
error
);
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number : TC_020-1
* @tc.name : readPixelsToBuffer-callback
* @tc.desc : read all pixels to an buffer
* 1.create PixelMap,buffer
* 2.call readPixelsToBuffer
* 3.return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_020-1
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
TC_020-1 in
'
);
const
color
=
new
ArrayBuffer
(
96
);
var
bufferArr
=
new
Uint8Array
(
color
);
for
(
var
i
=
0
;
i
<
bufferArr
.
length
;
i
++
)
{
bufferArr
[
i
]
=
i
+
1
;
}
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
,
(
err
,
pixelmap
)
=>
{
globalpixelmap
=
pixelmap
;
if
(
pixelmap
==
undefined
)
{
console
.
info
(
'
TC_020-1 createPixelMap failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
const
readBuffer
=
new
ArrayBuffer
(
96
);
pixelmap
.
readPixelsToBuffer
(
readBuffer
,
()
=>
{
var
bufferArr
=
new
Uint8Array
(
readBuffer
);
var
res
=
true
;
for
(
var
i
=
0
;
i
<
bufferArr
.
length
;
i
++
)
{
if
(
bufferArr
[
i
]
!=
tc_020_1Buf
[
i
])
{
res
=
false
;
console
.
info
(
'
TC_020-1 failed
'
);
expect
(
false
).
assertTrue
();
done
();
break
;
}
}
if
(
res
)
{
console
.
info
(
'
TC_020-1 success
'
);
expect
(
true
).
assertTrue
()
done
();
}
})
}
})
})
/**
* @tc.number : TC_020-2
* @tc.name : readPixelsToBuffer-callback(buffer:0)
* @tc.desc : read all pixels to an buffer
* 1.create PixelMap,buffer
* 2.call readPixelsToBuffer
* 3.return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_020-2
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
TC_020-2 in
'
);
const
color
=
new
ArrayBuffer
(
96
);
var
bufferArr
=
new
Uint8Array
(
color
);
for
(
var
i
=
0
;
i
<
bufferArr
.
length
;
i
++
)
{
bufferArr
[
i
]
=
i
+
1
;
}
let
opts
=
{
editable
:
true
,
pixelFormat
:
2
,
size
:
{
height
:
6
,
width
:
8
}
}
image
.
createPixelMap
(
color
,
opts
,
(
err
,
pixelmap
)
=>
{
globalpixelmap
=
pixelmap
;
if
(
pixelmap
==
undefined
)
{
console
.
info
(
'
TC_020-2 createPixelMap failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
const
readBuffer
=
new
ArrayBuffer
(
0
);
pixelmap
.
readPixelsToBuffer
(
readBuffer
,
()
=>
{
var
bufferArr
=
new
Uint8Array
(
readBuffer
);
var
res
=
true
;
for
(
var
i
=
0
;
i
<
bufferArr
.
length
;
i
++
)
{
if
(
bufferArr
[
i
]
==
0
)
{
res
=
false
;
console
.
info
(
'
TC_020-2 failed
'
);
expect
(
false
).
assertTrue
();
done
();
break
;
}
}
if
(
res
)
{
console
.
info
(
'
TC_020-2 success
'
);
expect
(
true
).
assertTrue
()
done
();
}
})
}
})
})
/**
* @tc.number : TC_021
* @tc.name : readPixels-promise
* @tc.desc : 1.create PixelMap
* 2.call readPixels
* 3.promise return array
* 4.callbackcall return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_021
'
,
0
,
async
function
(
done
)
{
const
color
=
new
ArrayBuffer
(
96
);
var
bufferArr
=
new
Uint8Array
(
color
);
for
(
var
i
=
0
;
i
<
bufferArr
.
length
;
i
++
)
{
bufferArr
[
i
]
=
i
+
1
;
}
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
)
.
then
(
pixelmap
=>
{
globalpixelmap
=
pixelmap
;
if
(
pixelmap
==
undefined
)
{
console
.
info
(
'
TC_021 createPixelMap failed
'
);
expect
(
false
).
assertTrue
()
done
();
}
const
area
=
{
pixels
:
new
ArrayBuffer
(
8
),
offset
:
0
,
stride
:
8
,
region
:
{
size
:
{
height
:
1
,
width
:
2
},
x
:
0
,
y
:
0
}
}
pixelmap
.
readPixels
(
area
).
then
(()
=>
{
var
bufferArr2
=
new
Uint8Array
(
area
.
pixels
);
var
res
=
true
;
for
(
var
i
=
0
;
i
<
bufferArr2
.
length
;
i
++
)
{
if
(
bufferArr2
[
i
]
!=
tc_021Buf
[
i
])
{
res
=
false
;
console
.
info
(
'
TC_021 failed
'
);
expect
(
false
).
assertTrue
();
done
();
break
;
}
}
if
(
res
)
{
console
.
info
(
'
TC_021 success
'
);
expect
(
true
).
assertTrue
()
done
();
}
})
})
.
catch
(
error
=>
{
console
.
log
(
'
TC_021 error:
'
+
error
);
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number : TC_021-1
* @tc.name : readPixels-callback
* @tc.desc : 1.create PixelMap
* 2.call readPixels
* 3.promise return array
* 4.callbackcall return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_021-1
'
,
0
,
async
function
(
done
)
{
const
color
=
new
ArrayBuffer
(
96
);
var
bufferArr
=
new
Uint8Array
(
color
);
for
(
var
i
=
0
;
i
<
bufferArr
.
length
;
i
++
)
{
bufferArr
[
i
]
=
i
+
1
;
}
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
,
(
err
,
pixelmap
)
=>
{
globalpixelmap
=
pixelmap
;
if
(
pixelmap
==
undefined
)
{
console
.
info
(
'
TC_020-1 createPixelMap failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
const
area
=
{
pixels
:
new
ArrayBuffer
(
8
),
offset
:
0
,
stride
:
8
,
region
:
{
size
:
{
height
:
1
,
width
:
2
},
x
:
0
,
y
:
0
}
}
pixelmap
.
readPixels
(
area
,
()
=>
{
var
bufferArr
=
new
Uint8Array
(
area
.
pixels
);
var
res
=
true
;
for
(
var
i
=
0
;
i
<
bufferArr
.
length
;
i
++
)
{
console
.
info
(
'
TC_021-1 buffer
'
+
bufferArr
[
i
]);
if
(
bufferArr
[
i
]
!=
tc_021_1Buf
[
i
])
{
res
=
false
;
console
.
info
(
'
TC_021-1 failed
'
);
expect
(
false
).
assertTrue
();
done
();
break
;
}
}
if
(
res
)
{
console
.
info
(
'
TC_021-1 success
'
);
expect
(
true
).
assertTrue
()
done
();
}
})
}
})
})
/**
* @tc.number : TC_021-2
* @tc.name : readPixels-callback( region: { size: { height: 1, width: 2 }, x: -1, y: -1 })
* @tc.desc : 1.create PixelMap
* 2.call readPixels
* 3.promise return array
* 4.callbackcall return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_021-2
'
,
0
,
async
function
(
done
)
{
const
color
=
new
ArrayBuffer
(
96
);
var
bufferArr
=
new
Uint8Array
(
color
);
for
(
var
i
=
0
;
i
<
bufferArr
.
length
;
i
++
)
{
bufferArr
[
i
]
=
i
+
1
;
}
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
,
(
err
,
pixelmap
)
=>
{
globalpixelmap
=
pixelmap
;
if
(
pixelmap
==
undefined
)
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
TC_021-2 create pixelmap fail
'
);
done
();
}
else
{
const
area
=
{
pixels
:
new
ArrayBuffer
(
20
),
offset
:
0
,
stride
:
8
,
region
:
{
size
:
{
height
:
1
,
width
:
2
},
x
:
-
1
,
y
:
-
1
}
}
pixelmap
.
readPixels
(
area
).
then
(()
=>
{
console
.
info
(
'
TC_021-2 failed
'
);
expect
(
false
).
assertTrue
();
done
();
}).
catch
(()
=>
{
expect
(
true
).
assertTrue
();
console
.
info
(
'
TC_021-2 success
'
);
done
();
})
}
})
})
/**
* @tc.number : TC_021-3
* @tc.name : readPixels-promise(buffer:0)
* @tc.desc : 1.create PixelMap
* 2.call readPixels
* 3.promise return array
* 4.callbackcall return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_021-3
'
,
0
,
async
function
(
done
)
{
const
color
=
new
ArrayBuffer
(
96
);
var
bufferArr
=
new
Uint8Array
(
color
);
for
(
var
i
=
0
;
i
<
bufferArr
.
length
;
i
++
)
{
bufferArr
[
i
]
=
i
+
1
;
}
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
,
(
err
,
pixelmap
)
=>
{
globalpixelmap
=
pixelmap
;
if
(
pixelmap
==
undefined
)
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
TC_021-3 create pixelmap failed
'
);
done
();
}
else
{
const
area
=
{
pixels
:
new
ArrayBuffer
(
0
),
offset
:
0
,
stride
:
8
,
region
:
{
size
:
{
height
:
1
,
width
:
2
},
x
:
0
,
y
:
0
}
}
pixelmap
.
readPixels
(
area
).
then
(()
=>
{
console
.
info
(
'
TC_021-3 failed
'
);
expect
(
false
).
assertTrue
();
done
();
}).
catch
(()
=>
{
expect
(
true
).
assertTrue
();
console
.
info
(
'
TC_021-3 success
'
);
done
();
})
}
})
})
/**
* @tc.number : TC_021-4
* @tc.name : readPixels-promise(offset > buffer)
* @tc.desc : 1.create PixelMap
* 2.call readPixels
* 3.promise return array
* 4.callbackcall return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_021-4
'
,
0
,
async
function
(
done
)
{
const
color
=
new
ArrayBuffer
(
96
);
var
bufferArr
=
new
Uint8Array
(
color
);
for
(
var
i
=
0
;
i
<
bufferArr
.
length
;
i
++
)
{
bufferArr
[
i
]
=
i
+
1
;
}
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
,
(
err
,
pixelmap
)
=>
{
globalpixelmap
=
pixelmap
;
if
(
pixelmap
==
undefined
)
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
TC_021-4 createPixelMap success
'
);
done
();
}
const
area
=
{
pixels
:
new
ArrayBuffer
(
20
),
offset
:
21
,
stride
:
8
,
region
:
{
size
:
{
height
:
1
,
width
:
2
},
x
:
0
,
y
:
0
}
}
pixelmap
.
readPixels
(
area
).
then
(()
=>
{
console
.
info
(
'
TC_021-4 failed
'
);
expect
(
false
).
assertTrue
();
done
();
}).
catch
(()
=>
{
expect
(
true
).
assertTrue
();
console
.
info
(
'
TC_021-4 success
'
);
done
();
})
})
})
/**
* @tc.number : TC_021-5
* @tc.name : readPixels-promise(region: { size: { height: -1, width:-1}, x: 0, y: 0 })
* @tc.desc : 1.create PixelMap
* 2.call readPixels
* 3.promise return array
* 4.callbackcall return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_021-5
'
,
0
,
async
function
(
done
)
{
const
color
=
new
ArrayBuffer
(
96
);
var
bufferArr
=
new
Uint8Array
(
color
);
for
(
var
i
=
0
;
i
<
bufferArr
.
length
;
i
++
)
{
bufferArr
[
i
]
=
i
+
1
;
}
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
,
(
err
,
pixelmap
)
=>
{
globalpixelmap
=
pixelmap
;
if
(
pixelmap
==
undefined
)
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
TC_021-5 createPixelMap success
'
);
done
();
}
const
area
=
{
pixels
:
new
ArrayBuffer
(
20
),
offset
:
0
,
stride
:
8
,
region
:
{
size
:
{
height
:
-
1
,
width
:
-
1
},
x
:
0
,
y
:
0
}
}
pixelmap
.
readPixels
(
area
).
then
(()
=>
{
console
.
info
(
'
TC_021-5 failed
'
);
expect
(
false
).
assertTrue
();
done
();
}).
catch
(()
=>
{
expect
(
true
).
assertTrue
();
console
.
info
(
'
TC_021-5 success
'
);
done
();
})
})
})
/**
* @tc.number : TC_022
* @tc.name : writePixels-promise
* @tc.desc : 1.create PixelMap
* 2.call writePixels
* 3.call return undefined
* 4.callbackcall return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_022
'
,
0
,
async
function
(
done
)
{
const
color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
)
.
then
(
pixelmap
=>
{
globalpixelmap
=
pixelmap
;
if
(
pixelmap
==
undefined
)
{
console
.
info
(
'
TC_022 createPixelMap failed
'
);
expect
(
false
).
assertTrue
()
done
();
}
const
area
=
{
pixels
:
new
ArrayBuffer
(
8
),
offset
:
0
,
stride
:
8
,
region
:
{
size
:
{
height
:
1
,
width
:
2
},
x
:
0
,
y
:
0
}
}
var
bufferArr
=
new
Uint8Array
(
area
.
pixels
);
for
(
var
i
=
0
;
i
<
bufferArr
.
length
;
i
++
)
{
bufferArr
[
i
]
=
i
+
1
;
}
console
.
info
(
'
============ bufferArr
'
+
JSON
.
stringify
(
bufferArr
));
pixelmap
.
writePixels
(
area
).
then
(()
=>
{
const
readArea
=
{
pixels
:
new
ArrayBuffer
(
8
),
offset
:
0
,
stride
:
8
,
region
:
{
size
:
{
height
:
1
,
width
:
2
},
x
:
0
,
y
:
0
}
}
console
.
info
(
'
============ bufferArr
'
+
JSON
.
stringify
(
readArea
));
pixelmap
.
readPixels
(
readArea
).
then
(()
=>
{
var
readArr
=
new
Uint8Array
(
readArea
.
pixels
);
var
res
=
true
;
for
(
var
i
=
0
;
i
<
readArr
.
length
;
i
++
)
{
if
(
readArr
[
i
]
!=
tc_022Buf
[
i
])
{
res
=
false
;
console
.
info
(
'
TC_022 failed
'
);
expect
(
false
).
assertTrue
();
done
();
break
;
}
}
if
(
res
)
{
console
.
info
(
'
TC_022 success
'
);
expect
(
true
).
assertTrue
()
done
();
}
})
})
})
.
catch
(
error
=>
{
console
.
log
(
'
TC_022 error:
'
+
error
);
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number : TC_022-1
* @tc.name : writePixels-callback
* @tc.desc : 1.create PixelMap
* 2.call writePixels
* 3.call return undefined
* 4.callbackcall return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_022-1
'
,
0
,
async
function
(
done
)
{
try
{
const
color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
,
(
err
,
pixelmap
)
=>
{
globalpixelmap
=
pixelmap
;
if
(
pixelmap
==
undefined
)
{
console
.
info
(
'
TC_022-1 createPixelMap failed
'
);
expect
(
false
).
assertTrue
()
done
();
}
const
area
=
{
pixels
:
new
ArrayBuffer
(
8
),
offset
:
0
,
stride
:
8
,
region
:
{
size
:
{
height
:
1
,
width
:
2
},
x
:
0
,
y
:
0
}
}
var
bufferArr
=
new
Uint8Array
(
area
.
pixels
);
for
(
var
i
=
0
;
i
<
bufferArr
.
length
;
i
++
)
{
bufferArr
[
i
]
=
i
+
1
;
}
pixelmap
.
writePixels
(
area
,
()
=>
{
const
readArea
=
{
pixels
:
new
ArrayBuffer
(
8
),
offset
:
0
,
stride
:
8
,
region
:
{
size
:
{
height
:
1
,
width
:
2
},
x
:
0
,
y
:
0
}
}
pixelmap
.
readPixels
(
readArea
,
()
=>
{
var
readArr
=
new
Uint8Array
(
readArea
.
pixels
);
var
res
=
true
;
for
(
var
i
=
0
;
i
<
readArr
.
length
;
i
++
)
{
if
(
readArr
[
i
]
!=
tc_022Buf
[
i
])
{
res
=
false
;
console
.
info
(
'
TC_022-1 failed
'
);
expect
(
false
).
assertTrue
();
done
();
break
;
}
}
if
(
res
)
{
console
.
info
(
'
TC_022-1 success
'
);
expect
(
true
).
assertTrue
()
done
();
}
})
})
})
}
catch
(
error
)
{
console
.
info
(
'
TC_022-1 error:
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
})
/**
* @tc.number : TC_023
* @tc.name : writeBufferToPixels-promise
* @tc.desc : 1.create PixelMap,buffer
* 2.call writeBufferToPixels
* 3.call return undefined
* 4.callbackcall return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_023
'
,
0
,
async
function
(
done
)
{
const
color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
)
.
then
(
pixelmap
=>
{
globalpixelmap
=
pixelmap
;
if
(
pixelmap
==
undefined
)
{
console
.
info
(
'
TC_023 createPixelMap failed
'
);
expect
(
false
).
assertTrue
()
done
();
}
const
writeColor
=
new
ArrayBuffer
(
96
);
var
bufferArr
=
new
Uint8Array
(
writeColor
);
for
(
var
i
=
0
;
i
<
bufferArr
.
length
;
i
++
)
{
bufferArr
[
i
]
=
i
+
1
;
}
pixelmap
.
writeBufferToPixels
(
writeColor
).
then
(()
=>
{
const
readBuffer
=
new
ArrayBuffer
(
96
);
pixelmap
.
readPixelsToBuffer
(
readBuffer
).
then
(()
=>
{
var
bufferArr
=
new
Uint8Array
(
readBuffer
);
var
res
=
true
;
for
(
var
i
=
0
;
i
<
bufferArr
.
length
;
i
++
)
{
if
(
bufferArr
[
i
]
==
0
)
{
res
=
false
;
console
.
info
(
'
TC_023 failed
'
);
expect
(
false
).
assertTrue
()
done
();
break
;
}
}
if
(
res
)
{
console
.
info
(
'
TC_023 success
'
);
expect
(
true
).
assertTrue
();
done
();
}
})
})
})
.
catch
(
error
=>
{
console
.
log
(
'
TC_023 error:
'
+
error
);
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number : TC_023-1
* @tc.name : writeBufferToPixels-callback
* @tc.desc : 1.create PixelMap,buffer
* 2.call writeBufferToPixels
* 3.call return undefined
* 4.callbackcall return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_023-1
'
,
0
,
async
function
(
done
)
{
const
color
=
new
ArrayBuffer
(
96
);
var
bufferArr
=
new
Uint8Array
(
color
);
for
(
var
i
=
0
;
i
<
bufferArr
.
length
;
i
++
)
{
bufferArr
[
i
]
=
i
+
1
;
}
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
).
then
(
pixelmap
=>
{
globalpixelmap
=
pixelmap
;
if
(
pixelmap
==
undefined
)
{
expect
(
false
).
assertTrue
()
console
.
info
(
'
TC_023-1 failed
'
);
done
();
}
const
writeColor
=
new
ArrayBuffer
(
96
);
pixelmap
.
writeBufferToPixels
(
writeColor
,
()
=>
{
const
readBuffer
=
new
ArrayBuffer
(
96
);
pixelmap
.
readPixelsToBuffer
(
readBuffer
,
()
=>
{
var
bufferArr
=
new
Uint8Array
(
readBuffer
);
var
res
=
true
;
for
(
var
i
=
0
;
i
<
bufferArr
.
length
;
i
++
)
{
if
(
res
)
{
if
(
bufferArr
[
i
]
==
0
)
{
res
=
false
;
console
.
info
(
'
TC_023-1 Success
'
);
expect
(
true
).
assertTrue
()
done
();
break
;
}
}
}
if
(
res
)
{
console
.
info
(
'
TC_023-1 no change after writeBuffer
'
);
expect
(
false
).
assertTrue
();
done
();
}
})
})
})
})
/**
* @tc.number : TC_024
* @tc.name : getImageInfo-pixelmap-promise
* @tc.desc : 1.create PixelMap,ImageInfo
* 2.call getImageInfo
* 3.call return imageinfo
* 4.callback return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_024
'
,
0
,
async
function
(
done
)
{
const
color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
2
,
size
:
{
height
:
6
,
width
:
8
}
}
image
.
createPixelMap
(
color
,
opts
)
.
then
(
pixelmap
=>
{
globalpixelmap
=
pixelmap
;
if
(
pixelmap
==
undefined
)
{
console
.
info
(
'
TC_024 createPixelMap failed
'
);
expect
(
false
).
assertTrue
()
done
();
}
pixelmap
.
getImageInfo
().
then
(
imageInfo
=>
{
if
(
imageInfo
==
undefined
)
{
console
.
info
(
'
TC_024 imageInfo is empty
'
);
expect
(
false
).
assertTrue
()
done
();
}
if
(
imageInfo
.
size
.
height
==
4
&&
imageInfo
.
size
.
width
==
6
)
{
console
.
info
(
'
TC_024 success
'
);
expect
(
true
).
assertTrue
()
done
();
}
done
();
}).
catch
(
error
=>
{
console
.
log
(
'
TC_024 getimageinfo error:
'
+
error
);
expect
().
assertFail
();
done
();
})
done
();
})
.
catch
(
error
=>
{
console
.
log
(
'
TC_024 error:
'
+
error
);
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number : TC_024-1
* @tc.name : getImageInfo-pixelmap-callback
* @tc.desc : 1.create PixelMap,ImageInfo
* 2.call getImageInfo
* 3.call return imageinfo
* 4.callback return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_024-1
'
,
0
,
async
function
(
done
)
{
const
color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
,
(
err
,
pixelmap
)
=>
{
if
(
pixelmap
==
undefined
)
{
globalpixelmap
=
pixelmap
;
expect
(
false
).
assertTrue
()
console
.
info
(
'
TC_024-1 create pixelmap fail
'
);
done
();
}
pixelmap
.
getImageInfo
((
err
,
imageInfo
)
=>
{
if
(
imageInfo
==
undefined
)
{
console
.
info
(
'
TC_024-1 imageInfo is empty
'
);
expect
(
false
).
assertTrue
()
done
();
}
if
(
imageInfo
.
size
.
height
==
4
&&
imageInfo
.
size
.
width
==
6
)
{
console
.
info
(
'
TC_024-1 imageInfo success
'
);
expect
(
true
).
assertTrue
()
done
();
}
done
();
})
})
})
/**
* @tc.number : TC_025-1
* @tc.name : getBytesNumberPerRow
* @tc.desc : 1.create PixelMap
* 2.set PixelMap
* 3.call getBytesNumberPerRow
* 4. call return number
* 5.callback return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_025-1
'
,
0
,
async
function
(
done
)
{
const
color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
const
expectNum
=
4
*
opts
.
size
.
width
;
image
.
createPixelMap
(
color
,
opts
,
(
err
,
pixelmap
)
=>
{
globalpixelmap
=
pixelmap
;
if
(
pixelmap
==
undefined
)
{
expect
(
false
).
assertTrue
()
console
.
info
(
'
TC_25-1 create pixelmap fail
'
);
done
();
}
else
{
const
num
=
pixelmap
.
getBytesNumberPerRow
();
console
.
info
(
'
TC_025-1 num is
'
+
num
);
expect
(
num
==
expectNum
).
assertTrue
();
if
(
num
==
expectNum
)
{
console
.
info
(
'
TC_25-1 success
'
);
}
else
{
console
.
info
(
'
TC_25-1 fail
'
);
}
done
();
}
})
})
/**
* @tc.number : TC_026-1
* @tc.name : getPixelBytesNumber
* @tc.desc : 1.create PixelMap
* 2.set Pixel
* 3.call getPixelBytesNumber
* 4. call return number
* 5.callback return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_026-1
'
,
0
,
async
function
(
done
)
{
const
color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
const
expectNum
=
4
*
opts
.
size
.
width
*
opts
.
size
.
height
;
image
.
createPixelMap
(
color
,
opts
,
(
err
,
pixelmap
)
=>
{
globalpixelmap
=
pixelmap
;
if
(
pixelmap
==
undefined
)
{
expect
(
false
).
assertTrue
()
console
.
info
(
'
TC_026-1 create pixelmap fail
'
);
done
();
}
else
{
const
num
=
pixelmap
.
getPixelBytesNumber
();
console
.
info
(
'
TC_026-1 num is
'
+
num
);
expect
(
num
==
expectNum
).
assertTrue
();
if
(
num
==
expectNum
)
{
console
.
info
(
'
TC_026-1 success
'
);
}
else
{
console
.
info
(
'
TC_026-1 fail
'
);
}
done
();
}
})
})
/**
* @tc.number : TC_027
* @tc.name : release-pixelmap-promise
* @tc.desc : 1.create PixelMap
* 2.set Pixel
* 3.call release
* 4.return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_027
'
,
0
,
async
function
(
done
)
{
const
color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
).
then
(
pixelmap
=>
{
globalpixelmap
=
pixelmap
;
if
(
pixelmap
==
undefined
)
{
console
.
info
(
'
TC_027 createPixelMap failed
'
);
expect
(
false
).
assertTrue
()
done
();
}
pixelmap
.
release
().
then
(()
=>
{
console
.
info
(
'
TC_027 success
'
);
expect
(
true
).
assertTrue
();
done
();
}).
catch
(
error
=>
{
console
.
log
(
'
TC_027 error:
'
+
error
);
expect
().
assertFail
();
done
();
})
}).
catch
(
error
=>
{
console
.
log
(
'
TC_027 createPixelMap failed error:
'
+
error
);
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number : TC_027-1
* @tc.name : release-pixelmap-callback
* @tc.desc : 1.create PixelMap
* 2.set Pixel
* 3.call release
* 4.return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_027-1
'
,
0
,
async
function
(
done
)
{
const
color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
,
(
err
,
pixelmap
)
=>
{
globalpixelmap
=
pixelmap
;
if
(
pixelmap
==
undefined
)
{
console
.
info
(
'
TC_027-1 createPixelMap failed
'
);
expect
(
false
).
assertTrue
()
done
();
}
pixelmap
.
release
(()
=>
{
expect
(
true
).
assertTrue
();
console
.
log
(
'
TC_027-1 success
'
);
done
();
})
})
})
...
...
@@ -1669,5 +2819,119 @@ export default function imageJsTest() {
}
})
})
/**
* @tc.number : editable_001
* @tc.name : create pixelmap-callback (editable: true, pixelFormat: ARGB_8888,
* size: { height: 4, width: 6 },bytes = buffer)
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixelFormat,size
* 3.using color and opts create newPixelMap
* 4.return newpixelmap not empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
editable_001
'
,
0
,
async
function
(
done
)
{
const
Color
=
new
ArrayBuffer
(
96
);
let
edit
=
true
;
let
opts
=
{
editable
:
true
,
pixelFormat
:
1
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
Color
,
opts
,
(
err
,
pixelmap
)
=>
{
expect
(
pixelmap
!=
undefined
).
assertTrue
();
console
.
info
(
'
editable_001 editable:
'
+
pixelmap
.
isEditable
);
expect
(
pixelmap
.
isEditable
==
opts
.
editable
).
assertTrue
();
console
.
info
(
'
editable_001 edit:
'
+
edit
);
expect
(
pixelmap
.
isEditable
==
edit
).
assertTrue
();
done
();
})
})
/**
* @tc.number : editable_002
* @tc.name : create pixelmap-callback (editable: false, pixelFormat: ARGB_8888,
* size: { height: 4, width: 6 },bytes = buffer)
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixelFormat,size
* 3.using color and opts create newPixelMap
* 4.return newpixelmap not empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
editable_002
'
,
0
,
async
function
(
done
)
{
const
Color
=
new
ArrayBuffer
(
96
);
let
edit
=
false
;
let
opts
=
{
editable
:
false
,
pixelFormat
:
1
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
Color
,
opts
,
(
err
,
pixelmap
)
=>
{
expect
(
pixelmap
!=
undefined
).
assertTrue
();
console
.
info
(
'
editable_002 editable:
'
+
pixelmap
.
isEditable
);
expect
(
pixelmap
.
isEditable
==
opts
.
editable
).
assertTrue
();
console
.
info
(
'
editable_002 edit:
'
+
edit
);
expect
(
pixelmap
.
isEditable
==
edit
).
assertTrue
();
done
();
})
})
/**
* @tc.number : editable_003
* @tc.name : create pixelmap-promise (editable: true, pixelFormat: RGB_565,
* size: { height: 4, width: 6 }, bytes = buffer)
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixeFormat,size
* 3.using color and opts create newPixelMap
* 4.return newpixelmap not empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
editable_003
'
,
0
,
async
function
(
done
)
{
const
Color
=
new
ArrayBuffer
(
96
);
let
edit
=
true
;
let
opts
=
{
editable
:
true
,
pixelFormat
:
2
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
Color
,
opts
)
.
then
(
pixelmap
=>
{
console
.
info
(
'
editable_003 editable:
'
+
pixelmap
.
isEditable
);
expect
(
pixelmap
!=
undefined
).
assertTrue
();
expect
(
pixelmap
.
isEditable
==
opts
.
editable
).
assertTrue
();
expect
(
pixelmap
.
isEditable
==
edit
).
assertTrue
();
done
();
})
.
catch
(
error
=>
{
console
.
log
(
'
editable_003 err
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
})
})
/**
* @tc.number : editable_004
* @tc.name : create pixelmap-promise (editable: false, pixelFormat: RGB_565,
* size: { height: 4, width: 6 }, bytes = buffer)
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixeFormat,size
* 3.using color and opts create newPixelMap
* 4.return newpixelmap not empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
editable_004
'
,
0
,
async
function
(
done
)
{
const
Color
=
new
ArrayBuffer
(
96
);
let
edit
=
false
;
let
opts
=
{
editable
:
false
,
pixelFormat
:
2
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
Color
,
opts
)
.
then
(
pixelmap
=>
{
console
.
info
(
'
editable_004 editable:
'
+
pixelmap
.
isEditable
);
expect
(
pixelmap
!=
undefined
).
assertTrue
();
expect
(
pixelmap
.
isEditable
==
opts
.
editable
).
assertTrue
();
expect
(
pixelmap
.
isEditable
==
edit
).
assertTrue
();
done
();
})
.
catch
(
error
=>
{
console
.
log
(
'
editable_004 err
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
})
})
})
}
multimedia/image/image_js_standard/image/src/main/js/test/testImg.js
浏览文件 @
53660364
...
...
@@ -607,4 +607,14 @@ let testJpg = new Uint8Array([255, 216, 255, 224, 0, 16, 74, 70, 73, 70, 0, 1, 1
2
,
138
,
40
,
160
,
2
,
138
,
40
,
160
,
2
,
138
,
40
,
160
,
2
,
138
,
40
,
160
,
2
,
138
,
40
,
160
,
2
,
138
,
40
,
160
,
2
,
138
,
40
,
160
,
2
,
138
,
40
,
160
,
2
,
138
,
40
,
160
,
2
,
138
,
40
,
160
,
2
,
138
,
40
,
160
,
2
,
138
,
40
,
160
,
2
,
138
,
40
,
160
,
2
,
138
,
40
,
160
,
2
,
138
,
40
,
160
,
15
,
255
,
217
])
export
{
testPng
,
testJpg
}
\ No newline at end of file
let
tc_020Buf
=
new
Uint8Array
([
0
,
0
,
0
,
4
,
0
,
0
,
0
,
8
,
1
,
0
,
0
,
12
,
1
,
1
,
1
,
16
,
1
,
1
,
1
,
20
,
2
,
2
,
2
,
24
,
3
,
3
,
3
,
28
,
4
,
4
,
4
,
32
,
5
,
5
,
5
,
36
,
6
,
6
,
6
,
40
,
7
,
7
,
7
,
44
,
9
,
9
,
8
,
48
,
10
,
10
,
10
,
52
,
12
,
12
,
12
,
56
,
14
,
14
,
13
,
60
,
16
,
16
,
15
,
64
,
18
,
18
,
17
,
68
,
20
,
20
,
19
,
72
,
22
,
22
,
22
,
76
,
25
,
24
,
24
,
80
,
27
,
27
,
27
,
84
,
30
,
30
,
29
,
88
,
33
,
32
,
32
,
92
,
36
,
35
,
35
,
96
])
let
tc_020_1Buf
=
new
Uint8Array
([
0
,
0
,
0
,
4
,
0
,
0
,
0
,
8
,
1
,
0
,
0
,
12
,
1
,
1
,
1
,
16
,
1
,
1
,
1
,
20
,
2
,
2
,
2
,
24
,
3
,
3
,
3
,
28
,
4
,
4
,
4
,
32
,
5
,
5
,
5
,
36
,
6
,
6
,
6
,
40
,
7
,
7
,
7
,
44
,
9
,
9
,
8
,
48
,
10
,
10
,
10
,
52
,
12
,
12
,
12
,
56
,
14
,
14
,
13
,
60
,
16
,
16
,
15
,
64
,
18
,
18
,
17
,
68
,
20
,
20
,
19
,
72
,
22
,
22
,
22
,
76
,
25
,
24
,
24
,
80
,
27
,
27
,
27
,
84
,
30
,
30
,
29
,
88
,
33
,
32
,
32
,
92
,
36
,
35
,
35
,
96
])
let
tc_021Buf
=
new
Uint8Array
([
0
,
0
,
0
,
4
,
0
,
0
,
0
,
8
])
let
tc_021_1Buf
=
new
Uint8Array
([
0
,
0
,
0
,
4
,
0
,
0
,
0
,
8
])
let
tc_022Buf
=
new
Uint8Array
([
0
,
0
,
0
,
4
,
0
,
0
,
0
,
8
])
export
{
testPng
,
testJpg
,
tc_020Buf
,
tc_020_1Buf
,
tc_021Buf
,
tc_021_1Buf
,
tc_022Buf
}
\ No newline at end of file
multimedia/image/image_js_standard/imageColorspace/Test.json
浏览文件 @
53660364
...
...
@@ -15,6 +15,14 @@
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
},
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"hilog -Q pidoff"
,
"hilog -b D"
],
"teardown-command"
:
[]
}
]
}
\ No newline at end of file
multimedia/image/image_js_standard/imageDecodeOptions/Test.json
浏览文件 @
53660364
...
...
@@ -36,6 +36,14 @@
"./resource/image/test.jpg ->/data/app/el2/100/base/ohos.acts.multimedia.image.DecodeOptions/haps/entry/files"
,
"./resource/image/moving_test.gif ->/data/app/el2/100/base/ohos.acts.multimedia.image.DecodeOptions/haps/entry/files"
]
},
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"hilog -Q pidoff"
,
"hilog -b D"
],
"teardown-command"
:
[]
}
]
}
\ No newline at end of file
multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/test/image.test.js
浏览文件 @
53660364
...
...
@@ -62,448 +62,7 @@ export default function imageDecodeOptions() {
afterAll
(
async
function
()
{
console
.
info
(
'
afterAll case
'
);
})
/**
* @tc.number : TC_062
* @tc.name : packing ImageSource - promise
* @tc.desc : 1.create ImageSource
* 2.call packing
* 3.return array
* 4.callbackcall return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_062
'
,
0
,
async
function
(
done
)
{
try
{
await
getFd
(
'
test.png
'
);
const
imageSourceApi
=
image
.
createImageSource
(
fdNumber
);
if
(
imageSourceApi
==
undefined
)
{
console
.
info
(
'
TC_062 create image source failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
const
imagePackerApi
=
image
.
createImagePacker
();
if
(
imagePackerApi
==
undefined
)
{
console
.
info
(
'
TC_062 create image packer failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
let
packOpts
=
{
format
:
"
image/jpeg
"
,
quality
:
99
}
imagePackerApi
.
packing
(
imageSourceApi
,
packOpts
)
.
then
(
data
=>
{
console
.
info
(
'
TC_062 success
'
);
expect
(
data
!=
undefined
).
assertTrue
();
done
();
}).
catch
(
error
=>
{
console
.
log
(
'
TC_062 error:
'
+
error
);
expect
(
false
).
assertFail
();
done
();
})
}
}
}
catch
(
error
)
{
console
.
info
(
'
TC_062 error:
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
})
/**
* @tc.number : TC_062-1
* @tc.name : packing ImageSource - callback
* @tc.desc : 1.create ImageSource
* 2.call packing
* 3.return array
* 4.callbackcall return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_062-1
'
,
0
,
async
function
(
done
)
{
try
{
await
getFd
(
'
test.png
'
);
const
imageSourceApi
=
image
.
createImageSource
(
fdNumber
);
if
(
imageSourceApi
==
undefined
)
{
console
.
info
(
'
TC_062-1 create image source failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
const
imagePackerApi
=
image
.
createImagePacker
();
if
(
imagePackerApi
==
undefined
)
{
console
.
info
(
'
TC_062-1 create image packer failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
let
packOpts
=
{
format
:
"
image/jpeg
"
,
quality
:
1
}
imagePackerApi
.
packing
(
imageSourceApi
,
packOpts
,
(
err
,
data
)
=>
{
console
.
info
(
'
TC_062-1 success
'
+
JSON
.
stringify
(
data
));
expect
(
data
!=
undefined
).
assertTrue
();
done
();
})
}
}
}
catch
(
error
)
{
console
.
info
(
'
TC_062-1 error:
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
})
/**
* @tc.number : TC_062-2
* @tc.name : packing ImageSource - callback - wrong format
* @tc.desc : 1.create ImageSource
* 2.call packing
* 3.return array
* 4.callbackcall return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_062-2
'
,
0
,
async
function
(
done
)
{
try
{
await
getFd
(
'
test.png
'
);
const
imageSourceApi
=
image
.
createImageSource
(
fdNumber
);
if
(
imageSourceApi
==
undefined
)
{
console
.
info
(
'
TC_062-2 create image source failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
const
imagePackerApi
=
image
.
createImagePacker
();
if
(
imagePackerApi
==
undefined
)
{
console
.
info
(
'
TC_062-2 create image packer failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
let
packOpts
=
{
format
:
"
image/gif
"
,
quality
:
98
}
imagePackerApi
.
packing
(
imageSourceApi
,
packOpts
,
(
err
,
data
)
=>
{
console
.
info
(
'
TC_062-2 success
'
);
expect
(
data
==
undefined
).
assertTrue
();
console
.
info
(
data
);
done
();
})
}
}
}
catch
(
error
)
{
console
.
info
(
'
TC_062-2 error:
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
})
/**
* @tc.number : TC_062-3
* @tc.name : packing ImageSource - callback - wrong quality
* @tc.desc : 1.create ImageSource
* 2.call packing
* 3.call return array
* 4.callbackcall return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_062-3
'
,
0
,
async
function
(
done
)
{
try
{
await
getFd
(
'
test.png
'
);
const
imageSourceApi
=
image
.
createImageSource
(
fdNumber
);
if
(
imageSourceApi
==
undefined
)
{
console
.
info
(
'
TC_062-3 create image source failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
const
imagePackerApi
=
image
.
createImagePacker
();
if
(
imagePackerApi
==
undefined
)
{
console
.
info
(
'
TC_062-3 create image packer failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
let
packOpts
=
{
format
:
"
image/jpeg
"
,
quality
:
101
}
imagePackerApi
.
packing
(
imageSourceApi
,
packOpts
,
(
err
,
data
)
=>
{
console
.
info
(
'
TC_062-3 success
'
);
expect
(
data
==
undefined
).
assertTrue
();
console
.
info
(
data
);
done
();
})
}
}
}
catch
(
error
)
{
console
.
info
(
'
TC_062-3 error:
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
})
/**
* @tc.number : TC_062-4
* @tc.name : createImagePacker
* @tc.desc : 1.create ImageSource
* 2.call packing
* 3.return array
* 4.callbackcall return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_062-4
'
,
0
,
async
function
(
done
)
{
try
{
await
getFd
(
'
test.png
'
);
const
imageSourceApi
=
image
.
createImageSource
(
fdNumber
);
if
(
imageSourceApi
==
undefined
)
{
console
.
info
(
'
TC_062-4 create image source failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
const
imagePackerApi
=
image
.
createImagePacker
();
if
(
imagePackerApi
==
undefined
)
{
console
.
info
(
'
TC_062-4 create image packer failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
console
.
info
(
'
TC_062-4 create image packer success
'
);
expect
(
true
).
assertTrue
();
done
();
}
}
}
catch
(
error
)
{
console
.
info
(
'
TC_062-4 error:
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
})
/**
* @tc.number : TC_062-5
* @tc.name : packing ImageSource - promise - no quality
* @tc.desc : 1.create ImageSource
* 2.call packing
* 3.call return array
* 4.callbackcall return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_062-5
'
,
0
,
async
function
(
done
)
{
try
{
await
getFd
(
'
test.png
'
);
const
imageSourceApi
=
image
.
createImageSource
(
fdNumber
);
if
(
imageSourceApi
==
undefined
)
{
console
.
info
(
'
TC_062-5 create image source failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
const
imagePackerApi
=
image
.
createImagePacker
();
if
(
imagePackerApi
==
undefined
)
{
console
.
info
(
'
TC_062-5 create image packer failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
let
packOpts
=
{
format
:
"
image/jpeg
"
}
imagePackerApi
.
packing
(
imageSourceApi
,
packOpts
)
.
then
(
data
=>
{
console
.
info
(
'
TC_062-5 failed
'
);
expect
(
data
==
undefined
).
assertTrue
();
done
();
}).
catch
(
error
=>
{
console
.
log
(
'
TC_062-5 error:
'
+
error
);
console
.
log
(
'
TC_062-5 success
'
);
expect
(
true
).
assertTrue
();
done
();
})
}
}
}
catch
(
error
)
{
console
.
info
(
'
TC_062-5 error:
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
})
/**
* @tc.number : TC_062-6
* @tc.name : packing ImageSource - promise - no format
* @tc.desc : 1.create ImageSource
* 2.call packing
* 3.call return array
* 4.callbackcall return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_062-6
'
,
0
,
async
function
(
done
)
{
try
{
await
getFd
(
'
test.png
'
);
const
imageSourceApi
=
image
.
createImageSource
(
fdNumber
);
if
(
imageSourceApi
==
undefined
)
{
console
.
info
(
'
TC_062-6 create image source failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
const
imagePackerApi
=
image
.
createImagePacker
();
if
(
imagePackerApi
==
undefined
)
{
console
.
info
(
'
TC_062-6 create image packer failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
let
packOpts
=
{
quality
:
50
}
imagePackerApi
.
packing
(
imageSourceApi
,
packOpts
)
.
then
(
data
=>
{
console
.
info
(
'
TC_062-6 failed
'
);
expect
(
data
==
undefined
).
assertTrue
();
done
();
}).
catch
(
error
=>
{
console
.
log
(
'
TC_062-6 error:
'
+
error
);
console
.
log
(
'
TC_062-6 success
'
);
expect
(
true
).
assertTrue
();
done
();
})
}
}
}
catch
(
error
)
{
console
.
info
(
'
TC_062-6 error:
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
})
/**
* @tc.number : TC_062-7
* @tc.name : packing ImageSource - callback - quality 100
* @tc.desc : 1.create ImageSource
* 2.call packing
* 3.return array
* 4.callbackcall return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_062-7
'
,
0
,
async
function
(
done
)
{
try
{
await
getFd
(
'
test.png
'
);
const
imageSourceApi
=
image
.
createImageSource
(
fdNumber
);
if
(
imageSourceApi
==
undefined
)
{
console
.
info
(
'
TC_062-7 create image source failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
const
imagePackerApi
=
image
.
createImagePacker
();
if
(
imagePackerApi
==
undefined
)
{
console
.
info
(
'
TC_062-7 create image packer failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
let
packOpts
=
{
format
:
"
image/jpeg
"
,
quality
:
100
}
imagePackerApi
.
packing
(
imageSourceApi
,
packOpts
,
(
err
,
data
)
=>
{
if
(
err
)
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
TC_062-7 error:
'
+
err
);
done
();
return
}
if
(
data
!=
undefined
)
{
console
.
info
(
'
TC_062-7 success
'
);
expect
(
true
).
assertTrue
();
done
();
}
else
{
except
(
false
).
assertTrue
();
console
.
info
(
'
TC_062-7 failed
'
);
done
();
}
})
}
}
}
catch
(
error
)
{
console
.
info
(
'
TC_062-7 error:
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
})
/**
* @tc.number : TC_062-8
* @tc.name : packing ImageSource - callback - quality 0
* @tc.desc : 1.create ImageSource
* 2.call packing
* 3.return array
* 4.callbackcall return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_062-8
'
,
0
,
async
function
(
done
)
{
try
{
await
getFd
(
'
test.png
'
);
const
imageSourceApi
=
image
.
createImageSource
(
fdNumber
);
if
(
imageSourceApi
==
undefined
)
{
console
.
info
(
'
TC_062-8 create image source failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
const
imagePackerApi
=
image
.
createImagePacker
();
if
(
imagePackerApi
==
undefined
)
{
console
.
info
(
'
TC_062-8 create image packer failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
let
packOpts
=
{
format
:
"
image/jpeg
"
,
quality
:
0
}
imagePackerApi
.
packing
(
imageSourceApi
,
packOpts
,
(
err
,
data
)
=>
{
console
.
info
(
'
TC_062-8 success
'
);
expect
(
data
!=
undefined
).
assertTrue
();
done
();
})
}
}
}
catch
(
error
)
{
console
.
info
(
'
TC_062-8 error:
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
})
/**
* @tc.number : TC_062-9
* @tc.name : packing ImageSource - callback - quality -1
* @tc.desc : 1.create ImageSource
* 2.call packing
* 3.return array
* 4.callbackcall return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_062-9
'
,
0
,
async
function
(
done
)
{
try
{
await
getFd
(
'
test.png
'
);
const
imageSourceApi
=
image
.
createImageSource
(
fdNumber
);
if
(
imageSourceApi
==
undefined
)
{
console
.
info
(
'
TC_062-9 create image source failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
const
imagePackerApi
=
image
.
createImagePacker
();
if
(
imagePackerApi
==
undefined
)
{
console
.
info
(
'
TC_062-9 create image packer failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
let
packOpts
=
{
format
:
"
image/jpeg
"
,
quality
:
-
1
}
imagePackerApi
.
packing
(
imageSourceApi
,
packOpts
,
(
err
,
data
)
=>
{
console
.
info
(
'
TC_062-9 success
'
);
expect
(
data
==
undefined
).
assertTrue
();
done
();
})
}
}
}
catch
(
error
)
{
console
.
info
(
'
TC_062-9 error:
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
})
/**
* @tc.number : TC_063
* @tc.name : release ImagePacker - promise
...
...
multimedia/image/image_js_standard/imageExif/Test.json
浏览文件 @
53660364
...
...
@@ -32,6 +32,14 @@
"./resource/image/test_exif.jpg ->/data/app/el2/100/base/ohos.acts.multimedia.image.Exif/haps/entry/files"
,
"./resource/image/test_exif1.jpg ->/data/app/el2/100/base/ohos.acts.multimedia.image.Exif/haps/entry/files"
]
},
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"hilog -Q pidoff"
,
"hilog -b D"
],
"teardown-command"
:
[]
}
]
...
...
multimedia/image/image_js_standard/imageExif/src/main/js/test/List.test.js
浏览文件 @
53660364
...
...
@@ -14,4 +14,3 @@
*/
require
(
'
./image.test.js
'
)
require
(
'
./addImage.test.js
'
)
multimedia/image/image_js_standard/imageExif/src/main/js/test/addImage.test.js
已删除
100755 → 0
浏览文件 @
0045d8c2
/*
* Copyright (C) 2022 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
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
{
testPng
}
from
'
../../../../../image/src/main/js/test/testImg
'
describe
(
'
addImage
'
,
function
()
{
beforeAll
(
async
function
()
{
console
.
info
(
'
beforeAll case
'
);
})
beforeEach
(
function
()
{
console
.
info
(
'
beforeEach case
'
);
})
afterEach
(
async
function
()
{
console
.
info
(
'
afterEach case
'
);
})
afterAll
(
async
function
()
{
console
.
info
(
'
afterAll case
'
);
})
function
createPixMapPromise
(
done
,
testNum
,
opts
)
{
const
Color
=
new
ArrayBuffer
(
96
);
image
.
createPixelMap
(
Color
,
opts
)
.
then
(
pixelmap
=>
{
expect
(
pixelmap
!=
undefined
).
assertTrue
();
console
.
info
(
`
${
testNum
}
success`
);
done
();
})
.
catch
(
error
=>
{
console
.
log
(
`
${
testNum
}
error: `
+
error
);
expect
(
false
).
assertTrue
();
done
();
})
}
function
createPixMapCb
(
done
,
testNum
,
opts
)
{
const
Color
=
new
ArrayBuffer
(
96
);
image
.
createPixelMap
(
Color
,
opts
,
(
err
,
pixelmap
)
=>
{
expect
(
pixelmap
!=
undefined
).
assertTrue
();
console
.
info
(
`
${
testNum
}
success`
);
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)
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixeFormat,size
* 3.using color and opts create newPixelMap
* 4.return newpixelmap not empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
add_01_001
'
,
0
,
async
function
(
done
)
{
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
},
scaleMode
:
1
,
alphaType
:
0
}
createPixMapPromise
(
done
,
'
add_01_001
'
,
opts
);
})
/**
* @tc.number : add_01_002
* @tc.name : create pixelmap-promise (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer,scaleMode: 1, alphaType: 1)
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixeFormat,size
* 3.using color and opts create newPixelMap
* 4.return newpixelmap not empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
add_01_002
'
,
0
,
async
function
(
done
)
{
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
},
scaleMode
:
1
,
alphaType
:
1
}
createPixMapPromise
(
done
,
'
add_01_002
'
,
opts
);
})
/**
* @tc.number : add_01_003
* @tc.name : create pixelmap-promise (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer,scaleMode: 0, alphaType: 2)
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixeFormat,size
* 3.using color and opts create newPixelMap
* 4.return newpixelmap not empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
add_01_003
'
,
0
,
async
function
(
done
)
{
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
},
scaleMode
:
0
,
alphaType
:
2
}
createPixMapPromise
(
done
,
'
add_01_003
'
,
opts
);
})
/**
* @tc.number : add_01_004
* @tc.name : create pixelmap-promise (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer,scaleMode: 0, alphaType: 3)
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixeFormat,size
* 3.using color and opts create newPixelMap
* 4.return newpixelmap not empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
add_01_004
'
,
0
,
async
function
(
done
)
{
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
},
scaleMode
:
0
,
alphaType
:
3
}
createPixMapPromise
(
done
,
'
add_01_004
'
,
opts
);
})
/**
* @tc.number : add_02_001
* @tc.name : create pixelmap-callback (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer,scaleMode: 0, alphaType: 0)
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixeFormat,size
* 3.using color and opts create newPixelMap
* 4.return newpixelmap not empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
add_02_001
'
,
0
,
async
function
(
done
)
{
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
},
scaleMode
:
0
,
alphaType
:
0
}
createPixMapCb
(
done
,
'
add_02_001
'
,
opts
);
})
/**
* @tc.number : add_02_002
* @tc.name : create pixelmap-callback (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer,scaleMode: 0, alphaType: 1)
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixeFormat,size
* 3.using color and opts create newPixelMap
* 4.return newpixelmap not empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
add_02_002
'
,
0
,
async
function
(
done
)
{
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
},
scaleMode
:
0
,
alphaType
:
1
}
createPixMapCb
(
done
,
'
add_02_002
'
,
opts
);
})
/**
* @tc.number : add_02_003
* @tc.name : create pixelmap-callback (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer,scaleMode: 1, alphaType: 2)
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixeFormat,size
* 3.using color and opts create newPixelMap
* 4.return newpixelmap not empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
add_02_003
'
,
0
,
async
function
(
done
)
{
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
},
scaleMode
:
1
,
alphaType
:
2
}
createPixMapCb
(
done
,
'
add_02_003
'
,
opts
);
})
/**
* @tc.number : add_02_004
* @tc.name : create pixelmap-callback (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer,scaleMode: 1, alphaType: 3)
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixeFormat,size
* 3.using color and opts create newPixelMap
* 4.return newpixelmap not empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
add_02_004
'
,
0
,
async
function
(
done
)
{
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
},
scaleMode
:
1
,
alphaType
:
3
}
createPixMapCb
(
done
,
'
add_02_004
'
,
opts
);
})
/**
* @tc.number : add_053
* @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_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
);
}
})
/**
* @tc.number : add_053-1
* @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_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
);
}
})
})
\ No newline at end of file
multimedia/image/image_js_standard/imageExif/src/main/js/test/image.test.js
浏览文件 @
53660364
...
...
@@ -16,7 +16,6 @@
import
image
from
'
@ohos.multimedia.image
'
import
fileio
from
'
@ohos.fileio
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
{
tc_020Buf
,
tc_020_1Buf
,
tc_021Buf
,
tc_021_1Buf
,
tc_022Buf
}
from
'
./testImg
'
import
featureAbility
from
'
@ohos.ability.featureAbility
'
describe
(
'
imageExif
'
,
function
()
{
...
...
@@ -61,1156 +60,7 @@ describe('imageExif', function () {
afterAll
(
async
function
()
{
console
.
info
(
'
afterAll case
'
);
})
/**
* @tc.number : TC_001
* @tc.name : create pixelmap-promise (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer)
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixeFormat,size
* 3.using color and opts create newPixelMap
* 4.return newpixelmap not empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
TC_001
'
,
0
,
async
function
(
done
)
{
const
Color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
Color
,
opts
)
.
then
(
pixelmap
=>
{
globalpixelmap
=
pixelmap
;
expect
(
pixelmap
!=
undefined
).
assertTrue
();
console
.
info
(
'
TC_001 success
'
);
done
();
})
.
catch
(
error
=>
{
console
.
log
(
'
TC_001 error:
'
+
error
);
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number : TC_001-1
* @tc.name : create pixelmap-callback (editable: false, pixelFormat: RGBA_8888, size: { height: 4, width: 6 },bytes = buffer)
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixelFormat,size
* 3.using colorand opts create newPixelMap
* 4.return newpixelmap not empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
TC_001-1
'
,
0
,
async
function
(
done
)
{
const
Color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
false
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
Color
,
opts
,
(
err
,
pixelmap
)
=>
{
globalpixelmap
=
pixelmap
;
expect
(
pixelmap
!=
undefined
).
assertTrue
();
console
.
info
(
'
TC_001-1 success
'
);
done
();
})
})
/**
* @tc.number : TC_001-2
* @tc.name : createpixelmap-promise (editable: true, pixelFormat: RGB_565, size: { height: 6, width: 8 },bytes = buffer)
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixelFormat,size
* 3.using colorand opts create newPixelMap
* 4.return newpixelmap not empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
TC_001-2
'
,
0
,
async
function
(
done
)
{
const
Color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
2
,
size
:
{
height
:
6
,
width
:
8
}
}
image
.
createPixelMap
(
Color
,
opts
)
.
then
(
pixelmap
=>
{
globalpixelmap
=
pixelmap
;
expect
(
pixelmap
!=
undefined
).
assertTrue
();
console
.
info
(
'
TC_001-2 success
'
);
done
();
})
.
catch
(
error
=>
{
console
.
log
(
'
TC_001-2 error:
'
+
error
);
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number : TC_001-3
* @tc.name : createpixelmap-callback (editable: false, pixelFormat: RGB_565, size: { height: 6, width: 8 },bytes = buffer)
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixelFormat,size
* 3.using colorand opts create newPixelMap
* 4.return newpixelmap not empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
TC_001-3
'
,
0
,
async
function
(
done
)
{
const
Color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
false
,
pixelFormat
:
2
,
size
:
{
height
:
6
,
width
:
8
}
}
image
.
createPixelMap
(
Color
,
opts
,
(
err
,
pixelmap
)
=>
{
globalpixelmap
=
pixelmap
;
expect
(
pixelmap
!=
undefined
).
assertTrue
();
console
.
info
(
'
TC_001-3 success
'
);
done
();
})
})
/**
* @tc.number : TC_001-4
* @tc.name : createpixelmap-promise(editable: true, pixelFormat: unkonwn, size: { height: 6, width: 8 })
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixelFormat,size
* 3.using colorand opts create newPixelMap
* 4.return newpixelmap not empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
TC_001-4
'
,
0
,
async
function
(
done
)
{
const
Color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
0
,
size
:
{
height
:
6
,
width
:
8
}
}
image
.
createPixelMap
(
Color
,
opts
)
.
then
(
pixelmap
=>
{
globalpixelmap
=
pixelmap
;
expect
(
pixelmap
!=
undefined
).
assertTrue
();
console
.
info
(
'
TC_001-4 success
'
);
done
();
})
.
catch
(
error
=>
{
console
.
log
(
'
TC_001-4 error:
'
+
error
);
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number : TC_001-5
* @tc.name : create pixelmap-callback(editable: false, pixelFormat: unkonwn, size: { height: 6, width: 8 })
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixelFormat,size
* 3.using colorand opts create newPixelMap
* 4.return newpixelmap not empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
TC_001-5
'
,
0
,
async
function
(
done
)
{
const
Color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
false
,
pixelFormat
:
0
,
size
:
{
height
:
6
,
width
:
8
}
}
image
.
createPixelMap
(
Color
,
opts
,
(
err
,
pixelmap
)
=>
{
globalpixelmap
=
pixelmap
;
expect
(
pixelmap
!=
undefined
).
assertTrue
();
console
.
info
(
'
TC_001-5 success
'
);
done
();
})
})
/**
* @tc.number : TC_001-6
* @tc.name : create pixelmap-callback(editable: true, pixelFormat: RGBA_8888, size: { height: 6, width: 8 } bytes > buffer )
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixeFormat,size
* 3.using color and opts create newPixelMap
* 4.return newpixelmap not empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
TC_001-6
'
,
0
,
async
function
(
done
)
{
const
Color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
6
,
width
:
8
}
}
image
.
createPixelMap
(
Color
,
opts
,
(
err
,
pixelmap
)
=>
{
globalpixelmap
=
pixelmap
;
expect
(
pixelmap
!=
undefined
).
assertTrue
();
console
.
info
(
'
TC_001-6 success
'
);
done
();
})
})
/**
* @tc.number : TC_001-7
* @tc.name : create pixelmap-callback(editable: true, pixelFormat: RGB_565, size: { height: 2, width: 3 }, bytes < buffer)
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixeFormat,size
* 3.using color and opts create newPixelMap
* 4.return newpixelmap not empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
TC_001-7
'
,
0
,
async
function
(
done
)
{
const
Color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
2
,
size
:
{
height
:
2
,
width
:
3
}
}
image
.
createPixelMap
(
Color
,
opts
,
(
err
,
pixelmap
)
=>
{
globalpixelmap
=
pixelmap
;
expect
(
pixelmap
!=
undefined
).
assertTrue
();
console
.
info
(
'
TC_001-7 success
'
);
done
();
})
})
/**
* @tc.number : TC_001-8
* @tc.name : create pixelmap-callback(editable: true, pixelFormat: unkonwn, size: { height: -1, width: -1 })
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixeFormat,size
* 3.using color and opts create newPixelMap
* 4.return newpixelmap empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
TC_001-8
'
,
0
,
async
function
(
done
)
{
const
Color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
0
,
size
:
{
height
:
-
1
,
width
:
-
1
}
}
image
.
createPixelMap
(
Color
,
opts
,
(
err
,
pixelmap
)
=>
{
globalpixelmap
=
pixelmap
;
expect
(
pixelmap
==
undefined
).
assertTrue
();
console
.
info
(
'
TC_001-8 success
'
);
done
();
})
})
/**
* @tc.number : TC_001-9
* @tc.name : create pixelmap-callback(editable: true, pixelFormat: unsupported format, size: { height: 6, width: 8 })
* @tc.desc : 1.create InitializationOptions object
* 2.set editable,pixeFormat,size(Unsupported formats are converted to RGBA_8888)
* 3.using color and opts create newPixelMap
* 4.return newpixelmap empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
TC_001-9
'
,
0
,
async
function
(
done
)
{
const
Color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
21
,
size
:
{
height
:
6
,
width
:
8
}
}
image
.
createPixelMap
(
Color
,
opts
,
(
err
,
pixelmap
)
=>
{
globalpixelmap
=
pixelmap
;
expect
(
pixelmap
!=
undefined
).
assertTrue
();
console
.
info
(
'
TC_001-9 success
'
);
done
();
})
})
/**
* @tc.number : TC_020
* @tc.name : readPixelsToBuffer-promise
* @tc.desc : read all pixels to an buffer
* 1.create PixelMap,buffer
* 2.call readPixelsToBuffer
* 3.return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_020
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
TC_020 in
'
);
const
color
=
new
ArrayBuffer
(
96
);
var
bufferArr
=
new
Uint8Array
(
color
);
for
(
var
i
=
0
;
i
<
bufferArr
.
length
;
i
++
)
{
bufferArr
[
i
]
=
i
+
1
;
}
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
)
.
then
(
pixelmap
=>
{
globalpixelmap
=
pixelmap
;
if
(
pixelmap
==
undefined
)
{
console
.
info
(
'
TC_020 createPixelMap failed
'
);
expect
(
false
).
assertTrue
()
done
();
}
const
readBuffer
=
new
ArrayBuffer
(
96
);
pixelmap
.
readPixelsToBuffer
(
readBuffer
).
then
(()
=>
{
var
bufferArr2
=
new
Uint8Array
(
readBuffer
);
var
res
=
true
;
for
(
var
i
=
0
;
i
<
bufferArr2
.
length
;
i
++
)
{
if
(
bufferArr2
[
i
]
!=
tc_020Buf
[
i
])
{
res
=
false
;
console
.
info
(
'
TC_20_buffer
'
+
bufferArr2
[
i
]);
console
.
info
(
'
TC_020 failed
'
);
expect
(
false
).
assertTrue
();
done
();
break
;
}
}
if
(
res
)
{
console
.
info
(
'
TC_020 success
'
);
expect
(
true
).
assertTrue
()
done
();
}
}).
catch
(
error
=>
{
console
.
log
(
'
TC_020 read error:
'
+
error
);
expect
().
assertFail
();
done
();
})
}).
catch
(
error
=>
{
console
.
log
(
'
TC_020 error:
'
+
error
);
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number : TC_020-1
* @tc.name : readPixelsToBuffer-callback
* @tc.desc : read all pixels to an buffer
* 1.create PixelMap,buffer
* 2.call readPixelsToBuffer
* 3.return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_020-1
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
TC_020-1 in
'
);
const
color
=
new
ArrayBuffer
(
96
);
var
bufferArr
=
new
Uint8Array
(
color
);
for
(
var
i
=
0
;
i
<
bufferArr
.
length
;
i
++
)
{
bufferArr
[
i
]
=
i
+
1
;
}
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
,
(
err
,
pixelmap
)
=>
{
globalpixelmap
=
pixelmap
;
if
(
pixelmap
==
undefined
)
{
console
.
info
(
'
TC_020-1 createPixelMap failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
const
readBuffer
=
new
ArrayBuffer
(
96
);
pixelmap
.
readPixelsToBuffer
(
readBuffer
,
()
=>
{
var
bufferArr
=
new
Uint8Array
(
readBuffer
);
var
res
=
true
;
for
(
var
i
=
0
;
i
<
bufferArr
.
length
;
i
++
)
{
if
(
bufferArr
[
i
]
!=
tc_020_1Buf
[
i
])
{
res
=
false
;
console
.
info
(
'
TC_020-1 failed
'
);
expect
(
false
).
assertTrue
();
done
();
break
;
}
}
if
(
res
)
{
console
.
info
(
'
TC_020-1 success
'
);
expect
(
true
).
assertTrue
()
done
();
}
})
}
})
})
/**
* @tc.number : TC_020-2
* @tc.name : readPixelsToBuffer-callback(buffer:0)
* @tc.desc : read all pixels to an buffer
* 1.create PixelMap,buffer
* 2.call readPixelsToBuffer
* 3.return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_020-2
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
TC_020-2 in
'
);
const
color
=
new
ArrayBuffer
(
96
);
var
bufferArr
=
new
Uint8Array
(
color
);
for
(
var
i
=
0
;
i
<
bufferArr
.
length
;
i
++
)
{
bufferArr
[
i
]
=
i
+
1
;
}
let
opts
=
{
editable
:
true
,
pixelFormat
:
2
,
size
:
{
height
:
6
,
width
:
8
}
}
image
.
createPixelMap
(
color
,
opts
,
(
err
,
pixelmap
)
=>
{
globalpixelmap
=
pixelmap
;
if
(
pixelmap
==
undefined
)
{
console
.
info
(
'
TC_020-2 createPixelMap failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
const
readBuffer
=
new
ArrayBuffer
(
0
);
pixelmap
.
readPixelsToBuffer
(
readBuffer
,
()
=>
{
var
bufferArr
=
new
Uint8Array
(
readBuffer
);
var
res
=
true
;
for
(
var
i
=
0
;
i
<
bufferArr
.
length
;
i
++
)
{
if
(
bufferArr
[
i
]
==
0
)
{
res
=
false
;
console
.
info
(
'
TC_020-2 failed
'
);
expect
(
false
).
assertTrue
();
done
();
break
;
}
}
if
(
res
)
{
console
.
info
(
'
TC_020-2 success
'
);
expect
(
true
).
assertTrue
()
done
();
}
})
}
})
})
/**
* @tc.number : TC_021
* @tc.name : readPixels-promise
* @tc.desc : 1.create PixelMap
* 2.call readPixels
* 3.promise return array
* 4.callbackcall return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_021
'
,
0
,
async
function
(
done
)
{
const
color
=
new
ArrayBuffer
(
96
);
var
bufferArr
=
new
Uint8Array
(
color
);
for
(
var
i
=
0
;
i
<
bufferArr
.
length
;
i
++
)
{
bufferArr
[
i
]
=
i
+
1
;
}
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
)
.
then
(
pixelmap
=>
{
globalpixelmap
=
pixelmap
;
if
(
pixelmap
==
undefined
)
{
console
.
info
(
'
TC_021 createPixelMap failed
'
);
expect
(
false
).
assertTrue
()
done
();
}
const
area
=
{
pixels
:
new
ArrayBuffer
(
8
),
offset
:
0
,
stride
:
8
,
region
:
{
size
:
{
height
:
1
,
width
:
2
},
x
:
0
,
y
:
0
}
}
pixelmap
.
readPixels
(
area
).
then
(()
=>
{
var
bufferArr2
=
new
Uint8Array
(
area
.
pixels
);
var
res
=
true
;
for
(
var
i
=
0
;
i
<
bufferArr2
.
length
;
i
++
)
{
if
(
bufferArr2
[
i
]
!=
tc_021Buf
[
i
])
{
res
=
false
;
console
.
info
(
'
TC_021 failed
'
);
expect
(
false
).
assertTrue
();
done
();
break
;
}
}
if
(
res
)
{
console
.
info
(
'
TC_021 success
'
);
expect
(
true
).
assertTrue
()
done
();
}
})
})
.
catch
(
error
=>
{
console
.
log
(
'
TC_021 error:
'
+
error
);
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number : TC_021-1
* @tc.name : readPixels-callback
* @tc.desc : 1.create PixelMap
* 2.call readPixels
* 3.promise return array
* 4.callbackcall return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_021-1
'
,
0
,
async
function
(
done
)
{
const
color
=
new
ArrayBuffer
(
96
);
var
bufferArr
=
new
Uint8Array
(
color
);
for
(
var
i
=
0
;
i
<
bufferArr
.
length
;
i
++
)
{
bufferArr
[
i
]
=
i
+
1
;
}
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
,
(
err
,
pixelmap
)
=>
{
globalpixelmap
=
pixelmap
;
if
(
pixelmap
==
undefined
)
{
console
.
info
(
'
TC_020-1 createPixelMap failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
const
area
=
{
pixels
:
new
ArrayBuffer
(
8
),
offset
:
0
,
stride
:
8
,
region
:
{
size
:
{
height
:
1
,
width
:
2
},
x
:
0
,
y
:
0
}
}
pixelmap
.
readPixels
(
area
,
()
=>
{
var
bufferArr
=
new
Uint8Array
(
area
.
pixels
);
var
res
=
true
;
for
(
var
i
=
0
;
i
<
bufferArr
.
length
;
i
++
)
{
console
.
info
(
'
TC_021-1 buffer
'
+
bufferArr
[
i
]);
if
(
bufferArr
[
i
]
!=
tc_021_1Buf
[
i
])
{
res
=
false
;
console
.
info
(
'
TC_021-1 failed
'
);
expect
(
false
).
assertTrue
();
done
();
break
;
}
}
if
(
res
)
{
console
.
info
(
'
TC_021-1 success
'
);
expect
(
true
).
assertTrue
()
done
();
}
})
}
})
})
/**
* @tc.number : TC_021-2
* @tc.name : readPixels-callback( region: { size: { height: 1, width: 2 }, x: -1, y: -1 })
* @tc.desc : 1.create PixelMap
* 2.call readPixels
* 3.promise return array
* 4.callbackcall return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_021-2
'
,
0
,
async
function
(
done
)
{
const
color
=
new
ArrayBuffer
(
96
);
var
bufferArr
=
new
Uint8Array
(
color
);
for
(
var
i
=
0
;
i
<
bufferArr
.
length
;
i
++
)
{
bufferArr
[
i
]
=
i
+
1
;
}
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
,
(
err
,
pixelmap
)
=>
{
globalpixelmap
=
pixelmap
;
if
(
pixelmap
==
undefined
)
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
TC_021-2 create pixelmap fail
'
);
done
();
}
else
{
const
area
=
{
pixels
:
new
ArrayBuffer
(
20
),
offset
:
0
,
stride
:
8
,
region
:
{
size
:
{
height
:
1
,
width
:
2
},
x
:
-
1
,
y
:
-
1
}
}
pixelmap
.
readPixels
(
area
).
then
(()
=>
{
console
.
info
(
'
TC_021-2 failed
'
);
expect
(
false
).
assertTrue
();
done
();
}).
catch
(()
=>
{
expect
(
true
).
assertTrue
();
console
.
info
(
'
TC_021-2 success
'
);
done
();
})
}
})
})
/**
* @tc.number : TC_021-3
* @tc.name : readPixels-promise(buffer:0)
* @tc.desc : 1.create PixelMap
* 2.call readPixels
* 3.promise return array
* 4.callbackcall return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_021-3
'
,
0
,
async
function
(
done
)
{
const
color
=
new
ArrayBuffer
(
96
);
var
bufferArr
=
new
Uint8Array
(
color
);
for
(
var
i
=
0
;
i
<
bufferArr
.
length
;
i
++
)
{
bufferArr
[
i
]
=
i
+
1
;
}
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
,
(
err
,
pixelmap
)
=>
{
globalpixelmap
=
pixelmap
;
if
(
pixelmap
==
undefined
)
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
TC_021-3 create pixelmap failed
'
);
done
();
}
else
{
const
area
=
{
pixels
:
new
ArrayBuffer
(
0
),
offset
:
0
,
stride
:
8
,
region
:
{
size
:
{
height
:
1
,
width
:
2
},
x
:
0
,
y
:
0
}
}
pixelmap
.
readPixels
(
area
).
then
(()
=>
{
console
.
info
(
'
TC_021-3 failed
'
);
expect
(
false
).
assertTrue
();
done
();
}).
catch
(()
=>
{
expect
(
true
).
assertTrue
();
console
.
info
(
'
TC_021-3 success
'
);
done
();
})
}
})
})
/**
* @tc.number : TC_021-4
* @tc.name : readPixels-promise(offset > buffer)
* @tc.desc : 1.create PixelMap
* 2.call readPixels
* 3.promise return array
* 4.callbackcall return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_021-4
'
,
0
,
async
function
(
done
)
{
const
color
=
new
ArrayBuffer
(
96
);
var
bufferArr
=
new
Uint8Array
(
color
);
for
(
var
i
=
0
;
i
<
bufferArr
.
length
;
i
++
)
{
bufferArr
[
i
]
=
i
+
1
;
}
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
,
(
err
,
pixelmap
)
=>
{
globalpixelmap
=
pixelmap
;
if
(
pixelmap
==
undefined
)
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
TC_021-4 createPixelMap success
'
);
done
();
}
const
area
=
{
pixels
:
new
ArrayBuffer
(
20
),
offset
:
21
,
stride
:
8
,
region
:
{
size
:
{
height
:
1
,
width
:
2
},
x
:
0
,
y
:
0
}
}
pixelmap
.
readPixels
(
area
).
then
(()
=>
{
console
.
info
(
'
TC_021-4 failed
'
);
expect
(
false
).
assertTrue
();
done
();
}).
catch
(()
=>
{
expect
(
true
).
assertTrue
();
console
.
info
(
'
TC_021-4 success
'
);
done
();
})
})
})
/**
* @tc.number : TC_021-5
* @tc.name : readPixels-promise(region: { size: { height: -1, width:-1}, x: 0, y: 0 })
* @tc.desc : 1.create PixelMap
* 2.call readPixels
* 3.promise return array
* 4.callbackcall return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_021-5
'
,
0
,
async
function
(
done
)
{
const
color
=
new
ArrayBuffer
(
96
);
var
bufferArr
=
new
Uint8Array
(
color
);
for
(
var
i
=
0
;
i
<
bufferArr
.
length
;
i
++
)
{
bufferArr
[
i
]
=
i
+
1
;
}
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
,
(
err
,
pixelmap
)
=>
{
globalpixelmap
=
pixelmap
;
if
(
pixelmap
==
undefined
)
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
TC_021-5 createPixelMap success
'
);
done
();
}
const
area
=
{
pixels
:
new
ArrayBuffer
(
20
),
offset
:
0
,
stride
:
8
,
region
:
{
size
:
{
height
:
-
1
,
width
:
-
1
},
x
:
0
,
y
:
0
}
}
pixelmap
.
readPixels
(
area
).
then
(()
=>
{
console
.
info
(
'
TC_021-5 failed
'
);
expect
(
false
).
assertTrue
();
done
();
}).
catch
(()
=>
{
expect
(
true
).
assertTrue
();
console
.
info
(
'
TC_021-5 success
'
);
done
();
})
})
})
/**
* @tc.number : TC_022
* @tc.name : writePixels-promise
* @tc.desc : 1.create PixelMap
* 2.call writePixels
* 3.call return undefined
* 4.callbackcall return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_022
'
,
0
,
async
function
(
done
)
{
const
color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
)
.
then
(
pixelmap
=>
{
globalpixelmap
=
pixelmap
;
if
(
pixelmap
==
undefined
)
{
console
.
info
(
'
TC_022 createPixelMap failed
'
);
expect
(
false
).
assertTrue
()
done
();
}
const
area
=
{
pixels
:
new
ArrayBuffer
(
8
),
offset
:
0
,
stride
:
8
,
region
:
{
size
:
{
height
:
1
,
width
:
2
},
x
:
0
,
y
:
0
}
}
var
bufferArr
=
new
Uint8Array
(
area
.
pixels
);
for
(
var
i
=
0
;
i
<
bufferArr
.
length
;
i
++
)
{
bufferArr
[
i
]
=
i
+
1
;
}
pixelmap
.
writePixels
(
area
).
then
(()
=>
{
const
readArea
=
{
pixels
:
new
ArrayBuffer
(
8
),
offset
:
0
,
stride
:
8
,
region
:
{
size
:
{
height
:
1
,
width
:
2
},
x
:
0
,
y
:
0
}
}
pixelmap
.
readPixels
(
readArea
).
then
(()
=>
{
var
readArr
=
new
Uint8Array
(
readArea
.
pixels
);
var
res
=
true
;
for
(
var
i
=
0
;
i
<
readArr
.
length
;
i
++
)
{
if
(
readArr
[
i
]
!=
tc_022Buf
[
i
])
{
res
=
false
;
console
.
info
(
'
TC_022 failed
'
);
expect
(
false
).
assertTrue
();
done
();
break
;
}
}
if
(
res
)
{
console
.
info
(
'
TC_022 success
'
);
expect
(
true
).
assertTrue
()
done
();
}
})
})
})
.
catch
(
error
=>
{
console
.
log
(
'
TC_022 error:
'
+
error
);
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number : TC_022-1
* @tc.name : writePixels-callback
* @tc.desc : 1.create PixelMap
* 2.call writePixels
* 3.call return undefined
* 4.callbackcall return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_022-1
'
,
0
,
async
function
(
done
)
{
const
color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
,
(
err
,
pixelmap
)
=>
{
globalpixelmap
=
pixelmap
;
if
(
pixelmap
==
undefined
)
{
console
.
info
(
'
TC_022-1 createPixelMap failed
'
);
expect
(
false
).
assertTrue
()
done
();
}
const
area
=
{
pixels
:
new
ArrayBuffer
(
8
),
offset
:
0
,
stride
:
8
,
region
:
{
size
:
{
height
:
1
,
width
:
2
},
x
:
0
,
y
:
0
}
}
var
bufferArr
=
new
Uint8Array
(
area
.
pixels
);
for
(
var
i
=
0
;
i
<
bufferArr
.
length
;
i
++
)
{
bufferArr
[
i
]
=
i
+
1
;
}
pixelmap
.
writePixels
(
area
,
()
=>
{
const
readArea
=
{
pixels
:
new
ArrayBuffer
(
8
),
offset
:
0
,
stride
:
8
,
region
:
{
size
:
{
height
:
1
,
width
:
2
},
x
:
0
,
y
:
0
}
}
pixelmap
.
readPixels
(
readArea
,
()
=>
{
var
readArr
=
new
Uint8Array
(
readArea
.
pixels
);
var
res
=
true
;
for
(
var
i
=
0
;
i
<
readArr
.
length
;
i
++
)
{
if
(
readArr
[
i
]
!=
tc_022Buf
[
i
])
{
res
=
false
;
console
.
info
(
'
TC_022-1 failed
'
);
expect
(
false
).
assertTrue
();
done
();
break
;
}
}
if
(
res
)
{
console
.
info
(
'
TC_022-1 success
'
);
expect
(
true
).
assertTrue
()
done
();
}
})
})
})
.
catch
(
error
=>
{
console
.
log
(
'
TC_022-1 error:
'
+
error
);
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number : TC_023
* @tc.name : writeBufferToPixels-promise
* @tc.desc : 1.create PixelMap,buffer
* 2.call writeBufferToPixels
* 3.call return undefined
* 4.callbackcall return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_023
'
,
0
,
async
function
(
done
)
{
const
color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
)
.
then
(
pixelmap
=>
{
globalpixelmap
=
pixelmap
;
if
(
pixelmap
==
undefined
)
{
console
.
info
(
'
TC_023 createPixelMap failed
'
);
expect
(
false
).
assertTrue
()
done
();
}
const
writeColor
=
new
ArrayBuffer
(
96
);
var
bufferArr
=
new
Uint8Array
(
writeColor
);
for
(
var
i
=
0
;
i
<
bufferArr
.
length
;
i
++
)
{
bufferArr
[
i
]
=
i
+
1
;
}
pixelmap
.
writeBufferToPixels
(
writeColor
).
then
(()
=>
{
const
readBuffer
=
new
ArrayBuffer
(
96
);
pixelmap
.
readPixelsToBuffer
(
readBuffer
).
then
(()
=>
{
var
bufferArr
=
new
Uint8Array
(
readBuffer
);
var
res
=
true
;
for
(
var
i
=
0
;
i
<
bufferArr
.
length
;
i
++
)
{
if
(
bufferArr
[
i
]
==
0
)
{
res
=
false
;
console
.
info
(
'
TC_023 failed
'
);
expect
(
false
).
assertTrue
()
done
();
break
;
}
}
if
(
res
)
{
console
.
info
(
'
TC_023 success
'
);
expect
(
true
).
assertTrue
();
done
();
}
})
})
})
.
catch
(
error
=>
{
console
.
log
(
'
TC_023 error:
'
+
error
);
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number : TC_023-1
* @tc.name : writeBufferToPixels-callback
* @tc.desc : 1.create PixelMap,buffer
* 2.call writeBufferToPixels
* 3.call return undefined
* 4.callbackcall return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_023-1
'
,
0
,
async
function
(
done
)
{
const
color
=
new
ArrayBuffer
(
96
);
var
bufferArr
=
new
Uint8Array
(
color
);
for
(
var
i
=
0
;
i
<
bufferArr
.
length
;
i
++
)
{
bufferArr
[
i
]
=
i
+
1
;
}
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
).
then
(
pixelmap
=>
{
globalpixelmap
=
pixelmap
;
if
(
pixelmap
==
undefined
)
{
expect
(
false
).
assertTrue
()
console
.
info
(
'
TC_023-1 failed
'
);
done
();
}
const
writeColor
=
new
ArrayBuffer
(
96
);
pixelmap
.
writeBufferToPixels
(
writeColor
,
()
=>
{
const
readBuffer
=
new
ArrayBuffer
(
96
);
pixelmap
.
readPixelsToBuffer
(
readBuffer
,
()
=>
{
var
bufferArr
=
new
Uint8Array
(
readBuffer
);
var
res
=
true
;
for
(
var
i
=
0
;
i
<
bufferArr
.
length
;
i
++
)
{
if
(
res
)
{
if
(
bufferArr
[
i
]
==
0
)
{
res
=
false
;
console
.
info
(
'
TC_023-1 Success
'
);
expect
(
true
).
assertTrue
()
done
();
break
;
}
}
}
if
(
res
)
{
console
.
info
(
'
TC_023-1 no change after writeBuffer
'
);
expect
(
false
).
assertTrue
();
done
();
}
})
})
})
})
/**
* @tc.number : TC_024
* @tc.name : getImageInfo-pixelmap-promise
* @tc.desc : 1.create PixelMap,ImageInfo
* 2.call getImageInfo
* 3.call return imageinfo
* 4.callback return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_024
'
,
0
,
async
function
(
done
)
{
const
color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
2
,
size
:
{
height
:
6
,
width
:
8
}
}
image
.
createPixelMap
(
color
,
opts
)
.
then
(
pixelmap
=>
{
globalpixelmap
=
pixelmap
;
if
(
pixelmap
==
undefined
)
{
console
.
info
(
'
TC_024 createPixelMap failed
'
);
expect
(
false
).
assertTrue
()
done
();
}
pixelmap
.
getImageInfo
().
then
(
imageInfo
=>
{
if
(
imageInfo
==
undefined
)
{
console
.
info
(
'
TC_024 imageInfo is empty
'
);
expect
(
false
).
assertTrue
()
done
();
}
if
(
imageInfo
.
size
.
height
==
4
&&
imageInfo
.
size
.
width
==
6
)
{
console
.
info
(
'
TC_024 success
'
);
expect
(
true
).
assertTrue
()
done
();
}
done
();
}).
catch
(
error
=>
{
console
.
log
(
'
TC_024 getimageinfo error:
'
+
error
);
expect
().
assertFail
();
done
();
})
done
();
})
.
catch
(
error
=>
{
console
.
log
(
'
TC_024 error:
'
+
error
);
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number : TC_024-1
* @tc.name : getImageInfo-pixelmap-callback
* @tc.desc : 1.create PixelMap,ImageInfo
* 2.call getImageInfo
* 3.call return imageinfo
* 4.callback return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_024-1
'
,
0
,
async
function
(
done
)
{
const
color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
,
(
err
,
pixelmap
)
=>
{
if
(
pixelmap
==
undefined
)
{
globalpixelmap
=
pixelmap
;
expect
(
false
).
assertTrue
()
console
.
info
(
'
TC_024-1 create pixelmap fail
'
);
done
();
}
pixelmap
.
getImageInfo
((
err
,
imageInfo
)
=>
{
if
(
imageInfo
==
undefined
)
{
console
.
info
(
'
TC_024-1 imageInfo is empty
'
);
expect
(
false
).
assertTrue
()
done
();
}
if
(
imageInfo
.
size
.
height
==
4
&&
imageInfo
.
size
.
width
==
6
)
{
console
.
info
(
'
TC_024-1 imageInfo success
'
);
expect
(
true
).
assertTrue
()
done
();
}
done
();
})
})
})
/**
* @tc.number : TC_025-1
* @tc.name : getBytesNumberPerRow
* @tc.desc : 1.create PixelMap
* 2.set PixelMap
* 3.call getBytesNumberPerRow
* 4. call return number
* 5.callback return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_025-1
'
,
0
,
async
function
(
done
)
{
const
color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
const
expectNum
=
4
*
opts
.
size
.
width
;
image
.
createPixelMap
(
color
,
opts
,
(
err
,
pixelmap
)
=>
{
globalpixelmap
=
pixelmap
;
if
(
pixelmap
==
undefined
)
{
expect
(
false
).
assertTrue
()
console
.
info
(
'
TC_25-1 create pixelmap fail
'
);
done
();
}
else
{
const
num
=
pixelmap
.
getBytesNumberPerRow
();
console
.
info
(
'
TC_025-1 num is
'
+
num
);
expect
(
num
==
expectNum
).
assertTrue
();
if
(
num
==
expectNum
)
{
console
.
info
(
'
TC_25-1 success
'
);
}
else
{
console
.
info
(
'
TC_25-1 fail
'
);
}
done
();
}
})
})
/**
* @tc.number : TC_026-1
* @tc.name : getPixelBytesNumber
* @tc.desc : 1.create PixelMap
* 2.set Pixel
* 3.call getPixelBytesNumber
* 4. call return number
* 5.callback return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_026-1
'
,
0
,
async
function
(
done
)
{
const
color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
const
expectNum
=
4
*
opts
.
size
.
width
*
opts
.
size
.
height
;
image
.
createPixelMap
(
color
,
opts
,
(
err
,
pixelmap
)
=>
{
globalpixelmap
=
pixelmap
;
if
(
pixelmap
==
undefined
)
{
expect
(
false
).
assertTrue
()
console
.
info
(
'
TC_026-1 create pixelmap fail
'
);
done
();
}
else
{
const
num
=
pixelmap
.
getPixelBytesNumber
();
console
.
info
(
'
TC_026-1 num is
'
+
num
);
expect
(
num
==
expectNum
).
assertTrue
();
if
(
num
==
expectNum
)
{
console
.
info
(
'
TC_026-1 success
'
);
}
else
{
console
.
info
(
'
TC_026-1 fail
'
);
}
done
();
}
})
})
/**
* @tc.number : TC_027
* @tc.name : release-pixelmap-promise
* @tc.desc : 1.create PixelMap
* 2.set Pixel
* 3.call release
* 4.return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_027
'
,
0
,
async
function
(
done
)
{
const
color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
).
then
(
pixelmap
=>
{
globalpixelmap
=
pixelmap
;
if
(
pixelmap
==
undefined
)
{
console
.
info
(
'
TC_027 createPixelMap failed
'
);
expect
(
false
).
assertTrue
()
done
();
}
pixelmap
.
release
().
then
(()
=>
{
console
.
info
(
'
TC_027 success
'
);
expect
(
true
).
assertTrue
();
done
();
}).
catch
(
error
=>
{
console
.
log
(
'
TC_027 error:
'
+
error
);
expect
().
assertFail
();
done
();
})
}).
catch
(
error
=>
{
console
.
log
(
'
TC_027 createPixelMap failed error:
'
+
error
);
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number : TC_027-1
* @tc.name : release-pixelmap-callback
* @tc.desc : 1.create PixelMap
* 2.set Pixel
* 3.call release
* 4.return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_027-1
'
,
0
,
async
function
(
done
)
{
const
color
=
new
ArrayBuffer
(
96
);
let
opts
=
{
editable
:
true
,
pixelFormat
:
3
,
size
:
{
height
:
4
,
width
:
6
}
}
image
.
createPixelMap
(
color
,
opts
,
(
err
,
pixelmap
)
=>
{
globalpixelmap
=
pixelmap
;
if
(
pixelmap
==
undefined
)
{
console
.
info
(
'
TC_027-1 createPixelMap failed
'
);
expect
(
false
).
assertTrue
()
done
();
}
pixelmap
.
release
(()
=>
{
expect
(
true
).
assertTrue
();
console
.
log
(
'
TC_027-1 success
'
);
done
();
})
})
})
/**
* @tc.number : TC_171
* @tc.name : getImageProperty(BitsPerSample)-promise
...
...
multimedia/image/image_js_standard/imageExif/src/main/js/test/testImg.js
已删除
100644 → 0
浏览文件 @
0045d8c2
/*
* Copyright (C) 2022 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.
*/
let
tc_020Buf
=
new
Uint8Array
([
0
,
0
,
0
,
4
,
0
,
0
,
0
,
8
,
1
,
0
,
0
,
12
,
1
,
1
,
1
,
16
,
1
,
1
,
1
,
20
,
2
,
2
,
2
,
24
,
3
,
3
,
3
,
28
,
4
,
4
,
4
,
32
,
5
,
5
,
5
,
36
,
6
,
6
,
6
,
40
,
7
,
7
,
7
,
44
,
9
,
9
,
8
,
48
,
10
,
10
,
10
,
52
,
12
,
12
,
12
,
56
,
14
,
14
,
13
,
60
,
16
,
16
,
15
,
64
,
18
,
18
,
17
,
68
,
20
,
20
,
19
,
72
,
22
,
22
,
22
,
76
,
25
,
24
,
24
,
80
,
27
,
27
,
27
,
84
,
30
,
30
,
29
,
88
,
33
,
32
,
32
,
92
,
36
,
35
,
35
,
96
])
let
tc_020_1Buf
=
new
Uint8Array
([
0
,
0
,
0
,
4
,
0
,
0
,
0
,
8
,
1
,
0
,
0
,
12
,
1
,
1
,
1
,
16
,
1
,
1
,
1
,
20
,
2
,
2
,
2
,
24
,
3
,
3
,
3
,
28
,
4
,
4
,
4
,
32
,
5
,
5
,
5
,
36
,
6
,
6
,
6
,
40
,
7
,
7
,
7
,
44
,
9
,
9
,
8
,
48
,
10
,
10
,
10
,
52
,
12
,
12
,
12
,
56
,
14
,
14
,
13
,
60
,
16
,
16
,
15
,
64
,
18
,
18
,
17
,
68
,
20
,
20
,
19
,
72
,
22
,
22
,
22
,
76
,
25
,
24
,
24
,
80
,
27
,
27
,
27
,
84
,
30
,
30
,
29
,
88
,
33
,
32
,
32
,
92
,
36
,
35
,
35
,
96
])
let
tc_021Buf
=
new
Uint8Array
([
0
,
0
,
0
,
4
,
0
,
0
,
0
,
8
])
let
tc_021_1Buf
=
new
Uint8Array
([
0
,
0
,
0
,
4
,
0
,
0
,
0
,
8
])
let
tc_022Buf
=
new
Uint8Array
([
0
,
0
,
0
,
4
,
0
,
0
,
0
,
8
])
export
{
tc_020Buf
,
tc_020_1Buf
,
tc_021Buf
,
tc_021_1Buf
,
tc_022Buf
}
\ No newline at end of file
multimedia/image/image_js_standard/imagePacking/Test.json
浏览文件 @
53660364
...
...
@@ -10,23 +10,34 @@
},
"kits"
:
[
{
"type"
:
"PushKit"
,
"pre-push"
:
[],
"push"
:
[]
"test-file-name"
:
[
"ActsImagePackingJsTest.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
},
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"hilog -Q pidoff"
"mkdir -p /data/app/el2/100/base/ohos.acts.multimedia.image.Packing/haps/entry/files/"
,
"chmod -R 666 /data/app/el2/100/base/ohos.acts.multimedia.image.Packing/haps/entry/files/*"
],
"teardown-command"
:
[]
},
{
"test-file-name"
:
[
"ActsImagePackingJsTest.hap"
"type"
:
"PushKit"
,
"pre-push"
:
[],
"push"
:
[
"./resource/image/test.png ->/data/app/el2/100/base/ohos.acts.multimedia.image.Packing/haps/entry/files"
]
},
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"hilog -Q pidoff"
,
"hilog -b D"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
"teardown-command"
:
[]
}
]
}
\ No newline at end of file
multimedia/image/image_js_standard/imagePacking/src/main/js/test/packing.test.js
浏览文件 @
53660364
...
...
@@ -15,9 +15,28 @@
import
image
from
'
@ohos.multimedia.image
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
import
featureAbility
from
'
@ohos.ability.featureAbility
'
import
fileio
from
'
@ohos.fileio
'
export
default
function
imagePacking
()
{
describe
(
'
imagePacking
'
,
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
);
})
}
beforeAll
(
async
function
()
{
console
.
info
(
'
beforeAll case
'
);
...
...
@@ -499,4 +518,445 @@ describe('imagePacking', function () {
packing_Cb_Fail
(
done
,
'
SUB_IMAGE_packing_Cb_010
'
,
5
,
packOpts
)
})
/**
* @tc.number : TC_062
* @tc.name : packing ImageSource - promise
* @tc.desc : 1.create ImageSource
* 2.call packing
* 3.return array
* 4.callbackcall return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_062
'
,
0
,
async
function
(
done
)
{
try
{
await
getFd
(
'
test.png
'
);
const
imageSourceApi
=
image
.
createImageSource
(
fdNumber
);
if
(
imageSourceApi
==
undefined
)
{
console
.
info
(
'
TC_062 create image source failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
const
imagePackerApi
=
image
.
createImagePacker
();
if
(
imagePackerApi
==
undefined
)
{
console
.
info
(
'
TC_062 create image packer failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
let
packOpts
=
{
format
:
"
image/jpeg
"
,
quality
:
99
}
imagePackerApi
.
packing
(
imageSourceApi
,
packOpts
)
.
then
(
data
=>
{
console
.
info
(
'
TC_062 success
'
);
expect
(
data
!=
undefined
).
assertTrue
();
done
();
}).
catch
(
error
=>
{
console
.
log
(
'
TC_062 error:
'
+
error
);
expect
(
false
).
assertFail
();
done
();
})
}
}
}
catch
(
error
)
{
console
.
info
(
'
TC_062 error:
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
})
/**
* @tc.number : TC_062-1
* @tc.name : packing ImageSource - callback
* @tc.desc : 1.create ImageSource
* 2.call packing
* 3.return array
* 4.callbackcall return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_062-1
'
,
0
,
async
function
(
done
)
{
try
{
await
getFd
(
'
test.png
'
);
const
imageSourceApi
=
image
.
createImageSource
(
fdNumber
);
if
(
imageSourceApi
==
undefined
)
{
console
.
info
(
'
TC_062-1 create image source failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
const
imagePackerApi
=
image
.
createImagePacker
();
if
(
imagePackerApi
==
undefined
)
{
console
.
info
(
'
TC_062-1 create image packer failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
let
packOpts
=
{
format
:
"
image/jpeg
"
,
quality
:
1
}
imagePackerApi
.
packing
(
imageSourceApi
,
packOpts
,
(
err
,
data
)
=>
{
console
.
info
(
'
TC_062-1 success
'
+
JSON
.
stringify
(
data
));
expect
(
data
!=
undefined
).
assertTrue
();
done
();
})
}
}
}
catch
(
error
)
{
console
.
info
(
'
TC_062-1 error:
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
})
/**
* @tc.number : TC_062-2
* @tc.name : packing ImageSource - callback - wrong format
* @tc.desc : 1.create ImageSource
* 2.call packing
* 3.return array
* 4.callbackcall return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_062-2
'
,
0
,
async
function
(
done
)
{
try
{
await
getFd
(
'
test.png
'
);
const
imageSourceApi
=
image
.
createImageSource
(
fdNumber
);
if
(
imageSourceApi
==
undefined
)
{
console
.
info
(
'
TC_062-2 create image source failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
const
imagePackerApi
=
image
.
createImagePacker
();
if
(
imagePackerApi
==
undefined
)
{
console
.
info
(
'
TC_062-2 create image packer failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
let
packOpts
=
{
format
:
"
image/gif
"
,
quality
:
98
}
imagePackerApi
.
packing
(
imageSourceApi
,
packOpts
,
(
err
,
data
)
=>
{
console
.
info
(
'
TC_062-2 success
'
);
expect
(
data
==
undefined
).
assertTrue
();
console
.
info
(
data
);
done
();
})
}
}
}
catch
(
error
)
{
console
.
info
(
'
TC_062-2 error:
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
})
/**
* @tc.number : TC_062-3
* @tc.name : packing ImageSource - callback - wrong quality
* @tc.desc : 1.create ImageSource
* 2.call packing
* 3.call return array
* 4.callbackcall return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_062-3
'
,
0
,
async
function
(
done
)
{
try
{
await
getFd
(
'
test.png
'
);
const
imageSourceApi
=
image
.
createImageSource
(
fdNumber
);
if
(
imageSourceApi
==
undefined
)
{
console
.
info
(
'
TC_062-3 create image source failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
const
imagePackerApi
=
image
.
createImagePacker
();
if
(
imagePackerApi
==
undefined
)
{
console
.
info
(
'
TC_062-3 create image packer failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
let
packOpts
=
{
format
:
"
image/jpeg
"
,
quality
:
101
}
imagePackerApi
.
packing
(
imageSourceApi
,
packOpts
,
(
err
,
data
)
=>
{
console
.
info
(
'
TC_062-3 success
'
);
expect
(
data
==
undefined
).
assertTrue
();
console
.
info
(
data
);
done
();
})
}
}
}
catch
(
error
)
{
console
.
info
(
'
TC_062-3 error:
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
})
/**
* @tc.number : TC_062-4
* @tc.name : createImagePacker
* @tc.desc : 1.create ImageSource
* 2.call packing
* 3.return array
* 4.callbackcall return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_062-4
'
,
0
,
async
function
(
done
)
{
try
{
await
getFd
(
'
test.png
'
);
const
imageSourceApi
=
image
.
createImageSource
(
fdNumber
);
if
(
imageSourceApi
==
undefined
)
{
console
.
info
(
'
TC_062-4 create image source failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
const
imagePackerApi
=
image
.
createImagePacker
();
if
(
imagePackerApi
==
undefined
)
{
console
.
info
(
'
TC_062-4 create image packer failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
console
.
info
(
'
TC_062-4 create image packer success
'
);
expect
(
true
).
assertTrue
();
done
();
}
}
}
catch
(
error
)
{
console
.
info
(
'
TC_062-4 error:
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
})
/**
* @tc.number : TC_062-5
* @tc.name : packing ImageSource - promise - no quality
* @tc.desc : 1.create ImageSource
* 2.call packing
* 3.call return array
* 4.callbackcall return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_062-5
'
,
0
,
async
function
(
done
)
{
try
{
await
getFd
(
'
test.png
'
);
const
imageSourceApi
=
image
.
createImageSource
(
fdNumber
);
if
(
imageSourceApi
==
undefined
)
{
console
.
info
(
'
TC_062-5 create image source failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
const
imagePackerApi
=
image
.
createImagePacker
();
if
(
imagePackerApi
==
undefined
)
{
console
.
info
(
'
TC_062-5 create image packer failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
let
packOpts
=
{
format
:
"
image/jpeg
"
}
imagePackerApi
.
packing
(
imageSourceApi
,
packOpts
)
.
then
(
data
=>
{
console
.
info
(
'
TC_062-5 failed
'
);
expect
(
data
==
undefined
).
assertTrue
();
done
();
}).
catch
(
error
=>
{
console
.
log
(
'
TC_062-5 error:
'
+
error
);
console
.
log
(
'
TC_062-5 success
'
);
expect
(
true
).
assertTrue
();
done
();
})
}
}
}
catch
(
error
)
{
console
.
info
(
'
TC_062-5 error:
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
})
/**
* @tc.number : TC_062-6
* @tc.name : packing ImageSource - promise - no format
* @tc.desc : 1.create ImageSource
* 2.call packing
* 3.call return array
* 4.callbackcall return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_062-6
'
,
0
,
async
function
(
done
)
{
try
{
await
getFd
(
'
test.png
'
);
const
imageSourceApi
=
image
.
createImageSource
(
fdNumber
);
if
(
imageSourceApi
==
undefined
)
{
console
.
info
(
'
TC_062-6 create image source failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
const
imagePackerApi
=
image
.
createImagePacker
();
if
(
imagePackerApi
==
undefined
)
{
console
.
info
(
'
TC_062-6 create image packer failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
let
packOpts
=
{
quality
:
50
}
imagePackerApi
.
packing
(
imageSourceApi
,
packOpts
)
.
then
(
data
=>
{
console
.
info
(
'
TC_062-6 failed
'
);
expect
(
data
==
undefined
).
assertTrue
();
done
();
}).
catch
(
error
=>
{
console
.
log
(
'
TC_062-6 error:
'
+
error
);
console
.
log
(
'
TC_062-6 success
'
);
expect
(
true
).
assertTrue
();
done
();
})
}
}
}
catch
(
error
)
{
console
.
info
(
'
TC_062-6 error:
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
})
/**
* @tc.number : TC_062-7
* @tc.name : packing ImageSource - callback - quality 100
* @tc.desc : 1.create ImageSource
* 2.call packing
* 3.return array
* 4.callbackcall return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_062-7
'
,
0
,
async
function
(
done
)
{
try
{
await
getFd
(
'
test.png
'
);
const
imageSourceApi
=
image
.
createImageSource
(
fdNumber
);
if
(
imageSourceApi
==
undefined
)
{
console
.
info
(
'
TC_062-7 create image source failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
const
imagePackerApi
=
image
.
createImagePacker
();
if
(
imagePackerApi
==
undefined
)
{
console
.
info
(
'
TC_062-7 create image packer failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
let
packOpts
=
{
format
:
"
image/jpeg
"
,
quality
:
100
}
imagePackerApi
.
packing
(
imageSourceApi
,
packOpts
,
(
err
,
data
)
=>
{
if
(
err
)
{
expect
(
false
).
assertTrue
();
console
.
info
(
'
TC_062-7 error:
'
+
err
);
done
();
return
}
if
(
data
!=
undefined
)
{
console
.
info
(
'
TC_062-7 success
'
);
expect
(
true
).
assertTrue
();
done
();
}
else
{
except
(
false
).
assertTrue
();
console
.
info
(
'
TC_062-7 failed
'
);
done
();
}
})
}
}
}
catch
(
error
)
{
console
.
info
(
'
TC_062-7 error:
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
})
/**
* @tc.number : TC_062-8
* @tc.name : packing ImageSource - callback - quality 0
* @tc.desc : 1.create ImageSource
* 2.call packing
* 3.return array
* 4.callbackcall return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_062-8
'
,
0
,
async
function
(
done
)
{
try
{
await
getFd
(
'
test.png
'
);
const
imageSourceApi
=
image
.
createImageSource
(
fdNumber
);
if
(
imageSourceApi
==
undefined
)
{
console
.
info
(
'
TC_062-8 create image source failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
const
imagePackerApi
=
image
.
createImagePacker
();
if
(
imagePackerApi
==
undefined
)
{
console
.
info
(
'
TC_062-8 create image packer failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
let
packOpts
=
{
format
:
"
image/jpeg
"
,
quality
:
0
}
imagePackerApi
.
packing
(
imageSourceApi
,
packOpts
,
(
err
,
data
)
=>
{
console
.
info
(
'
TC_062-8 success
'
);
expect
(
data
!=
undefined
).
assertTrue
();
done
();
})
}
}
}
catch
(
error
)
{
console
.
info
(
'
TC_062-8 error:
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
})
/**
* @tc.number : TC_062-9
* @tc.name : packing ImageSource - callback - quality -1
* @tc.desc : 1.create ImageSource
* 2.call packing
* 3.return array
* 4.callbackcall return undefined
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 1
*/
it
(
'
TC_062-9
'
,
0
,
async
function
(
done
)
{
try
{
await
getFd
(
'
test.png
'
);
const
imageSourceApi
=
image
.
createImageSource
(
fdNumber
);
if
(
imageSourceApi
==
undefined
)
{
console
.
info
(
'
TC_062-9 create image source failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
const
imagePackerApi
=
image
.
createImagePacker
();
if
(
imagePackerApi
==
undefined
)
{
console
.
info
(
'
TC_062-9 create image packer failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
let
packOpts
=
{
format
:
"
image/jpeg
"
,
quality
:
-
1
}
imagePackerApi
.
packing
(
imageSourceApi
,
packOpts
,
(
err
,
data
)
=>
{
console
.
info
(
'
TC_062-9 success
'
);
expect
(
data
==
undefined
).
assertTrue
();
done
();
})
}
}
}
catch
(
error
)
{
console
.
info
(
'
TC_062-9 error:
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
})
})}
multimedia/image/image_js_standard/imagePixelMapFramework/Test.json
浏览文件 @
53660364
...
...
@@ -15,6 +15,14 @@
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
},
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"hilog -Q pidoff"
,
"hilog -b D"
],
"teardown-command"
:
[]
}
]
}
\ No newline at end of file
multimedia/image/image_js_standard/imageReceiver/Test.json
浏览文件 @
53660364
...
...
@@ -10,14 +10,11 @@
},
"kits"
:
[
{
"type"
:
"ShellKit"
,
"run-command"
:
[],
"teardown-command"
:
[]
},
{
"type"
:
"PushKit"
,
"pre-push"
:
[],
"push"
:
[]
"test-file-name"
:
[
"ActsImageReceiverJsTest.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
},
{
"type"
:
"ShellKit"
,
...
...
@@ -28,13 +25,6 @@
"aa start -a MediaScannerAbility -b com.ohos.medialibrary.MediaScannerAbilityA"
],
"teardown-command"
:
[]
},
{
"test-file-name"
:
[
"ActsImageReceiverJsTest.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
}
]
}
\ No newline at end of file
multimedia/image/image_js_standard/imageWebp/Test.json
浏览文件 @
53660364
...
...
@@ -34,7 +34,8 @@
"type"
:
"ShellKit"
,
"run-command"
:
[
"chmod 777 /data/app/el2/100/base/ohos.acts.multimedia.image.Webp/haps/entry/files/test_large.webp"
,
"hilog -Q pidoff"
"hilog -Q pidoff"
,
"hilog -b D"
],
"teardown-command"
:
[]
}
...
...
multimedia/image/image_js_standard/imageYUV/Test.json
浏览文件 @
53660364
...
...
@@ -10,23 +10,19 @@
},
"kits"
:
[
{
"type"
:
"PushKit"
,
"pre-push"
:
[],
"push"
:
[]
"test-file-name"
:
[
"ActsImageyuvJsTest.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
},
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"hilog -Q pidoff"
"hilog -Q pidoff"
,
"hilog -b D"
],
"teardown-command"
:
[]
},
{
"test-file-name"
:
[
"ActsImageyuvJsTest.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
}
]
}
\ No newline at end of file
multimedia/image/image_js_standard/image_ndk_test/Test.json
浏览文件 @
53660364
...
...
@@ -9,12 +9,19 @@
},
"kits"
:
[
{
"test-file-name"
:
[
"ActsPixelMapNapiEtsTest.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
},
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"hilog -Q pidoff"
,
"hilog -b D"
],
"teardown-command"
:
[]
}
]
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录