rbpdf 1.20.0 → 1.20.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +4 -0
  3. data/lib/rbpdf/version.rb +1 -1
  4. data/rbpdf.gemspec +1 -2
  5. metadata +4 -90
  6. data/test/err_font1.rb +0 -7
  7. data/test/err_font2.rb +0 -8
  8. data/test/input.jpg +0 -0
  9. data/test/json: +0 -0
  10. data/test/logo_rbpdf_8bit .png +0 -0
  11. data/test/logo_rbpdf_8bit+ .png +0 -0
  12. data/test/logo_rbpdf_8bit.gif +0 -0
  13. data/test/logo_rbpdf_8bit.jpg +0 -0
  14. data/test/logo_rbpdf_8bit.png +0 -0
  15. data/test/logo_rbpdf_8bit_alpha.gif +0 -0
  16. data/test/logo_rbpdf_mono_gray.jpg +0 -0
  17. data/test/logo_rbpdf_mono_gray.png +0 -0
  18. data/test/logo_rbpdf_mono_rgb.jpg +0 -0
  19. data/test/logo_rbpdf_mono_rgb.png +0 -0
  20. data/test/output.png +0 -0
  21. data/test/png_test_alpha.png +0 -0
  22. data/test/png_test_msk_alpha.png +0 -0
  23. data/test/png_test_non_alpha.png +0 -0
  24. data/test/rbpdf_bidi_test.rb +0 -453
  25. data/test/rbpdf_bookmark_test.rb +0 -66
  26. data/test/rbpdf_cell_test.rb +0 -231
  27. data/test/rbpdf_content_test.rb +0 -213
  28. data/test/rbpdf_css_test.rb +0 -640
  29. data/test/rbpdf_dom_test.rb +0 -272
  30. data/test/rbpdf_examples_test.rb +0 -83
  31. data/test/rbpdf_font_func_test.rb +0 -45
  32. data/test/rbpdf_font_style_test.rb +0 -37
  33. data/test/rbpdf_font_test.rb +0 -308
  34. data/test/rbpdf_format_test.rb +0 -30
  35. data/test/rbpdf_func_test.rb +0 -139
  36. data/test/rbpdf_html_anchor_test.rb +0 -105
  37. data/test/rbpdf_html_func_test.rb +0 -170
  38. data/test/rbpdf_html_test.rb +0 -658
  39. data/test/rbpdf_htmlcell_test.rb +0 -60
  40. data/test/rbpdf_http_test.rb +0 -76
  41. data/test/rbpdf_image_rmagick_test.rb +0 -170
  42. data/test/rbpdf_image_test.rb +0 -174
  43. data/test/rbpdf_test.rb +0 -375
  44. data/test/rbpdf_transaction_test.rb +0 -203
  45. data/test/rbpdf_viewerpreferences_test.rb +0 -41
  46. data/test/rbpdf_write_test.rb +0 -229
  47. data/test/test.rb +0 -22
  48. data/test/test_helper.rb +0 -9
