Sha256: c95fb4f36515a0ecfbcc440d590ab08f26e0e7f6c5ce5b26a363fa3409a400f4

Contents?: true

Size: 735 Bytes

Versions: 3

Compression:

Stored size: 735 Bytes

Contents

# coding: utf-8

require 'test_helper'

class Thinreports::Generator::PDF::TestParseColor < Minitest::Test
  include Thinreports::TestHelper
  
  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.8.2 test/unit/generator/pdf/document/test_parse_color.rb
thinreports-0.8.1 test/unit/generator/pdf/document/test_parse_color.rb
thinreports-0.8.0 test/unit/generator/pdf/document/test_parse_color.rb