Sha256: 95d8ed37729237b7d472510b528d2f25a49d4bf99fc405d24a9005270446f290

Contents?: true

Size: 1.54 KB

Versions: 15

Compression:

Stored size: 1.54 KB

Contents

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

class TestTable06 < Test::Unit::TestCase
  def setup
    workbook = WriteXLSX.new(StringIO.new)
    @worksheet = workbook.add_worksheet
  end

  def test_table06
    # Set the table properties.
    @worksheet.add_table(
                         'C3:F13',
                         {
                           :columns => [
                                        {:header => 'Foo'},
                                        {:header => ''},
                                        {},
                                        {:header => 'Baz'}
                                       ]
                         }
                         )

    table = @worksheet.tables[0]
    table.__send__(:assemble_xml_file)

    result = got_to_array(table.instance_variable_get(:@writer).string)

    assert_equal(expected, result)
  end

  def expected
    expected_to_array(
                      <<EOS
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<table xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" id="1" name="Table1" displayName="Table1" ref="C3:F13" totalsRowShown="0">
  <autoFilter ref="C3:F13"/>
  <tableColumns count="4">
    <tableColumn id="1" name="Foo"/>
    <tableColumn id="2" name="Column2"/>
    <tableColumn id="3" name="Column3"/>
    <tableColumn id="4" name="Baz"/>
  </tableColumns>
  <tableStyleInfo name="TableStyleMedium9" showFirstColumn="0" showLastColumn="0" showRowStripes="1" showColumnStripes="0"/>
</table>
EOS
                      )
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
write_xlsx-0.72.3.beta1 test/package/table/test_table06.rb
write_xlsx-0.72.2 test/package/table/test_table06.rb
write_xlsx-0.72.1 test/package/table/test_table06.rb
write_xlsx-0.72.0 test/package/table/test_table06.rb
write_xlsx-0.71.0 test/package/table/test_table06.rb
write_xlsx-0.70.0 test/package/table/test_table06.rb
write_xlsx-0.69.0 test/package/table/test_table06.rb
write_xlsx-0.65.1 test/package/table/test_table06.rb
write_xlsx-0.65.0 test/package/table/test_table06.rb
write_xlsx-0.64.1 test/package/table/test_table06.rb
write_xlsx-0.64.0 test/package/table/test_table06.rb
write_xlsx-0.62.0 test/package/table/test_table06.rb
write_xlsx-0.61.0 test/package/table/test_table06.rb
write_xlsx-0.60.0 test/package/table/test_table06.rb
write_xlsx-0.59.0 test/package/table/test_table06.rb