feat: add tests

master
Tomas Aparicio 11 years ago
parent e82014093e
commit f60d5e7cad

@ -1,6 +1,6 @@
# bimg [![Build Status](https://travis-ci.org/h2non/bimg.png)](https://travis-ci.org/h2non/bimg) [![GitHub release](https://img.shields.io/github/tag/h2non/bimg.svg)](https://github.com/h2non/bimg/releases) [![GoDoc](https://godoc.org/github.com/h2non/bimg?status.png)](https://godoc.org/github.com/h2non/bimg) [![Coverage Status](https://coveralls.io/repos/h2non/bimg/badge.svg?branch=master)](https://coveralls.io/r/h2non/bimg?branch=master)
Small Go library for blazing fast and efficient image processing based on [libvips](https://github.com/jcupitt/libvips) using C bindings.
Small [Go](http://golang.org) library for blazing fast and efficient image processing based on [libvips](https://github.com/jcupitt/libvips) using C bindings. It provides a clean, simple and fluent [API](#examples) in pure Go.
bimg is designed to be a small and efficient library with a generic and useful set of features.
It uses internally libvips, which requires a [low memory footprint](http://www.vips.ecs.soton.ac.uk/index.php?title=Speed_and_Memory_Use)
@ -42,6 +42,7 @@ The [install script](https://github.com/lovell/sharp/blob/master/preinstall.sh)
- Enlarge
- Crop
- Rotate
- Auto-rotate (based on EXIF orientation)
- Flip
- Flop
- Thumbnail

@ -48,3 +48,35 @@ func TestDeterminateImageTypeName(t *testing.T) {
}
}
}
func TestIsTypeSupported(t *testing.T) {
types := []struct {
name ImageType
}{
{JPEG}, {PNG}, {WEBP},
}
for _, n := range types {
if IsTypeSupported(n.name) == false {
t.Fatal("Image type is not valid")
}
}
}
func TestIsTypeNameSupported(t *testing.T) {
types := []struct {
name string
expected bool
}{
{"jpg", true},
{"png", true},
{"webp", true},
{"gif", false},
}
for _, n := range types {
if IsTypeNameSupported(n.name) != n.expected {
t.Fatal("Image type is not valid")
}
}
}

Loading…
Cancel
Save