(data: ScreenshotDiffResult, useColor: boolean)
| 434 | } |
| 435 | |
| 436 | function formatScreenshotDiffOcrLines(data: ScreenshotDiffResult, useColor: boolean): string[] { |
| 437 | const ocrMatches = data.ocr?.matches ?? []; |
| 438 | if (ocrMatches.length === 0) return []; |
| 439 | |
| 440 | const shownOcrMatches = ocrMatches.slice(0, 8); |
| 441 | const lines = [ |
| 442 | ` ${formatMuted( |
| 443 | `OCR text deltas (${data.ocr?.provider}; baselineBlocks=${data.ocr?.baselineBlocks} ` + |
| 444 | `currentBlocks=${data.ocr?.currentBlocks}; showing ${shownOcrMatches.length}/${ocrMatches.length}; px):`, |
| 445 | useColor, |
| 446 | )}`, |
| 447 | ` ${formatMuted( |
| 448 | 'item | text | movePx | sizeDeltaPx | bboxBaseline | bboxCurrent | confidence | issueHint', |
| 449 | useColor, |
| 450 | )}`, |
| 451 | ]; |
| 452 | |
| 453 | for (const [index, ocrMatch] of shownOcrMatches.entries()) { |
| 454 | const delta = ocrMatch.delta; |
| 455 | lines.push( |
| 456 | ` ${index + 1} | ${JSON.stringify(ocrMatch.text)} | ` + |
| 457 | `${formatSignedPixels(delta.x)},${formatSignedPixels(delta.y)} | ` + |
| 458 | `${formatSignedPixels(delta.width)},${formatSignedPixels(delta.height)} | ` + |
| 459 | `${formatRect(ocrMatch.baselineRect)} | ${formatRect(ocrMatch.currentRect)} | ` + |
| 460 | `${ocrMatch.confidence} | ` + |
| 461 | `${ocrMatch.possibleTextMetricMismatch ? 'ocr-bbox-size-change' : '-'}`, |
| 462 | ); |
| 463 | } |
| 464 | |
| 465 | return lines; |
| 466 | } |
| 467 | |
| 468 | function formatScreenshotDiffNonTextLines(data: ScreenshotDiffResult, useColor: boolean): string[] { |
| 469 | const nonTextDeltas = data.nonTextDeltas ?? []; |
no test coverage detected
searching dependent graphs…