summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2012-12-15 10:39:37 +0900
committerRandy Morgan <[email protected]>2012-12-15 10:39:37 +0900
commit054de56d12e203a5f0696f98ac9fad3159e7abc1 (patch)
treec29ef8fb0bd35ef6170d5aa26cbd9bc8960a0a30 /test
parentb1600deadaafdb396c5cc7ca9d448e8adab8ac11 (diff)
downloadcaxlsx-054de56d12e203a5f0696f98ac9fad3159e7abc1.tar.gz
caxlsx-054de56d12e203a5f0696f98ac9fad3159e7abc1.zip
Added methods to simplify outlining with specs
worksheet#outline_rows worksheet#outline_columns
Diffstat (limited to 'test')
-rw-r--r--test/tc_package.rb5
-rw-r--r--test/workbook/worksheet/tc_pivot_table.rb1
-rw-r--r--test/workbook/worksheet/tc_worksheet.rb17
3 files changed, 21 insertions, 2 deletions
diff --git a/test/tc_package.rb b/test/tc_package.rb
index be303419..8a25d946 100644
--- a/test/tc_package.rb
+++ b/test/tc_package.rb
@@ -7,8 +7,9 @@ class TestPackage < Test::Unit::TestCase
ws = @package.workbook.add_worksheet
ws.add_row ['Can', 'we', 'build it?']
ws.add_row ['Yes!', 'We', 'can!']
+ ws.outline_rows 0, 1
+ ws.outline_columns 0, 1
ws.add_hyperlink :ref => ws.rows.first.cells.last, :location => 'https://github.com/randym'
- # TODO this needs to be confirmed and checked. Validation errors should not be happening here!!!!!!
ws.workbook.add_defined_name("#{ws.name}!A1:C2", :name => '_xlnm.Print_Titles', :hidden => true)
ws.protect_range('A1:C1')
ws.protect_range(ws.rows.last.cells)
@@ -145,7 +146,7 @@ class TestPackage < Test::Unit::TestCase
#no mystery parts
- assert_equal(p.size, 24)
+ assert_equal(24, p.size)
end
diff --git a/test/workbook/worksheet/tc_pivot_table.rb b/test/workbook/worksheet/tc_pivot_table.rb
index 3a94cfae..9adbaf93 100644
--- a/test/workbook/worksheet/tc_pivot_table.rb
+++ b/test/workbook/worksheet/tc_pivot_table.rb
@@ -45,6 +45,7 @@ class TestPivotTable < Test::Unit::TestCase
assert_equal(3, pivot_table.header_index_of('Type' ))
assert_equal(4, pivot_table.header_index_of('Sales' ))
assert_equal(nil, pivot_table.header_index_of('Missing'))
+ assert_equal(%w(A1 B1 C1 D1 E1), pivot_table.header_cell_refs)
end
def test_pn
diff --git a/test/workbook/worksheet/tc_worksheet.rb b/test/workbook/worksheet/tc_worksheet.rb
index 0311018b..846c2491 100644
--- a/test/workbook/worksheet/tc_worksheet.rb
+++ b/test/workbook/worksheet/tc_worksheet.rb
@@ -475,4 +475,21 @@ class TestWorksheet < Test::Unit::TestCase
doc = Nokogiri::XML(@ws.to_xml_string)
assert(doc.xpath('//sheetPr[@filterMode="true"]'))
end
+
+ def test_outline_rows
+ 3.times { @ws.add_row [1,2,3] }
+ @ws.outline_rows 0, 2
+ assert_equal(1, @ws.rows[0].outline_level)
+ assert_equal(true, @ws.rows[2].hidden)
+ assert_equal(true, @ws.sheet_view.show_outline_symbols)
+ end
+
+ def test_outline_columns
+ 3.times { @ws.add_row [1,2,3] }
+ @ws.outline_columns 0, 2
+ assert_equal(1, @ws.column_info[0].outline_level)
+ assert_equal(true, @ws.column_info[2].hidden)
+ assert_equal(true, @ws.sheet_view.show_outline_symbols)
+ end
+
end