Skip to content

Commit

Permalink
Add test classes and images
Browse files Browse the repository at this point in the history
  • Loading branch information
ebelair committed Apr 21, 2019
1 parent 84ccd0e commit 177bece
Show file tree
Hide file tree
Showing 25 changed files with 72 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--color
--require spec_helper
15 changes: 15 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ GEM
highline (~> 1.7.2)
declarative (0.0.10)
declarative-option (0.1.0)
diff-lcs (1.3)
digest-crc (0.4.1)
domain_name (0.5.20180417)
unf (>= 0.0.5, < 1.0.0)
Expand Down Expand Up @@ -121,6 +122,19 @@ GEM
uber (< 0.2.0)
retriable (3.1.2)
rouge (2.0.7)
rspec (3.4.0)
rspec-core (~> 3.4.0)
rspec-expectations (~> 3.4.0)
rspec-mocks (~> 3.4.0)
rspec-core (3.4.4)
rspec-support (~> 3.4.0)
rspec-expectations (3.4.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.4.0)
rspec-mocks (3.4.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.4.0)
rspec-support (3.4.1)
rubyzip (1.2.2)
security (0.1.3)
signet (0.11.0)
Expand Down Expand Up @@ -161,6 +175,7 @@ PLATFORMS

DEPENDENCIES
icon-banner!
rspec (~> 3.4.0)

BUNDLED WITH
1.16.4
2 changes: 2 additions & 0 deletions icon-banner.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ Gem::Specification.new do |spec|

spec.add_dependency 'fastlane', '>= 2.100.0'
spec.add_dependency 'mini_magick', '>= 4.5.1'

spec.add_development_dependency 'rspec', '~> 3.4.0'
end
Binary file added spec/Reference/facetime_Daily.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added spec/Reference/facetime_Production.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added spec/Reference/facetime_QA.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added spec/Reference/facetime_Staging.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added spec/Reference/ibooks_Daily.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added spec/Reference/ibooks_Production.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added spec/Reference/ibooks_QA.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added spec/Reference/ibooks_Staging.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added spec/Reference/podcasts_Daily.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added spec/Reference/podcasts_Production.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added spec/Reference/podcasts_QA.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added spec/Reference/podcasts_Staging.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added spec/Reference/testflight_Daily.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added spec/Reference/testflight_Production.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added spec/Reference/testflight_QA.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added spec/Reference/testflight_Staging.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added spec/Sample.appiconset/facetime.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added spec/Sample.appiconset/ibooks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added spec/Sample.appiconset/podcasts.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added spec/Sample.appiconset/testflight.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 50 additions & 0 deletions spec/appiconset_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
require 'icon_banner'
require 'icon_banner/appiconset'
require 'mini_magick'

RSpec.describe IconBanner::AppIconSet do
REFERENCE_ICONSET = 'Reference'
SAMPLE_ICONSET = 'Sample.appiconset'
LABELS = %w{Daily QA Staging Production}

it 'test icons' do
app_icon_set = IconBanner::AppIconSet.new
path = current_path
options = FastlaneCore::Configuration.create(IconBanner::IconBanner.available_options, Hash.new)

app_icon_set.restore path # just make sure

expect(options[:backup]).to be_truthy

icons = Dir.glob(File.join(icon_path, '*.{png,PNG}'))

LABELS.each do |label|
options[:label] = label
app_icon_set.generate path, options

icons.each do |icon|
reference = icon.sub(SAMPLE_ICONSET, REFERENCE_ICONSET)
.sub('.png', "_#{label}.png")

begin
compare = `compare -metric PSNR #{icon} #{reference} NULL: 2>&1`
expect(compare).to eq('inf')
end
# To regenerate images, replace this block with:
#begin
# FileUtils.copy icon, reference
#end
end

app_icon_set.restore path
end
end

def current_path
File.dirname __FILE__
end

def icon_path
File.join current_path, SAMPLE_ICONSET
end
end
3 changes: 3 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
RSpec.configure do |config|
config.fail_fast = false
end

0 comments on commit 177bece

Please sign in to comment.