Module: Cukunity::Android::TouchInput

Extended by:
Utils, TouchInputMethods
Defined in:
lib/cukunity/drivers/android/touch_input.rb

Constant Summary

Constants included from TouchInputMethods

TouchInputMethods::DEFAULT_TAP_DELAY

Class Method Summary collapse

Methods included from Utils

adb, launchable_activity_name, monkey, package_name, shell

Methods included from Utils

#check_timeout, #merge_options, #restrict_options, #to_options, #wait_connectivity

Methods included from TouchInputMethods

default_tap_delay, default_tap_delay=, set_default_tap_delay

Class Method Details

.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