Class: Applitools::Calabash::FullPageCaptureAlgorithm::AndroidScrollView

Inherits:
Base
  • Object
show all
Includes:
CalabashAndroidScreenshot
Defined in:
lib/applitools/calabash/full_page_capture_algorithm/android_scroll_view.rb

Constant Summary

Constants inherited from Base

Base::DEFAULT_SLEEP_INTERVAL

Instance Attribute Summary

Attributes inherited from Base

#context, #debug_screenshot_provider, #element, #screenshot_provider, #stitched_image

Instance Method Summary collapse

Methods included from CalabashAndroidScreenshot

#calabash_android_screenshot

Constructor Details

#initialize(*args) ⇒ AndroidScrollView

Returns a new instance of AndroidScrollView.



16
17
18
19
20
21
# File 'lib/applitools/calabash/full_page_capture_algorithm/android_scroll_view.rb', line 16

def initialize(*args)
  super
  @entire_content = nil
  @stitched_image = nil
  @original_position = nil
end

Instance Method Details

#get_stitched_region(scroll_to_top = true) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/applitools/calabash/full_page_capture_algorithm/android_scroll_view.rb', line 23

def get_stitched_region(scroll_to_top = true)
  create_entire_image
  store_original_position
  scroll_top if scroll_to_top

  scroll_it! do |scrollable_element|
    put_it_on_canvas!(
      screenshot_provider.capture_screenshot.sub_screenshot(
        eyes_window,
        Applitools::Calabash::EyesCalabashScreenshot::DRIVER,
        false,
        false
      ).image.image,
      element.location.offset_negative(scrollable_element.location)
    )
  end

  restore_original_position

  calabash_android_screenshot(
    Applitools::Screenshot.from_image(stitched_image),
    screenshot_provider.density
  )
end