mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-07 21:48:13 -08:00
fix(tests)
This commit is contained in:
parent
3f889aaf0a
commit
489fbc8a00
5 changed files with 39 additions and 27 deletions
Binary file not shown.
|
Before Width: | Height: | Size: 110 KiB After Width: | Height: | Size: 0 B |
Binary file not shown.
|
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 0 B |
Binary file not shown.
|
Before Width: | Height: | Size: 116 KiB After Width: | Height: | Size: 0 B |
|
|
@ -42,42 +42,48 @@ func TestImageSvgResize(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestImageGifToJpeg(t *testing.T) {
|
||||
i := initImage("test.gif")
|
||||
options := Options{
|
||||
Type: JPEG,
|
||||
}
|
||||
buf, err := i.Process(options)
|
||||
if err != nil {
|
||||
t.Errorf("Cannot process the image: %#v", err)
|
||||
}
|
||||
if VipsMinorVersion >= 8 && VipsMinorVersion > 2 {
|
||||
i := initImage("test.gif")
|
||||
options := Options{
|
||||
Type: JPEG,
|
||||
}
|
||||
buf, err := i.Process(options)
|
||||
if err != nil {
|
||||
t.Errorf("Cannot process the image: %#v", err)
|
||||
}
|
||||
|
||||
Write("fixtures/test_gif.jpg", buf)
|
||||
Write("fixtures/test_gif.jpg", buf)
|
||||
}
|
||||
}
|
||||
|
||||
func TestImagePdfToJpeg(t *testing.T) {
|
||||
i := initImage("test.pdf")
|
||||
options := Options{
|
||||
Type: JPEG,
|
||||
}
|
||||
buf, err := i.Process(options)
|
||||
if err != nil {
|
||||
t.Errorf("Cannot process the image: %#v", err)
|
||||
}
|
||||
if VipsMinorVersion >= 8 && VipsMinorVersion > 2 {
|
||||
i := initImage("test.pdf")
|
||||
options := Options{
|
||||
Type: JPEG,
|
||||
}
|
||||
buf, err := i.Process(options)
|
||||
if err != nil {
|
||||
t.Errorf("Cannot process the image: %#v", err)
|
||||
}
|
||||
|
||||
Write("fixtures/test_pdf.jpg", buf)
|
||||
Write("fixtures/test_pdf.jpg", buf)
|
||||
}
|
||||
}
|
||||
|
||||
func TestImageSvgToJpeg(t *testing.T) {
|
||||
i := initImage("test.svg")
|
||||
options := Options{
|
||||
Type: JPEG,
|
||||
}
|
||||
buf, err := i.Process(options)
|
||||
if err != nil {
|
||||
t.Errorf("Cannot process the image: %#v", err)
|
||||
}
|
||||
if VipsMinorVersion >= 8 && VipsMinorVersion > 2 {
|
||||
i := initImage("test.svg")
|
||||
options := Options{
|
||||
Type: JPEG,
|
||||
}
|
||||
buf, err := i.Process(options)
|
||||
if err != nil {
|
||||
t.Errorf("Cannot process the image: %#v", err)
|
||||
}
|
||||
|
||||
Write("fixtures/test_svg.jpg", buf)
|
||||
Write("fixtures/test_svg.jpg", buf)
|
||||
}
|
||||
}
|
||||
|
||||
func TestImageResizeAndCrop(t *testing.T) {
|
||||
|
|
|
|||
6
vips.go
6
vips.go
|
|
@ -24,6 +24,12 @@ var debug = d.Debug("bimg")
|
|||
// VipsVersion exposes the current libvips semantic version
|
||||
const VipsVersion = string(C.VIPS_VERSION)
|
||||
|
||||
// VipsMajorVersion exposes the current libvips major version number
|
||||
const VipsMajorVersion = string(C.VIPS_MAJOR_VERSION)
|
||||
|
||||
// VipsMinorVersion exposes the current libvips minor version number
|
||||
const VipsMinorVersion = int(C.VIPS_MINOR_VERSION)
|
||||
|
||||
// HasMagickSupport exposes if the current libvips compilation
|
||||
// supports libmagick bindings.
|
||||
const HasMagickSupport = int(C.VIPS_MAGICK_SUPPORT) == 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue