Class: Applitools::FloatingRegion

Inherits:
Region
  • Object
show all
Defined in:
lib/applitools/core/floating_region.rb

Constant Summary

Constants inherited from Region

Region::EMPTY

Instance Attribute Summary collapse

Attributes inherited from Region

#height, #left, #top, #width

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Region

#bottom, #contains?, #empty?, from_location_size, #intersect, #intersecting?, #location, #location=, #make_empty, #middle_offset, #right, #size, #size_equals?, #sub_regions, sub_regions_with_fixed_size, sub_regions_with_varying_size, #to_s

Constructor Details

#initialize(left, top, width, height, max_left_offset, max_top_offset, max_right_offset, max_bottom_offset) ⇒ FloatingRegion

Returns a new instance of FloatingRegion.



14
15
16
17
18
19
20
# File 'lib/applitools/core/floating_region.rb', line 14

def initialize(left, top, width, height, max_left_offset, max_top_offset, max_right_offset, max_bottom_offset)
  super(left, top, width, height)
  self.max_left_offset = max_left_offset
  self.max_top_offset = max_top_offset
  self.max_right_offset = max_right_offset
  self.max_bottom_offset = max_bottom_offset
end

Instance Attribute Details

#max_bottom_offsetObject

Returns the value of attribute max_bottom_offset.



12
13
14
# File 'lib/applitools/core/floating_region.rb', line 12

def max_bottom_offset
  @max_bottom_offset
end

#max_left_offsetObject

Returns the value of attribute max_left_offset.



12
13
14
# File 'lib/applitools/core/floating_region.rb', line 12

def max_left_offset
  @max_left_offset
end

#max_right_offsetObject

Returns the value of attribute max_right_offset.



12
13
14
# File 'lib/applitools/core/floating_region.rb', line 12

def max_right_offset
  @max_right_offset
end

#max_top_offsetObject

Returns the value of attribute max_top_offset.



12
13
14
# File 'lib/applitools/core/floating_region.rb', line 12

def max_top_offset
  @max_top_offset
end

Class Method Details

.for_element(element, max_left_offset, max_top_offset, max_right_offset, max_bottom_offset) ⇒ Object



5
6
7
8
9
# File 'lib/applitools/core/floating_region.rb', line 5

def for_element(element, max_left_offset, max_top_offset, max_right_offset, max_bottom_offset)
  Applitools::ArgumentGuard.is_a? element, 'element', Applitools::Selenium::Element
  new element.location.x, element.location.y, element.size.width, element.size.height, max_left_offset,
    max_top_offset, max_right_offset, max_bottom_offset
end

Instance Method Details

#to_hashObject



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/applitools/core/floating_region.rb', line 22

def to_hash
  {
    'Top' => top,
    'Left' => left,
    'Width' => width,
    'Height' => height,
    'MaxUpOffset' => max_top_offset,
    'MaxLeftOffset' => max_left_offset,
    'MaxRightOffset' => max_right_offset,
    'MaxDownOffset' => max_bottom_offset
  }
end