From: Vladimír Vondruš Date: Sat, 14 Sep 2024 22:45:24 +0000 (+0200) Subject: documentation/doxygen: adapt test to spacing changes in math in 1.9.x. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?a=commitdiff_plain;h=b938e87b5bfba774845acb0ae14d09c61fd3685b;p=blog.git 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. --- 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