diff --git a/multimedia/image/image_js_standard/imagePacking/BUILD.gn b/multimedia/image/image_js_standard/imagePacking/BUILD.gn index e87c0899973d9193af42ef2f87da1dbcb91e93d6..48e8e434d7121efff131304b55e8f07f8c77d3cb 100644 --- a/multimedia/image/image_js_standard/imagePacking/BUILD.gn +++ b/multimedia/image/image_js_standard/imagePacking/BUILD.gn @@ -9,23 +9,23 @@ # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and -# limitations under the License. +# limitations under the License. import("//test/xts/tools/build/suite.gni") ohos_js_hap_suite("image_packing_js_hap") { hap_profile = "./src/main/config.json" deps = [ - ":image_js_assets", - ":image_resources", + ":image_packing_js_assets", + ":image_packing_resources", ] certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsImagepackingJsTest" + hap_name = "ActsImagePackingJsTest" } -ohos_js_assets("image_js_assets") { +ohos_js_assets("image_packing_js_assets") { source_dir = "./src/main/js/default" } -ohos_resources("image_resources") { +ohos_resources("image_packing_resources") { sources = [ "./src/main/resources" ] hap_profile = "./src/main/config.json" } diff --git a/multimedia/image/image_js_standard/imagePacking/Test.json b/multimedia/image/image_js_standard/imagePacking/Test.json index abe0a93d15f1fde2d45fc08b349deda5d01e9cc4..02ae9ddcf6b57e643d4ed1953b0330121cd302ed 100644 --- a/multimedia/image/image_js_standard/imagePacking/Test.json +++ b/multimedia/image/image_js_standard/imagePacking/Test.json @@ -3,7 +3,7 @@ "driver": { "type": "JSUnitTest", "test-timeout": "1500000", - "package": "ohos.acts.multimedia.image", + "package": "ohos.acts.multimedia.image.Packing", "shell-timeout": "120000" }, "kits": [ @@ -27,7 +27,7 @@ { "test-file-name": [ - "ActsImagepackingJsTest.hap" + "ActsImagePackingJsTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/multimedia/image/image_js_standard/imagePacking/src/main/config.json b/multimedia/image/image_js_standard/imagePacking/src/main/config.json index dc3e221eab55d5a39d4fee1578b6c6fc6f50041f..641b95873c525f3cb7b0254f865f6bc792dd1d28 100644 --- a/multimedia/image/image_js_standard/imagePacking/src/main/config.json +++ b/multimedia/image/image_js_standard/imagePacking/src/main/config.json @@ -6,7 +6,7 @@ "target": 7 }, "vendor": "acts", - "bundleName": "ohos.acts.multimedia.image", + "bundleName": "ohos.acts.multimedia.image.Packing", "version": { "code": 1000000, "name": "1.0.0" @@ -35,7 +35,7 @@ "visible": true, "labelId": 16777216, "icon": "$media:icon", - "name": "ohos.acts.multimedia.image.MainAbility", + "name": "ohos.acts.multimedia.image.Packing.MainAbility", "description": "$string:mainability_description", "label": "$string:entry_MainAbility", "type": "page", @@ -49,7 +49,7 @@ "tv", "wearable" ], - "mainAbility": "ohos.acts.multimedia.image.MainAbility", + "mainAbility": "ohos.acts.multimedia.image.Packing.MainAbility", "distro": { "moduleType": "entry", "installationFree": false, @@ -86,7 +86,7 @@ "reason":"use ohos.permission.WRITE_MEDIA" } ], - "package": "ohos.acts.multimedia.image", + "package": "ohos.acts.multimedia.image.Packing", "name": ".MyApplication", "js": [ { diff --git a/multimedia/image/image_js_standard/imagePacking/src/main/js/test/packing.test.js b/multimedia/image/image_js_standard/imagePacking/src/main/js/test/packing.test.js index 722094381f89548209a22c4ec089c5e1eec03e1c..d7336568f5ecbfecbbcfb77add20839db481b72a 100644 --- a/multimedia/image/image_js_standard/imagePacking/src/main/js/test/packing.test.js +++ b/multimedia/image/image_js_standard/imagePacking/src/main/js/test/packing.test.js @@ -14,6 +14,7 @@ */ import image from '@ohos.multimedia.image' +import fileio from '@ohos.fileio' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' describe('Image', function () { @@ -24,7 +25,6 @@ describe('Image', function () { }) beforeEach(function () { - isTimeOut = false; console.info('beforeEach case'); }) @@ -38,7 +38,7 @@ describe('Image', function () { async function applyPermission() { console.info('[permission]case applyPermission in'); - let appInfo = await bundle.getApplicationInfo('ohos.acts.multimedia.image', 0, 100); + let appInfo = await bundle.getApplicationInfo('ohos.acts.multimedia.image.Packing', 0, 100); let atManager = abilityAccessCtrl.createAtManager(); if (atManager != null) { let tokenID = appInfo.accessTokenId; @@ -66,7 +66,7 @@ describe('Image', function () { } } - function packingPromise(done, testNum, pixFormat, arg) { + function packing_promise(done, testNum, pixFormat, arg) { let opts; const Color = new ArrayBuffer(96); if (pixFormat == 2) { @@ -112,7 +112,7 @@ describe('Image', function () { }) } - function packingCallback(done, testNum, pixFormat, arg) { + function packing_cb(done, testNum, pixFormat, arg) { let opts; const Color = new ArrayBuffer(96); if (pixFormat == 2) { @@ -134,11 +134,17 @@ describe('Image', function () { done(); } else { imagePackerApi.packing(pixelmap, arg, (err, data) => { + if (err != undefined) { + console.info(`${testNum} packing failerr: ${err}`) + expect(false).assertTrue(); + done(); + return; + } var dataArr = new Uint8Array(data); - console.info(`${testNum} dataArr.length=` + dataArr.length); - for (var i = 0; i < dataArr.length; i++) { - console.info(`dataArr[` + i + `]=` + dataArr[i]); - } + console.info(`${testNum} dataArr.length=` + dataArr.length); + for (var i = 0; i < dataArr.length; i++) { + console.info(`dataArr[` + i + `]=` + dataArr[i]); + } expect(data != undefined).assertTrue(); done(); }) @@ -152,7 +158,7 @@ describe('Image', function () { }) } - function packingCallbackFail(done, testNum, pixFormat, arg) { + function packing_cb_fail(done, testNum, pixFormat, arg) { const Color = new ArrayBuffer(96); if (pixFormat == 2) { var opts = { editable: true, pixelFormat: 2, size: { height: 4, width: 6 } } @@ -179,13 +185,13 @@ describe('Image', function () { } }) .catch(error => { - console.log(`${testNum} createpixelmap error:` + error); + console.log(`${testNum} createpixelmap error:` + error); expect().assertFail(); done(); }) } - function packingPromiseFail(done, testNum, pixFormat, arg) { + function packing_promise_fail(done, testNum, pixFormat, arg) { const Color = new ArrayBuffer(96); if (pixFormat == 2) { var opts = { editable: true, pixelFormat: 2, size: { height: 4, width: 6 } } @@ -205,6 +211,7 @@ describe('Image', function () { } else { imagePackerApi.packing(pixelmap, arg) .then((data) => { + expect(false).assertTrue(); done(); }).catch(error => { console.log(`${testNum} error:` + error); @@ -229,71 +236,71 @@ describe('Image', function () { * 3.call packing * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_packing_P_001', 0, async function (done) { - let packOpts = { format: ["image/jpeg"], quality: 99 } - packingPromise(done, 'SUB_IMAGE_packing_P_001', 2, packOpts) + let packOpts = { format: "image/jpeg", quality: 99 } + packing_promise(done, 'SUB_IMAGE_packing_P_001', 2, packOpts) }) /** * @tc.number : SUB_IMAGE_packing_P_002 - * @tc.name : SUB_IMAGE_packing_P_002 - Promise - GRB565 quality 123 + * @tc.name : SUB_IMAGE_packing_P_002 - Promise - RGB565 quality 123 * @tc.desc : 1.create PixelMap * 2.create ImagePacker * 3.call packing * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ - it('SUB_IMAGE_packing_P_002', 0, async function (done) { - let packOpts = { format: ["image/jpeg"], quality: 123 } - packingPromiseFail(done, 'SUB_IMAGE_packing_P_002', 2, packOpts) + it('SUB_IMAGE_packing_P_002', 0, async function (done) { + let packOpts = { format: "image/jpeg", quality: 123 } + packing_promise_fail(done, 'SUB_IMAGE_packing_P_002', 2, packOpts) }) /** * @tc.number : SUB_IMAGE_packing_P_003 - * @tc.name : SUB_IMAGE_packing_P_003 - Promise - GRB565 quality null + * @tc.name : SUB_IMAGE_packing_P_003 - Promise - RGB565 quality null * @tc.desc : 1.create PixelMap * 2.create ImagePacker * 3.call packing * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ - it('SUB_IMAGE_packing_P_003', 0, async function (done) { - let packOpts = { format: ["image/jpeg"] } - packingPromiseFail(done, 'SUB_IMAGE_packing_P_003', 2, packOpts) + it('SUB_IMAGE_packing_P_003', 0, async function (done) { + let packOpts = { format: "image/jpeg" } + packing_promise_fail(done, 'SUB_IMAGE_packing_P_003', 2, packOpts) }) /** * @tc.number : SUB_IMAGE_packing_P_004 - * @tc.name : SUB_IMAGE_packing_P_004 - Promise - GRB565 format null + * @tc.name : SUB_IMAGE_packing_P_004 - Promise - RGB565 format null * @tc.desc : 1.create PixelMap * 2.create ImagePacker * 3.call packing * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_packing_P_004', 0, async function (done) { let packOpts = { quality: 99 } - packingPromiseFail(done, 'SUB_IMAGE_packing_P_004', 2, packOpts) + packing_promise_fail(done, 'SUB_IMAGE_packing_P_004', 2, packOpts) }) /** * @tc.number : SUB_IMAGE_packing_P_005 - * @tc.name : SUB_IMAGE_packing_P_005 - Promise - GRB565 wrong format + * @tc.name : SUB_IMAGE_packing_P_005 - Promise - RGB565 wrong format * @tc.desc : 1.create PixelMap * 2.create ImagePacker * 3.call packing * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ - it('SUB_IMAGE_packing_P_005', 0, async function (done) { - let packOpts = { format: ["image/png"], quality: 99 } - packingPromiseFail(done, 'SUB_IMAGE_packing_P_005', 2, packOpts) + it('SUB_IMAGE_packing_P_005', 0, async function (done) { + let packOpts = { format: "image/png", quality: 99 } + packing_promise_fail(done, 'SUB_IMAGE_packing_P_005', 2, packOpts) }) /** @@ -304,11 +311,11 @@ describe('Image', function () { * 3.call packing * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ - it('SUB_IMAGE_packing_P_006', 0, async function (done) { - let packOpts = { format: ["image/jpeg"], quality: 50 } - packingPromise(done, 'SUB_IMAGE_packing_P_006', 5, packOpts) + it('SUB_IMAGE_packing_P_006', 0, async function (done) { + let packOpts = { format: "image/jpeg", quality: 50 } + packing_promise(done, 'SUB_IMAGE_packing_P_006', 5, packOpts) }) /** @@ -319,11 +326,11 @@ describe('Image', function () { * 3.call packing * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ - it('SUB_IMAGE_packing_P_007', 0, async function (done) { - let packOpts = { format: ["image/jpeg"], quality: 123 } - packingPromiseFail(done, 'SUB_IMAGE_packing_P_007', 5, packOpts) + it('SUB_IMAGE_packing_P_007', 0, async function (done) { + let packOpts = { format: "image/jpeg", quality: 123 } + packing_promise_fail(done, 'SUB_IMAGE_packing_P_007', 5, packOpts) }) /** @@ -334,11 +341,11 @@ describe('Image', function () { * 3.call packing * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ - it('SUB_IMAGE_packing_P_008', 0, async function (done) { - let packOpts = { format: ["image/jpeg"] } - packingPromiseFail(done, 'SUB_IMAGE_packing_P_008', 5, packOpts) + it('SUB_IMAGE_packing_P_008', 0, async function (done) { + let packOpts = { format: "image/jpeg" } + packing_promise_fail(done, 'SUB_IMAGE_packing_P_008', 5, packOpts) }) /** @@ -349,11 +356,11 @@ describe('Image', function () { * 3.call packing * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_packing_P_009', 0, async function (done) { let packOpts = { quality: 99 } - packingPromiseFail(done, 'SUB_IMAGE_packing_P_009', 5, packOpts) + packing_promise_fail(done, 'SUB_IMAGE_packing_P_009', 5, packOpts) }) /** @@ -364,11 +371,11 @@ describe('Image', function () { * 3.call packing * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ - it('SUB_IMAGE_packing_P_010', 0, async function (done) { - let packOpts = { format: ["image/png"], quality: 99 } - packingPromiseFail(done, 'SUB_IMAGE_packing_P_010', 5, packOpts) + it('SUB_IMAGE_packing_P_010', 0, async function (done) { + let packOpts = { format: "image/png", quality: 99 } + packing_promise_fail(done, 'SUB_IMAGE_packing_P_010', 5, packOpts) }) /** @@ -379,72 +386,72 @@ describe('Image', function () { * 3.call packing * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ - it('SUB_IMAGE_packing_CB_001', 0, async function (done) { - let packOpts = { format: ["image/jpeg"], quality: 99 } - packingCallback(done, 'SUB_IMAGE_packing_CB_001', 2, packOpts) + it('SUB_IMAGE_packing_CB_001', 0, async function (done) { + let packOpts = { format: "image/jpeg", quality: 99 } + packing_cb(done, 'SUB_IMAGE_packing_CB_001', 2, packOpts) }) /** * @tc.number : SUB_IMAGE_packing_CB_002 - * @tc.name : SUB_IMAGE_packing_CB_002 - callback - GRB565 quality 123 + * @tc.name : SUB_IMAGE_packing_CB_002 - callback - RGB565 quality 123 * @tc.desc : 1.create PixelMap * 2.create ImagePacker * 3.call packing * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_packing_CB_002', 0, async function (done) { - let packOpts = { format: ["image/jpeg"], quality: 123 } - packingCallbackFail(done, 'SUB_IMAGE_packing_CB_002', 2, packOpts) - + let packOpts = { format: "image/jpeg", quality: 123 } + packing_cb_fail(done, 'SUB_IMAGE_packing_CB_002', 2, packOpts) + }) /** * @tc.number : SUB_IMAGE_packing_CB_003 - * @tc.name : SUB_IMAGE_packing_CB_003 - callback - GRB565 quality null + * @tc.name : SUB_IMAGE_packing_CB_003 - callback - RGB565 quality null * @tc.desc : 1.create PixelMap * 2.create ImagePacker * 3.call packing * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_packing_CB_003', 0, async function (done) { - let packOpts = { format: ["image/jpeg"] } - packingCallbackFail(done, 'SUB_IMAGE_packing_CB_003', 2, packOpts) + let packOpts = { format: "image/jpeg" } + packing_cb_fail(done, 'SUB_IMAGE_packing_CB_003', 2, packOpts) }) /** * @tc.number : SUB_IMAGE_packing_CB_004 - * @tc.name : SUB_IMAGE_packing_CB_004 - callback - GRB565 format null + * @tc.name : SUB_IMAGE_packing_CB_004 - callback - RGB565 format null * @tc.desc : 1.create PixelMap * 2.create ImagePacker * 3.call packing * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_packing_CB_004', 0, async function (done) { let packOpts = { quality: 99 } - packingCallbackFail(done, 'SUB_IMAGE_packing_CB_004', 2, packOpts) + packing_cb_fail(done, 'SUB_IMAGE_packing_CB_004', 2, packOpts) }) /** * @tc.number : SUB_IMAGE_packing_CB_005 - * @tc.name : SUB_IMAGE_packing_CB_005 - callback - GRB565 wrong format + * @tc.name : SUB_IMAGE_packing_CB_005 - callback - RGB565 wrong format * @tc.desc : 1.create PixelMap * 2.create ImagePacker * 3.call packing * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_packing_CB_005', 0, async function (done) { - let packOpts = { format: ["image/png"], quality: 99 } - packingCallbackFail(done, 'SUB_IMAGE_packing_CB_005', 2, packOpts) + let packOpts = { format: "image/png", quality: 99 } + packing_cb_fail(done, 'SUB_IMAGE_packing_CB_005', 2, packOpts) }) /** @@ -455,11 +462,11 @@ describe('Image', function () { * 3.call packing * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ - it('SUB_IMAGE_packing_CB_006', 0, async function (done) { - let packOpts = { format: ["image/jpeg"], quality: 50 } - packingCallback(done, 'SUB_IMAGE_packing_CB_006', 5, packOpts) + it('SUB_IMAGE_packing_CB_006', 0, async function (done) { + let packOpts = { format: "image/jpeg", quality: 50 } + packing_cb(done, 'SUB_IMAGE_packing_CB_006', 5, packOpts) }) /** @@ -470,12 +477,12 @@ describe('Image', function () { * 3.call packing * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_packing_CB_007', 0, async function (done) { - let packOpts = { format: ["image/jpeg"], quality: 123 } - packingCallbackFail(done, 'SUB_IMAGE_packing_CB_007', 5, packOpts) - + let packOpts = { format: "image/jpeg", quality: 123 } + packing_cb_fail(done, 'SUB_IMAGE_packing_CB_007', 5, packOpts) + }) /** @@ -486,11 +493,11 @@ describe('Image', function () { * 3.call packing * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_packing_CB_008', 0, async function (done) { - let packOpts = { format: ["image/jpeg"] } - packingCallbackFail(done, 'SUB_IMAGE_packing_CB_008', 5, packOpts) + let packOpts = { format: "image/jpeg" } + packing_cb_fail(done, 'SUB_IMAGE_packing_CB_008', 5, packOpts) }) /** @@ -501,11 +508,11 @@ describe('Image', function () { * 3.call packing * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_packing_CB_009', 0, async function (done) { let packOpts = { quality: 99 } - packingCallbackFail(done, 'SUB_IMAGE_packing_CB_009', 5, packOpts) + packing_cb_fail(done, 'SUB_IMAGE_packing_CB_009', 5, packOpts) }) /** @@ -516,11 +523,11 @@ describe('Image', function () { * 3.call packing * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_packing_CB_010', 0, async function (done) { - let packOpts = { format: ["image/png"], quality: 99 } - packingCallbackFail(done, 'SUB_IMAGE_packing_CB_010', 5, packOpts) + let packOpts = { format: "image/png", quality: 99 } + packing_cb_fail(done, 'SUB_IMAGE_packing_CB_010', 5, packOpts) }) }) \ No newline at end of file diff --git a/multimedia/image/image_js_standard/imageYUV/src/main/js/test/yuv.test.js b/multimedia/image/image_js_standard/imageYUV/src/main/js/test/yuv.test.js index 9b98a7dac43573a022eeaf447f00ba5e0cfaed1a..6440d0f50de2edab5fa46d7c7717268ec59bf88e 100644 --- a/multimedia/image/image_js_standard/imageYUV/src/main/js/test/yuv.test.js +++ b/multimedia/image/image_js_standard/imageYUV/src/main/js/test/yuv.test.js @@ -28,7 +28,7 @@ describe('Image', function () { console.info('beforeEach case'); }) - afterEach(function () { + afterEach(async function () { console.info('afterEach case'); }) @@ -103,6 +103,11 @@ describe('Image', function () { done(); } else { pixelmap.getImageInfo((err, imageInfo) => { + if (err != undefined) { + expect(false).assertTrue(); + done(); + return; + } expect(imageInfo != undefined).assertTrue(); expect(imageInfo.size.height == 4).assertTrue(); expect(imageInfo.size.width == 6).assertTrue(); @@ -133,12 +138,10 @@ describe('Image', function () { } else { imageSource.createPixelMap() .then((pixelmap) => { - console.info(`${testNum} create Pixelmap ok`); expect(false).assertTrue(); done(); }).catch(error => { - console.info(`${testNum} create Pixelmap failed`); - console.log(`${testNum} error:` + error); + console.info(`${testNum} error:` + error); expect(true).assertTrue(); done(); }) @@ -160,17 +163,25 @@ describe('Image', function () { done(); } else { imageSource.createPixelMap((err, pixelmap) => { - if (pixelmap == undefined) { + if (err != undefined || pixelmap == undefined) { + console.info(`${testNum} err2: ` + err); expect(false).assertTrue(); done(); - } else { - pixelmap.getImageInfo((err, imageInfo) => { - expect(imageInfo != undefined).assertTrue(); - expect(imageInfo.size.height == 4).assertTrue(); - expect(imageInfo.size.width == 6).assertTrue(); - done(); - }) + return; } + pixelmap.getImageInfo((err, imageInfo) => { + if (err != undefined) { + console.info(`${testNum} getImageInfo fail`); + expect(false).assertTrue(); + done(); + return; + } + expect(imageInfo != undefined).assertTrue(); + expect(imageInfo.size.height == 4).assertTrue(); + expect(imageInfo.size.width == 6).assertTrue(); + done(); + }) + }) } } catch (error) { @@ -189,13 +200,14 @@ describe('Image', function () { done(); } else { imageSource.createPixelMap((err, pixelmap) => { - if (pixelmap == undefined) { - expect(true).assertTrue() - done(); - } else { - expect(false).assertTrue() + if (err != undefined || pixelmap == undefined) { + console.info(`${testNum} err: ` + err); + expect(true).assertTrue(); done(); + return; } + expect(false).assertTrue(); + done(); }) } } catch (error) { @@ -252,12 +264,12 @@ describe('Image', function () { const imagePackerApi = image.createImagePacker(); if (imagePackerApi == undefined) { console.info(`${testNum} create ImagePacker failed`); - expect(true).assertTrue(); + expect(false).assertTrue(); done(); } else { imagePackerApi.packing(imageSource, arg) .then(data => { - expect(false).assertTrue(); + expect(data == undefined).assertTrue(); done(); }).catch(error => { console.log(`${testNum} error: ` + error); @@ -282,6 +294,11 @@ describe('Image', function () { done(); } else { imagePackerApi.packing(imageSource, arg, (err, data) => { + if (err != undefined) { + expect(false).assertTrue(); + done(); + return; + } var dataArr = new Uint8Array(data); console.info(`${testNum} dataArr.length=` + dataArr.length); for (var i = 0; i < dataArr.length; i++) { @@ -313,7 +330,7 @@ describe('Image', function () { done(); } else { imagePackerApi.packing(imageSource, arg, (err, data) => { - expect(err != undefined).assertTrue(); + expect(err != undefined || data == undefined).assertTrue(); done(); }) } @@ -327,7 +344,7 @@ describe('Image', function () { * 2.create pixelmap * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_yuv_pixelmap_P_001', 0, async function (done) { let yuvData = createBuffer(4, 6); @@ -342,7 +359,7 @@ describe('Image', function () { * 2.create pixelmap * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_yuv_pixelmap_P_002', 0, async function (done) { let yuvData = createBuffer(4, 6); @@ -357,7 +374,7 @@ describe('Image', function () { * 2.create pixelmap * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_yuv_pixelmap_P_003', 0, async function (done) { let yuvData = new ArrayBuffer(5); @@ -372,7 +389,7 @@ describe('Image', function () { * 2.create pixelmap * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_yuv_pixelmap_P_004', 0, async function (done) { let yuvData = createBuffer(4, 6); @@ -387,7 +404,7 @@ describe('Image', function () { * 2.create pixelmap * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_yuv_pixelmap_P_005', 0, async function (done) { let yuvData = new ArrayBuffer(5); @@ -402,7 +419,7 @@ describe('Image', function () { * 2.create pixelmap * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_yuv_pixelmap_P_006', 0, async function (done) { let yuvData = createBuffer(4, 6); @@ -417,7 +434,7 @@ describe('Image', function () { * 2.create pixelmap * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_yuv_pixelmap_P_007', 0, async function (done) { let yuvData = createBuffer(4, 6); @@ -432,7 +449,7 @@ describe('Image', function () { * 2.create pixelmap * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_yuv_pixelmap_P_008', 0, async function (done) { let yuvData = createBuffer(4, 6); @@ -449,12 +466,12 @@ describe('Image', function () { * 4.call packing * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_yuv_imagesource_P_001', 0, async function (done) { let yuvData = createBuffer(4, 6); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 8, sourceSize: { height: 4, width: 6 } }; - let packOpts = { format: ["image/jpeg"], quality: 99 } + let packOpts = { format: "image/jpeg", quality: 99 } yuvToJpegByImageSourcePromise(done, 'SUB_IMAGE_yuv_imagesource_P_001', sourceOptions, packOpts, yuvData) }) @@ -467,12 +484,12 @@ describe('Image', function () { * 4.call packing * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_yuv_imagesource_P_002', 0, async function (done) { let yuvData = createBuffer(4, 6); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 9, sourceSize: { height: 4, width: 6 } }; - let packOpts = { format: ["image/jpeg"], quality: 99 } + let packOpts = { format: "image/jpeg", quality: 99 } yuvToJpegByImageSourcePromise(done, 'SUB_IMAGE_yuv_imagesource_P_002', sourceOptions, packOpts, yuvData) }) @@ -485,12 +502,12 @@ describe('Image', function () { * 4.call packing * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_yuv_imagesource_P_003', 0, async function (done) { let yuvData = new ArrayBuffer(5); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 8, sourceSize: { height: 4, width: 6 } }; - let packOpts = { format: ["image/jpeg"], quality: 99 } + let packOpts = { format: "image/jpeg", quality: 99 } yuvToJpegByImageSourcePromise(done, 'SUB_IMAGE_yuv_imagesource_P_003', sourceOptions, packOpts, yuvData) }) @@ -503,12 +520,12 @@ describe('Image', function () { * 4.call packing * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_yuv_imagesource_P_004', 0, async function (done) { let yuvData = createBuffer(4, 6); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 8, sourceSize: { height: 4, width: 5 } }; - let packOpts = { format: ["image/jpeg"], quality: 99 } + let packOpts = { format: "image/jpeg", quality: 99 } yuvToJpegByImageSourcePromise_fail(done, 'SUB_IMAGE_yuv_imagesource_P_004', sourceOptions, packOpts, yuvData) }) @@ -521,12 +538,12 @@ describe('Image', function () { * 4.call packing * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_yuv_imagesource_P_005', 0, async function (done) { let yuvData = new ArrayBuffer(5); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 9, sourceSize: { height: 4, width: 6 } }; - let packOpts = { format: ["image/jpeg"], quality: 99 } + let packOpts = { format: "image/jpeg", quality: 99 } yuvToJpegByImageSourcePromise(done, 'SUB_IMAGE_yuv_imagesource_P_005', sourceOptions, packOpts, yuvData) }) @@ -539,12 +556,12 @@ describe('Image', function () { * 4.call packing * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_yuv_imagesource_P_006', 0, async function (done) { let yuvData = createBuffer(4, 6); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 9, sourceSize: { height: 4, width: 5 } }; - let packOpts = { format: ["image/jpeg"], quality: 99 } + let packOpts = { format: "image/jpeg", quality: 99 } yuvToJpegByImageSourcePromise_fail(done, 'SUB_IMAGE_yuv_imagesource_P_006', sourceOptions, packOpts, yuvData) }) @@ -557,12 +574,12 @@ describe('Image', function () { * 4.call packing * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_yuv_imagesource_P_007', 0, async function (done) { let yuvData = createBuffer(4, 6); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 10, sourceSize: { height: 4, width: 6 } }; - let packOpts = { format: ["image/jpeg"], quality: 99 } + let packOpts = { format: "image/jpeg", quality: 99 } yuvToJpegByImageSourcePromise_fail(done, 'SUB_IMAGE_yuv_imagesource_P_007', sourceOptions, packOpts, yuvData) }) @@ -575,12 +592,12 @@ describe('Image', function () { * 4.call packing * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_yuv_imagesource_P_008', 0, async function (done) { let yuvData = createBuffer(4, 6); let sourceOptions = { sourceDensity: 120, sourceSize: { height: 4, width: 6 } }; - let packOpts = { format: ["image/jpeg"], quality: 99 } + let packOpts = { format: "image/jpeg", quality: 99 } yuvToJpegByImageSourcePromise_fail(done, 'SUB_IMAGE_yuv_imagesource_P_008', sourceOptions, packOpts, yuvData) }) @@ -591,7 +608,7 @@ describe('Image', function () { * 2.create pixelmap * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_yuv_pixelmap_CB_001', 0, async function (done) { let yuvData = createBuffer(4, 6); @@ -606,7 +623,7 @@ describe('Image', function () { * 2.create pixelmap * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_yuv_pixelmap_CB_002', 0, async function (done) { let yuvData = createBuffer(4, 6); @@ -621,7 +638,7 @@ describe('Image', function () { * 2.create pixelmap * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_yuv_pixelmap_CB_003', 0, async function (done) { let yuvData = new ArrayBuffer(5); @@ -636,7 +653,7 @@ describe('Image', function () { * 2.create pixelmap * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_yuv_pixelmap_CB_004', 0, async function (done) { let yuvData = createBuffer(4, 6); @@ -651,7 +668,7 @@ describe('Image', function () { * 2.create pixelmap * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_yuv_pixelmap_CB_005', 0, async function (done) { let yuvData = new ArrayBuffer(5); @@ -666,7 +683,7 @@ describe('Image', function () { * 2.create pixelmap * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_yuv_pixelmap_CB_006', 0, async function (done) { let yuvData = createBuffer(4, 6); @@ -681,7 +698,7 @@ describe('Image', function () { * 2.create pixelmap * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_yuv_pixelmap_CB_007', 0, async function (done) { let yuvData = createBuffer(4, 6); @@ -696,7 +713,7 @@ describe('Image', function () { * 2.create pixelmap * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_yuv_pixelmap_CB_008', 0, async function (done) { let yuvData = createBuffer(4, 6); @@ -713,12 +730,12 @@ describe('Image', function () { * 4.call packing * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_yuv_imagesource_CB_001', 0, async function (done) { let yuvData = createBuffer(4, 6); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 8, sourceSize: { height: 4, width: 6 } }; - let packOpts = { format: ["image/jpeg"], quality: 99 } + let packOpts = { format: "image/jpeg", quality: 99 } yuvToJpegByImageSourceCallback(done, 'SUB_IMAGE_yuv_imagesource_CB_001', sourceOptions, packOpts, yuvData) }) @@ -731,12 +748,12 @@ describe('Image', function () { * 4.call packing * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_yuv_imagesource_CB_002', 0, async function (done) { let yuvData = createBuffer(4, 6); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 9, sourceSize: { height: 4, width: 6 } }; - let packOpts = { format: ["image/jpeg"], quality: 99 } + let packOpts = { format: "image/jpeg", quality: 99 } yuvToJpegByImageSourceCallback(done, 'SUB_IMAGE_yuv_imagesource_CB_002', sourceOptions, packOpts, yuvData) }) @@ -749,12 +766,12 @@ describe('Image', function () { * 4.call packing * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_yuv_imagesource_CB_003', 0, async function (done) { let yuvData = new ArrayBuffer(5); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 8, sourceSize: { height: 4, width: 6 } }; - let packOpts = { format: ["image/jpeg"], quality: 99 } + let packOpts = { format: "image/jpeg", quality: 99 } yuvToJpegByImageSourceCallback(done, 'SUB_IMAGE_yuv_imagesource_CB_003', sourceOptions, packOpts, yuvData) }) @@ -767,12 +784,12 @@ describe('Image', function () { * 4.call packing * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_yuv_imagesource_CB_004', 0, async function (done) { let yuvData = createBuffer(4, 6); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 8, sourceSize: { height: 4, width: 5 } }; - let packOpts = { format: ["image/jpeg"], quality: 99 } + let packOpts = { format: "image/jpeg", quality: 99 } yuvToJpegByImageSourceCallback_fail(done, 'SUB_IMAGE_yuv_imagesource_CB_004', sourceOptions, packOpts, yuvData) }) @@ -785,12 +802,12 @@ describe('Image', function () { * 4.call packing * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_yuv_imagesource_CB_005', 0, async function (done) { let yuvData = new ArrayBuffer(5); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 9, sourceSize: { height: 4, width: 6 } }; - let packOpts = { format: ["image/jpeg"], quality: 99 } + let packOpts = { format: "image/jpeg", quality: 99 } yuvToJpegByImageSourceCallback(done, 'SUB_IMAGE_yuv_imagesource_CB_005', sourceOptions, packOpts, yuvData) }) @@ -803,12 +820,12 @@ describe('Image', function () { * 4.call packing * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_yuv_imagesource_CB_006', 0, async function (done) { let yuvData = createBuffer(4, 6); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 9, sourceSize: { height: 4, width: 5 } }; - let packOpts = { format: ["image/jpeg"], quality: 99 } + let packOpts = { format: "image/jpeg", quality: 99 } yuvToJpegByImageSourceCallback_fail(done, 'SUB_IMAGE_yuv_imagesource_CB_006', sourceOptions, packOpts, yuvData) }) @@ -821,12 +838,12 @@ describe('Image', function () { * 4.call packing * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_yuv_imagesource_CB_007', 0, async function (done) { let yuvData = createBuffer(4, 6); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 10, sourceSize: { height: 4, width: 6 } }; - let packOpts = { format: ["image/jpeg"], quality: 99 } + let packOpts = { format: "image/jpeg", quality: 99 } yuvToJpegByImageSourceCallback_fail(done, 'SUB_IMAGE_yuv_imagesource_CB_007', sourceOptions, packOpts, yuvData) }) @@ -839,12 +856,12 @@ describe('Image', function () { * 4.call packing * @tc.size : MEDIUM * @tc.type : Functional - * @tc.level : Level 1 + * @tc.level : level 0 */ it('SUB_IMAGE_yuv_imagesource_CB_008', 0, async function (done) { let yuvData = createBuffer(4, 6); let sourceOptions = { sourceDensity: 120, sourceSize: { height: 4, width: 6 } }; - let packOpts = { format: ["image/jpeg"], quality: 99 } + let packOpts = { format: "image/jpeg", quality: 99 } yuvToJpegByImageSourceCallback_fail(done, 'SUB_IMAGE_yuv_imagesource_CB_008', sourceOptions, packOpts, yuvData) }) }) \ No newline at end of file