test/workbook/worksheet/tc_worksheet.rb in axlsx-1.1.0 vs test/workbook/worksheet/tc_worksheet.rb in axlsx-1.1.1
- old
+ new
@@ -205,12 +205,14 @@
end
def test_to_xml_string_merge_cells
@ws.add_row [1, "two"]
@ws.merge_cells "A1:D1"
+ @ws.merge_cells "E1:F1"
doc = Nokogiri::XML(@ws.to_xml_string)
assert_equal(doc.xpath('//xmlns:worksheet/xmlns:mergeCells/xmlns:mergeCell[@ref="A1:D1"]').size, 1)
+ assert_equal(doc.xpath('//xmlns:worksheet/xmlns:mergeCells/xmlns:mergeCell[@ref="E1:F1"]').size, 1)
end
def test_to_xml_string_page_margins
@ws.page_margins do |pm|
pm.left = 9
@@ -250,12 +252,18 @@
puts error.message
end
assert(errors.empty?, "error free validation")
end
- def test_valid_with_page_margins
+ # Make sure the XML for all optional elements (like pageMargins, autoFilter, ...)
+ # is generated in correct order.
+ def test_valid_with_optional_elements
@ws.page_margins.set :left => 9
+ @ws.auto_filter = "A1:C3"
+ @ws.merge_cells "A4:A5"
+ @ws.add_chart Axlsx::Pie3DChart
+ @ws.add_table "E1:F3"
schema = Nokogiri::XML::Schema(File.open(Axlsx::SML_XSD))
doc = Nokogiri::XML(@ws.to_xml_string)
errors = []
schema.validate(doc).each do |error|
errors.push error
@@ -297,10 +305,9 @@
def test_set_column_width
@ws.add_row ["chasing windmills", "penut"]
@ws.column_widths nil, 0.5
assert_equal(@ws.column_info[1].width, 0.5, 'eat my width')
- assert_raise(ArgumentError, 'reject invalid columns') { @ws.column_widths 2, 7, nil }
assert_raise(ArgumentError, 'only accept unsigned ints') { @ws.column_widths 2, 7, -1 }
assert_raise(ArgumentError, 'only accept Integer, Float or Fixnum') { @ws.column_widths 2, 7, "-1" }
end
def test_merge_cells