summaryrefslogtreecommitdiff
path: root/tests/test_build_text.py
diff options
context:
space:
mode:
authorshimizukawa <shimizukawa@gmail.com>2013-03-09 22:58:47 +0900
committershimizukawa <shimizukawa@gmail.com>2013-03-09 22:58:47 +0900
commit0841cb7e59ff2d7a67e13aef5a045823fb28d1b5 (patch)
tree1291ea6fa02108bd74d0c2e7d1b77c2284831316 /tests/test_build_text.py
parent3d015c92899224ce004a59f4953a4fdd937f58c1 (diff)
downloadsphinx-0841cb7e59ff2d7a67e13aef5a045823fb28d1b5.tar.gz
Fix: text builder breach max-witdh specificatoin if paragraph have prefixed text. ex: 'See also:'
Diffstat (limited to 'tests/test_build_text.py')
-rw-r--r--tests/test_build_text.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/test_build_text.py b/tests/test_build_text.py
index 79edc623..e36076a5 100644
--- a/tests/test_build_text.py
+++ b/tests/test_build_text.py
@@ -31,6 +31,35 @@ def with_text_app(*args, **kw):
@with_text_app()
+def test_maxwitdh_with_prefix(app):
+ long_string = u' '.join([u"ham"] * 30)
+ contents = (
+ u".. seealso:: %(long_string)s\n\n"
+ u"* %(long_string)s\n"
+ u"* %(long_string)s\n"
+ u"\nspam egg\n"
+ ) % locals()
+
+ (app.srcdir / 'contents.rst').write_text(contents, encoding='utf-8')
+ app.builder.build_all()
+ result = (app.outdir / 'contents.txt').text(encoding='utf-8')
+
+ lines = result.splitlines()
+ line_widths = [column_width(line) for line in lines]
+ assert max(line_widths) < MAXWIDTH
+ assert lines[0].startswith('See also: ham')
+ assert lines[1].startswith(' ham')
+ assert lines[2] == ''
+ assert lines[3].startswith('* ham')
+ assert lines[4].startswith(' ham')
+ assert lines[5] == ''
+ assert lines[6].startswith('* ham')
+ assert lines[7].startswith(' ham')
+ assert lines[8] == ''
+ assert lines[9].startswith('spam egg')
+
+
+@with_text_app()
def test_multibyte_title_line(app):
title = u'\u65e5\u672c\u8a9e'
underline = u'=' * column_width(title)