Sha256: cbaee8f9b36feba13536fad97d9e02ce0b90d8107e27a8dfa7dfa2b4f39a5662
Contents?: true
Size: 1.69 KB
Versions: 1
Compression:
Stored size: 1.69 KB
Contents
require 'tc_helper.rb' class TestComment < Test::Unit::TestCase def setup p = Axlsx::Package.new wb = p.workbook @ws = wb.add_worksheet @c1 = @ws.add_comment :ref => 'A1', :text => 'penut machine', :author => 'crank' @c2 = @ws.add_comment :ref => 'C3', :text => 'rust bucket', :author => 'PO' end def test_initailize assert_raise(ArgumentError) { Axlsx::Comment.new } end def test_author assert(@c1.author == 'crank') assert(@c2.author == 'PO') end def test_text assert(@c1.text == 'penut machine') assert(@c2.text == 'rust bucket') end def test_author_index assert_equal(@c1.author_index, 1) assert_equal(@c2.author_index, 0) end def test_ref assert(@c1.ref == 'A1') assert(@c2.ref == 'C3') end def test_vml_shape assert(@c1.vml_shape.is_a?(Axlsx::VmlShape)) assert(@c1.vml_shape.column == Axlsx::name_to_indices(@c1.ref)[0]) assert(@c1.vml_shape.row == Axlsx::name_to_indices(@c1.ref)[1]) assert(@c1.vml_shape.row == Axlsx::name_to_indices(@c1.ref)[1]) assert(@c1.vml_shape.left_column == Axlsx::name_to_indices(@c1.ref)[1]+1) assert(@c1.vml_shape.top_row == Axlsx::name_to_indices(@c1.ref)[1]) assert(@c1.vml_shape.right_column == Axlsx::name_to_indices(@c1.ref)[0]+4) assert(@c1.vml_shape.bottom_row == Axlsx::name_to_indices(@c1.ref)[1]+4) end def to_xml_string doc = Nokogiri::XML(@c1.to_xml_string) assert_equal(doc.xpath("//comment[@ref='#{@c1.ref}']").size, 1) assert_equal(doc.xpath("//comment[@authorId='#{@c1.author_index.to}']").size, 1) assert_equal(doc.xpath("//t[text()='#{@c1.author}']").size, 1) assert_equal(doc.xpath("//t[text()='#{@c1.text}']").size, 1) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
axlsx-1.1.5 | test/workbook/worksheet/tc_comment.rb |