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

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

Merge pull request !4660 from 秦莉文/OpenHarmony-3.2-Beta2
......@@ -1067,15 +1067,23 @@ describe('Image', function () {
index: 0
};
imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => {
if (err) {
console.info('TC_050-10 fail ');
expect(false).assertTrue();
done();
} else {
globalpixelmap = pixelmap;
if (pixelmap == undefined) {
pixelmap.getImageInfo().then((imageInfo) => {
expect(imageInfo.size.height == 2).assertTrue();
expect(imageInfo.size.width == 1).assertTrue();
console.info('TC_050-10 success ');
expect(true).assertTrue();
console.info("imageInfo height :" + imageInfo.size.height + "width : " + imageInfo.size.width);
done();
} else {
}).catch((err) => {
console.info('TC_050-10 getimageInfo err ' + JSON.stringify(err));
expect(false).assertTrue();
done();
})
}
})
}
......@@ -1731,15 +1739,23 @@ describe('Image', function () {
index: 0
};
imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => {
if (err) {
console.info('TC_067-10 fail ');
expect(false).assertTrue();
done();
} else {
globalpixelmap = pixelmap;
if (pixelmap == undefined) {
pixelmap.getImageInfo().then((imageInfo) => {
expect(imageInfo.size.height == 2).assertTrue();
expect(imageInfo.size.width == 1).assertTrue();
console.info('TC_067-10 success ');
expect(true).assertTrue();
console.info("imageInfo height :" + imageInfo.size.height + "width : " + imageInfo.size.width);
done();
} else {
}).catch((err) => {
console.info('TC_067-10 getimageInfo err ' + JSON.stringify(err));
expect(false).assertTrue();
done();
})
}
})
}
......@@ -2369,15 +2385,23 @@ describe('Image', function () {
index: 0
};
imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => {
if (err) {
console.info('TC_068-10 fail ');
expect(false).assertTrue();
done();
} else {
globalpixelmap = pixelmap;
if (pixelmap == undefined) {
pixelmap.getImageInfo().then((imageInfo) => {
expect(imageInfo.size.height == 2).assertTrue();
expect(imageInfo.size.width == 1).assertTrue();
console.info('TC_068-10 success ');
expect(true).assertTrue();
console.info("imageInfo height :" + imageInfo.size.height + "width : " + imageInfo.size.width);
done();
} else {
}).catch((err) => {
console.info('TC_068-10 getimageInfo err ' + JSON.stringify(err));
expect(false).assertTrue();
done();
})
}
})
}
......@@ -2950,15 +2974,23 @@ describe('Image', function () {
index: 0
};
imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => {
if (err) {
console.info('TC_163-10 fail ');
expect(false).assertTrue();
done();
} else {
globalpixelmap = pixelmap;
if (pixelmap == undefined) {
pixelmap.getImageInfo().then((imageInfo) => {
expect(imageInfo.size.height == 2).assertTrue();
expect(imageInfo.size.width == 1).assertTrue();
console.info('TC_163-10 success ');
expect(true).assertTrue();
console.info("imageInfo height :" + imageInfo.size.height + "width : " + imageInfo.size.width);
done();
} else {
}).catch((err) => {
console.info('TC_163-10 getimageInfo err ' + JSON.stringify(err));
expect(false).assertTrue();
done();
})
}
})
}
......
......@@ -71,6 +71,34 @@ describe('Image', function () {
}
}
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)
})
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册