Class: Applitools::Selenium::EyesFullPageScreenshot
- Inherits:
-
EyesScreenshot
- Object
- EyesScreenshot
- Applitools::Selenium::EyesFullPageScreenshot
- Defined in:
- lib/applitools/selenium/eyes_full_page_screenshot.rb
Instance Method Summary collapse
- #convert_location(location, _from, _to) ⇒ Object
-
#initialize(*args) ⇒ EyesFullPageScreenshot
constructor
A new instance of EyesFullPageScreenshot.
- #intersected_region(region, _original_coordinate_types, _result_coordinate_types) ⇒ Object
- #location_in_screenshot(location, _coordinate_type) ⇒ Object
- #sub_screenshot(region, coordinate_type, throw_if_clipped = false, force_nil_if_clipped = false) ⇒ Object
Constructor Details
#initialize(*args) ⇒ EyesFullPageScreenshot
Returns a new instance of EyesFullPageScreenshot.
3 4 5 |
# File 'lib/applitools/selenium/eyes_full_page_screenshot.rb', line 3 def initialize(*args) super end |
Instance Method Details
#convert_location(location, _from, _to) ⇒ Object
39 40 41 |
# File 'lib/applitools/selenium/eyes_full_page_screenshot.rb', line 39 def convert_location(location, _from, _to) location end |
#intersected_region(region, _original_coordinate_types, _result_coordinate_types) ⇒ Object
35 36 37 |
# File 'lib/applitools/selenium/eyes_full_page_screenshot.rb', line 35 def intersected_region(region, _original_coordinate_types, _result_coordinate_types) region.intersect Applitools::Region.new(0, 0, image.width, image.height) end |
#location_in_screenshot(location, _coordinate_type) ⇒ Object
43 44 45 |
# File 'lib/applitools/selenium/eyes_full_page_screenshot.rb', line 43 def location_in_screenshot(location, _coordinate_type) location end |
#sub_screenshot(region, coordinate_type, throw_if_clipped = false, force_nil_if_clipped = false) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/applitools/selenium/eyes_full_page_screenshot.rb', line 7 def sub_screenshot(region, coordinate_type, throw_if_clipped = false, force_nil_if_clipped = false) logger.info "get_subscreenshot(#{region}, #{coordinate_type}, #{throw_if_clipped})" Applitools::ArgumentGuard.not_nil region, 'region' Applitools::ArgumentGuard.not_nil coordinate_type, 'coordinate_type' as_is_subscreenshot_region = intersected_region( region, coordinate_type, Applitools::EyesScreenshot::COORDINATE_TYPES[:screenshot_as_is] ) if as_is_subscreenshot_region.empty? || (throw_if_clipped && as_is_subscreenshot_region.size != region.size) return nil if force_nil_if_clipped raise Applitools::OutOfBoundsException.new "Region #{region} (#{coordinate_type}) is out" \ " of screenshot bounds [#{frame_window}]" end sub_screenshot_image = Applitools::Screenshot.from_image( image.crop( as_is_subscreenshot_region.left, as_is_subscreenshot_region.top, as_is_subscreenshot_region.width, as_is_subscreenshot_region.height ) ) result = self.class.new sub_screenshot_image logger.info 'Done!' result end |