looks_good 1.1.3 → 1.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -1
- data/lib/looks_good/capture_element.rb +2 -1
- data/lib/looks_good/configuration.rb +10 -1
- data/lib/looks_good/version.rb +1 -1
- data/lib/looks_good.rb +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2fba65b23577682bcb7a8d3d6160c4a30c3af865a8e9dd4dda173fb847869ed
|
4
|
+
data.tar.gz: 0ed688316367faa212692bf4cfd41c79eafe4a0e65710d716c6bb39ec3d98023
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b45984dc0c77fb299d24fbfb25fcffe2128da936126848572fa6fe97ea65bf5abf31aed2099fe27138e0e300e3904d3cdcfa0e762416f679fa435d87bff33588
|
7
|
+
data.tar.gz: 43ce78bfc4611178bbc6b52fd285a311d230acf5d4819154b1c1587309b94fcbd6bf0c0b7f8b759cab8807029c1cd103e1e50e806d6e80b5bea3339efa43c400
|
data/README.md
CHANGED
@@ -63,6 +63,7 @@ you can override any of the defaults with a config block.
|
|
63
63
|
c.sleep_between_tries = 0.5
|
64
64
|
c.browser_folders = false
|
65
65
|
c.scale_amount = 0.5
|
66
|
+
c.disable_scling = true
|
66
67
|
c.fuzz = "10%"
|
67
68
|
end
|
68
69
|
|
@@ -87,7 +88,13 @@ Also created are subfolders:
|
|
87
88
|
- allows pixels to not need to match exactly. a string percentage value, provided to imagemagick as fuzz value for comparison. default is "10%"
|
88
89
|
|
89
90
|
#### scale_amount
|
90
|
-
- Retina mac screenshots are 2x actual size, so this scales them to be 1:1. default is 0.5
|
91
|
+
- Retina mac screenshots are 2x actual size, so this scales them to be 1:1. default is 0.5.
|
92
|
+
|
93
|
+
#### disable_scaling
|
94
|
+
set to true to disable the scaling behavior
|
95
|
+
|
96
|
+
#### custom_error_message
|
97
|
+
When the spec fails, this message will be appended to the failure.
|
91
98
|
|
92
99
|
#### Sleep_between_tries
|
93
100
|
- sets the sleep time (in seconds) between match tries (requires max_no_tries > 1). Defaults to 0.5
|
@@ -39,7 +39,8 @@ module LooksGood
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def self.crop_element(image, element_to_crop, position)
|
42
|
-
|
42
|
+
image.scale!(LooksGood::Configuration.scale_amount) unless LooksGood::Configuration.disable_scaling
|
43
|
+
cropped_element = image.crop!(position[:x], position[:y], position[:width], position[:height])
|
43
44
|
end
|
44
45
|
|
45
46
|
end
|
@@ -6,7 +6,8 @@ module LooksGood
|
|
6
6
|
class << self
|
7
7
|
|
8
8
|
attr_accessor :fuzz, :reference_image_path, :max_no_tries, :sleep_between_tries,
|
9
|
-
:browser_folders, :default_within, :scale_amount
|
9
|
+
:browser_folders, :default_within, :scale_amount, :disable_scaling,
|
10
|
+
:custom_failure_message
|
10
11
|
|
11
12
|
attr_reader :paths
|
12
13
|
|
@@ -28,6 +29,14 @@ module LooksGood
|
|
28
29
|
@max_no_tries ||= 2
|
29
30
|
end
|
30
31
|
|
32
|
+
def disable_scaling
|
33
|
+
@disable_scaling ||= false
|
34
|
+
end
|
35
|
+
|
36
|
+
def custom_failure_message
|
37
|
+
@custom_failure_message ||= ""
|
38
|
+
end
|
39
|
+
|
31
40
|
def fuzz
|
32
41
|
@fuzz ||= "10%"
|
33
42
|
end
|
data/lib/looks_good/version.rb
CHANGED
data/lib/looks_good.rb
CHANGED
@@ -39,7 +39,9 @@ module LooksGood
|
|
39
39
|
HOW TO FIX:\n
|
40
40
|
- cp #{comparison.diff_image.path(:candidate)} #{@expected_reference_file}
|
41
41
|
or
|
42
|
-
- LOOKS_GOOD=true rspec ...
|
42
|
+
- LOOKS_GOOD=true rspec ...
|
43
|
+
--
|
44
|
+
#{LooksGood::LooksGood::Configuration.custom_failure_message}]
|
43
45
|
result_hash[:result] = false
|
44
46
|
result_hash
|
45
47
|
else
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: looks_good
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Russell Jennings
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-08-
|
11
|
+
date: 2022-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rmagick
|