thinreports 0.10.3 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +39 -0
  3. data/CHANGELOG.md +20 -0
  4. data/Dockerfile +12 -0
  5. data/Gemfile +5 -0
  6. data/README.md +37 -13
  7. data/Rakefile +1 -0
  8. data/lib/thinreports/core/shape/image_block.rb +1 -1
  9. data/lib/thinreports/core/shape/list.rb +1 -1
  10. data/lib/thinreports/core/shape/page_number.rb +1 -1
  11. data/lib/thinreports/core/shape/text.rb +1 -1
  12. data/lib/thinreports/core/shape/text_block.rb +1 -1
  13. data/lib/thinreports/core/shape/text_block/formatter/number.rb +6 -1
  14. data/lib/thinreports/core/shape/text_block/internal.rb +0 -2
  15. data/lib/thinreports/generator/pdf/prawn_ext/width_of.rb +6 -0
  16. data/lib/thinreports/layout/base.rb +1 -1
  17. data/lib/thinreports/layout/version.rb +1 -1
  18. data/lib/thinreports/report/internal.rb +2 -0
  19. data/lib/thinreports/version.rb +1 -1
  20. data/thinreports.gemspec +5 -9
  21. metadata +6 -204
  22. data/.travis.yml +0 -32
  23. data/test/data/font.ttf +0 -0
  24. data/test/data/image_normal.jpg +0 -0
  25. data/test/data/image_normal.png +0 -0
  26. data/test/data/image_normal_jpg_noext +0 -0
  27. data/test/data/image_normal_png_noext +0 -0
  28. data/test/data/image_pallete_based.png +0 -0
  29. data/test/data/legacy_layout/all-items.tlf +0 -1
  30. data/test/features/dynamic_style/expect.pdf +0 -3714
  31. data/test/features/dynamic_style/image.png +0 -0
  32. data/test/features/dynamic_style/templates/styles.tlf +0 -1835
  33. data/test/features/dynamic_style/templates/styles_in_list.tlf +0 -344
  34. data/test/features/dynamic_style/test_dynamic_style.rb +0 -152
  35. data/test/features/eudc/eudc.ttf +0 -0
  36. data/test/features/eudc/expect.pdf +0 -0
  37. data/test/features/eudc/template.tlf +0 -180
  38. data/test/features/eudc/test_eudc.rb +0 -27
  39. data/test/features/feature_test.rb +0 -58
  40. data/test/features/graphics/expect.pdf +0 -475
  41. data/test/features/graphics/template.tlf +0 -309
  42. data/test/features/graphics/test_graphics.rb +0 -12
  43. data/test/features/hidden_item/expect.pdf +0 -0
  44. data/test/features/hidden_item/template.tlf +0 -449
  45. data/test/features/hidden_item/test_hidden_item.rb +0 -12
  46. data/test/features/image_block/expect.pdf +0 -0
  47. data/test/features/image_block/img200x100.png +0 -0
  48. data/test/features/image_block/img50x50.png +0 -0
  49. data/test/features/image_block/template.tlf +0 -661
  50. data/test/features/image_block/test_image_block.rb +0 -35
  51. data/test/features/list_events/expect.pdf +0 -659
  52. data/test/features/list_events/template.tlf +0 -361
  53. data/test/features/list_events/test_list_events.rb +0 -36
  54. data/test/features/list_manually/expect.pdf +0 -599
  55. data/test/features/list_manually/template.tlf +0 -132
  56. data/test/features/list_manually/test_list_manually.rb +0 -25
  57. data/test/features/page_number/expect.pdf +0 -400
  58. data/test/features/page_number/template.tlf +0 -215
  59. data/test/features/page_number/test_page_number.rb +0 -24
  60. data/test/features/page_number_with_list/expect.pdf +0 -721
  61. data/test/features/page_number_with_list/template.tlf +0 -254
  62. data/test/features/page_number_with_list/test_page_number_with_list.rb +0 -21
  63. data/test/features/palleted_png/expect.pdf +0 -0
  64. data/test/features/palleted_png/palleted_png.png +0 -0
  65. data/test/features/palleted_png/template.tlf +0 -47
  66. data/test/features/palleted_png/test_palleted_png.rb +0 -14
  67. data/test/features/report_callbacks/expect.pdf +0 -169
  68. data/test/features/report_callbacks/template.tlf +0 -147
  69. data/test/features/report_callbacks/test_report_callbacks.rb +0 -18
  70. data/test/features/text_align/expect.pdf +0 -0
  71. data/test/features/text_align/template.tlf +0 -241
  72. data/test/features/text_align/test_text_align.rb +0 -12
  73. data/test/features/text_block_overflow/expect.pdf +0 -0
  74. data/test/features/text_block_overflow/template.tlf +0 -538
  75. data/test/features/text_block_overflow/test_text_block_overflow.rb +0 -25
  76. data/test/features/text_block_singleline/expect.pdf +0 -0
  77. data/test/features/text_block_singleline/template.tlf +0 -170
  78. data/test/features/text_block_singleline/test_text_block_singleline.rb +0 -15
  79. data/test/features/text_block_style/expect.pdf +0 -1391
  80. data/test/features/text_block_style/templates/basic_styles.tlf +0 -889
  81. data/test/features/text_block_style/templates/font_size.tlf +0 -383
  82. data/test/features/text_block_style/test_text_block_style.rb +0 -47
  83. data/test/features/text_character_spacing/expect.pdf +0 -0
  84. data/test/features/text_character_spacing/template.tlf +0 -293
  85. data/test/features/text_character_spacing/test_text_character_spacing.rb +0 -12
  86. data/test/features/text_word_wrap/expect.pdf +0 -0
  87. data/test/features/text_word_wrap/template.tlf +0 -297
  88. data/test/features/text_word_wrap/test_text_word_wrap.rb +0 -30
  89. data/test/schema_helper.rb +0 -122
  90. data/test/test_helper.rb +0 -39
  91. data/test/units/core/format/test_base.rb +0 -152
  92. data/test/units/core/shape/base/test_internal.rb +0 -87
  93. data/test/units/core/shape/basic/test_block_format.rb +0 -23
  94. data/test/units/core/shape/basic/test_block_interface.rb +0 -29
  95. data/test/units/core/shape/basic/test_block_internal.rb +0 -55
  96. data/test/units/core/shape/basic/test_format.rb +0 -37
  97. data/test/units/core/shape/basic/test_interface.rb +0 -108
  98. data/test/units/core/shape/basic/test_internal.rb +0 -55
  99. data/test/units/core/shape/image_block/test_interface.rb +0 -24
  100. data/test/units/core/shape/image_block/test_internal.rb +0 -31
  101. data/test/units/core/shape/list/test_format.rb +0 -111
  102. data/test/units/core/shape/list/test_manager.rb +0 -67
  103. data/test/units/core/shape/list/test_page.rb +0 -156
  104. data/test/units/core/shape/list/test_page_state.rb +0 -31
  105. data/test/units/core/shape/list/test_section_format.rb +0 -36
  106. data/test/units/core/shape/list/test_section_interface.rb +0 -75
  107. data/test/units/core/shape/list/test_section_internal.rb +0 -50
  108. data/test/units/core/shape/manager/test_format.rb +0 -38
  109. data/test/units/core/shape/manager/test_internal.rb +0 -132
  110. data/test/units/core/shape/manager/test_target.rb +0 -140
  111. data/test/units/core/shape/page_number/test_format.rb +0 -55
  112. data/test/units/core/shape/page_number/test_interface.rb +0 -33
  113. data/test/units/core/shape/page_number/test_internal.rb +0 -81
  114. data/test/units/core/shape/styles/test_base.rb +0 -191
  115. data/test/units/core/shape/styles/test_basic.rb +0 -24
  116. data/test/units/core/shape/styles/test_graphic.rb +0 -50
  117. data/test/units/core/shape/styles/test_text.rb +0 -97
  118. data/test/units/core/shape/text/test_format.rb +0 -44
  119. data/test/units/core/shape/text/test_internal.rb +0 -20
  120. data/test/units/core/shape/text_block/formatter/test_basic.rb +0 -24
  121. data/test/units/core/shape/text_block/formatter/test_datetime.rb +0 -49
  122. data/test/units/core/shape/text_block/formatter/test_number.rb +0 -76
  123. data/test/units/core/shape/text_block/formatter/test_padding.rb +0 -77
  124. data/test/units/core/shape/text_block/test_format.rb +0 -169
  125. data/test/units/core/shape/text_block/test_formatter.rb +0 -28
  126. data/test/units/core/shape/text_block/test_interface.rb +0 -63
  127. data/test/units/core/shape/text_block/test_internal.rb +0 -128
  128. data/test/units/core/test_shape.rb +0 -52
  129. data/test/units/core/test_utils.rb +0 -68
  130. data/test/units/generator/pdf/document/graphics/test_attributes.rb +0 -135
  131. data/test/units/generator/pdf/document/graphics/test_basic.rb +0 -46
  132. data/test/units/generator/pdf/document/graphics/test_image.rb +0 -46
  133. data/test/units/generator/pdf/document/graphics/test_text.rb +0 -171
  134. data/test/units/generator/pdf/document/test_font.rb +0 -110
  135. data/test/units/generator/pdf/document/test_graphics.rb +0 -42
  136. data/test/units/generator/pdf/document/test_page.rb +0 -122
  137. data/test/units/generator/pdf/document/test_parse_color.rb +0 -30
  138. data/test/units/generator/pdf/prawn_ext/test_calc_image_dimensions.rb +0 -41
  139. data/test/units/generator/pdf/prawn_ext/test_width_of.rb +0 -22
  140. data/test/units/generator/pdf/test_document.rb +0 -22
  141. data/test/units/generator/test_pdf.rb +0 -26
  142. data/test/units/layout/test_base.rb +0 -41
  143. data/test/units/layout/test_format.rb +0 -100
  144. data/test/units/layout/test_legacy_schema.rb +0 -576
  145. data/test/units/layout/test_version.rb +0 -26
  146. data/test/units/report/test_base.rb +0 -248
  147. data/test/units/report/test_internal.rb +0 -206
  148. data/test/units/test_config.rb +0 -36
  149. data/test/units/test_layout.rb +0 -12
  150. data/test/units/test_report.rb +0 -18
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'feature_test'
4
-
5
- class TestTextCharacterSpacing < FeatureTest
6
- feature :text_character_spacing do
7
- report = Thinreports::Report.new layout: template_path
8
- report.start_new_page
9
-
10
- assert_pdf report.generate
11
- end
12
- end
@@ -1,297 +0,0 @@
1
- {
2
- "version": "0.9.0",
3
- "items": [
4
- {
5
- "id": "single_none",
6
- "type": "text-block",
7
- "display": true,
8
- "description": "",
9
- "x": 33.1,
10
- "y": 101,
11
- "width": 210.1,
12
- "height": 17,
13
- "style": {
14
- "font-family": [
15
- "Helvetica"
16
- ],
17
- "font-size": 18,
18
- "color": "#000000",
19
- "text-align": "left",
20
- "vertical-align": "top",
21
- "line-height": "",
22
- "line-height-ratio": "",
23
- "letter-spacing": "",
24
- "font-style": [],
25
- "overflow": "expand",
26
- "word-wrap": "break-word"
27
- },
28
- "reference-id": "",
29
- "value": "",
30
- "multiple-line": false,
31
- "format": {
32
- "base": "",
33
- "type": ""
34
- }
35
- },
36
- {
37
- "id": "multiple_none",
38
- "type": "text-block",
39
- "display": true,
40
- "description": "",
41
- "x": 290.2,
42
- "y": 101.9,
43
- "width": 259.1,
44
- "height": 105.1,
45
- "style": {
46
- "font-family": [
47
- "Helvetica"
48
- ],
49
- "font-size": 18,
50
- "color": "#000000",
51
- "text-align": "left",
52
- "vertical-align": "top",
53
- "line-height": "",
54
- "line-height-ratio": "",
55
- "letter-spacing": "",
56
- "font-style": [],
57
- "overflow": "truncate",
58
- "word-wrap": "none"
59
- },
60
- "reference-id": "",
61
- "value": "",
62
- "multiple-line": true,
63
- "format": {
64
- "base": "",
65
- "type": ""
66
- }
67
- },
68
- {
69
- "id": "",
70
- "type": "rect",
71
- "display": true,
72
- "description": "",
73
- "x": 290.2,
74
- "y": 101.9,
75
- "width": 259.1,
76
- "height": 105.1,
77
- "style": {
78
- "border-color": "#000000",
79
- "border-width": 1,
80
- "border-style": "solid",
81
- "fill-color": "none"
82
- },
83
- "border-radius": 0
84
- },
85
- {
86
- "id": "multiple_break_word",
87
- "type": "text-block",
88
- "display": true,
89
- "description": "",
90
- "x": 290.2,
91
- "y": 232.9,
92
- "width": 259.1,
93
- "height": 105.1,
94
- "style": {
95
- "font-family": [
96
- "Helvetica"
97
- ],
98
- "font-size": 18,
99
- "color": "#000000",
100
- "text-align": "left",
101
- "vertical-align": "top",
102
- "line-height": "",
103
- "line-height-ratio": "",
104
- "letter-spacing": "",
105
- "font-style": [],
106
- "overflow": "truncate",
107
- "word-wrap": "break-word"
108
- },
109
- "reference-id": "",
110
- "value": "",
111
- "multiple-line": true,
112
- "format": {
113
- "base": "",
114
- "type": ""
115
- }
116
- },
117
- {
118
- "id": "",
119
- "type": "rect",
120
- "display": true,
121
- "description": "",
122
- "x": 290.2,
123
- "y": 232.9,
124
- "width": 259.1,
125
- "height": 105.1,
126
- "style": {
127
- "border-color": "#000000",
128
- "border-width": 1,
129
- "border-style": "solid",
130
- "fill-color": "none"
131
- },
132
- "border-radius": 0
133
- },
134
- {
135
- "id": "",
136
- "type": "line",
137
- "display": true,
138
- "description": "",
139
- "style": {
140
- "border-color": "#000000",
141
- "border-width": 1,
142
- "border-style": "solid"
143
- },
144
- "x1": 252,
145
- "y1": 100,
146
- "x2": 252,
147
- "y2": 379.1
148
- },
149
- {
150
- "id": "single_break_word",
151
- "type": "text-block",
152
- "display": true,
153
- "description": "",
154
- "x": 35,
155
- "y": 235,
156
- "width": 210.1,
157
- "height": 17,
158
- "style": {
159
- "font-family": [
160
- "Helvetica"
161
- ],
162
- "font-size": 18,
163
- "color": "#000000",
164
- "text-align": "left",
165
- "vertical-align": "top",
166
- "line-height": "",
167
- "line-height-ratio": "",
168
- "letter-spacing": "",
169
- "font-style": [],
170
- "overflow": "expand",
171
- "word-wrap": "break-word"
172
- },
173
- "reference-id": "",
174
- "value": "",
175
- "multiple-line": false,
176
- "format": {
177
- "base": "",
178
- "type": ""
179
- }
180
- },
181
- {
182
- "id": "",
183
- "type": "text",
184
- "display": true,
185
- "description": "",
186
- "x": 32.1,
187
- "y": 33,
188
- "width": 58,
189
- "height": 20.5,
190
- "style": {
191
- "font-family": [
192
- "Helvetica"
193
- ],
194
- "font-size": 18,
195
- "color": "#000000",
196
- "text-align": "left",
197
- "vertical-align": "top",
198
- "line-height": "",
199
- "line-height-ratio": "",
200
- "letter-spacing": "",
201
- "font-style": []
202
- },
203
- "texts": [
204
- "Locale:"
205
- ]
206
- },
207
- {
208
- "id": "locale",
209
- "type": "text-block",
210
- "display": true,
211
- "description": "",
212
- "x": 100,
213
- "y": 36,
214
- "width": 145.1,
215
- "height": 17,
216
- "style": {
217
- "font-family": [
218
- "Helvetica"
219
- ],
220
- "font-size": 18,
221
- "color": "#000000",
222
- "text-align": "left",
223
- "vertical-align": "top",
224
- "line-height": "",
225
- "line-height-ratio": "",
226
- "letter-spacing": "",
227
- "font-style": [],
228
- "overflow": "truncate",
229
- "word-wrap": "break-word"
230
- },
231
- "reference-id": "",
232
- "value": "",
233
- "multiple-line": false,
234
- "format": {
235
- "base": "",
236
- "type": ""
237
- }
238
- },
239
- {
240
- "id": "",
241
- "type": "rect",
242
- "display": true,
243
- "description": "",
244
- "x": 33.1,
245
- "y": 101,
246
- "width": 210.1,
247
- "height": 17,
248
- "style": {
249
- "border-color": "#000000",
250
- "border-width": 1,
251
- "border-style": "solid",
252
- "fill-color": "none"
253
- },
254
- "border-radius": 0
255
- },
256
- {
257
- "id": "",
258
- "type": "rect",
259
- "display": true,
260
- "description": "",
261
- "x": 34.1,
262
- "y": 235,
263
- "width": 210.1,
264
- "height": 17,
265
- "style": {
266
- "border-color": "#000000",
267
- "border-width": 1,
268
- "border-style": "solid",
269
- "fill-color": "none"
270
- },
271
- "border-radius": 0
272
- }
273
- ],
274
- "state": {
275
- "layout-guides": [
276
- {
277
- "type": "x",
278
- "position": 59.5
279
- },
280
- {
281
- "type": "y",
282
- "position": 61
283
- }
284
- ]
285
- },
286
- "title": "",
287
- "report": {
288
- "paper-type": "A4",
289
- "orientation": "portrait",
290
- "margin": [
291
- 20,
292
- 20,
293
- 20,
294
- 20
295
- ]
296
- }
297
- }
@@ -1,30 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'feature_test'
4
-
5
- class TestTextWordWrap < FeatureTest
6
- feature :text_word_wrap do
7
- report = Thinreports::Report.new layout: template_path
8
- report.start_new_page
9
-
10
- report.page.item(:locale).value('ja')
11
-
12
- text = 'Thinreports は Ruby 向けのオープンソース帳票・PDF ツールです。'
13
- report.page.values single_none: text,
14
- single_break_word: text,
15
- multiple_none: text,
16
- multiple_break_word: text
17
-
18
- report.start_new_page
19
-
20
- report.page.item(:locale).value('en')
21
-
22
- text = 'Thinreports is the OSS reporting tool for Ruby-lang.'
23
- report.page.values single_none: text,
24
- single_break_word: text,
25
- multiple_none: text,
26
- multiple_break_word: text
27
-
28
- assert_pdf report.generate
29
- end
30
- end
@@ -1,122 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Thinreports
4
- module SchemaHelper
5
- BASIC_SCHEMA_JSON = <<-EOF
6
- {
7
- "version": "%{version}",
8
- "title": "Report Title",
9
- "report": {
10
- "paper-type": "A4",
11
- "width": 100.0,
12
- "height": 200.0,
13
- "orientation": "landscape",
14
- "margin": [100.0, 200.0, 300.0, 999.9]
15
- },
16
- "state": {
17
- "layout-guides": [
18
- { "type": "x", "position": 0.1 }
19
- ]
20
- },
21
- "items": [
22
- { "type": "rect", "id": "rect_with_id", "display": true },
23
- { "type": "text-block", "id": "text_block", "x": 100.0, "y": 100.0, "value": "", "display": true },
24
- { "type": "text-block", "id": "text_block_referenced", "x": 100.0, "y": 100.0, "value": "", "display": true, "reference-id": "text_block" },
25
- { "type": "text-block", "id": "text_block_hidden", "x": 100.0, "y": 100.0, "value": "default value", "display": false },
26
- { "type": "image-block", "id": "image_block", "x": 200.0, "y": 200.0, "width": 150.0, "height": 150.0, "value": "", "display": true },
27
- {
28
- "type": "list",
29
- "id": "default",
30
- "x": 1.0,
31
- "y": 2.0,
32
- "display": true,
33
- "width": 200.0,
34
- "content-height": 300,
35
- "auto-page-break": true,
36
- "header": {
37
- "enabled": true,
38
- "height": 10.0,
39
- "items": []
40
- },
41
- "detail": {
42
- "height": 70.0,
43
- "items": [
44
- { "type": "text-block", "id": "name", "value": "" }
45
- ]
46
- },
47
- "page-footer": {
48
- "enabled": true,
49
- "items": [],
50
- "height": 30.0
51
- },
52
- "footer": {
53
- "enabled": true,
54
- "items": [],
55
- "height": 40.0
56
- }
57
- }
58
- ]
59
- }
60
- EOF
61
-
62
- LIST_NO_HEADER_SCHEMA_JSON = <<-EOF
63
- {
64
- "version": "%{version}",
65
- "title": "Report Title",
66
- "report": {
67
- "paper-type": "A4",
68
- "width": 100.0,
69
- "height": 200.0,
70
- "orientation": "landscape",
71
- "margin": [100.0, 200.0, 300.0, 999.9]
72
- },
73
- "state": {
74
- "layout-guides": []
75
- },
76
- "items": [
77
- {
78
- "type": "list",
79
- "id": "default",
80
- "x": 1.0,
81
- "y": 2.0,
82
- "display": true,
83
- "header": {
84
- "enabled": false,
85
- "height": 10.0,
86
- "items": []
87
- },
88
- "width": 200.0,
89
- "content-height": 300,
90
- "auto-page-break": true,
91
- "detail": {
92
- "height": 20.0,
93
- "items": [
94
- { "type": "text-block", "id": "name", "value": "" }
95
- ]
96
- },
97
- "page-footer": {
98
- "enabled": true,
99
- "items": [],
100
- "height": 30.0
101
- },
102
- "footer": {
103
- "enabled": true,
104
- "items": [],
105
- "height": 40.0
106
- }
107
- }
108
- ]
109
- }
110
- EOF
111
-
112
- def layout_file(options = {})
113
- schema_version = options[:version] || Thinreports::VERSION
114
- schema_json = options[:schema] || BASIC_SCHEMA_JSON
115
-
116
- Tempfile.open %w( test-thinreports-layout .tlf ) do |file|
117
- file.puts (schema_json % { version: schema_version })
118
- file
119
- end
120
- end
121
- end
122
- end