Sha256: 841931e28a28b53c1d8bee216822c007ae21a412219531467037da5be089cf94

Contents?: true

Size: 1.33 KB

Versions: 3

Compression:

Stored size: 1.33 KB

Contents

require 'spec_helper'

module ImageFile
  describe Image, ".new" do
    it "should raise ArgumentError without pixel format" do
      expect {
        described_class.new(width:42, height:42)
      }.to raise_error(ArgumentError)
    end

    it "should raise ArgumentError without width" do
      expect {
        described_class.new(pixel_format: :RGB24, height:42)
      }.to raise_error(ArgumentError)
    end

    it "should raise ArgumentError without height" do
      expect {
        described_class.new(pixel_format: :RGB24, width:42)
      }.to raise_error(ArgumentError)
    end
  end

  describe Image do
    subject { Image.new(width:42, height:42, pixel_format: :RGB24) }

    its(:width) { should be == 42 }
    its(:height) { should be == 42 }
    its(:row_stride) { should be == 42 }
    its(:pixel_format) { should be == :RGB24 }

    describe "create_cairo_surface" do
      subject { Image.new(width:42, height:42, pixel_format: :RGB24).create_cairo_surface }
      it { should be_a(Cairo::Surface) }
    end
  end

  describe Image, "with row-stride" do
    subject { Image.new(width:42, height:42, pixel_format: :RGB24, row_stride:64) }

    its(:width) { should be == 42 }
    its(:height) { should be == 42 }
    its(:row_stride) { should be == 64 }
    its(:pixel_format) { should be == :RGB24 }
  end
end

# vim: foldmethod=marker

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
image-file-0.1.2 spec/image_file/image_spec.rb
image-file-0.1.1 spec/image_file/image_spec.rb
image-file-0.1.0 spec/image_file/image_spec.rb