diff options
| author | Agustin Gomez <[email protected]> | 2021-03-19 10:50:03 -0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-03-19 14:50:03 +0100 |
| commit | 37acfa2e3692fbc278e3a06df457fde8d88a5f01 (patch) | |
| tree | ec72ed0fff861ff6df224868abb7702a18b33c63 /test | |
| parent | ed329dae5d9a69a11726a0ceba27e77aaf8adaa0 (diff) | |
| download | caxlsx-37acfa2e3692fbc278e3a06df457fde8d88a5f01.tar.gz caxlsx-37acfa2e3692fbc278e3a06df457fde8d88a5f01.zip | |
Implement :offset option for worksheet#add_row (#87)
Diffstat (limited to 'test')
| -rw-r--r-- | test/workbook/worksheet/tc_row.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/workbook/worksheet/tc_row.rb b/test/workbook/worksheet/tc_row.rb index f909129c..e6dc3ef1 100644 --- a/test/workbook/worksheet/tc_row.rb +++ b/test/workbook/worksheet/tc_row.rb @@ -136,4 +136,25 @@ class TestRow < Test::Unit::TestCase assert_equal(r_s_xml.xpath(".//row[@r=1][@ht=20][@customHeight=1]").size, 1) end + def test_offsets + offset = 3 + values = [1,2,3,4,5] + r = @ws.add_row(values, offset: offset, style: 1) + r.cells.each_with_index do |c, index| + assert_equal(c.style, index < offset ? 0 : 1) + assert_equal(c.value, index < offset ? nil : values[index - offset]) + end + end + + def test_offsets_with_styles + offset = 3 + values = [1,2,3,4,5] + styles = [6,7,8,9,10] + r = @ws.add_row(values, offset: offset, style: styles) + r.cells.each_with_index do |c, index| + assert_equal(c.style, index < offset ? 0 : styles[index-offset]) + assert_equal(c.value, index < offset ? nil : values[index - offset]) + end + end + end |
