11
22import os
3+ from unittest import skip
34
45import pytest
56from PIL import Image , ImageDraw , ImageFont
67
8+ from pycaption import SRTReader
79from pycaption .base import Caption , CaptionNode
810from pycaption .exceptions import CaptionRendererError
11+ from pycaption .filtergraph import FiltergraphWriter
912from pycaption .geometry import Layout , Point , Size , UnitEnum
1013from pycaption .subtitler_image_based import SubtitleImageBasedWriter
1114
@@ -112,12 +115,20 @@ class TestBaselineAlignment:
112115
113116 NO_DESCENDER = "AHLEN" # no descenders
114117 WITH_DESCENDER = "gypsy" # descenders: g, y, p
118+ WITH_DESCENDER_TOP = "gypsy\n AHLEN" # descenders: g, y, p
119+ WITH_DESCENDER_BOTTOM = "AHLEN\n gypsy" # descenders: g, y, p
120+
115121
116122 COMBOS = [
117123 ("no_desc_x2" , [NO_DESCENDER , NO_DESCENDER ]),
118124 ("desc_x2" , [WITH_DESCENDER , WITH_DESCENDER ]),
119125 ("top_no_bottom_yes" , [NO_DESCENDER , WITH_DESCENDER ]),
120126 ("top_yes_bottom_no" , [WITH_DESCENDER , NO_DESCENDER ]),
127+ ("one_line-no" , [NO_DESCENDER ]),
128+ ("one_line-yes" , [WITH_DESCENDER ]),
129+ ("one_line-yes" , [WITH_DESCENDER ]),
130+ ("two-in-one-a" , [WITH_DESCENDER_TOP ]),
131+ ("tow-in-one-b" , [WITH_DESCENDER_BOTTOM ]),
121132 ]
122133
123134 @pytest .fixture (params = COMBOS , ids = [c [0 ] for c in COMBOS ])
@@ -140,5 +151,7 @@ def test_baseline_visual(self, combo, tmp_path):
140151 guide .line ([(0 , baseline_y ), (width , baseline_y )], fill = (255 , 0 , 0 , 200 ), width = 1 )
141152
142153 out = tmp_path / f"baseline_{ name } .png"
154+ out = f"tests/baseline_samples/baseline_{ name } .png"
143155 img .save (str (out ))
144- print (f"\n Saved: { out } " )
156+ print (f"\n Saved: { out } " )
157+
0 commit comments