(t *testing.T)
| 138 | } |
| 139 | |
| 140 | func 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 | |
| 184 | func TestResizeImageBase64(t *testing.T) { |
| 185 | t.Parallel() |
nothing calls this directly
no test coverage detected