summaryrefslogtreecommitdiff
path: root/tests/test_build_text.py
diff options
context:
space:
mode:
authorTakayuki Shimizukawa <shimizukawa@gmail.com>2013-03-09 22:58:47 +0900
committerTakayuki Shimizukawa <shimizukawa@gmail.com>2013-03-09 22:58:47 +0900
commitf6fca7a8ac75e3fa2d2456646fe7c6c310547cba (patch)
tree1291ea6fa02108bd74d0c2e7d1b77c2284831316 /tests/test_build_text.py
parentfea035ebe0e3ee4d143589300f32166a07d45919 (diff)
downloadsphinx-git-f6fca7a8ac75e3fa2d2456646fe7c6c310547cba.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 79edc6230..e36076a58 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)