rbpdf 1.19.0 → 1.19.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +10 -0
  3. data/Gemfile +4 -0
  4. data/MIT-LICENSE +20 -0
  5. data/README.md +16 -0
  6. data/Rakefile +4 -0
  7. data/lib/core/rmagick.rb +1 -1
  8. data/lib/rbpdf.rb +82 -47
  9. data/lib/rbpdf/version.rb +5 -1
  10. data/lib/rbpdf_encode_ok.rb +15170 -0
  11. data/lib/rbpdf_encode_ok2.rb +15178 -0
  12. data/lib/unicode_data.rb +18 -1
  13. data/rbpdf.gemspec +21 -5
  14. data/test/_rbpdf_image_test.rb_ +161 -0
  15. data/test/err_font1.rb +4 -0
  16. data/test/err_font2.rb +4 -0
  17. data/test/logo_rbpdf_8bit .png +0 -0
  18. data/test/logo_rbpdf_8bit+ .png +0 -0
  19. data/test/logo_rbpdf_8bit_/343/201/202/343/201/204/343/201/206/343/201/210/343/201/212.png +0 -0
  20. data/test/rbpdf_bidi_test.rb +76 -71
  21. data/test/rbpdf_bookmark_test.rb +38 -28
  22. data/test/rbpdf_cell_test.rb +120 -40
  23. data/test/rbpdf_content_test.rb +62 -45
  24. data/test/rbpdf_css_test.rb +275 -271
  25. data/test/rbpdf_dom_test.rb +123 -113
  26. data/test/rbpdf_font_func_test.rb +6 -2
  27. data/test/rbpdf_font_style_test.rb +7 -3
  28. data/test/rbpdf_font_test.rb +44 -27
  29. data/test/rbpdf_format_test.rb +15 -11
  30. data/test/rbpdf_func_test.rb +26 -22
  31. data/test/rbpdf_html_anchor_test.rb +11 -13
  32. data/test/rbpdf_html_func_test.rb +34 -30
  33. data/test/rbpdf_html_test.rb +58 -5
  34. data/test/rbpdf_htmlcell_test.rb +10 -6
  35. data/test/rbpdf_http_test.rb +67 -0
  36. data/test/rbpdf_image_rmagick_test.rb +70 -87
  37. data/test/rbpdf_image_test.rb +86 -22
  38. data/test/rbpdf_test.rb +88 -90
  39. data/test/rbpdf_transaction_test.rb +4 -0
  40. data/test/rbpdf_viewerpreferences_test.rb +5 -1
  41. data/test/rbpdf_write_test.rb +49 -45
  42. data/test/test_helper.rb +5 -0
  43. data/test_unicode.rbpdf +4 -0
  44. metadata +22 -9
@@ -1,12 +1,10 @@
1
+ # Copyright (c) 2011-2017 NAITOH Jun
2
+ # Released under the MIT license
3
+ # http://www.opensource.org/licenses/MIT
4
+
1
5
  require 'test_helper'
2
6
 
3
7
  class RbpdfTest < Test::Unit::TestCase
4
- class MYPDF < RBPDF
5
- def getPageBuffer(page)
6
- super
7
- end
8
- end
9
-
10
8
  test "set_x potision" do
11
9
  pdf = RBPDF.new
12
10
  width = pdf.get_page_width
@@ -207,7 +205,7 @@ class RbpdfTest < Test::Unit::TestCase
207
205
  end
208
206
 
209
207
  test "deletePage test" do
210
- pdf = MYPDF.new
208
+ pdf = RBPDF.new
211
209
 
212
210
  pdf.add_page
213
211
  pdf.write(0, "Page 1")
@@ -217,7 +215,7 @@ class RbpdfTest < Test::Unit::TestCase
217
215
  pages = pdf.get_num_pages
218
216
  assert_equal 1, pages
219
217
 
220
- contents1 = pdf.getPageBuffer(1)
218
+ contents1 = pdf.send(:getPageBuffer, 1)
221
219
 
222
220
  pdf.add_page
223
221
  pdf.write(0, "Page 2")
@@ -227,7 +225,7 @@ class RbpdfTest < Test::Unit::TestCase
227
225
  pages = pdf.get_num_pages
228
226
  assert_equal 2, pages
229
227
 
230
- contents2 = pdf.getPageBuffer(2)
228
+ contents2 = pdf.send(:getPageBuffer, 2)
231
229
 
