Spaces:
Sleeping
Sleeping
File size: 2,065 Bytes
0db40c8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | #!/usr/bin/env python3
"""
测试新增的Comic模板
"""
from templates import get_templates_by_style
def test_new_comic_templates():
"""验证新增的comic模板"""
print("="*60)
print("新Comic模板验证")
print("="*60)
# 获取所有comic模板
comic_templates = get_templates_by_style('comic')
print(f"\n总共有 {len(comic_templates)} 个Comic模板\n")
# 新增的模板名称
new_templates = [
"comic_bold_announcement",
"comic_three_part_fun",
"comic_wavy_text",
"comic_explosion_box",
"comic_dotted_fun",
"comic_mega_title",
"comic_sticker_style"
]
print("新增的Comic模板:")
for i, name in enumerate(new_templates, 1):
# 查找模板
template = None
for t in comic_templates:
if t.name == name:
template = t
break
if template:
print(f"\n{i}. ✅ {name}")
print(f" 描述: {template.description}")
print(f" 对齐: {template.alignment}")
# 统计字体大小
if template.lines:
fonts = []
for line in template.lines:
if hasattr(line, 'font_size'):
fonts.append(f"{line.font_size}px")
if fonts:
print(f" 字体大小: {', '.join(fonts)}")
else:
print(f"\n{i}. ❌ {name} - 未找到!")
print("\n" + "="*60)
print("所有Comic模板列表:")
print("="*60)
for i, template in enumerate(comic_templates, 1):
is_new = "🆕" if template.name in new_templates else " "
print(f"{is_new} {i:2d}. {template.name}")
print("\n" + "="*60)
print(f"验证完成!共 {len(comic_templates)} 个Comic模板")
print(f"其中新增 {len([t for t in comic_templates if t.name in new_templates])} 个")
print("="*60)
if __name__ == "__main__":
test_new_comic_templates()
|