Sha256: 724ab510e9560d6bbb213be0b4597ae9b12c1fb735b5b7d556a40ad5e566ae41

Contents?: true

Size: 739 Bytes

Versions: 4

Compression:

Stored size: 739 Bytes

Contents

# frozen_string_literal: true

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

4 entries across 4 versions & 1 rubygems

Version Path
thinreports-0.10.3 test/units/generator/pdf/document/test_parse_color.rb
thinreports-0.10.2 test/unit/generator/pdf/document/test_parse_color.rb
thinreports-0.10.1 test/unit/generator/pdf/document/test_parse_color.rb
thinreports-0.10.0 test/unit/generator/pdf/document/test_parse_color.rb