Sha256: a710924db52479ae50139ddd192f887928734f016cd679cb8e299c5425d093b8

Contents?: true

Size: 751 Bytes

Versions: 3

Compression:

Stored size: 751 Bytes

Contents

# coding: utf-8

require 'test/unit/helper'

class ThinReports::Generator::PDF::TestParseColor < MiniTest::Unit::TestCase
  include ThinReports::TestHelpers
  
  class TestColorParser
    include ThinReports::Generator::PDF::ParseColor
  end
  
  def setup
    @parser = TestColorParser.new
  end
  
  def test_parse_color_with_hexcolor
    assert_equal @parser.parse_color('#ff0000'), 'ff0000'
    assert_equal @parser.parse_color('000000'), '000000'
  end
  
  def test_parse_color_with_colorname
    assert_equal @parser.parse_color('red'), 'ff0000'
  end
  
  def test_parse_color_with_colorname_raise_when_unknown_name_given
    assert_raises ThinReports::Errors::UnsupportedColorName do
      @parser.parse_color('whitesmoke')
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
thinreports-0.7.7 test/unit/generator/pdf/document/test_parse_color.rb
thinreports-0.7.6 test/unit/generator/pdf/document/test_parse_color.rb
thinreports-0.7.5 test/unit/generator/pdf/document/test_parse_color.rb