| """TikZ emitter tests.""" |
|
|
| from __future__ import annotations |
|
|
| from helpers import load_fixture |
|
|
| from statement_to_tikz.emit_tikz import emit_standalone_tex, emit_tikzpicture |
| from statement_to_tikz.solve import solve_geometry |
|
|
|
|
| def test_emit_contains_coordinates_and_segments() -> None: |
| ir, _ = load_fixture("equilateral.json") |
| scene = solve_geometry(ir) |
| body = emit_tikzpicture(scene) |
| assert r"\begin{tikzpicture}" in body |
| assert r"\coordinate (A)" in body |
| assert r"\draw (A) -- (B);" in body |
| assert "A" in body and "B" in body and "C" in body |
|
|
|
|
| def test_standalone_has_document_class() -> None: |
| ir, _ = load_fixture("right_altitude.json") |
| scene = solve_geometry(ir) |
| tex = emit_standalone_tex(scene) |
| assert r"\documentclass[11pt]{article}" in tex |
| assert r"\usetikzlibrary{calc,angles,quotes}" in tex |
| assert r"\end{document}" in tex |
|
|