diff --git a/processor_test.go b/processor_test.go index 3bb3fb5..5fd9e23 100644 --- a/processor_test.go +++ b/processor_test.go @@ -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") }) }