Sha256: 2b1fefc342911bab51d36a1cc73b7aa448a36fe8886fe1535fc55706e894b502

Contents?: true

Size: 1.05 KB

Versions: 7

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

module Headdesk
  module Checks
    module Teak
      #
      # Check to make sure that an APK, which uses Teak, has an API 21+ icon.
      #
      class Api21Icon
        include Checks::Teak::APK

        check_name 'api21_icon'
        describe 'Check for API 21+ Teak icons'
        # :reek:UncommunicativeVariableName { accept: ['icon_v21'] }
        def call
          skip_check if: -> { apk.min_sdk 21 }

          icon = apk.resources
                    .values(v: 20)
                    .drawable.io_teak_small_notification_icon
          icon_v21 = apk.resources
                        .values(v: 21)
                        .drawable.io_teak_small_notification_icon
          export icon: icon, icon_v21: icon_v21

          describe "APK contains a drawable for 'io_teak_small_notification_icon'"
          fail_check unless: -> { icon && icon_v21 }

          describe "'io_teak_small_notification_icon' for v21 is different from < v21"
          fail_check unless: -> { icon != icon_v21 }
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
headdesk-0.8.0 lib/headdesk/checks/teak/api21_icon.rb
headdesk-0.7.0 lib/headdesk/checks/teak/api21_icon.rb
headdesk-0.6.0 lib/headdesk/checks/teak/api21_icon.rb
headdesk-0.5.2 lib/headdesk/checks/teak/api21_icon.rb
headdesk-0.5.1 lib/headdesk/checks/teak/api21_icon.rb
headdesk-0.5.0 lib/headdesk/checks/teak/api21_icon.rb
headdesk-0.4.0 lib/headdesk/checks/teak/api21_icon.rb