Sha256: ec787c7c61f8822a5ea591900c02a76c16affafc8410452b375c2228e0166434

Contents?: true

Size: 1.76 KB

Versions: 24

Compression:

Stored size: 1.76 KB

Contents

require 'spec_helper'
require 'chunky_png'

describe HighFive::Thor::Tasks::Android do
  include HighFive::TestHelper
  include HighFive::AndroidHelper

  before(:all) do
    create_dummy_app!
    HighFive::Config.configure do |config|
      config.root = @project_root
      config.destination = "www"
      config.platform :android do |android|
        android.destination = 'android/assets/www'
      end
    end
  end

  after(:all) do
    destroy_dummy_app!
  end

  context 'Set icon' do
    let(:drawable_dir) { File.join(@project_root, 'android', 'res') }
    before(:all) do
      cli(HighFive::Thor::Tasks::Android).set_icon File.join(@project_root, 'test_icon.png')
    end

    it 'creates icons for each drawable- folder' do
      valid_directories(drawable_dir).each do |dir|
        file = File.join(dir, 'icon.png')
        expect(file).to exist
      end
    end

    it 'creates default in drawable folder' do
      pending "I don't think this tests the correct behavior, or the dummy app isn't set up properly"
      file = File.join(drawable_dir, 'drawable', 'icon.png')
      expect(file).to exist
    end

    it 'resizes to correct dimensions' do
      valid_directories(drawable_dir).each do |dir|
        res = parse_resolution(dir)
        size = res_map[res]
        file = File.join(dir, 'icon.png')
        image = ChunkyPNG::Image.from_file(file)
        expect(image.dimension.height).to eq size
        expect(image.dimension.width).to eq size
      end
    end
  end

  context "Set version" do
    it 'updates version number' do
      cli(HighFive::Thor::Tasks::Android, version: '2.0').set_version
      manifest = File.read(File.join(@project_root, 'android', 'AndroidManifest.xml'))
      expect(manifest).to match(/android:versionName="2.0"/)
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
high_five-0.3.23 spec/android_tasks_spec.rb
high_five-0.3.22 spec/android_tasks_spec.rb
high_five-0.3.21 spec/android_tasks_spec.rb
high_five-0.3.20 spec/android_tasks_spec.rb
high_five-0.3.19 spec/android_tasks_spec.rb
high_five-0.3.18 spec/android_tasks_spec.rb
high_five-0.3.17 spec/android_tasks_spec.rb
high_five-0.3.16 spec/android_tasks_spec.rb
high_five-0.3.15 spec/android_tasks_spec.rb
high_five-0.3.14 spec/android_tasks_spec.rb
high_five-0.3.13 spec/android_tasks_spec.rb
high_five-0.3.12 spec/android_tasks_spec.rb
high_five-0.3.11 spec/android_tasks_spec.rb
high_five-0.3.10 spec/android_tasks_spec.rb
high_five-0.3.9 spec/android_tasks_spec.rb
high_five-0.3.8 spec/android_tasks_spec.rb
high_five-0.3.7 spec/android_tasks_spec.rb
high_five-0.3.6 spec/android_tasks_spec.rb
high_five-0.3.5 spec/android_tasks_spec.rb
high_five-0.3.4 spec/android_tasks_spec.rb