writeexcel 0.1.0 → 0.3.0
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.
- data/README +26 -31
- data/examples/a_simple.rb +42 -42
- data/examples/{autofilters.rb → autofilter.rb} +264 -266
- data/examples/bigfile.rb +29 -0
- data/examples/chart_area.rb +120 -0
- data/examples/chart_bar.rb +119 -0
- data/examples/chart_column.rb +119 -0
- data/examples/chart_line.rb +119 -0
- data/examples/chart_pie.rb +107 -0
- data/examples/chart_scatter.rb +120 -0
- data/examples/chart_stock.rb +147 -0
- data/examples/copyformat.rb +51 -51
- data/examples/data_validate.rb +278 -278
- data/examples/date_time.rb +86 -86
- data/examples/defined_name.rb +31 -0
- data/examples/demo.rb +120 -118
- data/examples/diag_border.rb +35 -35
- data/examples/formats.rb +489 -489
- data/examples/header.rb +136 -136
- data/examples/hidden.rb +28 -28
- data/examples/hyperlink.rb +42 -42
- data/examples/images.rb +52 -52
- data/examples/merge1.rb +39 -39
- data/examples/merge2.rb +44 -44
- data/examples/merge3.rb +65 -65
- data/examples/merge4.rb +82 -82
- data/examples/merge5.rb +79 -79
- data/examples/properties.rb +33 -0
- data/examples/properties_jp.rb +32 -0
- data/examples/protection.rb +46 -46
- data/examples/regions.rb +52 -52
- data/examples/repeat.rb +42 -42
- data/examples/stats.rb +75 -75
- data/examples/stocks.rb +80 -80
- data/examples/tab_colors.rb +30 -30
- data/examples/write_arrays.rb +82 -0
- data/lib/writeexcel.rb +1134 -18
- data/lib/writeexcel/biffwriter.rb +273 -260
- data/lib/writeexcel/chart.rb +2306 -217
- data/lib/writeexcel/charts/area.rb +152 -0
- data/lib/writeexcel/charts/bar.rb +177 -0
- data/lib/writeexcel/charts/column.rb +156 -0
- data/lib/writeexcel/charts/external.rb +61 -0
- data/lib/writeexcel/charts/line.rb +152 -0
- data/lib/writeexcel/charts/pie.rb +169 -0
- data/lib/writeexcel/charts/scatter.rb +192 -0
- data/lib/writeexcel/charts/stock.rb +211 -0
- data/lib/writeexcel/excelformulaparser.rb +208 -195
- data/lib/writeexcel/format.rb +1697 -1108
- data/lib/writeexcel/formula.rb +1050 -986
- data/lib/writeexcel/olewriter.rb +322 -322
- data/lib/writeexcel/properties.rb +251 -250
- data/lib/writeexcel/storage_lite.rb +968 -0
- data/lib/writeexcel/workbook.rb +3294 -2630
- data/lib/writeexcel/worksheet.rb +9012 -6377
- data/test/excelfile/Chart1.xls +0 -0
- data/test/excelfile/Chart2.xls +0 -0
- data/test/excelfile/Chart3.xls +0 -0
- data/test/excelfile/Chart4.xls +0 -0
- data/test/excelfile/Chart5.xls +0 -0
- data/test/perl_output/Chart1.xls.data +0 -0
- data/test/perl_output/Chart2.xls.data +0 -0
- data/test/perl_output/Chart3.xls.data +0 -0
- data/test/perl_output/Chart4.xls.data +0 -0
- data/test/perl_output/Chart5.xls.data +0 -0
- data/test/perl_output/a_simple.xls +0 -0
- data/test/perl_output/autofilter.xls +0 -0
- data/test/perl_output/chart_area.xls +0 -0
- data/test/perl_output/chart_bar.xls +0 -0
- data/test/perl_output/chart_column.xls +0 -0
- data/test/perl_output/chart_line.xls +0 -0
- data/test/perl_output/data_validate.xls +0 -0
- data/test/perl_output/date_time.xls +0 -0
- data/test/perl_output/demo.xls +0 -0
- data/test/perl_output/demo101.bin +0 -0
- data/test/perl_output/demo201.bin +0 -0
- data/test/perl_output/demo301.bin +0 -0
- data/test/perl_output/demo401.bin +0 -0
- data/test/perl_output/demo501.bin +0 -0
- data/test/perl_output/diag_border.xls +0 -0
- data/test/perl_output/headers.xls +0 -0
- data/test/perl_output/hyperlink.xls +0 -0
- data/test/perl_output/images.xls +0 -0
- data/test/perl_output/merge1.xls +0 -0
- data/test/perl_output/merge2.xls +0 -0
- data/test/perl_output/merge3.xls +0 -0
- data/test/perl_output/merge4.xls +0 -0
- data/test/perl_output/merge5.xls +0 -0
- data/test/perl_output/protection.xls +0 -0
- data/test/perl_output/regions.xls +0 -0
- data/test/perl_output/stats.xls +0 -0
- data/test/perl_output/stocks.xls +0 -0
- data/test/perl_output/tab_colors.xls +0 -0
- data/test/perl_output/unicode_cyrillic.xls +0 -0
- data/test/perl_output/workbook1.xls +0 -0
- data/test/perl_output/workbook2.xls +0 -0
- data/test/tc_all.rb +32 -31
- data/test/tc_biff.rb +104 -104
- data/test/tc_chart.rb +22 -22
- data/test/tc_example_match.rb +1944 -1280
- data/test/tc_format.rb +1254 -1267
- data/test/tc_formula.rb +63 -63
- data/test/tc_ole.rb +110 -110
- data/test/tc_storage_lite.rb +149 -0
- data/test/tc_workbook.rb +140 -115
- data/test/tc_worksheet.rb +115 -115
- data/test/test_00_IEEE_double.rb +14 -14
- data/test/test_01_add_worksheet.rb +12 -12
- data/test/test_02_merge_formats.rb +58 -58
- data/test/test_04_dimensions.rb +397 -397
- data/test/test_05_rows.rb +182 -182
- data/test/test_06_extsst.rb +80 -80
- data/test/test_11_date_time.rb +484 -484
- data/test/test_12_date_only.rb +506 -506
- data/test/test_13_date_seconds.rb +486 -486
- data/test/test_21_escher.rb +642 -629
- data/test/test_22_mso_drawing_group.rb +750 -739
- data/test/test_23_note.rb +78 -78
- data/test/test_24_txo.rb +80 -80
- data/test/test_25_position_object.rb +82 -0
- data/test/test_26_autofilter.rb +327 -327
- data/test/test_27_autofilter.rb +144 -144
- data/test/test_28_autofilter.rb +174 -174
- data/test/test_29_process_jpg.rb +681 -131
- data/test/test_30_validation_dval.rb +82 -82
- data/test/test_31_validation_dv_strings.rb +131 -131
- data/test/test_32_validation_dv_formula.rb +211 -211
- data/test/test_40_property_types.rb +191 -191
- data/test/test_41_properties.rb +238 -238
- data/test/test_42_set_properties.rb +442 -419
- data/test/test_50_name_stored.rb +305 -0
- data/test/test_51_name_print_area.rb +363 -0
- data/test/test_52_name_print_titles.rb +460 -0
- data/test/test_53_autofilter.rb +209 -0
- data/test/test_60_chart_generic.rb +576 -0
- data/test/test_61_chart_subclasses.rb +97 -0
- data/test/test_62_chart_formats.rb +270 -0
- data/test/test_63_chart_area_formats.rb +647 -0
- data/test/test_chartex.rb +35 -0
- data/test/ts_all.rb +46 -34
- data/writeexcel.gemspec +18 -0
- data/writeexcel.rdoc +583 -0
- metadata +162 -108
data/test/test_21_escher.rb
CHANGED
|
@@ -1,629 +1,642 @@
|
|
|
1
|
-
###############################################################################
|
|
2
|
-
#
|
|
3
|
-
# A test for
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
target = %w(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
).join(' ')
|
|
79
|
-
|
|
80
|
-
result = unpack_record(@workbook.
|
|
81
|
-
|
|
82
|
-
assert_equal(target, result, caption)
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
def
|
|
86
|
-
caption = sprintf(" \
|
|
87
|
-
target = %w(
|
|
88
|
-
00
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
target = %w(
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
).join(' ')
|
|
112
|
-
|
|
113
|
-
result = unpack_record(@worksheet.
|
|
114
|
-
|
|
115
|
-
assert_equal(target, result, caption)
|
|
116
|
-
end
|
|
117
|
-
|
|
118
|
-
def
|
|
119
|
-
caption = sprintf(" \
|
|
120
|
-
data = [
|
|
121
|
-
target = %w(
|
|
122
|
-
|
|
123
|
-
).join(' ')
|
|
124
|
-
|
|
125
|
-
result = unpack_record(@worksheet.
|
|
126
|
-
|
|
127
|
-
assert_equal(target, result, caption)
|
|
128
|
-
end
|
|
129
|
-
|
|
130
|
-
def
|
|
131
|
-
caption = sprintf(" \
|
|
132
|
-
data = [
|
|
133
|
-
target = %w(
|
|
134
|
-
0F 00
|
|
135
|
-
).join(' ')
|
|
136
|
-
|
|
137
|
-
result = unpack_record(@worksheet.
|
|
138
|
-
|
|
139
|
-
assert_equal(target, result, caption)
|
|
140
|
-
end
|
|
141
|
-
|
|
142
|
-
def
|
|
143
|
-
caption = sprintf(" \
|
|
144
|
-
data = [
|
|
145
|
-
target = %w(
|
|
146
|
-
|
|
147
|
-
).join(' ')
|
|
148
|
-
|
|
149
|
-
result = unpack_record(@worksheet.
|
|
150
|
-
|
|
151
|
-
assert_equal(target, result, caption)
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
data = [
|
|
166
|
-
target = %w(
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
data =
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
data =
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
@worksheet.
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
target
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
).join(' ')
|
|
460
|
-
|
|
461
|
-
result = unpack_record(@worksheet.
|
|
462
|
-
|
|
463
|
-
assert_equal(target, result, caption)
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
target = %w(
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
00 00
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
'
|
|
547
|
-
|
|
548
|
-
'
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
0, #
|
|
555
|
-
|
|
556
|
-
'
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
'
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
'
|
|
570
|
-
|
|
571
|
-
'00
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
'00 00
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
'
|
|
592
|
-
|
|
593
|
-
'
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
0, #
|
|
600
|
-
|
|
601
|
-
''
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
'
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
'
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
1
|
+
###############################################################################
|
|
2
|
+
#
|
|
3
|
+
# A test for WriteExcel.
|
|
4
|
+
#
|
|
5
|
+
#
|
|
6
|
+
# all test is commented out because Workbook#add_mso_... was set to private
|
|
7
|
+
# method. Before that, all test passed.
|
|
8
|
+
#
|
|
9
|
+
#
|
|
10
|
+
#
|
|
11
|
+
#
|
|
12
|
+
# Tests for the internal methods used to write the records in an Escher drawing
|
|
13
|
+
# object such as images, comments and filters.
|
|
14
|
+
#
|
|
15
|
+
# reverse('©'), September 2005, John McNamara, jmcnamara@cpan.org
|
|
16
|
+
#
|
|
17
|
+
# original written in Perl by John McNamara
|
|
18
|
+
# converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
|
|
19
|
+
#
|
|
20
|
+
############################################################################
|
|
21
|
+
$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"
|
|
22
|
+
|
|
23
|
+
require "test/unit"
|
|
24
|
+
require 'writeexcel'
|
|
25
|
+
|
|
26
|
+
class TC_escher < Test::Unit::TestCase
|
|
27
|
+
|
|
28
|
+
def setup
|
|
29
|
+
t = Time.now.strftime("%Y%m%d")
|
|
30
|
+
path = "temp#{t}-#{$$}-#{rand(0x100000000).to_s(36)}"
|
|
31
|
+
@test_file = File.join(Dir.tmpdir, path)
|
|
32
|
+
@workbook = WriteExcel.new(@test_file)
|
|
33
|
+
@worksheet = @workbook.add_worksheet
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def teardown
|
|
37
|
+
@workbook.close
|
|
38
|
+
File.unlink(@test_file) if FileTest.exist?(@test_file)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def test_dummy
|
|
42
|
+
assert(true)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
=begin
|
|
46
|
+
def test_for_the_generic_method
|
|
47
|
+
data_for_test.each do |data|
|
|
48
|
+
caption = data.shift
|
|
49
|
+
target = data.pop
|
|
50
|
+
|
|
51
|
+
data[3].gsub!(/ /,'')
|
|
52
|
+
data[3] = [data[3]].pack('H*')
|
|
53
|
+
|
|
54
|
+
caption = sprintf(" \t_add_mso_generic(): (0x%04X) %s", data[0], caption)
|
|
55
|
+
|
|
56
|
+
result = unpack_record(@worksheet.add_mso_generic(*data))
|
|
57
|
+
|
|
58
|
+
assert_equal(target, result, caption)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def test_for_store_mso_dgg_container
|
|
63
|
+
caption = sprintf(" \t_store_mso_dgg_container()")
|
|
64
|
+
target = %w( 0F 00 00 F0 52 00 00 00 ).join(' ')
|
|
65
|
+
|
|
66
|
+
@workbook.mso_size = 94
|
|
67
|
+
result = unpack_record(@workbook.store_mso_dgg_container)
|
|
68
|
+
|
|
69
|
+
assert_equal(target, result, caption)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def test_for_store_mso_dgg
|
|
73
|
+
caption = sprintf(" \t_store_mso_dgg()")
|
|
74
|
+
data = [ 1026, 2, 2, 1, [[1,2]] ]
|
|
75
|
+
target = %w( 00 00 06 F0
|
|
76
|
+
18 00 00 00 02 04 00 00 02 00 00 00 02 00 00 00
|
|
77
|
+
01 00 00 00 01 00 00 00 02 00 00 00
|
|
78
|
+
).join(' ')
|
|
79
|
+
|
|
80
|
+
result = unpack_record(@workbook.store_mso_dgg(*data))
|
|
81
|
+
|
|
82
|
+
assert_equal(target, result, caption)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def test_for_store_mso_opt
|
|
86
|
+
caption = sprintf(" \t_store_mso_opt()")
|
|
87
|
+
target = %w( 33 00 0B F0
|
|
88
|
+
12 00 00 00 BF 00 08 00 08 00 81 01 09 00 00 08
|
|
89
|
+
C0 01 40 00 00 08
|
|
90
|
+
).join(' ')
|
|
91
|
+
|
|
92
|
+
result = unpack_record(@workbook.store_mso_opt)
|
|
93
|
+
|
|
94
|
+
assert_equal(target, result, caption)
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def test_for_store_mso_split_menu_colors
|
|
98
|
+
caption = sprintf(" \t_store_mso_split_menu_colors()")
|
|
99
|
+
target = %w( 40 00 1E F1 10 00 00 00 0D 00
|
|
100
|
+
00 08 0C 00 00 08 17 00 00 08 F7 00 00 10
|
|
101
|
+
).join(' ')
|
|
102
|
+
|
|
103
|
+
result = unpack_record(@workbook.store_mso_split_menu_colors)
|
|
104
|
+
|
|
105
|
+
assert_equal(target, result, caption)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def test_for_store_mso_dg_container
|
|
109
|
+
caption = sprintf(" \t_store_mso_dg_container()")
|
|
110
|
+
data = [0xC8]
|
|
111
|
+
target = %w( 0F 00 02 F0 C8 00 00 00 ).join(' ')
|
|
112
|
+
|
|
113
|
+
result = unpack_record(@worksheet.store_mso_dg_container(*data))
|
|
114
|
+
|
|
115
|
+
assert_equal(target, result, caption)
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def test_for_store_mso_dg
|
|
119
|
+
caption = sprintf(" \t_store_mso_dg()")
|
|
120
|
+
data = [1, 2, 1025]
|
|
121
|
+
target = %w( 10 00 08 F0
|
|
122
|
+
08 00 00 00 02 00 00 00 01 04 00 00
|
|
123
|
+
).join(' ')
|
|
124
|
+
|
|
125
|
+
result = unpack_record(@worksheet.store_mso_dg(*data))
|
|
126
|
+
|
|
127
|
+
assert_equal(target, result, caption)
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
def test_for_store_mso_spgr_container
|
|
131
|
+
caption = sprintf(" \t_store_mso_spgr_container()")
|
|
132
|
+
data = [0xB0]
|
|
133
|
+
target = %w(
|
|
134
|
+
0F 00 03 F0 B0 00 00 00
|
|
135
|
+
).join(' ')
|
|
136
|
+
|
|
137
|
+
result = unpack_record(@worksheet.store_mso_spgr_container(*data))
|
|
138
|
+
|
|
139
|
+
assert_equal(target, result, caption)
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
def test_for_store_mso_sp_container
|
|
143
|
+
caption = sprintf(" \t_store_mso_sp_container()")
|
|
144
|
+
data = [0x28]
|
|
145
|
+
target = %w(
|
|
146
|
+
0F 00 04 F0 28 00 00 00
|
|
147
|
+
).join(' ')
|
|
148
|
+
|
|
149
|
+
result = unpack_record(@worksheet.store_mso_sp_container(*data))
|
|
150
|
+
|
|
151
|
+
assert_equal(target, result, caption)
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
def test_for_store_mso_sp
|
|
155
|
+
caption = sprintf(" \t_store_mso_sp()")
|
|
156
|
+
data = [0, 1024, 0x0005]
|
|
157
|
+
target = %w(
|
|
158
|
+
02 00 0A F0 08 00 00 00 00 04 00 00 05 00 00 00
|
|
159
|
+
).join(' ')
|
|
160
|
+
|
|
161
|
+
result = unpack_record(@worksheet.store_mso_sp(*data))
|
|
162
|
+
|
|
163
|
+
assert_equal(target, result, caption)
|
|
164
|
+
|
|
165
|
+
data = [202, 1025, 0x0A00]
|
|
166
|
+
target = %w(
|
|
167
|
+
A2 0C 0A F0 08 00 00 00 01 04 00 00 00 0A 00 00
|
|
168
|
+
).join(' ')
|
|
169
|
+
|
|
170
|
+
result = unpack_record(@worksheet.store_mso_sp(*data))
|
|
171
|
+
|
|
172
|
+
assert_equal(target, result, caption)
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
def test_for_store_mso_opt_comment
|
|
176
|
+
caption = sprintf(" \t_store_mso_opt_comment()")
|
|
177
|
+
data = [0x80]
|
|
178
|
+
target = %w(
|
|
179
|
+
93 00 0B F0 36 00 00 00
|
|
180
|
+
80 00 00 00 00 00 BF 00 08 00 08 00
|
|
181
|
+
58 01 00 00 00 00 81 01 50 00 00 08 83 01 50 00
|
|
182
|
+
00 08 BF 01 10 00 11 00 01 02 00 00 00 00 3F 02
|
|
183
|
+
03 00 03 00 BF 03 02 00 0A 00
|
|
184
|
+
).join(' ')
|
|
185
|
+
|
|
186
|
+
result = unpack_record(@worksheet.store_mso_opt_comment(*data))
|
|
187
|
+
|
|
188
|
+
assert_equal(target, result, caption)
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
def test_for_store_mso_client_anchor
|
|
192
|
+
|
|
193
|
+
# A1
|
|
194
|
+
range = 'A1'
|
|
195
|
+
caption = sprintf(" \t_store_mso_client_anchor(%s)", range)
|
|
196
|
+
data = @worksheet.substitute_cellref(range)
|
|
197
|
+
data = @worksheet.comment_params(data[0], data[1], 'Test')
|
|
198
|
+
data = data[-1]
|
|
199
|
+
target = %w(
|
|
200
|
+
00 00 10 F0 12 00 00 00 03 00 01 00 F0 00 00 00
|
|
201
|
+
1E 00 03 00 F0 00 04 00 78 00
|
|
202
|
+
).join(' ')
|
|
203
|
+
|
|
204
|
+
result = unpack_record(@worksheet.store_mso_client_anchor(3, *data))
|
|
205
|
+
|
|
206
|
+
assert_equal(target, result, caption)
|
|
207
|
+
|
|
208
|
+
# A2
|
|
209
|
+
range = 'A2'
|
|
210
|
+
data = @worksheet.substitute_cellref(range)
|
|
211
|
+
data = @worksheet.comment_params(data[0], data[1], 'Test')
|
|
212
|
+
data = data[-1]
|
|
213
|
+
target = %w(
|
|
214
|
+
00 00 10 F0 12 00 00 00 03 00 01 00 F0 00 00 00
|
|
215
|
+
69 00 03 00 F0 00 04 00 C4 00
|
|
216
|
+
).join(' ')
|
|
217
|
+
|
|
218
|
+
result = unpack_record(@worksheet.store_mso_client_anchor(3, *data))
|
|
219
|
+
|
|
220
|
+
assert_equal(target, result, caption)
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
# A3
|
|
224
|
+
range = 'A3'
|
|
225
|
+
data = @worksheet.substitute_cellref(range)
|
|
226
|
+
data = @worksheet.comment_params(data[0], data[1], 'Test')
|
|
227
|
+
data = data[-1]
|
|
228
|
+
target = %w(
|
|
229
|
+
00 00 10 F0 12 00 00 00 03 00 01 00 F0 00 01 00
|
|
230
|
+
69 00 03 00 F0 00 05 00 C4 00
|
|
231
|
+
).join(' ')
|
|
232
|
+
|
|
233
|
+
result = unpack_record(@worksheet.store_mso_client_anchor(3, *data))
|
|
234
|
+
|
|
235
|
+
assert_equal(target, result, caption)
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
# A65534
|
|
239
|
+
range = 'A65534'
|
|
240
|
+
data = @worksheet.substitute_cellref(range)
|
|
241
|
+
data = @worksheet.comment_params(data[0], data[1], 'Test')
|
|
242
|
+
data = data[-1]
|
|
243
|
+
target = %w(
|
|
244
|
+
00 00 10 F0 12 00 00 00 03 00 01 00 F0 00 F9 FF
|
|
245
|
+
3C 00 03 00 F0 00 FD FF 97 00
|
|
246
|
+
).join(' ')
|
|
247
|
+
|
|
248
|
+
result = unpack_record(@worksheet.store_mso_client_anchor(3, *data))
|
|
249
|
+
|
|
250
|
+
assert_equal(target, result, caption)
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
# A65536
|
|
254
|
+
range = 'A65536'
|
|
255
|
+
data = @worksheet.substitute_cellref(range)
|
|
256
|
+
data = @worksheet.comment_params(data[0], data[1], 'Test')
|
|
257
|
+
data = data[-1]
|
|
258
|
+
target = %w(
|
|
259
|
+
00 00 10 F0 12 00 00 00 03 00 01 00 F0 00 FB FF
|
|
260
|
+
1E 00 03 00 F0 00 FF FF 78 00
|
|
261
|
+
).join(' ')
|
|
262
|
+
|
|
263
|
+
result = unpack_record(@worksheet.store_mso_client_anchor(3, *data))
|
|
264
|
+
|
|
265
|
+
assert_equal(target, result, caption)
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
# IT3
|
|
269
|
+
range = 'IT3'
|
|
270
|
+
data = @worksheet.substitute_cellref(range)
|
|
271
|
+
data = @worksheet.comment_params(data[0], data[1], 'Test')
|
|
272
|
+
data = data[-1]
|
|
273
|
+
target = %w(
|
|
274
|
+
00 00 10 F0 12 00 00 00 03 00 FA 00 10 03 01 00
|
|
275
|
+
69 00 FC 00 10 03 05 00 C4 00
|
|
276
|
+
).join(' ')
|
|
277
|
+
|
|
278
|
+
result = unpack_record(@worksheet.store_mso_client_anchor(3, *data))
|
|
279
|
+
|
|
280
|
+
assert_equal(target, result, caption)
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
# IU3
|
|
284
|
+
range = 'IU3'
|
|
285
|
+
data = @worksheet.substitute_cellref(range)
|
|
286
|
+
data = @worksheet.comment_params(data[0], data[1], 'Test')
|
|
287
|
+
data = data[-1]
|
|
288
|
+
target = %w(
|
|
289
|
+
00 00 10 F0 12 00 00 00 03 00 FB 00 10 03 01 00
|
|
290
|
+
69 00 FD 00 10 03 05 00 C4 00
|
|
291
|
+
).join(' ')
|
|
292
|
+
|
|
293
|
+
result = unpack_record(@worksheet.store_mso_client_anchor(3, *data))
|
|
294
|
+
|
|
295
|
+
assert_equal(target, result, caption)
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
#
|
|
299
|
+
range = 'IU3'
|
|
300
|
+
data = @worksheet.substitute_cellref(range)
|
|
301
|
+
data = @worksheet.comment_params(data[0], data[1], 'Test')
|
|
302
|
+
data = data[-1]
|
|
303
|
+
target = %w(
|
|
304
|
+
00 00 10 F0 12 00 00 00 03 00 FB 00 10 03 01 00
|
|
305
|
+
69 00 FD 00 10 03 05 00 C4 00
|
|
306
|
+
).join(' ')
|
|
307
|
+
|
|
308
|
+
result = unpack_record(@worksheet.store_mso_client_anchor(3, *data))
|
|
309
|
+
|
|
310
|
+
assert_equal(target, result, caption)
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
# IV3
|
|
314
|
+
range = 'IV3'
|
|
315
|
+
data = @worksheet.substitute_cellref(range)
|
|
316
|
+
data = @worksheet.comment_params(data[0], data[1], 'Test')
|
|
317
|
+
data = data[-1]
|
|
318
|
+
target = %w(
|
|
319
|
+
00 00 10 F0 12 00 00 00 03 00 FC 00 10 03 01 00
|
|
320
|
+
69 00 FE 00 10 03 05 00 C4 00
|
|
321
|
+
).join(' ')
|
|
322
|
+
|
|
323
|
+
result = unpack_record(@worksheet.store_mso_client_anchor(3, *data))
|
|
324
|
+
|
|
325
|
+
assert_equal(target, result, caption)
|
|
326
|
+
|
|
327
|
+
end
|
|
328
|
+
|
|
329
|
+
def test_for_store_mso_client_anchor_where_comment_offsets_have_changed
|
|
330
|
+
range = 'A3'
|
|
331
|
+
caption = sprintf(" \t_store_mso_client_anchor(%s). Cell offsets changes.", range)
|
|
332
|
+
data = @worksheet.substitute_cellref(range)
|
|
333
|
+
data = @worksheet.comment_params(data[0], data[1], 'Test',
|
|
334
|
+
:x_offset=>18, :y_offset=>9)
|
|
335
|
+
data = data[-1]
|
|
336
|
+
target = %w(
|
|
337
|
+
00 00 10 F0 12 00
|
|
338
|
+
00 00 03 00 01 00 20 01 01 00 88 00 03 00 20 01
|
|
339
|
+
05 00 E2 00
|
|
340
|
+
).join(' ')
|
|
341
|
+
|
|
342
|
+
result = unpack_record(@worksheet.store_mso_client_anchor(3, *data))
|
|
343
|
+
|
|
344
|
+
assert_equal(target, result, caption)
|
|
345
|
+
end
|
|
346
|
+
|
|
347
|
+
def test_for_store_mso_client_anchor_where_comment_dimensions_have_changed
|
|
348
|
+
# x_scale, y_scale
|
|
349
|
+
range = 'A3'
|
|
350
|
+
caption = sprintf(" \t_store_mso_client_anchor(%s). Dimensions changes.", range)
|
|
351
|
+
data = @worksheet.substitute_cellref(range)
|
|
352
|
+
data = @worksheet.comment_params(data[0], data[1], 'Test',
|
|
353
|
+
:x_scale=>3, :y_scale=>2)
|
|
354
|
+
data = data[-1]
|
|
355
|
+
target = %w(
|
|
356
|
+
00 00 10 F0 12 00 00 00 03 00
|
|
357
|
+
01 00 F0 00 01 00 69 00 07 00 F0 00 0A 00 1E 00
|
|
358
|
+
).join(' ')
|
|
359
|
+
|
|
360
|
+
result = unpack_record(@worksheet.store_mso_client_anchor(3, *data))
|
|
361
|
+
|
|
362
|
+
assert_equal(target, result, caption)
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
# width, height
|
|
366
|
+
data = @worksheet.substitute_cellref(range)
|
|
367
|
+
data = @worksheet.comment_params(data[0], data[1], 'Test',
|
|
368
|
+
:width=>384, :height=>148)
|
|
369
|
+
data = data[-1]
|
|
370
|
+
target = %w(
|
|
371
|
+
00 00 10 F0 12 00 00 00 03 00
|
|
372
|
+
01 00 F0 00 01 00 69 00 07 00 F0 00 0A 00 1E 00
|
|
373
|
+
).join(' ')
|
|
374
|
+
|
|
375
|
+
result = unpack_record(@worksheet.store_mso_client_anchor(3, *data))
|
|
376
|
+
|
|
377
|
+
assert_equal(target, result, caption)
|
|
378
|
+
|
|
379
|
+
end
|
|
380
|
+
|
|
381
|
+
def test_for_store_mso_client_anchor_where_column_widths_have_changed
|
|
382
|
+
# set_column G:G
|
|
383
|
+
range = 'F3'
|
|
384
|
+
@worksheet.set_column('G:G', 20)
|
|
385
|
+
|
|
386
|
+
caption = sprintf(" \t_store_mso_client_anchor(%s). Col width changes.", range)
|
|
387
|
+
data = @worksheet.substitute_cellref(range)
|
|
388
|
+
data = @worksheet.comment_params(data[0], data[1], 'Test')
|
|
389
|
+
data = data[-1]
|
|
390
|
+
|
|
391
|
+
target = %w(
|
|
392
|
+
00 00 10 F0 12 00
|
|
393
|
+
00 00 03 00 06 00 6A 00 01 00 69 00 06 00 F2 03
|
|
394
|
+
05 00 C4 00
|
|
395
|
+
).join(' ')
|
|
396
|
+
|
|
397
|
+
result = unpack_record(@worksheet.store_mso_client_anchor(3, *data))
|
|
398
|
+
|
|
399
|
+
assert_equal(target, result, caption)
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
# set_column L:O
|
|
403
|
+
range = 'K3'
|
|
404
|
+
@worksheet.set_column('L:O', 4)
|
|
405
|
+
|
|
406
|
+
data = @worksheet.substitute_cellref(range)
|
|
407
|
+
data = @worksheet.comment_params(data[0], data[1], 'Test')
|
|
408
|
+
data = data[-1]
|
|
409
|
+
|
|
410
|
+
target = %w(
|
|
411
|
+
00 00 10 F0 12 00
|
|
412
|
+
00 00 03 00 0B 00 D1 01 01 00 69 00 0F 00 B0 00
|
|
413
|
+
05 00 C4 00
|
|
414
|
+
).join(' ')
|
|
415
|
+
|
|
416
|
+
result = unpack_record(@worksheet.store_mso_client_anchor(3, *data))
|
|
417
|
+
|
|
418
|
+
assert_equal(target, result, caption)
|
|
419
|
+
|
|
420
|
+
end
|
|
421
|
+
|
|
422
|
+
def test_for_store_mso_client_anchor_where_row_height_have_changed
|
|
423
|
+
# set_row 5 to 8
|
|
424
|
+
range = 'A6'
|
|
425
|
+
@worksheet.set_row(5, 6)
|
|
426
|
+
@worksheet.set_row(6, 6)
|
|
427
|
+
@worksheet.set_row(7, 6)
|
|
428
|
+
@worksheet.set_row(8, 6)
|
|
429
|
+
|
|
430
|
+
caption = sprintf(" \t_store_mso_client_anchor(%s). Row height changed.", range)
|
|
431
|
+
data = @worksheet.substitute_cellref(range)
|
|
432
|
+
data = @worksheet.comment_params(data[0], data[1], 'Test')
|
|
433
|
+
data = data[-1]
|
|
434
|
+
|
|
435
|
+
target = %w(
|
|
436
|
+
00 00 10 F0 12 00
|
|
437
|
+
00 00 03 00 01 00 F0 00 04 00 69 00 03 00 F0 00
|
|
438
|
+
0A 00 E2 00
|
|
439
|
+
).join(' ')
|
|
440
|
+
|
|
441
|
+
result = unpack_record(@worksheet.store_mso_client_anchor(3, *data))
|
|
442
|
+
|
|
443
|
+
assert_equal(target, result, caption)
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
# set_row 14
|
|
447
|
+
range = 'A15'
|
|
448
|
+
@worksheet.set_row(14, 60)
|
|
449
|
+
|
|
450
|
+
caption = sprintf(" \t_store_mso_client_anchor(%s). Row height changed.", range)
|
|
451
|
+
data = @worksheet.substitute_cellref(range)
|
|
452
|
+
data = @worksheet.comment_params(data[0], data[1], 'Test')
|
|
453
|
+
data = data[-1]
|
|
454
|
+
|
|
455
|
+
target = %w(
|
|
456
|
+
00 00 10 F0 12 00
|
|
457
|
+
00 00 03 00 01 00 F0 00 0D 00 69 00 03 00 F0 00
|
|
458
|
+
0E 00 CD 00
|
|
459
|
+
).join(' ')
|
|
460
|
+
|
|
461
|
+
result = unpack_record(@worksheet.store_mso_client_anchor(3, *data))
|
|
462
|
+
|
|
463
|
+
assert_equal(target, result, caption)
|
|
464
|
+
|
|
465
|
+
end
|
|
466
|
+
|
|
467
|
+
def test_for_store_mso_client_data
|
|
468
|
+
caption = sprintf(" \t_store_mso_client_data")
|
|
469
|
+
target = %w(
|
|
470
|
+
00 00 11 F0 00 00 00 00
|
|
471
|
+
).join(' ')
|
|
472
|
+
|
|
473
|
+
result = unpack_record(@worksheet.store_mso_client_data)
|
|
474
|
+
|
|
475
|
+
assert_equal(target, result, caption)
|
|
476
|
+
end
|
|
477
|
+
|
|
478
|
+
def test_for_store_obj_comment
|
|
479
|
+
caption = sprintf(" \t_store_obj_comment")
|
|
480
|
+
data = [0x01]
|
|
481
|
+
target = %w(
|
|
482
|
+
5D 00 34 00 15 00 12 00 19 00 01 00 11 40 00 00
|
|
483
|
+
00 00 00 00 00 00 00 00 00 00 0D 00 16 00 00 00
|
|
484
|
+
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
|
485
|
+
00 00 00 00 00 00 00 00
|
|
486
|
+
).join(' ')
|
|
487
|
+
|
|
488
|
+
result = unpack_record(@worksheet.store_obj_comment(*data))
|
|
489
|
+
|
|
490
|
+
assert_equal(target, result, caption)
|
|
491
|
+
end
|
|
492
|
+
|
|
493
|
+
def test_for_store_mso_client_text_box
|
|
494
|
+
caption = sprintf(" \t_store_mso_client_text_box")
|
|
495
|
+
target = %w(
|
|
496
|
+
00 00 0D F0 00 00 00 00
|
|
497
|
+
).join(' ')
|
|
498
|
+
|
|
499
|
+
result = unpack_record(@worksheet.store_mso_client_text_box)
|
|
500
|
+
|
|
501
|
+
assert_equal(target, result, caption)
|
|
502
|
+
end
|
|
503
|
+
=end
|
|
504
|
+
|
|
505
|
+
###############################################################################
|
|
506
|
+
#
|
|
507
|
+
# Unpack the binary data into a format suitable for printing in tests.
|
|
508
|
+
#
|
|
509
|
+
def unpack_record(data)
|
|
510
|
+
data.unpack('C*').map! {|c| sprintf("%02X", c) }.join(' ')
|
|
511
|
+
end
|
|
512
|
+
|
|
513
|
+
def data_for_test
|
|
514
|
+
return [
|
|
515
|
+
[ 'DggContainer', # Caption
|
|
516
|
+
0xF000, # Type
|
|
517
|
+
15, # Version
|
|
518
|
+
0, # Instance
|
|
519
|
+
'', # Data
|
|
520
|
+
82, # Length
|
|
521
|
+
'0F 00 00 F0 52 00 00 00', # Target
|
|
522
|
+
],
|
|
523
|
+
|
|
524
|
+
[ 'DgContainer', # Caption
|
|
525
|
+
0xF002, # Type
|
|
526
|
+
15, # Version
|
|
527
|
+
0, # Instance
|
|
528
|
+
'', # Data
|
|
529
|
+
328, # Length
|
|
530
|
+
'0F 00 02 F0 48 01 00 00', # Target
|
|
531
|
+
],
|
|
532
|
+
|
|
533
|
+
[ 'SpgrContainer', # Caption
|
|
534
|
+
0xF003, # Type
|
|
535
|
+
15, # Version
|
|
536
|
+
0, # Instance
|
|
537
|
+
'', # Data
|
|
538
|
+
304, # Length
|
|
539
|
+
'0F 00 03 F0 30 01 00 00', # Target
|
|
540
|
+
],
|
|
541
|
+
|
|
542
|
+
[ 'SpContainer', # Caption
|
|
543
|
+
0xF004, # Type
|
|
544
|
+
15, # Version
|
|
545
|
+
0, # Instance
|
|
546
|
+
'', # Data
|
|
547
|
+
40, # Length
|
|
548
|
+
'0F 00 04 F0 28 00 00 00', # Target
|
|
549
|
+
],
|
|
550
|
+
|
|
551
|
+
[ 'Dgg', # Caption
|
|
552
|
+
0xF006, # Type
|
|
553
|
+
0, # Version
|
|
554
|
+
0, # Instance
|
|
555
|
+
'02 04 00 00 02 00 00 00 ' + # Data
|
|
556
|
+
'02 00 00 00 01 00 00 00 ' +
|
|
557
|
+
'01 00 00 00 02 00 00 00',
|
|
558
|
+
nil, # Length
|
|
559
|
+
'00 00 06 F0 18 00 00 00 ' + # Target
|
|
560
|
+
'02 04 00 00 02 00 00 00 ' +
|
|
561
|
+
'02 00 00 00 01 00 00 00 ' +
|
|
562
|
+
'01 00 00 00 02 00 00 00',
|
|
563
|
+
],
|
|
564
|
+
|
|
565
|
+
[ 'Dg', # Caption
|
|
566
|
+
0xF008, # Type
|
|
567
|
+
0, # Version
|
|
568
|
+
1, # Instance
|
|
569
|
+
'03 00 00 00 02 04 00 00', # Data
|
|
570
|
+
nil, # Length
|
|
571
|
+
'10 00 08 F0 08 00 00 00 ' + # Target
|
|
572
|
+
'03 00 00 00 02 04 00 00',
|
|
573
|
+
],
|
|
574
|
+
|
|
575
|
+
[ 'Spgr', # Caption
|
|
576
|
+
0xF009, # Type
|
|
577
|
+
1, # Version
|
|
578
|
+
0, # Instance
|
|
579
|
+
'00 0E 00 0E 40 41 00 00 ' + # Data
|
|
580
|
+
'00 0E 00 0E 40 41 00 00',
|
|
581
|
+
nil, # Length
|
|
582
|
+
'01 00 09 F0 10 00 00 00 ' + # Target
|
|
583
|
+
'00 0E 00 0E 40 41 00 00 ' +
|
|
584
|
+
'00 0E 00 0E 40 41 00 00',
|
|
585
|
+
],
|
|
586
|
+
|
|
587
|
+
[ 'ClientTextbox', # Caption
|
|
588
|
+
0xF00D, # Type
|
|
589
|
+
0, # Version
|
|
590
|
+
0, # Instance
|
|
591
|
+
'', # Data
|
|
592
|
+
nil, # Length
|
|
593
|
+
'00 00 0D F0 00 00 00 00', # Target
|
|
594
|
+
],
|
|
595
|
+
|
|
596
|
+
[ 'ClientAnchor', # Caption
|
|
597
|
+
0xF010, # Type
|
|
598
|
+
0, # Version
|
|
599
|
+
0, # Instance
|
|
600
|
+
'03 00 01 00 F0 00 01 00 ' + # Data
|
|
601
|
+
'69 00 03 00 F0 00 05 00 ' +
|
|
602
|
+
'C4 00',
|
|
603
|
+
nil, # Length
|
|
604
|
+
'00 00 10 F0 12 00 00 00 ' + # Target
|
|
605
|
+
'03 00 01 00 F0 00 01 00 ' +
|
|
606
|
+
'69 00 03 00 F0 00 05 00 ' +
|
|
607
|
+
'C4 00',
|
|
608
|
+
],
|
|
609
|
+
|
|
610
|
+
[ 'ClientData', # Caption
|
|
611
|
+
0xF011, # Type
|
|
612
|
+
0, # Version
|
|
613
|
+
0, # Instance
|
|
614
|
+
'', # Data
|
|
615
|
+
nil, # Length
|
|
616
|
+
'00 00 11 F0 00 00 00 00', # Target
|
|
617
|
+
],
|
|
618
|
+
|
|
619
|
+
[ 'SplitMenuColors', # Caption
|
|
620
|
+
0xF11E, # Type
|
|
621
|
+
0, # Version
|
|
622
|
+
4, # Instance
|
|
623
|
+
'0D 00 00 08 0C 00 00 08 ' + # Data
|
|
624
|
+
'17 00 00 08 F7 00 00 10',
|
|
625
|
+
nil, # Length
|
|
626
|
+
'40 00 1E F1 10 00 00 00 ' + # Target
|
|
627
|
+
'0D 00 00 08 0C 00 00 08 ' +
|
|
628
|
+
'17 00 00 08 F7 00 00 10',
|
|
629
|
+
],
|
|
630
|
+
|
|
631
|
+
[ 'BstoreContainer', # Caption
|
|
632
|
+
0xF001, # Type
|
|
633
|
+
15, # Version
|
|
634
|
+
1, # Instance
|
|
635
|
+
'', # Data
|
|
636
|
+
163, # Length
|
|
637
|
+
'1F 00 01 F0 A3 00 00 00', # Target
|
|
638
|
+
],
|
|
639
|
+
]
|
|
640
|
+
end
|
|
641
|
+
|
|
642
|
+
end
|