phantom_svg 1.2.7 → 1.2.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: a5d076c0058836cd3f12112b91940f9909ea5f1e
4
- data.tar.gz: 6360a3cd7543337a7ec400c566c9d6834769a0a8
2
+ SHA256:
3
+ metadata.gz: d637def050d183de374f5d8ce7f9e6410ccf99b6cce275fa1e07f15f1a93a858
4
+ data.tar.gz: 5adf343eace4a55a7c774780d084c0f1bb78088b61559f01978944252b142ed5
5
5
  SHA512:
6
- metadata.gz: 534c8e22a80cf08f9bcd0ab77bf4d172a2cc17b425128e40a6a1e0b72c10c247711840550b7c5ab462ae5dce4f9e4ff881a16fde1a84486cbd9b770769665341
7
- data.tar.gz: 0c2ac880c4a8acc89561e9f4c747ad1d5b8fa06162d3d9613a8d4f35b043347ef698d724238ac573aa13bb68a8628017e847e2faf2292196a694fe796c9f4d65
6
+ metadata.gz: 0fb99821fca59b666cb1ca5cf7b9aae227ade0fee84935581b0c8e0ea3295a9ff42d8871be947d87ba12be21db57b27717818cfb8d833ae9d2d5f1fadb265c10
7
+ data.tar.gz: 8aedb380b386a228a906d81e1ef19db0f0b568b51f0f5cbf7c781065d3d2dcdc34fddca229bd65938262c64939071a93d27d10ef98d2cbb1a28d8ef78f80a8b9
data/Gemfile CHANGED
@@ -4,6 +4,8 @@ gemspec
4
4
 
5
5
  group :test do
6
6
  gem 'rspec'
7
+ gem 'test-prof'
8
+
7
9
  end
8
10
 
9
11
  group :development do
@@ -13,4 +15,5 @@ group :development do
13
15
  gem 'guard-rspec'
14
16
  gem 'rubocop'
15
17
  gem 'guard-rubocop'
18
+ gem 'ruby-prof', '>= 0.16.0', require: false
16
19
  end
@@ -23,7 +23,7 @@ module Phantom
23
23
  @width = "#{frames.first.width}"
24
24
  @height = "#{frames.first.height}"
25
25
  @loops = 0
26
- @skip_first = false
26
+ @skip_first = frames[0].duration == 0.0
27
27
  @has_animation = true
28
28
  end
29
29
 
@@ -33,6 +33,7 @@ module Phantom
33
33
  def create_frames(path, _duration = nil)
34
34
  frames = []
35
35
  lst = ImageList.new path
36
+ lst = lst.coalesce
36
37
 
37
38
  lst.each do |img|
38
39
  frame = set_param(img)
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'phantom_svg'
3
- s.version = '1.2.7'
3
+ s.version = '1.2.8'
4
4
  s.license = 'LGPL-3.0'
5
5
  s.summary = 'Hight end SVG manipulation tools for Ruby'
6
6
  s.description = 'Hight end SVG manipulation tools for Ruby.\n' \
Binary file
@@ -571,6 +571,68 @@ describe Phantom::SVG::Base do
571
571
  end
572
572
  end
573
573
 
