createTestPNG creates a solid-color PNG image of the given dimensions.
(t *testing.T, w, h int)
| 68 | |
| 69 | // createTestPNG creates a solid-color PNG image of the given dimensions. |
| 70 | func createTestPNG(t *testing.T, w, h int) []byte { |
| 71 | t.Helper() |
| 72 | img := image.NewRGBA(image.Rect(0, 0, w, h)) |
| 73 | for y := range h { |
| 74 | for x := range w { |
| 75 | img.Set(x, y, color.RGBA{R: 255, G: 0, B: 0, A: 255}) |
| 76 | } |
| 77 | } |
| 78 | var buf bytes.Buffer |
| 79 | require.NoError(t, png.Encode(&buf, img)) |
| 80 | return buf.Bytes() |
| 81 | } |
| 82 | |
| 83 | func createTestJPEG(t *testing.T, w, h int) []byte { |
| 84 | t.Helper() |
no test coverage detected