|
|
|
|
@ -42,11 +42,20 @@ func TestVipsSave(t *testing.T) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestVipsRotate(t *testing.T) {
|
|
|
|
|
image, _, _ := vipsRead(readImage("test.jpg"))
|
|
|
|
|
files := []struct {
|
|
|
|
|
name string
|
|
|
|
|
rotate Angle
|
|
|
|
|
}{
|
|
|
|
|
{"test.jpg", D90},
|
|
|
|
|
{"test_square.jpg", D45},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
newImg, err := vipsRotate(image, D90)
|
|
|
|
|
for _, file := range files {
|
|
|
|
|
image, _, _ := vipsRead(readImage(file.name))
|
|
|
|
|
|
|
|
|
|
newImg, err := vipsRotate(image, file.rotate)
|
|
|
|
|
if err != nil {
|
|
|
|
|
t.Fatal("Cannot save the image")
|
|
|
|
|
t.Fatal("Cannot rotate the image")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
buf, _ := vipsSave(newImg, vipsSaveOptions{Quality: 95})
|
|
|
|
|
@ -54,6 +63,7 @@ func TestVipsRotate(t *testing.T) {
|
|
|
|
|
t.Fatal("Empty image")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestVipsZoom(t *testing.T) {
|
|
|
|
|
image, _, _ := vipsRead(readImage("test.jpg"))
|
|
|
|
|
|