(region: ScreenshotDiffRegion)
| 406 | } |
| 407 | |
| 408 | function formatScreenshotDiffRegionEntryLines(region: ScreenshotDiffRegion): string[] { |
| 409 | const share = |
| 410 | region.shareOfDiffPercentage === 0 && region.differentPixels > 0 |
| 411 | ? '<0.01' |
| 412 | : String(region.shareOfDiffPercentage); |
| 413 | const rect = region.rect; |
| 414 | const lines = [ |
| 415 | ` ${region.index}. ${region.location} x=${rect.x} y=${rect.y} ` + |
| 416 | `${rect.width}x${rect.height}, ${share}% of diff, change=${region.dominantChange}`, |
| 417 | ]; |
| 418 | |
| 419 | const detailLine = formatScreenshotRegionDetails(region); |
| 420 | if (detailLine) { |
| 421 | lines.push(` ${detailLine}`); |
| 422 | } |
| 423 | |
| 424 | const bestMatch = region.currentOverlayMatches?.[0]; |
| 425 | if (bestMatch) { |
| 426 | const label = bestMatch.label ? ` "${bestMatch.label}"` : ''; |
| 427 | lines.push( |
| 428 | ` overlaps @${bestMatch.ref}${label}, ` + |
| 429 | `${bestMatch.regionCoveragePercentage}% of region`, |
| 430 | ); |
| 431 | } |
| 432 | |
| 433 | return lines; |
| 434 | } |
| 435 | |
| 436 | function formatScreenshotDiffOcrLines(data: ScreenshotDiffResult, useColor: boolean): string[] { |
| 437 | const ocrMatches = data.ocr?.matches ?? []; |
no test coverage detected