write_xlsx 0.51.0 → 0.54.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (160) hide show
  1. data/.gitignore +39 -0
  2. data/Gemfile +4 -14
  3. data/LICENSE.txt +3 -1
  4. data/README.rdoc +5 -0
  5. data/Rakefile +4 -71
  6. data/examples/chart_radar.rb +127 -0
  7. data/examples/chart_secondary_axis.rb +1 -1
  8. data/lib/write_xlsx/chart/area.rb +7 -18
  9. data/lib/write_xlsx/chart/bar.rb +20 -23
  10. data/lib/write_xlsx/chart/column.rb +7 -20
  11. data/lib/write_xlsx/chart/radar.rb +94 -0
  12. data/lib/write_xlsx/chart/stock.rb +6 -0
  13. data/lib/write_xlsx/chart.rb +317 -116
  14. data/lib/write_xlsx/package/xml_writer_simple.rb +2 -2
  15. data/lib/write_xlsx/version.rb +5 -0
  16. data/test/chart/test_write_a_latin.rb +22 -0
  17. data/test/chart/test_write_auto.rb +1 -1
  18. data/test/chart/test_write_ax_id.rb +1 -1
  19. data/test/chart/test_write_ax_pos.rb +1 -1
  20. data/test/chart/test_write_cross_ax.rb +1 -1
  21. data/test/chart/test_write_crosses.rb +1 -1
  22. data/test/chart/test_write_d_lbls.rb +18 -18
  23. data/test/chart/test_write_idx.rb +1 -1
  24. data/test/chart/test_write_label_align.rb +1 -1
  25. data/test/chart/test_write_label_offset.rb +1 -1
  26. data/test/chart/test_write_lang.rb +1 -1
  27. data/test/chart/test_write_layout.rb +1 -1
  28. data/test/chart/test_write_legend.rb +1 -1
  29. data/test/chart/test_write_legend_pos.rb +1 -1
  30. data/test/chart/test_write_major_gridlines.rb +2 -2
  31. data/test/chart/test_write_marker.rb +1 -1
  32. data/test/chart/test_write_marker_size.rb +1 -1
  33. data/test/chart/test_write_marker_value.rb +1 -1
  34. data/test/chart/test_write_num_cache.rb +1 -1
  35. data/test/chart/test_write_number_format.rb +40 -2
  36. data/test/chart/test_write_order.rb +1 -1
  37. data/test/chart/test_write_orientation.rb +1 -1
  38. data/test/chart/test_write_page_margins.rb +1 -1
  39. data/test/chart/test_write_page_setup.rb +1 -1
  40. data/test/chart/test_write_plot_vis_only.rb +1 -1
  41. data/test/chart/test_write_pt_count.rb +1 -1
  42. data/test/chart/test_write_style.rb +1 -1
  43. data/test/chart/test_write_symbol.rb +1 -1
  44. data/test/chart/test_write_tick_lbl_pos.rb +1 -1
  45. data/test/drawing/test_write_a_graphic_frame_locks.rb +1 -1
  46. data/test/drawing/test_write_c_chart.rb +1 -1
  47. data/test/drawing/test_write_c_nv_graphic_frame_pr.rb +2 -2
  48. data/test/drawing/test_write_c_nv_pr.rb +1 -1
  49. data/test/drawing/test_write_ext.rb +1 -1
  50. data/test/drawing/test_write_pos.rb +1 -1
  51. data/test/drawing/test_write_xfrm_extension.rb +1 -1
  52. data/test/drawing/test_write_xfrm_offset.rb +1 -1
  53. data/test/helper.rb +1 -1
  54. data/test/package/content_types/test_write_default.rb +1 -1
  55. data/test/package/content_types/test_write_override.rb +1 -1
  56. data/test/package/table/test_write_auto_filter.rb +1 -1
  57. data/test/package/table/test_write_table_column.rb +1 -1
  58. data/test/package/table/test_write_table_style_info.rb +1 -1
  59. data/test/package/vml/test_write_fill.rb +1 -1
  60. data/test/package/vml/test_write_idmap.rb +1 -1
  61. data/test/package/vml/test_write_move_with_cells.rb +1 -1
  62. data/test/package/vml/test_write_path.rb +2 -2
  63. data/test/package/vml/test_write_shadow.rb +1 -1
  64. data/test/package/vml/test_write_shapelayout.rb +1 -1
  65. data/test/package/vml/test_write_shapetype.rb +1 -1
  66. data/test/package/vml/test_write_size_with_cells.rb +1 -1
  67. data/test/package/vml/test_write_stroke.rb +1 -1
  68. data/test/perl_output/chart_radar.xlsx +0 -0
  69. data/test/perl_output/chart_secondary_axis.xlsx +0 -0
  70. data/test/regression/test_chart_axis22.rb +45 -0
  71. data/test/regression/test_chart_axis23.rb +46 -0
  72. data/test/regression/test_chart_axis24.rb +46 -0
  73. data/test/regression/test_chart_font01.rb +54 -0
  74. data/test/regression/test_chart_font02.rb +56 -0
  75. data/test/regression/test_chart_font03.rb +59 -0
  76. data/test/regression/test_chart_font04.rb +57 -0
  77. data/test/regression/test_chart_font05.rb +54 -0
  78. data/test/regression/test_chart_font06.rb +84 -0
  79. data/test/regression/test_chart_radar01.rb +39 -0
  80. data/test/regression/test_chart_radar02.rb +43 -0
  81. data/test/regression/test_chart_radar03.rb +43 -0
  82. data/test/regression/test_escapes04.rb +30 -0
  83. data/test/regression/test_escapes05.rb +31 -0
  84. data/test/regression/test_rich_string01.rb +1 -1
  85. data/test/regression/test_rich_string02.rb +1 -1
  86. data/test/regression/test_rich_string03.rb +1 -1
  87. data/test/regression/test_rich_string04.rb +1 -1
  88. data/test/regression/test_rich_string05.rb +1 -1
  89. data/test/regression/test_rich_string06.rb +1 -1
  90. data/test/regression/test_rich_string07.rb +1 -1
  91. data/test/regression/test_rich_string08.rb +1 -1
  92. data/test/regression/test_rich_string09.rb +1 -1
  93. data/test/regression/test_rich_string10.rb +1 -1
  94. data/test/regression/test_rich_string11.rb +1 -1
  95. data/test/regression/test_shape_connect01.rb +1 -1
  96. data/test/regression/test_shape_connect02.rb +1 -1
  97. data/test/regression/test_shape_connect03.rb +1 -1
  98. data/test/regression/test_shape_connect04.rb +1 -1
  99. data/test/regression/xlsx_files/chart_axis22.xlsx +0 -0
  100. data/test/regression/xlsx_files/chart_axis23.xlsx +0 -0
  101. data/test/regression/xlsx_files/chart_axis24.xlsx +0 -0
  102. data/test/regression/xlsx_files/chart_font01.xlsx +0 -0
  103. data/test/regression/xlsx_files/chart_font02.xlsx +0 -0
  104. data/test/regression/xlsx_files/chart_font03.xlsx +0 -0
  105. data/test/regression/xlsx_files/chart_font04.xlsx +0 -0
  106. data/test/regression/xlsx_files/chart_font05.xlsx +0 -0
  107. data/test/regression/xlsx_files/chart_font06.xlsx +0 -0
  108. data/test/regression/xlsx_files/chart_radar01.xlsx +0 -0
  109. data/test/regression/xlsx_files/chart_radar02.xlsx +0 -0
  110. data/test/regression/xlsx_files/chart_radar03.xlsx +0 -0
  111. data/test/regression/xlsx_files/escapes04.xlsx +0 -0
  112. data/test/regression/xlsx_files/escapes05.xlsx +0 -0
  113. data/test/test_example_match.rb +119 -1
  114. data/test/test_xml_writer_simple.rb +4 -4
  115. data/test/worksheet/test_write_autofilter.rb +21 -21
  116. data/test/worksheet/test_write_brk.rb +1 -1
  117. data/test/worksheet/test_write_col_breaks.rb +2 -2
  118. data/test/worksheet/test_write_col_info.rb +6 -6
  119. data/test/worksheet/test_write_custom_filter.rb +1 -1
  120. data/test/worksheet/test_write_custom_filters.rb +2 -2
  121. data/test/worksheet/test_write_dimension.rb +9 -9
  122. data/test/worksheet/test_write_ext.rb +1 -1
  123. data/test/worksheet/test_write_ext_lst.rb +1 -1
  124. data/test/worksheet/test_write_filter.rb +1 -1
  125. data/test/worksheet/test_write_filter_column.rb +1 -1
  126. data/test/worksheet/test_write_filters.rb +3 -3
  127. data/test/worksheet/test_write_hyperlink.rb +4 -4
  128. data/test/worksheet/test_write_hyperlinks.rb +2 -2
  129. data/test/worksheet/test_write_legacy_drawing.rb +1 -1
  130. data/test/worksheet/test_write_merge_cell.rb +1 -1
  131. data/test/worksheet/test_write_mx_plv.rb +1 -1
  132. data/test/worksheet/test_write_page_margins.rb +11 -11
  133. data/test/worksheet/test_write_page_set_up_pr.rb +1 -1
  134. data/test/worksheet/test_write_page_setup.rb +4 -4
  135. data/test/worksheet/test_write_pane.rb +14 -14
  136. data/test/worksheet/test_write_phonetic_pr.rb +1 -1
  137. data/test/worksheet/test_write_print_options.rb +5 -5
  138. data/test/worksheet/test_write_row_breaks.rb +2 -2
  139. data/test/worksheet/test_write_row_element.rb +1 -1
  140. data/test/worksheet/test_write_selection.rb +1 -1
  141. data/test/worksheet/test_write_sheet_calc_pr.rb +1 -1
  142. data/test/worksheet/test_write_sheet_data.rb +1 -1
  143. data/test/worksheet/test_write_sheet_format_pr.rb +1 -1
  144. data/test/worksheet/test_write_sheet_pr.rb +3 -3
  145. data/test/worksheet/test_write_sheet_protection.rb +18 -18
  146. data/test/worksheet/test_write_sheet_view.rb +6 -6
  147. data/test/worksheet/test_write_sheet_view1.rb +6 -6
  148. data/test/worksheet/test_write_sheet_view2.rb +5 -5
  149. data/test/worksheet/test_write_sheet_view3.rb +8 -8
  150. data/test/worksheet/test_write_sheet_view4.rb +8 -8
  151. data/test/worksheet/test_write_sheet_view5.rb +7 -7
  152. data/test/worksheet/test_write_sheet_view6.rb +4 -4
  153. data/test/worksheet/test_write_sheet_view7.rb +6 -6
  154. data/test/worksheet/test_write_sheet_view8.rb +4 -4
  155. data/test/worksheet/test_write_sheet_view9.rb +4 -4
  156. data/test/worksheet/test_write_tab_color.rb +1 -1
  157. data/write_xlsx.gemspec +18 -935
  158. metadata +881 -32
  159. data/VERSION +0 -1
  160. data/test/chart/test_write_num_fmt.rb +0 -16
