diff options
| author | Scott <[email protected]> | 2012-04-06 07:27:29 -0400 |
|---|---|---|
| committer | Scott <[email protected]> | 2012-04-06 07:27:29 -0400 |
| commit | 89f5b16ae10295e93cd976bc79eec3b8e5902cb8 (patch) | |
| tree | a62f4b690c4c30fc9a2d207876895bfe07d3ec29 | |
| parent | 71859909ed45618cd57ec82bb6781f062d188b6d (diff) | |
| download | caxlsx-89f5b16ae10295e93cd976bc79eec3b8e5902cb8.tar.gz caxlsx-89f5b16ae10295e93cd976bc79eec3b8e5902cb8.zip | |
Add edges() to border to return list of applied edges
Add border edge tests to styles spec
| -rw-r--r-- | lib/axlsx/stylesheet/border.rb | 7 | ||||
| -rw-r--r-- | test/stylesheet/tc_styles.rb | 8 |
2 files changed, 15 insertions, 0 deletions
diff --git a/lib/axlsx/stylesheet/border.rb b/lib/axlsx/stylesheet/border.rb index d23e5476..60b89b6f 100644 --- a/lib/axlsx/stylesheet/border.rb +++ b/lib/axlsx/stylesheet/border.rb @@ -35,6 +35,13 @@ module Axlsx end end + # Return list of edge names applied to this border + def edges + edges = [] + @prs.each {|pr| edges << pr.name} + edges + end + # @see diagonalUp def diagonalUp=(v) Axlsx::validate_boolean v; @diagonalUp = v end # @see diagonalDown diff --git a/test/stylesheet/tc_styles.rb b/test/stylesheet/tc_styles.rb index ef14e151..42c64eee 100644 --- a/test/stylesheet/tc_styles.rb +++ b/test/stylesheet/tc_styles.rb @@ -23,7 +23,15 @@ class TestStyles < Test::Unit::TestCase 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"} } + [:top,:bottom,:left,:right].each {|edge| assert(@styles.borders.last.edges.include?(edge))} + s2 = @styles.add_style :border => {:style=>:thin, :color => "0000FFFF", :edges => [:top, :bottom]} + assert_equal(@styles.borders.size, border_count + 2) + assert_equal(@styles.borders.last.prs.last.color.rgb, "0000FFFF") + assert(@styles.borders.last.edges.include?(:top)) + assert(@styles.borders.last.edges.include?(:bottom)) + assert(! @styles.borders.last.edges.include?(:left)) + assert(! @styles.borders.last.edges.include?(:right)) end def test_add_style |
