test/drawing/tc_drawing.rb in axlsx-1.0.18 vs test/drawing/tc_drawing.rb in axlsx-1.1.0

- old
+ new

@@ -1,10 +1,9 @@ -require 'test/unit' -require 'axlsx.rb' +require 'tc_helper.rb' class TestDrawing < Test::Unit::TestCase - def setup + def setup p = Axlsx::Package.new @ws = p.workbook.add_worksheet end @@ -22,26 +21,26 @@ anchor = @ws.drawing.anchors.last assert_equal([anchor.from.row, anchor.from.col], [0,0], "options for start at are applied") assert_equal([anchor.to.row, anchor.to.col], [1,1], "options for start at are applied") assert_equal(chart.title.text, "bob", "option for title is applied") end - + def test_add_image src = File.dirname(__FILE__) + "/../../examples/image1.jpeg" image = @ws.add_image(:image_src => src, :start_at=>[0,0], :width=>600, :height=>400) assert(@ws.drawing.anchors.last.is_a?(Axlsx::OneCellAnchor)) assert(image.is_a?(Axlsx::Pic)) assert_equal(600, image.width) - assert_equal(400, image.height) + assert_equal(400, image.height) end def test_charts assert(@ws.drawing.charts.empty?) chart = @ws.add_chart(Axlsx::Pie3DChart, :title=>"bob", :start_at=>[0,0], :end_at=>[1,1]) assert_equal(@ws.drawing.charts.last, chart, "add chart is returned") chart = @ws.add_chart(Axlsx::Pie3DChart, :title=>"nancy", :start_at=>[1,5], :end_at=>[5,10]) - assert_equal(@ws.drawing.charts.last, chart, "add chart is returned") + assert_equal(@ws.drawing.charts.last, chart, "add chart is returned") end def test_pn assert_equal(@ws.drawing.pn, "drawings/drawing1.xml") end @@ -51,11 +50,11 @@ end def test_rId assert_equal(@ws.drawing.rId, "rId1") end - + def test_index assert_equal(@ws.drawing.index, @ws.workbook.drawings.index(@ws.drawing)) end def test_relationships @@ -66,10 +65,10 @@ assert_equal(@ws.drawing.relationships.size, 2, "adding a chart adds a relationship") end def test_to_xml schema = Nokogiri::XML::Schema(File.open(Axlsx::DRAWING_XSD)) - doc = Nokogiri::XML(@ws.drawing.to_xml) + doc = Nokogiri::XML(@ws.drawing.to_xml_string) errors = [] schema.validate(doc).each do |error| errors.push error puts error.message end