Sha256: 1667061342fd60b874068d64bcf8551104575ad89fbf5025dfdf325093d03b22
Contents?: true
Size: 1003 Bytes
Versions: 3
Compression:
Stored size: 1003 Bytes
Contents
# encoding: utf-8 require File.join(File.expand_path(File.dirname(__FILE__)), "spec_helper") describe "the image() function" do before(:each) do @filename = "#{Prawn::BASEDIR}/data/images/pigs.jpg" create_pdf end it "should only embed an image once, even if it's added multiple times" do @pdf.image @filename, :at => [100,100] @pdf.image @filename, :at => [300,300] output = @pdf.render images = PDF::Inspector::XObject.analyze(output) # there should be 2 images in the page resources images.page_xobjects.first.size.should == 2 # but only 1 image xobject output.scan(/\/Type \/XObject/).size.should == 1 end it "should return the image info object" do info = @pdf.image(@filename) assert info.kind_of?(Prawn::Images::JPG) info.height.should == 453 end it "should accept IO objects" do file = File.open(@filename, "rb") info = @pdf.image(file) info.height.should == 453 end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
prawn-0.2.1 | spec/images_spec.rb |
prawn-0.2.2 | spec/images_spec.rb |
prawn-0.2.3 | spec/images_spec.rb |