diff options
| author | Zsolt Kozaroczy <[email protected]> | 2021-07-24 00:31:54 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-07-24 00:31:54 +0200 |
| commit | 158942c16b249a269e77633dd261b87787d191af (patch) | |
| tree | bca8bcd68530a6f67115080e4295303960963a12 /test/drawing/tc_bar_chart.rb | |
| parent | 187461e2a653e53c34171cc894e10c3dcfced04d (diff) | |
| download | caxlsx-158942c16b249a269e77633dd261b87787d191af.tar.gz caxlsx-158942c16b249a269e77633dd261b87787d191af.zip | |
Add overlap to bar charts (#107)
Diffstat (limited to 'test/drawing/tc_bar_chart.rb')
| -rw-r--r-- | test/drawing/tc_bar_chart.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/drawing/tc_bar_chart.rb b/test/drawing/tc_bar_chart.rb index ca1ca016..d064e5be 100644 --- a/test/drawing/tc_bar_chart.rb +++ b/test/drawing/tc_bar_chart.rb @@ -45,6 +45,13 @@ class TestBarChart < Test::Unit::TestCase assert(@chart.gap_depth == "200%") end + def test_overlap + assert_raise(ArgumentError, "require valid overlap") { @chart.overlap = -101 } + assert_raise(ArgumentError, "require valid overlap") { @chart.overlap = 101 } + assert_nothing_raised("allow valid overlap") { @chart.overlap = 100 } + assert_equal(@chart.overlap, 100, 'overlap is incorrect') + end + def test_shape assert_raise(ArgumentError, "require valid shape") { @chart.shape = :star } assert_nothing_raised("allow valid shape") { @chart.shape = :cone } @@ -68,4 +75,11 @@ class TestBarChart < Test::Unit::TestCase val_axis_position = str.index(@chart.axes[:val_axis].id.to_s) assert(cat_axis_position < val_axis_position, "cat_axis must occur earlier than val_axis in the XML") end + + def test_to_xml_string_has_overlap + overlap_value = rand(-100..100) + @chart.overlap = overlap_value + doc = Nokogiri::XML(@chart.to_xml_string) + assert_equal(doc.xpath("//c:barChart/c:overlap").first.attribute('val').value, overlap_value.to_s) + end end |
