writeexcel 0.3.5 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. data/.gitattributes +1 -0
  2. data/README.rdoc +12 -6
  3. data/VERSION +1 -1
  4. data/charts/chartex.rb +316 -315
  5. data/charts/demo1.rb +1 -0
  6. data/charts/demo2.rb +1 -0
  7. data/charts/demo3.rb +117 -116
  8. data/charts/demo4.rb +119 -118
  9. data/charts/demo5.rb +48 -47
  10. data/examples/a_simple.rb +1 -0
  11. data/examples/autofilter.rb +1 -0
  12. data/examples/bigfile.rb +30 -29
  13. data/examples/chart_area.rb +121 -120
  14. data/examples/chart_bar.rb +120 -119
  15. data/examples/chart_column.rb +120 -119
  16. data/examples/chart_line.rb +120 -119
  17. data/examples/chart_pie.rb +108 -107
  18. data/examples/chart_scatter.rb +121 -120
  19. data/examples/chart_stock.rb +148 -147
  20. data/examples/chess.rb +1 -0
  21. data/examples/colors.rb +1 -0
  22. data/examples/comments1.rb +1 -0
  23. data/examples/comments2.rb +3 -2
  24. data/examples/copyformat.rb +1 -0
  25. data/examples/data_validate.rb +1 -0
  26. data/examples/date_time.rb +1 -0
  27. data/examples/defined_name.rb +1 -0
  28. data/examples/demo.rb +1 -0
  29. data/examples/diag_border.rb +1 -0
  30. data/examples/formats.rb +1 -0
  31. data/examples/formula_result.rb +1 -0
  32. data/examples/header.rb +1 -0
  33. data/examples/hide_sheet.rb +1 -0
  34. data/examples/hyperlink.rb +1 -0
  35. data/examples/images.rb +1 -0
  36. data/examples/indent.rb +1 -0
  37. data/examples/merge1.rb +1 -0
  38. data/examples/merge2.rb +1 -0
  39. data/examples/merge3.rb +1 -0
  40. data/examples/merge4.rb +1 -0
  41. data/examples/merge5.rb +1 -0
  42. data/examples/merge6.rb +67 -66
  43. data/examples/outline.rb +1 -0
  44. data/examples/outline_collapsed.rb +1 -0
  45. data/examples/panes.rb +1 -0
  46. data/examples/properties.rb +1 -0
  47. data/examples/properties_jp.rb +1 -0
  48. data/examples/protection.rb +1 -0
  49. data/examples/regions.rb +1 -0
  50. data/examples/repeat.rb +1 -0
  51. data/examples/right_to_left.rb +1 -0
  52. data/examples/row_wrap.rb +1 -0
  53. data/examples/stats.rb +1 -0
  54. data/examples/stocks.rb +1 -0
  55. data/examples/tab_colors.rb +1 -0
  56. data/examples/write_arrays.rb +1 -0
  57. data/lib/writeexcel.rb +6 -1
  58. data/lib/writeexcel/biffwriter.rb +21 -20
  59. data/lib/writeexcel/chart.rb +25 -12
  60. data/lib/writeexcel/charts/area.rb +153 -152
  61. data/lib/writeexcel/charts/bar.rb +178 -177
  62. data/lib/writeexcel/charts/column.rb +157 -156
  63. data/lib/writeexcel/charts/external.rb +62 -61
  64. data/lib/writeexcel/charts/line.rb +153 -152
  65. data/lib/writeexcel/charts/pie.rb +170 -169
  66. data/lib/writeexcel/charts/scatter.rb +4 -3
  67. data/lib/writeexcel/charts/stock.rb +212 -211
  68. data/lib/writeexcel/compatibility.rb +320 -0
  69. data/lib/writeexcel/excelformulaparser.rb +587 -586
  70. data/lib/writeexcel/format.rb +12 -13
  71. data/lib/writeexcel/formula.rb +30 -28
  72. data/lib/writeexcel/helper.rb +23 -0
  73. data/lib/writeexcel/olewriter.rb +5 -16
  74. data/lib/writeexcel/properties.rb +43 -54
  75. data/lib/writeexcel/storage_lite.rb +981 -968
  76. data/lib/writeexcel/workbook.rb +94 -73
  77. data/lib/writeexcel/worksheet.rb +230 -210
  78. data/test/helper.rb +19 -0
  79. data/test/test_00_IEEE_double.rb +1 -0
  80. data/test/test_01_add_worksheet.rb +1 -0
  81. data/test/test_02_merge_formats.rb +3 -5
  82. data/test/test_04_dimensions.rb +3 -5
  83. data/test/test_05_rows.rb +6 -6
  84. data/test/test_06_extsst.rb +8 -8
  85. data/test/test_11_date_time.rb +3 -5
  86. data/test/test_12_date_only.rb +3 -5
  87. data/test/test_13_date_seconds.rb +4 -6
  88. data/test/test_21_escher.rb +3 -5
  89. data/test/test_22_mso_drawing_group.rb +20 -22
  90. data/test/test_23_note.rb +5 -7
  91. data/test/test_24_txo.rb +3 -5
  92. data/test/test_25_position_object.rb +84 -79
  93. data/test/test_26_autofilter.rb +3 -13
  94. data/test/test_27_autofilter.rb +3 -13
  95. data/test/test_28_autofilter.rb +3 -13
  96. data/test/test_29_process_jpg.rb +5 -0
  97. data/test/test_30_validation_dval.rb +3 -5
  98. data/test/test_31_validation_dv_strings.rb +3 -5
  99. data/test/test_32_validation_dv_formula.rb +3 -5
  100. data/test/test_40_property_types.rb +10 -9
  101. data/test/test_41_properties.rb +1 -0
  102. data/test/test_42_set_properties.rb +14 -15
  103. data/test/test_50_name_stored.rb +299 -302
  104. data/test/test_51_name_print_area.rb +357 -360
  105. data/test/test_52_name_print_titles.rb +454 -457
  106. data/test/test_53_autofilter.rb +203 -206
  107. data/test/test_60_chart_generic.rb +5 -0
  108. data/test/test_61_chart_subclasses.rb +95 -94
  109. data/test/test_62_chart_formats.rb +272 -267
  110. data/test/test_63_chart_area_formats.rb +649 -644
  111. data/test/test_biff.rb +12 -38
  112. data/test/test_compatibility.rb +627 -0
  113. data/test/test_example_match.rb +3 -18
  114. data/test/test_format.rb +46 -105
  115. data/test/test_formula.rb +1 -0
  116. data/test/test_ole.rb +3 -4
  117. data/test/test_storage_lite.rb +125 -146
  118. data/test/test_workbook.rb +2 -23
  119. data/test/test_worksheet.rb +4 -5
  120. data/utils/add_magic_comment.rb +80 -0
  121. data/writeexcel.gemspec +8 -2
  122. metadata +10 -4
