zpng 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
Binary file
Binary file
Binary file
@@ -45,7 +45,7 @@ describe "ZPNG png2ascii" do
45
45
  Dir[File.join(SAMPLES_DIR,'qr_*.png')].each do |fname|
46
46
  describe fname do
47
47
  it "generates a nice ascii img" do
48
- ZPNG::Image.new(fname).to_ascii('#.').strip.should == ASCII_QR.strip
48
+ ZPNG::Image.load(fname).to_ascii('#.').strip.should == ASCII_QR.strip
49
49
  end
50
50
  end
51
51
  end
@@ -0,0 +1,20 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ each_sample("mouse*.bmp") do |fname|
4
+ describe fname do
5
+ subject(:bmp){ ZPNG::Image.load(fname) }
6
+ let!(:png){ ZPNG::Image.load(fname.sub(".bmp",".png")) }
7
+
8
+ its(:width ){ should == png.width }
9
+ its(:height){ should == png.height }
10
+ its(:format){ should == :bmp }
11
+
12
+ it "should be equal to PNG" do
13
+ bmp.should == png
14
+ end
15
+
16
+ it "should restore original imagedata" do
17
+ File.binread(fname).should include(bmp.imagedata)
18
+ end
19
+ end
20
+ end
@@ -59,4 +59,16 @@ describe "CLI" do
59
59
 
60
60
  end
61
61
  end
62
+
63
+ it "cuts long metadata" do
64
+ fname = File.join(SAMPLES_DIR, "cats.png")
65
+ orig_stdout, out = $stdout, ""
66
+ begin
67
+ $stdout = StringIO.new(out)
68
+ lambda { ZPNG::CLI.new([fname]).run }.should_not raise_error
69
+ ensure
70
+ $stdout = orig_stdout
71
+ end
72
+ out.size.should < 100_000
73
+ end
62
74
  end
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+
3
+ describe ZPNG::Image do
4
+ it "should raise ZPNG::NotSupported on unknown file" do
5
+ lambda{
6
+ ZPNG::Image.load(__FILE__)
7
+ }.should raise_error(ZPNG::NotSupported)
8
+ end
9
+ end
@@ -0,0 +1,22 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ each_sample do |fname|
4
+ describe fname do
5
+ before(:all) do
6
+ @src = ZPNG::Image.load(fname)
7
+ @dst = ZPNG::Image.new(@src.export)
8
+ end
9
+
10
+ it "should have equal width" do
11
+ @src.width.should == @dst.width
12
+ end
13
+
14
+ it "should have equal width" do
15
+ @src.height.should == @dst.height
16
+ end
17
+
18
+ it "should have equal data" do
19
+ @src.should == @dst
20
+ end
21
+ end
22
+ end
@@ -44,7 +44,7 @@ describe "ZPNG modify" do
44
44
  end
45
45
  SAMPLES.each do |fname|
46
46
  describe fname.sub(File.dirname(SAMPLES_DIR)+'/','') do
47
- img = ZPNG::Image.new(fname)
47
+ img = ZPNG::Image.load(fname)
48
48
  it "modifies img - color=#{img.hdr.color}, depth=#{img.hdr.depth}, bpp=#{img.hdr.bpp}" do
49
49
  img.width.times do |x|
50
50
  img[x,0] = (x%2==0) ? ZPNG::Color::WHITE : ZPNG::Color::BLACK
@@ -20,6 +20,16 @@ SAMPLES =
20
20
  Dir[File.join(SAMPLES_DIR,'qr_*.png')]
21
21
  end
22
22
 
23
+ def each_sample glob="*.png"
24
+ Dir[File.join(SAMPLES_DIR, glob)].each do |fname|
25
+ yield fname.sub(Dir.pwd+'/','')
26
+ end
27
+ end
28
+
29
+ def sample fname
30
+ File.join(SAMPLES_DIR, fname)
31
+ end
32
+
23
33
  PNGSuite.init( File.join(SAMPLES_DIR, "png_suite") )
24
34
 