@@ -39,12 +39,12 @@ module Writexlsx
39
39
  end
40
40
 
41
41
  def empty_tag(tag, attr = [])
42
- str = "<#{tag}#{key_vals(attr)} />"
42
+ str = "<#{tag}#{key_vals(attr)}/>"
43
43
  io_write(str)
44
44
  end
45
45
 
46
46
  def empty_tag_encoded(tag, attr = [])
47
- str = "<#{tag}#{key_vals(attr)} />"
47
+ str = "<#{tag}#{key_vals(attr)}/>"
48
48
  io_write(str)
49
49
  end
50
50
 
@@ -0,0 +1,5 @@
1
+ require 'write_xlsx/workbook'
2
+
3
+ class WriteXLSX < Writexlsx::Workbook
4
+ VERSION = "0.54.0"
5
+ end
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require 'helper'
3
+ require 'write_xlsx/chart'
4
+
5
+ class TestWriteALatin < Test::Unit::TestCase
6
+ def setup
7
+ @chart = Writexlsx::Chart.new('Bar')
8
+ end
9
+
10
+ def test_write_a_latin
11
+ expected = '<a:latin typeface="Arial" pitchFamily="34" charset="0"/>'
12
+
13
+ result = @chart.__send__('write_a_latin',
14
+ [
15
+ 'typeface', 'Arial',
16
+ 'pitchFamily', 34,
17
+ 'charset', 0
18
+ ]
19
+ )
20
+ assert_equal(expected, result)
21
+ end
22
+ end
@@ -8,7 +8,7 @@ class TestWriteAuto < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  def test_write_auto
11
- expected = '<c:auto val="1" />'
11
+ expected = '<c:auto val="1"/>'
12
12
  result = @chart.__send__('write_auto', 1)