@@ -1,3 +1,4 @@
1
+ # -*- coding: utf-8 -*-
1
2
  ##########################################################################
2
3
  # test_23_note.rb
3
4
  #
@@ -11,24 +12,21 @@
11
12
  #
12
13
  #########################################################################
13
14
  require 'helper'
15
+ require 'stringio'
14
16
 
15
17
  class TC_note < Test::Unit::TestCase
16
18
 
17
19
  def setup
18
- t = Time.now.strftime("%Y%m%d")
19
- path = "temp#{t}-#{$$}-#{rand(0x100000000).to_s(36)}"
20
- @test_file = File.join(Dir.tmpdir, path)
21
- @workbook = WriteExcel.new(@test_file)
20
+ @workbook = WriteExcel.new(StringIO.new)
22
21
  @worksheet = @workbook.add_worksheet
23
22
  end
24
23
 
25
24
  def teardown
26
25
  @workbook.close
27
- File.unlink(@test_file) if FileTest.exist?(@test_file)
28
26
  end
29
27
 
30
28
  def test_blank_author_name
31
- data = @worksheet.comment_params(2,0,'Test')
29
+ data = @worksheet.comment_params(2, 0, 'Test')
32
30
  row = data[0]
33
31
  col = data[1]
34
32
  author = data[4]
@@ -41,7 +39,7 @@ def test_blank_author_name
41
39
  1C 00 0C 00 02 00 00 00 00 00 01 00 00 00 00 00