25
35
  RSpec.configure do |config|
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "zpng"
8
- s.version = "0.2.1"
8
+ s.version = "0.2.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Andrey \"Zed\" Zaikin"]
12
- s.date = "2013-01-02"
12
+ s.date = "2013-01-13"
13
13
  s.email = "zed.0xff@gmail.com"
14
14
  s.executables = ["zpng"]
15
15
  s.extra_rdoc_files = [
@@ -33,6 +33,7 @@ Gem::Specification.new do |s|
33
33
  "lib/zpng.rb",
34
34
  "lib/zpng/adam7_decoder.rb",
35
35
  "lib/zpng/block.rb",
36
+ "lib/zpng/bmp/reader.rb",
36
37
  "lib/zpng/chunk.rb",
37
38
  "lib/zpng/cli.rb",
38
39
  "lib/zpng/color.rb",
@@ -41,14 +42,21 @@ Gem::Specification.new do |s|
41
42
  "lib/zpng/image.rb",
42
43
  "lib/zpng/metadata.rb",
43
44
  "lib/zpng/pixels.rb",
45
+ "lib/zpng/readable_struct.rb",
44
46
  "lib/zpng/scan_line.rb",
47
+ "lib/zpng/scan_line/mixins.rb",
45
48
  "lib/zpng/string_ext.rb",
46
49
  "lib/zpng/text_chunk.rb",
47
50
  "misc/chars.png",
48
51
  "misc/gen_ascii_map.rb",
49
52
  "samples/captcha_4bpp.png",
53
+ "samples/cats.png",
50
54
  "samples/itxt.png",
51
55
  "samples/modify.rb",
56
+ "samples/mouse.bmp",
57
+ "samples/mouse.png",
58
+ "samples/mouse17.bmp",
59
+ "samples/mouse17.png",
52
60
  "samples/qr_aux_chunks.png",
53
61
  "samples/qr_bw.png",
54
62
  "samples/qr_gray_alpha.png",
@@ -60,12 +68,15 @@ Gem::Specification.new do |s|
60
68
  "spec/adam7_spec.rb",
61
69
  "spec/alpha_spec.rb",
62
70
  "spec/ascii_spec.rb",
71
+ "spec/bmp_spec.rb",
63
72
  "spec/cli_spec.rb",
64
73
  "spec/color_spec.rb",
65
74
  "spec/create_image_spec.rb",
66
75
  "spec/crop_spec.rb",
67
76
  "spec/deinterlace_spec.rb",
77
+ "spec/exception_spec.rb",
68
78
  "spec/image_spec.rb",
79
+ "spec/load_save_spec.rb",
69
80
  "spec/metadata_spec.rb",
70
81
  "spec/modify_spec.rb",
71
82
  "spec/pixel_access_spec.rb",
@@ -74,7 +85,6 @@ Gem::Specification.new do |s|
74
85
  "spec/set_random_pixel_spec.rb",
75
86
  "spec/spec_helper.rb",
76
87
  "spec/support/png_suite.rb",
77
- "spec/zpng_spec.rb",
78
88
  "zpng.gemspec"
79
89
  ]
80
90
  s.homepage = "http://github.com/zed-0xff/zpng"
@@ -91,17 +101,20 @@ Gem::Specification.new do |s|
91
101
  s.add_development_dependency(%q<rspec>, [">= 2.8.0"])
92
102
  s.add_development_dependency(%q<bundler>, [">= 1.0.0"])
93
103
  s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
104
+ s.add_development_dependency(%q<what_methods>, [">= 0"])
94
105
  else
95
106
  s.add_dependency(%q<rainbow>, [">= 0"])
96
107
  s.add_dependency(%q<rspec>, [">= 2.8.0"])
97
108
  s.add_dependency(%q<bundler>, [">= 1.0.0"])
98
109
  s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
110
+ s.add_dependency(%q<what_methods>, [">= 0"])
99
111
  end
100
112
  else
101
113
  s.add_dependency(%q<rainbow>, [">= 0"])
