diff --git a/multimedia/BUILD.gn b/multimedia/BUILD.gn index 3f2201f99c371e48c8986ef5321ef30a06436260..2f83952f41e38d1a962218a294c06ccb6abbab76 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 4d0a45955fa2ca80ff57ba51d7336b038fa38846..0000000000000000000000000000000000000000 --- 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 0000000000000000000000000000000000000000..fb892ef7de8d5f49188cef72a89b981a58f0be03 --- /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 6f50908608db806afcb812761b38ac281a93aff6..941d885673b1dc1d93c396a09f5f6a82fbbba5e5 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 363f2555b1badec9fec342a93141db084083fcb8..e423f4bce4698ec1d7dc86c3eea3990a5e7b1085 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 53f5d6a2e897f72b2c3196dd6c8b654ab6f65b2c..8a84d231e7d97e58517b96c3794da04a31499def 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 0000000000000000000000000000000000000000..87e00d5380f6cee6986940e47a4ebf037e64b112 --- /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 7527cec4bbb6adb1b3ecc4d1af4267ea8abc2ae4..c79296bb79f9f320485971d4319b23fb0ca15ff2 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 eed70c6527b594a191b279111f5ad25a3155a1b6..22af6ba2c28e0a8fbe9b594f399e76a0ea6f7fc0 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 0000000000000000000000000000000000000000..41a1eea8c618f12ceccb32779b212a4fa4c2464b --- /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 0000000000000000000000000000000000000000..cda7c7218bbf3185548cdf890170f195e32134f7 --- /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 Binary files /dev/null and b/multimedia/image/image_js_standard/imageDecodeOptions/signature/openharmony_sx.p7b differ diff --git a/multimedia/image/image_js_standard/imageDecodeOptions/src/main/config.json b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..340aadfab3e6f81a29c7355983784d30c4f81711 --- /dev/null +++ b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/config.json @@ -0,0 +1,104 @@ +{ + "app": { + "apiVersion": { + "compatible": 6, + "releaseType": "Beta1", + "target": 7 + }, + "vendor": "acts", + "bundleName": "ohos.acts.multimedia.image.DecodeOptions", + "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.DecodeOptions.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.DecodeOptions.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.DecodeOptions", + "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/imageDecodeOptions/src/main/js/default/app.js b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..e423f4bce4698ec1d7dc86c3eea3990a5e7b1085 --- /dev/null +++ b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/default/app.js @@ -0,0 +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'); + } +}; diff --git a/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/default/i18n/en-US.json b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/default/i18n/zh-CN.json b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/default/pages/index/index.css b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..5bd7567028568bd522193b2519d545ca6dcf397d --- /dev/null +++ b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/default/pages/index/index.css @@ -0,0 +1,46 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; + width: 100%; + height: 100%; +} + +.title { + font-size: 40px; + color: #000000; + opacity: 0.9; +} + +@media screen and (device-type: tablet) and (orientation: landscape) { + .title { + font-size: 100px; + } +} + +@media screen and (device-type: wearable) { + .title { + font-size: 28px; + color: #FFFFFF; + } +} + +@media screen and (device-type: tv) { + .container { + background-image: url("/common/images/Wallpaper.png"); + background-size: cover; + background-repeat: no-repeat; + background-position: center; + } + + .title { + font-size: 100px; + color: #FFFFFF; + } +} + +@media screen and (device-type: phone) and (orientation: landscape) { + .title { + font-size: 60px; + } +} diff --git a/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/default/pages/index/index.hml b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $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 0000000000000000000000000000000000000000..a0719cee588ac4b0f56efbf784b19647bc6645de --- /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 0000000000000000000000000000000000000000..8a84d231e7d97e58517b96c3794da04a31499def --- /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 0000000000000000000000000000000000000000..b911fdb147767609bc083a4ff040aa2ed47cc35f --- /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 0000000000000000000000000000000000000000..22af6ba2c28e0a8fbe9b594f399e76a0ea6f7fc0 --- /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 Binary files /dev/null and b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/resources/base/media/icon.png differ diff --git a/multimedia/image/image_js_standard/imageExif/BUILD.gn b/multimedia/image/image_js_standard/imageExif/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..0fd8c8cd62d9f376aced92f92e8b9c96c687e018 --- /dev/null +++ b/multimedia/image/image_js_standard/imageExif/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_exif_js_hap") { + hap_profile = "./src/main/config.json" + deps = [ + ":image_exif_js_assets", + ":image_exif_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsImageExifJsTest" +} +ohos_js_assets("image_exif_js_assets") { + source_dir = "./src/main/js/default" +} +ohos_resources("image_exif_resources") { + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" +} diff --git a/multimedia/image/image_js_standard/imageExif/Test.json b/multimedia/image/image_js_standard/imageExif/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..496ad7314a3ef52c08808d4e75c23e27a5333e03 --- /dev/null +++ b/multimedia/image/image_js_standard/imageExif/Test.json @@ -0,0 +1,45 @@ +{ + "description": "Configuration for Image Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "ohos.acts.multimedia.image.Exif", + "shell-timeout": "120000" + }, + "kits": [ + { + "type": "ShellKit", + "run-command": [ + "mkdir /data/app/el2/100/base/ohos.acts.multimedia.image.Exif/files", + "chmod 777 /data/app/el2/100/base/ohos.acts.multimedia.image.Exif/files" + ] + }, + { + "type": "PushKit", + "pre-push": [ + ], + "push": [ + "./resource/image/test_exif.jpg ->/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 Binary files /dev/null and b/multimedia/image/image_js_standard/imageExif/signature/openharmony_sx.p7b differ diff --git a/multimedia/image/image_js_standard/imageExif/src/main/config.json b/multimedia/image/image_js_standard/imageExif/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..c06776984f532b4dbf17643b69db9e08a2bb20d4 --- /dev/null +++ b/multimedia/image/image_js_standard/imageExif/src/main/config.json @@ -0,0 +1,104 @@ +{ + "app": { + "apiVersion": { + "compatible": 6, + "releaseType": "Beta1", + "target": 7 + }, + "vendor": "acts", + "bundleName": "ohos.acts.multimedia.image.Exif", + "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.Exif.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.Exif.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.Exif", + "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/imageExif/src/main/js/default/app.js b/multimedia/image/image_js_standard/imageExif/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..e423f4bce4698ec1d7dc86c3eea3990a5e7b1085 --- /dev/null +++ b/multimedia/image/image_js_standard/imageExif/src/main/js/default/app.js @@ -0,0 +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'); + } +}; diff --git a/multimedia/image/image_js_standard/imageExif/src/main/js/default/i18n/en-US.json b/multimedia/image/image_js_standard/imageExif/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/multimedia/image/image_js_standard/imageExif/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/multimedia/image/image_js_standard/imageExif/src/main/js/default/i18n/zh-CN.json b/multimedia/image/image_js_standard/imageExif/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/multimedia/image/image_js_standard/imageExif/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/multimedia/image/image_js_standard/imageExif/src/main/js/default/pages/index/index.css b/multimedia/image/image_js_standard/imageExif/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..5bd7567028568bd522193b2519d545ca6dcf397d --- /dev/null +++ b/multimedia/image/image_js_standard/imageExif/src/main/js/default/pages/index/index.css @@ -0,0 +1,46 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; + width: 100%; + height: 100%; +} + +.title { + font-size: 40px; + color: #000000; + opacity: 0.9; +} + +@media screen and (device-type: tablet) and (orientation: landscape) { + .title { + font-size: 100px; + } +} + +@media screen and (device-type: wearable) { + .title { + font-size: 28px; + color: #FFFFFF; + } +} + +@media screen and (device-type: tv) { + .container { + background-image: url("/common/images/Wallpaper.png"); + background-size: cover; + background-repeat: no-repeat; + background-position: center; + } + + .title { + font-size: 100px; + color: #FFFFFF; + } +} + +@media screen and (device-type: phone) and (orientation: landscape) { + .title { + font-size: 60px; + } +} diff --git a/multimedia/image/image_js_standard/imageExif/src/main/js/default/pages/index/index.hml b/multimedia/image/image_js_standard/imageExif/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/multimedia/image/image_js_standard/imageExif/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $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 0000000000000000000000000000000000000000..a0719cee588ac4b0f56efbf784b19647bc6645de --- /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 0000000000000000000000000000000000000000..8a84d231e7d97e58517b96c3794da04a31499def --- /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 0000000000000000000000000000000000000000..15556e8dc07af17b6996591b649f3ad8bf09c33f --- /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 0000000000000000000000000000000000000000..c31c50222d24efd01e8be4cf79b145f854a2b2c8 --- /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 0000000000000000000000000000000000000000..22af6ba2c28e0a8fbe9b594f399e76a0ea6f7fc0 --- /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 Binary files /dev/null and b/multimedia/image/image_js_standard/imageExif/src/main/resources/base/media/icon.png differ diff --git a/multimedia/image/image_js_standard/src/main/js/test/image.test.js b/multimedia/image/image_js_standard/src/main/js/test/image.test.js deleted file mode 100644 index 898ff26b8f2895cbdef71b6652600ee3f9ca4d18..0000000000000000000000000000000000000000 --- a/multimedia/image/image_js_standard/src/main/js/test/image.test.js +++ /dev/null @@ -1,6108 +0,0 @@ -/* - * 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, tc_020buf, tc_020_1buf, tc_021buf, tc_021_1buf, tc_022buf} from './testImg' -import mediaLibrary from '@ohos.multimedia.mediaLibrary'; -import featureAbility from '@ohos.ability.featureAbility'; -import resourceManager from '@ohos.resourceManager' -import abilityAccessCtrl from '@ohos.abilityAccessCtrl' -import bundle from '@ohos.bundle' - -describe('Image', function () { - const contextAPI = featureAbility.getContext(); - const mediaTest = mediaLibrary.getMediaLibrary(contextAPI); - console.log("case 1 " + mediaTest); - let isTimeOut = false; - let fdPath; - let fdNumber; - let fileAsset; - let fdHead = 'fd://'; - let fileDescriptor = undefined; - function sleep(time){ - for(let t = Date.now();Date.now() - t <= time;); - } - - beforeAll(async function () { - await applyPermission(); - console.info('beforeAll case'); - }) - - beforeEach(function () { - sleep(5000); - console.info('beforeEach case'); - }) - - afterEach(async function () { - await closeFd(); - console.info('afterEach case'); - }) - - afterAll(async function () { - console.info('afterAll case'); - }) - - async function getFd(fileName) { - fdPath = 'fd://'; - let fileKeyObj = mediaLibrary.FileKey; - let getFileOp = { - selections : fileKeyObj.DISPLAY_NAME + '= ? AND ' + fileKeyObj.RELATIVE_PATH + '= ?', - selectionArgs : [ fileName, 'img/' ], - order : fileKeyObj.ID + " DESC LIMIT 0,100", - extendArgs : "", - } - let fetchFileResult = await mediaTest.getFileAssets(getFileOp); - fileAsset = await fetchFileResult.getAllObject(); - if (fileAsset.length != undefined) { - await fileAsset[0].open('rw').then((fd) => { - 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(); - } - }) - } - }) -})