13
13
  assert_equal(expected, result)
14
14
  end
@@ -8,7 +8,7 @@ class TestWriteAxId < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  def test_write_axis_id
11
- expected = '<c:axId val="53850880" />'
11
+ expected = '<c:axId val="53850880"/>'
12
12
  result = @chart.__send__('write_axis_id', 53850880)
13
13
  assert_equal(expected, result)
14
14
  end
@@ -8,7 +8,7 @@ class TestAxPos < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  def test_write_axis_pos
11
- expected = '<c:axPos val="l" />'
11
+ expected = '<c:axPos val="l"/>'
12
12
  result = @chart.__send__('write_axis_pos', 'l')
13
13
  assert_equal(expected, result)
14
14
  end
@@ -8,7 +8,7 @@ class TestWriteCrossAx < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  def test_write_cross_axis
11
- expected = '<c:crossAx val="82642816" />'
11
+ expected = '<c:crossAx val="82642816"/>'
12
12
  result = @chart.__send__('write_cross_axis', 82642816)
13
13
  assert_equal(expected, result)
14
14
  end
@@ -8,7 +8,7 @@ class TestWriteCrosses < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  def test_write_crosses
11
- expected = '<c:crosses val="autoZero" />'
11
+ expected = '<c:crosses val="autoZero"/>'
12
12
  result = @chart.__send__('write_crosses', 'autoZero')
13
13
  assert_equal(expected, result)
14
14
  end
@@ -8,7 +8,7 @@ class TestWriteDLbls < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  def test_write_d_lbls_value_only
11
- expected = '<c:dLbls><c:showVal val="1" /></c:dLbls>'
11
+ expected = '<c:dLbls><c:showVal val="1"/></c:dLbls>'
12
12
 
13
13
  labels = @chart.__send__(:get_labels_properties, :value => 1)
