Module: Calabash::Cucumber::StatusBarHelpers
- Included in:
- Core
- Defined in:
- lib/calabash-cucumber/status_bar_helpers.rb
Overview
> Map
Instance Method Summary collapse
- #device_orientation(force_down = false) ⇒ Object
-
#landscape? ⇒ Boolean
returns
true
if orientation is landscape. -
#portrait? ⇒ Boolean
returns
true
if orientation is portrait. - #status_bar_orientation ⇒ Object
Instance Method Details
#device_orientation(force_down = false) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/calabash-cucumber/status_bar_helpers.rb', line 5 def device_orientation(force_down=false) res = map(nil, :orientation, :device).first if ['face up', 'face down'].include?(res) if ENV['CALABASH_FULL_CONSOLE_OUTPUT'] == '1' if force_down puts "WARN found orientation '#{res}' - will rotate to force orientation to 'down'" end end return res unless force_down return :down end return res unless res.eql?('unknown') return res unless force_down (:down) end |
#landscape? ⇒ Boolean
returns true
if orientation is landscape
35 36 37 38 |
# File 'lib/calabash-cucumber/status_bar_helpers.rb', line 35 def landscape? o = o.eql?('right') or o.eql?('left') end |
#portrait? ⇒ Boolean
returns true
if orientation is portrait
29 30 31 32 |
# File 'lib/calabash-cucumber/status_bar_helpers.rb', line 29 def portrait? o = o.eql?('up') or o.eql?('down') end |
#status_bar_orientation ⇒ Object
24 25 26 |
# File 'lib/calabash-cucumber/status_bar_helpers.rb', line 24 def map(nil, :orientation, :status_bar).first end |