diff options
| author | Randy Morgan <[email protected]> | 2012-02-15 22:12:12 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2012-02-15 22:12:12 +0900 |
| commit | cd890f6c5a84f6b5c5458f4c6edeab9103bf1cee (patch) | |
| tree | 40d9aaafa09abed5d3c8429b20d95d117c004956 /test | |
| parent | 41b78ef639c7d3f5f157f478d644e793cef370b4 (diff) | |
| download | caxlsx-cd890f6c5a84f6b5c5458f4c6edeab9103bf1cee.tar.gz caxlsx-cd890f6c5a84f6b5c5458f4c6edeab9103bf1cee.zip | |
some small changes to ochko's great idea of allowing us to specify widths, and even better ignore some cells when calculating autowidth.
Diffstat (limited to 'test')
| -rw-r--r-- | test/workbook/worksheet/tc_worksheet.rb | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/test/workbook/worksheet/tc_worksheet.rb b/test/workbook/worksheet/tc_worksheet.rb index 0295a64f..f6180691 100644 --- a/test/workbook/worksheet/tc_worksheet.rb +++ b/test/workbook/worksheet/tc_worksheet.rb @@ -144,13 +144,14 @@ class TestWorksheet < Test::Unit::TestCase end def test_set_fixed_width_column - big = @ws.workbook.styles.add_style(:sz=>10) - - @ws.add_row ["mule", "donkey", "horse"], :style=>big, :widths => [20, true, false] + @ws.add_row ["mule", "donkey", "horse"], :widths => [20, :ignore, nil] assert(@ws.auto_fit_data.size == 3, "a data item for each column") - assert_equal({:sz=>11, :fixed=>20, :longest=>"" }, @ws.auto_fit_data[0], "adding a row with fixed width updates :fixed attribute") - assert_equal({:sz=>11,:longest=>"", :fixed=>nil}, @ws.auto_fit_data[1], "adding a row with fixed with 'true' doesn't try set auto fit data") - assert_equal({:sz=>10,:longest=>"horse", :fixed=>nil}, @ws.auto_fit_data[2], "adding a row with falsy fixed value updates auto_fit_data") + assert_equal({:sz=>11, :fixed=>20, :longest=>"mule" }, @ws.auto_fit_data[0], "adding a row with fixed width updates :fixed attribute") + assert_equal({:sz=>11, :longest=>"", :fixed=>nil}, @ws.auto_fit_data[1], ":ignore does not set any data") + assert_equal({:sz=>11, :longest=>"horse", :fixed=>nil}, @ws.auto_fit_data[2], "nil, well really anything else just works as normal") + @ws.add_row ["mule", "donkey", "horse"] + assert_equal({:sz=>11, :longest=>"donkey", :fixed=>nil}, @ws.auto_fit_data[1]) + end def test_auto_width |
