Sha256: 1021697906bd79670c748ae8322408461c5371459788258d359d4d773ba62874

Contents?: true

Size: 1.18 KB

Versions: 1

Compression:

Stored size: 1.18 KB

Contents

require 'tc_helper.rb'

class TestAreaChart < Test::Unit::TestCase

  def setup
    @p = Axlsx::Package.new
    ws = @p.workbook.add_worksheet
    @row = ws.add_row ["one", 1, Time.now]
    @chart = ws.add_chart Axlsx::AreaChart, :title => "fishery"
  end

  def teardown
  end

  def test_initialization
    assert_equal(@chart.grouping, :standard, "grouping defualt incorrect")
    assert_equal(@chart.series_type, Axlsx::AreaSeries, "series type incorrect")
    assert(@chart.cat_axis.is_a?(Axlsx::CatAxis), "category axis not created")
    assert(@chart.val_axis.is_a?(Axlsx::ValAxis), "value access not created")
  end

  def test_grouping
    assert_raise(ArgumentError, "require valid grouping") { @chart.grouping = :inverted }
    assert_nothing_raised("allow valid grouping") { @chart.grouping = :stacked }
    assert(@chart.grouping == :stacked)
  end

  def test_to_xml
    schema = Nokogiri::XML::Schema(File.open(Axlsx::DRAWING_XSD))
    doc = Nokogiri::XML(@chart.to_xml_string)
    errors = []
    schema.validate(doc).each do |error|
      errors.push error
      puts error.message
    end
    assert(errors.empty?, "error free validation")
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

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