Sha256: b4d6ea81caadf70b000256145212d316fdb924cac37ff6539de8fe1b0971a1b4

Contents?: true

Size: 1.45 KB

Versions: 1

Compression:

Stored size: 1.45 KB

Contents

require File.dirname(__FILE__) + '/spec_helper'

describe Sprite do
  before(:all) do
    @sprite = Sprite.new
  end
  
  context "get_image" do
    it "should get a image" do
      @sprite.get_image(File.join(File.dirname(__FILE__), 'resources/good_topic.gif')).class.should == Magick::Image
    end
  end
  
  context "image_properties" do
    it "should get image properties" do
      image = @sprite.get_image(File.join(File.dirname(__FILE__), 'resources/good_topic.gif'))
      @sprite.image_properties(image).should == {:name => 'good_topic', :width => 20, :height => 19}
    end
  end
  
  context "composite_images" do
    it "should composite two images into one horizontally" do
      image1 = @sprite.get_image(File.join(File.dirname(__FILE__), 'resources/good_topic.gif'))
      image2 = @sprite.get_image(File.join(File.dirname(__FILE__), 'resources/mid_topic.gif'))
      image = @sprite.composite_images(image1, image2, image1.columns, 0)
      @sprite.image_properties(image).should == {:name => nil, :width => 40, :height => 19}
    end
    
    it "should composite two images into one verically" do
      image1 = @sprite.get_image(File.join(File.dirname(__FILE__), 'resources/good_topic.gif'))
      image2 = @sprite.get_image(File.join(File.dirname(__FILE__), 'resources/mid_topic.gif'))
      image = @sprite.composite_images(image1, image2, 0, image1.rows)
      @sprite.image_properties(image).should == {:name => nil, :width => 20, :height => 38}
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sprite-0.1.0 spec/sprite_spec.rb