diff --git a/multimedia/image/image_js_standard/imageDecodeOptions/BUILD.gn b/multimedia/image/image_js_standard/imageDecodeOptions/BUILD.gn
index 41a1eea8c618f12ceccb32779b212a4fa4c2464b..6be641823221f40c449c61aa2d197df9e66b1902 100644
--- a/multimedia/image/image_js_standard/imageDecodeOptions/BUILD.gn
+++ b/multimedia/image/image_js_standard/imageDecodeOptions/BUILD.gn
@@ -9,7 +9,7 @@
# 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.
+# limitations under the License.
import("//test/xts/tools/build/suite.gni")
@@ -23,7 +23,9 @@ ohos_js_hap_suite("image_DecodeOptions_js_hap") {
hap_name = "ActsImageDecodeOptionsJsTest"
}
ohos_js_assets("image_DecodeOptions_js_assets") {
- source_dir = "./src/main/js/default"
+ js2abc = true
+ hap_profile = "./src/main/config.json"
+ source_dir = "./src/main/js"
}
ohos_resources("image_DecodeOptions_resources") {
sources = [ "./src/main/resources" ]
diff --git a/multimedia/image/image_js_standard/imageDecodeOptions/Test.json b/multimedia/image/image_js_standard/imageDecodeOptions/Test.json
index 715122676a16f30ac472c75b4a3349f3f982eb7e..5f0eb1c7050287470b248af14ccafe6a005f8ce3 100644
--- a/multimedia/image/image_js_standard/imageDecodeOptions/Test.json
+++ b/multimedia/image/image_js_standard/imageDecodeOptions/Test.json
@@ -1,52 +1,49 @@
-{
- "description": "Configuration for Image Tests",
- "driver": {
- "type": "JSUnitTest",
- "test-timeout": "1200000",
- "package": "ohos.acts.multimedia.image.DecodeOptions",
- "shell-timeout": "120000"
- },
- "kits": [
- {
- "test-file-name": [
- "ActsImageDecodeOptionsJsTest.hap"
- ],
- "type": "AppInstallKit",
- "cleanup-apps": true
- },
- {
- "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":[
-
- ]
- }
- ]
-
-}
+{
+ "description": "Configuration for Image Tests",
+ "driver": {
+ "type": "OHJSUnitTest",
+ "test-timeout": "1200000",
+ "shell-timeout": "1200000",
+ "bundle-name": "ohos.acts.multimedia.image.DecodeOptions",
+ "package-name": "ohos.acts.multimedia.image.DecodeOptions",
+ "testcase-timeout": 60000
+ },
+ "kits": [
+ {
+ "test-file-name": [
+ "ActsImageDecodeOptionsJsTest.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ },
+ {
+ "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": []
+ }
+ ]
+}
\ No newline at end of file
diff --git a/multimedia/image/image_js_standard/imageDecodeOptions/src/main/config.json b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/config.json
index 340aadfab3e6f81a29c7355983784d30c4f81711..afbf1d0bf5eb2f4aeca86b5b239f5818d6909ad0 100644
--- a/multimedia/image/image_js_standard/imageDecodeOptions/src/main/config.json
+++ b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/config.json
@@ -1,104 +1,132 @@
-{
- "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
- }
- }
- ]
- }
+{
+ "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": [
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "orientation": "unspecified",
+ "formsEnabled": false,
+ "name": ".MainAbility",
+ "srcLanguage": "js",
+ "srcPath": "MainAbility",
+ "icon": "$media:icon",
+ "description": "$string:MainAbility_desc",
+ "label": "$string:MainAbility_label",
+ "type": "page",
+ "visible": true,
+ "launchType": "standard"
+ },
+ {
+ "orientation": "unspecified",
+ "formsEnabled": false,
+ "name": ".TestAbility",
+ "srcLanguage": "js",
+ "srcPath": "TestAbility",
+ "icon": "$media:icon",
+ "description": "$string:TestAbility_desc",
+ "label": "$string:TestAbility_label",
+ "type": "page",
+ "visible": true,
+ "launchType": "standard"
+ }
+ ],
+ "deviceType": [
+ "phone",
+ "tablet",
+ "tv",
+ "wearable"
+ ],
+ "mainAbility": ".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": ".entry",
+ "js": [
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": "default",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": true
+ }
+ },
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": ".TestAbility",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
+ }
+ ],
+ "testRunner": {
+ "name": "OpenHarmonyTestRunner",
+ "srcPath": "TestRunner"
+ },
+ "srcPath": ""
+ }
}
\ No newline at end of file
diff --git a/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/MainAbility/app.js b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/MainAbility/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..3362c5179fc359efb448f21fca269317a35799d3
--- /dev/null
+++ b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/MainAbility/app.js
@@ -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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+import { Hypium } from '@ohos/hypium'
+import testsuite from '../test/List.test'
+
+export default {
+ onCreate() {
+ console.info('TestApplication onCreate')
+ var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ console.info('start run testcase!!!')
+ Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
+ },
+ onDestroy() {
+ console.info("TestApplication 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/MainAbility/i18n/en-US.json
similarity index 91%
rename from multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/default/i18n/en-US.json
rename to multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/MainAbility/i18n/en-US.json
index e63c70d978a3a53be988388c87182f81785e170c..a4c13dcbdc39c537073f638393d7726ac9a5cdc4 100644
--- 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/MainAbility/i18n/en-US.json
@@ -1,6 +1,6 @@
-{
- "strings": {
- "hello": "Hello",
- "world": "World"
- }
+{
+ "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/MainAbility/i18n/zh-CN.json
similarity index 91%
rename from multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/default/i18n/zh-CN.json
rename to multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/MainAbility/i18n/zh-CN.json
index de6ee5748322f44942c1b003319d8e66c837675f..b1c02368f72f929e4375a43170444de95dcc5984 100644
--- 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/MainAbility/i18n/zh-CN.json
@@ -1,6 +1,6 @@
-{
- "strings": {
- "hello": "您好",
- "world": "世界"
- }
+{
+ "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/MainAbility/pages/index/index.css
similarity index 94%
rename from multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/default/pages/index/index.css
rename to multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/MainAbility/pages/index/index.css
index 5bd7567028568bd522193b2519d545ca6dcf397d..c537ef67c7f634af1f13df6e699b0a3e123064ca 100644
--- 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/MainAbility/pages/index/index.css
@@ -1,46 +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;
- }
-}
+.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/MainAbility/pages/index/index.hml
similarity index 95%
rename from multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/default/pages/index/index.hml
rename to multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/MainAbility/pages/index/index.hml
index f64b040a5ae394dbaa5e185e1ecd4f4556b92184..f629c71a9be857db6cdf94149652a191b9b272ea 100644
--- 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/MainAbility/pages/index/index.hml
@@ -1,5 +1,5 @@
-
-
- {{ $t('strings.hello') }} {{ title }}
-
-
+
+
+ {{ $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/MainAbility/pages/index/index.js
similarity index 64%
rename from multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/default/pages/index/index.js
rename to multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/MainAbility/pages/index/index.js
index a0719cee588ac4b0f56efbf784b19647bc6645de..6e13f07516799a59adf5300cb7a609436db8122a 100644
--- 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/MainAbility/pages/index/index.js
@@ -1,41 +1,29 @@
-/*
- * 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() {
- },
+/*
+ * 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 {
+ data: {
+ title: ""
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ },
+ onShow() {
+ console.info('onShow finish')
+ },
+ onReady() {
+ },
}
\ 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/TestAbility/app.js
similarity index 91%
rename from multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/default/app.js
rename to multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/TestAbility/app.js
index e423f4bce4698ec1d7dc86c3eea3990a5e7b1085..875191631733a62e2bdff76d6b5a2e2f1b130937 100644
--- a/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/default/app.js
+++ b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/TestAbility/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) 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.
+ */
+
+export default {
+ onCreate() {
+ console.info('AceApplication onCreate');
+ },
+ onDestroy() {
+ console.info('AceApplication onDestroy');
+ }
+};
diff --git a/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/TestAbility/i18n/en-US.json b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/TestAbility/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..3cb24b374b1d919ca8eac0638f361692b603a900
--- /dev/null
+++ b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/TestAbility/i18n/en-US.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/TestAbility/i18n/zh-CN.json b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/TestAbility/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..c804e32c0c3103929baca5617cdac70be11fdba1
--- /dev/null
+++ b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/TestAbility/i18n/zh-CN.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/TestAbility/pages/index/index.css b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/TestAbility/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..b1bcd43387ba131cc1d30975ff7508a6f8084a4b
--- /dev/null
+++ b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/TestAbility/pages/index/index.css
@@ -0,0 +1,30 @@
+.container {
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ left: 0px;
+ top: 0px;
+ width: 100%;
+ height: 100%;
+}
+
+.title {
+ font-size: 60px;
+ text-align: center;
+ width: 100%;
+ height: 40%;
+ margin: 10px;
+}
+
+@media screen and (device-type: phone) and (orientation: landscape) {
+ .title {
+ font-size: 60px;
+ }
+}
+
+@media screen and (device-type: tablet) and (orientation: landscape) {
+ .title {
+ font-size: 100px;
+ }
+}
\ No newline at end of file
diff --git a/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/TestAbility/pages/index/index.hml b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/TestAbility/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..f629c71a9be857db6cdf94149652a191b9b272ea
--- /dev/null
+++ b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/TestAbility/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/TestAbility/pages/index/index.js b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/TestAbility/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..88b083a7f6b979019d6a2c5ad20b19c5fd43286b
--- /dev/null
+++ b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/TestAbility/pages/index/index.js
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ }
+}
+
+
+
diff --git a/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/TestRunner/OpenHarmonyTestRunner.js
new file mode 100644
index 0000000000000000000000000000000000000000..05ba5782592890d16fe15add4421c6187bae9511
--- /dev/null
+++ b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/TestRunner/OpenHarmonyTestRunner.js
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ */
+
+import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+
+function translateParamsToString(parameters) {
+ const keySet = new Set([
+ '-s class', '-s notClass', '-s suite', '-s itName',
+ '-s level', '-s testType', '-s size', '-s timeout',
+ '-s package', '-s dryRun'
+ ])
+ let targetParams = '';
+ for (const key in parameters) {
+ if (keySet.has(key)) {
+ targetParams += ' ' + key + ' ' + parameters[key]
+ }
+ }
+ return targetParams.trim()
+}
+
+ export default {
+ onPrepare() {
+ console.info('OpenHarmonyTestRunner OnPrepare')
+ },
+ onRun() {
+ console.log('OpenHarmonyTestRunner onRun run')
+ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+
+ var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.MainAbility'
+
+ var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
+ cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters)
+ var debug = abilityDelegatorArguments.parameters["-D"]
+ console.info('debug value : '+debug)
+ if (debug == 'true')
+ {
+ cmd += ' -D'
+ }
+ console.info('cmd : '+cmd)
+ abilityDelegator.executeShellCommand(cmd, (err, data) => {
+ console.info('executeShellCommand : err : ' + JSON.stringify(err));
+ console.info('executeShellCommand : data : ' + data.stdResult);
+ console.info('executeShellCommand : data : ' + data.exitCode);
+ })
+ }
+};
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
index 8a84d231e7d97e58517b96c3794da04a31499def..776c6814d1ab842edf8a7866dc7cee41c021cbac 100644
--- 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
@@ -1,16 +1,19 @@
-/*
- * 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
+/*
+ * 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_test from './image.test.js'
+export default function testsuite() {
+Image_test()
+}
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
index 30498a5022976446d399e47fa4eda2fbff3a2040..f973a2a0a5d848973190775ca94208d09ba3fc55 100644
--- 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
@@ -1,3175 +1,3177 @@
-/*
- * 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';
- let globalpixelmap;
-
- beforeAll(async function () {
- await applyPermission();
- console.info('beforeAll case');
- })
-
- beforeEach(function () {
- console.info('beforeEach case');
- })
-
- afterEach(async function () {
- if (globalpixelmap != undefined) {
- console.info('globalpixelmap release start');
- try {
- await globalpixelmap.release();
- } catch (error) {
- console.info('globalpixelmap release fail');
- }
- }
- 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = pixelmap;
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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 => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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 => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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: 1500, height: 1500 },
- rotate: 10,
- desiredPixelFormat: 2,
- desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 },
- index: 0
- };
- imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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: 1500, height: 1500 },
- rotate: 10,
- desiredPixelFormat: 2,
- desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 },
- index: 0
- };
- imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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) => {
- globalpixelmap = 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();
- }
- })
- })
- }
- })
-})
+/*
+ * 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 '@ohos/hypium'
+import abilityAccessCtrl from '@ohos.abilityAccessCtrl'
+import bundle from '@ohos.bundle'
+
+export default function Image_test() {
+describe('Image_test', 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';
+ let globalpixelmap;
+
+ beforeAll(async function () {
+ await applyPermission();
+ console.info('beforeAll case');
+ })
+
+ beforeEach(function () {
+ console.info('beforeEach case');
+ })
+
+ afterEach(async function () {
+ if (globalpixelmap != undefined) {
+ console.info('globalpixelmap release start');
+ try {
+ await globalpixelmap.release();
+ } catch (error) {
+ console.info('globalpixelmap release fail');
+ }
+ }
+ 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = pixelmap;
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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 => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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 => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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: 1500, height: 1500 },
+ rotate: 10,
+ desiredPixelFormat: 2,
+ desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 },
+ index: 0
+ };
+ imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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: 1500, height: 1500 },
+ rotate: 10,
+ desiredPixelFormat: 2,
+ desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 },
+ index: 0
+ };
+ imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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) => {
+ globalpixelmap = 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
index 22af6ba2c28e0a8fbe9b594f399e76a0ea6f7fc0..4522e38f2079534d8d0c376826988915a695b00d 100644
--- 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
@@ -1,12 +1,28 @@
-{
- "string": [
- {
- "name": "entry_MainAbility",
- "value": "ImageJSTestMain"
- },
- {
- "name": "mainability_description",
- "value": "ImageJSTestMain Ability"
- }
- ]
+{
+ "string": [
+ {
+ "name": "entry_MainAbility",
+ "value": "ImageJSTestMain"
+ },
+ {
+ "name": "mainability_description",
+ "value": "ImageJSTestMain Ability"
+ },
+ {
+ "name": "MainAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "MainAbility_label",
+ "value": "label"
+ },
+ {
+ "name": "TestAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "TestAbility_label",
+ "value": "label"
+ }
+ ]
}
\ No newline at end of file