102
114
  s.add_dependency(%q<rspec>, [">= 2.8.0"])
103
115
  s.add_dependency(%q<bundler>, [">= 1.0.0"])
104
116
  s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
117
+ s.add_dependency(%q<what_methods>, [">= 0"])
105
118
  end
106
119
  end
107
120
 
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: zpng
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.1
5
+ version: 0.2.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Andrey "Zed" Zaikin
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-02 00:00:00.000000000 Z
12
+ date: 2013-01-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  prerelease: false
@@ -75,6 +75,22 @@ dependencies:
75
75
  - !ruby/object:Gem::Version
76
76
  version: 1.8.4
77
77
  none: false
78
+ - !ruby/object:Gem::Dependency
79
+ prerelease: false
80
+ type: :development
81
+ name: what_methods
82
+ requirement: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ! '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ none: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ! '>='
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ none: false
78
94
  description:
79
95
  email: zed.0xff@gmail.com
80
96
  executables:
@@ -100,6 +116,7 @@ files:
100
116
  - lib/zpng.rb
101
117
  - lib/zpng/adam7_decoder.rb
102
118
  - lib/zpng/block.rb
119
+ - lib/zpng/bmp/reader.rb
103
120
  - lib/zpng/chunk.rb
104
121
  - lib/zpng/cli.rb
105
122
  - lib/zpng/color.rb
@@ -108,14 +125,21 @@ files:
108
125
  - lib/zpng/image.rb
109
126
  - lib/zpng/metadata.rb
110
127
  - lib/zpng/pixels.rb
128
+ - lib/zpng/readable_struct.rb
111
129
  - lib/zpng/scan_line.rb
130
+ - lib/zpng/scan_line/mixins.rb
112
131
  - lib/zpng/string_ext.rb
113
132
  - lib/zpng/text_chunk.rb
114
133
  - misc/chars.png
115
134
  - misc/gen_ascii_map.rb
116
135
  - samples/captcha_4bpp.png
136
+ - samples/cats.png
117
137
  - samples/itxt.png
118
138
  - samples/modify.rb
139
+ - samples/mouse.bmp
140
+ - samples/mouse.png
141
+ - samples/mouse17.bmp
142
+ - samples/mouse17.png
119
143
  - samples/qr_aux_chunks.png
120
144
  - samples/qr_bw.png
121
145
  - samples/qr_gray_alpha.png
@@ -127,12 +151,15 @@ files:
127
151
  - spec/adam7_spec.rb
128
152
  - spec/alpha_spec.rb
129
153
  - spec/ascii_spec.rb
154
+ - spec/bmp_spec.rb
130
155
  - spec/cli_spec.rb
131
156
  - spec/color_spec.rb
132
157
  - spec/create_image_spec.rb
133
158
  - spec/crop_spec.rb
134
159
  - spec/deinterlace_spec.rb
160
+ - spec/exception_spec.rb
135
161
  - spec/image_spec.rb
162
+ - spec/load_save_spec.rb
136
163
  - spec/metadata_spec.rb
137
164
  - spec/modify_spec.rb
138
165
  - spec/pixel_access_spec.rb
@@ -141,7 +168,6 @@ files:
141
168
  - spec/set_random_pixel_spec.rb
142
169
  - spec/spec_helper.rb
143
170
  - spec/support/png_suite.rb
144
- - spec/zpng_spec.rb
145
171
  - zpng.gemspec
146
172
  homepage: http://github.com/zed-0xff/zpng
147
173
  licenses:
@@ -157,7 +183,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
157
183
  version: '0'
158
184
  segments:
159
185
  - 0
160
- hash: -2687381686191062956
186
+ hash: 3712335013458038737
161
187
  none: false
162
188
  required_rubygems_version: !ruby/object:Gem::Requirement
163
189
  requirements:
@@ -1,7 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
-
3
- describe "Zpng" do
4
- it "fails" do
5
- # fail "hey buddy, you should probably rename this file and start specing for real"
6
- end
7
- end