summaryrefslogtreecommitdiffstats
path: root/share/extensions/tests/test_pdflatex.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:29:01 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:29:01 +0000
commit35a96bde514a8897f6f0fcc41c5833bf63df2e2a (patch)
tree657d15a03cc46bd099fc2c6546a7a4ad43815d9f /share/extensions/tests/test_pdflatex.py
parentInitial commit. (diff)
downloadinkscape-35a96bde514a8897f6f0fcc41c5833bf63df2e2a.tar.xz
inkscape-35a96bde514a8897f6f0fcc41c5833bf63df2e2a.zip
Adding upstream version 1.0.2.upstream/1.0.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'share/extensions/tests/test_pdflatex.py')
-rw-r--r--share/extensions/tests/test_pdflatex.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/share/extensions/tests/test_pdflatex.py b/share/extensions/tests/test_pdflatex.py
new file mode 100644
index 0000000..e3873a5
--- /dev/null
+++ b/share/extensions/tests/test_pdflatex.py
@@ -0,0 +1,34 @@
+# coding=utf-8
+"""
+Test calling pdflatex to convert formule to svg.
+
+This test uses cached output from the `pdflatex` command because this
+test is not a test of pdflatex, but of the extension only. The mocked
+output also allows testing in the CI builder without dependancies.
+
+To re-generate the cached files, run the pytest command:
+
+NO_MOCK_COMMANDS=1 pytest tests/test_pdflatex.py
+
+This will use pdflatex, but will also store the output of the call
+to `tests/data/cmd/pdflatex/[key].msg.output (and also to `cmd/inkscape/...`)
+
+The key depends on the comparison arguments, so changing them will invalidate
+the file and you must regenerate them.
+
+Remove the `.output` extension from the above file and commit it to the
+repository only AFTER all the tests pass and you are happy with them.
+
+Clean up any old `.msg` files with invalid or old keys.
+
+(use EXPORT_COMPARE to generate the output svgs, see inkex.tester docs)
+"""
+from pdflatex import PdfLatex
+from inkex.tester import ComparisonMixin, TestCase
+
+class PdfLatexTest(ComparisonMixin, TestCase):
+ compare_file = 'svg/empty.svg'
+ effect_class = PdfLatex
+ comparisons = [
+ ('--formule=\\(\\displaystyle\\frac{\\pi^2}{6}=\\lim_{n \\to \\infty}\\sum_{k=1}^n \\frac{1}{k^2}\\)', '--packages='),
+ ]