232
230
  pdf.deletePage(1)
233
231
  page = pdf.get_page
@@ -235,12 +233,12 @@ class RbpdfTest < Test::Unit::TestCase
235
233
  pages = pdf.get_num_pages
236
234
  assert_equal 1, pages
237
235
 
238
- contents3 = pdf.getPageBuffer(1)
239
- assert_not_equal contents3, contents1
240
- assert_equal contents3, contents2
236
+ contents3 = pdf.send(:getPageBuffer, 1)
237
+ assert_not_equal contents1, contents3
238
+ assert_equal contents2, contents3
241
239
 
242
- contents4 = pdf.getPageBuffer(2)
243
- assert_equal contents4, false
240
+ contents4 = pdf.send(:getPageBuffer, 2)
241
+ assert_equal false, contents4
244
242
  end
245
243
 
246
244
  test "start_page_group test" do
@@ -257,108 +255,108 @@ class RbpdfTest < Test::Unit::TestCase
257
255
  pdf.add_page
258
256
 
259
257
  pagedim = pdf.get_page_dimensions
260
- assert_equal pagedim['CropBox']['llx'], 0.0
258
+ assert_equal 0.0, pagedim['CropBox']['llx']
261
259
  pagedim = pdf.get_page_dimensions(1)
262
- assert_equal pagedim['CropBox']['llx'], 0.0
260
+ assert_equal 0.0, pagedim['CropBox']['llx']
263
261
  pagedim = pdf.get_page_dimensions(nil)
264
- assert_equal pagedim['CropBox']['llx'], 0.0
262
+ assert_equal 0.0, pagedim['CropBox']['llx']
265
263
  pagedim = pdf.get_page_dimensions('')
266
- assert_equal pagedim['CropBox']['llx'], 0.0
264
+ assert_equal 0.0, pagedim['CropBox']['llx']
267
265
  end
268
266
 
269
267
  test "Page Box A4 test 1" do
270
268
  pdf = RBPDF.new
271
269
  pagedim = pdf.get_page_dimensions
272
- assert_equal pagedim['MediaBox']['llx'], 0.0
273
- assert_equal pagedim['MediaBox']['lly'], 0.0
274
- assert_equal pagedim['MediaBox']['urx'], 595.28
275
- assert_equal pagedim['MediaBox']['ury'], 841.89
276
- assert_equal pagedim['CropBox']['llx'], 0.0
277
- assert_equal pagedim['CropBox']['lly'], 0.0
278
- assert_equal pagedim['CropBox']['urx'], 595.28
279
- assert_equal pagedim['CropBox']['ury'], 841.89
280
- assert_equal pagedim['BleedBox']['llx'], 0.0
281
- assert_equal pagedim['BleedBox']['lly'], 0.0
282
- assert_equal pagedim['BleedBox']['urx'], 595.28
283
- assert_equal pagedim['BleedBox']['ury'], 841.89
284
- assert_equal pagedim['TrimBox']['llx'], 0.0
285
- assert_equal pagedim['TrimBox']['lly'], 0.0
286
- assert_equal pagedim['TrimBox']['urx'], 595.28
287
- assert_equal pagedim['TrimBox']['ury'], 841.89
288
- assert_equal pagedim['ArtBox']['llx'], 0.0
289
- assert_equal pagedim['ArtBox']['lly'], 0.0
290
- assert_equal pagedim['ArtBox']['urx'], 595.28
291
- assert_equal pagedim['ArtBox']['ury'], 841.89
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']
292
290
  end
293
291
 
294
292
  test "Page Box A4 test 2" do
295
293
  format = {}
296
294
  type = ['CropBox', 'BleedBox', 'TrimBox', 'ArtBox']
297
- type.each do |type|
298
- format[type] = {}
299
- format[type]['llx'] = 0
300
- format[type]['lly'] = 0
301
- format[type]['urx'] = 210
302
- format[type]['ury'] = 297
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
303
301
  end
304
302
 
305
303
  pdf = RBPDF.new('P', 'mm', format)
306
304
  pagedim = pdf.get_page_dimensions
