test: add comprehensive pytest test suite
Add complete test infrastructure for yaml2pptx project with 245+ tests covering unit, integration, and end-to-end scenarios. Test structure: - Unit tests: elements, template system, validators, loaders, utils - Integration tests: presentation and rendering flows - E2E tests: CLI commands (convert, check, preview) Key features: - PptxFileValidator for Level 2 PPTX validation (file structure, element count, content matching, position tolerance) - Comprehensive fixtures for test data consistency - Mock-based testing for external dependencies - Test images generated with PIL/Pillow - Boundary case coverage for edge scenarios Dependencies added: - pytest, pytest-cov, pytest-mock - pillow (for test image generation) Documentation updated: - README.md: test running instructions - README_DEV.md: test development guide Co-authored-by: OpenSpec change: add-comprehensive-tests
This commit is contained in:
71
tests/fixtures/yaml_samples/full_features.yaml
vendored
Normal file
71
tests/fixtures/yaml_samples/full_features.yaml
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
metadata:
|
||||
size: 16:9
|
||||
|
||||
slides:
|
||||
# 文本元素幻灯片
|
||||
- background:
|
||||
color: "#ffffff"
|
||||
elements:
|
||||
- type: text
|
||||
box: [1, 1, 8, 1]
|
||||
content: "Full Features Test"
|
||||
font:
|
||||
size: 44
|
||||
bold: true
|
||||
color: "#333333"
|
||||
align: center
|
||||
|
||||
- type: text
|
||||
box: [1, 2.5, 8, 0.5]
|
||||
content: "Testing all element types"
|
||||
font:
|
||||
size: 18
|
||||
italic: true
|
||||
color: "#666666"
|
||||
align: center
|
||||
|
||||
# 图片元素幻灯片
|
||||
- elements:
|
||||
- type: image
|
||||
box: [1, 1, 4, 3]
|
||||
src: "test_image.png"
|
||||
|
||||
# 形状元素幻灯片
|
||||
- elements:
|
||||
- type: shape
|
||||
box: [1, 1, 2, 1]
|
||||
shape: rectangle
|
||||
fill: "#4a90e2"
|
||||
line:
|
||||
color: "#000000"
|
||||
width: 2
|
||||
|
||||
- type: shape
|
||||
box: [4, 1, 2, 1]
|
||||
shape: ellipse
|
||||
fill: "#e24a4a"
|
||||
line:
|
||||
color: "#000000"
|
||||
width: 1
|
||||
|
||||
- type: shape
|
||||
box: [7, 1, 2, 1]
|
||||
shape: rounded_rectangle
|
||||
fill: "#4ae290"
|
||||
line:
|
||||
color: "#000000"
|
||||
width: 2
|
||||
|
||||
# 表格元素幻灯片
|
||||
- elements:
|
||||
- type: table
|
||||
position: [1, 1]
|
||||
col_widths: [2, 2, 2]
|
||||
data:
|
||||
- ["Header 1", "Header 2", "Header 3"]
|
||||
- ["Data 1", "Data 2", "Data 3"]
|
||||
- ["Data 4", "Data 5", "Data 6"]
|
||||
style:
|
||||
font_size: 14
|
||||
header_bg: "#4a90e2"
|
||||
header_color: "#ffffff"
|
||||
Reference in New Issue
Block a user