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.
- data/.gitignore +39 -0
- data/Gemfile +4 -14
- data/LICENSE.txt +3 -1
- data/README.rdoc +5 -0
- data/Rakefile +4 -71
- data/examples/chart_radar.rb +127 -0
- data/examples/chart_secondary_axis.rb +1 -1
- data/lib/write_xlsx/chart/area.rb +7 -18
- data/lib/write_xlsx/chart/bar.rb +20 -23
- data/lib/write_xlsx/chart/column.rb +7 -20
- data/lib/write_xlsx/chart/radar.rb +94 -0
- data/lib/write_xlsx/chart/stock.rb +6 -0
- data/lib/write_xlsx/chart.rb +317 -116
- data/lib/write_xlsx/package/xml_writer_simple.rb +2 -2
- data/lib/write_xlsx/version.rb +5 -0
- data/test/chart/test_write_a_latin.rb +22 -0
- data/test/chart/test_write_auto.rb +1 -1
- data/test/chart/test_write_ax_id.rb +1 -1
- data/test/chart/test_write_ax_pos.rb +1 -1
- data/test/chart/test_write_cross_ax.rb +1 -1
- data/test/chart/test_write_crosses.rb +1 -1
- data/test/chart/test_write_d_lbls.rb +18 -18
- data/test/chart/test_write_idx.rb +1 -1
- data/test/chart/test_write_label_align.rb +1 -1
- data/test/chart/test_write_label_offset.rb +1 -1
- data/test/chart/test_write_lang.rb +1 -1
- data/test/chart/test_write_layout.rb +1 -1
- data/test/chart/test_write_legend.rb +1 -1
- data/test/chart/test_write_legend_pos.rb +1 -1
- data/test/chart/test_write_major_gridlines.rb +2 -2
- data/test/chart/test_write_marker.rb +1 -1
- data/test/chart/test_write_marker_size.rb +1 -1
- data/test/chart/test_write_marker_value.rb +1 -1
- data/test/chart/test_write_num_cache.rb +1 -1
- data/test/chart/test_write_number_format.rb +40 -2
- data/test/chart/test_write_order.rb +1 -1
- data/test/chart/test_write_orientation.rb +1 -1
- data/test/chart/test_write_page_margins.rb +1 -1
- data/test/chart/test_write_page_setup.rb +1 -1
- data/test/chart/test_write_plot_vis_only.rb +1 -1
- data/test/chart/test_write_pt_count.rb +1 -1
- data/test/chart/test_write_style.rb +1 -1
- data/test/chart/test_write_symbol.rb +1 -1
- data/test/chart/test_write_tick_lbl_pos.rb +1 -1
- data/test/drawing/test_write_a_graphic_frame_locks.rb +1 -1
- data/test/drawing/test_write_c_chart.rb +1 -1
- data/test/drawing/test_write_c_nv_graphic_frame_pr.rb +2 -2
- data/test/drawing/test_write_c_nv_pr.rb +1 -1
- data/test/drawing/test_write_ext.rb +1 -1
- data/test/drawing/test_write_pos.rb +1 -1
- data/test/drawing/test_write_xfrm_extension.rb +1 -1
- data/test/drawing/test_write_xfrm_offset.rb +1 -1
- data/test/helper.rb +1 -1
- data/test/package/content_types/test_write_default.rb +1 -1
- data/test/package/content_types/test_write_override.rb +1 -1
- data/test/package/table/test_write_auto_filter.rb +1 -1
- data/test/package/table/test_write_table_column.rb +1 -1
- data/test/package/table/test_write_table_style_info.rb +1 -1
- data/test/package/vml/test_write_fill.rb +1 -1
- data/test/package/vml/test_write_idmap.rb +1 -1
- data/test/package/vml/test_write_move_with_cells.rb +1 -1
- data/test/package/vml/test_write_path.rb +2 -2
- data/test/package/vml/test_write_shadow.rb +1 -1
- data/test/package/vml/test_write_shapelayout.rb +1 -1
- data/test/package/vml/test_write_shapetype.rb +1 -1
- data/test/package/vml/test_write_size_with_cells.rb +1 -1
- data/test/package/vml/test_write_stroke.rb +1 -1
- data/test/perl_output/chart_radar.xlsx +0 -0
- data/test/perl_output/chart_secondary_axis.xlsx +0 -0
- data/test/regression/test_chart_axis22.rb +45 -0
- data/test/regression/test_chart_axis23.rb +46 -0
- data/test/regression/test_chart_axis24.rb +46 -0
- data/test/regression/test_chart_font01.rb +54 -0
- data/test/regression/test_chart_font02.rb +56 -0
- data/test/regression/test_chart_font03.rb +59 -0
- data/test/regression/test_chart_font04.rb +57 -0
- data/test/regression/test_chart_font05.rb +54 -0
- data/test/regression/test_chart_font06.rb +84 -0
- data/test/regression/test_chart_radar01.rb +39 -0
- data/test/regression/test_chart_radar02.rb +43 -0
- data/test/regression/test_chart_radar03.rb +43 -0
- data/test/regression/test_escapes04.rb +30 -0
- data/test/regression/test_escapes05.rb +31 -0
- data/test/regression/test_rich_string01.rb +1 -1
- data/test/regression/test_rich_string02.rb +1 -1
- data/test/regression/test_rich_string03.rb +1 -1
- data/test/regression/test_rich_string04.rb +1 -1
- data/test/regression/test_rich_string05.rb +1 -1
- data/test/regression/test_rich_string06.rb +1 -1
- data/test/regression/test_rich_string07.rb +1 -1
- data/test/regression/test_rich_string08.rb +1 -1
- data/test/regression/test_rich_string09.rb +1 -1
- data/test/regression/test_rich_string10.rb +1 -1
- data/test/regression/test_rich_string11.rb +1 -1
- data/test/regression/test_shape_connect01.rb +1 -1
- data/test/regression/test_shape_connect02.rb +1 -1
- data/test/regression/test_shape_connect03.rb +1 -1
- data/test/regression/test_shape_connect04.rb +1 -1
- data/test/regression/xlsx_files/chart_axis22.xlsx +0 -0
- data/test/regression/xlsx_files/chart_axis23.xlsx +0 -0
- data/test/regression/xlsx_files/chart_axis24.xlsx +0 -0
- data/test/regression/xlsx_files/chart_font01.xlsx +0 -0
- data/test/regression/xlsx_files/chart_font02.xlsx +0 -0
- data/test/regression/xlsx_files/chart_font03.xlsx +0 -0
- data/test/regression/xlsx_files/chart_font04.xlsx +0 -0
- data/test/regression/xlsx_files/chart_font05.xlsx +0 -0
- data/test/regression/xlsx_files/chart_font06.xlsx +0 -0
- data/test/regression/xlsx_files/chart_radar01.xlsx +0 -0
- data/test/regression/xlsx_files/chart_radar02.xlsx +0 -0
- data/test/regression/xlsx_files/chart_radar03.xlsx +0 -0
- data/test/regression/xlsx_files/escapes04.xlsx +0 -0
- data/test/regression/xlsx_files/escapes05.xlsx +0 -0
- data/test/test_example_match.rb +119 -1
- data/test/test_xml_writer_simple.rb +4 -4
- data/test/worksheet/test_write_autofilter.rb +21 -21
- data/test/worksheet/test_write_brk.rb +1 -1
- data/test/worksheet/test_write_col_breaks.rb +2 -2
- data/test/worksheet/test_write_col_info.rb +6 -6
- data/test/worksheet/test_write_custom_filter.rb +1 -1
- data/test/worksheet/test_write_custom_filters.rb +2 -2
- data/test/worksheet/test_write_dimension.rb +9 -9
- data/test/worksheet/test_write_ext.rb +1 -1
- data/test/worksheet/test_write_ext_lst.rb +1 -1
- data/test/worksheet/test_write_filter.rb +1 -1
- data/test/worksheet/test_write_filter_column.rb +1 -1
- data/test/worksheet/test_write_filters.rb +3 -3
- data/test/worksheet/test_write_hyperlink.rb +4 -4
- data/test/worksheet/test_write_hyperlinks.rb +2 -2
- data/test/worksheet/test_write_legacy_drawing.rb +1 -1
- data/test/worksheet/test_write_merge_cell.rb +1 -1
- data/test/worksheet/test_write_mx_plv.rb +1 -1
- data/test/worksheet/test_write_page_margins.rb +11 -11
- data/test/worksheet/test_write_page_set_up_pr.rb +1 -1
- data/test/worksheet/test_write_page_setup.rb +4 -4
- data/test/worksheet/test_write_pane.rb +14 -14
- data/test/worksheet/test_write_phonetic_pr.rb +1 -1
- data/test/worksheet/test_write_print_options.rb +5 -5
- data/test/worksheet/test_write_row_breaks.rb +2 -2
- data/test/worksheet/test_write_row_element.rb +1 -1
- data/test/worksheet/test_write_selection.rb +1 -1
- data/test/worksheet/test_write_sheet_calc_pr.rb +1 -1
- data/test/worksheet/test_write_sheet_data.rb +1 -1
- data/test/worksheet/test_write_sheet_format_pr.rb +1 -1
- data/test/worksheet/test_write_sheet_pr.rb +3 -3
- data/test/worksheet/test_write_sheet_protection.rb +18 -18
- data/test/worksheet/test_write_sheet_view.rb +6 -6
- data/test/worksheet/test_write_sheet_view1.rb +6 -6
- data/test/worksheet/test_write_sheet_view2.rb +5 -5
- data/test/worksheet/test_write_sheet_view3.rb +8 -8
- data/test/worksheet/test_write_sheet_view4.rb +8 -8
- data/test/worksheet/test_write_sheet_view5.rb +7 -7
- data/test/worksheet/test_write_sheet_view6.rb +4 -4
- data/test/worksheet/test_write_sheet_view7.rb +6 -6
- data/test/worksheet/test_write_sheet_view8.rb +4 -4
- data/test/worksheet/test_write_sheet_view9.rb +4 -4
- data/test/worksheet/test_write_tab_color.rb +1 -1
- data/write_xlsx.gemspec +18 -935
- metadata +881 -32
- data/VERSION +0 -1
- 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,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 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"
|
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"
|
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"
|
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"
|
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"
|
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"
|
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"
|
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"
|
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"
|
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"
|
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"
|
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"
|
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"
|
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"
|
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"
|
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"
|
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"
|
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"
|
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 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 TestWriteLegend < Test::Unit::TestCase
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def test_write_legend
|
11
|
-
expected = '<c:legend><c:legendPos val="r"
|
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,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', {:
|
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"
|
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 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"
|
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 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 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 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"
|
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 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
@@ -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
|