summaryrefslogtreecommitdiffhomepage
path: root/test/stylesheet/tc_gradient_stop.rb
blob: 6b37779fcf83c758ecc7cd0cd3e6247ad24d88f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# frozen_string_literal: true

require 'tc_helper'

class TestGradientStop < Test::Unit::TestCase
  def setup
    @item = Axlsx::GradientStop.new(Axlsx::Color.new(rgb: "FFFF0000"), 1.0)
  end

  def teardown; end

  def test_initialiation
    assert_equal("FFFF0000", @item.color.rgb)
    assert_in_delta(@item.position, 1.0)
  end

  def test_position
    assert_raise(ArgumentError) { @item.position = -1.1 }
    assert_nothing_raised { @item.position = 0.0 }
    assert_in_delta(@item.position, 0.0)
  end

  def test_color
    assert_raise(ArgumentError) { @item.color = nil }
    color = Axlsx::Color.new(rgb: "FF0000FF")
    @item.color = color

    assert_equal("FF0000FF", @item.color.rgb)
  end
end