summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/stylesheet/tc_styles.rb15
1 files changed, 11 insertions, 4 deletions
diff --git a/test/stylesheet/tc_styles.rb b/test/stylesheet/tc_styles.rb
index 1b7365b2..61a87bf7 100644
--- a/test/stylesheet/tc_styles.rb
+++ b/test/stylesheet/tc_styles.rb
@@ -2,12 +2,12 @@ require 'test/unit'
require 'axlsx.rb'
class TestStyles < Test::Unit::TestCase
- def setup
+ def setup
@styles = Axlsx::Styles.new
end
def teardown
end
-
+
def test_valid_document
schema = Nokogiri::XML::Schema(File.open(Axlsx::SML_XSD))
doc = Nokogiri::XML(@styles.to_xml)
@@ -18,7 +18,14 @@ class TestStyles < Test::Unit::TestCase
end
assert(errors.size == 0)
end
+ def test_add_style_border_hash
+ border_count = @styles.borders.size
+ s = @styles.add_style :border => {:style=>:thin, :color => "FFFF0000"}
+ assert_equal(@styles.borders.size, border_count + 1)
+ assert_equal(@styles.borders.last.prs.last.color.rgb, "FFFF0000")
+ assert_raise(ArgumentError) { @styles.add_style :border => {:color => "FFFF0000"} }
+ end
def test_add_style
fill_count = @styles.fills.size
@@ -44,9 +51,9 @@ class TestStyles < Test::Unit::TestCase
assert_equal(xf.alignment.horizontal, :left, "horizontal alignment applied")
assert_equal(xf.protection.hidden, true, "hidden protection set")
assert_equal(xf.protection.locked, true, "cell locking set")
- assert_raise(ArgumentError, "should reject invalid borderId") { @styles.add_style :border => 2 }
+ assert_raise(ArgumentError, "should reject invalid borderId") { @styles.add_style :border => 2 }
+
-
assert_equal(xf.applyProtection, 1, "protection applied")
assert_equal(xf.applyBorder, true, "border applied")
assert_equal(xf.applyNumberFormat, true, "number format applied")