1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
RSpec.describe Magick::Image, "#channel_extrema" do
it "returns the min and max intensity values for all channels when no arguments are passed" do
image = build_image
extrema = image.channel_extrema
expect(extrema).to eq([2, 247])
end
it "returns the min and max intensity values for one channel" do
image = build_image
extrema = image.channel_extrema(Magick::GreenChannel)
expect(extrema).to eq([65, 236])
end
it "returns the min and max intensity values for two channels" do
image = build_image
extrema = image.channel_extrema(Magick::RedChannel, Magick::GreenChannel)
expect(extrema).to eq([8, 239])
end
it "returns the min and max intensity values for three channels" do
image = build_image
extrema = image.channel_extrema(Magick::RedChannel, Magick::GreenChannel, Magick::BlueChannel)
expect(extrema).to eq([2, 247])
end
it "raises an error when the wrong type of argument is passed" do
image = build_image
expect { image.channel_extrema("test") }
.to raise_error(TypeError, "argument must be a ChannelType value (String given)")
end
end
|