summaryrefslogtreecommitdiffhomepage
path: root/test/workbook/worksheet/tc_rich_text_run.rb
diff options
context:
space:
mode:
authorWeston Ganger <[email protected]>2020-02-12 16:07:52 -0800
committerGitHub <[email protected]>2020-02-13 01:07:52 +0100
commit5a5c09132060f1270849c2535d00c456a31fa02a (patch)
tree3a05366e3e9795266f08ce17fa6d0e387eb8747d /test/workbook/worksheet/tc_rich_text_run.rb
parenta58375fa72fac090d6310e2094808e8a477eab82 (diff)
downloadcaxlsx-5a5c09132060f1270849c2535d00c456a31fa02a.tar.gz
caxlsx-5a5c09132060f1270849c2535d00c456a31fa02a.zip
Improve cell string_autowidth calculations (#44)
Previously, cells with autowidth sometimes were too narrow for the content to fit. The original width calculation tried to take the difference between narrow and wide chars into account, but it didn’t work out very well. The new calculation is simpler. Compared to the previous implementation it results in cells being slightly wider in most cases.
Diffstat (limited to 'test/workbook/worksheet/tc_rich_text_run.rb')
-rw-r--r--test/workbook/worksheet/tc_rich_text_run.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/test/workbook/worksheet/tc_rich_text_run.rb b/test/workbook/worksheet/tc_rich_text_run.rb
index e4a5ef80..39919a31 100644
--- a/test/workbook/worksheet/tc_rich_text_run.rb
+++ b/test/workbook/worksheet/tc_rich_text_run.rb
@@ -148,8 +148,9 @@ class RichTextRun < Test::Unit::TestCase
@ws.add_row [rt], :style => wrap
ar = [0]
awtr.autowidth(ar)
- assert_equal(ar.length, 2)
- assert_equal(ar.last, 0)
+ assert_equal(2, ar.length)
+ assert_equal(13.2, ar[0])
+ assert_equal(0, ar[1])
end
def test_to_xml