Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
d43070b9
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
d43070b9
编写于
7月 01, 2022
作者:
O
openharmony_ci
提交者:
Gitee
7月 01, 2022
浏览文件
操作
浏览文件
下载
差异文件
!4003 image add xts
Merge pull request !4003 from L刘/master
上级
d78c2b0d
63491c69
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
304 addition
and
1 deletion
+304
-1
multimedia/image/image_js_standard/imageExif/src/main/js/test/List.test.js
...image_js_standard/imageExif/src/main/js/test/List.test.js
+2
-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
+302
-0
未找到文件。
multimedia/image/image_js_standard/imageExif/src/main/js/test/List.test.js
浏览文件 @
d43070b9
...
...
@@ -13,4 +13,5 @@
* limitations under the License.
*/
require
(
'
./image.test.js
'
)
\ No newline at end of file
require
(
'
./image.test.js
'
)
require
(
'
./addImage.test.js
'
)
multimedia/image/image_js_standard/imageExif/src/main/js/test/addImage.test.js
0 → 100644
浏览文件 @
d43070b9
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
image
from
'
@ohos.multimedia.image
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
{
testPng
}
from
'
../../../../../image/src/main/js/test/testImg
'
describe
(
'
Image
'
,
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: 2, 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
:
2
,
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: 2, 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
:
2
,
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: 2, 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
:
2
,
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: 2, 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
:
2
,
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
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录