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

Method processImageAndCheck

processing/suite_test.go:104–130  ·  view source on GitHub ↗
(tc testCaseParams)

Source from the content-addressed store, hash-verified

102}
103
104func (s *testSuite) processImageAndCheck(tc testCaseParams) {
105 s.T().Helper()
106
107 resultData := s.processImage(tc.Options())
108 defer resultData.Close()
109
110 // Load the result image to check its size and interpretation
111 resultImg := new(vips.Image)
112 defer resultImg.Clear()
113
114 err := resultImg.Load(resultData, 1.0, 0, 1)
115 s.Require().NoError(err)
116
117 outSize := tc.OutSize()
118 outInterpretation := tc.OutInterpretation()
119
120 s.Require().Equal(resultImg.Width(), outSize.width, "Width mismatch")
121 s.Require().Equal(resultImg.Height(), outSize.height, "Height mismatch")
122
123 if outInterpretation != vips.InterpretationMultiBand {
124 // Check the interpretation
125 actualInterpretation := resultImg.Type()
126 s.Require().Equal(outInterpretation, actualInterpretation)
127 }
128
129 s.ImageMatcher().ImageMatches(s.T(), resultData.Reader(), "test", 0.0005)
130}

Callers 15

TestResizeToFitMethod · 0.80
TestResizeToFitExtendMethod · 0.80
TestResizeToFillMethod · 0.80
TestResizeToFillDownMethod · 0.80

Calls 13

processImageMethod · 0.95
TMethod · 0.80
ClearMethod · 0.80
LoadMethod · 0.80
TypeMethod · 0.80
ImageMatchesMethod · 0.80
OptionsMethod · 0.65
CloseMethod · 0.65
OutSizeMethod · 0.65
OutInterpretationMethod · 0.65
ReaderMethod · 0.65
WidthMethod · 0.45

Tested by

no test coverage detected