Module: Calabash::Cucumber::StatusBarHelpers

Includes:
Logging
Included in:
Core
Defined in:
lib/calabash-cucumber/status_bar_helpers.rb

Overview

> Map

Constant Summary

Constants included from Logging

Logging::CALABASH_NO_DEPRECATION

Instance Method Summary collapse

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 rotate_home_button_to :down
  end

  return res unless res.eql?('unknown')
  return res unless force_down
  rotate_home_button_to(:down)
end

#landscape?Boolean

returns true if orientation is landscape

Returns:

  • (Boolean)


39
40
41
42
# File 'lib/calabash-cucumber/status_bar_helpers.rb', line 39

def landscape?
  o = status_bar_orientation
  o.eql?('right') or o.eql?('left')
end

#portrait?Boolean

returns true if orientation is portrait

Returns:

  • (Boolean)


33
34
35
36
# File 'lib/calabash-cucumber/status_bar_helpers.rb', line 33

def portrait?
  o = status_bar_orientation
  o.eql?('up') or o.eql?('down')
end

#status_bar_orientationObject



28
29
30
# File 'lib/calabash-cucumber/status_bar_helpers.rb', line 28

def status_bar_orientation
  map(nil, :orientation, :status_bar).first
end