mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-17 11:16:34 -07:00
add test
This commit is contained in:
parent
a2cd58f651
commit
3b61e30982
1 changed files with 29 additions and 2 deletions
31
vips_test.go
31
vips_test.go
|
|
@ -89,8 +89,8 @@ func TestVipsAutoRotate(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
files := []struct {
|
files := []struct {
|
||||||
name string
|
name string
|
||||||
orientation int
|
orientation int
|
||||||
}{
|
}{
|
||||||
{"test.jpg", 0},
|
{"test.jpg", 0},
|
||||||
{"test_exif.jpg", 0},
|
{"test_exif.jpg", 0},
|
||||||
|
|
@ -203,6 +203,33 @@ func TestVipsMemory(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestVipsExifShort(t *testing.T) {
|
||||||
|
tt := []struct {
|
||||||
|
input string
|
||||||
|
expected string
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
input: `( ()`,
|
||||||
|
expected: `(`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
input: ` ()`,
|
||||||
|
expected: ` ()`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
input: `sRGB`,
|
||||||
|
expected: `sRGB`,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tc := range tt {
|
||||||
|
got := vipsExifShort(tc.input)
|
||||||
|
if got != tc.expected {
|
||||||
|
t.Fatalf("expected: %s; got: %s", tc.expected, got)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func readImage(file string) []byte {
|
func readImage(file string) []byte {
|
||||||
img, _ := os.Open(path.Join("testdata", file))
|
img, _ := os.Open(path.Join("testdata", file))
|
||||||
buf, _ := ioutil.ReadAll(img)
|
buf, _ := ioutil.ReadAll(img)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue