File: mean_error_per_pixel_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 (21 lines) | stat: -rw-r--r-- 926 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
RSpec.describe Magick::Image, '#mean_error_per_pixel' do
  it 'works' do
    hat = described_class.read(FLOWER_HAT).first

    expect { hat.mean_error_per_pixel }.not_to raise_error
    expect { hat.normalized_mean_error }.not_to raise_error
    expect { hat.normalized_maximum_error }.not_to raise_error
    expect(hat.mean_error_per_pixel).to eq(0.0)
    expect(hat.normalized_mean_error).to eq(0.0)
    expect(hat.normalized_maximum_error).to eq(0.0)

    hat2 = hat.quantize(16, Magick::RGBColorspace, true, 0, true)

    expect(hat2.mean_error_per_pixel).not_to eq(0.0)
    expect(hat2.normalized_mean_error).not_to eq(0.0)
    expect(hat2.normalized_maximum_error).not_to eq(0.0)
    expect { hat2.mean_error_per_pixel = 1 }.to raise_error(NoMethodError)
    expect { hat2.normalized_mean_error = 1 }.to raise_error(NoMethodError)
    expect { hat2.normalized_maximum_error = 1 }.to raise_error(NoMethodError)
  end
end