From 79f5b439430ae845af5721a382eede6deff5ddc2 Mon Sep 17 00:00:00 2001 From: qinliwen Date: Mon, 30 May 2022 12:10:01 +0800 Subject: [PATCH] =?UTF-8?q??= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: qinliwen --- multimedia/BUILD.gn | 4 +- multimedia/image/image_js_standard/Test.json | 100 - .../image_js_standard/{ => image}/BUILD.gn | 0 .../image/image_js_standard/image/Test.json | 56 + .../{ => image}/signature/openharmony_sx.p7b | Bin .../{ => image}/src/main/config.json | 206 +- .../{ => image}/src/main/js/default/app.js | 46 +- .../src/main/js/default/i18n/en-US.json | 0 .../src/main/js/default/i18n/zh-CN.json | 0 .../src/main/js/default/pages/index/index.css | 0 .../src/main/js/default/pages/index/index.hml | 0 .../src/main/js/default/pages/index/index.js | 0 .../{ => image}/src/main/js/test/List.test.js | 30 +- .../image/src/main/js/test/image.test.js | 1673 +++++ .../{ => image}/src/main/js/test/testImg.js | 163 +- .../main/resources/base/element/string.json | 22 +- .../src/main/resources/base/media/icon.png | Bin .../imageDecodeOptions/BUILD.gn | 31 + .../imageDecodeOptions/Test.json | 53 + .../signature/openharmony_sx.p7b | Bin 0 -> 3445 bytes .../imageDecodeOptions/src/main/config.json | 104 + .../src/main/js/default/app.js | 23 + .../src/main/js/default/i18n/en-US.json | 6 + .../src/main/js/default/i18n/zh-CN.json | 6 + .../src/main/js/default/pages/index/index.css | 46 + .../src/main/js/default/pages/index/index.hml | 5 + .../src/main/js/default/pages/index/index.js | 41 + .../src/main/js/test/List.test.js | 16 + .../src/main/js/test/image.test.js | 3045 ++++++++ .../main/resources/base/element/string.json | 12 + .../src/main/resources/base/media/icon.png | Bin 0 -> 6790 bytes .../image_js_standard/imageExif/BUILD.gn | 31 + .../image_js_standard/imageExif/Test.json | 45 + .../imageExif/signature/openharmony_sx.p7b | Bin 0 -> 3445 bytes .../imageExif/src/main/config.json | 104 + .../imageExif/src/main/js/default/app.js | 23 + .../src/main/js/default/i18n/en-US.json | 6 + .../src/main/js/default/i18n/zh-CN.json | 6 + .../src/main/js/default/pages/index/index.css | 46 + .../src/main/js/default/pages/index/index.hml | 5 + .../src/main/js/default/pages/index/index.js | 41 + .../imageExif/src/main/js/test/List.test.js | 16 + .../imageExif/src/main/js/test/image.test.js | 2066 ++++++ .../imageExif/src/main/js/test/testImg.js | 22 + .../main/resources/base/element/string.json | 12 + .../src/main/resources/base/media/icon.png | Bin 0 -> 6790 bytes .../src/main/js/test/image.test.js | 6108 ----------------- 47 files changed, 7774 insertions(+), 6445 deletions(-) delete mode 100644 multimedia/image/image_js_standard/Test.json rename multimedia/image/image_js_standard/{ => image}/BUILD.gn (100%) create mode 100644 multimedia/image/image_js_standard/image/Test.json rename multimedia/image/image_js_standard/{ => image}/signature/openharmony_sx.p7b (100%) rename multimedia/image/image_js_standard/{ => image}/src/main/config.json (96%) rename multimedia/image/image_js_standard/{ => image}/src/main/js/default/app.js (97%) rename multimedia/image/image_js_standard/{ => image}/src/main/js/default/i18n/en-US.json (100%) rename multimedia/image/image_js_standard/{ => image}/src/main/js/default/i18n/zh-CN.json (100%) rename multimedia/image/image_js_standard/{ => image}/src/main/js/default/pages/index/index.css (100%) rename multimedia/image/image_js_standard/{ => image}/src/main/js/default/pages/index/index.hml (100%) rename multimedia/image/image_js_standard/{ => image}/src/main/js/default/pages/index/index.js (100%) rename multimedia/image/image_js_standard/{ => image}/src/main/js/test/List.test.js (93%) create mode 100644 multimedia/image/image_js_standard/image/src/main/js/test/image.test.js rename multimedia/image/image_js_standard/{ => image}/src/main/js/test/testImg.js (99%) rename multimedia/image/image_js_standard/{ => image}/src/main/resources/base/element/string.json (94%) rename multimedia/image/image_js_standard/{ => image}/src/main/resources/base/media/icon.png (100%) create mode 100644 multimedia/image/image_js_standard/imageDecodeOptions/BUILD.gn create mode 100644 multimedia/image/image_js_standard/imageDecodeOptions/Test.json create mode 100644 multimedia/image/image_js_standard/imageDecodeOptions/signature/openharmony_sx.p7b create mode 100644 multimedia/image/image_js_standard/imageDecodeOptions/src/main/config.json create mode 100644 multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/default/app.js create mode 100644 multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/default/i18n/en-US.json create mode 100644 multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/default/i18n/zh-CN.json create mode 100644 multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/default/pages/index/index.css create mode 100644 multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/default/pages/index/index.hml create mode 100644 multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/default/pages/index/index.js create mode 100644 multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/test/List.test.js create mode 100644 multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/test/image.test.js create mode 100644 multimedia/image/image_js_standard/imageDecodeOptions/src/main/resources/base/element/string.json create mode 100644 multimedia/image/image_js_standard/imageDecodeOptions/src/main/resources/base/media/icon.png create mode 100644 multimedia/image/image_js_standard/imageExif/BUILD.gn create mode 100644 multimedia/image/image_js_standard/imageExif/Test.json create mode 100644 multimedia/image/image_js_standard/imageExif/signature/openharmony_sx.p7b create mode 100644 multimedia/image/image_js_standard/imageExif/src/main/config.json create mode 100644 multimedia/image/image_js_standard/imageExif/src/main/js/default/app.js create mode 100644 multimedia/image/image_js_standard/imageExif/src/main/js/default/i18n/en-US.json create mode 100644 multimedia/image/image_js_standard/imageExif/src/main/js/default/i18n/zh-CN.json create mode 100644 multimedia/image/image_js_standard/imageExif/src/main/js/default/pages/index/index.css create mode 100644 multimedia/image/image_js_standard/imageExif/src/main/js/default/pages/index/index.hml create mode 100644 multimedia/image/image_js_standard/imageExif/src/main/js/default/pages/index/index.js create mode 100644 multimedia/image/image_js_standard/imageExif/src/main/js/test/List.test.js create mode 100644 multimedia/image/image_js_standard/imageExif/src/main/js/test/image.test.js create mode 100644 multimedia/image/image_js_standard/imageExif/src/main/js/test/testImg.js create mode 100644 multimedia/image/image_js_standard/imageExif/src/main/resources/base/element/string.json create mode 100644 multimedia/image/image_js_standard/imageExif/src/main/resources/base/media/icon.png delete mode 100644 multimedia/image/image_js_standard/src/main/js/test/image.test.js diff --git a/multimedia/BUILD.gn b/multimedia/BUILD.gn index 3f2201f99..2f83952f4 100644 --- a/multimedia/BUILD.gn +++ b/multimedia/BUILD.gn @@ -19,7 +19,9 @@ group("multimedia") { deps = [ "audio/audio_js_standard/audioManager:audio_manager_js_hap", "camera/camera_js_standard:camera_standard_ets_hap", - "image/image_js_standard:image_js_hap", + "image/image_js_standard/image:image_js_hap", + "image/image_js_standard/imageDecodeOptions:image_DecodeOptions_js_hap", + "image/image_js_standard/imageExif:image_exif_js_hap", "media/media_js_standard/audioCodecFormat:audio_codec_format_js_hap", "media/media_js_standard/audioDecoder:audio_decoder_js_hap", "media/media_js_standard/audioEncoder:audio_encoder_js_hap", diff --git a/multimedia/image/image_js_standard/Test.json b/multimedia/image/image_js_standard/Test.json deleted file mode 100644 index 4d0a45955..000000000 --- a/multimedia/image/image_js_standard/Test.json +++ /dev/null @@ -1,100 +0,0 @@ -{ - "description": "Configuration for Image Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "1500000", - "package": "ohos.acts.multimedia.image", - "shell-timeout": "120000" - }, - "kits": [ - { - "type": "PushKit", - "pre-push": [ - ], - "push": [ - "./resource/image/test.tiff ->/storage/media/100/local/files", - "./resource/image/test.123 ->/storage/media/100/local/files", - "./resource/image/test.bmp ->/storage/media/100/local/files", - "./resource/image/test.png ->/storage/media/100/local/files", - "./resource/image/test.gif ->/storage/media/100/local/files", - "./resource/image/test.jpg ->/storage/media/100/local/files", - "./resource/image/test_exif.jpg ->/storage/media/100/local/files", - "./resource/image/moving_test.gif ->/storage/media/100/local/files" - ] - }, - - { - "type": "ShellKit", - "run-command": [ - "mkdir /storage/media/100/local/files/img", - "cp /storage/media/100/local/files/test.tiff /storage/media/100/local/files/img/", - "cp /storage/media/100/local/files/test.123 /storage/media/100/local/files/img/", - "cp /storage/media/100/local/files/test.bmp /storage/media/100/local/files/img/", - "cp /storage/media/100/local/files/test.bmp /storage/media/100/local/files/img/test0.bmp", - "cp /storage/media/100/local/files/test.bmp /storage/media/100/local/files/img/test1.bmp", - "cp /storage/media/100/local/files/test.bmp /storage/media/100/local/files/img/test2.bmp", - "cp /storage/media/100/local/files/test.bmp /storage/media/100/local/files/img/test3.bmp", - "cp /storage/media/100/local/files/test.bmp /storage/media/100/local/files/img/test4.bmp", - "cp /storage/media/100/local/files/test.bmp /storage/media/100/local/files/img/test5.bmp", - "cp /storage/media/100/local/files/test.bmp /storage/media/100/local/files/img/test6.bmp", - "cp /storage/media/100/local/files/test.bmp /storage/media/100/local/files/img/test7.bmp", - "cp /storage/media/100/local/files/test.bmp /storage/media/100/local/files/img/test8.bmp", - "cp /storage/media/100/local/files/test.bmp /storage/media/100/local/files/img/test9.bmp", - "cp /storage/media/100/local/files/test.bmp /storage/media/100/local/files/img/test10.bmp", - "cp /storage/media/100/local/files/test.bmp /storage/media/100/local/files/img/test11.bmp", - "cp /storage/media/100/local/files/test.bmp /storage/media/100/local/files/img/test12.bmp", - "cp /storage/media/100/local/files/test.bmp /storage/media/100/local/files/img/test13.bmp", - "cp /storage/media/100/local/files/test.bmp /storage/media/100/local/files/img/test14.bmp", - "cp /storage/media/100/local/files/test.bmp /storage/media/100/local/files/img/test15.bmp", - "cp /storage/media/100/local/files/test.png /storage/media/100/local/files/img/", - "cp /storage/media/100/local/files/test.png /storage/media/100/local/files/img/test0.png", - "cp /storage/media/100/local/files/test.png /storage/media/100/local/files/img/test1.png", - "cp /storage/media/100/local/files/test.png /storage/media/100/local/files/img/test2.png", - "cp /storage/media/100/local/files/test.png /storage/media/100/local/files/img/test3.png", - "cp /storage/media/100/local/files/test.png /storage/media/100/local/files/img/test4.png", - "cp /storage/media/100/local/files/test.png /storage/media/100/local/files/img/test5.png", - "cp /storage/media/100/local/files/test.png /storage/media/100/local/files/img/test6.png", - "cp /storage/media/100/local/files/test.png /storage/media/100/local/files/img/test7.png", - "cp /storage/media/100/local/files/test.png /storage/media/100/local/files/img/test8.png", - "cp /storage/media/100/local/files/test.png /storage/media/100/local/files/img/test9.png", - "cp /storage/media/100/local/files/test.png /storage/media/100/local/files/img/test10.png", - "cp /storage/media/100/local/files/test.png /storage/media/100/local/files/img/test11.png", - "cp /storage/media/100/local/files/test.png /storage/media/100/local/files/img/test12.png", - "cp /storage/media/100/local/files/test.png /storage/media/100/local/files/img/test13.png", - "cp /storage/media/100/local/files/test.png /storage/media/100/local/files/img/test14.png", - "cp /storage/media/100/local/files/test.png /storage/media/100/local/files/img/test15.png", - "cp /storage/media/100/local/files/test.png /storage/media/100/local/files/img/test00.png", - "cp /storage/media/100/local/files/test.png /storage/media/100/local/files/img/test01.png", - "cp /storage/media/100/local/files/test.png /storage/media/100/local/files/img/test02.png", - "cp /storage/media/100/local/files/test.png /storage/media/100/local/files/img/test03.png", - "cp /storage/media/100/local/files/test.png /storage/media/100/local/files/img/test04.png", - "cp /storage/media/100/local/files/test.png /storage/media/100/local/files/img/test05.png", - "cp /storage/media/100/local/files/test.png /storage/media/100/local/files/img/test06.png", - "cp /storage/media/100/local/files/test.png /storage/media/100/local/files/img/test07.png", - "cp /storage/media/100/local/files/test.png /storage/media/100/local/files/img/test08.png", - "cp /storage/media/100/local/files/test.png /storage/media/100/local/files/img/test09.png", - "cp /storage/media/100/local/files/test.gif /storage/media/100/local/files/img/", - "cp /storage/media/100/local/files/test.jpg /storage/media/100/local/files/img/", - "cp /storage/media/100/local/files/test.jpg /storage/media/100/local/files/img/test0.jpg", - "cp /storage/media/100/local/files/test_exif.jpg /storage/media/100/local/files/img/", - "cp /storage/media/100/local/files/moving_test.gif /storage/media/100/local/files/img/", - "chmod -R 666 /data/media/*", - "chmod -R 666 /storage/media/100/local/files/img/*", - "killall com.ohos.medialibrary.MediaScannerAbilityA", - "aa start -a MediaScannerAbility -b com.ohos.medialibrary.MediaScannerAbilityA" - ], - "teardown-command":[ - - ] - }, - - { - "test-file-name": [ - "ActsImageJsTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] - -} diff --git a/multimedia/image/image_js_standard/BUILD.gn b/multimedia/image/image_js_standard/image/BUILD.gn similarity index 100% rename from multimedia/image/image_js_standard/BUILD.gn rename to multimedia/image/image_js_standard/image/BUILD.gn diff --git a/multimedia/image/image_js_standard/image/Test.json b/multimedia/image/image_js_standard/image/Test.json new file mode 100644 index 000000000..fb892ef7d --- /dev/null +++ b/multimedia/image/image_js_standard/image/Test.json @@ -0,0 +1,56 @@ +{ + "description": "Configuration for Image Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "ohos.acts.multimedia.image", + "shell-timeout": "120000" + }, + "kits": [ + { + "type": "ShellKit", + "run-command": [ + "mkdir /data/app/el2/100/base/ohos.acts.multimedia.image/files", + "chmod 777 /data/app/el2/100/base/ohos.acts.multimedia.image/files" + ] + }, + { + "type": "PushKit", + "pre-push": [ + ], + "push": [ + "./resource/image/test.bmp ->/data/app/el2/100/base/ohos.acts.multimedia.image/files", + "./resource/image/test.png ->/data/app/el2/100/base/ohos.acts.multimedia.image/files", + "./resource/image/test.123 ->/data/app/el2/100/base/ohos.acts.multimedia.image/files", + "./resource/image/test.gif ->/data/app/el2/100/base/ohos.acts.multimedia.image/files", + "./resource/image/test.jpg ->/data/app/el2/100/base/ohos.acts.multimedia.image/files", + "./resource/image/moving_test.gif ->/data/app/el2/100/base/ohos.acts.multimedia.image/files" + ] + }, + + { + "type": "ShellKit", + "run-command": [ + "chmod 777 /data/app/el2/100/base/ohos.acts.multimedia.image/files/test.bmp", + "chmod 777 /data/app/el2/100/base/ohos.acts.multimedia.image/files/test.png", + "chmod 777 /data/app/el2/100/base/ohos.acts.multimedia.image/files/test.123", + "chmod 777 /data/app/el2/100/base/ohos.acts.multimedia.image/files/test.gif", + "chmod 777 /data/app/el2/100/base/ohos.acts.multimedia.image/files/test.jpg", + "chmod 777 /data/app/el2/100/base/ohos.acts.multimedia.image/files/moving_test.gif" + + ], + "teardown-command":[ + + ] + }, + + { + "test-file-name": [ + "ActsImageJsTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] + +} diff --git a/multimedia/image/image_js_standard/signature/openharmony_sx.p7b b/multimedia/image/image_js_standard/image/signature/openharmony_sx.p7b similarity index 100% rename from multimedia/image/image_js_standard/signature/openharmony_sx.p7b rename to multimedia/image/image_js_standard/image/signature/openharmony_sx.p7b diff --git a/multimedia/image/image_js_standard/src/main/config.json b/multimedia/image/image_js_standard/image/src/main/config.json similarity index 96% rename from multimedia/image/image_js_standard/src/main/config.json rename to multimedia/image/image_js_standard/image/src/main/config.json index 6f5090860..941d88567 100644 --- a/multimedia/image/image_js_standard/src/main/config.json +++ b/multimedia/image/image_js_standard/image/src/main/config.json @@ -1,104 +1,104 @@ -{ - "app": { - "apiVersion": { - "compatible": 6, - "releaseType": "Beta1", - "target": 7 - }, - "vendor": "acts", - "bundleName": "ohos.acts.multimedia.image", - "version": { - "code": 1000000, - "name": "1.0.0" - } - }, - "deviceConfig": { - "default": { - "debug": true - } - }, - "module": { - "abilities": [ - { - "iconId": 16777218, - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "descriptionId": 16777217, - "visible": true, - "labelId": 16777216, - "icon": "$media:icon", - "name": "ohos.acts.multimedia.image.MainAbility", - "description": "$string:mainability_description", - "label": "$string:entry_MainAbility", - "type": "page", - "homeAbility": true, - "launchType": "standard" - } - ], - "deviceType": [ - "phone", - "tablet", - "tv", - "wearable" - ], - "mainAbility": "ohos.acts.multimedia.image.MainAbility", - "distro": { - "moduleType": "entry", - "installationFree": false, - "deliveryWithInstall": true, - "moduleName": "entry" - }, - "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" - } - ], - "package": "ohos.acts.multimedia.image", - "name": ".MyApplication", - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": true - } - } - ] - } +{ + "app": { + "apiVersion": { + "compatible": 6, + "releaseType": "Beta1", + "target": 7 + }, + "vendor": "acts", + "bundleName": "ohos.acts.multimedia.image", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": { + "default": { + "debug": true + } + }, + "module": { + "abilities": [ + { + "iconId": 16777218, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "descriptionId": 16777217, + "visible": true, + "labelId": 16777216, + "icon": "$media:icon", + "name": "ohos.acts.multimedia.image.MainAbility", + "description": "$string:mainability_description", + "label": "$string:entry_MainAbility", + "type": "page", + "homeAbility": true, + "launchType": "standard" + } + ], + "deviceType": [ + "phone", + "tablet", + "tv", + "wearable" + ], + "mainAbility": "ohos.acts.multimedia.image.MainAbility", + "distro": { + "moduleType": "entry", + "installationFree": false, + "deliveryWithInstall": true, + "moduleName": "entry" + }, + "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" + } + ], + "package": "ohos.acts.multimedia.image", + "name": ".MyApplication", + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": true + } + } + ] + } } \ No newline at end of file diff --git a/multimedia/image/image_js_standard/src/main/js/default/app.js b/multimedia/image/image_js_standard/image/src/main/js/default/app.js similarity index 97% rename from multimedia/image/image_js_standard/src/main/js/default/app.js rename to multimedia/image/image_js_standard/image/src/main/js/default/app.js index 363f2555b..e423f4bce 100644 --- a/multimedia/image/image_js_standard/src/main/js/default/app.js +++ b/multimedia/image/image_js_standard/image/src/main/js/default/app.js @@ -1,23 +1,23 @@ -/* - * Copyright (C) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/multimedia/image/image_js_standard/src/main/js/default/i18n/en-US.json b/multimedia/image/image_js_standard/image/src/main/js/default/i18n/en-US.json similarity index 100% rename from multimedia/image/image_js_standard/src/main/js/default/i18n/en-US.json rename to multimedia/image/image_js_standard/image/src/main/js/default/i18n/en-US.json diff --git a/multimedia/image/image_js_standard/src/main/js/default/i18n/zh-CN.json b/multimedia/image/image_js_standard/image/src/main/js/default/i18n/zh-CN.json similarity index 100% rename from multimedia/image/image_js_standard/src/main/js/default/i18n/zh-CN.json rename to multimedia/image/image_js_standard/image/src/main/js/default/i18n/zh-CN.json diff --git a/multimedia/image/image_js_standard/src/main/js/default/pages/index/index.css b/multimedia/image/image_js_standard/image/src/main/js/default/pages/index/index.css similarity index 100% rename from multimedia/image/image_js_standard/src/main/js/default/pages/index/index.css rename to multimedia/image/image_js_standard/image/src/main/js/default/pages/index/index.css diff --git a/multimedia/image/image_js_standard/src/main/js/default/pages/index/index.hml b/multimedia/image/image_js_standard/image/src/main/js/default/pages/index/index.hml similarity index 100% rename from multimedia/image/image_js_standard/src/main/js/default/pages/index/index.hml rename to multimedia/image/image_js_standard/image/src/main/js/default/pages/index/index.hml diff --git a/multimedia/image/image_js_standard/src/main/js/default/pages/index/index.js b/multimedia/image/image_js_standard/image/src/main/js/default/pages/index/index.js similarity index 100% rename from multimedia/image/image_js_standard/src/main/js/default/pages/index/index.js rename to multimedia/image/image_js_standard/image/src/main/js/default/pages/index/index.js diff --git a/multimedia/image/image_js_standard/src/main/js/test/List.test.js b/multimedia/image/image_js_standard/image/src/main/js/test/List.test.js similarity index 93% rename from multimedia/image/image_js_standard/src/main/js/test/List.test.js rename to multimedia/image/image_js_standard/image/src/main/js/test/List.test.js index 53f5d6a2e..8a84d231e 100644 --- a/multimedia/image/image_js_standard/src/main/js/test/List.test.js +++ b/multimedia/image/image_js_standard/image/src/main/js/test/List.test.js @@ -1,16 +1,16 @@ -/* - * Copyright (C) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + require('./image.test.js') \ No newline at end of file diff --git a/multimedia/image/image_js_standard/image/src/main/js/test/image.test.js b/multimedia/image/image_js_standard/image/src/main/js/test/image.test.js new file mode 100644 index 000000000..87e00d538 --- /dev/null +++ b/multimedia/image/image_js_standard/image/src/main/js/test/image.test.js @@ -0,0 +1,1673 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import image from '@ohos.multimedia.image' +import fileio from '@ohos.fileio' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' +import {testPng, testJpg} from './testImg' +import abilityAccessCtrl from '@ohos.abilityAccessCtrl' +import bundle from '@ohos.bundle' + +describe('Image', function () { + var pathJpg = '/data/storage/el2/base/files/test.jpg'; + var pathBmp = '/data/storage/el2/base/files/test.bmp'; + var pathGif = '/data/storage/el2/base/files/test.gif'; + var pathPng = '/data/storage/el2/base/files/test.png'; + var pathMovingGif = '/data/storage/el2/base/files/moving_test.gif'; + + beforeAll(async function () { + await applyPermission(); + console.info('beforeAll case'); + }) + + beforeEach(function () { + console.info('beforeEach case'); + }) + + afterEach(async function () { + console.info('afterEach case'); + }) + + afterAll(async function () { + console.info('afterAll case'); + }) + + async function applyPermission(){ + let appInfo = await bundle.getApplicationInfo('ohos.acts.multimedia.image',0,100); + let atManager = abilityAccessCtrl.createAtManager(); + if(atManager != null){ + let tokenID = appInfo.accessTokenId; + console.info('[permission]case accessTokenId is' + tokenID); + let permissionName1 = 'ohos.permission.MEDIA_LOCATION'; + let permissionName2 = 'ohos.permission.READ_MEDIA'; + let permissionName3 = 'ohos.permission.WRITE_MEDIA'; + await atManager.grantUserGrantedPermission(tokenID,permissionName1).then((result)=>{ + console.info('[permission]case grantUserGrantedPermission success:' + result); + }).catch((err)=>{ + console.info('[permission]case grantUserGrantedPermission failed:' + err); + }); + await atManager.grantUserGrantedPermission(tokenID,permissionName2).then((result)=>{ + console.info('[permission]case grantUserGrantedPermission success:' + result); + }).catch((err)=>{ + console.info('[permission]case grantUserGrantedPermission failed:' + err); + }); + await atManager.grantUserGrantedPermission(tokenID,permissionName3).then((result)=>{ + console.info('[permission]case grantUserGrantedPermission success:' + result); + }).catch((err)=>{ + console.info('[permission]case grantUserGrantedPermission failed:' + err); + }); + }else{ + console.info('[permission]case apply permission failed,createAtManager failed'); + } + } + + + + /** + * @tc.number : TC_041 + * @tc.name : createImageSource(uri)-jpg + * @tc.desc : 1.set uri + * 2.call createImageSource(uri) + * 3.return imagesource + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('TC_041', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathJpg); + const imageSourceApi = image.createImageSource(fdNumber); + expect(imageSourceApi != undefined).assertTrue(); + console.info('TC_041 success'); + fileio.closeSync(fdNumber); + done(); + }catch(error){ + console.info('TC_041 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_041-1 + * @tc.name : createImageSource(uri)-bmp + * @tc.desc : 1.seturi + * 2.call createImageSource(uri) + * 3.return imagesource + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('TC_041-1', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathBmp); + const imageSourceApi = image.createImageSource(fdNumber); + expect(imageSourceApi != undefined).assertTrue(); + console.info('TC_041-1 success'); + done(); + }catch(error){ + console.info('TC_041-1 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_041-2 + * @tc.name : createImageSource(uri)-gif + * @tc.desc : 1.seturi + * 2.call createImageSource(uri) + * 3.return imagesource + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('TC_041-2', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathGif); + const imageSourceApi = image.createImageSource(fdNumber); + expect(imageSourceApi != undefined).assertTrue(); + console.info('TC_041-2 success'); + done(); + }catch(error){ + console.info('TC_041-2 error: ' + error); + expect(false).assertTrue(); + done(); + } + + }) + + /** + * @tc.number : TC_041-3 + * @tc.name : createImageSource(uri)-png + * @tc.desc : 1.seturi + * 2.call createImageSource(uri) + * 3.return imagesource + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('TC_041-3', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathPng); + const imageSourceApi = image.createImageSource(fdNumber); + expect(imageSourceApi != undefined).assertTrue(); + console.info('TC_041-3 success'); + done(); + }catch(error){ + console.info('TC_041-3 error: ' + error); + expect(false).assertTrue(); + done(); + } + + }) + + /** + * @tc.number : TC_041-4 + * @tc.name : createImageSource(uri)-wrong suffix file + * @tc.desc : 1.call createImageSource(uri) + * 2.Incoming wrong suffix file + * 3.imagesource null + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('TC_041-4', 0, async function (done) { + const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.123'); + expect(imageSourceApi == undefined).assertTrue(); + console.info('TC_041-4 success'); + done(); + }) + + /** + * @tc.number : TC_041-5 + * @tc.name : createImageSource(uri)-wrong uri + * @tc.desc : 1.call createImageSource(uri) + * 2.set wrong uri + * 3.return null + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('TC_041-5', 0, async function (done) { + try{ + const imageSourceApi = image.createImageSource('file:///multimedia/test.jpg'); + expect(imageSourceApi == undefined).assertTrue(); + console.info('TC_041-5 success'); + done(); + }catch(error){ + console.info('TC_041-5 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_042 + * @tc.name : createImageSource(fd) + * @tc.desc : 1.call createImageSource + * 2.set fd + * 3.return imagesource + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('TC_042', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_042 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.getImageInfo((err,imageInfo) => { + if (err){ + expect(false).assertTrue(); + console.info('TC_042 err: ' + err); + done(); + return + } + if (imageInfo != undefined){ + expect(true).assertTrue(); + fileio.closeSync(fdNumber); + done(); + }else{ + console.info('TC_042 failed'); + expect(false).assertTrue(); + done(); + } + + }) + } + }catch(error){ + console.info('TC_042 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_042-1 + * @tc.name : createImageSource(fd) fd<0 + * @tc.desc : 1.call createImageSource + * 2.set wrong fd + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('TC_042-1', 0, async function (done) { + const imageSourceApi = image.createImageSource(-2); + expect(imageSourceApi == undefined).assertTrue(); + console.info('TC_042-1 success'); + done(); + }) + + /** + * @tc.number : TC_043 + * @tc.name : createImageSource(data) + * @tc.desc : 1.setdata + * 2.createImageSource + * 3.return imagesource + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('TC_043', 0, async function (done) { + const data = testJpg.buffer; + const imageSourceApi = image.createImageSource(data); + if (imageSourceApi == undefined) { + console.info('TC_043 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.getImageInfo((err,imageInfo) => { + console.info('TC_043 imageInfo'); + expect(imageInfo != undefined).assertTrue(); + done(); + }) + } + }) + + /** + * @tc.number : TC_043-1 + * @tc.name : createImageSource(data) buffer:0 + * @tc.desc : 1.setdata + * 2.createImageSource + * 3.return imagesource + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('TC_043-1', 0, async function (done) { + const data = new ArrayBuffer(0); + const imageSourceApi = image.createImageSource(data); + expect(imageSourceApi == undefined).assertTrue(); + console.info('TC_043-1 success'); + done(); + }) + + /** + * @tc.number : TC_044 + * @tc.name : release-imagesource-promise-jpg + * @tc.desc : 1.create ImageSource + * 2.call release() + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_044', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_044 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.release().then(()=>{ + console.info('TC_044 success'); + expect(true).assertTrue(); + done(); + }).catch(error => { + console.info('TC_044 error'); + expect(false).assertTrue(); + done(); + }) + } + }catch(error){ + console.info('TC_044 err:' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_044-1 + * @tc.name : release-imagesource-callback-jpg + * @tc.desc : 1.create ImageSource + * 2.call release() + * 3.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_044-1', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_044-1 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.release(() => { + console.info('TC_044-1 Success'); + expect(true).assertTrue(); + done(); + }) + } + }catch(error){ + console.info('TC_044-1 err:' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_045 + * @tc.name : getImageInfo(callback: AsyncCallback)-jpg + * @tc.desc : 1.create imageSource + * 2.imageSourcecall getImageInfo(ImageInfo) + * 3.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + + it('TC_045', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_045 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.getImageInfo((err,imageInfo) => { + if(err){ + expect(false).assertTrue(); + console.info('TC_045 err:' + err); + done(); + return + } + if (imageInfo != undefined){ + console.info('TC_045 imageInfo.size.height:'+imageInfo.size.height); + console.info('TC_045 imageInfo.size.width:'+imageInfo.size.width); + expect(true).assertTrue(); + fileio.closeSync(fdNumber); + done(); + }else{ + console.info('TC_045 failed'); + expect(false).assertTrue(); + done(); + } + }) + } + }catch(error){ + console.info('TC_045 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + + /** + * @tc.number : TC_045-1 + * @tc.name : getImageInfo(callback: AsyncCallback)-bmp + * @tc.desc : 1.create imageSource + * 2.imageSourcecall getImageInfo(ImageInfo) + * 3.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_045-1', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathBmp); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_045-1 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.getImageInfo((err,imageInfo) => { + expect(imageInfo != undefined).assertTrue(); + console.info('TC_045-1 imageInfo.size.height:'+imageInfo.size.height); + console.info('TC_045-1 imageInfo.size.width:'+imageInfo.size.width); + done(); + }) + } + }catch(error){ + console.info('TC_045-1 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_045-2 + * @tc.name : getImageInfo(callback: AsyncCallback)-png + * @tc.desc : 1.create imageSource + * 2.imageSourcecall getImageInfo(ImageInfo) + * 3.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_045-2', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathPng); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_045-2 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.getImageInfo((err,imageInfo) => { + expect(imageInfo != undefined).assertTrue(); + console.info('TC_045-2 imageInfo.size.height:'+imageInfo.size.height); + console.info('TC_045-2 imageInfo.size.width:'+imageInfo.size.width); + done(); + }) + } + }catch(error){ + console.info('TC_045-2 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_045-3 + * @tc.name : getImageInfo(callback: AsyncCallback)-gif + * @tc.desc : 1.create ImageInfo + * 2.call getImageInfo(index, ImageInfo) + * 3.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_045-3', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathGif); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_045-3 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.getImageInfo((err,imageInfo) => { + if (err){ + expect(false).assertTrue(); + console.info('TC_045-3 error' + err); + done(); + return + } + if (imageInfo != undefined && imageInfo != null){ + expect(true).assertTrue(); + console.info('TC_045-3 imageInfo.size.height:' + imageInfo.size.height); + console.info('TC_045-3 imageInfo.size.width:'+imageInfo.size.width); + console.info('TC_045-3 success') + done(); + }else{ + expect(false).assertTrue(); + console.info('TC_045-3 failed') + done(); + } + }) + } + }catch(error){ + console.info('TC_045-3 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_046 + * @tc.name : getImageInfo(index: number, callback: AsyncCallback)-jpg + * @tc.desc : 1.create ImageInfo + * 2.call getImageInfo(index, ImageInfo) + * 3.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_046', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_046 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.getImageInfo(0, (err, imageInfo) => { + expect(imageInfo != undefined).assertTrue(); + console.info('TC_046 imageInfo.size.height:'+imageInfo.size.height); + console.info('TC_046 imageInfo.size.width:'+imageInfo.size.width); + done(); + }) + } + }catch(error){ + console.info('TC_046 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_046-1 + * @tc.name : getImageInfo(index: number, callback: AsyncCallback)-bmp + * @tc.desc : 1.create ImageInfo + * 2.call getImageInfo(index, ImageInfo) + * 3.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_046-1', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathBmp); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_046-1 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.getImageInfo(0, (err, imageInfo) => { + expect(imageInfo != undefined).assertTrue(); + console.info('TC_046-1 imageInfo.size.height:'+imageInfo.size.height); + console.info('TC_046-1 imageInfo.size.width:'+imageInfo.size.width); + done(); + }) + } + }catch(error){ + console.info('TC_046-1 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number: TC_046-2 + * @tc.name : getImageInfo(index: number, callback: AsyncCallback)-png + * @tc.desc : 1.create ImageInfo + * 2.call getImageInfo(index, ImageInfo) + * 3.callback return undefined + * @tc.size : MEDIUM MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_046-2', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathPng); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_046-2 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.getImageInfo(0, (err, imageInfo) => { + expect(imageInfo != undefined).assertTrue(); + console.info('TC_046-2 imageInfo.size.height:'+imageInfo.size.height); + console.info('TC_046-2 imageInfo.size.width:'+imageInfo.size.width); + done(); + }) + } + }catch{ + console.info('TC_046-2 error: ' + error); + expect(false).assertTrue(); + done(); + } + + }) + + /** + * @tc.number: TC_046-3 + * @tc.name : getImageInfo(index: number, callback: AsyncCallback)-gif + * @tc.desc : 1.create ImageInfo + * 2.call getImageInfo(index, ImageInfo) + * 3.callback return undefined + * @tc.size : MEDIUM MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_046-3', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathGif); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_046-3 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.getImageInfo(0,(err, imageInfo) => { + if (err){ + expect(false).assertTrue(); + console.info('TC_046-3 error' + err); + done(); + return + } + if (imageInfo != undefined && imageInfo != null){ + expect(true).assertTrue(); + console.info('TC_046-3 imageInfo.size.height:' + imageInfo.size.height); + console.info('TC_046-3 imageInfo.size.width:'+imageInfo.size.width); + console.info('TC_046-3 success') + done(); + }else{ + expect(false).assertTrue(); + console.info('TC_046-3 failed') + done(); + } + }) + } + }catch(error){ + console.info('TC_046-3 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number: TC_046-4 + * @tc.name : getImageInfo(index: number, callback: AsyncCallback)-gif(frame:1)-index:1 + * @tc.desc : 1.create ImageInfo + * 2.call getImageInfo(index, ImageInfo) + * 3.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_046-4', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathGif); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_046-4 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.getImageInfo(1, (err, imageInfo) => { + if(imageInfo == undefined) { + expect(true).assertTrue(); + done(); + } else { + expect(false).assertTrue(); + done(); + } + }) + } + }catch(error){ + console.info('TC_046-4 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number: TC_046-5 + * @tc.name : getImageInfo(index: number, callback: AsyncCallback)-gif-index:-1 + * @tc.desc : 1.create ImageInfo + * 2.call getImageInfo(index, ImageInfo) + * 3.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_046-5', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathGif); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_046-5 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.getImageInfo(-1, (err, imageInfo) => { + expect(imageInfo == undefined).assertTrue(); + done(); + }) + } + }catch(error){ + console.info('TC_046-5 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_047 + * @tc.name : getImageInfo(index?: number): Promise-jpg + * @tc.desc : 1.create imagesource + * 2.call getImageInfo(index) + * 3.callbackcall ,return imageinfo + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_047', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_047 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.getImageInfo(0) + .then(imageInfo => { + expect(imageInfo != undefined).assertTrue(); + console.info('TC_047 imageInfo'); + console.info('imageInfo.size.height:'+imageInfo.size.height); + console.info('imageInfo.size.width:'+imageInfo.size.width); + done(); + }).catch(error => { + console.log('TC_047 error: ' + error); + expect().assertFail(); + done(); + }) + } + }catch(error){ + console.info('TC_047 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_047-1 + * @tc.name : getImageInfo(index?: number): Promise-bmp + * @tc.desc : 1.create imagesource + * 2.call getImageInfo(index) + * 3.callbackcall ,return imageinfo + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_047-1', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathBmp); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_047-1 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.getImageInfo(0) + .then(imageInfo => { + expect(imageInfo != undefined).assertTrue(); + console.info('TC_047-1 imageInfo'); + console.info('imageInfo.size.height:'+imageInfo.size.height); + console.info('imageInfo.size.width:'+imageInfo.size.width); + done(); + }).catch(error => { + console.log('TC_047-1 error: ' + error); + expect().assertFail(); + done(); + }) + } + }catch(error){ + console.info('TC_047-1 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_047-2 + * @tc.name : getImageInfo(index?: number): Promise-png + * @tc.desc : 1.create imagesource + * 2.call getImageInfo(index) + * 3.callbackcall ,return imageinfo + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_047-2', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathPng); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_047-2 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.getImageInfo(0) + .then(imageInfo => { + expect(imageInfo != undefined).assertTrue(); + console.info('TC_047-2 imageInfo'); + console.info('imageInfo.size.height:'+imageInfo.size.height); + console.info('imageInfo.size.width:'+imageInfo.size.width); + done(); + }).catch(error => { + console.log('TC_047-2 error: ' + error); + expect().assertFail(); + done(); + }) + } + }catch(error){ + console.info('TC_047-2 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_047-3 + * @tc.name : getImageInfo(index?: number): Promise-gif + * @tc.desc : 1.create imagesource + * 2.call getImageInfo(index) + * 3.callbackcall ,return imageinfo + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_047-3', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathGif); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_047-3 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.getImageInfo(0) + .then(imageInfo => { + if (imageInfo != undefined && imageInfo != null){ + expect(true).assertTrue(); + console.info('TC_047-3 imageInfo.size.height:'+imageInfo.size.height); + console.info('TC_047-3 imageInfo.size.width:'+imageInfo.size.width); + done(); + }else{ + expect(false).assertTrue(); + console.info('TC_047-3 failed'); + done(); + } + }).catch(error => { + console.log('TC_047-3 error: ' + error); + expect().assertFail(); + done(); + }) + } + }catch(error){ + console.info('TC_047-3 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number: TC_047-4 + * @tc.name : getImageInfo(index?: number): Promise-gif(frame:1)-index:1 + * @tc.desc : 1.create imagesource + * 2.call getImageInfo(index=1) + * 3.callback return imageinfo undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_047-4', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathGif); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_047-4 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.getImageInfo(1) + .then(() => { + console.log('TC_047-4 failed'); + expect().assertFail(); + done(); + }).catch(error => { + console.log('TC_047-4 success'); + expect(true).assertTrue(); + done(); + }) + } + }catch(error){ + console.info('TC_047-4 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_047-5 + * @tc.name : getImageInfo(index?: number): Promise-gif-index:-1 + * @tc.desc : 1.create imagesource + * 2.call getImageInfo(index=-1) + * 3.callback return imageinfo undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_047-5', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathGif); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_047-5 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.getImageInfo(-1) + .then(() => { + console.log('TC_047-5 failed'); + expect().assertFail(); + done(); + }).catch(error => { + console.log('TC_047-5 success'); + expect(true).assertTrue(); + done(); + }) + } + }catch(error){ + console.info('TC_047-5 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_050-14 + * @tc.name : createPixelMap-promise-jpg + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_050-14', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_050-14 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.createPixelMap().then(pixelmap => { + console.info('TC_050-14 success '); + expect(pixelmap != undefined ).assertTrue(); + done(); + }).catch(error => { + console.log('TC_050-14 error: ' + error); + expect().assertFail(); + done(); + }) + } + }catch(error){ + console.info('TC_050-14 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_050-15 + * @tc.name : createPixelMap-callback-jpg + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return null + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_050-15', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_050-15 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.createPixelMap((err, pixelmap) => { + console.info('TC_050-15 success '); + expect(pixelmap != undefined ).assertTrue(); + done(); + }) + } + }catch(error){ + console.info('TC_050-15 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_053 + * @tc.name : createIncrementalSource-updateData-png + * @tc.desc : 1.create imagesource + * 2.update data + * 3.create pixelmap + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_053', 0, async function (done) { + try { + let testimagebuffer = testPng; + console.info('TC_053 0003 ' + testimagebuffer.length); + let bufferSize = testimagebuffer.length; + let offset = 0; + const incSouce = image.createIncrementalSource(new ArrayBuffer(1)); + let ret; + let isFinished = false; + while (offset < testimagebuffer.length) { + console.info('TC_053 0006 ' + testimagebuffer.length); + var oneStep = testimagebuffer.slice(offset, offset + bufferSize); + console.info('TC_053 0007 ' + oneStep.length); + if (oneStep.length < bufferSize) { + isFinished = true; + } + ret = await incSouce.updateData(oneStep, isFinished, 0, oneStep.length); + if (!ret) { + console.info('TC_053 updateData failed'); + expect(ret).assertTrue(); + break; + } + offset = offset + oneStep.length; + console.info('TC_053 0011 ' + offset); + } + if (ret) { + console.info('TC_053 updateData success '); + let decodingOptions = { + sampleSize:1 + }; + incSouce.createPixelMap(decodingOptions, (err, pixelmap) => { + console.info('TC_053 0014' + pixelmap); + expect(pixelmap != undefined ).assertTrue(); + done(); + }) + } else { + done(); + } + } catch (error) { + console.info('TC_053 updateData failed ' + error); + } + }) + + /** + * @tc.number : TC_053-1 + * @tc.name : createIncrementalSource-updateData-jpg + * @tc.desc : 1.create imagesource + * 2.update data + * 3.create pixelmap + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_053-1', 0, async function (done) { + try { + let testimagebuffer = testJpg; + console.info('TC_053-1 0003 ' + testimagebuffer.length); + let bufferSize = testimagebuffer.length; + let offset = 0; + const incSouce = image.createIncrementalSource(new ArrayBuffer(1)); + let isFinished = false; + let ret; + while (offset < testimagebuffer.length) { + console.info('TC_053-1 0006 ' + testimagebuffer.length); + var oneStep = testimagebuffer.slice(offset, offset + bufferSize); + console.info('TC_053-1 0007 ' + oneStep.length); + if (oneStep.length < bufferSize) { + isFinished = true; + } + ret = await incSouce.updateData(oneStep, isFinished, 0, oneStep.length); + if (!ret) { + console.info('TC_053-1 updateData failed'); + expect(ret).assertTrue(); + break; + } + offset = offset + oneStep.length; + console.info('TC_053-1 0011 ' + offset); + } + if (ret) { + console.info('TC_053-1 updateData success '); + let decodingOptions = { + sampleSize:1 + }; + incSouce.createPixelMap(decodingOptions, (err, pixelmap) => { + expect(pixelmap != undefined ).assertTrue(); + done(); + }) + } else { + done(); + } + } catch (error) { + console.info('TC_053-1 updateData failed ' + error); + } + }) + + /** + * @tc.number : TC_064 + * @tc.name : release ImageSource - promise - png + * @tc.desc : 1.create ImageSource + * 2.call release() + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_064', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathPng); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_064 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.release().then(()=>{ + console.info('TC_064 success'); + expect(true).assertTrue(); + done(); + }).catch(error => { + console.log('TC_064 error: ' + error); + expect().assertFail(); + done(); + }) + } + }catch(error){ + console.info('TC_064 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_064-1 + * @tc.name : release ImageSource - callback - png + * @tc.desc : 1.create ImageSource + * 2.call release() + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_064-1', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathPng); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_064-1 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.release(async(err) => { + if (err){ + console.info('TC_064-1 err:' + err); + expect(false).assertTrue(); + done(); + return + } + console.info('TC_064-1 Success'); + expect(true).assertTrue(); + expect(true).assertTrue(); + done(); + }) + } + }catch(error){ + console.info('TC_064-1 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_065 + * @tc.name : release ImageSource - promise - bmp + * @tc.desc : 1.create ImageSource + * 2.call release() + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_065', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathBmp); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_065 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.release().then(()=>{ + console.info('TC_065 success'); + expect(true).assertTrue(); + done(); + }).catch(error => { + console.log('TC_065 error: ' + error); + expect().assertFail(); + done(); + }) + } + }catch(error){ + console.info('TC_065 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_065-1 + * @tc.name : release ImageSource - callback - bmp + * @tc.desc : 1.create ImageSource + * 2.create SourceStream + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_065-1', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathBmp); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_065-1 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.release(async() => { + console.info('TC_065-1 Success'); + expect(true).assertTrue(); + done(); + }) + } + }catch(error){ + console.info('TC_065-1 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_066 + * @tc.name : release ImageSource - promise - gif + * @tc.desc : 1.create ImageSource + * 2.call release() + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_066', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathGif); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_066 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.release().then(()=>{ + console.info('TC_066 success'); + expect(true).assertTrue(); + done(); + }).catch(error => { + console.log('TC_066 error: ' + error); + expect().assertFail(); + done(); + }) + } + }catch(error){ + console.info('TC_066 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_066-1 + * @tc.name : release ImageSource - callback - gif + * @tc.desc : 1.create ImageSource + * 2.call release() + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_066-1', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathGif); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_066-1 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.release(() => { + console.info('TC_066-1 Success'); + expect(true).assertTrue(); + done(); + }) + } + }catch(error){ + console.info('TC_066-1 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_067-14 + * @tc.name : createPixelMap-promise-gif + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_067-14', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathMovingGif); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_067-14 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.createPixelMap().then(pixelmap => { + console.info('TC_067-14 success '); + expect(pixelmap !== undefined ).assertTrue(); + done(); + }).catch(error => { + console.log('TC_067-14 error: ' + error); + expect().assertFail(); + done(); + }) + } + }catch(error){ + console.info('TC_067-14 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_067-15 + * @tc.name : createPixelMap-pcallback-gif + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return null + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_067-15', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathMovingGif); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_067-15 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.createPixelMap((err, pixelmap) => { + console.info('TC_067-15 success '); + expect(pixelmap !== undefined ).assertTrue(); + done(); + }) + } + }catch(error){ + console.info('TC_067-15 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_068-14 + * @tc.name : createPixelMap-promise-bmp + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_068-14', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathBmp); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_068-14 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.createPixelMap().then(pixelmap => { + console.info('TC_068-14 success '); + expect(pixelmap != undefined ).assertTrue(); + done(); + }).catch(error => { + console.log('TC_068-14 error: ' + error); + expect().assertFail(); + done(); + }) + } + }catch(error){ + console.info('TC_068-14 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_068-15 + * @tc.name : createPixelMap-callback-bmp + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_068-15', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathBmp); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_068-15 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.createPixelMap((err, pixelmap) => { + console.info('TC_068-15 success '); + expect(pixelmap != undefined ).assertTrue(); + done(); + }) + } + }catch(error){ + console.info('TC_068-15 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_163-14 + * @tc.name : createPixelMap-promise-png + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_163-14', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathPng); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_163-14 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.createPixelMap().then(pixelmap => { + console.info('TC_163-14 success'); + expect(pixelmap != undefined ).assertTrue(); + done(); + }).catch(error => { + console.log('TC_163-14 error: ' + error); + expect().assertFail(); + done(); + }) + } + }catch(error){ + console.info('TC_163-14 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_163-15 + * @tc.name : createPixelMap-callback-png + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return null + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_163-15', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathPng); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_163-15 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.createPixelMap((err, pixelmap) => { + console.info('TC_163-15 success'); + expect(pixelmap != undefined ).assertTrue(); + done(); + }) + } + }catch(error){ + console.info('TC_163-15 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_164 + * @tc.name : imagesource supportedFormats + * @tc.desc : 1.create imagesource + * 2.call supportedFormats + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('TC_164', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_164 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + expect(imageSourceApi.supportedFormats != undefined).assertTrue(); + console.info(imageSourceApi.supportedFormats); + console.info('TC_164 success '); + done(); + } + }catch(error){ + console.info('TC_164 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_166 + * @tc.name : imagepacker supportedFormats + * @tc.desc : 1.create imagepacker + * 2.call supportedFormats + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('TC_166', 0, async function (done) { + const imagePackerApi = image.createImagePacker(); + if (imagePackerApi == undefined) { + console.info('TC_166 create image packer failed'); + expect(false).assertTrue(); + done(); + } else { + expect(imagePackerApi.supportedFormats != undefined).assertTrue(); + console.info(imagePackerApi.supportedFormats); + console.info('TC_166 success '); + done(); + } + }) + + /** + * @tc.number : TC_168 + * @tc.name : isEditable + * @tc.desc : 1.create pixelmap + * 2.call isEditable + * 3.return true + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_168', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(Color, opts, (error,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_168 create pixelmap failed'); + expect(false).assertTrue(); + done(); + }else { + expect(pixelmap.isEditable == true).assertTrue(); + console.info('TC_168 success '); + done(); + } + }) + }) +}) \ No newline at end of file diff --git a/multimedia/image/image_js_standard/src/main/js/test/testImg.js b/multimedia/image/image_js_standard/image/src/main/js/test/testImg.js similarity index 99% rename from multimedia/image/image_js_standard/src/main/js/test/testImg.js rename to multimedia/image/image_js_standard/image/src/main/js/test/testImg.js index 7527cec4b..c79296bb7 100644 --- a/multimedia/image/image_js_standard/src/main/js/test/testImg.js +++ b/multimedia/image/image_js_standard/image/src/main/js/test/testImg.js @@ -13,88 +13,6 @@ * limitations under the License. */ -let tc_020buf = new Uint8Array([0,0,0,4,0,0,0,8,1,0,0,12,1,1,1,16,1,1,1,20,2,2,2,24,3,3,3,28,4,4,4,32,5,5,5,36,6,6,6,40,7,7,7,44,9,9,8,48,10,10,10,52,12,12,12,56,14,14,13,60,16,16,15,64,18,18,17,68,20,20,19,72,22,22,22,76,25,24,24,80,27,27,27,84,30,30,29,88,33,32,32,92,36,35,35,96]) -let tc_020_1buf = new Uint8Array([0,0,0,4,0,0,0,8,1,0,0,12,1,1,1,16,1,1,1,20,2,2,2,24,3,3,3,28,4,4,4,32,5,5,5,36,6,6,6,40,7,7,7,44,9,9,8,48,10,10,10,52,12,12,12,56,14,14,13,60,16,16,15,64,18,18,17,68,20,20,19,72,22,22,22,76,25,24,24,80,27,27,27,84,30,30,29,88,33,32,32,92,36,35,35,96]) -let tc_021buf = new Uint8Array([0,0,0,4,0,0,0,8]) -let tc_021_1buf = new Uint8Array([0,0,0,4,0,0,0,8]) -let tc_022buf = new Uint8Array([0,0,0,4,0,0,0,8]) - -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]) let testPng = new Uint8Array([137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 0, 100, 0, 0, 0, 100, 8, 6, 0, 0, 0, 112, 226, 149, 84, 0, 0, 32, 0, 73, 68, 65, 84, 120, 1, 212, 193, 123, 176, 231, 247, 93, 223, 247, 231, 251, 253, 249, 254, 126, 231, 156, 61, 123, 191, 105, 37, 173, 180, 186, 95, 173, 187, 228, 43, 166, 182, 133, 109, 44, 108, 160, 6, 154, 105, 157, 116, 104, 50, 64, 72, 155, 41, 195, 64, 167, 13, 80, @@ -611,5 +529,82 @@ let testPng = new Uint8Array([137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 19, 255, 28, 240, 23, 223, 64, 127, 237, 65, 62, 251, 233, 207, 228, 181, 27, 215, 87, 115, 206, 40, 125, 211, 16, 0, 0, 0, 35, 73, 68, 65, 84, 149, 164, 204, 8, 133, 132, 13, 22, 190, 173, 132, 22, 133, 166, 164, 186, 251, 158, 143, 248, 248, 248, 136, 103, 158, 125, 134, 127, 94, 252, 223, 160, 16, 125, 12, 251, 15, 241, 139, 0, 0, 0, 0, 73, 69, 78, 68, 174, 66, 96, 130]) - - export {testPng, testJpg, tc_020buf, tc_020_1buf, tc_021buf, tc_021_1buf, tc_022buf} \ No newline at end of file + +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 {testPng, testJpg} \ No newline at end of file diff --git a/multimedia/image/image_js_standard/src/main/resources/base/element/string.json b/multimedia/image/image_js_standard/image/src/main/resources/base/element/string.json similarity index 94% rename from multimedia/image/image_js_standard/src/main/resources/base/element/string.json rename to multimedia/image/image_js_standard/image/src/main/resources/base/element/string.json index eed70c652..22af6ba2c 100644 --- a/multimedia/image/image_js_standard/src/main/resources/base/element/string.json +++ b/multimedia/image/image_js_standard/image/src/main/resources/base/element/string.json @@ -1,12 +1,12 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "ImageJSTestMain" - }, - { - "name": "mainability_description", - "value": "ImageJSTestMain Ability" - } - ] +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "ImageJSTestMain" + }, + { + "name": "mainability_description", + "value": "ImageJSTestMain Ability" + } + ] } \ No newline at end of file diff --git a/multimedia/image/image_js_standard/src/main/resources/base/media/icon.png b/multimedia/image/image_js_standard/image/src/main/resources/base/media/icon.png similarity index 100% rename from multimedia/image/image_js_standard/src/main/resources/base/media/icon.png rename to multimedia/image/image_js_standard/image/src/main/resources/base/media/icon.png diff --git a/multimedia/image/image_js_standard/imageDecodeOptions/BUILD.gn b/multimedia/image/image_js_standard/imageDecodeOptions/BUILD.gn new file mode 100644 index 000000000..41a1eea8c --- /dev/null +++ b/multimedia/image/image_js_standard/imageDecodeOptions/BUILD.gn @@ -0,0 +1,31 @@ +# Copyright (C) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("image_DecodeOptions_js_hap") { + hap_profile = "./src/main/config.json" + deps = [ + ":image_DecodeOptions_js_assets", + ":image_DecodeOptions_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsImageDecodeOptionsJsTest" +} +ohos_js_assets("image_DecodeOptions_js_assets") { + source_dir = "./src/main/js/default" +} +ohos_resources("image_DecodeOptions_resources") { + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" +} diff --git a/multimedia/image/image_js_standard/imageDecodeOptions/Test.json b/multimedia/image/image_js_standard/imageDecodeOptions/Test.json new file mode 100644 index 000000000..cda7c7218 --- /dev/null +++ b/multimedia/image/image_js_standard/imageDecodeOptions/Test.json @@ -0,0 +1,53 @@ +{ + "description": "Configuration for Image Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "1200000", + "package": "ohos.acts.multimedia.image.DecodeOptions", + "shell-timeout": "120000" + }, + "kits": [ + { + "type": "ShellKit", + "run-command": [ + "mkdir /data/app/el2/100/base/ohos.acts.multimedia.image.DecodeOptions/files", + "chmod 777 /data/app/el2/100/base/ohos.acts.multimedia.image.DecodeOptions/files" + ] + }, + { + "type": "PushKit", + "pre-push": [ + ], + "push": [ + "./resource/image/test.bmp ->/data/app/el2/100/base/ohos.acts.multimedia.image.DecodeOptions/files", + "./resource/image/test.png ->/data/app/el2/100/base/ohos.acts.multimedia.image.DecodeOptions/files", + "./resource/image/test.tiff ->/data/app/el2/100/base/ohos.acts.multimedia.image.DecodeOptions/files", + "./resource/image/test.jpg ->/data/app/el2/100/base/ohos.acts.multimedia.image.DecodeOptions/files", + "./resource/image/moving_test.gif ->/data/app/el2/100/base/ohos.acts.multimedia.image.DecodeOptions/files" + ] + }, + + { + "type": "ShellKit", + "run-command": [ + "chmod 777 /data/app/el2/100/base/ohos.acts.multimedia.image.DecodeOptions/files/test.bmp", + "chmod 777 /data/app/el2/100/base/ohos.acts.multimedia.image.DecodeOptions/files/test.png", + "chmod 777 /data/app/el2/100/base/ohos.acts.multimedia.image.DecodeOptions/files/test.tiff", + "chmod 777 /data/app/el2/100/base/ohos.acts.multimedia.image.DecodeOptions/files/test.jpg", + "chmod 777 /data/app/el2/100/base/ohos.acts.multimedia.image.DecodeOptions/files/moving_test.gif" + ], + "teardown-command":[ + + ] + }, + + { + "test-file-name": [ + "ActsImageDecodeOptionsJsTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] + +} diff --git a/multimedia/image/image_js_standard/imageDecodeOptions/signature/openharmony_sx.p7b b/multimedia/image/image_js_standard/imageDecodeOptions/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..d9fe0c1edd5ef09a357ed0bf05ed915a72278cca GIT binary patch literal 3445 zcmcgvYg7|w8YUN@h!HF*>Z)M0V#VM$A%TQi>r67a$s{BuKxh;v$>ajbOh_h7h}E)j zWkp5nda7)_q2R4myT?nBJ*T$YZgsV*uC2@NX~nK}*{-fzx2v{pJ+eCkRKcS^_VgU{ zBXi!%H{Ubw`@GM0K9CUArKHVj(lvc2;-&K25+Wx^h!*pCJV*r6Q__|+>3D=d$mfAX z^5}<&ytYI#UziZ~Efv=j;fS9iB`(TMh)bZ^4;&;OWF2Ct02Bc6Y;iQ|ceAD(NQ<3H zB_WY}*gsj3+$~YcfkJ{S2>=z!JRSm4u-SA&h+7;c0t6l*SO*>oN!x1Vkhmn;>N6fJQQ9xBWslPhJ4BDqwqnBDKkJv0$!-9-we zthkVMFPklPMoD*okoZXt#VvOe^+bRQ5n)L`bW?~Rb$B>PkqzuV!@#(RFzxsFT{z95 zmT*4=)#{D8D%4`tYxFAEiuQXQB&OG^u((PEI|(n$=n>efM{$#CPFxLRh}T=^tF1AW znaygLvB8)Yi>czU0r48k5!h~pYmFxM4Hh$ldhP0Rvv~o^&}A-dd32#x)8MR7MhPog zg&{624B1ds3^Q8`k$|(-=W_+2dM8=yE!UR&9Hi5V)?g~MKMRgw_@i0oN`!H012y(a zOUNmedCdT2bUv36t3es825w+6SoJZJ6^m7{UZc7;hSgxP2fiAF!pspyW$wqQMHz$I zT7%j!L_dJbhm|_WNA`?qt#IYQcSfuzs${AvOnOgTu)o#u&F=WtUzFo0!3g2u{qgAQuv)++;VfuW?ay7$prcLtGp2&2f-45nm@q!5q- zDI{f|@~Ui+ObJN~p+OUbek2G03I;&rJqbivnDY1oM6P8(vw`}sT!Z9D?*WTS5H(osd`jMaANWTAVwTNdK-ZOze z33&KW(t&k{(h|;wL%QjsksGfOUA~mV&u+_PH1qD?*wxzkC9>Xq$#dt*-rHANQi_)J zy}6BD($-WH|DtbX34CMvqSEB4tADen(F883|FU{Uk7eTfJk`Ey(~q>vGh_SvBFlUK znsJ2XkDBGr=|TQvTv4nUjs^IBWb0;v83V1$c~a{v6h%KmB1i@)hLEV=e2PfwLFPm9 zB<`%2N}CBSWO2kv1_JgmoJqWtAxz3H$=vzYgjaf#Ob0Hs<{fUWVn&@E-aUag z3Ap)ysbcb=v)?iM=55~AU3qln)H}$dDa89P4oC77yEjCPAbFv5D33Vv=_uk8C^U8Z*Qd6?zr_Sy+UxO=1M*T;)HmWL{vPc8pR=y3g>cYbdH6-PhYJhQ0m zSm)axY?-)q_pRpU%v%>)r#9bxb;;5EoV(XgUs?CP#MbTt_%LyLEJywijy+b~hMh11 zUlJhrAb4r9V#P1%o3H-rZi%mY|EZ$wS5IV~>dv~l%#&&A)!DviZk*uj)c^b9_0F-M zT<;#uiq*+yC}w|2c&DXvhUDI{$^##5+LZZ0;Dw%XiAncYT{gCad)MJtLw35wdq%e7 zh0hA01P@_JHjlj@fZC_h#=#SH=vAc655_;Zilhl3Hul2>h6g4+Fw&Bt4E9iz0-00} ziVBMWR0ZZdj0z#KFt;`2ou^xQFr#Cw$TZ~-`PpT`Je6VoT#M_qvzK3=P_6+Z9-QQS zp$=&HQ>mRGlNV(OoszuvvL>>MRyQ#wAJuWN6)v{h9) bx>478EPvJ9ufm`It;*5<%DP;E@Q(C + + {{ $t('strings.hello') }} {{ title }} + + diff --git a/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/default/pages/index/index.js b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/default/pages/index/index.js new file mode 100644 index 000000000..a0719cee5 --- /dev/null +++ b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/default/pages/index/index.js @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {Core, ExpectExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + core.init() + const configService = core.getDefaultService('config') + this.timeout = 60000 + configService.setConfig(this) + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/test/List.test.js b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/test/List.test.js new file mode 100644 index 000000000..8a84d231e --- /dev/null +++ b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/test/List.test.js @@ -0,0 +1,16 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +require('./image.test.js') \ No newline at end of file diff --git a/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/test/image.test.js b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/test/image.test.js new file mode 100644 index 000000000..b911fdb14 --- /dev/null +++ b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/test/image.test.js @@ -0,0 +1,3045 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import image from '@ohos.multimedia.image' +import fileio from '@ohos.fileio' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' +import abilityAccessCtrl from '@ohos.abilityAccessCtrl' +import bundle from '@ohos.bundle' + +describe('Image', function () { + var pathJpg = '/data/storage/el2/base/files/test.jpg'; + var pathBmp = '/data/storage/el2/base/files/test.bmp'; + var pathPng = '/data/storage/el2/base/files/test.png'; + var pathMovingGif = '/data/storage/el2/base/files/moving_test.gif'; + var pathTiff = '/data/storage/el2/base/files/test.tiff'; + + beforeAll(async function () { + await applyPermission(); + console.info('beforeAll case'); + }) + + beforeEach(function () { + console.info('beforeEach case'); + }) + + afterEach(async function () { + console.info('afterEach case'); + }) + + afterAll(async function () { + console.info('afterAll case'); + }) + + async function applyPermission(){ + let appInfo = await bundle.getApplicationInfo('ohos.acts.multimedia.image.DecodeOptions',0,100); + let atManager = abilityAccessCtrl.createAtManager(); + if(atManager != null){ + let tokenID = appInfo.accessTokenId; + console.info('[permission]case accessTokenId is' + tokenID); + let permissionName1 = 'ohos.permission.MEDIA_LOCATION'; + let permissionName2 = 'ohos.permission.READ_MEDIA'; + let permissionName3 = 'ohos.permission.WRITE_MEDIA'; + await atManager.grantUserGrantedPermission(tokenID,permissionName1).then((result)=>{ + console.info('[permission]case grantUserGrantedPermission success:' + result); + }).catch((err)=>{ + console.info('[permission]case grantUserGrantedPermission failed:' + err); + }); + await atManager.grantUserGrantedPermission(tokenID,permissionName2).then((result)=>{ + console.info('[permission]case grantUserGrantedPermission success:' + result); + }).catch((err)=>{ + console.info('[permission]case grantUserGrantedPermission failed:' + err); + }); + await atManager.grantUserGrantedPermission(tokenID,permissionName3).then((result)=>{ + console.info('[permission]case grantUserGrantedPermission success:' + result); + }).catch((err)=>{ + console.info('[permission]case grantUserGrantedPermission failed:' + err); + }); + }else{ + console.info('[permission]case apply permission failed,createAtManager failed'); + } + } + + /** + * @tc.number : TC_062 + * @tc.name : packing ImageSource - promise + * @tc.desc : 1.create ImageSource + * 2.call packing + * 3.return array + * 4.callbackcall return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_062', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathPng); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_062 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + const imagePackerApi = image.createImagePacker(); + if (imagePackerApi == undefined) { + console.info('TC_062 create image packer failed'); + expect(false).assertTrue(); + done(); + } else { + let packOpts = { format:["image/jpeg"], quality:99 } + imagePackerApi.packing(imageSourceApi, packOpts) + .then( data => { + console.info('TC_062 success'); + expect(data != undefined).assertTrue(); + done(); + }).catch(error => { + console.log('TC_062 error: ' + error); + expect(false).assertFail(); + done(); + }) + } + } + }catch(error){ + console.info('TC_062 error: ' + error); + expect(false).assertTrue(); + done(); + } + + }) + + /** + * @tc.number : TC_062-1 + * @tc.name : packing ImageSource - callback + * @tc.desc : 1.create ImageSource + * 2.call packing + * 3.return array + * 4.callbackcall return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_062-1', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathPng); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_062-1 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + const imagePackerApi = image.createImagePacker(); + if (imagePackerApi == undefined) { + console.info('TC_062-1 create image packer failed'); + expect(false).assertTrue(); + done(); + } else { + let packOpts = { format:["image/jpeg"], quality:1 } + imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => { + console.info('TC_062-1 success'); + expect(data != undefined).assertTrue(); + done(); + }) + } + } + }catch(error){ + console.info('TC_062-1 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_062-2 + * @tc.name : packing ImageSource - callback - wrong format + * @tc.desc : 1.create ImageSource + * 2.call packing + * 3.return array + * 4.callbackcall return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_062-2', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathPng); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_062-2 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + const imagePackerApi = image.createImagePacker(); + if (imagePackerApi == undefined) { + console.info('TC_062-2 create image packer failed'); + expect(false).assertTrue(); + done(); + } else { + let packOpts = { format:["image/gif"], quality:98 } + imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => { + console.info('TC_062-2 success'); + expect(data == undefined).assertTrue(); + console.info(data); + done(); + }) + } + } + }catch(error){ + console.info('TC_062-2 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_062-3 + * @tc.name : packing ImageSource - callback - wrong quality + * @tc.desc : 1.create ImageSource + * 2.call packing + * 3.call return array + * 4.callbackcall return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_062-3', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathPng); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_062-3 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + const imagePackerApi = image.createImagePacker(); + if (imagePackerApi == undefined) { + console.info('TC_062-3 create image packer failed'); + expect(false).assertTrue(); + done(); + } else { + let packOpts = { format:["image/jpeg"], quality:101 } + imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => { + console.info('TC_062-3 success'); + expect(data == undefined).assertTrue(); + console.info(data); + done(); + }) + } + } + }catch(error){ + console.info('TC_062-3 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_062-4 + * @tc.name : createImagePacker + * @tc.desc : 1.create ImageSource + * 2.call packing + * 3.return array + * 4.callbackcall return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_062-4', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathPng); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_062-4 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + const imagePackerApi = image.createImagePacker(); + if (imagePackerApi == undefined) { + console.info('TC_062-4 create image packer failed'); + expect(false).assertTrue(); + done(); + } else { + console.info('TC_062-4 create image packer success'); + expect(true).assertTrue(); + done(); + } + } + }catch(error){ + console.info('TC_062-4 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_062-5 + * @tc.name : packing ImageSource - promise - no quality + * @tc.desc : 1.create ImageSource + * 2.call packing + * 3.call return array + * 4.callbackcall return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + + it('TC_062-5', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathPng); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_062-5 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + const imagePackerApi = image.createImagePacker(); + if (imagePackerApi == undefined) { + console.info('TC_062-5 create image packer failed'); + expect(false).assertTrue(); + done(); + } else { + let packOpts = { format:["image/jpeg"] } + imagePackerApi.packing(imageSourceApi, packOpts) + .then( data => { + console.info('TC_062-5 failed'); + expect(data == undefined).assertTrue(); + done(); + }).catch(error => { + console.log('TC_062-5 error: ' + error); + console.log('TC_062-5 success'); + expect(true).assertTrue(); + done(); + }) + } + } + }catch(error){ + console.info('TC_062-5 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + + /** + * @tc.number : TC_062-6 + * @tc.name : packing ImageSource - promise - no format + * @tc.desc : 1.create ImageSource + * 2.call packing + * 3.call return array + * 4.callbackcall return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_062-6', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathPng); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_062-6 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + const imagePackerApi = image.createImagePacker(); + if (imagePackerApi == undefined) { + console.info('TC_062-6 create image packer failed'); + expect(false).assertTrue(); + done(); + } else { + let packOpts = { quality:50 } + imagePackerApi.packing(imageSourceApi, packOpts) + .then( data => { + console.info('TC_062-6 failed'); + expect(data == undefined).assertTrue(); + done(); + }).catch(error => { + console.log('TC_062-6 error: ' + error); + console.log('TC_062-6 success'); + expect(true).assertTrue(); + done(); + }) + } + } + }catch(error){ + console.info('TC_062-6 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) +/** + * @tc.number : TC_062-7 + * @tc.name : packing ImageSource - callback - quality 100 + * @tc.desc : 1.create ImageSource + * 2.call packing + * 3.return array + * 4.callbackcall return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + + it('TC_062-7', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathPng); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_062-7 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + const imagePackerApi = image.createImagePacker(); + if (imagePackerApi == undefined) { + console.info('TC_062-7 create image packer failed'); + expect(false).assertTrue(); + done(); + } else { + let packOpts = { format:["image/jpeg"], quality:100 } + imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => { + if (err){ + expect(false).assertTrue(); + console.info('TC_062-7 error: ' + err); + done(); + return + } + if (data != undefined){ + console.info('TC_062-7 success'); + expect(true).assertTrue(); + done(); + }else{ + except(false).assertTrue(); + console.info('TC_062-7 failed'); + done(); + } + }) + } + } + }catch(error){ + console.info('TC_062-7 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + /** + * @tc.number : TC_062-8 + * @tc.name : packing ImageSource - callback - quality 0 + * @tc.desc : 1.create ImageSource + * 2.call packing + * 3.return array + * 4.callbackcall return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_062-8', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathPng); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_062-8 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + const imagePackerApi = image.createImagePacker(); + if (imagePackerApi == undefined) { + console.info('TC_062-8 create image packer failed'); + expect(false).assertTrue(); + done(); + } else { + let packOpts = { format:["image/jpeg"], quality:0 } + imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => { + console.info('TC_062-8 success'); + expect(data != undefined).assertTrue(); + done(); + }) + } + } + }catch(error){ + console.info('TC_062-8 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_062-9 + * @tc.name : packing ImageSource - callback - quality -1 + * @tc.desc : 1.create ImageSource + * 2.call packing + * 3.return array + * 4.callbackcall return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_062-9', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathPng); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_062-9 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + const imagePackerApi = image.createImagePacker(); + if (imagePackerApi == undefined) { + console.info('TC_062-9 create image packer failed'); + expect(false).assertTrue(); + done(); + } else { + let packOpts = { format:["image/jpeg"], quality:-1 } + imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => { + console.info('TC_062-9 success'); + expect(data == undefined).assertTrue(); + done(); + }) + } + } + }catch(error){ + console.info('TC_062-9 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_063 + * @tc.name : release ImagePacker - promise + * @tc.desc : 1.create ImagePacker + * 2.call release + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_063', 0, async function (done) { + const imagePackerApi = image.createImagePacker(); + if (imagePackerApi == undefined) { + console.info('TC_063 create image packer failed'); + expect(false).assertTrue(); + done(); + } else { + imagePackerApi.release().then(()=>{ + console.info('TC_063 success'); + expect(true).assertTrue(); + done(); + }).catch(()=>{ + console.log('TC_063 error: ' + error); + expect(false).assertTrue(); + done(); + }) + } + }) + + /** + * @tc.number : TC_063-1 + * @tc.name : release ImagePacker - callback + * @tc.desc : 1.create ImagePacker + * 2.call release + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_063-1', 0, async function (done) { + const imagePackerApi = image.createImagePacker(); + if (imagePackerApi == undefined) { + console.info('TC_063-1 create image packer failed'); + expect(false).assertTrue(); + done(); + } else { + imagePackerApi.release(()=>{ + console.info('TC_063-1 success'); + expect(true).assertTrue(); + done(); + }) + } + }) + + + /** + * @tc.number : TC_050 + * @tc.name : createPixelMap(decodingOptions)-pixelformat:RGBA_8888-jpg + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_050', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_050 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:3, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + console.info('TC_050 success '); + expect(pixelmap != undefined ).assertTrue(); + done(); + }) + } + }catch(error){ + console.info('TC_050 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + /** + * @tc.number : TC_050-1 + * @tc.name : createPixelMap(decodingOptions)-pixelformat:RGB_565-jpg + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_050-1', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_050-1 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + console.info('TC_050-1 success '); + expect(pixelmap != undefined ).assertTrue(); + done(); + }) + } + }catch(error){ + console.info('TC_050-1 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + /** + * @tc.number : TC_050-2 + * @tc.name : createPixelMap(decodingOptions)-pixelformat:unknown-jpg + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return null + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_050-2', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_050-2 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:0, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + console.info('TC_050-2 success '); + expect(pixelmap != undefined ).assertTrue(); + done(); + }) + } + }catch(error){ + console.info('TC_050-2 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + /** + * @tc.number : TC_050-3 + * @tc.name : createPixelMap(decodingOptions: index 1})-jpg + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_050-3', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_050-3 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:0, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:1 + }; + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_050-3 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }catch(error){ + console.info('TC_050-3 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_050-4 + * @tc.name : createPixelMap(decodingOptions:index -1})-jpg + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_050-4', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_050-4 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:0, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:-1 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.error('TC_050-4 success'); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }catch(error){ + console.info('TC_050-4 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_050-5 + * @tc.name : createPixelMap(decodingOptions:sampleSize -1})-jpg + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_050-5', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_050-5 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:-1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:0, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_050-5 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }catch(error){ + console.info('TC_050-5 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_050-6 + * @tc.name : createPixelMap(decodingOptions:rotate -10})-jpg + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_050-6', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_050-6 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:-10, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_050-6 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }catch(error){ + console.info('TC_050-6 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_050-7 + * @tc.name : createPixelMap(decodingOptions:unsupported pixelformat)-jpg + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_050-7', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_050-7 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:60, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_050-7 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }catch(error){ + console.info('TC_050-7 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_050-8 + * @tc.name : createPixelMap(decodingOptions:editable false})-jpg + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_050-8', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_050-8 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: false, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + console.info('TC_050-8 success'); + expect(pixelmap != undefined ).assertTrue(); + done(); + }) + } + }catch(error){ + console.info('TC_050-8 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_050-9 + * @tc.name : createPixelMap(decodingOptions:desiredSize>imagesize)-jpg + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_050-9', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_050-9 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:10000, height:10000}, + rotate:10, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + console.info('TC_050-9 success '); + expect(pixelmap != undefined ).assertTrue(); + done(); + }) + } + }catch(error){ + console.info('TC_050-9 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_050-10 + * @tc.name : createPixelMap(decodingOptions:desiredRegion>imagesize)-jpg + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_050-10', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_050-10 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:2, + desiredRegion: { size: { height: 10000, width: 10000 }, x: 0, y: 0 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_050-10 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }catch(error){ + console.info('TC_050-10 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_050-11 + * @tc.name : createPixelMapdecodingOptions:x -1 y -1)-jpg + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_050-11', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_050-11 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: -1, y: -1 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_050-11 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }catch(error){ + console.info('TC_050-11 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_050-12 + * @tc.name : createPixelMap(decodingOptions:x > image.height y > image.width)-jpg + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_050-12', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_050-12 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: 10000, y: 10000 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_050-12 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }catch(error){ + console.info('TC_050-12 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_050-13 + * @tc.name : createPixelMap(decodingOptions:rotate>360)-jpg + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_050-13', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_050-13 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:500, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: 1, y: 2 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_050-13 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }catch(error){ + console.info('TC_050-13 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_050-14 + * @tc.name : createPixelMap-promise-jpg + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_050-14', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_050-14 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.createPixelMap().then(pixelmap => { + console.info('TC_050-14 success '); + expect(pixelmap != undefined ).assertTrue(); + done(); + }).catch(error => { + console.log('TC_050-14 error: ' + error); + expect().assertFail(); + done(); + }) + } + }catch(error){ + console.info('TC_050-14 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_050-15 + * @tc.name : createPixelMap-callback-jpg + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return null + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_050-15', 0, async function (done) { + try{ + let fdNumber = fileio.openSync(pathJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_050-15 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.createPixelMap((err, pixelmap) => { + console.info('TC_050-15 success '); + expect(pixelmap != undefined ).assertTrue(); + done(); + }) + } + }catch(error){ + console.info('TC_050-15 error: ' + error); + expect(false).assertTrue(); + done(); + } + }) + + /** + * @tc.number : TC_067 + * @tc.name : createPixelMap(decodingOptions)-pixelformat:RGBA_8888-gif + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_067', 0, async function (done) { + let fdNumber = fileio.openSync(pathMovingGif); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_067 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:3, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions, (err,pixelmap) => { + console.info('TC_067 createPixelMap '); + expect(pixelmap != undefined ).assertTrue(); + done(); + }) + } + }) + /** + * @tc.number : TC_067-1 + * @tc.name : createPixelMap(decodingOptions)-pixelformat:RGBA_565-gif + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return null + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_067-1', 0, async function (done) { + let fdNumber = fileio.openSync(pathMovingGif); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_067-1 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions, (err,pixelmap) => { + console.info('TC_067-1 success '); + expect(pixelmap != undefined ).assertTrue(); + done(); + }) + } + }) + /** + * @tc.number : TC_067-2 + * @tc.name : createPixelMap(decodingOptions)-pixelformat:unkonwn-gif + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_067-2', 0, async function (done) { + let fdNumber = fileio.openSync(pathMovingGif); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_067-2 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:0, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions, (err,pixelmap) => { + console.info('TC_067-2 success '); + expect(pixelmap != undefined ).assertTrue(); + done(); + }) + } + }) + /** + * @tc.number : TC_067-3 + * @tc.name : createPixelMap(decodingOptions:index 1})-gif + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return null + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_067-3', 0, async function (done) { + let fdNumber = fileio.openSync(pathMovingGif); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_067-3 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:0, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:1 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + console.info('TC_067-3 success '); + expect(pixelmap != undefined ).assertTrue(); + done(); + }) + } + }) + + /** + * @tc.number : TC_067-4 + * @tc.name : createPixelMap(decodingOptions:index -1})-gif + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return null + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_067-4', 0, async function (done) { + let fdNumber = fileio.openSync(pathMovingGif); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_067-4 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:0, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:-1 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_067-4 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_067-5 + * @tc.name : createPixelMap(decodingOptions:sampleSize -1})-gif + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_067-5', 0, async function (done) { + let fdNumber = fileio.openSync(pathMovingGif); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_067-5 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:-1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:0, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_067-5 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_067-6 + * @tc.name : createPixelMap(decodingOptions:rotate -10})-gif + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_067-6', 0, async function (done) { + let fdNumber = fileio.openSync(pathMovingGif); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_067-6 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:-10, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_067-6 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_067-7 + * @tc.name : createPixelMap(decodingOptions:unsupported pixelformat)-gif + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_067-7', 0, async function (done) { + let fdNumber = fileio.openSync(pathMovingGif); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_067-7 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:60, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_067-7 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }) + /** + * @tc.number : TC_067-8 + * @tc.name : createPixelMap(decodingOptions:editable false})-gif + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_067-8', 0, async function (done) { + let fdNumber = fileio.openSync(pathMovingGif); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_067-8 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: false, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + console.info('TC_067-8 success'); + expect(pixelmap != undefined ).assertTrue(); + done(); + }) + } + }) + + /** + * @tc.number : TC_067-9 + * @tc.name : createPixelMap(decodingOptions:desiredSize>imagesize)-gif + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_067-9', 0, async function (done) { + let fdNumber = fileio.openSync(pathMovingGif); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_067-9 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:10000, height:10000}, + rotate:10, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + console.info('TC_067-9 success '); + expect(pixelmap != undefined ).assertTrue(); + done(); + }) + } + }) + + /** + * @tc.number : TC_067-10 + * @tc.name : createPixelMap(decodingOptions:desiredRegion>imagesize)-gif + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_067-10', 0, async function (done) { + let fdNumber = fileio.openSync(pathMovingGif); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info(' TC_067-10 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:2, + desiredRegion: { size: { height: 10000, width: 10000 }, x: 0, y: 0 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_067-10 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_067-11 + * @tc.name : createPixelMapdecodingOptions:x -1 y -1)-gif + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_067-11', 0, async function (done) { + let fdNumber = fileio.openSync(pathMovingGif); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_067-11 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: -1, y: -1 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_067-11 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_067-12 + * @tc.name : createPixelMap(decodingOptions:x > image.height y > image.width)-gif + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_067-12', 0, async function (done) { + let fdNumber = fileio.openSync(pathMovingGif); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_067-12 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: 10000, y: 10000 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_067-12 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_067-13 + * @tc.name : createPixelMap(decodingOptions:rotate>360)-gif + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_067-13', 0, async function (done) { + let fdNumber = fileio.openSync(pathMovingGif); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_067-13 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:500, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: 1, y: 2 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_067-13 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_067-14 + * @tc.name : createPixelMap-promise-gif + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_067-14', 0, async function (done) { + let fdNumber = fileio.openSync(pathMovingGif); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_067-14 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.createPixelMap().then(pixelmap => { + console.info('TC_067-14 success '); + expect(pixelmap !== undefined ).assertTrue(); + done(); + }).catch(error => { + console.log('TC_067-14 error: ' + error); + expect().assertFail(); + done(); + }) + } + }) + + /** + * @tc.number : TC_067-15 + * @tc.name : createPixelMap-pcallback-gif + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return null + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_067-15', 0, async function (done) { + let fdNumber = fileio.openSync(pathMovingGif); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_067-15 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.createPixelMap((err, pixelmap) => { + console.info('TC_067-15 success '); + expect(pixelmap !== undefined ).assertTrue(); + done(); + }) + } + }) + + + /** + * @tc.number : TC_068 + * @tc.name : createPixelMap(decodingOptions)-pixelformat:RGBA_8888-bmp + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_068', 0, async function (done) { + let fdNumber = fileio.openSync(pathBmp); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_068 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:3, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + console.info('TC_068 success '); + expect(pixelmap != undefined ).assertTrue(); + done(); + }) + } + }) + /** + * @tc.number : TC_068-1 + * @tc.name : createPixelMap(decodingOptions)-pixelformat:RGB_565-bmp + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_068-1', 0, async function (done) { + let fdNumber = fileio.openSync(pathBmp); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_068-1 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + console.info('TC_068-1 success '); + expect(pixelmap != undefined ).assertTrue(); + done(); + }) + } + }) + + /** + * @tc.number : TC_068-2 + * @tc.name : createPixelMap(decodingOptions)-pixelformat:unkonwn-bmp + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_068-2', 0, async function (done) { + let fdNumber = fileio.openSync(pathBmp); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_068-2 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:0, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + console.info('TC_068-2 success '); + expect(pixelmap != undefined ).assertTrue(); + done(); + }) + } + }) + + /** + * @tc.number : TC_068-3 + * @tc.name : createPixelMap(decodingOptions: index 1})-bmp + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_068-3', 0, async function (done) { + let fdNumber = fileio.openSync(pathBmp); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_068-3 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:0, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:1 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_068-3 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_068-4 + * @tc.name : createPixelMap(decodingOptions:index -1})-bmp + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_068-4', 0, async function (done) { + let fdNumber = fileio.openSync(pathBmp); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_068-4 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:0, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:-1 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_068-4 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_068-5 + * @tc.name : createPixelMap(decodingOptions:sampleSize -1})-bmp + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_068-5', 0, async function (done) { + let fdNumber = fileio.openSync(pathBmp); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_068-5 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:-1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:0, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_068-5 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_068-6 + * @tc.name : createPixelMap(decodingOptions:rotate -10})-bmp + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_068-6', 0, async function (done) { + let fdNumber = fileio.openSync(pathBmp); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_068-6 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:-10, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_068-6 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_068-7 + * @tc.name : createPixelMap(decodingOptions:unsupported pixelformat)-bmp + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_068-7', 0, async function (done) { + let fdNumber = fileio.openSync(pathBmp); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_068-7 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:60, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_068-7 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_068-8 + * @tc.name : createPixelMap(decodingOptions:editable false})-bmp + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_068-8', 0, async function (done) { + let fdNumber = fileio.openSync(pathBmp); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_068-8 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: false, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + console.info('TC_068-8 success'); + expect(pixelmap != undefined ).assertTrue(); + done(); + }) + } + }) + + /** + * @tc.number : TC_068-9 + * @tc.name : createPixelMap(decodingOptions:desiredSize>imagesize)-bmp + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_068-9', 0, async function (done) { + let fdNumber = fileio.openSync(pathBmp); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_068-9 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:10000, height:10000}, + rotate:10, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + console.info('TC_068-9 success '); + expect(pixelmap != undefined ).assertTrue(); + done(); + }) + } + }) + + /** + * @tc.number : TC_068-10 + * @tc.name : createPixelMap(decodingOptions:desiredRegion>imagesize)-bmp + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_068-10', 0, async function (done) { + let fdNumber = fileio.openSync(pathBmp); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info(' TC_068-10 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:2, + desiredRegion: { size: { height: 10000, width: 10000 }, x: 0, y: 0 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_068-10 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_068-11 + * @tc.name : createPixelMapdecodingOptions:x -1 y -1)-bmp + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_068-11', 0, async function (done) { + let fdNumber = fileio.openSync(pathBmp); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_068-11 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: -1, y: -1 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_068-11 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_068-12 + * @tc.name : createPixelMap(decodingOptions:x > image.height y > image.width)-bmp + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_068-12', 0, async function (done) { + let fdNumber = fileio.openSync(pathBmp); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_068-12 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: 10000, y: 10000 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_068-12 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }) + /** + * @tc.number : TC_068-13 + * @tc.name : createPixelMap(decodingOptions:rotate>360)-jpg + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_068-13', 0, async function (done) { + let fdNumber = fileio.openSync(pathBmp); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_068-13 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:500, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: 1, y: 2 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_068-13 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_163 + * @tc.name : createPixelMap(decodingOptions)-pixelformat:RGBA_8888-png + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_163', 0, async function (done) { + let fdNumber = fileio.openSync(pathPng); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_163 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:3, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + console.info('TC_163 success'); + expect(pixelmap != undefined ).assertTrue(); + done(); + }) + } + }) + /** + * @tc.number : TC_163-1 + * @tc.name : createPixelMap(decodingOptions)-pixelformat:RGB_565-png + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_163-1', 0, async function (done) { + let fdNumber = fileio.openSync(pathPng); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_163-1 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + console.info('TC_163-1 success'); + expect(pixelmap != undefined ).assertTrue(); + done(); + }) + } + }) + /** + * @tc.number : TC_163-2 + * @tc.name : createPixelMap(decodingOptions)-pixelformat:unkonwn-png + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_163-2', 0, async function (done) { + let fdNumber = fileio.openSync(pathPng); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_163-2 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:0, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + console.info('TC_163-2 success'); + expect(pixelmap != undefined ).assertTrue(); + done(); + }) + } + }) + /** + * @tc.number : TC_163-3 + * @tc.name : createPixelMap(decodingOptions: index 1})-png + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_163-3', 0, async function (done) { + let fdNumber = fileio.openSync(pathPng); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_163-3 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:0, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:1 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_163-3 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_163-4 + * @tc.name : createPixelMap(decodingOptions:index -1})-png + * @tc.desc : 1.create imagesource + * 2.set decodingOptions + * 3.call createPixelMap + * 4.set index=-1,options + * 5.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_163-4', 0, async function (done) { + let fdNumber = fileio.openSync(pathPng); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_163-4 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:0, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:-1 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_163-4 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_163-5 + * @tc.name : createPixelMap(decodingOptions:sampleSize -1})-png + * @tc.desc : 1.create imagesource + * 2.set decodingOptions + * 3.call createPixelMap + * 4.set index=-1,options + * 5.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_163-5', 0, async function (done) { + let fdNumber = fileio.openSync(pathPng); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_163-5 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:-1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:0, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_163-5 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_163-6 + * @tc.name : createPixelMap(decodingOptions:rotate -10})-png + * @tc.desc : 1.create imagesource + * 2.set decodingOptions + * 3.call createPixelMap + * 4.set index=-1,options + * 5.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_163-6', 0, async function (done) { + let fdNumber = fileio.openSync(pathPng); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_163-6 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:-10, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_163-6 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_163-7 + * @tc.name : createPixelMap(decodingOptions:unsupported pixelformat)-png + * @tc.desc : 1.create imagesource + * 2.set decodingOptions + * 3.call createPixelMap + * 4.set index=-1,options + * 5.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_163-7', 0, async function (done) { + let fdNumber = fileio.openSync(pathPng); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_163-7 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:60, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_163-7 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_163-8 + * @tc.name : createPixelMap(decodingOptions:editable false})-png + * @tc.desc : 1.create imagesource + * 2.set decodingOptions + * 3.call createPixelMap + * 4.set index=-1,options + * 5.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_163-8', 0, async function (done) { + let fdNumber = fileio.openSync(pathPng); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_163-8 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: false, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + console.info('TC_163-8 success'); + expect(pixelmap != undefined ).assertTrue(); + done(); + }) + } + }) + + /** + * @tc.number : TC_163-9 + * @tc.name : createPixelMap(decodingOptions:desiredSize>imagesize)-png + * @tc.desc : 1.create imagesource + * 2.set decodingOptions + * 3.call createPixelMap + * 4.set index=-1,options + * 5.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + + it('TC_163-9', 0, async function (done) { + let fdNumber = fileio.openSync(pathPng); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_163-9 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:500, height:500}, + rotate:10, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + console.info('TC_163-9 success'); + expect(pixelmap != undefined ).assertTrue(); + done(); + }) + } + }) + + /** + * @tc.number : TC_163-10 + * @tc.name : createPixelMap(decodingOptions:desiredRegion>imagesize)-png + * @tc.desc : 1.create imagesource + * 2.set decodingOptions + * 3.call createPixelMap + * 4.set index=-1,options + * 5.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_163-10', 0, async function (done) { + let fdNumber = fileio.openSync(pathPng); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info(' TC_163-10 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:2, + desiredRegion: { size: { height: 10000, width: 10000 }, x: 0, y: 0 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_163-10 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_163-11 + * @tc.name : createPixelMapdecodingOptions:x -1 y -1)-png + * @tc.desc : 1.create imagesource + * 2.set decodingOptions + * 3.call createPixelMap + * 4.set index=-1,options + * 5.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_163-11', 0, async function (done) { + let fdNumber = fileio.openSync(pathPng); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_163-11 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: -1, y: -1 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_163-11 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_163-12 + * @tc.name : createPixelMap(decodingOptions:x > image.height y > image.width)-png + * @tc.desc : 1.create imagesource + * 2.set decodingOptions + * 3.call createPixelMap + * 4.set index=-1,options + * 5.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_163-12', 0, async function (done) { + let fdNumber = fileio.openSync(pathPng); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_163-12 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: 10000, y: 10000 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_163-12 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }) + /** + * @tc.number : TC_163-13 + * @tc.name : createPixelMap(decodingOptions:rotate>360)-png + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_163-13', 0, async function (done) { + let fdNumber = fileio.openSync(pathPng); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_163-13 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:500, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: 1, y: 2 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_163-13 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_167 + * @tc.name : createPixelMap-unsupported image format + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_167', 0, async function (done) { + let fdNumber = fileio.openSync(pathTiff); + const imageSourceApi = image.createImageSource(fdNumber); + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:3, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + console.info('TC_167 success '); + expect(pixelmap == undefined ).assertTrue(); + done(); + }) + }) + + /** + * @tc.number : TC_169 + * @tc.name : Decode the image to generate a bitmap + * @tc.desc : 1.create imagesource + * 2.create pixelmap + * 3.call getimageinfo + * 4.Judging the length and width are opposite to the original + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_169', 0, async function (done) { + let fdNumber = fileio.openSync(pathJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_169 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:90, + desiredPixelFormat:3, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + pixelmap.getImageInfo( (err,imageInfo) => { + if (imageInfo != undefined) { + console.info('TC_169 success'); + expect(imageInfo.size.height == 2).assertTrue(); + expect(imageInfo.size.width == 1).assertTrue(); + done(); + }else { + console.info('TC_169 imageInfo is empty'); + expect(false).assertTrue() + done(); + } + }) + }) + } + }) +}) diff --git a/multimedia/image/image_js_standard/imageDecodeOptions/src/main/resources/base/element/string.json b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/resources/base/element/string.json new file mode 100644 index 000000000..22af6ba2c --- /dev/null +++ b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "ImageJSTestMain" + }, + { + "name": "mainability_description", + "value": "ImageJSTestMain Ability" + } + ] +} \ No newline at end of file diff --git a/multimedia/image/image_js_standard/imageDecodeOptions/src/main/resources/base/media/icon.png b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c GIT binary patch literal 6790 zcmX|G1ymHk)?T_}Vd;>R?p|tHQo6fg38|$UVM!6BLrPFWk?s;$LOP{GmJpBl$qoSA!PUg~PA65-S00{{S`XKG6NkG0RgjEntPrmV+?0|00mu7;+5 zrdpa{2QLqPJ4Y{j7=Mrl{BaxrkdY69+c~(w{Fv-v&aR%aEI&JYSeRTLWm!zbv;?)_ ziZB;fwGbbeL5Q}YLx`J$lp~A09KK8t_z}PZ=4ZzgdeKtgoc+o5EvN9A1K1_<>M?MBqb#!ASf&# zEX?<)!RH(7>1P+j=jqG(58}TVN-$psA6K}atCuI!KTJD&FMmH-78ZejBm)0qc{ESp z|LuG1{QnBUJRg_E=h1#XMWt2%fcoN@l7eAS!Es?Q+;XsRNPhiiE=@AqlLkJzF`O18 zbsbSmKN=aaq8k3NFYZfDWpKmM!coBU0(XnL8R{4=i|wi{!uWYM2je{U{B*K2PVdu&=E zTq*-XsEsJ$u5H4g6DIm2Y!DN`>^v|AqlwuCD;w45K0@eqauiqWf7l&o)+YLHm~|L~ z7$0v5mkobriU!H<@mVJHLlmQqzQ3d6Rh_-|%Yy2li*tHO>_vcnuZ7OR_xkAIuIU&x z-|8Y0wj|6|a6_I(v91y%k_kNw6pnkNdxjqG8!%Vz_d%c_!X+6-;1`GC9_FpjoHev5fEV7RhJ>r=mh-jp$fqbqRJ=obwdgLDVP5+s zy1=_DWG0Y-Jb3t^WXmkr(d9~08k-|#Ly zaNOmT(^9tIb&eb4%CzIT zAm3CUtWSr1t4?h1kk#NBi{U|pJslvME{q|_eS^3En>SOqSxyuN1x;Is@8~m?*>}** znrRFArP!K_52RpX*&JHMR<^lVdm8ypJ}0R(SD(51j;6@ni$6bQ+2XL+R^|NnSp5}(kzvMZ^(@4fD_{QVu$(&K6H|C37TG1Am9Re{<<3gd zh@`>;BqkXMW&p0T6rt|iB$)~CvFe(XC)F9WgAZn*0@t$oZo;!*}r@_`h?KKH&6A@3= zISXoQB+~`op>NP-buiA*^0n{@i{_?MRG)&k)c)k_F+-2Lud!S9pc+i`s74NpBCaGF zXN+pHkubw*msGBTY27BKHv)RRh3;nMg4&$fD_6X9Vt~;_4D+5XPH~#Kn-yjcy!$}1 zigv#FNY>TqMhtIBb@UoF!cE~Q8~;!Pek>SQQwHnHuWKoVBosAiOr}q>!>aE*Krc)V zBUMEcJ5NU0g8}-h6i1zpMY9>m4ne?=U2~`w7K7Q0gB_=p@$5K7p6}thw z-~3dMj?YNX2X$lZ+7ngQ$=s}3mizNN@kE%OtB)?c&i~2L55z8^=yz;xMHLmlY>&Q# zJj?!)M#q_SyfkQh)k?j8IfLtB)ZCp|*vf4_B zos?73yd^h-Ac+;?E4*bpf=o*^3x3-`TVjbY4n6!EN10K6o@fxdyps05Vo3PU)otB} z`3kR+2w7_C#8Z!q`J)p{Vh!+m9-UP!$STp+Hb}}#@#_u^SsUQg<}59< zTvH3%XS4G+6FF^(m6bVF&nSUIXcl;nw{=H$%fgeJ>CgDYiLdpDXr{;-AnG z8dvcrHYVMI&`R6;GWekI@Ir3!uo)oz4^{6q0m^}@f2tM9&=YHNi6-?rh0-{+k@cQm zdp`g#YdQn%MDVg2GR>wZ`n2<0l4)9nx1Wfr&!Dvz=bPwU!h2S?ez6MVc5APE4-xLB zi&W9Q8k2@0w!C53g?iAIQ}~p*3O(@zja6KQ=M3zfW*_6o5SwR-)6VBh~m7{^-=MC-owYH5-u40a}a0liho3QZZ5L{bS_xM1)4}19)zTU$$MY zq3eZML1WC{K%YFd`Be0M-rkO^l?h{kM{$2oK1*A@HVJ57*yhDkUF!2WZ&oA4Y-sK( zCY69%#`mBCi6>6uw(x4gbFaP0+FD*JKJ-q!F1E?vLJ+d35!I5d7@^eU?(CS|C^tmI5?lv@s{{*|1F zFg|OzNpZ0hxljdjaW%45O0MOttRrd(Z?h{HYbB-KFUx&9GfFL3b8NwZ$zNu)WbBD` zYkj$^UB5%3Pj1MDr>S2Ejr9pUcgA!;ZG!@{uAy12)vG=*^9-|dNQBc8&`oxBlU~#y zs!anJX&T?57Jdr^sb>e+V`MVfY>Y0ESg7MG<7W0g&bR-ZYzzZ%2H&Etcp zcd6QeXO1D!5A#zM0lx*GH}`M)2~ZFLE;sP^RSB5wVMNfiZXPd(cmO>j=OSA3`o5r& zna(|^jGXbdN7PK)U8b7^zYtYkkeb%<%F~=OqB~kXMQkq}ii|skh@WSRt>5za;cjP0 zZ~nD%6)wzedqE}BMLt~qKwlvTr33))#uP~xyw#*Eaa|DbMQ_%mG0U8numf8)0DX`r zRoG2bM;#g|p-8gWnwRV5SCW0tLjLO&9Z?K>FImeIxlGUgo0Zk`9Qzhj1eco~7XZy+hXc@YF&ZQ=? zn*^1O56yK^x{y}q`j7}blGCx%dydV!c7)g~tJzmHhV=W~jbWRRR{1<^oDK+1clprm zz$eCy7y9+?{E|YgkW~}}iB#I4XoJ*xr8R?i_Hv$=Cof5bo-Nj~f`-DLebH}&0% zfQj9@WGd4;N~Y?mzQsHJTJq6!Qzl^-vwol(+fMt#Pl=Wh#lI5Vmu@QM0=_r+1wHt` z+8WZ~c2}KQQ+q)~2Ki77QvV&`xb|xVcTms99&cD$Zz4+-^R4kvUBxG8gDk7Y`K*)JZ^2rL(+ZWV~%W(@6 z)0bPArG#BROa_PHs~&WplQ_UIrpd)1N1QGPfv!J(Z9jNT#i%H?CE6|pPZb9hJ1JW4 z^q;ft#!HRNV0YgPojzIYT`8LuET2rUe-J|c!9l4`^*;4WtY@Ew@pL>wkjmMgGfN7 ze}}GtmU0@<_#08~I-Suk=^*9GLW=H4xhsml;vAV{%hy5Eegl@!6qKqbG024%n2HHw zCc@ivW_$@5ZoHP70(7D+(`PvgjW1Pd`wsiuv-aCukMrafwDm)B!xXVy*j2opohhoU zcJz%ADmj>i3`-3-$7nQKBQQuGY;2Qt&+(L~C>vSGFj5{Mlv?T_^dql;{zkpe4R1}R z%XfZyQ}wr*sr>jrKgm*PWLjuVc%6&&`Kbf1SuFpHPN&>W)$GmqC;pIoBC`=4-hPY8 zT*>%I2fP}vGW;R=^!1be?ta2UQd2>alOFFbVl;(SQJ4Jk#)4Z0^wpWEVvY4=vyDk@ zqlModi@iVPMC+{?rm=4(n+<;|lmUO@UKYA>EPTS~AndtK^Wy^%#3<;(dQdk3WaUkRtzSMC9}7x2||CNpF#(3T4C)@ z$~RWs`BNABKX|{cmBt>Q=&gkXl&x!!NK_%5hW0LS)Z4PB>%sV?F-{Wyj#s7W%$F{D zXdK^Fp3wvy+48+GP6F_|^PCRx=ddcTO3sG;B23A49~Qaw31SZ0Rc~`r4qqt%#OGW{ zCA_(LG5^N>yzUn&kAgVmxb=EA8s&tBXC}S1CZ(KoW)(%^JjLTPo^fs`Va;`=YlVPgmB$!yB}<(4ym6OeZ3xAJJ#;)2+B%p3P1Wt+d$eo`vz`T zXfUP2))kBDPoscH;Jc7I3NU<({|@wM$&GaDt`n7WLgIY3IA7A6-_R?z8N3mz|}*i z(zl5ot--Oq@f2-nv{X(ujT2T(k1vY_qh93pK@>H-qc%2Xta)IP0Q%zt%bqYgI`o!wv!0QerB`nCN^1n|@$sVOQ!V0teVG!I z_fD%JvfDeT1cK#-{o6Gv7}& zY0#NWin~kVaf$aufV&;63Hbs|`QVZWpDX6IMk1Hj2G}fiH9e-^6u2zf^FIr^BwD<6zjw63+{yUe8PUFvk8v{sJ=R{d#`O!sz`Q13~< zPT$JS(w=yQfU2`zPCNfSw=&zup@DXc(98afjhv@1w_f!m2Z>rMJ19AB&dB%P#Ls3b z=lK7OILM+SQ&VEd=1GN6o&>YVVtIzoZ%=Z_SdqJN2}E43{bE`>w+A;=y->@^k{oCC z$F*WTY&?34;kfyFV?b*Xb1Pq`Z=%OgwEg)Rz)tx=`f%5#w_INP=x&z5!jI;#;N$ma zhO)+MDm;SxOEVL15; zGq(v2pL3&P1Sl)8P*;G-fd{l1QJsv@e@d8)1PK4w2m*M%V3j-V~L^$i|&C@b?D?9tfwE{B^}Z$k8e5FmQ>v7Xz)sG32g9t}YBt zyR$+*_00RmPx+0mW+vVG4mxd(n$(eQf3-w>JPl2UJpafrPaL5@2j}%{VE-) zBI%6Qpj*dsdH<;g!S!avA~bv^0E+ zfyJbSjPb+j;J52U)<|cIcntQBI2T#>2;tOxu{%D?kML476AErF(qN9hPva5Nkc@BF zC-tLF@3ZFb%Kpj)M<{)x*l|*Ia@ECeXo2E4h2f!aV=cHAhi_E_mfUth(sM4^hJq7B zQsGWqdZUm9S%F`$nQ*_#NcuD`&)Ek%_s{&^78{9Hm ztri&rYLOxgFdG>O@+XHy z9#;|&vBCPXH5Mon^I`jSuR$&~ZWtyB67ujzFSj!51>#C}C17~TffQ{c-!QFQkTQ%! zIR^b1`zHx|*1GU?tbBx23weFLz5H?y_Q%N&t$}k?w+``2A=aotj0;2v$~AL z{scF-cL{wsdrmPvf#a9OHyYLcwQD4Kcm)`LLwMh4WT~p29f7M!iafJSU`IV}QY5Wa z(n44-9oA}?J{a+ah*@31WTs#&J#o1`H98#6IQf;Wv0N_!);f&9g7o-k(lW5rWnDUR zQBFIRG+X=6NnsI@mxnwm;tf5;_Uxg?jZ8m-m0}&6+DA!qam(p$mN5R})yA_7m$q@| zFEd|dpS595rxQr-n#GjI5i-AhnUE>Cr;jpCqSrD~EwK_DqI^7%3#p5)%T_od!t3SOmH9MyXeeGO2(UQL;ax|x?Ncixmeo1=$ z{-);Au{*tfzOG?KQ~K|ak8-HQ?`Pekhe2WM(8s{xv-p>Zmu_6{G!-oE$7$mY`MOJorI=+mMx?H;`pr!;fVYz?5~yXBACruWB`Ph zZM}90_<^OBxIhyZ9BW$`>6JvO;%VFpqVr8|7t3~AmxYak6?`Pp#c;**_SYmi`&z23 z`p6_~ePvH)C6x-G9$hgL=eVALq`-AiamN>!3~Lxw&{H(b{B(7xSRm6<3<{%{yXiH# zos5Rv1L+8fUKJLo%P>4I&$}y/data/app/el2/100/base/ohos.acts.multimedia.image.Exif/files" + ] + }, + + { + "type": "ShellKit", + "run-command": [ + "chmod 777 /data/app/el2/100/base/ohos.acts.multimedia.image.Exif/files/test_exif.jpg" + ], + "teardown-command":[ + + ] + }, + + { + "test-file-name": [ + "ActsImageExifJsTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] + +} diff --git a/multimedia/image/image_js_standard/imageExif/signature/openharmony_sx.p7b b/multimedia/image/image_js_standard/imageExif/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..d9fe0c1edd5ef09a357ed0bf05ed915a72278cca GIT binary patch literal 3445 zcmcgvYg7|w8YUN@h!HF*>Z)M0V#VM$A%TQi>r67a$s{BuKxh;v$>ajbOh_h7h}E)j zWkp5nda7)_q2R4myT?nBJ*T$YZgsV*uC2@NX~nK}*{-fzx2v{pJ+eCkRKcS^_VgU{ zBXi!%H{Ubw`@GM0K9CUArKHVj(lvc2;-&K25+Wx^h!*pCJV*r6Q__|+>3D=d$mfAX z^5}<&ytYI#UziZ~Efv=j;fS9iB`(TMh)bZ^4;&;OWF2Ct02Bc6Y;iQ|ceAD(NQ<3H zB_WY}*gsj3+$~YcfkJ{S2>=z!JRSm4u-SA&h+7;c0t6l*SO*>oN!x1Vkhmn;>N6fJQQ9xBWslPhJ4BDqwqnBDKkJv0$!-9-we zthkVMFPklPMoD*okoZXt#VvOe^+bRQ5n)L`bW?~Rb$B>PkqzuV!@#(RFzxsFT{z95 zmT*4=)#{D8D%4`tYxFAEiuQXQB&OG^u((PEI|(n$=n>efM{$#CPFxLRh}T=^tF1AW znaygLvB8)Yi>czU0r48k5!h~pYmFxM4Hh$ldhP0Rvv~o^&}A-dd32#x)8MR7MhPog zg&{624B1ds3^Q8`k$|(-=W_+2dM8=yE!UR&9Hi5V)?g~MKMRgw_@i0oN`!H012y(a zOUNmedCdT2bUv36t3es825w+6SoJZJ6^m7{UZc7;hSgxP2fiAF!pspyW$wqQMHz$I zT7%j!L_dJbhm|_WNA`?qt#IYQcSfuzs${AvOnOgTu)o#u&F=WtUzFo0!3g2u{qgAQuv)++;VfuW?ay7$prcLtGp2&2f-45nm@q!5q- zDI{f|@~Ui+ObJN~p+OUbek2G03I;&rJqbivnDY1oM6P8(vw`}sT!Z9D?*WTS5H(osd`jMaANWTAVwTNdK-ZOze z33&KW(t&k{(h|;wL%QjsksGfOUA~mV&u+_PH1qD?*wxzkC9>Xq$#dt*-rHANQi_)J zy}6BD($-WH|DtbX34CMvqSEB4tADen(F883|FU{Uk7eTfJk`Ey(~q>vGh_SvBFlUK znsJ2XkDBGr=|TQvTv4nUjs^IBWb0;v83V1$c~a{v6h%KmB1i@)hLEV=e2PfwLFPm9 zB<`%2N}CBSWO2kv1_JgmoJqWtAxz3H$=vzYgjaf#Ob0Hs<{fUWVn&@E-aUag z3Ap)ysbcb=v)?iM=55~AU3qln)H}$dDa89P4oC77yEjCPAbFv5D33Vv=_uk8C^U8Z*Qd6?zr_Sy+UxO=1M*T;)HmWL{vPc8pR=y3g>cYbdH6-PhYJhQ0m zSm)axY?-)q_pRpU%v%>)r#9bxb;;5EoV(XgUs?CP#MbTt_%LyLEJywijy+b~hMh11 zUlJhrAb4r9V#P1%o3H-rZi%mY|EZ$wS5IV~>dv~l%#&&A)!DviZk*uj)c^b9_0F-M zT<;#uiq*+yC}w|2c&DXvhUDI{$^##5+LZZ0;Dw%XiAncYT{gCad)MJtLw35wdq%e7 zh0hA01P@_JHjlj@fZC_h#=#SH=vAc655_;Zilhl3Hul2>h6g4+Fw&Bt4E9iz0-00} ziVBMWR0ZZdj0z#KFt;`2ou^xQFr#Cw$TZ~-`PpT`Je6VoT#M_qvzK3=P_6+Z9-QQS zp$=&HQ>mRGlNV(OoszuvvL>>MRyQ#wAJuWN6)v{h9) bx>478EPvJ9ufm`It;*5<%DP;E@Q(C + + {{ $t('strings.hello') }} {{ title }} + + diff --git a/multimedia/image/image_js_standard/imageExif/src/main/js/default/pages/index/index.js b/multimedia/image/image_js_standard/imageExif/src/main/js/default/pages/index/index.js new file mode 100644 index 000000000..a0719cee5 --- /dev/null +++ b/multimedia/image/image_js_standard/imageExif/src/main/js/default/pages/index/index.js @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {Core, ExpectExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + core.init() + const configService = core.getDefaultService('config') + this.timeout = 60000 + configService.setConfig(this) + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/multimedia/image/image_js_standard/imageExif/src/main/js/test/List.test.js b/multimedia/image/image_js_standard/imageExif/src/main/js/test/List.test.js new file mode 100644 index 000000000..8a84d231e --- /dev/null +++ b/multimedia/image/image_js_standard/imageExif/src/main/js/test/List.test.js @@ -0,0 +1,16 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +require('./image.test.js') \ No newline at end of file diff --git a/multimedia/image/image_js_standard/imageExif/src/main/js/test/image.test.js b/multimedia/image/image_js_standard/imageExif/src/main/js/test/image.test.js new file mode 100644 index 000000000..15556e8dc --- /dev/null +++ b/multimedia/image/image_js_standard/imageExif/src/main/js/test/image.test.js @@ -0,0 +1,2066 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import image from '@ohos.multimedia.image' +import fileio from '@ohos.fileio' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' +import {tc_020buf, tc_020_1buf, tc_021buf, tc_021_1buf, tc_022buf} from './testImg' +import abilityAccessCtrl from '@ohos.abilityAccessCtrl' +import bundle from '@ohos.bundle' + +describe('Image', function () { + var pathExifJpg = '/data/storage/el2/base/files/test_exif.jpg'; + + beforeAll(async function () { + await applyPermission(); + console.info('beforeAll case'); + }) + + beforeEach(function () { + console.info('beforeEach case'); + }) + + afterEach(async function () { + console.info('afterEach case'); + }) + + afterAll(async function () { + console.info('afterAll case'); + }) + + async function applyPermission(){ + let appInfo = await bundle.getApplicationInfo('ohos.acts.multimedia.image.Exif',0,100); + let atManager = abilityAccessCtrl.createAtManager(); + if(atManager != null){ + let tokenID = appInfo.accessTokenId; + console.info('[permission]case accessTokenId is' + tokenID); + let permissionName1 = 'ohos.permission.MEDIA_LOCATION'; + let permissionName2 = 'ohos.permission.READ_MEDIA'; + let permissionName3 = 'ohos.permission.WRITE_MEDIA'; + await atManager.grantUserGrantedPermission(tokenID,permissionName1).then((result)=>{ + console.info('[permission]case grantUserGrantedPermission success:' + result); + }).catch((err)=>{ + console.info('[permission]case grantUserGrantedPermission failed:' + err); + }); + await atManager.grantUserGrantedPermission(tokenID,permissionName2).then((result)=>{ + console.info('[permission]case grantUserGrantedPermission success:' + result); + }).catch((err)=>{ + console.info('[permission]case grantUserGrantedPermission failed:' + err); + }); + await atManager.grantUserGrantedPermission(tokenID,permissionName3).then((result)=>{ + console.info('[permission]case grantUserGrantedPermission success:' + result); + }).catch((err)=>{ + console.info('[permission]case grantUserGrantedPermission failed:' + err); + }); + }else{ + console.info('[permission]case apply permission failed,createAtManager failed'); + } + } + + /** + * @tc.number : TC_001 + * @tc.name : create pixelmap-promise (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixeFormat,size + * 3.using color and opts create newPixelMap + * 4.return newpixelmap not empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('TC_001', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(Color, opts) + .then( pixelmap => { + expect(pixelmap != undefined).assertTrue(); + console.info('TC_001 success'); + done(); + }) + .catch(error => { + console.log('TC_001 error: ' + error); + expect().assertFail(); + done(); + }) + }) + + /** + * @tc.number : TC_001-1 + * @tc.name : create pixelmap-callback (editable: false, pixelFormat: RGBA_8888, size: { height: 4, width: 6 },bytes = buffer) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixelFormat,size + * 3.using colorand opts create newPixelMap + * 4.return newpixelmap not empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('TC_001-1', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: false, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(Color, opts, (err, pixelmap) => { + expect(pixelmap != undefined).assertTrue(); + console.info('TC_001-1 success'); + done(); + }) + }) + /** + * @tc.number : TC_001-2 + * @tc.name : createpixelmap-promise (editable: true, pixelFormat: RGB_565, size: { height: 6, width: 8 },bytes = buffer) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixelFormat,size + * 3.using colorand opts create newPixelMap + * 4.return newpixelmap not empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('TC_001-2', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 2, size: { height: 6, width: 8 } } + image.createPixelMap(Color, opts) + .then( pixelmap => { + expect(pixelmap != undefined).assertTrue(); + console.info('TC_001-2 success'); + done(); + }) + .catch(error => { + console.log('TC_001-2 error: ' + error); + expect().assertFail(); + done(); + }) + }) + + /** + * @tc.number : TC_001-3 + * @tc.name : createpixelmap-callback (editable: false, pixelFormat: RGB_565, size: { height: 6, width: 8 },bytes = buffer) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixelFormat,size + * 3.using colorand opts create newPixelMap + * 4.return newpixelmap not empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('TC_001-3', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: false, pixelFormat: 2, size: { height: 6, width: 8 } } + image.createPixelMap(Color, opts, (err, pixelmap) => { + expect(pixelmap != undefined).assertTrue(); + console.info('TC_001-3 success'); + done(); + + }) + }) + /** + * @tc.number : TC_001-4 + * @tc.name : createpixelmap-promise(editable: true, pixelFormat: unkonwn, size: { height: 6, width: 8 }) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixelFormat,size + * 3.using colorand opts create newPixelMap + * 4.return newpixelmap not empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('TC_001-4', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 0, size: { height: 6, width: 8 } } + image.createPixelMap(Color, opts) + .then( pixelmap => { + expect(pixelmap != undefined).assertTrue(); + console.info('TC_001-4 success'); + done(); + }) + .catch(error => { + console.log('TC_001-4 error: ' + error); + expect().assertFail(); + done(); + }) + }) + + /** + * @tc.number : TC_001-5 + * @tc.name : create pixelmap-callback(editable: false, pixelFormat: unkonwn, size: { height: 6, width: 8 }) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixelFormat,size + * 3.using colorand opts create newPixelMap + * 4.return newpixelmap not empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('TC_001-5', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: false, pixelFormat: 0, size: { height: 6, width: 8 } } + image.createPixelMap(Color, opts, (err, pixelmap) => { + expect(pixelmap != undefined).assertTrue(); + console.info('TC_001-5 success'); + done(); + }) + }) + /** + * @tc.number : TC_001-6 + * @tc.name : create pixelmap-callback(editable: true, pixelFormat: RGBA_8888, size: { height: 6, width: 8 } bytes > buffer ) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixeFormat,size + * 3.using color and opts create newPixelMap + * 4.return newpixelmap not empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('TC_001-6', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 3, size: { height: 6, width: 8 } } + image.createPixelMap(Color, opts, (err, pixelmap) => { + expect(pixelmap != undefined).assertTrue(); + console.info('TC_001-6 success'); + done(); + }) + }) + + /** + * @tc.number : TC_001-7 + * @tc.name : create pixelmap-callback(editable: true, pixelFormat: RGB_565, size: { height: 2, width: 3 }, bytes < buffer) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixeFormat,size + * 3.using color and opts create newPixelMap + * 4.return newpixelmap not empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('TC_001-7', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 2, size: { height: 2, width: 3 } } + image.createPixelMap(Color, opts, (err, pixelmap) => { + expect(pixelmap != undefined).assertTrue(); + console.info('TC_001-7 success'); + done(); + }) + }) + + /** + * @tc.number : TC_001-8 + * @tc.name : create pixelmap-callback(editable: true, pixelFormat: unkonwn, size: { height: -1, width: -1 }) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixeFormat,size + * 3.using color and opts create newPixelMap + * 4.return newpixelmap empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('TC_001-8', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 0, size: { height: -1, width: -1 } } + image.createPixelMap(Color, opts, (err, pixelmap) => { + expect(pixelmap == undefined).assertTrue(); + console.info('TC_001-8 success'); + done(); + }) + }) + + /** + * @tc.number : TC_001-9 + * @tc.name : create pixelmap-callback(editable: true, pixelFormat: unsupported format, size: { height: 6, width: 8 }) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixeFormat,size + * 3.using color and opts create newPixelMap + * 4.return newpixelmap empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('TC_001-9', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 1, size: { height: 6, width: 8 } } + image.createPixelMap(Color, opts, (err, pixelmap) => { + expect(pixelmap == undefined).assertTrue(); + console.info('TC_001-9 success'); + done(); + }) + }) + + /** + * @tc.number : TC_020 + * @tc.name : readPixelsToBuffer-promise + * @tc.desc : read all pixels to an buffer + * 1.create PixelMap,buffer + * 2.call readPixelsToBuffer + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_020', 0, async function (done) { + console.info('TC_020 in'); + const color = new ArrayBuffer(96); + var bufferArr = new Uint8Array(color); + for (var i = 0; i < bufferArr.length; i++) { + bufferArr[i] = i + 1; + } + + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(color, opts) + .then( pixelmap => { + if (pixelmap == undefined) { + console.info('TC_020 createPixelMap failed'); + expect(false).assertTrue() + done(); + } + const readBuffer = new ArrayBuffer(96); + pixelmap.readPixelsToBuffer(readBuffer).then(() => { + var bufferArr2 = new Uint8Array(readBuffer); + var res = true; + for (var i = 0; i < bufferArr2.length; i++) { + if (bufferArr2[i] != tc_020buf[i]) { + res = false; + console.info('TC_20_buffer'+ bufferArr2[i]); + console.info('TC_020 failed'); + expect(false).assertTrue(); + done(); + break; + } + } + if (res) { + console.info('TC_020 success'); + expect(true).assertTrue() + done(); + } + }).catch(error => { + console.log('TC_020 read error: ' + error); + expect().assertFail(); + done(); + }) + }).catch(error => { + console.log('TC_020 error: ' + error); + expect().assertFail(); + done(); + }) + }) + + /** + * @tc.number : TC_020-1 + * @tc.name : readPixelsToBuffer-callback + * @tc.desc : read all pixels to an buffer + * 1.create PixelMap,buffer + * 2.call readPixelsToBuffer + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_020-1', 0, async function (done) { + console.info('TC_020-1 in'); + const color = new ArrayBuffer(96); + var bufferArr = new Uint8Array(color); + for (var i = 0; i < bufferArr.length; i++) { + bufferArr[i] = i + 1; + } + + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(color, opts, (err, pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_020-1 createPixelMap failed'); + expect(false).assertTrue(); + done(); + }else{ + const readBuffer = new ArrayBuffer(96); + pixelmap.readPixelsToBuffer(readBuffer,() => { + var bufferArr = new Uint8Array(readBuffer); + var res = true; + for (var i = 0; i < bufferArr.length; i++) { + if (bufferArr[i] != tc_020_1buf[i]) { + res = false; + console.info('TC_020-1 failed'); + expect(false).assertTrue(); + done(); + break; + } + } + if (res) { + console.info('TC_020-1 success'); + expect(true).assertTrue() + done(); + } + }) + } + }) + }) + + /** + * @tc.number : TC_020-2 + * @tc.name : readPixelsToBuffer-callback(buffer:0) + * @tc.desc : read all pixels to an buffer + * 1.create PixelMap,buffer + * 2.call readPixelsToBuffer + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_020-2', 0, async function (done) { + console.info('TC_020-2 in'); + const color = new ArrayBuffer(96); + var bufferArr = new Uint8Array(color); + for (var i = 0; i < bufferArr.length; i++) { + bufferArr[i] = i + 1; + } + + let opts = { editable: true, pixelFormat: 2, size: { height: 6, width: 8 } } + image.createPixelMap(color, opts, (err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_020-2 createPixelMap failed'); + expect(false).assertTrue(); + done(); + }else{ + const readBuffer = new ArrayBuffer(0); + pixelmap.readPixelsToBuffer(readBuffer,() => { + var bufferArr = new Uint8Array(readBuffer); + var res = true; + for (var i = 0; i < bufferArr.length; i++) { + if (bufferArr[i] == 0) { + res = false; + console.info('TC_020-2 failed'); + expect(false).assertTrue(); + done(); + break; + } + } + if (res) { + console.info('TC_020-2 success'); + expect(true).assertTrue() + done(); + } + }) + } + }) + }) + + /** + * @tc.number : TC_021 + * @tc.name : readPixels-promise + * @tc.desc : 1.create PixelMap + * 2.call readPixels + * 3.promise return array + * 4.callbackcall return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_021', 0, async function (done) { + const color = new ArrayBuffer(96); + var bufferArr = new Uint8Array(color); + for (var i = 0; i < bufferArr.length; i++) { + bufferArr[i] = i + 1; + } + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(color, opts) + .then( pixelmap => { + if (pixelmap == undefined) { + console.info('TC_021 createPixelMap failed'); + expect(false).assertTrue() + done(); + } + const area = { pixels: new ArrayBuffer(8), + offset: 0, + stride: 8, + region: { size: { height: 1, width: 2 }, x: 0, y: 0 } + } + pixelmap.readPixels(area).then(() => { + var bufferArr2 = new Uint8Array(area.pixels); + var res = true; + for (var i = 0; i < bufferArr2.length; i++) { + if (bufferArr2[i] != tc_021buf[i]) { + res = false; + console.info('TC_021 failed'); + expect(false).assertTrue(); + done(); + break; + } + } + if (res) { + console.info('TC_021 success'); + expect(true).assertTrue() + done(); + } + }) + }) + .catch(error => { + console.log('TC_021 error: ' + error); + expect().assertFail(); + done(); + }) + }) + + /** + * @tc.number : TC_021-1 + * @tc.name : readPixels-callback + * @tc.desc : 1.create PixelMap + * 2.call readPixels + * 3.promise return array + * 4.callbackcall return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_021-1', 0, async function (done) { + const color = new ArrayBuffer(96); + var bufferArr = new Uint8Array(color); + for (var i = 0; i < bufferArr.length; i++) { + bufferArr[i] = i + 1; + } + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(color, opts, (err, pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_020-1 createPixelMap failed'); + expect(false).assertTrue(); + done(); + }else{ + const area = { pixels: new ArrayBuffer(8), + offset: 0, + stride: 8, + region: { size: { height: 1, width: 2 }, x: 0, y: 0 }} + pixelmap.readPixels(area, () => { + var bufferArr = new Uint8Array(area.pixels); + var res = true; + for (var i = 0; i < bufferArr.length; i++) { + console.info('TC_021-1 buffer ' + bufferArr[i]); + if(bufferArr[i] != tc_021_1buf[i]) { + res = false; + console.info('TC_021-1 failed'); + expect(false).assertTrue(); + done(); + break; + } + } + if (res) { + console.info('TC_021-1 success'); + expect(true).assertTrue() + done(); + } + }) + } + }) + }) + + /** + * @tc.number : TC_021-2 + * @tc.name : readPixels-callback( region: { size: { height: 1, width: 2 }, x: -1, y: -1 }) + * @tc.desc : 1.create PixelMap + * 2.call readPixels + * 3.promise return array + * 4.callbackcall return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_021-2', 0, async function (done) { + const color = new ArrayBuffer(96); + var bufferArr = new Uint8Array(color); + for (var i = 0; i < bufferArr.length; i++) { + bufferArr[i] = i + 1; + } + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(color, opts, (err,pixelmap) => { + if(pixelmap == undefined){ + expect(false).assertTrue(); + console.info('TC_021-2 create pixelmap fail'); + done(); + }else{ + const area = { pixels: new ArrayBuffer(20), + offset: 0, + stride: 8, + region: { size: { height: 1, width: 2 }, x: -1, y: -1 }} + pixelmap.readPixels(area).then(()=>{ + console.info('TC_021-2 failed'); + expect(false).assertTrue(); + done(); + }).catch(()=>{ + expect(true).assertTrue(); + console.info('TC_021-2 success'); + done(); + }) + } + }) + }) + + /** + * @tc.number : TC_021-3 + * @tc.name : readPixels-promise(buffer:0) + * @tc.desc : 1.create PixelMap + * 2.call readPixels + * 3.promise return array + * 4.callbackcall return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_021-3', 0, async function (done) { + const color = new ArrayBuffer(96); + var bufferArr = new Uint8Array(color); + for (var i = 0; i < bufferArr.length; i++) { + bufferArr[i] = i + 1; + } + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(color, opts, (err,pixelmap) => { + if(pixelmap == undefined){ + expect(false).assertTrue(); + console.info('TC_021-3 create pixelmap failed'); + done(); + }else{ + const area = { pixels: new ArrayBuffer(0), + offset: 0, + stride: 8, + region: { size: { height: 1, width: 2 }, x: 0, y: 0 }} + pixelmap.readPixels(area).then(()=>{ + console.info('TC_021-3 failed'); + expect(false).assertTrue(); + done(); + }).catch(()=>{ + expect(true).assertTrue(); + console.info('TC_021-3 success'); + done(); + }) + } + }) + }) + + /** + * @tc.number : TC_021-4 + * @tc.name : readPixels-promise(offset > buffer) + * @tc.desc : 1.create PixelMap + * 2.call readPixels + * 3.promise return array + * 4.callbackcall return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_021-4', 0, async function (done) { + const color = new ArrayBuffer(96); + var bufferArr = new Uint8Array(color); + for (var i = 0; i < bufferArr.length; i++) { + bufferArr[i] = i + 1; + } + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(color, opts, (err, pixelmap) => { + if(pixelmap == undefined){ + expect(false).assertTrue(); + console.info('TC_021-4 createPixelMap success'); + done(); + } + const area = { pixels: new ArrayBuffer(20), + offset: 21, + stride: 8, + region: { size: { height: 1, width: 2 }, x: 0, y: 0 }} + pixelmap.readPixels(area).then(()=>{ + console.info('TC_021-4 failed'); + expect(false).assertTrue(); + done(); + }).catch(()=>{ + expect(true).assertTrue(); + console.info('TC_021-4 success'); + done(); + }) + }) + }) + + /** + * @tc.number : TC_021-5 + * @tc.name : readPixels-promise(region: { size: { height: -1, width:-1}, x: 0, y: 0 }) + * @tc.desc : 1.create PixelMap + * 2.call readPixels + * 3.promise return array + * 4.callbackcall return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_021-5', 0, async function (done) { + const color = new ArrayBuffer(96); + var bufferArr = new Uint8Array(color); + for (var i = 0; i < bufferArr.length; i++) { + bufferArr[i] = i + 1; + } + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(color, opts, (err,pixelmap) => { + if(pixelmap == undefined){ + expect(false).assertTrue(); + console.info('TC_021-5 createPixelMap success'); + done(); + } + const area = { pixels: new ArrayBuffer(20), + offset: 0, + stride: 8, + region: { size: { height: -1, width:-1}, x: 0, y: 0 }} + pixelmap.readPixels(area).then(()=>{ + console.info('TC_021-5 failed'); + expect(false).assertTrue(); + done(); + }).catch(()=>{ + expect(true).assertTrue(); + console.info('TC_021-5 success'); + done(); + }) + }) + }) + + /** + * @tc.number : TC_022 + * @tc.name : writePixels-promise + * @tc.desc : 1.create PixelMap + * 2.call writePixels + * 3.call return undefined + * 4.callbackcall return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_022', 0, async function (done) { + const color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(color, opts) + .then( pixelmap => { + if (pixelmap == undefined) { + console.info('TC_022 createPixelMap failed'); + expect(false).assertTrue() + done(); + } + + const area = { pixels: new ArrayBuffer(8), + offset: 0, + stride: 8, + region: { size: { height: 1, width: 2 }, x: 0, y: 0 } + } + var bufferArr = new Uint8Array(area.pixels); + for (var i = 0; i < bufferArr.length; i++) { + bufferArr[i] = i + 1; + } + + pixelmap.writePixels(area).then(() => { + const readArea = { pixels: new ArrayBuffer(8), + offset: 0, + stride: 8, + region: { size: { height: 1, width: 2 }, x: 0, y: 0 } + } + pixelmap.readPixels(readArea).then(() => { + var readArr = new Uint8Array(readArea.pixels); + var res = true; + for (var i = 0; i < readArr.length; i++) { + if (readArr[i] != tc_022buf[i]) { + res = false; + console.info('TC_022 failed'); + expect(false).assertTrue(); + done(); + break; + } + } + if (res) { + console.info('TC_022 success'); + expect(true).assertTrue() + done(); + } + }) + }) + }) + .catch(error => { + console.log('TC_022 error: ' + error); + expect().assertFail(); + done(); + }) + }) + + /** + * @tc.number : TC_022-1 + * @tc.name : writePixels-callback + * @tc.desc : 1.create PixelMap + * 2.call writePixels + * 3.call return undefined + * 4.callbackcall return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_022-1', 0, async function (done) { + const color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(color, opts, (err, pixelmap) => { + if (pixelmap == undefined) { + console.info('TC_022-1 createPixelMap failed'); + expect(false).assertTrue() + done(); + } + const area = { + pixels: new ArrayBuffer(8), + offset: 0, + stride: 8, + region: { size: { height: 1, width: 2 }, x: 0, y: 0 } + } + var bufferArr = new Uint8Array(area.pixels); + for (var i = 0; i < bufferArr.length; i++) { + bufferArr[i] = i + 1; + } + pixelmap.writePixels(area, () => { + const readArea = { + pixels: new ArrayBuffer(8), + offset: 0, + stride: 8, + region: { size: { height: 1, width: 2 }, x: 0, y: 0 } + } + pixelmap.readPixels(readArea, () => { + var readArr = new Uint8Array(readArea.pixels); + var res = true; + for (var i = 0; i < readArr.length; i++) { + if (readArr[i] != tc_022buf[i]) { + res = false; + console.info('TC_022-1 failed'); + expect(false).assertTrue(); + done(); + break; + } + } + if (res) { + console.info('TC_022-1 success'); + expect(true).assertTrue() + done(); + } + }) + }) + }) + .catch(error => { + console.log('TC_022-1 error: ' + error); + expect().assertFail(); + done(); + }) +}) + + /** + * @tc.number : TC_023 + * @tc.name : writeBufferToPixels-promise + * @tc.desc : 1.create PixelMap,buffer + * 2.call writeBufferToPixels + * 3.call return undefined + * 4.callbackcall return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_023', 0, async function (done) { + const color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 }} + image.createPixelMap(color, opts) + .then( pixelmap => { + if (pixelmap == undefined) { + console.info('TC_023 createPixelMap failed'); + expect(false).assertTrue() + done(); + } + + const writeColor = new ArrayBuffer(96); + var bufferArr = new Uint8Array(writeColor); + for (var i = 0; i < bufferArr.length; i++) { + bufferArr[i] = i + 1; + } + pixelmap.writeBufferToPixels(writeColor).then(() => { + const readBuffer = new ArrayBuffer(96); + pixelmap.readPixelsToBuffer(readBuffer).then(() => { + var bufferArr = new Uint8Array(readBuffer); + var res = true; + for (var i = 0; i < bufferArr.length; i++) { + if (bufferArr[i] == 0) { + res = false; + console.info('TC_023 failed'); + expect(false).assertTrue() + done(); + break; + } + } + if (res) { + console.info('TC_023 success'); + expect(true).assertTrue(); + done(); + } + }) + }) + }) + .catch(error => { + console.log('TC_023 error: ' + error); + expect().assertFail(); + done(); + }) + }) + + /** + * @tc.number : TC_023-1 + * @tc.name : writeBufferToPixels-callback + * @tc.desc : 1.create PixelMap,buffer + * 2.call writeBufferToPixels + * 3.call return undefined + * 4.callbackcall return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_023-1', 0, async function (done) { + const color = new ArrayBuffer(96); + var bufferArr = new Uint8Array(color); + for (var i = 0; i < bufferArr.length; i++) { + bufferArr[i] = i + 1; + } + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(color, opts).then( pixelmap => { + if(pixelmap == undefined){ + expect(false).assertTrue() + console.info('TC_023-1 failed'); + done(); + } + const writeColor = new ArrayBuffer(96); + pixelmap.writeBufferToPixels(writeColor,() => { + const readBuffer = new ArrayBuffer(96); + pixelmap.readPixelsToBuffer(readBuffer,() => { + var bufferArr = new Uint8Array(readBuffer); + var res = true; + for (var i = 0; i < bufferArr.length; i++) { + if(res) { + if (bufferArr[i] == 0) { + res = false; + console.info('TC_023-1 Success'); + expect(true).assertTrue() + done(); + break; + } + } + } + if (res) { + console.info('TC_023-1 no change after writeBuffer'); + expect(false).assertTrue(); + done(); + } + }) + }) + }) + }) + + /** + * @tc.number : TC_024 + * @tc.name : getImageInfo-pixelmap-promise + * @tc.desc : 1.create PixelMap,ImageInfo + * 2.call getImageInfo + * 3.call return imageinfo + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_024', 0, async function (done) { + const color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 2, size: { height: 6, width: 8 } } + image.createPixelMap(color, opts) + .then( pixelmap => { + if (pixelmap == undefined) { + console.info('TC_024 createPixelMap failed'); + expect(false).assertTrue() + done(); + } + pixelmap.getImageInfo().then( imageInfo => { + if (imageInfo == undefined) { + console.info('TC_024 imageInfo is empty'); + expect(false).assertTrue() + done(); + } + if(imageInfo.size.height == 4 && imageInfo.size.width == 6){ + console.info('TC_024 success '); + expect(true).assertTrue() + done(); + } + done(); + }).catch(error => { + console.log('TC_024 getimageinfo error: ' + error); + expect().assertFail(); + done(); + }) + done(); + }) + .catch(error => { + console.log('TC_024 error: ' + error); + expect().assertFail(); + done(); + }) + }) + + /** + * @tc.number : TC_024-1 + * @tc.name : getImageInfo-pixelmap-callback + * @tc.desc : 1.create PixelMap,ImageInfo + * 2.call getImageInfo + * 3.call return imageinfo + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_024-1', 0, async function (done) { + const color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(color, opts, (err,pixelmap) => { + if(pixelmap == undefined){ + expect(false).assertTrue() + console.info('TC_024-1 create pixelmap fail'); + done(); + } + pixelmap.getImageInfo( (err,imageInfo) => { + if (imageInfo == undefined) { + console.info('TC_024-1 imageInfo is empty'); + expect(false).assertTrue() + done(); + } + if(imageInfo.size.height == 4 && imageInfo.size.width == 6){ + console.info('TC_024-1 imageInfo success'); + expect(true).assertTrue() + done(); + } + done(); + }) + }) + }) + + /** + * @tc.number : TC_025-1 + * @tc.name : getBytesNumberPerRow + * @tc.desc : 1.create PixelMap + * 2.set PixelMap + * 3.call getBytesNumberPerRow + * 4. call return number + * 5.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_025-1', 0, async function (done) { + const color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + const expectNum = 4 * opts.size.width; + image.createPixelMap(color, opts, (err,pixelmap) => { + if(pixelmap == undefined){ + expect(false).assertTrue() + console.info('TC_25-1 create pixelmap fail'); + done(); + } else { + const num = pixelmap.getBytesNumberPerRow(); + console.info('TC_025-1 num is ' + num); + expect(num == expectNum).assertTrue(); + if(num == expectNum) { + console.info('TC_25-1 success'); + } else { + console.info('TC_25-1 fail'); + } + done(); + } + }) + }) + + /** + * @tc.number : TC_026-1 + * @tc.name : getPixelBytesNumber + * @tc.desc : 1.create PixelMap + * 2.set Pixel + * 3.call getPixelBytesNumber + * 4. call return number + * 5.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_026-1', 0, async function (done) { + const color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + const expectNum = 4 * opts.size.width * opts.size.height; + image.createPixelMap(color, opts,(err,pixelmap) => { + if(pixelmap == undefined){ + expect(false).assertTrue() + console.info('TC_026-1 create pixelmap fail'); + done(); + } else { + const num = pixelmap.getPixelBytesNumber(); + console.info('TC_026-1 num is ' + num); + expect(num == expectNum).assertTrue(); + if(num == expectNum) { + console.info('TC_026-1 success'); + } else { + console.info('TC_026-1 fail'); + } + done(); + } + }) + }) + + /** + * @tc.number : TC_027 + * @tc.name : release-pixelmap-promise + * @tc.desc : 1.create PixelMap + * 2.set Pixel + * 3.call release + * 4.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_027', 0, async function (done) { + const color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(color, opts).then(pixelmap => { + if (pixelmap == undefined) { + console.info('TC_027 createPixelMap failed'); + expect(false).assertTrue() + done(); + } + pixelmap.release().then(() => { + console.info('TC_027 success'); + expect(true).assertTrue(); + done(); + }).catch(error => { + console.log('TC_027 error: ' + error); + expect().assertFail(); + done(); + }) + }).catch(error => { + console.log('TC_027 createPixelMap failed error: ' + error); + expect().assertFail(); + done(); + }) + }) + + /** + * @tc.number : TC_027-1 + * @tc.name : release-pixelmap-callback + * @tc.desc : 1.create PixelMap + * 2.set Pixel + * 3.call release + * 4.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_027-1', 0, async function (done) { + const color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(color, opts, (err, pixelmap) => { + if (pixelmap == undefined) { + console.info('TC_027-1 createPixelMap failed'); + expect(false).assertTrue() + done(); + } + pixelmap.release(()=>{ + expect(true).assertTrue(); + console.log('TC_027-1 success'); + done(); + }) + }) + }) + + /** + * @tc.number : TC_171 + * @tc.name : getImageProperty(BitsPerSample)-promise + * @tc.desc : 1.create imagesource + * 2.set property + * 3.call getImageProperty(BitsPerSample) + * 4.The return value is not empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_171', 0, async function (done) { + let fdNumber = fileio.openSync(pathExifJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_171 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.getImageProperty("BitsPerSample") + .then(data => { + console.info('TC_171 BitsPerSample ' + data); + expect(data != undefined).assertTrue(); + done(); + }) + .catch(error => { + console.log('TC_171 error: ' + error); + expect(false).assertFail(); + done(); + }) + } + }) + + /** + * @tc.number : TC_171-1 + * @tc.name : getImageProperty(Orientation)-promise + * @tc.desc : 1.create imagesource + * 2.set property + * 3.call getImageProperty(Orientation) + * 4.The return value is not empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_171-1', 0, async function (done) { + let fdNumber = fileio.openSync(pathExifJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_171-1 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.getImageProperty("Orientation") + .then(data => { + console.info('TC_171-1 Orientation ' + data); + expect(data != undefined && data != '' ).assertTrue(); + done(); + }) + .catch(error => { + console.log('TC_171-1 error: ' + error); + expect(false).assertFail(); + done(); + }) + } + }) + + /** + * @tc.number : TC_171-2 + * @tc.name : getImageProperty(ImageLength)-promise + * @tc.desc : 1.create imagesource + * 2.set property + * 3.call getImageProperty(ImageLength) + * 4.The return value is not empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_171-2', 0, async function (done) { + let fdNumber = fileio.openSync(pathExifJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_171-2 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.getImageProperty("ImageLength") + .then(data => { + console.info('TC_171-2 ImageLength ' + data); + expect(data != undefined && data != '' ).assertTrue(); + done(); + }) + .catch(error => { + console.log('TC_171-2 error: ' + error); + expect(false).assertFail(); + done(); + }) + } + }) + + /** + * @tc.number : TC_171-3 + * @tc.name : getImageProperty(ImageWidth)-promise + * @tc.desc : 1.create imagesource + * 2.set property + * 3.call getImageProperty(ImageWidth) + * 4.The return value is not empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_171-3', 0, async function (done) { + let fdNumber = fileio.openSync(pathExifJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_171-3 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.getImageProperty("ImageWidth") + .then(data => { + console.info('TC_171-3 ImageWidth ' + data); + expect(data != undefined && data != '' ).assertTrue(); + done(); + }) + .catch(error => { + console.log('TC_171-3 error: ' + error); + expect(false).assertFail(); + done(); + }) + } + }) + + /** + * @tc.number : TC_171-4 + * @tc.name : getImageProperty(GPSLatitude)-promise + * @tc.desc : 1.create imagesource + * 2.set property + * 3.call getImageProperty(GPSLatitude) + * 4.The return value is not empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_171-4', 0, async function (done) { + let fdNumber = fileio.openSync(pathExifJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_171-4 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.getImageProperty("GPSLatitude") + .then(data => { + console.info('TC_171-4 GPSLatitude ' + data); + expect(data != undefined && data != '' ).assertTrue(); + done(); + }) + .catch(error => { + console.log('TC_171-4 error: ' + error); + expect(false).assertFail(); + done(); + }) + } + }) + + /** + * @tc.number : TC_171-5 + * @tc.name : getImageProperty(GPSLongitude)-promise + * @tc.desc : 1.create imagesource + * 2.set property + * 3.call getImageProperty(GPSLongitude) + * 4.The return value is not empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_171-5', 0, async function (done) { + let fdNumber = fileio.openSync(pathExifJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_171-5 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.getImageProperty("GPSLongitude") + .then(data => { + console.info('TC_171-5 GPSLongitude ' + data); + expect(data != undefined && data != '' ).assertTrue(); + done(); + }) + .catch(error => { + console.log('TC_171-5 error: ' + error); + expect(false).assertFail(); + done(); + }) + } + }) + + /** + * @tc.number : TC_171-6 + * @tc.name : getImageProperty(GPSLatitudeRef)-promise + * @tc.desc : 1.create imagesource + * 2.set property + * 3.call getImageProperty(GPSLatitudeRef) + * 4.The return value is not empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_171-6', 0, async function (done) { + let fdNumber = fileio.openSync(pathExifJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_171-6 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.getImageProperty("GPSLatitudeRef") + .then(data => { + console.info('TC_171-6 GPSLatitudeRef ' + data); + expect(data != undefined && data != '' ).assertTrue(); + done(); + }) + .catch(error => { + console.log('TC_171-6 error: ' + error); + expect(false).assertFail(); + done(); + }) + } + }) + + /** + * @tc.number : TC_171-7 + * @tc.name : getImageProperty(GPSLongitudeRef)-promise + * @tc.desc : 1.create imagesource + * 2.set property + * 3.call getImageProperty(GPSLongitudeRef) + * 4.The return value is not empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_171-7', 0, async function (done) { + let fdNumber = fileio.openSync(pathExifJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_171-7 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.getImageProperty("GPSLongitudeRef") + .then(data => { + console.info('TC_171-7 GPSLongitudeRef ' + data); + expect(data != undefined && data != '' ).assertTrue(); + done(); + }) + .catch(error => { + console.log('TC_171-7 error: ' + error); + expect(false).assertFail(); + done(); + }) + } + }) + + /** + * @tc.number : TC_171-8 + * @tc.name : getImageProperty(DateTimeOriginal) + * @tc.desc : 1.create imagesource + * 2.set property + * 3.call getImageProperty(ImageLength) + * 4.The return value is not empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_171-8', 0, async function (done) { + let fdNumber = fileio.openSync(pathExifJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_171-8 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.getImageProperty("DateTimeOriginal") + .then(data => { + console.info('TC_171-8 DateTimeOriginal ' + data); + expect(data != undefined && data != '' ).assertTrue(); + done(); + }) + .catch(error => { + console.log('TC_171-8 error: ' + error); + expect(false).assertFail(); + done(); + }) + } + }) + + /** + * @tc.number : TC_172 + * @tc.name : getImageProperty(BitsPerSample)-callback + * @tc.desc : 1.create imagesource + * 2.call getImageProperty(BitsPerSample) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_172', 0, async function (done) { + let fdNumber = fileio.openSync(pathExifJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_172 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.getImageProperty("BitsPerSample",(error,data) => { + if (error){ + console.info('TC_172 getImageProperty BitsPerSample error'); + expect(false).assertTrue(); + done(); + }else{ + console.info('TC_172 BitsPerSample ' + data); + expect(data != undefined).assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_172-1 + * @tc.name : getImageProperty(Orientation)-callback + * @tc.desc : 1.create imagesource + * 2.call getImageProperty(Orientation) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_172-1', 0, async function (done) { + let fdNumber = fileio.openSync(pathExifJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_172-1 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.getImageProperty("Orientation",(error,data) => { + if (error){ + console.info('TC_172-1 getImageProperty Orientation error'); + expect(false).assertTrue(); + done(); + }else{ + console.info('TC_172-1 Orientation ' + data); + expect(data != undefined && data != '').assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_172-2 + * @tc.name : getImageProperty(ImageLength)-callback + * @tc.desc : 1.create imagesource + * 2.call getImageProperty(ImageLength) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_172-2', 0, async function (done) { + let fdNumber = fileio.openSync(pathExifJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_172-2 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.getImageProperty("ImageLength",(error,data) => { + if (error){ + console.info('TC_172-2 getImageProperty ImageLength error'); + expect(false).assertTrue(); + done(); + }else{ + console.info('TC_172-2 ImageLength ' + data); + expect(data != undefined && data != '' ).assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_172-3 + * @tc.name : getImageProperty(ImageWidth)-callback + * @tc.desc : 1.create imagesource + * 2.call getImageProperty(ImageWidth) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_172-3', 0, async function (done) { + let fdNumber = fileio.openSync(pathExifJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_172-3 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.getImageProperty("ImageWidth",(error,data) => { + if (error){ + console.info('TC_172-3 getImageProperty ImageWidth error'); + expect(false).assertTrue(); + done(); + }else{ + console.info('TC_172-3 ImageWidth ' + data); + expect(data != undefined && data != '' ).assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_172-4 + * @tc.name : getImageProperty(GPSLatitude)-callback + * @tc.desc : 1.create imagesource + * 2.call getImageProperty(GPSLatitude) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_172-4', 0, async function (done) { + let fdNumber = fileio.openSync(pathExifJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_172-4 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.getImageProperty("GPSLatitude",(error,data) => { + if (error){ + console.info('TC_172-4 getImageProperty GPSLatitude error'); + expect(false).assertTrue(); + done(); + }else{ + console.info('TC_172-4 GPSLatitude ' + data); + expect(data != undefined && data != '' ).assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_172-5 + * @tc.name : getImageProperty(GPSLongitude)-callback + * @tc.desc : 1.create imagesource + * 2.call getImageProperty(GPSLongitude) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_172-5', 0, async function (done) { + let fdNumber = fileio.openSync(pathExifJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_172-5 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.getImageProperty("GPSLongitude",(error,data) => { + if (error){ + console.info('TC_172-5 getImageProperty GPSLongitude error'); + expect(false).assertTrue(); + done(); + }else{ + console.info('TC_172-5 GPSLongitude ' + data); + expect(data != undefined && data != '' ).assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_172-6 + * @tc.name : getImageProperty(GPSLatitudeRef)-callback + * @tc.desc : 1.create imagesource + * 2.call getImageProperty(GPSLatitudeRef) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_172-6', 0, async function (done) { + let fdNumber = fileio.openSync(pathExifJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_172-6 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.getImageProperty("GPSLatitudeRef",(error,data) => { + if (error){ + console.info('TC_172-6 getImageProperty GPSLatitudeRef error'); + expect(false).assertTrue(); + done(); + }else{ + console.info('TC_172-6 GPSLatitudeRef ' + data); + expect(data != undefined && data != '' ).assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_172-7 + * @tc.name : getImageProperty(GPSLongitudeRef)-callback + * @tc.desc : 1.create imagesource + * 2.call getImageProperty(GPSLongitudeRef) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_172-7', 0, async function (done) { + let fdNumber = fileio.openSync(pathExifJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_172-7 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.getImageProperty("GPSLongitudeRef",(error,data) => { + if (error){ + console.info('TC_172-7 getImageProperty GPSLongitudeRef error'); + expect(false).assertTrue(); + done(); + }else{ + console.info('TC_172-7 GPSLongitudeRef ' + data); + expect(data != undefined && data != '' ).assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_172-8 + * @tc.name : getImageProperty(DateTimeOriginal)-callback + * @tc.desc : 1.create imagesource + * 2.call getImageProperty(DateTimeOriginal) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_172-8', 0, async function (done) { + let fdNumber = fileio.openSync(pathExifJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_172-8 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.getImageProperty("DateTimeOriginal",(error,data) => { + if (error){ + console.info('TC_172-8 getImageProperty DateTimeOriginal error'); + expect(false).assertTrue(); + done(); + }else{ + console.info('TC_172-8 DateTimeOriginal ' + data); + expect(data != undefined && data != '' ).assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_173 + * @tc.name : getImageProperty(BitsPerSample,property)-callback + * @tc.desc : 1.create imagesource + * 2.set property + * 3.call getImageProperty(BitsPerSample,property) + * 4.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_173', 0, async function (done) { + let fdNumber = fileio.openSync(pathExifJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_173 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let property = {index:0,defaultValue:'9999'} + imageSourceApi.getImageProperty("BitsPerSample",property,(error,data) => { + if (error){ + console.info('TC_173 getImageProperty BitsPerSample error'); + expect(false).assertTrue(); + done(); + }else{ + console.info('TC_173 BitsPerSample ' + data); + expect(data != '9999' && data != undefined).assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_173-1 + * @tc.name : getImageProperty(Orientation,property)-callback + * @tc.desc : 1.create imagesource + * 2.set property + * 3.call getImageProperty(Orientation,property) + * 4.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_173-1', 0, async function (done) { + let fdNumber = fileio.openSync(pathExifJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_173-1 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let property = {index:0,defaultValue:'9999'} + imageSourceApi.getImageProperty("Orientation",property,(error,data) => { + if (error){ + console.info('TC_173-1 getImageProperty Orientation error'); + expect(false).assertTrue(); + done(); + }else{ + console.info('TC_173-1 Orientation ' + data); + expect(data != '9999' && data != undefined && data != '').assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_173-2 + * @tc.name : getImageProperty(ImageLength,property)-callback + * @tc.desc : 1.create imagesource + * 2.set property + * 3.call getImageProperty(ImageLength,property) + * 4.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_173-2', 0, async function (done) { + let fdNumber = fileio.openSync(pathExifJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_173-2 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let property = {index:0,defaultValue:'9999'} + imageSourceApi.getImageProperty("ImageLength",property,(error,data) => { + if (error){ + console.info('TC_173-2 getImageProperty ImageLength error'); + expect(false).assertTrue(); + done(); + }else{ + console.info('TC_173-2 ImageLength ' + data); + expect(data != '9999' && data != undefined && data != '').assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_173-3 + * @tc.name : getImageProperty(ImageWidth,property)-callback + * @tc.desc : 1.create imagesource + * 2.set property + * 3.call getImageProperty(ImageWidth,property) + * 4.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_173-3', 0, async function (done) { + let fdNumber = fileio.openSync(pathExifJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_173-3 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let property = {index:0,defaultValue:'9999'} + imageSourceApi.getImageProperty("ImageWidth",property,(error,data) => { + if (error){ + console.info('TC_173-3 getImageProperty ImageWidth error'); + expect(false).assertTrue(); + done(); + }else{ + console.info('TC_173-3 ImageWidth ' + data); + expect(data != '9999' && data != undefined && data != '').assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_173-4 + * @tc.name : getImageProperty(GPSLatitude,property)-callback + * @tc.desc : 1.create imagesource + * 2.set property + * 3.call getImageProperty(GPSLatitude,property) + * 4.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_173-4', 0, async function (done) { + let fdNumber = fileio.openSync(pathExifJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_173-4 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let property = {index:0,defaultValue:'9999'} + imageSourceApi.getImageProperty("GPSLatitude",property,(error,data) => { + if (error){ + console.info('TC_173-4 getImageProperty GPSLatitude error'); + expect(false).assertTrue(); + done(); + }else{ + console.info('TC_173-4 GPSLatitude ' + data); + expect(data != '9999' && data != undefined && data != '').assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_173-5 + * @tc.name : getImageProperty(GPSLongitude,property)-callback + * @tc.desc : 1.create imagesource + * 2.set property + * 3.call getImageProperty(GPSLongitude,property) + * 4.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_173-5', 0, async function (done) { + let fdNumber = fileio.openSync(pathExifJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_173-5 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let property = {index:0,defaultValue:'9999'} + imageSourceApi.getImageProperty("GPSLongitude",property,(error,data) => { + if (error){ + console.info('TC_173-5 getImageProperty GPSLongitude error'); + expect(false).assertTrue(); + done(); + }else{ + console.info('TC_173-5 GPSLongitude ' + data); + expect(data != '9999' && data != undefined && data != '').assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_173-6 + * @tc.name : getImageProperty(GPSLatitudeRef,property)-callback + * @tc.desc : 1.create imagesource + * 2.set property + * 3.call getImageProperty(GPSLatitudeRef,property) + * 4.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_173-6', 0, async function (done) { + let fdNumber = fileio.openSync(pathExifJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_173-6 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let property = {index:0,defaultValue:'9999'} + imageSourceApi.getImageProperty("GPSLatitudeRef",property,(error,data) => { + if (error){ + console.info('TC_173-6 getImageProperty GPSLatitudeRef error'); + expect(false).assertTrue(); + done(); + }else{ + console.info('TC_173-6 GPSLatitudeRef ' + data); + expect(data != '9999' && data != undefined && data != '').assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_173-7 + * @tc.name : getImageProperty(GPSLongitudeRef,property)-callback + * @tc.desc : 1.create imagesource + * 2.set property + * 3.call getImageProperty(GPSLongitudeRef,property) + * 4.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_173-7', 0, async function (done) { + let fdNumber = fileio.openSync(pathExifJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_173-7 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let property = {index:0,defaultValue:'9999'} + imageSourceApi.getImageProperty("GPSLongitudeRef",property,(error,data) => { + if (error){ + console.info('TC_173-7 getImageProperty GPSLongitudeRef error'); + expect(false).assertTrue(); + done(); + }else{ + console.info('TC_173-7 GPSLongitudeRef ' + data); + expect(data != '9999' && data != undefined && data != '').assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_173-8 + * @tc.name : getImageProperty(DateTimeOriginal,property)-callback + * @tc.desc : 1.create imagesource + * 2.set property + * 3.call getImageProperty(DateTimeOriginal,property) + * 4.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_173-8', 0, async function (done) { + let fdNumber = fileio.openSync(pathExifJpg); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_173-8 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let property = {index:0,defaultValue:'9999'} + imageSourceApi.getImageProperty("DateTimeOriginal",property,(error,data) => { + if (error){ + console.info('TC_173-8 getImageProperty DateTimeOriginal error'); + expect(false).assertTrue(); + done(); + }else{ + console.info('TC_173-8 DateTimeOriginal ' + data); + expect(data != '9999' && data != undefined && data != '').assertTrue(); + done(); + } + }) + } + }) +}) diff --git a/multimedia/image/image_js_standard/imageExif/src/main/js/test/testImg.js b/multimedia/image/image_js_standard/imageExif/src/main/js/test/testImg.js new file mode 100644 index 000000000..c31c50222 --- /dev/null +++ b/multimedia/image/image_js_standard/imageExif/src/main/js/test/testImg.js @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2022 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 tc_020buf = new Uint8Array([0,0,0,4,0,0,0,8,1,0,0,12,1,1,1,16,1,1,1,20,2,2,2,24,3,3,3,28,4,4,4,32,5,5,5,36,6,6,6,40,7,7,7,44,9,9,8,48,10,10,10,52,12,12,12,56,14,14,13,60,16,16,15,64,18,18,17,68,20,20,19,72,22,22,22,76,25,24,24,80,27,27,27,84,30,30,29,88,33,32,32,92,36,35,35,96]) +let tc_020_1buf = new Uint8Array([0,0,0,4,0,0,0,8,1,0,0,12,1,1,1,16,1,1,1,20,2,2,2,24,3,3,3,28,4,4,4,32,5,5,5,36,6,6,6,40,7,7,7,44,9,9,8,48,10,10,10,52,12,12,12,56,14,14,13,60,16,16,15,64,18,18,17,68,20,20,19,72,22,22,22,76,25,24,24,80,27,27,27,84,30,30,29,88,33,32,32,92,36,35,35,96]) +let tc_021buf = new Uint8Array([0,0,0,4,0,0,0,8]) +let tc_021_1buf = new Uint8Array([0,0,0,4,0,0,0,8]) +let tc_022buf = new Uint8Array([0,0,0,4,0,0,0,8]) + + export {tc_020buf, tc_020_1buf, tc_021buf, tc_021_1buf, tc_022buf} \ No newline at end of file diff --git a/multimedia/image/image_js_standard/imageExif/src/main/resources/base/element/string.json b/multimedia/image/image_js_standard/imageExif/src/main/resources/base/element/string.json new file mode 100644 index 000000000..22af6ba2c --- /dev/null +++ b/multimedia/image/image_js_standard/imageExif/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "ImageJSTestMain" + }, + { + "name": "mainability_description", + "value": "ImageJSTestMain Ability" + } + ] +} \ No newline at end of file diff --git a/multimedia/image/image_js_standard/imageExif/src/main/resources/base/media/icon.png b/multimedia/image/image_js_standard/imageExif/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c GIT binary patch literal 6790 zcmX|G1ymHk)?T_}Vd;>R?p|tHQo6fg38|$UVM!6BLrPFWk?s;$LOP{GmJpBl$qoSA!PUg~PA65-S00{{S`XKG6NkG0RgjEntPrmV+?0|00mu7;+5 zrdpa{2QLqPJ4Y{j7=Mrl{BaxrkdY69+c~(w{Fv-v&aR%aEI&JYSeRTLWm!zbv;?)_ ziZB;fwGbbeL5Q}YLx`J$lp~A09KK8t_z}PZ=4ZzgdeKtgoc+o5EvN9A1K1_<>M?MBqb#!ASf&# zEX?<)!RH(7>1P+j=jqG(58}TVN-$psA6K}atCuI!KTJD&FMmH-78ZejBm)0qc{ESp z|LuG1{QnBUJRg_E=h1#XMWt2%fcoN@l7eAS!Es?Q+;XsRNPhiiE=@AqlLkJzF`O18 zbsbSmKN=aaq8k3NFYZfDWpKmM!coBU0(XnL8R{4=i|wi{!uWYM2je{U{B*K2PVdu&=E zTq*-XsEsJ$u5H4g6DIm2Y!DN`>^v|AqlwuCD;w45K0@eqauiqWf7l&o)+YLHm~|L~ z7$0v5mkobriU!H<@mVJHLlmQqzQ3d6Rh_-|%Yy2li*tHO>_vcnuZ7OR_xkAIuIU&x z-|8Y0wj|6|a6_I(v91y%k_kNw6pnkNdxjqG8!%Vz_d%c_!X+6-;1`GC9_FpjoHev5fEV7RhJ>r=mh-jp$fqbqRJ=obwdgLDVP5+s zy1=_DWG0Y-Jb3t^WXmkr(d9~08k-|#Ly zaNOmT(^9tIb&eb4%CzIT zAm3CUtWSr1t4?h1kk#NBi{U|pJslvME{q|_eS^3En>SOqSxyuN1x;Is@8~m?*>}** znrRFArP!K_52RpX*&JHMR<^lVdm8ypJ}0R(SD(51j;6@ni$6bQ+2XL+R^|NnSp5}(kzvMZ^(@4fD_{QVu$(&K6H|C37TG1Am9Re{<<3gd zh@`>;BqkXMW&p0T6rt|iB$)~CvFe(XC)F9WgAZn*0@t$oZo;!*}r@_`h?KKH&6A@3= zISXoQB+~`op>NP-buiA*^0n{@i{_?MRG)&k)c)k_F+-2Lud!S9pc+i`s74NpBCaGF zXN+pHkubw*msGBTY27BKHv)RRh3;nMg4&$fD_6X9Vt~;_4D+5XPH~#Kn-yjcy!$}1 zigv#FNY>TqMhtIBb@UoF!cE~Q8~;!Pek>SQQwHnHuWKoVBosAiOr}q>!>aE*Krc)V zBUMEcJ5NU0g8}-h6i1zpMY9>m4ne?=U2~`w7K7Q0gB_=p@$5K7p6}thw z-~3dMj?YNX2X$lZ+7ngQ$=s}3mizNN@kE%OtB)?c&i~2L55z8^=yz;xMHLmlY>&Q# zJj?!)M#q_SyfkQh)k?j8IfLtB)ZCp|*vf4_B zos?73yd^h-Ac+;?E4*bpf=o*^3x3-`TVjbY4n6!EN10K6o@fxdyps05Vo3PU)otB} z`3kR+2w7_C#8Z!q`J)p{Vh!+m9-UP!$STp+Hb}}#@#_u^SsUQg<}59< zTvH3%XS4G+6FF^(m6bVF&nSUIXcl;nw{=H$%fgeJ>CgDYiLdpDXr{;-AnG z8dvcrHYVMI&`R6;GWekI@Ir3!uo)oz4^{6q0m^}@f2tM9&=YHNi6-?rh0-{+k@cQm zdp`g#YdQn%MDVg2GR>wZ`n2<0l4)9nx1Wfr&!Dvz=bPwU!h2S?ez6MVc5APE4-xLB zi&W9Q8k2@0w!C53g?iAIQ}~p*3O(@zja6KQ=M3zfW*_6o5SwR-)6VBh~m7{^-=MC-owYH5-u40a}a0liho3QZZ5L{bS_xM1)4}19)zTU$$MY zq3eZML1WC{K%YFd`Be0M-rkO^l?h{kM{$2oK1*A@HVJ57*yhDkUF!2WZ&oA4Y-sK( zCY69%#`mBCi6>6uw(x4gbFaP0+FD*JKJ-q!F1E?vLJ+d35!I5d7@^eU?(CS|C^tmI5?lv@s{{*|1F zFg|OzNpZ0hxljdjaW%45O0MOttRrd(Z?h{HYbB-KFUx&9GfFL3b8NwZ$zNu)WbBD` zYkj$^UB5%3Pj1MDr>S2Ejr9pUcgA!;ZG!@{uAy12)vG=*^9-|dNQBc8&`oxBlU~#y zs!anJX&T?57Jdr^sb>e+V`MVfY>Y0ESg7MG<7W0g&bR-ZYzzZ%2H&Etcp zcd6QeXO1D!5A#zM0lx*GH}`M)2~ZFLE;sP^RSB5wVMNfiZXPd(cmO>j=OSA3`o5r& zna(|^jGXbdN7PK)U8b7^zYtYkkeb%<%F~=OqB~kXMQkq}ii|skh@WSRt>5za;cjP0 zZ~nD%6)wzedqE}BMLt~qKwlvTr33))#uP~xyw#*Eaa|DbMQ_%mG0U8numf8)0DX`r zRoG2bM;#g|p-8gWnwRV5SCW0tLjLO&9Z?K>FImeIxlGUgo0Zk`9Qzhj1eco~7XZy+hXc@YF&ZQ=? zn*^1O56yK^x{y}q`j7}blGCx%dydV!c7)g~tJzmHhV=W~jbWRRR{1<^oDK+1clprm zz$eCy7y9+?{E|YgkW~}}iB#I4XoJ*xr8R?i_Hv$=Cof5bo-Nj~f`-DLebH}&0% zfQj9@WGd4;N~Y?mzQsHJTJq6!Qzl^-vwol(+fMt#Pl=Wh#lI5Vmu@QM0=_r+1wHt` z+8WZ~c2}KQQ+q)~2Ki77QvV&`xb|xVcTms99&cD$Zz4+-^R4kvUBxG8gDk7Y`K*)JZ^2rL(+ZWV~%W(@6 z)0bPArG#BROa_PHs~&WplQ_UIrpd)1N1QGPfv!J(Z9jNT#i%H?CE6|pPZb9hJ1JW4 z^q;ft#!HRNV0YgPojzIYT`8LuET2rUe-J|c!9l4`^*;4WtY@Ew@pL>wkjmMgGfN7 ze}}GtmU0@<_#08~I-Suk=^*9GLW=H4xhsml;vAV{%hy5Eegl@!6qKqbG024%n2HHw zCc@ivW_$@5ZoHP70(7D+(`PvgjW1Pd`wsiuv-aCukMrafwDm)B!xXVy*j2opohhoU zcJz%ADmj>i3`-3-$7nQKBQQuGY;2Qt&+(L~C>vSGFj5{Mlv?T_^dql;{zkpe4R1}R z%XfZyQ}wr*sr>jrKgm*PWLjuVc%6&&`Kbf1SuFpHPN&>W)$GmqC;pIoBC`=4-hPY8 zT*>%I2fP}vGW;R=^!1be?ta2UQd2>alOFFbVl;(SQJ4Jk#)4Z0^wpWEVvY4=vyDk@ zqlModi@iVPMC+{?rm=4(n+<;|lmUO@UKYA>EPTS~AndtK^Wy^%#3<;(dQdk3WaUkRtzSMC9}7x2||CNpF#(3T4C)@ z$~RWs`BNABKX|{cmBt>Q=&gkXl&x!!NK_%5hW0LS)Z4PB>%sV?F-{Wyj#s7W%$F{D zXdK^Fp3wvy+48+GP6F_|^PCRx=ddcTO3sG;B23A49~Qaw31SZ0Rc~`r4qqt%#OGW{ zCA_(LG5^N>yzUn&kAgVmxb=EA8s&tBXC}S1CZ(KoW)(%^JjLTPo^fs`Va;`=YlVPgmB$!yB}<(4ym6OeZ3xAJJ#;)2+B%p3P1Wt+d$eo`vz`T zXfUP2))kBDPoscH;Jc7I3NU<({|@wM$&GaDt`n7WLgIY3IA7A6-_R?z8N3mz|}*i z(zl5ot--Oq@f2-nv{X(ujT2T(k1vY_qh93pK@>H-qc%2Xta)IP0Q%zt%bqYgI`o!wv!0QerB`nCN^1n|@$sVOQ!V0teVG!I z_fD%JvfDeT1cK#-{o6Gv7}& zY0#NWin~kVaf$aufV&;63Hbs|`QVZWpDX6IMk1Hj2G}fiH9e-^6u2zf^FIr^BwD<6zjw63+{yUe8PUFvk8v{sJ=R{d#`O!sz`Q13~< zPT$JS(w=yQfU2`zPCNfSw=&zup@DXc(98afjhv@1w_f!m2Z>rMJ19AB&dB%P#Ls3b z=lK7OILM+SQ&VEd=1GN6o&>YVVtIzoZ%=Z_SdqJN2}E43{bE`>w+A;=y->@^k{oCC z$F*WTY&?34;kfyFV?b*Xb1Pq`Z=%OgwEg)Rz)tx=`f%5#w_INP=x&z5!jI;#;N$ma zhO)+MDm;SxOEVL15; zGq(v2pL3&P1Sl)8P*;G-fd{l1QJsv@e@d8)1PK4w2m*M%V3j-V~L^$i|&C@b?D?9tfwE{B^}Z$k8e5FmQ>v7Xz)sG32g9t}YBt zyR$+*_00RmPx+0mW+vVG4mxd(n$(eQf3-w>JPl2UJpafrPaL5@2j}%{VE-) zBI%6Qpj*dsdH<;g!S!avA~bv^0E+ zfyJbSjPb+j;J52U)<|cIcntQBI2T#>2;tOxu{%D?kML476AErF(qN9hPva5Nkc@BF zC-tLF@3ZFb%Kpj)M<{)x*l|*Ia@ECeXo2E4h2f!aV=cHAhi_E_mfUth(sM4^hJq7B zQsGWqdZUm9S%F`$nQ*_#NcuD`&)Ek%_s{&^78{9Hm ztri&rYLOxgFdG>O@+XHy z9#;|&vBCPXH5Mon^I`jSuR$&~ZWtyB67ujzFSj!51>#C}C17~TffQ{c-!QFQkTQ%! zIR^b1`zHx|*1GU?tbBx23weFLz5H?y_Q%N&t$}k?w+``2A=aotj0;2v$~AL z{scF-cL{wsdrmPvf#a9OHyYLcwQD4Kcm)`LLwMh4WT~p29f7M!iafJSU`IV}QY5Wa z(n44-9oA}?J{a+ah*@31WTs#&J#o1`H98#6IQf;Wv0N_!);f&9g7o-k(lW5rWnDUR zQBFIRG+X=6NnsI@mxnwm;tf5;_Uxg?jZ8m-m0}&6+DA!qam(p$mN5R})yA_7m$q@| zFEd|dpS595rxQr-n#GjI5i-AhnUE>Cr;jpCqSrD~EwK_DqI^7%3#p5)%T_od!t3SOmH9MyXeeGO2(UQL;ax|x?Ncixmeo1=$ z{-);Au{*tfzOG?KQ~K|ak8-HQ?`Pekhe2WM(8s{xv-p>Zmu_6{G!-oE$7$mY`MOJorI=+mMx?H;`pr!;fVYz?5~yXBACruWB`Ph zZM}90_<^OBxIhyZ9BW$`>6JvO;%VFpqVr8|7t3~AmxYak6?`Pp#c;**_SYmi`&z23 z`p6_~ePvH)C6x-G9$hgL=eVALq`-AiamN>!3~Lxw&{H(b{B(7xSRm6<3<{%{yXiH# zos5Rv1L+8fUKJLo%P>4I&$}y { - if (fd == undefined) { - console.info('[mediaLibrary]case open fd faild'); - } else { - fdNumber = fd; - fdPath = fdPath + '' + fdNumber; - console.info('[mediaLibrary]case open fd success, fd = ' + fdPath); - } - }).catch((err) => { - console.info('[mediaLibrary]case open fd faild'); - }); - } else { - console.info('[mediaLibrary]case getAllObject faild'); - } - } - - async function closeFd() { - if (fileAsset != null) { - await fileAsset[0].close(fdNumber).then(() => { - console.info('[mediaLibrary] case close fd success'); - }).catch((err) => { - console.info('[mediaLibrary] case close fd failed'); - }); - } else { - console.info('[mediaLibrary] case fileAsset is null'); - } - } - async function applyPermission(){ - let appInfo = await bundle.getApplicationInfo('ohos.acts.multimedia.image',0,100); - let atManager = abilityAccessCtrl.createAtManager(); - if(atManager != null){ - let tokenID = appInfo.accessTokenId; - console.info('[permission]case accessTokenId is' + tokenID); - let permissionName1 = 'ohos.permission.MEDIA_LOCATION'; - let permissionName2 = 'ohos.permission.READ_MEDIA'; - let permissionName3 = 'ohos.permission.WRITE_MEDIA'; - await atManager.grantUserGrantedPermission(tokenID,permissionName1).then((result)=>{ - console.info('[permission]case grantUserGrantedPermission success:' + result); - }).catch((err)=>{ - console.info('[permission]case grantUserGrantedPermission failed:' + err); - }); - await atManager.grantUserGrantedPermission(tokenID,permissionName2).then((result)=>{ - console.info('[permission]case grantUserGrantedPermission success:' + result); - }).catch((err)=>{ - console.info('[permission]case grantUserGrantedPermission failed:' + err); - }); - await atManager.grantUserGrantedPermission(tokenID,permissionName3).then((result)=>{ - console.info('[permission]case grantUserGrantedPermission success:' + result); - }).catch((err)=>{ - console.info('[permission]case grantUserGrantedPermission failed:' + err); - }); - }else{ - console.info('[permission]case apply permission failed,createAtManager failed'); - } - } - - /** - * @tc.number : TC_001 - * @tc.name : create pixelmap-promise (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer) - * @tc.desc : 1.create InitializationOptions object - * 2.set editable,pixeFormat,size - * 3.using color and opts create newPixelMap - * 4.return newpixelmap not empty - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ - it('TC_001', 0, async function (done) { - const Color = new ArrayBuffer(96); - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(Color, opts) - .then( pixelmap => { - expect(pixelmap != undefined).assertTrue(); - console.info('TC_001 success'); - done(); - }) - .catch(error => { - console.log('TC_001 error: ' + error); - expect().assertFail(); - done(); - }) - }) - - /** - * @tc.number : TC_001-1 - * @tc.name : create pixelmap-callback (editable: false, pixelFormat: RGBA_8888, size: { height: 4, width: 6 },bytes = buffer) - * @tc.desc : 1.create InitializationOptions object - * 2.set editable,pixelFormat,size - * 3.using colorand opts create newPixelMap - * 4.return newpixelmap not empty - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ - it('TC_001-1', 0, async function (done) { - const Color = new ArrayBuffer(96); - let opts = { editable: false, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(Color, opts, (err, pixelmap) => { - expect(pixelmap != undefined).assertTrue(); - console.info('TC_001-1 success'); - done(); - }) - }) - /** - * @tc.number : TC_001-2 - * @tc.name : createpixelmap-promise (editable: true, pixelFormat: RGB_565, size: { height: 6, width: 8 },bytes = buffer) - * @tc.desc : 1.create InitializationOptions object - * 2.set editable,pixelFormat,size - * 3.using colorand opts create newPixelMap - * 4.return newpixelmap not empty - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ - it('TC_001-2', 0, async function (done) { - const Color = new ArrayBuffer(96); - let opts = { editable: true, pixelFormat: 2, size: { height: 6, width: 8 } } - image.createPixelMap(Color, opts) - .then( pixelmap => { - expect(pixelmap != undefined).assertTrue(); - console.info('TC_001-2 success'); - done(); - }) - .catch(error => { - console.log('TC_001-2 error: ' + error); - expect().assertFail(); - done(); - }) - }) - - /** - * @tc.number : TC_001-3 - * @tc.name : createpixelmap-callback (editable: false, pixelFormat: RGB_565, size: { height: 6, width: 8 },bytes = buffer) - * @tc.desc : 1.create InitializationOptions object - * 2.set editable,pixelFormat,size - * 3.using colorand opts create newPixelMap - * 4.return newpixelmap not empty - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ - it('TC_001-3', 0, async function (done) { - const Color = new ArrayBuffer(96); - let opts = { editable: false, pixelFormat: 2, size: { height: 6, width: 8 } } - image.createPixelMap(Color, opts, (err, pixelmap) => { - expect(pixelmap != undefined).assertTrue(); - console.info('TC_001-3 success'); - done(); - - }) - }) - /** - * @tc.number : TC_001-4 - * @tc.name : createpixelmap-promise(editable: true, pixelFormat: unkonwn, size: { height: 6, width: 8 }) - * @tc.desc : 1.create InitializationOptions object - * 2.set editable,pixelFormat,size - * 3.using colorand opts create newPixelMap - * 4.return newpixelmap not empty - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ - it('TC_001-4', 0, async function (done) { - const Color = new ArrayBuffer(96); - let opts = { editable: true, pixelFormat: 0, size: { height: 6, width: 8 } } - image.createPixelMap(Color, opts) - .then( pixelmap => { - expect(pixelmap != undefined).assertTrue(); - console.info('TC_001-4 success'); - done(); - }) - .catch(error => { - console.log('TC_001-4 error: ' + error); - expect().assertFail(); - done(); - }) - }) - - /** - * @tc.number : TC_001-5 - * @tc.name : create pixelmap-callback(editable: false, pixelFormat: unkonwn, size: { height: 6, width: 8 }) - * @tc.desc : 1.create InitializationOptions object - * 2.set editable,pixelFormat,size - * 3.using colorand opts create newPixelMap - * 4.return newpixelmap not empty - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ - it('TC_001-5', 0, async function (done) { - const Color = new ArrayBuffer(96); - let opts = { editable: false, pixelFormat: 0, size: { height: 6, width: 8 } } - image.createPixelMap(Color, opts, (err, pixelmap) => { - expect(pixelmap != undefined).assertTrue(); - console.info('TC_001-5 success'); - done(); - }) - }) - /** - * @tc.number : TC_001-6 - * @tc.name : create pixelmap-callback(editable: true, pixelFormat: RGBA_8888, size: { height: 6, width: 8 } bytes > buffer ) - * @tc.desc : 1.create InitializationOptions object - * 2.set editable,pixeFormat,size - * 3.using color and opts create newPixelMap - * 4.return newpixelmap not empty - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ - it('TC_001-6', 0, async function (done) { - const Color = new ArrayBuffer(96); - let opts = { editable: true, pixelFormat: 3, size: { height: 6, width: 8 } } - image.createPixelMap(Color, opts, (err, pixelmap) => { - expect(pixelmap != undefined).assertTrue(); - console.info('TC_001-6 success'); - done(); - }) - }) - - /** - * @tc.number : TC_001-7 - * @tc.name : create pixelmap-callback(editable: true, pixelFormat: RGB_565, size: { height: 2, width: 3 }, bytes < buffer) - * @tc.desc : 1.create InitializationOptions object - * 2.set editable,pixeFormat,size - * 3.using color and opts create newPixelMap - * 4.return newpixelmap not empty - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ - it('TC_001-7', 0, async function (done) { - const Color = new ArrayBuffer(96); - let opts = { editable: true, pixelFormat: 2, size: { height: 2, width: 3 } } - image.createPixelMap(Color, opts, (err, pixelmap) => { - expect(pixelmap != undefined).assertTrue(); - console.info('TC_001-7 success'); - done(); - }) - }) - - /** - * @tc.number : TC_001-8 - * @tc.name : create pixelmap-callback(editable: true, pixelFormat: unkonwn, size: { height: -1, width: -1 }) - * @tc.desc : 1.create InitializationOptions object - * 2.set editable,pixeFormat,size - * 3.using color and opts create newPixelMap - * 4.return newpixelmap empty - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ - it('TC_001-8', 0, async function (done) { - const Color = new ArrayBuffer(96); - let opts = { editable: true, pixelFormat: 0, size: { height: -1, width: -1 } } - image.createPixelMap(Color, opts, (err, pixelmap) => { - expect(pixelmap == undefined).assertTrue(); - console.info('TC_001-8 success'); - done(); - }) - }) - - /** - * @tc.number : TC_001-9 - * @tc.name : create pixelmap-callback(editable: true, pixelFormat: unsupported format, size: { height: 6, width: 8 }) - * @tc.desc : 1.create InitializationOptions object - * 2.set editable,pixeFormat,size - * 3.using color and opts create newPixelMap - * 4.return newpixelmap empty - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ - it('TC_001-9', 0, async function (done) { - const Color = new ArrayBuffer(96); - let opts = { editable: true, pixelFormat: 1, size: { height: 6, width: 8 } } - image.createPixelMap(Color, opts, (err, pixelmap) => { - expect(pixelmap == undefined).assertTrue(); - console.info('TC_001-9 success'); - done(); - }) - }) - - /** - * @tc.number : TC_020 - * @tc.name : readPixelsToBuffer-promise - * @tc.desc : read all pixels to an buffer - * 1.create PixelMap,buffer - * 2.call readPixelsToBuffer - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_020', 0, async function (done) { - console.info('TC_020 in'); - const color = new ArrayBuffer(96); - var bufferArr = new Uint8Array(color); - for (var i = 0; i < bufferArr.length; i++) { - bufferArr[i] = i + 1; - } - - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts) - .then( pixelmap => { - if (pixelmap == undefined) { - console.info('TC_020 createPixelMap failed'); - expect(false).assertTrue() - done(); - } - const readBuffer = new ArrayBuffer(96); - pixelmap.readPixelsToBuffer(readBuffer).then(() => { - var bufferArr2 = new Uint8Array(readBuffer); - var res = true; - for (var i = 0; i < bufferArr2.length; i++) { - if (bufferArr2[i] != tc_020buf[i]) { - res = false; - console.info('TC_20_buffer'+ bufferArr2[i]); - console.info('TC_020 failed'); - expect(false).assertTrue(); - done(); - break; - } - } - if (res) { - console.info('TC_020 success'); - expect(true).assertTrue() - done(); - } - }).catch(error => { - console.log('TC_020 read error: ' + error); - expect().assertFail(); - done(); - }) - }).catch(error => { - console.log('TC_020 error: ' + error); - expect().assertFail(); - done(); - }) - }) - - /** - * @tc.number : TC_020-1 - * @tc.name : readPixelsToBuffer-callback - * @tc.desc : read all pixels to an buffer - * 1.create PixelMap,buffer - * 2.call readPixelsToBuffer - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_020-1', 0, async function (done) { - console.info('TC_020-1 in'); - const color = new ArrayBuffer(96); - var bufferArr = new Uint8Array(color); - for (var i = 0; i < bufferArr.length; i++) { - bufferArr[i] = i + 1; - } - - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts, (err, pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_020-1 createPixelMap failed'); - expect(false).assertTrue(); - done(); - }else{ - const readBuffer = new ArrayBuffer(96); - pixelmap.readPixelsToBuffer(readBuffer,() => { - var bufferArr = new Uint8Array(readBuffer); - var res = true; - for (var i = 0; i < bufferArr.length; i++) { - if (bufferArr[i] != tc_020_1buf[i]) { - res = false; - console.info('TC_020-1 failed'); - expect(false).assertTrue(); - done(); - break; - } - } - if (res) { - console.info('TC_020-1 success'); - expect(true).assertTrue() - done(); - } - }) - } - }) - }) - - /** - * @tc.number : TC_020-2 - * @tc.name : readPixelsToBuffer-callback(buffer:0) - * @tc.desc : read all pixels to an buffer - * 1.create PixelMap,buffer - * 2.call readPixelsToBuffer - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_020-2', 0, async function (done) { - console.info('TC_020-2 in'); - const color = new ArrayBuffer(96); - var bufferArr = new Uint8Array(color); - for (var i = 0; i < bufferArr.length; i++) { - bufferArr[i] = i + 1; - } - - let opts = { editable: true, pixelFormat: 2, size: { height: 6, width: 8 } } - image.createPixelMap(color, opts, (err,pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_020-2 createPixelMap failed'); - expect(false).assertTrue(); - done(); - }else{ - const readBuffer = new ArrayBuffer(0); - pixelmap.readPixelsToBuffer(readBuffer,() => { - var bufferArr = new Uint8Array(readBuffer); - var res = true; - for (var i = 0; i < bufferArr.length; i++) { - if (bufferArr[i] == 0) { - res = false; - console.info('TC_020-2 failed'); - expect(false).assertTrue(); - done(); - break; - } - } - if (res) { - console.info('TC_020-2 success'); - expect(true).assertTrue() - done(); - } - }) - } - }) - }) - - /** - * @tc.number : TC_021 - * @tc.name : readPixels-promise - * @tc.desc : 1.create PixelMap - * 2.call readPixels - * 3.promise return array - * 4.callbackcall return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_021', 0, async function (done) { - const color = new ArrayBuffer(96); - var bufferArr = new Uint8Array(color); - for (var i = 0; i < bufferArr.length; i++) { - bufferArr[i] = i + 1; - } - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts) - .then( pixelmap => { - if (pixelmap == undefined) { - console.info('TC_021 createPixelMap failed'); - expect(false).assertTrue() - done(); - } - const area = { pixels: new ArrayBuffer(8), - offset: 0, - stride: 8, - region: { size: { height: 1, width: 2 }, x: 0, y: 0 } - } - pixelmap.readPixels(area).then(() => { - var bufferArr2 = new Uint8Array(area.pixels); - var res = true; - for (var i = 0; i < bufferArr2.length; i++) { - if (bufferArr2[i] != tc_021buf[i]) { - res = false; - console.info('TC_021 failed'); - expect(false).assertTrue(); - done(); - break; - } - } - if (res) { - console.info('TC_021 success'); - expect(true).assertTrue() - done(); - } - }) - }) - .catch(error => { - console.log('TC_021 error: ' + error); - expect().assertFail(); - done(); - }) - }) - - /** - * @tc.number : TC_021-1 - * @tc.name : readPixels-callback - * @tc.desc : 1.create PixelMap - * 2.call readPixels - * 3.promise return array - * 4.callbackcall return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_021-1', 0, async function (done) { - const color = new ArrayBuffer(96); - var bufferArr = new Uint8Array(color); - for (var i = 0; i < bufferArr.length; i++) { - bufferArr[i] = i + 1; - } - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts, (err, pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_020-1 createPixelMap failed'); - expect(false).assertTrue(); - done(); - }else{ - const area = { pixels: new ArrayBuffer(8), - offset: 0, - stride: 8, - region: { size: { height: 1, width: 2 }, x: 0, y: 0 }} - pixelmap.readPixels(area, () => { - var bufferArr = new Uint8Array(area.pixels); - var res = true; - for (var i = 0; i < bufferArr.length; i++) { - console.info('TC_021-1 buffer ' + bufferArr[i]); - if(bufferArr[i] != tc_021_1buf[i]) { - res = false; - console.info('TC_021-1 failed'); - expect(false).assertTrue(); - done(); - break; - } - } - if (res) { - console.info('TC_021-1 success'); - expect(true).assertTrue() - done(); - } - }) - } - }) - }) - - /** - * @tc.number : TC_021-2 - * @tc.name : readPixels-callback( region: { size: { height: 1, width: 2 }, x: -1, y: -1 }) - * @tc.desc : 1.create PixelMap - * 2.call readPixels - * 3.promise return array - * 4.callbackcall return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_021-2', 0, async function (done) { - const color = new ArrayBuffer(96); - var bufferArr = new Uint8Array(color); - for (var i = 0; i < bufferArr.length; i++) { - bufferArr[i] = i + 1; - } - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts, (err,pixelmap) => { - if(pixelmap == undefined){ - expect(false).assertTrue(); - console.info('TC_021-2 create pixelmap fail'); - done(); - }else{ - const area = { pixels: new ArrayBuffer(20), - offset: 0, - stride: 8, - region: { size: { height: 1, width: 2 }, x: -1, y: -1 }} - pixelmap.readPixels(area).then(()=>{ - console.info('TC_021-2 failed'); - expect(false).assertTrue(); - done(); - }).catch(()=>{ - expect(true).assertTrue(); - console.info('TC_021-2 success'); - done(); - }) - } - }) - }) - - /** - * @tc.number : TC_021-3 - * @tc.name : readPixels-promise(buffer:0) - * @tc.desc : 1.create PixelMap - * 2.call readPixels - * 3.promise return array - * 4.callbackcall return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_021-3', 0, async function (done) { - const color = new ArrayBuffer(96); - var bufferArr = new Uint8Array(color); - for (var i = 0; i < bufferArr.length; i++) { - bufferArr[i] = i + 1; - } - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts, (err,pixelmap) => { - if(pixelmap == undefined){ - expect(false).assertTrue(); - console.info('TC_021-3 create pixelmap failed'); - done(); - }else{ - const area = { pixels: new ArrayBuffer(0), - offset: 0, - stride: 8, - region: { size: { height: 1, width: 2 }, x: 0, y: 0 }} - pixelmap.readPixels(area).then(()=>{ - console.info('TC_021-3 failed'); - expect(false).assertTrue(); - done(); - }).catch(()=>{ - expect(true).assertTrue(); - console.info('TC_021-3 success'); - done(); - }) - } - }) - }) - - /** - * @tc.number : TC_021-4 - * @tc.name : readPixels-promise(offset > buffer) - * @tc.desc : 1.create PixelMap - * 2.call readPixels - * 3.promise return array - * 4.callbackcall return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_021-4', 0, async function (done) { - const color = new ArrayBuffer(96); - var bufferArr = new Uint8Array(color); - for (var i = 0; i < bufferArr.length; i++) { - bufferArr[i] = i + 1; - } - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts, (err, pixelmap) => { - if(pixelmap == undefined){ - expect(false).assertTrue(); - console.info('TC_021-4 createPixelMap success'); - done(); - } - const area = { pixels: new ArrayBuffer(20), - offset: 21, - stride: 8, - region: { size: { height: 1, width: 2 }, x: 0, y: 0 }} - pixelmap.readPixels(area).then(()=>{ - console.info('TC_021-4 failed'); - expect(false).assertTrue(); - done(); - }).catch(()=>{ - expect(true).assertTrue(); - console.info('TC_021-4 success'); - done(); - }) - }) - }) - - /** - * @tc.number : TC_021-5 - * @tc.name : readPixels-promise(region: { size: { height: -1, width:-1}, x: 0, y: 0 }) - * @tc.desc : 1.create PixelMap - * 2.call readPixels - * 3.promise return array - * 4.callbackcall return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_021-5', 0, async function (done) { - const color = new ArrayBuffer(96); - var bufferArr = new Uint8Array(color); - for (var i = 0; i < bufferArr.length; i++) { - bufferArr[i] = i + 1; - } - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts, (err,pixelmap) => { - if(pixelmap == undefined){ - expect(false).assertTrue(); - console.info('TC_021-5 createPixelMap success'); - done(); - } - const area = { pixels: new ArrayBuffer(20), - offset: 0, - stride: 8, - region: { size: { height: -1, width:-1}, x: 0, y: 0 }} - pixelmap.readPixels(area).then(()=>{ - console.info('TC_021-5 failed'); - expect(false).assertTrue(); - done(); - }).catch(()=>{ - expect(true).assertTrue(); - console.info('TC_021-5 success'); - done(); - }) - }) - }) - - /** - * @tc.number : TC_022 - * @tc.name : writePixels-promise - * @tc.desc : 1.create PixelMap - * 2.call writePixels - * 3.call return undefined - * 4.callbackcall return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_022', 0, async function (done) { - const color = new ArrayBuffer(96); - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts) - .then( pixelmap => { - if (pixelmap == undefined) { - console.info('TC_022 createPixelMap failed'); - expect(false).assertTrue() - done(); - } - - const area = { pixels: new ArrayBuffer(8), - offset: 0, - stride: 8, - region: { size: { height: 1, width: 2 }, x: 0, y: 0 } - } - var bufferArr = new Uint8Array(area.pixels); - for (var i = 0; i < bufferArr.length; i++) { - bufferArr[i] = i + 1; - } - - pixelmap.writePixels(area).then(() => { - const readArea = { pixels: new ArrayBuffer(8), - offset: 0, - stride: 8, - region: { size: { height: 1, width: 2 }, x: 0, y: 0 } - } - pixelmap.readPixels(readArea).then(() => { - var readArr = new Uint8Array(readArea.pixels); - var res = true; - for (var i = 0; i < readArr.length; i++) { - if (readArr[i] != tc_022buf[i]) { - res = false; - console.info('TC_022 failed'); - expect(false).assertTrue(); - done(); - break; - } - } - if (res) { - console.info('TC_022 success'); - expect(true).assertTrue() - done(); - } - }) - }) - }) - .catch(error => { - console.log('TC_022 error: ' + error); - expect().assertFail(); - done(); - }) - }) - - /** - * @tc.number : TC_022-1 - * @tc.name : writePixels-callback - * @tc.desc : 1.create PixelMap - * 2.call writePixels - * 3.call return undefined - * 4.callbackcall return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_022-1', 0, async function (done) { - const color = new ArrayBuffer(96); - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts, (err, pixelmap) => { - if (pixelmap == undefined) { - console.info('TC_022-1 createPixelMap failed'); - expect(false).assertTrue() - done(); - } - const area = { - pixels: new ArrayBuffer(8), - offset: 0, - stride: 8, - region: { size: { height: 1, width: 2 }, x: 0, y: 0 } - } - var bufferArr = new Uint8Array(area.pixels); - for (var i = 0; i < bufferArr.length; i++) { - bufferArr[i] = i + 1; - } - pixelmap.writePixels(area, () => { - const readArea = { - pixels: new ArrayBuffer(8), - offset: 0, - stride: 8, - region: { size: { height: 1, width: 2 }, x: 0, y: 0 } - } - pixelmap.readPixels(readArea, () => { - var readArr = new Uint8Array(readArea.pixels); - var res = true; - for (var i = 0; i < readArr.length; i++) { - if (readArr[i] != tc_022buf[i]) { - res = false; - console.info('TC_022-1 failed'); - expect(false).assertTrue(); - done(); - break; - } - } - if (res) { - console.info('TC_022-1 success'); - expect(true).assertTrue() - done(); - } - }) - }) - }) - .catch(error => { - console.log('TC_022-1 error: ' + error); - expect().assertFail(); - done(); - }) - }) - - /** - * @tc.number : TC_023 - * @tc.name : writeBufferToPixels-promise - * @tc.desc : 1.create PixelMap,buffer - * 2.call writeBufferToPixels - * 3.call return undefined - * 4.callbackcall return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_023', 0, async function (done) { - const color = new ArrayBuffer(96); - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 }} - image.createPixelMap(color, opts) - .then( pixelmap => { - if (pixelmap == undefined) { - console.info('TC_023 createPixelMap failed'); - expect(false).assertTrue() - done(); - } - - const writeColor = new ArrayBuffer(96); - var bufferArr = new Uint8Array(writeColor); - for (var i = 0; i < bufferArr.length; i++) { - bufferArr[i] = i + 1; - } - pixelmap.writeBufferToPixels(writeColor).then(() => { - const readBuffer = new ArrayBuffer(96); - pixelmap.readPixelsToBuffer(readBuffer).then(() => { - var bufferArr = new Uint8Array(readBuffer); - var res = true; - for (var i = 0; i < bufferArr.length; i++) { - if (bufferArr[i] == 0) { - res = false; - console.info('TC_023 failed'); - expect(false).assertTrue() - done(); - break; - } - } - if (res) { - console.info('TC_023 success'); - expect(true).assertTrue(); - done(); - } - }) - }) - }) - .catch(error => { - console.log('TC_023 error: ' + error); - expect().assertFail(); - done(); - }) - }) - - /** - * @tc.number : TC_023-1 - * @tc.name : writeBufferToPixels-callback - * @tc.desc : 1.create PixelMap,buffer - * 2.call writeBufferToPixels - * 3.call return undefined - * 4.callbackcall return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_023-1', 0, async function (done) { - const color = new ArrayBuffer(96); - var bufferArr = new Uint8Array(color); - for (var i = 0; i < bufferArr.length; i++) { - bufferArr[i] = i + 1; - } - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts).then( pixelmap => { - if(pixelmap == undefined){ - expect(false).assertTrue() - console.info('TC_023-1 failed'); - done(); - } - const writeColor = new ArrayBuffer(96); - pixelmap.writeBufferToPixels(writeColor,() => { - const readBuffer = new ArrayBuffer(96); - pixelmap.readPixelsToBuffer(readBuffer,() => { - var bufferArr = new Uint8Array(readBuffer); - var res = true; - for (var i = 0; i < bufferArr.length; i++) { - if(res) { - if (bufferArr[i] == 0) { - res = false; - console.info('TC_023-1 Success'); - expect(true).assertTrue() - done(); - break; - } - } - } - if (res) { - console.info('TC_023-1 no change after writeBuffer'); - expect(false).assertTrue(); - done(); - } - }) - }) - }) - }) - - /** - * @tc.number : TC_024 - * @tc.name : getImageInfo-pixelmap-promise - * @tc.desc : 1.create PixelMap,ImageInfo - * 2.call getImageInfo - * 3.call return imageinfo - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_024', 0, async function (done) { - const color = new ArrayBuffer(96); - let opts = { editable: true, pixelFormat: 2, size: { height: 6, width: 8 } } - image.createPixelMap(color, opts) - .then( pixelmap => { - if (pixelmap == undefined) { - console.info('TC_024 createPixelMap failed'); - expect(false).assertTrue() - done(); - } - pixelmap.getImageInfo().then( imageInfo => { - if (imageInfo == undefined) { - console.info('TC_024 imageInfo is empty'); - expect(false).assertTrue() - done(); - } - if(imageInfo.size.height == 4 && imageInfo.size.width == 6){ - console.info('TC_024 success '); - expect(true).assertTrue() - done(); - } - done(); - }).catch(error => { - console.log('TC_024 getimageinfo error: ' + error); - expect().assertFail(); - done(); - }) - done(); - }) - .catch(error => { - console.log('TC_024 error: ' + error); - expect().assertFail(); - done(); - }) - }) - - /** - * @tc.number : TC_024-1 - * @tc.name : getImageInfo-pixelmap-callback - * @tc.desc : 1.create PixelMap,ImageInfo - * 2.call getImageInfo - * 3.call return imageinfo - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_024-1', 0, async function (done) { - const color = new ArrayBuffer(96); - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts, (err,pixelmap) => { - if(pixelmap == undefined){ - expect(false).assertTrue() - console.info('TC_024-1 create pixelmap fail'); - done(); - } - pixelmap.getImageInfo( (err,imageInfo) => { - if (imageInfo == undefined) { - console.info('TC_024-1 imageInfo is empty'); - expect(false).assertTrue() - done(); - } - if(imageInfo.size.height == 4 && imageInfo.size.width == 6){ - console.info('TC_024-1 imageInfo success'); - expect(true).assertTrue() - done(); - } - done(); - }) - }) - }) - - /** - * @tc.number : TC_025-1 - * @tc.name : getBytesNumberPerRow - * @tc.desc : 1.create PixelMap - * 2.set PixelMap - * 3.call getBytesNumberPerRow - * 4. call return number - * 5.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_025-1', 0, async function (done) { - const color = new ArrayBuffer(96); - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - const expectNum = 4 * opts.size.width; - image.createPixelMap(color, opts, (err,pixelmap) => { - if(pixelmap == undefined){ - expect(false).assertTrue() - console.info('TC_25-1 create pixelmap fail'); - done(); - } else { - const num = pixelmap.getBytesNumberPerRow(); - console.info('TC_025-1 num is ' + num); - expect(num == expectNum).assertTrue(); - if(num == expectNum) { - console.info('TC_25-1 success'); - } else { - console.info('TC_25-1 fail'); - } - done(); - } - }) - }) - - /** - * @tc.number : TC_026-1 - * @tc.name : getPixelBytesNumber - * @tc.desc : 1.create PixelMap - * 2.set Pixel - * 3.call getPixelBytesNumber - * 4. call return number - * 5.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_026-1', 0, async function (done) { - const color = new ArrayBuffer(96); - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - const expectNum = 4 * opts.size.width * opts.size.height; - image.createPixelMap(color, opts,(err,pixelmap) => { - if(pixelmap == undefined){ - expect(false).assertTrue() - console.info('TC_026-1 create pixelmap fail'); - done(); - } else { - const num = pixelmap.getPixelBytesNumber(); - console.info('TC_026-1 num is ' + num); - expect(num == expectNum).assertTrue(); - if(num == expectNum) { - console.info('TC_026-1 success'); - } else { - console.info('TC_026-1 fail'); - } - done(); - } - }) - }) - - /** - * @tc.number : TC_027 - * @tc.name : release-pixelmap-promise - * @tc.desc : 1.create PixelMap - * 2.set Pixel - * 3.call release - * 4.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_027', 0, async function (done) { - const color = new ArrayBuffer(96); - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts).then(pixelmap => { - if (pixelmap == undefined) { - console.info('TC_027 createPixelMap failed'); - expect(false).assertTrue() - done(); - } - pixelmap.release().then(() => { - console.info('TC_027 success'); - expect(true).assertTrue(); - done(); - }).catch(error => { - console.log('TC_027 error: ' + error); - expect().assertFail(); - done(); - }) - }).catch(error => { - console.log('TC_027 createPixelMap failed error: ' + error); - expect().assertFail(); - done(); - }) - }) - - /** - * @tc.number : TC_027-1 - * @tc.name : release-pixelmap-callback - * @tc.desc : 1.create PixelMap - * 2.set Pixel - * 3.call release - * 4.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_027-1', 0, async function (done) { - const color = new ArrayBuffer(96); - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts, (err, pixelmap) => { - if (pixelmap == undefined) { - console.info('TC_027-1 createPixelMap failed'); - expect(false).assertTrue() - done(); - } - pixelmap.release(()=>{ - expect(true).assertTrue(); - console.log('TC_027-1 success'); - done(); - }) - }) - }) - - /** - * @tc.number : TC_041 - * @tc.name : createImageSource(uri)-jpg - * @tc.desc : 1.set uri - * 2.call createImageSource(uri) - * 3.return imagesource - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ - it('TC_041', 0, async function (done) { - await getFd("test.jpg"); - - const imageSourceApi = image.createImageSource(fdNumber); - expect(imageSourceApi != undefined).assertTrue(); - console.info('TC_041 success'); - done(); - }) - - /** - * @tc.number : TC_041-1 - * @tc.name : createImageSource(uri)-bmp - * @tc.desc : 1.seturi - * 2.call createImageSource(uri) - * 3.return imagesource - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ - it('TC_041-1', 0, async function (done) { - await getFd("test.bmp"); - const imageSourceApi = image.createImageSource(fdNumber); - expect(imageSourceApi != undefined).assertTrue(); - console.info('TC_041-1 success'); - done(); - }) - - /** - * @tc.number : TC_041-2 - * @tc.name : createImageSource(uri)-gif - * @tc.desc : 1.seturi - * 2.call createImageSource(uri) - * 3.return imagesource - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ - it('TC_041-2', 0, async function (done) { - await getFd("test.gif"); - const imageSourceApi = image.createImageSource(fdNumber); - expect(imageSourceApi != undefined).assertTrue(); - console.info('TC_041-2 success'); - done(); - }) - - /** - * @tc.number : TC_041-3 - * @tc.name : createImageSource(uri)-png - * @tc.desc : 1.seturi - * 2.call createImageSource(uri) - * 3.return imagesource - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ - it('TC_041-3', 0, async function (done) { - await getFd("test.png"); - const imageSourceApi = image.createImageSource(fdNumber); - expect(imageSourceApi != undefined).assertTrue(); - console.info('TC_041-3 success'); - done(); - }) - - /** - * @tc.number : TC_041-4 - * @tc.name : createImageSource(uri)-wrong suffix file - * @tc.desc : 1.call createImageSource(uri) - * 2.Incoming wrong suffix file - * 3.imagesource null - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ - it('TC_041-4', 0, async function (done) { - const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.123'); - expect(imageSourceApi == undefined).assertTrue(); - console.info('TC_041-4 success'); - done(); - }) - - /** - * @tc.number : TC_041-5 - * @tc.name : createImageSource(uri)-wrong uri - * @tc.desc : 1.call createImageSource(uri) - * 2.set wrong uri - * 3.return null - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ - it('TC_041-5', 0, async function (done) { - const imageSourceApi = image.createImageSource('file:///multimedia/test.jpg'); - expect(imageSourceApi == undefined).assertTrue(); - console.info('TC_041-5 success'); - done(); - }) - - /** - * @tc.number : TC_042 - * @tc.name : createImageSource(fd) - * @tc.desc : 1.call createImageSource - * 2.set fd - * 3.return imagesource - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ - it('TC_042', 0, async function (done) { - await getFd("test.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_042 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.getImageInfo((err,imageInfo) => { - if (err){ - expect(false).assertTrue(); - console.info('TC_042 err: ' + err); - done(); - return - } - if (imageInfo != undefined){ - console.info('TC_042 success'); - console.info('TC_042 imageInfo height: ' + imageInfo.size.height); - console.info('TC_042 imageInfo width: ' + imageInfo.size.width); - expect(true).assertTrue(); - done(); - }else{ - console.info('TC_042 failed'); - expect(false).assertTrue(); - done(); - } - - }) - } - }) - - /** - * @tc.number : TC_042-1 - * @tc.name : createImageSource(fd) fd<0 - * @tc.desc : 1.call createImageSource - * 2.set wrong fd - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ - it('TC_042-1', 0, async function (done) { - const imageSourceApi = image.createImageSource(-2); - expect(imageSourceApi == undefined).assertTrue(); - console.info('TC_042-1 success'); - done(); - }) - - /** - * @tc.number : TC_043 - * @tc.name : createImageSource(data) - * @tc.desc : 1.setdata - * 2.createImageSource - * 3.return imagesource - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ - it('TC_043', 0, async function (done) { - console.info('TC_043 start'); - const data = testJpg.buffer; - const imageSourceApi = image.createImageSource(data); - if (imageSourceApi == undefined) { - console.info('TC_043 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.getImageInfo((err,imageInfo) => { - console.info('TC_043 imageInfo'); - expect(imageInfo != undefined).assertTrue(); - done(); - }) - } - }) - - /** - * @tc.number : TC_043-1 - * @tc.name : createImageSource(data) buffer:0 - * @tc.desc : 1.setdata - * 2.createImageSource - * 3.return imagesource - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ - it('TC_043-1', 0, async function (done) { - console.info('TC_043-1 start'); - const data = new ArrayBuffer(0); - const imageSourceApi = image.createImageSource(data); - expect(imageSourceApi == undefined).assertTrue(); - console.info('TC_043-1 success'); - done(); - }) - - /** - * @tc.number : TC_044 - * @tc.name : release-imagesource-promise-jpg - * @tc.desc : 1.create ImageSource - * 2.call release() - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_044', 0, async function (done) { - await getFd("test.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_044 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.release().then(()=>{ - console.info('TC_044 success'); - expect(true).assertTrue(); - done(); - }).catch(error => { - console.info('TC_044 error'); - expect(false).assertTrue(); - done(); - }) - } - }) - - /** - * @tc.number : TC_044-1 - * @tc.name : release-imagesource-callback-jpg - * @tc.desc : 1.create ImageSource - * 2.call release() - * 3.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_044-1', 0, async function (done) { - await getFd("test.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_044-1 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.release(() => { - console.info('TC_044-1 Success'); - expect(true).assertTrue(); - done(); - }) - } - }) - - /** - * @tc.number : TC_045-1 - * @tc.name : getImageInfo(callback: AsyncCallback)-bmp - * @tc.desc : 1.create imageSource - * 2.imageSourcecall getImageInfo(ImageInfo) - * 3.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_045-1', 0, async function (done) { - await getFd("test.bmp"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_045-1 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.getImageInfo((err,imageInfo) => { - expect(imageInfo != undefined).assertTrue(); - console.info('TC_045-1 imageInfo'); - console.info('imageInfo.size.height:'+imageInfo.size.height); - console.info('imageInfo.size.width:'+imageInfo.size.width); - done(); - }) - } - }) - - /** - * @tc.number : TC_045-2 - * @tc.name : getImageInfo(callback: AsyncCallback)-png - * @tc.desc : 1.create imageSource - * 2.imageSourcecall getImageInfo(ImageInfo) - * 3.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_045-2', 0, async function (done) { - await getFd("test.png"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_045-2 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.getImageInfo((err,imageInfo) => { - expect(imageInfo != undefined).assertTrue(); - console.info('TC_045-2 imageInfo'); - console.info('imageInfo.size.height:'+imageInfo.size.height); - console.info('imageInfo.size.width:'+imageInfo.size.width); - done(); - }) - } - }) - - /** - * @tc.number : TC_045-3 - * @tc.name : getImageInfo(callback: AsyncCallback)-gif - * @tc.desc : 1.create ImageInfo - * 2.call getImageInfo(index, ImageInfo) - * 3.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_045-3', 0, async function (done) { - await getFd("test.gif"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_045-3 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.getImageInfo((err,imageInfo) => { - if (err){ - expect(false).assertTrue(); - console.info('TC_045-3 error' + err); - done(); - return - } - if (imageInfo != undefined && imageInfo != null){ - expect(true).assertTrue(); - console.info('TC_045-3 imageInfo.size.height:' + imageInfo.size.height); - console.info('TC_045-3 imageInfo.size.width:'+imageInfo.size.width); - console.info('TC_045-3 success') - done(); - }else{ - expect(false).assertTrue(); - console.info('TC_045-3 failed') - done(); - } - }) - } - }) - - /** - * @tc.number : TC_046 - * @tc.name : getImageInfo(index: number, callback: AsyncCallback)-jpg - * @tc.desc : 1.create ImageInfo - * 2.call getImageInfo(index, ImageInfo) - * 3.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_046', 0, async function (done) { - await getFd("test.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_046 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.getImageInfo(0, (err, imageInfo) => { - console.info('TC_046 imageInfo'); - expect(imageInfo != undefined).assertTrue(); - console.info('imageInfo.size.height:'+imageInfo.size.height); - console.info('imageInfo.size.width:'+imageInfo.size.width); - done(); - }) - } - }) - - /** - * @tc.number : TC_046-1 - * @tc.name : getImageInfo(index: number, callback: AsyncCallback)-bmp - * @tc.desc : 1.create ImageInfo - * 2.call getImageInfo(index, ImageInfo) - * 3.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_046-1', 0, async function (done) { - await getFd("test.bmp"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_046-1 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.getImageInfo(0, (err, imageInfo) => { - expect(imageInfo != undefined).assertTrue(); - console.info('TC_046-1 imageInfo.size.height:'+imageInfo.size.height); - console.info('TC_046-1 imageInfo.size.width:'+imageInfo.size.width); - done(); - }) - } - }) - - /** - * @tc.number: TC_046-2 - * @tc.name : getImageInfo(index: number, callback: AsyncCallback)-png - * @tc.desc : 1.create ImageInfo - * 2.call getImageInfo(index, ImageInfo) - * 3.callback return undefined - * @tc.size : MEDIUM MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_046-2', 0, async function (done) { - await getFd("test.png"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_046-2 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.getImageInfo(0, (err, imageInfo) => { - expect(imageInfo != undefined).assertTrue(); - console.info('TC_046-2 imageInfo'); - console.info('imageInfo.size.height:'+imageInfo.size.height); - console.info('imageInfo.size.width:'+imageInfo.size.width); - done(); - }) - } - }) - - /** - * @tc.number: TC_046-3 - * @tc.name : getImageInfo(index: number, callback: AsyncCallback)-gif - * @tc.desc : 1.create ImageInfo - * 2.call getImageInfo(index, ImageInfo) - * 3.callback return undefined - * @tc.size : MEDIUM MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_046-3', 0, async function (done) { - await getFd("test.gif"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_046-3 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.getImageInfo(0,(err, imageInfo) => { - if (err){ - expect(false).assertTrue(); - console.info('TC_046-3 error' + err); - done(); - return - } - if (imageInfo != undefined && imageInfo != null){ - expect(true).assertTrue(); - console.info('TC_046-3 imageInfo.size.height:' + imageInfo.size.height); - console.info('TC_046-3 imageInfo.size.width:'+imageInfo.size.width); - console.info('TC_046-3 success') - done(); - }else{ - expect(false).assertTrue(); - console.info('TC_046-3 failed') - done(); - } - }) - } - }) - - /** - * @tc.number: TC_046-4 - * @tc.name : getImageInfo(index: number, callback: AsyncCallback)-gif(frame:1)-index:1 - * @tc.desc : 1.create ImageInfo - * 2.call getImageInfo(index, ImageInfo) - * 3.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_046-4', 0, async function (done) { - await getFd("test.gif"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_046-4 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.getImageInfo(1, (err, imageInfo) => { - if(imageInfo == undefined) { - expect(true).assertTrue(); - done(); - } else { - expect(false).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number: TC_046-5 - * @tc.name : getImageInfo(index: number, callback: AsyncCallback)-gif-index:-1 - * @tc.desc : 1.create ImageInfo - * 2.call getImageInfo(index, ImageInfo) - * 3.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_046-5', 0, async function (done) { - await getFd("test.gif"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_046-5 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.getImageInfo(-1, (err, imageInfo) => { - expect(imageInfo == undefined).assertTrue(); - done(); - }) - } - }) - - /** - * @tc.number : TC_047 - * @tc.name : getImageInfo(index?: number): Promise-jpg - * @tc.desc : 1.create imagesource - * 2.call getImageInfo(index) - * 3.callbackcall ,return imageinfo - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_047', 0, async function (done) { - await getFd("test.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_047 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.getImageInfo(0) - .then(imageInfo => { - expect(imageInfo != undefined).assertTrue(); - console.info('TC_047 imageInfo'); - console.info('imageInfo.size.height:'+imageInfo.size.height); - console.info('imageInfo.size.width:'+imageInfo.size.width); - done(); - }).catch(error => { - console.log('TC_047 error: ' + error); - expect().assertFail(); - done(); - }) - } - }) - - /** - * @tc.number : TC_047-1 - * @tc.name : getImageInfo(index?: number): Promise-bmp - * @tc.desc : 1.create imagesource - * 2.call getImageInfo(index) - * 3.callbackcall ,return imageinfo - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_047-1', 0, async function (done) { - await getFd("test.bmp"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_047-1 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.getImageInfo(0) - .then(imageInfo => { - expect(imageInfo != undefined).assertTrue(); - console.info('TC_047-1 imageInfo'); - console.info('imageInfo.size.height:'+imageInfo.size.height); - console.info('imageInfo.size.width:'+imageInfo.size.width); - done(); - }).catch(error => { - console.log('TC_047-1 error: ' + error); - expect().assertFail(); - done(); - }) - } - }) - - /** - * @tc.number : TC_047-2 - * @tc.name : getImageInfo(index?: number): Promise-png - * @tc.desc : 1.create imagesource - * 2.call getImageInfo(index) - * 3.callbackcall ,return imageinfo - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_047-2', 0, async function (done) { - await getFd("test.png"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_047-2 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.getImageInfo(0) - .then(imageInfo => { - expect(imageInfo != undefined).assertTrue(); - console.info('TC_047-2 imageInfo'); - console.info('imageInfo.size.height:'+imageInfo.size.height); - console.info('imageInfo.size.width:'+imageInfo.size.width); - done(); - }).catch(error => { - console.log('TC_047-2 error: ' + error); - expect().assertFail(); - done(); - }) - } - }) - - /** - * @tc.number : TC_047-3 - * @tc.name : getImageInfo(index?: number): Promise-gif - * @tc.desc : 1.create imagesource - * 2.call getImageInfo(index) - * 3.callbackcall ,return imageinfo - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_047-3', 0, async function (done) { - await getFd("test.gif"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_047-3 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.getImageInfo(0) - .then(imageInfo => { - if (imageInfo != undefined && imageInfo != null){ - expect(true).assertTrue(); - console.info('TC_047-3 imageInfo.size.height:'+imageInfo.size.height); - console.info('TC_047-3 imageInfo.size.width:'+imageInfo.size.width); - done(); - }else{ - expect(false).assertTrue(); - console.info('TC_047-3 failed'); - done(); - } - }).catch(error => { - console.log('TC_047-3 error: ' + error); - expect().assertFail(); - done(); - }) - } - }) - - /** - * @tc.number: TC_047-4 - * @tc.name : getImageInfo(index?: number): Promise-gif(frame:1)-index:1 - * @tc.desc : 1.create imagesource - * 2.call getImageInfo(index=1) - * 3.callback return imageinfo undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_047-4', 0, async function (done) { - await getFd("test.gif"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_047-4 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.getImageInfo(1) - .then(() => { - console.log('TC_047-4 failed'); - expect().assertFail(); - done(); - }).catch(error => { - console.log('TC_047-4 success'); - expect(true).assertTrue(); - done(); - }) - } - }) - - /** - * @tc.number : TC_047-5 - * @tc.name : getImageInfo(index?: number): Promise-gif-index:-1 - * @tc.desc : 1.create imagesource - * 2.call getImageInfo(index=-1) - * 3.callback return imageinfo undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_047-5', 0, async function (done) { - await getFd("test.gif"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_047-5 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.getImageInfo(-1) - .then(() => { - console.log('TC_047-5 failed'); - expect().assertFail(); - done(); - }).catch(error => { - console.log('TC_047-5 success'); - expect(true).assertTrue(); - done(); - }) - } - }) - - /** - * @tc.number : TC_050 - * @tc.name : createPixelMap(decodingOptions)-pixelformat:RGBA_8888-jpg - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_050', 0, async function (done) { - - await getFd("test.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_050 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:3, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { - console.info('TC_050 success '); - expect(pixelmap != undefined ).assertTrue(); - done(); - }) - } - }) - /** - * @tc.number : TC_050-1 - * @tc.name : createPixelMap(decodingOptions)-pixelformat:RGB_565-jpg - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_050-1', 0, async function (done) { - - await getFd("test.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_050-1 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { - console.info('TC_050-1 success '); - expect(pixelmap != undefined ).assertTrue(); - done(); - }) - } - }) - /** - * @tc.number : TC_050-2 - * @tc.name : createPixelMap(decodingOptions)-pixelformat:unknown-jpg - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return null - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_050-2', 0, async function (done) { - - await getFd("test.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_050-2 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:0, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { - console.info('TC_050-2 success '); - expect(pixelmap != undefined ).assertTrue(); - done(); - }) - } - }) - /** - * @tc.number : TC_050-3 - * @tc.name : createPixelMap(decodingOptions: index 1})-jpg - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_050-3', 0, async function (done) { - - await getFd("test.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_050-3 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:0, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:1 - }; - imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_050-3 success '); - expect(true).assertTrue(); - done(); - }else{ - expect(false).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_050-4 - * @tc.name : createPixelMap(decodingOptions:index -1})-jpg - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_050-4', 0, async function (done) { - - await getFd("test.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_050-4 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:0, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:-1 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ - console.error('TC_050-4 success'); - expect(true).assertTrue(); - done(); - }else{ - expect(false).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_050-5 - * @tc.name : createPixelMap(decodingOptions:sampleSize -1})-jpg - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_050-5', 0, async function (done) { - - await getFd("test.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_050-5 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:-1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:0, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_050-5 success '); - expect(true).assertTrue(); - done(); - }else{ - expect(false).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_050-6 - * @tc.name : createPixelMap(decodingOptions:rotate -10})-jpg - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_050-6', 0, async function (done) { - - await getFd("test.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_050-6 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:-10, - desiredPixelFormat:2, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_050-6 success '); - expect(true).assertTrue(); - done(); - }else{ - expect(false).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_050-7 - * @tc.name : createPixelMap(decodingOptions:unsupported pixelformat)-jpg - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_050-7', 0, async function (done) { - - await getFd("test.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_050-7 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:60, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_050-7 success '); - expect(true).assertTrue(); - done(); - }else{ - expect(false).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_050-8 - * @tc.name : createPixelMap(decodingOptions:editable false})-jpg - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_050-8', 0, async function (done) { - - await getFd("test.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_050-8 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: false, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - console.info('TC_050-8 success'); - expect(pixelmap != undefined ).assertTrue(); - done(); - }) - } - }) - - /** - * @tc.number : TC_050-9 - * @tc.name : createPixelMap(decodingOptions:desiredSize>imagesize)-jpg - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_050-9', 0, async function (done) { - - await getFd("test.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_050-9 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:10000, height:10000}, - rotate:10, - desiredPixelFormat:2, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - console.info('TC_050-9 success '); - expect(pixelmap != undefined ).assertTrue(); - done(); - }) - } - }) - - /** - * @tc.number : TC_050-10 - * @tc.name : createPixelMap(decodingOptions:desiredRegion>imagesize)-jpg - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_050-10', 0, async function (done) { - - await getFd("test.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_050-10 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, - desiredRegion: { size: { height: 10000, width: 10000 }, x: 0, y: 0 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_050-10 success '); - expect(true).assertTrue(); - done(); - }else{ - expect(false).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_050-11 - * @tc.name : createPixelMapdecodingOptions:x -1 y -1)-jpg - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_050-11', 0, async function (done) { - - await getFd("test.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_050-11 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, - desiredRegion: { size: { height: 1, width: 2 }, x: -1, y: -1 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_050-11 success '); - expect(true).assertTrue(); - done(); - }else{ - expect(false).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_050-12 - * @tc.name : createPixelMap(decodingOptions:x > image.height y > image.width)-jpg - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_050-12', 0, async function (done) { - - await getFd("test.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_050-12 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, - desiredRegion: { size: { height: 1, width: 2 }, x: 10000, y: 10000 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_050-12 success '); - expect(true).assertTrue(); - done(); - }else{ - expect(false).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_050-13 - * @tc.name : createPixelMap(decodingOptions:rotate>360)-jpg - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_050-13', 0, async function (done) { - - await getFd("test.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_050-13 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:500, - desiredPixelFormat:2, - desiredRegion: { size: { height: 1, width: 2 }, x: 1, y: 2 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_050-13 success '); - expect(true).assertTrue(); - done(); - }else{ - expect(false).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_05s0-14 - * @tc.name : createPixelMap-promise-jpg - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_050-14', 0, async function (done) { - - await getFd("test.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_050-14 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.createPixelMap().then(pixelmap => { - console.info('TC_050-14 success '); - expect(pixelmap != undefined ).assertTrue(); - done(); - }).catch(error => { - console.log('TC_050-14 error: ' + error); - expect().assertFail(); - done(); - }) - } - }) - - /** - * @tc.number : TC_050-15 - * @tc.name : createPixelMap-callback-jpg - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return null - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_050-15', 0, async function (done) { - - await getFd("test.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_050-15 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.createPixelMap((err, pixelmap) => { - console.info('TC_050-15 success '); - expect(pixelmap != undefined ).assertTrue(); - done(); - }) - } - }) - - /** - * @tc.number : TC_053 - * @tc.name : createIncrementalSource-updateData-png - * @tc.desc : 1.create imagesource - * 2.update data - * 3.create pixelmap - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_053', 0, async function (done) { - try { - let testimagebuffer = testPng; - console.info('TC_053 0003 ' + testimagebuffer.length); - let bufferSize = testimagebuffer.length; - let offset = 0; - const incSouce = image.createIncrementalSource(new ArrayBuffer(1)); - let ret; - let isFinished = false; - while (offset < testimagebuffer.length) { - console.info('TC_053 0006 ' + testimagebuffer.length); - var oneStep = testimagebuffer.slice(offset, offset + bufferSize); - console.info('TC_053 0007 ' + oneStep.length); - if (oneStep.length < bufferSize) { - isFinished = true; - } - ret = await incSouce.updateData(oneStep, isFinished, 0, oneStep.length); - if (!ret) { - console.info('TC_053 updateData failed'); - expect(ret).assertTrue(); - break; - } - offset = offset + oneStep.length; - console.info('TC_053 0011 ' + offset); - } - if (ret) { - console.info('TC_053 updateData success '); - let decodingOptions = { - sampleSize:1 - }; - incSouce.createPixelMap(decodingOptions, (err, pixelmap) => { - console.info('TC_053 0014' + pixelmap); - expect(pixelmap != undefined ).assertTrue(); - done(); - }) - } else { - done(); - } - } catch (error) { - console.info('TC_053 updateData failed ' + error); - } - }) - - /** - * @tc.number : TC_053-1 - * @tc.name : createIncrementalSource-updateData-jpg - * @tc.desc : 1.create imagesource - * 2.update data - * 3.create pixelmap - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_053-1', 0, async function (done) { - try { - let testimagebuffer = testJpg; - console.info('TC_053-1 0003 ' + testimagebuffer.length); - let bufferSize = testimagebuffer.length; - let offset = 0; - const incSouce = image.createIncrementalSource(new ArrayBuffer(1)); - let isFinished = false; - let ret; - while (offset < testimagebuffer.length) { - console.info('TC_053-1 0006 ' + testimagebuffer.length); - var oneStep = testimagebuffer.slice(offset, offset + bufferSize); - console.info('TC_053-1 0007 ' + oneStep.length); - if (oneStep.length < bufferSize) { - isFinished = true; - } - ret = await incSouce.updateData(oneStep, isFinished, 0, oneStep.length); - if (!ret) { - console.info('TC_053-1 updateData failed'); - expect(ret).assertTrue(); - break; - } - offset = offset + oneStep.length; - console.info('TC_053-1 0011 ' + offset); - } - if (ret) { - console.info('TC_053-1 updateData success '); - let decodingOptions = { - sampleSize:1 - }; - incSouce.createPixelMap(decodingOptions, (err, pixelmap) => { - expect(pixelmap != undefined ).assertTrue(); - done(); - }) - } else { - done(); - } - } catch (error) { - console.info('TC_053-1 updateData failed ' + error); - } - }) - - /** - * @tc.number : TC_062 - * @tc.name : packing ImageSource - promise - * @tc.desc : 1.create ImageSource - * 2.call packing - * 3.return array - * 4.callbackcall return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_062', 0, async function (done) { - await getFd("test00.png"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_062 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - const imagePackerApi = image.createImagePacker(); - if (imagePackerApi == undefined) { - console.info('TC_062 create image packer failed'); - expect(false).assertTrue(); - done(); - } else { - let packOpts = { format:["image/jpeg"], quality:99 } - imagePackerApi.packing(imageSourceApi, packOpts) - .then( data => { - console.info('TC_062 success'); - expect(data != undefined).assertTrue(); - done(); - }).catch(error => { - console.log('TC_062 error: ' + error); - expect(false).assertFail(); - done(); - }) - } - } - }) - - /** - * @tc.number : TC_062-1 - * @tc.name : packing ImageSource - callback - * @tc.desc : 1.create ImageSource - * 2.call packing - * 3.return array - * 4.callbackcall return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_062-1', 0, async function (done) { - await getFd("test01.png"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_062-1 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - const imagePackerApi = image.createImagePacker(); - if (imagePackerApi == undefined) { - console.info('TC_062-1 create image packer failed'); - expect(false).assertTrue(); - done(); - } else { - let packOpts = { format:["image/jpeg"], quality:1 } - imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => { - console.info('TC_062-1 success'); - expect(data != undefined).assertTrue(); - done(); - }) - } - } - }) - - /** - * @tc.number : TC_062-2 - * @tc.name : packing ImageSource - callback - wrong format - * @tc.desc : 1.create ImageSource - * 2.call packing - * 3.return array - * 4.callbackcall return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_062-2', 0, async function (done) { - await getFd("test02.png"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_062-2 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - const imagePackerApi = image.createImagePacker(); - if (imagePackerApi == undefined) { - console.info('TC_062-2 create image packer failed'); - expect(false).assertTrue(); - done(); - } else { - let packOpts = { format:["image/gif"], quality:98 } - imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => { - console.info('TC_062-2 success'); - expect(data == undefined).assertTrue(); - console.info(data); - done(); - }) - } - } - }) - - /** - * @tc.number : TC_062-3 - * @tc.name : packing ImageSource - callback - wrong quality - * @tc.desc : 1.create ImageSource - * 2.call packing - * 3.call return array - * 4.callbackcall return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_062-3', 0, async function (done) { - await getFd("test03.png"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_062-3 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - const imagePackerApi = image.createImagePacker(); - if (imagePackerApi == undefined) { - console.info('TC_062-3 create image packer failed'); - expect(false).assertTrue(); - done(); - } else { - let packOpts = { format:["image/jpeg"], quality:101 } - imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => { - console.info('TC_062-3 success'); - expect(data == undefined).assertTrue(); - console.info(data); - done(); - }) - } - } - }) - - /** - * @tc.number : TC_062-4 - * @tc.name : createImagePacker - * @tc.desc : 1.create ImageSource - * 2.call packing - * 3.return array - * 4.callbackcall return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_062-4', 0, async function (done) { - await getFd("test04.png"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_062-4 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - const imagePackerApi = image.createImagePacker(); - if (imagePackerApi == undefined) { - console.info('TC_062-4 create image packer failed'); - expect(false).assertTrue(); - done(); - } else { - console.info('TC_062-4 create image packer success'); - expect(true).assertTrue(); - done(); - } - } - }) - - /** - * @tc.number : TC_062-5 - * @tc.name : packing ImageSource - promise - no quality - * @tc.desc : 1.create ImageSource - * 2.call packing - * 3.call return array - * 4.callbackcall return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - - it('TC_062-5', 0, async function (done) { - await getFd("test05.png"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_062-5 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - const imagePackerApi = image.createImagePacker(); - if (imagePackerApi == undefined) { - console.info('TC_062-5 create image packer failed'); - expect(false).assertTrue(); - done(); - } else { - let packOpts = { format:["image/jpeg"] } - imagePackerApi.packing(imageSourceApi, packOpts) - .then( data => { - console.info('TC_062-5 failed'); - expect(data == undefined).assertTrue(); - done(); - }).catch(error => { - console.log('TC_062-5 error: ' + error); - console.log('TC_062-5 success'); - expect(true).assertTrue(); - done(); - }) - } - } - }) - - - /** - * @tc.number : TC_062-6 - * @tc.name : packing ImageSource - promise - no format - * @tc.desc : 1.create ImageSource - * 2.call packing - * 3.call return array - * 4.callbackcall return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_062-6', 0, async function (done) { - await getFd("test06.png"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_062-6 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - const imagePackerApi = image.createImagePacker(); - if (imagePackerApi == undefined) { - console.info('TC_062-6 create image packer failed'); - expect(false).assertTrue(); - done(); - } else { - let packOpts = { quality:50 } - imagePackerApi.packing(imageSourceApi, packOpts) - .then( data => { - console.info('TC_062-6 failed'); - expect(data == undefined).assertTrue(); - done(); - }).catch(error => { - console.log('TC_062-6 error: ' + error); - console.log('TC_062-6 success'); - expect(true).assertTrue(); - done(); - }) - } - } - }) - - /** - * @tc.number : TC_062-8 - * @tc.name : packing ImageSource - callback - quality 0 - * @tc.desc : 1.create ImageSource - * 2.call packing - * 3.return array - * 4.callbackcall return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_062-8', 0, async function (done) { - await getFd("test08.png"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_062-8 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - const imagePackerApi = image.createImagePacker(); - if (imagePackerApi == undefined) { - console.info('TC_062-8 create image packer failed'); - expect(false).assertTrue(); - done(); - } else { - let packOpts = { format:["image/jpeg"], quality:0 } - imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => { - console.info('TC_062-8 success'); - expect(data != undefined).assertTrue(); - done(); - }) - } - } - }) - - /** - * @tc.number : TC_062-9 - * @tc.name : packing ImageSource - callback - quality -1 - * @tc.desc : 1.create ImageSource - * 2.call packing - * 3.return array - * 4.callbackcall return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_062-9', 0, async function (done) { - await getFd("test09.png"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_062-9 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - const imagePackerApi = image.createImagePacker(); - if (imagePackerApi == undefined) { - console.info('TC_062-9 create image packer failed'); - expect(false).assertTrue(); - done(); - } else { - let packOpts = { format:["image/jpeg"], quality:-1 } - imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => { - console.info('TC_062-9 success'); - expect(data == undefined).assertTrue(); - done(); - }) - } - } - }) - - /** - * @tc.number : TC_063 - * @tc.name : release ImagePacker - promise - * @tc.desc : 1.create ImagePacker - * 2.call release - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_063', 0, async function (done) { - const imagePackerApi = image.createImagePacker(); - if (imagePackerApi == undefined) { - console.info('TC_063 create image packer failed'); - expect(false).assertTrue(); - done(); - } else { - imagePackerApi.release().then(()=>{ - console.info('TC_063 success'); - expect(true).assertTrue(); - done(); - }).catch(()=>{ - console.log('TC_063 error: ' + error); - expect(false).assertTrue(); - done(); - }) - } - }) - - /** - * @tc.number : TC_063-1 - * @tc.name : release ImagePacker - callback - * @tc.desc : 1.create ImagePacker - * 2.call release - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_063-1', 0, async function (done) { - const imagePackerApi = image.createImagePacker(); - if (imagePackerApi == undefined) { - console.info('TC_063-1 create image packer failed'); - expect(false).assertTrue(); - done(); - } else { - imagePackerApi.release(()=>{ - console.info('TC_063-1 success'); - expect(true).assertTrue(); - done(); - }) - } - }) - - /** - * @tc.number : TC_064 - * @tc.name : release ImageSource - promise - png - * @tc.desc : 1.create ImageSource - * 2.call release() - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_064', 0, async function (done) { - await getFd("test.png"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_064 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.release().then(()=>{ - console.info('TC_064 success'); - expect(true).assertTrue(); - done(); - }).catch(error => { - console.log('TC_064 error: ' + error); - expect().assertFail(); - done(); - }) - } - }) - - /** - * @tc.number : TC_064-1 - * @tc.name : release ImageSource - callback - png - * @tc.desc : 1.create ImageSource - * 2.call release() - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_064-1', 0, async function (done) { - await getFd("test.png"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_064-1 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.release(async(err) => { - if (err){ - console.info('TC_064-1 err:' + err); - expect(false).assertTrue(); - done(); - return - } - console.info('TC_064-1 Success'); - expect(true).assertTrue(); - expect(true).assertTrue(); - done(); - }) - } - }) - - /** - * @tc.number : TC_065 - * @tc.name : release ImageSource - promise - bmp - * @tc.desc : 1.create ImageSource - * 2.call release() - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_065', 0, async function (done) { - await getFd("test.bmp"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_065 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.release().then(()=>{ - console.info('TC_065 success'); - expect(true).assertTrue(); - done(); - }).catch(error => { - console.log('TC_065 error: ' + error); - expect().assertFail(); - done(); - }) - } - }) - - /** - * @tc.number : TC_065-1 - * @tc.name : release ImageSource - callback - bmp - * @tc.desc : 1.create ImageSource - * 2.create SourceStream - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_065-1', 0, async function (done) { - await getFd("test.bmp"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_065-1 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.release(async() => { - console.info('TC_065-1 Success'); - expect(true).assertTrue(); - done(); - }) - } - }) - - /** - * @tc.number : TC_066 - * @tc.name : release ImageSource - promise - gif - * @tc.desc : 1.create ImageSource - * 2.call release() - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_066', 0, async function (done) { - await getFd("test.gif"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_066 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.release().then(()=>{ - console.info('TC_066 success'); - expect(true).assertTrue(); - done(); - }).catch(error => { - console.log('TC_066 error: ' + error); - expect().assertFail(); - done(); - }) - } - }) - - /** - * @tc.number : TC_066-1 - * @tc.name : release ImageSource - callback - gif - * @tc.desc : 1.create ImageSource - * 2.call release() - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_066-1', 0, async function (done) { - await getFd("test.gif"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_066-1 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.release(() => { - console.info('TC_066-1 Success'); - expect(true).assertTrue(); - done(); - }) - } - }) - - /** - * @tc.number : TC_067 - * @tc.name : createPixelMap(decodingOptions)-pixelformat:RGBA_8888-gif - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_067', 0, async function (done) { - await getFd("moving_test.gif"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_067 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:3, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions, (err,pixelmap) => { - console.info('TC_067 createPixelMap '); - expect(pixelmap != undefined ).assertTrue(); - done(); - }) - } - }) - /** - * @tc.number : TC_067-1 - * @tc.name : createPixelMap(decodingOptions)-pixelformat:RGBA_565-gif - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return null - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_067-1', 0, async function (done) { - await getFd("moving_test.gif"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_067-1 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions, (err,pixelmap) => { - console.info('TC_067-1 success '); - expect(pixelmap != undefined ).assertTrue(); - done(); - }) - } - }) - /** - * @tc.number : TC_067-2 - * @tc.name : createPixelMap(decodingOptions)-pixelformat:unkonwn-gif - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_067-2', 0, async function (done) { - await getFd("moving_test.gif"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_067-2 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:0, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions, (err,pixelmap) => { - console.info('TC_067-2 success '); - expect(pixelmap != undefined ).assertTrue(); - done(); - }) - } - }) - /** - * @tc.number : TC_067-3 - * @tc.name : createPixelMap(decodingOptions:index 1})-gif - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return null - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_067-3', 0, async function (done) { - await getFd("moving_test.gif"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_067-3 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:0, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:1 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - console.info('TC_067-3 success '); - expect(pixelmap != undefined ).assertTrue(); - done(); - }) - } - }) - - /** - * @tc.number : TC_067-4 - * @tc.name : createPixelMap(decodingOptions:index -1})-gif - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return null - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_067-4', 0, async function (done) { - await getFd("moving_test.gif"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_067-4 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:0, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:-1 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_067-4 success '); - expect(true).assertTrue(); - done(); - }else{ - expect(false).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_067-5 - * @tc.name : createPixelMap(decodingOptions:sampleSize -1})-gif - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_067-5', 0, async function (done) { - await getFd("moving_test.gif"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_067-5 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:-1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:0, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_067-5 success '); - expect(true).assertTrue(); - done(); - }else{ - expect(false).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_067-6 - * @tc.name : createPixelMap(decodingOptions:rotate -10})-gif - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_067-6', 0, async function (done) { - await getFd("moving_test.gif"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_067-6 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:-10, - desiredPixelFormat:2, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_067-6 success '); - expect(true).assertTrue(); - done(); - }else{ - expect(false).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_067-7 - * @tc.name : createPixelMap(decodingOptions:unsupported pixelformat)-gif - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_067-7', 0, async function (done) { - await getFd("moving_test.gif"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_067-7 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:60, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_067-7 success '); - expect(true).assertTrue(); - done(); - }else{ - expect(false).assertTrue(); - done(); - } - }) - } - }) - /** - * @tc.number : TC_067-8 - * @tc.name : createPixelMap(decodingOptions:editable false})-gif - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_067-8', 0, async function (done) { - await getFd("moving_test.gif"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_067-8 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: false, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - console.info('TC_067-8 success'); - expect(pixelmap != undefined ).assertTrue(); - done(); - }) - } - }) - - /** - * @tc.number : TC_067-9 - * @tc.name : createPixelMap(decodingOptions:desiredSize>imagesize)-gif - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_067-9', 0, async function (done) { - await getFd("moving_test.gif"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_067-9 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:10000, height:10000}, - rotate:10, - desiredPixelFormat:2, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - console.info('TC_067-9 success '); - expect(pixelmap != undefined ).assertTrue(); - done(); - }) - } - }) - - /** - * @tc.number : TC_067-10 - * @tc.name : createPixelMap(decodingOptions:desiredRegion>imagesize)-gif - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_067-10', 0, async function (done) { - await getFd("moving_test.gif"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info(' TC_067-10 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, - desiredRegion: { size: { height: 10000, width: 10000 }, x: 0, y: 0 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_067-10 success '); - expect(true).assertTrue(); - done(); - }else{ - expect(false).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_067-11 - * @tc.name : createPixelMapdecodingOptions:x -1 y -1)-gif - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_067-11', 0, async function (done) { - await getFd("moving_test.gif"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_067-11 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, - desiredRegion: { size: { height: 1, width: 2 }, x: -1, y: -1 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_067-11 success '); - expect(true).assertTrue(); - done(); - }else{ - expect(false).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_067-12 - * @tc.name : createPixelMap(decodingOptions:x > image.height y > image.width)-gif - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_067-12', 0, async function (done) { - await getFd("moving_test.gif"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_067-12 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, - desiredRegion: { size: { height: 1, width: 2 }, x: 10000, y: 10000 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_067-12 success '); - expect(true).assertTrue(); - done(); - }else{ - expect(false).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_067-13 - * @tc.name : createPixelMap(decodingOptions:rotate>360)-gif - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_067-13', 0, async function (done) { - await getFd("moving_test.gif"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_067-13 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:500, - desiredPixelFormat:2, - desiredRegion: { size: { height: 1, width: 2 }, x: 1, y: 2 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_067-13 success '); - expect(true).assertTrue(); - done(); - }else{ - expect(false).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_067-14 - * @tc.name : createPixelMap-promise-gif - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_067-14', 0, async function (done) { - await getFd("moving_test.gif"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_067-14 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.createPixelMap().then(pixelmap => { - console.info('TC_067-14 success '); - expect(pixelmap !== undefined ).assertTrue(); - done(); - }).catch(error => { - console.log('TC_067-14 error: ' + error); - expect().assertFail(); - done(); - }) - } - }) - - /** - * @tc.number : TC_067-15 - * @tc.name : createPixelMap-pcallback-gif - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return null - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_067-15', 0, async function (done) { - await getFd("moving_test.gif"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_067-15 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.createPixelMap((err, pixelmap) => { - console.info('TC_067-15 success '); - expect(pixelmap !== undefined ).assertTrue(); - done(); - }) - } - }) - - - /** - * @tc.number : TC_068 - * @tc.name : createPixelMap(decodingOptions)-pixelformat:RGBA_8888-bmp - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_068', 0, async function (done) { - await getFd("test0.bmp"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_068 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:3, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - console.info('TC_068 success '); - expect(pixelmap != undefined ).assertTrue(); - done(); - }) - } - }) - /** - * @tc.number : TC_068-1 - * @tc.name : createPixelMap(decodingOptions)-pixelformat:RGB_565-bmp - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_068-1', 0, async function (done) { - await getFd("test1.bmp"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_068-1 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - console.info('TC_068-1 success '); - expect(pixelmap != undefined ).assertTrue(); - done(); - }) - } - }) - /** - * @tc.number : TC_068-2 - * @tc.name : createPixelMap(decodingOptions)-pixelformat:unkonwn-bmp - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_068-2', 0, async function (done) { - await getFd("test2.bmp"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_068-2 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:0, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - console.info('TC_068-2 success '); - expect(pixelmap != undefined ).assertTrue(); - done(); - }) - } - }) - /** - * @tc.number : TC_068-3 - * @tc.name : createPixelMap(decodingOptions: index 1})-bmp - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_068-3', 0, async function (done) { - await getFd("test3.bmp"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_068-3 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:0, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:1 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_068-3 success '); - expect(true).assertTrue(); - done(); - }else{ - expect(false).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_068-4 - * @tc.name : createPixelMap(decodingOptions:index -1})-bmp - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_068-4', 0, async function (done) { - await getFd("test4.bmp"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_068-4 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:0, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:-1 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_068-4 success '); - expect(true).assertTrue(); - done(); - }else{ - expect(false).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_068-5 - * @tc.name : createPixelMap(decodingOptions:sampleSize -1})-bmp - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_068-5', 0, async function (done) { - await getFd("test5.bmp"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_068-5 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:-1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:0, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_068-5 success '); - expect(true).assertTrue(); - done(); - }else{ - expect(false).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_068-6 - * @tc.name : createPixelMap(decodingOptions:rotate -10})-bmp - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_068-6', 0, async function (done) { - await getFd("test6.bmp"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_068-6 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:-10, - desiredPixelFormat:2, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_068-6 success '); - expect(true).assertTrue(); - done(); - }else{ - expect(false).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_068-7 - * @tc.name : createPixelMap(decodingOptions:unsupported pixelformat)-bmp - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_068-7', 0, async function (done) { - await getFd("test7.bmp"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_068-7 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:60, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_068-7 success '); - expect(true).assertTrue(); - done(); - }else{ - expect(false).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_068-8 - * @tc.name : createPixelMap(decodingOptions:editable false})-bmp - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_068-8', 0, async function (done) { - await getFd("test8.bmp"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_068-8 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: false, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - console.info('TC_068-8 success'); - expect(pixelmap != undefined ).assertTrue(); - done(); - }) - } - }) - - /** - * @tc.number : TC_068-9 - * @tc.name : createPixelMap(decodingOptions:desiredSize>imagesize)-bmp - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_068-9', 0, async function (done) { - await getFd("test9.bmp"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_068-9 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:10000, height:10000}, - rotate:10, - desiredPixelFormat:2, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - console.info('TC_068-9 success '); - expect(pixelmap != undefined ).assertTrue(); - done(); - }) - } - }) - - /** - * @tc.number : TC_068-10 - * @tc.name : createPixelMap(decodingOptions:desiredRegion>imagesize)-bmp - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_068-10', 0, async function (done) { - await getFd("test10.bmp"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info(' TC_068-10 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, - desiredRegion: { size: { height: 10000, width: 10000 }, x: 0, y: 0 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_068-10 success '); - expect(true).assertTrue(); - done(); - }else{ - expect(false).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_068-11 - * @tc.name : createPixelMapdecodingOptions:x -1 y -1)-bmp - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_068-11', 0, async function (done) { - await getFd("test11.bmp"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_068-11 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, - desiredRegion: { size: { height: 1, width: 2 }, x: -1, y: -1 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_068-11 success '); - expect(true).assertTrue(); - done(); - }else{ - expect(false).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_068-12 - * @tc.name : createPixelMap(decodingOptions:x > image.height y > image.width)-bmp - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_068-12', 0, async function (done) { - await getFd("test12.bmp"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_068-12 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, - desiredRegion: { size: { height: 1, width: 2 }, x: 10000, y: 10000 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_068-12 success '); - expect(true).assertTrue(); - done(); - }else{ - expect(false).assertTrue(); - done(); - } - }) - } - }) - /** - * @tc.number : TC_068-13 - * @tc.name : createPixelMap(decodingOptions:rotate>360)-jpg - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_068-13', 0, async function (done) { - await getFd("test13.bmp"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_068-13 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:500, - desiredPixelFormat:2, - desiredRegion: { size: { height: 1, width: 2 }, x: 1, y: 2 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_068-13 success '); - expect(true).assertTrue(); - done(); - }else{ - expect(false).assertTrue(); - done(); - } - }) - } - }) - /** - * @tc.number : TC_068-14 - * @tc.name : createPixelMap-promise-bmp - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_068-14', 0, async function (done) { - await getFd("test14.bmp"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_068-14 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.createPixelMap().then(pixelmap => { - console.info('TC_068-14 success '); - expect(pixelmap != undefined ).assertTrue(); - done(); - }).catch(error => { - console.log('TC_068-14 error: ' + error); - expect().assertFail(); - done(); - }) - } - }) - - /** - * @tc.number : TC_068-15 - * @tc.name : createPixelMap-callback-bmp - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_068-15', 0, async function (done) { - await getFd("test15.bmp"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_068-15 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.createPixelMap((err, pixelmap) => { - console.info('TC_068-15 success '); - expect(pixelmap != undefined ).assertTrue(); - done(); - }) - } - }) - /** - * @tc.number : TC_163 - * @tc.name : createPixelMap(decodingOptions)-pixelformat:RGBA_8888-png - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_163', 0, async function (done) { - await getFd("test0.png"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_163 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:3, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - console.info('TC_163 success'); - expect(pixelmap != undefined ).assertTrue(); - done(); - }) - } - }) - /** - * @tc.number : TC_163-1 - * @tc.name : createPixelMap(decodingOptions)-pixelformat:RGB_565-png - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_163-1', 0, async function (done) { - await getFd("test1.png"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_163-1 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - console.info('TC_163-1 success'); - expect(pixelmap != undefined ).assertTrue(); - done(); - }) - } - }) - /** - * @tc.number : TC_163-2 - * @tc.name : createPixelMap(decodingOptions)-pixelformat:unkonwn-png - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_163-2', 0, async function (done) { - await getFd("test2.png"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_163-2 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:0, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - console.info('TC_163-2 success'); - expect(pixelmap != undefined ).assertTrue(); - done(); - }) - } - }) - /** - * @tc.number : TC_163-3 - * @tc.name : createPixelMap(decodingOptions: index 1})-png - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_163-3', 0, async function (done) { - await getFd("test3.png"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_163-3 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:0, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:1 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_163-3 success '); - expect(true).assertTrue(); - done(); - }else{ - expect(false).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_163-4 - * @tc.name : createPixelMap(decodingOptions:index -1})-png - * @tc.desc : 1.create imagesource - * 2.set decodingOptions - * 3.call createPixelMap - * 4.set index=-1,options - * 5.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_163-4', 0, async function (done) { - await getFd("test4.png"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_163-4 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:0, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:-1 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_163-4 success '); - expect(true).assertTrue(); - done(); - }else{ - expect(false).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_163-5 - * @tc.name : createPixelMap(decodingOptions:sampleSize -1})-png - * @tc.desc : 1.create imagesource - * 2.set decodingOptions - * 3.call createPixelMap - * 4.set index=-1,options - * 5.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_163-5', 0, async function (done) { - await getFd("test5.png"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_163-5 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:-1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:0, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_163-5 success '); - expect(true).assertTrue(); - done(); - }else{ - expect(false).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_163-6 - * @tc.name : createPixelMap(decodingOptions:rotate -10})-png - * @tc.desc : 1.create imagesource - * 2.set decodingOptions - * 3.call createPixelMap - * 4.set index=-1,options - * 5.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_163-6', 0, async function (done) { - await getFd("test6.png"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_163-6 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:-10, - desiredPixelFormat:2, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_163-6 success '); - expect(true).assertTrue(); - done(); - }else{ - expect(false).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_163-7 - * @tc.name : createPixelMap(decodingOptions:unsupported pixelformat)-png - * @tc.desc : 1.create imagesource - * 2.set decodingOptions - * 3.call createPixelMap - * 4.set index=-1,options - * 5.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_163-7', 0, async function (done) { - await getFd("test7.png"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_163-7 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:60, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_163-7 success '); - expect(true).assertTrue(); - done(); - }else{ - expect(false).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_163-8 - * @tc.name : createPixelMap(decodingOptions:editable false})-png - * @tc.desc : 1.create imagesource - * 2.set decodingOptions - * 3.call createPixelMap - * 4.set index=-1,options - * 5.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_163-8', 0, async function (done) { - await getFd("test8.png"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_163-8 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: false, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - console.info('TC_163-8 success'); - expect(pixelmap != undefined ).assertTrue(); - done(); - }) - } - }) - - /** - * @tc.number : TC_163-9 - * @tc.name : createPixelMap(decodingOptions:desiredSize>imagesize)-png - * @tc.desc : 1.create imagesource - * 2.set decodingOptions - * 3.call createPixelMap - * 4.set index=-1,options - * 5.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - - it('TC_163-9', 0, async function (done) { - await getFd("test9.png"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_163-9 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:500, height:500}, - rotate:10, - desiredPixelFormat:2, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - console.info('TC_163-9 success'); - expect(pixelmap != undefined ).assertTrue(); - done(); - }) - } - }) - - /** - * @tc.number : TC_163-10 - * @tc.name : createPixelMap(decodingOptions:desiredRegion>imagesize)-png - * @tc.desc : 1.create imagesource - * 2.set decodingOptions - * 3.call createPixelMap - * 4.set index=-1,options - * 5.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_163-10', 0, async function (done) { - await getFd("test10.png"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info(' TC_163-10 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, - desiredRegion: { size: { height: 10000, width: 10000 }, x: 0, y: 0 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_163-10 success '); - expect(true).assertTrue(); - done(); - }else{ - expect(false).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_163-11 - * @tc.name : createPixelMapdecodingOptions:x -1 y -1)-png - * @tc.desc : 1.create imagesource - * 2.set decodingOptions - * 3.call createPixelMap - * 4.set index=-1,options - * 5.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_163-11', 0, async function (done) { - await getFd("test11.png"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_163-11 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, - desiredRegion: { size: { height: 1, width: 2 }, x: -1, y: -1 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_163-11 success '); - expect(true).assertTrue(); - done(); - }else{ - expect(false).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_163-12 - * @tc.name : createPixelMap(decodingOptions:x > image.height y > image.width)-png - * @tc.desc : 1.create imagesource - * 2.set decodingOptions - * 3.call createPixelMap - * 4.set index=-1,options - * 5.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_163-12', 0, async function (done) { - await getFd("test12.png"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_163-12 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, - desiredRegion: { size: { height: 1, width: 2 }, x: 10000, y: 10000 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_163-12 success '); - expect(true).assertTrue(); - done(); - }else{ - expect(false).assertTrue(); - done(); - } - }) - } - }) - /** - * @tc.number : TC_163-13 - * @tc.name : createPixelMap(decodingOptions:rotate>360)-png - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_163-13', 0, async function (done) { - await getFd("test13.png"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_163-13 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:500, - desiredPixelFormat:2, - desiredRegion: { size: { height: 1, width: 2 }, x: 1, y: 2 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_163-13 success '); - expect(true).assertTrue(); - done(); - }else{ - expect(false).assertTrue(); - done(); - } - }) - } - }) - /** - * @tc.number : TC_163-14 - * @tc.name : createPixelMap-promise-png - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_163-14', 0, async function (done) { - await getFd("test14.png"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_163-14 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.createPixelMap().then(pixelmap => { - console.info('TC_163-14 success'); - expect(pixelmap != undefined ).assertTrue(); - done(); - }).catch(error => { - console.log('TC_163-14 error: ' + error); - expect().assertFail(); - done(); - }) - } - }) - - /** - * @tc.number : TC_163-15 - * @tc.name : createPixelMap-callback-png - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return null - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_163-15', 0, async function (done) { - await getFd("test15.png"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_163-15 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.createPixelMap((err, pixelmap) => { - console.info('TC_163-15 success'); - expect(pixelmap != undefined ).assertTrue(); - done(); - }) - } - }) - /** - * @tc.number : TC_164 - * @tc.name : imagesource supportedFormats - * @tc.desc : 1.create imagesource - * 2.call supportedFormats - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ - it('TC_164', 0, async function (done) { - - await getFd("test.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_164 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - expect(imageSourceApi.supportedFormats != undefined).assertTrue(); - console.info(imageSourceApi.supportedFormats); - console.info('TC_164 success '); - done(); - } - }) - - /** - * @tc.number : TC_166 - * @tc.name : imagepacker supportedFormats - * @tc.desc : 1.create imagepacker - * 2.call supportedFormats - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ - it('TC_166', 0, async function (done) { - const imagePackerApi = image.createImagePacker(); - if (imagePackerApi == undefined) { - console.info('TC_166 create image packer failed'); - expect(false).assertTrue(); - done(); - } else { - expect(imagePackerApi.supportedFormats != undefined).assertTrue(); - console.info(imagePackerApi.supportedFormats); - console.info('TC_166 success '); - done(); - } - }) - - /** - * @tc.number : TC_167 - * @tc.name : createPixelMap-unsupported image format - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_167', 0, async function (done) { - await getFd("test.tiff"); - const imageSourceApi = image.createImageSource(fdNumber); - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:3, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { - console.info('TC_167 success '); - expect(pixelmap == undefined ).assertTrue(); - done(); - }) - }) - - /** - * @tc.number : TC_168 - * @tc.name : isEditable - * @tc.desc : 1.create pixelmap - * 2.call isEditable - * 3.return true - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_168', 0, async function (done) { - const Color = new ArrayBuffer(96); - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(Color, opts, (error,pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_168 create pixelmap failed'); - expect(false).assertTrue(); - done(); - }else { - expect(pixelmap.isEditable == true).assertTrue(); - console.info('TC_168 success '); - done(); - } - }) - }) - - /** - * @tc.number : TC_169 - * @tc.name : Decode the image to generate a bitmap - * @tc.desc : 1.create imagesource - * 2.create pixelmap - * 3.call getimageinfo - * 4.Judging the length and width are opposite to the original - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_169', 0, async function (done) { - - await getFd("test.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_169 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:90, - desiredPixelFormat:3, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { - pixelmap.getImageInfo( (err,imageInfo) => { - if (imageInfo != undefined) { - console.info('TC_169 success'); - expect(imageInfo.size.height == 2).assertTrue(); - expect(imageInfo.size.width == 1).assertTrue(); - done(); - }else { - console.info('TC_169 imageInfo is empty'); - expect(false).assertTrue() - done(); - } - }) - }) - } - }) - /** - * @tc.number : TC_171 - * @tc.name : getImageProperty(BitsPerSample)-promise - * @tc.desc : 1.create imagesource - * 2.set property - * 3.call getImageProperty(BitsPerSample) - * 4.The return value is not empty - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_171', 0, async function (done) { - await getFd("test_exif.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_171 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.getImageProperty("BitsPerSample") - .then(data => { - console.info('TC_171 BitsPerSample ' + data); - expect(data != undefined).assertTrue(); - done(); - }) - .catch(error => { - console.log('TC_171 error: ' + error); - expect(false).assertFail(); - done(); - }) - } - }) - - /** - * @tc.number : TC_171-1 - * @tc.name : getImageProperty(Orientation)-promise - * @tc.desc : 1.create imagesource - * 2.set property - * 3.call getImageProperty(Orientation) - * 4.The return value is not empty - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_171-1', 0, async function (done) { - await getFd("test_exif.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_171-1 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.getImageProperty("Orientation") - .then(data => { - console.info('TC_171-1 Orientation ' + data); - expect(data != undefined && data != '' ).assertTrue(); - done(); - }) - .catch(error => { - console.log('TC_171-1 error: ' + error); - expect(false).assertFail(); - done(); - }) - } - }) - - /** - * @tc.number : TC_171-2 - * @tc.name : getImageProperty(ImageLength)-promise - * @tc.desc : 1.create imagesource - * 2.set property - * 3.call getImageProperty(ImageLength) - * 4.The return value is not empty - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_171-2', 0, async function (done) { - await getFd("test_exif.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_171-2 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.getImageProperty("ImageLength") - .then(data => { - console.info('TC_171-2 ImageLength ' + data); - expect(data != undefined && data != '' ).assertTrue(); - done(); - }) - .catch(error => { - console.log('TC_171-2 error: ' + error); - expect(false).assertFail(); - done(); - }) - } - }) - - /** - * @tc.number : TC_171-3 - * @tc.name : getImageProperty(ImageWidth)-promise - * @tc.desc : 1.create imagesource - * 2.set property - * 3.call getImageProperty(ImageWidth) - * 4.The return value is not empty - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_171-3', 0, async function (done) { - await getFd("test_exif.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_171-3 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.getImageProperty("ImageWidth") - .then(data => { - console.info('TC_171-3 ImageWidth ' + data); - expect(data != undefined && data != '' ).assertTrue(); - done(); - }) - .catch(error => { - console.log('TC_171-3 error: ' + error); - expect(false).assertFail(); - done(); - }) - } - }) - - /** - * @tc.number : TC_171-4 - * @tc.name : getImageProperty(GPSLatitude)-promise - * @tc.desc : 1.create imagesource - * 2.set property - * 3.call getImageProperty(GPSLatitude) - * 4.The return value is not empty - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_171-4', 0, async function (done) { - await getFd("test_exif.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_171-4 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.getImageProperty("GPSLatitude") - .then(data => { - console.info('TC_171-4 GPSLatitude ' + data); - expect(data != undefined && data != '' ).assertTrue(); - done(); - }) - .catch(error => { - console.log('TC_171-4 error: ' + error); - expect(false).assertFail(); - done(); - }) - } - }) - - /** - * @tc.number : TC_171-5 - * @tc.name : getImageProperty(GPSLongitude)-promise - * @tc.desc : 1.create imagesource - * 2.set property - * 3.call getImageProperty(GPSLongitude) - * 4.The return value is not empty - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_171-5', 0, async function (done) { - await getFd("test_exif.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_171-5 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.getImageProperty("GPSLongitude") - .then(data => { - console.info('TC_171-5 GPSLongitude ' + data); - expect(data != undefined && data != '' ).assertTrue(); - done(); - }) - .catch(error => { - console.log('TC_171-5 error: ' + error); - expect(false).assertFail(); - done(); - }) - } - }) - - /** - * @tc.number : TC_171-6 - * @tc.name : getImageProperty(GPSLatitudeRef)-promise - * @tc.desc : 1.create imagesource - * 2.set property - * 3.call getImageProperty(GPSLatitudeRef) - * 4.The return value is not empty - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_171-6', 0, async function (done) { - await getFd("test_exif.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_171-6 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.getImageProperty("GPSLatitudeRef") - .then(data => { - console.info('TC_171-6 GPSLatitudeRef ' + data); - expect(data != undefined && data != '' ).assertTrue(); - done(); - }) - .catch(error => { - console.log('TC_171-6 error: ' + error); - expect(false).assertFail(); - done(); - }) - } - }) - - /** - * @tc.number : TC_171-7 - * @tc.name : getImageProperty(GPSLongitudeRef)-promise - * @tc.desc : 1.create imagesource - * 2.set property - * 3.call getImageProperty(GPSLongitudeRef) - * 4.The return value is not empty - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_171-7', 0, async function (done) { - await getFd("test_exif.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_171-7 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.getImageProperty("GPSLongitudeRef") - .then(data => { - console.info('TC_171-7 GPSLongitudeRef ' + data); - expect(data != undefined && data != '' ).assertTrue(); - done(); - }) - .catch(error => { - console.log('TC_171-7 error: ' + error); - expect(false).assertFail(); - done(); - }) - } - }) - - /** - * @tc.number : TC_171-8 - * @tc.name : getImageProperty(DateTimeOriginal) - * @tc.desc : 1.create imagesource - * 2.set property - * 3.call getImageProperty(ImageLength) - * 4.The return value is not empty - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_171-8', 0, async function (done) { - await getFd("test_exif.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_171-8 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.getImageProperty("DateTimeOriginal") - .then(data => { - console.info('TC_171-8 DateTimeOriginal ' + data); - expect(data != undefined && data != '' ).assertTrue(); - done(); - }) - .catch(error => { - console.log('TC_171-8 error: ' + error); - expect(false).assertFail(); - done(); - }) - } - }) - - /** - * @tc.number : TC_172 - * @tc.name : getImageProperty(BitsPerSample)-callback - * @tc.desc : 1.create imagesource - * 2.call getImageProperty(BitsPerSample) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_172', 0, async function (done) { - await getFd("test_exif.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_172 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.getImageProperty("BitsPerSample",(error,data) => { - if (error){ - console.info('TC_172 getImageProperty BitsPerSample error'); - expect(false).assertTrue(); - done(); - }else{ - console.info('TC_172 BitsPerSample ' + data); - expect(data != undefined).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_172-1 - * @tc.name : getImageProperty(Orientation)-callback - * @tc.desc : 1.create imagesource - * 2.call getImageProperty(Orientation) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_172-1', 0, async function (done) { - await getFd("test_exif.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_172-1 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.getImageProperty("Orientation",(error,data) => { - if (error){ - console.info('TC_172-1 getImageProperty Orientation error'); - expect(false).assertTrue(); - done(); - }else{ - console.info('TC_172-1 Orientation ' + data); - expect(data != undefined && data != '').assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_172-2 - * @tc.name : getImageProperty(ImageLength)-callback - * @tc.desc : 1.create imagesource - * 2.call getImageProperty(ImageLength) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_172-2', 0, async function (done) { - await getFd("test_exif.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_172-2 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.getImageProperty("ImageLength",(error,data) => { - if (error){ - console.info('TC_172-2 getImageProperty ImageLength error'); - expect(false).assertTrue(); - done(); - }else{ - console.info('TC_172-2 ImageLength ' + data); - expect(data != undefined && data != '' ).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_172-3 - * @tc.name : getImageProperty(ImageWidth)-callback - * @tc.desc : 1.create imagesource - * 2.call getImageProperty(ImageWidth) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_172-3', 0, async function (done) { - await getFd("test_exif.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_172-3 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.getImageProperty("ImageWidth",(error,data) => { - if (error){ - console.info('TC_172-3 getImageProperty ImageWidth error'); - expect(false).assertTrue(); - done(); - }else{ - console.info('TC_172-3 ImageWidth ' + data); - expect(data != undefined && data != '' ).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_172-4 - * @tc.name : getImageProperty(GPSLatitude)-callback - * @tc.desc : 1.create imagesource - * 2.call getImageProperty(GPSLatitude) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_172-4', 0, async function (done) { - await getFd("test_exif.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_172-4 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.getImageProperty("GPSLatitude",(error,data) => { - if (error){ - console.info('TC_172-4 getImageProperty GPSLatitude error'); - expect(false).assertTrue(); - done(); - }else{ - console.info('TC_172-4 GPSLatitude ' + data); - expect(data != undefined && data != '' ).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_172-5 - * @tc.name : getImageProperty(GPSLongitude)-callback - * @tc.desc : 1.create imagesource - * 2.call getImageProperty(GPSLongitude) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_172-5', 0, async function (done) { - await getFd("test_exif.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_172-5 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.getImageProperty("GPSLongitude",(error,data) => { - if (error){ - console.info('TC_172-5 getImageProperty GPSLongitude error'); - expect(false).assertTrue(); - done(); - }else{ - console.info('TC_172-5 GPSLongitude ' + data); - expect(data != undefined && data != '' ).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_172-6 - * @tc.name : getImageProperty(GPSLatitudeRef)-callback - * @tc.desc : 1.create imagesource - * 2.call getImageProperty(GPSLatitudeRef) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_172-6', 0, async function (done) { - await getFd("test_exif.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_172-6 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.getImageProperty("GPSLatitudeRef",(error,data) => { - if (error){ - console.info('TC_172-6 getImageProperty GPSLatitudeRef error'); - expect(false).assertTrue(); - done(); - }else{ - console.info('TC_172-6 GPSLatitudeRef ' + data); - expect(data != undefined && data != '' ).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_172-7 - * @tc.name : getImageProperty(GPSLongitudeRef)-callback - * @tc.desc : 1.create imagesource - * 2.call getImageProperty(GPSLongitudeRef) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_172-7', 0, async function (done) { - await getFd("test_exif.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_172-7 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.getImageProperty("GPSLongitudeRef",(error,data) => { - if (error){ - console.info('TC_172-7 getImageProperty GPSLongitudeRef error'); - expect(false).assertTrue(); - done(); - }else{ - console.info('TC_172-7 GPSLongitudeRef ' + data); - expect(data != undefined && data != '' ).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_172-8 - * @tc.name : getImageProperty(DateTimeOriginal)-callback - * @tc.desc : 1.create imagesource - * 2.call getImageProperty(DateTimeOriginal) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_172-8', 0, async function (done) { - await getFd("test_exif.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_172-8 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.getImageProperty("DateTimeOriginal",(error,data) => { - if (error){ - console.info('TC_172-8 getImageProperty DateTimeOriginal error'); - expect(false).assertTrue(); - done(); - }else{ - console.info('TC_172-8 DateTimeOriginal ' + data); - expect(data != undefined && data != '' ).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_173 - * @tc.name : getImageProperty(BitsPerSample,property)-callback - * @tc.desc : 1.create imagesource - * 2.set property - * 3.call getImageProperty(BitsPerSample,property) - * 4.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_173', 0, async function (done) { - await getFd("test_exif.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_173 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let property = {index:0,defaultValue:'9999'} - imageSourceApi.getImageProperty("BitsPerSample",property,(error,data) => { - if (error){ - console.info('TC_173 getImageProperty BitsPerSample error'); - expect(false).assertTrue(); - done(); - }else{ - console.info('TC_173 BitsPerSample ' + data); - expect(data != '9999' && data != undefined).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_173-1 - * @tc.name : getImageProperty(Orientation,property)-callback - * @tc.desc : 1.create imagesource - * 2.set property - * 3.call getImageProperty(Orientation,property) - * 4.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_173-1', 0, async function (done) { - await getFd("test_exif.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_173-1 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let property = {index:0,defaultValue:'9999'} - imageSourceApi.getImageProperty("Orientation",property,(error,data) => { - if (error){ - console.info('TC_173-1 getImageProperty Orientation error'); - expect(false).assertTrue(); - done(); - }else{ - console.info('TC_173-1 Orientation ' + data); - expect(data != '9999' && data != undefined && data != '').assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_173-2 - * @tc.name : getImageProperty(ImageLength,property)-callback - * @tc.desc : 1.create imagesource - * 2.set property - * 3.call getImageProperty(ImageLength,property) - * 4.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_173-2', 0, async function (done) { - await getFd("test_exif.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_173-2 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let property = {index:0,defaultValue:'9999'} - imageSourceApi.getImageProperty("ImageLength",property,(error,data) => { - if (error){ - console.info('TC_173-2 getImageProperty ImageLength error'); - expect(false).assertTrue(); - done(); - }else{ - console.info('TC_173-2 ImageLength ' + data); - expect(data != '9999' && data != undefined && data != '').assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_173-3 - * @tc.name : getImageProperty(ImageWidth,property)-callback - * @tc.desc : 1.create imagesource - * 2.set property - * 3.call getImageProperty(ImageWidth,property) - * 4.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_173-3', 0, async function (done) { - await getFd("test_exif.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_173-3 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let property = {index:0,defaultValue:'9999'} - imageSourceApi.getImageProperty("ImageWidth",property,(error,data) => { - if (error){ - console.info('TC_173-3 getImageProperty ImageWidth error'); - expect(false).assertTrue(); - done(); - }else{ - console.info('TC_173-3 ImageWidth ' + data); - expect(data != '9999' && data != undefined && data != '').assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_173-4 - * @tc.name : getImageProperty(GPSLatitude,property)-callback - * @tc.desc : 1.create imagesource - * 2.set property - * 3.call getImageProperty(GPSLatitude,property) - * 4.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_173-4', 0, async function (done) { - await getFd("test_exif.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_173-4 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let property = {index:0,defaultValue:'9999'} - imageSourceApi.getImageProperty("GPSLatitude",property,(error,data) => { - if (error){ - console.info('TC_173-4 getImageProperty GPSLatitude error'); - expect(false).assertTrue(); - done(); - }else{ - console.info('TC_173-4 GPSLatitude ' + data); - expect(data != '9999' && data != undefined && data != '').assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_173-5 - * @tc.name : getImageProperty(GPSLongitude,property)-callback - * @tc.desc : 1.create imagesource - * 2.set property - * 3.call getImageProperty(GPSLongitude,property) - * 4.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_173-5', 0, async function (done) { - await getFd("test_exif.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_173-5 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let property = {index:0,defaultValue:'9999'} - imageSourceApi.getImageProperty("GPSLongitude",property,(error,data) => { - if (error){ - console.info('TC_173-5 getImageProperty GPSLongitude error'); - expect(false).assertTrue(); - done(); - }else{ - console.info('TC_173-5 GPSLongitude ' + data); - expect(data != '9999' && data != undefined && data != '').assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_173-6 - * @tc.name : getImageProperty(GPSLatitudeRef,property)-callback - * @tc.desc : 1.create imagesource - * 2.set property - * 3.call getImageProperty(GPSLatitudeRef,property) - * 4.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_173-6', 0, async function (done) { - await getFd("test_exif.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_173-6 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let property = {index:0,defaultValue:'9999'} - imageSourceApi.getImageProperty("GPSLatitudeRef",property,(error,data) => { - if (error){ - console.info('TC_173-6 getImageProperty GPSLatitudeRef error'); - expect(false).assertTrue(); - done(); - }else{ - console.info('TC_173-6 GPSLatitudeRef ' + data); - expect(data != '9999' && data != undefined && data != '').assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_173-7 - * @tc.name : getImageProperty(GPSLongitudeRef,property)-callback - * @tc.desc : 1.create imagesource - * 2.set property - * 3.call getImageProperty(GPSLongitudeRef,property) - * 4.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_173-7', 0, async function (done) { - await getFd("test_exif.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_173-7 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let property = {index:0,defaultValue:'9999'} - imageSourceApi.getImageProperty("GPSLongitudeRef",property,(error,data) => { - if (error){ - console.info('TC_173-7 getImageProperty GPSLongitudeRef error'); - expect(false).assertTrue(); - done(); - }else{ - console.info('TC_173-7 GPSLongitudeRef ' + data); - expect(data != '9999' && data != undefined && data != '').assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_173-8 - * @tc.name : getImageProperty(DateTimeOriginal,property)-callback - * @tc.desc : 1.create imagesource - * 2.set property - * 3.call getImageProperty(DateTimeOriginal,property) - * 4.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_173-8', 0, async function (done) { - await getFd("test_exif.jpg"); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('TC_173-8 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let property = {index:0,defaultValue:'9999'} - imageSourceApi.getImageProperty("DateTimeOriginal",property,(error,data) => { - if (error){ - console.info('TC_173-8 getImageProperty DateTimeOriginal error'); - expect(false).assertTrue(); - done(); - }else{ - console.info('TC_173-8 DateTimeOriginal ' + data); - expect(data != '9999' && data != undefined && data != '').assertTrue(); - done(); - } - }) - } - }) -}) -- GitLab