image_compare 1.0.5 → 1.0.7

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
  SHA256:
3
- metadata.gz: a4f15aaf75201eeea7e42796e91f00bb059b9bce5390b85d8f61d3596a94f1c4
4
- data.tar.gz: 4cede23770aa3d38035403aeed400d0cafb764dbf78ac1215a44510537371891
3
+ metadata.gz: 83bfbc6343288b7b1c56f8b96df48e941b67aeb6c70f6628f08c11f0a224a48f
4
+ data.tar.gz: 2fa90cd2bba4c93988c1ca73cb55d29bf44e22d7375a5146f17c9a17597d8219
5
5
  SHA512:
6
- metadata.gz: de19b90cf7387caea0f222c63f9dc132cf8a184f1578954853601bd440b9de0c75da094e1b3c1130eee1739a1cce318a394f0f2649fa16da1f7389461ba89212
7
- data.tar.gz: 812d70bad6990ba71a2a58be872525349a452fa254ec5d75ad8f90558c9af97709681272547c815c79ae9e2fce790cdec102c3ada8bbd465789302b6eb6dd0a7
6
+ metadata.gz: ccdbc41fff4603801acb2ba62c7ee6e13b7b0dbed0e32509625958ac87dc5ab3dfa4e0cfb2aaf61226d52cfbcdd7cc324fb3c8a93a5e526512fa5cf64dc74a67
7
+ data.tar.gz: d0f1c158fe61387fb011ddd1da2265f6636c67799894fa9dec41927b1b6dbd51eb240042f8afaed435f254a49a36aac0112e971911f73e0135eae07330aa2fcd
data/CHANGELOG.md CHANGED
@@ -7,6 +7,8 @@
7
7
  - v1.0.3: Fix documentation ([@gsguma][])
8
8
  - v1.0.4: Fix gem documentation images ([@gsguma][])
9
9
  - v1.0.5: Fix gem documentation ([@gsguma][])
10
+ - v1.0.6: Fix the error when trying to add a rect exclude area that is partially outside the image bounds ([@gsguma][])
11
+ - v1.0.7: Fix all code smells and integration tests ([@gsguma][], [@cristianofmc][])
10
12
 
11
13
  [@gsguma]: https://github.com/gsguma
12
14
  [@cristianofmc]: https://github.com/cristianofmc
data/README.md CHANGED
@@ -1,4 +1,7 @@
1
1
  # ImageCompare
2
+ [<img src="https://shields.io/github/license/instantink/image_compare?color=%2345a34c" />](LICENSE.txt)
3
+ [<img src="https://shields.io/gem/v/image_compare" />](https://rubygems.org/gems/image_compare)
4
+ <img alt="Gem total downloads" src="https://shields.io/gem/dt/image_compare" />
2
5
 
3
6
  Compare PNG images in pure Ruby (uses [ChunkyPNG](https://github.com/wvanbergen/chunky_png)) using different algorithms.
4
7
  This is an utility library for image regression testing.
@@ -30,7 +33,7 @@ ImageCompare supports different ways (_modes_) of comparing images.
30
33
 
31
34
  Source images used in examples:
32
35
 
33
- a1.png
36
+ a.png
34
37
 
35
38
  <img alt="a.png" src="spec/fixtures/a.png" />
36
39
 
@@ -34,12 +34,6 @@ module ImageCompare
34
34
 
35
35
  image_area = Rectangle.new(0, 0, a.width - 1, a.height - 1)
36
36
 
37
- unless mode.exclude_rect.nil?
38
- unless image_area.contains?(mode.exclude_rect)
39
- raise ArgumentError, "Bounds must be in image"
40
- end
41
- end
42
-
43
37
  unless mode.include_rect.nil?
44
38
  unless image_area.contains?(mode.include_rect)
45
39
  raise ArgumentError, "Bounds must be in image"
@@ -16,14 +16,14 @@ module ImageCompare
16
16
  super(**options)
17
17
  end
18
18
 
19
- def diff(bg, diff)
19
+ def diff(bg, _diff)
20
20
  diff_image = bg.highlight_rectangle(exclude_rect, :blue)
21
21
 
22
- if area_in_exclude_rect?
23
- diff_image
24
- else
25
- diff_image.highlight_rectangle(bounds)
22
+ unless result.match? || area_in_exclude_rect?
23
+ return diff_image.highlight_rectangle(bounds, :red)
26
24
  end
25
+
26
+ diff_image
27
27
  end
28
28
 
29
29
  def area_in_exclude_rect?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ImageCompare
4
- VERSION = "1.0.5"
4
+ VERSION = "1.0.7"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: image_compare
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - cristianofmc
@@ -9,22 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-03-29 00:00:00.000000000 Z
12
+ date: 2023-04-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: chunky_png
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - '='
19
19
  - !ruby/object:Gem::Version
20
- version: '1.4'
20
+ version: 1.3.15
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - "~>"
25
+ - - '='
26
26
  - !ruby/object:Gem::Version
27
- version: '1.4'
27
+ version: 1.3.15
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rake
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -91,7 +91,7 @@ licenses:
91
91
  metadata:
92
92
  bug_tracker_uri: https://github.com/instantink/image_compare/issues
93
93
  changelog_uri: https://github.com/instantink/image_compare/blob/master/CHANGELOG.md
94
- documentation_uri: https://www.rubydoc.info/gems/image_compare/1.0.5
94
+ documentation_uri: https://www.rubydoc.info/gems/image_compare/1.0.7
95
95
  homepage_uri: https://github.com/instantink/image_compare
96
96
  source_code_uri: https://github.com/instantink/image_compare
97
97
  post_install_message: