From f3b50ebef0357f49b779784f4e0ab8d8d163ec4a Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sun, 18 Mar 2018 12:32:22 +0900 Subject: [PATCH] Add testcase for qthelp --- tests/test_build_qthelp.py | 46 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/tests/test_build_qthelp.py b/tests/test_build_qthelp.py index de676e6e0..e2e2322d4 100644 --- a/tests/test_build_qthelp.py +++ b/tests/test_build_qthelp.py @@ -14,15 +14,61 @@ import pytest +@pytest.mark.sphinx('qthelp', testroot='basic') +def test_qthelp_basic(app, status, warning): + app.builder.build_all() + + qhcp = (app.outdir / 'Python.qhcp').text() + assert 'Python documentation' in qhcp + assert 'qthelp://org.sphinx.python/doc/index.html' in qhcp + assert 'qthelp://org.sphinx.python/doc/index.html' in qhcp + assert 'Python.qhp' in qhcp + assert 'Python.qch' in qhcp + assert 'Python.qch' in qhcp + + @pytest.mark.sphinx('qthelp', testroot='basic') def test_qthelp_namespace(app, status, warning): # default namespace app.builder.build_all() + qhp = (app.outdir / 'Python.qhp').text() assert 'org.sphinx.python' in qhp + qhcp = (app.outdir / 'Python.qhcp').text() + assert 'qthelp://org.sphinx.python/doc/index.html' in qhcp + assert 'qthelp://org.sphinx.python/doc/index.html' in qhcp + # give a namespace app.config.qthelp_namespace = 'org.sphinx-doc.sphinx' app.builder.build_all() + qhp = (app.outdir / 'Python.qhp').text() assert 'org.sphinxdoc.sphinx' in qhp + + qhcp = (app.outdir / 'Python.qhcp').text() + assert 'qthelp://org.sphinxdoc.sphinx/doc/index.html' in qhcp + assert 'qthelp://org.sphinxdoc.sphinx/doc/index.html' in qhcp + + +@pytest.mark.sphinx('qthelp', testroot='basic') +def test_qthelp_title(app, status, warning): + # default title + app.builder.build_all() + + qhp = (app.outdir / 'Python.qhp').text() + assert '
' in qhp + + qhcp = (app.outdir / 'Python.qhcp').text() + assert 'Python documentation' in qhcp + + # give a title + app.config.html_title = 'Sphinx "full" title' + app.config.html_short_title = 'Sphinx "short" title' + app.builder.build_all() + + qhp = (app.outdir / 'Python.qhp').text() + assert '
' in qhp + + qhcp = (app.outdir / 'Python.qhcp').text() + assert 'Sphinx <b>"short"</b> title' in qhcp