@@ -1,375 +0,0 @@
1
- # Copyright (c) 2011-2017 NAITOH Jun
2
- # Released under the MIT license
3
- # http://www.opensource.org/licenses/MIT
4
-
5
- require 'test_helper'
6
-
7
- class RbpdfTest < Test::Unit::TestCase
8
- test "set_x potision" do
9
- pdf = RBPDF.new
10
- width = pdf.get_page_width
11
-
12
- pdf.set_x(5)
13
- x = pdf.get_x
14
- abs_x = pdf.get_abs_x
15
- assert_equal 5, x
16
- assert_equal 5, abs_x
17
-
18
- pdf.set_x(-4)
19
- x = pdf.get_x
20
- abs_x = pdf.get_abs_x
21
- assert_equal width - 4, x
22
- assert_equal width - 4, abs_x
23
-
24
- pdf.set_rtl(true) # Right to Left
25
-
26
- pdf.set_x(5)
27
- x = pdf.get_x
28
- abs_x = pdf.get_abs_x
29
- assert_equal 5, x
30
- assert_equal width - 5, abs_x
31
-
32
- pdf.set_x(-4)
33
- x = pdf.get_x
34
- abs_x = pdf.get_abs_x
35
- assert_equal width - 4, x
36
- assert_equal 4, abs_x
37
- end
38
-
39
- test "set_y potision" do
40
- pdf = RBPDF.new
41
- width = pdf.get_page_width
42
-
43
- pdf.set_left_margin(10)
44
- pdf.set_y(20)
45
- x = pdf.get_x
46
- abs_x = pdf.get_abs_x
47
- y = pdf.get_y
48
- assert_equal 10, x
49
- assert_equal 10, abs_x
50
- assert_equal 20, y
51
-
52
- pdf.set_left_margin(30)
53
- pdf.set_y(20)
54
- x = pdf.get_x
55
- abs_x = pdf.get_abs_x
56
- y = pdf.get_y
57
- assert_equal 30, x
58
- assert_equal 30, abs_x
59
- assert_equal 20, y
60
-
61
- pdf.set_rtl(true) # Right to Left
62
-
63
- pdf.set_right_margin(10)
64
- pdf.set_y(20)
65
- x = pdf.get_x
66
- abs_x = pdf.get_abs_x
67
- y = pdf.get_y
68
- assert_equal 10, x
69
- assert_equal width - 10, abs_x
70
- assert_equal 20, y
71
-
72
- pdf.set_right_margin(30)
73
- pdf.set_y(20)
74
- x = pdf.get_x
75
- abs_x = pdf.get_abs_x
76
- y = pdf.get_y
77
- assert_equal 30, x
78
- assert_equal width - 30, abs_x
79
- assert_equal 20, y
80
- end
81
-
82
- test "add_page potision" do
83
- pdf = RBPDF.new
84
- width = pdf.get_page_width
85
-
86
- pdf.add_page
87
- x = pdf.get_x
88
- abs_x = pdf.get_abs_x
89
- y = pdf.get_y
90
- assert_in_delta 10.00125, x, 0.00001
91
- assert_in_delta 10.00125, abs_x, 0.00001
92
- assert_in_delta 10.00125, y, 0.00001
93
-
94
- pdf.set_rtl(true) # Right to Left
95
-
96
- pdf.add_page
97
- x = pdf.get_x
98
- abs_x = pdf.get_abs_x
99
- y = pdf.get_y
100
- assert_in_delta 10.00125, x, 0.00001
101
- assert_in_delta width - 10.00125, abs_x, 0.00001
102
- assert_in_delta 10.00125, y, 0.00001
103
-
104
- pdf.set_page(1)
105
- page = pdf.get_page
106
- assert_equal 1, page
107
- pdf.set_y(20)
108
- y = pdf.get_y
109
- assert_equal 20, y
110
- pdf.add_page
111
- y = pdf.get_y
112
- assert_in_delta 10.00125, y, 0.00001
113
-
114
- end
115
-
116
- test "add_page" do
117
- pdf = RBPDF.new
118
-
119
- page = pdf.get_page
120
- assert_equal 0, page
121
- pages = pdf.get_num_pages
122
- assert_equal 0, pages
123
-
124
- pdf.add_page
125
- page = pdf.get_page
126
- assert_equal 1, page
127
- pages = pdf.get_num_pages
128
- assert_equal 1, pages
129
-
130
- pdf.add_page
131
- page = pdf.get_page
132
- assert_equal 2, page
133
- pages = pdf.get_num_pages
134
- assert_equal 2, pages
135
-
136
- pdf.set_page(1)
137
- page = pdf.get_page
138
- assert_equal 1, page
139
-
140
- pdf.add_page
141
- page = pdf.get_page
142
- assert_equal 2, page
143
- pages = pdf.get_num_pages
144
- assert_equal 2, pages
145
-
146
- pdf.add_page
147
- page = pdf.get_page
148
- assert_equal 3, page
149
- pages = pdf.get_num_pages
150
- assert_equal 3, pages
151
-
152
- pdf.set_page(1)
153
- page = pdf.get_page
154
- assert_equal 1, page
155
-
156
- pdf.last_page
157
- page = pdf.get_page
158
- assert_equal 3, page
159
- pages = pdf.get_num_pages
160
- assert_equal 3, pages
161
- end
162
-
163
- test "add_page set_page Under Error" do
164
- pdf = RBPDF.new
165
-
166
- page = pdf.get_page
167
- assert_equal 0, page
168
- pages = pdf.get_num_pages
169
- assert_equal 0, pages
170
-
171
- pdf.add_page
172
- page = pdf.get_page
173
- assert_equal 1, page
174
- pages = pdf.get_num_pages
175
- assert_equal 1, pages
176
-
177
- assert_raise(RBPDFError) {pdf.set_page(0)} # Page under size
178
- end
179
-
180
- test "add_page set_page Over Error" do
181
- pdf = RBPDF.new
182
-
183
- page = pdf.get_page
184
- assert_equal 0, page
185
- pages = pdf.get_num_pages
186
- assert_equal 0, pages
187
-
188
- pdf.add_page
189
- page = pdf.get_page
190
- assert_equal 1, page
191
- pages = pdf.get_num_pages
192
- assert_equal 1, pages
193
-
194
- pdf.add_page
195
- page = pdf.get_page
196
- assert_equal 2, page
197
- pages = pdf.get_num_pages
198
- assert_equal 2, pages
199
-
200
- pdf.set_page(1)
201
- page = pdf.get_page
202
- assert_equal 1, page
203
-
204
- assert_raise(RBPDFError) {pdf.set_page(3)} # Page over size
205
- end
206
-
207
- test "deletePage test" do
208
- pdf = RBPDF.new
209
-
210
- pdf.add_page
211
- pdf.write(0, "Page 1")
212
-
213
- page = pdf.get_page
214
- assert_equal 1, page
215
- pages = pdf.get_num_pages
216
- assert_equal 1, pages
217
-
218
- contents1 = pdf.send(:getPageBuffer, 1)
219
-
220
- pdf.add_page
221
- pdf.write(0, "Page 2")
222
-
223
- page = pdf.get_page
224
- assert_equal 2, page
225
- pages = pdf.get_num_pages
226
- assert_equal 2, pages
227
-
228
- contents2 = pdf.send(:getPageBuffer, 2)
229
-
230
- pdf.deletePage(1)
231
- page = pdf.get_page
232
- assert_equal 1, page
233
- pages = pdf.get_num_pages
234
- assert_equal 1, pages
235
-
236
- contents3 = pdf.send(:getPageBuffer, 1)
237
- assert_not_equal contents1, contents3
238
- assert_equal contents2, contents3
239
-
240
- contents4 = pdf.send(:getPageBuffer, 2)
241
- assert_equal false, contents4
242
- end
243
-
244
- test "start_page_group test" do
245
- pdf = RBPDF.new
246
- pdf.add_page
247
- pdf.start_page_group
248
- pdf.start_page_group(1)
249
- pdf.start_page_group(nil)
250
- pdf.start_page_group('')
251
- end
252
-
253
- test "get_page_dimensions test" do
254
- pdf = RBPDF.new
255
- pdf.add_page
256
-
257
- pagedim = pdf.get_page_dimensions
258
- assert_equal 0.0, pagedim['CropBox']['llx']
259
- pagedim = pdf.get_page_dimensions(1)
260
- assert_equal 0.0, pagedim['CropBox']['llx']
261
- pagedim = pdf.get_page_dimensions(nil)
262
- assert_equal 0.0, pagedim['CropBox']['llx']
263
- pagedim = pdf.get_page_dimensions('')
264
- assert_equal 0.0, pagedim['CropBox']['llx']
265
- end
266
-
267
- test "Page Box A4 test 1" do
268
- pdf = RBPDF.new
269
- pagedim = pdf.get_page_dimensions
270
- assert_equal 0.0, pagedim['MediaBox']['llx']
271
- assert_equal 0.0, pagedim['MediaBox']['lly']
272
- assert_equal 595.28, pagedim['MediaBox']['urx']
273
- assert_equal 841.89, pagedim['MediaBox']['ury']
274
- assert_equal 0.0, pagedim['CropBox']['llx']
275
- assert_equal 0.0, pagedim['CropBox']['lly']
276
- assert_equal 595.28, pagedim['CropBox']['urx']
277
- assert_equal 841.89, pagedim['CropBox']['ury']
278
- assert_equal 0.0, pagedim['BleedBox']['llx']
279
- assert_equal 0.0, pagedim['BleedBox']['lly']
280
- assert_equal 595.28, pagedim['BleedBox']['urx']
281
- assert_equal 841.89, pagedim['BleedBox']['ury']
282
- assert_equal 0.0, pagedim['TrimBox']['llx']
283
- assert_equal 0.0, pagedim['TrimBox']['lly']
284
- assert_equal 595.28, pagedim['TrimBox']['urx']
285
- assert_equal 841.89, pagedim['TrimBox']['ury']
286
- assert_equal 0.0, pagedim['ArtBox']['llx']
287
- assert_equal 0.0, pagedim['ArtBox']['lly']
288
- assert_equal 595.28, pagedim['ArtBox']['urx']
289
- assert_equal 841.89, pagedim['ArtBox']['ury']
290
- end
291
-
292
- test "Page Box A4 test 2" do
293
- format = {}
294
- type = ['CropBox', 'BleedBox', 'TrimBox', 'ArtBox']
295
- type.each do |t|
296
- format[t] = {}
297
- format[t]['llx'] = 0
298
- format[t]['lly'] = 0
299
- format[t]['urx'] = 210
300
- format[t]['ury'] = 297
301
- end
302
-
303
- pdf = RBPDF.new('P', 'mm', format)
304
- pagedim = pdf.get_page_dimensions
305
- assert_equal 0.0, pagedim['MediaBox']['llx']
306
- assert_equal 0.0, pagedim['MediaBox']['lly']
307
- assert_in_delta 595.28, pagedim['MediaBox']['urx'], 0.1
308
- assert_in_delta 841.89, pagedim['MediaBox']['ury'], 0.1
309
- assert_equal 0.0, pagedim['CropBox']['llx']
310
- assert_equal 0.0, pagedim['CropBox']['lly']
311
- assert_in_delta 595.28, pagedim['CropBox']['urx'], 0.1
312
- assert_in_delta 841.89, pagedim['CropBox']['ury'], 0.1
313
- assert_equal 0.0, pagedim['BleedBox']['llx']
314
- assert_equal 0.0, pagedim['BleedBox']['lly']
315
- assert_in_delta 595.28, pagedim['BleedBox']['urx'], 0.1
316
- assert_in_delta 841.89, pagedim['BleedBox']['ury'], 0.1
317
- assert_equal 0.0, pagedim['TrimBox']['llx']
318
- assert_equal 0.0, pagedim['TrimBox']['lly']
319
- assert_in_delta 595.28, pagedim['TrimBox']['urx'], 0.1
320
- assert_in_delta 841.89, pagedim['TrimBox']['ury'], 0.1
321
- assert_equal 0.0, pagedim['ArtBox']['llx']
322
- assert_equal 0.0, pagedim['ArtBox']['lly']
323
- assert_in_delta 595.28, pagedim['ArtBox']['urx'], 0.1
324
- assert_in_delta 841.89, pagedim['ArtBox']['ury'], 0.1
325
- end
326
-
327
- test "Page Box A4 test 3" do
328
- format = {}
329
- type = ['MediaBox', 'CropBox', 'BleedBox', 'TrimBox', 'ArtBox']
330
- type.each do |t|
331
- format[t] = {}
332
- format[t]['llx'] = 0
333
- format[t]['lly'] = 0
334
- format[t]['urx'] = 210
335
- format[t]['ury'] = 297
336
- end
337
-
338
- pdf = RBPDF.new('P', 'mm', format)
339
- pagedim = pdf.get_page_dimensions
340
- assert_equal 0.0, pagedim['MediaBox']['llx']
341
- assert_equal 0.0, pagedim['MediaBox']['lly']
342
- assert_in_delta 595.28, pagedim['MediaBox']['urx'], 0.1
343
- assert_in_delta 841.89, pagedim['MediaBox']['ury'], 0.1
344
- assert_equal 0.0, pagedim['CropBox']['llx']
345
- assert_equal 0.0, pagedim['CropBox']['lly']
346
- assert_in_delta 595.28, pagedim['CropBox']['urx'], 0.1
347
- assert_in_delta 841.89, pagedim['CropBox']['ury'], 0.1
348
- assert_equal 0.0, pagedim['BleedBox']['llx']
349
- assert_equal 0.0, pagedim['BleedBox']['lly']
350
- assert_in_delta 595.28, pagedim['BleedBox']['urx'], 0.1
351
- assert_in_delta 841.89, pagedim['BleedBox']['ury'], 0.1
352
- assert_equal 0.0, pagedim['TrimBox']['llx']
353
- assert_equal 0.0, pagedim['TrimBox']['lly']
354
- assert_in_delta 595.28, pagedim['TrimBox']['urx'], 0.1
355
- assert_in_delta 841.89, pagedim['TrimBox']['ury'], 0.1
356
- assert_equal 0.0, pagedim['ArtBox']['llx']
357
- assert_equal 0.0, pagedim['ArtBox']['lly']
358
- assert_in_delta 595.28, pagedim['ArtBox']['urx'], 0.1
359
- assert_in_delta 841.89, pagedim['ArtBox']['ury'], 0.1
360
- end
361
-
362
- test "get_break_margin test" do
363
- pdf = RBPDF.new
364
- pdf.add_page
365
-
366
- b_margin = pdf.get_break_margin
367
- assert_in_delta b_margin, 20.0, 0.1
368
- b_margin = pdf.get_break_margin(1)
369
- assert_in_delta b_margin, 20.0, 0.1
370
- b_margin = pdf.get_break_margin(nil)
371
- assert_in_delta b_margin, 20.0, 0.1
372
- b_margin = pdf.get_break_margin('')
373
- assert_in_delta b_margin, 20.0, 0.1
374
- end
375
- end
@@ -1,203 +0,0 @@
1
- # Copyright (c) 2011-2017 NAITOH Jun
2
- # Released under the MIT license
3
- # http://www.opensource.org/licenses/MIT
4
-
5
- require 'test_helper'
6
-
7
- class RbpdfTest < Test::Unit::TestCase
8
- class MYPDF < RBPDF
9
- def getPageBuffer(page)
10
- super
11
- end
12
- end
13
-
14
- test "Transaction write test without diskcache" do
15
- pdf = MYPDF.new
16
- pdf.add_page()
17
- page = pdf.get_page
18
-
19
- pdf.write(0, "LINE 0\n")
20
- contents01 = pdf.getPageBuffer(page).dup
21
-
22
- pdf.start_transaction()
23
-
24
- pdf.write(0, "LINE 1\n")
25
- pdf.write(0, "LINE 2\n")
26
- contents02 = pdf.getPageBuffer(page).dup
27
- assert_not_equal contents01, contents02
28
-
29
- # rolls back to the last (re)start 1
30
- pdf = pdf.rollback_transaction()
31
- contents03 = pdf.getPageBuffer(page).dup
32
- assert_equal contents01, contents03
33
-
34
- pdf.start_transaction()
35
-
36
- pdf.write(0, "LINE 3\n")
37
- pdf.write(0, "LINE 4\n")
38
- contents04 = pdf.getPageBuffer(page).dup
39
- assert_not_equal contents03, contents04
40
-
41
- # rolls back to the last (re)start 2
42
- pdf = pdf.rollback_transaction()
43
- contents05 = pdf.getPageBuffer(page).dup
44
- assert_equal contents03, contents05
45
-
46
- pdf.commit_transaction()
47
- end
48
-
49
- test "Transaction test with diskcache" do
50
- pdf = MYPDF.new('P', 'mm', 'A4', true, "UTF-8", true)
51
- pdf.add_page()
52
- page = pdf.get_page
53
-
54
- pdf.write(0, "LINE 0\n")
55
- contents01 = pdf.getPageBuffer(page).dup
56
- cache_file1 = pdf.cache_file_length.dup
57
-
58
- pdf.start_transaction()
59
-
60
- pdf.write(0, "LINE 1\n")
61
- pdf.write(0, "LINE 2\n")
62
- cache_file2 = pdf.cache_file_length.dup
63
- contents02 = pdf.getPageBuffer(page).dup
64
- assert_not_equal cache_file1, cache_file2
65
- assert_not_equal contents01, contents02
66
-
67
- # rolls back to the last (re)start 1
68
- pdf = pdf.rollback_transaction()
69
-
70
- cache_file3 = pdf.cache_file_length.dup
71
- contents03 = pdf.getPageBuffer(page).dup
72
- assert_equal cache_file1, cache_file3
73
- assert_equal contents01, contents03
74
-
75
- pdf.start_transaction()
76
-
77
- pdf.write(0, "LINE 3\n")
78
- pdf.write(0, "LINE 4\n")
79
- contents04 = pdf.getPageBuffer(page).dup
80
- assert_not_equal contents03, contents04
81
-
82
- # rolls back to the last (re)start 2
83
- pdf = pdf.rollback_transaction()
84
-
85
- contents05 = pdf.getPageBuffer(page).dup
86
- assert_equal contents03, contents05
87
- end
88
-
89
- test "Transaction multi_cell test without diskcache" do
90
- pdf = MYPDF.new
91
- pdf.add_page()
92
- page = pdf.get_page
93
-
94
- pdf.multi_cell(50, 5, 'mult_cell 1', 0)
95
- contents01 = pdf.getPageBuffer(page).dup
96
-
97
- pdf.start_transaction()
98
-
99
- pdf.multi_cell(50, 5, 'mult_cell 1', 1)
100
- pdf.multi_cell(50, 5, 'mult_cell 2', 1)
101
- contents02 = pdf.getPageBuffer(page).dup
102
- assert_not_equal contents01, contents02
103
-
104
- # rolls back to the last (re)start 1
105
- pdf = pdf.rollback_transaction()
106
- contents03 = pdf.getPageBuffer(page).dup
107
- assert_equal contents01, contents03
108
-
109
- pdf.start_transaction()
110
-
111
- pdf.multi_cell(50, 5, 'mult_cell 3', 1)
112
- pdf.multi_cell(50, 5, 'mult_cell 4', 1)
113
- contents04 = pdf.getPageBuffer(page).dup
114
- assert_not_equal contents03, contents04
115
-
116
- # rolls back to the last (re)start 2
117
- pdf = pdf.rollback_transaction()
118
- contents05 = pdf.getPageBuffer(page).dup
119
- assert_equal contents03, contents05
120
-
121
- pdf.commit_transaction()
122
- end
123
-
124
- test "Transaction mult_cell test with diskcache" do
125
- pdf = MYPDF.new('P', 'mm', 'A4', true, "UTF-8", true)
126
- pdf.add_page()
127
- page = pdf.get_page
128
-
129
- pdf.multi_cell(50, 5, 'mult_cell 0', 1)
130
- cache_file1 = pdf.cache_file_length.dup
131
- contents01 = pdf.getPageBuffer(page).dup
132
-
133
- pdf.start_transaction()
134
-
135
- pdf.multi_cell(50, 5, 'mult_cell 1', 1)
136
- pdf.multi_cell(50, 5, 'mult_cell 2', 1)
137
- cache_file2 = pdf.cache_file_length.dup
138
- contents02 = pdf.getPageBuffer(page).dup
139
- assert_not_equal cache_file1, cache_file2
140
- assert_not_equal contents01, contents02
141
-
142
- # rolls back to the last (re)start 1
143
- pdf = pdf.rollback_transaction()
144
-
145
- contents03 = pdf.getPageBuffer(page).dup
146
- cache_file3 = pdf.cache_file_length.dup
147
- assert_equal cache_file1, cache_file3
148
- assert_equal contents01, contents03
149
-
150
- pdf.start_transaction()
151
-
152
- pdf.multi_cell(50, 5, 'mult_cell 3', 1)
153
- pdf.multi_cell(50, 5, 'mult_cell 4', 1)
154
- contents04 = pdf.getPageBuffer(page).dup
155
- assert_not_equal contents03, contents04
156
-
157
- # rolls back to the last (re)start 2
158
- pdf = pdf.rollback_transaction()
159
-
160
- contents05 = pdf.getPageBuffer(page).dup
161
- assert_equal contents03, contents05
162
- end
163
-
164
- test "Transaction mult_cell self test with diskcache" do
165
- pdf = MYPDF.new('P', 'mm', 'A4', true, "UTF-8", true)
166
- pdf.add_page()
167
- page = pdf.get_page
168
-
169
- pdf.multi_cell(50, 5, 'mult_cell 0', 1)
170
- cache_file1 = pdf.cache_file_length.dup
171
- contents01 = pdf.getPageBuffer(page).dup
172
-
173
- pdf.start_transaction()
174
-
175
- pdf.multi_cell(50, 5, 'mult_cell 1', 1)
176
- pdf.multi_cell(50, 5, 'mult_cell 2', 1)
177
- cache_file2 = pdf.cache_file_length.dup
178
- contents02 = pdf.getPageBuffer(page).dup
179
- assert_not_equal cache_file1, cache_file2
180
- assert_not_equal contents01, contents02
181
-
182
- # rolls back to the last (re)start 1
183
- pdf.rollback_transaction(true)
184
-
185
- contents03 = pdf.getPageBuffer(page).dup
186
- cache_file3 = pdf.cache_file_length.dup
187
- assert_equal cache_file1, cache_file3
188
- assert_equal contents01, contents03
189
-
190
- pdf.start_transaction()
191
-
192
- pdf.multi_cell(50, 5, 'mult_cell 3', 1)
193
- pdf.multi_cell(50, 5, 'mult_cell 4', 1)
194
- contents04 = pdf.getPageBuffer(page).dup
195
- assert_not_equal contents03, contents04
196
-
197
- # rolls back to the last (re)start 2
198
- pdf.rollback_transaction(true)
199
-
200
- contents05 = pdf.getPageBuffer(page).dup
201
- assert_equal contents03, contents05
202
- end
203
- end