rendering tests fixed

This commit is contained in:
Dmitry Sergeev
2026-09-16 23:58:45 +03:00
parent 6fa3dea391
commit eeb13c3bd4
6 changed files with 159 additions and 120 deletions
+14 -3
View File
@@ -87,9 +87,8 @@ func NewTextOverlay(text string, frameW, frameH, posX, posY int, textPos string,
return nil, fmt.Errorf("text: box %dpx wider than frame %dpx", w, frameW)
}
h := 2*padY + textH
const topMargin = 48
if topMargin+h > frameH {
return nil, fmt.Errorf("text: box %dpx does not fit frame height %dpx", topMargin+h, frameH)
if h > frameH {
return nil, fmt.Errorf("text: box %dpx higher than frame %dpx", h, frameH)
}
if textPos != "" {
@@ -120,6 +119,18 @@ func NewTextOverlay(text string, frameW, frameH, posX, posY int, textPos string,
posY = frameH - h
}
}
if posX < 0 || posY < 0 {
return nil, fmt.Errorf("text: position (%d, %d) must not be negative", posX, posY)
}
if posX%6 != 0 {
return nil, fmt.Errorf("text: x position %d must be divisible by 6 for v210", posX)
}
if posX+w > frameW || posY+h > frameH {
return nil, fmt.Errorf(
"text: box at (%d, %d), size %dx%d, does not fit frame %dx%d",
posX, posY, w, h, frameW, frameH,
)
}
o := &TextOverlay{
frameW: frameW,
x: posX,