ricardoo27-writeexcel 0.6.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (245) hide show
  1. data/.document +5 -0
  2. data/.gitattributes +1 -0
  3. data/README.rdoc +136 -0
  4. data/Rakefile +52 -0
  5. data/VERSION +1 -0
  6. data/charts/chartex.rb +316 -0
  7. data/charts/demo1.rb +46 -0
  8. data/charts/demo101.bin +0 -0
  9. data/charts/demo2.rb +65 -0
  10. data/charts/demo201.bin +0 -0
  11. data/charts/demo3.rb +117 -0
  12. data/charts/demo301.bin +0 -0
  13. data/charts/demo4.rb +119 -0
  14. data/charts/demo401.bin +0 -0
  15. data/charts/demo5.rb +48 -0
  16. data/charts/demo501.bin +0 -0
  17. data/examples/a_simple.rb +43 -0
  18. data/examples/autofilter.rb +265 -0
  19. data/examples/bigfile.rb +30 -0
  20. data/examples/chart_area.rb +121 -0
  21. data/examples/chart_bar.rb +120 -0
  22. data/examples/chart_column.rb +120 -0
  23. data/examples/chart_line.rb +120 -0
  24. data/examples/chart_pie.rb +108 -0
  25. data/examples/chart_scatter.rb +121 -0
  26. data/examples/chart_stock.rb +148 -0
  27. data/examples/chess.rb +142 -0
  28. data/examples/colors.rb +129 -0
  29. data/examples/comments1.rb +27 -0
  30. data/examples/comments2.rb +352 -0
  31. data/examples/copyformat.rb +52 -0
  32. data/examples/data_validate.rb +279 -0
  33. data/examples/date_time.rb +87 -0
  34. data/examples/defined_name.rb +32 -0
  35. data/examples/demo.rb +124 -0
  36. data/examples/diag_border.rb +36 -0
  37. data/examples/formats.rb +490 -0
  38. data/examples/formula_result.rb +30 -0
  39. data/examples/header.rb +137 -0
  40. data/examples/hide_sheet.rb +29 -0
  41. data/examples/hyperlink.rb +43 -0
  42. data/examples/images.rb +63 -0
  43. data/examples/indent.rb +31 -0
  44. data/examples/merge1.rb +40 -0
  45. data/examples/merge2.rb +45 -0
  46. data/examples/merge3.rb +66 -0
  47. data/examples/merge4.rb +83 -0
  48. data/examples/merge5.rb +80 -0
  49. data/examples/merge6.rb +67 -0
  50. data/examples/outline.rb +255 -0
  51. data/examples/outline_collapsed.rb +209 -0
  52. data/examples/panes.rb +113 -0
  53. data/examples/password_protection.rb +33 -0
  54. data/examples/properties.rb +34 -0
  55. data/examples/properties_jp.rb +33 -0
  56. data/examples/protection.rb +47 -0
  57. data/examples/regions.rb +53 -0
  58. data/examples/repeat.rb +43 -0
  59. data/examples/republic.png +0 -0
  60. data/examples/right_to_left.rb +27 -0
  61. data/examples/row_wrap.rb +53 -0
  62. data/examples/set_first_sheet.rb +14 -0
  63. data/examples/stats.rb +74 -0
  64. data/examples/stocks.rb +81 -0
  65. data/examples/store_formula.rb +15 -0
  66. data/examples/tab_colors.rb +31 -0
  67. data/examples/utf8.rb +15 -0
  68. data/examples/write_arrays.rb +83 -0
  69. data/html/en/doc_en.html +5946 -0
  70. data/html/images/a_simple.jpg +0 -0
  71. data/html/images/area1.jpg +0 -0
  72. data/html/images/bar1.jpg +0 -0
  73. data/html/images/chart_area.xls +0 -0
  74. data/html/images/column1.jpg +0 -0
  75. data/html/images/data_validation.jpg +0 -0
  76. data/html/images/line1.jpg +0 -0
  77. data/html/images/pie1.jpg +0 -0
  78. data/html/images/regions.jpg +0 -0
  79. data/html/images/scatter1.jpg +0 -0
  80. data/html/images/stats.jpg +0 -0
  81. data/html/images/stock1.jpg +0 -0
  82. data/html/images/stocks.jpg +0 -0
  83. data/html/index.html +16 -0
  84. data/html/style.css +433 -0
  85. data/lib/writeexcel.rb +1159 -0
  86. data/lib/writeexcel/biffwriter.rb +223 -0
  87. data/lib/writeexcel/caller_info.rb +12 -0
  88. data/lib/writeexcel/cell_range.rb +332 -0
  89. data/lib/writeexcel/chart.rb +1968 -0
  90. data/lib/writeexcel/charts/area.rb +154 -0
  91. data/lib/writeexcel/charts/bar.rb +177 -0
  92. data/lib/writeexcel/charts/column.rb +156 -0
  93. data/lib/writeexcel/charts/external.rb +66 -0
  94. data/lib/writeexcel/charts/line.rb +154 -0
  95. data/lib/writeexcel/charts/pie.rb +169 -0
  96. data/lib/writeexcel/charts/scatter.rb +192 -0
  97. data/lib/writeexcel/charts/stock.rb +213 -0
  98. data/lib/writeexcel/col_info.rb +87 -0
  99. data/lib/writeexcel/colors.rb +68 -0
  100. data/lib/writeexcel/comments.rb +460 -0
  101. data/lib/writeexcel/compatibility.rb +65 -0
  102. data/lib/writeexcel/convert_date_time.rb +117 -0
  103. data/lib/writeexcel/data_validations.rb +370 -0
  104. data/lib/writeexcel/debug_info.rb +41 -0
  105. data/lib/writeexcel/embedded_chart.rb +35 -0
  106. data/lib/writeexcel/excelformula.y +139 -0
  107. data/lib/writeexcel/excelformulaparser.rb +587 -0
  108. data/lib/writeexcel/format.rb +1575 -0
  109. data/lib/writeexcel/formula.rb +987 -0
  110. data/lib/writeexcel/helper.rb +78 -0
  111. data/lib/writeexcel/image.rb +218 -0
  112. data/lib/writeexcel/olewriter.rb +305 -0
  113. data/lib/writeexcel/outline.rb +24 -0
  114. data/lib/writeexcel/properties.rb +242 -0
  115. data/lib/writeexcel/shared_string_table.rb +153 -0
  116. data/lib/writeexcel/storage_lite.rb +984 -0
  117. data/lib/writeexcel/workbook.rb +2478 -0
  118. data/lib/writeexcel/worksheet.rb +6925 -0
  119. data/lib/writeexcel/worksheets.rb +25 -0
  120. data/lib/writeexcel/write_file.rb +63 -0
  121. data/test/excelfile/Chart1.xls +0 -0
  122. data/test/excelfile/Chart2.xls +0 -0
  123. data/test/excelfile/Chart3.xls +0 -0
  124. data/test/excelfile/Chart4.xls +0 -0
  125. data/test/excelfile/Chart5.xls +0 -0
  126. data/test/helper.rb +31 -0
  127. data/test/perl_output/Chart1.xls.data +0 -0
  128. data/test/perl_output/Chart2.xls.data +0 -0
  129. data/test/perl_output/Chart3.xls.data +0 -0
  130. data/test/perl_output/Chart4.xls.data +0 -0
  131. data/test/perl_output/Chart5.xls.data +0 -0
  132. data/test/perl_output/README +31 -0
  133. data/test/perl_output/a_simple.xls +0 -0
  134. data/test/perl_output/autofilter.xls +0 -0
  135. data/test/perl_output/biff_add_continue_testdata +0 -0
  136. data/test/perl_output/chart_area.xls +0 -0
  137. data/test/perl_output/chart_bar.xls +0 -0
  138. data/test/perl_output/chart_column.xls +0 -0
  139. data/test/perl_output/chart_line.xls +0 -0
  140. data/test/perl_output/chess.xls +0 -0
  141. data/test/perl_output/colors.xls +0 -0
  142. data/test/perl_output/comments0.xls +0 -0
  143. data/test/perl_output/comments1.xls +0 -0
  144. data/test/perl_output/comments2.xls +0 -0
  145. data/test/perl_output/data_validate.xls +0 -0
  146. data/test/perl_output/date_time.xls +0 -0
  147. data/test/perl_output/defined_name.xls +0 -0
  148. data/test/perl_output/demo.xls +0 -0
  149. data/test/perl_output/demo101.bin +0 -0
  150. data/test/perl_output/demo201.bin +0 -0
  151. data/test/perl_output/demo301.bin +0 -0
  152. data/test/perl_output/demo401.bin +0 -0
  153. data/test/perl_output/demo501.bin +0 -0
  154. data/test/perl_output/diag_border.xls +0 -0
  155. data/test/perl_output/f_font_biff +0 -0
  156. data/test/perl_output/f_font_key +1 -0
  157. data/test/perl_output/f_xf_biff +0 -0
  158. data/test/perl_output/file_font_biff +0 -0
  159. data/test/perl_output/file_font_key +1 -0
  160. data/test/perl_output/file_xf_biff +0 -0
  161. data/test/perl_output/formula_result.xls +0 -0
  162. data/test/perl_output/headers.xls +0 -0
  163. data/test/perl_output/hidden.xls +0 -0
  164. data/test/perl_output/hide_zero.xls +0 -0
  165. data/test/perl_output/hyperlink.xls +0 -0
  166. data/test/perl_output/images.xls +0 -0
  167. data/test/perl_output/indent.xls +0 -0
  168. data/test/perl_output/merge1.xls +0 -0
  169. data/test/perl_output/merge2.xls +0 -0
  170. data/test/perl_output/merge3.xls +0 -0
  171. data/test/perl_output/merge4.xls +0 -0
  172. data/test/perl_output/merge5.xls +0 -0
  173. data/test/perl_output/merge6.xls +0 -0
  174. data/test/perl_output/ole_write_header +0 -0
  175. data/test/perl_output/outline.xls +0 -0
  176. data/test/perl_output/outline_collapsed.xls +0 -0
  177. data/test/perl_output/panes.xls +0 -0
  178. data/test/perl_output/password_protection.xls +0 -0
  179. data/test/perl_output/protection.xls +0 -0
  180. data/test/perl_output/regions.xls +0 -0
  181. data/test/perl_output/right_to_left.xls +0 -0
  182. data/test/perl_output/set_first_sheet.xls +0 -0
  183. data/test/perl_output/stats.xls +0 -0
  184. data/test/perl_output/stocks.xls +0 -0
  185. data/test/perl_output/store_formula.xls +0 -0
  186. data/test/perl_output/tab_colors.xls +0 -0
  187. data/test/perl_output/unicode_cyrillic.xls +0 -0
  188. data/test/perl_output/utf8.xls +0 -0
  189. data/test/perl_output/workbook1.xls +0 -0
  190. data/test/perl_output/workbook2.xls +0 -0
  191. data/test/perl_output/ws_colinfo +1 -0
  192. data/test/perl_output/ws_store_colinfo +0 -0
  193. data/test/perl_output/ws_store_dimensions +0 -0
  194. data/test/perl_output/ws_store_filtermode +0 -0
  195. data/test/perl_output/ws_store_filtermode_off +0 -0
  196. data/test/perl_output/ws_store_filtermode_on +0 -0
  197. data/test/perl_output/ws_store_selection +0 -0
  198. data/test/perl_output/ws_store_window2 +1 -0
  199. data/test/republic.png +0 -0
  200. data/test/test_00_IEEE_double.rb +13 -0
  201. data/test/test_01_add_worksheet.rb +10 -0
  202. data/test/test_02_merge_formats.rb +49 -0
  203. data/test/test_04_dimensions.rb +388 -0
  204. data/test/test_05_rows.rb +175 -0
  205. data/test/test_06_extsst.rb +74 -0
  206. data/test/test_11_date_time.rb +475 -0
  207. data/test/test_12_date_only.rb +525 -0
  208. data/test/test_13_date_seconds.rb +477 -0
  209. data/test/test_21_escher.rb +624 -0
  210. data/test/test_22_mso_drawing_group.rb +741 -0
  211. data/test/test_23_note.rb +57 -0
  212. data/test/test_24_txo.rb +74 -0
  213. data/test/test_25_position_object.rb +80 -0
  214. data/test/test_26_autofilter.rb +309 -0
  215. data/test/test_27_autofilter.rb +126 -0
  216. data/test/test_28_autofilter.rb +156 -0
  217. data/test/test_29_process_jpg.rb +670 -0
  218. data/test/test_30_validation_dval.rb +74 -0
  219. data/test/test_31_validation_dv_strings.rb +123 -0
  220. data/test/test_32_validation_dv_formula.rb +203 -0
  221. data/test/test_40_property_types.rb +188 -0
  222. data/test/test_41_properties.rb +235 -0
  223. data/test/test_42_set_properties.rb +434 -0
  224. data/test/test_50_name_stored.rb +295 -0
  225. data/test/test_51_name_print_area.rb +353 -0
  226. data/test/test_52_name_print_titles.rb +450 -0
  227. data/test/test_53_autofilter.rb +199 -0
  228. data/test/test_60_chart_generic.rb +574 -0
  229. data/test/test_61_chart_subclasses.rb +84 -0
  230. data/test/test_62_chart_formats.rb +268 -0
  231. data/test/test_63_chart_area_formats.rb +645 -0
  232. data/test/test_biff.rb +71 -0
  233. data/test/test_big_workbook.rb +17 -0
  234. data/test/test_compatibility.rb +12 -0
  235. data/test/test_example_match.rb +3246 -0
  236. data/test/test_format.rb +1189 -0
  237. data/test/test_formula.rb +61 -0
  238. data/test/test_ole.rb +102 -0
  239. data/test/test_storage_lite.rb +116 -0
  240. data/test/test_workbook.rb +146 -0
  241. data/test/test_worksheet.rb +106 -0
  242. data/utils/add_magic_comment.rb +80 -0
  243. data/writeexcel.gemspec +278 -0
  244. data/writeexcel.rdoc +1425 -0
  245. metadata +292 -0
