capybara-screenshot-diff 0.11.1 → 0.11.2
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1d58c9045025d9f38006f766e9ecfaec712dd2d
|
4
|
+
data.tar.gz: 301b53140c0e2feccf839f4331afdcc8ac3edf3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db1b86f92fcb0b5818de4643fd69e3cb69ddd17a403da0b521b97c24f7c0629bcf949195dc1f6c0d760cd7571e84f03a8aa7ca49376d6bb9127f19507021d129
|
7
|
+
data.tar.gz: eab2ca743e989c83f9974811d3e6069387e0b0d55a43135c73d3b11010f7bbfb7873dfc17b778a335cf64201e88024b4e657c5e639cdbaa1463f7427a2d59ec5
|
data/.rubocop_todo.yml
CHANGED
@@ -8,17 +8,17 @@
|
|
8
8
|
|
9
9
|
# Offense count: 12
|
10
10
|
Metrics/AbcSize:
|
11
|
-
Max:
|
11
|
+
Max: 55
|
12
12
|
|
13
13
|
# Offense count: 1
|
14
14
|
# Configuration parameters: CountComments, ExcludedMethods.
|
15
15
|
Metrics/BlockLength:
|
16
|
-
Max:
|
16
|
+
Max: 43
|
17
17
|
|
18
18
|
# Offense count: 1
|
19
19
|
# Configuration parameters: CountComments.
|
20
20
|
Metrics/ClassLength:
|
21
|
-
Max:
|
21
|
+
Max: 283
|
22
22
|
|
23
23
|
# Offense count: 6
|
24
24
|
Metrics/CyclomaticComplexity:
|
@@ -27,7 +27,7 @@ Metrics/CyclomaticComplexity:
|
|
27
27
|
# Offense count: 16
|
28
28
|
# Configuration parameters: CountComments.
|
29
29
|
Metrics/MethodLength:
|
30
|
-
Max:
|
30
|
+
Max: 48
|
31
31
|
|
32
32
|
# Offense count: 1
|
33
33
|
# Configuration parameters: CountComments.
|
@@ -41,7 +41,7 @@ Metrics/ParameterLists:
|
|
41
41
|
|
42
42
|
# Offense count: 6
|
43
43
|
Metrics/PerceivedComplexity:
|
44
|
-
Max:
|
44
|
+
Max: 15
|
45
45
|
|
46
46
|
# Offense count: 2
|
47
47
|
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
|
@@ -40,7 +40,7 @@ module Capybara
|
|
40
40
|
old_bytes, new_bytes = load_image_files(@old_file_name, @new_file_name)
|
41
41
|
return true if old_bytes == new_bytes
|
42
42
|
images = load_images(old_bytes, new_bytes)
|
43
|
-
old_bytes = new_bytes = nil
|
43
|
+
old_bytes = new_bytes = nil # rubocop: disable Lint/UselessAssignment
|
44
44
|
crop_images(images, @dimensions) if @dimensions
|
45
45
|
|
46
46
|
return false if sizes_changed?(*images)
|
@@ -91,7 +91,6 @@ module Capybara
|
|
91
91
|
@left, @top, @right, @bottom = find_diff_rectangle(old_img, new_img)
|
92
92
|
|
93
93
|
return not_different if @top.nil?
|
94
|
-
|
95
94
|
return not_different if @area_size_limit && size <= @area_size_limit
|
96
95
|
|
97
96
|
annotated_old_img, annotated_new_img = draw_rectangles(images, @bottom, @left, @right, @top)
|
@@ -255,18 +254,18 @@ module Capybara
|
|
255
254
|
def same_color?(old_img, new_img, x, y)
|
256
255
|
color_distance =
|
257
256
|
color_distance_at(new_img, old_img, x, y, shift_distance_limit: @shift_distance_limit)
|
258
|
-
shift_distance =
|
259
|
-
shift_distance_at(new_img, old_img, x, y, color_distance_limit: @color_distance_limit)
|
260
257
|
if !@max_color_distance || color_distance > @max_color_distance
|
261
258
|
@max_color_distance = color_distance
|
262
259
|
end
|
263
|
-
|
260
|
+
color_matches = color_distance == 0 || (@color_distance_limit && @color_distance_limit > 0 &&
|
261
|
+
color_distance <= @color_distance_limit)
|
262
|
+
return color_matches unless @shift_distance_limit
|
263
|
+
shift_distance =
|
264
|
+
shift_distance_at(new_img, old_img, x, y, color_distance_limit: @color_distance_limit)
|
265
|
+
if shift_distance && (@max_shift_distance.nil? || shift_distance > @max_shift_distance)
|
264
266
|
@max_shift_distance = shift_distance
|
265
267
|
end
|
266
|
-
|
267
|
-
color_distance <= @color_distance_limit)) &&
|
268
|
-
(shift_distance == 0 || (@shift_distance_limit && @shift_distance_limit > 0 &&
|
269
|
-
shift_distance <= @shift_distance_limit))
|
268
|
+
color_matches
|
270
269
|
end
|
271
270
|
|
272
271
|
def color_distance_at(new_img, old_img, x, y, shift_distance_limit:)
|
@@ -285,8 +284,7 @@ module Capybara
|
|
285
284
|
end
|
286
285
|
distances.min
|
287
286
|
else
|
288
|
-
|
289
|
-
ChunkyPNG::Color.euclidean_distance_rgba(org_color, new_color)
|
287
|
+
ChunkyPNG::Color.euclidean_distance_rgba(org_color, new_img[x, y])
|
290
288
|
end
|
291
289
|
end
|
292
290
|
|
@@ -337,7 +335,6 @@ module Capybara
|
|
337
335
|
end
|
338
336
|
break if bounds_breached == 4
|
339
337
|
shift_distance += 1
|
340
|
-
# puts "Bumped shift_distance to #{shift_distance}"
|
341
338
|
end
|
342
339
|
nil
|
343
340
|
end
|
@@ -346,10 +343,6 @@ module Capybara
|
|
346
343
|
new_color = new_img[dx, dy]
|
347
344
|
return new_color == org_color unless color_distance_limit
|
348
345
|
color_distance = ChunkyPNG::Color.euclidean_distance_rgba(org_color, new_color)
|
349
|
-
# if color_distance > 0
|
350
|
-
# puts "color_distance: #{dx} #{dy} #{color_distance} #{color_distance_limit} " \
|
351
|
-
# "#{color_distance <= color_distance_limit}"
|
352
|
-
# end
|
353
346
|
color_distance <= color_distance_limit
|
354
347
|
end
|
355
348
|
end
|
@@ -108,9 +108,10 @@ module Capybara
|
|
108
108
|
end
|
109
109
|
# ODOT
|
110
110
|
|
111
|
+
max_shift_distance = comparison.max_shift_distance
|
111
112
|
"Screenshot does not match for '#{name}' (area: #{comparison.size}px #{comparison.dimensions}" \
|
112
113
|
", max_color_distance: #{max_color_distance}" \
|
113
|
-
", max_shift_distance: #{
|
114
|
+
"#{", max_shift_distance: #{max_shift_distance}" if max_shift_distance})\n" \
|
114
115
|
"#{comparison.new_file_name}\n#{comparison.annotated_old_file_name}\n" \
|
115
116
|
"#{comparison.annotated_new_file_name}\n" \
|
116
117
|
"at #{caller}"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capybara-screenshot-diff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Uwe Kubosch
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08-
|
11
|
+
date: 2018-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|