build: fix golden test
This commit is contained in:
parent
d7d7261a06
commit
17a57e8c3d
1 changed files with 14 additions and 2 deletions
|
|
@ -125,11 +125,23 @@ func doGoldenTests(t *testing.T, resultDir string, tests []test, opts ...Option)
|
|||
b := imagor.NewBlobFromBytes(w.Body.Bytes())
|
||||
_ = resStorage.Put(context.Background(), tt.path, b)
|
||||
path := filepath.Join(resultDir, imagorpath.Normalize(tt.path, nil))
|
||||
|
||||
bc := imagor.NewBlobFromFile(path)
|
||||
buf, err := bc.ReadAll()
|
||||
require.NoError(t, err)
|
||||
assert.True(t, reflect.DeepEqual(buf, w.Body.Bytes()))
|
||||
if reflect.DeepEqual(buf, w.Body.Bytes()) {
|
||||
return
|
||||
}
|
||||
img1, err := vips.LoadImageFromBuffer(buf, nil)
|
||||
require.NoError(t, err)
|
||||
img2, err := vips.LoadImageFromBuffer(w.Body.Bytes(), nil)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, img1.Width(), img2.Width(), "width mismatch")
|
||||
require.Equal(t, img1.Height(), img2.Height(), "height mismatch")
|
||||
buf1, err := img1.ExportWebp(nil)
|
||||
require.NoError(t, err)
|
||||
buf2, err := img2.ExportWebp(nil)
|
||||
require.NoError(t, err)
|
||||
require.True(t, reflect.DeepEqual(buf1, buf2), "image mismatch")
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue