Sha256: 2d92194429622f4b2ee630717160f04902ab80130eb838ef9d269dc2568d2855

Contents?: true

Size: 1.4 KB

Versions: 6

Compression:

Stored size: 1.4 KB

Contents

require 'spec_helper'

describe 'Slices' do

  describe "Handle file with slice properly" do


    it "should successfully parse a the PSD file of version 7 or above and has slices" do
      psd = PSD.new('spec/files/slices.psd')
      psd.parse!

      # File should parse
      expect(psd).to be_parsed

      # Slices should not be nil
      expect(psd.resources[:slices]).to_not be_nil

      # slices version should be above 6
      expect(psd.resources[:slices].data.version).to be > 6

      # Bounds of each slice should not be nil
      psd.resources[:slices].data.to_a.each do |slice|
        expect(slice).to_not be_nil
        expect(slice['bounds']).to_not be_nil
      end
    end


    it "should successfully parse a the PSD file of version 6 and has slices" do
      psd = PSD.new('spec/files/pixel.psd')
      psd.parse!

      # File should parse
      expect(psd).to be_parsed

      # Slices should still be not nil
      expect(psd.resources[:slices]).to_not be_nil

      # But slices version should be equal to 6
      expect(psd.resources[:slices].data.version).to eq 6

      # Slices data to be nil
      expect(psd.resources[:slices].data.to_a).to eq []
    end
  end

  describe "Handle file without slices properly" do
    #TODO: All files have atleast one autogenerated slice. Dunno how to handle this case yet!
    #it "should successfully parse a PSD file which does not have slices" do
    #end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
psd-1.4.5 spec/slices_spec.rb
psd-1.4.4 spec/slices_spec.rb
psd-1.4.3 spec/slices_spec.rb
psd-1.4.2 spec/slices_spec.rb
psd-1.4.1 spec/slices_spec.rb
psd-1.4.0 spec/slices_spec.rb