thinreports 0.7.6 → 0.7.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -0
  3. data/.travis.yml +11 -1
  4. data/Gemfile +2 -9
  5. data/MIT-LICENSE +1 -1
  6. data/README.rdoc +25 -26
  7. data/lib/thinreports/core/format/base.rb +0 -5
  8. data/lib/thinreports/core/format/builder.rb +5 -5
  9. data/lib/thinreports/core/page.rb +5 -3
  10. data/lib/thinreports/core/shape.rb +2 -0
  11. data/lib/thinreports/core/shape/basic/internal.rb +5 -1
  12. data/lib/thinreports/core/shape/list/configuration.rb +9 -3
  13. data/lib/thinreports/core/shape/list/manager.rb +11 -4
  14. data/lib/thinreports/core/shape/list/page.rb +3 -1
  15. data/lib/thinreports/core/shape/list/page_state.rb +4 -1
  16. data/lib/thinreports/core/shape/manager/internal.rb +1 -1
  17. data/lib/thinreports/core/shape/page_number.rb +15 -0
  18. data/lib/thinreports/core/shape/page_number/format.rb +25 -0
  19. data/lib/thinreports/core/shape/page_number/interface.rb +27 -0
  20. data/lib/thinreports/core/shape/page_number/internal.rb +57 -0
  21. data/lib/thinreports/core/shape/style/text.rb +6 -2
  22. data/lib/thinreports/core/shape/text_block/format.rb +1 -0
  23. data/lib/thinreports/generator/pdf.rb +1 -1
  24. data/lib/thinreports/generator/pdf/document/draw_shape.rb +14 -4
  25. data/lib/thinreports/generator/pdf/document/graphics/attributes.rb +9 -0
  26. data/lib/thinreports/generator/pdf/document/graphics/text.rb +4 -1
  27. data/lib/thinreports/generator/pdf/document/page.rb +18 -3
  28. data/lib/thinreports/generator/pdf/drawer/base.rb +3 -8
  29. data/lib/thinreports/generator/pdf/drawer/list.rb +31 -12
  30. data/lib/thinreports/generator/pdf/drawer/list_section.rb +5 -5
  31. data/lib/thinreports/generator/pdf/drawer/page.rb +22 -10
  32. data/lib/thinreports/generator/pdf/prawn_ext.rb +18 -1
  33. data/lib/thinreports/layout/base.rb +4 -2
  34. data/lib/thinreports/layout/format.rb +1 -5
  35. data/lib/thinreports/report/base.rb +36 -6
  36. data/lib/thinreports/report/internal.rb +7 -5
  37. data/lib/thinreports/version.rb +1 -1
  38. data/tasks/doc.rake +0 -1
  39. data/test/case/character_spacing/character_spacing.rb +4 -3
  40. data/test/case/dynamic_image/dynamic_image.rb +34 -34
  41. data/test/case/dynamic_style/dynamic_style.rb +141 -141
  42. data/test/case/eudc/eudc.rb +16 -16
  43. data/test/case/helper.rb +39 -20
  44. data/test/case/hidden_shapes/hidden_shapes.rb +4 -8
  45. data/test/case/list_events/list_events.rb +26 -26
  46. data/test/case/list_manual_generation/list_manual_generation.rb +16 -16
  47. data/test/case/list_page_number/list_page_number.rb +17 -0
  48. data/test/case/list_page_number/list_page_number.tlf +1 -0
  49. data/test/case/page_number/page_number.rb +33 -0
  50. data/test/case/page_number/page_number.tlf +1 -0
  51. data/test/case/password_setting/password_setting.rb +10 -0
  52. data/test/case/password_setting/password_setting.tlf +1 -0
  53. data/test/case/single_line_tblock/single_line_tblock.rb +10 -12
  54. data/test/case/tblock_overflow/tblock_overflow.rb +16 -16
  55. data/test/case/tblock_styles/tblock_styles.rb +24 -24
  56. data/test/case/text_align/text_align.rb +5 -6
  57. data/test/case/typeB_page_size/B4_ISO.tlf +1 -0
  58. data/test/case/typeB_page_size/B4_JIS.tlf +1 -0
  59. data/test/case/typeB_page_size/typeB_page_size.rb +17 -0
  60. data/test/case/word_wrap/word_wrap.rb +26 -0
  61. data/test/case/word_wrap/word_wrap.tlf +1 -0
  62. data/test/unit/core/format/test_builder.rb +1 -2
  63. data/test/unit/core/shape/basic/test_internal.rb +9 -1
  64. data/test/unit/core/shape/list/test_configuration.rb +6 -1
  65. data/test/unit/core/shape/list/test_manager.rb +10 -0
  66. data/test/unit/core/shape/list/test_page_state.rb +1 -1
  67. data/test/unit/core/shape/page_number/test_format.rb +73 -0
  68. data/test/unit/core/shape/page_number/test_interface.rb +30 -0
  69. data/test/unit/core/shape/page_number/test_internal.rb +81 -0
  70. data/test/unit/core/shape/styles/test_text.rb +12 -1
  71. data/test/unit/core/shape/text_block/formatter/test_datetime.rb +19 -17
  72. data/test/unit/core/shape/text_block/test_format.rb +5 -0
  73. data/test/unit/core/test_events.rb +5 -3
  74. data/test/unit/core/test_shape.rb +5 -1
  75. data/test/unit/generator/pdf/document/graphics/test_attributes.rb +6 -0
  76. data/test/unit/generator/pdf/document/test_draw_shape.rb +6 -0
  77. data/test/unit/generator/pdf/document/test_page.rb +29 -3
  78. data/test/unit/generator/test_pdf.rb +1 -10
  79. data/test/unit/helper.rb +33 -11
  80. data/test/unit/layout/test_base.rb +1 -1
  81. data/test/unit/report/test_base.rb +47 -0
  82. data/test/unit/report/test_internal.rb +22 -0
  83. data/test/unit/tmp/.gitkeep +0 -0
  84. data/thinreports.gemspec +14 -13
  85. metadata +89 -53
  86. data/.yardopts +0 -1
  87. data/test/case/list_header_inheriting/list_header_inheriting.rb +0 -17
  88. data/test/case/list_header_inheriting/list_header_inheriting.tlf +0 -1
@@ -2,28 +2,47 @@
2
2
 
3
3
  require 'thinreports'
4
4
 
5
- class ThinReports::TestCaseRunner
5
+ class ThinReports::TestCase
6
6
  ROOTDIR = File.expand_path(File.join('test', 'case'))
7
+
8
+ attr_reader :name, :description
9
+
10
+ def initialize(name, description)
11
+ @name = name
12
+ @description = description
13
+ end
14
+
15
+ def start
16
+ print "[#{name}] #{description}: "
17
+ end
18
+
19
+ def success
20
+ print "ok#{$/}"
21
+ end
22
+
23
+ def error(e)
24
+ puts "#{$/}ERROR: #{e}"
25
+ puts e.backtrace
26
+ end
27
+
28
+ def layout_filename
29
+ resource("#{@name}.tlf")
30
+ end
7
31
 
8
- class << self
9
- attr_accessor :current
10
-
11
- def current(casename)
12
- @current = casename.to_s
13
- end
14
-
15
- def layout_file
16
- case_resource("#{@current}.tlf")
17
- end
18
-
19
- def output_file
20
- case_resource("#{@current}.pdf")
21
- end
22
-
23
- def case_resource(filename = nil)
24
- File.join(*[ROOTDIR, @current, filename].compact)
25
- end
32
+ def output_filename
33
+ resource("#{@name}.pdf")
34
+ end
35
+
36
+ def resource(filename = nil)
37
+ File.join(*[ROOTDIR, @name.to_s, filename].compact)
26
38
  end
27
39
  end
28
40
 
29
- CaseRunner = ThinReports::TestCaseRunner
41
+ def testcase(name, description = nil, &block)
42
+ test = ThinReports::TestCase.new(name, description)
43
+ test.start
44
+ block.arity == 1 ? block.call(test) : test.instance_eval(&block)
45
+ test.success
46
+ rescue => e
47
+ test.error(e)
48
+ end
@@ -1,13 +1,9 @@
1
1
  # coding: utf-8
2
2
 
3
- CaseRunner.current :hidden_shapes
3
+ testcase :hidden_shapes, 'Generate PDF that contains hidden shapes' do |t|
4
+ ThinReports::Report.generate(:filename => t.output_filename) do
5
+ use_layout t.layout_filename
4
6
 
5
- ThinReports::Report.generate_file(:pdf, CaseRunner.output_file) do
6
- use_layout(CaseRunner.layout_file)
7
-
8
- start_new_page
9
-
10
- 2.times do
11
- page.list(:List).add_row
7
+ 2.times { list(:List).add_row }
12
8
  end
