diff options
| author | randym <[email protected]> | 2017-04-01 18:46:12 +0900 |
|---|---|---|
| committer | randym <[email protected]> | 2017-04-01 18:46:12 +0900 |
| commit | f85e6cfea2f121a104ddf015928a05c88d2f9373 (patch) | |
| tree | 772f89ba7d1149d7ec5d3835b0b94ae760259197 /test/drawing/tc_chart.rb | |
| parent | 83e23982914e87bb4f2feb00c508580b8fa85cdb (diff) | |
| download | caxlsx-f85e6cfea2f121a104ddf015928a05c88d2f9373.tar.gz caxlsx-f85e6cfea2f121a104ddf015928a05c88d2f9373.zip | |
chore(test): update tests for depreciated methods
Diffstat (limited to 'test/drawing/tc_chart.rb')
| -rw-r--r-- | test/drawing/tc_chart.rb | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/test/drawing/tc_chart.rb b/test/drawing/tc_chart.rb index 8b69e73a..64a5435b 100644 --- a/test/drawing/tc_chart.rb +++ b/test/drawing/tc_chart.rb @@ -6,7 +6,7 @@ class TestChart < Test::Unit::TestCase @p = Axlsx::Package.new ws = @p.workbook.add_worksheet @row = ws.add_row ["one", 1, Time.now] - @chart = ws.add_chart Axlsx::Bar3DChart, :title => "fishery" + @chart = ws.add_chart Axlsx::Bar3DChart, :title => "fishery", :bg_color => "000000" end def teardown @@ -27,17 +27,30 @@ class TestChart < Test::Unit::TestCase assert_equal(@chart.title.cell, @row.cells.first) end + def test_style + assert_raise(ArgumentError) { @chart.style = 49 } + assert_nothing_raised { @chart.style = 2 } + assert_equal(@chart.style, 2) + end + def test_to_from_marker_access assert(@chart.to.is_a?(Axlsx::Marker)) assert(@chart.from.is_a?(Axlsx::Marker)) end - def test_style - assert_raise(ArgumentError) { @chart.style = 49 } - assert_nothing_raised { @chart.style = 2 } - assert_equal(@chart.style, 2) + def test_bg_color + assert_raise(ArgumentError) { @chart.bg_color = 2 } + assert_nothing_raised { @chart.bg_color = "FFFFFF" } + assert_equal(@chart.bg_color, "FFFFFF") + end - + + def test_title_size + assert_raise(ArgumentError) { @chart.title_size = 2 } + assert_nothing_raised { @chart.title_size = "100" } + assert_equal(@chart.title.text_size, "100") + end + def test_vary_colors assert_equal(true, @chart.vary_colors) assert_raise(ArgumentError) { @chart.vary_colors = 7 } @@ -63,7 +76,7 @@ class TestChart < Test::Unit::TestCase @chart.start_at [5,6] assert_equal(@chart.graphic_frame.anchor.from.col, 5) assert_equal(@chart.graphic_frame.anchor.from.row, 6) - + end def test_end_at @@ -76,7 +89,7 @@ class TestChart < Test::Unit::TestCase @chart.end_at [10,11] assert_equal(@chart.graphic_frame.anchor.to.col, 10) assert_equal(@chart.graphic_frame.anchor.to.row, 11) - + end def test_add_series @@ -88,13 +101,13 @@ class TestChart < Test::Unit::TestCase def test_pn assert_equal(@chart.pn, "charts/chart1.xml") end - + def test_d_lbls assert_equal(nil, @chart.instance_values[:d_lbls]) @chart.d_lbls.d_lbl_pos = :t assert(@chart.d_lbls.is_a?(Axlsx::DLbls), 'DLbls instantiated on access') end - + def test_to_xml_string schema = Nokogiri::XML::Schema(File.open(Axlsx::DRAWING_XSD)) doc = Nokogiri::XML(@chart.to_xml_string) |
