Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
354179da
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看板
未验证
提交
354179da
编写于
7月 04, 2023
作者:
O
openharmony_ci
提交者:
Gitee
7月 04, 2023
浏览文件
操作
浏览文件
下载
差异文件
!9186 add receiverNdk release test
Merge pull request !9186 from caochuan/receiverMul
上级
626fd54d
e299dee4
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
101 addition
and
0 deletion
+101
-0
multimedia/image/image_js_standard/imageReceiverNDK/entry/src/main/cpp/napi/image_receiver_mdk_test.cpp
...erNDK/entry/src/main/cpp/napi/image_receiver_mdk_test.cpp
+34
-0
multimedia/image/image_js_standard/imageReceiverNDK/entry/src/main/cpp/napi/image_receiver_mdk_test.h
...iverNDK/entry/src/main/cpp/napi/image_receiver_mdk_test.h
+2
-0
multimedia/image/image_js_standard/imageReceiverNDK/entry/src/main/ets/test/receiverNDK.test.ets
...eReceiverNDK/entry/src/main/ets/test/receiverNDK.test.ets
+65
-0
未找到文件。
multimedia/image/image_js_standard/imageReceiverNDK/entry/src/main/cpp/napi/image_receiver_mdk_test.cpp
浏览文件 @
354179da
...
...
@@ -51,6 +51,8 @@ napi_value ImageReceiverNDKTest::Init(napi_env env, napi_value exports)
STATIC_FUNCTION
(
"imageSize"
,
JsImageSize
),
STATIC_FUNCTION
(
"imageFormat"
,
JsImageFormat
),
STATIC_FUNCTION
(
"imageGetComponent"
,
JsImageGetComponent
),
STATIC_FUNCTION
(
"receiverRelease"
,
JsReceiverRelease
),
STATIC_FUNCTION
(
"imageRelease"
,
JsImageRelease
),
};
napi_define_properties
(
env
,
exports
,
sizeof
(
props
)
/
sizeof
(
props
[
0
]),
props
);
return
exports
;
...
...
@@ -183,6 +185,22 @@ napi_value ImageReceiverNDKTest::JsOn(napi_env env, napi_callback_info info)
return
result
;
}
napi_value
ImageReceiverNDKTest
::
JsReceiverRelease
(
napi_env
env
,
napi_callback_info
info
)
{
napi_value
result
=
nullptr
;
napi_get_undefined
(
env
,
&
result
);
ImageReceiverNative
*
native
=
getNativeReceiver
(
env
,
info
);
if
(
native
==
nullptr
)
{
return
result
;
}
int32_t
res
=
OH_Image_Receiver_Release
(
native
);
napi_create_int32
(
env
,
res
,
&
result
);
return
result
;
}
static
void
setInt32NamedProperty
(
napi_env
env
,
napi_value
object
,
const
char
*
utf8name
,
int32_t
value
)
{
napi_value
tmp
;
...
...
@@ -276,6 +294,22 @@ static ImageNative* getNativeImage(napi_env env, napi_callback_info info)
return
OH_Image_InitImageNative
(
env
,
argValue
[
NUM_0
]);
}
napi_value
ImageReceiverNDKTest
::
JsImageRelease
(
napi_env
env
,
napi_callback_info
info
)
{
napi_value
result
=
nullptr
;
napi_get_undefined
(
env
,
&
result
);
ImageNative
*
native
=
getNativeImage
(
env
,
info
);
if
(
native
==
nullptr
)
{
return
result
;
}
int32_t
res
=
OH_Image_Release
(
native
);
napi_create_int32
(
env
,
res
,
&
result
);
return
result
;
}
napi_value
ImageReceiverNDKTest
::
JsImageClipRect
(
napi_env
env
,
napi_callback_info
info
)
{
napi_value
result
=
nullptr
;
...
...
multimedia/image/image_js_standard/imageReceiverNDK/entry/src/main/cpp/napi/image_receiver_mdk_test.h
浏览文件 @
354179da
...
...
@@ -41,6 +41,8 @@ public:
static
napi_value
JsImageSize
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JsImageFormat
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JsImageGetComponent
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JsReceiverRelease
(
napi_env
env
,
napi_callback_info
info
);
static
napi_value
JsImageRelease
(
napi_env
env
,
napi_callback_info
info
);
private:
static
uint32_t
sOnEvnentCount
;
...
...
multimedia/image/image_js_standard/imageReceiverNDK/entry/src/main/ets/test/receiverNDK.test.ets
浏览文件 @
354179da
...
...
@@ -365,5 +365,70 @@ export default function ImageReceiverNDKTest() {
done();
}
})
/**
* @tc.number : SUB_GRAPHIC_IMAGE_RECEIVERNDK_0900
* @tc.name : img.release
* @tc.desc : 1.createImageReceiver
* : 2.readLatestImage
* : 3.release
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('SUB_GRAPHIC_IMAGE_RECEIVERNDK_0900', 0, async function (done) {
let mlg = logger("SUB_GRAPHIC_IMAGE_RECEIVERNDK_0900");
try {
mlg.log("SUB_GRAPHIC_IMAGE_RECEIVERNDK_0900");
let myReceiver = ndkTest.createImageReceiver(WIDTH, HEIGHT, RECEIVER_FORMAT, CAPACITY);
let onRet = ndkTest.on(myReceiver);
mlg.log("onRet " + JSON.stringify(onRet));
expect(onRet != undefined).assertTrue();
var dummy = myReceiver.test;
mlg.log("dummy test !!! ")
let myLatestImage = ndkTest.readLatestImage(myReceiver);
let myImageComponent = ndkTest.imageGetComponent(myLatestImage, JPEG);
var bufferArr = new Uint8Array(myImageComponent.byteBuffer);
mlg.log("myImageComponent.byteBuffer size " + JSON.stringify(bufferArr.length));
for (var i = 0; i < 30; i++) {
mlg.log("myImageComponent.byteBuffer data " + JSON.stringify(bufferArr[i]));
}
expect(myImageComponent.byteBuffer != undefined).assertTrue();
let releaseRes = ndkTest.imageRelease(myLatestImage);
mlg.log('release result ' + JSON.stringify(releaseRes));
expect(releaseRes != undefined).assertTrue();
done();
} catch (error) {
mlg.log("Test exception " + error);
expect().assertFail();
done();
}
})
/**
* @tc.number : SUB_GRAPHIC_IMAGE_RECEIVERNDK_1000
* @tc.name : receiver.release
* @tc.desc : 1.createImageReceiver
* : 2.release
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('SUB_GRAPHIC_IMAGE_RECEIVERNDK_1000', 0, async function (done) {
let mlg = logger("SUB_GRAPHIC_IMAGE_RECEIVERNDK_1000");
try {
mlg.log("SUB_GRAPHIC_IMAGE_RECEIVERNDK_1000");
let myReceiver = ndkTest.createImageReceiver(WIDTH, HEIGHT, RECEIVER_FORMAT, CAPACITY);
let releaseRes = ndkTest.receiverRelease(myReceiver);
mlg.log('release result ' + JSON.stringify(releaseRes));
expect(releaseRes != undefined).assertTrue();
done();
} catch (error) {
mlg.log("Test exception " + error);
expect().assertFail();
done();
}
})
})
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录