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

Function TestFormatDimensionNote

pkg/chat/image_test.go:140–182  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

138}
139
140func TestFormatDimensionNote(t *testing.T) {
141 t.Parallel()
142
143 t.Run("not resized", func(t *testing.T) {
144 t.Parallel()
145 result := &ImageResizeResult{Resized: false}
146 assert.Empty(t, FormatDimensionNote(result))
147 })
148
149 t.Run("uniform scaling", func(t *testing.T) {
150 t.Parallel()
151 result := &ImageResizeResult{
152 Resized: true,
153 OriginalWidth: 4000,
154 OriginalHeight: 3000,
155 Width: 2000,
156 Height: 1500,
157 }
158 note := FormatDimensionNote(result)
159 assert.Contains(t, note, "original 4000x3000")
160 assert.Contains(t, note, "displayed at 2000x1500")
161 assert.Contains(t, note, "Multiply coordinates by 2.00")
162 // Should NOT contain separate X/Y factors.
163 assert.NotContains(t, note, "X coordinates")
164 })
165
166 t.Run("non-uniform scaling", func(t *testing.T) {
167 t.Parallel()
168 // Manually constructed result with different X and Y scale factors.
169 result := &ImageResizeResult{
170 Resized: true,
171 OriginalWidth: 4000,
172 OriginalHeight: 2000,
173 Width: 2000,
174 Height: 2000,
175 }
176 note := FormatDimensionNote(result)
177 assert.Contains(t, note, "original 4000x2000")
178 assert.Contains(t, note, "displayed at 2000x2000")
179 assert.Contains(t, note, "Multiply X coordinates by 2.00")
180 assert.Contains(t, note, "Y coordinates by 1.00")
181 })
182}
183
184func TestResizeImageBase64(t *testing.T) {
185 t.Parallel()

Callers

nothing calls this directly

Calls 2

FormatDimensionNoteFunction · 0.85
RunMethod · 0.65

Tested by

no test coverage detected