lib/gametel.rb in gametel-0.5 vs lib/gametel.rb in gametel-0.5.1
- old
+ new
@@ -1,14 +1,18 @@
require 'gametel/accessors'
require 'gametel/navigation'
require 'gametel/version'
require 'gametel/platforms/brazenhead_platform'
+require 'gametel/views'
module Gametel
attr_reader :platform
+ ROBOTIUM_LEFT = 21
+ ROBOTIUM_RIGHT = 22
+
def self.included(cls)
cls.extend Gametel::Accessors
end
def initialize(pform = :brazenhead)
@@ -42,10 +46,27 @@
def back
platform.back
end
#
+ # Go back to a specific activity
+ #
+ def back_to(activity)
+ platform.go_back_to_activity activity
+ end
+
+ def current_activity
+ platform.chain_calls do |device|
+ device.get_current_activity
+ device.get_class
+ device.get_simple_name
+ end
+
+ platform.last_response.body.gsub('"','')
+ end
+
+ #
# Press the enter key
#
def enter
platform.enter
end
@@ -60,9 +81,23 @@
#
# scroll up
#
def scroll_up
platform.scroll_up
+ end
+
+ #
+ # scroll left
+ #
+ def scroll_left
+ platform.scroll_to_side ROBOTIUM_LEFT
+ end
+
+ #
+ # scroll right
+ #
+ def scroll_right
+ platform.scroll_to_side ROBOTIUM_RIGHT
end
#
# Wait for the provided text to appear
#