Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
626fd54d
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看板
未验证
提交
626fd54d
编写于
7月 04, 2023
作者:
O
openharmony_ci
提交者:
Gitee
7月 04, 2023
浏览文件
操作
浏览文件
下载
差异文件
!9182 跨应用传输pixelmap
Merge pull request !9182 from 曾岳洋/master
上级
aae67bc4
04749190
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
82 addition
and
0 deletion
+82
-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
+82
-0
未找到文件。
multimedia/image/image_js_standard/image/src/main/js/test/image.test.js
浏览文件 @
626fd54d
...
...
@@ -14,6 +14,7 @@
*/
import
image
from
'
@ohos.multimedia.image
'
import
rpc
from
'
@ohos.rpc
'
import
fileio
from
'
@ohos.fileio
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
import
{
testPng
,
testJpg
}
from
'
./testImg
'
...
...
@@ -25,6 +26,39 @@ export default function imageJsTest() {
let
filePath
;
let
fdNumber
;
let
globalpixelmap
;
class
MySequence1
{
pixel_map
;
constructor
(
pixelmap
)
{
this
.
pixel_map
=
pixelmap
;
}
marshalling
(
messageSequence
)
{
this
.
pixel_map
.
marshalling
(
messageSequence
);
return
true
;
}
async
unmarshalling
(
messageSequence
)
{
await
image
.
unmarshalling
(
messageSequence
).
then
(
async
(
pixelMap
)
=>
{
this
.
pixel_map
=
pixelMap
;
})
return
true
;
}
}
class
MySequence2
{
pixel_map
;
constructor
(
pixelmap
)
{
this
.
pixel_map
=
pixelmap
;
}
marshalling
(
messageSequence
)
{
this
.
pixel_map
.
marshalling
(
messageSequence
);
return
true
;
}
async
unmarshalling
(
messageSequence
)
{
await
image
.
unmarshalling
(
messageSequence
).
then
(
async
(
pixelMap
)
=>
{
this
.
pixel_map
=
pixelMap
;
})
return
true
;
}
}
async
function
getFd
(
fileName
)
{
let
context
=
await
featureAbility
.
getContext
();
await
context
.
getFilesDir
().
then
((
data
)
=>
{
...
...
@@ -3002,5 +3036,53 @@ export default function imageJsTest() {
done
();
})
})
/**
* @tc.number : SUB_GRAPHIC_IMAGE_MARSHALLING_AND_UNMARSHALLIGN_PROMISE_EDITABLE_0100
* @tc.name : marshalling and unmarshalling 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.marshalling pixelmap into the messageSequence
* 5.unmarshalling pixelmap from the messageSequence
* 6.return pixelmap not empty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it
(
'
SUB_GRAPHIC_IMAGE_MARSHALLING_AND_UNMARSHALLIGN_PROMISE_EDITABLE_0100
'
,
0
,
async
function
(
done
)
{
const
color
=
new
ArrayBuffer
(
96
);
let
bufferArr
=
new
Uint8Array
(
color
);
for
(
var
i
=
0
;
i
<
bufferArr
.
length
;
i
++
)
{
bufferArr
[
i
]
=
0x80
;
}
let
opts
=
{
editable
:
true
,
pixelFormat
:
image
.
PixelMapFormat
.
RGB_565
,
size
:
{
height
:
4
,
width
:
6
},
alphaType
:
1
}
let
pixelMap
;
await
image
.
createPixelMap
(
color
,
opts
).
then
((
pixelmap
)
=>
{
pixelMap
=
pixelmap
;
console
.
info
(
'
SUB_GRAPHIC_IMAGE_MARSHALLING_AND_UNMARSHALLIGN_PROMISE_EDITABLE_0100 editable:
'
+
pixelmap
.
isEditable
);
})
let
parcelable
=
new
MySequence1
(
pixelMap
);
let
data
=
rpc
.
MessageSequence
.
create
();
data
.
writeParcelable
(
parcelable
);
let
pixel_map
=
undefined
;
let
ret
=
new
MySequence2
(
pixel_map
);
await
data
.
readParcelable
(
ret
);
if
(
ret
.
pixel_map
==
undefined
)
{
console
.
info
(
'
SUB_GRAPHIC_IMAGE_MARSHALLING_AND_UNMARSHALLIGN_PROMISE_EDITABLE_0100 unmarshalling pixelmap failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
else
{
expect
(
ret
.
pixel_map
.
isEditable
==
opts
.
editable
).
assertTrue
();
console
.
info
(
'
SUB_GRAPHIC_IMAGE_MARSHALLING_AND_UNMARSHALLIGN_PROMISE_EDITABLE_0100 success
'
);
done
();
}
})
})
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录