13
9
  end
@@ -1,32 +1,32 @@
1
1
  # coding: utf-8
2
2
 
3
- CaseRunner.current :list_events
4
-
5
- ThinReports::Report.generate_file(CaseRunner.output_file) do
6
- use_layout(CaseRunner.layout_file) do |config|
7
- config.list do
8
- events.on :page_footer_insert do |e|
9
- e.section.item(:event_name).value(':page_footer_insert')
10
- end
11
- events.on :footer_insert do |e|
12
- e.section.item(:event_name).value(':footer_insert')
13
- end
14
- events.on :page_finalize do |e|
15
- e.list.header.item(:event_name).value(':page_finalize')
16
- e.page.item(:event_name).value(':page_finalize')
3
+ testcase :list_events, 'Basic list events' do |t|
4
+ ThinReports::Report.generate :filename => t.output_filename do
5
+ use_layout(t.layout_filename) do |config|
6
+ config.list do
7
+ events.on :page_footer_insert do |e|
8
+ e.section.item(:event_name).value(':page_footer_insert')
9
+ end
10
+ events.on :footer_insert do |e|
11
+ e.section.item(:event_name).value(':footer_insert')
12
+ end
13
+ events.on :page_finalize do |e|
14
+ e.list.header.item(:event_name).value(':page_finalize')
15
+ e.page.item(:event_name).value(':page_finalize')
16
+ end
17
17
  end
18
18
  end
19
+
20
+ start_new_page
21
+
22
+ 2.times do |t|
23
+ list.add_row :row_name => t + 1
24
+ end
25
+
26
+ start_new_page
27
+
28
+ 8.times do |t|
29
+ list.add_row :row_name => t + 1
30
+ end
19
31
  end
20
-
21
- start_new_page
22
-
23
- 2.times do |t|
24
- page.list(:default).add_row :row_name => t + 1
25
- end
26
-
27
- start_new_page
28
-
29
- 8.times do |t|
30
- page.list(:default).add_row :row_name => t + 1
31
- end
32
32
  end
@@ -1,22 +1,22 @@
1
1
  # coding: utf-8
2
2
 
3
- CaseRunner.current :list_manual_generation
4
-
5
- ThinReports::Report.generate_file(:pdf, CaseRunner.output_file) do
6
- use_layout(CaseRunner.layout_file)
7
-
8
- list.header do |h|
9
- h.item(:header).value(page.no)
10
- end
11
-
12
- 25.times do |t|
13
- if page.list.overflow?
14
- start_new_page
15
- list.header :header => page.no
16
- end
3
+ testcase :list_manual_generation, 'Generate list manually' do |t|
4
+ ThinReports::Report.generate(:filename => t.output_filename) do
5
+ use_layout(t.layout_filename)
17
6
 
18
- list.page_break if t == 15
7
+ list.header do |h|
8
+ h.item(:header).value(page.no)
9
+ end
19
10
 
20
- list.add_row :detail => t
11
+ 25.times do |t|
12
+ if list.overflow?
13
+ start_new_page
14
+ list.header :header => page.no
15
+ end
16
+
17
+ list.page_break if t == 15
18
+
19
+ list.add_row :detail => t
20
+ end
21
21
  end
22
22
  end
