From 6e6ec19b8eba516e2ccc950b221a61f65049582a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20B?= <2589111+jfbu@users.noreply.github.com> Date: Tue, 13 Aug 2024 11:23:38 +0200 Subject: [PATCH] Add test --- .../test-latex-contents-topic-sidebar/conf.py | 0 .../index.rst | 19 ++++++++++++ tests/test_builders/test_build_latex.py | 30 +++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 tests/roots/test-latex-contents-topic-sidebar/conf.py create mode 100644 tests/roots/test-latex-contents-topic-sidebar/index.rst diff --git a/tests/roots/test-latex-contents-topic-sidebar/conf.py b/tests/roots/test-latex-contents-topic-sidebar/conf.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/roots/test-latex-contents-topic-sidebar/index.rst b/tests/roots/test-latex-contents-topic-sidebar/index.rst new file mode 100644 index 00000000000..d47e867f64d --- /dev/null +++ b/tests/roots/test-latex-contents-topic-sidebar/index.rst @@ -0,0 +1,19 @@ +test-contents-et-al +=================== + +.. contents:: + +test-topic +---------- + +.. topic:: Title of topic + + text of topic + +test-sidebar +------------ + +.. sidebar:: Title of sidebar + :subtitle: sub-title + + text of sidebar diff --git a/tests/test_builders/test_build_latex.py b/tests/test_builders/test_build_latex.py index fb0f1bf4c57..e5ba4f3a903 100644 --- a/tests/test_builders/test_build_latex.py +++ b/tests/test_builders/test_build_latex.py @@ -2272,3 +2272,33 @@ def test_latex_rubric(app): content = (app.outdir / 'test.tex').read_text(encoding='utf8') assert r'\subsubsection*{This is a rubric}' in content assert r'\subsection*{A rubric with a heading level 2}' in content + + +@pytest.mark.sphinx('latex',testroot='latex-contents-topic-sidebar') +def test_latex_contents_topic_sidebar(app): + app.build() + result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8') + + assert ( + '\\begin{sphinxcontents}\n' + '\\sphinxstylecontentstitle{Contents}\n' + ) in result + + assert ( + '\\begin{sphinxtopic}\n' + '\\sphinxstyletopictitle{Title of topic}\n' + '\n' + '\\sphinxAtStartPar\n' + 'text of topic\n' + '\\end{sphinxtopic}\n' + ) in result + + assert ( + '\\begin{sphinxsidebar}\n' + '\\sphinxstylesidebartitle{Title of sidebar}\n' + '\\sphinxstylesidebarsubtitle{sub\\sphinxhyphen{}title}\n' + '\n' + '\\sphinxAtStartPar\n' + 'text of sidebar\n' + '\\end{sphinxsidebar}\n' + ) in result