diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2022-05-10 03:51:51 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-10 03:51:51 -0600 |
| commit | 80b24612688df6fd052591550bfa012a596a85e0 (patch) | |
| tree | c7324f697eefcd63fdffc2988f09abb9b4375b18 /spec | |
| parent | c599a1f524e87d78a072b956abbfeb9559d59474 (diff) | |
resolves #2149 preserve columns on subsequent pages in the index section (PR #2152)
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/index_spec.rb | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/spec/index_spec.rb b/spec/index_spec.rb index e12a32bd..d30d9f1e 100644 --- a/spec/index_spec.rb +++ b/spec/index_spec.rb @@ -787,7 +787,6 @@ describe 'Asciidoctor::PDF::Converter - Index' do ((melody)) and ((harmony)) - [index] == Index EOS @@ -800,6 +799,49 @@ describe 'Asciidoctor::PDF::Converter - Index' do (expect s_category_text[:x]).to eql 36.0 end + it 'should preserve column count on subsequent pages' do + pdf_theme = { + page_margin: 36, + page_margin_inner: 54, + page_margin_outer: 18, + } + pdf = to_pdf <<~EOS, pdf_theme: pdf_theme, analyze: true + = Document Title + :doctype: book + :notitle: + :media: prepress + :pdf-page-size: A5 + + == Chapter + + #{('a'..'z').map {|l| [l, l * 2, l * 3, l * 4] }.flatten.map {|it| '((' + it + '))' }.join ' '} + + [index] + == Index + EOS + + (expect pdf.pages).to have_size 5 + midpoint_recto = 54 + (pdf.pages[0][:size][0] - 72) * 0.5 + midpoint_verso = 18 + (pdf.pages[0][:size][0] - 72) * 0.5 + + a_category_text = pdf.find_unique_text 'A', page_number: 3 + f_category_text = pdf.find_unique_text 'F', page_number: 3 + k_category_text = pdf.find_unique_text 'K', page_number: 4 + q_category_text = pdf.find_unique_text 'Q', page_number: 4 + z_category_text = pdf.find_unique_text 'Z', page_number: 5 + (expect a_category_text).not_to be_nil + (expect a_category_text[:x]).to eql 54.0 + (expect f_category_text).not_to be_nil + (expect f_category_text[:x]).to be > midpoint_recto + (expect k_category_text).not_to be_nil + (expect k_category_text[:x]).to eql 18.0 + (expect q_category_text).not_to be_nil + (expect q_category_text[:x]).to be > midpoint_verso + (expect q_category_text[:x]).to be < midpoint_recto + (expect z_category_text).not_to be_nil + (expect z_category_text[:x]).to eql 54.0 + end + it 'should indent TOC title properly when index exceeds a page and section indent is positive' do pdf = to_pdf <<~EOS, pdf_theme: { section_indent: 50 }, analyze: true = Document Title |
