diff options
| author | Koza <[email protected]> | 2023-05-31 10:23:28 +0200 |
|---|---|---|
| committer | Koza <[email protected]> | 2023-10-19 10:17:14 +0200 |
| commit | 86393121fdd30dacf5b54eb64ac30be493405376 (patch) | |
| tree | 4a25cd2dd3a77afae53d0068f9ef27084c868171 /test/workbook | |
| parent | e15ceb41bbcbdbeed33e304101cc66114ef1cf7d (diff) | |
| download | caxlsx-86393121fdd30dacf5b54eb64ac30be493405376.tar.gz caxlsx-86393121fdd30dacf5b54eb64ac30be493405376.zip | |
Add optional interpolation points to icon sets
Diffstat (limited to 'test/workbook')
| -rw-r--r-- | test/workbook/worksheet/tc_icon_set.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/workbook/worksheet/tc_icon_set.rb b/test/workbook/worksheet/tc_icon_set.rb index beb69919..b2ced29b 100644 --- a/test/workbook/worksheet/tc_icon_set.rb +++ b/test/workbook/worksheet/tc_icon_set.rb @@ -12,6 +12,7 @@ class TestIconSet < Test::Unit::TestCase assert(@icon_set.percent) refute(@icon_set.reverse) assert(@icon_set.showValue) + assert_equal([0, 33, 67], @icon_set.interpolationPoints) end def test_icon_set @@ -20,6 +21,12 @@ class TestIconSet < Test::Unit::TestCase assert_equal("5Rating", @icon_set.iconSet) end + def test_interpolation_points + assert_raise(ArgumentError) { @icon_set.interpolationPoints = ["invalid_value"] } + assert_nothing_raised { @icon_set.interpolationPoints = [0, 60, 80] } + assert_equal([0, 60, 80], @icon_set.interpolationPoints) + end + def test_percent assert_raise(ArgumentError) { @icon_set.percent = :invalid_type } assert_nothing_raised { @icon_set.percent = false } @@ -44,4 +51,13 @@ class TestIconSet < Test::Unit::TestCase assert_equal(1, doc.xpath(".//iconSet[@iconSet='3TrafficLights1'][@percent=1][@reverse=0][@showValue=1]").size) assert_equal(3, doc.xpath(".//iconSet//cfvo").size) end + + def test_to_xml_string_with_interpolation_points + @icon_set.iconSet = '5Arrows' + @icon_set.interpolationPoints = [0, 20, 40, 60, 80] + doc = Nokogiri::XML.parse(@icon_set.to_xml_string) + + assert_equal(1, doc.xpath(".//iconSet[@iconSet='5Arrows'][@percent=1][@reverse=0][@showValue=1]").size) + assert_equal(5, doc.xpath(".//iconSet//cfvo").size) + end end |
