diff options
| author | Randy Morgan <[email protected]> | 2012-04-21 12:53:54 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2012-04-21 12:53:54 +0900 |
| commit | c84e62cb7a91fefae0457baabbd9b2f3bef3259e (patch) | |
| tree | 3f379cbd38a74d7d20fe449b57c07d3307f0421f /test/workbook | |
| parent | a7072a25772a7613620ee60cb607e62ad2db743e (diff) | |
| download | caxlsx-c84e62cb7a91fefae0457baabbd9b2f3bef3259e.tar.gz caxlsx-c84e62cb7a91fefae0457baabbd9b2f3bef3259e.zip | |
add data bar conditional formatting support.
Diffstat (limited to 'test/workbook')
| -rw-r--r-- | test/workbook/worksheet/tc_data_bar.rb | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/workbook/worksheet/tc_data_bar.rb b/test/workbook/worksheet/tc_data_bar.rb new file mode 100644 index 00000000..644ce6bd --- /dev/null +++ b/test/workbook/worksheet/tc_data_bar.rb @@ -0,0 +1,39 @@ +require 'tc_helper.rb' + +class TestDataBar < Test::Unit::TestCase + def setup + @data_bar = Axlsx::DataBar.new :color => "FF638EC6" + end + + def test_defaults + assert_equal @data_bar.minLength, 10 + assert_equal @data_bar.maxLength, 90 + assert_equal @data_bar.showValue, true + end + + def test_minLength + assert_raise(ArgumentError) { @data_bar.minLength = :invalid_type } + assert_nothing_raised { @data_bar.minLength = 0} + assert_equal(@data_bar.minLength, 0) + end + + def test_maxLength + assert_raise(ArgumentError) { @data_bar.maxLength = :invalid_type } + assert_nothing_raised { @data_bar.maxLength = 0} + assert_equal(@data_bar.maxLength, 0) + end + + def test_maxLength + assert_raise(ArgumentError) { @data_bar.showValue = :invalid_type } + assert_nothing_raised { @data_bar.showValue = false} + assert_equal(@data_bar.showValue, false) + end + + def test_to_xml_string + doc = Nokogiri::XML.parse(@data_bar.to_xml_string) + assert_equal(doc.xpath(".//dataBar[@minLength=10][@maxLength=90][@showValue='true']").size, 1) + assert_equal(doc.xpath(".//dataBar//cfvo").size, 2) + assert_equal(doc.xpath(".//dataBar//color").size, 1) + end + +end |
