Sha256: a0d5b6ceac30e18f9e47a29a294a6c8a3e1b3a792af86a2b593a38d562c9fc31

Contents?: true

Size: 1.06 KB

Versions: 10

Compression:

Stored size: 1.06 KB

Contents

module Calabash
  module Cucumber
    module StatusBarHelpers #=> Map

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

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

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

      # returns +true+ if orientation is portrait
      def portrait?
        o = status_bar_orientation
        o.eql?('up') or o.eql?('down')
      end

      # returns +true+ if orientation is landscape
      def landscape?
        o = status_bar_orientation
        o.eql?('right') or o.eql?('left')
      end

    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
calabash-cucumber-0.9.169.pre2 lib/calabash-cucumber/status_bar_helpers.rb
calabash-cucumber-0.9.168 lib/calabash-cucumber/status_bar_helpers.rb
calabash-cucumber-0.9.168.pre6 lib/calabash-cucumber/status_bar_helpers.rb
calabash-cucumber-0.9.168.pre5 lib/calabash-cucumber/status_bar_helpers.rb
calabash-cucumber-0.9.168.pre4 lib/calabash-cucumber/status_bar_helpers.rb
calabash-cucumber-0.9.167 lib/calabash-cucumber/status_bar_helpers.rb
calabash-cucumber-0.9.166 lib/calabash-cucumber/status_bar_helpers.rb
calabash-cucumber-0.9.165 lib/calabash-cucumber/status_bar_helpers.rb
calabash-cucumber-0.9.164 lib/calabash-cucumber/status_bar_helpers.rb
calabash-cucumber-0.9.163 lib/calabash-cucumber/status_bar_helpers.rb