Sha256: 43b9cb597bca86cdcd70e85986f7f2bf5e816f28968d260076271403ea8eb178

Contents?: true

Size: 594 Bytes

Versions: 6

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| v >= 0 && v <= Magick::QuantumRange }).to be true
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rmagick-4.1.0.rc2 spec/rmagick/image/constitute_spec.rb
rmagick-4.1.0.rc1 spec/rmagick/image/constitute_spec.rb
rmagick-4.0.0 spec/rmagick/image/constitute_spec.rb
rmagick-3.2.0 spec/rmagick/image/constitute_spec.rb
rmagick-3.1.0 spec/rmagick/image/constitute_spec.rb
rmagick-3.0.0 spec/rmagick/image/constitute_spec.rb