Sha256: 44f69d60e575dd05d38f84727c3acfb701c23a1d74f88b836f49d2e725721e5f

Contents?: true

Size: 1.63 KB

Versions: 3

Compression:

Stored size: 1.63 KB

Contents

# encoding: utf-8

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

describe "#character_spacing" do
  it "should draw the character spacing to the document" do
    create_pdf
    @pdf.character_spacing(10.555555) do
      @pdf.text("hello world")
    end
    contents = PDF::Inspector::Text.analyze(@pdf.render)
    contents.character_spacing[0].should == 10.556
  end
  it "should restore character spacing to 0" do
    create_pdf
    @pdf.character_spacing(10.555555) do
      @pdf.text("hello world")
    end
    contents = PDF::Inspector::Text.analyze(@pdf.render)
    contents.character_spacing[1].should == 0
  end
  it "should function as an accessor when no parameter given" do
    create_pdf
    @pdf.character_spacing(10.555555) do
      @pdf.text("hello world")
      @pdf.character_spacing.should == 10.555555
    end
    @pdf.character_spacing.should == 0
  end
end

describe "#word_spacing" do
  it "should draw the word spacing to the document" do
    create_pdf
    @pdf.word_spacing(10.555555) do
      @pdf.text("hello world")
    end
    contents = PDF::Inspector::Text.analyze(@pdf.render)
    contents.word_spacing[0].should == 10.556
  end
  it "should restore word spacing to 0" do
    create_pdf
    @pdf.word_spacing(10.555555) do
      @pdf.text("hello world")
    end
    contents = PDF::Inspector::Text.analyze(@pdf.render)
    contents.word_spacing[1].should == 0
  end
  it "should function as an accessor when no parameter given" do
    create_pdf
    @pdf.word_spacing(10.555555) do
      @pdf.text("hello world")
      @pdf.word_spacing.should == 10.555555
    end
    @pdf.word_spacing.should == 0
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
piglop-prawn-0.10.2.3 spec/text_spacing_spec.rb
piglop-prawn-0.10.2.2 spec/text_spacing_spec.rb
piglop-prawn-0.10.2.1 spec/text_spacing_spec.rb