diff options
| author | ochko <[email protected]> | 2012-04-06 16:33:15 +0900 |
|---|---|---|
| committer | ochko <[email protected]> | 2012-04-06 16:33:15 +0900 |
| commit | 3431214a4feaa076ebc246552e5e61331d35c398 (patch) | |
| tree | e560af73715bed412c4e4fd3427b00b681257ac7 /test/workbook/worksheet/tc_cell.rb | |
| parent | 78e2f076f0b0a1bbe651a3ce53075ae2cf778284 (diff) | |
| download | caxlsx-3431214a4feaa076ebc246552e5e61331d35c398.tar.gz caxlsx-3431214a4feaa076ebc246552e5e61331d35c398.zip | |
put only plain string cells in shared string table
Diffstat (limited to 'test/workbook/worksheet/tc_cell.rb')
| -rw-r--r-- | test/workbook/worksheet/tc_cell.rb | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/test/workbook/worksheet/tc_cell.rb b/test/workbook/worksheet/tc_cell.rb index 1cfd6169..12b4fb4c 100644 --- a/test/workbook/worksheet/tc_cell.rb +++ b/test/workbook/worksheet/tc_cell.rb @@ -212,24 +212,34 @@ class TestCell < Test::Unit::TestCase assert_equal(@c.row.worksheet.merged_cells.last, "A1:C1") end - def test_equality - c2 = @row.add_cell 1, :type=>:float, :style=>1 - - assert_equal(c2.shareable_hash,@c.shareable_hash) - c3 = @row.add_cell 2, :type=>:float, :style=>1 - c4 = @row.add_cell 1, :type=>:float, :style=>1, :color => "#FFFFFFFF" - assert_equal(c4.shareable_hash == c2.shareable_hash,false) - c5 = @row.add_cell 1, :type=>:float, :style=>1, :color => "#FFFFFFFF" - assert_equal(c5.shareable_hash, c4.shareable_hash) - - end - def test_ssti assert_raise(ArgumentError, "ssti must be an unsigned integer!") { @c.send(:ssti=, -1) } @c.send :ssti=, 1 assert_equal(@c.ssti, 1) end + def test_plain_string + @c.type = :integer + assert_equal(@c.plain_string?, false) + + @c.type = :string + @c.value = 'plain string' + assert_equal(@c.plain_string?, true) + + @c.value = nil + assert_equal(@c.plain_string?, false) + + @c.value = '' + assert_equal(@c.plain_string?, false) + + @c.value = '=sum' + assert_equal(@c.plain_string?, false) + + @c.value = 'plain string' + @c.font_name = 'Arial' + assert_equal(@c.plain_string?, false) + end + def test_to_xml_string c_xml = Nokogiri::XML(@c.to_xml_string(1,1)) assert_equal(c_xml.xpath("/c[@s=1]").size, 1) |