42
40
  ).join(' ')
43
41
  result = unpack_record(
44
- @worksheet.store_note(row,col,obj_id,author,encoding,visible))
42
+ @worksheet.store_note(row, col, obj_id, author, encoding, visible))
45
43
  assert_equal(target, result, caption)
46
44
  end
47
45
 
@@ -1,3 +1,4 @@
1
+ # -*- coding: utf-8 -*-
1
2
  ##########################################################################
2
3
  # test_24_txo.rb
3
4
  #
@@ -11,20 +12,17 @@
11
12
  #
12
13
  #########################################################################
13
14
  require 'helper'
15
+ require 'stringio'
14
16
 
15
17
  class TC_txo < Test::Unit::TestCase
16
18
 
17
19
  def setup
18
- t = Time.now.strftime("%Y%m%d")
19
- path = "temp#{t}-#{$$}-#{rand(0x100000000).to_s(36)}"
20
- @test_file = File.join(Dir.tmpdir, path)
21
- @workbook = WriteExcel.new(@test_file)
20
+ @workbook = WriteExcel.new(StringIO.new)
22
21
  @worksheet = @workbook.add_worksheet
23
22
  end
24
23
 
25
24
  def teardown
26
25
  @workbook.close
27
- File.unlink(@test_file) if FileTest.exist?(@test_file)
28
26
  end
29
27
 
30
28
  def test_txo
