Sha256: caf02476a1ded554e5cf7227f409c5768aad42a876c04e6b25dac679cb338919

Contents?: true

Size: 1011 Bytes

Versions: 3

Compression:

Stored size: 1011 Bytes

Contents

require 'spec_helper'

describe ChunkyPNG::Canvas do

  describe '.from_rgb_stream' do
    it "should load an image correctly from a datastream" do
      File.open(resource_file('pixelstream.rgb')) do |stream|
        matrix = ChunkyPNG::Canvas.from_rgb_stream(240, 180, stream)
        matrix.should == reference_canvas('pixelstream_reference')
      end
    end
  end

  describe '.from_bgr_stream' do
    it "should load an image correctly from a datastream" do
      File.open(resource_file('pixelstream.bgr')) do |stream|
        matrix = ChunkyPNG::Canvas.from_bgr_stream(240, 180, stream)
        matrix.should == reference_canvas('pixelstream_reference')
      end
    end
  end

  describe '.from_rgba_stream' do
    it "should load an image correctly from a datastream" do
      File.open(resource_file('pixelstream.rgba')) do |stream|
        matrix = ChunkyPNG::Canvas.from_rgba_stream(240, 180, stream)
        matrix.should == reference_canvas('pixelstream_reference')
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
bench9000-0.1 vendor/chunky_png/spec/chunky_png/canvas/stream_importing_spec.rb
chunky_png-1.3.2 spec/chunky_png/canvas/stream_importing_spec.rb
chunky_png-1.3.1 spec/chunky_png/canvas/stream_importing_spec.rb