rpdiff 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rpdiff.rb +3 -1
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: af35e2511342dba9d3c08c126b947a999e448d2e
4
- data.tar.gz: 9077537a63e74d9f736a1586dcefbe21a1271c1c
3
+ metadata.gz: 2f1447a1f0f2a6f54eaf67cdd5cb0f60e40dc9ea
4
+ data.tar.gz: 5c8365e67294b411f0702ef87c6c80997afc2560
5
5
  SHA512:
6
- metadata.gz: 6f810d02144f1063f6647b4fe2a229f53db5fab4e46605db3f1a2819c7c9b209f4b5ac9dc491588f19cc8513413231844c35f9ef34ed3f9771f4a4c15122364b
7
- data.tar.gz: 72c4699264956ee3f1e3171b95d0b5a08d2d06e005ab57f1ce7378bcb0ca78d03d80e06f4506801ddeef8ccab22236c53b6a3839fc91143acbeac5f8153534f3
6
+ metadata.gz: 89d9fe65bb72501dcc64b5fe71df111e65374d7ac29ec9789a27066f149c36d935bb376c0d7714f1b7407b695ca5c9018cb5f55fbfd2397d2bd3d981b6756625
7
+ data.tar.gz: 6362579a759f6a945cdbb6b3632163659684ac520eb1754a4f30ea12fdb5a438965ad6db85dfcd1952380caecb8f01f455df6f037e96bb10b3a1610b5e685998
data/lib/rpdiff.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  class RPDiff
2
2
 
3
3
  attr_reader :visibly_different, :identical, :indistinguishable, :pixel_difference,
4
- :img1, :img2, :fov, :threshold, :gamma, :luminance
4
+ :img1, :img2, :fov, :threshold, :gamma, :luminance, :match_percentage
5
5
 
6
6
  def initialize(img1, img2, options={})
7
7
  @img1, @img2, @options = img1, img2, options
@@ -24,6 +24,7 @@ class RPDiff
24
24
  @visibly_different = true if line =~ /FAIL: Images are visibly different/
25
25
  @identical = true if line =~ /PASS: Images are binary identical/
26
26
  @indistinguishable = true if line =~ /PASS: Images are perceptually indistinguishable/
27
+ @incomparable = true if line =~ /FAIL: Images dimensions do not match/
27
28
  end
28
29
 
29
30
  if @options[:match_percentage]
@@ -36,6 +37,7 @@ class RPDiff
36
37
  #Optional gem requirement to get a % value out of image similarity.
37
38
  def calculate_match_percentage
38
39
  require 'fastimage'
40
+ return 0 if @incomparable
39
41
  @image_sizes = FastImage.size(@img1)
40
42
  @match_percentage = 100 - (@pixel_difference.to_f * 100 / (@image_sizes.first * @image_sizes.last).to_f)
41
43
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rpdiff
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriel Benmergui
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-26 00:00:00.000000000 Z
11
+ date: 2014-03-13 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A thin wrapper on Perceptual Diff for ease of use.
14
14
  email: gabriel.benmergui@gmail.com