feat: v4.2 - garant v editoru+PDF, footnote index v bloků, stránka s poznámkami
Some checks failed
Build & Push Docker / build (push) Has been cancelled
Some checks failed
Build & Push Docker / build (push) Has been cancelled
This commit is contained in:
@@ -140,3 +140,36 @@ def test_generate_pdf_many_types_legend():
|
||||
doc = make_doc(program_types=types, blocks=blocks)
|
||||
pdf_bytes = generate_pdf(doc)
|
||||
assert pdf_bytes[:5] == b'%PDF-'
|
||||
|
||||
|
||||
def test_generate_pdf_with_notes_creates_second_page():
|
||||
"""Blocks with notes should produce a 2-page PDF (timetable + notes)."""
|
||||
import re
|
||||
types = [ProgramType(id="ws", name="Workshop", color="#0070C0")]
|
||||
blocks = [
|
||||
Block(id="b1", date="2026-03-01", start="09:00", end="10:00",
|
||||
title="Opening", type_id="ws", notes="Bring the flipchart and markers."),
|
||||
Block(id="b2", date="2026-03-01", start="10:00", end="11:00",
|
||||
title="Teambuilding", type_id="ws", notes="Outdoor if weather permits."),
|
||||
Block(id="b3", date="2026-03-01", start="11:00", end="12:00",
|
||||
title="Lunch", type_id="ws"), # no notes
|
||||
]
|
||||
doc = make_doc(program_types=types, blocks=blocks)
|
||||
pdf_bytes = generate_pdf(doc)
|
||||
assert pdf_bytes[:5] == b'%PDF-'
|
||||
pages = len(re.findall(rb'/Type\s*/Page[^s]', pdf_bytes))
|
||||
assert pages == 2, f"Expected 2 pages (timetable + notes), got {pages}"
|
||||
|
||||
|
||||
def test_generate_pdf_no_notes_single_page():
|
||||
"""Without notes, PDF should be exactly 1 page."""
|
||||
import re
|
||||
doc = make_doc(
|
||||
blocks=[
|
||||
Block(id="b1", date="2026-03-01", start="09:00", end="10:00",
|
||||
title="No notes here", type_id="ws"),
|
||||
]
|
||||
)
|
||||
pdf_bytes = generate_pdf(doc)
|
||||
pages = len(re.findall(rb'/Type\s*/Page[^s]', pdf_bytes))
|
||||
assert pages == 1, f"Expected 1 page, got {pages}"
|
||||
|
||||
Reference in New Issue
Block a user