Sha256: 5d9a2de8b74aa900b5b595658b53dbb57e2ad9ce8c21708b760d50e7a9929a0b

Contents?: true

Size: 903 Bytes

Versions: 19

Compression:

Stored size: 903 Bytes

Contents

require 'tc_helper.rb'

class TestColor < Test::Unit::TestCase

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

  def teardown
  end

  def test_initialiation
    assert_equal(@item.auto, nil)
    assert_equal(@item.rgb, "FF000000")
    assert_equal(@item.tint, nil)
  end

  def test_auto
    assert_raise(ArgumentError) { @item.auto = -1 }
    assert_nothing_raised { @item.auto = true }
    assert_equal(@item.auto, true )
  end

  def test_rgb
    assert_raise(ArgumentError) { @item.rgb = -1 }
    assert_nothing_raised { @item.rgb = "FF00FF00" }
    assert_equal(@item.rgb, "FF00FF00" )
  end

  def test_rgb_writer_doesnt_mutate_its_argument
    my_rgb = 'ff00ff00'
    @item.rgb = my_rgb
    assert_equal 'ff00ff00', my_rgb
  end

  def test_tint
    assert_raise(ArgumentError) { @item.tint = -1 }
    assert_nothing_raised { @item.tint = -1.0 }
    assert_equal(@item.tint, -1.0 )
  end


end

Version data entries

19 entries across 19 versions & 6 rubygems

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