574
+ describe 'creating an animated SVG file from a PROBLEMATIC GIF file.' do
575
+ before(:all) do
576
+ @image_name = 'japanred'
577
+ @source = "#{SPEC_SOURCE_DIR}/#{@image_name}.gif"
578
+ @destination_dir = SPEC_TEMP_DIR
579
+ end
580
+
581
+ before do
582
+ @loader = Phantom::SVG::Base.new
583
+ end
584
+
585
+ it 'loads frames / saves to SVG and PNG' do
586
+ test_name = 'gif_test'
587
+ @loader.add_frame_from_file(@source)
588
+ expect(@loader.frames.size).to eq(20)
589
+ @loader.frames.each do |frame|
590
+ expect(frame.duration.instance_of?(Float)).to eq(true)
591
+ expect(frame.width).to eq('600px')
592
+ expect(frame.height).to eq('600px')
593
+ expect(frame.surfaces).not_to be_nil
594
+ expect(frame.surfaces).not_to be_empty
595
+ expect(frame.surfaces.to_s.length).not_to eq(1)
596
+ expect(frame.namespaces).not_to be_empty
597
+ end
598
+ write_size = @loader.save_svg("#{@destination_dir}/#{test_name}.svg")
599
+ expect(write_size).not_to eq(0)
600
+ write_size = @loader.save_apng("#{@destination_dir}/#{test_name}.png")
601
+ expect(write_size).not_to eq(0)
602
+ end
603
+ end
604
+
605
+ describe 'creating an animated SVG file from a COMPLEX PROBLEMATIC GIF file.' do
606
+ before(:all) do
607
+ @image_name = 'complex_gif'
608
+ @source = "#{SPEC_SOURCE_DIR}/#{@image_name}.gif"
609
+ @destination_dir = SPEC_TEMP_DIR
610
+ end
611
+
612
+ before do
613
+ @loader = Phantom::SVG::Base.new
614
+ end
615
+
616
+ it 'loads frames / saves to SVG and PNG' do
617
+ test_name = 'complex_gif_test'
618
+ @loader.add_frame_from_file(@source)
619
+ expect(@loader.frames.size).to eq(74)
620
+ @loader.frames.each do |frame|
621
+ expect(frame.duration.instance_of?(Float)).to eq(true)
622
+ expect(frame.width).to eq('450px')
623
+ expect(frame.height).to eq('450px')
624
+ expect(frame.surfaces).not_to be_nil
625
+ expect(frame.surfaces).not_to be_empty
626
+ expect(frame.surfaces.to_s.length).not_to eq(1)
627
+ expect(frame.namespaces).not_to be_empty
628
+ end
629
+ write_size = @loader.save_svg("#{@destination_dir}/#{test_name}.svg")
630
+ expect(write_size).not_to eq(0)
631
+ write_size = @loader.save_apng("#{@destination_dir}/#{test_name}.png")
632
+ expect(write_size).not_to eq(0)
633
+ end
634
+ end
635
+
574
636
  describe 'output test' do
575
637
  before(:all) do
576
638
  @source_dir = SPEC_SOURCE_DIR
@@ -14,6 +14,17 @@
14
14
  # users commonly want.
15
15
  #
16
16
  # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
17
+ require 'test-prof'
18
+ TestProf.configure do |config|
19
+ # the directory to put artifacts (reports) in ("tmp/test_prof" by default)
20
+ config.output_dir = "../tmp/test_prof"
21
+
22
+ # use unique filenames for reports (by simply appending current timestamp)
23
+ config.timestamps = true
24
+
25
+ # color output
26
+ config.color = true
27
+ end
17
28
  RSpec.configure do |config|
18
29
  SPEC_ROOT_DIR = File.dirname(__FILE__)
19
30
  SPEC_SOURCE_DIR = SPEC_ROOT_DIR + '/images'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phantom_svg
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.7
4
+ version: 1.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rika Yoshida
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-07-02 00:00:00.000000000 Z
13
+ date: 2018-03-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: gobject-introspection
@@ -189,6 +189,7 @@ files:
189
189
  - spec/images/combine_test/dad_01(p).svg
190
190
  - spec/images/combine_test/mom_01.svg
191
191
  - spec/images/compiled.svg
192
+ - spec/images/complex_gif.gif
192
193
  - spec/images/gradation_test/0.svg
193
194
  - spec/images/gradation_test/1.svg
194
195
  - spec/images/gradation_test/2.svg
@@ -198,6 +199,7 @@ files:
198
199
  - spec/images/gradation_test/6.svg
199
200
  - spec/images/gradation_test/7.svg
200
201
  - spec/images/gradation_test/animation.json
202
+ - spec/images/japanred.gif
201
203
  - spec/images/jpeg_test/1.jpg
202
204
  - spec/images/jpeg_test/10.jpg
203
205
  - spec/images/jpeg_test/11.jpg
@@ -279,7 +281,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
279
281
  requirements:
280
282
  - libapngasm
281
283
  rubyforge_project:
282
- rubygems_version: 2.6.11
284
+ rubygems_version: 2.7.3
283
285
  signing_key:
284
286
  specification_version: 4
285
287
  summary: Hight end SVG manipulation tools for Ruby
@@ -290,6 +292,7 @@ test_files:
290
292
  - spec/images/combine_test/dad_01(p).svg
291
293
  - spec/images/combine_test/mom_01.svg
292
294
  - spec/images/compiled.svg
295
+ - spec/images/complex_gif.gif
293
296
  - spec/images/gradation_test/0.svg
294
297
  - spec/images/gradation_test/1.svg
295
298
  - spec/images/gradation_test/2.svg
@@ -299,6 +302,7 @@ test_files:
299
302
  - spec/images/gradation_test/6.svg
300
303
  - spec/images/gradation_test/7.svg
301
304
  - spec/images/gradation_test/animation.json
305
+ - spec/images/japanred.gif
302
306
  - spec/images/jpeg_test/1.jpg
303
307
  - spec/images/jpeg_test/10.jpg
304
308
  - spec/images/jpeg_test/11.jpg