Sha256: 7251a75c18d44d1d9c1fd5ce358008637f1288001fe24487da8a74b164ef47bf

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 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

        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

3 entries across 3 versions & 1 rubygems

Version Path
headdesk-0.3.0 lib/headdesk/checks/teak/api21_icon.rb
headdesk-0.2.0 lib/headdesk/checks/teak/api21_icon.rb
headdesk-0.1.0 lib/headdesk/checks/teak/api21_icon.rb