lib/calabash-cucumber/actions/instruments_actions.rb in calabash-cucumber-0.10.2 vs lib/calabash-cucumber/actions/instruments_actions.rb in calabash-cucumber-0.11.0
- old
+ new
@@ -119,10 +119,20 @@
# @!visibility private
def normalize_rect_for_orientation!(orientation, rect)
orientation = orientation.to_sym
launcher = Calabash::Cucumber::Launcher.launcher
- screen_size = launcher.device.screen_size
+ if launcher.ios_major_version.to_i >= 8
+ return ## Orientation management changed in iOS 8:
+ # ## https://developer.apple.com/library/ios/documentation/UIKit/Reference/UICoordinateSpace_protocol/index.html
+ end
+ dimensions = launcher.device.screen_dimensions
+ if dimensions
+ screen_size = {width: dimensions[:width]*dimensions[:sample]/dimensions[:scale],
+ height: dimensions[:height]*dimensions[:sample]/dimensions[:scale]}
+ else
+ screen_size = launcher.device.screen_size
+ end
case orientation
when :right
cx = rect['center_x']
rect['center_x'] = rect['center_y']
rect['center_y'] = screen_size[:width] - cx
\ No newline at end of file