From 0b1a033ca0766b69ec727309122371be13cf56fe Mon Sep 17 00:00:00 2001 From: lwx1121892 Date: Wed, 27 Apr 2022 11:09:06 +0800 Subject: [PATCH] Signed-off-by: lwx1121892 --- multimedia/image/image_js_standard/Test.json | 48 +- .../signature/openharmony_sx.p7b | Bin 3437 -> 3445 bytes .../image_js_standard/src/main/config.json | 30 + .../src/main/js/test/image.test.js | 3474 +++++++++-------- 4 files changed, 1852 insertions(+), 1700 deletions(-) diff --git a/multimedia/image/image_js_standard/Test.json b/multimedia/image/image_js_standard/Test.json index 7fafbc7b2..349477d53 100644 --- a/multimedia/image/image_js_standard/Test.json +++ b/multimedia/image/image_js_standard/Test.json @@ -2,38 +2,50 @@ "description": "Configuration for Image Tests", "driver": { "type": "JSUnitTest", - "test-timeout": "120000", + "test-timeout": "1500000", "package": "ohos.acts.multimedia.image", "shell-timeout": "120000" }, "kits": [ + { + "type": "PushKit", + "pre-push": [ + ], + "push": [ + "./resource/image/test.tiff ->/storage/media/100/local/files", + "./resource/image/test.123 ->/storage/media/100/local/files", + "./resource/image/test.bmp ->/storage/media/100/local/files", + "./resource/image/test.png ->/storage/media/100/local/files", + "./resource/image/test.gif ->/storage/media/100/local/files", + "./resource/image/test.jpg ->/storage/media/100/local/files", + "./resource/image/test_exif.jpg ->/storage/media/100/local/files", + "./resource/image/moving_test.gif ->/storage/media/100/local/files" + + ] + }, { "type": "ShellKit", "run-command": [ - "mkdir /data/accounts/account_0/appdata/image", + "mkdir /storage/media/100/local/files/cjh", + "cp /storage/media/100/local/files/test.tiff /storage/media/100/local/files/cjh/", + "cp /storage/media/100/local/files/test.123 /storage/media/100/local/files/cjh/", + "cp /storage/media/100/local/files/test.bmp /storage/media/100/local/files/cjh/", + "cp /storage/media/100/local/files/test.png /storage/media/100/local/files/cjh/", + "cp /storage/media/100/local/files/test.gif /storage/media/100/local/files/cjh/", + "cp /storage/media/100/local/files/test.jpg /storage/media/100/local/files/cjh/", + "cp /storage/media/100/local/files/test_exif.jpg /storage/media/100/local/files/cjh/", + "cp /storage/media/100/local/files/moving_test.gif /storage/media/100/local/files/cjh/", "chmod -R 666 /data/media/*", - "chmod -R 666 /data/accounts/account_0/appdata/image/*" + "chmod -R 666 /storage/media/100/local/files/cjh/*", + "killall com.ohos.medialibrary.MediaScannerAbilityA", + "aa start -a MediaScannerAbility -b com.ohos.medialibrary.MediaScannerAbilityA" ], "teardown-command":[ ] }, - { - "type": "PushKit", - "pre-push": [ - ], - "push": [ - "./resource/image/test.tiff ->/data/accounts/account_0/appdata/image", - "./resource/image/test.123 ->/data/accounts/account_0/appdata/image", - "./resource/image/test.bmp ->/data/accounts/account_0/appdata/image", - "./resource/image/test.png ->/data/accounts/account_0/appdata/image", - "./resource/image/test.gif ->/data/accounts/account_0/appdata/image", - "./resource/image/test.jpg ->/data/accounts/account_0/appdata/image", - "./resource/image/test_exif.jpg ->/data/accounts/account_0/appdata/image", - "./resource/image/moving_test.gif ->/data/accounts/account_0/appdata/image" - ] - }, + { "test-file-name": [ "ActsImageJsTest.hap" diff --git a/multimedia/image/image_js_standard/signature/openharmony_sx.p7b b/multimedia/image/image_js_standard/signature/openharmony_sx.p7b index 9be1e98fa4c0c28ca997ed660112fa16b194f0f5..d9fe0c1edd5ef09a357ed0bf05ed915a72278cca 100644 GIT binary patch delta 994 zcmZ9L&5Ij#9LCMd?z-*9QYgwUDBBz?y1U75W;5GFYwd4dGB0K_ncc}Np*k~}%p{q& z%uIG>Q)MOKQb9|XAb2QPXz@_!NyI;(;6bo@st3iJ3WCSt$>K<16)#_SK74pi-{+6D z$7_dRmKiTDzk0+R{h3KDC2!9%N{p^16A2^(PA@LMbHpUHR63aevxT$&iiz8^g=Bh` zesV3luX+B!vA0yGr)6J5Hcx;pTQSHYIgkU{&Fo|{=*1BO=tZSe(zdXEe2(v}o(T@z ze>_h!HQCp)$HR@|2dn3?QlYqmp;&PEDe!5MHqagYfIa>sf-LmwUB+q9!0bSTex0r;Lw*S zsuXsb7~5`ffr4TfTi!L>O%T0B!b9t+#7kY90sqsea;Vag+eXVkZk8r&nKKo-VW?<5 zY)VkVb#-ivhC)qbaa`BOUHfU`aXhRN5K2m0AVkq^V*TEz%~T86K4@)2Mvf44Si^f1 z>G*~6F55x0mK6!@=^ov+xsdPsj8U(b097h4q02lBX@VHjdwijUL!QJ%NXig~ z9g&S77s#L{qHcj?CwbTJ+7-T6AxK@s>I`B6yilVJ+~oD%0G;-W_Ne5$@{|(UJZM!z zw;vQm$Pyv5H-TtVGaG}v)3vA2EQ2CxE1V|?fnbYcEM$b5Nw)EV5Y(qan~Qr?C-5kn zi?}K68~OS5bS~!@j-Qj&z|UC|GZ>v&ya+zodWQ2b%S^>Ui20-=#ZC z3pki1F3)o-#6i( F^lwkLM0WrH delta 1011 zcmY+DO^6$17{{Azy6sA$ps>(hc8v$Y>?Sk$+DW0V?|kgcWOpW+B$JOJhn<;BGRb^p z=OdFDTLL*Of+8%rNDo>M6;E2Qmx3VmCWt~Q+M5W9UbLV{PlDN%u6TTZ|L6Dc9-jYS zSAV-YgXW3h>e_3^)bZ0qtXytzw~&Eka9tb1UfvX2Mb} zr>9I5-5M+QVkfe@UcoU8NZA4KX%q}-qEV{~e7JZg^3jYP5pdUJa5`ige6FR+EE5v` zl7{DOgnA6;_!!s0n;b_Hei?6!h&qD;62Lrxp-j1J3c02#89hzP7EGo___%*IO%c8t zie%GM3{{s#1jm5yb;bL2%1YJd37h(X)hSQ2I;(Q|3U*p}J(Ks%*d$ z$<+K-12oWqe57ilO4qD%G>Q%eXRj*9ps3Gc0Mx*KsCW&SAUI-D^hq___avVRgHqcQ zTwiN=ZF)qtA+<2=nhL87B$>m|9&h(LI6UoOZ2?0=!qz(bCSq|kZL&Qtdk}$}X3Z3hV8?p2i*)r0~R5ZrAk~V_n)#^i8JU!UY9>;`B zaSWPAc9#W#G)P`#F7GaG##7J#zbcD+@$?Laif{qS=8zmBK$-LAti|ADY}0?VE`JO^ z=sbzuyOTP+w$Z+Iga7f9N75fBUw-;M^48nXbE}t^t^DSCY$X~aAtJhISMXQj8^3?$ z=8VZ3AJ{B5`BwP5{JwNl{^7~H@mF7uzI@?+UiQCRVIJQ~CSKfl>8|zjFCQL0IIP}z O@9x*m7r#Di|MU+})KR(s diff --git a/multimedia/image/image_js_standard/src/main/config.json b/multimedia/image/image_js_standard/src/main/config.json index 9d3eebf15..6f5090860 100644 --- a/multimedia/image/image_js_standard/src/main/config.json +++ b/multimedia/image/image_js_standard/src/main/config.json @@ -56,6 +56,36 @@ "deliveryWithInstall": true, "moduleName": "entry" }, + "reqPermissions": [ + { + "name": "ohos.permission.GET_BUNDLE_INFO", + "reason": "use ohos.permission.GET_BUNDLE_INFO" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name" : "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", + "reason" : "use ohos.permission.GRANT_SENSITIVE_PERMISSIONS" + }, + { + "name" : "ohos.permission.REVOKE_SENSITIVE_PERMISSIONS", + "reason" : "use ohos.permission.REVOKE_SENSITIVE_PERMISSIONS" + }, + { + "name": "ohos.permission.MEDIA_LOCATION", + "reason":"use ohos.permission.MEDIA_LOCATION" + }, + { + "name": "ohos.permission.READ_MEDIA", + "reason":"use ohos.permission.READ_MEDIA" + }, + { + "name": "ohos.permission.WRITE_MEDIA", + "reason":"use ohos.permission.WRITE_MEDIA" + } + ], "package": "ohos.acts.multimedia.image", "name": ".MyApplication", "js": [ diff --git a/multimedia/image/image_js_standard/src/main/js/test/image.test.js b/multimedia/image/image_js_standard/src/main/js/test/image.test.js index d35b363d3..e2e0fac36 100644 --- a/multimedia/image/image_js_standard/src/main/js/test/image.test.js +++ b/multimedia/image/image_js_standard/src/main/js/test/image.test.js @@ -17,705 +17,849 @@ import image from '@ohos.multimedia.image' import fileio from '@ohos.fileio' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' import {testPng, testJpg, tc_020buf, tc_020_1buf, tc_021buf, tc_021_1buf, tc_022buf} from './testImg' +import mediaLibrary from '@ohos.multimedia.mediaLibrary'; +import featureAbility from '@ohos.ability.featureAbility'; +import resourceManager from '@ohos.resourceManager' +import abilityAccessCtrl from '@ohos.abilityAccessCtrl' +import bundle from '@ohos.bundle' describe('Image', function () { - var pathJpg = '/data/accounts/account_0/appdata/image/test.jpg'; - var pathBmp = '/data/accounts/account_0/appdata/image/test.bmp'; - var pathGif = '/data/accounts/account_0/appdata/image/test.gif'; - var pathPng = '/data/accounts/account_0/appdata/image/test.png'; - var pathMovingGif = '/data/accounts/account_0/appdata/image/moving_test.gif'; - var pathExifJpg = '/data/accounts/account_0/appdata/image/test_exif.jpg'; - var pathTiff = '/data/accounts/account_0/appdata/image/test.tiff'; - beforeAll(function () { + const contextAPI = featureAbility.getContext(); + const mediaTest = mediaLibrary.getMediaLibrary(contextAPI); + console.log("case 1 " + mediaTest); + let isTimeOut = false; + let fdPath; + let fdNumber; + let fileAsset; + let fdHead = 'fd://'; + let fileDescriptor = undefined; + function sleep(time){ + for(let t = Date.now();Date.now() - t <= time;); + } + + beforeAll(async function () { + await applyPermission(); console.info('beforeAll case'); }) beforeEach(function () { - isTimeOut = false; + sleep(5000); console.info('beforeEach case'); }) - afterEach(function () { + afterEach(async function () { + await closeFd(); console.info('afterEach case'); }) - afterAll(function () { + afterAll(async function () { console.info('afterAll case'); }) - /** - * @tc.number : TC_001 - * @tc.name : create pixelmap-promise (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer) - * @tc.desc : 1.create InitializationOptions object - * 2.set editable,pixeFormat,size - * 3.using color and opts create newPixelMap - * 4.return newpixelmap not empty - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ - it('TC_001', 0, async function (done) { - const Color = new ArrayBuffer(96); - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(Color, opts) - .then( pixelmap => { + async function getFd(fileName) { + fdPath = 'fd://'; + let fileKeyObj = mediaLibrary.FileKey; + let getFileOp = { + selections : fileKeyObj.DISPLAY_NAME + '= ? AND ' + fileKeyObj.RELATIVE_PATH + '= ?', + selectionArgs : [ fileName, 'cjh/' ], + order : fileKeyObj.ID + " DESC LIMIT 0,100", + extendArgs : "", + } + let fetchFileResult = await mediaTest.getFileAssets(getFileOp); + fileAsset = await fetchFileResult.getAllObject(); + if (fileAsset.length != undefined) { + await fileAsset[0].open('rw').then((fd) => { + if (fd == undefined) { + console.info('[mediaLibrary]case open fd faild'); + } else { + fdNumber = fd; + fdPath = fdPath + '' + fdNumber; + console.info('[mediaLibrary]case open fd success, fd = ' + fdPath); + } + }).catch((err) => { + console.info('[mediaLibrary]case open fd faild'); + }); + } else { + console.info('[mediaLibrary]case getAllObject faild'); + } + } + + async function closeFd() { + if (fileAsset != null) { + await fileAsset[0].close(fdNumber).then(() => { + console.info('[mediaLibrary] case close fd success'); + }).catch((err) => { + console.info('[mediaLibrary] case close fd failed'); + }); + } else { + console.info('[mediaLibrary] case fileAsset is null'); + } + } + async function applyPermission(){ + let appInfo = await bundle.getApplicationInfo('ohos.acts.multimedia.image',0,100); + let atManager = abilityAccessCtrl.createAtManager(); + if(atManager != null){ + let tokenID = appInfo.accessTokenId; + console.info('[permission]case accessTokenId is' + tokenID); + let permissionName1 = 'ohos.permission.MEDIA_LOCATION'; + let permissionName2 = 'ohos.permission.READ_MEDIA'; + let permissionName3 = 'ohos.permission.WRITE_MEDIA'; + await atManager.grantUserGrantedPermission(tokenID,permissionName1).then((result)=>{ + console.info('[permission]case grantUserGrantedPermission success:' + result); + }).catch((err)=>{ + console.info('[permission]case grantUserGrantedPermission failed:' + err); + }); + await atManager.grantUserGrantedPermission(tokenID,permissionName2).then((result)=>{ + console.info('[permission]case grantUserGrantedPermission success:' + result); + }).catch((err)=>{ + console.info('[permission]case grantUserGrantedPermission failed:' + err); + }); + await atManager.grantUserGrantedPermission(tokenID,permissionName3).then((result)=>{ + console.info('[permission]case grantUserGrantedPermission success:' + result); + }).catch((err)=>{ + console.info('[permission]case grantUserGrantedPermission failed:' + err); + }); + }else{ + console.info('[permission]case apply permission failed,createAtManager failed'); + } + } + + /** + * @tc.number : TC_001 + * @tc.name : create pixelmap-promise (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixeFormat,size + * 3.using color and opts create newPixelMap + * 4.return newpixelmap not empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('TC_001', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(Color, opts) + .then( pixelmap => { + expect(pixelmap != undefined).assertTrue(); + console.info('TC_001 success'); + done(); + }) + .catch(error => { + console.log('TC_001 error: ' + error); + expect().assertFail(); + done(); + }) + }) + + /** + * @tc.number : TC_001-1 + * @tc.name : create pixelmap-callback (editable: false, pixelFormat: RGBA_8888, size: { height: 4, width: 6 },bytes = buffer) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixelFormat,size + * 3.using colorand opts create newPixelMap + * 4.return newpixelmap not empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('TC_001-1', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: false, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(Color, opts, (err, pixelmap) => { expect(pixelmap != undefined).assertTrue(); - console.info('TC_001 success'); + console.info('TC_001-1 success'); done(); }) - .catch(error => { - console.log('TC_001 error: ' + error); - expect().assertFail(); + }) + /** + * @tc.number : TC_001-2 + * @tc.name : createpixelmap-promise (editable: true, pixelFormat: RGB_565, size: { height: 6, width: 8 },bytes = buffer) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixelFormat,size + * 3.using colorand opts create newPixelMap + * 4.return newpixelmap not empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('TC_001-2', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 2, size: { height: 6, width: 8 } } + image.createPixelMap(Color, opts) + .then( pixelmap => { + expect(pixelmap != undefined).assertTrue(); + console.info('TC_001-2 success'); + done(); + }) + .catch(error => { + console.log('TC_001-2 error: ' + error); + expect().assertFail(); + done(); + }) + }) + + /** + * @tc.number : TC_001-3 + * @tc.name : createpixelmap-callback (editable: false, pixelFormat: RGB_565, size: { height: 6, width: 8 },bytes = buffer) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixelFormat,size + * 3.using colorand opts create newPixelMap + * 4.return newpixelmap not empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('TC_001-3', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: false, pixelFormat: 2, size: { height: 6, width: 8 } } + image.createPixelMap(Color, opts, (err, pixelmap) => { + expect(pixelmap != undefined).assertTrue(); + console.info('TC_001-3 success'); done(); + }) }) - - /** - * @tc.number : TC_001-1 - * @tc.name : create pixelmap-callback (editable: false, pixelFormat: RGBA_8888, size: { height: 4, width: 6 },bytes = buffer) - * @tc.desc : 1.create InitializationOptions object - * 2.set editable,pixelFormat,size - * 3.using colorand opts create newPixelMap - * 4.return newpixelmap not empty - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ - it('TC_001-1', 0, async function (done) { - const Color = new ArrayBuffer(96); - let opts = { editable: false, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(Color, opts, (err, pixelmap) => { - expect(pixelmap != undefined).assertTrue(); - console.info('TC_001-1 success'); - done(); + /** + * @tc.number : TC_001-4 + * @tc.name : createpixelmap-promise(editable: true, pixelFormat: unkonwn, size: { height: 6, width: 8 }) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixelFormat,size + * 3.using colorand opts create newPixelMap + * 4.return newpixelmap not empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('TC_001-4', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 0, size: { height: 6, width: 8 } } + image.createPixelMap(Color, opts) + .then( pixelmap => { + expect(pixelmap != undefined).assertTrue(); + console.info('TC_001-4 success'); + done(); + }) + .catch(error => { + console.log('TC_001-4 error: ' + error); + expect().assertFail(); + done(); + }) }) - }) - /** - * @tc.number : TC_001-2 - * @tc.name : createpixelmap-promise (editable: true, pixelFormat: RGB_565, size: { height: 6, width: 8 },bytes = buffer) - * @tc.desc : 1.create InitializationOptions object - * 2.set editable,pixelFormat,size - * 3.using colorand opts create newPixelMap - * 4.return newpixelmap not empty - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ - it('TC_001-2', 0, async function (done) { - const Color = new ArrayBuffer(96); - let opts = { editable: true, pixelFormat: 2, size: { height: 6, width: 8 } } - image.createPixelMap(Color, opts) - .then( pixelmap => { + + /** + * @tc.number : TC_001-5 + * @tc.name : create pixelmap-callback(editable: false, pixelFormat: unkonwn, size: { height: 6, width: 8 }) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixelFormat,size + * 3.using colorand opts create newPixelMap + * 4.return newpixelmap not empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('TC_001-5', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: false, pixelFormat: 0, size: { height: 6, width: 8 } } + image.createPixelMap(Color, opts, (err, pixelmap) => { expect(pixelmap != undefined).assertTrue(); - console.info('TC_001-2 success'); + console.info('TC_001-5 success'); done(); }) - .catch(error => { - console.log('TC_001-2 error: ' + error); - expect().assertFail(); + }) + /** + * @tc.number : TC_001-6 + * @tc.name : create pixelmap-callback(editable: true, pixelFormat: RGBA_8888, size: { height: 6, width: 8 } bytes > buffer ) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixeFormat,size + * 3.using color and opts create newPixelMap + * 4.return newpixelmap not empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('TC_001-6', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 3, size: { height: 6, width: 8 } } + image.createPixelMap(Color, opts, (err, pixelmap) => { + expect(pixelmap != undefined).assertTrue(); + console.info('TC_001-6 success'); done(); }) }) - /** - * @tc.number : TC_001-3 - * @tc.name : createpixelmap-callback (editable: false, pixelFormat: RGB_565, size: { height: 6, width: 8 },bytes = buffer) - * @tc.desc : 1.create InitializationOptions object - * 2.set editable,pixelFormat,size - * 3.using colorand opts create newPixelMap - * 4.return newpixelmap not empty - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ - it('TC_001-3', 0, async function (done) { - const Color = new ArrayBuffer(96); - let opts = { editable: false, pixelFormat: 2, size: { height: 6, width: 8 } } - image.createPixelMap(Color, opts, (err, pixelmap) => { - expect(pixelmap != undefined).assertTrue(); - console.info('TC_001-3 success'); - done(); - - }) - }) - /** - * @tc.number : TC_001-4 - * @tc.name : createpixelmap-promise(editable: true, pixelFormat: unkonwn, size: { height: 6, width: 8 }) - * @tc.desc : 1.create InitializationOptions object - * 2.set editable,pixelFormat,size - * 3.using colorand opts create newPixelMap - * 4.return newpixelmap not empty - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ - it('TC_001-4', 0, async function (done) { - const Color = new ArrayBuffer(96); - let opts = { editable: true, pixelFormat: 0, size: { height: 6, width: 8 } } - image.createPixelMap(Color, opts) - .then( pixelmap => { + /** + * @tc.number : TC_001-7 + * @tc.name : create pixelmap-callback(editable: true, pixelFormat: RGB_565, size: { height: 2, width: 3 }, bytes < buffer) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixeFormat,size + * 3.using color and opts create newPixelMap + * 4.return newpixelmap not empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('TC_001-7', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 2, size: { height: 2, width: 3 } } + image.createPixelMap(Color, opts, (err, pixelmap) => { expect(pixelmap != undefined).assertTrue(); - console.info('TC_001-4 success'); + console.info('TC_001-7 success'); done(); }) - .catch(error => { - console.log('TC_001-4 error: ' + error); - expect().assertFail(); + }) + + /** + * @tc.number : TC_001-8 + * @tc.name : create pixelmap-callback(editable: true, pixelFormat: unkonwn, size: { height: -1, width: -1 }) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixeFormat,size + * 3.using color and opts create newPixelMap + * 4.return newpixelmap empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('TC_001-8', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 0, size: { height: -1, width: -1 } } + image.createPixelMap(Color, opts, (err, pixelmap) => { + expect(pixelmap == undefined).assertTrue(); + console.info('TC_001-8 success'); done(); }) - }) - - /** - * @tc.number : TC_001-5 - * @tc.name : create pixelmap-callback(editable: false, pixelFormat: unkonwn, size: { height: 6, width: 8 }) - * @tc.desc : 1.create InitializationOptions object - * 2.set editable,pixelFormat,size - * 3.using colorand opts create newPixelMap - * 4.return newpixelmap not empty - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ - it('TC_001-5', 0, async function (done) { - const Color = new ArrayBuffer(96); - let opts = { editable: false, pixelFormat: 0, size: { height: 6, width: 8 } } - image.createPixelMap(Color, opts, (err, pixelmap) => { - expect(pixelmap != undefined).assertTrue(); - console.info('TC_001-5 success'); - done(); }) - }) - /** - * @tc.number : TC_001-6 - * @tc.name : create pixelmap-callback(editable: true, pixelFormat: RGBA_8888, size: { height: 6, width: 8 } bytes > buffer ) - * @tc.desc : 1.create InitializationOptions object - * 2.set editable,pixeFormat,size - * 3.using color and opts create newPixelMap - * 4.return newpixelmap not empty - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ - it('TC_001-6', 0, async function (done) { - const Color = new ArrayBuffer(96); - let opts = { editable: true, pixelFormat: 3, size: { height: 6, width: 8 } } - image.createPixelMap(Color, opts, (err, pixelmap) => { - expect(pixelmap != undefined).assertTrue(); - console.info('TC_001-6 success'); - done(); - }) - }) - /** - * @tc.number : TC_001-7 - * @tc.name : create pixelmap-callback(editable: true, pixelFormat: RGB_565, size: { height: 2, width: 3 }, bytes < buffer) - * @tc.desc : 1.create InitializationOptions object - * 2.set editable,pixeFormat,size - * 3.using color and opts create newPixelMap - * 4.return newpixelmap not empty - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ - it('TC_001-7', 0, async function (done) { - const Color = new ArrayBuffer(96); - let opts = { editable: true, pixelFormat: 2, size: { height: 2, width: 3 } } - image.createPixelMap(Color, opts, (err, pixelmap) => { - expect(pixelmap != undefined).assertTrue(); - console.info('TC_001-7 success'); - done(); + /** + * @tc.number : TC_001-9 + * @tc.name : create pixelmap-callback(editable: true, pixelFormat: unsupported format, size: { height: 6, width: 8 }) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixeFormat,size + * 3.using color and opts create newPixelMap + * 4.return newpixelmap empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it('TC_001-9', 0, async function (done) { + const Color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 1, size: { height: 6, width: 8 } } + image.createPixelMap(Color, opts, (err, pixelmap) => { + expect(pixelmap == undefined).assertTrue(); + console.info('TC_001-9 success'); + done(); + }) }) - }) - /** - * @tc.number : TC_001-8 - * @tc.name : create pixelmap-callback(editable: true, pixelFormat: unkonwn, size: { height: -1, width: -1 }) - * @tc.desc : 1.create InitializationOptions object - * 2.set editable,pixeFormat,size - * 3.using color and opts create newPixelMap - * 4.return newpixelmap empty - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ - it('TC_001-8', 0, async function (done) { - const Color = new ArrayBuffer(96); - let opts = { editable: true, pixelFormat: 0, size: { height: -1, width: -1 } } - image.createPixelMap(Color, opts, (err, pixelmap) => { - expect(pixelmap == undefined).assertTrue(); - console.info('TC_001-8 success'); - done(); - }) - }) + /** + * @tc.number : TC_020 + * @tc.name : readPixelsToBuffer-promise + * @tc.desc : read all pixels to an buffer + * 1.create PixelMap,buffer + * 2.call readPixelsToBuffer + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_020', 0, async function (done) { + console.info('TC_020 in'); + const color = new ArrayBuffer(96); + var bufferArr = new Uint8Array(color); + for (var i = 0; i < bufferArr.length; i++) { + bufferArr[i] = i + 1; + } - /** - * @tc.number : TC_001-9 - * @tc.name : create pixelmap-callback(editable: true, pixelFormat: unsupported format, size: { height: 6, width: 8 }) - * @tc.desc : 1.create InitializationOptions object - * 2.set editable,pixeFormat,size - * 3.using color and opts create newPixelMap - * 4.return newpixelmap empty - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ - it('TC_001-9', 0, async function (done) { - const Color = new ArrayBuffer(96); - let opts = { editable: true, pixelFormat: 1, size: { height: 6, width: 8 } } - image.createPixelMap(Color, opts, (err, pixelmap) => { - expect(pixelmap == undefined).assertTrue(); - console.info('TC_001-9 success'); - done(); + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(color, opts) + .then( pixelmap => { + if (pixelmap == undefined) { + console.info('TC_020 createPixelMap failed'); + expect(false).assertTrue() + done(); + } + const readBuffer = new ArrayBuffer(96); + pixelmap.readPixelsToBuffer(readBuffer).then(() => { + var bufferArr2 = new Uint8Array(readBuffer); + var res = true; + for (var i = 0; i < bufferArr2.length; i++) { + if (bufferArr2[i] != tc_020buf[i]) { + res = false; + console.info('TC_20_buffer'+ bufferArr2[i]); + console.info('TC_020 failed'); + expect(false).assertTrue(); + done(); + break; + } + } + if (res) { + console.info('TC_020 success'); + expect(true).assertTrue() + done(); + } + }).catch(error => { + console.log('TC_020 read error: ' + error); + expect().assertFail(); + done(); + }) + }).catch(error => { + console.log('TC_020 error: ' + error); + expect().assertFail(); + done(); + }) }) - }) - /** - * @tc.number : TC_020 - * @tc.name : readPixelsToBuffer-promise - * @tc.desc : read all pixels to an buffer - * 1.create PixelMap,buffer - * 2.call readPixelsToBuffer - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_020', 0, async function (done) { - console.info('TC_020 in'); - const color = new ArrayBuffer(96); - var bufferArr = new Uint8Array(color); - for (var i = 0; i < bufferArr.length; i++) { - bufferArr[i] = i + 1; - } + /** + * @tc.number : TC_020-1 + * @tc.name : readPixelsToBuffer-callback + * @tc.desc : read all pixels to an buffer + * 1.create PixelMap,buffer + * 2.call readPixelsToBuffer + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_020-1', 0, async function (done) { + console.info('TC_020-1 in'); + const color = new ArrayBuffer(96); + var bufferArr = new Uint8Array(color); + for (var i = 0; i < bufferArr.length; i++) { + bufferArr[i] = i + 1; + } - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts) - .then( pixelmap => { - if (pixelmap == undefined) { - console.info('TC_020 createPixelMap failed'); - expect(false).assertTrue() + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(color, opts, (err, pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_020-1 createPixelMap failed'); + expect(false).assertTrue(); done(); - } - const readBuffer = new ArrayBuffer(96); - pixelmap.readPixelsToBuffer(readBuffer).then(() => { - var bufferArr2 = new Uint8Array(readBuffer); - var res = true; - for (var i = 0; i < bufferArr2.length; i++) { - if (bufferArr2[i] != tc_020buf[i]) { + }else{ + const readBuffer = new ArrayBuffer(96); + pixelmap.readPixelsToBuffer(readBuffer,() => { + var bufferArr = new Uint8Array(readBuffer); + var res = true; + for (var i = 0; i < bufferArr.length; i++) { + if (bufferArr[i] != tc_020_1buf[i]) { res = false; - console.info('TC_20_buffer'+ bufferArr2[i]); - console.info('TC_020 failed'); + console.info('TC_020-1 failed'); expect(false).assertTrue(); done(); break; } } - if (res) { - console.info('TC_020 success'); - expect(true).assertTrue() - done(); - } - }).catch(error => { - console.log('TC_020 read error: ' + error); - expect().assertFail(); - done(); - }) - }).catch(error => { - console.log('TC_020 error: ' + error); - expect().assertFail(); - done(); - }) - }) - - /** - * @tc.number : TC_020-1 - * @tc.name : readPixelsToBuffer-callback - * @tc.desc : read all pixels to an buffer - * 1.create PixelMap,buffer - * 2.call readPixelsToBuffer - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_020-1', 0, async function (done) { - console.info('TC_020-1 in'); - const color = new ArrayBuffer(96); - var bufferArr = new Uint8Array(color); - for (var i = 0; i < bufferArr.length; i++) { - bufferArr[i] = i + 1; - } - - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts, (err, pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_020-1 createPixelMap failed'); - expect(false).assertTrue(); - done(); - }else{ - const readBuffer = new ArrayBuffer(96); - pixelmap.readPixelsToBuffer(readBuffer,() => { - var bufferArr = new Uint8Array(readBuffer); - var res = true; - for (var i = 0; i < bufferArr.length; i++) { - if (bufferArr[i] != tc_020_1buf[i]) { - res = false; - console.info('TC_020-1 failed'); - expect(false).assertTrue(); + if (res) { + console.info('TC_020-1 success'); + expect(true).assertTrue() done(); - break; } - } - if (res) { - console.info('TC_020-1 success'); - expect(true).assertTrue() - done(); - } - }) - } + }) + } + }) }) - }) - /** - * @tc.number : TC_020-2 - * @tc.name : readPixelsToBuffer-callback(buffer:0) - * @tc.desc : read all pixels to an buffer - * 1.create PixelMap,buffer - * 2.call readPixelsToBuffer - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_020-2', 0, async function (done) { - console.info('TC_020-2 in'); - const color = new ArrayBuffer(96); - var bufferArr = new Uint8Array(color); - for (var i = 0; i < bufferArr.length; i++) { - bufferArr[i] = i + 1; - } + /** + * @tc.number : TC_020-2 + * @tc.name : readPixelsToBuffer-callback(buffer:0) + * @tc.desc : read all pixels to an buffer + * 1.create PixelMap,buffer + * 2.call readPixelsToBuffer + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_020-2', 0, async function (done) { + console.info('TC_020-2 in'); + const color = new ArrayBuffer(96); + var bufferArr = new Uint8Array(color); + for (var i = 0; i < bufferArr.length; i++) { + bufferArr[i] = i + 1; + } - let opts = { editable: true, pixelFormat: 2, size: { height: 6, width: 8 } } - image.createPixelMap(color, opts, (err,pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_020-2 createPixelMap failed'); - expect(false).assertTrue(); - done(); - }else{ - const readBuffer = new ArrayBuffer(0); - pixelmap.readPixelsToBuffer(readBuffer,() => { - var bufferArr = new Uint8Array(readBuffer); - var res = true; - for (var i = 0; i < bufferArr.length; i++) { - if (bufferArr[i] == 0) { - res = false; - console.info('TC_020-2 failed'); - expect(false).assertTrue(); + let opts = { editable: true, pixelFormat: 2, size: { height: 6, width: 8 } } + image.createPixelMap(color, opts, (err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_020-2 createPixelMap failed'); + expect(false).assertTrue(); + done(); + }else{ + const readBuffer = new ArrayBuffer(0); + pixelmap.readPixelsToBuffer(readBuffer,() => { + var bufferArr = new Uint8Array(readBuffer); + var res = true; + for (var i = 0; i < bufferArr.length; i++) { + if (bufferArr[i] == 0) { + res = false; + console.info('TC_020-2 failed'); + expect(false).assertTrue(); + done(); + break; + } + } + if (res) { + console.info('TC_020-2 success'); + expect(true).assertTrue() done(); - break; } - } - if (res) { - console.info('TC_020-2 success'); - expect(true).assertTrue() + }) + } + }) + }) + + /** + * @tc.number : TC_021 + * @tc.name : readPixels-promise + * @tc.desc : 1.create PixelMap + * 2.call readPixels + * 3.promise return array + * 4.callbackcall return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_021', 0, async function (done) { + const color = new ArrayBuffer(96); + var bufferArr = new Uint8Array(color); + for (var i = 0; i < bufferArr.length; i++) { + bufferArr[i] = i + 1; + } + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(color, opts) + .then( pixelmap => { + if (pixelmap == undefined) { + console.info('TC_021 createPixelMap failed'); + expect(false).assertTrue() done(); } + const area = { pixels: new ArrayBuffer(8), + offset: 0, + stride: 8, + region: { size: { height: 1, width: 2 }, x: 0, y: 0 } + } + pixelmap.readPixels(area).then(() => { + var bufferArr2 = new Uint8Array(area.pixels); + var res = true; + for (var i = 0; i < bufferArr2.length; i++) { + if (bufferArr2[i] != tc_021buf[i]) { + res = false; + console.info('TC_021 failed'); + expect(false).assertTrue(); + done(); + break; + } + } + if (res) { + console.info('TC_021 success'); + expect(true).assertTrue() + done(); + } + }) }) - } - }) - }) - - /** - * @tc.number : TC_021 - * @tc.name : readPixels-promise - * @tc.desc : 1.create PixelMap - * 2.call readPixels - * 3.promise return array - * 4.callbackcall return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_021', 0, async function (done) { - const color = new ArrayBuffer(96); - var bufferArr = new Uint8Array(color); - for (var i = 0; i < bufferArr.length; i++) { - bufferArr[i] = i + 1; - } - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts) - .then( pixelmap => { - if (pixelmap == undefined) { - console.info('TC_021 createPixelMap failed'); - expect(false).assertTrue() + .catch(error => { + console.log('TC_021 error: ' + error); + expect().assertFail(); done(); - } - const area = { pixels: new ArrayBuffer(8), - offset: 0, - stride: 8, - region: { size: { height: 1, width: 2 }, x: 0, y: 0 } - } - pixelmap.readPixels(area).then(() => { - var bufferArr2 = new Uint8Array(area.pixels); - var res = true; - for (var i = 0; i < bufferArr2.length; i++) { - if (bufferArr2[i] != tc_021buf[i]) { - res = false; - console.info('TC_021 failed'); - expect(false).assertTrue(); + }) + }) + + /** + * @tc.number : TC_021-1 + * @tc.name : readPixels-callback + * @tc.desc : 1.create PixelMap + * 2.call readPixels + * 3.promise return array + * 4.callbackcall return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_021-1', 0, async function (done) { + const color = new ArrayBuffer(96); + var bufferArr = new Uint8Array(color); + for (var i = 0; i < bufferArr.length; i++) { + bufferArr[i] = i + 1; + } + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(color, opts, (err, pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_020-1 createPixelMap failed'); + expect(false).assertTrue(); + done(); + }else{ + const area = { pixels: new ArrayBuffer(8), + offset: 0, + stride: 8, + region: { size: { height: 1, width: 2 }, x: 0, y: 0 }} + pixelmap.readPixels(area, () => { + var bufferArr = new Uint8Array(area.pixels); + var res = true; + for (var i = 0; i < bufferArr.length; i++) { + console.info('TC_021-1 buffer ' + bufferArr[i]); + if(bufferArr[i] != tc_021_1buf[i]) { + res = false; + console.info('TC_021-1 failed'); + expect(false).assertTrue(); + done(); + break; + } + } + if (res) { + console.info('TC_021-1 success'); + expect(true).assertTrue() done(); - break; } - } - if (res) { - console.info('TC_021 success'); - expect(true).assertTrue() - done(); - } - }) - }) - .catch(error => { - console.log('TC_021 error: ' + error); - expect().assertFail(); - done(); + }) + } }) - }) + }) - /** - * @tc.number : TC_021-1 - * @tc.name : readPixels-callback - * @tc.desc : 1.create PixelMap - * 2.call readPixels - * 3.promise return array - * 4.callbackcall return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_021-1', 0, async function (done) { - const color = new ArrayBuffer(96); - var bufferArr = new Uint8Array(color); - for (var i = 0; i < bufferArr.length; i++) { - bufferArr[i] = i + 1; - } - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts, (err, pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_020-1 createPixelMap failed'); - expect(false).assertTrue(); - done(); - }else{ - const area = { pixels: new ArrayBuffer(8), - offset: 0, - stride: 8, - region: { size: { height: 1, width: 2 }, x: 0, y: 0 }} - pixelmap.readPixels(area, () => { - var bufferArr = new Uint8Array(area.pixels); - var res = true; - for (var i = 0; i < bufferArr.length; i++) { - console.info('TC_021-1 buffer ' + bufferArr[i]); - if(bufferArr[i] != tc_021_1buf[i]) { - res = false; - console.info('TC_021-1 failed'); - expect(false).assertTrue(); - done(); - break; - } - } - if (res) { - console.info('TC_021-1 success'); - expect(true).assertTrue() + /** + * @tc.number : TC_021-2 + * @tc.name : readPixels-callback( region: { size: { height: 1, width: 2 }, x: -1, y: -1 }) + * @tc.desc : 1.create PixelMap + * 2.call readPixels + * 3.promise return array + * 4.callbackcall return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_021-2', 0, async function (done) { + const color = new ArrayBuffer(96); + var bufferArr = new Uint8Array(color); + for (var i = 0; i < bufferArr.length; i++) { + bufferArr[i] = i + 1; + } + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(color, opts, (err,pixelmap) => { + if(pixelmap == undefined){ + expect(false).assertTrue(); + console.info('TC_021-2 create pixelmap fail'); + done(); + }else{ + const area = { pixels: new ArrayBuffer(20), + offset: 0, + stride: 8, + region: { size: { height: 1, width: 2 }, x: -1, y: -1 }} + pixelmap.readPixels(area).then(()=>{ + console.info('TC_021-2 failed'); + expect(false).assertTrue(); done(); - } - }) + }).catch(()=>{ + expect(true).assertTrue(); + console.info('TC_021-2 success'); + done(); + }) + } + }) + }) + + /** + * @tc.number : TC_021-3 + * @tc.name : readPixels-promise(buffer:0) + * @tc.desc : 1.create PixelMap + * 2.call readPixels + * 3.promise return array + * 4.callbackcall return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_021-3', 0, async function (done) { + const color = new ArrayBuffer(96); + var bufferArr = new Uint8Array(color); + for (var i = 0; i < bufferArr.length; i++) { + bufferArr[i] = i + 1; } + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(color, opts, (err,pixelmap) => { + if(pixelmap == undefined){ + expect(false).assertTrue(); + console.info('TC_021-3 create pixelmap failed'); + done(); + }else{ + const area = { pixels: new ArrayBuffer(0), + offset: 0, + stride: 8, + region: { size: { height: 1, width: 2 }, x: 0, y: 0 }} + pixelmap.readPixels(area).then(()=>{ + console.info('TC_021-3 failed'); + expect(false).assertTrue(); + done(); + }).catch(()=>{ + expect(true).assertTrue(); + console.info('TC_021-3 success'); + done(); + }) + } + }) }) - }) - /** - * @tc.number : TC_021-2 - * @tc.name : readPixels-callback( region: { size: { height: 1, width: 2 }, x: -1, y: -1 }) - * @tc.desc : 1.create PixelMap - * 2.call readPixels - * 3.promise return array - * 4.callbackcall return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_021-2', 0, async function (done) { - const color = new ArrayBuffer(96); - var bufferArr = new Uint8Array(color); - for (var i = 0; i < bufferArr.length; i++) { - bufferArr[i] = i + 1; - } - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts, (err,pixelmap) => { - if(pixelmap == undefined){ - expect(false).assertTrue(); - console.info('TC_021-2 create pixelmap fail'); - done(); - }else{ + /** + * @tc.number : TC_021-4 + * @tc.name : readPixels-promise(offset > buffer) + * @tc.desc : 1.create PixelMap + * 2.call readPixels + * 3.promise return array + * 4.callbackcall return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_021-4', 0, async function (done) { + const color = new ArrayBuffer(96); + var bufferArr = new Uint8Array(color); + for (var i = 0; i < bufferArr.length; i++) { + bufferArr[i] = i + 1; + } + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(color, opts, (err, pixelmap) => { + if(pixelmap == undefined){ + expect(false).assertTrue(); + console.info('TC_021-4 createPixelMap success'); + done(); + } const area = { pixels: new ArrayBuffer(20), - offset: 0, + offset: 21, stride: 8, - region: { size: { height: 1, width: 2 }, x: -1, y: -1 }} + region: { size: { height: 1, width: 2 }, x: 0, y: 0 }} pixelmap.readPixels(area).then(()=>{ - console.info('TC_021-2 failed'); + console.info('TC_021-4 failed'); expect(false).assertTrue(); done(); }).catch(()=>{ expect(true).assertTrue(); - console.info('TC_021-2 success'); - done(); + console.info('TC_021-4 success'); + done(); }) - } - }) - }) + }) + }) - /** - * @tc.number : TC_021-3 - * @tc.name : readPixels-promise(buffer:0) - * @tc.desc : 1.create PixelMap - * 2.call readPixels - * 3.promise return array - * 4.callbackcall return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_021-3', 0, async function (done) { - const color = new ArrayBuffer(96); - var bufferArr = new Uint8Array(color); - for (var i = 0; i < bufferArr.length; i++) { - bufferArr[i] = i + 1; - } - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts, (err,pixelmap) => { - if(pixelmap == undefined){ - expect(false).assertTrue(); - console.info('TC_021-3 create pixelmap failed'); - done(); - }else{ - const area = { pixels: new ArrayBuffer(0), + /** + * @tc.number : TC_021-5 + * @tc.name : readPixels-promise(region: { size: { height: -1, width:-1}, x: 0, y: 0 }) + * @tc.desc : 1.create PixelMap + * 2.call readPixels + * 3.promise return array + * 4.callbackcall return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_021-5', 0, async function (done) { + const color = new ArrayBuffer(96); + var bufferArr = new Uint8Array(color); + for (var i = 0; i < bufferArr.length; i++) { + bufferArr[i] = i + 1; + } + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(color, opts, (err,pixelmap) => { + if(pixelmap == undefined){ + expect(false).assertTrue(); + console.info('TC_021-5 createPixelMap success'); + done(); + } + const area = { pixels: new ArrayBuffer(20), offset: 0, stride: 8, - region: { size: { height: 1, width: 2 }, x: 0, y: 0 }} + region: { size: { height: -1, width:-1}, x: 0, y: 0 }} pixelmap.readPixels(area).then(()=>{ - console.info('TC_021-3 failed'); - expect(false).assertTrue(); - done(); - }).catch(()=>{ - expect(true).assertTrue(); - console.info('TC_021-3 success'); - done(); - }) - } + console.info('TC_021-5 failed'); + expect(false).assertTrue(); + done(); + }).catch(()=>{ + expect(true).assertTrue(); + console.info('TC_021-5 success'); + done(); + }) + }) }) - }) - /** - * @tc.number : TC_021-4 - * @tc.name : readPixels-promise(offset > buffer) - * @tc.desc : 1.create PixelMap - * 2.call readPixels - * 3.promise return array - * 4.callbackcall return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_021-4', 0, async function (done) { - const color = new ArrayBuffer(96); - var bufferArr = new Uint8Array(color); - for (var i = 0; i < bufferArr.length; i++) { - bufferArr[i] = i + 1; - } - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts, (err, pixelmap) => { - if(pixelmap == undefined){ - expect(false).assertTrue(); - console.info('TC_021-4 createPixelMap success'); - done(); - } - const area = { pixels: new ArrayBuffer(20), - offset: 21, - stride: 8, - region: { size: { height: 1, width: 2 }, x: 0, y: 0 }} - pixelmap.readPixels(area).then(()=>{ - console.info('TC_021-4 failed'); - expect(false).assertTrue(); - done(); - }).catch(()=>{ - expect(true).assertTrue(); - console.info('TC_021-4 success'); - done(); - }) - }) - }) + /** + * @tc.number : TC_022 + * @tc.name : writePixels-promise + * @tc.desc : 1.create PixelMap + * 2.call writePixels + * 3.call return undefined + * 4.callbackcall return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_022', 0, async function (done) { + const color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(color, opts) + .then( pixelmap => { + if (pixelmap == undefined) { + console.info('TC_022 createPixelMap failed'); + expect(false).assertTrue() + done(); + } - /** - * @tc.number : TC_021-5 - * @tc.name : readPixels-promise(region: { size: { height: -1, width:-1}, x: 0, y: 0 }) - * @tc.desc : 1.create PixelMap - * 2.call readPixels - * 3.promise return array - * 4.callbackcall return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_021-5', 0, async function (done) { - const color = new ArrayBuffer(96); - var bufferArr = new Uint8Array(color); - for (var i = 0; i < bufferArr.length; i++) { - bufferArr[i] = i + 1; - } - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts, (err,pixelmap) => { - if(pixelmap == undefined){ - expect(false).assertTrue(); - console.info('TC_021-5 createPixelMap success'); - done(); - } - const area = { pixels: new ArrayBuffer(20), - offset: 0, - stride: 8, - region: { size: { height: -1, width:-1}, x: 0, y: 0 }} - pixelmap.readPixels(area).then(()=>{ - console.info('TC_021-5 failed'); - expect(false).assertTrue(); - done(); - }).catch(()=>{ - expect(true).assertTrue(); - console.info('TC_021-5 success'); - done(); - }) + const area = { pixels: new ArrayBuffer(8), + offset: 0, + stride: 8, + region: { size: { height: 1, width: 2 }, x: 0, y: 0 } + } + var bufferArr = new Uint8Array(area.pixels); + for (var i = 0; i < bufferArr.length; i++) { + bufferArr[i] = i + 1; + } + + pixelmap.writePixels(area).then(() => { + const readArea = { pixels: new ArrayBuffer(8), + offset: 0, + stride: 8, + region: { size: { height: 1, width: 2 }, x: 0, y: 0 } + } + pixelmap.readPixels(readArea).then(() => { + var readArr = new Uint8Array(readArea.pixels); + var res = true; + for (var i = 0; i < readArr.length; i++) { + if (readArr[i] != tc_022buf[i]) { + res = false; + console.info('TC_022 failed'); + expect(false).assertTrue(); + done(); + break; + } + } + if (res) { + console.info('TC_022 success'); + expect(true).assertTrue() + done(); + } + }) + }) + }) + .catch(error => { + console.log('TC_022 error: ' + error); + expect().assertFail(); + done(); + }) }) - }) - - /** - * @tc.number : TC_022 - * @tc.name : writePixels-promise - * @tc.desc : 1.create PixelMap - * 2.call writePixels - * 3.call return undefined - * 4.callbackcall return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_022', 0, async function (done) { - const color = new ArrayBuffer(96); - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts) - .then( pixelmap => { + + /** + * @tc.number : TC_022-1 + * @tc.name : writePixels-callback + * @tc.desc : 1.create PixelMap + * 2.call writePixels + * 3.call return undefined + * 4.callbackcall return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_022-1', 0, async function (done) { + const color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(color, opts, (err, pixelmap) => { if (pixelmap == undefined) { - console.info('TC_022 createPixelMap failed'); + console.info('TC_022-1 createPixelMap failed'); expect(false).assertTrue() done(); } - const area = { pixels: new ArrayBuffer(8), offset: 0, stride: 8, @@ -725,27 +869,26 @@ describe('Image', function () { for (var i = 0; i < bufferArr.length; i++) { bufferArr[i] = i + 1; } - - pixelmap.writePixels(area).then(() => { + pixelmap.writePixels(area, () => { const readArea = { pixels: new ArrayBuffer(8), offset: 0, stride: 8, region: { size: { height: 1, width: 2 }, x: 0, y: 0 } } - pixelmap.readPixels(readArea).then(() => { + pixelmap.readPixels(readArea,() => { var readArr = new Uint8Array(readArea.pixels); var res = true; for (var i = 0; i < readArr.length; i++) { - if (readArr[i] != tc_022buf[i]) { + if (readArr[i] == 0) { res = false; - console.info('TC_022 failed'); + console.info('TC_022-1 failed'); expect(false).assertTrue(); done(); break; - } + } } if (res) { - console.info('TC_022 success'); + console.info('TC_022-1 success'); expect(true).assertTrue() done(); } @@ -753,397 +896,335 @@ describe('Image', function () { }) }) .catch(error => { - console.log('TC_022 error: ' + error); + console.log('TC_022-1 error: ' + error); expect().assertFail(); done(); }) - }) + }) - /** - * @tc.number : TC_022-1 - * @tc.name : writePixels-callback - * @tc.desc : 1.create PixelMap - * 2.call writePixels - * 3.call return undefined - * 4.callbackcall return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_022-1', 0, async function (done) { - const color = new ArrayBuffer(96); - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts, (err, pixelmap) => { - if (pixelmap == undefined) { - console.info('TC_022-1 createPixelMap failed'); - expect(false).assertTrue() - done(); - } - const area = { pixels: new ArrayBuffer(8), - offset: 0, - stride: 8, - region: { size: { height: 1, width: 2 }, x: 0, y: 0 } - } - var bufferArr = new Uint8Array(area.pixels); - for (var i = 0; i < bufferArr.length; i++) { - bufferArr[i] = i + 1; - } - pixelmap.writePixels(area, () => { - const readArea = { pixels: new ArrayBuffer(8), - offset: 0, - stride: 8, - region: { size: { height: 1, width: 2 }, x: 0, y: 0 } - } - pixelmap.readPixels(readArea,() => { - var readArr = new Uint8Array(readArea.pixels); - var res = true; - for (var i = 0; i < readArr.length; i++) { - if (readArr[i] == 0) { - res = false; - console.info('TC_022-1 failed'); - expect(false).assertTrue(); - done(); - break; - } - } - if (res) { - console.info('TC_022-1 success'); - expect(true).assertTrue() + /** + * @tc.number : TC_023 + * @tc.name : writeBufferToPixels-promise + * @tc.desc : 1.create PixelMap,buffer + * 2.call writeBufferToPixels + * 3.call return undefined + * 4.callbackcall return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_023', 0, async function (done) { + const color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 }} + image.createPixelMap(color, opts) + .then( pixelmap => { + if (pixelmap == undefined) { + console.info('TC_023 createPixelMap failed'); + expect(false).assertTrue() done(); } + + const writeColor = new ArrayBuffer(96); + var bufferArr = new Uint8Array(writeColor); + for (var i = 0; i < bufferArr.length; i++) { + bufferArr[i] = i + 1; + } + pixelmap.writeBufferToPixels(writeColor).then(() => { + const readBuffer = new ArrayBuffer(96); + pixelmap.readPixelsToBuffer(readBuffer).then(() => { + var bufferArr = new Uint8Array(readBuffer); + var res = true; + for (var i = 0; i < bufferArr.length; i++) { + if (bufferArr[i] == 0) { + res = false; + console.info('TC_023 failed'); + expect(false).assertTrue() + done(); + break; + } + } + if (res) { + console.info('TC_023 success'); + expect(true).assertTrue(); + done(); + } + }) + }) + }) + .catch(error => { + console.log('TC_023 error: ' + error); + expect().assertFail(); + done(); }) - }) - }) - .catch(error => { - console.log('TC_022-1 error: ' + error); - expect().assertFail(); - done(); }) - }) - /** - * @tc.number : TC_023 - * @tc.name : writeBufferToPixels-promise - * @tc.desc : 1.create PixelMap,buffer - * 2.call writeBufferToPixels - * 3.call return undefined - * 4.callbackcall return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_023', 0, async function (done) { - const color = new ArrayBuffer(96); - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 }} - image.createPixelMap(color, opts) - .then( pixelmap => { - if (pixelmap == undefined) { - console.info('TC_023 createPixelMap failed'); + /** + * @tc.number : TC_023-1 + * @tc.name : writeBufferToPixels-callback + * @tc.desc : 1.create PixelMap,buffer + * 2.call writeBufferToPixels + * 3.call return undefined + * 4.callbackcall return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_023-1', 0, async function (done) { + const color = new ArrayBuffer(96); + var bufferArr = new Uint8Array(color); + for (var i = 0; i < bufferArr.length; i++) { + bufferArr[i] = i + 1; + } + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(color, opts).then( pixelmap => { + if(pixelmap == undefined){ expect(false).assertTrue() + console.info('TC_023-1 failed'); done(); } - const writeColor = new ArrayBuffer(96); - var bufferArr = new Uint8Array(writeColor); - for (var i = 0; i < bufferArr.length; i++) { - bufferArr[i] = i + 1; - } - pixelmap.writeBufferToPixels(writeColor).then(() => { + pixelmap.writeBufferToPixels(writeColor,() => { const readBuffer = new ArrayBuffer(96); - pixelmap.readPixelsToBuffer(readBuffer).then(() => { + pixelmap.readPixelsToBuffer(readBuffer,() => { var bufferArr = new Uint8Array(readBuffer); var res = true; for (var i = 0; i < bufferArr.length; i++) { - if (bufferArr[i] == 0) { - res = false; - console.info('TC_023 failed'); - expect(false).assertTrue() - done(); - break; + if(res) { + if (bufferArr[i] == 0) { + res = false; + console.info('TC_023-1 Success'); + expect(true).assertTrue() + done(); + break; + } } } if (res) { - console.info('TC_023 success'); - expect(true).assertTrue(); + console.info('TC_023-1 no change after writeBuffer'); + expect(false).assertTrue(); done(); } }) }) }) - .catch(error => { - console.log('TC_023 error: ' + error); - expect().assertFail(); - done(); - }) - }) + }) - /** - * @tc.number : TC_023-1 - * @tc.name : writeBufferToPixels-callback - * @tc.desc : 1.create PixelMap,buffer - * 2.call writeBufferToPixels - * 3.call return undefined - * 4.callbackcall return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_023-1', 0, async function (done) { - const color = new ArrayBuffer(96); - var bufferArr = new Uint8Array(color); - for (var i = 0; i < bufferArr.length; i++) { - bufferArr[i] = i + 1; - } - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts).then( pixelmap => { - if(pixelmap == undefined){ - expect(false).assertTrue() - console.info('TC_023-1 failed'); - done(); - } - const writeColor = new ArrayBuffer(96); - pixelmap.writeBufferToPixels(writeColor,() => { - const readBuffer = new ArrayBuffer(96); - pixelmap.readPixelsToBuffer(readBuffer,() => { - var bufferArr = new Uint8Array(readBuffer); - var res = true; - for (var i = 0; i < bufferArr.length; i++) { - if(res) { - if (bufferArr[i] == 0) { - res = false; - console.info('TC_023-1 Success'); - expect(true).assertTrue() - done(); - break; - } - } + /** + * @tc.number : TC_024 + * @tc.name : getImageInfo-pixelmap-promise + * @tc.desc : 1.create PixelMap,ImageInfo + * 2.call getImageInfo + * 3.call return imageinfo + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_024', 0, async function (done) { + const color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 2, size: { height: 6, width: 8 } } + image.createPixelMap(color, opts) + .then( pixelmap => { + if (pixelmap == undefined) { + console.info('TC_024 createPixelMap failed'); + expect(false).assertTrue() + done(); + } + pixelmap.getImageInfo().then( imageInfo => { + if (imageInfo == undefined) { + console.info('TC_024 imageInfo is empty'); + expect(false).assertTrue() + done(); } - if (res) { - console.info('TC_023-1 no change after writeBuffer'); - expect(false).assertTrue(); + if(imageInfo.size.height == 4 && imageInfo.size.width == 6){ + console.info('TC_024 success '); + expect(true).assertTrue() done(); } - }) - }) - }) - }) - - /** - * @tc.number : TC_024 - * @tc.name : getImageInfo-pixelmap-promise - * @tc.desc : 1.create PixelMap,ImageInfo - * 2.call getImageInfo - * 3.call return imageinfo - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_024', 0, async function (done) { - const color = new ArrayBuffer(96); - let opts = { editable: true, pixelFormat: 2, size: { height: 6, width: 8 } } - image.createPixelMap(color, opts) - .then( pixelmap => { - if (pixelmap == undefined) { - console.info('TC_024 createPixelMap failed'); - expect(false).assertTrue() - done(); - } - pixelmap.getImageInfo().then( imageInfo => { - if (imageInfo == undefined) { - console.info('TC_024 imageInfo is empty'); - expect(false).assertTrue() done(); - } - if(imageInfo.size.height == 4 && imageInfo.size.width == 6){ - console.info('TC_024 success '); - expect(true).assertTrue() + }).catch(error => { + console.log('TC_024 getimageinfo error: ' + error); + expect().assertFail(); done(); - } + }) done(); - }).catch(error => { - console.log('TC_024 getimageinfo error: ' + error); + }) + .catch(error => { + console.log('TC_024 error: ' + error); expect().assertFail(); done(); }) - done(); - }) - .catch(error => { - console.log('TC_024 error: ' + error); - expect().assertFail(); - done(); }) - }) - /** - * @tc.number : TC_024-1 - * @tc.name : getImageInfo-pixelmap-callback - * @tc.desc : 1.create PixelMap,ImageInfo - * 2.call getImageInfo - * 3.call return imageinfo - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_024-1', 0, async function (done) { - const color = new ArrayBuffer(96); - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts, (err,pixelmap) => { - if(pixelmap == undefined){ - expect(false).assertTrue() - console.info('TC_024-1 create pixelmap fail'); - done(); - } - pixelmap.getImageInfo( (err,imageInfo) => { - if (imageInfo == undefined) { - console.info('TC_024-1 imageInfo is empty'); + /** + * @tc.number : TC_024-1 + * @tc.name : getImageInfo-pixelmap-callback + * @tc.desc : 1.create PixelMap,ImageInfo + * 2.call getImageInfo + * 3.call return imageinfo + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_024-1', 0, async function (done) { + const color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(color, opts, (err,pixelmap) => { + if(pixelmap == undefined){ expect(false).assertTrue() + console.info('TC_024-1 create pixelmap fail'); done(); - } - if(imageInfo.size.height == 4 && imageInfo.size.width == 6){ - console.info('TC_024-1 imageInfo success'); - expect(true).assertTrue() + } + pixelmap.getImageInfo( (err,imageInfo) => { + if (imageInfo == undefined) { + console.info('TC_024-1 imageInfo is empty'); + expect(false).assertTrue() + done(); + } + if(imageInfo.size.height == 4 && imageInfo.size.width == 6){ + console.info('TC_024-1 imageInfo success'); + expect(true).assertTrue() + done(); + } done(); - } - done(); + }) }) }) - }) - /** - * @tc.number : TC_025-1 - * @tc.name : getBytesNumberPerRow - * @tc.desc : 1.create PixelMap - * 2.set PixelMap - * 3.call getBytesNumberPerRow - * 4. call return number - * 5.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_025-1', 0, async function (done) { - const color = new ArrayBuffer(96); - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - const expectNum = 4 * opts.size.width; - image.createPixelMap(color, opts, (err,pixelmap) => { - if(pixelmap == undefined){ - expect(false).assertTrue() - console.info('TC_25-1 create pixelmap fail'); - done(); - } else { - const num = pixelmap.getBytesNumberPerRow(); - console.info('TC_025-1 num is ' + num); - expect(num == expectNum).assertTrue(); - if(num == expectNum) { - console.info('TC_25-1 success'); + /** + * @tc.number : TC_025-1 + * @tc.name : getBytesNumberPerRow + * @tc.desc : 1.create PixelMap + * 2.set PixelMap + * 3.call getBytesNumberPerRow + * 4. call return number + * 5.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_025-1', 0, async function (done) { + const color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + const expectNum = 4 * opts.size.width; + image.createPixelMap(color, opts, (err,pixelmap) => { + if(pixelmap == undefined){ + expect(false).assertTrue() + console.info('TC_25-1 create pixelmap fail'); + done(); } else { - console.info('TC_25-1 fail'); + const num = pixelmap.getBytesNumberPerRow(); + console.info('TC_025-1 num is ' + num); + expect(num == expectNum).assertTrue(); + if(num == expectNum) { + console.info('TC_25-1 success'); + } else { + console.info('TC_25-1 fail'); + } + done(); } - done(); - } + }) }) - }) - /** - * @tc.number : TC_026-1 - * @tc.name : getPixelBytesNumber - * @tc.desc : 1.create PixelMap - * 2.set Pixel - * 3.call getPixelBytesNumber - * 4. call return number - * 5.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_026-1', 0, async function (done) { - const color = new ArrayBuffer(96); - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - const expectNum = 4 * opts.size.width * opts.size.height; - image.createPixelMap(color, opts,(err,pixelmap) => { - if(pixelmap == undefined){ - expect(false).assertTrue() - console.info('TC_026-1 create pixelmap fail'); - done(); - } else { - const num = pixelmap.getPixelBytesNumber(); - console.info('TC_026-1 num is ' + num); - expect(num == expectNum).assertTrue(); - if(num == expectNum) { - console.info('TC_026-1 success'); + /** + * @tc.number : TC_026-1 + * @tc.name : getPixelBytesNumber + * @tc.desc : 1.create PixelMap + * 2.set Pixel + * 3.call getPixelBytesNumber + * 4. call return number + * 5.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_026-1', 0, async function (done) { + const color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + const expectNum = 4 * opts.size.width * opts.size.height; + image.createPixelMap(color, opts,(err,pixelmap) => { + if(pixelmap == undefined){ + expect(false).assertTrue() + console.info('TC_026-1 create pixelmap fail'); + done(); } else { - console.info('TC_026-1 fail'); + const num = pixelmap.getPixelBytesNumber(); + console.info('TC_026-1 num is ' + num); + expect(num == expectNum).assertTrue(); + if(num == expectNum) { + console.info('TC_026-1 success'); + } else { + console.info('TC_026-1 fail'); + } + done(); } - done(); - } + }) }) - }) - /** - * @tc.number : TC_027 - * @tc.name : release-pixelmap-promise - * @tc.desc : 1.create PixelMap - * 2.set Pixel - * 3.call release - * 4.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_027', 0, async function (done) { - const color = new ArrayBuffer(96); - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts).then(pixelmap => { - if (pixelmap == undefined) { - console.info('TC_027 createPixelMap failed'); - expect(false).assertTrue() - done(); - } - pixelmap.release().then(() => { - console.info('TC_027 success'); - expect(true).assertTrue(); - done(); + /** + * @tc.number : TC_027 + * @tc.name : release-pixelmap-promise + * @tc.desc : 1.create PixelMap + * 2.set Pixel + * 3.call release + * 4.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_027', 0, async function (done) { + const color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(color, opts).then(pixelmap => { + if (pixelmap == undefined) { + console.info('TC_027 createPixelMap failed'); + expect(false).assertTrue() + done(); + } + pixelmap.release().then(() => { + console.info('TC_027 success'); + expect(true).assertTrue(); + done(); + }).catch(error => { + console.log('TC_027 error: ' + error); + expect().assertFail(); + done(); + }) }).catch(error => { - console.log('TC_027 error: ' + error); + console.log('TC_027 createPixelMap failed error: ' + error); expect().assertFail(); done(); }) - }).catch(error => { - console.log('TC_027 createPixelMap failed error: ' + error); - expect().assertFail(); - done(); }) - }) - /** - * @tc.number : TC_027-1 - * @tc.name : release-pixelmap-callback - * @tc.desc : 1.create PixelMap - * 2.set Pixel - * 3.call release - * 4.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_027-1', 0, async function (done) { - const color = new ArrayBuffer(96); - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts, (err, pixelmap) => { - if (pixelmap == undefined) { - console.info('TC_027-1 createPixelMap failed'); - expect(false).assertTrue() - done(); - } - pixelmap.release(()=>{ - expect(true).assertTrue(); - console.log('TC_027-1 success'); - done(); - }) - }) - }) + /** + * @tc.number : TC_027-1 + * @tc.name : release-pixelmap-callback + * @tc.desc : 1.create PixelMap + * 2.set Pixel + * 3.call release + * 4.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_027-1', 0, async function (done) { + const color = new ArrayBuffer(96); + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } + image.createPixelMap(color, opts, (err, pixelmap) => { + if (pixelmap == undefined) { + console.info('TC_027-1 createPixelMap failed'); + expect(false).assertTrue() + done(); + } + pixelmap.release(()=>{ + expect(true).assertTrue(); + console.log('TC_027-1 success'); + done(); + }) + }) + }) /** * @tc.number : TC_041 @@ -1156,8 +1237,9 @@ describe('Image', function () { * @tc.level : Level 0 */ it('TC_041', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); - const imageSourceApi = image.createImageSource(fdJpg); + await getFd("test.jpg"); + + const imageSourceApi = image.createImageSource(fdNumber); expect(imageSourceApi != undefined).assertTrue(); console.info('TC_041 success'); done(); @@ -1174,8 +1256,8 @@ describe('Image', function () { * @tc.level : Level 0 */ it('TC_041-1', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); - const imageSourceApi = image.createImageSource(fdBmp); + await getFd("test.bmp"); + const imageSourceApi = image.createImageSource(fdNumber); expect(imageSourceApi != undefined).assertTrue(); console.info('TC_041-1 success'); done(); @@ -1192,8 +1274,8 @@ describe('Image', function () { * @tc.level : Level 0 */ it('TC_041-2', 0, async function (done) { - let fdGif = fileio.openSync(pathGif); - const imageSourceApi = image.createImageSource(fdGif); + await getFd("test.gif"); + const imageSourceApi = image.createImageSource(fdNumber); expect(imageSourceApi != undefined).assertTrue(); console.info('TC_041-2 success'); done(); @@ -1210,8 +1292,8 @@ describe('Image', function () { * @tc.level : Level 0 */ it('TC_041-3', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); - const imageSourceApi = image.createImageSource(fdPng); + await getFd("test.png"); + const imageSourceApi = image.createImageSource(fdNumber); expect(imageSourceApi != undefined).assertTrue(); console.info('TC_041-3 success'); done(); @@ -1262,8 +1344,9 @@ describe('Image', function () { * @tc.level : Level 0 */ it('TC_042', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); - const imageSourceApi = image.createImageSource(fdJpg); + await getFd("test.jpg"); + + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_042 create image source failed'); expect(false).assertTrue(); @@ -1305,7 +1388,7 @@ describe('Image', function () { * @tc.level : Level 0 */ it('TC_043', 0, async function (done) { - console.info('TC_043 start'); + console.info('TC_043 start'); const data = testJpg.buffer; const imageSourceApi = image.createImageSource(data); if (imageSourceApi == undefined) { @@ -1332,7 +1415,7 @@ describe('Image', function () { * @tc.level : Level 0 */ it('TC_043-1', 0, async function (done) { - console.info('TC_043-1 start'); + console.info('TC_043-1 start'); const data = new ArrayBuffer(0); const imageSourceApi = image.createImageSource(data); expect(imageSourceApi == undefined).assertTrue(); @@ -1349,10 +1432,11 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_044', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); - const imageSourceApi = image.createImageSource(fdJpg); + await getFd("test.jpg"); + + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_044 create image source failed'); expect(false).assertTrue(); @@ -1379,10 +1463,11 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_044-1', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); - const imageSourceApi = image.createImageSource(fdJpg); + await getFd("test.jpg"); + + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_044-1 create image source failed'); expect(false).assertTrue(); @@ -1405,10 +1490,11 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_045', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); - const imageSourceApi = image.createImageSource(fdJpg); + await getFd("test.jpg"); + + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_045 create image source failed'); expect(false).assertTrue(); @@ -1433,10 +1519,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_045-1', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); - const imageSourceApi = image.createImageSource(fdBmp); + await getFd("test.bmp"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_045-1 create image source failed'); expect(false).assertTrue(); @@ -1461,10 +1547,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_045-2', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); - const imageSourceApi = image.createImageSource(fdPng); + await getFd("test.png"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_045-2 create image source failed'); expect(false).assertTrue(); @@ -1489,11 +1575,11 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_045-3', 0, async function (done) { console.info('TC_045-3'); - let fdGif = fileio.openSync(pathGif); - const imageSourceApi = image.createImageSource(fdGif); + await getFd("test.gif"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_045-3 create image source failed'); expect(false).assertTrue(); @@ -1518,10 +1604,11 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_046', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); - const imageSourceApi = image.createImageSource(fdJpg); + await getFd("test.jpg"); + + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_046 create image source failed'); expect(false).assertTrue(); @@ -1546,10 +1633,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_046-1', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); - const imageSourceApi = image.createImageSource(fdBmp); + await getFd("test.bmp"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_046-1 create image source failed'); expect(false).assertTrue(); @@ -1574,10 +1661,10 @@ describe('Image', function () { * @tc.size : MEDIUM MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_046-2', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); - const imageSourceApi = image.createImageSource(fdPng); + await getFd("test.png"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_046-2 create image source failed'); expect(false).assertTrue(); @@ -1602,10 +1689,10 @@ describe('Image', function () { * @tc.size : MEDIUM MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_046-3', 0, async function (done) { - let fdGif = fileio.openSync(pathGif); - const imageSourceApi = image.createImageSource(fdGif); + await getFd("test.gif"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_046-3 create image source failed'); expect(false).assertTrue(); @@ -1630,10 +1717,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_046-4', 0, async function (done) { - let fdGif = fileio.openSync(pathGif); - const imageSourceApi = image.createImageSource(fdGif); + await getFd("test.gif"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_046-4 create image source failed'); expect(false).assertTrue(); @@ -1660,10 +1747,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_046-5', 0, async function (done) { - let fdGif = fileio.openSync(pathGif); - const imageSourceApi = image.createImageSource(fdGif); + await getFd("test.gif"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_046-5 create image source failed'); expect(false).assertTrue(); @@ -1685,23 +1772,24 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_047', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); - const imageSourceApi = image.createImageSource(fdJpg); + + await getFd("test.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_047 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageInfo(0) - .then(imageInfo => { - expect(imageInfo != undefined).assertTrue(); - console.info('TC_047 imageInfo'); - console.info('imageInfo.size.height:'+imageInfo.size.height); - console.info('imageInfo.size.width:'+imageInfo.size.width); - done(); - }).catch(error => { + .then(imageInfo => { + expect(imageInfo != undefined).assertTrue(); + console.info('TC_047 imageInfo'); + console.info('imageInfo.size.height:'+imageInfo.size.height); + console.info('imageInfo.size.width:'+imageInfo.size.width); + done(); + }).catch(error => { console.log('TC_047 error: ' + error); expect().assertFail(); done(); @@ -1718,23 +1806,23 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_047-1', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); - const imageSourceApi = image.createImageSource(fdBmp); + await getFd("test.bmp"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_047-1 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageInfo(0) - .then(imageInfo => { - expect(imageInfo != undefined).assertTrue(); - console.info('TC_047-1 imageInfo'); - console.info('imageInfo.size.height:'+imageInfo.size.height); - console.info('imageInfo.size.width:'+imageInfo.size.width); - done(); - }).catch(error => { + .then(imageInfo => { + expect(imageInfo != undefined).assertTrue(); + console.info('TC_047-1 imageInfo'); + console.info('imageInfo.size.height:'+imageInfo.size.height); + console.info('imageInfo.size.width:'+imageInfo.size.width); + done(); + }).catch(error => { console.log('TC_047-1 error: ' + error); expect().assertFail(); done(); @@ -1751,23 +1839,23 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_047-2', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); - const imageSourceApi = image.createImageSource(fdPng); + await getFd("test.png"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_047-2 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageInfo(0) - .then(imageInfo => { - expect(imageInfo != undefined).assertTrue(); - console.info('TC_047-2 imageInfo'); - console.info('imageInfo.size.height:'+imageInfo.size.height); - console.info('imageInfo.size.width:'+imageInfo.size.width); - done(); - }).catch(error => { + .then(imageInfo => { + expect(imageInfo != undefined).assertTrue(); + console.info('TC_047-2 imageInfo'); + console.info('imageInfo.size.height:'+imageInfo.size.height); + console.info('imageInfo.size.width:'+imageInfo.size.width); + done(); + }).catch(error => { console.log('TC_047-2 error: ' + error); expect().assertFail(); done(); @@ -1784,23 +1872,23 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_047-3', 0, async function (done) { - let fdGif = fileio.openSync(pathGif); - const imageSourceApi = image.createImageSource(fdGif); + await getFd("test.gif"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_047-3 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageInfo(0) - .then(imageInfo => { - expect(imageInfo != undefined).assertTrue(); - console.info('TC_047-3 '); - console.info('imageInfo.size.height:'+imageInfo.size.height); - console.info('imageInfo.size.width:'+imageInfo.size.width); - done(); - }).catch(error => { + .then(imageInfo => { + expect(imageInfo != undefined).assertTrue(); + console.info('TC_047-3 '); + console.info('imageInfo.size.height:'+imageInfo.size.height); + console.info('imageInfo.size.width:'+imageInfo.size.width); + done(); + }).catch(error => { console.log('TC_047-3 error: ' + error); expect().assertFail(); done(); @@ -1817,21 +1905,21 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_047-4', 0, async function (done) { - let fdGif = fileio.openSync(pathGif); - const imageSourceApi = image.createImageSource(fdGif); + await getFd("test.gif"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_047-4 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageInfo(1) - .then(() => { - console.log('TC_047-4 failed'); - expect().assertFail(); - done(); - }).catch(error => { + .then(() => { + console.log('TC_047-4 failed'); + expect().assertFail(); + done(); + }).catch(error => { console.log('TC_047-4 success'); expect(true).assertTrue(); done(); @@ -1848,28 +1936,28 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_047-5', 0, async function (done) { - let fdGif = fileio.openSync(pathGif); - const imageSourceApi = image.createImageSource(fdGif); + await getFd("test.gif"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_047-5 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageInfo(-1) - .then(() => { - console.log('TC_047-5 failed'); - expect().assertFail(); - done(); - }).catch(error => { + .then(() => { + console.log('TC_047-5 failed'); + expect().assertFail(); + done(); + }).catch(error => { console.log('TC_047-5 success'); expect(true).assertTrue(); done(); }) } }) - + /** * @tc.number : TC_050 * @tc.name : createPixelMap(decodingOptions)-pixelformat:RGBA_8888-jpg @@ -1882,8 +1970,9 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_050', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); - const imageSourceApi = image.createImageSource(fdJpg); + + await getFd("test.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_050 create image source failed'); expect(false).assertTrue(); @@ -1891,7 +1980,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:3, @@ -1903,7 +1992,7 @@ describe('Image', function () { expect(pixelmap != undefined ).assertTrue(); done(); }) - } + } }) /** * @tc.number : TC_050-1 @@ -1916,9 +2005,10 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_050-1', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); - const imageSourceApi = image.createImageSource(fdJpg); + it('TC_050-1', 0, async function (done) { + + await getFd("test.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_050-1 create image source failed'); expect(false).assertTrue(); @@ -1926,7 +2016,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:2, @@ -1938,7 +2028,7 @@ describe('Image', function () { expect(pixelmap != undefined ).assertTrue(); done(); }) - } + } }) /** * @tc.number : TC_050-2 @@ -1951,9 +2041,10 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_050-2', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); - const imageSourceApi = image.createImageSource(fdJpg); + it('TC_050-2', 0, async function (done) { + + await getFd("test.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_050-2 create image source failed'); expect(false).assertTrue(); @@ -1961,7 +2052,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:0, @@ -1973,7 +2064,7 @@ describe('Image', function () { expect(pixelmap != undefined ).assertTrue(); done(); }) - } + } }) /** * @tc.number : TC_050-3 @@ -1987,8 +2078,9 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_050-3', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); - const imageSourceApi = image.createImageSource(fdJpg); + + await getFd("test.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_050-3 create image source failed'); expect(false).assertTrue(); @@ -1996,7 +2088,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:0, @@ -2011,8 +2103,8 @@ describe('Image', function () { }else{ expect(false).assertTrue(); done(); - } - }) + } + }) } }) @@ -2028,8 +2120,9 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_050-4', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); - const imageSourceApi = image.createImageSource(fdJpg); + + await getFd("test.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_050-4 create image source failed'); expect(false).assertTrue(); @@ -2037,7 +2130,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:0, @@ -2052,7 +2145,7 @@ describe('Image', function () { }else{ expect(false).assertTrue(); done(); - } + } }) } }) @@ -2069,8 +2162,9 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_050-5', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); - const imageSourceApi = image.createImageSource(fdJpg); + + await getFd("test.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_050-5 create image source failed'); expect(false).assertTrue(); @@ -2078,7 +2172,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:-1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:0, @@ -2093,8 +2187,8 @@ describe('Image', function () { }else{ expect(false).assertTrue(); done(); - } - }) + } + }) } }) @@ -2110,8 +2204,9 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_050-6', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); - const imageSourceApi = image.createImageSource(fdJpg); + + await getFd("test.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_050-6 create image source failed'); expect(false).assertTrue(); @@ -2119,7 +2214,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:-10, desiredPixelFormat:2, @@ -2134,8 +2229,8 @@ describe('Image', function () { }else{ expect(false).assertTrue(); done(); - } - }) + } + }) } }) @@ -2151,8 +2246,9 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_050-7', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); - const imageSourceApi = image.createImageSource(fdJpg); + + await getFd("test.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_050-7 create image source failed'); expect(false).assertTrue(); @@ -2160,7 +2256,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:60, @@ -2175,8 +2271,8 @@ describe('Image', function () { }else{ expect(false).assertTrue(); done(); - } - }) + } + }) } }) @@ -2192,8 +2288,9 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_050-8', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); - const imageSourceApi = image.createImageSource(fdJpg); + + await getFd("test.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_050-8 create image source failed'); expect(false).assertTrue(); @@ -2201,7 +2298,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: false, + editable: false, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:2, @@ -2228,8 +2325,9 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_050-9', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); - const imageSourceApi = image.createImageSource(fdJpg); + + await getFd("test.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_050-9 create image source failed'); expect(false).assertTrue(); @@ -2237,7 +2335,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:10000, height:10000}, rotate:10, desiredPixelFormat:2, @@ -2249,7 +2347,7 @@ describe('Image', function () { expect(pixelmap != undefined ).assertTrue(); done(); }) - } + } }) /** @@ -2264,8 +2362,9 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_050-10', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); - const imageSourceApi = image.createImageSource(fdJpg); + + await getFd("test.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_050-10 create image source failed'); expect(false).assertTrue(); @@ -2273,7 +2372,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:2, @@ -2288,11 +2387,11 @@ describe('Image', function () { }else{ expect(false).assertTrue(); done(); - } - }) + } + }) } }) - + /** * @tc.number : TC_050-11 * @tc.name : createPixelMapdecodingOptions:x -1 y -1)-jpg @@ -2303,10 +2402,11 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_050-11', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); - const imageSourceApi = image.createImageSource(fdJpg); + + await getFd("test.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_050-11 create image source failed'); expect(false).assertTrue(); @@ -2314,7 +2414,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:2, @@ -2329,92 +2429,94 @@ describe('Image', function () { }else{ expect(false).assertTrue(); done(); - } - }) + } + }) } }) - /** - * @tc.number : TC_050-12 - * @tc.name : createPixelMap(decodingOptions:x > image.height y > image.width)-jpg + /** + * @tc.number : TC_050-12 + * @tc.name : createPixelMap(decodingOptions:x > image.height y > image.width)-jpg + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_050-12', 0, async function (done) { + + await getFd("test.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_050-12 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:10, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: 10000, y: 10000 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_050-12 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }) + + /** + * @tc.number : TC_050-13 + * @tc.name : createPixelMap(decodingOptions:rotate>360)-jpg * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap * 4.callback return undefined - * @tc.size : MEDIUM + * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_050-12', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); - const imageSourceApi = image.createImageSource(fdJpg); - if (imageSourceApi == undefined) { - console.info('TC_050-12 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, - desiredRegion: { size: { height: 1, width: 2 }, x: 10000, y: 10000 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_050-12 success '); - expect(true).assertTrue(); - done(); - }else{ - expect(false).assertTrue(); - done(); - } - }) - } - }) - - /** - * @tc.number : TC_050-13 - * @tc.name : createPixelMap(decodingOptions:rotate>360)-jpg - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_050-13', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); - const imageSourceApi = image.createImageSource(fdJpg); - if (imageSourceApi == undefined) { - console.info('TC_050-13 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:500, - desiredPixelFormat:2, - desiredRegion: { size: { height: 1, width: 2 }, x: 1, y: 2 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_050-13 success '); - expect(true).assertTrue(); - done(); - }else{ - expect(false).assertTrue(); - done(); - } - }) - } - }) + it('TC_050-13', 0, async function (done) { + + await getFd("test.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info('TC_050-13 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize:1, + editable: true, + desiredSize:{ width:1, height:2}, + rotate:500, + desiredPixelFormat:2, + desiredRegion: { size: { height: 1, width: 2 }, x: 1, y: 2 }, + index:0 + }; + imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + if(pixelmap == undefined){ + console.info('TC_050-13 success '); + expect(true).assertTrue(); + done(); + }else{ + expect(false).assertTrue(); + done(); + } + }) + } + }) /** * @tc.number : TC_050-14 @@ -2428,8 +2530,9 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_050-14', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); - const imageSourceApi = image.createImageSource(fdJpg); + + await getFd("test.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_050-14 create image source failed'); expect(false).assertTrue(); @@ -2444,7 +2547,7 @@ describe('Image', function () { expect().assertFail(); done(); }) - } + } }) /** @@ -2458,9 +2561,10 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_050-15', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); - const imageSourceApi = image.createImageSource(fdJpg); + it('TC_050-15', 0, async function (done) { + + await getFd("test.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_050-15 create image source failed'); expect(false).assertTrue(); @@ -2471,7 +2575,7 @@ describe('Image', function () { expect(pixelmap != undefined ).assertTrue(); done(); }) - } + } }) /** @@ -2524,7 +2628,7 @@ describe('Image', function () { } } catch (error) { console.info('TC_053 updateData failed ' + error); - } + } }) /** @@ -2576,7 +2680,7 @@ describe('Image', function () { } } catch (error) { console.info('TC_053-1 updateData failed ' + error); - } + } }) /** @@ -2590,9 +2694,12 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_062', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); - const imageSourceApi = image.createImageSource(fdPng); + it('TC_062', 0, async function (done) { + await getFd("test.Png"); + console.log('start~~~'); + console.log('fdPng0~~~~~~~~' + fdNumber); + console.log('fdPng1~~~~~~~~' + JSON.stringify(fdPng)); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_062 create image source failed'); expect(false).assertTrue(); @@ -2606,11 +2713,11 @@ describe('Image', function () { } 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 => { + .then( data => { + console.info('TC_062 success'); + expect(data != undefined).assertTrue(); + done(); + }).catch(error => { console.log('TC_062 error: ' + error); expect(false).assertFail(); done(); @@ -2631,8 +2738,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_062-1', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); - const imageSourceApi = image.createImageSource(fdPng); + await getFd("test.png"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_062-1 create image source failed'); expect(false).assertTrue(); @@ -2666,8 +2773,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_062-2', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); - const imageSourceApi = image.createImageSource(fdPng); + await getFd("test.png"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_062-2 create image source failed'); expect(false).assertTrue(); @@ -2702,8 +2809,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_062-3', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); - const imageSourceApi = image.createImageSource(fdPng); + await getFd("test.png"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_062-3 create image source failed'); expect(false).assertTrue(); @@ -2738,8 +2845,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_062-4', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); - const imageSourceApi = image.createImageSource(fdPng); + await getFd("test.png"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_062-4 create image source failed'); expect(false).assertTrue(); @@ -2757,8 +2864,8 @@ describe('Image', function () { } } }) - - /** + + /** * @tc.number : TC_062-5 * @tc.name : packing ImageSource - promise - no quality * @tc.desc : 1.create ImageSource @@ -2770,8 +2877,9 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_062-5', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); - const imageSourceApi = image.createImageSource(fdPng); + // await getFd("test.png"); + await getFd("test.Png"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_062-5 create image source failed'); expect(false).assertTrue(); @@ -2785,21 +2893,21 @@ describe('Image', function () { } else { let packOpts = { format:["image/jpg"] } imagePackerApi.packing(imageSourceApi, packOpts) - .then( data => { - console.info('TC_062-5 failed'); - expect(data == undefined).assertTrue(); - done(); - }).catch(error => { + .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'); + console.log('TC_062-5 success'); expect(true).assertTrue(); done(); }) } } }) - - /** + + /** * @tc.number : TC_062-6 * @tc.name : packing ImageSource - promise - no format * @tc.desc : 1.create ImageSource @@ -2811,8 +2919,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_062-6', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); - const imageSourceApi = image.createImageSource(fdPng); + await getFd("test.png"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_062-6 create image source failed'); expect(false).assertTrue(); @@ -2826,21 +2934,21 @@ describe('Image', function () { } else { let packOpts = { quality:50 } imagePackerApi.packing(imageSourceApi, packOpts) - .then( data => { - console.info('TC_062-6 failed'); - expect(data == undefined).assertTrue(); - done(); - }).catch(error => { + .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'); + console.log('TC_062-6 success'); expect(true).assertTrue(); done(); }) } } }) - - /** + + /** * @tc.number : TC_062-7 * @tc.name : packing ImageSource - callback - quality 100 * @tc.desc : 1.create ImageSource @@ -2852,8 +2960,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_062-7', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); - const imageSourceApi = image.createImageSource(fdPng); + await getFd("test.png"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_062-7 create image source failed'); expect(false).assertTrue(); @@ -2874,8 +2982,8 @@ describe('Image', function () { } } }) - - /** + + /** * @tc.number : TC_062-8 * @tc.name : packing ImageSource - callback - quality 0 * @tc.desc : 1.create ImageSource @@ -2887,8 +2995,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_062-8', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); - const imageSourceApi = image.createImageSource(fdPng); + await getFd("test.png"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_062-8 create image source failed'); expect(false).assertTrue(); @@ -2909,8 +3017,8 @@ describe('Image', function () { } } }) - - /** + + /** * @tc.number : TC_062-9 * @tc.name : packing ImageSource - callback - quality -1 * @tc.desc : 1.create ImageSource @@ -2922,8 +3030,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_062-9', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); - const imageSourceApi = image.createImageSource(fdPng); + await getFd("test.png"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_062-9 create image source failed'); expect(false).assertTrue(); @@ -2970,7 +3078,7 @@ describe('Image', function () { console.log('TC_063 error: ' + error); expect(false).assertTrue(); done(); - }) + }) } }) @@ -2992,9 +3100,9 @@ describe('Image', function () { done(); } else { imagePackerApi.release(()=>{ - console.info('TC_063-1 success'); - expect(true).assertTrue(); - done(); + console.info('TC_063-1 success'); + expect(true).assertTrue(); + done(); }) } }) @@ -3008,10 +3116,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_064', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); - const imageSourceApi = image.createImageSource(fdPng); + await getFd("test.png"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_064 create image source failed'); expect(false).assertTrue(); @@ -3020,7 +3128,7 @@ describe('Image', function () { imageSourceApi.release().then(()=>{ console.info('TC_064 success'); expect(true).assertTrue(); - done(); + done(); }).catch(error => { console.log('TC_064 error: ' + error); expect().assertFail(); @@ -3038,10 +3146,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_064-1', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); - const imageSourceApi = image.createImageSource(fdPng); + await getFd("test.png"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_064-1 create image source failed'); expect(false).assertTrue(); @@ -3064,10 +3172,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_065', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); - const imageSourceApi = image.createImageSource(fdBmp); + await getFd("test.bmp"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_065 create image source failed'); expect(false).assertTrue(); @@ -3076,7 +3184,7 @@ describe('Image', function () { imageSourceApi.release().then(()=>{ console.info('TC_065 success'); expect(true).assertTrue(); - done(); + done(); }).catch(error => { console.log('TC_065 error: ' + error); expect().assertFail(); @@ -3094,10 +3202,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_065-1', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); - const imageSourceApi = image.createImageSource(fdBmp); + await getFd("test.bmp"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_065-1 create image source failed'); expect(false).assertTrue(); @@ -3122,8 +3230,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_066', 0, async function (done) { - let fdGif = fileio.openSync(pathGif); - const imageSourceApi = image.createImageSource(fdGif); + await getFd("test.gif"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_066 create image source failed'); expect(false).assertTrue(); @@ -3140,7 +3248,7 @@ describe('Image', function () { }) } }) - + /** * @tc.number : TC_066-1 * @tc.name : release ImageSource - callback - gif @@ -3150,10 +3258,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_066-1', 0, async function (done) { - let fdGif = fileio.openSync(pathGif); - const imageSourceApi = image.createImageSource(fdGif); + await getFd("test.gif"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_066-1 create image source failed'); expect(false).assertTrue(); @@ -3179,8 +3287,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_067', 0, async function (done) { - let fdMovingGif = fileio.openSync(pathMovingGif); - const imageSourceApi = image.createImageSource(fdMovingGif); + await getFd("moving_test.gif"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_067 create image source failed'); expect(false).assertTrue(); @@ -3188,7 +3296,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:3, @@ -3213,9 +3321,9 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_067-1', 0, async function (done) { - let fdMovingGif = fileio.openSync(pathMovingGif); - const imageSourceApi = image.createImageSource(fdMovingGif); + it('TC_067-1', 0, async function (done) { + await getFd("moving_test.gif"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_067-1 create image source failed'); expect(false).assertTrue(); @@ -3223,7 +3331,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:2, @@ -3248,9 +3356,9 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_067-2', 0, async function (done) { - let fdMovingGif = fileio.openSync(pathMovingGif); - const imageSourceApi = image.createImageSource(fdMovingGif); + it('TC_067-2', 0, async function (done) { + await getFd("moving_test.gif"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_067-2 create image source failed'); expect(false).assertTrue(); @@ -3258,7 +3366,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:0, @@ -3282,10 +3390,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_067-3', 0, async function (done) { - let fdMovingGif = fileio.openSync(pathMovingGif); - const imageSourceApi = image.createImageSource(fdMovingGif); + await getFd("moving_test.gif"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_067-3 create image source failed'); expect(false).assertTrue(); @@ -3293,7 +3401,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:0, @@ -3303,7 +3411,7 @@ describe('Image', function () { imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { console.info('TC_067-3 success '); expect(pixelmap != undefined ).assertTrue(); - done(); + done(); }) } }) @@ -3320,8 +3428,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_067-4', 0, async function (done) { - let fdMovingGif = fileio.openSync(pathMovingGif); - const imageSourceApi = image.createImageSource(fdMovingGif); + await getFd("moving_test.gif"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_067-4 create image source failed'); expect(false).assertTrue(); @@ -3329,7 +3437,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:0, @@ -3344,8 +3452,8 @@ describe('Image', function () { }else{ expect(false).assertTrue(); done(); - } - }) + } + }) } }) @@ -3361,8 +3469,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_067-5', 0, async function (done) { - let fdMovingGif = fileio.openSync(pathMovingGif); - const imageSourceApi = image.createImageSource(fdMovingGif); + await getFd("moving_test.gif"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_067-5 create image source failed'); expect(false).assertTrue(); @@ -3370,7 +3478,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:-1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:0, @@ -3385,8 +3493,8 @@ describe('Image', function () { }else{ expect(false).assertTrue(); done(); - } - }) + } + }) } }) @@ -3400,10 +3508,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_067-6', 0, async function (done) { - let fdMovingGif = fileio.openSync(pathMovingGif); - const imageSourceApi = image.createImageSource(fdMovingGif); + await getFd("moving_test.gif"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_067-6 create image source failed'); expect(false).assertTrue(); @@ -3411,7 +3519,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:-10, desiredPixelFormat:2, @@ -3426,8 +3534,8 @@ describe('Image', function () { }else{ expect(false).assertTrue(); done(); - } - }) + } + }) } }) @@ -3441,10 +3549,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_067-7', 0, async function (done) { - let fdMovingGif = fileio.openSync(pathMovingGif); - const imageSourceApi = image.createImageSource(fdMovingGif); + await getFd("moving_test.gif"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_067-7 create image source failed'); expect(false).assertTrue(); @@ -3452,7 +3560,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:60, @@ -3467,8 +3575,8 @@ describe('Image', function () { }else{ expect(false).assertTrue(); done(); - } - }) + } + }) } }) /** @@ -3481,10 +3589,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_067-8', 0, async function (done) { - let fdMovingGif = fileio.openSync(pathMovingGif); - const imageSourceApi = image.createImageSource(fdMovingGif); + await getFd("moving_test.gif"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_067-8 create image source failed'); expect(false).assertTrue(); @@ -3492,7 +3600,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: false, + editable: false, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:2, @@ -3505,7 +3613,7 @@ describe('Image', function () { done(); }) } - }) + }) /** * @tc.number : TC_067-9 @@ -3517,10 +3625,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_067-9', 0, async function (done) { - let fdMovingGif = fileio.openSync(pathMovingGif); - const imageSourceApi = image.createImageSource(fdMovingGif); + await getFd("moving_test.gif"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_067-9 create image source failed'); expect(false).assertTrue(); @@ -3528,7 +3636,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:10000, height:10000}, rotate:10, desiredPixelFormat:2, @@ -3538,7 +3646,7 @@ describe('Image', function () { imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { console.info('TC_067-9 success '); expect(pixelmap != undefined ).assertTrue(); - done(); + done(); }) } }) @@ -3553,10 +3661,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_067-10', 0, async function (done) { - let fdMovingGif = fileio.openSync(pathMovingGif); - const imageSourceApi = image.createImageSource(fdMovingGif); + await getFd("moving_test.gif"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info(' TC_067-10 create image source failed'); expect(false).assertTrue(); @@ -3564,7 +3672,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:2, @@ -3579,8 +3687,8 @@ describe('Image', function () { }else{ expect(false).assertTrue(); done(); - } - }) + } + }) } }) @@ -3594,10 +3702,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_067-11', 0, async function (done) { - let fdMovingGif = fileio.openSync(pathMovingGif); - const imageSourceApi = image.createImageSource(fdMovingGif); + await getFd("moving_test.gif"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_067-11 create image source failed'); expect(false).assertTrue(); @@ -3605,7 +3713,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:2, @@ -3620,10 +3728,10 @@ describe('Image', function () { }else{ expect(false).assertTrue(); done(); - } - }) + } + }) } - }) + }) /** * @tc.number : TC_067-12 @@ -3635,10 +3743,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_067-12', 0, async function (done) { - let fdMovingGif = fileio.openSync(pathMovingGif); - const imageSourceApi = image.createImageSource(fdMovingGif); + await getFd("moving_test.gif"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_067-12 create image source failed'); expect(false).assertTrue(); @@ -3646,7 +3754,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:2, @@ -3661,10 +3769,10 @@ describe('Image', function () { }else{ expect(false).assertTrue(); done(); - } - }) + } + }) } - }) + }) /** * @tc.number : TC_067-13 @@ -3676,10 +3784,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_067-13', 0, async function (done) { - let fdMovingGif = fileio.openSync(pathMovingGif); - const imageSourceApi = image.createImageSource(fdMovingGif); + await getFd("moving_test.gif"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_067-13 create image source failed'); expect(false).assertTrue(); @@ -3687,7 +3795,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:500, desiredPixelFormat:2, @@ -3702,11 +3810,11 @@ describe('Image', function () { }else{ expect(false).assertTrue(); done(); - } - }) + } + }) } - }) - + }) + /** * @tc.number : TC_067-14 * @tc.name : createPixelMap-promise-gif @@ -3718,9 +3826,9 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_067-14', 0, async function (done) { - let fdMovingGif = fileio.openSync(pathMovingGif); - const imageSourceApi = image.createImageSource(fdMovingGif); + it('TC_067-14', 0, async function (done) { + await getFd("moving_test.gif"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_067-14 create image source failed'); expect(false).assertTrue(); @@ -3750,8 +3858,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_067-15', 0, async function (done) { - let fdMovingGif = fileio.openSync(pathMovingGif); - const imageSourceApi = image.createImageSource(fdMovingGif); + await getFd("moving_test.gif"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_067-15 create image source failed'); expect(false).assertTrue(); @@ -3778,8 +3886,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_068', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); - const imageSourceApi = image.createImageSource(fdBmp); + await getFd("test.bmp"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_068 create image source failed'); expect(false).assertTrue(); @@ -3787,12 +3895,12 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:3, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 + index:0 }; imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { console.info('TC_068 success '); @@ -3812,9 +3920,9 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_068-1', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); - const imageSourceApi = image.createImageSource(fdBmp); + it('TC_068-1', 0, async function (done) { + await getFd("test.bmp"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_068-1 create image source failed'); expect(false).assertTrue(); @@ -3822,12 +3930,12 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:2, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 + index:0 }; imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { console.info('TC_068-1 success '); @@ -3847,9 +3955,9 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_068-2', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); - const imageSourceApi = image.createImageSource(fdBmp); + it('TC_068-2', 0, async function (done) { + await getFd("test.bmp"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_068-2 create image source failed'); expect(false).assertTrue(); @@ -3857,12 +3965,12 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:0, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 + index:0 }; imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { console.info('TC_068-2 success '); @@ -3883,8 +3991,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_068-3', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); - const imageSourceApi = image.createImageSource(fdBmp); + await getFd("test.bmp"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_068-3 create image source failed'); expect(false).assertTrue(); @@ -3892,7 +4000,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:0, @@ -3907,8 +4015,8 @@ describe('Image', function () { }else{ expect(false).assertTrue(); done(); - } - }) + } + }) } }) @@ -3922,10 +4030,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_068-4', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); - const imageSourceApi = image.createImageSource(fdBmp); + await getFd("test.bmp"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_068-4 create image source failed'); expect(false).assertTrue(); @@ -3933,7 +4041,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:0, @@ -3948,8 +4056,8 @@ describe('Image', function () { }else{ expect(false).assertTrue(); done(); - } - }) + } + }) } }) @@ -3963,10 +4071,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_068-5', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); - const imageSourceApi = image.createImageSource(fdBmp); + await getFd("test.bmp"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_068-5 create image source failed'); expect(false).assertTrue(); @@ -3974,7 +4082,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:-1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:0, @@ -3989,10 +4097,10 @@ describe('Image', function () { }else{ expect(false).assertTrue(); done(); - } - }) + } + }) } - }) + }) /** * @tc.number : TC_068-6 @@ -4004,10 +4112,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_068-6', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); - const imageSourceApi = image.createImageSource(fdBmp); + await getFd("test.bmp"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_068-6 create image source failed'); expect(false).assertTrue(); @@ -4015,7 +4123,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:-10, desiredPixelFormat:2, @@ -4030,10 +4138,10 @@ describe('Image', function () { }else{ expect(false).assertTrue(); done(); - } - }) + } + }) } - }) + }) /** * @tc.number : TC_068-7 @@ -4045,10 +4153,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_068-7', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); - const imageSourceApi = image.createImageSource(fdBmp); + await getFd("test.bmp"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_068-7 create image source failed'); expect(false).assertTrue(); @@ -4056,7 +4164,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:60, @@ -4071,8 +4179,8 @@ describe('Image', function () { }else{ expect(false).assertTrue(); done(); - } - }) + } + }) } }) @@ -4086,10 +4194,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_068-8', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); - const imageSourceApi = image.createImageSource(fdBmp); + await getFd("test.bmp"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_068-8 create image source failed'); expect(false).assertTrue(); @@ -4097,7 +4205,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: false, + editable: false, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:2, @@ -4110,7 +4218,7 @@ describe('Image', function () { done(); }) } - }) + }) /** * @tc.number : TC_068-9 @@ -4122,10 +4230,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_068-9', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); - const imageSourceApi = image.createImageSource(fdBmp); + await getFd("test.bmp"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_068-9 create image source failed'); expect(false).assertTrue(); @@ -4133,7 +4241,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:10000, height:10000}, rotate:10, desiredPixelFormat:2, @@ -4146,7 +4254,7 @@ describe('Image', function () { done(); }) } - }) + }) /** * @tc.number : TC_068-10 @@ -4158,10 +4266,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_068-10', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); - const imageSourceApi = image.createImageSource(fdBmp); + await getFd("test.bmp"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info(' TC_068-10 create image source failed'); expect(false).assertTrue(); @@ -4169,7 +4277,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:2, @@ -4184,10 +4292,10 @@ describe('Image', function () { }else{ expect(false).assertTrue(); done(); - } - }) + } + }) } - }) + }) /** * @tc.number : TC_068-11 @@ -4199,10 +4307,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_068-11', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); - const imageSourceApi = image.createImageSource(fdBmp); + await getFd("test.bmp"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_068-11 create image source failed'); expect(false).assertTrue(); @@ -4210,7 +4318,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:2, @@ -4225,10 +4333,10 @@ describe('Image', function () { }else{ expect(false).assertTrue(); done(); - } - }) + } + }) } - }) + }) /** * @tc.number : TC_068-12 @@ -4240,10 +4348,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_068-12', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); - const imageSourceApi = image.createImageSource(fdBmp); + await getFd("test.bmp"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_068-12 create image source failed'); expect(false).assertTrue(); @@ -4251,7 +4359,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:2, @@ -4266,8 +4374,8 @@ describe('Image', function () { }else{ expect(false).assertTrue(); done(); - } - }) + } + }) } }) /** @@ -4282,8 +4390,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_068-13', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); - const imageSourceApi = image.createImageSource(fdBmp); + await getFd("test.bmp"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_068-13 create image source failed'); expect(false).assertTrue(); @@ -4291,12 +4399,12 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:500, desiredPixelFormat:2, desiredRegion: { size: { height: 1, width: 2 }, x: 1, y: 2 }, - index:0 + index:0 }; imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { if(pixelmap == undefined){ @@ -4306,8 +4414,8 @@ describe('Image', function () { }else{ expect(false).assertTrue(); done(); - } - }) + } + }) } }) /** @@ -4322,8 +4430,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_068-14', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); - const imageSourceApi = image.createImageSource(fdBmp); + await getFd("test.bmp"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_068-14 create image source failed'); expect(false).assertTrue(); @@ -4353,8 +4461,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_068-15', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); - const imageSourceApi = image.createImageSource(fdBmp); + await getFd("test.bmp"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_068-15 create image source failed'); expect(false).assertTrue(); @@ -4379,21 +4487,21 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_163', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); - const imageSourceApi = image.createImageSource(fdPng); + await getFd("test.png"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_163 create image source failed'); expect(false).assertTrue(); done(); - } else { + } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:3, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 + index:0 }; imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { console.info('TC_163 success'); @@ -4413,22 +4521,22 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_163-1', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); - const imageSourceApi = image.createImageSource(fdPng); + it('TC_163-1', 0, async function (done) { + await getFd("test.png"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_163-1 create image source failed'); expect(false).assertTrue(); done(); - } else { + } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:2, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 + index:0 }; imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { console.info('TC_163-1 success'); @@ -4448,22 +4556,22 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_163-2', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); - const imageSourceApi = image.createImageSource(fdPng); + it('TC_163-2', 0, async function (done) { + await getFd("test.png"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_163-2 create image source failed'); expect(false).assertTrue(); done(); - } else { + } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:0, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 + index:0 }; imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { console.info('TC_163-2 success'); @@ -4484,8 +4592,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_163-3', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); - const imageSourceApi = image.createImageSource(fdPng); + await getFd("test.png"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_163-3 create image source failed'); expect(false).assertTrue(); @@ -4493,7 +4601,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:0, @@ -4508,8 +4616,8 @@ describe('Image', function () { }else{ expect(false).assertTrue(); done(); - } - }) + } + }) } }) @@ -4526,8 +4634,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_163-4', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); - const imageSourceApi = image.createImageSource(fdPng); + await getFd("test.png"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_163-4 create image source failed'); expect(false).assertTrue(); @@ -4535,7 +4643,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:0, @@ -4550,8 +4658,8 @@ describe('Image', function () { }else{ expect(false).assertTrue(); done(); - } - }) + } + }) } }) @@ -4566,10 +4674,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_163-5', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); - const imageSourceApi = image.createImageSource(fdPng); + await getFd("test.png"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_163-5 create image source failed'); expect(false).assertTrue(); @@ -4577,7 +4685,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:-1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:0, @@ -4592,8 +4700,8 @@ describe('Image', function () { }else{ expect(false).assertTrue(); done(); - } - }) + } + }) } }) @@ -4608,10 +4716,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_163-6', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); - const imageSourceApi = image.createImageSource(fdPng); + await getFd("test.png"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_163-6 create image source failed'); expect(false).assertTrue(); @@ -4619,7 +4727,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:-10, desiredPixelFormat:2, @@ -4634,10 +4742,10 @@ describe('Image', function () { }else{ expect(false).assertTrue(); done(); - } - }) + } + }) } - }) + }) /** * @tc.number : TC_163-7 @@ -4650,10 +4758,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_163-7', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); - const imageSourceApi = image.createImageSource(fdPng); + await getFd("test.png"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_163-7 create image source failed'); expect(false).assertTrue(); @@ -4661,7 +4769,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:60, @@ -4676,10 +4784,10 @@ describe('Image', function () { }else{ expect(false).assertTrue(); done(); - } - }) + } + }) } - }) + }) /** * @tc.number : TC_163-8 @@ -4692,10 +4800,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_163-8', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); - const imageSourceApi = image.createImageSource(fdPng); + await getFd("test.png"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_163-8 create image source failed'); expect(false).assertTrue(); @@ -4703,7 +4811,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: false, + editable: false, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:2, @@ -4729,10 +4837,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_163-9', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); - const imageSourceApi = image.createImageSource(fdPng); + await getFd("test.png"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_163-9 create image source failed'); expect(false).assertTrue(); @@ -4740,7 +4848,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:10000, height:10000}, rotate:10, desiredPixelFormat:2, @@ -4766,10 +4874,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_163-10', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); - const imageSourceApi = image.createImageSource(fdPng); + await getFd("test.png"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info(' TC_163-10 create image source failed'); expect(false).assertTrue(); @@ -4777,7 +4885,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:2, @@ -4792,10 +4900,10 @@ describe('Image', function () { }else{ expect(false).assertTrue(); done(); - } - }) + } + }) } - }) + }) /** * @tc.number : TC_163-11 @@ -4808,10 +4916,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_163-11', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); - const imageSourceApi = image.createImageSource(fdPng); + await getFd("test.png"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_163-11 create image source failed'); expect(false).assertTrue(); @@ -4819,7 +4927,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:2, @@ -4834,8 +4942,8 @@ describe('Image', function () { }else{ expect(false).assertTrue(); done(); - } - }) + } + }) } }) @@ -4850,10 +4958,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_163-12', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); - const imageSourceApi = image.createImageSource(fdPng); + await getFd("test.png"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_163-12 create image source failed'); expect(false).assertTrue(); @@ -4861,7 +4969,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:2, @@ -4876,8 +4984,8 @@ describe('Image', function () { }else{ expect(false).assertTrue(); done(); - } - }) + } + }) } }) /** @@ -4891,9 +4999,9 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_163-13', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); - const imageSourceApi = image.createImageSource(fdPng); + it('TC_163-13', 0, async function (done) { + await getFd("test.png"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_163-13 create image source failed'); expect(false).assertTrue(); @@ -4901,7 +5009,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:500, desiredPixelFormat:2, @@ -4916,9 +5024,9 @@ describe('Image', function () { }else{ expect(false).assertTrue(); done(); - } - }) - } + } + }) + } }) /** * @tc.number : TC_163-14 @@ -4932,13 +5040,13 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_163-14', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); - const imageSourceApi = image.createImageSource(fdPng); + await getFd("test.png"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_163-14 create image source failed'); expect(false).assertTrue(); done(); - } else { + } else { imageSourceApi.createPixelMap().then(pixelmap => { console.info('TC_163-14 success'); expect(pixelmap != undefined ).assertTrue(); @@ -4963,13 +5071,13 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_163-15', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); - const imageSourceApi = image.createImageSource(fdPng); + await getFd("test.png"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_163-15 create image source failed'); expect(false).assertTrue(); done(); - } else { + } else { imageSourceApi.createPixelMap((err, pixelmap) => { console.info('TC_163-15 success'); expect(pixelmap != undefined ).assertTrue(); @@ -4985,17 +5093,18 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 0 - */ + */ it('TC_164', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); - const imageSourceApi = image.createImageSource(fdJpg); + + await getFd("test.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_164 create image source failed'); expect(false).assertTrue(); done(); } else { expect(imageSourceApi.supportedFormats != undefined).assertTrue(); - console.info(imageSourceApi.supportedFormats); + console.info(imageSourceApi.supportedFormats); console.info('TC_164 success '); done(); } @@ -5009,7 +5118,7 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 0 - */ + */ it('TC_166', 0, async function (done) { const imagePackerApi = image.createImagePacker(); if (imagePackerApi == undefined) { @@ -5018,7 +5127,7 @@ describe('Image', function () { done(); } else { expect(imagePackerApi.supportedFormats != undefined).assertTrue(); - console.info(imagePackerApi.supportedFormats); + console.info(imagePackerApi.supportedFormats); console.info('TC_166 success '); done(); } @@ -5036,11 +5145,11 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_167', 0, async function (done) { - let fdTiff = fileio.openSync(pathTiff); - const imageSourceApi = image.createImageSource(fdTiff); + await getFd("test.tiff"); + const imageSourceApi = image.createImageSource(fdNumber); let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:10, desiredPixelFormat:3, @@ -5052,7 +5161,7 @@ describe('Image', function () { expect(pixelmap == undefined ).assertTrue(); done(); }) - }) + }) /** * @tc.number : TC_168 @@ -5071,13 +5180,13 @@ describe('Image', function () { if(pixelmap == undefined){ console.info('TC_168 create pixelmap failed'); expect(false).assertTrue(); - done(); + done(); }else { expect(pixelmap.isEditable == true).assertTrue(); console.info('TC_168 success '); done(); } - }) + }) }) /** @@ -5091,9 +5200,10 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_169', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); - const imageSourceApi = image.createImageSource(fdJpg); + it('TC_169', 0, async function (done) { + + await getFd("test.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_169 create image source failed'); expect(false).assertTrue(); @@ -5101,7 +5211,7 @@ describe('Image', function () { } else { let decodingOptions = { sampleSize:1, - editable: true, + editable: true, desiredSize:{ width:1, height:2}, rotate:90, desiredPixelFormat:3, @@ -5136,24 +5246,24 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_171', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getFd("test_exif.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_171 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("BitsPerSample") - .then(data => { - console.info('TC_171 BitsPerSample ' + data); - expect(data != undefined && data != '' ).assertTrue(); - done(); - }) - .catch(error => { - console.log('TC_171 error: ' + error); - expect(false).assertFail(); - done(); - }) + .then(data => { + console.info('TC_171 BitsPerSample ' + data); + expect(data != undefined && data != '' ).assertTrue(); + done(); + }) + .catch(error => { + console.log('TC_171 error: ' + error); + expect(false).assertFail(); + done(); + }) } }) @@ -5169,24 +5279,24 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_171-1', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getFd("test_exif.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_171-1 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("Orientation") - .then(data => { - console.info('TC_171-1 Orientation ' + data); - expect(data != undefined && data != '' ).assertTrue(); - done(); - }) - .catch(error => { - console.log('TC_171-1 error: ' + error); - expect(false).assertFail(); - done(); - }) + .then(data => { + console.info('TC_171-1 Orientation ' + data); + expect(data != undefined && data != '' ).assertTrue(); + done(); + }) + .catch(error => { + console.log('TC_171-1 error: ' + error); + expect(false).assertFail(); + done(); + }) } }) @@ -5202,24 +5312,24 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_171-2', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getFd("test_exif.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_171-2 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("ImageLength") - .then(data => { - console.info('TC_171-2 ImageLength ' + data); - expect(data != undefined && data != '' ).assertTrue(); - done(); - }) - .catch(error => { - console.log('TC_171-2 error: ' + error); - expect(false).assertFail(); - done(); - }) + .then(data => { + console.info('TC_171-2 ImageLength ' + data); + expect(data != undefined && data != '' ).assertTrue(); + done(); + }) + .catch(error => { + console.log('TC_171-2 error: ' + error); + expect(false).assertFail(); + done(); + }) } }) @@ -5235,24 +5345,24 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_171-3', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getFd("test_exif.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_171-3 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("ImageWidth") - .then(data => { - console.info('TC_171-3 ImageWidth ' + data); - expect(data != undefined && data != '' ).assertTrue(); - done(); - }) - .catch(error => { - console.log('TC_171-3 error: ' + error); - expect(false).assertFail(); - done(); - }) + .then(data => { + console.info('TC_171-3 ImageWidth ' + data); + expect(data != undefined && data != '' ).assertTrue(); + done(); + }) + .catch(error => { + console.log('TC_171-3 error: ' + error); + expect(false).assertFail(); + done(); + }) } }) @@ -5268,24 +5378,24 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_171-4', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getFd("test_exif.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_171-4 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("GPSLatitude") - .then(data => { - console.info('TC_171-4 GPSLatitude ' + data); - expect(data != undefined && data != '' ).assertTrue(); - done(); - }) - .catch(error => { - console.log('TC_171-4 error: ' + error); - expect(false).assertFail(); - done(); - }) + .then(data => { + console.info('TC_171-4 GPSLatitude ' + data); + expect(data != undefined && data != '' ).assertTrue(); + done(); + }) + .catch(error => { + console.log('TC_171-4 error: ' + error); + expect(false).assertFail(); + done(); + }) } }) @@ -5301,24 +5411,24 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_171-5', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getFd("test_exif.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_171-5 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("GPSLongitude") - .then(data => { - console.info('TC_171-5 GPSLongitude ' + data); - expect(data != undefined && data != '' ).assertTrue(); - done(); - }) - .catch(error => { - console.log('TC_171-5 error: ' + error); - expect(false).assertFail(); - done(); - }) + .then(data => { + console.info('TC_171-5 GPSLongitude ' + data); + expect(data != undefined && data != '' ).assertTrue(); + done(); + }) + .catch(error => { + console.log('TC_171-5 error: ' + error); + expect(false).assertFail(); + done(); + }) } }) @@ -5334,24 +5444,24 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_171-6', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getFd("test_exif.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_171-6 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("GPSLatitudeRef") - .then(data => { - console.info('TC_171-6 GPSLatitudeRef ' + data); - expect(data != undefined && data != '' ).assertTrue(); - done(); - }) - .catch(error => { - console.log('TC_171-6 error: ' + error); - expect(false).assertFail(); - done(); - }) + .then(data => { + console.info('TC_171-6 GPSLatitudeRef ' + data); + expect(data != undefined && data != '' ).assertTrue(); + done(); + }) + .catch(error => { + console.log('TC_171-6 error: ' + error); + expect(false).assertFail(); + done(); + }) } }) @@ -5367,24 +5477,24 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_171-7', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getFd("test_exif.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_171-7 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("GPSLongitudeRef") - .then(data => { - console.info('TC_171-7 GPSLongitudeRef ' + data); - expect(data != undefined && data != '' ).assertTrue(); - done(); - }) - .catch(error => { - console.log('TC_171-7 error: ' + error); - expect(false).assertFail(); - done(); - }) + .then(data => { + console.info('TC_171-7 GPSLongitudeRef ' + data); + expect(data != undefined && data != '' ).assertTrue(); + done(); + }) + .catch(error => { + console.log('TC_171-7 error: ' + error); + expect(false).assertFail(); + done(); + }) } }) @@ -5400,24 +5510,24 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_171-8', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getFd("test_exif.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_171-8 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("DateTimeOriginal") - .then(data => { - console.info('TC_171-8 DateTimeOriginal ' + data); - expect(data != undefined && data != '' ).assertTrue(); - done(); - }) - .catch(error => { - console.log('TC_171-8 error: ' + error); - expect(false).assertFail(); - done(); - }) + .then(data => { + console.info('TC_171-8 DateTimeOriginal ' + data); + expect(data != undefined && data != '' ).assertTrue(); + done(); + }) + .catch(error => { + console.log('TC_171-8 error: ' + error); + expect(false).assertFail(); + done(); + }) } }) @@ -5432,8 +5542,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_172', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getFd("test_exif.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_172 create image source failed'); expect(false).assertTrue(); @@ -5464,8 +5574,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_172-1', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getFd("test_exif.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_172-1 create image source failed'); expect(false).assertTrue(); @@ -5496,8 +5606,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_172-2', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getFd("test_exif.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_172-2 create image source failed'); expect(false).assertTrue(); @@ -5528,8 +5638,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_172-3', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getFd("test_exif.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_172-3 create image source failed'); expect(false).assertTrue(); @@ -5560,8 +5670,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_172-4', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getFd("test_exif.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_172-4 create image source failed'); expect(false).assertTrue(); @@ -5592,8 +5702,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_172-5', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getFd("test_exif.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_172-5 create image source failed'); expect(false).assertTrue(); @@ -5624,8 +5734,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_172-6', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getFd("test_exif.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_172-6 create image source failed'); expect(false).assertTrue(); @@ -5656,8 +5766,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_172-7', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getFd("test_exif.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_172-7 create image source failed'); expect(false).assertTrue(); @@ -5688,8 +5798,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_172-8', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getFd("test_exif.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_172-8 create image source failed'); expect(false).assertTrue(); @@ -5721,8 +5831,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_173', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getFd("test_exif.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_173 create image source failed'); expect(false).assertTrue(); @@ -5755,8 +5865,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_173-1', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getFd("test_exif.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_173-1 create image source failed'); expect(false).assertTrue(); @@ -5789,8 +5899,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_173-2', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getFd("test_exif.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_173-2 create image source failed'); expect(false).assertTrue(); @@ -5823,8 +5933,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_173-3', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getFd("test_exif.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_173-3 create image source failed'); expect(false).assertTrue(); @@ -5857,8 +5967,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_173-4', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getFd("test_exif.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_173-4 create image source failed'); expect(false).assertTrue(); @@ -5891,8 +6001,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_173-5', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getFd("test_exif.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_173-5 create image source failed'); expect(false).assertTrue(); @@ -5925,8 +6035,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_173-6', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getFd("test_exif.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_173-6 create image source failed'); expect(false).assertTrue(); @@ -5959,8 +6069,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_173-7', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getFd("test_exif.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_173-7 create image source failed'); expect(false).assertTrue(); @@ -5993,8 +6103,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_173-8', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getFd("test_exif.jpg"); + const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { console.info('TC_173-8 create image source failed'); expect(false).assertTrue(); -- GitLab