summaryrefslogtreecommitdiffhomepage
path: root/test/stylesheet/tc_gradient_fill.rb
diff options
context:
space:
mode:
authorGeremia Taglialatela <[email protected]>2023-04-13 13:13:34 +0200
committerGeremia Taglialatela <[email protected]>2023-05-03 16:05:17 +0200
commit350f7ae9a04f3d39c099cc54f7c04bf31f385d96 (patch)
treee84af2a70d3b18a0b94c784338faf48215c9c8a8 /test/stylesheet/tc_gradient_fill.rb
parente81036b76e734ab03fac31faafb9732f6b3b2928 (diff)
downloadcaxlsx-350f7ae9a04f3d39c099cc54f7c04bf31f385d96.tar.gz
caxlsx-350f7ae9a04f3d39c099cc54f7c04bf31f385d96.zip
Add RuboCop Minitest
Diffstat (limited to 'test/stylesheet/tc_gradient_fill.rb')
-rw-r--r--test/stylesheet/tc_gradient_fill.rb28
1 files changed, 15 insertions, 13 deletions
diff --git a/test/stylesheet/tc_gradient_fill.rb b/test/stylesheet/tc_gradient_fill.rb
index 3707cdad..7f0a4013 100644
--- a/test/stylesheet/tc_gradient_fill.rb
+++ b/test/stylesheet/tc_gradient_fill.rb
@@ -8,54 +8,55 @@ class TestGradientFill < Test::Unit::TestCase
def teardown; end
def test_initialiation
- assert_equal(@item.type, :linear)
- assert_equal(@item.degree, nil)
- assert_equal(@item.left, nil)
- assert_equal(@item.right, nil)
- assert_equal(@item.top, nil)
- assert_equal(@item.bottom, nil)
+ assert_equal(:linear, @item.type)
+ assert_nil(@item.degree)
+ assert_nil(@item.left)
+ assert_nil(@item.right)
+ assert_nil(@item.top)
+ assert_nil(@item.bottom)
assert(@item.stop.is_a?(Axlsx::SimpleTypedList))
end
def test_type
assert_raise(ArgumentError) { @item.type = 7 }
assert_nothing_raised { @item.type = :path }
- assert_equal(@item.type, :path)
+ assert_equal(:path, @item.type)
end
def test_degree
assert_raise(ArgumentError) { @item.degree = -7 }
assert_nothing_raised { @item.degree = 5.0 }
- assert_equal(@item.degree, 5.0)
+ assert_in_delta(@item.degree, 5.0)
end
def test_left
assert_raise(ArgumentError) { @item.left = -1.1 }
assert_nothing_raised { @item.left = 1.0 }
- assert_equal(@item.left, 1.0)
+ assert_in_delta(@item.left, 1.0)
end
def test_right
assert_raise(ArgumentError) { @item.right = -1.1 }
assert_nothing_raised { @item.right = 0.5 }
- assert_equal(@item.right, 0.5)
+ assert_in_delta(@item.right, 0.5)
end
def test_top
assert_raise(ArgumentError) { @item.top = -1.1 }
assert_nothing_raised { @item.top = 1.0 }
- assert_equal(@item.top, 1.0)
+ assert_in_delta(@item.top, 1.0)
end
def test_bottom
assert_raise(ArgumentError) { @item.bottom = -1.1 }
assert_nothing_raised { @item.bottom = 0.0 }
- assert_equal(@item.bottom, 0.0)
+ assert_in_delta(@item.bottom, 0.0)
end
def test_stop
@item.stop << Axlsx::GradientStop.new(Axlsx::Color.new(:rgb => "00000000"), 0.5)
- assert(@item.stop.size == 1)
+
+ assert_equal(1, @item.stop.size)
assert(@item.stop.last.is_a?(Axlsx::GradientStop))
end
@@ -64,6 +65,7 @@ class TestGradientFill < Test::Unit::TestCase
@item.stop << Axlsx::GradientStop.new(Axlsx::Color.new(:rgb => "FFFFFF"), 0.5)
@item.type = :path
doc = Nokogiri::XML(@item.to_xml_string)
+
assert(doc.xpath("//color[@rgb='FF000000']"))
end
end