Sha256: 3168632782baf7ee0b65af14a723eb345b2f2a58686e24d77e88523b40267c29

Contents?: true

Size: 1.23 KB

Versions: 1

Compression:

Stored size: 1.23 KB

Contents

require 'tc_helper.rb'

class TestPieSeries < Test::Unit::TestCase

  def setup
    p = Axlsx::Package.new
    @ws = p.workbook.add_worksheet :name=>"hmmm"
    chart = @ws.add_chart Axlsx::Pie3DChart, :title => "fishery"
    @series = chart.add_series :data=>[0,1,2], :labels=>["zero", "one", "two"], :title=>"bob", :colors => ["FF0000", "00FF00", "0000FF"]
  end

  def test_initialize
    assert_equal(@series.title.text, "bob", "series title has been applied")
    assert_equal(@series.labels.class, Axlsx::AxDataSource)
    assert_equal(@series.data.class, Axlsx::NumDataSource)
    assert_equal(@series.explosion, nil, "series shape has been applied")
  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)
    # issue 58 - explosion caused to_xml_string to fail - now tested
    assert_nothing_raised("allow to_xml_string") { @series.to_xml_string }
  end

  def test_to_xml_string
    doc = Nokogiri::XML(@series.to_xml_string)
    assert(doc.xpath("//srgbClr[@val='#{@series.colors[0]}']"))
  end
  #TODO test unique serialization parts

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
caxlsx-3.2.0 test/drawing/tc_pie_series.rb