test(P3-1): 第56波 worker层更多引擎纯逻辑单测(+108)
- test_subtitle_render_engine.py: 53个(颜色转换/时间格式化/文字换行/ASS转义/样式) - test_sticker_engine.py: 27个(配置类/位置解析/常量/便捷函数) - test_tts_engine.py: 12个(数据类/入口判断/初始化) - test_render_audio_utils.py: 16个(clip_effective_duration/RenderContext) 覆盖worker层4个模块的纯逻辑部分
This commit is contained in:
@@ -244,6 +244,16 @@ class TestWrapText:
|
||||
result = _wrap_text(text, 1)
|
||||
assert result == ["a", "b", "c"]
|
||||
|
||||
def test_max_chars_zero(self):
|
||||
# 边界情况
|
||||
text = "abc"
|
||||
result = _wrap_text(text, 0)
|
||||
# 0的话,max_chars//2也是0,range不会执行
|
||||
# 按逻辑 len(text) > 0 成立,但 break_point 从 0 开始
|
||||
# 这取决于具体实现,只要不崩溃就行
|
||||
assert isinstance(result, list)
|
||||
assert len(result) > 0
|
||||
|
||||
def test_punctuation_at_boundary(self):
|
||||
# 标点刚好在 max_chars 位置
|
||||
text = "一二三四五六七八九。"
|
||||
|
||||
Reference in New Issue
Block a user