feat(docs): add API and examples

This commit is contained in:
Tomas Aparicio 2015-04-06 23:59:42 +02:00
parent 3904953399
commit 0d13e86634
2 changed files with 101 additions and 17 deletions

View file

@ -53,6 +53,19 @@ func TestImageConvert(t *testing.T) {
Write("fixtures/test_image_convert_out.png", buf)
}
func TestImageMetadata(t *testing.T) {
data, err := initImage("test.png").Metadata(PNG)
if err != nil {
t.Errorf("Cannot process the image: %#v", err)
}
if data.Alpha != true {
t.Fatal("Invalid alpha channel")
}
if data.Size.Width != 400 {
t.Fatal("Invalid width size")
}
}
func initImage(file string) *Image {
buf, _ := Read(path.Join("fixtures", file))
return NewImage(buf)