Sha256: 977a4b03d4e629bffec90d43d957c6ab42b1c3b661a79052a301294136dda1e9

Contents?: true

Size: 1.11 KB

Versions: 29

Compression:

Stored size: 1.11 KB

Contents

require 'spec_helper'

describe ChunkyPNG::Datastream do

  describe '.from_io'do
    it "should raise an error when loading a file with a bad signature" do
      filename = resource_file('damaged_signature.png')
      lambda { ChunkyPNG::Datastream.from_file(filename) }.should raise_error
    end

    it "should raise an error if the CRC of a chunk is incorrect" do
      filename = resource_file('damaged_chunk.png')
      lambda { ChunkyPNG::Datastream.from_file(filename) }.should raise_error
    end
  end

  describe '#metadata' do
    it "should load uncompressed tXTt chunks correctly" do
      filename = resource_file('text_chunk.png')
      ds = ChunkyPNG::Datastream.from_file(filename)
      ds.metadata['Title'].should  == 'My amazing icon!'
      ds.metadata['Author'].should == "Willem van Bergen"
    end

    it "should load compressed zTXt chunks correctly" do
      filename = resource_file('ztxt_chunk.png')
      ds = ChunkyPNG::Datastream.from_file(filename)
      ds.metadata['Title'].should == 'PngSuite'
      ds.metadata['Copyright'].should == "Copyright Willem van Schaik, Singapore 1995-96"
    end
  end
end

Version data entries

29 entries across 28 versions & 4 rubygems

Version Path
bench9000-0.1 vendor/chunky_png/spec/chunky_png/datastream_spec.rb
chunky_png-1.3.2 spec/chunky_png/datastream_spec.rb
chunky_png-1.3.1 spec/chunky_png/datastream_spec.rb
sadui-0.0.4 vendor/bundle/ruby/2.1.0/gems/chunky_png-1.3.0/spec/chunky_png/datastream_spec.rb
sadui-0.0.4 vendor/bundle/ruby/2.0.0/gems/chunky_png-1.3.0/spec/chunky_png/datastream_spec.rb
chunky_png-1.3.0 spec/chunky_png/datastream_spec.rb
chunky_png-1.2.9 spec/chunky_png/datastream_spec.rb
chunky_png-1.2.8 spec/chunky_png/datastream_spec.rb
chunky_png-1.2.7 spec/chunky_png/datastream_spec.rb
chunky_png-1.2.6 spec/chunky_png/datastream_spec.rb
radiant-1.0.0 ruby-debug/ruby/1.8/gems/chunky_png-1.2.5/spec/chunky_png/datastream_spec.rb
chunky_png-1.2.5 spec/chunky_png/datastream_spec.rb
chunky_png-1.2.4 spec/chunky_png/datastream_spec.rb
chunky_png-1.2.3 spec/chunky_png/datastream_spec.rb
chunky_png-1.2.2 spec/chunky_png/datastream_spec.rb
chunky_png-1.2.1 spec/chunky_png/datastream_spec.rb
chunky_png-1.2.0 spec/chunky_png/datastream_spec.rb
chunky_png-1.1.2 spec/chunky_png/datastream_spec.rb
chunky_png-1.1.1 spec/chunky_png/datastream_spec.rb
chunky_png-1.1.0 spec/chunky_png/datastream_spec.rb