Sha256: 9fc6b65a14fbb47dc11d4631f7ae9adf91e537f6a81cc70d2c3136eaa41a4635

Contents?: true

Size: 1 KB

Versions: 5

Compression:

Stored size: 1 KB

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)
        expect(matrix).to eql 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)
        expect(matrix).to eql 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)
        expect(matrix).to eql reference_canvas("pixelstream_reference")
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
chunky_png-1.4.0 spec/chunky_png/canvas/stream_importing_spec.rb
chunky_png-1.3.15 spec/chunky_png/canvas/stream_importing_spec.rb
chunky_png-1.3.14 spec/chunky_png/canvas/stream_importing_spec.rb
chunky_png-1.3.13 spec/chunky_png/canvas/stream_importing_spec.rb
chunky_png-1.3.12 spec/chunky_png/canvas/stream_importing_spec.rb