Sha256: 4fd5f1f41ecf96ad329aed208baef02032a4d32ca594d41dabe357e198d3b7ae

Contents?: true

Size: 1.37 KB

Versions: 20

Compression:

Stored size: 1.37 KB

Contents

require 'tc_helper.rb'

class TestIconSet < Test::Unit::TestCase
  def setup
    @icon_set = Axlsx::IconSet.new
  end

  def test_defaults
    assert_equal @icon_set.iconSet, "3TrafficLights1"
    assert_equal @icon_set.percent, true
    assert_equal @icon_set.reverse, false
    assert_equal @icon_set.showValue, true
  end

  def test_icon_set
    assert_raise(ArgumentError) { @icon_set.iconSet = "invalid_value" }
    assert_nothing_raised { @icon_set.iconSet = "5Rating"}
    assert_equal(@icon_set.iconSet, "5Rating")
  end

  def test_percent
    assert_raise(ArgumentError) { @icon_set.percent = :invalid_type }
    assert_nothing_raised { @icon_set.percent =  false}
    assert_equal(@icon_set.percent, false)
  end

  def test_showValue
    assert_raise(ArgumentError) { @icon_set.showValue = :invalid_type }
    assert_nothing_raised { @icon_set.showValue =  false}
    assert_equal(@icon_set.showValue, false)
  end

  def test_reverse
    assert_raise(ArgumentError) { @icon_set.reverse = :invalid_type }
    assert_nothing_raised { @icon_set.reverse =  false}
    assert_equal(@icon_set.reverse, false)
  end

  def test_to_xml_string
    doc = Nokogiri::XML.parse(@icon_set.to_xml_string)
    assert_equal(doc.xpath(".//iconSet[@iconSet='3TrafficLights1'][@percent='true'][@reverse='false'][@showValue='true']").size, 1)
    assert_equal(doc.xpath(".//iconSet//cfvo").size, 3)
  end

end

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
caxlsx-2.0.2 test/workbook/worksheet/tc_icon_set.rb
axlsx-2.0.1 test/workbook/worksheet/tc_icon_set.rb
axlsx-2.0.0 test/workbook/worksheet/tc_icon_set.rb
axlsx-1.3.6 test/workbook/worksheet/tc_icon_set.rb
axlsx-1.3.5 test/workbook/worksheet/tc_icon_set.rb
axlsx-1.3.4 test/workbook/worksheet/tc_icon_set.rb
axlsx-1.3.3 test/workbook/worksheet/tc_icon_set.rb
axlsx-1.3.2 test/workbook/worksheet/tc_icon_set.rb
axlsx-1.3.1 test/workbook/worksheet/tc_icon_set.rb
axlsx-1.2.3 test/workbook/worksheet/tc_icon_set.rb
axlsx-1.2.2 test/workbook/worksheet/tc_icon_set.rb
axlsx-1.2.1 test/workbook/worksheet/tc_icon_set.rb
axlsx-1.2.0 test/workbook/worksheet/tc_icon_set.rb
axlsx-1.1.8 test/workbook/worksheet/tc_icon_set.rb
axlsx-1.1.7 test/workbook/worksheet/tc_icon_set.rb
axlsx-1.1.6 test/workbook/worksheet/tc_icon_set.rb
axlsx-1.1.5 test/workbook/worksheet/tc_icon_set.rb
axlsx-1.1.4 test/workbook/worksheet/tc_icon_set.rb
axlsx-1.1.3 test/workbook/worksheet/tc_icon_set.rb
axlsx-1.1.2 test/workbook/worksheet/tc_icon_set.rb