Sha256: 37e6946b070ab76c273949128703c0a12f900b17d1bdffbe1be68514629214af

Contents?: true

Size: 1.21 KB

Versions: 8

Compression:

Stored size: 1.21 KB

Contents

# NEEDS:
#
# @image
# @processor
#
describe "image analyser methods", :shared => true do
  
  it "should return the width" do
    @analyser.width(@image).should == 280
  end

  it "should return the height" do
    @analyser.height(@image).should == 355
  end

  it "should return the aspect ratio" do
    @analyser.aspect_ratio(@image).should == (280.0/355.0)
  end

  it "should say if it's portrait" do
    @analyser.portrait?(@image).should be_true
  end

  it "should say if it's landscape" do
    @analyser.landscape?(@image).should be_false
  end

  it "should return the number of colours" do
    @analyser.number_of_colours(@image).should == 34703
  end

  it "should return the depth" do
    @analyser.depth(@image).should == 8
  end

  it "should return the format" do
    @analyser.format(@image).should == :png
  end

  %w(width height aspect_ratio number_of_colours depth format portrait? landscape?).each do |meth|
    it "should throw unable_to_handle in #{meth.inspect} if it's not an image file" do
      suppressing_stderr do
        temp_object = Dragonfly::TempObject.new('blah')
        lambda{
          @analyser.send(meth, temp_object)
        }.should throw_symbol(:unable_to_handle)
      end
    end
  end

end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
dragonfly-0.8.6 spec/dragonfly/analysis/shared_analyser_spec.rb
dragonfly-0.8.5 spec/dragonfly/analysis/shared_analyser_spec.rb
dragonfly-0.8.4 spec/dragonfly/analysis/shared_analyser_spec.rb
fog-dragonfly-0.8.2 spec/dragonfly/analysis/shared_analyser_spec.rb
dragonfly-0.8.2 spec/dragonfly/analysis/shared_analyser_spec.rb
fog-dragonfly-0.8.1 spec/dragonfly/analysis/shared_analyser_spec.rb
dragonfly-0.8.1 spec/dragonfly/analysis/shared_analyser_spec.rb
dragonfly-0.8.0 spec/dragonfly/analysis/shared_analyser_spec.rb