@@ -0,0 +1,17 @@
1
+ # coding: utf-8
2
+
3
+ testcase :list_page_number, 'Draw page-number automatically each list' do |t|
4
+ report = ThinReports::Report.new :layout => t.layout_filename
5
+
6
+ report.start_new_page
7
+ report.page.item(:group_no).value('Group A')
8
+
9
+ 10.times { report.list.add_row }
10
+
11
+ report.start_new_page
12
+ report.page.item(:group_no).value('Group B')
13
+
14
+ 20.times { report.list.add_row }
15
+
16
+ report.generate :filename => t.output_filename
17
+ end
@@ -0,0 +1 @@
1
+ {"version":"0.7.6","finger-print":-1073781321,"config":{"title":"","option":{},"page":{"paper-type":"A4","orientation":"portrait","margin-top":"20","margin-bottom":"20","margin-left":"20","margin-right":"20"}},"svg":"<svg width=\"595.2\" height=\"841.8\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" preserveAspectRatio=\"none\" viewBox=\"0 0 595.2 841.8\"><g class=\"canvas\"><!--SHAPE{\"type\":\"s-list\",\"id\":\"default\",\"display\":\"true\",\"desc\":null,\"footer\":{},\"footer-enabled\":\"false\",\"page-footer\":{},\"page-footer-enabled\":\"false\",\"detail\":{\"height\":52.9,\"svg\":{\"tag\":\"g\",\"content\":\"<line stroke=\\\"#000000\\\" stroke-width=\\\"1\\\" fill=\\\"none\\\" class=\\\"s-line\\\" x-display=\\\"true\\\" x-stroke-type=\\\"solid\\\" stroke-dasharray=\\\"none\\\" x-id=\\\"\\\" id=\\\"goog_1602017915\\\" x1=\\\"20\\\" x2=\\\"575.2\\\" y1=\\\"239.9\\\" y2=\\\"239.9\\\"></line><g class=\\\"s-text\\\" stroke-width=\\\"0\\\" fill=\\\"#000000\\\" fill-opacity=\\\"1\\\" kerning=\\\"auto\\\" x-display=\\\"true\\\" x-id=\\\"\\\" id=\\\"goog_1602017916\\\" stroke=\\\"none\\\" font-weight=\\\"normal\\\" font-style=\\\"normal\\\" font-family=\\\"Helvetica\\\" font-size=\\\"18\\\" text-anchor=\\\"middle\\\" x-valign=\\\"center\\\" text-decoration=\\\"none\\\" x-width=\\\"200\\\" x-height=\\\"25.1\\\" x-left=\\\"197.6\\\" x-top=\\\"203.6\\\"><rect class=\\\"s-text-box\\\" stroke=\\\"none\\\" fill=\\\"#000000\\\" fill-opacity=\\\"0.001\\\" width=\\\"200\\\" height=\\\"25.1\\\" x=\\\"197.6\\\" y=\\\"203.6\\\"></rect><text class=\\\"s-text-l0\\\" xml:space=\\\"preserve\\\" stroke=\\\"none\\\" fill=\\\"inherit\\\" fill-opacity=\\\"1\\\" text-decoration=\\\"none\\\" x=\\\"297.6\\\" y=\\\"220.7\\\">Detail</text></g>\"},\"translate\":{\"x\":0,\"y\":-19.9}},\"header\":{\"height\":58.1,\"svg\":{\"tag\":\"g\",\"content\":\"<line stroke=\\\"#000000\\\" stroke-width=\\\"1\\\" fill=\\\"none\\\" class=\\\"s-line\\\" x-display=\\\"true\\\" x-stroke-type=\\\"solid\\\" stroke-dasharray=\\\"none\\\" x-id=\\\"\\\" id=\\\"goog_1602017913\\\" x1=\\\"20\\\" x2=\\\"575.2\\\" y1=\\\"167.1\\\" y2=\\\"167.1\\\"></line><g class=\\\"s-text\\\" stroke-width=\\\"0\\\" fill=\\\"#000000\\\" fill-opacity=\\\"1\\\" kerning=\\\"auto\\\" x-display=\\\"true\\\" x-id=\\\"\\\" id=\\\"goog_1602017914\\\" font-size=\\\"18\\\" font-family=\\\"Helvetica\\\" font-weight=\\\"normal\\\" font-style=\\\"normal\\\" text-anchor=\\\"middle\\\" text-decoration=\\\"none\\\" x-width=\\\"200\\\" x-height=\\\"25.1\\\" x-left=\\\"197.6\\\" x-top=\\\"125.6\\\" x-valign=\\\"center\\\"><rect class=\\\"s-text-box\\\" stroke=\\\"none\\\" fill=\\\"#000000\\\" fill-opacity=\\\"0.001\\\" width=\\\"200\\\" height=\\\"25.1\\\" x=\\\"197.6\\\" y=\\\"125.6\\\"></rect><text class=\\\"s-text-l0\\\" xml:space=\\\"preserve\\\" stroke=\\\"none\\\" fill=\\\"inherit\\\" fill-opacity=\\\"1\\\" text-decoration=\\\"none\\\" x=\\\"297.6\\\" y=\\\"142.7\\\">Header</text></g>\"},\"translate\":{\"x\":0,\"y\":0}},\"header-enabled\":\"true\",\"svg\":{\"tag\":\"g\",\"attrs\":{}},\"content-height\":332.09999999999997,\"page-break\":\"true\"}SHAPE--><!--LAYOUT<g class=\"s-list\" x-id=\"default\" x-header-enabled=\"true\" x-page-footer-enabled=\"false\" x-footer-enabled=\"false\" x-changing-page=\"true\" x-display=\"true\" id=\"goog_1602017912\" width=\"555.2\" height=\"390.2\" x=\"20\" y=\"109\"><g class=\"s-list-header\" transform=\"translate(0,0) rotate(0 0 0)\" x-top=\"109\" x-height=\"58.1\"><line stroke=\"#000000\" stroke-width=\"1\" fill=\"none\" class=\"s-line\" x-display=\"true\" x-stroke-type=\"solid\" stroke-dasharray=\"none\" x-id=\"\" id=\"goog_1602017913\" x1=\"20\" x2=\"575.2\" y1=\"167.1\" y2=\"167.1\"></line><g class=\"s-text\" stroke-width=\"0\" fill=\"#000000\" fill-opacity=\"1\" kerning=\"auto\" x-display=\"true\" x-id=\"\" id=\"goog_1602017914\" font-size=\"18\" font-family=\"Helvetica\" font-weight=\"normal\" font-style=\"normal\" text-anchor=\"middle\" text-decoration=\"none\" x-width=\"200\" x-height=\"25.1\" x-left=\"197.6\" x-top=\"125.6\" x-valign=\"center\"><rect class=\"s-text-box\" stroke=\"none\" fill=\"#000000\" fill-opacity=\"0.001\" width=\"200\" height=\"25.1\" x=\"197.6\" y=\"125.6\"></rect><text class=\"s-text-l0\" xml:space=\"preserve\" stroke=\"none\" fill=\"inherit\" fill-opacity=\"1\" text-decoration=\"none\" x=\"297.6\" y=\"142.7\">Header</text></g></g><g class=\"s-list-detail\" transform=\"translate(0,-19.9) rotate(0 0 0)\" x-top=\"167.1\" x-height=\"52.9\"><line stroke=\"#000000\" stroke-width=\"1\" fill=\"none\" class=\"s-line\" x-display=\"true\" x-stroke-type=\"solid\" stroke-dasharray=\"none\" x-id=\"\" id=\"goog_1602017915\" x1=\"20\" x2=\"575.2\" y1=\"239.9\" y2=\"239.9\"></line><g class=\"s-text\" stroke-width=\"0\" fill=\"#000000\" fill-opacity=\"1\" kerning=\"auto\" x-display=\"true\" x-id=\"\" id=\"goog_1602017916\" stroke=\"none\" font-weight=\"normal\" font-style=\"normal\" font-family=\"Helvetica\" font-size=\"18\" text-anchor=\"middle\" x-valign=\"center\" text-decoration=\"none\" x-width=\"200\" x-height=\"25.1\" x-left=\"197.6\" x-top=\"203.6\"><rect class=\"s-text-box\" stroke=\"none\" fill=\"#000000\" fill-opacity=\"0.001\" width=\"200\" height=\"25.1\" x=\"197.6\" y=\"203.6\"></rect><text class=\"s-text-l0\" xml:space=\"preserve\" stroke=\"none\" fill=\"inherit\" fill-opacity=\"1\" text-decoration=\"none\" x=\"297.6\" y=\"220.7\">Detail</text></g></g><g class=\"s-list-page-footer\" transform=\"translate(0,-45) rotate(0 0 0)\" x-top=\"220\" x-height=\"0\" display=\"none\"></g><g class=\"s-list-footer\" transform=\"translate(0,-103.5) rotate(0 0 0)\" x-top=\"220\" x-height=\"0\" display=\"none\"></g><text class=\"s-list-id\" font-size=\"11\" font-family=\"Helvetica\" font-weight=\"normal\" font-style=\"normal\" text-anchor=\"start\" stroke=\"none\" fill=\"#7C4007\" fill-opacity=\"1\" x=\"22\" y=\"119.8\">default</text><rect stroke-dasharray=\"5\" stroke=\"#BBBBBB\" stroke-width=\"1\" fill=\"#FFFFFF\" fill-opacity=\"0\" class=\"s-list-face\" width=\"555.2\" height=\"390.2\" x=\"20\" y=\"109\"></rect></g>LAYOUT--><!--SHAPE{\"type\":\"s-pageno\",\"id\":\"\",\"display\":\"true\",\"desc\":null,\"box\":{\"x\":273.1,\"y\":756.3,\"width\":186,\"height\":17},\"start-at\":\"\",\"target\":\"\",\"format\":\"{page} / {total}\",\"overflow\":\"\",\"svg\":{\"tag\":\"text\",\"attrs\":{\"x\":273.1,\"y\":769.2,\"kerning\":\"auto\",\"id\":\"goog_1654517107\",\"fill\":\"#000000\",\"fill-opacity\":\"1\",\"font-size\":\"18\",\"font-family\":\"Helvetica\",\"font-weight\":\"normal\",\"font-style\":\"normal\",\"text-anchor\":\"start\",\"text-decoration\":\"none\"}}}SHAPE--><!--LAYOUT<g class=\"s-pageno\" kerning=\"auto\" x-display=\"true\" id=\"goog_1654517107\" fill=\"#000000\" fill-opacity=\"1\" font-size=\"18\" font-family=\"Helvetica\" font-weight=\"normal\" font-style=\"normal\" text-anchor=\"start\" text-decoration=\"none\" x-width=\"186\" x-height=\"17\" x-left=\"273.1\" x-top=\"756.3\" x-id=\"\" x-format=\"{page} / {total}\"><rect class=\"s-pageno-box\" stroke=\"#7C4007\" fill=\"#f4e2c4\" stroke-width=\"0.28\" fill-opacity=\"0.8\" width=\"186\" height=\"17\" x=\"273.1\" y=\"756.3\"></rect><text kerning=\"auto\" font-size=\"11\" font-family=\"Helvetica\" text-anchor=\"middle\" stroke=\"none\" fill=\"#666\" fill-opacity=\"1\" x=\"366.1\" y=\"767.3\">{page} / {total}</text></g>LAYOUT--><!--SHAPE{\"type\":\"s-pageno\",\"id\":\"\",\"display\":\"true\",\"desc\":null,\"box\":{\"x\":434.1,\"y\":75,\"width\":141.1,\"height\":17},\"start-at\":\"\",\"target\":\"default\",\"format\":\"{page} / {total}\",\"overflow\":\"truncate\",\"svg\":{\"tag\":\"text\",\"attrs\":{\"x\":575.2,\"y\":87.9,\"kerning\":\"auto\",\"id\":\"goog_1252273150\",\"fill\":\"#000000\",\"fill-opacity\":\"1\",\"font-size\":\"18\",\"font-family\":\"Helvetica\",\"font-weight\":\"normal\",\"font-style\":\"normal\",\"text-decoration\":\"none\",\"text-anchor\":\"end\"}}}SHAPE--><!--LAYOUT<g class=\"s-pageno\" kerning=\"auto\" x-display=\"true\" id=\"goog_1252273150\" x-width=\"141.1\" x-height=\"17\" x-left=\"434.1\" x-top=\"75\" fill=\"#000000\" fill-opacity=\"1\" font-size=\"18\" font-family=\"Helvetica\" font-weight=\"normal\" font-style=\"normal\" text-decoration=\"none\" text-anchor=\"end\" x-overflow=\"truncate\" x-id=\"\" x-format=\"{page} / {total}\" x-list-id=\"default\" x-target=\"default\"><rect class=\"s-pageno-box\" stroke=\"#7C4007\" fill=\"#f4e2c4\" stroke-width=\"0.28\" fill-opacity=\"0.8\" width=\"141.1\" height=\"17\" x=\"434.1\" y=\"75\"></rect><text kerning=\"auto\" font-size=\"11\" font-family=\"Helvetica\" text-anchor=\"middle\" stroke=\"none\" fill=\"#666\" fill-opacity=\"1\" x=\"504.1\" y=\"86\">{page} / {total}</text></g>LAYOUT--><g class=\"s-text\" stroke-width=\"0\" fill=\"#000000\" fill-opacity=\"1\" kerning=\"auto\" x-display=\"true\" x-id=\"\" id=\"goog_528220625\" font-size=\"16\" font-family=\"Helvetica\" font-weight=\"normal\" font-style=\"normal\" text-anchor=\"end\" text-decoration=\"none\" x-width=\"150.1\" x-height=\"15\" x-left=\"115\" x-top=\"758.3\"><rect class=\"s-text-box\" stroke=\"none\" fill=\"#000000\" fill-opacity=\"0.001\" width=\"150.1\" height=\"15\" x=\"115\" y=\"758.3\"></rect><text class=\"s-text-l0\" xml:space=\"preserve\" stroke=\"none\" fill=\"inherit\" fill-opacity=\"1\" text-decoration=\"none\" x=\"265.1\" y=\"769.8\">Report PageNo:</text></g><!--SHAPE{\"type\":\"s-tblock\",\"id\":\"group_no\",\"display\":\"true\",\"desc\":null,\"multiple\":\"false\",\"valign\":\"\",\"line-height\":\"\",\"box\":{\"x\":20,\"y\":72,\"width\":142.1,\"height\":17},\"format\":{\"base\":\"\",\"type\":\"\"},\"value\":\"\",\"ref-id\":\"\",\"overflow\":\"\",\"svg\":{\"tag\":\"text\",\"attrs\":{\"x\":20,\"y\":84.9,\"xml:space\":\"preserve\",\"kerning\":\"auto\",\"id\":\"goog_528220626\",\"fill\":\"#000000\",\"fill-opacity\":\"1\",\"font-size\":\"18\",\"font-family\":\"Helvetica\",\"font-weight\":\"normal\",\"font-style\":\"normal\",\"text-anchor\":\"start\",\"text-decoration\":\"none\"}}}SHAPE--><!--LAYOUT<g class=\"s-tblock\" x-format-type=\"\" x-value=\"\" x-format-base=\"\" x-ref-id=\"\" kerning=\"auto\" x-display=\"true\" x-multiple=\"false\" id=\"goog_528220626\" x-id=\"group_no\" fill=\"#000000\" fill-opacity=\"1\" font-size=\"18\" font-family=\"Helvetica\" font-weight=\"normal\" font-style=\"normal\" text-anchor=\"start\" text-decoration=\"none\" x-width=\"142.1\" x-height=\"17\" x-left=\"20\" x-top=\"72\"><rect class=\"s-tblock-box\" stroke=\"#7C4007\" fill=\"#f4e2c4\" stroke-width=\"0.28\" fill-opacity=\"0.8\" width=\"142.1\" height=\"17\" x=\"20\" y=\"72\"></rect><text class=\"s-tblock-id\" font-size=\"11\" font-family=\"Helvetica\" font-weight=\"normal\" font-style=\"normal\" text-decoration=\"none\" text-anchor=\"start\" kerning=\"auto\" stroke=\"none\" fill=\"#7C4007\" fill-opacity=\"1\" x=\"22\" y=\"83\">group_no</text></g>LAYOUT--></g></svg>","state":{"layout-guide":[]}}
@@ -0,0 +1,33 @@
1
+ # coding: utf-8
2
+
3
+ testcase :page_number, 'Draw page-number automatically each pages' do |t|
4
+ # Basic PageNumber
5
+ report = ThinReports::Report.new :layout => t.layout_filename
6
+
7
+ report.start_new_page do |page|
8
+ # change visibility
9
+ page.item(:pageno).hide
10
+ end
11
+ report.start_new_page do |page|
12
+ # change style
13
+ page.item(:pageno).styles(:color => 'red',
14
+ :bold => true,
15
+ :underline => true,
16
+ :linethrough => true)
17
+ end
18
+
19
+ # Do not count as total page count
20
+ report.start_new_page :count => false
21
+
22
+ report.start_new_page :count => true
23
+
24
+ report.generate :filename => t.output_filename
25
+
26
+ # PageNumber is started from 5
27
+ report = ThinReports::Report.new :layout => t.layout_filename
28
+ report.start_page_number_from 5
29
+
30
+ 10.times { report.start_new_page }
31
+
32
+ report.generate :filename => t.resource("#{t.name}_from5.pdf")
33
+ end
@@ -0,0 +1 @@
1
+ {"version":"0.7.6","finger-print":-1012307845,"config":{"title":"","option":{},"page":{"paper-type":"A4","orientation":"portrait","margin-top":"20","margin-bottom":"20","margin-left":"20","margin-right":"20"}},"svg":"<svg width=\"595.2\" height=\"841.8\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" preserveAspectRatio=\"none\" viewBox=\"0 0 595.2 841.8\"><g class=\"canvas\"><!--SHAPE{\"type\":\"s-pageno\",\"id\":\"pageno\",\"display\":\"true\",\"desc\":null,\"box\":{\"x\":50,\"y\":205,\"width\":139.1,\"height\":17},\"start-at\":\"\",\"target\":\"\",\"format\":\"{page} / {total}\",\"overflow\":\"truncate\",\"svg\":{\"tag\":\"text\",\"attrs\":{\"x\":119.6,\"y\":217.9,\"kerning\":\"auto\",\"id\":\"goog_703138854\",\"fill\":\"#000000\",\"fill-opacity\":\"1\",\"font-size\":\"18\",\"font-family\":\"Helvetica\",\"font-weight\":\"normal\",\"font-style\":\"normal\",\"text-decoration\":\"none\",\"text-anchor\":\"middle\"}}}SHAPE--><!--LAYOUT<g class=\"s-pageno\" kerning=\"auto\" x-display=\"true\" id=\"goog_703138854\" x-width=\"139.1\" x-height=\"17\" x-left=\"50\" x-top=\"205\" fill=\"#000000\" fill-opacity=\"1\" font-size=\"18\" font-family=\"Helvetica\" font-weight=\"normal\" font-style=\"normal\" text-decoration=\"none\" text-anchor=\"middle\" x-overflow=\"truncate\" x-id=\"pageno\" x-format=\"{page} / {total}\"><rect class=\"s-pageno-box\" stroke=\"#7C4007\" fill=\"#f4e2c4\" stroke-width=\"0.28\" fill-opacity=\"0.8\" width=\"139.1\" height=\"17\" x=\"50\" y=\"205\"></rect><text kerning=\"auto\" font-size=\"11\" font-family=\"Helvetica\" text-anchor=\"middle\" stroke=\"none\" fill=\"#666\" fill-opacity=\"1\" x=\"119\" y=\"216\">{page} / {total}</text></g>LAYOUT--><g class=\"s-text\" stroke-width=\"0\" fill=\"#000000\" fill-opacity=\"1\" kerning=\"auto\" x-display=\"true\" x-id=\"\" id=\"goog_703138857\" font-size=\"18\" font-family=\"Helvetica\" font-weight=\"normal\" font-style=\"normal\" text-anchor=\"start\" text-decoration=\"none\" x-width=\"176.1\" x-height=\"28\" x-left=\"20\" x-top=\"46\"><rect class=\"s-text-box\" stroke=\"none\" fill=\"#000000\" fill-opacity=\"0.001\" width=\"176.1\" height=\"28\" x=\"20\" y=\"46\"></rect><text class=\"s-text-l0\" xml:space=\"preserve\" stroke=\"none\" fill=\"inherit\" fill-opacity=\"1\" text-decoration=\"none\" x=\"20\" y=\"58.9\">Basis</text></g><g class=\"s-text\" stroke-width=\"0\" fill=\"#000000\" fill-opacity=\"1\" kerning=\"auto\" x-display=\"true\" x-id=\"\" id=\"goog_703138858\" font-size=\"14\" font-family=\"Helvetica\" font-weight=\"normal\" font-style=\"normal\" text-anchor=\"start\" text-decoration=\"none\" x-width=\"199.1\" x-height=\"17\" x-left=\"195\" x-top=\"114\"><rect class=\"s-text-box\" stroke=\"none\" fill=\"#000000\" fill-opacity=\"0.001\" width=\"199.1\" height=\"17\" x=\"195\" y=\"114\"></rect><text class=\"s-text-l0\" xml:space=\"preserve\" stroke=\"none\" fill=\"inherit\" fill-opacity=\"1\" text-decoration=\"none\" x=\"195\" y=\"124\">(Center Alignment)</text></g><g class=\"s-text\" stroke-width=\"0\" fill=\"#000000\" fill-opacity=\"1\" kerning=\"auto\" x-display=\"true\" x-id=\"\" id=\"goog_703138859\" stroke=\"none\" font-weight=\"normal\" font-style=\"normal\" font-family=\"Helvetica\" font-size=\"14\" text-anchor=\"start\" text-decoration=\"none\" x-width=\"199.1\" x-height=\"17\" x-left=\"195\" x-top=\"143\"><rect class=\"s-text-box\" stroke=\"none\" fill=\"#000000\" fill-opacity=\"0.001\" width=\"199.1\" height=\"17\" x=\"195\" y=\"143\"></rect><text class=\"s-text-l0\" xml:space=\"preserve\" stroke=\"none\" fill=\"inherit\" fill-opacity=\"1\" text-decoration=\"none\" x=\"195\" y=\"153\">(Right Alignment)</text></g><g class=\"s-text\" stroke-width=\"0\" fill=\"#000000\" fill-opacity=\"1\" kerning=\"auto\" x-display=\"true\" x-id=\"\" id=\"goog_703138860\" stroke=\"none\" font-weight=\"normal\" font-style=\"normal\" font-family=\"Helvetica\" font-size=\"18\" text-anchor=\"start\" text-decoration=\"none\" x-width=\"176.1\" x-height=\"28\" x-left=\"20\" x-top=\"180\"><rect class=\"s-text-box\" stroke=\"none\" fill=\"#000000\" fill-opacity=\"0.001\" width=\"176.1\" height=\"28\" x=\"20\" y=\"180\"></rect><text class=\"s-text-l0\" xml:space=\"preserve\" stroke=\"none\" fill=\"inherit\" fill-opacity=\"1\" text-decoration=\"none\" x=\"20\" y=\"192.9\">With ID</text></g><!--SHAPE{\"type\":\"s-pageno\",\"id\":\"\",\"display\":\"true\",\"desc\":null,\"box\":{\"x\":50,\"y\":113,\"width\":130.1,\"height\":17},\"start-at\":\"\",\"target\":\"\",\"format\":\"{page}\",\"overflow\":\"\",\"svg\":{\"tag\":\"text\",\"attrs\":{\"x\":115.1,\"y\":125.9,\"kerning\":\"auto\",\"id\":\"goog_34633767\",\"fill\":\"#000000\",\"fill-opacity\":\"1\",\"font-size\":\"18\",\"font-family\":\"Helvetica\",\"font-weight\":\"normal\",\"font-style\":\"normal\",\"text-anchor\":\"middle\",\"text-decoration\":\"none\"}}}SHAPE--><!--LAYOUT<g class=\"s-pageno\" kerning=\"auto\" x-display=\"true\" id=\"goog_34633767\" fill=\"#000000\" fill-opacity=\"1\" font-size=\"18\" font-family=\"Helvetica\" font-weight=\"normal\" font-style=\"normal\" text-anchor=\"middle\" text-decoration=\"none\" x-width=\"130.1\" x-height=\"17\" x-left=\"50\" x-top=\"113\" x-id=\"\" x-format=\"{page}\"><rect class=\"s-pageno-box\" stroke=\"#7C4007\" fill=\"#f4e2c4\" stroke-width=\"0.28\" fill-opacity=\"0.8\" width=\"130.1\" height=\"17\" x=\"50\" y=\"113\"></rect><text kerning=\"auto\" font-size=\"11\" font-family=\"Helvetica\" text-anchor=\"middle\" stroke=\"none\" fill=\"#666\" fill-opacity=\"1\" x=\"115\" y=\"124\">{page}</text></g>LAYOUT--><!--SHAPE{\"type\":\"s-pageno\",\"id\":\"\",\"display\":\"true\",\"desc\":null,\"box\":{\"x\":50,\"y\":85,\"width\":130.1,\"height\":18.9},\"start-at\":\"20\",\"target\":\"\",\"format\":\"{page}\",\"overflow\":\"truncate\",\"svg\":{\"tag\":\"text\",\"attrs\":{\"x\":50,\"y\":97.9,\"kerning\":\"10\",\"id\":\"goog_34633768\",\"fill\":\"#000000\",\"fill-opacity\":\"1\",\"font-size\":\"18\",\"font-family\":\"Helvetica\",\"font-weight\":\"normal\",\"font-style\":\"normal\",\"text-decoration\":\"none\",\"text-anchor\":\"start\"}}}SHAPE--><!--LAYOUT<g class=\"s-pageno\" kerning=\"10\" x-display=\"true\" id=\"goog_34633768\" x-width=\"130.1\" x-height=\"18.9\" x-left=\"50\" x-top=\"85\" fill=\"#000000\" fill-opacity=\"1\" font-size=\"18\" font-family=\"Helvetica\" font-weight=\"normal\" font-style=\"normal\" text-decoration=\"none\" text-anchor=\"start\" x-overflow=\"truncate\" x-id=\"\" x-format=\"{page}\" x-start-at=\"20\"><rect class=\"s-pageno-box\" stroke=\"#7C4007\" fill=\"#f4e2c4\" stroke-width=\"0.28\" fill-opacity=\"0.8\" width=\"130.1\" height=\"18.9\" x=\"50\" y=\"85\"></rect><text kerning=\"auto\" font-size=\"11\" font-family=\"Helvetica\" text-anchor=\"middle\" stroke=\"none\" fill=\"#666\" fill-opacity=\"1\" x=\"115\" y=\"96\">{page}</text></g>LAYOUT--><!--SHAPE{\"type\":\"s-pageno\",\"id\":\"\",\"display\":\"true\",\"desc\":null,\"box\":{\"x\":50,\"y\":140,\"width\":130.1,\"height\":17},\"start-at\":\"\",\"target\":\"\",\"format\":\"{page}\",\"overflow\":\"truncate\",\"svg\":{\"tag\":\"text\",\"attrs\":{\"x\":180.1,\"y\":152.9,\"kerning\":\"auto\",\"id\":\"goog_34633769\",\"fill\":\"#000000\",\"fill-opacity\":\"1\",\"font-size\":\"18\",\"font-family\":\"Helvetica\",\"font-weight\":\"normal\",\"font-style\":\"normal\",\"text-decoration\":\"none\",\"text-anchor\":\"end\"}}}SHAPE--><!--LAYOUT<g class=\"s-pageno\" kerning=\"auto\" x-display=\"true\" id=\"goog_34633769\" x-width=\"130.1\" x-height=\"17\" x-left=\"50\" x-top=\"140\" fill=\"#000000\" fill-opacity=\"1\" font-size=\"18\" font-family=\"Helvetica\" font-weight=\"normal\" font-style=\"normal\" text-decoration=\"none\" text-anchor=\"end\" x-overflow=\"truncate\" x-id=\"\" x-format=\"{page}\"><rect class=\"s-pageno-box\" stroke=\"#7C4007\" fill=\"#f4e2c4\" stroke-width=\"0.28\" fill-opacity=\"0.8\" width=\"130.1\" height=\"17\" x=\"50\" y=\"140\"></rect><text kerning=\"auto\" font-size=\"11\" font-family=\"Helvetica\" text-anchor=\"middle\" stroke=\"none\" fill=\"#666\" fill-opacity=\"1\" x=\"115\" y=\"151\">{page}</text></g>LAYOUT--></g></svg>","state":{"layout-guide":[]}}
@@ -0,0 +1,10 @@
1
+ # coding: utf-8
2
+
3
+ testcase :password_setting, 'Set password to open' do |t|
4
+ report = ThinReports::Report.new :layout => t.layout_filename
5
+ report.start_new_page
6
+ report.generate(:filename => t.output_filename, :security => {
7
+ :user_password => 'password',
8
+ :owner_password => :random
9
+ })
10
+ end
@@ -0,0 +1 @@
1
+ {"version":"0.7.6","finger-print":-1162734925,"config":{"title":"","option":{},"page":{"paper-type":"A4","orientation":"portrait","margin-top":"20","margin-bottom":"20","margin-left":"20","margin-right":"20"}},"svg":"<svg width=\"595.2\" height=\"841.8\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" preserveAspectRatio=\"none\" viewBox=\"0 0 595.2 841.8\"><g class=\"canvas\"><g class=\"s-text\" stroke-width=\"0\" fill=\"#000000\" fill-opacity=\"1\" kerning=\"auto\" x-display=\"true\" x-id=\"\" font-size=\"18\" font-family=\"Helvetica\" font-weight=\"normal\" font-style=\"normal\" text-anchor=\"middle\" text-decoration=\"none\" x-width=\"200\" x-height=\"100\" x-left=\"197.6\" x-top=\"138\"><rect class=\"s-text-box\" stroke=\"none\" fill=\"#000000\" fill-opacity=\"0.001\" width=\"200\" height=\"100\" x=\"197.6\" y=\"138\"></rect><text class=\"s-text-l0\" xml:space=\"preserve\" stroke=\"none\" fill=\"inherit\" fill-opacity=\"1\" text-decoration=\"none\" x=\"297.6\" y=\"153.3\">Password is \"password\"</text></g></g></svg>","state":{"layout-guide":[]}}
@@ -1,15 +1,13 @@
1
1
  # coding: utf-8
