summaryrefslogtreecommitdiffhomepage
path: root/test/workbook/worksheet/tc_cell.rb
diff options
context:
space:
mode:
authorTobias Egli <[email protected]>2022-02-02 16:00:32 +0100
committerJosef Šimánek <[email protected]>2022-02-06 00:37:27 +0100
commitd3cf7bca5728b166c7643ad839efeba60ed0e256 (patch)
tree9175590f74a43cd394d22b03da1788eef7a7d2af /test/workbook/worksheet/tc_cell.rb
parent059c9d38c8860775a260711f78222b69535e6163 (diff)
downloadcaxlsx-d3cf7bca5728b166c7643ad839efeba60ed0e256.tar.gz
caxlsx-d3cf7bca5728b166c7643ad839efeba60ed0e256.zip
Autowidth cell calculation is now configurable
On the workbook you can now configure the font_scale_divisor and the bold_font_multiplier to get better results for the automatic cell width calculationb
Diffstat (limited to 'test/workbook/worksheet/tc_cell.rb')
-rw-r--r--test/workbook/worksheet/tc_cell.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/test/workbook/worksheet/tc_cell.rb b/test/workbook/worksheet/tc_cell.rb
index 04f6bed3..bdbfd59d 100644
--- a/test/workbook/worksheet/tc_cell.rb
+++ b/test/workbook/worksheet/tc_cell.rb
@@ -44,7 +44,7 @@ class TestCell < Test::Unit::TestCase
end
def test_wide_r
- assert_equal(@cAA.r, "AA2", "calculate cell reference")
+ assert_equal(@cAA.r, "AA2", "calculate cell reference")
end
def test_r_abs
@@ -64,6 +64,18 @@ class TestCell < Test::Unit::TestCase
assert_in_delta(6.6, @c.autowidth, 0.01)
end
+ def test_autowidth_with_bold_font_multiplier
+ style = @c.row.worksheet.workbook.styles.add_style(b: true)
+ @c.row.worksheet.workbook.bold_font_multiplier = 1.05
+ @c.style = style
+ assert_in_delta(6.93, @c.autowidth, 0.01)
+ end
+
+ def test_autowidth_with_font_scale_divisor
+ @c.row.worksheet.workbook.font_scale_divisor = 11.0
+ assert_in_delta(6.0, @c.autowidth, 0.01)
+ end
+
def test_time
@c.type = :time
now = DateTime.now