307
- assert_equal pagedim['MediaBox']['llx'], 0.0
308
- assert_equal pagedim['MediaBox']['lly'], 0.0
309
- assert_in_delta pagedim['MediaBox']['urx'], 595.28, 0.1
310
- assert_in_delta pagedim['MediaBox']['ury'], 841.89, 0.1
311
- assert_equal pagedim['CropBox']['llx'], 0.0
312
- assert_equal pagedim['CropBox']['lly'], 0.0
313
- assert_in_delta pagedim['CropBox']['urx'], 595.28, 0.1
314
- assert_in_delta pagedim['CropBox']['ury'], 841.89, 0.1
315
- assert_equal pagedim['BleedBox']['llx'], 0.0
316
- assert_equal pagedim['BleedBox']['lly'], 0.0
317
- assert_in_delta pagedim['BleedBox']['urx'], 595.28, 0.1
318
- assert_in_delta pagedim['BleedBox']['ury'], 841.89, 0.1
319
- assert_equal pagedim['TrimBox']['llx'], 0.0
320
- assert_equal pagedim['TrimBox']['lly'], 0.0
321
- assert_in_delta pagedim['TrimBox']['urx'], 595.28, 0.1
322
- assert_in_delta pagedim['TrimBox']['ury'], 841.89, 0.1
323
- assert_equal pagedim['ArtBox']['llx'], 0.0
324
- assert_equal pagedim['ArtBox']['lly'], 0.0
325
- assert_in_delta pagedim['ArtBox']['urx'], 595.28, 0.1
326
- assert_in_delta pagedim['ArtBox']['ury'], 841.89, 0.1
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
327
325
  end
328
326
 
329
327
  test "Page Box A4 test 3" do
330
328
  format = {}
331
329
  type = ['MediaBox', 'CropBox', 'BleedBox', 'TrimBox', 'ArtBox']
332
- type.each do |type|
333
- format[type] = {}
334
- format[type]['llx'] = 0
335
- format[type]['lly'] = 0
336
- format[type]['urx'] = 210
337
- format[type]['ury'] = 297
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
338
336
  end
339
337
 
340
338
  pdf = RBPDF.new('P', 'mm', format)
341
339
  pagedim = pdf.get_page_dimensions
342
- assert_equal pagedim['MediaBox']['llx'], 0.0
343
- assert_equal pagedim['MediaBox']['lly'], 0.0
344
- assert_in_delta pagedim['MediaBox']['urx'], 595.28, 0.1
345
- assert_in_delta pagedim['MediaBox']['ury'], 841.89, 0.1
346
- assert_equal pagedim['CropBox']['llx'], 0.0
347
- assert_equal pagedim['CropBox']['lly'], 0.0
348
- assert_in_delta pagedim['CropBox']['urx'], 595.28, 0.1
349
- assert_in_delta pagedim['CropBox']['ury'], 841.89, 0.1
350
- assert_equal pagedim['BleedBox']['llx'], 0.0
351
- assert_equal pagedim['BleedBox']['lly'], 0.0
352
- assert_in_delta pagedim['BleedBox']['urx'], 595.28, 0.1
353
- assert_in_delta pagedim['BleedBox']['ury'], 841.89, 0.1
354
- assert_equal pagedim['TrimBox']['llx'], 0.0
355
- assert_equal pagedim['TrimBox']['lly'], 0.0
356
- assert_in_delta pagedim['TrimBox']['urx'], 595.28, 0.1
357
- assert_in_delta pagedim['TrimBox']['ury'], 841.89, 0.1
358
- assert_equal pagedim['ArtBox']['llx'], 0.0
359
- assert_equal pagedim['ArtBox']['lly'], 0.0
360
- assert_in_delta pagedim['ArtBox']['urx'], 595.28, 0.1
361
- assert_in_delta pagedim['ArtBox']['ury'], 841.89, 0.1
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
362
360
  end
363
361
 
364
362
  test "get_break_margin test" do
@@ -1,3 +1,7 @@
1
+ # Copyright (c) 2011-2017 NAITOH Jun
2
+ # Released under the MIT license
3
+ # http://www.opensource.org/licenses/MIT
4
+
1
5
  require 'test_helper'
2
6
 
3
7
  class RbpdfTest < Test::Unit::TestCase
@@ -1,3 +1,7 @@
1
+ # Copyright (c) 2011-2017 NAITOH Jun
2
+ # Released under the MIT license
3
+ # http://www.opensource.org/licenses/MIT
4
+
1
5
  require 'test_helper'
2
6
 
3
7
  class RbpdfPageTest < Test::Unit::TestCase
@@ -32,6 +36,6 @@ class RbpdfPageTest < Test::Unit::TestCase
32
36
  pdf.set_viewer_preferences(preferences)