2
2
 
3
- CaseRunner.current :single_line_tblock
4
-
5
- ThinReports::Report.generate_file(CaseRunner.output_file) do
6
- use_layout(CaseRunner.layout_file)
7
-
8
- start_new_page
9
-
10
- # When Japanese is set to the Tblock to which the Helvetica font is set.
11
- page.item(:fallback_to_ipafont).value('IPA明朝に自動的にフォールバックされる')
12
-
13
- # When multi-line text is set.
14
- page.item(:set_multiline_text).value("1行目\n2行目\n3行目\n4行目\n5行目")
3
+ testcase :single_line_tblock, 'Show a single-line Tblock' do |t|
4
+ ThinReports::Report.generate :filename => t.output_filename do
5
+ use_layout(t.layout_filename)
6
+
7
+ start_new_page
8
+
9
+ page.item(:fallback_to_ipafont).value('IPA明朝に自動的にフォールバックされる')
10
+
11
+ page.item(:set_multiline_text).value("1行目\n2行目\n3行目\n4行目\n5行目")
12
+ end
15
13
  end
@@ -1,20 +1,20 @@
1
1
  # coding: utf-8
2
2
 
3
- CaseRunner.current :tblock_overflow
4
-
5
- report = ThinReports::Report.new :layout => CaseRunner.layout_file
6
- report.start_new_page do |page|
7
- page.values(:truncate => 'The string overflowing from the area will be truncated',
8
- :truncate_ja => '領域から溢れたテキストは切り捨てられます。',
9
- :truncate_m => 'The string overflowing from the area will be truncated')
10
-
11
- page.values(:fit => 'The string overflowing from the area will be reduced',
12
- :fit_ja => '領域から溢れたテキストは縮小されます。',
13
- :fit_m => '複数行モードでも、領域から溢れたテキストは自動的に縮小され折り返して表示されます。')
3
+ testcase :tblock_overflow, 'Control overflowing the Tblock' do
4
+ report = ThinReports::Report.new :layout => layout_filename
5
+ report.start_new_page do |page|
6
+ page.values(:truncate => 'The string overflowing from the area will be truncated',
7
+ :truncate_ja => '領域から溢れたテキストは切り捨てられます。',
8
+ :truncate_m => 'The string overflowing from the area will be truncated')
14
9
 
