summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorJurriaan Pruis <[email protected]>2015-03-14 16:11:38 +0100
committerJurriaan Pruis <[email protected]>2015-03-14 16:11:38 +0100
commit05c9faa89da35ba01ece50c2951739b579478993 (patch)
tree6e46c7be1704e0fad06099584d9e48cea5b25cbb /test
parente6b0228fb441fe31eaa09b747f3c3e76ff629dee (diff)
parent9a5c96c8c21424a8737245f8a51a4693b4deb38c (diff)
downloadcaxlsx-05c9faa89da35ba01ece50c2951739b579478993.tar.gz
caxlsx-05c9faa89da35ba01ece50c2951739b579478993.zip
Merge pull request #347 from ionthegeek/smoothing
Add support for enabling or disabling smoothed lines in a scatter series
Diffstat (limited to 'test')
-rw-r--r--test/drawing/tc_scatter_series.rb26
1 files changed, 25 insertions, 1 deletions
diff --git a/test/drawing/tc_scatter_series.rb b/test/drawing/tc_scatter_series.rb
index b43ed171..62a338b1 100644
--- a/test/drawing/tc_scatter_series.rb
+++ b/test/drawing/tc_scatter_series.rb
@@ -6,13 +6,37 @@ class TestScatterSeries < Test::Unit::TestCase
p = Axlsx::Package.new
@ws = p.workbook.add_worksheet :name=>"hmmm"
@chart = @ws.add_chart Axlsx::ScatterChart, :title => "Scatter Chart"
- @series = @chart.add_series :xData=>[1,2,4], :yData=>[1,3,9], :title=>"exponents", :color => 'FF0000'
+ @series = @chart.add_series :xData=>[1,2,4], :yData=>[1,3,9], :title=>"exponents", :color => 'FF0000', :smooth => true
end
def test_initialize
assert_equal(@series.title.text, "exponents", "series title has been applied")
end
+ def test_smoothed_chart_default_smoothing
+ @chart = @ws.add_chart Axlsx::ScatterChart, :title => "Smooth Chart", :scatter_style => :smoothMarker
+ @series = @chart.add_series :xData=>[1,2,4], :yData=>[1,3,9], :title=>"smoothed exponents"
+ assert(@series.smooth, "series is smooth by default on smooth charts")
+ end
+
+ def test_unsmoothed_chart_default_smoothing
+ @chart = @ws.add_chart Axlsx::ScatterChart, :title => "Unsmooth Chart", :scatter_style => :line
+ @series = @chart.add_series :xData=>[1,2,4], :yData=>[1,3,9], :title=>"unsmoothed exponents"
+ assert([email protected], "series is not smooth by default on non-smooth charts")
+ end
+
+ def test_explicit_smoothing
+ @chart = @ws.add_chart Axlsx::ScatterChart, :title => "Unsmooth Chart, Smooth Series", :scatter_style => :line
+ @series = @chart.add_series :xData=>[1,2,4], :yData=>[1,3,9], :title=>"smoothed exponents", :smooth => true
+ assert(@series.smooth, "series is smooth when overriding chart default")
+ end
+
+ def test_explicit_unsmoothing
+ @chart = @ws.add_chart Axlsx::ScatterChart, :title => "Smooth Chart, Unsmooth Series", :scatter_style => :smoothMarker
+ @series = @chart.add_series :xData=>[1,2,4], :yData=>[1,3,9], :title=>"unsmoothed exponents", :smooth => false
+ assert([email protected], "series is not smooth when overriding chart default")
+ end
+
def test_to_xml_string
doc = Nokogiri::XML(@chart.to_xml_string)
assert_equal(doc.xpath("//a:srgbClr[@val='#{@series.color}']").size,4)