mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
add tests for math_numfig
This commit is contained in:
parent
7fc43d3365
commit
783cff44b3
@ -2,8 +2,10 @@ Test Math
|
||||
=========
|
||||
|
||||
.. toctree::
|
||||
:numbered: 1
|
||||
|
||||
math
|
||||
page
|
||||
|
||||
.. math:: a^2+b^2=c^2
|
||||
|
||||
|
9
tests/roots/test-ext-math/page.rst
Normal file
9
tests/roots/test-ext-math/page.rst
Normal file
@ -0,0 +1,9 @@
|
||||
Test multiple pages
|
||||
===================
|
||||
|
||||
.. math::
|
||||
:label: bar
|
||||
|
||||
a = b + 1
|
||||
|
||||
Referencing equations :eq:`foo` and :eq:`bar`.
|
@ -139,3 +139,52 @@ def test_math_eqref_format_latex(app, status, warning):
|
||||
content = (app.outdir / 'test.tex').text()
|
||||
macro = r'Referencing equation Eq.\\ref{equation:math:foo}.'
|
||||
assert re.search(macro, content, re.S)
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='ext-math',
|
||||
confoverrides={'extensions': ['sphinx.ext.mathjax'],
|
||||
'numfig': True,
|
||||
'math_numfig': True})
|
||||
def test_mathjax_numfig_html(app, status, warning):
|
||||
app.builder.build_all()
|
||||
|
||||
content = (app.outdir / 'math.html').text()
|
||||
html = ('<div class="math" id="equation-math:0">\n'
|
||||
'<span class="eqno">(1.2)')
|
||||
assert html in content
|
||||
html = ('<p>Referencing equation <a class="reference internal" '
|
||||
'href="#equation-foo">(1.1)</a>.</p>')
|
||||
assert html in content
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='ext-math',
|
||||
confoverrides={'extensions': ['sphinx.ext.jsmath'],
|
||||
'jsmath_path': 'dummy.js',
|
||||
'numfig': True,
|
||||
'math_numfig': True})
|
||||
def test_jsmath_numfig_html(app, status, warning):
|
||||
app.builder.build_all()
|
||||
|
||||
content = (app.outdir / 'math.html').text()
|
||||
html = '<span class="eqno">(1.2)<a class="headerlink" href="#equation-math:0"'
|
||||
assert html in content
|
||||
html = ('<p>Referencing equation <a class="reference internal" '
|
||||
'href="#equation-foo">(1.1)</a>.</p>')
|
||||
assert html in content
|
||||
|
||||
|
||||
@pytest.mark.sphinx('html', testroot='ext-math',
|
||||
confoverrides={'extensions': ['sphinx.ext.imgmath'],
|
||||
'numfig': True,
|
||||
'numfig_secnum_depth': 0,
|
||||
'math_numfig': True})
|
||||
def test_imgmath_numfig_html(app, status, warning):
|
||||
app.builder.build_all()
|
||||
|
||||
content = (app.outdir / 'page.html').text()
|
||||
html = '<span class="eqno">(3)<a class="headerlink" href="#equation-bar"'
|
||||
assert html in content
|
||||
html = ('<p>Referencing equations <a class="reference internal" '
|
||||
'href="math.html#equation-foo">(1)</a> and '
|
||||
'<a class="reference internal" href="#equation-bar">(3)</a>.</p>')
|
||||
assert html in content
|
||||
|
Loading…
Reference in New Issue
Block a user