Skip to content

Commit

Permalink
Bump 1.0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
guma committed Apr 6, 2023
1 parent b0d3f88 commit 670c8ec
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- v1.0.4: Fix gem documentation images ([@gsguma][])
- v1.0.5: Fix gem documentation ([@gsguma][])
- v1.0.6: Fix the error when trying to add a rect exclude area that is partially outside the image bounds ([@gsguma][])
- v1.0.7: Fix all code smells and integration tests ([@gsguma][], [@cristianofmc][])

[@gsguma]: https://github.com/gsguma
[@cristianofmc]: https://github.com/cristianofmc
8 changes: 5 additions & 3 deletions lib/image_compare/modes/color.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ def initialize(**options)
super(**options)
end

def diff(bg, diff)
def diff(bg, _diff)
diff_image = bg.highlight_rectangle(exclude_rect, :blue)

return diff_image if self.result.match?
unless result.match? || area_in_exclude_rect?
return diff_image.highlight_rectangle(bounds, :red)
end

diff_image.highlight_rectangle(bounds) unless area_in_exclude_rect?
diff_image
end

def area_in_exclude_rect?
Expand Down
2 changes: 1 addition & 1 deletion lib/image_compare/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module ImageCompare
VERSION = "1.0.6"
VERSION = "1.0.7"
end
4 changes: 2 additions & 2 deletions spec/matcher_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@

context "with negative exclude rect bounds" do
let(:options) { {exclude_rect: [-1, -1, -1, -1]} }
it { expect { subject }.to raise_error ArgumentError }
it { expect(subject).to be_a ImageCompare::Result }
end

context "with big exclude rect bounds" do
let(:options) { {exclude_rect: [100, 100, 100, 100]} }
it { expect { subject }.to raise_error ArgumentError }
it { expect(subject).to be_a ImageCompare::Result }
end

context "with negative include rect bounds" do
Expand Down

0 comments on commit 670c8ec

Please sign in to comment.