14
14
  @chart.__send__(:write_d_lbls, labels)
@@ -18,7 +18,7 @@ class TestWriteDLbls < Test::Unit::TestCase
18
18
  end
19
19
 
20
20
  def test_write_d_lbls_series_name_only
21
- expected = '<c:dLbls><c:showSerName val="1" /></c:dLbls>'
21
+ expected = '<c:dLbls><c:showSerName val="1"/></c:dLbls>'
22
22
 
23
23
  labels = @chart.__send__(:get_labels_properties, :series_name => 1)
24
24
  @chart.__send__(:write_d_lbls, labels)
@@ -28,7 +28,7 @@ class TestWriteDLbls < Test::Unit::TestCase
28
28
  end
29
29
 
30
30
  def test_write_d_lbls_category_only
31
- expected = '<c:dLbls><c:showCatName val="1" /></c:dLbls>'
31
+ expected = '<c:dLbls><c:showCatName val="1"/></c:dLbls>'
32
32
 
33
33
  labels = @chart.__send__(:get_labels_properties, :category => 1)
34
34
  @chart.__send__(:write_d_lbls, labels)
@@ -38,7 +38,7 @@ class TestWriteDLbls < Test::Unit::TestCase
38
38
  end
39
39
 
40
40
  def test_write_d_lbls_value_category_and_series
41
- expected = '<c:dLbls><c:showVal val="1" /><c:showCatName val="1" /><c:showSerName val="1" /></c:dLbls>'
41
+ expected = '<c:dLbls><c:showVal val="1"/><c:showCatName val="1"/><c:showSerName val="1"/></c:dLbls>'
42
42
 
