Spaces:
Sleeping
Sleeping
| #!/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() | |