33
37
  out = pdf.putviewerpreferences()
34
38
 
35
- assert_equal out, '/ViewerPreferences << /Direction /L2R /HideToolbar true /HideMenubar true /HideWindowUI true /FitWindow true /CenterWindow true /DisplayDocTitle true /NonFullScreenPageMode /UseNone /ViewArea /CropBox /ViewClip /CropBox /PrintArea /CropBox /PrintClip /CropBox /PrintScaling /AppDefault /Duplex /DuplexFlipLongEdge /PickTrayByPDFSize true /PrintPageRange [0 0 1 2] /NumCopies 2 >>'
39
+ assert_equal '/ViewerPreferences << /Direction /L2R /HideToolbar true /HideMenubar true /HideWindowUI true /FitWindow true /CenterWindow true /DisplayDocTitle true /NonFullScreenPageMode /UseNone /ViewArea /CropBox /ViewClip /CropBox /PrintArea /CropBox /PrintClip /CropBox /PrintScaling /AppDefault /Duplex /DuplexFlipLongEdge /PickTrayByPDFSize true /PrintPageRange [0 0 1 2] /NumCopies 2 >>', out
36
40
  end
37
41
  end
@@ -1,3 +1,7 @@
1
+ # Copyright (c) 2011-2017 NAITOH Jun
2
+ # Released under the MIT license
3
+ # http://www.opensource.org/licenses/MIT
4
+
1
5
  require 'test_helper'
2
6
 
3
7
  class RbpdfTest < Test::Unit::TestCase
@@ -5,26 +9,26 @@ class RbpdfTest < Test::Unit::TestCase
5
9
  pdf = RBPDF.new
6
10
 
7
11
  line = pdf.write(0, "LINE 1")
8
- assert_equal line, 1
12
+ assert_equal 1, line
9
13
 
10
14
  line = pdf.write(0, "LINE 1\n")
11
- assert_equal line, 1
15
+ assert_equal 1, line
12
16
 
13
17
  line = pdf.write(0, "LINE 1\n2\n")
14
- assert_equal line, 2
18
+ assert_equal 2, line
15
19
 
16
20
  line = pdf.write(0, "")
17
- assert_equal line, 1
21
+ assert_equal 1, line
18
22
 
19
23
  line = pdf.write(0, "\n")
20
- assert_equal line, 1
24
+ assert_equal 1, line
21
25
 
22
26
  line = pdf.write(0, "abcdefghijklmnopgrstuvwxyz01234567890")
23
- assert_equal line, 1
27
+ assert_equal 1, line
24
28
  line = pdf.write(0, "abcdefghijklmnopgrstuvwxyz01234567890 abcdefghijklmnopgrstuvwxyz01234567890 abcdefghijklmnopgrstuvwxyz01234567890")
25
- assert_equal line, 2
29
+ assert_equal 2, line
26
30
  line = pdf.write(0, "abcdefghijklmnopgrstuvwxyz01234567890 abcdefghijklmnopgrstuvwxyz01234567890 abcdefghijklmnopgrstuvwxyz01234567890 abcdefghijklmnopgrstuvwxyz01234567890 abcdefghijklmnopgrstuvwxyz01234567890")
27
- assert_equal line, 3
31
+ assert_equal 3, line
28
32
  end
29
33
 
30
34
  test "write Break test single line 1" do
@@ -36,21 +40,21 @@ class RbpdfTest < Test::Unit::TestCase
36
40
  break_hight = pdf.set_auto_page_break(true)
37
41
 
38
42
  pno = pdf.get_page
39
- assert_equal pno, 1
43
+ assert_equal 1, pno
40
44
 
41
45
  0.upto(60) do |i|
42
46
  y = pdf.get_y()
43
47
  old_pno = pno
44
48
 
45
49
  line = pdf.write(0, "LINE 1\n")
46
- assert_equal line, 1
50
+ assert_equal 1, line
47
51
 
48
52
  pno = pdf.get_page
49
53
 
50
54
  if y + fontsize * cell_hight < break_hight
51
- assert_equal pno, old_pno
55
+ assert_equal old_pno, pno
52
56
  else
53
- assert_equal pno, old_pno + 1
57
+ assert_equal old_pno + 1, pno
54
58
  end
55
59
  end
56
60
  end
@@ -61,70 +65,70 @@ class RbpdfTest < Test::Unit::TestCase
61
65
 