15
- page.values(:expand => 'If a string was overflowed, a box will be expanded automatically',
16
- :expand_ja => 'テキストが溢れた場合、ボックスが自動的に拡張されます。',
17
- :expand_m => 'If a string was overflowed, a box will be expanded automatically')
10
+ page.values(:fit => 'The string overflowing from the area will be reduced',
11
+ :fit_ja => '領域から溢れたテキストは縮小されます。',
12
+ :fit_m => '複数行モードでも、領域から溢れたテキストは自動的に縮小され折り返して表示されます。')
13
+
14
+ page.values(:expand => 'If a string was overflowed, a box will be expanded automatically',
15
+ :expand_ja => 'テキストが溢れた場合、ボックスが自動的に拡張されます。',
16
+ :expand_m => 'If a string was overflowed, a box will be expanded automatically')
17
+ end
18
+
19
+ report.generate :filename => output_filename
18
20
  end
19
-
20
- report.generate_file(CaseRunner.output_file)
@@ -1,27 +1,27 @@
1
1
  # coding: utf-8
2
2
 
3
- CaseRunner.current :tblock_styles
4
-
5
- ThinReports::Report.generate_file(:pdf, CaseRunner.output_file) do
6
- use_layout(CaseRunner.layout_file)
7
-
8
- start_new_page
9
-
10
- page.item(:space_single_helvetica).value('Char Space in Single(Helvetica)')
11
- page.item(:space_single_ipamincho).value('文字間隔 in 単行(IPA明朝)')
12
-
13
- page.item(:space_multi_times).value("Char Space\nin Multiple(Times New Roman)")
14
- page.item(:space_multi_ipamincho).value("文字間隔\nin 複数行(IPA明朝)")
15
-
16
- page.values(:left_top => '左上揃え',
17
- :left_center => '左中央揃え',
18
- :left_bottom => '左下揃え',
19
- :center_top => '中央上揃え',
20
- :center_center => '中央揃え',
21
- :center_bottom => '中央下揃え',
22
- :right_top => '右上揃え',
23
- :right_center => '右中央揃え',
24
- :right_bottom => '右下揃え')
25
-
26
- page.item(:line_height).value("行間隔2.0\n日本語\nThinReports")
3
+ testcase :tblock_styles, 'Set the styles of Tblock in the Editor' do |t|
4
+ ThinReports::Report.generate :filename => t.output_filename do
5
+ use_layout t.layout_filename
6
+
7
+ start_new_page
8
+
9
+ page.item(:space_single_helvetica).value('Char Space in Single(Helvetica)')
10
+ page.item(:space_single_ipamincho).value('文字間隔 in 単行(IPA明朝)')
11
+
12
+ page.item(:space_multi_times).value("Char Space\nin Multiple(Times New Roman)")
13
+ page.item(:space_multi_ipamincho).value("文字間隔\nin 複数行(IPA明朝)")
14
+
15
+ page.values(:left_top => '左上揃え',
16
+ :left_center => '左中央揃え',
17
+ :left_bottom => '左下揃え',
18
+ :center_top => '中央上揃え',
19
+ :center_center => '中央揃え',
20
+ :center_bottom => '中央下揃え',
21
+ :right_top => '右上揃え',
22
+ :right_center => '右中央揃え',
23
+ :right_bottom => '右下揃え')
24
+
25
+ page.item(:line_height).value("行間隔2.0\n日本語\nThinReports")
26
+ end
27
27
  end
