module Gametel::Platforms::ListItem

Public Instance Methods

get_class(device, class_name) click to toggle source
# File lib/gametel/platforms/brazenhead/list_item.rb, line 37
def get_class(device, class_name)
  device.get_class
  device.for_name class_name, :variable => '@@the_class@@'
end
list_item(locator, &block) click to toggle source
# File lib/gametel/platforms/brazenhead/list_item.rb, line 29
def list_item(locator, &block) 
  chain_calls do |device|
    device.list_item_by_text(locator[:text], :target => 'Brazenhead', :variable => '@@the_view@@') if locator[:text]
    device.list_item_by_index(locator[:index], :target => 'Brazenhead', :variable => '@@the_view@@') if locator[:index]
    block.call device if block
  end
end
list_item_has_image(locator) click to toggle source
# File lib/gametel/platforms/brazenhead/list_item.rb, line 21
def list_item_has_image(locator)
  list_item(locator) do |device|
    get_class(device, 'android.widget.ImageView')
    device.get_current_views('@@the_class@@', '@@the_view@@', :target => 'Robotium')
  end
  last_json[0]['hasDrawable'] if last_json[0]
end
press_list_item(locator) click to toggle source
# File lib/gametel/platforms/brazenhead/list_item.rb, line 7
def press_list_item(locator)
  list = locator[:list] ? locator[:list] : 0
  result = click_in_list(locator[:index] + 1, list) if locator[:index]
  result = click_on_text(locator[:text]) if locator[:text]
end
text_from_list_item(locator) click to toggle source
# File lib/gametel/platforms/brazenhead/list_item.rb, line 13
def text_from_list_item(locator)
  list_item(locator) do |device|
    get_class(device, 'android.widget.TextView')
    device.get_current_views('@@the_class@@', '@@the_view@@', :target => 'Robotium')
  end
  last_json.map { |text_view| text_view['text'] }
end