mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-13 01:10:29 -07:00
parent
f63020b40f
commit
e603ddd10a
8 changed files with 204 additions and 20 deletions
|
|
@ -104,6 +104,31 @@ func TestImageThumbnail(t *testing.T) {
|
|||
Write("fixtures/test_thumbnail_out.jpg", buf)
|
||||
}
|
||||
|
||||
func TestImageWatermark(t *testing.T) {
|
||||
image := initImage("test.jpg")
|
||||
_, err := image.Crop(800, 600, NORTH)
|
||||
if err != nil {
|
||||
t.Errorf("Cannot process the image: %#v", err)
|
||||
}
|
||||
|
||||
insert, _ := Read("fixtures/watermark.png")
|
||||
buf, err := image.Watermark(insert, 10, 10)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
err = assertSize(buf, 800, 600)
|
||||
if err != nil {
|
||||
//t.Error(err)
|
||||
}
|
||||
|
||||
if DetermineImageType(buf) != PNG {
|
||||
//t.Fatal("Image is not jpeg")
|
||||
}
|
||||
|
||||
Write("fixtures/test_watermark_out.jpg", buf)
|
||||
}
|
||||
|
||||
func TestImageFlip(t *testing.T) {
|
||||
buf, err := initImage("test.jpg").Flip()
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue