writeexcel 0.6.9 → 0.6.10
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -0
- data/VERSION +1 -1
- data/lib/writeexcel/biffwriter.rb +29 -43
- data/lib/writeexcel/cell_range.rb +332 -0
- data/lib/writeexcel/chart.rb +50 -51
- data/lib/writeexcel/col_info.rb +87 -0
- data/lib/writeexcel/comments.rb +456 -0
- data/lib/writeexcel/convert_date_time.rb +117 -0
- data/lib/writeexcel/data_validations.rb +370 -0
- data/lib/writeexcel/debug_info.rb +5 -1
- data/lib/writeexcel/embedded_chart.rb +35 -0
- data/lib/writeexcel/format.rb +1 -1
- data/lib/writeexcel/formula.rb +3 -3
- data/lib/writeexcel/helper.rb +3 -0
- data/lib/writeexcel/image.rb +61 -1
- data/lib/writeexcel/olewriter.rb +2 -8
- data/lib/writeexcel/outline.rb +24 -0
- data/lib/writeexcel/shared_string_table.rb +153 -0
- data/lib/writeexcel/workbook.rb +86 -444
- data/lib/writeexcel/worksheet.rb +693 -2029
- data/lib/writeexcel/worksheets.rb +25 -0
- data/lib/writeexcel/write_file.rb +34 -15
- data/test/test_02_merge_formats.rb +0 -4
- data/test/test_04_dimensions.rb +0 -4
- data/test/test_05_rows.rb +0 -4
- data/test/test_06_extsst.rb +3 -6
- data/test/test_11_date_time.rb +0 -4
- data/test/test_12_date_only.rb +262 -231
- data/test/test_13_date_seconds.rb +0 -4
- data/test/test_21_escher.rb +71 -84
- data/test/test_22_mso_drawing_group.rb +0 -4
- data/test/test_23_note.rb +5 -21
- data/test/test_24_txo.rb +6 -7
- data/test/test_25_position_object.rb +0 -4
- data/test/test_26_autofilter.rb +0 -5
- data/test/test_27_autofilter.rb +0 -5
- data/test/test_28_autofilter.rb +0 -5
- data/test/test_29_process_jpg.rb +1 -1
- data/test/test_30_validation_dval.rb +4 -7
- data/test/test_31_validation_dv_strings.rb +9 -12
- data/test/test_32_validation_dv_formula.rb +11 -14
- data/test/test_42_set_properties.rb +0 -3
- data/test/test_50_name_stored.rb +0 -4
- data/test/test_51_name_print_area.rb +0 -4
- data/test/test_52_name_print_titles.rb +0 -4
- data/test/test_53_autofilter.rb +0 -4
- data/test/test_60_chart_generic.rb +42 -46
- data/test/test_61_chart_subclasses.rb +7 -11
- data/test/test_62_chart_formats.rb +12 -16
- data/test/test_63_chart_area_formats.rb +3 -7
- data/test/test_biff.rb +0 -4
- data/test/test_big_workbook.rb +17 -0
- data/test/test_format.rb +0 -3
- data/test/test_ole.rb +0 -4
- data/test/test_storage_lite.rb +0 -9
- data/test/test_workbook.rb +0 -4
- data/test/test_worksheet.rb +3 -7
- data/writeexcel.gemspec +12 -2
- metadata +12 -2
data/test/test_21_escher.rb
CHANGED
@@ -29,14 +29,6 @@ def setup
|
|
29
29
|
@worksheet = @workbook.add_worksheet
|
30
30
|
end
|
31
31
|
|
32
|
-
def teardown
|
33
|
-
@workbook.close
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_dummy
|
37
|
-
assert(true)
|
38
|
-
end
|
39
|
-
|
40
32
|
def test_for_store_mso_dg_container
|
41
33
|
caption = sprintf(" \t_store_mso_dg_container()")
|
42
34
|
data = [0xC8]
|
@@ -49,12 +41,12 @@ def test_for_store_mso_dg_container
|
|
49
41
|
|
50
42
|
def test_for_store_mso_dg
|
51
43
|
caption = sprintf(" \t_store_mso_dg()")
|
52
|
-
|
44
|
+
@worksheet.instance_variable_set(:@object_ids, Writeexcel::Worksheet::ObjectIds.new(nil, 1, 2, 1025))
|
53
45
|
target = %w( 10 00 08 F0
|
54
46
|
08 00 00 00 02 00 00 00 01 04 00 00
|
55
47
|
).join(' ')
|
56
48
|
|
57
|
-
result = unpack_record(@worksheet.__send__("store_mso_dg"
|
49
|
+
result = unpack_record(@worksheet.__send__("store_mso_dg"))
|
58
50
|
|
59
51
|
assert_equal(target, result, caption)
|
60
52
|
end
|
@@ -119,6 +111,7 @@ def test_for_store_mso_sp
|
|
119
111
|
|
120
112
|
def test_for_store_mso_opt_comment
|
121
113
|
caption = sprintf(" \t_store_mso_opt_comment()")
|
114
|
+
comment = Writeexcel::Worksheet::Comment.new(@worksheet, 1, 1, ' ')
|
122
115
|
data = [0x80]
|
123
116
|
target = %w(
|
124
117
|
93 00 0B F0 36 00 00 00
|
@@ -128,7 +121,7 @@ def test_for_store_mso_opt_comment
|
|
128
121
|
03 00 03 00 BF 03 02 00 0A 00
|
129
122
|
).join(' ')
|
130
123
|
|
131
|
-
result = unpack_record(
|
124
|
+
result = unpack_record(comment.store_mso_opt_comment(*data))
|
132
125
|
|
133
126
|
assert_equal(target, result, caption)
|
134
127
|
end
|
@@ -144,8 +137,9 @@ def test_for_store_mso_client_data
|
|
144
137
|
assert_equal(target, result, caption)
|
145
138
|
end
|
146
139
|
|
147
|
-
def
|
148
|
-
caption = sprintf(" \
|
140
|
+
def test_for_obj_comment_record
|
141
|
+
caption = sprintf(" \t_obj_comment_record")
|
142
|
+
comment = Writeexcel::Worksheet::Comment.new(@worksheet, 1, 1, ' ')
|
149
143
|
data = [0x01]
|
150
144
|
target = %w(
|
151
145
|
5D 00 34 00 15 00 12 00 19 00 01 00 11 40 00 00
|
@@ -154,18 +148,19 @@ def test_for_store_obj_comment
|
|
154
148
|
00 00 00 00 00 00 00 00
|
155
149
|
).join(' ')
|
156
150
|
|
157
|
-
result = unpack_record(
|
151
|
+
result = unpack_record(comment.obj_comment_record(*data))
|
158
152
|
|
159
153
|
assert_equal(target, result, caption)
|
160
154
|
end
|
161
155
|
|
162
156
|
def test_for_store_mso_client_text_box
|
163
157
|
caption = sprintf(" \t_store_mso_client_text_box")
|
158
|
+
comment = Writeexcel::Worksheet::Comment.new(@worksheet, 1, 1, ' ')
|
164
159
|
target = %w(
|
165
160
|
00 00 0D F0 00 00 00 00
|
166
161
|
).join(' ')
|
167
162
|
|
168
|
-
result = unpack_record(
|
163
|
+
result = unpack_record(comment.__send__("store_mso_client_text_box"))
|
169
164
|
|
170
165
|
assert_equal(target, result, caption)
|
171
166
|
end
|
@@ -175,153 +170,151 @@ def test_for_store_mso_client_anchor
|
|
175
170
|
# A1
|
176
171
|
range = 'A1'
|
177
172
|
caption = sprintf(" \t_store_mso_client_anchor(%s)", range)
|
178
|
-
|
179
|
-
|
180
|
-
data = data[-1]
|
173
|
+
row, col = @worksheet.__send__("substitute_cellref", range)
|
174
|
+
vertices = Writeexcel::Worksheet::Comment.new(@worksheet, row, col, 'Test').vertices
|
181
175
|
target = %w(
|
182
176
|
00 00 10 F0 12 00 00 00 03 00 01 00 F0 00 00 00
|
183
177
|
1E 00 03 00 F0 00 04 00 78 00
|
184
178
|
).join(' ')
|
185
179
|
|
186
|
-
result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *
|
180
|
+
result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *vertices))
|
187
181
|
|
188
182
|
assert_equal(target, result, caption)
|
189
183
|
|
190
184
|
# A2
|
191
185
|
range = 'A2'
|
192
|
-
|
193
|
-
|
194
|
-
|
186
|
+
caption = sprintf(" \t_store_mso_client_anchor(%s)", range)
|
187
|
+
row, col = @worksheet.__send__("substitute_cellref", range)
|
188
|
+
vertices = Writeexcel::Worksheet::Comment.new(@worksheet, row, col, 'Test').vertices
|
195
189
|
target = %w(
|
196
190
|
00 00 10 F0 12 00 00 00 03 00 01 00 F0 00 00 00
|
197
191
|
69 00 03 00 F0 00 04 00 C4 00
|
198
192
|
).join(' ')
|
199
193
|
|
200
|
-
result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *
|
194
|
+
result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *vertices))
|
201
195
|
|
202
196
|
assert_equal(target, result, caption)
|
203
197
|
|
204
198
|
|
205
199
|
# A3
|
206
200
|
range = 'A3'
|
207
|
-
|
208
|
-
|
209
|
-
|
201
|
+
caption = sprintf(" \t_store_mso_client_anchor(%s)", range)
|
202
|
+
row, col = @worksheet.__send__("substitute_cellref", range)
|
203
|
+
vertices = Writeexcel::Worksheet::Comment.new(@worksheet, row, col, 'Test').vertices
|
210
204
|
target = %w(
|
211
205
|
00 00 10 F0 12 00 00 00 03 00 01 00 F0 00 01 00
|
212
206
|
69 00 03 00 F0 00 05 00 C4 00
|
213
207
|
).join(' ')
|
214
208
|
|
215
|
-
result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *
|
209
|
+
result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *vertices))
|
216
210
|
|
217
211
|
assert_equal(target, result, caption)
|
218
212
|
|
219
213
|
|
220
214
|
# A65534
|
221
215
|
range = 'A65534'
|
222
|
-
|
223
|
-
|
224
|
-
|
216
|
+
caption = sprintf(" \t_store_mso_client_anchor(%s)", range)
|
217
|
+
row, col = @worksheet.__send__("substitute_cellref", range)
|
218
|
+
vertices = Writeexcel::Worksheet::Comment.new(@worksheet, row, col, 'Test').vertices
|
225
219
|
target = %w(
|
226
220
|
00 00 10 F0 12 00 00 00 03 00 01 00 F0 00 F9 FF
|
227
221
|
3C 00 03 00 F0 00 FD FF 97 00
|
228
222
|
).join(' ')
|
229
223
|
|
230
|
-
result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *
|
224
|
+
result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *vertices))
|
231
225
|
|
232
226
|
assert_equal(target, result, caption)
|
233
227
|
|
234
228
|
|
235
229
|
# A65536
|
236
230
|
range = 'A65536'
|
237
|
-
|
238
|
-
|
239
|
-
|
231
|
+
caption = sprintf(" \t_store_mso_client_anchor(%s)", range)
|
232
|
+
row, col = @worksheet.__send__("substitute_cellref", range)
|
233
|
+
vertices = Writeexcel::Worksheet::Comment.new(@worksheet, row, col, 'Test').vertices
|
240
234
|
target = %w(
|
241
235
|
00 00 10 F0 12 00 00 00 03 00 01 00 F0 00 FB FF
|
242
236
|
1E 00 03 00 F0 00 FF FF 78 00
|
243
237
|
).join(' ')
|
244
238
|
|
245
|
-
result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *
|
239
|
+
result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *vertices))
|
246
240
|
|
247
241
|
assert_equal(target, result, caption)
|
248
242
|
|
249
243
|
|
250
244
|
# IT3
|
251
245
|
range = 'IT3'
|
252
|
-
|
253
|
-
|
254
|
-
|
246
|
+
caption = sprintf(" \t_store_mso_client_anchor(%s)", range)
|
247
|
+
row, col = @worksheet.__send__("substitute_cellref", range)
|
248
|
+
vertices = Writeexcel::Worksheet::Comment.new(@worksheet, row, col, 'Test').vertices
|
255
249
|
target = %w(
|
256
250
|
00 00 10 F0 12 00 00 00 03 00 FA 00 10 03 01 00
|
257
251
|
69 00 FC 00 10 03 05 00 C4 00
|
258
252
|
).join(' ')
|
259
253
|
|
260
|
-
result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *
|
254
|
+
result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *vertices))
|
261
255
|
|
262
256
|
assert_equal(target, result, caption)
|
263
257
|
|
264
258
|
|
265
259
|
# IU3
|
266
260
|
range = 'IU3'
|
267
|
-
|
268
|
-
|
269
|
-
|
261
|
+
caption = sprintf(" \t_store_mso_client_anchor(%s)", range)
|
262
|
+
row, col = @worksheet.__send__("substitute_cellref", range)
|
263
|
+
vertices = Writeexcel::Worksheet::Comment.new(@worksheet, row, col, 'Test').vertices
|
270
264
|
target = %w(
|
271
265
|
00 00 10 F0 12 00 00 00 03 00 FB 00 10 03 01 00
|
272
266
|
69 00 FD 00 10 03 05 00 C4 00
|
273
267
|
).join(' ')
|
274
268
|
|
275
|
-
result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *
|
269
|
+
result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *vertices))
|
276
270
|
|
277
271
|
assert_equal(target, result, caption)
|
278
272
|
|
279
273
|
|
280
274
|
#
|
281
275
|
range = 'IU3'
|
282
|
-
|
283
|
-
|
284
|
-
|
276
|
+
caption = sprintf(" \t_store_mso_client_anchor(%s)", range)
|
277
|
+
row, col = @worksheet.__send__("substitute_cellref", range)
|
278
|
+
vertices = Writeexcel::Worksheet::Comment.new(@worksheet, row, col, 'Test').vertices
|
285
279
|
target = %w(
|
286
280
|
00 00 10 F0 12 00 00 00 03 00 FB 00 10 03 01 00
|
287
281
|
69 00 FD 00 10 03 05 00 C4 00
|
288
282
|
).join(' ')
|
289
283
|
|
290
|
-
result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *
|
284
|
+
result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *vertices))
|
291
285
|
|
292
286
|
assert_equal(target, result, caption)
|
293
287
|
|
294
288
|
|
295
289
|
# IV3
|
296
290
|
range = 'IV3'
|
297
|
-
|
298
|
-
|
299
|
-
|
291
|
+
caption = sprintf(" \t_store_mso_client_anchor(%s)", range)
|
292
|
+
row, col = @worksheet.__send__("substitute_cellref", range)
|
293
|
+
vertices = Writeexcel::Worksheet::Comment.new(@worksheet, row, col, 'Test').vertices
|
300
294
|
target = %w(
|
301
295
|
00 00 10 F0 12 00 00 00 03 00 FC 00 10 03 01 00
|
302
296
|
69 00 FE 00 10 03 05 00 C4 00
|
303
297
|
).join(' ')
|
304
298
|
|
305
|
-
result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *
|
299
|
+
result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *vertices))
|
306
300
|
|
307
301
|
assert_equal(target, result, caption)
|
308
302
|
|
309
303
|
end
|
310
304
|
|
311
305
|
def test_for_store_mso_client_anchor_where_comment_offsets_have_changed
|
312
|
-
range
|
313
|
-
caption
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
data = data[-1]
|
306
|
+
range = 'A3'
|
307
|
+
caption = sprintf(" \t_store_mso_client_anchor(%s). Cell offsets changes.", range)
|
308
|
+
row, col = @worksheet.__send__("substitute_cellref", range)
|
309
|
+
vertices = Writeexcel::Worksheet::Comment.new(@worksheet, row, col, 'Test',
|
310
|
+
:x_offset => 18, :y_offset => 9).vertices
|
318
311
|
target = %w(
|
319
312
|
00 00 10 F0 12 00
|
320
313
|
00 00 03 00 01 00 20 01 01 00 88 00 03 00 20 01
|
321
314
|
05 00 E2 00
|
322
315
|
).join(' ')
|
323
316
|
|
324
|
-
result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *
|
317
|
+
result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *vertices))
|
325
318
|
|
326
319
|
assert_equal(target, result, caption)
|
327
320
|
end
|
@@ -330,31 +323,29 @@ def test_for_store_mso_client_anchor_where_comment_dimensions_have_changed
|
|
330
323
|
# x_scale, y_scale
|
331
324
|
range = 'A3'
|
332
325
|
caption = sprintf(" \t_store_mso_client_anchor(%s). Dimensions changes.", range)
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
data = data[-1]
|
326
|
+
row, col = @worksheet.__send__("substitute_cellref", range)
|
327
|
+
vertices = Writeexcel::Worksheet::Comment.new(@worksheet, row, col, 'Test',
|
328
|
+
:x_scale => 3, :y_scale => 2).vertices
|
337
329
|
target = %w(
|
338
330
|
00 00 10 F0 12 00 00 00 03 00
|
339
331
|
01 00 F0 00 01 00 69 00 07 00 F0 00 0A 00 1E 00
|
340
332
|
).join(' ')
|
341
333
|
|
342
|
-
result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *
|
334
|
+
result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *vertices))
|
343
335
|
|
344
336
|
assert_equal(target, result, caption)
|
345
337
|
|
346
338
|
|
347
339
|
# width, height
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
data = data[-1]
|
340
|
+
row, col = @worksheet.__send__("substitute_cellref", range)
|
341
|
+
vertices = Writeexcel::Worksheet::Comment.new(@worksheet, row, col, 'Test',
|
342
|
+
:width => 384, :height => 148).vertices
|
352
343
|
target = %w(
|
353
344
|
00 00 10 F0 12 00 00 00 03 00
|
354
345
|
01 00 F0 00 01 00 69 00 07 00 F0 00 0A 00 1E 00
|
355
346
|
).join(' ')
|
356
347
|
|
357
|
-
result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *
|
348
|
+
result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *vertices))
|
358
349
|
|
359
350
|
assert_equal(target, result, caption)
|
360
351
|
|
@@ -366,9 +357,8 @@ def test_for_store_mso_client_anchor_where_column_widths_have_changed
|
|
366
357
|
@worksheet.set_column('G:G', 20)
|
367
358
|
|
368
359
|
caption = sprintf(" \t_store_mso_client_anchor(%s). Col width changes.", range)
|
369
|
-
|
370
|
-
|
371
|
-
data = data[-1]
|
360
|
+
row, col = @worksheet.__send__("substitute_cellref", range)
|
361
|
+
vertices = Writeexcel::Worksheet::Comment.new(@worksheet, row, col, 'Test').vertices
|
372
362
|
|
373
363
|
target = %w(
|
374
364
|
00 00 10 F0 12 00
|
@@ -376,7 +366,7 @@ def test_for_store_mso_client_anchor_where_column_widths_have_changed
|
|
376
366
|
05 00 C4 00
|
377
367
|
).join(' ')
|
378
368
|
|
379
|
-
result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *
|
369
|
+
result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *vertices))
|
380
370
|
|
381
371
|
assert_equal(target, result, caption)
|
382
372
|
|
@@ -385,9 +375,8 @@ def test_for_store_mso_client_anchor_where_column_widths_have_changed
|
|
385
375
|
range = 'K3'
|
386
376
|
@worksheet.set_column('L:O', 4)
|
387
377
|
|
388
|
-
|
389
|
-
|
390
|
-
data = data[-1]
|
378
|
+
row, col = @worksheet.__send__("substitute_cellref", range)
|
379
|
+
vertices = Writeexcel::Worksheet::Comment.new(@worksheet, row, col, 'Test').vertices
|
391
380
|
|
392
381
|
target = %w(
|
393
382
|
00 00 10 F0 12 00
|
@@ -395,7 +384,7 @@ def test_for_store_mso_client_anchor_where_column_widths_have_changed
|
|
395
384
|
05 00 C4 00
|
396
385
|
).join(' ')
|
397
386
|
|
398
|
-
result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *
|
387
|
+
result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *vertices))
|
399
388
|
|
400
389
|
assert_equal(target, result, caption)
|
401
390
|
|
@@ -410,9 +399,8 @@ def test_for_store_mso_client_anchor_where_row_height_have_changed
|
|
410
399
|
@worksheet.set_row(8, 6)
|
411
400
|
|
412
401
|
caption = sprintf(" \t_store_mso_client_anchor(%s). Row height changed.", range)
|
413
|
-
|
414
|
-
|
415
|
-
data = data[-1]
|
402
|
+
row, col = @worksheet.__send__("substitute_cellref", range)
|
403
|
+
vertices = Writeexcel::Worksheet::Comment.new(@worksheet, row, col, 'Test').vertices
|
416
404
|
|
417
405
|
target = %w(
|
418
406
|
00 00 10 F0 12 00
|
@@ -420,7 +408,7 @@ def test_for_store_mso_client_anchor_where_row_height_have_changed
|
|
420
408
|
0A 00 E2 00
|
421
409
|
).join(' ')
|
422
410
|
|
423
|
-
result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *
|
411
|
+
result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *vertices))
|
424
412
|
|
425
413
|
assert_equal(target, result, caption)
|
426
414
|
|
@@ -430,9 +418,8 @@ def test_for_store_mso_client_anchor_where_row_height_have_changed
|
|
430
418
|
@worksheet.set_row(14, 60)
|
431
419
|
|
432
420
|
caption = sprintf(" \t_store_mso_client_anchor(%s). Row height changed.", range)
|
433
|
-
|
434
|
-
|
435
|
-
data = data[-1]
|
421
|
+
row, col = @worksheet.__send__("substitute_cellref", range)
|
422
|
+
vertices = Writeexcel::Worksheet::Comment.new(@worksheet, row, col, 'Test').vertices
|
436
423
|
|
437
424
|
target = %w(
|
438
425
|
00 00 10 F0 12 00
|
@@ -440,7 +427,7 @@ def test_for_store_mso_client_anchor_where_row_height_have_changed
|
|
440
427
|
0E 00 CD 00
|
441
428
|
).join(' ')
|
442
429
|
|
443
|
-
result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *
|
430
|
+
result = unpack_record(@worksheet.__send__("store_mso_client_anchor", 3, *vertices))
|
444
431
|
|
445
432
|
assert_equal(target, result, caption)
|
446
433
|
|
data/test/test_23_note.rb
CHANGED
@@ -21,35 +21,20 @@ def setup
|
|
21
21
|
@worksheet = @workbook.add_worksheet
|
22
22
|
end
|
23
23
|
|
24
|
-
def teardown
|
25
|
-
@workbook.close
|
26
|
-
end
|
27
|
-
|
28
24
|
def test_blank_author_name
|
29
|
-
|
30
|
-
row = data[0]
|
31
|
-
col = data[1]
|
32
|
-
author = data[4]
|
33
|
-
encoding = data[5]
|
34
|
-
visible = data[6]
|
25
|
+
comment = Writeexcel::Worksheet::Comment.new(@worksheet, 2, 0, 'Test')
|
35
26
|
obj_id = 1
|
36
27
|
|
37
|
-
caption = sprintf(" \
|
28
|
+
caption = sprintf(" \tnote_record")
|
38
29
|
target = %w(
|
39
30
|
1C 00 0C 00 02 00 00 00 00 00 01 00 00 00 00 00
|
40
31
|
).join(' ')
|
41
|
-
result = unpack_record(
|
42
|
-
@worksheet.__send__("store_note", row, col, obj_id, author, encoding, visible))
|
32
|
+
result = unpack_record(comment.store_note_record(obj_id))
|
43
33
|
assert_equal(target, result, caption)
|
44
34
|
end
|
45
35
|
|
46
36
|
def test_defined_author_name
|
47
|
-
|
48
|
-
row = data[0]
|
49
|
-
col = data[1]
|
50
|
-
author = data[4]
|
51
|
-
encoding = data[5]
|
52
|
-
visible = data[6]
|
37
|
+
comment = Writeexcel::Worksheet::Comment.new(@worksheet, 2, 0,'Test', :author => 'Username')
|
53
38
|
obj_id = 1
|
54
39
|
|
55
40
|
caption = sprintf(" \tstore_note")
|
@@ -57,8 +42,7 @@ def test_defined_author_name
|
|
57
42
|
1C 00 14 00 02 00 00 00 00 00 01 00 08 00 00 55
|
58
43
|
73 65 72 6E 61 6D 65 00
|
59
44
|
).join(' ')
|
60
|
-
result = unpack_record(
|
61
|
-
@worksheet.__send__("store_note", row,col,obj_id,author,encoding,visible))
|
45
|
+
result = unpack_record(comment.store_note_record(obj_id))
|
62
46
|
assert_equal(target, result, caption)
|
63
47
|
end
|
64
48
|
|