writeexcel 0.1.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -1,739 +1,750 @@
|
|
1
|
-
##########################################################################
|
2
|
-
# test_22_mso_drawing_group.rb
|
3
|
-
#
|
4
|
-
# Tests for the internal methods used to write the MSODRAWINGGROUP record.
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
def
|
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
|
-
@workbook.
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
@workbook.
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
@workbook.
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
@workbook.
|
165
|
-
|
166
|
-
|
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
|
-
|
199
|
-
@workbook.
|
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
|
-
@workbook.
|
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
|
-
|
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
|
-
|
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
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
end
|
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
|
-
end
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
end
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
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
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
end
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
end
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
1
|
+
##########################################################################
|
2
|
+
# test_22_mso_drawing_group.rb
|
3
|
+
#
|
4
|
+
# Tests for the internal methods used to write the MSODRAWINGGROUP record.
|
5
|
+
#
|
6
|
+
# all test is commented out because related method was set to
|
7
|
+
# private method. Before that, all test passed.
|
8
|
+
#
|
9
|
+
#
|
10
|
+
#
|
11
|
+
#
|
12
|
+
# reverse('©'), September 2005, John McNamara, jmcnamara@cpan.org
|
13
|
+
#
|
14
|
+
# original written in Perl by John McNamara
|
15
|
+
# converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
|
16
|
+
#
|
17
|
+
#########################################################################
|
18
|
+
$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"
|
19
|
+
|
20
|
+
require "test/unit"
|
21
|
+
require 'writeexcel'
|
22
|
+
|
23
|
+
class TC_mso_drawing_group < Test::Unit::TestCase
|
24
|
+
|
25
|
+
def test_dummy
|
26
|
+
assert(true)
|
27
|
+
end
|
28
|
+
|
29
|
+
def setup
|
30
|
+
t = Time.now.strftime("%Y%m%d")
|
31
|
+
path = "temp#{t}-#{$$}-#{rand(0x100000000).to_s(36)}"
|
32
|
+
@test_file = File.join(Dir.tmpdir, path)
|
33
|
+
@workbook = WriteExcel.new(@test_file)
|
34
|
+
@worksheet1 = @workbook.add_worksheet
|
35
|
+
@worksheet2 = @workbook.add_worksheet
|
36
|
+
@worksheet3 = @workbook.add_worksheet
|
37
|
+
end
|
38
|
+
|
39
|
+
def teardown
|
40
|
+
@workbook.close
|
41
|
+
File.unlink(@test_file) if FileTest.exist?(@test_file)
|
42
|
+
end
|
43
|
+
|
44
|
+
=begin
|
45
|
+
def test_1_time
|
46
|
+
count = 1
|
47
|
+
for i in 1 .. count
|
48
|
+
@worksheet1.write_comment(i -1, 0, 'aaa')
|
49
|
+
end
|
50
|
+
@workbook.calc_mso_sizes
|
51
|
+
|
52
|
+
caption = sprintf(" \tSheet1: %4d comments.", count)
|
53
|
+
target = %w(
|
54
|
+
EB 00 5A 00 0F 00 00 F0 52 00 00 00 00 00 06 F0
|
55
|
+
18 00 00 00 02 04 00 00 02 00 00 00 02 00 00 00
|
56
|
+
01 00 00 00 01 00 00 00 02 00 00 00 33 00 0B F0
|
57
|
+
12 00 00 00 BF 00 08 00 08 00 81 01 09 00 00 08
|
58
|
+
C0 01 40 00 00 08 40 00 1E F1 10 00 00 00 0D 00
|
59
|
+
00 08 0C 00 00 08 17 00 00 08 F7 00 00 10
|
60
|
+
).join(' ')
|
61
|
+
result = unpack_record(@workbook.add_mso_drawing_group)
|
62
|
+
assert_equal(target, result, caption)
|
63
|
+
|
64
|
+
|
65
|
+
# Test the parameters pass to the worksheets
|
66
|
+
caption = caption + ' (params)'
|
67
|
+
result_ids = []
|
68
|
+
target_ids = [
|
69
|
+
1024, 1, 2, 1025,
|
70
|
+
]
|
71
|
+
|
72
|
+
@workbook.sheets.each do |sheet|
|
73
|
+
sheet.object_ids.each {|id| result_ids.push(id) }
|
74
|
+
end
|
75
|
+
|
76
|
+
assert_equal(target_ids, result_ids, caption)
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_2_times
|
81
|
+
count = 2
|
82
|
+
for i in 1 .. count
|
83
|
+
@worksheet1.write_comment(i -1, 0, 'aaa')
|
84
|
+
end
|
85
|
+
@workbook.calc_mso_sizes
|
86
|
+
|
87
|
+
target = %w(
|
88
|
+
EB 00 5A 00 0F 00 00 F0 52 00 00 00 00 00 06 F0
|
89
|
+
18 00 00 00 03 04 00 00 02 00 00 00 03 00 00 00
|
90
|
+
01 00 00 00 01 00 00 00 03 00 00 00 33 00 0B F0
|
91
|
+
12 00 00 00 BF 00 08 00 08 00 81 01 09 00 00 08
|
92
|
+
C0 01 40 00 00 08 40 00 1E F1 10 00 00 00 0D 00
|
93
|
+
00 08 0C 00 00 08 17 00 00 08 F7 00 00 10
|
94
|
+
).join(' ')
|
95
|
+
caption = sprintf( " \tSheet1: %4d comments.", count)
|
96
|
+
result = unpack_record(@workbook.add_mso_drawing_group)
|
97
|
+
assert_equal(target, result, caption)
|
98
|
+
|
99
|
+
|
100
|
+
# Test the parameters pass to the worksheets
|
101
|
+
caption = caption + ' (params)'
|
102
|
+
result_ids = []
|
103
|
+
target_ids = [
|
104
|
+
1024, 1, 3, 1026,
|
105
|
+
]
|
106
|
+
|
107
|
+
@workbook.sheets.each do |sheet|
|
108
|
+
sheet.object_ids.each {|id| result_ids.push(id) }
|
109
|
+
end
|
110
|
+
assert_equal(target_ids, result_ids, caption)
|
111
|
+
|
112
|
+
end
|
113
|
+
|
114
|
+
def test_3_times
|
115
|
+
count = 3
|
116
|
+
for i in 1 .. count
|
117
|
+
@worksheet1.write_comment(i -1, 0, 'aaa')
|
118
|
+
end
|
119
|
+
@workbook.calc_mso_sizes
|
120
|
+
|
121
|
+
target = %w(
|
122
|
+
EB 00 5A 00 0F 00 00 F0 52 00 00 00 00 00 06 F0
|
123
|
+
18 00 00 00 04 04 00 00 02 00 00 00 04 00 00 00
|
124
|
+
01 00 00 00 01 00 00 00 04 00 00 00 33 00 0B F0
|
125
|
+
12 00 00 00 BF 00 08 00 08 00 81 01 09 00 00 08
|
126
|
+
C0 01 40 00 00 08 40 00 1E F1 10 00 00 00 0D 00
|
127
|
+
00 08 0C 00 00 08 17 00 00 08 F7 00 00 10
|
128
|
+
).join(' ')
|
129
|
+
caption = sprintf( " \tSheet1: %4d comments.", count)
|
130
|
+
result = unpack_record(@workbook.add_mso_drawing_group)
|
131
|
+
assert_equal(target, result, caption)
|
132
|
+
|
133
|
+
|
134
|
+
# Test the parameters pass to the worksheets
|
135
|
+
caption = caption + ' (params)'
|
136
|
+
result_ids = []
|
137
|
+
target_ids = [
|
138
|
+
1024, 1, 4, 1027
|
139
|
+
]
|
140
|
+
|
141
|
+
@workbook.sheets.each do |sheet|
|
142
|
+
sheet.object_ids.each {|id| result_ids.push(id) }
|
143
|
+
end
|
144
|
+
assert_equal(target_ids, result_ids, caption)
|
145
|
+
|
146
|
+
end
|
147
|
+
|
148
|
+
def test_1023_times
|
149
|
+
count = 1023
|
150
|
+
for i in 1 .. count
|
151
|
+
@worksheet1.write_comment(i -1, 0, 'aaa')
|
152
|
+
end
|
153
|
+
@workbook.calc_mso_sizes
|
154
|
+
|
155
|
+
target = %w(
|
156
|
+
EB 00 5A 00 0F 00 00 F0 52 00 00 00 00 00 06 F0
|
157
|
+
18 00 00 00 00 08 00 00 02 00 00 00 00 04 00 00
|
158
|
+
01 00 00 00 01 00 00 00 00 04 00 00 33 00 0B F0
|
159
|
+
12 00 00 00 BF 00 08 00 08 00 81 01 09 00 00 08
|
160
|
+
C0 01 40 00 00 08 40 00 1E F1 10 00 00 00 0D 00
|
161
|
+
00 08 0C 00 00 08 17 00 00 08 F7 00 00 10
|
162
|
+
).join(' ')
|
163
|
+
caption = sprintf( " \tSheet1: %4d comments.", count)
|
164
|
+
result = unpack_record(@workbook.add_mso_drawing_group)
|
165
|
+
assert_equal(target, result, caption)
|
166
|
+
|
167
|
+
|
168
|
+
# Test the parameters pass to the worksheets
|
169
|
+
caption = caption + ' (params)'
|
170
|
+
result_ids = []
|
171
|
+
target_ids = [
|
172
|
+
1024, 1, 1024, 2047
|
173
|
+
]
|
174
|
+
|
175
|
+
@workbook.sheets.each do |sheet|
|
176
|
+
sheet.object_ids.each {|id| result_ids.push(id) }
|
177
|
+
end
|
178
|
+
assert_equal(target_ids, result_ids, caption)
|
179
|
+
|
180
|
+
end
|
181
|
+
|
182
|
+
def test_1024_times
|
183
|
+
count = 1024
|
184
|
+
for i in 1 .. count
|
185
|
+
@worksheet1.write_comment(i -1, 0, 'aaa')
|
186
|
+
end
|
187
|
+
@workbook.calc_mso_sizes
|
188
|
+
|
189
|
+
target = %w(
|
190
|
+
EB 00 62 00 0F 00 00 F0 5A 00 00 00 00 00 06 F0
|
191
|
+
20 00 00 00 01 08 00 00 03 00 00 00 01 04 00 00
|
192
|
+
01 00 00 00 01 00 00 00 00 04 00 00 01 00 00 00
|
193
|
+
01 00 00 00 33 00 0B F0 12 00 00 00 BF 00 08 00
|
194
|
+
08 00 81 01 09 00 00 08 C0 01 40 00 00 08 40 00
|
195
|
+
1E F1 10 00 00 00 0D 00 00 08 0C 00 00 08 17 00
|
196
|
+
00 08 F7 00 00 10
|
197
|
+
).join(' ')
|
198
|
+
caption = sprintf( " \tSheet1: %4d comments.", count)
|
199
|
+
result = unpack_record(@workbook.add_mso_drawing_group)
|
200
|
+
assert_equal(target, result, caption)
|
201
|
+
|
202
|
+
|
203
|
+
# Test the parameters pass to the worksheets
|
204
|
+
caption = caption + ' (params)'
|
205
|
+
result_ids = []
|
206
|
+
target_ids = [
|
207
|
+
1024, 1, 1025, 2048
|
208
|
+
]
|
209
|
+
|
210
|
+
@workbook.sheets.each do |sheet|
|
211
|
+
sheet.object_ids.each {|id| result_ids.push(id) }
|
212
|
+
end
|
213
|
+
assert_equal(target_ids, result_ids, caption)
|
214
|
+
|
215
|
+
end
|
216
|
+
|
217
|
+
def test_2048_times
|
218
|
+
count = 2048
|
219
|
+
for i in 1 .. count
|
220
|
+
@worksheet1.write_comment(i -1, 0, 'aaa')
|
221
|
+
end
|
222
|
+
@workbook.calc_mso_sizes
|
223
|
+
|
224
|
+
target = %w(
|
225
|
+
EB 00 6A 00 0F 00 00 F0 62 00 00 00 00 00 06 F0
|
226
|
+
28 00 00 00 01 0C 00 00 04 00 00 00 01 08 00 00
|
227
|
+
01 00 00 00 01 00 00 00 00 04 00 00 01 00 00 00
|
228
|
+
00 04 00 00 01 00 00 00 01 00 00 00 33 00 0B F0
|
229
|
+
12 00 00 00 BF 00 08 00 08 00 81 01 09 00 00 08
|
230
|
+
C0 01 40 00 00 08 40 00 1E F1 10 00 00 00 0D 00
|
231
|
+
00 08 0C 00 00 08 17 00 00 08 F7 00 00 10
|
232
|
+
).join(' ')
|
233
|
+
caption = sprintf( " \tSheet1: %4d comments.", count)
|
234
|
+
result = unpack_record(@workbook.add_mso_drawing_group)
|
235
|
+
assert_equal(target, result, caption)
|
236
|
+
|
237
|
+
|
238
|
+
# Test the parameters pass to the worksheets
|
239
|
+
caption = caption + ' (params)'
|
240
|
+
result_ids = []
|
241
|
+
target_ids = [
|
242
|
+
1024, 1, 2049, 3072
|
243
|
+
]
|
244
|
+
|
245
|
+
@workbook.sheets.each do |sheet|
|
246
|
+
sheet.object_ids.each {|id| result_ids.push(id) }
|
247
|
+
end
|
248
|
+
assert_equal(target_ids, result_ids, caption)
|
249
|
+
|
250
|
+
end
|
251
|
+
|
252
|
+
def test_2_sheets_1_and_1_times
|
253
|
+
count1 = 1
|
254
|
+
count2 = 1
|
255
|
+
for i in 1 .. count1
|
256
|
+
@worksheet1.write_comment(i -1, 0, 'aaa')
|
257
|
+
end
|
258
|
+
for i in 1 .. count2
|
259
|
+
@worksheet2.write_comment(i -1, 0, 'aaa')
|
260
|
+
end
|
261
|
+
@workbook.calc_mso_sizes
|
262
|
+
|
263
|
+
target = %w(
|
264
|
+
EB 00 62 00 0F 00 00 F0 5A 00 00 00 00 00 06 F0
|
265
|
+
20 00 00 00 02 08 00 00 03 00 00 00 04 00 00 00
|
266
|
+
02 00 00 00 01 00 00 00 02 00 00 00 02 00 00 00
|
267
|
+
02 00 00 00 33 00 0B F0 12 00 00 00 BF 00 08 00
|
268
|
+
08 00 81 01 09 00 00 08 C0 01 40 00 00 08 40 00
|
269
|
+
1E F1 10 00 00 00 0D 00 00 08 0C 00 00 08 17 00
|
270
|
+
00 08 F7 00 00 10
|
271
|
+
).join(' ')
|
272
|
+
caption = sprintf( " \tSheet1: %4d comments, Sheet2: %4d comments..",
|
273
|
+
count1, count2)
|
274
|
+
result = unpack_record(@workbook.add_mso_drawing_group)
|
275
|
+
assert_equal(target, result, caption)
|
276
|
+
|
277
|
+
|
278
|
+
# Test the parameters pass to the worksheets
|
279
|
+
caption = caption + ' (params)'
|
280
|
+
result_ids = []
|
281
|
+
target_ids = [
|
282
|
+
1024, 1, 2, 1025,
|
283
|
+
2048, 2, 2, 2049
|
284
|
+
]
|
285
|
+
|
286
|
+
@workbook.sheets.each do |sheet|
|
287
|
+
sheet.object_ids.each {|id| result_ids.push(id) }
|
288
|
+
end
|
289
|
+
assert_equal(target_ids, result_ids, caption)
|
290
|
+
|
291
|
+
end
|
292
|
+
|
293
|
+
def test_2_sheets_2_and_2_times
|
294
|
+
count1 = 2
|
295
|
+
count2 = 2
|
296
|
+
for i in 1 .. count1
|
297
|
+
@worksheet1.write_comment(i -1, 0, 'aaa')
|
298
|
+
end
|
299
|
+
for i in 1 .. count2
|
300
|
+
@worksheet2.write_comment(i -1, 0, 'aaa')
|
301
|
+
end
|
302
|
+
@workbook.calc_mso_sizes
|
303
|
+
|
304
|
+
target = %w(
|
305
|
+
EB 00 62 00 0F 00 00 F0 5A 00 00 00 00 00 06 F0
|
306
|
+
20 00 00 00 03 08 00 00 03 00 00 00 06 00 00 00
|
307
|
+
02 00 00 00 01 00 00 00 03 00 00 00 02 00 00 00
|
308
|
+
03 00 00 00 33 00 0B F0 12 00 00 00 BF 00 08 00
|
309
|
+
08 00 81 01 09 00 00 08 C0 01 40 00 00 08 40 00
|
310
|
+
1E F1 10 00 00 00 0D 00 00 08 0C 00 00 08 17 00
|
311
|
+
00 08 F7 00 00 10
|
312
|
+
).join(' ')
|
313
|
+
caption = sprintf( " \tSheet1: %4d comments, Sheet2: %4d comments..",
|
314
|
+
count1, count2)
|
315
|
+
result = unpack_record(@workbook.add_mso_drawing_group)
|
316
|
+
assert_equal(target, result, caption)
|
317
|
+
|
318
|
+
|
319
|
+
# Test the parameters pass to the worksheets
|
320
|
+
caption = caption + ' (params)'
|
321
|
+
result_ids = []
|
322
|
+
target_ids = [
|
323
|
+
1024, 1, 3, 1026,
|
324
|
+
2048, 2, 3, 2050
|
325
|
+
]
|
326
|
+
|
327
|
+
@workbook.sheets.each do |sheet|
|
328
|
+
sheet.object_ids.each {|id| result_ids.push(id) }
|
329
|
+
end
|
330
|
+
assert_equal(target_ids, result_ids, caption)
|
331
|
+
|
332
|
+
end
|
333
|
+
|
334
|
+
def test_2_sheets_1023_and_1_times
|
335
|
+
count1 = 1023
|
336
|
+
count2 = 1
|
337
|
+
for i in 1 .. count1
|
338
|
+
@worksheet1.write_comment(i -1, 0, 'aaa')
|
339
|
+
end
|
340
|
+
for i in 1 .. count2
|
341
|
+
@worksheet2.write_comment(i -1, 0, 'aaa')
|
342
|
+
end
|
343
|
+
@workbook.calc_mso_sizes
|
344
|
+
|
345
|
+
target = %w(
|
346
|
+
EB 00 62 00 0F 00 00 F0 5A 00 00 00 00 00 06 F0
|
347
|
+
20 00 00 00 02 08 00 00 03 00 00 00 02 04 00 00
|
348
|
+
02 00 00 00 01 00 00 00 00 04 00 00 02 00 00 00
|
349
|
+
02 00 00 00 33 00 0B F0 12 00 00 00 BF 00 08 00
|
350
|
+
08 00 81 01 09 00 00 08 C0 01 40 00 00 08 40 00
|
351
|
+
1E F1 10 00 00 00 0D 00 00 08 0C 00 00 08 17 00
|
352
|
+
00 08 F7 00 00 10
|
353
|
+
).join(' ')
|
354
|
+
caption = sprintf( " \tSheet1: %4d comments, Sheet2: %4d comments..",
|
355
|
+
count1, count2)
|
356
|
+
result = unpack_record(@workbook.add_mso_drawing_group)
|
357
|
+
assert_equal(target, result, caption)
|
358
|
+
|
359
|
+
|
360
|
+
# Test the parameters pass to the worksheets
|
361
|
+
caption = caption + ' (params)'
|
362
|
+
result_ids = []
|
363
|
+
target_ids = [
|
364
|
+
1024, 1, 1024, 2047,
|
365
|
+
2048, 2, 2, 2049
|
366
|
+
]
|
367
|
+
|
368
|
+
@workbook.sheets.each do |sheet|
|
369
|
+
sheet.object_ids.each {|id| result_ids.push(id) }
|
370
|
+
end
|
371
|
+
assert_equal(target_ids, result_ids, caption)
|
372
|
+
|
373
|
+
end
|
374
|
+
|
375
|
+
def test_2_sheets_1023_and_1023_times
|
376
|
+
count1 = 1023
|
377
|
+
count2 = 1023
|
378
|
+
for i in 1 .. count1
|
379
|
+
@worksheet1.write_comment(i -1, 0, 'aaa')
|
380
|
+
end
|
381
|
+
for i in 1 .. count2
|
382
|
+
@worksheet2.write_comment(i -1, 0, 'aaa')
|
383
|
+
end
|
384
|
+
@workbook.calc_mso_sizes
|
385
|
+
|
386
|
+
target = %w(
|
387
|
+
EB 00 62 00 0F 00 00 F0 5A 00 00 00 00 00 06 F0
|
388
|
+
20 00 00 00 00 0C 00 00 03 00 00 00 00 08 00 00
|
389
|
+
02 00 00 00 01 00 00 00 00 04 00 00 02 00 00 00
|
390
|
+
00 04 00 00 33 00 0B F0 12 00 00 00 BF 00 08 00
|
391
|
+
08 00 81 01 09 00 00 08 C0 01 40 00 00 08 40 00
|
392
|
+
1E F1 10 00 00 00 0D 00 00 08 0C 00 00 08 17 00
|
393
|
+
00 08 F7 00 00 10
|
394
|
+
).join(' ')
|
395
|
+
caption = sprintf( " \tSheet1: %4d comments, Sheet2: %4d comments..",
|
396
|
+
count1, count2)
|
397
|
+
result = unpack_record(@workbook.add_mso_drawing_group)
|
398
|
+
assert_equal(target, result, caption)
|
399
|
+
|
400
|
+
|
401
|
+
# Test the parameters pass to the worksheets
|
402
|
+
caption = caption + ' (params)'
|
403
|
+
result_ids = []
|
404
|
+
target_ids = [
|
405
|
+
1024, 1, 1024, 2047,
|
406
|
+
2048, 2, 1024, 3071
|
407
|
+
]
|
408
|
+
|
409
|
+
@workbook.sheets.each do |sheet|
|
410
|
+
sheet.object_ids.each {|id| result_ids.push(id) }
|
411
|
+
end
|
412
|
+
assert_equal(target_ids, result_ids, caption)
|
413
|
+
|
414
|
+
end
|
415
|
+
|
416
|
+
def test_2_sheets_1024_and_1024_times
|
417
|
+
count1 = 1024
|
418
|
+
count2 = 1024
|
419
|
+
for i in 1 .. count1
|
420
|
+
@worksheet1.write_comment(i -1, 0, 'aaa')
|
421
|
+
end
|
422
|
+
for i in 1 .. count2
|
423
|
+
@worksheet2.write_comment(i -1, 0, 'aaa')
|
424
|
+
end
|
425
|
+
@workbook.calc_mso_sizes
|
426
|
+
|
427
|
+
target = %w(
|
428
|
+
EB 00 72 00 0F 00 00 F0 6A 00 00 00 00 00 06 F0
|
429
|
+
30 00 00 00 01 10 00 00 05 00 00 00 02 08 00 00
|
430
|
+
02 00 00 00 01 00 00 00 00 04 00 00 01 00 00 00
|
431
|
+
01 00 00 00 02 00 00 00 00 04 00 00 02 00 00 00
|
432
|
+
01 00 00 00 33 00 0B F0 12 00 00 00 BF 00 08 00
|
433
|
+
08 00 81 01 09 00 00 08 C0 01 40 00 00 08 40 00
|
434
|
+
1E F1 10 00 00 00 0D 00 00 08 0C 00 00 08 17 00
|
435
|
+
00 08 F7 00 00 10
|
436
|
+
).join(' ')
|
437
|
+
caption = sprintf( " \tSheet1: %4d comments, Sheet2: %4d comments..",
|
438
|
+
count1, count2)
|
439
|
+
result = unpack_record(@workbook.add_mso_drawing_group)
|
440
|
+
assert_equal(target, result, caption)
|
441
|
+
|
442
|
+
|
443
|
+
# Test the parameters pass to the worksheets
|
444
|
+
caption = caption + ' (params)'
|
445
|
+
result_ids = []
|
446
|
+
target_ids = [
|
447
|
+
1024, 1, 1025, 2048,
|
448
|
+
3072, 2, 1025, 4096
|
449
|
+
]
|
450
|
+
|
451
|
+
@workbook.sheets.each do |sheet|
|
452
|
+
sheet.object_ids.each {|id| result_ids.push(id) }
|
453
|
+
end
|
454
|
+
assert_equal(target_ids, result_ids, caption)
|
455
|
+
|
456
|
+
end
|
457
|
+
|
458
|
+
def test_2_sheets_1024_and_1_times
|
459
|
+
count1 = 1024
|
460
|
+
count2 = 1
|
461
|
+
for i in 1 .. count1
|
462
|
+
@worksheet1.write_comment(i -1, 0, 'aaa')
|
463
|
+
end
|
464
|
+
for i in 1 .. count2
|
465
|
+
@worksheet2.write_comment(i -1, 0, 'aaa')
|
466
|
+
end
|
467
|
+
@workbook.calc_mso_sizes
|
468
|
+
|
469
|
+
target = %w(
|
470
|
+
EB 00 6A 00 0F 00 00 F0 62 00 00 00 00 00 06 F0
|
471
|
+
28 00 00 00 02 0C 00 00 04 00 00 00 03 04 00 00
|
472
|
+
02 00 00 00 01 00 00 00 00 04 00 00 01 00 00 00
|
473
|
+
01 00 00 00 02 00 00 00 02 00 00 00 33 00 0B F0
|
474
|
+
12 00 00 00 BF 00 08 00 08 00 81 01 09 00 00 08
|
475
|
+
C0 01 40 00 00 08 40 00 1E F1 10 00 00 00 0D 00
|
476
|
+
00 08 0C 00 00 08 17 00 00 08 F7 00 00 10
|
477
|
+
).join(' ')
|
478
|
+
caption = sprintf( " \tSheet1: %4d comments, Sheet2: %4d comments..",
|
479
|
+
count1, count2)
|
480
|
+
result = unpack_record(@workbook.add_mso_drawing_group)
|
481
|
+
assert_equal(target, result, caption)
|
482
|
+
|
483
|
+
|
484
|
+
# Test the parameters pass to the worksheets
|
485
|
+
caption = caption + ' (params)'
|
486
|
+
result_ids = []
|
487
|
+
target_ids = [
|
488
|
+
1024, 1, 1025, 2048,
|
489
|
+
3072, 2, 2, 3073
|
490
|
+
]
|
491
|
+
|
492
|
+
@workbook.sheets.each do |sheet|
|
493
|
+
sheet.object_ids.each {|id| result_ids.push(id) }
|
494
|
+
end
|
495
|
+
assert_equal(target_ids, result_ids, caption)
|
496
|
+
|
497
|
+
end
|
498
|
+
|
499
|
+
def test_3_sheets_1023_and_1_and_1023_times
|
500
|
+
count1 = 1023
|
501
|
+
count2 = 1
|
502
|
+
count3 = 1023
|
503
|
+
for i in 1 .. count1
|
504
|
+
@worksheet1.write_comment(i -1, 0, 'aaa')
|
505
|
+
end
|
506
|
+
for i in 1 .. count2
|
507
|
+
@worksheet2.write_comment(i -1, 0, 'aaa')
|
508
|
+
end
|
509
|
+
for i in 1 .. count3
|
510
|
+
@worksheet3.write_comment(i -1, 0, 'aaa')
|
511
|
+
end
|
512
|
+
@workbook.calc_mso_sizes
|
513
|
+
|
514
|
+
target = %w(
|
515
|
+
EB 00 6A 00 0F 00 00 F0 62 00 00 00 00 00 06 F0
|
516
|
+
28 00 00 00 00 10 00 00 04 00 00 00 02 08 00 00
|
517
|
+
03 00 00 00 01 00 00 00 00 04 00 00 02 00 00 00
|
518
|
+
02 00 00 00 03 00 00 00 00 04 00 00 33 00 0B F0
|
519
|
+
12 00 00 00 BF 00 08 00 08 00 81 01 09 00 00 08
|
520
|
+
C0 01 40 00 00 08 40 00 1E F1 10 00 00 00 0D 00
|
521
|
+
00 08 0C 00 00 08 17 00 00 08 F7 00 00 10
|
522
|
+
).join(' ')
|
523
|
+
caption = sprintf( " \tSheet1: %4d comments, Sheet2: %4d comments,"+
|
524
|
+
"Sheet3: %4d comments.", count1, count2, count3)
|
525
|
+
result = unpack_record(@workbook.add_mso_drawing_group)
|
526
|
+
assert_equal(target, result, caption)
|
527
|
+
|
528
|
+
|
529
|
+
# Test the parameters pass to the worksheets
|
530
|
+
caption = caption + ' (params)'
|
531
|
+
result_ids = []
|
532
|
+
target_ids = [
|
533
|
+
1024, 1, 1024, 2047,
|
534
|
+
2048, 2, 2, 2049,
|
535
|
+
3072, 3, 1024, 4095
|
536
|
+
]
|
537
|
+
|
538
|
+
@workbook.sheets.each do |sheet|
|
539
|
+
sheet.object_ids.each {|id| result_ids.push(id) }
|
540
|
+
end
|
541
|
+
assert_equal(target_ids, result_ids, caption)
|
542
|
+
|
543
|
+
end
|
544
|
+
|
545
|
+
def test_3_sheets_1023_and_1023_and_1_times
|
546
|
+
count1 = 1023
|
547
|
+
count2 = 1023
|
548
|
+
count3 = 1
|
549
|
+
for i in 1 .. count1
|
550
|
+
@worksheet1.write_comment(i -1, 0, 'aaa')
|
551
|
+
end
|
552
|
+
for i in 1 .. count2
|
553
|
+
@worksheet2.write_comment(i -1, 0, 'aaa')
|
554
|
+
end
|
555
|
+
for i in 1 .. count3
|
556
|
+
@worksheet3.write_comment(i -1, 0, 'aaa')
|
557
|
+
end
|
558
|
+
@workbook.calc_mso_sizes
|
559
|
+
|
560
|
+
target = %w(
|
561
|
+
EB 00 6A 00 0F 00 00 F0 62 00 00 00 00 00 06 F0
|
562
|
+
28 00 00 00 02 0C 00 00 04 00 00 00 02 08 00 00
|
563
|
+
03 00 00 00 01 00 00 00 00 04 00 00 02 00 00 00
|
564
|
+
00 04 00 00 03 00 00 00 02 00 00 00 33 00 0B F0
|
565
|
+
12 00 00 00 BF 00 08 00 08 00 81 01 09 00 00 08
|
566
|
+
C0 01 40 00 00 08 40 00 1E F1 10 00 00 00 0D 00
|
567
|
+
00 08 0C 00 00 08 17 00 00 08 F7 00 00 10
|
568
|
+
).join(' ')
|
569
|
+
caption = sprintf( " \tSheet1: %4d comments, Sheet2: %4d comments,"+
|
570
|
+
"Sheet3: %4d comments.", count1, count2, count3)
|
571
|
+
result = unpack_record(@workbook.add_mso_drawing_group)
|
572
|
+
assert_equal(target, result, caption)
|
573
|
+
|
574
|
+
|
575
|
+
# Test the parameters pass to the worksheets
|
576
|
+
caption = caption + ' (params)'
|
577
|
+
result_ids = []
|
578
|
+
target_ids = [
|
579
|
+
1024, 1, 1024, 2047,
|
580
|
+
2048, 2, 1024, 3071,
|
581
|
+
3072, 3, 2, 3073
|
582
|
+
]
|
583
|
+
|
584
|
+
@workbook.sheets.each do |sheet|
|
585
|
+
sheet.object_ids.each {|id| result_ids.push(id) }
|
586
|
+
end
|
587
|
+
assert_equal(target_ids, result_ids, caption)
|
588
|
+
|
589
|
+
end
|
590
|
+
|
591
|
+
def test_3_sheets_1024_and_1_and_1024_times
|
592
|
+
count1 = 1024
|
593
|
+
count2 = 1
|
594
|
+
count3 = 1024
|
595
|
+
for i in 1 .. count1
|
596
|
+
@worksheet1.write_comment(i -1, 0, 'aaa')
|
597
|
+
end
|
598
|
+
for i in 1 .. count2
|
599
|
+
@worksheet2.write_comment(i -1, 0, 'aaa')
|
600
|
+
end
|
601
|
+
for i in 1 .. count3
|
602
|
+
@worksheet3.write_comment(i -1, 0, 'aaa')
|
603
|
+
end
|
604
|
+
@workbook.calc_mso_sizes
|
605
|
+
|
606
|
+
target = %w(
|
607
|
+
EB 00 7A 00 0F 00 00 F0 72 00 00 00 00 00 06 F0
|
608
|
+
38 00 00 00 01 14 00 00 06 00 00 00 04 08 00 00
|
609
|
+
03 00 00 00 01 00 00 00 00 04 00 00 01 00 00 00
|
610
|
+
01 00 00 00 02 00 00 00 02 00 00 00 03 00 00 00
|
611
|
+
00 04 00 00 03 00 00 00 01 00 00 00 33 00 0B F0
|
612
|
+
12 00 00 00 BF 00 08 00 08 00 81 01 09 00 00 08
|
613
|
+
C0 01 40 00 00 08 40 00 1E F1 10 00 00 00 0D 00
|
614
|
+
00 08 0C 00 00 08 17 00 00 08 F7 00 00 10
|
615
|
+
).join(' ')
|
616
|
+
caption = sprintf( " \tSheet1: %4d comments, Sheet2: %4d comments,"+
|
617
|
+
"Sheet3: %4d comments.", count1, count2, count3)
|
618
|
+
result = unpack_record(@workbook.add_mso_drawing_group)
|
619
|
+
assert_equal(target, result, caption)
|
620
|
+
|
621
|
+
|
622
|
+
# Test the parameters pass to the worksheets
|
623
|
+
caption = caption + ' (params)'
|
624
|
+
result_ids = []
|
625
|
+
target_ids = [
|
626
|
+
1024, 1, 1025, 2048,
|
627
|
+
3072, 2, 2, 3073,
|
628
|
+
4096, 3, 1025, 5120
|
629
|
+
]
|
630
|
+
|
631
|
+
@workbook.sheets.each do |sheet|
|
632
|
+
sheet.object_ids.each {|id| result_ids.push(id) }
|
633
|
+
end
|
634
|
+
assert_equal(target_ids, result_ids, caption)
|
635
|
+
|
636
|
+
end
|
637
|
+
|
638
|
+
def test_3_sheets_1024_and_1024_and_1_times
|
639
|
+
count1 = 1024
|
640
|
+
count2 = 1024
|
641
|
+
count3 = 1
|
642
|
+
for i in 1 .. count1
|
643
|
+
@worksheet1.write_comment(i -1, 0, 'aaa')
|
644
|
+
end
|
645
|
+
for i in 1 .. count2
|
646
|
+
@worksheet2.write_comment(i -1, 0, 'aaa')
|
647
|
+
end
|
648
|
+
for i in 1 .. count3
|
649
|
+
@worksheet3.write_comment(i -1, 0, 'aaa')
|
650
|
+
end
|
651
|
+
@workbook.calc_mso_sizes
|
652
|
+
|
653
|
+
target = %w(
|
654
|
+
EB 00 7A 00 0F 00 00 F0 72 00 00 00 00 00 06 F0
|
655
|
+
38 00 00 00 02 14 00 00 06 00 00 00 04 08 00 00
|
656
|
+
03 00 00 00 01 00 00 00 00 04 00 00 01 00 00 00
|
657
|
+
01 00 00 00 02 00 00 00 00 04 00 00 02 00 00 00
|
658
|
+
01 00 00 00 03 00 00 00 02 00 00 00 33 00 0B F0
|
659
|
+
12 00 00 00 BF 00 08 00 08 00 81 01 09 00 00 08
|
660
|
+
C0 01 40 00 00 08 40 00 1E F1 10 00 00 00 0D 00
|
661
|
+
00 08 0C 00 00 08 17 00 00 08 F7 00 00 10
|
662
|
+
).join(' ')
|
663
|
+
caption = sprintf( " \tSheet1: %4d comments, Sheet2: %4d comments,"+
|
664
|
+
"Sheet3: %4d comments.", count1, count2, count3)
|
665
|
+
result = unpack_record(@workbook.add_mso_drawing_group)
|
666
|
+
assert_equal(target, result, caption)
|
667
|
+
|
668
|
+
|
669
|
+
# Test the parameters pass to the worksheets
|
670
|
+
caption = caption + ' (params)'
|
671
|
+
result_ids = []
|
672
|
+
target_ids = [
|
673
|
+
1024, 1, 1025, 2048,
|
674
|
+
3072, 2, 1025, 4096,
|
675
|
+
5120, 3, 2, 5121
|
676
|
+
]
|
677
|
+
|
678
|
+
@workbook.sheets.each do |sheet|
|
679
|
+
sheet.object_ids.each {|id| result_ids.push(id) }
|
680
|
+
end
|
681
|
+
assert_equal(target_ids, result_ids, caption)
|
682
|
+
|
683
|
+
end
|
684
|
+
|
685
|
+
def test_3_sheets_1024_and_1024_and_1_times_duplicate
|
686
|
+
count1 = 1024
|
687
|
+
count2 = 1024
|
688
|
+
count3 = 1
|
689
|
+
for i in 1 .. count1
|
690
|
+
@worksheet1.write_comment(i -1, 0, 'aaa')
|
691
|
+
end
|
692
|
+
for i in 1 .. count2
|
693
|
+
@worksheet2.write_comment(i -1, 0, 'aaa')
|
694
|
+
end
|
695
|
+
for i in 1 .. count3
|
696
|
+
@worksheet3.write_comment(i -1, 0, 'aaa')
|
697
|
+
end
|
698
|
+
# dupulicate -- these are ignored. result is same as prev.--
|
699
|
+
for i in 1 .. count1
|
700
|
+
@worksheet1.write_comment(i -1, 0, 'aaa')
|
701
|
+
end
|
702
|
+
for i in 1 .. count2
|
703
|
+
@worksheet2.write_comment(i -1, 0, 'aaa')
|
704
|
+
end
|
705
|
+
for i in 1 .. count3
|
706
|
+
@worksheet3.write_comment(i -1, 0, 'aaa')
|
707
|
+
end
|
708
|
+
@workbook.calc_mso_sizes
|
709
|
+
|
710
|
+
target = %w(
|
711
|
+
EB 00 7A 00 0F 00 00 F0 72 00 00 00 00 00 06 F0
|
712
|
+
38 00 00 00 02 14 00 00 06 00 00 00 04 08 00 00
|
713
|
+
03 00 00 00 01 00 00 00 00 04 00 00 01 00 00 00
|
714
|
+
01 00 00 00 02 00 00 00 00 04 00 00 02 00 00 00
|
715
|
+
01 00 00 00 03 00 00 00 02 00 00 00 33 00 0B F0
|
716
|
+
12 00 00 00 BF 00 08 00 08 00 81 01 09 00 00 08
|
717
|
+
C0 01 40 00 00 08 40 00 1E F1 10 00 00 00 0D 00
|
718
|
+
00 08 0C 00 00 08 17 00 00 08 F7 00 00 10
|
719
|
+
).join(' ')
|
720
|
+
caption = sprintf( " \tSheet1: %4d comments, Sheet2: %4d comments,"+
|
721
|
+
"Sheet3: %4d comments.", count1, count2, count3)
|
722
|
+
result = unpack_record(@workbook.add_mso_drawing_group)
|
723
|
+
assert_equal(target, result, caption)
|
724
|
+
|
725
|
+
|
726
|
+
# Test the parameters pass to the worksheets
|
727
|
+
caption = caption + ' (params)'
|
728
|
+
result_ids = []
|
729
|
+
target_ids = [
|
730
|
+
1024, 1, 1025, 2048,
|
731
|
+
3072, 2, 1025, 4096,
|
732
|
+
5120, 3, 2, 5121
|
733
|
+
]
|
734
|
+
|
735
|
+
@workbook.sheets.each do |sheet|
|
736
|
+
sheet.object_ids.each {|id| result_ids.push(id) }
|
737
|
+
end
|
738
|
+
assert_equal(target_ids, result_ids, caption)
|
739
|
+
|
740
|
+
end
|
741
|
+
=end
|
742
|
+
###############################################################################
|
743
|
+
#
|
744
|
+
# Unpack the binary data into a format suitable for printing in tests.
|
745
|
+
#
|
746
|
+
def unpack_record(data)
|
747
|
+
data.unpack('C*').map! {|c| sprintf("%02X", c) }.join(' ')
|
748
|
+
end
|
749
|
+
|
750
|
+
end
|