summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2012-07-15 13:29:18 +0900
committerRandy Morgan <[email protected]>2012-07-15 13:29:18 +0900
commit14beaaac13637f2153faa3b851f3e849974df556 (patch)
tree3fd3f23addb01df172c2eca738220b2d9106f34a /test
parent46c67de5cc3d8a1350fc3cf0773b2d56b019f960 (diff)
downloadcaxlsx-14beaaac13637f2153faa3b851f3e849974df556.tar.gz
caxlsx-14beaaac13637f2153faa3b851f3e849974df556.zip
refactoring auto width calculation to improve code quality.
Diffstat (limited to 'test')
-rw-r--r--test/workbook/worksheet/tc_row.rb4
-rw-r--r--test/workbook/worksheet/tc_worksheet.rb2
2 files changed, 3 insertions, 3 deletions
diff --git a/test/workbook/worksheet/tc_row.rb b/test/workbook/worksheet/tc_row.rb
index bfd5ae9f..b126845a 100644
--- a/test/workbook/worksheet/tc_row.rb
+++ b/test/workbook/worksheet/tc_row.rb
@@ -38,8 +38,8 @@ class TestRow < Test::Unit::TestCase
end
def test_add_cell_autowidth_info
- width = @ws.send :calculate_width, 'this is the cell of cells', @ws.workbook.styles.fonts.first.sz
- @row.add_cell("this is the cell of cells")
+ cell = @row.add_cell("this is the cell of cells")
+ width = cell.send(:autowidth)
assert_equal(@ws.column_info.last.width, width)
end
diff --git a/test/workbook/worksheet/tc_worksheet.rb b/test/workbook/worksheet/tc_worksheet.rb
index 3ab80ed2..9f7529c4 100644
--- a/test/workbook/worksheet/tc_worksheet.rb
+++ b/test/workbook/worksheet/tc_worksheet.rb
@@ -365,7 +365,7 @@ class TestWorksheet < Test::Unit::TestCase
def test_set_fixed_width_column
@ws.add_row ["mule", "donkey", "horse"], :widths => [20, :ignore, nil]
assert(@ws.column_info.size == 3, "a data item for each column")
- assert_equal(@ws.column_info[0].width, 20, "adding a row with fixed width updates :fixed attribute")
+ assert_equal(20, @ws.column_info[0].width, "adding a row with fixed width updates :fixed attribute")
assert_equal(@ws.column_info[1].width, nil, ":ignore does not set any data")
end