(tmp_path)
| 111 | @pytest.mark.skipif(shutil.which("latex") is None, reason="latex is not available") |
| 112 | @pytest.mark.skipif(not _has_tex_package("concmath"), reason="needs concmath.sty") |
| 113 | def test_dviread_pk(tmp_path): |
| 114 | (tmp_path / "test.tex").write_text(r""" |
| 115 | \documentclass{article} |
| 116 | \usepackage{concmath} |
| 117 | \pagestyle{empty} |
| 118 | \begin{document} |
| 119 | Hi! |
| 120 | \end{document} |
| 121 | """) |
| 122 | subprocess_run_for_testing( |
| 123 | ["latex", "-no-shell-escape", "test.tex"], |
| 124 | cwd=tmp_path, check=True, capture_output=True) |
| 125 | with dr.Dvi(tmp_path / "test.dvi", None) as dvi: |
| 126 | pages = [*dvi] |
| 127 | data = [ |
| 128 | { |
| 129 | "text": [ |
| 130 | [ |
| 131 | t.x, t.y, |
| 132 | t._as_unicode_or_name(), |
| 133 | t.font.resolve_path().name, |
| 134 | round(t.font.size, 2), |
| 135 | t.font.effects, |
| 136 | ] for t in page.text |
| 137 | ], |
| 138 | "boxes": [[b.x, b.y, b.height, b.width] for b in page.boxes] |
| 139 | } for page in pages |
| 140 | ] |
| 141 | correct = [{ |
| 142 | 'boxes': [], |
| 143 | 'text': [ |
| 144 | [5046272, 4128768, 'H?', 'ccr10.600pk', 9.96, {}], |
| 145 | [5530510, 4128768, 'i?', 'ccr10.600pk', 9.96, {}], |
| 146 | [5716195, 4128768, '!?', 'ccr10.600pk', 9.96, {}], |
| 147 | ], |
| 148 | }] |
| 149 | assert data == correct |
nothing calls this directly
no test coverage detected
searching dependent graphs…