未验证 提交 cc83d098 编写于 作者: O openharmony_ci 提交者: Gitee

!4660 image decodingoption用例修改适配开发修改

Merge pull request !4660 from 秦莉文/OpenHarmony-3.2-Beta2
...@@ -1067,16 +1067,24 @@ describe('Image', function () { ...@@ -1067,16 +1067,24 @@ describe('Image', function () {
index: 0 index: 0
}; };
imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => {
globalpixelmap = pixelmap; if (err) {
console.info('TC_050-10 fail ');
if (pixelmap == undefined) { expect(false).assertTrue();
console.info('TC_050-10 success '); done();
expect(true).assertTrue(); } else {
done(); globalpixelmap = pixelmap;
} else { pixelmap.getImageInfo().then((imageInfo) => {
expect(false).assertTrue(); expect(imageInfo.size.height == 2).assertTrue();
done(); 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) { } catch (error) {
...@@ -1731,16 +1739,24 @@ describe('Image', function () { ...@@ -1731,16 +1739,24 @@ describe('Image', function () {
index: 0 index: 0
}; };
imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => {
globalpixelmap = pixelmap; if (err) {
console.info('TC_067-10 fail ');
if (pixelmap == undefined) { expect(false).assertTrue();
console.info('TC_067-10 success '); done();
expect(true).assertTrue(); } else {
done(); globalpixelmap = pixelmap;
} else { pixelmap.getImageInfo().then((imageInfo) => {
expect(false).assertTrue(); expect(imageInfo.size.height == 2).assertTrue();
done(); 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 () { ...@@ -2369,16 +2385,24 @@ describe('Image', function () {
index: 0 index: 0
}; };
imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => {
globalpixelmap = pixelmap; if (err) {
console.info('TC_068-10 fail ');
if (pixelmap == undefined) { expect(false).assertTrue();
console.info('TC_068-10 success '); done();
expect(true).assertTrue(); } else {
done(); globalpixelmap = pixelmap;
} else { pixelmap.getImageInfo().then((imageInfo) => {
expect(false).assertTrue(); expect(imageInfo.size.height == 2).assertTrue();
done(); 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 () { ...@@ -2950,16 +2974,24 @@ describe('Image', function () {
index: 0 index: 0
}; };
imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => {
globalpixelmap = pixelmap; if (err) {
console.info('TC_163-10 fail ');
if (pixelmap == undefined) { expect(false).assertTrue();
console.info('TC_163-10 success '); done();
expect(true).assertTrue(); } else {
done(); globalpixelmap = pixelmap;
} else { pixelmap.getImageInfo().then((imageInfo) => {
expect(false).assertTrue(); expect(imageInfo.size.height == 2).assertTrue();
done(); 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();
})
}
}) })
} }
}) })
......
...@@ -70,7 +70,35 @@ describe('Image', function () { ...@@ -70,7 +70,35 @@ describe('Image', function () {
console.info('[permission]case apply permission failed,createAtManager failed'); 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) { async function createPixMapCbErr(done, testNum, arg) {
let fdNumber = fileio.openSync(pathWebp); let fdNumber = fileio.openSync(pathWebp);
const imageSourceApi = image.createImageSource(fdNumber); const imageSourceApi = image.createImageSource(fdNumber);
...@@ -91,6 +119,33 @@ describe('Image', function () { ...@@ -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) { async function createPixMapPromiseErr(done, testNum, arg) {
let fdNumber = fileio.openSync(pathWebp); let fdNumber = fileio.openSync(pathWebp);
const imageSourceApi = image.createImageSource(fdNumber); const imageSourceApi = image.createImageSource(fdNumber);
...@@ -752,7 +807,7 @@ describe('Image', function () { ...@@ -752,7 +807,7 @@ describe('Image', function () {
desiredRegion: { size: { height: 10000, width: 10000 }, x: 0, y: 0 }, desiredRegion: { size: { height: 10000, width: 10000 }, x: 0, y: 0 },
index: 0 index: 0
}; };
createPixMapCbErr(done, 'wbp_009', decodingOptions) createPixMapCb(done, 'wbp_009', decodingOptions)
}) })
/** /**
...@@ -873,7 +928,7 @@ describe('Image', function () { ...@@ -873,7 +928,7 @@ describe('Image', function () {
desiredRegion: { size: { height: 10000, width: 10000 }, x: 0, y: 0 }, desiredRegion: { size: { height: 10000, width: 10000 }, x: 0, y: 0 },
index: 0 index: 0
}; };
createPixMapPromiseErr(done, 'wbp_014', decodingOptions) createPixMapPromise(done, 'wbp_014', decodingOptions)
}) })
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册