Class: Applitools::Appium::Screenshot

Inherits:
EyesScreenshot
  • Object
show all
Defined in:
lib/applitools/appium/screenshot.rb

Direct Known Subclasses

AndroidScreenshot, IosScreenshot

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Screenshot

Returns a new instance of Screenshot.



9
10
11
12
13
14
# File 'lib/applitools/appium/screenshot.rb', line 9

def initialize(*args)
  options = Applitools::Utils.extract_options!(args)
  @status_bar_height = options[:status_bar_height] || 0
  @device_pixel_ratio = options[:device_pixel_ratio] || 1
  super
end

Instance Attribute Details

#device_pixel_ratioObject (readonly)

Returns the value of attribute device_pixel_ratio.



7
8
9
# File 'lib/applitools/appium/screenshot.rb', line 7

def device_pixel_ratio
  @device_pixel_ratio
end

#status_bar_heightObject (readonly)

Returns the value of attribute status_bar_height.



7
8
9
# File 'lib/applitools/appium/screenshot.rb', line 7

def status_bar_height
  @status_bar_height
end

Instance Method Details

#convert_location(location, _from, _to) ⇒ Object



24
25
26
27
# File 'lib/applitools/appium/screenshot.rb', line 24

def convert_location(location, _from, _to)
  raise 'Applitools::Appium::Screenshot is an abstract class.' \
    ' You should implement :convert_location method in a descendant class.'
end

#sub_screenshot(region, _coordinate_type, _throw_if_clipped = false, _force_nil_if_clipped = false) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/applitools/appium/screenshot.rb', line 16

def sub_screenshot(region, _coordinate_type, _throw_if_clipped = false, _force_nil_if_clipped = false)
  self.class.new(
    Applitools::Screenshot.from_image(
      image.crop(region.x, region.y, region.width, region.height)
    )
  )
end