writeexcel 0.3.1 → 0.3.2
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/.document +5 -0
- data/.gitignore +21 -0
- data/{README → README.rdoc} +14 -3
- data/Rakefile +52 -0
- data/VERSION +1 -0
- data/charts/chartex.rb +315 -0
- data/charts/demo1.rb +45 -0
- data/charts/demo101.bin +0 -0
- data/charts/demo2.rb +64 -0
- data/charts/demo201.bin +0 -0
- data/charts/demo3.rb +116 -0
- data/charts/demo301.bin +0 -0
- data/charts/demo4.rb +118 -0
- data/charts/demo401.bin +0 -0
- data/charts/demo5.rb +47 -0
- data/charts/demo501.bin +0 -0
- data/examples/demo.rb +4 -1
- data/examples/images.rb +14 -4
- data/examples/stats.rb +0 -2
- data/lib/writeexcel.rb +0 -1
- data/lib/writeexcel/excelformula.y +139 -0
- data/lib/writeexcel/formula.rb +3 -1
- data/lib/writeexcel/workbook.rb +9 -9
- data/test/helper.rb +9 -0
- data/test/perl_output/defined_name.xls +0 -0
- data/test/test_00_IEEE_double.rb +1 -3
- data/test/test_01_add_worksheet.rb +1 -4
- data/test/test_02_merge_formats.rb +1 -4
- data/test/test_04_dimensions.rb +1 -4
- data/test/test_05_rows.rb +1 -4
- data/test/test_06_extsst.rb +1 -4
- data/test/test_11_date_time.rb +1 -4
- data/test/test_12_date_only.rb +1 -4
- data/test/test_13_date_seconds.rb +1 -4
- data/test/test_21_escher.rb +1 -4
- data/test/test_22_mso_drawing_group.rb +1 -4
- data/test/test_23_note.rb +1 -4
- data/test/test_24_txo.rb +1 -4
- data/test/test_25_position_object.rb +1 -4
- data/test/test_26_autofilter.rb +1 -4
- data/test/test_27_autofilter.rb +1 -4
- data/test/test_28_autofilter.rb +1 -4
- data/test/test_29_process_jpg.rb +1 -4
- data/test/test_30_validation_dval.rb +1 -4
- data/test/test_31_validation_dv_strings.rb +1 -4
- data/test/test_32_validation_dv_formula.rb +1 -4
- data/test/test_40_property_types.rb +1 -5
- data/test/test_41_properties.rb +1 -5
- data/test/test_42_set_properties.rb +1 -5
- data/test/test_50_name_stored.rb +1 -4
- data/test/test_51_name_print_area.rb +1 -4
- data/test/test_52_name_print_titles.rb +1 -4
- data/test/test_53_autofilter.rb +1 -4
- data/test/test_60_chart_generic.rb +1 -4
- data/test/test_61_chart_subclasses.rb +1 -4
- data/test/test_62_chart_formats.rb +1 -4
- data/test/test_63_chart_area_formats.rb +1 -4
- data/test/{tc_biff.rb → test_biff.rb} +1 -4
- data/test/{tc_example_match.rb → test_example_match.rb} +84 -69
- data/test/{tc_format.rb → test_format.rb} +1 -4
- data/test/{tc_formula.rb → test_formula.rb} +1 -4
- data/test/{tc_ole.rb → test_ole.rb} +1 -4
- data/test/{tc_storage_lite.rb → test_storage_lite.rb} +1 -4
- data/test/{tc_workbook.rb → test_workbook.rb} +1 -4
- data/test/{tc_worksheet.rb → test_worksheet.rb} +1 -4
- data/writeexcel.gemspec +287 -16
- metadata +123 -35
- data/test/tc_all.rb +0 -32
- data/test/tc_chart.rb +0 -22
- data/test/test_chartex.rb +0 -35
- data/test/ts_all.rb +0 -46
@@ -1,7 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require "test/unit"
|
4
|
-
require 'writeexcel'
|
1
|
+
require 'helper'
|
2
|
+
require 'stringio'
|
5
3
|
|
6
4
|
class TC_example_match < Test::Unit::TestCase
|
7
5
|
|
@@ -9,25 +7,18 @@ class TC_example_match < Test::Unit::TestCase
|
|
9
7
|
PERL_OUTDIR = File.join(TEST_DIR, 'perl_output')
|
10
8
|
|
11
9
|
def setup
|
10
|
+
@file = StringIO.new
|
11
|
+
=begin
|
12
12
|
t = Time.now.strftime("%Y%m%d")
|
13
13
|
path = "temp#{t}-#{$$}-#{rand(0x100000000).to_s(36)}"
|
14
14
|
@test_file = File.join(Dir.tmpdir, path)
|
15
15
|
@filename = @test_file
|
16
16
|
@filename2 = @test_file + "2"
|
17
|
-
|
18
|
-
|
19
|
-
def teardown
|
20
|
-
File.delete(@filename) if File.exist?(@filename)
|
21
|
-
File.delete(@filename2) if File.exist?(@filename2)
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_compare_file
|
25
|
-
expected = target = __FILE__
|
26
|
-
compare_file(expected, target)
|
17
|
+
=end
|
27
18
|
end
|
28
19
|
|
29
20
|
def test_a_simple
|
30
|
-
workbook = WriteExcel.new(@
|
21
|
+
workbook = WriteExcel.new(@file)
|
31
22
|
worksheet = workbook.add_worksheet
|
32
23
|
|
33
24
|
# The general syntax is write(row, column, token). Note that row and
|
@@ -55,13 +46,12 @@ class TC_example_match < Test::Unit::TestCase
|
|
55
46
|
|
56
47
|
# File save
|
57
48
|
workbook.close
|
58
|
-
|
59
49
|
# do assertion
|
60
|
-
compare_file("#{PERL_OUTDIR}/a_simple.xls", @
|
50
|
+
compare_file("#{PERL_OUTDIR}/a_simple.xls", @file)
|
61
51
|
end
|
62
52
|
|
63
53
|
def test_autofilter
|
64
|
-
workbook = WriteExcel.new(@
|
54
|
+
workbook = WriteExcel.new(@file)
|
65
55
|
|
66
56
|
worksheet1 = workbook.add_worksheet
|
67
57
|
worksheet2 = workbook.add_worksheet
|
@@ -250,7 +240,7 @@ class TC_example_match < Test::Unit::TestCase
|
|
250
240
|
workbook.close
|
251
241
|
|
252
242
|
# do assertion
|
253
|
-
compare_file("#{PERL_OUTDIR}/autofilter.xls", @
|
243
|
+
compare_file("#{PERL_OUTDIR}/autofilter.xls", @file)
|
254
244
|
end
|
255
245
|
|
256
246
|
def get_data_for_autofilter
|
@@ -309,7 +299,7 @@ class TC_example_match < Test::Unit::TestCase
|
|
309
299
|
end
|
310
300
|
|
311
301
|
def test_regions
|
312
|
-
workbook = WriteExcel.new(@
|
302
|
+
workbook = WriteExcel.new(@file)
|
313
303
|
|
314
304
|
# Add some worksheets
|
315
305
|
north = workbook.add_worksheet("North")
|
@@ -346,11 +336,11 @@ class TC_example_match < Test::Unit::TestCase
|
|
346
336
|
workbook.close
|
347
337
|
|
348
338
|
# do assertion
|
349
|
-
compare_file("#{PERL_OUTDIR}/regions.xls", @
|
339
|
+
compare_file("#{PERL_OUTDIR}/regions.xls", @file)
|
350
340
|
end
|
351
341
|
|
352
342
|
def test_stats
|
353
|
-
workbook = WriteExcel.new(@
|
343
|
+
workbook = WriteExcel.new(@file)
|
354
344
|
worksheet = workbook.add_worksheet('Test data')
|
355
345
|
|
356
346
|
# Set the column width for columns 1
|
@@ -406,12 +396,12 @@ class TC_example_match < Test::Unit::TestCase
|
|
406
396
|
workbook.close
|
407
397
|
|
408
398
|
# do assertion
|
409
|
-
compare_file("#{PERL_OUTDIR}/stats.xls", @
|
399
|
+
compare_file("#{PERL_OUTDIR}/stats.xls", @file)
|
410
400
|
end
|
411
401
|
|
412
402
|
def test_hyperlink1
|
413
403
|
# Create a new workbook and add a worksheet
|
414
|
-
workbook = WriteExcel.new(@
|
404
|
+
workbook = WriteExcel.new(@file)
|
415
405
|
worksheet = workbook.add_worksheet('Hyperlinks')
|
416
406
|
|
417
407
|
# Format the first column
|
@@ -439,18 +429,19 @@ class TC_example_match < Test::Unit::TestCase
|
|
439
429
|
workbook.close
|
440
430
|
|
441
431
|
# do assertion
|
442
|
-
compare_file("#{PERL_OUTDIR}/hyperlink.xls", @
|
432
|
+
compare_file("#{PERL_OUTDIR}/hyperlink.xls", @file)
|
443
433
|
end
|
444
434
|
|
445
435
|
def test_copyformat
|
446
436
|
# Create workbook1
|
447
|
-
workbook1 = WriteExcel.new(@
|
437
|
+
workbook1 = WriteExcel.new(@file)
|
448
438
|
worksheet1 = workbook1.add_worksheet
|
449
439
|
format1a = workbook1.add_format
|
450
440
|
format1b = workbook1.add_format
|
451
441
|
|
452
442
|
# Create workbook2
|
453
|
-
|
443
|
+
file2 = StringIO.new
|
444
|
+
workbook2 = WriteExcel.new(file2)
|
454
445
|
worksheet2 = workbook2.add_worksheet
|
455
446
|
format2a = workbook2.add_format
|
456
447
|
format2b = workbook2.add_format
|
@@ -483,12 +474,12 @@ class TC_example_match < Test::Unit::TestCase
|
|
483
474
|
workbook2.close
|
484
475
|
|
485
476
|
# do assertion
|
486
|
-
compare_file("#{PERL_OUTDIR}/workbook1.xls", @
|
487
|
-
compare_file("#{PERL_OUTDIR}/workbook2.xls",
|
477
|
+
compare_file("#{PERL_OUTDIR}/workbook1.xls", @file)
|
478
|
+
compare_file("#{PERL_OUTDIR}/workbook2.xls", file2)
|
488
479
|
end
|
489
480
|
|
490
481
|
def test_data_validate
|
491
|
-
workbook = WriteExcel.new(@
|
482
|
+
workbook = WriteExcel.new(@file)
|
492
483
|
worksheet = workbook.add_worksheet
|
493
484
|
|
494
485
|
# Add a format for the header cells.
|
@@ -752,11 +743,11 @@ class TC_example_match < Test::Unit::TestCase
|
|
752
743
|
workbook.close
|
753
744
|
|
754
745
|
# do assertion
|
755
|
-
compare_file("#{PERL_OUTDIR}/data_validate.xls", @
|
746
|
+
compare_file("#{PERL_OUTDIR}/data_validate.xls", @file)
|
756
747
|
end
|
757
748
|
|
758
749
|
def test_merge1
|
759
|
-
workbook = WriteExcel.new(@
|
750
|
+
workbook = WriteExcel.new(@file)
|
760
751
|
worksheet = workbook.add_worksheet
|
761
752
|
|
762
753
|
# Increase the cell size of the merged cells to highlight the formatting.
|
@@ -774,11 +765,11 @@ class TC_example_match < Test::Unit::TestCase
|
|
774
765
|
workbook.close
|
775
766
|
|
776
767
|
# do assertion
|
777
|
-
compare_file("#{PERL_OUTDIR}/merge1.xls", @
|
768
|
+
compare_file("#{PERL_OUTDIR}/merge1.xls", @file)
|
778
769
|
end
|
779
770
|
|
780
771
|
def test_merge2
|
781
|
-
workbook = WriteExcel.new(@
|
772
|
+
workbook = WriteExcel.new(@file)
|
782
773
|
worksheet = workbook.add_worksheet
|
783
774
|
|
784
775
|
# Increase the cell size of the merged cells to highlight the formatting.
|
@@ -804,11 +795,11 @@ class TC_example_match < Test::Unit::TestCase
|
|
804
795
|
workbook.close
|
805
796
|
|
806
797
|
# do assertion
|
807
|
-
compare_file("#{PERL_OUTDIR}/merge2.xls", @
|
798
|
+
compare_file("#{PERL_OUTDIR}/merge2.xls", @file)
|
808
799
|
end
|
809
800
|
|
810
801
|
def test_merge3
|
811
|
-
workbook = WriteExcel.new(@
|
802
|
+
workbook = WriteExcel.new(@file)
|
812
803
|
worksheet = workbook.add_worksheet()
|
813
804
|
|
814
805
|
# Increase the cell size of the merged cells to highlight the formatting.
|
@@ -856,12 +847,12 @@ class TC_example_match < Test::Unit::TestCase
|
|
856
847
|
workbook.close
|
857
848
|
|
858
849
|
# do assertion
|
859
|
-
compare_file("#{PERL_OUTDIR}/merge3.xls", @
|
850
|
+
compare_file("#{PERL_OUTDIR}/merge3.xls", @file)
|
860
851
|
end
|
861
852
|
|
862
853
|
def test_merge4
|
863
854
|
# Create a new workbook and add a worksheet
|
864
|
-
workbook = WriteExcel.new(@
|
855
|
+
workbook = WriteExcel.new(@file)
|
865
856
|
worksheet = workbook.add_worksheet
|
866
857
|
|
867
858
|
# Increase the cell size of the merged cells to highlight the formatting.
|
@@ -928,12 +919,12 @@ class TC_example_match < Test::Unit::TestCase
|
|
928
919
|
workbook.close
|
929
920
|
|
930
921
|
# do assertion
|
931
|
-
compare_file("#{PERL_OUTDIR}/merge4.xls", @
|
922
|
+
compare_file("#{PERL_OUTDIR}/merge4.xls", @file)
|
932
923
|
end
|
933
924
|
|
934
925
|
def test_merge5
|
935
926
|
# Create a new workbook and add a worksheet
|
936
|
-
workbook = WriteExcel.new(@
|
927
|
+
workbook = WriteExcel.new(@file)
|
937
928
|
worksheet = workbook.add_worksheet
|
938
929
|
|
939
930
|
|
@@ -996,12 +987,12 @@ class TC_example_match < Test::Unit::TestCase
|
|
996
987
|
workbook.close
|
997
988
|
|
998
989
|
# do assertion
|
999
|
-
compare_file("#{PERL_OUTDIR}/merge5.xls", @
|
990
|
+
compare_file("#{PERL_OUTDIR}/merge5.xls", @file)
|
1000
991
|
end
|
1001
992
|
|
1002
993
|
def test_images
|
1003
994
|
# Create a new workbook called simple.xls and add a worksheet
|
1004
|
-
workbook = WriteExcel.new(@
|
995
|
+
workbook = WriteExcel.new(@file)
|
1005
996
|
worksheet1 = workbook.add_worksheet('Image 1')
|
1006
997
|
worksheet2 = workbook.add_worksheet('Image 2')
|
1007
998
|
worksheet3 = workbook.add_worksheet('Image 3')
|
@@ -1038,11 +1029,11 @@ class TC_example_match < Test::Unit::TestCase
|
|
1038
1029
|
workbook.close
|
1039
1030
|
|
1040
1031
|
# do assertion
|
1041
|
-
compare_file("#{PERL_OUTDIR}/images.xls", @
|
1032
|
+
compare_file("#{PERL_OUTDIR}/images.xls", @file)
|
1042
1033
|
end
|
1043
1034
|
|
1044
1035
|
def test_tab_colors
|
1045
|
-
workbook = WriteExcel.new(@
|
1036
|
+
workbook = WriteExcel.new(@file)
|
1046
1037
|
|
1047
1038
|
worksheet1 = workbook.add_worksheet
|
1048
1039
|
worksheet2 = workbook.add_worksheet
|
@@ -1057,12 +1048,12 @@ class TC_example_match < Test::Unit::TestCase
|
|
1057
1048
|
workbook.close
|
1058
1049
|
|
1059
1050
|
# do assertion
|
1060
|
-
compare_file("#{PERL_OUTDIR}/tab_colors.xls", @
|
1051
|
+
compare_file("#{PERL_OUTDIR}/tab_colors.xls", @file)
|
1061
1052
|
end
|
1062
1053
|
|
1063
1054
|
def test_stocks
|
1064
1055
|
# Create a new workbook and add a worksheet
|
1065
|
-
workbook = WriteExcel.new(@
|
1056
|
+
workbook = WriteExcel.new(@file)
|
1066
1057
|
worksheet = workbook.add_worksheet
|
1067
1058
|
|
1068
1059
|
# Set the column width for columns 1, 2, 3 and 4
|
@@ -1124,11 +1115,11 @@ class TC_example_match < Test::Unit::TestCase
|
|
1124
1115
|
workbook.close
|
1125
1116
|
|
1126
1117
|
# do assertion
|
1127
|
-
compare_file("#{PERL_OUTDIR}/stocks.xls", @
|
1118
|
+
compare_file("#{PERL_OUTDIR}/stocks.xls", @file)
|
1128
1119
|
end
|
1129
1120
|
|
1130
1121
|
def test_protection
|
1131
|
-
workbook = WriteExcel.new(@
|
1122
|
+
workbook = WriteExcel.new(@file)
|
1132
1123
|
worksheet = workbook.add_worksheet
|
1133
1124
|
|
1134
1125
|
# Create some format objects
|
@@ -1159,12 +1150,12 @@ class TC_example_match < Test::Unit::TestCase
|
|
1159
1150
|
workbook.close
|
1160
1151
|
|
1161
1152
|
# do assertion
|
1162
|
-
compare_file("#{PERL_OUTDIR}/protection.xls", @
|
1153
|
+
compare_file("#{PERL_OUTDIR}/protection.xls", @file)
|
1163
1154
|
end
|
1164
1155
|
|
1165
1156
|
def test_date_time
|
1166
1157
|
# Create a new workbook and add a worksheet
|
1167
|
-
workbook = WriteExcel.new(@
|
1158
|
+
workbook = WriteExcel.new(@file)
|
1168
1159
|
worksheet = workbook.add_worksheet
|
1169
1160
|
bold = workbook.add_format(:bold => 1)
|
1170
1161
|
|
@@ -1235,11 +1226,11 @@ class TC_example_match < Test::Unit::TestCase
|
|
1235
1226
|
workbook.close
|
1236
1227
|
|
1237
1228
|
# do assertion
|
1238
|
-
compare_file("#{PERL_OUTDIR}/date_time.xls", @
|
1229
|
+
compare_file("#{PERL_OUTDIR}/date_time.xls", @file)
|
1239
1230
|
end
|
1240
1231
|
|
1241
1232
|
def test_diag_border
|
1242
|
-
workbook = WriteExcel.new(@
|
1233
|
+
workbook = WriteExcel.new(@file)
|
1243
1234
|
worksheet = workbook.add_worksheet
|
1244
1235
|
|
1245
1236
|
format1 = workbook.add_format(:diag_type => 1)
|
@@ -1259,11 +1250,11 @@ class TC_example_match < Test::Unit::TestCase
|
|
1259
1250
|
workbook.close
|
1260
1251
|
|
1261
1252
|
# do assertion
|
1262
|
-
compare_file("#{PERL_OUTDIR}/diag_border.xls", @
|
1253
|
+
compare_file("#{PERL_OUTDIR}/diag_border.xls", @file)
|
1263
1254
|
end
|
1264
1255
|
|
1265
1256
|
def test_headers
|
1266
|
-
workbook = WriteExcel.new(@
|
1257
|
+
workbook = WriteExcel.new(@file)
|
1267
1258
|
preview = "Select Print Preview to see the header and footer"
|
1268
1259
|
|
1269
1260
|
|
@@ -1359,11 +1350,11 @@ class TC_example_match < Test::Unit::TestCase
|
|
1359
1350
|
workbook.close
|
1360
1351
|
|
1361
1352
|
# do assertion
|
1362
|
-
compare_file("#{PERL_OUTDIR}/headers.xls", @
|
1353
|
+
compare_file("#{PERL_OUTDIR}/headers.xls", @file)
|
1363
1354
|
end
|
1364
1355
|
|
1365
1356
|
def test_demo
|
1366
|
-
workbook = WriteExcel.new(@
|
1357
|
+
workbook = WriteExcel.new(@file)
|
1367
1358
|
worksheet = workbook.add_worksheet('Demo')
|
1368
1359
|
worksheet2 = workbook.add_worksheet('Another sheet')
|
1369
1360
|
worksheet3 = workbook.add_worksheet('And another')
|
@@ -1453,7 +1444,7 @@ worksheet.write('B9', 'http://www.perl.com/' )
|
|
1453
1444
|
# Images
|
1454
1445
|
#
|
1455
1446
|
worksheet.write('A10', "Images")
|
1456
|
-
worksheet.insert_image('B10',
|
1447
|
+
worksheet.insert_image('B10', "#{TEST_DIR}/republic.png", 16, 8)
|
1457
1448
|
|
1458
1449
|
|
1459
1450
|
#######################################################################
|
@@ -1466,7 +1457,7 @@ worksheet.write('A19', "Multiple worksheets")
|
|
1466
1457
|
workbook.close
|
1467
1458
|
|
1468
1459
|
# do assertion
|
1469
|
-
compare_file("#{PERL_OUTDIR}/demo.xls", @
|
1460
|
+
compare_file("#{PERL_OUTDIR}/demo.xls", @file)
|
1470
1461
|
end
|
1471
1462
|
|
1472
1463
|
def test_unicode_cyrillic
|
@@ -1479,7 +1470,7 @@ workbook.close
|
|
1479
1470
|
0x0442, 0x0432, 0x0443, 0x0439, 0x0020, 0x041C,
|
1480
1471
|
0x0438, 0x0440, 0x0021].pack("U*")
|
1481
1472
|
|
1482
|
-
workbook = WriteExcel.new(@
|
1473
|
+
workbook = WriteExcel.new(@file)
|
1483
1474
|
worksheet = workbook.add_worksheet(sheet + '1')
|
1484
1475
|
|
1485
1476
|
worksheet.set_column('A:A', 18)
|
@@ -1488,11 +1479,34 @@ workbook.close
|
|
1488
1479
|
workbook.close
|
1489
1480
|
|
1490
1481
|
# do assertion
|
1491
|
-
compare_file("#{PERL_OUTDIR}/unicode_cyrillic.xls", @
|
1482
|
+
compare_file("#{PERL_OUTDIR}/unicode_cyrillic.xls", @file)
|
1483
|
+
end
|
1484
|
+
|
1485
|
+
def test_defined_name
|
1486
|
+
workbook = WriteExcel.new(@file)
|
1487
|
+
worksheet1 = workbook.add_worksheet
|
1488
|
+
worksheet2 = workbook.add_worksheet
|
1489
|
+
|
1490
|
+
workbook.define_name('Exchange_rate', '=0.96')
|
1491
|
+
workbook.define_name('Sales', '=Sheet1!$G$1:$H$10')
|
1492
|
+
workbook.define_name('Sheet2!Sales', '=Sheet2!$G$1:$G$10')
|
1493
|
+
|
1494
|
+
workbook.sheets.each do |worksheet|
|
1495
|
+
worksheet.set_column('A:A', 45)
|
1496
|
+
worksheet.write('A2', 'This worksheet contains some defined names,')
|
1497
|
+
worksheet.write('A3', 'See the Insert -> Name -> Define dialog.')
|
1498
|
+
end
|
1499
|
+
|
1500
|
+
worksheet1.write('A4', '=Exchange_rate')
|
1501
|
+
|
1502
|
+
workbook.close
|
1503
|
+
|
1504
|
+
# do assertion
|
1505
|
+
compare_file("#{PERL_OUTDIR}/defined_name.xls", @file)
|
1492
1506
|
end
|
1493
1507
|
|
1494
1508
|
def test_chart_area
|
1495
|
-
workbook = WriteExcel.new(@
|
1509
|
+
workbook = WriteExcel.new(@file)
|
1496
1510
|
worksheet = workbook.add_worksheet
|
1497
1511
|
bold = workbook.add_format(:bold => 1)
|
1498
1512
|
|
@@ -1599,11 +1613,11 @@ worksheet.insert_chart('E2', chart5)
|
|
1599
1613
|
workbook.close
|
1600
1614
|
|
1601
1615
|
# do assertion
|
1602
|
-
compare_file("#{PERL_OUTDIR}/chart_area.xls", @
|
1616
|
+
compare_file("#{PERL_OUTDIR}/chart_area.xls", @file)
|
1603
1617
|
end
|
1604
1618
|
|
1605
1619
|
def test_chart_bar
|
1606
|
-
workbook = WriteExcel.new(@
|
1620
|
+
workbook = WriteExcel.new(@file)
|
1607
1621
|
worksheet = workbook.add_worksheet
|
1608
1622
|
bold = workbook.add_format(:bold => 1)
|
1609
1623
|
|
@@ -1710,11 +1724,11 @@ worksheet.insert_chart('E2', chart5)
|
|
1710
1724
|
workbook.close
|
1711
1725
|
|
1712
1726
|
# do assertion
|
1713
|
-
compare_file("#{PERL_OUTDIR}/chart_bar.xls", @
|
1727
|
+
compare_file("#{PERL_OUTDIR}/chart_bar.xls", @file)
|
1714
1728
|
end
|
1715
1729
|
|
1716
1730
|
def test_chart_column
|
1717
|
-
workbook = WriteExcel.new(@
|
1731
|
+
workbook = WriteExcel.new(@file)
|
1718
1732
|
worksheet = workbook.add_worksheet
|
1719
1733
|
bold = workbook.add_format(:bold => 1)
|
1720
1734
|
|
@@ -1821,11 +1835,11 @@ worksheet.insert_chart('E2', chart5)
|
|
1821
1835
|
workbook.close
|
1822
1836
|
|
1823
1837
|
# do assertion
|
1824
|
-
compare_file("#{PERL_OUTDIR}/chart_column.xls", @
|
1838
|
+
compare_file("#{PERL_OUTDIR}/chart_column.xls", @file)
|
1825
1839
|
end
|
1826
1840
|
|
1827
1841
|
def test_chart_line
|
1828
|
-
workbook = WriteExcel.new(@
|
1842
|
+
workbook = WriteExcel.new(@file)
|
1829
1843
|
worksheet = workbook.add_worksheet
|
1830
1844
|
bold = workbook.add_format(:bold => 1)
|
1831
1845
|
|
@@ -1932,13 +1946,14 @@ worksheet.insert_chart('E2', chart5)
|
|
1932
1946
|
workbook.close
|
1933
1947
|
|
1934
1948
|
# do assertion
|
1935
|
-
compare_file("#{PERL_OUTDIR}/chart_line.xls", @
|
1949
|
+
compare_file("#{PERL_OUTDIR}/chart_line.xls", @file)
|
1936
1950
|
end
|
1937
1951
|
|
1938
1952
|
def compare_file(expected, target)
|
1953
|
+
# target is StringIO object.
|
1939
1954
|
assert_equal(
|
1940
1955
|
open(expected, 'rb') { |f| f.read },
|
1941
|
-
|
1956
|
+
target.string
|
1942
1957
|
)
|
1943
1958
|
end
|
1944
1959
|
end
|