Class: Applitools::Appium::AndroidScreenshot

Inherits:
Screenshot
  • Object
show all
Defined in:
lib/applitools/appium/android_screenshot.rb

Instance Attribute Summary

Attributes inherited from Screenshot

#device_pixel_ratio, #status_bar_height

Instance Method Summary collapse

Methods inherited from Screenshot

#initialize, #sub_screenshot

Constructor Details

This class inherits a constructor from Applitools::Appium::Screenshot

Instance Method Details

#convert_location(location, _from, _to) ⇒ Object



15
16
17
# File 'lib/applitools/appium/android_screenshot.rb', line 15

def convert_location(location, _from, _to)
  location.offset_negative(Applitools::Location.new(0, status_bar_height))
end

#convert_region_location(region, from, to) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/applitools/appium/android_screenshot.rb', line 5

def convert_region_location(region, from, to)
  # converted_size = region.size.dup.scale_it!(1 / device_pixel_ratio)
  # converted_location = region.location.dup.offset_negative(Applitools::Location.new(0, status_bar_height)).scale_it!(1 / device_pixel_ratio)
  # Applitools::Region.from_location_size(converted_location, converted_size)
  Applitools::Region.from_location_size(
    convert_location(region.location, nil, nil),
    region.size
  ).scale_it!(1.to_f / device_pixel_ratio)
end