lib/calabash/android/gestures.rb in calabash-2.0.0.pre11 vs lib/calabash/android/gestures.rb in calabash-2.0.0.prelegacy
- old
+ new
@@ -312,43 +312,59 @@
@offset_y = offset[:y]
end
end
# @!visibility private
- define_method(:_pan_screen_up) do |options={}|
+ def _pan_screen_up(options={})
from = {x: 50, y: 90}
to = {x: 50, y: 10}
pan("* id:'content'", from, to, options)
end
# @!visibility private
- define_method(:_pan_screen_down) do |options={}|
+ def _pan_screen_down(options={})
from = {x: 50, y: 10}
to = {x: 50, y: 90}
pan("* id:'content'", from, to, options)
end
# @!visibility private
- define_method(:_flick_screen_up) do |options={}|
+ def _flick_screen_up(options={})
from = {x: 50, y: 90}
to = {x: 50, y: 10}
flick("* id:'content'", from, to, options)
end
# @!visibility private
- define_method(:_flick_screen_down) do |options={}|
+ def _flick_screen_down(options={})
from = {x: 50, y: 10}
to = {x: 50, y: 90}
flick("* id:'content'", from, to, options)
end
# @!visibility private
- define_method(:_pinch_screen) do |options={}|
- Calabash::Internal.with_default_device(required_os: :android) {|device| device.pinch(direction, "* id:'content'", options)}
+ def _pinch_screen(direction, options={})
+ Device.default.pinch(direction, "* id:'content'", options)
+ end
+
+ # @!visibility private
+ def _pinch_to_zoom(direction, query, options={})
+ if direction == :out
+ Device.default.pinch(:in, query, options)
+ elsif direction == :in
+ Device.default.pinch(:out, query, options)
+ else
+ raise "Invalid direction '#{direction}'"
+ end
+ end
+
+ # @!visibility private
+ def _pinch_screen_to_zoom(direction, options={})
+ _pinch_to_zoom(direction, "* id:'content'", options)
end
end
end
end