rendering tests fixed
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user