43
43
  labels = @chart.__send__(:get_labels_properties,
44
44
  {
@@ -54,7 +54,7 @@ class TestWriteDLbls < Test::Unit::TestCase
54
54
  end
55
55
 
56
56
  def test_write_d_lbls_position_center
57
- expected = '<c:dLbls><c:dLblPos val="ctr" /><c:showVal val="1" /></c:dLbls>'
57
+ expected = '<c:dLbls><c:dLblPos val="ctr"/><c:showVal val="1"/></c:dLbls>'
58
58
 
59
59
  labels = @chart.__send__(:get_labels_properties,
60
60
  {
@@ -69,7 +69,7 @@ class TestWriteDLbls < Test::Unit::TestCase
69
69
  end
70
70
 
71
71
  def test_write_d_lbls_position_left
72
- expected = '<c:dLbls><c:dLblPos val="l" /><c:showVal val="1" /></c:dLbls>'
72
+ expected = '<c:dLbls><c:dLblPos val="l"/><c:showVal val="1"/></c:dLbls>'
73
73
 
74
74
  labels = @chart.__send__(:get_labels_properties,
75
75
  {
@@ -84,7 +84,7 @@ class TestWriteDLbls < Test::Unit::TestCase
84
84
  end
85
85
 
86
86
  def test_write_d_lbls_position_right
87
- expected = '<c:dLbls><c:dLblPos val="r" /><c:showVal val="1" /></c:dLbls>'
87
+ expected = '<c:dLbls><c:dLblPos val="r"/><c:showVal val="1"/></c:dLbls>'
88
88
 
89
89
  labels = @chart.__send__(:get_labels_properties,
90
90
  {
@@ -99,7 +99,7 @@ class TestWriteDLbls < Test::Unit::TestCase
99
99
  end
100
100
 
101
101
  def test_write_d_lbls_position_top
102
- expected = '<c:dLbls><c:dLblPos val="t" /><c:showVal val="1" /></c:dLbls>'
102
+ expected = '<c:dLbls><c:dLblPos val="t"/><c:showVal val="1"/></c:dLbls>'
103
103
 
104
104
  labels = @chart.__send__(:get_labels_properties,
105
105
  {
@@ -114,7 +114,7 @@ class TestWriteDLbls < Test::Unit::TestCase
114
114
  end
115
115
 
116
116
  def test_write_d_lbls_position_above
117
- expected = '<c:dLbls><c:dLblPos val="t" /><c:showVal val="1" /></c:dLbls>'
117
+ expected = '<c:dLbls><c:dLblPos val="t"/><c:showVal val="1"/></c:dLbls>'
118
118
 
119
119
  labels = @chart.__send__(:get_labels_properties,
120
120
  {
@@ -129,7 +129,7 @@ class TestWriteDLbls < Test::Unit::TestCase
129
129
  end
130
130
 
131
131
  def test_write_d_lbls_position_bottom
132
- expected = '<c:dLbls><c:dLblPos val="b" /><c:showVal val="1" /></c:dLbls>'
132
+ expected = '<c:dLbls><c:dLblPos val="b"/><c:showVal val="1"/></c:dLbls>'
133
133
 
134
134
  labels = @chart.__send__(:get_labels_properties,
135
135
  {
@@ -144,7 +144,7 @@ class TestWriteDLbls < Test::Unit::TestCase
144
144
  end
145
145
 
146
146
  def test_write_d_lbls_position_below
147
- expected = '<c:dLbls><c:dLblPos val="b" /><c:showVal val="1" /></c:dLbls>'
147
+ expected = '<c:dLbls><c:dLblPos val="b"/><c:showVal val="1"/></c:dLbls>'
148
148
 
149
149
  labels = @chart.__send__(:get_labels_properties,
150
150
  {
@@ -159,7 +159,7 @@ class TestWriteDLbls < Test::Unit::TestCase
159
159
  end
160
160
 
161
161
  def test_write_d_lbls_pie
162
- expected = '<c:dLbls><c:showVal val="1" /><c:showLeaderLines val="1" /></c:dLbls>'
162
+ expected = '<c:dLbls><c:showVal val="1"/><c:showLeaderLines val="1"/></c:dLbls>'
163
163
 
164
164
  labels = @chart.__send__(:get_labels_properties,
165
165
  {
@@ -174,7 +174,7 @@ class TestWriteDLbls < Test::Unit::TestCase
174
174
  end
175
175
 
176
176
  def test_write_d_lbls_pie_position_empty
177
- expected = '<c:dLbls><c:showVal val="1" /><c:showLeaderLines val="1" /></c:dLbls>'
177
+ expected = '<c:dLbls><c:showVal val="1"/><c:showLeaderLines val="1"/></c:dLbls>'
178
178
 
179
179
  labels = @chart.__send__(:get_labels_properties,
180
180
  {
@@ -190,7 +190,7 @@ class TestWriteDLbls < Test::Unit::TestCase
190
190
  end
191
191
 
192
192
  def test_write_d_lbls_pie_position_center
193
- expected = '<c:dLbls><c:dLblPos val="ctr" /><c:showVal val="1" /><c:showLeaderLines val="1" /></c:dLbls>'
193
+ expected = '<c:dLbls><c:dLblPos val="ctr"/><c:showVal val="1"/><c:showLeaderLines val="1"/></c:dLbls>'
194
194
 
195
195
  labels = @chart.__send__(:get_labels_properties,
196
196
  {
@@ -206,7 +206,7 @@ class TestWriteDLbls < Test::Unit::TestCase
206
206
  end
207
207
 
208
208
  def test_write_d_lbls_pie_position_inside_end
209
- expected = '<c:dLbls><c:dLblPos val="inEnd" /><c:showVal val="1" /><c:showLeaderLines val="1" /></c:dLbls>'
209
+ expected = '<c:dLbls><c:dLblPos val="inEnd"/><c:showVal val="1"/><c:showLeaderLines val="1"/></c:dLbls>'
210
210
 
211
211
  labels = @chart.__send__(:get_labels_properties,
212
212
  {
@@ -222,7 +222,7 @@ class TestWriteDLbls < Test::Unit::TestCase
222
222
  end
223
223
 
224
224
  def test_write_d_lbls_pie_position_outside_end
225
- expected = '<c:dLbls><c:dLblPos val="outEnd" /><c:showVal val="1" /><c:showLeaderLines val="1" /></c:dLbls>'
225
+ expected = '<c:dLbls><c:dLblPos val="outEnd"/><c:showVal val="1"/><c:showLeaderLines val="1"/></c:dLbls>'
226
226
 
227
227
  labels = @chart.__send__(:get_labels_properties,
228
228
  {
@@ -238,7 +238,7 @@ class TestWriteDLbls < Test::Unit::TestCase
238
238
  end
239
239
 
240
240
  def test_write_d_lbls_pie_position_best_fit
241
- expected = '<c:dLbls><c:dLblPos val="bestFit" /><c:showVal val="1" /><c:showLeaderLines val="1" /></c:dLbls>'
241
+ expected = '<c:dLbls><c:dLblPos val="bestFit"/><c:showVal val="1"/><c:showLeaderLines val="1"/></c:dLbls>'
242
242
 
243
243
  labels = @chart.__send__(:get_labels_properties,
244
244
  {
@@ -254,7 +254,7 @@ class TestWriteDLbls < Test::Unit::TestCase
254
254
  end
255
255
 
256
256
  def test_write_d_lbls_pie_percentage
257
- expected = '<c:dLbls><c:showPercent val="1" /><c:showLeaderLines val="1" /></c:dLbls>'
257
+ expected = '<c:dLbls><c:showPercent val="1"/><c:showLeaderLines val="1"/></c:dLbls>'
258
258
 
259
259
  labels = @chart.__send__(:get_labels_properties,
260
260
  {
@@ -8,7 +8,7 @@ class TestWriteIdx < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  def test_write_idx
11
- expected = '<c:idx val="0" />'
11
+ expected = '<c:idx val="0"/>'
12
12
  result = @chart.__send__('write_idx', 0)
13
13
  assert_equal(expected, result)
14
14
  end
@@ -8,7 +8,7 @@ class TestWriteLabelAlign < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  def test_write_label_align
11
- expected = '<c:lblAlgn val="ctr" />'
11
+ expected = '<c:lblAlgn val="ctr"/>'
12
12
  result = @chart.__send__('write_label_align', 'ctr')
13
13
  assert_equal(expected, result)
14
14
  end
@@ -8,7 +8,7 @@ class TestWriteLabelOffset < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  def test_write_label_offset
11
- expected = '<c:lblOffset val="100" />'
11
+ expected = '<c:lblOffset val="100"/>'
12
12
  result = @chart.__send__('write_label_offset', 100)
13
13
  assert_equal(expected, result)
14
14
  end
@@ -8,7 +8,7 @@ class TestWriteLang < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  def test_write_lang
11
- expected = '<c:lang val="en-US" />'
11
+ expected = '<c:lang val="en-US"/>'
12
12
  result = @chart.__send__('write_lang')
13
13
  assert_equal(expected, result)
14
14
  end
@@ -8,7 +8,7 @@ class TestWriteLayout < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  def test_write_idx
11
- expected = '<c:layout />'
11
+ expected = '<c:layout/>'
12
12
  result = @chart.__send__('write_layout')
13
13
  assert_equal(expected, result)
14
14
  end
@@ -8,7 +8,7 @@ class TestWriteLegend < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  def test_write_legend
11
- expected = '<c:legend><c:legendPos val="r" /><c:layout /></c:legend>'
11
+ expected = '<c:legend><c:legendPos val="r"/><c:layout/></c:legend>'
12
12
  @chart.__send__('write_legend')
13
13
  result = @chart.instance_variable_get(:@writer).string
14
14
  assert_equal(expected, result)
@@ -8,7 +8,7 @@ class TestWriteLegendPos < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  def test_write_legend_pos
11
- expected = '<c:legendPos val="r" />'
11
+ expected = '<c:legendPos val="r"/>'
12
12
  result = @chart.__send__('write_legend_pos', 'r')
13
13
  assert_equal(expected, result)
14
14
  end
@@ -8,8 +8,8 @@ class TestWriteMajorGridlines < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  def test_write_major_gridlines
11
- expected = '<c:majorGridlines />'
12
- result = @chart.__send__('write_major_gridlines', {:visible => 1})
11
+ expected = '<c:majorGridlines/>'
12
+ result = @chart.__send__('write_major_gridlines', {:_visible => 1})
13
13
  assert_equal(expected, result)
14
14
  end
15
15
  end
@@ -8,7 +8,7 @@ class TestWriteMarker < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  def test_write_marker
11
- expected = '<c:marker><c:symbol val="none" /></c:marker>'
11
+ expected = '<c:marker><c:symbol val="none"/></c:marker>'
12
12
  @chart.instance_variable_set(:@default_marker, { :type => 'none'})
13
13
  @chart.__send__('write_marker')
14
14
  result = @chart.instance_variable_get(:@writer).string
@@ -8,7 +8,7 @@ class TestWriteMarkerSize < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  def test_write_marker_size
11
- expected = '<c:size val="3" />'
11
+ expected = '<c:size val="3"/>'
12
12
  result = @chart.__send__('write_marker_size', 3)
13
13
  assert_equal(expected, result)
14
14
  end
@@ -8,7 +8,7 @@ class TestWriteMarkerValue < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  def test_write_marker_value
11
- expected = '<c:marker val="1" />'
11
+ expected = '<c:marker val="1"/>'
12
12
  @chart.instance_variable_set(:@default_marker, 'none')
13
13
  result = @chart.__send__('write_marker_value')
14
14
  assert_equal(expected, result)
@@ -8,7 +8,7 @@ class TestWriteNumCache < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  def test_write_num_cache
11
- expected = '<c:numCache><c:formatCode>General</c:formatCode><c:ptCount val="5" /><c:pt idx="0"><c:v>1</c:v></c:pt><c:pt idx="1"><c:v>2</c:v></c:pt><c:pt idx="2"><c:v>3</c:v></c:pt><c:pt idx="3"><c:v>4</c:v></c:pt><c:pt idx="4"><c:v>5</c:v></c:pt></c:numCache>'
11
+ expected = '<c:numCache><c:formatCode>General</c:formatCode><c:ptCount val="5"/><c:pt idx="0"><c:v>1</c:v></c:pt><c:pt idx="1"><c:v>2</c:v></c:pt><c:pt idx="2"><c:v>3</c:v></c:pt><c:pt idx="3"><c:v>4</c:v></c:pt><c:pt idx="4"><c:v>5</c:v></c:pt></c:numCache>'
12
12
  @chart.__send__('write_num_cache', [1, 2, 3, 4, 5])
13
13
  result = @chart.instance_variable_get(:@writer).string
14
14
  assert_equal(expected, result)
@@ -8,8 +8,46 @@ class TestWriteNumberFormat < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  def test_write_number_format
11
- expected = '<c:numFmt formatCode="General" sourceLinked="1" />'
12
- result = @chart.__send__('write_number_format')
11
+ expected = '<c:numFmt formatCode="General" sourceLinked="1"/>'
12
+ result = @chart.__send__('write_number_format',
13
+ {
14
+ :_num_format => 'General',
15
+ :defaults => { :num_format => 'General' }
16
+ }
17
+ )
18
+ assert_equal(expected, result)
19
+ end
20
+
21
+ def test_write_number_format02
22
+ expected = '<c:numFmt formatCode="#,##0.00" sourceLinked="0"/>'
23
+ result = @chart.__send__('write_number_format',
24
+ {
25
+ :_num_format => '#,##0.00',
26
+ :_defaults => { :num_format => 'General' }
27
+ }
28
+ )
29
+ assert_equal(expected, result)
30
+ end
31
+
32
+ def test_write_number_format03
33
+ expected = ''
34
+ result = @chart.__send__('write_cat_number_format',
35
+ {
36
+ :_num_format => 'General',
37
+ :_defaults => { :num_format => 'General' }
38
+ }
39
+ )
40
+ assert_equal(expected, result)
41
+ end
42
+
43
+ def test_write_number_format04
44
+ expected = '<c:numFmt formatCode="#,##0.00" sourceLinked="0"/>'
45
+ result = @chart.__send__('write_cat_number_format',
46
+ {
47
+ :_num_format => '#,##0.00',
48
+ :_defaults => { :num_format => 'General' }
49
+ }
50
+ )
13
51
  assert_equal(expected, result)
14
52
  end
15
53
  end
@@ -8,7 +8,7 @@ class TestWriteOrder < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  def test_write_order
11
- expected = '<c:order val="0" />'
11
+ expected = '<c:order val="0"/>'
12
12
  result = @chart.__send__('write_order', 0)
13
13
  assert_equal(expected, result)
14
14
  end
@@ -8,7 +8,7 @@ class TestWriteOrientation < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  def test_write_orientation
11
- expected = '<c:orientation val="minMax" />'
11
+ expected = '<c:orientation val="minMax"/>'
12
12
  result = @chart.__send__('write_orientation')
13
13
  assert_equal(expected, result)
14
14
  end
@@ -8,7 +8,7 @@ class TestChartWritePageMargins < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  def test_write_page_margins
11
- expected = '<c:pageMargins b="0.75" l="0.7" r="0.7" t="0.75" header="0.3" footer="0.3" />'
11
+ expected = '<c:pageMargins b="0.75" l="0.7" r="0.7" t="0.75" header="0.3" footer="0.3"/>'
12
12
  result = @chart.__send__('write_page_margins')
13
13
  assert_equal(expected, result)
14
14
  end
@@ -8,7 +8,7 @@ class TestChartWritePageSetup < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  def test_write_page_setup
11
- expected = '<c:pageSetup />'
11
+ expected = '<c:pageSetup/>'
12
12
  result = @chart.__send__('write_page_setup')
13
13
  assert_equal(expected, result)
14
14
  end
@@ -8,7 +8,7 @@ class TestWritePlotVisOnly < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  def test_write_plot_vis_only
11
- expected = '<c:plotVisOnly val="1" />'
11
+ expected = '<c:plotVisOnly val="1"/>'
12
12
  result = @chart.__send__('write_plot_vis_only')
13
13
  assert_equal(expected, result)
14
14
  end
@@ -8,7 +8,7 @@ class TestWritePtCount < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  def test_write_pt_count
11
- expected = '<c:ptCount val="5" />'
11
+ expected = '<c:ptCount val="5"/>'
12
12
  @chart.__send__('write_pt_count', 5)
13
13
  result = @chart.instance_variable_get(:@writer).string
14
14
  assert_equal(expected, result)
@@ -8,7 +8,7 @@ class TestWriteStyle < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  def test_write_style_1
11
- expected = '<c:style val="1" />'
11
+ expected = '<c:style val="1"/>'
12
12
  @chart.set_style(1)
13
13
  @chart.__send__('write_style')
14
14
  result = @chart.instance_variable_get(:@writer).string
@@ -8,7 +8,7 @@ class TestWriteSymbol < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  def test_write_symbol
11
- expected = '<c:symbol val="none" />'
11
+ expected = '<c:symbol val="none"/>'
12
12
  @chart.__send__('write_symbol', 'none')
13
13
  result = @chart.instance_variable_get(:@writer).string
14
14
  assert_equal(expected, result)
@@ -8,7 +8,7 @@ class TestWriteTickLabelPos < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  def test_write_tick_label_pos
11
- expected = '<c:tickLblPos val="nextTo" />'
11
+ expected = '<c:tickLblPos val="nextTo"/>'
12
12
  @chart.__send__('write_tick_label_pos', 'nextTo')
13
13
  result = @chart.instance_variable_get(:@writer).string
14
14
  assert_equal(expected, result)
@@ -8,7 +8,7 @@ class TestWriteAGraphicFrameLocks < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  def test_write_a_graphic_frame_locks
11
- expected = '<a:graphicFrameLocks noGrp="1" />'
11
+ expected = '<a:graphicFrameLocks noGrp="1"/>'
12
12
 
13
13
  @drawing.__send__(:write_a_graphic_frame_locks)
14
14
  result = @drawing.instance_variable_get(:@writer).string
@@ -8,7 +8,7 @@ class TestWriteCChart < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  def test_write_c_chart
11
- expected = '<c:chart xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" r:id="rId1" />'
11
+ expected = '<c:chart xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" r:id="rId1"/>'
12
12
 
13
13
  @drawing.__send__(:write_c_chart, 'rId1')
14
14
  result = @drawing.instance_variable_get(:@writer).string
@@ -8,7 +8,7 @@ class TestWriteCNvGraphicFramePr < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  def test_write_c_nv_graphic_frame_pr_01
11
- expected = '<xdr:cNvGraphicFramePr />'
11
+ expected = '<xdr:cNvGraphicFramePr/>'
12
12
 
13
13
  @drawing.instance_variable_set(:@embedded, 1)
14
14
  @drawing.__send__(:write_c_nv_graphic_frame_pr)
@@ -18,7 +18,7 @@ class TestWriteCNvGraphicFramePr < Test::Unit::TestCase
18
18
  end
19
19
 
20
20
  def test_write_c_nv_graphic_frame_pr_02
21
- expected = '<xdr:cNvGraphicFramePr><a:graphicFrameLocks noGrp="1" /></xdr:cNvGraphicFramePr>'
21
+ expected = '<xdr:cNvGraphicFramePr><a:graphicFrameLocks noGrp="1"/></xdr:cNvGraphicFramePr>'
22
22
 
23
23
  @drawing.__send__(:write_c_nv_graphic_frame_pr)
24
24
  result = @drawing.instance_variable_get(:@writer).string
@@ -8,7 +8,7 @@ class TestWriteCNvPr < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  def test_write_c_nv_pr
11
- expected = '<xdr:cNvPr id="2" name="Chart 1" />'
11
+ expected = '<xdr:cNvPr id="2" name="Chart 1"/>'
12
12
 
13
13
  @drawing.__send__(:write_c_nv_pr, 2, 'Chart 1')
14
14
  result = @drawing.instance_variable_get(:@writer).string
@@ -8,7 +8,7 @@ class TestWriteExt < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  def test_write_ext
11
- expected = '<xdr:ext cx="9308969" cy="6078325" />'
11
+ expected = '<xdr:ext cx="9308969" cy="6078325"/>'
12
12
 
13
13
  @drawing.__send__(:write_ext, 9308969, 6078325)
14
14
  result = @drawing.instance_variable_get(:@writer).string
@@ -8,7 +8,7 @@ class TestWritePos < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  def test_write_pos
11
- expected = '<xdr:pos x="0" y="0" />'
11
+ expected = '<xdr:pos x="0" y="0"/>'
12
12
 
13
13
  @drawing.__send__(:write_pos, 0, 0)
14
14
  result = @drawing.instance_variable_get(:@writer).string
@@ -8,7 +8,7 @@ class TestWriteXfrmExtension < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  def test_write_xfrm_extension
11
- expected = '<a:ext cx="0" cy="0" />'
11
+ expected = '<a:ext cx="0" cy="0"/>'
12
12
 
13
13
  @drawing.__send__(:write_xfrm_extension)
14
14
  result = @drawing.instance_variable_get(:@writer).string
@@ -8,7 +8,7 @@ class TestWriteXfrmOffset < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  def test_write_xfrm_offset
11
- expected = '<a:off x="0" y="0" />'
11
+ expected = '<a:off x="0" y="0"/>'
12
12
 
13
13
  @drawing.__send__(:write_xfrm_offset)
14
14
  result = @drawing.instance_variable_get(:@writer).string
data/test/helper.rb CHANGED
@@ -33,7 +33,7 @@ class Test::Unit::TestCase
33
33
  def expected_to_array(lines)
34
34
  array = []
35
35
  lines.each_line do |line|
36
- str = line.chomp.sub(%r!/>$!, ' />').sub(/^\s+/, '')
36
+ str = line.chomp.sub(/^\s+/, '')
37
37
  array << str unless str == ''
38
38
  end
39
39
  array
@@ -7,7 +7,7 @@ class TestWriteDefault < Test::Unit::TestCase
7
7
  @obj = Writexlsx::Package::ContentTypes.new
8
8
  @obj.__send__('write_default', 'xml', 'application/xml')
9
9
  result = @obj.xml_str
10
- expected = '<Default Extension="xml" ContentType="application/xml" />'
10
+ expected = '<Default Extension="xml" ContentType="application/xml"/>'
11
11
  assert_equal(expected, result)
12
12
  end
13
13
  end