@@ -0,0 +1,574 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+ require 'stringio'
4
+
5
+ ###############################################################################
6
+ #
7
+ # A test for Chart.
8
+ #
9
+ # Tests for the Excel chart.rb methods.
10
+ #
11
+ # reverse(''), December 2009, John McNamara, jmcnamara@cpan.org
12
+ #
13
+ # original written in Perl by John McNamara
14
+ # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
15
+ #
16
+ class TC_ChartGeneric < Test::Unit::TestCase
17
+ def setup
18
+ io = StringIO.new
19
+ workbook = WriteExcel.new(io)
20
+ @chart = Writeexcel::Chart.new(workbook, '', 'chart')
21
+ end
22
+
23
+ ###############################################################################
24
+ #
25
+ # Test the _store_fbi method.
26
+ #
27
+ def test_store_fbi
28
+ caption = " \tChart: _store_fbi()"
29
+ expected = %w(
30
+ 60 10 0A 00 B8 38 A1 22 C8 00 00 00 05 00
31
+ ).join(' ')
32
+ got = unpack_record(@chart.__send__("store_fbi", 5, 10, 0x38B8, 0x22A1, 0x0000))
33
+ assert_equal(expected, got, caption)
34
+
35
+ expected = %w(
36
+ 60 10 0A 00 B8 38 A1 22 C8 00 00 00 06 00
37
+ ).join(' ')
38
+ got = unpack_record(@chart.__send__("store_fbi", 6, 10, 0x38B8, 0x22A1, 0x0000))
39
+ assert_equal(expected, got, caption)
40
+ end
41
+
42
+ ###############################################################################
43
+ #
44
+ # Test the _store_chart method.
45
+ #
46
+ def test_store_chart
47
+ caption = " \tChart: _store_chart()"
48
+ expected = %w(
49
+ 02 10 10 00 00 00 00 00 00 00 00 00 E0 51 DD 02
50
+ 38 B8 C2 01
51
+ ).join(' ')
52
+ values = [0x0000, 0x0000, 0x02DD51E0, 0x01C2B838]
53
+ got = unpack_record(@chart.__send__("store_chart", *values))
54
+ assert_equal(expected, got, caption)
55
+ end
56
+
57
+ ###############################################################################
58
+ #
59
+ # Test the _store_series method.
60
+ #
61
+ def test_store_series
62
+ caption = " \tChart: _store_series()"
63
+ expected = %w(
64
+ 03 10 0C 00 01 00 01 00 08 00 08 00 01 00 00 00
65
+ ).join(' ')
66
+ got = unpack_record(@chart.__send__("store_series", 8, 8))
67
+ assert_equal(expected, got, caption)
68
+ end
69
+
70
+ ###############################################################################
71
+ #
72
+ # Test the _store_begin method.
73
+ #
74
+ def test_store_begin
75
+ caption = " \tChart: _store_begin()"
76
+ expected = %w(
77
+ 33 10 00 00
78
+ ).join(' ')
79
+ got = unpack_record(@chart.__send__("store_begin"))
80
+ assert_equal(expected, got, caption)
81
+ end
82
+
83
+ ###############################################################################
84
+ #
85
+ # Test the _store_end method.
86
+ #
87
+ def test_store_end
88
+ caption = " \tChart: _store_end()"
89
+ expected = %w(
90
+ 34 10 00 00
91
+ ).join(' ')
92
+ got = unpack_record(@chart.__send__("store_end"))
93
+ assert_equal(expected, got, caption)
94
+ end
95
+
96
+ ###############################################################################
97
+ #
98
+ # Test the _store_ai method.
99
+ #
100
+ def test_store_ai
101
+ caption = " \tChart: _store_ai()"
102
+ values = [0, 1, '']
103
+ expected = %w(
104
+ 51 10 08 00 00 01 00 00 00 00 00 00
105
+ ).join(' ')
106
+ got = unpack_record(@chart.__send__("store_ai", *values))
107
+ assert_equal(expected, got, caption)
108
+
109
+ values = [1, 2, ['3B00000000070000000000'].pack('H*')]
110
+ expected = %w(
111
+ 51 10 13 00 01 02 00 00 00 00 0B 00 3B 00 00 00
112
+ 00 07 00 00 00 00 00
113
+ ).join(' ')
114
+ got = unpack_record(@chart.__send__("store_ai", *values))
115
+ assert_equal(expected, got, caption)
116
+ end
117
+
118
+ ###############################################################################
119
+ #
120
+ # Test the _store_dataformat method.
121
+ #
122
+ def test_store_dataformat
123
+ caption = " \tChart: _store_dataformat()"
124
+ expected = %w(
125
+ 06 10 08 00 FF FF 00 00 00 00 00 00
126
+ ).join(' ')
127
+ got = unpack_record(@chart.__send__("store_dataformat", 0, 0, 0xFFFF))
128
+ assert_equal(expected, got, caption)
129
+
130
+ expected = %w(
131
+ 06 10 08 00 00 00 00 00 FD FF 00 00
132
+ ).join(' ')
133
+ got = unpack_record(@chart.__send__("store_dataformat", 0, 0xFFFD, 0))
134
+ assert_equal(expected, got, caption)
135
+ end
136
+
137
+ ###############################################################################
138
+ #
139
+ # Test the _store_3dbarshape method.
140
+ #
141
+ def test_store_3dbarshape
142
+ caption = " \tChart: _store_3dbarshape()"
143
+ expected = %w(
144
+ 5F 10 02 00 00 00
145
+ ).join(' ')
146
+ got = unpack_record(@chart.__send__("store_3dbarshape"))
147
+ assert_equal(expected, got, caption)
148
+ end
149
+
150
+ ###############################################################################
151
+ #
152
+ # Test the _store_sertocrt method.
153
+ #
154
+ def test_store_sertocrt
155
+ caption = " \tChart: _store_sertocrt()"
156
+ expected = %w(
157
+ 45 10 02 00 00 00
158
+ ).join(' ')
159
+ got = unpack_record(@chart.__send__("store_sertocrt"))
160
+ assert_equal(expected, got, caption)
161
+ end
162
+
163
+ ###############################################################################
164
+ #
165
+ # Test the _store_shtprops method.
166
+ #
167
+ def test_store_shtprops
168
+ caption = " \tChart: _store_shtprops()"
169
+ expected = %w(
170
+ 44 10 04 00 0E 00 00 00
171
+ ).join(' ')
172
+ got = unpack_record(@chart.__send__("store_shtprops"))
173
+ assert_equal(expected, got, caption)
174
+ end
175
+
176
+ ###############################################################################
177
+ #
178
+ # Test the _store_defaulttext method.
179
+ #
180
+ def test_store_defaulttext
181
+ caption = " \tChart: _store_defaulttext()"
182
+ expected = %w(
183
+ 24 10 02 00 02 00
184
+ ).join(' ')
185
+ got = unpack_record(@chart.__send__("store_defaulttext"))
186
+ assert_equal(expected, got, caption)
187
+ end
188
+
189
+ ###############################################################################
190
+ #
191
+ # Test the _store_charttext method.
192
+ #
193
+ def test_store_charttext
194
+ caption = " \tChart: _store_charttext()"
195
+ expected = %w(
196
+ 25 10 20 00 02 02 01 00 00 00 00 00 46 FF FF FF
197
+ 06 FF FF FF 00 00 00 00 00 00 00 00 B1 00 4D 00
198
+ 00 00 00 00
199
+ ).join(' ')
200
+ got = unpack_record(@chart.__send__("store_charttext"))
201
+ assert_equal(expected, got, caption)
202
+ end
203
+
204
+ ###############################################################################
205
+ #
206
+ # Test the _store_fontx method.
207
+ #
208
+ def test_store_fontx
209
+ caption = " \tChart: _store_fontx()"
210
+ expected = %w(
211
+ 26 10 02 00 05 00
212
+ ).join(' ')
213
+ got = unpack_record(@chart.__send__("store_fontx", 5))
214
+ assert_equal(expected, got, caption)
215
+ end
216
+
217
+ ###############################################################################
218
+ #
219
+ # Test the _store_axesused method.
220
+ #
221
+ def test_store_axesused
222
+ caption = " \tChart: _store_axesused()"
223
+ expected = %w(
224
+ 46 10 02 00 01 00
225
+ ).join(' ')
226
+ got = unpack_record(@chart.__send__("store_axesused", 1))
227
+ assert_equal(expected, got, caption)
228
+ end
229
+
230
+ ###############################################################################
231
+ #
232
+ # Test the _store_axisparent method.
233
+ #
234
+ def test_store_axisparent
235
+ caption = " \tChart: _store_axisparent()"
236
+ expected = %w(
237
+ 41 10 12 00 00 00 F8 00 00 00 F5 01 00 00 7F 0E
238
+ 00 00 36 0B 00 00
239
+ ).join(' ')
240
+ values = [0, 0x00F8, 0x01F5, 0x0E7F, 0x0B36]
241
+ got = unpack_record(@chart.__send__("store_axisparent", *values))
242
+ assert_equal(expected, got, caption)
243
+ end
244
+
245
+ ###############################################################################
246
+ #
247
+ # Test the _store_axis method.
248
+ #
249
+ def test_store_axis
250
+ caption = " \tChart: _store_axis()"
251
+ expected = %w(
252
+ 1D 10 12 00 00 00 00 00 00 00 00 00 00 00 00 00
253
+ 00 00 00 00 00 00
254
+ ).join(' ')
255
+ got = unpack_record(@chart.__send__("store_axis", 0))
256
+ assert_equal(expected, got, caption)
257
+ end
258
+
259
+ ###############################################################################
260
+ #
261
+ # Test the _store_catserrange method.
262
+ #
263
+ def test_store_catserrange
264
+ caption = " \tChart: _store_catserrange()"
265
+ expected = %w(
266
+ 20 10 08 00 01 00 01 00 01 00 01 00
267
+ ).join(' ')
268
+ got = unpack_record(@chart.__send__("store_catserrange"))
269
+ assert_equal(expected, got, caption)
270
+ end
271
+
272
+ ###############################################################################
273
+ #
274
+ # Test the _store_axcext method.
275
+ #
276
+ def test_store_axcext
277
+ caption = " \tChart: _store_axcext()"
278
+ expected = %w(
279
+ 62 10 12 00 00 00 00 00 01 00 00 00 01 00 00 00
280
+ 00 00 00 00 EF 00
281
+ ).join(' ')
282
+ got = unpack_record(@chart.__send__("store_axcext"))
283
+ assert_equal(expected, got, caption)
284
+ end
285
+
286
+ ###############################################################################
287
+ #
288
+ # Test the _store_tick method.
289
+ #
290
+ def test_store_tick
291
+ caption = " \tChart: _store_tick()"
292
+ expected = %w(
293
+ 1E 10 1E 00 02 00 03 01 00 00 00 00 00 00 00 00
294
+ 00 00 00 00 00 00 00 00 00 00 00 00 23 00 4D 00
295
+ 00 00
296
+ ).join(' ')
297
+ got = unpack_record(@chart.__send__("store_tick"))
298
+ assert_equal(expected, got, caption)
299
+ end
300
+
301
+ ###############################################################################
302
+ #
303
+ # Test the _store_valuerange method.
304
+ #
305
+ def test_store_valuerange
306
+ caption = " \tChart: _store_valuerange()"
307
+ expected = %w(
308
+ 1F 10 2A 00 00 00 00 00 00 00 00 00 00 00 00 00
309
+ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
310
+ 00 00 00 00 00 00 00 00 00 00 00 00 1F 01
311
+ ).join(' ')
312
+ got = unpack_record(@chart.__send__("store_valuerange"))
313
+ assert_equal(expected, got, caption)
314
+ end
315
+
316
+ ###############################################################################
317
+ #
318
+ # Test the _store_axislineformat method.
319
+ #
320
+ def test_store_axislineformat
321
+ caption = " \tChart: _store_axislineformat()"
322
+ expected = %w(
323
+ 21 10 02 00 01 00
324
+ ).join(' ')
325
+ got = unpack_record(@chart.__send__("store_axislineformat"))
326
+ assert_equal(expected, got, caption)
327
+ end
328
+
329
+ ###############################################################################
330
+ #
331
+ # Test the _store_lineformat method.
332
+ #
333
+ def test_store_lineformat
334
+ caption = " \tChart: _store_lineformat()"
335
+ expected = %w(
336
+ 07 10 0C 00 00 00 00 00 00 00 FF FF 09 00 4D 00
337
+ ).join(' ')
338
+ values = [0x00000000, 0x0000, 0xFFFF, 0x0009, 0x004D]
339
+ got = unpack_record(@chart.__send__("store_lineformat", *values))
340
+ assert_equal(expected, got, caption)
341
+ end
342
+
343
+ ###############################################################################
344
+ #
345
+ # Test the _store_frame method.
346
+ #
347
+ def test_store_frame
348
+ caption = " \tChart: _store_frame()"
349
+ expected = %w(
350
+ 32 10 04 00 00 00 03 00
351
+ ).join(' ')
352
+ got = unpack_record(@chart.__send__("store_frame", 0x00, 0x03))
353
+ assert_equal(expected, got, caption)
354
+ end
355
+
356
+ ###############################################################################
357
+ #
358
+ # Test the _store_areaformat method.
359
+ #
360
+ def test_store_areaformat
361
+ caption = " \tChart: _store_areaformat()"
362
+ expected = %w(
363
+ 0A 10 10 00 C0 C0 C0 00 00 00 00 00 01 00 00 00
364
+ 16 00 4F 00
365
+ ).join(' ')
366
+ values = [0x00C0C0C0, 0x00, 0x01, 0x00, 0x16, 0x4F]
367
+ got = unpack_record(@chart.__send__("store_areaformat", *values))
368
+ assert_equal(expected, got, caption)
369
+ end
370
+
371
+ ###############################################################################
372
+ #
373
+ # Test the _store_chartformat method.
374
+ #
375
+ def test_store_chartformat
376
+ caption = " \tChart: _store_chartformat()"
377
+ expected = %w(
378
+ 14 10 14 00 00 00 00 00 00 00 00 00 00 00 00 00
379
+ 00 00 00 00 00 00 00 00
380
+ ).join(' ')
381
+ got = unpack_record(@chart.__send__("store_chartformat"))
382
+ assert_equal(expected, got, caption)
383
+ end
384
+
385
+ ###############################################################################
386
+ #
387
+ # Test the _store_legend method.
388
+ #
389
+ def test_store_legend
390
+ caption = " \tChart: _store_legend()"
391
+ expected = %w(
392
+ 15 10 14 00 F9 05 00 00 E9 0E 00 00 7D 04 00 00
393
+ 9C 00 00 00 00 01 0F 00
394
+ ).join(' ')
395
+ values = [0x05F9, 0x0EE9, 0x047D, 0x009C, 0x00, 0x01, 0x000F]
396
+ got = unpack_record(@chart.__send__("store_legend", *values))
397
+ assert_equal(expected, got, caption)
398
+ end
399
+
400
+ ###############################################################################
401
+ #
402
+ # Test the _store_pos method.
403
+ #
404
+ def test_store_pos
405
+ caption = " \tChart: _store_pos()"
406
+ expected = %w(
407
+ 4F 10 14 00 05 00 02 00 83 0E 00 00 F9 06 00 00
408
+ 00 00 00 00 00 00 00 00
409
+ ).join(' ')
410
+ values = [5, 2, 0x0E83, 0x06F9, 0, 0]
411
+ got = unpack_record(@chart.__send__("store_pos", *values))
412
+ assert_equal(expected, got, caption)
413
+ end
414
+
415
+ ###############################################################################
416
+ #
417
+ # Test the _store_text method.
418
+ #
419
+ def test_store_text
420
+ caption = " \tChart: _store_text()"
421
+ expected = %w(
422
+ 25 10 20 00 02 02 01 00 00 00 00 00 46 FF FF FF
423
+ 06 FF FF FF 00 00 00 00 00 00 00 00 B1 00 4D 00
424
+ 20 10 00 00
425
+ ).join(' ')
426
+ values = [0xFFFFFF46, 0xFFFFFF06, 0, 0, 0x00B1, 0x1020]
427
+ got = unpack_record(@chart.__send__("store_text", *values))
428
+ assert_equal(expected, got, caption)
429
+ end
430
+
431
+ ###############################################################################
432
+ #
433
+ # Test the _store_plotgrowth method.
434
+ #
435
+ def test_store_plotgrowth
436
+ caption = " \tChart: _store_plotgrowth()"
437
+ expected = %w(
438
+ 64 10 08 00 00 00 01 00 00 00 01 00
439
+ ).join(' ')
440
+ got = unpack_record(@chart.__send__("store_plotgrowth"))
441
+ assert_equal(expected, got, caption)
442
+ end
443
+
444
+ ###############################################################################
445
+ #
446
+ # Test the _store_seriestext method.
447
+ #
448
+ def test_store_seriestext
449
+ caption = " \tChart: _store_seriestext()"
450
+ expected = %w(
451
+ 0D 10 14 00 00 00 10 00 4E 61 6D 65
452
+ 20 66 6F 72 20 53 65 72
453
+ 69 65 73 31
454
+ ).join(' ')
455
+ str = 'Name for Series1'
456
+ got = unpack_record(@chart.__send__("store_seriestext", str, 0))
457
+ assert_equal(expected, got, caption)
458
+ end
459
+
460
+ ###############################################################################
461
+ #
462
+ # Test the _store_seriestext method.
463
+ #
464
+ def test_store_seriestext_utf16
465
+ caption = " \tChart: _store_seriestext()"
466
+ expected = %w(
467
+ 0D 10 24 00 00 00 10 01 4E 00 61 00 6D 00 65 00
468
+ 20 00 66 00 6F 00 72 00 20 00 53 00 65 00 72 00
469
+ 69 00 65 00 73 00 31 00
470
+ ).join(' ')
471
+ str = 'Name for Series1'.unpack('C*').pack('n*')
472
+ got = unpack_record(@chart.__send__("store_seriestext", str, 1))
473
+ assert_equal(expected, got, caption)
474
+ end
475
+
476
+ ###############################################################################
477
+ #
478
+ # Test the _store_objectlink method.
479
+ #
480
+ def test_store_objectlink
481
+ caption = " \tChart: _store_objectlink()"
482
+ expected = %w(
483
+ 27 10 06 00 01 00 00 00 00 00
484
+ ).join(' ')
485
+ got = unpack_record(@chart.__send__("store_objectlink", 1))
486
+ assert_equal(expected, got, caption)
487
+ end
488
+
489
+ ###############################################################################
490
+ #
491
+ # Test the _store_pieformat method.
492
+ #
493
+ def test_store_pieformat
494
+ caption = " \tChart: _store_pieformat()"
495
+ expected = %w(
496
+ 0B 10 02 00 00 00
497
+ ).join(' ')
498
+ got = unpack_record(@chart.__send__("store_pieformat"))
499
+ assert_equal(expected, got, caption)
500
+ end
501
+
502
+ ###############################################################################
503
+ #
504
+ # Test the _store_markerformat method.
505
+ #
506
+ def test_store_markerformat
507
+ caption = " \tChart: _store_markerformat()"
508
+ expected = %w(
509
+ 09 10 14 00 00 00 00 00 00 00 00 00 02 00 01 00
510
+ 4D 00 4D 00 3C 00 00 00
511
+ ).join(' ')
512
+ values = [0x00, 0x00, 0x02, 0x01, 0x4D, 0x4D, 0x3C]
513
+ got = unpack_record(@chart.__send__("store_markerformat", *values))
514
+ assert_equal(expected, got, caption)
515
+ end
516
+
517
+ ###############################################################################
518
+ #
519
+ # Test the _store_dropbar method.
520
+ #
521
+ def test_store_dropbar
522
+ caption = " \tChart: _store_dropbar()"
523
+ expected = %w(
524
+ 3D 10 02 00 96 00
525
+ ).join(' ')
526
+ got = unpack_record(@chart.__send__("store_dropbar"))
527
+ assert_equal(expected, got, caption)
528
+ end
529
+
530
+ ###############################################################################
531
+ #
532
+ # Test the _store_chartline method.
533
+ #
534
+ def test_store_chartline
535
+ caption = " \tChart: _store_chartline()"
536
+ expected = %w(
537
+ 1C 10 02 00 01 00
538
+ ).join(' ')
539
+ got = unpack_record(@chart.__send__("store_chartline"))
540
+ assert_equal(expected, got, caption)
541
+ end
542
+
543
+ ###############################################################################
544
+ #
545
+ # Test the _store_serparent method.
546
+ #
547
+ def test_store_serparent
548
+ caption = " \tChart: _store_serparent()"
549
+ expected = %w(
550
+ 4A 10 02 00 01 00
551
+ ).join(' ')
552
+ got = unpack_record(@chart.__send__("store_serparent", 1))
553
+ assert_equal(expected, got, caption)
554
+ end
555
+
556
+ ###############################################################################
557
+ #
558
+ # Test the _store_serauxtrend method.
559
+ #
560
+ def test_store_serauxtrend
561
+ caption = " \tChart: _store_serauxtrend()"
562
+ expected = %w(
563
+ 4B 10 1C 00 00 01 FF FF FF FF 00 01 FF FF 00 00
564
+ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
565
+ ).join(' ')
566
+ values = [0x00, 0x01, 0x00, 0x00]
567
+ got = unpack_record(@chart.__send__("store_serauxtrend", *values))
568
+ assert_equal(expected, got, caption)
569
+ end
570
+
571
+ def unpack_record(data)
572
+ data.unpack('C*').map! {|c| sprintf("%02X", c) }.join(' ')
573
+ end
574
+ end