MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / NewImageHashCacheMatcher

Function NewImageHashCacheMatcher

testutil/image_hash_cache_matcher.go:36–47  ·  view source on GitHub ↗

NewImageHashCacheMatcher creates a new ImageHashRegressionMatcher instance

(testDataProvider *TestDataProvider, hashType ImageHashType)

Source from the content-addressed store, hash-verified

34
35// NewImageHashCacheMatcher creates a new ImageHashRegressionMatcher instance
36func 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.

Callers 4

SetupTestMethod · 0.92
SetupSuiteMethod · 0.92
TestLinearColorspaceMethod · 0.92

Calls 1

PathMethod · 0.80

Tested by 4

SetupTestMethod · 0.74
SetupSuiteMethod · 0.74
TestLinearColorspaceMethod · 0.74