Class: Capybara::Screenshot::Diff::Difference
- Inherits:
-
Struct
- Object
- Struct
- Capybara::Screenshot::Diff::Difference
- Defined in:
- lib/capybara/screenshot/diff/difference.rb
Instance Attribute Summary collapse
-
#comparison ⇒ Object
Returns the value of attribute comparison.
-
#failed_by ⇒ Object
Returns the value of attribute failed_by.
-
#meta ⇒ Object
Returns the value of attribute meta.
-
#region ⇒ Object
Returns the value of attribute region.
Instance Method Summary collapse
- #area_size_limit ⇒ Object
- #blank? ⇒ Boolean
- #coordinates ⇒ Object
- #different? ⇒ Boolean
- #equal? ⇒ Boolean
- #failed? ⇒ Boolean
- #inspect ⇒ Object
- #options ⇒ Object
- #ratio ⇒ Object
- #region_area_size ⇒ Object
- #skip_area ⇒ Object
- #to_h ⇒ Object
- #tolerable? ⇒ Boolean
- #tolerance ⇒ Object
Instance Attribute Details
#comparison ⇒ Object
Returns the value of attribute comparison
8 9 10 |
# File 'lib/capybara/screenshot/diff/difference.rb', line 8 def comparison @comparison end |
#failed_by ⇒ Object
Returns the value of attribute failed_by
8 9 10 |
# File 'lib/capybara/screenshot/diff/difference.rb', line 8 def failed_by @failed_by end |
#meta ⇒ Object
Returns the value of attribute meta
8 9 10 |
# File 'lib/capybara/screenshot/diff/difference.rb', line 8 def @meta end |
#region ⇒ Object
Returns the value of attribute region
8 9 10 |
# File 'lib/capybara/screenshot/diff/difference.rb', line 8 def region @region end |
Instance Method Details
#area_size_limit ⇒ Object
33 34 35 |
# File 'lib/capybara/screenshot/diff/difference.rb', line 33 def area_size_limit [:area_size_limit] end |
#blank? ⇒ Boolean
37 38 39 |
# File 'lib/capybara/screenshot/diff/difference.rb', line 37 def blank? region.nil? || region_area_size.zero? end |
#coordinates ⇒ Object
53 54 55 |
# File 'lib/capybara/screenshot/diff/difference.rb', line 53 def coordinates region&.to_edge_coordinates end |
#different? ⇒ Boolean
9 10 11 |
# File 'lib/capybara/screenshot/diff/difference.rb', line 9 def different? failed? || !(blank? || tolerable?) end |
#equal? ⇒ Boolean
13 14 15 |
# File 'lib/capybara/screenshot/diff/difference.rb', line 13 def equal? !different? end |
#failed? ⇒ Boolean
17 18 19 |
# File 'lib/capybara/screenshot/diff/difference.rb', line 17 def failed? !!failed_by end |
#inspect ⇒ Object
57 58 59 |
# File 'lib/capybara/screenshot/diff/difference.rb', line 57 def inspect to_h.to_json end |
#options ⇒ Object
21 22 23 |
# File 'lib/capybara/screenshot/diff/difference.rb', line 21 def comparison. end |
#ratio ⇒ Object
45 46 47 |
# File 'lib/capybara/screenshot/diff/difference.rb', line 45 def ratio [:difference_level] end |
#region_area_size ⇒ Object
41 42 43 |
# File 'lib/capybara/screenshot/diff/difference.rb', line 41 def region_area_size region&.size || 0 end |
#skip_area ⇒ Object
29 30 31 |
# File 'lib/capybara/screenshot/diff/difference.rb', line 29 def skip_area [:skip_area] end |
#to_h ⇒ Object
49 50 51 |
# File 'lib/capybara/screenshot/diff/difference.rb', line 49 def to_h {area_size: region_area_size, region: coordinates}.merge!() end |
#tolerable? ⇒ Boolean
61 62 63 |
# File 'lib/capybara/screenshot/diff/difference.rb', line 61 def tolerable? !!((area_size_limit && area_size_limit >= region_area_size) || (tolerance && tolerance >= ratio)) end |
#tolerance ⇒ Object
25 26 27 |
# File 'lib/capybara/screenshot/diff/difference.rb', line 25 def tolerance [:tolerance] end |