62
66
  0.upto(49) do |i|
63
67
  line = pdf.write(0, "LINE 1\n")
64
- assert_equal line, 1
68
+ assert_equal 1, line
65
69
 
66
70
  pno = pdf.get_page
67
- assert_equal pno, 1
71
+ assert_equal 1, pno
68
72
  end
69
73
 
70
74
  line = pdf.write(0, "abcdefghijklmnopgrstuvwxyz01234567890 abcdefghijklmnopgrstuvwxyz01234567890 abcdefghijklmnopgrstuvwxyz01234567890")
71
- assert_equal line, 2
75
+ assert_equal 2, line
72
76
  pno = pdf.get_page
73
- assert_equal pno, 2
77
+ assert_equal 2, pno
74
78
  end
75
79
 
76
80
  test "write Break test multi line 1" do
77
81
  pdf = RBPDF.new
78
82
  pdf.add_page()
79
83
  pno = pdf.get_page
80
- assert_equal pno, 1
84
+ assert_equal 1, pno
81
85
 
82
86
  line = pdf.write(0, "1\n\n\n\n\n\n\n\n\n\n 2\n\n\n\n\n\n\n\n\n\n 3\n\n\n\n\n\n\n\n\n\n 4\n\n\n\n\n\n\n\n\n\n")
83
- assert_equal line, 40
87
+ assert_equal 40, line
84
88
  pno = pdf.get_page
85
- assert_equal pno, 1
89
+ assert_equal 1, pno
86
90
 
87
91
  line = pdf.write(0, "1\n\n\n\n\n\n\n\n\n\n 2\n\n\n\n\n\n\n\n\n\n 3\n\n\n\n\n\n\n\n\n\n 4\n\n\n\n\n\n\n\n\n\n")
88
- assert_equal line, 40
92
+ assert_equal 40, line
89
93
  pno = pdf.get_page
90
- assert_equal pno, 2
94
+ assert_equal 2, pno
91
95
  end
92
96
 
93
97
  test "write Break test multi line 2" do
94
98
  pdf = RBPDF.new
95
99
  pdf.add_page()
96
100
  pno = pdf.get_page
97
- assert_equal pno, 1
101
+ assert_equal 1, pno
98
102
 
99
103
  line = pdf.write(0, "1\n\n\n\n\n\n\n\n\n\n 2\n\n\n\n\n\n\n\n\n\n 3\n\n\n\n\n\n\n\n\n\n 4\n\n\n\n\n\n\n\n\n\n 5\n\n\n\n\n\n\n\n\n\n 6\n\n\n\n\n\n\n\n\n\n 7\n\n\n\n\n\n\n\n\n\n 8\n\n\n\n\n\n\n\n\n\n 9\n\n\n\n\n\n\n\n\n\n 10\n\n\n\n\n\n\n\n\n\n 11\n\n\n\n\n\n\n\n\n\n")
100
- assert_equal line, 110
104
+ assert_equal 110, line
101
105
  pno = pdf.get_page
102
- assert_equal pno, 3
106
+ assert_equal 3, pno
103
107
  end
104
108
 
105
109
  test "write firstline test" do
106
110
  pdf = RBPDF.new
107
111
  pdf.add_page()
108
112
  pno = pdf.get_page
109
- assert_equal pno, 1
113
+ assert_equal 1, pno
110
114
 
111
115
  line = pdf.write(0, "\n", nil, 0, '', false, 0, true)
112
- assert_equal line, "\n"
116
+ assert_equal "\n", line
113
117
 
114
118
  line = pdf.write(0, "\n", nil, 0, '', false, 0, true)
115
- assert_equal line, "\n"
119
+ assert_equal "\n", line
116
120
 
117
121
  line = pdf.write(0, "12345\n", nil, 0, '', false, 0, true)
118
- assert_equal line, "\n"
122
+ assert_equal "\n", line
119
123
 
120
124
  line = pdf.write(0, "12345\nabcde", nil, 0, '', false, 0, true)
121
- assert_equal line, "\nabcde"
125
+ assert_equal "\nabcde", line
122
126
 
123
127
  line = pdf.write(0, "12345\nabcde\n", nil, 0, '', false, 0, true)
124
- assert_equal line, "\nabcde\n"
128
+ assert_equal "\nabcde\n", line
125
129
 
126
130
  line = pdf.write(0, "12345\nabcde\nefgh", nil, 0, '', false, 0, true)
