未验证 提交 0696b8d1 编写于 作者: O openharmony_ci 提交者: Gitee

回退 'Pull Request !9684 : 回退 'Pull Request !9642 : 回退 'Pull Request !9556 : Add...

回退 'Pull Request !9684 : 回退 'Pull Request !9642 : 回退 'Pull Request !9556 : Add error message for Ndk & Js'''
上级 a9fd9b8c
...@@ -239,7 +239,7 @@ export default function ImageSource() { ...@@ -239,7 +239,7 @@ export default function ImageSource() {
} else { } else {
try { try {
console.info(`${testNum} getDelayTimePromise create imagesource success`); console.info(`${testNum} getDelayTimePromise create imagesource success`);
let delayTimes = await imageSourceApi.getDelayTimeList(); let delayTimes = await imageSourceApi.getDelayTime();
if (delayTimes != undefined) { if (delayTimes != undefined) {
console.info(`${testNum} getDelayTimePromise getDelayTime success`); console.info(`${testNum} getDelayTimePromise getDelayTime success`);
expect(true).assertTrue(); expect(true).assertTrue();
...@@ -270,7 +270,7 @@ export default function ImageSource() { ...@@ -270,7 +270,7 @@ export default function ImageSource() {
done(); done();
} else { } else {
console.info(`${testNum} getDelayTimeCallBack create imagesource success`); console.info(`${testNum} getDelayTimeCallBack create imagesource success`);
imageSourceApi.getDelayTimeList((err, delayTimes) => { imageSourceApi.getDelayTime((err, delayTimes) => {
if (err != undefined) { if (err != undefined) {
console.info(`${testNum} getDelayTimeCallBack getDelayTime failed err: ${err}`); console.info(`${testNum} getDelayTimeCallBack getDelayTime failed err: ${err}`);
expect(false).assertTrue(); expect(false).assertTrue();
......
...@@ -115,7 +115,7 @@ export default function imageGif() { ...@@ -115,7 +115,7 @@ export default function imageGif() {
} else { } else {
try { try {
console.info(`${testNum} getDelayTimePromise create imagesource success`); console.info(`${testNum} getDelayTimePromise create imagesource success`);
let delayTimes = await imageSourceApi.getDelayTimeList(); let delayTimes = await imageSourceApi.getDelayTime();
if (delayTimes != undefined) { if (delayTimes != undefined) {
console.info(`${testNum} getDelayTimePromise getDelayTime success`); console.info(`${testNum} getDelayTimePromise getDelayTime success`);
expect(true).assertTrue(); expect(true).assertTrue();
...@@ -147,7 +147,7 @@ export default function imageGif() { ...@@ -147,7 +147,7 @@ export default function imageGif() {
done(); done();
} else { } else {
console.info(`${testNum} getDelayTimeCallBack create imagesource success`); console.info(`${testNum} getDelayTimeCallBack create imagesource success`);
imageSourceApi.getDelayTimeList((err, delayTimes) => { imageSourceApi.getDelayTime((err, delayTimes) => {
if (err != undefined) { if (err != undefined) {
console.info(`${testNum} getDelayTimeCallBack getDelayTime failed err: ${err}`); console.info(`${testNum} getDelayTimeCallBack getDelayTime failed err: ${err}`);
expect(false).assertTrue(); expect(false).assertTrue();
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "image_pixel_map_imgndk_test.h" #include "image_pixel_map_imgndk_test.h"
#include "node_api.h" #include "node_api.h"
#include "image_pixel_map_napi.h"
namespace { namespace {
constexpr uint32_t NUM_0 = 0; constexpr uint32_t NUM_0 = 0;
...@@ -25,6 +26,8 @@ namespace { ...@@ -25,6 +26,8 @@ namespace {
constexpr uint32_t NUM_5 = 5; constexpr uint32_t NUM_5 = 5;
} }
namespace OHOS {
namespace Media {
#define STATIC_FUNCTION(n, f) { (n), nullptr, (f), nullptr, nullptr, nullptr, napi_static, nullptr } #define STATIC_FUNCTION(n, f) { (n), nullptr, (f), nullptr, nullptr, nullptr, napi_static, nullptr }
napi_value ImagePixelMapNDKTest::Init(napi_env env, napi_value exports) napi_value ImagePixelMapNDKTest::Init(napi_env env, napi_value exports)
...@@ -160,7 +163,7 @@ napi_value ImagePixelMapNDKTest::CreatePixelMap(napi_env env, napi_callback_info ...@@ -160,7 +163,7 @@ napi_value ImagePixelMapNDKTest::CreatePixelMap(napi_env env, napi_callback_info
return udfVar; return udfVar;
} }
int32_t res = OH_PixelMap_CreatePixelMap(env, createOps, buffer, bufferSize, &pixelmap); int32_t res = OH_PixelMap_CreatePixelMap(env, createOps, buffer, bufferSize, &pixelmap);
if (res != IMAGE_RESULT_SUCCESS || pixelmap == nullptr) { if (res != OHOS_IMAGE_RESULT_SUCCESS || pixelmap == nullptr) {
return udfVar; return udfVar;
} }
return pixelmap; return pixelmap;
...@@ -182,7 +185,7 @@ napi_value ImagePixelMapNDKTest::CreateAlphaPixelMap(napi_env env, napi_callback ...@@ -182,7 +185,7 @@ napi_value ImagePixelMapNDKTest::CreateAlphaPixelMap(napi_env env, napi_callback
return udfVar; return udfVar;
} }
int32_t res = OH_PixelMap_CreateAlphaPixelMap(env, argValue[NUM_0], &alphaPixelmap); int32_t res = OH_PixelMap_CreateAlphaPixelMap(env, argValue[NUM_0], &alphaPixelmap);
if (res != IMAGE_RESULT_SUCCESS || alphaPixelmap == nullptr) { if (res != OHOS_IMAGE_RESULT_SUCCESS || alphaPixelmap == nullptr) {
return udfVar; return udfVar;
} }
return alphaPixelmap; return alphaPixelmap;
...@@ -210,7 +213,7 @@ napi_value ImagePixelMapNDKTest::InitNativePixelMap(napi_env env, napi_callback_ ...@@ -210,7 +213,7 @@ napi_value ImagePixelMapNDKTest::InitNativePixelMap(napi_env env, napi_callback_
return result; return result;
} }
napi_create_int32(env, IMAGE_RESULT_SUCCESS, &result); napi_create_int32(env, OHOS_IMAGE_RESULT_SUCCESS, &result);
return result; return result;
} }
...@@ -226,7 +229,7 @@ napi_value ImagePixelMapNDKTest::GetBytesNumberPerRow(napi_env env, napi_callbac ...@@ -226,7 +229,7 @@ napi_value ImagePixelMapNDKTest::GetBytesNumberPerRow(napi_env env, napi_callbac
int32_t rowBytes = NUM_0; int32_t rowBytes = NUM_0;
int32_t res = OH_PixelMap_GetBytesNumberPerRow(native, &rowBytes); int32_t res = OH_PixelMap_GetBytesNumberPerRow(native, &rowBytes);
if (res != IMAGE_RESULT_SUCCESS || rowBytes == NUM_0) { if (res != OHOS_IMAGE_RESULT_SUCCESS || rowBytes == NUM_0) {
return result; return result;
} }
...@@ -246,7 +249,7 @@ napi_value ImagePixelMapNDKTest::GetIsEditable(napi_env env, napi_callback_info ...@@ -246,7 +249,7 @@ napi_value ImagePixelMapNDKTest::GetIsEditable(napi_env env, napi_callback_info
int32_t editable = NUM_0; int32_t editable = NUM_0;
int32_t res = OH_PixelMap_GetIsEditable(native, &editable); int32_t res = OH_PixelMap_GetIsEditable(native, &editable);
if (res != IMAGE_RESULT_SUCCESS) { if (res != OHOS_IMAGE_RESULT_SUCCESS) {
return result; return result;
} }
...@@ -266,7 +269,7 @@ napi_value ImagePixelMapNDKTest::IsSupportAlpha(napi_env env, napi_callback_info ...@@ -266,7 +269,7 @@ napi_value ImagePixelMapNDKTest::IsSupportAlpha(napi_env env, napi_callback_info
int32_t supportAlpha = NUM_0; int32_t supportAlpha = NUM_0;
int32_t res = OH_PixelMap_IsSupportAlpha(native, &supportAlpha); int32_t res = OH_PixelMap_IsSupportAlpha(native, &supportAlpha);
if (res != IMAGE_RESULT_SUCCESS) { if (res != OHOS_IMAGE_RESULT_SUCCESS) {
return result; return result;
} }
...@@ -313,7 +316,7 @@ napi_value ImagePixelMapNDKTest::GetDensity(napi_env env, napi_callback_info inf ...@@ -313,7 +316,7 @@ napi_value ImagePixelMapNDKTest::GetDensity(napi_env env, napi_callback_info inf
int32_t density = NUM_0; int32_t density = NUM_0;
int32_t res = OH_PixelMap_GetDensity(native, &density); int32_t res = OH_PixelMap_GetDensity(native, &density);
if (res != IMAGE_RESULT_SUCCESS) { if (res != OHOS_IMAGE_RESULT_SUCCESS) {
return result; return result;
} }
...@@ -561,9 +564,9 @@ napi_value ImagePixelMapNDKTest::GetImageInfo(napi_env env, napi_callback_info i ...@@ -561,9 +564,9 @@ napi_value ImagePixelMapNDKTest::GetImageInfo(napi_env env, napi_callback_info i
return result; return result;
} }
OhosPixelMapInfos pixelmapInfo; OhosPixelMapInfo pixelmapInfo;
int32_t res = OH_PixelMap_GetImageInfo(native, &pixelmapInfo); int32_t res = OH_PixelMap_GetImageInfo(native, &pixelmapInfo);
if (res != IMAGE_RESULT_SUCCESS) { if (res != OHOS_IMAGE_RESULT_SUCCESS) {
return result; return result;
} }
napi_create_object(env, &result); napi_create_object(env, &result);
...@@ -586,7 +589,7 @@ napi_value ImagePixelMapNDKTest::AccessPixels(napi_env env, napi_callback_info i ...@@ -586,7 +589,7 @@ napi_value ImagePixelMapNDKTest::AccessPixels(napi_env env, napi_callback_info i
void* pixelAddr = nullptr; void* pixelAddr = nullptr;
int32_t res = OH_PixelMap_AccessPixels(native, &pixelAddr); int32_t res = OH_PixelMap_AccessPixels(native, &pixelAddr);
if (res != IMAGE_RESULT_SUCCESS || pixelAddr == nullptr) { if (res != OHOS_IMAGE_RESULT_SUCCESS || pixelAddr == nullptr) {
return result; return result;
} }
napi_create_int32(env, res, &result); napi_create_int32(env, res, &result);
...@@ -630,3 +633,5 @@ __attribute__((constructor)) void RegisterModule(void) ...@@ -630,3 +633,5 @@ __attribute__((constructor)) void RegisterModule(void)
napi_module_register(&demoModule); napi_module_register(&demoModule);
} }
EXTERN_C_END EXTERN_C_END
}
}
\ No newline at end of file
...@@ -20,9 +20,10 @@ ...@@ -20,9 +20,10 @@
#include <string> #include <string>
#include "napi/native_api.h" #include "napi/native_api.h"
#include "image_pixel_map_mdk.h"
#include "image_pixel_map_napi.h" #include "image_pixel_map_napi.h"
namespace OHOS {
namespace Media {
class ImagePixelMapNDKTest { class ImagePixelMapNDKTest {
public: public:
static napi_value Init(napi_env env, napi_value exports); static napi_value Init(napi_env env, napi_value exports);
...@@ -46,4 +47,6 @@ public: ...@@ -46,4 +47,6 @@ public:
static napi_value UnAccessPixels(napi_env env, napi_callback_info info); static napi_value UnAccessPixels(napi_env env, napi_callback_info info);
private: private:
}; };
} // namespace Media
} // namespace OHOS
#endif #endif
\ No newline at end of file
...@@ -88,7 +88,7 @@ napi_value ImageReceiverNDKTest::JsCreateImageReceiver(napi_env env, napi_callba ...@@ -88,7 +88,7 @@ napi_value ImageReceiverNDKTest::JsCreateImageReceiver(napi_env env, napi_callba
return udfVar; return udfVar;
} }
int32_t res = OH_Image_Receiver_CreateImageReceiver(env, receiverInfo, &receiver); int32_t res = OH_Image_Receiver_CreateImageReceiver(env, receiverInfo, &receiver);
if (res != IMAGE_RESULT_SUCCESS || receiver == nullptr) { if (res != OHOS_IMAGE_RESULT_SUCCESS || receiver == nullptr) {
return udfVar; return udfVar;
} }
return receiver; return receiver;
...@@ -118,7 +118,7 @@ napi_value ImageReceiverNDKTest::JsGetReceivingSurfaceId(napi_env env, napi_call ...@@ -118,7 +118,7 @@ napi_value ImageReceiverNDKTest::JsGetReceivingSurfaceId(napi_env env, napi_call
} }
char buf[ID_SIZE] = {0}; char buf[ID_SIZE] = {0};
int32_t res = OH_Image_Receiver_GetReceivingSurfaceId(native, buf, ID_SIZE); int32_t res = OH_Image_Receiver_GetReceivingSurfaceId(native, buf, ID_SIZE);
if (res != IMAGE_RESULT_SUCCESS) { if (res != OHOS_IMAGE_RESULT_SUCCESS) {
return result; return result;
} }
HiviewDFX::HiLog::Debug(LABEL, "JsGetReceivingSurfaceId IN [%{public}x]", buf[0]); HiviewDFX::HiLog::Debug(LABEL, "JsGetReceivingSurfaceId IN [%{public}x]", buf[0]);
...@@ -139,7 +139,7 @@ napi_value ImageReceiverNDKTest::JsReadLatestImage(napi_env env, napi_callback_i ...@@ -139,7 +139,7 @@ napi_value ImageReceiverNDKTest::JsReadLatestImage(napi_env env, napi_callback_i
} }
int32_t res = OH_Image_Receiver_ReadLatestImage(native, &result); int32_t res = OH_Image_Receiver_ReadLatestImage(native, &result);
if (res != IMAGE_RESULT_SUCCESS) { if (res != OHOS_IMAGE_RESULT_SUCCESS) {
napi_get_undefined(env, &result); napi_get_undefined(env, &result);
return result; return result;
} }
...@@ -157,7 +157,7 @@ napi_value ImageReceiverNDKTest::JsReadNextImage(napi_env env, napi_callback_inf ...@@ -157,7 +157,7 @@ napi_value ImageReceiverNDKTest::JsReadNextImage(napi_env env, napi_callback_inf
} }
int32_t res = OH_Image_Receiver_ReadNextImage(native, &result); int32_t res = OH_Image_Receiver_ReadNextImage(native, &result);
if (res != IMAGE_RESULT_SUCCESS) { if (res != OHOS_IMAGE_RESULT_SUCCESS) {
napi_get_undefined(env, &result); napi_get_undefined(env, &result);
return result; return result;
} }
...@@ -228,7 +228,7 @@ napi_value ImageReceiverNDKTest::JsGetSize(napi_env env, napi_callback_info info ...@@ -228,7 +228,7 @@ napi_value ImageReceiverNDKTest::JsGetSize(napi_env env, napi_callback_info info
} }
struct OhosImageSize size; struct OhosImageSize size;
int32_t res = OH_Image_Receiver_GetSize(native, &size); int32_t res = OH_Image_Receiver_GetSize(native, &size);
if (res != IMAGE_RESULT_SUCCESS) { if (res != OHOS_IMAGE_RESULT_SUCCESS) {
return result; return result;
} }
...@@ -249,7 +249,7 @@ napi_value ImageReceiverNDKTest::JsGetCapacity(napi_env env, napi_callback_info ...@@ -249,7 +249,7 @@ napi_value ImageReceiverNDKTest::JsGetCapacity(napi_env env, napi_callback_info
} }
int32_t capacity; int32_t capacity;
int32_t res = OH_Image_Receiver_GetCapacity(native, &capacity); int32_t res = OH_Image_Receiver_GetCapacity(native, &capacity);
if (res != IMAGE_RESULT_SUCCESS) { if (res != OHOS_IMAGE_RESULT_SUCCESS) {
return result; return result;
} }
napi_create_int32(env, capacity, &result); napi_create_int32(env, capacity, &result);
...@@ -267,7 +267,7 @@ napi_value ImageReceiverNDKTest::JsGetFormat(napi_env env, napi_callback_info in ...@@ -267,7 +267,7 @@ napi_value ImageReceiverNDKTest::JsGetFormat(napi_env env, napi_callback_info in
} }
int32_t format; int32_t format;
int32_t res = OH_Image_Receiver_GetFormat(native, &format); int32_t res = OH_Image_Receiver_GetFormat(native, &format);
if (res != IMAGE_RESULT_SUCCESS) { if (res != OHOS_IMAGE_RESULT_SUCCESS) {
return result; return result;
} }
napi_create_int32(env, format, &result); napi_create_int32(env, format, &result);
...@@ -321,7 +321,7 @@ napi_value ImageReceiverNDKTest::JsImageClipRect(napi_env env, napi_callback_inf ...@@ -321,7 +321,7 @@ napi_value ImageReceiverNDKTest::JsImageClipRect(napi_env env, napi_callback_inf
} }
struct OhosImageRect rect; struct OhosImageRect rect;
int32_t res = OH_Image_ClipRect(native, &rect); int32_t res = OH_Image_ClipRect(native, &rect);
if (res != IMAGE_RESULT_SUCCESS) { if (res != OHOS_IMAGE_RESULT_SUCCESS) {
return result; return result;
} }
...@@ -344,7 +344,7 @@ napi_value ImageReceiverNDKTest::JsImageSize(napi_env env, napi_callback_info in ...@@ -344,7 +344,7 @@ napi_value ImageReceiverNDKTest::JsImageSize(napi_env env, napi_callback_info in
} }
struct OhosImageSize size; struct OhosImageSize size;
int32_t res = OH_Image_Size(native, &size); int32_t res = OH_Image_Size(native, &size);
if (res != IMAGE_RESULT_SUCCESS) { if (res != OHOS_IMAGE_RESULT_SUCCESS) {
return result; return result;
} }
napi_create_object(env, &result); napi_create_object(env, &result);
...@@ -364,7 +364,7 @@ napi_value ImageReceiverNDKTest::JsImageFormat(napi_env env, napi_callback_info ...@@ -364,7 +364,7 @@ napi_value ImageReceiverNDKTest::JsImageFormat(napi_env env, napi_callback_info
} }
int32_t format; int32_t format;
int32_t res = OH_Image_Format(native, &format); int32_t res = OH_Image_Format(native, &format);
if (res != IMAGE_RESULT_SUCCESS) { if (res != OHOS_IMAGE_RESULT_SUCCESS) {
return result; return result;
} }
napi_create_uint32(env, format, &result); napi_create_uint32(env, format, &result);
...@@ -393,7 +393,7 @@ napi_value ImageReceiverNDKTest::JsImageGetComponent(napi_env env, napi_callback ...@@ -393,7 +393,7 @@ napi_value ImageReceiverNDKTest::JsImageGetComponent(napi_env env, napi_callback
struct OhosImageComponent component; struct OhosImageComponent component;
int32_t res = OH_Image_GetComponent(native, componentType, &component); int32_t res = OH_Image_GetComponent(native, componentType, &component);
if (res != IMAGE_RESULT_SUCCESS) { if (res != OHOS_IMAGE_RESULT_SUCCESS) {
return result; return result;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册