Sha256: db94ace51a249f80ab57bbd1ef6b5395e8f6e7e63e7fa3c75af292a33443db40

Contents?: true

Size: 1.03 KB

Versions: 4

Compression:

Stored size: 1.03 KB

Contents

require 'test/unit'
require 'axlsx.rb'

class TestPieSeries < Test::Unit::TestCase

  def setup
    p = Axlsx::Package.new
    @ws = p.workbook.add_worksheet :name=>"hmmm"
    chart = @ws.drawing.add_chart Axlsx::Pie3DChart, :title => "fishery"
    @series = chart.add_series :data=>[0,1,2], :labels=>["zero", "one", "two"], :title=>"bob"
  end
  
  def test_initialize
    assert_equal(@series.title, "bob", "series title has been applied")
    assert_equal(@series.data, [0,1,2], "data option applied")
    assert_equal(@series.labels, ["zero", "one","two"], "labels option applied")    
    assert_equal(@series.explosion, nil, "series shape has been applied")   
  end

  def test_data
    assert_equal(@series.data, [0,1,2])
  end

  def test_labels
    assert_equal(@series.labels, ["zero", "one", "two"])

  end

  def test_explosion
    assert_raise(ArgumentError, "require valid explosion") { @series.explosion = :lots }
    assert_nothing_raised("allow valid explosion") { @series.explosion = 20 }
    assert(@series.explosion == 20)
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
axlsx-1.0.4 test/drawing/tc_pie_series.rb
axlsx-1.0.3 test/drawing/tc_pie_series.rb
axlsx-1.0.1 test/drawing/tc_pie_series.rb
axlsx-1.0.0 test/drawing/tc_pie_series.rb