127
- assert_equal line, "\nabcde\nefgh"
131
+ assert_equal "\nabcde\nefgh", line
128
132
  end
129
133
 
130
134
  class MYPDF < RBPDF
@@ -139,9 +143,9 @@ class RbpdfTest < Test::Unit::TestCase
139
143
  test "write endline x test 1" do
140
144
  pdf = MYPDF.new
141
145
  pdf.add_page()
142
- line = pdf.write(0, " cccccccccc cccccccccc ", nil, 0, '', false, 0, true)
146
+ pdf.write(0, " cccccccccc cccccccccc ", nil, 0, '', false, 0, true)
143
147
  endlinex = pdf.endlinex()
144
- assert_not_equal endlinex, 0
148
+ assert_not_equal 0, endlinex
145
149
  end
146
150
 
147
151
  test "write endline x test 2" do
@@ -152,9 +156,9 @@ class RbpdfTest < Test::Unit::TestCase
152
156
  width = pdf.getPageWidth()
153
157
  x = width - r_margin - 10
154
158
  pdf.SetX(x)
155
- line = pdf.write(0, " cccccccccc cccccccccc ", nil, 0, '', false, 0, true)
159
+ pdf.write(0, " cccccccccc cccccccccc ", nil, 0, '', false, 0, true)
156
160
  endlinex = pdf.endlinex()
157
- assert_equal endlinex, x
161
+ assert_equal x, endlinex
158
162
  end
159
163
 
160
164
  test "write endline x test 3" do
@@ -165,9 +169,9 @@ class RbpdfTest < Test::Unit::TestCase
165
169
  width = pdf.getPageWidth()
166
170
  x = width - r_margin - 10
167
171
  pdf.SetX(x)
168
- line = pdf.write(0, "cccccccccc cccccccccc ", nil, 0, '', false, 0, true)
172
+ pdf.write(0, "cccccccccc cccccccccc ", nil, 0, '', false, 0, true)
169
173
  endlinex = pdf.endlinex()
170
- assert_not_equal endlinex, x
174
+ assert_not_equal x, endlinex
171
175
  end
172
176
 
173
177
  test "write encoding test" do
@@ -175,8 +179,8 @@ class RbpdfTest < Test::Unit::TestCase
175
179
 
176
180
  pdf = RBPDF.new('P', 'mm', 'A4', true, "UTF-8", true)
177
181
  str = 'test'.force_encoding('UTF-8')
178
- width = pdf.write(0, str)
179
- assert_equal str.encoding.to_s, 'UTF-8'
182
+ pdf.write(0, str)
183
+ assert_equal 'UTF-8', str.encoding.to_s
180
184
  end
181
185
 
182
186
  test "write Bidi arabic test" do
@@ -188,9 +192,9 @@ class RbpdfTest < Test::Unit::TestCase
188
192
  utf8_arabic_str_1 = "\xd8\xaf\xd9\x88\xd8\xb1"
189
193
 
190
194
  line = pdf.write(0, ascii_str)
191
- assert_equal line, 1
195
+ assert_equal 1, line
192
196
  line = pdf.write(0, utf8_arabic_str_1)
193
- assert_equal line, 1
197
+ assert_equal 1, line
194
198
  end
195
199
 
196
200
  test "write Bidi arabic set_rtl test" do
@@ -203,9 +207,9 @@ class RbpdfTest < Test::Unit::TestCase
203
207
  utf8_arabic_str_1 = "\xd8\xaf\xd9\x88\xd8\xb1"
204
208
 
205
209
  line = pdf.write(0, ascii_str)
206
- assert_equal line, 1
210
+ assert_equal 1, line
207
211
  line = pdf.write(0, utf8_arabic_str_1)
208
- assert_equal line, 1
212
+ assert_equal 1, line
209
213
  end
210
214
 
211
215
  test "write Bidi arabic set_temp_rtl test" do
@@ -218,8 +222,8 @@ class RbpdfTest < Test::Unit::TestCase
218
222
  utf8_arabic_str_1 = "\xd8\xaf\xd9\x88\xd8\xb1"
219
223
 
220
224
  line = pdf.write(0, ascii_str)
221
- assert_equal line, 1
225
+ assert_equal 1, line
222
226
  line = pdf.write(0, utf8_arabic_str_1)
223
- assert_equal line, 1
227
+ assert_equal 1, line
224
228
  end
225
229
  end