summaryrefslogtreecommitdiffhomepage
path: root/test/drawing/tc_scatter_chart.rb
blob: 367cf56d644ff0bd4a0f4ce5e3d8011410a1b24b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
require 'tc_helper.rb'

class TestScatterChart < 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::ScatterChart, :title => "A Title"
  end

  def teardown
  end

  def test_initialization
    assert_equal(@chart.scatterStyle, :lineMarker, "scatterStyle defualt incorrect")
    assert_equal(@chart.series_type, Axlsx::ScatterSeries, "series type incorrect")
    assert(@chart.xValAxis.is_a?(Axlsx::ValAxis), "independant value axis not created")
    assert(@chart.yValAxis.is_a?(Axlsx::ValAxis), "dependant value axis not created")
  end

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

end