File: charcoal_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 (29 lines) | stat: -rw-r--r-- 1,040 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
RSpec.describe Magick::Image, "#charcoal" do
  it "applies a charcoal effect", unsupported_before('6.8') do
    image = build_image
    expected_pixels = [gray(53736), gray(48703), gray(9953), gray(51857)]

    expect(image.charcoal).to match_pixels(expected_pixels, delta: 1)
  end

  it "applies a charcoal effect with radius", unsupported_before('6.8') do
    image = build_image
    expected_pixels = [gray(55422), gray(49372), gray(9121), gray(53918)]

    expect(image.charcoal(1.0)).to match_pixels(expected_pixels, delta: 50)
  end

  it "applies a charcoal effect with radius and sigma", unsupported_before('6.8') do
    image = build_image
    expected_pixels = [gray(51460), gray(48203), gray(11918), gray(50352)]

    expect(image.charcoal(1.0, 2.0)).to match_pixels(expected_pixels, delta: 100)
  end

  it "raises an error with an incorrect number of arguments" do
    image = build_image

    expect { image.charcoal(1.0, 2.0, 3.0) }
      .to raise_error(ArgumentError, "wrong number of arguments (3 for 0 to 2)")
  end
end