]> git.giacomolli.uk - onechat/blob - image_helper_test.go
Accept owner photos and image files in Telegram
[onechat] / image_helper_test.go
1 package main
2
3 import (
4         "bytes"
5         "image"
6         "image/color"
7         "image/png"
8         "testing"
9
10         "github.com/stretchr/testify/require"
11 )
12
13 func imageTestPNG(t *testing.T, width, height int) []byte {
14         t.Helper()
15
16         picture := image.NewRGBA(image.Rect(0, 0, width, height))
17         picture.Set(0, 0, color.RGBA{
18                 R: 255,
19                 A: 255,
20         })
21
22         var data bytes.Buffer
23
24         require.NoError(t, png.Encode(&data, picture))
25
26         return data.Bytes()
27 }