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..0b79a826f93 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