Module: Calabash::Cucumber::StatusBarHelpers
Overview
> Map
Constant Summary
Constants included from Logging
Logging::CALABASH_NO_DEPRECATION
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
Methods included from Logging
#_deprecated, #calabash_info, #calabash_warn, #debug_logging?, #full_console_logging?, #no_deprecation_warnings?
Instance Method Details
#device_orientation(force_down = false) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/calabash-cucumber/status_bar_helpers.rb', line 9 def device_orientation(force_down=false) res = map(nil, :orientation, :device).first if ['face up', 'face down'].include?(res) if full_console_logging? 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
39 40 41 42 |
# File 'lib/calabash-cucumber/status_bar_helpers.rb', line 39 def landscape? o = o.eql?('right') or o.eql?('left') end |
#portrait? ⇒ Boolean
returns true
if orientation is portrait
33 34 35 36 |
# File 'lib/calabash-cucumber/status_bar_helpers.rb', line 33 def portrait? o = o.eql?('up') or o.eql?('down') end |
#status_bar_orientation ⇒ Object
28 29 30 |
# File 'lib/calabash-cucumber/status_bar_helpers.rb', line 28 def map(nil, :orientation, :status_bar).first end |