web_image_compare 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 946232f6d4774b842da3cf33c43af3f6a5bc6e03
4
- data.tar.gz: 822d61b410e368b681d88fa65a8b14df8db39fb4
3
+ metadata.gz: 4845598c0a82448f38db553936242d84e01322b6
4
+ data.tar.gz: 8ac6d3d491256a6e881eb8519653fbadea8b221e
5
5
  SHA512:
6
- metadata.gz: e28570f844338d4312feb12d572e25c3908db9b8ffa4b729e0d0d9a53bac72ce4a1d93cc5fbdcfaa5cf082a4183c4d66639c49323ddb19601ef09af937ec68cc
7
- data.tar.gz: 7f6553c1f8f48dd2ac0f8f1e6ff6639604af1518a5eb7b5ecc9943086fce76a9189c2e639087afe0aa5148db7ead6fc16adb0bc64a7dabf08f1093e350807431
6
+ metadata.gz: b7c379bda5dcded22943eef2791eda7a96e3298427ccbc68e0ca1e3c45883c544ef19fd82425f74e4109f1432fcfd36f207a53b89b71fff100eef941472cf640
7
+ data.tar.gz: e16d174ce0f21506d663bdde87cfaf90d0ddaa36f47990035986e34afa33a399a0c1acb6bf7669b023b102a5bb17114d64994d76471169f2c7e6f58bc8f8054e
@@ -3,8 +3,6 @@ module ChunkyPNG
3
3
  class Canvas
4
4
  # Module operations
5
5
  module Operations
6
- include ChunkyPNG::Color
7
-
8
6
  # Performs the image comparison pixel by pixel
9
7
  #
10
8
  # @param [String] result_img complete path to where is intended save the image
@@ -35,7 +33,7 @@ module ChunkyPNG
35
33
 
36
34
  def pixel_difference(pixel_1, pixel_2)
37
35
  Math.sqrt(
38
- (r(pixel_1) - r(pixel_2))**2 +
36
+ (r(pixel_1) - Color.r(pixel_2))**2 +
39
37
  (g(pixel_1) - g(pixel_2))**2 +
40
38
  (b(pixel_1) - b(pixel_2))**2
41
39
  ) / Math.sqrt(MAX**2 * 3)
@@ -2,7 +2,7 @@ module CmpImgTool
2
2
  # BW config api Version
3
3
  module Version
4
4
  # The current gem version
5
- VERSION = '0.0.1'
5
+ VERSION = '0.0.2'
6
6
  # The date version was updated
7
7
  DATE = '2016-02-03'
8
8
  # Debug output that will contain ruby information
@@ -1,9 +1,9 @@
1
- require 'chunky_png'
1
+ require 'oily_png'
2
2
  require_relative 'chunky_png/operations'
3
+ include ChunkyPNG::Color
3
4
 
4
5
  # Compare image class
5
6
  class WebImageCompare
6
- include ChunkyPNG::Color
7
7
 
8
8
  # initialize the object with the path for the two images
9
9
  #
@@ -1,4 +1,4 @@
1
- require 'web_image_compare'
1
+ require_relative '../lib/web_image_compare'
2
2
 
3
3
  describe WebImageCompare do
4
4
  describe '.new' do
@@ -15,4 +15,13 @@ describe WebImageCompare do
15
15
  compare_image.process_image(false, {}).should eq(0.0)
16
16
  end
17
17
  end
18
+
19
+ describe '.process_image' do
20
+ it 'The images don\'t match' do
21
+ image_path_1 = File.dirname(__FILE__) + '/images/example_image.png'
22
+ image_path_2 = File.dirname(__FILE__) + '/images/example_image_2.png'
23
+ compare_image = WebImageCompare.new(image_path_1, image_path_2)
24
+ compare_image.process_image(false, {}).should_not eq(0.0)
25
+ end
26
+ end
18
27
  end
@@ -23,6 +23,7 @@ Gem::Specification.new do |s|
23
23
  s.add_development_dependency 'rspec', '~> 3.0', '>= 3.0.0'
24
24
  s.add_development_dependency 'rubocop', '~> 0.24', '>= 0.24.1'
25
25
  s.add_development_dependency 'rake', '~> 10.4'
26
+ s.add_development_dependency 'pry', '~> 0.10'
26
27
  s.add_development_dependency 'yard', '~> 0.8'
27
28
 
28
29
  s.add_runtime_dependency 'oily_png', '~> 1.2'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web_image_compare
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rui Nunes
@@ -64,6 +64,20 @@ dependencies:
64
64
  - - "~>"
65
65
  - !ruby/object:Gem::Version
66
66
  version: '10.4'
67
+ - !ruby/object:Gem::Dependency
68
+ name: pry
69
+ requirement: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - "~>"
72
+ - !ruby/object:Gem::Version
73
+ version: '0.10'
74
+ type: :development
75
+ prerelease: false
76
+ version_requirements: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - "~>"
79
+ - !ruby/object:Gem::Version
80
+ version: '0.10'
67
81
  - !ruby/object:Gem::Dependency
68
82
  name: yard
69
83
  requirement: !ruby/object:Gem::Requirement