summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJean-François B <2589111+jfbu@users.noreply.github.com>2023-04-11 20:02:15 +0200
committerJean-François B <2589111+jfbu@users.noreply.github.com>2023-04-11 20:32:31 +0200
commit509cc4533c92adae92997d63c8a7b11295f9e207 (patch)
tree135cb91b612bcbcb85426db076140ed264e52e3e /tests
parent2c83af0aab7080e0b78d4a16981eed878b2cac4c (diff)
downloadsphinx-git-509cc4533c92adae92997d63c8a7b11295f9e207.tar.gz
LaTeX: get aligned longtable obey current list indent
Fix #11268. Thanks to @picnixz.
Diffstat (limited to 'tests')
-rw-r--r--tests/roots/test-latex-table/expects/longtable.tex6
-rw-r--r--tests/roots/test-latex-table/expects/longtable_having_align.tex6
-rw-r--r--tests/roots/test-latex-table/expects/longtable_having_caption.tex6
-rw-r--r--tests/roots/test-latex-table/expects/longtable_having_problematic_cell.tex6
-rw-r--r--tests/roots/test-latex-table/expects/longtable_having_stub_columns_and_problematic_cell.tex6
-rw-r--r--tests/roots/test-latex-table/expects/longtable_having_verbatim.tex6
-rw-r--r--tests/roots/test-latex-table/expects/longtable_having_widths.tex6
-rw-r--r--tests/roots/test-latex-table/expects/longtable_having_widths_and_problematic_cell.tex6
-rw-r--r--tests/roots/test-latex-table/expects/longtable_with_tabularcolumn.tex6
-rw-r--r--tests/test_build_latex.py4
-rw-r--r--tests/test_ext_autosummary.py2
11 files changed, 48 insertions, 12 deletions
diff --git a/tests/roots/test-latex-table/expects/longtable.tex b/tests/roots/test-latex-table/expects/longtable.tex
index 754d10249..f74eb080c 100644
--- a/tests/roots/test-latex-table/expects/longtable.tex
+++ b/tests/roots/test-latex-table/expects/longtable.tex
@@ -4,7 +4,11 @@
\sphinxatlongtablestart
\sphinxthistablewithglobalstyle
\sphinxthistablewithborderlessstyle
-\begin{longtable}[c]{ll}
+\makeatletter
+ \setlength\LTleft{\@totalleftmargin plus1fill}
+ \setlength\LTright{\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill}
+\makeatother
+\begin{longtable}{ll}
\sphinxtoprule
\sphinxstyletheadfamily
\sphinxAtStartPar
diff --git a/tests/roots/test-latex-table/expects/longtable_having_align.tex b/tests/roots/test-latex-table/expects/longtable_having_align.tex
index dcf8f83a1..8a3e8a955 100644
--- a/tests/roots/test-latex-table/expects/longtable_having_align.tex
+++ b/tests/roots/test-latex-table/expects/longtable_having_align.tex
@@ -3,7 +3,11 @@
\begin{savenotes}
\sphinxatlongtablestart
\sphinxthistablewithglobalstyle
-\begin{longtable}[r]{|l|l|}
+\makeatletter
+ \setlength\LTleft{\@totalleftmargin plus1fill}
+ \setlength\LTright{\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax}
+\makeatother
+\begin{longtable}{|l|l|}
\sphinxtoprule
\sphinxstyletheadfamily
\sphinxAtStartPar
diff --git a/tests/roots/test-latex-table/expects/longtable_having_caption.tex b/tests/roots/test-latex-table/expects/longtable_having_caption.tex
index dd2a87fa6..603a3c108 100644
--- a/tests/roots/test-latex-table/expects/longtable_having_caption.tex
+++ b/tests/roots/test-latex-table/expects/longtable_having_caption.tex
@@ -3,7 +3,11 @@
\begin{savenotes}
\sphinxatlongtablestart
\sphinxthistablewithglobalstyle
-\begin{longtable}[c]{|l|l|}
+\makeatletter
+ \setlength\LTleft{\@totalleftmargin plus1fill}
+ \setlength\LTright{\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill}
+\makeatother
+\begin{longtable}{|l|l|}
\sphinxthelongtablecaptionisattop
\caption{caption for longtable\strut}\label{\detokenize{longtable:id1}}\\*[\sphinxlongtablecapskipadjust]
\sphinxtoprule
diff --git a/tests/roots/test-latex-table/expects/longtable_having_problematic_cell.tex b/tests/roots/test-latex-table/expects/longtable_having_problematic_cell.tex
index 8258612f5..479bdfafe 100644
--- a/tests/roots/test-latex-table/expects/longtable_having_problematic_cell.tex
+++ b/tests/roots/test-latex-table/expects/longtable_having_problematic_cell.tex
@@ -3,7 +3,11 @@
\begin{savenotes}
\sphinxatlongtablestart
\sphinxthistablewithglobalstyle
-\begin{longtable}[c]{|*{2}{\X{1}{2}|}}
+\makeatletter
+ \setlength\LTleft{\@totalleftmargin plus1fill}
+ \setlength\LTright{\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill}
+\makeatother
+\begin{longtable}{|*{2}{\X{1}{2}|}}
\sphinxtoprule
\sphinxstyletheadfamily
\sphinxAtStartPar
diff --git a/tests/roots/test-latex-table/expects/longtable_having_stub_columns_and_problematic_cell.tex b/tests/roots/test-latex-table/expects/longtable_having_stub_columns_and_problematic_cell.tex
index 44114ce78..9ae535c19 100644
--- a/tests/roots/test-latex-table/expects/longtable_having_stub_columns_and_problematic_cell.tex
+++ b/tests/roots/test-latex-table/expects/longtable_having_stub_columns_and_problematic_cell.tex
@@ -3,7 +3,11 @@
\begin{savenotes}
\sphinxatlongtablestart
\sphinxthistablewithglobalstyle
-\begin{longtable}[c]{|*{3}{\X{1}{3}|}}
+\makeatletter
+ \setlength\LTleft{\@totalleftmargin plus1fill}
+ \setlength\LTright{\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill}
+\makeatother
+\begin{longtable}{|*{3}{\X{1}{3}|}}
\sphinxtoprule
\sphinxstyletheadfamily
\sphinxAtStartPar
diff --git a/tests/roots/test-latex-table/expects/longtable_having_verbatim.tex b/tests/roots/test-latex-table/expects/longtable_having_verbatim.tex
index fc78914a9..029bc54c2 100644
--- a/tests/roots/test-latex-table/expects/longtable_having_verbatim.tex
+++ b/tests/roots/test-latex-table/expects/longtable_having_verbatim.tex
@@ -3,7 +3,11 @@
\begin{savenotes}
\sphinxatlongtablestart
\sphinxthistablewithglobalstyle
-\begin{longtable}[c]{|*{2}{\X{1}{2}|}}
+\makeatletter
+ \setlength\LTleft{\@totalleftmargin plus1fill}
+ \setlength\LTright{\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill}
+\makeatother
+\begin{longtable}{|*{2}{\X{1}{2}|}}
\sphinxtoprule
\sphinxstyletheadfamily
\sphinxAtStartPar
diff --git a/tests/roots/test-latex-table/expects/longtable_having_widths.tex b/tests/roots/test-latex-table/expects/longtable_having_widths.tex
index 5bf1507a7..706061cd8 100644
--- a/tests/roots/test-latex-table/expects/longtable_having_widths.tex
+++ b/tests/roots/test-latex-table/expects/longtable_having_widths.tex
@@ -3,7 +3,11 @@
\begin{savenotes}
\sphinxatlongtablestart
\sphinxthistablewithglobalstyle
-\begin{longtable}[c]{|\X{30}{100}|\X{70}{100}|}
+\makeatletter
+ \setlength\LTleft{\@totalleftmargin plus1fill}
+ \setlength\LTright{\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill}
+\makeatother
+\begin{longtable}{|\X{30}{100}|\X{70}{100}|}
\noalign{\phantomsection\label{\detokenize{longtable:namedlongtable}}\label{\detokenize{longtable:mylongtable}}}%
\sphinxtoprule
\sphinxstyletheadfamily
diff --git a/tests/roots/test-latex-table/expects/longtable_having_widths_and_problematic_cell.tex b/tests/roots/test-latex-table/expects/longtable_having_widths_and_problematic_cell.tex
index bf9192009..f24ca827d 100644
--- a/tests/roots/test-latex-table/expects/longtable_having_widths_and_problematic_cell.tex
+++ b/tests/roots/test-latex-table/expects/longtable_having_widths_and_problematic_cell.tex
@@ -3,7 +3,11 @@
\begin{savenotes}
\sphinxatlongtablestart
\sphinxthistablewithglobalstyle
-\begin{longtable}[c]{|\X{30}{100}|\X{70}{100}|}
+\makeatletter
+ \setlength\LTleft{\@totalleftmargin plus1fill}
+ \setlength\LTright{\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill}
+\makeatother
+\begin{longtable}{|\X{30}{100}|\X{70}{100}|}
\sphinxtoprule
\sphinxstyletheadfamily
\sphinxAtStartPar
diff --git a/tests/roots/test-latex-table/expects/longtable_with_tabularcolumn.tex b/tests/roots/test-latex-table/expects/longtable_with_tabularcolumn.tex
index 6383d9d56..57960d7e0 100644
--- a/tests/roots/test-latex-table/expects/longtable_with_tabularcolumn.tex
+++ b/tests/roots/test-latex-table/expects/longtable_with_tabularcolumn.tex
@@ -4,7 +4,11 @@
\sphinxatlongtablestart
\sphinxthistablewithglobalstyle
\sphinxthistablewithvlinesstyle
-\begin{longtable}[c]{|c|c|}
+\makeatletter
+ \setlength\LTleft{\@totalleftmargin plus1fill}
+ \setlength\LTright{\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill}
+\makeatother
+\begin{longtable}{|c|c|}
\sphinxtoprule
\sphinxstyletheadfamily
\sphinxAtStartPar
diff --git a/tests/test_build_latex.py b/tests/test_build_latex.py
index 5dce900e2..8c6ecb96a 100644
--- a/tests/test_build_latex.py
+++ b/tests/test_build_latex.py
@@ -1364,10 +1364,10 @@ def test_latex_table_with_booktabs_and_colorrows(app, status, warning):
assert r'\PassOptionsToPackage{booktabs}{sphinx}' in result
assert r'\PassOptionsToPackage{colorrows}{sphinx}' in result
# tabularcolumns
- assert r'\begin{longtable}[c]{|c|c|}' in result
+ assert r'\begin{longtable}{|c|c|}' in result
# class: standard
assert r'\begin{tabulary}{\linewidth}[t]{|T|T|T|T|T|}' in result
- assert r'\begin{longtable}[c]{ll}' in result
+ assert r'\begin{longtable}{ll}' in result
assert r'\begin{tabular}[t]{*{2}{\X{1}{2}}}' in result
assert r'\begin{tabular}[t]{\X{30}{100}\X{70}{100}}' in result
diff --git a/tests/test_ext_autosummary.py b/tests/test_ext_autosummary.py
index 7226a1167..1b56ef38e 100644
--- a/tests/test_ext_autosummary.py
+++ b/tests/test_ext_autosummary.py
@@ -538,7 +538,7 @@ def test_autosummary_latex_table_colspec(app, status, warning):
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
print(status.getvalue())
print(warning.getvalue())
- assert r'\begin{longtable}[c]{\X{1}{2}\X{1}{2}}' in result
+ assert r'\begin{longtable}{\X{1}{2}\X{1}{2}}' in result
assert r'p{0.5\linewidth}' not in result