eyes_selenium 1.34.0 → 1.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MDg5ZmMzODY5MjAzMWJlYmY2YjgyMGQ2ZDM5YjFhZjdlYTFkYWZhMg==
4
+ YzEwYjZmOWVkMjcxNzQ3NTNkNGE0NDRmODQ1NTcwOGU1NDM4ZWViOA==
5
5
  data.tar.gz: !binary |-
6
- M2ZlM2FjYTU4ZmZmNjQ1MTdhYzA0YTJhMDkwOTM1NmZiM2VlOWZmMg==
6
+ ZTA3Y2UwM2Q4OTc1MjQwMTMwNjlkZmE3MjUxNmMyZTg1OWM3ZDViNA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OTJjODIwYTdiMzZlZTQzYmExOTBmMzM0MDVkY2ZlZGVkZGY2ZTUyZDliZGVh
10
- MDBjNjgwODU0NWEyMzJkNmNkNGQzNmI0ZmY4ZDg3OTY0ZGE3MTlkZDQ4NDc5
11
- ZDkwYWU0N2NkZThjZTFkNjViY2Y5OGQ0MTZmYmYzZjc4MThiZTA=
9
+ YzNjOWVhYmNhYzZhYmExYTczZjM2OTZjN2U3YmQyNzM5ZTMxYTgxOWI5NzMy
10
+ N2U1NjNhZDI4MjZkN2EyNmRjMjYzNGIwODIzNzQ3NmM3ZDM5NzQ3ZWM1MmY2
11
+ NTA5ZjAyNmMwMjFiYWQyMDI2ZGExZjBlYzVhYjJkNTk0NDlmNmI=
12
12
  data.tar.gz: !binary |-
13
- YTg4N2ZiNjI1NGQ0YjUyZTM5MmI4N2MwNDA1ZDBjOTE3ZjRiNDE1MzljZmEz
14
- ZThjNDU5M2U4MGQ4OTYxNDA2ZWI0YTMwYTBjN2RlODgxMmVlN2VmMzBkOGUy
15
- OTE3MTVkZDRhN2IyOTg0NDBkOWRiMDVhOWFiMDI2ZjVlOTA1OGY=
13
+ MDA0YjljYTNmNmE2MjY1MDRmYWFjODFhMDM0NDNjNThkZTcwYmE1NTg5ZTlm
14
+ OTE5ZmJjZGIwZGJlYTFmZWQwYmM4YmE5Y2VkYjliZWM5NzA3OWMxODc0Yjdk
15
+ YzlhZDJkZTdlMTdiMTZlMjJkZWFkYTZjMTc1NDE3ZjI5NmQzMzA=
@@ -55,6 +55,14 @@ class Applitools::MatchWindowTask
55
55
 
56
56
  private
57
57
 
58
+ def get_clipped_region(region, image)
59
+ left, top = [region.left, 0].max, [region.top, 0].max
60
+ max_width = image.width - left
61
+ max_height = image.height - top
62
+ width, height = [region.width, max_width].min, [region.height, max_height].min
63
+ Applitools::Region.new(left, top, width, height)
64
+ end
65
+
58
66
  def prep_match_data(region, tag, ignore_mismatch)
59
67
  title = eyes.title
60
68
  # 'encoded', as in 'png'.
@@ -62,7 +70,10 @@ class Applitools::MatchWindowTask
62
70
  @current_screenshot = ChunkyPNG::Image.from_blob(current_screenshot_encoded)
63
71
  # If a region was defined, we refer to the sub-image defined by the region.
64
72
  unless region.empty?
65
- @current_screenshot.crop!(region.left, region.top, region.width, region.height)
73
+ # If the region is out of bounds, clip it
74
+ clipped_region = get_clipped_region(region, @current_screenshot)
75
+ raise Applitools::EyesError.new("Region is outside the viewport: #{region}") if clipped_region.empty?
76
+ @current_screenshot.crop!(clipped_region.left, clipped_region.top, clipped_region.width, clipped_region.height)
66
77
  current_screenshot_encoded = @current_screenshot.to_blob.force_encoding('BINARY')
67
78
  end
68
79
  compressed_screenshot = Applitools::Utils::ImageDeltaCompressor.compress_by_raw_blocks(@current_screenshot,
@@ -1,3 +1,3 @@
1
1
  module Applitools
2
- VERSION = '1.34.0'
2
+ VERSION = '1.35.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eyes_selenium
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.34.0
4
+ version: 1.35.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Applitools team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-25 00:00:00.000000000 Z
11
+ date: 2014-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver