未验证 提交 8fd312c3 编写于 作者: O openharmony_ci 提交者: Gitee

!8610 add imageSourceNdk testcase

Merge pull request !8610 from 黄开兴/master
......@@ -45,6 +45,7 @@ group("multimedia") {
"image/image_js_standard/imageReceiver:image_receiver_js_hap",
"image/image_js_standard/imageReceiverMultiThread:image_receiver_multi_thread_hap",
"image/image_js_standard/imageReceiverNDK:image_receiver_ndk_js_hap",
"image/image_js_standard/imageSourceNDK:image_source_ndk_js_hap",
"image/image_js_standard/imageSvg:image_svg_js_hap",
"image/image_js_standard/imageWebp:image_webp_js_hap",
"image/image_js_standard/imageYUV:image_yuv_js_hap",
......
# Copyright (c) 2023 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("//build/ohos.gni")
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("image_source_ndk_js_hap") {
hap_profile = "./entry/src/main/config.json"
deps = [
":ace_third_ets_assets",
":ace_third_ets_resources",
":ace_third_ets_test_assets",
]
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsImageSourceNdkJsTest"
subsystem_name = "multimedia"
part_name = "multimedia_image_framework"
shared_libraries = [ "./entry/src/main/cpp:ImageSourceNDKTest" ]
}
ohos_js_assets("ace_third_ets_assets") {
source_dir = "./entry/src/main/ets/MainAbility"
}
ohos_js_assets("ace_third_ets_test_assets") {
source_dir = "./entry/src/main/ets/TestAbility"
}
ohos_resources("ace_third_ets_resources") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "OHJSUnitTest",
"test-timeout": "600000",
"testcase-timeout": "300000",
"bundle-name": "ohos.acts.multimedia.imageSourceNDK",
"package-name": "ohos.acts.multimedia.imageSourceNDK",
"shell-timeout": "600000"
},
"kits": [
{
"test-file-name": [
"ActsImageSourceNdkJsTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "ShellKit",
"run-command": [
"mkdir -p /data/app/el2/100/base/ohos.acts.multimedia.imageSourceNDK/haps/entry/files/",
"chmod -R 666 /data/app/el2/100/base/ohos.acts.multimedia.imageSourceNDK/haps/entry/files/*"
],
"teardown-command": []
},
{
"type": "PushKit",
"pre-push": [],
"push": [
"./resource/image/moving_test.gif ->/data/app/el2/100/base/ohos.acts.multimedia.imageSourceNDK/haps/entry/files",
"./resource/image/test_exif.jpg ->/data/app/el2/100/base/ohos.acts.multimedia.imageSourceNDK/haps/entry/files",
"./resource/image/test.jpg ->/data/app/el2/100/base/ohos.acts.multimedia.imageSourceNDK/haps/entry/files",
"./resource/image/test.png ->/data/app/el2/100/base/ohos.acts.multimedia.imageSourceNDK/haps/entry/files",
"./resource/image/test.bmp ->/data/app/el2/100/base/ohos.acts.multimedia.imageSourceNDK/haps/entry/files",
"./resource/image/test_large.webp ->/data/app/el2/100/base/ohos.acts.multimedia.imageSourceNDK/haps/entry/files",
"./resource/image/test_large.svg ->/data/app/el2/100/base/ohos.acts.multimedia.imageSourceNDK/haps/entry/files",
"./resource/image/test_dng.dng ->/data/app/el2/100/base/ohos.acts.multimedia.imageSourceNDK/haps/entry/files",
"./resource/image/test.nrw ->/data/app/el2/100/base/ohos.acts.multimedia.imageSourceNDK/haps/entry/files",
"./resource/image/test.cr2 ->/data/app/el2/100/base/ohos.acts.multimedia.imageSourceNDK/haps/entry/files",
"./resource/image/test.arw ->/data/app/el2/100/base/ohos.acts.multimedia.imageSourceNDK/haps/entry/files",
"./resource/image/test.pef ->/data/app/el2/100/base/ohos.acts.multimedia.imageSourceNDK/haps/entry/files",
"./resource/image/test.raf ->/data/app/el2/100/base/ohos.acts.multimedia.imageSourceNDK/haps/entry/files",
"./resource/image/test.rw2 ->/data/app/el2/100/base/ohos.acts.multimedia.imageSourceNDK/haps/entry/files"
]
},
{
"type": "ShellKit",
"run-command": [
"hilog -Q pidoff",
"chmod 777 /data/app/el2/100/base/ohos.acts.multimedia.imageSourceNDK/haps/entry/files/*"
],
"teardown-command": [
"rm -rf /data/app/el2/100/base/ohos.acts.multimedia.imageSourceNDK/*"
]
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "ohos.acts.multimedia.imageSourceNDK",
"vendor": "open",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 9,
"releaseType": "Release",
"target": 9
}
},
"deviceConfig": {},
"module": {
"package": "ohos.acts.multimedia.imageSourceNDK",
"name": ".MyApplication",
"mainAbility": "ohos.acts.multimedia.imageSourceNDK.MainAbility",
"deviceType": [
"tablet",
"default",
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": false
},
"reqPermissions": [
{
"name": "ohos.permission.GET_BUNDLE_INFO",
"reason": "use ohos.permission.GET_BUNDLE_INFO"
},
{
"name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"reason": "use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
},
{
"name": "ohos.permission.GRANT_SENSITIVE_PERMISSIONS",
"reason": "use ohos.permission.GRANT_SENSITIVE_PERMISSIONS"
},
{
"name": "ohos.permission.REVOKE_SENSITIVE_PERMISSIONS",
"reason": "use ohos.permission.REVOKE_SENSITIVE_PERMISSIONS"
},
{
"name": "ohos.permission.MEDIA_LOCATION",
"reason": "use ohos.permission.MEDIA_LOCATION"
},
{
"name": "ohos.permission.READ_MEDIA",
"reason": "use ohos.permission.READ_MEDIA"
},
{
"name": "ohos.permission.WRITE_MEDIA",
"reason": "use ohos.permission.WRITE_MEDIA"
}
],
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"orientation": "unspecified",
"visible": true,
"srcPath": "MainAbility",
"name": ".MainAbility",
"srcLanguage": "ets",
"icon": "$media:icon",
"description": "$string:description_mainability",
"formsEnabled": false,
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
},
{
"orientation": "unspecified",
"visible": true,
"srcPath": "TestAbility",
"name": ".TestAbility",
"srcLanguage": "ets",
"icon": "$media:icon",
"description": "$string:TestAbility_desc",
"formsEnabled": false,
"label": "$string:TestAbility_label",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
# Copyright (C) 2023 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("//build/config/ohos/config.gni")
import("//build/ohos.gni")
import("//foundation/arkui/napi/napi.gni")
import("//foundation/multimedia/image_framework/ide/image_decode_config.gni")
config("config") {
visibility = [ ":*" ]
cflags = [
"-Wall",
"-Werror",
"-g3",
"-Wunused-variable",
]
}
ohos_shared_library("ImageSourceNDKTest") {
sources = [ "./napi/image_source_test.cpp" ]
if (target_cpu == "arm") {
libs = [ "${clang_base_path}/../libcxx-ndk/lib/arm-linux-ohos/c++/libc++_shared.so" ]
} else if (target_cpu == "arm64") {
libs = [ "${clang_base_path}/../libcxx-ndk/lib/aarch64-linux-ohos/c++/libc++_shared.so" ]
} else {
libs = []
}
include_dirs = [ "../cpp" ]
configs = [ ":config" ]
deps = [ "$image_subsystem/frameworks/kits/js/common/ndk:image_source_ndk" ]
external_deps = [
"hiviewdfx_hilog_native:libhilog",
"napi:ace_napi",
]
output_extension = "so"
subsystem_name = "multimedia"
part_name = "multimedia_image_framework"
}
/*
* Copyright (c) 2023 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.
*/
#include "image_source_test.h"
#include "node_api.h"
#include "image_pixel_map_napi.h"
#include <cstdlib>
#include "hilog/log.h"
namespace {
constexpr size_t SIZE_ZERO = 0;
constexpr size_t SIZE_ONE = 1;
constexpr size_t SIZE_TWO = 2;
constexpr size_t SIZE_THREE = 3;
constexpr size_t DEFAULT_STRING_SIZE = 64;
constexpr uint32_t ARGS_FIRST = 0;
constexpr uint32_t ARGS_SECOND = 1;
constexpr uint32_t ARGS_THIRD = 2;
constexpr uint32_t INVALID_FRAME_COUNT = 0;
constexpr int8_t INT8_FALSE = 0;
constexpr int8_t INT8_TRUE = 1;
constexpr int32_t DEFAULT_INDEX = 0;
}
namespace OHOS {
namespace Media {
const unsigned int LOG_ID = 0xD002B05;
constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {LOG_CORE, LOG_ID, "ImageSourceNDKTest"};
#define MY_HILOG(op, fmt, args...) \
do { \
op(LABEL, "{%{public}s:%{public}d} " fmt, __FUNCTION__, __LINE__, ##args); \
} while (0)
#define DEBUG_LOG(fmt, ...) MY_HILOG(OHOS::HiviewDFX::HiLog::Info, fmt, ##__VA_ARGS__)
#define DEBUG_PTR(p) (((p) == nullptr)?"nullptr":"not nullptr")
#define STATIC_FUNCTION(n, f) { (n), nullptr, (f), nullptr, nullptr, nullptr, napi_static, nullptr }
napi_value ImageSourceNDKTest::Init(napi_env env, napi_value exports)
{
napi_property_descriptor props[] = {
STATIC_FUNCTION("create", Create),
STATIC_FUNCTION("createIncremental", CreateIncremental),
STATIC_FUNCTION("initNative", InitNative),
STATIC_FUNCTION("createPixelMap", CreatePixelMap),
STATIC_FUNCTION("createPixelMapList", CreatePixelMapList),
STATIC_FUNCTION("getDelayTime", GetDelayTime),
STATIC_FUNCTION("getFrameCount", GetFrameCount),
STATIC_FUNCTION("getSupportedFormats", GetSupportedFormats),
STATIC_FUNCTION("getImageInfo", GetImageInfo),
STATIC_FUNCTION("getImageProperty", GetImageProperty),
STATIC_FUNCTION("modifyImageProperty", ModifyImageProperty),
STATIC_FUNCTION("updateData", UpdateData),
STATIC_FUNCTION("release", Release),
};
napi_define_properties(env, exports, sizeof(props) / sizeof(props[ARGS_FIRST]), props);
return exports;
}
static bool GetBoolProperty(napi_env env, napi_value root, const char* utf8name, int8_t* res)
{
napi_value property = nullptr;
auto status = napi_get_named_property(env, root, utf8name, &property);
if (status != napi_ok || property == nullptr) {
DEBUG_LOG("Get property error %{public}s", utf8name);
return false;
}
bool tmp = false;
status = napi_get_value_bool(env, property, &tmp);
*res = tmp ? INT8_TRUE : INT8_FALSE;
return (status == napi_ok);
}
static bool GetInt32Property(napi_env env, napi_value root, const char* utf8name, int32_t* res)
{
napi_value property = nullptr;
auto status = napi_get_named_property(env, root, utf8name, &property);
if (status != napi_ok || property == nullptr) {
DEBUG_LOG("Get property error %{public}s", utf8name);
return false;
}
return (napi_get_value_int32(env, property, res) == napi_ok);
}
static bool GetUint32Property(napi_env env, napi_value root, const char* utf8name, uint32_t* res)
{
napi_value property = nullptr;
auto status = napi_get_named_property(env, root, utf8name, &property);
if (status != napi_ok || property == nullptr) {
DEBUG_LOG("Get property error %{public}s", utf8name);
return false;
}
return (napi_get_value_uint32(env, property, res) == napi_ok);
}
static bool GetArrayBufferProperty(napi_env env, napi_value root, const char* utf8name,
uint8_t** buffer, size_t* bufferSize)
{
napi_value property = nullptr;
auto status = napi_get_named_property(env, root, utf8name, &property);
if (status != napi_ok || property == nullptr) {
DEBUG_LOG("Get property error %{public}s", utf8name);
return false;
}
void* tmp;
status = napi_get_arraybuffer_info(env, property, &tmp, bufferSize);
*buffer = static_cast<uint8_t*>(tmp);
return (status == napi_ok);
}
static bool GetStringValue(napi_env env, napi_value value, char** buffer, size_t *bufferSize)
{
if (napi_ok != napi_get_value_string_utf8(env, value, nullptr, SIZE_ZERO, bufferSize)
&& *bufferSize == SIZE_ZERO) {
DEBUG_LOG("Get napi string length error");
return false;
}
*buffer = (char*)malloc((*bufferSize) + 1);
if (napi_ok != napi_get_value_string_utf8(env, value, *buffer, (*bufferSize) + 1, bufferSize)) {
DEBUG_LOG("Get napi string error");
return false;
}
return (*bufferSize > SIZE_ZERO);
}
static void setInt32NamedProperty(napi_env env, napi_value object, const char* utf8name, uint32_t value)
{
napi_value tmp;
napi_create_int32(env, value, &tmp);
napi_set_named_property(env, object, utf8name, tmp);
}
static bool checkType(napi_env env, napi_value arg, napi_valuetype type)
{
napi_valuetype argType = napi_undefined;
napi_typeof(env, arg, &argType);
return (type == argType);
}
static bool checkArgs(napi_value* argValue, size_t argCount, size_t want)
{
if (argCount < want) {
DEBUG_LOG("argCount %{public}zu < want %{public}zu", argCount, want);
return false;
}
for (size_t i = SIZE_ZERO; i < want; i++) {
if (argValue[i] == nullptr) {
DEBUG_LOG("argValue[%{public}zu] is nullptr", i);
return false;
}
}
return true;
}
static bool parseImageSource(napi_env env, napi_value arg, struct OhosImageSource &src)
{
if (env == nullptr || arg == nullptr) {
DEBUG_LOG("env is %{public}s || arg is %{public}s", DEBUG_PTR(env), DEBUG_PTR(arg));
return false;
}
bool isArrayBuffer = false;
if (checkType(env, arg, napi_string)) {
DEBUG_LOG("Uri arg In");
if (!GetStringValue(env, arg, &src.uri, &src.uriSize)) {
DEBUG_LOG("Uri arg failed");
return false;
}
DEBUG_LOG("Uri arg %{public}s", src.uri);
return true;
} else if (checkType(env, arg, napi_number)) {
DEBUG_LOG("Fd arg In");
if (napi_ok != napi_get_value_int32(env, arg, &(src.fd))) {
DEBUG_LOG("Fd arg failed");
return false;
}
return true;
} else if (napi_is_arraybuffer(env, arg, &isArrayBuffer) == napi_ok && isArrayBuffer) {
DEBUG_LOG("Buffer arg In");
void* buf = nullptr;
if (napi_ok != napi_get_arraybuffer_info(env, arg, &buf, &(src.bufferSize)) || buf == nullptr ||
src.bufferSize == SIZE_ZERO) {
DEBUG_LOG("Fd arg failed");
return false;
}
src.buffer = static_cast<uint8_t*>(buf);
return true;
}
DEBUG_LOG("Invaild arg type");
return false;
}
static void OhosImageSourceRelease(struct OhosImageSource &src)
{
if (src.uri != nullptr) {
free(src.uri);
src.uri = nullptr;
}
}
static bool parseImageSourceOpt(napi_env env, napi_value arg, struct OhosImageSourceOps &src)
{
if (env == nullptr || arg == nullptr) {
DEBUG_LOG("env is %{public}s || arg is %{public}s", DEBUG_PTR(env), DEBUG_PTR(arg));
return false;
}
// Optional parameters, no need check error.
GetInt32Property(env, arg, "density", &(src.density));
GetInt32Property(env, arg, "pixelFormat", &(src.pixelFormat));
napi_value nSize = nullptr;
auto status = napi_get_named_property(env, arg, "size", &nSize);
if (status == napi_ok && nSize != nullptr) {
GetInt32Property(env, nSize, "width", &(src.size.width));
GetInt32Property(env, nSize, "height", &(src.size.height));
}
return true;
}
static bool parseImageDecodingOps(napi_env env, napi_value arg, struct OhosImageDecodingOps &ops)
{
if (env == nullptr || arg == nullptr) {
DEBUG_LOG("env is %{public}s || arg is %{public}s", DEBUG_PTR(env), DEBUG_PTR(arg));
return false;
}
// Optional parameters, no need check error.
GetBoolProperty(env, arg, "editable", &(ops.editable));
GetInt32Property(env, arg, "pixelFormat", &(ops.pixelFormat));
GetInt32Property(env, arg, "fitDensity", &(ops.fitDensity));
GetUint32Property(env, arg, "index", &(ops.index));
GetUint32Property(env, arg, "sampleSize", &(ops.sampleSize));
GetUint32Property(env, arg, "rotate", &(ops.rotate));
napi_value nSize = nullptr;
auto status = napi_get_named_property(env, arg, "size", &nSize);
if (status == napi_ok && nSize != nullptr) {
GetInt32Property(env, nSize, "width", &(ops.size.width));
GetInt32Property(env, nSize, "height", &(ops.size.height));
}
napi_value nRegion = nullptr;
status = napi_get_named_property(env, arg, "region", &nRegion);
if (status == napi_ok && nRegion != nullptr) {
GetInt32Property(env, nRegion, "x", &(ops.region.x));
GetInt32Property(env, nRegion, "y", &(ops.region.y));
GetInt32Property(env, nRegion, "width", &(ops.region.width));
GetInt32Property(env, nRegion, "height", &(ops.region.height));
}
return true;
}
static napi_value createUndefine(napi_env env)
{
napi_value udfVal = nullptr;
napi_get_undefined(env, &udfVal);
return udfVal;
}
static napi_value createResultValue(napi_env env, int32_t resCode, napi_value res = nullptr)
{
napi_value result = nullptr;
// JS result like
// {code: <error code>, result: <result value>}
napi_value nRes = nullptr;
napi_create_int32(env, resCode, &nRes);
napi_create_object(env, &result);
napi_set_named_property(env, result, "code", nRes);
if (res != nullptr) {
napi_set_named_property(env, result, "result", res);
}
return result;
}
napi_value ImageSourceNDKTest::Create(napi_env env, napi_callback_info info)
{
napi_value thisVar = nullptr;
napi_value argValue[SIZE_TWO] = {0};
size_t argCount = SIZE_TWO;
if (napi_get_cb_info(env, info, &argCount, argValue, &thisVar, nullptr) != napi_ok ||
!checkArgs(argValue, argCount, SIZE_TWO)) {
return createUndefine(env);
}
struct OhosImageSource src;
if (!parseImageSource(env, argValue[ARGS_FIRST], src)) {
DEBUG_LOG("parseImageSource failed!!!");
OhosImageSourceRelease(src);
return createUndefine(env);
}
struct OhosImageSourceOps ops;
if (!parseImageSourceOpt(env, argValue[ARGS_SECOND], ops)) {
DEBUG_LOG("parseImageSourceOpt failed!!!");
OhosImageSourceRelease(src);
return createUndefine(env);
}
napi_value imageSource = nullptr;
int32_t res = OH_ImageSource_Create(env, &src, &ops, &imageSource);
OhosImageSourceRelease(src);
return createResultValue(env, res, imageSource);
}
napi_value ImageSourceNDKTest::CreateIncremental(napi_env env, napi_callback_info info)
{
napi_value thisVar = nullptr;
napi_value argValue[SIZE_TWO] = {0};
size_t argCount = SIZE_TWO;
if (napi_get_cb_info(env, info, &argCount, argValue, &thisVar, nullptr) != napi_ok ||
!checkArgs(argValue, argCount, SIZE_TWO)) {
return createUndefine(env);
}
// No source check. There is no source input.
struct OhosImageSource src;
parseImageSource(env, argValue[ARGS_FIRST], src);
struct OhosImageSourceOps ops;
if (!parseImageSourceOpt(env, argValue[ARGS_SECOND], ops)) {
DEBUG_LOG("parseImageSourceOpt failed!!!");
OhosImageSourceRelease(src);
return createUndefine(env);
}
napi_value imageSource = nullptr;
int32_t res = OH_ImageSource_CreateIncremental(env, &src, &ops, &imageSource);
if (res != OHOS_IMAGE_RESULT_SUCCESS || imageSource == nullptr) {
OhosImageSourceRelease(src);
return createUndefine(env);
}
OhosImageSourceRelease(src);
return createResultValue(env, res, imageSource);
}
static ImageSourceNative* getNativeImageSource(napi_env env, napi_callback_info info,
napi_value* argValue, size_t &argCount)
{
napi_value thisVar = nullptr;
if (argValue == nullptr || argCount == SIZE_ZERO) {
DEBUG_LOG("Invaild input!");
return nullptr;
}
if (napi_get_cb_info(env, info, &argCount, argValue, &thisVar, nullptr) != napi_ok) {
return nullptr;
}
return OH_ImageSource_InitNative(env, argValue[ARGS_FIRST]);
}
napi_value ImageSourceNDKTest::InitNative(napi_env env, napi_callback_info info)
{
napi_value argValue[SIZE_ONE] = {0};
size_t argCount = SIZE_ONE;
ImageSourceNative* native = getNativeImageSource(env, info, argValue, argCount);
if (native == nullptr) {
return createUndefine(env);
}
return createResultValue(env, OHOS_IMAGE_RESULT_SUCCESS);
}
napi_value ImageSourceNDKTest::CreatePixelMap(napi_env env, napi_callback_info info)
{
napi_value argValue[SIZE_TWO] = {0};
size_t argCount = SIZE_TWO;
ImageSourceNative* native = getNativeImageSource(env, info, argValue, argCount);
if (native == nullptr || !checkArgs(argValue, argCount, SIZE_TWO)) {
DEBUG_LOG("argValue check failed");
return createUndefine(env);
}
struct OhosImageDecodingOps ops;
if (!parseImageDecodingOps(env, argValue[ARGS_SECOND], ops)) {
DEBUG_LOG("parseImageDecodingOps failed");
return createUndefine(env);
}
napi_value pixelmap = nullptr;
int32_t res = OH_ImageSource_CreatePixelMap(native, &ops, &pixelmap);
return createResultValue(env, res, pixelmap);
}
napi_value ImageSourceNDKTest::CreatePixelMapList(napi_env env, napi_callback_info info)
{
napi_value argValue[SIZE_TWO] = {0};
size_t argCount = SIZE_TWO;
ImageSourceNative* native = getNativeImageSource(env, info, argValue, argCount);
if (native == nullptr || !checkArgs(argValue, argCount, SIZE_TWO)) {
DEBUG_LOG("argValue check failed");
return createUndefine(env);
}
struct OhosImageDecodingOps ops;
if (!parseImageDecodingOps(env, argValue[ARGS_SECOND], ops)) {
DEBUG_LOG("parseImageDecodingOps failed");
return createUndefine(env);
}
napi_value pixelmapList = nullptr;
int32_t res = OH_ImageSource_CreatePixelMapList(native, &ops, &pixelmapList);
return createResultValue(env, res, pixelmapList);
}
static void ReleaseDelayTimeList(struct OhosImageSourceDelayTimeList &timeList)
{
if (timeList.delayTimeList != nullptr) {
timeList.size = SIZE_ZERO;
free(timeList.delayTimeList);
timeList.delayTimeList = nullptr;
}
}
napi_value ImageSourceNDKTest::GetDelayTime(napi_env env, napi_callback_info info) __attribute__((no_sanitize("cfi")))
{
napi_value argValue[SIZE_ONE] = {0};
size_t argCount = SIZE_ONE;
ImageSourceNative* native = getNativeImageSource(env, info, argValue, argCount);
if (native == nullptr) {
DEBUG_LOG("argValue check failed");
return createUndefine(env);
}
struct OhosImageSourceDelayTimeList timeList;
int32_t res = OH_ImageSource_GetDelayTime(native, &timeList);
if (timeList.size == SIZE_ZERO) {
DEBUG_LOG("Delay time list get failed");
return createUndefine(env);
}
timeList.delayTimeList = (int32_t*)malloc(sizeof(int32_t) * timeList.size);
res = OH_ImageSource_GetDelayTime(native, &timeList);
napi_value result;
napi_create_array(env, &result);
for (size_t i = SIZE_ZERO; i < timeList.size; i++) {
napi_value nDelayTime = nullptr;
napi_create_int32(env, timeList.delayTimeList[i], &nDelayTime);
napi_set_element(env, result, i, nDelayTime);
}
ReleaseDelayTimeList(timeList);
return createResultValue(env, res, result);
}
napi_value ImageSourceNDKTest::GetFrameCount(napi_env env, napi_callback_info info)
{
napi_value argValue[SIZE_ONE] = {0};
size_t argCount = SIZE_ONE;
ImageSourceNative* native = getNativeImageSource(env, info, argValue, argCount);
if (native == nullptr) {
DEBUG_LOG("argValue check failed");
return createUndefine(env);
}
uint32_t frameCount = INVALID_FRAME_COUNT;
int32_t res = OH_ImageSource_GetFrameCount(native, &frameCount);
napi_value nFrameCount = nullptr;
napi_create_int32(env, frameCount, &nFrameCount);
return createResultValue(env, res, nFrameCount);
}
static void ReleaseSupportedFormatList(struct OhosImageSourceSupportedFormatList &formatList)
{
if (formatList.supportedFormatList == nullptr) {
return;
}
for (size_t i = SIZE_ZERO; i < formatList.size; i++) {
auto format = formatList.supportedFormatList[i];
if (format != nullptr) {
if (format->format != nullptr) {
free(format->format);
format->format = nullptr;
}
free(format);
}
}
free(formatList.supportedFormatList);
formatList.supportedFormatList = nullptr;
}
napi_value ImageSourceNDKTest::GetSupportedFormats(napi_env env, napi_callback_info info) __attribute__((no_sanitize("cfi")))
{
struct OhosImageSourceSupportedFormatList formatList;
int32_t res = OH_ImageSource_GetSupportedFormats(&formatList);
if (formatList.size == SIZE_ZERO) {
DEBUG_LOG("Supported format list get failed");
return createUndefine(env);
}
formatList.supportedFormatList = (struct OhosImageSourceSupportedFormat**)malloc(
sizeof(struct OhosImageSourceSupportedFormat*) * formatList.size);
for (size_t i = 0; i < formatList.size; i++) {
formatList.supportedFormatList[i] = (struct OhosImageSourceSupportedFormat*)malloc(
sizeof(struct OhosImageSourceSupportedFormat));
formatList.supportedFormatList[i]->format = (char*)malloc(DEFAULT_STRING_SIZE);
formatList.supportedFormatList[i]->size = DEFAULT_STRING_SIZE;
}
res = OH_ImageSource_GetSupportedFormats(&formatList);
napi_value result;
napi_create_array(env, &result);
for (size_t i = SIZE_ZERO; i < formatList.size; i++) {
napi_value nFormat = nullptr;
auto format = formatList.supportedFormatList[i];
napi_create_string_utf8(env, format->format, format->size, &nFormat);
napi_set_element(env, result, i, nFormat);
}
ReleaseSupportedFormatList(formatList);
return createResultValue(env, res, result);
}
static napi_value createImageInfoNVal(napi_env env, struct OhosImageSourceInfo &imageInfo)
{
napi_value result = nullptr;
napi_create_object(env, &result);
setInt32NamedProperty(env, result, "pixelFormat", imageInfo.pixelFormat);
setInt32NamedProperty(env, result, "colorSpace", imageInfo.colorSpace);
setInt32NamedProperty(env, result, "alphaType", imageInfo.alphaType);
setInt32NamedProperty(env, result, "density", imageInfo.density);
napi_value nSize = nullptr;
napi_create_object(env, &nSize);
setInt32NamedProperty(env, nSize, "width", imageInfo.size.width);
setInt32NamedProperty(env, nSize, "height", imageInfo.size.height);
napi_set_named_property(env, result, "size", nSize);
return result;
}
napi_value ImageSourceNDKTest::GetImageInfo(napi_env env, napi_callback_info info)
{
napi_value argValue[SIZE_TWO] = {0};
size_t argCount = SIZE_TWO;
ImageSourceNative* native = getNativeImageSource(env, info, argValue, argCount);
if (native == nullptr || !checkArgs(argValue, argCount, SIZE_TWO)) {
DEBUG_LOG("argValue check failed");
return createUndefine(env);
}
int32_t index = DEFAULT_INDEX;
napi_get_value_int32(env, argValue[ARGS_SECOND], &index);
struct OhosImageSourceInfo imageInfo;
int32_t res = OH_ImageSource_GetImageInfo(native, index, &imageInfo);
napi_value nImageInfo = createImageInfoNVal(env, imageInfo);
return createResultValue(env, res, nImageInfo);
}
napi_value ImageSourceNDKTest::GetImageProperty(napi_env env, napi_callback_info info) __attribute__((no_sanitize("cfi")))
{
napi_value argValue[SIZE_TWO] = {0};
size_t argCount = SIZE_TWO;
ImageSourceNative* native = getNativeImageSource(env, info, argValue, argCount);
if (native == nullptr || !checkArgs(argValue, argCount, SIZE_TWO)) {
DEBUG_LOG("argValue check failed");
return createUndefine(env);
}
struct OhosImageSourceProperty key;
if (!GetStringValue(env, argValue[ARGS_SECOND], &key.value, &key.size) ||
key.value == nullptr || key.size == SIZE_ZERO) {
DEBUG_LOG("Get key failed");
return createUndefine(env);
}
struct OhosImageSourceProperty val;
int32_t res = OH_ImageSource_GetImageProperty(native, &key, &val);
if (val.size == SIZE_ZERO) {
DEBUG_LOG("Get val size failed");
return createResultValue(env, res, createUndefine(env));
}
val.value = (char*)malloc(val.size);
res = OH_ImageSource_GetImageProperty(native, &key, &val);
napi_value nValue = nullptr;
if (val.value != nullptr && val.size != SIZE_ZERO) {
napi_create_string_utf8(env, val.value, val.size, &nValue);
} else {
DEBUG_LOG("Get val is empty");
}
if (val.value != nullptr) {
free(val.value);
}
return createResultValue(env, res, nValue);
}
napi_value ImageSourceNDKTest::ModifyImageProperty(napi_env env, napi_callback_info info)
{
napi_value argValue[SIZE_THREE] = {0};
size_t argCount = SIZE_THREE;
ImageSourceNative* native = getNativeImageSource(env, info, argValue, argCount);
if (native == nullptr || !checkArgs(argValue, argCount, SIZE_THREE)) {
DEBUG_LOG("argValue check failed");
return createUndefine(env);
}
struct OhosImageSourceProperty key;
if (!GetStringValue(env, argValue[ARGS_SECOND], &key.value, &key.size) ||
key.value == nullptr || key.size == SIZE_ZERO) {
DEBUG_LOG("Get key failed");
return createUndefine(env);
}
struct OhosImageSourceProperty val;
if (!GetStringValue(env, argValue[ARGS_THIRD], &val.value, &val.size) ||
val.value == nullptr || val.size == SIZE_ZERO) {
DEBUG_LOG("Get val failed");
return createUndefine(env);
}
int32_t res = OH_ImageSource_ModifyImageProperty(native, &key, &val);
return createResultValue(env, res);
}
static bool parseImageSourceUpdateData(napi_env env, napi_value arg, struct OhosImageSourceUpdateData &data)
{
if (env == nullptr || arg == nullptr) {
DEBUG_LOG("env is %{public}s || arg is %{public}s", DEBUG_PTR(env), DEBUG_PTR(arg));
return false;
}
GetArrayBufferProperty(env, arg, "buffer", &(data.buffer), &(data.bufferSize));
GetUint32Property(env, arg, "offset", &(data.offset));
GetUint32Property(env, arg, "updateLength", &(data.updateLength));
GetBoolProperty(env, arg, "isCompleted", &(data.isCompleted));
return true;
}
napi_value ImageSourceNDKTest::UpdateData(napi_env env, napi_callback_info info)
{
napi_value argValue[SIZE_TWO] = {0};
size_t argCount = SIZE_TWO;
ImageSourceNative* native = getNativeImageSource(env, info, argValue, argCount);
if (native == nullptr || !checkArgs(argValue, argCount, SIZE_TWO)) {
DEBUG_LOG("argValue check failed");
return createUndefine(env);
}
struct OhosImageSourceUpdateData data;
parseImageSourceUpdateData(env, argValue[ARGS_SECOND], data);
int32_t res = OH_ImageSource_UpdateData(native, &data);
return createResultValue(env, res);
}
napi_value ImageSourceNDKTest::Release(napi_env env, napi_callback_info info)
{
napi_value argValue[SIZE_ONE] = {0};
size_t argCount = SIZE_ONE;
ImageSourceNative* native = getNativeImageSource(env, info, argValue, argCount);
if (native == nullptr) {
DEBUG_LOG("argValue check failed");
return createUndefine(env);
}
int32_t res = OH_ImageSource_Release(native);
return createResultValue(env, res);
}
EXTERN_C_START
static napi_value ModuleRegister(napi_env env, napi_value exports)
{
ImageSourceNDKTest::Init(env, exports);
return exports;
}
static napi_module demoModule = {
.nm_version =1,
.nm_flags = 0,
.nm_filename = nullptr,
.nm_register_func = ModuleRegister,
.nm_modname = "ImageSourceNDKTest",
.nm_priv = nullptr,
.reserved = { 0 },
};
__attribute__((constructor)) void RegisterModule(void)
{
napi_module_register(&demoModule);
}
EXTERN_C_END
}
}
\ No newline at end of file
/*
* Copyright (c) 2023 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.
*/
#ifndef IMAGE_SOURCE_TEST_H
#define IMAGE_SOURCE_TEST_H
#include "napi/native_api.h"
#include "image_pixel_map_napi.h"
#include "image_source_mdk.h"
namespace OHOS {
namespace Media {
class ImageSourceNDKTest {
public:
static napi_value Init(napi_env env, napi_value exports);
static napi_value Create(napi_env env, napi_callback_info info);
static napi_value CreateIncremental(napi_env env, napi_callback_info info);
static napi_value InitNative(napi_env env, napi_callback_info info);
static napi_value CreatePixelMap(napi_env env, napi_callback_info info);
static napi_value CreatePixelMapList(napi_env env, napi_callback_info info);
static napi_value GetDelayTime(napi_env env, napi_callback_info info);
static napi_value GetFrameCount(napi_env env, napi_callback_info info);
static napi_value GetSupportedFormats(napi_env env, napi_callback_info info);
static napi_value GetImageInfo(napi_env env, napi_callback_info info);
static napi_value GetImageProperty(napi_env env, napi_callback_info info);
static napi_value ModifyImageProperty(napi_env env, napi_callback_info info);
static napi_value UpdateData(napi_env env, napi_callback_info info);
static napi_value Release(napi_env env, napi_callback_info info);
private:
};
} // namespace Media
} // namespace OHOS
#endif // IMAGE_SOURCE_TEST_H
\ No newline at end of file
// @ts-nocheck
/**
* Copyright (c) 2023 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from 'hypium/index'
import testsuite from '../test/List.test'
export default {
onCreate() {
console.info('Application onCreate')
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
},
onDestroy() {
console.info('Application onDestroy')
},
}
\ No newline at end of file
// @ts-nocheck
/**
* Copyright (c) 2023 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.
*/
@Entry
@Component
struct MyComponent {
aboutToAppear() {
}
build() {
Flex({
direction: FlexDirection.Column,
alignItems: ItemAlign.Center,
justifyContent: FlexAlign.Center
}) {
Text('ACE ETS TEST')
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.height('100%')
}
}
// @ts-nocheck
/**
* Copyright (c) 2023 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from 'hypium/index'
import testsuite from '../test/List.test'
export default {
onCreate() {
console.info('Application onCreate')
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
},
onDestroy() {
console.info('Application onDestroy')
},
}
\ No newline at end of file
// @ts-nocheck
/**
* Copyright (c) 2023 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 router from '@system.router';
@Entry
@Component
struct Index {
aboutToAppear() {
console.info('TestAbility index aboutToAppear')
}
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('next page')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('35%')
.height('5%')
.onClick(() => {
})
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
// @ts-nocheck
/**
* Copyright (c) 2023 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 TestRunner from '@ohos.application.testRunner'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
var abilityDelegator = undefined
var abilityDelegatorArguments = undefined
function translateParamsToString(parameters) {
const keySet = new Set([
'-s class', '-s notClass', '-s suite', '-s itName',
'-s level', '-s testType', '-s size', '-s timeout',
'-s package'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams += ' ' + key + ' ' + parameters[key]
}
}
return targetParams.trim()
}
async function onAbilityCreateCallback() {
console.log('onAbilityCreateCallback');
}
async function addAbilityMonitorCallback(err: any) {
console.info('addAbilityMonitorCallback : ' + JSON.stringify(err))
}
export default class OpenHarmonyTestRunner implements TestRunner {
constructor() {
}
onPrepare() {
console.info('OpenHarmonyTestRunner OnPrepare')
}
onRun() {
console.log('OpenHarmonyTestRunner onRun run')
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
let lMonitor = {
abilityName: testAbilityName,
onAbilityCreate: onAbilityCreateCallback,
};
var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.MainAbility'
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback)
var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters)
console.info('cmd : ' + cmd)
abilityDelegator.executeShellCommand(cmd,
(err: any, d: any) => {
console.info('executeShellCommand : err : ' + JSON.stringify(err));
console.info('executeShellCommand : data : ' + d.stdResult);
console.info('executeShellCommand : data : ' + d.exitCode);
})
console.info('OpenHarmonyTestRunner onRun call abilityDelegator.getAppContext')
var context = abilityDelegator.getAppContext()
console.info('getAppContext : ' + JSON.stringify(context))
console.info('OpenHarmonyTestRunner onRun end')
}
};
\ No newline at end of file
// @ts-nocheck
/*
* Copyright (c) 2023 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 'hypium/index';
import featureAbility from "@ohos.ability.featureAbility";
import fileio from "@ohos.fileio";
import ndkTest from 'libImageSourceNDKTest.so';
import { testJpg } from './testImg';
export default function ImageSourceNDKTest() {
describe('ImageSourceNDKTest', function () {
const CODE_SUCCESS = 0;
const CODE_ERROR = -1;
const { BITS_PER_SAMPLE, ORIENTATION, IMAGE_LENGTH, IMAGE_WIDTH, GPS_LATITUDE, GPS_LONGITUDE, GPS_LATITUDE_REF,
GPS_LONGITUDE_REF, DATE_TIME_ORIGINAL } = image.PropertyKey;
beforeAll(function () {
console.info('beforeAll case');
})
beforeEach(function () {
console.info('beforeEach case');
})
afterEach(function () {
console.info('afterEach case');
})
afterAll(function () {
console.info('afterAll case');
})
function logger(caseName) {
return {
myName: caseName,
log: function (msg) {
console.info(this.myName + ' ' + msg);
}
}
}
async function getPath(fileName: string) {
let filePath = ""
try {
let context = await featureAbility.getContext();
await context.getFilesDir().then((data) => {
filePath = data + "/" + fileName;
});
console.info("image case filePath is " + filePath);
} catch (error) {
console.info("image getFd " + error);
}
return filePath;
}
async function getFd(fileName) {
let fdNumber = undefined;
let filePath = undefined;
try {
filePath = await getPath(fileName);
console.info("image case filePath is " + filePath);
await fileio.open(filePath, 0o2, 0o777).then((data) => {
fdNumber = data;
console.info("image case open fd success " + fdNumber);
}, (err) => {
console.info("image case open fd fail" + err);
}).catch((err) => {
console.info("image case open fd err " + err);
});
} catch (error) {
console.info("image getFd " + error);
}
return [filePath, fdNumber];
}
function checkNdkRes(res) {
expect(res != undefined).assertTrue();
expect(res.code == CODE_SUCCESS).assertTrue();
}
async function imageSourceCreateTest(done, testNum, picName, source) {
try {
let log = logger(testNum);
let path, fd;
[path, fd] = await getFd(picName);
let imageSourceOps = {
density: 240
};
const sources = {
fd: fd, path: path, buffer: testJpg.buffer
};
let res = ndkTest.create(sources[source], imageSourceOps);
log.log("imageSourceCreate res " + JSON.stringify(res));
checkNdkRes(res);
expect(res.result != undefined).assertTrue();
return res;
} catch (error) {
log.log("Test exception1 " + error);
expect().assertFail();
done();
}
}
async function createPixelMap(done, testNum, picName) {
try {
let res = await imageSourceCreateTest(done, testNum, picName, "fd");
let decodingOps = {
editable: true,
fitDensity: 220
};
let pixelMapRes = ndkTest.createPixelMap(res.result, decodingOps);
checkNdkRes(pixelMapRes);
expect(pixelMapRes.result != undefined).assertTrue();
done();
} catch (error) {
console.error("Test exception " + error);
expect().assertFail();
done();
}
}
async function release(done, testNum, pictureName) {
try {
let log = logger(testNum);
let res = await imageSourceCreateTest(done, testNum, pictureName, "fd");
let releaseRes = ndkTest.release(res.result);
checkNdkRes(releaseRes);
log.log("release result " + releaseRes.code);
done();
} catch (error) {
console.error("Test exception " + error);
expect().assertFail();
done();
}
}
async function getImageProperty(done, testNum, key, checkProps) {
try {
let log = logger(testNum);
let res = await imageSourceCreateTest(done, testNum, "test_exif.jpg", "fd");
let imagePropertyRes = ndkTest.getImageProperty(res.result, key);
expect(imagePropertyRes != undefined).assertTrue();
expect(imagePropertyRes.code == CODE_SUCCESS).assertTrue();
log.log("Image property " + imagePropertyRes.result);
checkProps(imagePropertyRes.result);
done();
} catch (error) {
console.error("Test exception " + error);
expect().assertFail();
done();
}
}
async function modify(done, testNum, prop, checkProps) {
try {
let log = logger(testNum);
let res = await imageSourceCreateTest(done, testNum, "test_exif.jpg", "fd");
let propertyModifyRes = ndkTest.modifyImageProperty(res.result, prop.key, prop.value);
checkNdkRes(propertyModifyRes);
log.log("Image property modify " + propertyModifyRes.code);
let imagePropertyRes = ndkTest.getImageProperty(res.result, prop.key);
expect(imagePropertyRes != undefined).assertTrue();
expect(imagePropertyRes.code == CODE_SUCCESS).assertTrue();
log.log("Image property " + imagePropertyRes.result);
checkProps(imagePropertyRes.result);
done();
} catch (error) {
console.error("Test exception " + error);
expect().assertFail();
done();
}
}
async function modifyErr(done, testNum, key, value) {
try {
let log = logger(testNum)
let res = await imageSourceCreateTest(done, testNum, "test_exif.jpg", "fd");
let propertyModifyRes = ndkTest.modifyImageProperty(res.result, key, value);
log.log("res " + JSON.stringify(propertyModifyRes));
expect(propertyModifyRes.code == CODE_ERROR).assertTrue();
done();
} catch (error) {
console.error("Test exception " + error);
expect().assertFail();
done();
}
}
async function getImagePropertyErr(done, testNum, key) {
try {
let log = logger(testNum)
let res = await imageSourceCreateTest(done, testNum, "test_exif.jpg", "fd");
let imagePropertyRes = ndkTest.getImageProperty(res.result, key);
log.log("res " + JSON.stringify(imagePropertyRes));
expect(imagePropertyRes.code == CODE_ERROR).assertTrue();
done();
} catch (error) {
console.error("Test exception " + error);
expect().assertFail();
done();
}
}
function createImageSourceErr(done, testNum, source) {
try {
let log = logger(testNum);
let imageSourceOps = {
density: 240
};
let res = ndkTest.create(source, imageSourceOps);
log.log("res " + JSON.stringify(res));
expect(res.code == CODE_ERROR).assertTrue();
done();
} catch (error) {
console.error("Test exception " + error);
expect().assertFail();
done();
}
}
/**
* @tc.number : IMAGE_SOURCENDK_CREATE_BY_FD_0100
* @tc.name : createImageSource -gif
* @tc.desc : 1.get fd
* 2.createImageSource
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_CREATE_BY_FD_0100', 0, async function (done) {
await imageSourceCreateTest(done, "IMAGE_SOURCENDK_CREATE_BY_FD_0100", "moving_test.gif", "fd");
done();
})
/**
* @tc.number : IMAGE_SOURCENDK_CREATE_BY_FD_0200
* @tc.name : createImageSource -jpg
* @tc.desc : 1.get fd
* 2.createImageSource
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_CREATE_BY_FD_0200', 0, async function (done) {
await imageSourceCreateTest(done, "IMAGE_SOURCENDK_CREATE_BY_FD_0200", "test.jpg", "fd");
done();
})
/**
* @tc.number : IMAGE_SOURCENDK_CREATE_BY_FD_0300
* @tc.name : createImageSource -bmp
* @tc.desc : 1.get fd
* 2.createImageSource
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_CREATE_BY_FD_0300', 0, async function (done) {
await imageSourceCreateTest(done, "IMAGE_SOURCENDK_CREATE_BY_FD_0300", "test.bmp", "fd");
done();
})
/**
* @tc.number : IMAGE_SOURCENDK_CREATE_BY_FD_0400
* @tc.name : createImageSource -png
* @tc.desc : 1.get fd
* 2.createImageSource
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_CREATE_BY_FD_0400', 0, async function (done) {
await imageSourceCreateTest(done, "IMAGE_SOURCENDK_CREATE_BY_FD_0400", "test.png", "fd");
done();
})
/**
* @tc.number : IMAGE_SOURCENDK_CREATE_BY_FD_0500
* @tc.name : createImageSource -webp
* @tc.desc : 1.get fd
* 2.createImageSource
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_CREATE_BY_FD_0500', 0, async function (done) {
await imageSourceCreateTest(done, "IMAGE_SOURCENDK_CREATE_BY_FD_0500", "test_large.webp", "fd");
done();
})
/**
* @tc.number : IMAGE_SOURCENDK_CREATE_BY_FD_0600
* @tc.name : createImageSource -svg
* @tc.desc : 1.get fd
* 2.createImageSource
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_CREATE_BY_FD_0600', 0, async function (done) {
await imageSourceCreateTest(done, "IMAGE_SOURCENDK_CREATE_BY_FD_0600", "test_large.svg", "fd");
done();
})
/**
* @tc.number : IMAGE_SOURCENDK_CREATE_BY_FD_0700
* @tc.name : createImageSource -dng
* @tc.desc : 1.get fd
* 2.createImageSource
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_CREATE_BY_FD_0700', 0, async function (done) {
await imageSourceCreateTest(done, "IMAGE_SOURCENDK_CREATE_BY_FD_0700", "test_dng.dng", "fd");
done();
})
/**
* @tc.number : IMAGE_SOURCENDK_CREATE_BY_FD_0800
* @tc.name : createImageSource -raw
* @tc.desc : 1.get fd
* 2.createImageSource
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_CREATE_BY_FD_0800', 0, async function (done) {
await imageSourceCreateTest(done, "IMAGE_SOURCENDK_CREATE_BY_FD_0800", "test.nrw", "fd");
done();
})
/**
* @tc.number : IMAGE_SOURCENDK_CREATE_BY_FD_0900
* @tc.name : createImageSource -raw
* @tc.desc : 1.get fd
* 2.createImageSource
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_CREATE_BY_FD_0900', 0, async function (done) {
await imageSourceCreateTest(done, "IMAGE_SOURCENDK_CREATE_BY_FD_0900", "test.cr2", "fd");
done();
})
/**
* @tc.number : IMAGE_SOURCENDK_CREATE_BY_FD_1000
* @tc.name : createImageSource -raw
* @tc.desc : 1.get fd
* 2.createImageSource
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_CREATE_BY_FD_1000', 0, async function (done) {
await imageSourceCreateTest(done, "IMAGE_SOURCENDK_CREATE_BY_FD_1000", "test.arw", "fd");
done();
})
/**
* @tc.number : IMAGE_SOURCENDK_CREATE_BY_FD_1100
* @tc.name : createImageSource -raw
* @tc.desc : 1.get fd
* 2.createImageSource
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_CREATE_BY_FD_1100', 0, async function (done) {
await imageSourceCreateTest(done, "IMAGE_SOURCENDK_CREATE_BY_FD_1100", "test.pef", "fd");
done();
})
/**
* @tc.number : IMAGE_SOURCENDK_CREATE_BY_FD_1200
* @tc.name : createImageSource -raw
* @tc.desc : 1.get fd
* 2.createImageSource
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_CREATE_BY_FD_1200', 0, async function (done) {
await imageSourceCreateTest(done, "IMAGE_SOURCENDK_CREATE_BY_FD_1200", "test.raf", "fd");
done();
})
/**
* @tc.number : IMAGE_SOURCENDK_CREATE_BY_FD_1300
* @tc.name : createImageSource -raw
* @tc.desc : 1.get fd
* 2.createImageSource
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_CREATE_BY_FD_1300', 0, async function (done) {
await imageSourceCreateTest(done, "IMAGE_SOURCENDK_CREATE_BY_FD_1300", "test.rw2", "fd");
done();
})
/**
* @tc.number : IMAGE_SOURCENDK_CREATE_BY_BUFFER
* @tc.name : createImageSource -buffer
* @tc.desc : 1.get image buffer
* 2.createImageSource
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_CREATE_BY_BUFFER', 0, async function (done) {
await imageSourceCreateTest(done, "IMAGE_SOURCENDK_CREATE_BY_BUFFER", "test.jpg", "buffer");
done();
})
/**
* @tc.number : IMAGE_SOURCENDK_CREATE_BY_PATH
* @tc.name : createImageSource -path
* @tc.desc : 1.get image path
* 2.createImageSource
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_CREATE_BY_PATH', 0, async function (done) {
await imageSourceCreateTest(done, "IMAGE_SOURCENDK_CREATE_BY_PATH", "moving_test.gif", "path");
done();
})
/**
* @tc.number : IMAGE_SOURCENDK_CREATE_INCREMENTAL
* @tc.name : createIncremental
* @tc.desc : 1.set imageSourceOps
* 2.createIncremental
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_CREATE_INCREMENTAL', 0, async function (done) {
try {
let log = logger("IMAGE_SOURCENDK_CREATE_INCREMENTAL")
let imageSourceOps = {
density: 240
};
let res = ndkTest.createIncremental(new ArrayBuffer(1), imageSourceOps);
log.log("res " + JSON.stringify(res));
checkNdkRes(res);
expect(res.result != undefined).assertTrue();
done();
} catch (error) {
console.error("Test exception " + JSON.stringify(error));
expect().assertFail();
done();
}
})
/**
* @tc.number : IMAGE_SOURCENDK_INITNATIVE
* @tc.name : initNative
* @tc.desc : 1.create imageSource
* 2.initNative
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_INITNATIVE', 0, async function (done) {
try {
let res = await imageSourceCreateTest(done, "IMAGE_SOURCENDK_INITNATIVE", "moving_test.gif", "fd");
let initRes = ndkTest.initNative(res.result);
checkNdkRes(initRes);
done();
} catch (error) {
console.error("Test exception " + error);
expect().assertFail();
done();
}
})
/**
* @tc.number : IMAGE_SOURCENDK_CREATEPIXELMAP_GIF_0100
* @tc.name : createPixelMap -gif
* @tc.desc : 1.create imageSource
* 2.createPixelMap
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_CREATEPIXELMAP_GIF_0100', 0, async function (done) {
createPixelMap(done, "IMAGE_SOURCENDK_CREATEPIXELMAP_GIF_0100", "moving_test.gif");
})
/**
* @tc.number : IMAGE_SOURCENDK_CREATEPIXELMAP_BMP_0200
* @tc.name : createPixelMap -bmp
* @tc.desc : 1.create imageSource
* 2.createPixelMap
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_CREATEPIXELMAP_BMP_0200', 0, async function (done) {
createPixelMap(done, "IMAGE_SOURCENDK_CREATEPIXELMAP_BMP_0200", "test.bmp");
})
/**
* @tc.number : IMAGE_SOURCENDK_CREATEPIXELMAP_JPG_0300
* @tc.name : createPixelMap -jpg
* @tc.desc : 1.create imageSource
* 2.createPixelMap
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_CREATEPIXELMAP_JPG_0300', 0, async function (done) {
createPixelMap(done, "IMAGE_SOURCENDK_CREATEPIXELMAP_JPG_0300", "test.jpg");
})
/**
* @tc.number : IMAGE_SOURCENDK_CREATEPIXELMAP_WEBP_0400
* @tc.name : createPixelMap -webp
* @tc.desc : 1.create imageSource
* 2.createPixelMap
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_CREATEPIXELMAP_WEBP_0400', 0, async function (done) {
createPixelMap(done, "IMAGE_SOURCENDK_CREATEPIXELMAP_WEBP_0400", "test_large.webp");
})
/**
* @tc.number : IMAGE_SOURCENDK_CREATEPIXELMAP_PNG_0500
* @tc.name : createPixelMap -png
* @tc.desc : 1.create imageSource
* 2.createPixelMap
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_CREATEPIXELMAP_PNG_0500', 0, async function (done) {
createPixelMap(done, "IMAGE_SOURCENDK_CREATEPIXELMAP_PNG_0500", "test.png");
})
/**
* @tc.number : IMAGE_SOURCENDK_CREATEPIXELMAP_SVG_0600
* @tc.name : createPixelMap -svg
* @tc.desc : 1.create imageSource
* 2.createPixelMap
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_CREATEPIXELMAP_SVG_0600', 0, async function (done) {
createPixelMap(done, "IMAGE_SOURCENDK_CREATEPIXELMAP_SVG_0600", "test_large.svg");
})
/**
* @tc.number : IMAGE_SOURCENDK_CREATEPIXELMAP_RAW_0700
* @tc.name : createPixelMap -raw
* @tc.desc : 1.create imageSource
* 2.createPixelMap
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_CREATEPIXELMAP_RAW_0700', 0, async function (done) {
createPixelMap(done, "IMAGE_SOURCENDK_CREATEPIXELMAP_RAW_0700", "test_dng.dng");
})
/**
* @tc.number : IMAGE_SOURCENDK_CREATEPIXELMAP_RAW_0800
* @tc.name : createPixelMap -raw
* @tc.desc : 1.create imageSource
* 2.createPixelMap
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_CREATEPIXELMAP_RAW_0800', 0, async function (done) {
createPixelMap(done, "IMAGE_SOURCENDK_CREATEPIXELMAP_RAW_0800", "test.nrw");
})
/**
* @tc.number : IMAGE_SOURCENDK_CREATEPIXELMAP_RAW_0900
* @tc.name : createPixelMap -raw
* @tc.desc : 1.create imageSource
* 2.createPixelMap
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_CREATEPIXELMAP_RAW_0900', 0, async function (done) {
createPixelMap(done, "IMAGE_SOURCENDK_CREATEPIXELMAP_RAW_0900", "test.cr2");
})
/**
* @tc.number : IMAGE_SOURCENDK_CREATEPIXELMAP_RAW_1000
* @tc.name : createPixelMap -raw
* @tc.desc : 1.create imageSource
* 2.createPixelMap
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_CREATEPIXELMAP_RAW_1000', 0, async function (done) {
createPixelMap(done, "IMAGE_SOURCENDK_CREATEPIXELMAP_RAW_1000", "test.arw");
})
/**
* @tc.number : IMAGE_SOURCENDK_CREATEPIXELMAP_RAW_1100
* @tc.name : createPixelMap -raw
* @tc.desc : 1.create imageSource
* 2.createPixelMap
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_CREATEPIXELMAP_RAW_1100', 0, async function (done) {
createPixelMap(done, "IMAGE_SOURCENDK_CREATEPIXELMAP_RAW_1100", "test.pef");
})
/**
* @tc.number : IMAGE_SOURCENDK_CREATEPIXELMAP_RAW_1200
* @tc.name : createPixelMap -raw
* @tc.desc : 1.create imageSource
* 2.createPixelMap
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_CREATEPIXELMAP_RAW_1200', 0, async function (done) {
createPixelMap(done, "IMAGE_SOURCENDK_CREATEPIXELMAP_RAW_1200", "test.raf");
})
/**
* @tc.number : IMAGE_SOURCENDK_CREATEPIXELMAP_RAW_1300
* @tc.name : createPixelMap -raw
* @tc.desc : 1.create imageSource
* 2.createPixelMap
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_CREATEPIXELMAP_RAW_1300', 0, async function (done) {
createPixelMap(done, "IMAGE_SOURCENDK_CREATEPIXELMAP_RAW_1300", "test.rw2");
})
/**
* @tc.number : IMAGE_SOURCENDK_CREATE_PIXEL_MAP_LIST
* @tc.name : createPixelMapList
* @tc.desc : 1.create imageSource
* 2.createPixelMapList
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_CREATE_PIXEL_MAP_LIST', 0, async function (done) {
try {
let log = logger("IMAGE_SOURCENDK_CREATE_PIXEL_MAP_LIST");
let res = await imageSourceCreateTest(done, "IMAGE_SOURCENDK_CREATE_PIXEL_MAP_LIST", "moving_test.gif",
"fd");
let decodingOps = {
fitDensity: 240
};
let pixelMapListRes = ndkTest.createPixelMapList(res.result, decodingOps);
checkNdkRes(pixelMapListRes);
expect(pixelMapListRes.result != undefined).assertTrue();
expect(Array.isArray(pixelMapListRes.result)).assertTrue();
log.log("Pixelmap list size " + pixelMapListRes.result.length);
done();
} catch (error) {
console.error("Test exception " + error);
expect().assertFail();
done();
}
})
/**
* @tc.number : IMAGE_SOURCENDK_GET_DELAY_TIME
* @tc.name : getDelayTime
* @tc.desc : 1.create imageSource
* 2.getDelayTime
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_GET_DELAY_TIME', 0, async function (done) {
try {
let log = logger("IMAGE_SOURCENDK_GET_DELAY_TIME");
let res = await imageSourceCreateTest(done, "IMAGE_SOURCENDK_GET_DELAY_TIME", "moving_test.gif", "fd");
let delayTimeListRes = ndkTest.getDelayTime(res.result);
checkNdkRes(delayTimeListRes);
expect(delayTimeListRes.result != undefined).assertTrue();
expect(Array.isArray(delayTimeListRes.result)).assertTrue();
log.log("Delay time list size " + delayTimeListRes.result.length);
delayTimeListRes.result.forEach(element => {
log.log("Delay time " + element);
});
done();
} catch (error) {
console.error("Test exception " + error);
expect().assertFail();
done();
}
})
/**
* @tc.number : IMAGE_SOURCENDK_GET_FRAME_COUNT
* @tc.name : getFrameCount
* @tc.desc : 1.create imageSource
* 2.getFrameCount
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_GET_FRAME_COUNT', 0, async function (done) {
try {
let log = logger("IMAGE_SOURCENDK_GET_FRAME_COUNT");
let res = await imageSourceCreateTest(done, "IMAGE_SOURCENDK_GET_FRAME_COUNT", "moving_test.gif", "fd");
let frameCountRes = ndkTest.getFrameCount(res.result);
checkNdkRes(frameCountRes);
expect(frameCountRes.result != undefined).assertTrue();
expect(frameCountRes.result != 0).assertTrue();
log.log("Frame count " + frameCountRes.result);
done();
} catch (error) {
console.error("Test exception " + error);
expect().assertFail();
done();
}
})
/**
* @tc.number : IMAGE_SOURCENDK_GET_SUPPORTED_FORMATS
* @tc.name : getSupportedFormats
* @tc.desc : 1.getSupportedFormats
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_GET_SUPPORTED_FORMATS', 0, async function (done) {
try {
let log = logger("IMAGE_SOURCENDK_GET_SUPPORTED_FORMATS");
let supportedFormatListRes = ndkTest.getSupportedFormats();
checkNdkRes(supportedFormatListRes);
expect(supportedFormatListRes.result != undefined).assertTrue();
expect(Array.isArray(supportedFormatListRes.result)).assertTrue();
log.log("Supported format list size " + supportedFormatListRes.result.length);
supportedFormatListRes.result.forEach(element => {
log.log("Supported format " + element);
});
done();
} catch (error) {
console.error("Test exception " + error);
expect().assertFail();
done();
}
})
/**
* @tc.number : IMAGE_SOURCENDK_GET_IMAGE_INFO
* @tc.name : getImageInfo
* @tc.desc : 1.create imageSource
* : 2.getImageInfo
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_GET_IMAGE_INFO', 0, async function (done) {
try {
let log = logger("IMAGE_SOURCENDK_GET_IMAGE_INFO");
let res = await imageSourceCreateTest(done, "IMAGE_SOURCENDK_GET_IMAGE_INFO", "moving_test.gif", "fd");
let index = 0;
let imageInfoRes = ndkTest.getImageInfo(res.result, index);
checkNdkRes(imageInfoRes);
log.log("Image Info " + JSON.stringify(imageInfoRes.result));
done();
} catch (error) {
console.error("Test exception " + error);
expect().assertFail();
done();
}
})
/**
* @tc.number : IMAGE_SOURCENDK_IMAGE_RELEASE_0100
* @tc.name : release -gif
* @tc.desc : 1.create imageSource
* : 2.release
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_IMAGE_RELEASE_0100', 0, async function (done) {
release(done, "IMAGE_SOURCENDK_IMAGE_RELEASE_0100", "moving_test.gif");
})
/**
* @tc.number : IMAGE_SOURCENDK_IMAGE_RELEASE_0200
* @tc.name : release -bmp
* @tc.desc : 1.create imageSource
* : 2.release
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_IMAGE_RELEASE_0200', 0, async function (done) {
release(done, "IMAGE_SOURCENDK_IMAGE_RELEASE_0200", "test.bmp");
})
/**
* @tc.number : IMAGE_SOURCENDK_IMAGE_RELEASE_0300
* @tc.name : release -png
* @tc.desc : 1.create imageSource
* : 2.release
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_IMAGE_RELEASE_0300', 0, async function (done) {
release(done, "IMAGE_SOURCENDK_IMAGE_RELEASE_0300", "test.png");
})
/**
* @tc.number : IMAGE_SOURCENDK_IMAGE_RELEASE_0400
* @tc.name : release -jpg
* @tc.desc : 1.create imageSource
* : 2.release
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_IMAGE_RELEASE_0400', 0, async function (done) {
release(done, "IMAGE_SOURCENDK_IMAGE_RELEASE_0400", "test.jpg");
})
/**
* @tc.number : IMAGE_SOURCENDK_IMAGE_RELEASE_0500
* @tc.name : release -webp
* @tc.desc : 1.create imageSource
* : 2.release
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_IMAGE_RELEASE_0500', 0, async function (done) {
release(done, "IMAGE_SOURCENDK_IMAGE_RELEASE_0500", "test_large.webp");
})
/**
* @tc.number : IMAGE_SOURCENDK_IMAGE_RELEASE_0600
* @tc.name : release -svg
* @tc.desc : 1.create imageSource
* : 2.release
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_IMAGE_RELEASE_0600', 0, async function (done) {
release(done, "IMAGE_SOURCENDK_IMAGE_RELEASE_0600", "test_large.svg");
})
/**
* @tc.number : IMAGE_SOURCENDK_IMAGE_RELEASE_0700
* @tc.name : release -raw
* @tc.desc : 1.create imageSource
* : 2.release
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_IMAGE_RELEASE_0700', 0, async function (done) {
release(done, "IMAGE_SOURCENDK_IMAGE_RELEASE_0700", "test_dng.dng");
})
/**
* @tc.number : IMAGE_SOURCENDK_IMAGE_RELEASE_0800
* @tc.name : release -raw
* @tc.desc : 1.create imageSource
* : 2.release
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_IMAGE_RELEASE_0800', 0, async function (done) {
release(done, "IMAGE_SOURCENDK_IMAGE_RELEASE_0800", "test.nrw");
})
/**
* @tc.number : IMAGE_SOURCENDK_IMAGE_RELEASE_0900
* @tc.name : release -raw
* @tc.desc : 1.create imageSource
* : 2.release
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_IMAGE_RELEASE_0900', 0, async function (done) {
release(done, "IMAGE_SOURCENDK_IMAGE_RELEASE_0900", "test.cr2");
})
/**
* @tc.number : IMAGE_SOURCENDK_IMAGE_RELEASE_1000
* @tc.name : release -raw
* @tc.desc : 1.create imageSource
* : 2.release
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_IMAGE_RELEASE_1000', 0, async function (done) {
release(done, "IMAGE_SOURCENDK_IMAGE_RELEASE_1000", "test.arw");
})
/**
* @tc.number : IMAGE_SOURCENDK_IMAGE_RELEASE_1100
* @tc.name : release -raw
* @tc.desc : 1.create imageSource
* : 2.release
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_IMAGE_RELEASE_1100', 0, async function (done) {
release(done, "IMAGE_SOURCENDK_IMAGE_RELEASE_1100", "test.pef");
})
/**
* @tc.number : IMAGE_SOURCENDK_IMAGE_RELEASE_1200
* @tc.name : release -raw
* @tc.desc : 1.create imageSource
* : 2.release
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_IMAGE_RELEASE_1200', 0, async function (done) {
release(done, "IMAGE_SOURCENDK_IMAGE_RELEASE_1200", "test.raf");
})
/**
* @tc.number : IMAGE_SOURCENDK_IMAGE_RELEASE_1300
* @tc.name : release -raw
* @tc.desc : 1.create imageSource
* : 2.release
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_IMAGE_RELEASE_1300', 0, async function (done) {
release(done, "IMAGE_SOURCENDK_IMAGE_RELEASE_1300", "test.rw2");
})
/**
* @tc.number : IMAGE_SOURCENDK_UPDATE_DATA
* @tc.name : updateData
* @tc.desc : 1.createIncremental
* : 2.updateData
* : 3.createPixelMap
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_UPDATE_DATA', 0, async function (done) {
try {
let log = logger("IMAGE_SOURCENDK_UPDATE_DATA")
let imageSourceOps = {
density: 240
};
let res = ndkTest.createIncremental(new ArrayBuffer(1), imageSourceOps);
if (res.result == undefined) {
done();
return;
}
let updateOps = {
buffer: testJpg.buffer,
offset: 0,
updateLength: testJpg.buffer.byteLength,
isCompleted: true
};
let updateRes = ndkTest.updateData(res.result, updateOps);
checkNdkRes(updateRes);
log.log("Image update Data " + updateRes.code)
let decodingOps = {
editable: true,
fitDensity: 220
};
let pixelMapRes = ndkTest.createPixelMap(res.result, decodingOps);
checkNdkRes(pixelMapRes);
expect(pixelMapRes.result != undefined).assertTrue();
done();
} catch (error) {
console.error("Test exception " + error);
expect().assertFail();
done();
}
})
/**
* @tc.number : IMAGE_SOURCENDK_GET_IMAGE_PROPERTY_0100
* @tc.name : getImageProperty
* @tc.desc : 1.create imageSource
* : 2.getImageProperty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_GET_IMAGE_PROPERTY_0100', 0, async function (done) {
function checkProps(result) {
expect(result == "8, 8, 8").assertTrue();
}
getImageProperty(done, "IMAGE_SOURCENDK_GET_IMAGE_PROPERTY_0100", BITS_PER_SAMPLE, checkProps);
})
/**
* @tc.number : IMAGE_SOURCENDK_GET_IMAGE_PROPERTY_0200
* @tc.name : getImageProperty
* @tc.desc : 1.create imageSource
* : 2.getImageProperty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_GET_IMAGE_PROPERTY_0200', 0, async function (done) {
function checkProps(result) {
expect(result == "Top-right").assertTrue();
}
getImageProperty(done, "IMAGE_SOURCENDK_GET_IMAGE_PROPERTY_0200", ORIENTATION, checkProps);
})
/**
* @tc.number : IMAGE_SOURCENDK_GET_IMAGE_PROPERTY_0300
* @tc.name : getImageProperty
* @tc.desc : 1.create imageSource
* : 2.getImageProperty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_GET_IMAGE_PROPERTY_0300', 0, async function (done) {
function checkProps(result) {
expect(result == "4608").assertTrue();
}
getImageProperty(done, "IMAGE_SOURCENDK_GET_IMAGE_PROPERTY_0300", IMAGE_LENGTH, checkProps);
})
/**
* @tc.number : IMAGE_SOURCENDK_GET_IMAGE_PROPERTY_0400
* @tc.name : getImageProperty
* @tc.desc : 1.create imageSource
* : 2.getImageProperty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_GET_IMAGE_PROPERTY_0400', 0, async function (done) {
function checkProps(result) {
expect(result == "3456").assertTrue();
}
getImageProperty(done, "IMAGE_SOURCENDK_GET_IMAGE_PROPERTY_0400", IMAGE_WIDTH, checkProps);
})
/**
* @tc.number : IMAGE_SOURCENDK_GET_IMAGE_PROPERTY_0500
* @tc.name : getImageProperty
* @tc.desc : 1.create imageSource
* : 2.getImageProperty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_GET_IMAGE_PROPERTY_0500', 0, async function (done) {
function checkProps(result) {
expect(result.search("38") != -1).assertTrue();
}
getImageProperty(done, "IMAGE_SOURCENDK_GET_IMAGE_PROPERTY_0500", GPS_LATITUDE, checkProps);
})
/**
* @tc.number : IMAGE_SOURCENDK_GET_IMAGE_PROPERTY_0600
* @tc.name : getImageProperty
* @tc.desc : 1.create imageSource
* : 2.getImageProperty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_GET_IMAGE_PROPERTY_0600', 0, async function (done) {
function checkProps(result) {
expect(result.search("9") != -1).assertTrue();
}
getImageProperty(done, "IMAGE_SOURCENDK_GET_IMAGE_PROPERTY_0600", GPS_LONGITUDE, checkProps);
})
/**
* @tc.number : IMAGE_SOURCENDK_GET_IMAGE_PROPERTY_0700
* @tc.name : getImageProperty
* @tc.desc : 1.create imageSource
* : 2.getImageProperty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_GET_IMAGE_PROPERTY_0700', 0, async function (done) {
function checkProps(result) {
expect(result == "N").assertTrue();
}
getImageProperty(done, "IMAGE_SOURCENDK_GET_IMAGE_PROPERTY_0700", GPS_LATITUDE_REF, checkProps);
})
/**
* @tc.number : IMAGE_SOURCENDK_GET_IMAGE_PROPERTY_0800
* @tc.name : getImageProperty
* @tc.desc : 1.create imageSource
* : 2.getImageProperty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_GET_IMAGE_PROPERTY_0800', 0, async function (done) {
function checkProps(result) {
expect(result == "W").assertTrue();
}
getImageProperty(done, "IMAGE_SOURCENDK_GET_IMAGE_PROPERTY_0800", GPS_LONGITUDE_REF, checkProps);
})
/**
* @tc.number : IMAGE_SOURCENDK_GET_IMAGE_PROPERTY_0900
* @tc.name : getImageProperty
* @tc.desc : 1.create imageSource
* : 2.getImageProperty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_GET_IMAGE_PROPERTY_0900', 0, async function (done) {
function checkProps(result) {
expect(result == "2022:06:02 15:51:35").assertTrue();
}
getImageProperty(done, "IMAGE_SOURCENDK_GET_IMAGE_PROPERTY_0900", DATE_TIME_ORIGINAL, checkProps);
})
/**
* @tc.number : IMAGE_SOURCENDK_MODIFY_IMAGE_PROPERTY_0100
* @tc.name : modifyImageProperty
* @tc.desc : 1.create imageSource
* : 2.modifyImageProperty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_MODIFY_IMAGE_PROPERTY_0100', 0, async function (done) {
let prop = { key: ORIENTATION, value: "4" };
function checkProps(result) {
expect(result == "Bottom-left").assertTrue();
}
modify(done, "IMAGE_SOURCENDK_MODIFY_IMAGE_PROPERTY_0100", prop, checkProps);
})
/**
* @tc.number : IMAGE_SOURCENDK_MODIFY_IMAGE_PROPERTY_0200
* @tc.name : modifyImageProperty
* @tc.desc : 1.create imageSource
* : 2.modifyImageProperty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_MODIFY_IMAGE_PROPERTY_0200', 0, async function (done) {
let prop = { key: BITS_PER_SAMPLE, value: "4, 4, 4" };
function checkProps(result) {
expect(result == "4, 4, 4").assertTrue();
}
modify(done, "IMAGE_SOURCENDK_MODIFY_IMAGE_PROPERTY_0200", prop, checkProps);
})
/**
* @tc.number : IMAGE_SOURCENDK_MODIFY_IMAGE_PROPERTY_0300
* @tc.name : modifyImageProperty
* @tc.desc : 1.create imageSource
* : 2.modifyImageProperty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_MODIFY_IMAGE_PROPERTY_0300', 0, async function (done) {
let prop = { key: GPS_LATITUDE, value: "114,57" };
function checkProps(result) {
expect(result.search("2") != -1).assertTrue();
}
modify(done, "IMAGE_SOURCENDK_MODIFY_IMAGE_PROPERTY_0300", prop, checkProps);
})
/**
* @tc.number : IMAGE_SOURCENDK_MODIFY_IMAGE_PROPERTY_0400
* @tc.name : modifyImageProperty
* @tc.desc : 1.create imageSource
* : 2.modifyImageProperty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_MODIFY_IMAGE_PROPERTY_0400', 0, async function (done) {
let prop = { key: GPS_LONGITUDE, value: "116,58" };
function checkProps(result) {
expect(result.search("2") != -1).assertTrue();
}
modify(done, "IMAGE_SOURCENDK_MODIFY_IMAGE_PROPERTY_0400", prop, checkProps);
})
/**
* @tc.number : IMAGE_SOURCENDK_MODIFY_IMAGE_PROPERTY_0500
* @tc.name : modifyImageProperty
* @tc.desc : 1.create imageSource
* : 2.modifyImageProperty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_MODIFY_IMAGE_PROPERTY_0500', 0, async function (done) {
let prop = { key: GPS_LATITUDE_REF, value: "N" };
function checkProps(result) {
expect(result == "N").assertTrue();
}
modify(done, "IMAGE_SOURCENDK_MODIFY_IMAGE_PROPERTY_0500", prop, checkProps);
})
/**
* @tc.number : IMAGE_SOURCENDK_MODIFY_IMAGE_PROPERTY_0600
* @tc.name : modifyImageProperty
* @tc.desc : 1.create imageSource
* : 2.modifyImageProperty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_MODIFY_IMAGE_PROPERTY_0600', 0, async function (done) {
let prop = { key: GPS_LONGITUDE_REF, value: "W" };
function checkProps(result) {
expect(result == "W").assertTrue();
}
modify(done, "IMAGE_SOURCENDK_MODIFY_IMAGE_PROPERTY_0600", prop, checkProps);
})
/**
* @tc.number : IMAGE_SOURCENDK_MODIFY_IMAGE_PROPERTY_0700
* @tc.name : modifyImageProperty
* @tc.desc : 1.create imageSource
* : 2.modifyImageProperty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_MODIFY_IMAGE_PROPERTY_0700', 0, async function (done) {
let prop = { key: IMAGE_WIDTH, value: "500" };
function checkProps(result) {
expect(result == "500").assertTrue();
}
modify(done, "IMAGE_SOURCENDK_MODIFY_IMAGE_PROPERTY_0700", prop, checkProps);
})
/**
* @tc.number : IMAGE_SOURCENDK_MODIFY_IMAGE_PROPERTY_0800
* @tc.name : modifyImageProperty
* @tc.desc : 1.create imageSource
* : 2.modifyImageProperty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_MODIFY_IMAGE_PROPERTY_0800', 0, async function (done) {
let prop = { key: IMAGE_LENGTH, value: "800" };
function checkProps(result) {
expect(result == "800").assertTrue();
}
modify(done, "IMAGE_SOURCENDK_MODIFY_IMAGE_PROPERTY_0800", prop, checkProps);
})
/**
* @tc.number : IMAGE_SOURCENDK_MODIFY_IMAGE_PROPERTY_ERR_0100
* @tc.name : modifyImageProperty
* @tc.desc : 1.create imageSource
* : 2.modifyImageProperty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_MODIFY_IMAGE_PROPERTY_ERR_0100', 0, async function (done) {
await modifyErr(done, "IMAGE_SOURCENDK_MODIFY_IMAGE_PROPERTY_ERR_0100", "null", "100");
})
/**
* @tc.number : IMAGE_SOURCENDK_MODIFY_IMAGE_PROPERTY_ERR_0200
* @tc.name : modifyImageProperty
* @tc.desc : 1.create imageSource
* : 2.modifyImageProperty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_MODIFY_IMAGE_PROPERTY_ERR_0200', 0, async function (done) {
await modifyErr(done, "IMAGE_SOURCENDK_MODIFY_IMAGE_PROPERTY_ERR_0200", " GPSLongitudeRef", "12345");
})
/**
* @tc.number : IMAGE_SOURCENDK_MODIFY_IMAGE_PROPERTY_ERR_0300
* @tc.name : modifyImageProperty
* @tc.desc : 1.create imageSource
* : 2.modifyImageProperty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_MODIFY_IMAGE_PROPERTY_ERR_0300', 0, async function (done) {
await modifyErr(done, "IMAGE_SOURCENDK_MODIFY_IMAGE_PROPERTY_ERR_0300", "GPSLatitude", "{a:3}");
})
/**
* @tc.number : IMAGE_SOURCENDK_MODIFY_IMAGE_PROPERTY_ERR_0400
* @tc.name : modifyImageProperty
* @tc.desc : 1.create imageSource
* : 2.modifyImageProperty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_MODIFY_IMAGE_PROPERTY_ERR_0400', 0, async function (done) {
await modifyErr(done, "IMAGE_SOURCENDK_MODIFY_IMAGE_PROPERTY_ERR_0400", "1000", "ImageLength");
})
/**
* @tc.number : IMAGE_SOURCENDK_GET_IMAGE_PROPERTY_ERR_0100
* @tc.name : getImageProperty
* @tc.desc : 1.create imageSource
* : 2.getImageProperty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_GET_IMAGE_PROPERTY_ERR_0100', 0, async function (done) {
getImagePropertyErr(done, "IMAGE_SOURCENDK_GET_IMAGE_PROPERTY_ERR_0100", "aa");
})
/**
* @tc.number : IMAGE_SOURCENDK_GET_IMAGE_PROPERTY_ERR_0200
* @tc.name : getImageProperty
* @tc.desc : 1.create imageSource
* : 2.getImageProperty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_GET_IMAGE_PROPERTY_ERR_0200', 0, async function (done) {
getImagePropertyErr(done, "IMAGE_SOURCENDK_GET_IMAGE_PROPERTY_ERR_0200", "12");
})
/**
* @tc.number : IMAGE_SOURCENDK_GET_IMAGE_PROPERTY_ERR_0300
* @tc.name : getImageProperty
* @tc.desc : 1.create imageSource
* : 2.getImageProperty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_GET_IMAGE_PROPERTY_ERR_0300', 0, async function (done) {
getImagePropertyErr(done, "IMAGE_SOURCENDK_GET_IMAGE_PROPERTY_ERR_0300", "true");
})
/**
* @tc.number : IMAGE_SOURCENDK_GET_IMAGE_PROPERTY_ERR_0400
* @tc.name : getImageProperty
* @tc.desc : 1.create imageSource
* : 2.getImageProperty
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_GET_IMAGE_PROPERTY_ERR_0400', 0, async function (done) {
getImagePropertyErr(done, "IMAGE_SOURCENDK_GET_IMAGE_PROPERTY_ERR_0400", "abc,123");
})
/**
* @tc.number : IMAGE_SOURCENDK_CREATE_ERR_0100
* @tc.name : createImageSource fd<0
* @tc.desc : 1.get fd
* 2.createImageSource
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_CREATE_ERR_0100', 0, async function (done) {
createImageSourceErr(done, "IMAGE_SOURCENDK_CREATE_ERR_0100", -1);
})
/**
* @tc.number : IMAGE_SOURCENDK_CREATE_ERR_0200
* @tc.name : createImageSource -wrong uri
* @tc.desc : 1.get path
* 2.createImageSource
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_CREATE_ERR_0200', 0, async function (done) {
createImageSourceErr(done, "IMAGE_SOURCENDK_CREATE_ERR_0200", "file:///multimedia/test.jpg");
})
/**
* @tc.number : IMAGE_SOURCENDK_CREATE_ERR_0300
* @tc.name : createImageSource -fd string
* @tc.desc : 1.get fd
* 2.createImageSource
* @tc.size : MEDIUM
* @tc.type : Functional
* @tc.level : Level 0
*/
it('IMAGE_SOURCENDK_CREATE_ERR_0300', 0, async function (done) {
createImageSourceErr(done, "IMAGE_SOURCENDK_CREATE_ERR_0300", "fd");
})
})
}
\ No newline at end of file
/*
* Copyright (c) 2023 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 ImageSourceNDKTest from './ImageSourceNDKTest';
export default function testsuite() {
ImageSourceNDKTest();
}
\ No newline at end of file
/*
* Copyright (C) 2023 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 testJpg = new Uint8Array([255, 216, 255, 224, 0, 16, 74, 70, 73, 70, 0, 1, 1, 1, 0, 96, 0, 96, 0, 0, 255, 219, 0, 67, 0, 2, 1, 1, 2, 1, 1, 2,
2, 2, 2, 2, 2, 2, 2, 3, 5, 3, 3, 3, 3, 3, 6, 4, 4, 3, 5, 7, 6, 7, 7, 7, 6, 7, 7, 8, 9, 11, 9, 8,
8, 10, 8, 7, 7, 10, 13, 10, 10, 11, 12, 12, 12, 12, 7, 9, 14, 15, 13, 12, 14, 11, 12, 12, 12, 255, 219, 0, 67, 1, 2, 2,
2, 3, 3, 3, 6, 3, 3, 6, 12, 8, 7, 8, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 255, 192,
0, 17, 8, 0, 226, 1, 216, 3, 1, 34, 0, 2, 17, 1, 3, 17, 1, 255, 196, 0, 31, 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0,
0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 255, 196, 0, 181, 16, 0, 2, 1, 3, 3, 2, 4, 3, 5,
5, 4, 4, 0, 0, 1, 125, 1, 2, 3, 0, 4, 17, 5, 18, 33, 49, 65, 6, 19, 81, 97, 7, 34, 113, 20, 50, 129, 145, 161, 8, 35,
66, 177, 193, 21, 82, 209, 240, 36, 51, 98, 114, 130, 9, 10, 22, 23, 24, 25, 26, 37, 38, 39, 40, 41, 42, 52, 53, 54, 55, 56, 57, 58,
67, 68, 69, 70, 71, 72, 73, 74, 83, 84, 85, 86, 87, 88, 89, 90, 99, 100, 101, 102, 103, 104, 105, 106, 115, 116, 117, 118, 119, 120, 121, 122,
131, 132, 133, 134, 135, 136, 137, 138, 146, 147, 148, 149, 150, 151, 152, 153, 154, 162, 163, 164, 165, 166, 167, 168, 169, 170, 178, 179, 180, 181, 182, 183,
184, 185, 186, 194, 195, 196, 197, 198, 199, 200, 201, 202, 210, 211, 212, 213, 214, 215, 216, 217, 218, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 241,
242, 243, 244, 245, 246, 247, 248, 249, 250, 255, 196, 0, 31, 1, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1,
2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 255, 196, 0, 181, 17, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 119, 0,
1, 2, 3, 17, 4, 5, 33, 49, 6, 18, 65, 81, 7, 97, 113, 19, 34, 50, 129, 8, 20, 66, 145, 161, 177, 193, 9, 35, 51, 82, 240, 21,
98, 114, 209, 10, 22, 36, 52, 225, 37, 241, 23, 24, 25, 26, 38, 39, 40, 41, 42, 53, 54, 55, 56, 57, 58, 67, 68, 69, 70, 71, 72, 73,
74, 83, 84, 85, 86, 87, 88, 89, 90, 99, 100, 101, 102, 103, 104, 105, 106, 115, 116, 117, 118, 119, 120, 121, 122, 130, 131, 132, 133, 134, 135, 136,
137, 138, 146, 147, 148, 149, 150, 151, 152, 153, 154, 162, 163, 164, 165, 166, 167, 168, 169, 170, 178, 179, 180, 181, 182, 183, 184, 185, 186, 194, 195, 196,
197, 198, 199, 200, 201, 202, 210, 211, 212, 213, 214, 215, 216, 217, 218, 226, 227, 228, 229, 230, 231, 232, 233, 234, 242, 243, 244, 245, 246, 247, 248, 249,
250, 255, 218, 0, 12, 3, 1, 0, 2, 17, 3, 17, 0, 63, 0, 253, 16, 162, 138, 43, 252, 99, 63, 170, 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, 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, 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, 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, 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, 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,
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, 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, 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, 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, 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, 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, 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, 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,
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, 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, 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, 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, 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, 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, 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, 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,
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, 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, 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, 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, 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, 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, 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, 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 { testJpg }
\ No newline at end of file
{
"string": [
{
"name": "entry_MainAbility",
"value": "entry_MainAbility"
},
{
"name": "description_mainability",
"value": "ETS_Empty Ability"
},
{
"name": "TestAbility_desc",
"value": "description"
},
{
"name": "TestAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册