Add support for 45° rotation.

This commit is contained in:
Yoan Blanc 2016-08-25 15:28:15 +02:00
parent 66f3ccc217
commit 00fee003f7
No known key found for this signature in database
GPG key ID: 6058CF4574298812
4 changed files with 44 additions and 10 deletions

View file

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