Class: Applitools::ImageMatchSettings
Defined Under Namespace
Classes: Exact
Instance Method Summary
collapse
#match_level_with_exact
Methods included from Jsonable
included, #json, #json_data
Constructor Details
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_validation ⇒ Object
52
53
54
|
# File 'lib/applitools/core/image_match_settings.rb', line 52
def accessibility_validation
accessibility_settings
end
|
#accessibility_validation=(value) ⇒ Object
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_dup ⇒ Object
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
|
#to_hash ⇒ Object
export type MatchSettings<TRegion> = {
exact?: {
minDiffIntensity: number
minDiffWidth: number
minDiffHeight: number
matchThreshold: number
}
matchLevel?: MatchLevel
sendDom?: boolean
useDom?: boolean
enablePatterns?: boolean
ignoreCaret?: boolean
ignoreDisplacements?: boolean
accessibilitySettings?: {
level?: AccessibilityLevel
guidelinesVersion?: AccessibilityGuidelinesVersion
}
ignoreRegions?: TRegion[]
layoutRegions?: TRegion[]
strictRegions?: TRegion[]
contentRegions?: TRegion[]
floatingRegions?: (TRegion | FloatingRegion<TRegion>)[]
accessibilityRegions?: (TRegion | AccessibilityRegion<TRegion>)[]
}
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
# File 'lib/applitools/core/image_match_settings.rb', line 136
def to_hash
result = {}
result[:exact] = exact.to_hash unless exact == Exact.new result[:matchLevel] = match_level
result[:useDom] = use_dom if use_dom
result[:enablePatterns] = enable_patterns if enable_patterns
result[:ignoreCaret] = ignore_caret if ignore_caret
result[:ignoreDisplacements] = ignore_displacements if ignore_displacements
result[:accessibilitySettings] = accessibility_settings.to_hash if accessibility_settings
result[:ignoreRegions] = ignore unless ignore.empty?
result[:layoutRegions] = layout unless layout.empty?
result[:strictRegions] = strict unless strict.empty?
result[:contentRegions] = content unless content.empty?
result[:floatingRegions] = floating unless floating.empty?
result[:accessibilityRegions] = accessibility unless accessibility.empty?
result.compact
end
|