Skip to content

swipe proffers use of delta_x, delta_y instead of end_x, end_y which … #380

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 16, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/appium_lib/common/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Appium
# Version and Date are defined on the 'Appium' module, not 'Appium::Common'
VERSION = '8.0.2' unless defined? ::Appium::VERSION
DATE = '2016-01-29' unless defined? ::Appium::DATE
VERSION = '8.0.3' unless defined? ::Appium::VERSION
DATE = '2016-10-12' unless defined? ::Appium::DATE
end
24 changes: 19 additions & 5 deletions lib/appium_lib/device/touch_actions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,19 +120,33 @@ def wait(milliseconds)
#
# @option opts [int] :start_x Where to start swiping, on the x axis. Default 0.
# @option opts [int] :start_y Where to start swiping, on the y axis. Default 0.
# @option opts [int] :end_x Where to end swiping, on the x axis. Default 0.
# @option opts [int] :end_y Where to end swiping, on the y axis. Default 0.
# @option opts [int] :delta_x The distance from start to move, on the x axis. Default 0.
# @option opts [int] :delta_y The distance from start to move, on the y axis. Default 0.
# @option opts [int] :duration How long the actual swipe takes to complete in milliseconds. Default 200.
# @deprecated Please do not use end_x, end_y anymore
def swipe(opts)
start_x = opts.fetch :start_x, 0
start_y = opts.fetch :start_y, 0
end_x = opts.fetch :end_x, 0
end_y = opts.fetch :end_y, 0
delta_x = opts.fetch :delta_x, nil
delta_y = opts.fetch :delta_y, nil
end_x = opts.fetch :end_x, nil
end_y = opts.fetch :end_y, nil

if end_x || end_y
warn '[DEPRECATION] `end_x` and `end_y` are deprecated. Please use `delta_x` and `delta_y` instead.'
end

delta_x ||= end_x
delta_y ||= end_y

delta_x ||= 0
delta_y ||= 0

duration = opts.fetch :duration, 200

press x: start_x, y: start_y
wait(duration) if duration
move_to x: end_x, y: end_y
move_to x: delta_x, y: delta_y
release
self
end
Expand Down