summaryrefslogtreecommitdiffhomepage
path: root/test/stylesheet/tc_gradient_fill.rb
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2011-11-20 23:22:04 +0900
committerRandy Morgan <[email protected]>2011-11-20 23:22:04 +0900
commite53f04284618713b0a90b7a691425c380e829476 (patch)
tree801fea138160f9af426d62bf94ad5bf97123ece9 /test/stylesheet/tc_gradient_fill.rb
downloadcaxlsx-e53f04284618713b0a90b7a691425c380e829476.tar.gz
caxlsx-e53f04284618713b0a90b7a691425c380e829476.zip
first commit
Diffstat (limited to 'test/stylesheet/tc_gradient_fill.rb')
-rw-r--r--test/stylesheet/tc_gradient_fill.rb65
1 files changed, 65 insertions, 0 deletions
diff --git a/test/stylesheet/tc_gradient_fill.rb b/test/stylesheet/tc_gradient_fill.rb
new file mode 100644
index 00000000..f5c87771
--- /dev/null
+++ b/test/stylesheet/tc_gradient_fill.rb
@@ -0,0 +1,65 @@
+require 'test/unit'
+require 'axlsx.rb'
+
+class TestGradientFill < Test::Unit::TestCase
+
+ def setup
+ @item = Axlsx::GradientFill.new
+ end
+
+ 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(@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)
+ end
+
+ def test_degree
+ assert_raise(ArgumentError) { @item.degree = -7 }
+ assert_nothing_raised { @item.degree = 5.0 }
+ assert_equal(@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)
+ end
+
+ def test_right
+ assert_raise(ArgumentError) { @item.right = -1.1 }
+ assert_nothing_raised { @item.right = 0.5 }
+ assert_equal(@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)
+ end
+
+ def test_bottom
+ assert_raise(ArgumentError) { @item.bottom = -1.1 }
+ assert_nothing_raised { @item.bottom = 0.0 }
+ assert_equal(@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(@item.stop.last.is_a?(Axlsx::GradientStop))
+ end
+end