本文整理汇总了TypeScript中image-diff.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: Promise
return new Promise(resolve => {
imageDiff({
actualImage: actualPath,
expectedImage: goldenPath,
diffImage: diffPath,
}, (err: any, imagesAreEqual: boolean) => {
if (err) {
throw err;
}
resolve(imagesAreEqual);
});
});
示例2: Promise
return new Promise((resolve: any, reject: any) => {
imageDiff({
actualImage: pullRequestUrl,
expectedImage: goldUrl,
diffImage: diffUrl,
}, (err: any, imagesAreSame: boolean) => {
if (err) {
console.log(err);
imagesAreSame = false;
reject(err);
}
resolve(imagesAreSame);
return updateFileResult(database, prNumber, filenameKey, imagesAreSame);
});
});
示例3: compareImages
export function compareImages (img1: string, img2: string, cb: Function = () => {}) {
// console.log(`comparing
// ../../results/screenshots/ ${img1}
// ../../results/screenshots/ ${img2}`);
imageDiff({
actualImage: `${ssDir}/${img1}.png`,
expectedImage: `${ssDir}/${img2}.png`,
diffImage: `${ssDir}/COMPARE:${img1}+${img2}.png`
}, (err, imagesAreSame) => {
cb(imagesAreSame);
});
// fs.readFile(`../../results/screenshots/${img1}.png`, 'utf8', () => console.log("callback"));
// resemble(`./results/screenshots/${img1}.png`).compareTo(`./results/screenshots/${img2}.png`).ignoreColors().onComplete(data => {
// console.log('compare data ', data);
// return cb(data);
// })
}