Sha256: 0d01c69964a4086d874416aa455f2aebe269f7f01f750f454ad6179b627e2056

Contents?: true

Size: 1.16 KB

Versions: 33

Compression:

Stored size: 1.16 KB

Contents

require 'tc_helper.rb'

class TestPatternFill < Test::Unit::TestCase

  def setup
    @item = Axlsx::PatternFill.new
  end

  def teardown
  end


  def test_initialiation
    assert_equal(@item.patternType, :none)
    assert_equal(@item.bgColor, nil)
    assert_equal(@item.fgColor, nil)
  end

  def test_bgColor
    assert_raise(ArgumentError) { @item.bgColor = -1.1 }
    assert_nothing_raised { @item.bgColor = Axlsx::Color.new }
    assert_equal(@item.bgColor.rgb, "FF000000")
  end

  def test_fgColor
    assert_raise(ArgumentError) { @item.fgColor = -1.1 }
    assert_nothing_raised { @item.fgColor = Axlsx::Color.new }
    assert_equal(@item.fgColor.rgb, "FF000000")
  end

  def test_pattern_type
    assert_raise(ArgumentError) { @item.patternType = -1.1 }
    assert_nothing_raised { @item.patternType = :lightUp }
    assert_equal(@item.patternType, :lightUp)
  end
 
  def test_to_xml_string
    @item = Axlsx::PatternFill.new :bgColor => Axlsx::Color.new(:rgb => "FF0000"), :fgColor => Axlsx::Color.new(:rgb=>"00FF00") 
    doc = Nokogiri::XML(@item.to_xml_string)
    assert(doc.xpath('//color[@rgb="FFFF0000"]'))
    assert(doc.xpath('//color[@rgb="FF00FF00"]'))
  end
end

Version data entries

33 entries across 33 versions & 6 rubygems

Version Path
caxlsx-3.1.1 test/stylesheet/tc_pattern_fill.rb
caxlsx-3.1.0 test/stylesheet/tc_pattern_fill.rb
bonio-axlsx-2.2.3 test/stylesheet/tc_pattern_fill.rb
caxlsx-3.0.4 test/stylesheet/tc_pattern_fill.rb
caxlsx-3.0.3 test/stylesheet/tc_pattern_fill.rb
caxlsx-3.0.2 test/stylesheet/tc_pattern_fill.rb
caxlsx-2.0.2 test/stylesheet/tc_pattern_fill.rb
caxlsx-3.0.1 test/stylesheet/tc_pattern_fill.rb
caxlsx-3.0.0 test/stylesheet/tc_pattern_fill.rb
axlsx-alt-3.0.1 test/stylesheet/tc_pattern_fill.rb
axlsx-alt-3.0.0 test/stylesheet/tc_pattern_fill.rb
axlsx-3.0.0.pre test/stylesheet/tc_pattern_fill.rb
bonio-axlsx-2.2.2 test/stylesheet/tc_pattern_fill.rb
bonio-axlsx-2.2.1 test/stylesheet/tc_pattern_fill.rb
dg-axlsx-2.1.0 test/stylesheet/tc_pattern_fill.rb
axlsx-2.1.0.pre test/stylesheet/tc_pattern_fill.rb
l_axlsx-2.0.1 test/stylesheet/tc_pattern_fill.rb
axlsx-2.0.1 test/stylesheet/tc_pattern_fill.rb
axlsx-2.0.0 test/stylesheet/tc_pattern_fill.rb
axlsx-1.3.6 test/stylesheet/tc_pattern_fill.rb