Поддержка тем
This commit is contained in:
Mikan
2025-12-08 17:21:41 +03:00
parent c262bffb41
commit 8da965234c
3 changed files with 46 additions and 3 deletions

View File

@@ -45,4 +45,40 @@ def test_process_document_with_template(create_example_doc):
# Удаляем файл после теста
output_path.unlink(missing_ok=True)
tpl_path.unlink(missing_ok=True)
tpl_path.unlink(missing_ok=True)
def test_process_document_with_theme():
# Создаём тему
theme_dir = Path("resources/themes")
theme_dir.mkdir(exist_ok=True)
theme_path = theme_dir / "test_theme.yaml"
theme_path.write_text("""
styles:
Heading 1:
font:
name: "Arial"
size: 14
bold: true
paragraph:
space_before: 10
space_after: 5
""", encoding="utf-8")
# Создаём фикстуру
doc_dir = Path("tests/fixtures/inputs/theme_test")
doc_dir.mkdir(parents=True, exist_ok=True)
(doc_dir / "document.md").write_text("# Заголовок", encoding="utf-8")
(doc_dir / "images").mkdir(exist_ok=True)
process_document(
input_dir=Path("tests/fixtures/inputs"),
output_dir=Path("tests/output"),
style_config_path=Path("resources/style_config.yaml"),
theme_name="test_theme"
)
output_path = Path("tests/output/theme_test.docx")
assert output_path.exists()
output_path.unlink(missing_ok=True)
theme_path.unlink(missing_ok=True)