File size: 885 Bytes
eab734a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""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