MCPcopy
hub / github.com/docker/docker-agent / TestProcessAttachment_PNG_WithAlpha_StaysPNG

Function TestProcessAttachment_PNG_WithAlpha_StaysPNG

pkg/chat/attach_test.go:110–123  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

108}
109
110func TestProcessAttachment_PNG_WithAlpha_StaysPNG(t *testing.T) {
111 t.Parallel()
112 data := encodePNGBytes(100, 100, true)
113 path := writeTempFile(t, ".png", data)
114
115 doc, err := chat.ProcessAttachment(t.Context(), chat.MessagePart{
116 Type: chat.MessagePartTypeFile,
117 File: &chat.MessageFile{Path: path, MimeType: "image/png"},
118 })
119 require.NoError(t, err)
120 assert.True(t, doc.MimeType == "image/png" || doc.MimeType == "image/jpeg",
121 "expected png or jpeg, got %q", doc.MimeType)
122 assert.NotEmpty(t, doc.Source.InlineData)
123}
124
125func TestProcessAttachment_ImageTooLarge_Resized(t *testing.T) {
126 t.Parallel()

Callers

nothing calls this directly

Calls 4

ProcessAttachmentFunction · 0.92
encodePNGBytesFunction · 0.85
ContextMethod · 0.80
writeTempFileFunction · 0.70

Tested by

no test coverage detected