Class: Applitools::ImageMatchSettings

Inherits:
Object
  • Object
show all
Includes:
Jsonable, MatchLevelSetter
Defined in:
lib/applitools/core/image_match_settings.rb

Defined Under Namespace

Classes: Exact

Instance Method Summary collapse

Methods included from MatchLevelSetter

#match_level_with_exact

Methods included from Jsonable

included, #json, #json_data

Constructor Details

#initializeImageMatchSettings

Returns a new instance of ImageMatchSettings.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/applitools/core/image_match_settings.rb', line 13

def initialize
  self.accessibility_settings = nil
  self.match_level = Applitools::MatchLevel::STRICT
  self.split_top_height = 0
  self.split_bottom_height = 0
  self.ignore_caret = true
  self.ignore_displacements = false
  self.accessibility = []
  self.ignore = []
  self.floating = []
  self.layout = []
  self.strict = []
  self.content = []
  self.exact = Exact.new
  self.scale = 0
  self.remainder = 0
  self.enable_patterns = false
  self.use_dom = false
end

Instance Method Details

#==(other) ⇒ Object



61
62
63
64
65
66
67
68
69
# File 'lib/applitools/core/image_match_settings.rb', line 61

def ==(other)
  return true if other.object_id == object_id
  result = true
  self.class.json_methods.keys.each do |f|
    result = send(f) == other.send(f)
    break unless result
  end
  result
end

#accessibility_validationObject



52
53
54
# File 'lib/applitools/core/image_match_settings.rb', line 52

def accessibility_validation
  accessibility_settings
end

#accessibility_validation=(value) ⇒ Object

Raises:

  • (Applitools::EyesIllegalArgument)


56
57
58
59
# File 'lib/applitools/core/image_match_settings.rb', line 56

def accessibility_validation=(value)
  raise Applitools::EyesIllegalArgument, "Expected value to be an Applitools::AccessibilitySettings instance but got #{value.class}" unless value.nil? || value.is_a?(Applitools::AccessibilitySettings)
  self.accessibility_settings = value
end

#deep_dupObject Also known as: deep_clone



38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/applitools/core/image_match_settings.rb', line 38

def deep_dup
  cloned_value = self.class.new
  self.class.json_methods.keys.each do |f|
    new_value = case (v = send(f))
                when Symbol, FalseClass, TrueClass, Integer, Float, NilClass
                  v
                else
                  v.clone
                end
    cloned_value.send("#{f}=", new_value)
  end
  cloned_value
end

#set_match_level(value, exact_options = {}) ⇒ Object



33
34
35
36
# File 'lib/applitools/core/image_match_settings.rb', line 33

def set_match_level(value, exact_options = {})
  (self.match_level, self.exact) = match_level_with_exact(value, exact_options)
  match_level
end