mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-16 10:55:54 -07:00
feat: add tests
This commit is contained in:
parent
e82014093e
commit
f60d5e7cad
2 changed files with 34 additions and 1 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
# bimg [](https://travis-ci.org/h2non/bimg) [](https://github.com/h2non/bimg/releases) [](https://godoc.org/github.com/h2non/bimg) [](https://coveralls.io/r/h2non/bimg?branch=master)
|
# bimg [](https://travis-ci.org/h2non/bimg) [](https://github.com/h2non/bimg/releases) [](https://godoc.org/github.com/h2non/bimg) [](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.
|
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)
|
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
|
- Enlarge
|
||||||
- Crop
|
- Crop
|
||||||
- Rotate
|
- Rotate
|
||||||
|
- Auto-rotate (based on EXIF orientation)
|
||||||
- Flip
|
- Flip
|
||||||
- Flop
|
- Flop
|
||||||
- Thumbnail
|
- Thumbnail
|
||||||
|
|
|
||||||
32
type_test.go
32
type_test.go
|
|
@ -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…
Add table
Add a link
Reference in a new issue