From 4cabb13e1cff88137d01ae4fae0d6f654725d4e9 Mon Sep 17 00:00:00 2001 From: Sergio Cambra Date: Fri, 15 Mar 2013 17:57:20 +0100 Subject: add test and remove activesupport methods --- test/drawing/tc_line_chart.rb | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 test/drawing/tc_line_chart.rb diff --git a/test/drawing/tc_line_chart.rb b/test/drawing/tc_line_chart.rb new file mode 100644 index 00000000..07e23702 --- /dev/null +++ b/test/drawing/tc_line_chart.rb @@ -0,0 +1,40 @@ +require 'tc_helper.rb' + +class TestLineChart < 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::LineChart, :title => "fishery" + end + + def teardown + end + + def test_initialization + assert_equal(@chart.grouping, :standard, "grouping defualt incorrect") + assert_equal(@chart.series_type, Axlsx::LineSeries, "series type incorrect") + assert(@chart.catAxis.is_a?(Axlsx::CatAxis), "category axis not created") + assert(@chart.valAxis.is_a?(Axlsx::ValAxis), "value access not created") + assert(@chart.serAxis.is_a?(Axlsx::SerAxis), "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 -- cgit v1.2.3