summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorWeston Ganger <[email protected]>2022-10-09 14:40:24 -0700
committerWeston Ganger <[email protected]>2022-10-09 14:40:24 -0700
commit03bad903f474fecccc7dacdc14ef17605d9e2aa2 (patch)
treee0a88df15105a6c2d5dfda5c9178a428b280e6bf /test
parent99b25655ef0e5c953007ff81b5bc08058831da8c (diff)
downloadcaxlsx-03bad903f474fecccc7dacdc14ef17605d9e2aa2.tar.gz
caxlsx-03bad903f474fecccc7dacdc14ef17605d9e2aa2.zip
Improvements
Diffstat (limited to 'test')
-rw-r--r--test/workbook/worksheet/tc_border_creator.rb40
1 files changed, 40 insertions, 0 deletions
diff --git a/test/workbook/worksheet/tc_border_creator.rb b/test/workbook/worksheet/tc_border_creator.rb
new file mode 100644
index 00000000..95a85b18
--- /dev/null
+++ b/test/workbook/worksheet/tc_border_creator.rb
@@ -0,0 +1,40 @@
+require 'tc_helper.rb'
+
+class TestBorderCreator < Test::Unit::TestCase
+ def setup
+ @p = Axlsx::Package.new
+ @wb = @p.workbook
+ @ws = @wb.add_worksheet
+ end
+
+ def test_defaults
+ 3.times do
+ @ws.add_row [1,2,3]
+ end
+
+ bc = Axlsx::BorderCreator.new(@ws, @ws["A1:B2"], {})
+ assert_equal bc.instance_variable_get(:@edges), :all
+ assert_equal bc.instance_variable_get(:@width), :thin
+ assert_equal bc.instance_variable_get(:@color), "000000"
+
+ bc = Axlsx::BorderCreator.new(@ws, @ws["A1:B2"], [:top])
+ assert_equal bc.instance_variable_get(:@edges), [:top]
+ assert_equal bc.instance_variable_get(:@width), :thin
+ assert_equal bc.instance_variable_get(:@color), "000000"
+
+ bc = Axlsx::BorderCreator.new(@ws, @ws["A1:B2"], {edges: [:top], style: :thick, color: "ffffff"})
+ assert_equal bc.instance_variable_get(:@edges), [:top]
+ assert_equal bc.instance_variable_get(:@width), :thick
+ assert_equal bc.instance_variable_get(:@color), "ffffff"
+ end
+
+ def test_draw
+ 5.times do
+ @ws.add_row [1,2,3,4,5]
+ end
+
+ bc = Axlsx::BorderCreator.new(@ws, @ws["A1:C3"], {})
+ bc.draw
+ # TODO add more expectations
+ end
+end