diff options
| author | Randy Morgan <[email protected]> | 2012-04-21 13:58:27 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2012-04-21 13:58:27 +0900 |
| commit | 050f4cfac1b3a52da16b98f3a494083f0de5348f (patch) | |
| tree | 889e7217fe7a731be6f3588e4e179d3d73d349cd /test/workbook/worksheet/tc_conditional_formatting.rb | |
| parent | c84e62cb7a91fefae0457baabbd9b2f3bef3259e (diff) | |
| download | caxlsx-050f4cfac1b3a52da16b98f3a494083f0de5348f.tar.gz caxlsx-050f4cfac1b3a52da16b98f3a494083f0de5348f.zip | |
adding in icon set and MOAR examples for conditional formatting.
Diffstat (limited to 'test/workbook/worksheet/tc_conditional_formatting.rb')
| -rw-r--r-- | test/workbook/worksheet/tc_conditional_formatting.rb | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/test/workbook/worksheet/tc_conditional_formatting.rb b/test/workbook/worksheet/tc_conditional_formatting.rb index 2287c017..0dcb1a7c 100644 --- a/test/workbook/worksheet/tc_conditional_formatting.rb +++ b/test/workbook/worksheet/tc_conditional_formatting.rb @@ -25,15 +25,35 @@ class TestConditionalFormatting < Test::Unit::TestCase cs.value_objects.first.val = 5 end + data_bar = Axlsx::DataBar.new :color => "FFFF0000" + icon_set = Axlsx::IconSet.new :iconSet => "5Rating" + cfs = @ws.add_conditional_formatting( "B2:B2", [{ :type => :containsText, :text => "TRUE", :dxfId => 0, :priority => 1, :formula => 'NOT(ISERROR(SEARCH("FALSE",AB1)))', - :color_scale => color_scale}]) + :color_scale => color_scale, + :data_bar => data_bar, + :icon_set => icon_set}]) doc = Nokogiri::XML.parse(cfs.last.to_xml_string) assert_equal(1, doc.xpath(".//conditionalFormatting[@sqref='B2:B2']//cfRule[@type='containsText'][@dxfId=0][@priority=1]").size) assert doc.xpath(".//conditionalFormatting//cfRule[@type='containsText'][@dxfId=0][@priority=1]//formula='NOT(ISERROR(SEARCH(\"FALSE\",AB1)))'") + + cfs.last.rules.last.type = :colorScale + doc = Nokogiri::XML.parse(cfs.last.to_xml_string) assert_equal(doc.xpath(".//conditionalFormatting//cfRule//colorScale//cfvo").size, 2) assert_equal(doc.xpath(".//conditionalFormatting//cfRule//colorScale//color").size, 2) + + cfs.last.rules.last.type = :dataBar + doc = Nokogiri::XML.parse(cfs.last.to_xml_string) + assert_equal(doc.xpath(".//conditionalFormatting//cfRule//dataBar").size, 1) + assert_equal(doc.xpath(".//conditionalFormatting//cfRule//dataBar//cfvo").size, 2) + assert_equal(doc.xpath(".//conditionalFormatting//cfRule//dataBar//color[@rgb='FFFF0000']").size, 1) + + cfs.last.rules.last.type = :iconSet + doc = Nokogiri::XML.parse(cfs.last.to_xml_string) + assert_equal(doc.xpath(".//conditionalFormatting//cfRule//iconSet//cfvo").size, 2) + assert_equal(doc.xpath(".//conditionalFormatting//cfRule//iconSet[@iconSet='5Rating']").size, 1) + end def test_single_rule |
