Method: Cukunity::Android::TouchInput.touch_screen

Defined in:
lib/cukunity/drivers/android/touch_input.rb

.touch_screen(options) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/cukunity/drivers/android/touch_input.rb', line 7

def self.touch_screen(options)
  options = merge_options(options, { :x => 0, :y => 0, :type => :tap })
  wait = (options.delete(:wait) || 0.1).to_f
  options[:x] = options[:x].to_i
  options[:y] = options[:y].to_i
  prefix = 
    if options[:type] == :tap
      "tap"
    else
      "touch #{type}"
    end
  req = %Q[#{prefix} #{options[:x]} #{options[:y]}]
  monkey.command(req)
  sleep(wait) unless wait.nil? or wait <= 0
end