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 +5 -5
- data/Gemfile +3 -0
- data/lib/phantom/parser/gif_reader.rb +2 -1
- data/phantom_svg.gemspec +1 -1
- data/spec/images/complex_gif.gif +0 -0
- data/spec/images/japanred.gif +0 -0
- data/spec/phantom/svg_spec.rb +62 -0
- data/spec/spec_helper.rb +11 -0
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d637def050d183de374f5d8ce7f9e6410ccf99b6cce275fa1e07f15f1a93a858
|
4
|
+
data.tar.gz: 5adf343eace4a55a7c774780d084c0f1bb78088b61559f01978944252b142ed5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0fb99821fca59b666cb1ca5cf7b9aae227ade0fee84935581b0c8e0ea3295a9ff42d8871be947d87ba12be21db57b27717818cfb8d833ae9d2d5f1fadb265c10
|
7
|
+
data.tar.gz: 8aedb380b386a228a906d81e1ef19db0f0b568b51f0f5cbf7c781065d3d2dcdc34fddca229bd65938262c64939071a93d27d10ef98d2cbb1a28d8ef78f80a8b9
|
data/Gemfile
CHANGED
@@ -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 =
|
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)
|
data/phantom_svg.gemspec
CHANGED
Binary file
|
Binary file
|
data/spec/phantom/svg_spec.rb
CHANGED
@@ -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
|
data/spec/spec_helper.rb
CHANGED
@@ -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.
|
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:
|
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.
|
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
|