summaryrefslogtreecommitdiffhomepage
path: root/test/drawing
diff options
context:
space:
mode:
authorStefan <[email protected]>2022-05-23 12:52:53 +0200
committerStefan Daschek <[email protected]>2022-06-01 09:55:27 +0200
commit35ed793586a57837b2e0319e57b5c763f9f4ade4 (patch)
tree46fe4d8701c12e5a66f7fdf40aac7e504d9411bf /test/drawing
parent2a5c58faffb690831911f3799e8c097c6fdef793 (diff)
downloadcaxlsx-35ed793586a57837b2e0319e57b5c763f9f4ade4.tar.gz
caxlsx-35ed793586a57837b2e0319e57b5c763f9f4ade4.zip
Implement “plot visible only” setting for charts
Until now this setting was hardcoded to `true`. The setting affects whether data from hidden cells (cells width zero height or width) is used when plotting the chart.
Diffstat (limited to 'test/drawing')
-rw-r--r--test/drawing/tc_chart.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/test/drawing/tc_chart.rb b/test/drawing/tc_chart.rb
index 58622621..c3392f26 100644
--- a/test/drawing/tc_chart.rb
+++ b/test/drawing/tc_chart.rb
@@ -107,12 +107,19 @@ class TestChart < Test::Unit::TestCase
end
def test_d_lbls
-
+
assert_equal(nil, Axlsx.instance_values_for(@chart)[:d_lbls])
@chart.d_lbls.d_lbl_pos = :t
assert(@chart.d_lbls.is_a?(Axlsx::DLbls), 'DLbls instantiated on access')
end
+ def test_plot_visible_only
+ assert(@chart.plot_visible_only, "default should be true")
+ @chart.plot_visible_only = false
+ assert_false(@chart.plot_visible_only)
+ assert_raise(ArgumentError) { @chart.plot_visible_only = "" }
+ end
+
def test_to_xml_string
schema = Nokogiri::XML::Schema(File.open(Axlsx::DRAWING_XSD))
doc = Nokogiri::XML(@chart.to_xml_string)
@@ -135,4 +142,10 @@ class TestChart < Test::Unit::TestCase
doc = Nokogiri::XML(@chart.to_xml_string)
assert_equal(0, doc.xpath("//c:title").size)
end
+
+ def test_to_xml_string_for_plot_visible_only
+ assert_equal("true", Nokogiri::XML(@chart.to_xml_string).xpath("//c:plotVisOnly").attr("val").value)
+ @chart.plot_visible_only = false
+ assert_equal("false", Nokogiri::XML(@chart.to_xml_string).xpath("//c:plotVisOnly").attr("val").value)
+ end
end