@@ -1,79 +1,84 @@
1
- ###############################################################################
2
- #
3
- # A test for Spreadsheet::WriteExcel.
4
- #
5
- # Tests for the _position_object() Worksheet method used to calculate the
6
- # vertices that define the position of a graphical object within a worksheet.
7
- #
8
- # See the the _position_object() comments for a full explanation.
9
- #
10
- # reverse('ゥ'), September 2005, John McNamara, jmcnamara@cpan.org
11
- #
12
- # original written in Perl by John McNamara
13
- # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
14
- #
15
- #########################################################################
16
- require 'helper'
17
- require 'stringio'
18
-
19
- class TC_position_object < Test::Unit::TestCase
20
-
21
- def setup
22
- @test_file = StringIO.new
23
- @workbook = WriteExcel.new(@test_file)
24
- @worksheet = @workbook.add_worksheet
25
- end
26
-
27
- ###############################################################################
28
- #
29
- # Tests extracted from images imported into Excel.
30
- #
31
- #
32
- # input = ($col_start, $row_start, $x1, $y1, $width, $height)
33
- # (0, 1, 2, 3, 4, 5 )
34
- #
35
- # expected = ($col_start, $x1, $row_start, $y1, $col_end, $x2, $row_end, $y2)
36
- # (0, 1, 2, 3, 4, 5, 6, 7 )
37
- #
38
- def test_extracted_from_images_imported_into_excel
39
- tests = [
40
- # Input # Expected results
41
- [ [0, 0, 0, 0, 1, 1], [ 0, 0, 0, 0, 0, 16, 0, 15] ],
42
- [ [0, 0, 0, 0, 2, 2], [ 0, 0, 0, 0, 0, 32, 0, 30] ],
43
- [ [0, 0, 0, 0, 3, 3], [ 0, 0, 0, 0, 0, 48, 0, 45] ],
44
- [ [0, 0, 0, 0, 4, 4], [ 0, 0, 0, 0, 0, 64, 0, 60] ],
45
- [ [0, 0, 0, 0, 5, 5], [ 0, 0, 0, 0, 0, 80, 0, 75] ],
46
- [ [0, 0, 0, 0, 6, 6], [ 0, 0, 0, 0, 0, 96, 0, 90] ],
47
- [ [0, 0, 0, 0, 7, 7], [ 0, 0, 0, 0, 0, 112, 0, 105] ],
48
- [ [0, 0, 0, 0, 8, 8], [ 0, 0, 0, 0, 0, 128, 0, 120] ],
49
- [ [0, 0, 0, 0, 9, 9], [ 0, 0, 0, 0, 0, 144, 0, 136] ],
50
- [ [0, 0, 0, 0, 10, 10], [ 0, 0, 0, 0, 0, 160, 0, 151] ],
51
- [ [0, 0, 0, 0, 15, 15], [ 0, 0, 0, 0, 0, 240, 0, 226] ],
52
- [ [0, 0, 0, 0, 16, 16], [ 0, 0, 0, 0, 0, 256, 0, 241] ],
53
- [ [0, 0, 0, 0, 17, 17], [ 0, 0, 0, 0, 0, 272, 1, 0] ],
54
- [ [0, 0, 0, 0, 18, 18], [ 0, 0, 0, 0, 0, 288, 1, 15] ],
55
- [ [0, 0, 0, 0, 19, 19], [ 0, 0, 0, 0, 0, 304, 1, 30] ],
56
- [ [0, 0, 0, 0, 62, 8], [ 0, 0, 0, 0, 0, 992, 0, 120] ],
57
- [ [0, 0, 0, 0, 63, 8], [ 0, 0, 0, 0, 0, 1008, 0, 120] ],
58
- [ [0, 0, 0, 0, 64, 8], [ 0, 0, 0, 0, 1, 0, 0, 120] ],
59
- [ [0, 0, 0, 0, 65, 8], [ 0, 0, 0, 0, 1, 16, 0, 120] ],
60
- [ [0, 0, 0, 0, 66, 8], [ 0, 0, 0, 0, 1, 32, 0, 120] ],
61
- [ [0, 0, 0, 0, 200, 200], [ 0, 0, 0, 0, 3, 128, 11, 196] ],
62
- [ [1, 4, 0, 0, 64, 16], [ 1, 0, 4, 0, 2, 0, 4, 241] ],
63
- [ [1, 4, 1, 0, 64, 16], [ 1, 16, 4, 0, 2, 16, 4, 241] ],
64
- [ [1, 4, 2, 0, 64, 16], [ 1, 32, 4, 0, 2, 32, 4, 241] ],
65
- [ [1, 4, 2, 1, 64, 16], [ 1, 32, 4, 15, 2, 32, 5, 0] ],
66
- [ [1, 4, 2, 2, 64, 16], [ 1, 32, 4, 30, 2, 32, 5, 15] ],
67
-
68
- # Test for comment box standard sizes.
69
- [ [2, 1, 15, 7, 128, 74], [ 2, 240, 1, 105, 4, 240, 5, 196] ]
70
- ]
71
-
72
- tests.each do |testcase|
73
- input = testcase[0]
74
- expected = testcase[1]
75
- results = @worksheet.position_object(*input)
76
- assert_equal(expected, results)
77
- end
78
- end
79
- end
1
+ # -*- coding: utf-8 -*-
2
+ ###############################################################################
3
+ #
4
+ # A test for Spreadsheet::WriteExcel.
5
+ #
6
+ # Tests for the _position_object() Worksheet method used to calculate the
7
+ # vertices that define the position of a graphical object within a worksheet.
8
+ #
9
+ # See the the _position_object() comments for a full explanation.
10
+ #
11
+ # reverse('ゥ'), September 2005, John McNamara, jmcnamara@cpan.org
12
+ #
13
+ # original written in Perl by John McNamara
14
+ # converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
15
+ #
16
+ #########################################################################
17
+ require 'helper'
18
+ require 'stringio'
19
+
20
+ class TC_position_object < Test::Unit::TestCase
21
+
22
+ def setup
23
+ @test_file = StringIO.new
24
+ @workbook = WriteExcel.new(@test_file)
25
+ @worksheet = @workbook.add_worksheet
26
+ end
27
+
28
+ def teardown
29
+ @workbook.close
30
+ end
31
+
32
+ ###############################################################################
33
+ #
34
+ # Tests extracted from images imported into Excel.
35
+ #
36
+ #
37
+ # input = ($col_start, $row_start, $x1, $y1, $width, $height)
38
+ # (0, 1, 2, 3, 4, 5 )
39
+ #
40
+ # expected = ($col_start, $x1, $row_start, $y1, $col_end, $x2, $row_end, $y2)
41
+ # (0, 1, 2, 3, 4, 5, 6, 7 )
42
+ #
43
+ def test_extracted_from_images_imported_into_excel
44
+ tests = [
45
+ # Input # Expected results
46
+ [ [0, 0, 0, 0, 1, 1], [ 0, 0, 0, 0, 0, 16, 0, 15] ],
47
+ [ [0, 0, 0, 0, 2, 2], [ 0, 0, 0, 0, 0, 32, 0, 30] ],
48
+ [ [0, 0, 0, 0, 3, 3], [ 0, 0, 0, 0, 0, 48, 0, 45] ],
49
+ [ [0, 0, 0, 0, 4, 4], [ 0, 0, 0, 0, 0, 64, 0, 60] ],
50
+ [ [0, 0, 0, 0, 5, 5], [ 0, 0, 0, 0, 0, 80, 0, 75] ],
51
+ [ [0, 0, 0, 0, 6, 6], [ 0, 0, 0, 0, 0, 96, 0, 90] ],
52
+ [ [0, 0, 0, 0, 7, 7], [ 0, 0, 0, 0, 0, 112, 0, 105] ],
53
+ [ [0, 0, 0, 0, 8, 8], [ 0, 0, 0, 0, 0, 128, 0, 120] ],
54
+ [ [0, 0, 0, 0, 9, 9], [ 0, 0, 0, 0, 0, 144, 0, 136] ],
55
+ [ [0, 0, 0, 0, 10, 10], [ 0, 0, 0, 0, 0, 160, 0, 151] ],
56
+ [ [0, 0, 0, 0, 15, 15], [ 0, 0, 0, 0, 0, 240, 0, 226] ],
57
+ [ [0, 0, 0, 0, 16, 16], [ 0, 0, 0, 0, 0, 256, 0, 241] ],
58
+ [ [0, 0, 0, 0, 17, 17], [ 0, 0, 0, 0, 0, 272, 1, 0] ],
59
+ [ [0, 0, 0, 0, 18, 18], [ 0, 0, 0, 0, 0, 288, 1, 15] ],
60
+ [ [0, 0, 0, 0, 19, 19], [ 0, 0, 0, 0, 0, 304, 1, 30] ],
61
+ [ [0, 0, 0, 0, 62, 8], [ 0, 0, 0, 0, 0, 992, 0, 120] ],
62
+ [ [0, 0, 0, 0, 63, 8], [ 0, 0, 0, 0, 0, 1008, 0, 120] ],
63
+ [ [0, 0, 0, 0, 64, 8], [ 0, 0, 0, 0, 1, 0, 0, 120] ],
64
+ [ [0, 0, 0, 0, 65, 8], [ 0, 0, 0, 0, 1, 16, 0, 120] ],
65
+ [ [0, 0, 0, 0, 66, 8], [ 0, 0, 0, 0, 1, 32, 0, 120] ],
66
+ [ [0, 0, 0, 0, 200, 200], [ 0, 0, 0, 0, 3, 128, 11, 196] ],
67
+ [ [1, 4, 0, 0, 64, 16], [ 1, 0, 4, 0, 2, 0, 4, 241] ],
68
+ [ [1, 4, 1, 0, 64, 16], [ 1, 16, 4, 0, 2, 16, 4, 241] ],
69
+ [ [1, 4, 2, 0, 64, 16], [ 1, 32, 4, 0, 2, 32, 4, 241] ],
70
+ [ [1, 4, 2, 1, 64, 16], [ 1, 32, 4, 15, 2, 32, 5, 0] ],
71
+ [ [1, 4, 2, 2, 64, 16], [ 1, 32, 4, 30, 2, 32, 5, 15] ],
72
+
73
+ # Test for comment box standard sizes.
74
+ [ [2, 1, 15, 7, 128, 74], [ 2, 240, 1, 105, 4, 240, 5, 196] ]
75
+ ]
76
+
77
+ tests.each do |testcase|
78
+ input = testcase[0]
79
+ expected = testcase[1]
80
+ results = @worksheet.position_object(*input)
81
+ assert_equal(expected, results)
82
+ end
83
+ end
84
+ end
@@ -1,3 +1,4 @@
1
+ # -*- coding: utf-8 -*-
1
2
  ##########################################################################
