Sha256: bf691d6fce8159ac1ed80aae94658a6658a1884dcc2bb079a368bcadeb469f0a

Contents?: true

Size: 1.29 KB

Versions: 14

Compression:

Stored size: 1.29 KB

Contents

# -*- coding: utf-8 -*-
require 'helper'

class TestComments01 < Minitest::Test
  def setup
    @workbook = WriteXLSX.new(StringIO.new)
    @worksheet = @workbook.add_worksheet('')
  end

  ###############################################################################
  #
  # Test the _assemble_xml_file() method.
  #
  def test_assemble_xml_file
    @worksheet.write_comment(
      1, 1, 'Some text',
      :author => 'John', :visible => nil, :color => 81,
      :font => 'Tahoma', :font_size => 8, :font_family => 2
    )

    comments = @worksheet.comments
    comments.assemble_xml_file
    result = got_to_array(comments.instance_variable_get(:@writer).string)

    expected = expected_to_array(expected_xml)
    assert_equal(expected, result)
  end

  def expected_xml
    <<EOS
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<comments xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
  <authors>
    <author>John</author>
  </authors>
  <commentList>
    <comment ref="B2" authorId="0">
      <text>
        <r>
          <rPr>
            <sz val="8"/>
            <color indexed="81"/>
            <rFont val="Tahoma"/>
            <family val="2"/>
          </rPr>
          <t>Some text</t>
        </r>
      </text>
    </comment>
  </commentList>
</comments>
EOS
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
write_xlsx-1.09.4 test/package/comments/test_comments_01.rb
write_xlsx-1.09.3 test/package/comments/test_comments_01.rb
write_xlsx-1.09.2 test/package/comments/test_comments_01.rb
write_xlsx-1.09.1 test/package/comments/test_comments_01.rb
write_xlsx-1.09.0 test/package/comments/test_comments_01.rb
write_xlsx-1.08.2 test/package/comments/test_comments_01.rb
write_xlsx-1.08.1 test/package/comments/test_comments_01.rb
write_xlsx-1.08.0 test/package/comments/test_comments_01.rb
write_xlsx-1.07.0 test/package/comments/test_comments_01.rb
write_xlsx-1.04.0 test/package/comments/test_comments_01.rb
write_xlsx-1.02.0 test/package/comments/test_comments_01.rb
write_xlsx-1.01.0 test/package/comments/test_comments_01.rb
write_xlsx-1.00.0 test/package/comments/test_comments_01.rb
write_xlsx-0.99.0 test/package/comments/test_comments_01.rb