@@ -1,9 +1,8 @@
1
1
  # coding: utf-8
2
2
 
3
- CaseRunner.current :text_align
4
-
5
- ThinReports::Report.generate_file(:pdf, CaseRunner.output_file) do
6
- use_layout(CaseRunner.layout_file)
7
-
8
- start_new_page
3
+ testcase :text_align, 'Sets the text-align style to Text' do |t|
4
+ ThinReports::Report.generate :filename => t.output_filename do
5
+ use_layout t.layout_filename
6
+ start_new_page
7
+ end
9
8
  end
@@ -0,0 +1 @@
1
+ {"version":"0.7.6","finger-print":1242723283,"config":{"title":"B4 ISO","option":{},"page":{"paper-type":"B4_ISO","orientation":"portrait","margin-top":"20","margin-bottom":"20","margin-left":"20","margin-right":"20"}},"svg":"<svg width=\"708.6\" height=\"1000.6\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" preserveAspectRatio=\"none\" viewBox=\"0 0 708.6 1000.6\"><g class=\"canvas\"><g class=\"s-text\" stroke-width=\"0\" fill=\"#000000\" fill-opacity=\"1\" kerning=\"auto\" x-display=\"true\" x-id=\"\" id=\"goog_465465614\" font-size=\"26\" font-family=\"Helvetica\" font-weight=\"normal\" font-style=\"normal\" text-anchor=\"middle\" text-decoration=\"none\" x-width=\"200\" x-height=\"100\" x-left=\"254.3\" x-top=\"20\" x-valign=\"center\"><rect class=\"s-text-box\" stroke=\"none\" fill=\"#000000\" fill-opacity=\"0.001\" width=\"200\" height=\"100\" x=\"254.3\" y=\"20\"></rect><text class=\"s-text-l0\" xml:space=\"preserve\" stroke=\"none\" fill=\"inherit\" fill-opacity=\"1\" text-decoration=\"none\" x=\"354.3\" y=\"76.4\">B4 ISO</text></g></g></svg>","state":{"layout-guide":[]}}
@@ -0,0 +1 @@
1
+ {"version":"0.7.6","finger-print":-1080364850,"config":{"title":"B4 JIS","option":{},"page":{"paper-type":"B4","orientation":"portrait","margin-top":"20","margin-bottom":"20","margin-left":"20","margin-right":"20"}},"svg":"<svg width=\"728.5\" height=\"1031.8\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" preserveAspectRatio=\"none\" viewBox=\"0 0 728.5 1031.8\"><g class=\"canvas\"><g class=\"s-text\" stroke-width=\"0\" fill=\"#000000\" fill-opacity=\"1\" kerning=\"auto\" x-display=\"true\" x-id=\"\" id=\"goog_465465613\" font-size=\"28\" font-family=\"Helvetica\" font-weight=\"normal\" font-style=\"normal\" text-anchor=\"middle\" text-decoration=\"none\" x-width=\"200\" x-height=\"100\" x-left=\"264.3\" x-top=\"20\" x-valign=\"center\"><rect class=\"s-text-box\" stroke=\"none\" fill=\"#000000\" fill-opacity=\"0.001\" width=\"200\" height=\"100\" x=\"264.3\" y=\"20\"></rect><text class=\"s-text-l0\" xml:space=\"preserve\" stroke=\"none\" fill=\"inherit\" fill-opacity=\"1\" text-decoration=\"none\" x=\"364.3\" y=\"76.9\">B4 JIS</text></g></g></svg>","state":{"layout-guide":[]}}
@@ -0,0 +1,17 @@
1
+ # coding: utf-8
2
+
3
+ require 'pdf/inspector'
4
+
5
+ testcase :typeB_page_size, 'Generate type B(JIS/ISO) size pages' do |t|
6
+ report = ThinReports::Report.new :layout => t.resource('B4_ISO.tlf')
7
+ report.start_new_page
8
+
9
+ inspector = PDF::Inspector::Page.analyze(report.generate)
10
+ raise 'Invalid B4 ISO size' unless inspector.pages.first[:size] == [708.66, 1000.63]
11
+
12
+ report = ThinReports::Report.new :layout => t.resource('B4_JIS.tlf')
13
+ report.start_new_page
14
+
15
+ inspector = PDF::Inspector::Page.analyze(report.generate)
16
+ raise 'Invalid B4 JIS size' unless inspector.pages.first[:size] == [728.5, 1031.8]
17
+ end
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+
3
+ testcase :word_wrap, 'Word-wrap property of TextBlock' do |t|
4
+ ThinReports::Report.generate :filename => t.output_filename do
5
+ use_layout t.layout_filename
6
+ start_new_page
7
+
8
+ page.item(:locale).value('ja')
9
+
10
+ text = 'ThinReports は Ruby 向けのオープンソース帳票・PDF ツールです。'
11
+ page.values :single_none => text,
12
+ :single_break_word => text,
13
+ :multiple_none => text,
14
+ :multiple_break_word => text
15
+
16
+ start_new_page
17
+
18
+ page.item(:locale).value('en')
19
+
20
+ text = 'ThinReports is the OSS reporting tool for Ruby-lang.'
21
+ page.values :single_none => text,
22
+ :single_break_word => text,
23
+ :multiple_none => text,
24
+ :multiple_break_word => text
25
+ end
26
+ end
@@ -0,0 +1 @@
1
+ {"version":"0.7.6","finger-print":2040879295,"config":{"title":"","option":{},"page":{"paper-type":"A4","orientation":"portrait","margin-top":"20","margin-bottom":"20","margin-left":"20","margin-right":"20"}},"svg":"<svg width=\"595.2\" height=\"841.8\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" preserveAspectRatio=\"none\" viewBox=\"0 0 595.2 841.8\"><g class=\"canvas\"><!--SHAPE{\"type\":\"s-tblock\",\"id\":\"single_none\",\"display\":\"true\",\"desc\":null,\"multiple\":\"false\",\"valign\":\"\",\"line-height\":\"\",\"box\":{\"x\":33.1,\"y\":101,\"width\":210.1,\"height\":17},\"format\":{\"base\":\"\",\"type\":\"\"},\"value\":\"\",\"ref-id\":\"\",\"overflow\":\"expand\",\"word-wrap\":\"none\",\"svg\":{\"tag\":\"text\",\"attrs\":{\"x\":33.1,\"y\":113.9,\"xml:space\":\"preserve\",\"xmlns\":\"http://www.w3.org/2000/svg\",\"kerning\":\"auto\",\"id\":\"goog_478710130\",\"fill\":\"#000000\",\"fill-opacity\":\"1\",\"font-size\":\"18\",\"font-family\":\"Helvetica\",\"font-weight\":\"normal\",\"font-style\":\"normal\",\"text-anchor\":\"start\",\"text-decoration\":\"none\"}}}SHAPE--><!--LAYOUT<g xmlns=\"http://www.w3.org/2000/svg\" class=\"s-tblock\" x-format-type=\"\" x-value=\"\" x-format-base=\"\" x-ref-id=\"\" kerning=\"auto\" x-display=\"true\" x-multiple=\"false\" id=\"goog_478710130\" x-id=\"single_none\" fill=\"#000000\" fill-opacity=\"1\" font-size=\"18\" font-family=\"Helvetica\" font-weight=\"normal\" font-style=\"normal\" text-anchor=\"start\" text-decoration=\"none\" x-width=\"210.1\" x-height=\"17\" x-left=\"33.1\" x-top=\"101\" x-overflow=\"expand\"><rect class=\"s-tblock-box\" stroke=\"#7C4007\" fill=\"#f4e2c4\" stroke-width=\"0.28\" fill-opacity=\"0.8\" width=\"210.1\" height=\"17\" x=\"33.1\" y=\"101\"/><text class=\"s-tblock-id\" font-size=\"11\" font-family=\"Helvetica\" font-weight=\"normal\" font-style=\"normal\" text-decoration=\"none\" text-anchor=\"start\" kerning=\"auto\" stroke=\"none\" fill=\"#7C4007\" fill-opacity=\"1\" x=\"35.1\" y=\"112\">single_none</text></g>LAYOUT--><!--SHAPE{\"type\":\"s-tblock\",\"id\":\"multiple_none\",\"display\":\"true\",\"desc\":null,\"multiple\":\"true\",\"valign\":\"\",\"line-height\":\"\",\"box\":{\"x\":290.2,\"y\":101.9,\"width\":259.1,\"height\":105.1},\"format\":{\"base\":\"\",\"type\":\"\"},\"value\":\"\",\"ref-id\":\"\",\"overflow\":\"\",\"word-wrap\":\"none\",\"svg\":{\"tag\":\"textArea\",\"attrs\":{\"x\":290.2,\"y\":101.8,\"width\":259.1,\"height\":105.1,\"xml:space\":\"preserve\",\"xmlns\":\"http://www.w3.org/2000/svg\",\"kerning\":\"auto\",\"id\":\"goog_478710131\",\"fill\":\"#000000\",\"fill-opacity\":\"1\",\"font-size\":\"18\",\"font-family\":\"Helvetica\",\"font-weight\":\"normal\",\"font-style\":\"normal\",\"text-anchor\":\"start\",\"text-decoration\":\"none\"}}}SHAPE--><!--LAYOUT<g xmlns=\"http://www.w3.org/2000/svg\" class=\"s-tblock\" x-format-type=\"\" x-value=\"\" x-format-base=\"\" x-ref-id=\"\" kerning=\"auto\" x-display=\"true\" x-multiple=\"true\" id=\"goog_478710131\" x-id=\"multiple_none\" fill=\"#000000\" fill-opacity=\"1\" font-size=\"18\" font-family=\"Helvetica\" font-weight=\"normal\" font-style=\"normal\" text-anchor=\"start\" text-decoration=\"none\" x-width=\"259.1\" x-height=\"105.1\" x-left=\"290.2\" x-top=\"101.9\" x-word-wrap=\"none\"><rect class=\"s-tblock-box\" stroke=\"#7C4007\" fill=\"#f4e2c4\" stroke-width=\"0.28\" fill-opacity=\"0.8\" width=\"259.1\" height=\"105.1\" x=\"290.2\" y=\"101.9\"/><text class=\"s-tblock-id\" font-size=\"11\" font-family=\"Helvetica\" font-weight=\"normal\" font-style=\"normal\" text-decoration=\"none\" text-anchor=\"start\" kerning=\"auto\" stroke=\"none\" fill=\"#7C4007\" fill-opacity=\"1\" x=\"292.2\" y=\"112.9\">multiple_none</text></g>LAYOUT--><rect stroke=\"#000000\" stroke-width=\"1\" fill=\"none\" fill-opacity=\"1\" class=\"s-rect\" x-display=\"true\" x-stroke-type=\"solid\" stroke-dasharray=\"none\" x-id=\"\" rx=\"0\" ry=\"0\" id=\"goog_1119358811\" width=\"259.1\" height=\"105.1\" x=\"290.2\" y=\"101.9\"/><!--SHAPE{\"type\":\"s-tblock\",\"id\":\"multiple_break_word\",\"display\":\"true\",\"desc\":null,\"multiple\":\"true\",\"valign\":\"\",\"line-height\":\"\",\"box\":{\"x\":290.2,\"y\":232.9,\"width\":259.1,\"height\":105.1},\"format\":{\"base\":\"\",\"type\":\"\"},\"value\":\"\",\"ref-id\":\"\",\"overflow\":\"truncate\",\"word-wrap\":\"break-word\",\"svg\":{\"tag\":\"textArea\",\"attrs\":{\"x\":290.2,\"y\":232.8,\"width\":259.1,\"height\":105.1,\"xml:space\":\"preserve\",\"kerning\":\"auto\",\"id\":\"goog_1119358812\",\"fill\":\"#000000\",\"fill-opacity\":\"1\",\"font-size\":\"18\",\"font-family\":\"Helvetica\",\"font-weight\":\"normal\",\"font-style\":\"normal\",\"text-decoration\":\"none\",\"text-anchor\":\"start\"}}}SHAPE--><!--LAYOUT<g xmlns=\"http://www.w3.org/2000/svg\" class=\"s-tblock\" x-format-type=\"\" x-value=\"\" x-format-base=\"\" x-ref-id=\"\" kerning=\"auto\" x-display=\"true\" x-multiple=\"true\" id=\"goog_1119358812\" x-id=\"multiple_break_word\" x-width=\"259.1\" x-height=\"105.1\" x-left=\"290.2\" x-top=\"232.9\" fill=\"#000000\" fill-opacity=\"1\" font-size=\"18\" font-family=\"Helvetica\" font-weight=\"normal\" font-style=\"normal\" text-decoration=\"none\" text-anchor=\"start\" x-overflow=\"truncate\" x-word-wrap=\"break-word\"><rect class=\"s-tblock-box\" stroke=\"#7C4007\" fill=\"#f4e2c4\" stroke-width=\"0.28\" fill-opacity=\"0.8\" width=\"259.1\" height=\"105.1\" x=\"290.2\" y=\"232.9\"/><text class=\"s-tblock-id\" font-size=\"11\" font-family=\"Helvetica\" font-weight=\"normal\" font-style=\"normal\" text-decoration=\"none\" text-anchor=\"start\" kerning=\"auto\" stroke=\"none\" fill=\"#7C4007\" fill-opacity=\"1\" x=\"292.2\" y=\"243.9\">multiple_break_word</text></g>LAYOUT--><rect stroke=\"#000000\" stroke-width=\"1\" fill=\"none\" fill-opacity=\"1\" class=\"s-rect\" x-display=\"true\" x-stroke-type=\"solid\" stroke-dasharray=\"none\" x-id=\"\" rx=\"0\" ry=\"0\" id=\"goog_1119358813\" width=\"259.1\" height=\"105.1\" x=\"290.2\" y=\"232.9\"/><line stroke=\"#000000\" stroke-width=\"1\" fill=\"none\" class=\"s-line\" x-display=\"true\" x-stroke-type=\"solid\" stroke-dasharray=\"none\" x-id=\"\" id=\"goog_1119358814\" x1=\"251.2\" x2=\"251.2\" y1=\"100\" y2=\"379.1\"/><!--SHAPE{\"type\":\"s-tblock\",\"id\":\"single_break_word\",\"display\":\"true\",\"desc\":null,\"multiple\":\"false\",\"valign\":\"\",\"line-height\":\"\",\"box\":{\"x\":35,\"y\":235,\"width\":210.1,\"height\":17},\"format\":{\"base\":\"\",\"type\":\"\"},\"value\":\"\",\"ref-id\":\"\",\"overflow\":\"expand\",\"word-wrap\":\"break-word\",\"svg\":{\"tag\":\"text\",\"attrs\":{\"x\":35,\"y\":247.9,\"xml:space\":\"preserve\",\"kerning\":\"auto\",\"id\":\"goog_1119358815\",\"fill\":\"#000000\",\"fill-opacity\":\"1\",\"font-size\":\"18\",\"font-family\":\"Helvetica\",\"font-weight\":\"normal\",\"font-style\":\"normal\",\"text-decoration\":\"none\",\"text-anchor\":\"start\"}}}SHAPE--><!--LAYOUT<g xmlns=\"http://www.w3.org/2000/svg\" class=\"s-tblock\" x-format-type=\"\" x-value=\"\" x-format-base=\"\" x-ref-id=\"\" kerning=\"auto\" x-display=\"true\" x-multiple=\"false\" id=\"goog_1119358815\" x-id=\"single_break_word\" x-width=\"210.1\" x-height=\"17\" x-left=\"35\" x-top=\"235\" fill=\"#000000\" fill-opacity=\"1\" font-size=\"18\" font-family=\"Helvetica\" font-weight=\"normal\" font-style=\"normal\" text-decoration=\"none\" text-anchor=\"start\" x-overflow=\"expand\" x-word-wrap=\"break-word\"><rect class=\"s-tblock-box\" stroke=\"#7C4007\" fill=\"#f4e2c4\" stroke-width=\"0.28\" fill-opacity=\"0.8\" width=\"210.1\" height=\"17\" x=\"35\" y=\"235\"/><text class=\"s-tblock-id\" font-size=\"11\" font-family=\"Helvetica\" font-weight=\"normal\" font-style=\"normal\" text-decoration=\"none\" text-anchor=\"start\" kerning=\"auto\" stroke=\"none\" fill=\"#7C4007\" fill-opacity=\"1\" x=\"37\" y=\"246\">single_break_word</text></g>LAYOUT--><g class=\"s-text\" stroke-width=\"0\" fill=\"#000000\" fill-opacity=\"1\" kerning=\"auto\" x-display=\"true\" x-id=\"\" id=\"goog_1119358816\" font-size=\"18\" font-family=\"Helvetica\" font-weight=\"normal\" font-style=\"normal\" text-anchor=\"start\" text-decoration=\"none\" x-width=\"58\" x-height=\"17\" x-left=\"32.1\" x-top=\"36\"><rect class=\"s-text-box\" stroke=\"none\" fill=\"#000000\" fill-opacity=\"0.001\" width=\"58\" height=\"17\" x=\"32.1\" y=\"36\"/><text class=\"s-text-l0\" xml:space=\"preserve\" stroke=\"none\" fill=\"inherit\" fill-opacity=\"1\" text-decoration=\"none\" x=\"32.1\" y=\"48.9\">Locale:</text></g><!--SHAPE{\"type\":\"s-tblock\",\"id\":\"locale\",\"display\":\"true\",\"desc\":null,\"multiple\":\"false\",\"valign\":\"\",\"line-height\":\"\",\"box\":{\"x\":100,\"y\":36,\"width\":145.1,\"height\":17},\"format\":{\"base\":\"\",\"type\":\"\"},\"value\":\"\",\"ref-id\":\"\",\"overflow\":\"\",\"word-wrap\":\"none\",\"svg\":{\"tag\":\"text\",\"attrs\":{\"x\":100,\"y\":48.9,\"xml:space\":\"preserve\",\"kerning\":\"auto\",\"id\":\"goog_1119358817\",\"fill\":\"#000000\",\"fill-opacity\":\"1\",\"font-size\":\"18\",\"font-family\":\"Helvetica\",\"font-weight\":\"normal\",\"font-style\":\"normal\",\"text-anchor\":\"start\",\"text-decoration\":\"none\"}}}SHAPE--><!--LAYOUT<g xmlns=\"http://www.w3.org/2000/svg\" class=\"s-tblock\" x-format-type=\"\" x-value=\"\" x-format-base=\"\" x-ref-id=\"\" kerning=\"auto\" x-display=\"true\" x-multiple=\"false\" id=\"goog_1119358817\" x-id=\"locale\" fill=\"#000000\" fill-opacity=\"1\" font-size=\"18\" font-family=\"Helvetica\" font-weight=\"normal\" font-style=\"normal\" text-anchor=\"start\" text-decoration=\"none\" x-width=\"145.1\" x-height=\"17\" x-left=\"100\" x-top=\"36\"><rect class=\"s-tblock-box\" stroke=\"#7C4007\" fill=\"#f4e2c4\" stroke-width=\"0.28\" fill-opacity=\"0.8\" width=\"145.1\" height=\"17\" x=\"100\" y=\"36\"/><text class=\"s-tblock-id\" font-size=\"11\" font-family=\"Helvetica\" font-weight=\"normal\" font-style=\"normal\" text-decoration=\"none\" text-anchor=\"start\" kerning=\"auto\" stroke=\"none\" fill=\"#7C4007\" fill-opacity=\"1\" x=\"102\" y=\"47\">locale</text></g>LAYOUT--><rect stroke=\"#000000\" stroke-width=\"1\" fill=\"none\" fill-opacity=\"1\" class=\"s-rect\" x-display=\"true\" x-stroke-type=\"solid\" stroke-dasharray=\"none\" x-id=\"\" rx=\"0\" ry=\"0\" id=\"goog_1119358818\" width=\"210.1\" height=\"17\" x=\"33.1\" y=\"101\"/><rect stroke=\"#000000\" stroke-width=\"1\" fill=\"none\" fill-opacity=\"1\" class=\"s-rect\" x-display=\"true\" x-stroke-type=\"solid\" stroke-dasharray=\"none\" x-id=\"\" rx=\"0\" ry=\"0\" id=\"goog_1119358820\" width=\"210.1\" height=\"17\" x=\"34.1\" y=\"235\"/></g></svg>","state":{"layout-guide":[{"type":"x","position":59.5},{"type":"y","position":61}]}}