(t *testing.T)
| 173 | } |
| 174 | |
| 175 | func TestPrintWithDimensions_TaskWithProgress(t *testing.T) { |
| 176 | w, buf := newTestWriter() |
| 177 | |
| 178 | // Create parent task |
| 179 | parent := &task{ |
| 180 | ID: "Image nginx", |
| 181 | parents: make(map[string]struct{}), |
| 182 | startTime: time.Now(), |
| 183 | text: "Pulling", |
| 184 | status: api.Working, |
| 185 | spinner: NewSpinner(), |
| 186 | } |
| 187 | w.tasks["Image nginx"] = parent |
| 188 | w.ids = append(w.ids, "Image nginx") |
| 189 | |
| 190 | // Create child tasks to trigger progress display |
| 191 | for i := range 3 { |
| 192 | child := &task{ |
| 193 | ID: "layer" + string(rune('a'+i)), |
| 194 | parents: map[string]struct{}{"Image nginx": {}}, |
| 195 | startTime: time.Now(), |
| 196 | text: "Downloading", |
| 197 | status: api.Working, |
| 198 | total: 1000, |
| 199 | current: 500, |
| 200 | percent: 50, |
| 201 | spinner: NewSpinner(), |
| 202 | } |
| 203 | w.tasks[child.ID] = child |
| 204 | w.ids = append(w.ids, child.ID) |
| 205 | } |
| 206 | |
| 207 | terminalWidth := 80 |
| 208 | w.printWithDimensions(terminalWidth, 24) |
| 209 | |
| 210 | lines := extractLines(buf) |
| 211 | for i, line := range lines { |
| 212 | lineLen := lenAnsi(line) |
| 213 | assert.Assert(t, lineLen <= terminalWidth, |
| 214 | "line %d has length %d which exceeds terminal width %d: %q", |
| 215 | i, lineLen, terminalWidth, line) |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | func TestAdjustLineWidth_DetailsCorrectlyTruncated(t *testing.T) { |
| 220 | w := &ttyWriter{} |
nothing calls this directly
no test coverage detected