File: channel_extrema_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 (40 lines) | stat: -rw-r--r-- 1,138 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
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