MCPcopy Index your code
hub / github.com/docker/docker-agent / createTestPNG

Function createTestPNG

pkg/chat/image_test.go:70–81  ·  view source on GitHub ↗

createTestPNG creates a solid-color PNG image of the given dimensions.

(t *testing.T, w, h int)

Source from the content-addressed store, hash-verified

68
69// createTestPNG creates a solid-color PNG image of the given dimensions.
70func 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
83func createTestJPEG(t *testing.T, w, h int) []byte {
84 t.Helper()

Callers 3

TestResizeImageBase64Function · 0.70

Calls 2

BytesMethod · 0.95
SetMethod · 0.45

Tested by

no test coverage detected