image_compare 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a4f15aaf75201eeea7e42796e91f00bb059b9bce5390b85d8f61d3596a94f1c4
4
- data.tar.gz: 4cede23770aa3d38035403aeed400d0cafb764dbf78ac1215a44510537371891
3
+ metadata.gz: 23eba1fc057ba2ec6ad089496b1ba60b6e7b5290cd181c08cc7d413729b83eff
4
+ data.tar.gz: e3adbb49a9da518ce1867ca09ad8272aac9250b0f6d61a524e4a989a00133d57
5
5
  SHA512:
6
- metadata.gz: de19b90cf7387caea0f222c63f9dc132cf8a184f1578954853601bd440b9de0c75da094e1b3c1130eee1739a1cce318a394f0f2649fa16da1f7389461ba89212
7
- data.tar.gz: 812d70bad6990ba71a2a58be872525349a452fa254ec5d75ad8f90558c9af97709681272547c815c79ae9e2fce790cdec102c3ada8bbd465789302b6eb6dd0a7
6
+ metadata.gz: 5179a1d7f11c7189188f2027a092cc5f69050148f94e8947218f3f404aa60f11f1c8b266559b0b1c0363b11f4177b0f3ccec284460c62b777917ca0f73d19ccc
7
+ data.tar.gz: da70a3d2e6e085501fda1d3aac1804d811733eeab02549a6cd7395c5eae6d00369b4e1d90360de34020481acb866e3cc90d3988a50789b006fdc5d7db10cbaa4
data/CHANGELOG.md CHANGED
@@ -7,6 +7,7 @@
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][])
10
11
 
11
12
  [@gsguma]: https://github.com/gsguma
12
13
  [@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"
@@ -19,11 +19,9 @@ module ImageCompare
19
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)
26
- end
22
+ return diff_image if self.result.match?
23
+
24
+ diff_image.highlight_rectangle(bounds) unless area_in_exclude_rect?
27
25
  end
28
26
 
29
27
  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.6"
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.6
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-05 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.6
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: