From b938e87b5bfba774845acb0ae14d09c61fd3685b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 15 Sep 2024 00:45:24 +0200 Subject: [PATCH] documentation/doxygen: adapt test to spacing changes in math in 1.9.x. Not sure which version, really. Don't want to plow through the messy changelogs. --- .../contents_math_cached/math-197.html | 68 +++++++++++++++++++ .../contents_math_cached/math.html | 4 +- documentation/test_doxygen/test_contents.py | 13 +++- 3 files changed, 82 insertions(+), 3 deletions(-) create mode 100644 documentation/test_doxygen/contents_math_cached/math-197.html diff --git a/documentation/test_doxygen/contents_math_cached/math-197.html b/documentation/test_doxygen/contents_math_cached/math-197.html new file mode 100644 index 00000000..26b4db20 --- /dev/null +++ b/documentation/test_doxygen/contents_math_cached/math-197.html @@ -0,0 +1,68 @@ + + + + + Math | My Project + + + + + +
+
+
+
+
+

+ Math +

+

In order to actually test use of the cache, I need to cheat a bit. Inline formula which is pi in the source but + +$ \pi $ + + + + + + + + + + + here. Then a block formula which is a Pythagorean theorem in source but not in the output:

+ +\[ a^2 + b^2 = c^2 \] + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+ + diff --git a/documentation/test_doxygen/contents_math_cached/math.html b/documentation/test_doxygen/contents_math_cached/math.html index 26b4db20..b0105df1 100644 --- a/documentation/test_doxygen/contents_math_cached/math.html +++ b/documentation/test_doxygen/contents_math_cached/math.html @@ -37,7 +37,9 @@ $ \pi $ here. Then a block formula which is a Pythagorean theorem in source but not in the output:

-\[ a^2 + b^2 = c^2 \] +\[ + a^2 + b^2 = c^2 +\] diff --git a/documentation/test_doxygen/test_contents.py b/documentation/test_doxygen/test_contents.py index b661a89f..7441b6c9 100644 --- a/documentation/test_doxygen/test_contents.py +++ b/documentation/test_doxygen/test_contents.py @@ -177,7 +177,12 @@ class MathCached(IntegrationTestCase): """ # Actually generated from \[ a^3 + b^3 \neq c^3 \] tho - self.fermat_hash = sha1(r"""\[ a^2 + b^2 = c^2 \]""".encode('utf-8')).digest() + # Doxygen 1.9.8+ (or maybe earlier? 1.9.1 not yet) changes the spacing, + # so have to calculate the hash differently + if parse_version(doxygen_version()) >= parse_version("1.9.8"): + self.fermat_hash = sha1("""\\[\n a^2 + b^2 = c^2\n\\]""".encode('utf-8')).digest() + else: + self.fermat_hash = sha1(r"""\[ a^2 + b^2 = c^2 \]""".encode('utf-8')).digest() self.fermat = """ @@ -213,7 +218,11 @@ class MathCached(IntegrationTestCase): pickle.dump(math_cache, f) self.run_doxygen(wildcard='math.xml') - self.assertEqual(*self.actual_expected_contents('math.html')) + # Same as done above, there's different spacing in 1.9.8+ + if parse_version(doxygen_version()) >= parse_version("1.9.8"): + self.assertEqual(*self.actual_expected_contents('math.html')) + else: + self.assertEqual(*self.actual_expected_contents('math.html', 'math-197.html')) # Expect that after the operation the global cache age is bumped, # unused entries removed and used entries age bumped as well -- 2.30.2