Class: Applitools::EyesScreenshot
- Inherits:
-
Object
- Object
- Applitools::EyesScreenshot
- Extended by:
- Helpers, Forwardable
- Defined in:
- lib/applitools/core/eyes_screenshot.rb
Direct Known Subclasses
Constant Summary collapse
- COORDINATE_TYPES =
{ context_as_is: 'CONTEXT_AS_IS', screenshot_as_is: 'SCREENSHOT_AS_IS', context_relative: 'CONTEXT_RELATIVE' }.freeze
Instance Attribute Summary collapse
-
#image ⇒ Object
Returns the value of attribute image.
Instance Method Summary collapse
- #convert_region_location(region, from, to) ⇒ Object
-
#initialize(screenshot) ⇒ EyesScreenshot
constructor
A new instance of EyesScreenshot.
- #sub_screenshots(regions, coordinate_type) ⇒ Object
Methods included from Helpers
abstract_attr_accessor, abstract_method
Constructor Details
#initialize(screenshot) ⇒ EyesScreenshot
Returns a new instance of EyesScreenshot.
15 16 17 18 |
# File 'lib/applitools/core/eyes_screenshot.rb', line 15 def initialize(screenshot) Applitools::ArgumentGuard.is_a? screenshot, 'screenshot', Applitools::Screenshot self.image = screenshot end |
Instance Attribute Details
#image ⇒ Object
Returns the value of attribute image.
7 8 9 |
# File 'lib/applitools/core/eyes_screenshot.rb', line 7 def image @image end |
Instance Method Details
#convert_region_location(region, from, to) ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/applitools/core/eyes_screenshot.rb', line 32 def convert_region_location(region, from, to) Applitools::ArgumentGuard.not_nil region, 'region' Applitools::ArgumentGuard.is_a? region, 'region', Applitools::Region return Region.new(0, 0, 0, 0) if region.empty? Applitools::ArgumentGuard.not_nil from, 'from' Applitools::ArgumentGuard.not_nil to, 'to' updated_location = convert_location(region.location, from, to) Region.new updated_location.x, updated_location.y, region.width, region.height end |
#sub_screenshots(regions, coordinate_type) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/applitools/core/eyes_screenshot.rb', line 25 def sub_screenshots(regions, coordinate_type) Applitools::ArgumentGuard.is_a? regions, 'regions', Enumerable regions.map do |region| sub_screenshot(region, coordinate_type, false, true) end end |