import { BinaryBitmap , GlobalHistogramBinarizer } from '@zxing/library' ; import AbstractBlackBoxSpec from '../../../common/AbstractBlackBox' ; import SharpImageLuminanceSource from '../../../SharpImageLuminanceSource' ; import SharpImage from '../../../util/SharpImage' ; export default class TestCaseUtil { private constructor ( ) { } throws private static getBufferedImage ( path ) { let file = AbstractBlackBoxSpec . buildTestBase ( path ) ; return SharpImage . load ( file , 0 ) ; } throws static getBinaryBitmap ( path ) { let bufferedImage = TestCaseUtil . getBufferedImage ( path ) ; let luminanceSource = new SharpImageLuminanceSource ( bufferedImage ) ; return new BinaryBitmap ( new GlobalHistogramBinarizer ( luminanceSource ) ) ; } }