Sha256: 6f30b1f7a9ef8a4e3c0e55a2c259494f891911eedcba59c54608a3223d2e0f64

Contents?: true

Size: 1.11 KB

Versions: 17

Compression:

Stored size: 1.11 KB

Contents

# encoding: utf-8

require File.join(File.expand_path(File.dirname(__FILE__)), "spec_helper")

describe "#formatted_text" do
  it "should draw text" do
    create_pdf
    string = "hello world"
    format_array = [:text => string]
    @pdf.formatted_text(format_array)
    # grab the text from the rendered PDF and ensure it matches
    text = PDF::Inspector::Text.analyze(@pdf.render)
    text.strings.first.should == string
  end
end

describe "#text with inline styling" do
  before(:each) { create_pdf }

  it "should automatically move to a new page if the tallest fragment" +
     " on the next line won't fit in the available space" do
    create_pdf
    @pdf.move_cursor_to(@pdf.font.height)
    formatted = "this contains <font size='24'>sized</font> text"
    @pdf.text(formatted, :inline_format => true)
    pages = PDF::Inspector::Page.analyze(@pdf.render).pages
    pages.size.should == 2
  end

  it "should embed links as literal strings" do
    @pdf.text "<link href='http://wiki.github.com/sandal/prawn/'>wiki</link>",
      :inline_format => true
    @pdf.render.should =~ %r{/URI\s+\(http://wiki\.github\.com}
  end
end

Version data entries

17 entries across 17 versions & 3 rubygems

Version Path
prawn-git-2.0.1 spec/text_with_inline_formatting_spec.rb
prawn-2.0.1 spec/text_with_inline_formatting_spec.rb
prawn-2.0.0 spec/text_with_inline_formatting_spec.rb
prawn-1.3.0 spec/text_with_inline_formatting_spec.rb
prawn-1.2.1 spec/text_with_inline_formatting_spec.rb
prawn-1.1.0 spec/text_with_inline_formatting_spec.rb
prawn-1.0.0 spec/text_with_inline_formatting_spec.rb
prawn-0.15.0 spec/text_with_inline_formatting_spec.rb
prawn-0.14.0 spec/text_with_inline_formatting_spec.rb
prawn-0.13.2 spec/text_with_inline_formatting_spec.rb
prawn-0.13.1 spec/text_with_inline_formatting_spec.rb
prawn-0.13.0 spec/text_with_inline_formatting_spec.rb
prawn-1.0.0.rc2 spec/text_with_inline_formatting_spec.rb
nurettin-prawn-1.0.0.rc1 spec/text_with_inline_formatting_spec.rb
prawn-1.0.0.rc1 spec/text_with_inline_formatting_spec.rb
prawn-0.12.0 spec/text_with_inline_formatting_spec.rb
prawn-0.11.1 spec/text_with_inline_formatting_spec.rb