Ajouter le bouton d'export PDF, ses réglages et le cadre imprimable à la carte

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Antoine Jacquin
2026-09-27 16:21:25 +02:00
parent 7f590ddecf
commit 1f8f13dd13
2 changed files with 138 additions and 0 deletions

View File

@ -1321,3 +1321,18 @@ def test_export_pdf_never_delegated(tmp_path, monkeypatch):
monkeypatch.setattr(mapserve, "GENERATION_URL", "http://injoignable.invalid")
lat, lon = _center()
assert mapserve.export_pdf_file(lat, lon, "A4", "paysage", 2000, None).body.startswith(b"%PDF")
def test_map_ui_has_pdf_export():
from lidar_pipeline.mapui import _MAP_CSS, _MAP_HTML, _MAP_JS
for id_ in ("btnPrint", "printcard", "printPaper", "printOrient", "printScale",
"printTitle", "printGo", "printMsg", "printClose", "printInfo"):
assert f'id="{id_}"' in _MAP_HTML, id_
for scale in ("1000", "2000", "5000", "10000"):
assert f'value="{scale}"' in _MAP_HTML
assert "api/export/frame?" in _MAP_JS and "api/export/pdf?" in _MAP_JS
assert "createPane('printFrame')" in _MAP_JS
assert "map.on('moveend', printRefreshFrame)" in _MAP_JS
assert "#printcard" in _MAP_CSS
# bouton toujours visible : indépendant de /api/status.available
assert 'id="btnPrint"' in _MAP_HTML and 'id="btnPrint" hidden' not in _MAP_HTML