Sha256: 8274186fb62df8c991a6b6c81a31d75def1178442e6a11e391470b7e04c2fb24

Contents?: true

Size: 998 Bytes

Versions: 12

Compression:

Stored size: 998 Bytes

Contents

require 'spec_helper'

describe ChunkyPNG::Image do
  describe '#metadata' do

    it "should load metadata from an existing file" do
      image = ChunkyPNG::Image.from_file(resource_file('text_chunk.png'))
      expect(image.metadata['Title']).to  eql 'My amazing icon!'
      expect(image.metadata['Author']).to eql 'Willem van Bergen'
    end

    it "should write metadata to the file correctly" do
      filename = resource_file('_metadata.png')

      image = ChunkyPNG::Image.new(10, 10)
      image.metadata['Title']  = 'My amazing icon!'
      image.metadata['Author'] = 'Willem van Bergen'
      image.save(filename)

      metadata = ChunkyPNG::Datastream.from_file(filename).metadata
      expect(metadata['Title']).to  eql 'My amazing icon!'
      expect(metadata['Author']).to eql 'Willem van Bergen'
    end

    it "should load empty images correctly" do
      expect do
        ChunkyPNG::Image.from_file(resource_file('empty.png'))
      end.to_not raise_error
    end
  end
end

Version data entries

12 entries across 11 versions & 3 rubygems

Version Path
chunky_png-1.3.11 spec/chunky_png/image_spec.rb
chunky_png-1.3.10 spec/chunky_png/image_spec.rb
chunky_png-1.3.9 spec/chunky_png/image_spec.rb
arcabouco-0.2.13 vendor/bundle/gems/chunky_png-1.3.8/spec/chunky_png/image_spec.rb
arcabouco-0.2.13 vendor/bundle/gems/chunky_png-1.3.6/spec/chunky_png/image_spec.rb
chunky_png-1.3.8 spec/chunky_png/image_spec.rb
second_step-0.1.2 secondstep-notify-1.0.0-osx/lib/ruby/lib/ruby/gems/2.2.0/gems/chunky_png-1.3.7/spec/chunky_png/image_spec.rb
chunky_png-1.3.7 spec/chunky_png/image_spec.rb
chunky_png-1.3.6 spec/chunky_png/image_spec.rb
chunky_png-1.3.5 spec/chunky_png/image_spec.rb
chunky_png-1.3.4 spec/chunky_png/image_spec.rb
chunky_png-1.3.3 spec/chunky_png/image_spec.rb