mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-10 16:00:26 -07:00
feat(docs): add API and examples
This commit is contained in:
parent
3904953399
commit
0d13e86634
2 changed files with 101 additions and 17 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue