Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: bug in SetPages #421

Merged
merged 1 commit into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion vips/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ func (r *ImageRef) SetPages(pages int) error {
return err
}

vipsSetImageNPages(r.image, pages)
vipsSetImageNPages(out, pages)

r.setImage(out)
return nil
Expand Down
12 changes: 12 additions & 0 deletions vips/image_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1169,6 +1169,18 @@ func TestImageRef_HistogramEntropy(t *testing.T) {
require.True(t, e > 0)
}

func TestImageRef_SetPages(t *testing.T) {
Startup(nil)

image, err := NewImageFromFile(resources + "gif-animated.gif")
require.NoError(t, err)
require.Equal(t, 8, image.Pages())

err = image.SetPages(3)
require.NoError(t, err)
require.Equal(t, 3, image.Pages())
}

// TODO unit tests to cover:
// NewImageFromReader failing test
// NewImageFromFile failing test
Expand Down
Loading