summaryrefslogtreecommitdiffstats
path: root/tests/roots/test-latex-includegraphics/conf.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 17:25:40 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 17:25:40 +0000
commitcf7da1843c45a4c2df7a749f7886a2d2ba0ee92a (patch)
tree18dcde1a8d1f5570a77cd0c361de3b490d02c789 /tests/roots/test-latex-includegraphics/conf.py
parentInitial commit. (diff)
downloadsphinx-be21195fae81d3ed2bf307cc2df9ad6779da83b0.tar.xz
sphinx-be21195fae81d3ed2bf307cc2df9ad6779da83b0.zip
Adding upstream version 7.2.6.upstream/7.2.6
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/roots/test-latex-includegraphics/conf.py')
-rw-r--r--tests/roots/test-latex-includegraphics/conf.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/roots/test-latex-includegraphics/conf.py b/tests/roots/test-latex-includegraphics/conf.py
new file mode 100644
index 0000000..65c19ab
--- /dev/null
+++ b/tests/roots/test-latex-includegraphics/conf.py
@@ -0,0 +1,47 @@
+exclude_patterns = ['_build']
+
+latex_elements = {
+ 'preamble': r'''
+\makeatletter
+\def\dividetwolengths#1#2{\the\dimexpr
+ \numexpr65536*\dimexpr#1\relax/\dimexpr#2\relax sp}%
+\newwrite\out
+\immediate\openout\out=\jobname-dimensions.txt
+\def\toout{\immediate\write\out}
+\def\getWfromoptions #1width=#2,#3\relax{\def\WidthFromOption{#2}}%
+\def\getHfromoptions #1height=#2,#3\relax{\def\HeightFromOption{#2}}%
+\def\tempincludegraphics[#1]#2{%
+ \sphinxsafeincludegraphics[#1]{#2}%
+ \edef\obtainedratio
+ {\dividetwolengths\spx@image@requiredheight\spx@image@requiredwidth}%
+ \getWfromoptions#1,width=,\relax
+ \getHfromoptions#1,height=,\relax
+ \def\ratiocheck{}%
+ \ifx\WidthFromOption\empty\else
+ \ifx\HeightFromOption\empty\else
+ \edef\askedforratio{\dividetwolengths\HeightFromOption\WidthFromOption}%
+ \edef\ratiocheck{\dividetwolengths\obtainedratio\askedforratio}%
+ \fi\fi
+ \toout{original options = #1^^J%
+ width = \the\dimexpr\spx@image@requiredwidth,
+ linewidth = \the\linewidth^^J%
+ height = \the\dimexpr\spx@image@requiredheight,
+ maxheight = \the\spx@image@maxheight^^J%
+ obtained H/W = \obtainedratio^^J%
+ \ifx\ratiocheck\empty
+ \else
+ asked for H/W = \askedforratio^^J%
+ ratio of ratios = \ratiocheck^^J%
+ \fi
+ }%
+ \ifx\ratiocheck\empty
+ \else
+ \ifpdfabsdim\dimexpr\ratiocheck-1pt\relax > 0.01pt
+ \ASPECTRATIOERROR
+ \fi
+ \fi
+}
+\def\sphinxincludegraphics#1#{\tempincludegraphics#1}
+\makeatother
+''',
+}