diff --git a/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/test/image.test.js b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/test/image.test.js old mode 100644 new mode 100755 index 30498a5022976446d399e47fa4eda2fbff3a2040..4041d5607e7927a851ec35d0e2b34d942a919152 --- a/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/test/image.test.js +++ b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/test/image.test.js @@ -1067,16 +1067,24 @@ describe('Image', function () { index: 0 }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { - globalpixelmap = pixelmap; - - if (pixelmap == undefined) { - console.info('TC_050-10 success '); - expect(true).assertTrue(); - done(); - } else { - expect(false).assertTrue(); - done(); - } + if (err) { + console.info('TC_050-10 fail '); + expect(false).assertTrue(); + done(); + } else { + globalpixelmap = pixelmap; + pixelmap.getImageInfo().then((imageInfo) => { + expect(imageInfo.size.height == 2).assertTrue(); + expect(imageInfo.size.width == 1).assertTrue(); + console.info('TC_050-10 success '); + console.info("imageInfo height :" + imageInfo.size.height + "width : " + imageInfo.size.width); + done(); + }).catch((err) => { + console.info('TC_050-10 getimageInfo err ' + JSON.stringify(err)); + expect(false).assertTrue(); + done(); + }) + } }) } } catch (error) { @@ -1731,16 +1739,24 @@ describe('Image', function () { index: 0 }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { - globalpixelmap = pixelmap; - - if (pixelmap == undefined) { - console.info('TC_067-10 success '); - expect(true).assertTrue(); - done(); - } else { - expect(false).assertTrue(); - done(); - } + if (err) { + console.info('TC_067-10 fail '); + expect(false).assertTrue(); + done(); + } else { + globalpixelmap = pixelmap; + pixelmap.getImageInfo().then((imageInfo) => { + expect(imageInfo.size.height == 2).assertTrue(); + expect(imageInfo.size.width == 1).assertTrue(); + console.info('TC_067-10 success '); + console.info("imageInfo height :" + imageInfo.size.height + "width : " + imageInfo.size.width); + done(); + }).catch((err) => { + console.info('TC_067-10 getimageInfo err ' + JSON.stringify(err)); + expect(false).assertTrue(); + done(); + }) + } }) } }) @@ -2369,16 +2385,24 @@ describe('Image', function () { index: 0 }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { - globalpixelmap = pixelmap; - - if (pixelmap == undefined) { - console.info('TC_068-10 success '); - expect(true).assertTrue(); - done(); - } else { - expect(false).assertTrue(); - done(); - } + if (err) { + console.info('TC_068-10 fail '); + expect(false).assertTrue(); + done(); + } else { + globalpixelmap = pixelmap; + pixelmap.getImageInfo().then((imageInfo) => { + expect(imageInfo.size.height == 2).assertTrue(); + expect(imageInfo.size.width == 1).assertTrue(); + console.info('TC_068-10 success '); + console.info("imageInfo height :" + imageInfo.size.height + "width : " + imageInfo.size.width); + done(); + }).catch((err) => { + console.info('TC_068-10 getimageInfo err ' + JSON.stringify(err)); + expect(false).assertTrue(); + done(); + }) + } }) } }) @@ -2950,16 +2974,24 @@ describe('Image', function () { index: 0 }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { - globalpixelmap = pixelmap; - - if (pixelmap == undefined) { - console.info('TC_163-10 success '); - expect(true).assertTrue(); - done(); - } else { - expect(false).assertTrue(); - done(); - } + if (err) { + console.info('TC_163-10 fail '); + expect(false).assertTrue(); + done(); + } else { + globalpixelmap = pixelmap; + pixelmap.getImageInfo().then((imageInfo) => { + expect(imageInfo.size.height == 2).assertTrue(); + expect(imageInfo.size.width == 1).assertTrue(); + console.info('TC_163-10 success '); + console.info("imageInfo height :" + imageInfo.size.height + "width : " + imageInfo.size.width); + done(); + }).catch((err) => { + console.info('TC_163-10 getimageInfo err ' + JSON.stringify(err)); + expect(false).assertTrue(); + done(); + }) + } }) } }) diff --git a/multimedia/image/image_js_standard/imageWebp/src/main/js/test/webp.test.js b/multimedia/image/image_js_standard/imageWebp/src/main/js/test/webp.test.js old mode 100644 new mode 100755 index ba3148d213628a2ace955a1d7cf3fc73b6d866d2..9c3cc0d6dd545c7cfe1566368147f0fcaaac379a --- a/multimedia/image/image_js_standard/imageWebp/src/main/js/test/webp.test.js +++ b/multimedia/image/image_js_standard/imageWebp/src/main/js/test/webp.test.js @@ -70,7 +70,35 @@ describe('Image', function () { console.info('[permission]case apply permission failed,createAtManager failed'); } } - + + async function createPixMapCb(done, testNum, arg) { + let fdNumber = fileio.openSync(pathWebp); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info(`${testNum} create image source failed`); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.createPixelMap(arg, (err, pixelmap) => { + if (err) { + console.info(`${testNum} - fail `); + expect(false).assertTrue(); + done(); + } else { + pixelmap.getImageInfo().then((imageInfo) => { + expect(imageInfo.size.height == 2).assertTrue(); + expect(imageInfo.size.width == 1).assertTrue(); + console.info(`${testNum} - success `); + console.info("imageInfo height :" + imageInfo.size.height + "width : " + imageInfo.size.width); + done(); + }).catch((err) => { + console.info(`${testNum} getimageInfo err ` + JSON.stringify(err)); + }) + } + }) + } + } + async function createPixMapCbErr(done, testNum, arg) { let fdNumber = fileio.openSync(pathWebp); const imageSourceApi = image.createImageSource(fdNumber); @@ -91,6 +119,33 @@ describe('Image', function () { }) } } + + async function createPixMapPromise(done, testNum, arg) { + let fdNumber = fileio.openSync(pathWebp); + const imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info(`${testNum} create image source failed`); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.createPixelMap(arg).then(pixelmap => { + pixelmap.getImageInfo().then((imageInfo) => { + expect(imageInfo.size.height == 2).assertTrue(); + expect(imageInfo.size.width == 1).assertTrue(); + console.info(`${testNum} - success `); + console.info("imageInfo height :" + imageInfo.size.height + "width : " + imageInfo.size.width); + done(); + }).catch((err) => { + console.info(`${testNum} getimageInfo err ` + JSON.stringify(err)); + }) + }).catch(error => { + console.log(`${testNum} fail `); + expect(flase).assertTrue(); + done(); + }) + } + } + async function createPixMapPromiseErr(done, testNum, arg) { let fdNumber = fileio.openSync(pathWebp); const imageSourceApi = image.createImageSource(fdNumber); @@ -752,7 +807,7 @@ describe('Image', function () { desiredRegion: { size: { height: 10000, width: 10000 }, x: 0, y: 0 }, index: 0 }; - createPixMapCbErr(done, 'wbp_009', decodingOptions) + createPixMapCb(done, 'wbp_009', decodingOptions) }) /** @@ -873,7 +928,7 @@ describe('Image', function () { desiredRegion: { size: { height: 10000, width: 10000 }, x: 0, y: 0 }, index: 0 }; - createPixMapPromiseErr(done, 'wbp_014', decodingOptions) + createPixMapPromise(done, 'wbp_014', decodingOptions) }) /**