2
3
  # test_26_autofilter.rb
3
4
  #
@@ -10,6 +11,7 @@
10
11
  #
11
12
  #########################################################################
12
13
  require 'helper'
14
+ require 'stringio'
13
15
 
14
16
  class TC_26_autofilter < Test::Unit::TestCase
15
17
 
@@ -31,19 +33,8 @@ def test_26_autofilter
31
33
  end
32
34
  end
33
35
 
34
- ###############################################################################
35
- #
36
- # Unpack the binary data into a format suitable for printing in tests.
37
- #
38
- def unpack_record(data)
39
- data.unpack('C*').map! {|c| sprintf("%02X", c) }.join(' ')
40
- end
41
-
42
36
  def setup
43
- t = Time.now.strftime("%Y%m%d")
44
- path = "temp#{t}-#{$$}-#{rand(0x100000000).to_s(36)}"
45
- @test_file = File.join(Dir.tmpdir, path)
46
- @workbook = WriteExcel.new(@test_file)
37
+ @workbook = WriteExcel.new(StringIO.new)
47
38
  @worksheet = @workbook.add_worksheet
48
39
  @tests = [
49
40
  {
@@ -318,7 +309,6 @@ def setup
318
309
 
319
310
  def teardown
320
311
  @workbook.close
321
- File.unlink(@test_file) if FileTest.exist?(@test_file)
322
312
  end
323
313
 
324
314
  end
@@ -1,3 +1,4 @@
1
+ # -*- coding: utf-8 -*-
1
2
  ##########################################################################
2
3
  # test_27_autofilter.rb
3
4
  #
@@ -10,6 +11,7 @@
10
11
  #
11
12
  #########################################################################
12
13
  require 'helper'
14
+ require 'stringio'
13
15
 
14
16
  class TC_27_autofilter < Test::Unit::TestCase
15
17
 
@@ -25,19 +27,8 @@ def test_27_autofilter
25
27
  end
26
28
  end
27
29
 
28
- ###############################################################################
29
- #
30
- # Unpack the binary data into a format suitable for printing in tests.
31
- #
32
- def unpack_record(data)
33
- data.unpack('C*').map! {|c| sprintf("%02X", c) }.join(' ')
34
- end
35
-
36
30
  def setup
37
- t = Time.now.strftime("%Y%m%d")
38
- path = "temp#{t}-#{$$}-#{rand(0x100000000).to_s(36)}"
39
- @test_file = File.join(Dir.tmpdir, path)
40
- @workbook = WriteExcel.new(@test_file)
31
+ @workbook = WriteExcel.new(StringIO.new)
41
32
  @worksheet = @workbook.add_worksheet
42
33
  @tests = [
43
34
  [
@@ -135,7 +126,6 @@ def setup
135
126
 
136
127
  def teardown
137
128
  @workbook.close
138
- File.unlink(@test_file) if FileTest.exist?(@test_file)
139
129
  end
140
130
 
141
131
  end
@@ -1,3 +1,4 @@
1
+ # -*- coding: utf-8 -*-
1
2
  ##########################################################################
2
3
  # test_28_autofilter.rb
3
4
  #
@@ -10,6 +11,7 @@
10
11
  #
11
12
  #########################################################################
12
13
  require 'helper'
14
+ require 'stringio'
13
15
 
14
16
  class TC_28_autofilter < Test::Unit::TestCase
15
17
 
@@ -26,19 +28,8 @@ def test_28_autofilter
26
28
  end
27
29
  end
28
30
 
29
- ###############################################################################
30
- #
31
- # Unpack the binary data into a format suitable for printing in tests.
32
- #
33
- def unpack_record(data)
34
- data.unpack('C*').map! {|c| sprintf("%02X", c) }.join(' ')
35
- end
36
-
37
31
  def setup
38
- t = Time.now.strftime("%Y%m%d")
39
- path = "temp#{t}-#{$$}-#{rand(0x100000000).to_s(36)}"
40
- @test_file = File.join(Dir.tmpdir, path)
41
- @workbook = WriteExcel.new(@test_file)
32
+ @workbook = WriteExcel.new(StringIO.new)
42
33
  @worksheet = @workbook.add_worksheet
43
34
  @tests = [
44
35
  [
@@ -165,7 +156,6 @@ def setup
165
156
 
166
157
  def teardown
167
158
  @workbook.close
168
- File.unlink(@test_file) if FileTest.exist?(@test_file)
169
159
  end
170
160
 
171
161
  end
@@ -1,3 +1,4 @@
1
+ # -*- coding: utf-8 -*-
1
2
  ##########################################################################
2
3
  # test_29_process_jpg.rb
3
4
  #
@@ -26,6 +27,10 @@ def setup
26
27
  @type = 5 # Excel Blip type (MSOBLIPTYPE).
27
28
  end
28
29
 
30
+ def teardown
31
+ @workbook.close
32
+ end
33
+
29
34
  def test_valid_jpg_image_1
30
35
  testname = '3w x 5h jpeg image.'
31
36
 
@@ -1,3 +1,4 @@
1
+ # -*- coding: utf-8 -*-
1
2
  ##########################################################################
2
3
  # test_30_validation_dval.rb
3
4
  #
@@ -10,20 +11,17 @@
10
11
  #
11
12
  #########################################################################
12
13
  require 'helper'
14
+ require 'stringio'
13
15
 
14
16
  class TC_validation_dval < Test::Unit::TestCase
15
17
 
16
18
  def setup
17
- t = Time.now.strftime("%Y%m%d")
18
- path = "temp#{t}-#{$$}-#{rand(0x100000000).to_s(36)}"
19
- @test_file = File.join(Dir.tmpdir, path)
20
- @workbook = WriteExcel.new(@test_file)
19
+ @workbook = WriteExcel.new(StringIO.new)
21
20
  @worksheet = @workbook.add_worksheet
22
21
  end
23
22
 
24
23
  def teardown
25
24
  @workbook.close
26
- File.unlink(@test_file) if FileTest.exist?(@test_file)
27
25
  end
28
26
 
29
27
  def test_1
@@ -1,3 +1,4 @@
1
+ # -*- coding: utf-8 -*-
1
2
  ##########################################################################
2
3
  # test_31_validation_dv_strings.rb
3
4
  #
@@ -11,20 +12,17 @@
11
12
  #
12
13
  #########################################################################
13
14
  require 'helper'
15
+ require 'stringio'
14
16
 
15
17
  class TC_validation_dv_strings < Test::Unit::TestCase
16
18
 
17
19
  def setup
18
- t = Time.now.strftime("%Y%m%d")
19
- path = "temp#{t}-#{$$}-#{rand(0x100000000).to_s(36)}"
20
- @test_file = File.join(Dir.tmpdir, path)
21
- @workbook = WriteExcel.new(@test_file)
20
+ @workbook = WriteExcel.new(StringIO.new)
22
21
  @worksheet = @workbook.add_worksheet
23
22
  end
24
23
 
25
24
  def teardown
26
25
  @workbook.close
27
- File.unlink(@test_file) if FileTest.exist?(@test_file)
28
26
  end
29
27
 
30
28
  def test_empty_string
@@ -1,3 +1,4 @@
1
+ # -*- coding: utf-8 -*-
1
2
  ##########################################################################
2
3
  # test_32_validation_dv_formula.rb
3
4
  #
@@ -10,21 +11,18 @@
10
11
  #
11
12
  #########################################################################
12
13
  require 'helper'
14
+ require 'stringio'
13
15
 
14
16
  class TC_validation_dv_formula < Test::Unit::TestCase
15
17
 
16
18
  def setup
17
- t = Time.now.strftime("%Y%m%d")
18
- path = "temp#{t}-#{$$}-#{rand(0x100000000).to_s(36)}"
19
- @test_file = File.join(Dir.tmpdir, path)
20
- @workbook = WriteExcel.new(@test_file)
19
+ @workbook = WriteExcel.new(StringIO.new)
21
20
  @worksheet = @workbook.add_worksheet
22
21
  @worksheet2 = @workbook.add_worksheet
23
22
  end
24
23
 
25
24
  def teardown
26
25
  @workbook.close
27
- File.unlink(@test_file) if FileTest.exist?(@test_file)
28
26
  end
29
27
 
30
28
  def test_integer_values