diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2018-03-18 12:32:22 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2018-03-18 12:32:53 +0900 |
commit | f3b50ebef0357f49b779784f4e0ab8d8d163ec4a (patch) | |
tree | 38f0215a9e0d41b13ba7f50d2c9307f38aad9b5c | |
parent | fb8e2580121ea63815ae099ab0f241500e3b3814 (diff) | |
download | sphinx-git-f3b50ebef0357f49b779784f4e0ab8d8d163ec4a.tar.gz |
Add testcase for qthelp
-rw-r--r-- | tests/test_build_qthelp.py | 46 |
1 files changed, 46 insertions, 0 deletions
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 @@ -15,14 +15,60 @@ 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 '<title>Python documentation</title>' in qhcp + assert '<homePage>qthelp://org.sphinx.python/doc/index.html</homePage>' in qhcp + assert '<startPage>qthelp://org.sphinx.python/doc/index.html</startPage>' in qhcp + assert '<input>Python.qhp</input>' in qhcp + assert '<output>Python.qch</output>' in qhcp + assert '<file>Python.qch</file>' 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 '<namespace>org.sphinx.python</namespace>' in qhp + qhcp = (app.outdir / 'Python.qhcp').text() + assert '<homePage>qthelp://org.sphinx.python/doc/index.html</homePage>' in qhcp + assert '<startPage>qthelp://org.sphinx.python/doc/index.html</startPage>' in qhcp + # give a namespace app.config.qthelp_namespace = 'org.sphinx-doc.sphinx' app.builder.build_all() + qhp = (app.outdir / 'Python.qhp').text() assert '<namespace>org.sphinxdoc.sphinx</namespace>' in qhp + + qhcp = (app.outdir / 'Python.qhcp').text() + assert '<homePage>qthelp://org.sphinxdoc.sphinx/doc/index.html</homePage>' in qhcp + assert '<startPage>qthelp://org.sphinxdoc.sphinx/doc/index.html</startPage>' 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 '<section title="Python documentation" ref="index.html">' in qhp + + qhcp = (app.outdir / 'Python.qhcp').text() + assert '<title>Python documentation</title>' in qhcp + + # give a title + app.config.html_title = 'Sphinx <b>"full"</b> title' + app.config.html_short_title = 'Sphinx <b>"short"</b> title' + app.builder.build_all() + + qhp = (app.outdir / 'Python.qhp').text() + assert '<section title="Sphinx <b>"full"</b> title" ref="index.html">' in qhp + + qhcp = (app.outdir / 'Python.qhcp').text() + assert '<title>Sphinx <b>"short"</b> title</title>' in qhcp |