Sha256: 6cad1a4ff8c2db03c9ca618ecd1d67e10f7161fe9f4a89674a25a7031887c328

Contents?: true

Size: 594 Bytes

Versions: 8

Compression:

Stored size: 594 Bytes

Contents

RSpec.describe Magick::Image, '#constitute' do

  let(:img) { Magick::Image.read(IMAGES_DIR+'/Button_0.gif').first }
  let(:pixels) { img.dispatch(0, 0, img.columns, img.rows, 'RGBA') }

  it 'returns an equivalent image to the given pixels' do
    res = Magick::Image.constitute(img.columns, img.rows, 'RGBA', pixels)
    # The constituted image is in MIFF format so we
    # can't compare it directly to the original image.
    expect(res.columns).to eq img.columns
    expect(res.rows).to eq img.rows
    expect(pixels.all? { |v| 0 <= v && v <= Magick::QuantumRange }).to be true
  end

end

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
rmagick-windows-2.16.5 spec/rmagick/image/constitute_spec.rb
rmagick-windows-2.16.4 spec/rmagick/image/constitute_spec.rb
rmagick-windows-2.16.3 spec/rmagick/image/constitute_spec.rb
rmagick-windows-2.16.2 spec/rmagick/image/constitute_spec.rb
rmagick-windows-2.16.1 spec/rmagick/image/constitute_spec.rb
mdg-1.0.1 vendor/bundle/ruby/2.3.0/gems/rmagick-2.16.0/spec/rmagick/image/constitute_spec.rb
rmagick-2.16.0 spec/rmagick/image/constitute_spec.rb
rmagick-2.15.4 spec/rmagick/image/constitute_spec.rb