mork 0.0.6 → 0.0.7

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
2
  SHA1:
3
- metadata.gz: 4e92c32ca59c988cea80c3c77500fd756e53410d
4
- data.tar.gz: 0334a33ef6ce0f4166ba19d57d9b82909f915c05
3
+ metadata.gz: 77cd220a9af15fb52c434ad78e5436e922a92d9b
4
+ data.tar.gz: 7ec01ec5ef0fe665822dbcf2da5b4c59682db51c
5
5
  SHA512:
6
- metadata.gz: 7f7dd80d9be2d3a2ccd58ec2e1a077401269baeebcb2d84d0105b325f351bad0bef130607502d5e5eecb86af0004e49e12d6d8410251ac55013147d5261924af
7
- data.tar.gz: 96b17f9ea0bf9a307d46a1f8cecbc6e39858f0c6303ea3d23690e8bfccb8602eccf5a08b5690046edef8bfb345a49b87994629586cbf90e41e7387df270541ca
6
+ metadata.gz: 4f59e836632c2cb223193480692b52631b09a7739b61e8b839f36babdd77ccef7785a0515c54cc670327547b9ca1f26e99bc8a389914b2864d51547de249e575
7
+ data.tar.gz: 29829dc19f2217b4beadd263f181290c585f5e54f0463b6b62d10b489b517deac42ffdf76d3c543a5942d84dbad364f0e7b4db871bb3fde87d7ce9a0ff5d0e30
data/.gitignore CHANGED
@@ -5,4 +5,4 @@ quick.rb
5
5
  pkg/*
6
6
  tmp/*
7
7
  .rvmrc
8
- .rspec
8
+ .rspec
data/Guardfile CHANGED
@@ -1,4 +1,4 @@
1
- guard 'rspec', all_after_pass: false do
1
+ guard 'rspec', cmd: 'bundle exec rspec', all_after_pass: false do
2
2
  watch(%r{^spec/.+_spec\.rb$})
3
3
  watch(%r{^lib/mork/(.+)\.rb$}) { |m| "spec/mork/#{m[1]}_spec.rb" }
4
4
  end
data/lib/mork/grid.rb CHANGED
@@ -221,7 +221,13 @@ module Mork
221
221
 
222
222
  def pdf_ctrl_area_light
223
223
  {
224
- p: [cell_spacing.mm + pdf_control_xy[0]+pdf_control_width+@params[:control][:margin].to_f.mm, pdf_control_xy[1]],
224
+ p: [
225
+ cell_spacing.mm +
226
+ pdf_control_xy[0] +
227
+ pdf_control_width +
228
+ ctrl_margin.mm,
229
+ pdf_control_xy[1]
230
+ ],
225
231
  w: cell_width.mm,
226
232
  h: cell_height.mm
227
233
  }
@@ -355,28 +361,29 @@ module Mork
355
361
  # ===============================
356
362
  # = Simple parameter extraction =
357
363
  # ===============================
358
- def ctrl_cell_x() @params[:control][:left].to_f + @params[:control][:width].to_f + ctrl_margin end
359
- def ctrl_margin() @params[:control][:margin].to_f end
360
- def ctrl_cell_y() @params[:control][:top].to_f end
361
- def code_height() @params[:code][:height].to_f end
362
- def code_width() @params[:code][:width].to_f end
363
- def page_width() @params[:page_size][:width].to_f end
364
- def page_height() @params[:page_size][:height].to_f end
365
- def cell_width() @params[:items][:cell_width].to_f end
366
- def cell_height() @params[:items][:cell_height].to_f end
367
- def cell_spacing() @params[:items][:x_spacing].to_f end
368
- def item_spacing() @params[:items][:y_spacing].to_f end
369
- def column_width() @params[:items][:column_width].to_f end
370
- def row_spacing() @params[:items][:y_spacing].to_f end
371
- def first_x() @params[:items][:first_x].to_f end
372
- def first_y() @params[:items][:first_y].to_f end
373
- def rows() @params[:items][:rows] end
374
- def columns() @params[:items][:columns] end
375
- def reg_margin() @params[:regmarks][:margin].to_f end
376
- def reg_search() @params[:regmarks][:search].to_f end
377
- def reg_radius() @params[:regmarks][:radius].to_f end
378
- def reg_frame_width() page_width - reg_margin * 2 end
379
- def reg_frame_height() page_height - reg_margin * 2 end
380
- def reg_off() @params[:regmarks][:offset].to_f end
364
+ def ctrl_cell_x() @params[:control][:left].to_f + ctrl_width + ctrl_margin end
365
+ def ctrl_margin() @params[:control][:margin].to_f end
366
+ def ctrl_width() @params[:control][:width].to_f end
367
+ def ctrl_cell_y() @params[:control][:top].to_f end
368
+ def code_height() @params[:code][:height].to_f end
369
+ def code_width() @params[:code][:width].to_f end
370
+ def page_width() @params[:page_size][:width].to_f end
371
+ def page_height() @params[:page_size][:height].to_f end
372
+ def cell_width() @params[:items][:cell_width].to_f end
373
+ def cell_height() @params[:items][:cell_height].to_f end
374
+ def cell_spacing() @params[:items][:x_spacing].to_f end
375
+ def item_spacing() @params[:items][:y_spacing].to_f end
376
+ def column_width() @params[:items][:column_width].to_f end
377
+ def row_spacing() @params[:items][:y_spacing].to_f end
378
+ def first_x() @params[:items][:first_x].to_f end
379
+ def first_y() @params[:items][:first_y].to_f end
380
+ def rows() @params[:items][:rows] end
381
+ def columns() @params[:items][:columns] end
382
+ def reg_margin() @params[:regmarks][:margin].to_f end
383
+ def reg_search() @params[:regmarks][:search].to_f end
384
+ def reg_radius() @params[:regmarks][:radius].to_f end
385
+ def reg_frame_width() page_width - reg_margin * 2 end
386
+ def reg_frame_height() page_height - reg_margin * 2 end
387
+ def reg_off() @params[:regmarks][:offset].to_f end
381
388
  end
382
389
  end
@@ -11,7 +11,7 @@ module Mork
11
11
  margin: 10,
12
12
  radius: 2.5,
13
13
  search: 10,
14
- offset: 3
14
+ offset: 2
15
15
  }, # regmarks end
16
16
  header: {
17
17
  name: {
data/lib/mork/npatch.rb CHANGED
@@ -31,7 +31,7 @@ module Mork
31
31
  end
32
32
 
33
33
  def narr
34
- @narr ||= NArray[@mim.pixels]
34
+ NArray[@mim.pixels]
35
35
  end
36
36
 
37
37
  def blurry_narr
data/lib/mork/sheet.rb CHANGED
@@ -4,10 +4,10 @@ module Mork
4
4
  @raw = case im.class.to_s
5
5
  when "String"
6
6
  Mimage.new im
7
- when "Mimage"
7
+ when "Mork::Mimage"
8
8
  im
9
9
  else
10
- raise "A new sheet requires either a Mimage or the name of the source image file"
10
+ raise "A new sheet requires either a Mimage or the name of the source image file, but it was a: #{im.class}"
11
11
  end
12
12
  @grid = grid
13
13
  # send page size to the grid, so that all later measurements can be done within the
@@ -42,6 +42,7 @@ module Mork
42
42
  # false otherwise
43
43
  def marked?(q, c)
44
44
  return if not_registered
45
+ # puts "SHADE: #{shade_of(q, c)}, Q: #{q}, C: #{c}, THR: #{choice_threshold}"
45
46
  shade_of(q, c) < choice_threshold
46
47
  end
47
48
 
@@ -102,23 +103,30 @@ module Mork
102
103
  @crop.highlight! @grid.choice_cell_area(q, c)
103
104
  end
104
105
 
105
- def highlight_code
106
+ def highlight_code_areas
106
107
  return if not_registered
107
108
  @grid.code_bits.times do |bit|
108
109
  @crop.highlight! @grid.code_bit_area bit
109
110
  end
110
111
  end
111
112
 
112
- def highlight_code_bit(i)
113
- @crop.highlight!(@grid.code_bit_area(i)) if @ok_reg
113
+ def highlight_code
114
+ return if not_registered
115
+ @grid.code_bits.times do |bit|
116
+ if code_string.reverse[bit] == '1'
117
+ @crop.highlight! @grid.code_bit_area bit
118
+ end
119
+ end
114
120
  end
115
-
121
+
116
122
  def highlight_dark_calibration_bit
117
- @crop.highlight!(@grid.cal_area_black) if @ok_reg
123
+ return if not_registered
124
+ @crop.highlight!(@grid.cal_area_black)
118
125
  end
119
126
 
120
127
  def highlight_light_calibration_bit
121
- @crop.highlight!(@grid.cal_area_white) if @ok_reg
128
+ return if not_registered
129
+ @crop.highlight!(@grid.cal_area_white)
122
130
  end
123
131
 
124
132
  def highlight_reg_area
@@ -126,11 +134,13 @@ module Mork
126
134
  @raw.highlight! @rmsa[:tr]
127
135
  @raw.highlight! @rmsa[:br]
128
136
  @raw.highlight! @rmsa[:bl]
129
- @raw.join!(@rm) if @ok_reg
137
+ return if not_registered
138
+ @raw.join!(@rm)
130
139
  end
131
140
 
132
141
  def write(fname)
133
- @crop.write(fname) if @ok_reg
142
+ return if not_registered
143
+ @crop.write(fname)
134
144
  end
135
145
 
136
146
  def write_raw(fname)
@@ -144,8 +154,10 @@ module Mork
144
154
  (0...@grid.max_questions)
145
155
  elsif r.is_a? Fixnum
146
156
  (0...r)
147
- else
157
+ elsif r.is_a? Array
148
158
  r
159
+ else
160
+ raise "Invalid argument"
149
161
  end
150
162
  end
151
163
 
@@ -165,7 +177,7 @@ module Mork
165
177
  end
166
178
 
167
179
  def choice_threshold
168
- @choice_threshold ||= (naverage(@grid.ctrl_area_dark) +
180
+ @choice_threshold ||= (naverage(@grid.ctrl_area_dark) +
169
181
  naverage(@grid.ctrl_area_light)) / 2
170
182
  end
171
183
 
@@ -202,7 +214,6 @@ module Mork
202
214
  def reg_centroid_on(img, corner)
203
215
  1000.times do |i|
204
216
  @rmsa[corner] = @grid.rm_search_area(corner, i)
205
- puts "RM: #{@rmsa[corner].inspect}"
206
217
  cx, cy = NPatch.new(img.crop(@rmsa[corner])).dark_centroid
207
218
  if cx.nil?
208
219
  status = :insufficient_contrast
@@ -2,12 +2,16 @@ require 'prawn'
2
2
 
3
3
  module Mork
4
4
  class SheetPDF < Prawn::Document
5
- def initialize(grid, info)
6
- @grid = grid
5
+ def initialize(content, grid=Grid.new)
6
+ @grid = case grid.class.to_s
7
+ when "String"; Grid.new grid
8
+ when "Mork::Grid"; grid
9
+ else raise "Invalid initialization parameter"
10
+ end
7
11
  super my_page_params
8
- # @info should be an array of hashes, one per page;
12
+ # @content should be an array of hashes, one per page;
9
13
  # convert to array if a single hash was passed
10
- @info = info.class == Hash ? [info] : info
14
+ @content = content.class == Hash ? [content] : content
11
15
  process
12
16
  end
13
17
 
@@ -23,16 +27,16 @@ module Mork
23
27
 
24
28
  def process
25
29
  # for each response sheet
26
- @info.each_with_index do |info, i|
30
+ @content.each_with_index do |content, i|
27
31
  start_new_page if i>0
28
32
  fill_color "000000"
29
33
  stroke_color "000000"
30
34
  line_width 0.3
31
35
  registration_marks
32
- calibration_and_code info[:code]
33
- header info[:header]
34
- control info[:control] if info[:control]
35
- questions_and_choices info[:choices]
36
+ calibration_and_code content[:code]
37
+ header content[:header]
38
+ control content[:control] if content[:control]
39
+ questions_and_choices content[:choices]
36
40
  end
37
41
  end
38
42
 
@@ -64,9 +68,9 @@ module Mork
64
68
  end
65
69
  end
66
70
 
67
- def control(info)
71
+ def control(content)
68
72
  font_size @grid.pdf_control_size do
69
- text_box info[:string], at: @grid.pdf_control_xy,
73
+ text_box content[:string], at: @grid.pdf_control_xy,
70
74
  width: @grid.pdf_control_width,
71
75
  align: :right
72
76
  stroke do
@@ -76,19 +80,19 @@ module Mork
76
80
  a = @grid.pdf_ctrl_area_dark
77
81
  rounded_rectangle a[:p], a[:w], a[:h], [a[:h], a[:w]].min / 2
78
82
  fill_color "ff0000"
79
- draw_text info[:labels][0], at: @grid.pdf_dark_control_letter_xy
83
+ draw_text content[:labels][0], at: @grid.pdf_dark_control_letter_xy
80
84
  # light
81
85
  a = @grid.pdf_ctrl_area_light
82
86
  rounded_rectangle a[:p], a[:w], a[:h], [a[:h], a[:w]].min / 2
83
87
  fill_color "ff0000"
84
- draw_text info[:labels][1], at: @grid.pdf_light_control_letter_xy
88
+ draw_text content[:labels][1], at: @grid.pdf_light_control_letter_xy
85
89
 
86
90
  end
87
91
  end
88
92
  end
89
93
 
90
- def header(info)
91
- info.each do |k,v|
94
+ def header(content)
95
+ content.each do |k,v|
92
96
  font_size @grid.pdf_header_size(k) do
93
97
  if @grid.pdf_header_boxed?(k)
94
98
  bounding_box @grid.pdf_header_xy(k), width: @grid.pdf_header_width(k), height: @grid.pdf_header_height(k) do
@@ -104,9 +108,9 @@ module Mork
104
108
  end
105
109
  end
106
110
 
107
- def questions_and_choices(info)
111
+ def questions_and_choices(content)
108
112
  stroke do
109
- info.length.times do |q|
113
+ content.length.times do |q|
110
114
  fill_color "000000"
111
115
  text_box "#{q+1}", at: @grid.pdf_qnum_xy(q),
112
116
  width: @grid.pdf_qnum_width,
@@ -114,7 +118,7 @@ module Mork
114
118
  size: @grid.pdf_qnum_size
115
119
  stroke_color "ff0000"
116
120
  font_size @grid.pdf_chlett_size
117
- info[q].times do |c|
121
+ content[q].times do |c|
118
122
  a = @grid.pdf_choice_cell_area q, c
119
123
  rounded_rectangle a[:p], a[:w], a[:h], [a[:h], a[:w]].min / 2
120
124
  fill_color "ff0000"
@@ -125,11 +129,11 @@ module Mork
125
129
  end
126
130
 
127
131
  # def nquestions
128
- # @info[:choices].length
132
+ # @content[:choices].length
129
133
  # end
130
134
  #
131
135
  # def nchoices(i)
132
- # @info[:choices][i]
136
+ # @content[:choices][i]
133
137
  # end
134
138
  end
135
139
  end
data/lib/mork/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mork
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
data/mork.gemspec CHANGED
@@ -5,6 +5,7 @@ require "mork/version"
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "mork"
7
7
  s.version = Mork::VERSION
8
+ s.licenses = ['MIT']
8
9
  s.authors = ["Giuseppe Bertini"]
9
10
  s.email = ["giuseppe.bertini@gmail.com"]
10
11
  s.homepage = ""
@@ -18,16 +19,14 @@ Gem::Specification.new do |s|
18
19
  s.require_paths = ["lib"]
19
20
 
20
21
  # dependencies:
21
- s.add_dependency "narray"
22
- s.add_dependency "rmagick"
23
- s.add_dependency "prawn"
24
- s.add_development_dependency 'rake'
25
- s.add_development_dependency "rspec"
26
- s.add_development_dependency "cucumber"
27
- s.add_development_dependency "guard-rspec"
28
- s.add_development_dependency "guard-shell"
29
- s.add_development_dependency "rb-fsevent"
30
- s.add_development_dependency "awesome_print"
31
-
32
- # s.add_runtime_dependency "rest-client"
22
+ s.add_dependency 'narray', '~> 0.6'
23
+ s.add_dependency 'rmagick', '~> 2.13'
24
+ s.add_dependency 'prawn', '1.0.0.rc2'
25
+ s.add_development_dependency 'rake', '~> 10.3'
26
+ s.add_development_dependency 'rspec', '~> 3.1'
27
+ s.add_development_dependency 'guard', '~> 2.6'
28
+ s.add_development_dependency 'guard-rspec', '~> 4.3'
29
+ s.add_development_dependency 'guard-shell', '~> 0.6'
30
+ # s.add_development_dependency 'rb-fsevent'
31
+ s.add_development_dependency 'awesome_print', '~> 1.2'
33
32
  end
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  module Mork
4
4
  describe Grid do
5
- context 'default grid', focus: true do
5
+ context 'default grid' do
6
6
  before(:all) do
7
7
  @grid = Grid.new
8
8
  @grid.set_page_size 1601, 2281 # the size of sample01.jpg
@@ -34,44 +34,44 @@ module Mork
34
34
  context 'on the first iteration' do
35
35
  it 'returns an {:x, :y, :w, :h} hash of coordinates in pixels for the :tl reg_mark corner' do
36
36
  c = @grid.rm_search_area :tl, 0
37
- c.should == { x: 23, y: 23, w: 76, h: 77 }
37
+ c.should == {:x=>15, :y=>15, :w=>76, :h=>77}
38
38
  end
39
39
 
40
40
  it 'returns an {:x, :y, :w, :h} hash of coordinates in pixels for the :tr reg_mark corner' do
41
41
  c = @grid.rm_search_area :tr, 0
42
- c.should == { x: 1502, y: 23, w: 76, h: 77 }
42
+ c.should == { x: 1510, y: 15, w: 76, h: 77 }
43
43
  end
44
44
 
45
45
  it 'returns an {:x, :y, :w, :h} hash of coordinates in pixels for the :br reg_mark corner' do
46
46
  c = @grid.rm_search_area :br, 0
47
- c.should == { x: 1502, y: 2181, w: 76, h: 77 }
47
+ c.should == { x: 1510, y: 2189, w: 76, h: 77 }
48
48
  end
49
49
 
50
50
  it 'returns an {:x, :y, :w, :h} hash of coordinates in pixels for the :bl reg_mark corner' do
51
51
  c = @grid.rm_search_area :bl, 0
52
- c.should == { x: 23, y: 2181, w: 76, h: 77 }
52
+ c.should == { x: 15, y: 2189, w: 76, h: 77 }
53
53
  end
54
54
  end
55
55
 
56
56
  context 'on the third iteration' do
57
57
  it 'returns an {:x, :y, :w, :h} hash of coordinates in pixels for the :tl reg_mark corner' do
58
58
  c = @grid.rm_search_area :tl, 2
59
- c.should == { x: 23, y: 23, w: 114, h: 115 }
59
+ c.should == { x: 15, y: 15, w: 114, h: 115 }
60
60
  end
61
61
 
62
62
  it 'returns an {:x, :y, :w, :h} hash of coordinates in pixels for the :tr reg_mark corner' do
63
63
  c = @grid.rm_search_area :tr, 2
64
- c.should == { x: 1464, y: 23, w: 114, h: 115 }
64
+ c.should == { x: 1471, y: 15, w: 114, h: 115 }
65
65
  end
66
66
 
67
67
  it 'returns an {:x, :y, :w, :h} hash of coordinates in pixels for the :br reg_mark corner' do
68
68
  c = @grid.rm_search_area :br, 2
69
- c.should == { x: 1464, y: 2143, w: 114, h: 115 }
69
+ c.should == { x: 1471, y: 2150, w: 114, h: 115 }
70
70
  end
71
71
 
72
72
  it 'returns an {:x, :y, :w, :h} hash of coordinates in pixels for the :bl reg_mark corner' do
73
73
  c = @grid.rm_search_area :bl, 2
74
- c.should == { x: 23, y: 2143, w: 114, h: 115 }
74
+ c.should == { x: 15, y: 2150, w: 114, h: 115 }
75
75
  end
76
76
  end
77
77
  end
@@ -1,106 +1,41 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  module Mork
4
+
4
5
  describe SheetPDF do
6
+ it 'assigns the grid to @grid' do
7
+ s = SheetPDF.new(some_pdf_content)
8
+ s.instance_variable_get("@grid").should be_a Grid
9
+ end
10
+
11
+ it 'creates a grid by loading the specified file' do
12
+ s = SheetPDF.new(some_pdf_content, 'spec/samples/grid01.yml')
13
+ s.instance_variable_get('@grid').should be_a Grid
14
+ end
5
15
 
6
- it "should create a basic pdf" do
7
- info = {
8
- code: 1099511627775,
9
- choices: [5] * 120,
10
- header: {
11
- name: "Bertini Giuseppe VR123456",
12
- title: "Esame di Fondamenti Morfologici e Funzionali della Vita - 18 gennaio 2013",
13
- code: "119.27",
14
- signature: "Firma"
15
- },
16
- control: {
17
- string: "Annerisci solo la casella ‘V’:",
18
- labels: ['V', 'F']
19
- }
20
- }
21
-
22
- grid_opts = {
23
- regmarks: {
24
- margin: 10,
25
- radius: 2.5,
26
- search: 10
27
- },
28
- header: {
29
- name: {
30
- top: 5,
31
- left: 7.5,
32
- width: 170,
33
- size: 14,
34
- },
35
- title: {
36
- top: 15,
37
- left: 7.5,
38
- width: 180,
39
- size: 12
40
- },
41
- code: {
42
- top: 5,
43
- left: 165,
44
- width: 20,
45
- size: 14
46
- },
47
- signature: {
48
- top: 30,
49
- left: 7.5,
50
- width: 120,
51
- height: 15,
52
- size: 7,
53
- box: true,
54
- }
55
- }, # header end
56
- items: {
57
- columns: 4,
58
- column_width: 49,
59
- rows: 30,
60
- # from the top-left registration mark
61
- # to the center of the first choice cell
62
- first_x: 10.5,
63
- first_y: 55.5,
64
- # between choices
65
- x_spacing: 7.0,
66
- # between rows
67
- y_spacing: 7.0,
68
- # darkened area
69
- cell_width: 6.0,
70
- cell_height: 5.0,
71
- # the maximum number of choices per question
72
- max_cells: 5,
73
- # font size for the question number
74
- number_size: 10,
75
- # distance between right side of q num and left side of first choice cell
76
- number_width: 8,
77
- # width of question number text box
78
- number_margin: 2,
79
- # font size for the choice letter
80
- letter_size: 8
81
- },
82
- code: {
83
- bits: 40,
84
- left: 15,
85
- width: 3.0,
86
- height: 2.5,
87
- spacing: 4
88
- },
89
- control: {
90
- top: 40,
91
- left: 123,
92
- width: 50,
93
- size: 9,
94
- margin: 2.5
95
- }
96
- }
16
+ it 'raises an error with an invalid init parameter' do
17
+ lambda { SheetPDF.new(some_pdf_content, 2) }.should raise_error "Invalid initialization parameter"
18
+ end
19
+
20
+ it 'assigns an array to @content' do
21
+ s = SheetPDF.new(some_pdf_content)
22
+ s.instance_variable_get("@content").should be_an Array
23
+ end
97
24
 
98
- # s = SheetPDF.new(Grid.new(grid_opts), info)
99
- # s.save("tmp/f1.pdf")
25
+ it 'assigns an array of hashes to @content' do
26
+ s = SheetPDF.new(some_pdf_content)
27
+ s.instance_variable_get("@content").first.should be_a Hash
28
+ end
100
29
 
101
- info = {
102
- code: 5512,
103
- choices: [5] * 160,
30
+ it 'creates a basic PDF sheet' do
31
+ s = SheetPDF.new(some_pdf_content)
32
+ s.save("tmp/f1.pdf")
33
+ end
34
+
35
+ it 'creates a PDF sheet with the maximum possible code' do
36
+ content = {
37
+ code: 1099511627775,
38
+ choices: [5] * 120,
104
39
  header: {
105
40
  name: "Bonazza Sara vr354320",
106
41
  title: "Esame di Fondamenti Morfologici e Funzionali della Vita - 18 gennaio 2013",
@@ -108,27 +43,14 @@ module Mork
108
43
  signature: "Firma"
109
44
  }
110
45
  }
111
- s = SheetPDF.new(Grid.new, info)
46
+ s = SheetPDF.new(content)
112
47
  s.save("tmp/f2.pdf")
113
-
114
- info = {
115
- code: 8928348236,
116
- choices: [5] * 160,
117
- header: {
118
- name: "G" * 60,
119
- title: "E" * 100,
120
- code: "119.28",
121
- signature: "Firma"
122
- }
123
- }
124
- s = SheetPDF.new(Grid.new, info)
125
- s.save("tmp/f3.pdf")
126
48
  end
127
49
 
128
50
  it "should create a multipage pdf" do
129
- info = [
51
+ content = [
130
52
  {
131
- code: 18446744073709551615,
53
+ code: 18446744073,
132
54
  choices: [5] * 100,
133
55
  header: {
134
56
  name: "Bertini Giuseppe VR123456 Bertini Giuseppe VR123456",
@@ -139,7 +61,7 @@ module Mork
139
61
  },
140
62
  {
141
63
  code: 5512,
142
- choices: [5] * 160,
64
+ choices: [5] * 100,
143
65
  header: {
144
66
  name: "Bonazza Sara vr354320",
145
67
  title: "Esame di Fondamenti Morfologici e Funzionali della Vita - 18 gennaio 2013",
@@ -148,7 +70,7 @@ module Mork
148
70
  }
149
71
  }
150
72
  ]
151
- s = SheetPDF.new(Grid.new, info)
73
+ s = SheetPDF.new(content)
152
74
  s.save("tmp/p2.pdf")
153
75
  end
154
76
  end