NewImageHashCacheMatcher creates a new ImageHashRegressionMatcher instance
(testDataProvider *TestDataProvider, hashType ImageHashType)
| 34 | |
| 35 | // NewImageHashCacheMatcher creates a new ImageHashRegressionMatcher instance |
| 36 | func NewImageHashCacheMatcher(testDataProvider *TestDataProvider, hashType ImageHashType) *ImageHashCacheMatcher { |
| 37 | hashesPath := testDataProvider.Path(hashPath) |
| 38 | createMissingHashes := len(os.Getenv(createMissingHashesEnv)) > 0 |
| 39 | saveTmpImagesPath := os.Getenv(saveTmpImagesPathEnv) |
| 40 | |
| 41 | return &ImageHashCacheMatcher{ |
| 42 | hashesPath: hashesPath, |
| 43 | createMissingHashes: createMissingHashes, |
| 44 | saveTmpImagesPath: saveTmpImagesPath, |
| 45 | hashType: hashType, |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | // ImageMatches is a testing helper, which accepts image as reader, calculates |
| 50 | // hash and compares it with a hash saved to testdata/test-hashes folder. |