Sha256: 5fc2ed2b3a953f74d4e66bc77ad79de87758b1e36c418225082ceacee398e264

Contents?: true

Size: 610 Bytes

Versions: 5

Compression:

Stored size: 610 Bytes

Contents

require "spec_helper"

describe ChunkyPNG::Canvas do
  describe "#to_data_url" do
    it "should export a sample canvas to an RGBA stream correctly" do
      canvas = ChunkyPNG::Canvas.new(2, 2, [
        ChunkyPNG::Color.rgba(1, 2, 3, 4),
        ChunkyPNG::Color.rgba(5, 6, 7, 8),
        ChunkyPNG::Color.rgba(4, 3, 2, 1),
        ChunkyPNG::Color.rgba(8, 7, 6, 5),
      ])

      expect(canvas.to_data_url).to eql "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACAgMAAAAP2OW3AAAADFBMVEUBAgMEAwIFBgcIBwazgAAdAAAABHRSTlMEAQgFhYDlfQAAAAxJREFUeJxjUmAKAAAAwAB1GNhIEwAAAABJRU5ErkJggg=="
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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