summaryrefslogtreecommitdiffhomepage
path: root/test/stylesheet
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2012-03-23 00:48:42 +0900
committerRandy Morgan <[email protected]>2012-03-23 00:48:42 +0900
commit43d31eb7c4f04e3ddf3bf865d55e6ce8de7b7a69 (patch)
tree44b89d66539724341e95cfc29d6aa70c771d77ca /test/stylesheet
parent6df8104a5b059497d7363d45118a5d1379c4db6a (diff)
downloadcaxlsx-43d31eb7c4f04e3ddf3bf865d55e6ce8de7b7a69.tar.gz
caxlsx-43d31eb7c4f04e3ddf3bf865d55e6ce8de7b7a69.zip
update add Styles#add_style to allow a simple hash to create a new border style
Diffstat (limited to 'test/stylesheet')
-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")