File: add_noise_channel_spec.rb

package info (click to toggle)
ruby-rmagick 6.0.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,232 kB
  • sloc: cpp: 19,563; ruby: 17,147; sh: 88; javascript: 36; makefile: 13
file content (19 lines) | stat: -rw-r--r-- 1,090 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
RSpec.describe Magick::Image, "#add_noise_channel" do
  it "works" do
    image = described_class.new(20, 20)

    expect { image.add_noise_channel(Magick::UniformNoise) }.not_to raise_error
    expect { image.add_noise_channel(Magick::UniformNoise, Magick::RedChannel) }.not_to raise_error
    expect { image.add_noise_channel(Magick::GaussianNoise, Magick::BlueChannel) }.not_to raise_error
    expect { image.add_noise_channel(Magick::ImpulseNoise, Magick::GreenChannel) }.not_to raise_error
    expect { image.add_noise_channel(Magick::LaplacianNoise, Magick::RedChannel, Magick::GreenChannel) }.not_to raise_error
    expect { image.add_noise_channel(Magick::PoissonNoise, Magick::RedChannel, Magick::GreenChannel, Magick::BlueChannel) }.not_to raise_error

    # Not a NoiseType
    expect { image.add_noise_channel(1) }.to raise_error(TypeError)
    # Not a ChannelType
    expect { image.add_noise_channel(Magick::UniformNoise, Magick::RedChannel, 1) }.to raise_error(TypeError)
    # Too few arguments
    expect { image.add_noise_channel }.to raise_error(ArgumentError)
  end
end