diff options
| author | Randy Morgan <[email protected]> | 2013-09-29 13:16:22 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2013-09-29 13:16:22 +0900 |
| commit | 2d604bd4a7463d6f248e103f24246e53973c71aa (patch) | |
| tree | 7e89d913b128d5d074f94a1b1e6030470687a8fc /test/workbook/tc_workbook.rb | |
| parent | 097b7da7eb6b29907da28c174e83ff22a6358176 (diff) | |
| download | caxlsx-2d604bd4a7463d6f248e103f24246e53973c71aa.tar.gz caxlsx-2d604bd4a7463d6f248e103f24246e53973c71aa.zip | |
Integrate workbook views and alter serialization
This integrates workbook views and sheet state into serialization.
I also noticed that we were populating defined names during
serialization. While it is good to delay this as late as possible
as there is always the chance that some conditional programming
by the consumer adds, and then removes an autofilter, I am
choosing to risk it at this point for cleaner code.
Diffstat (limited to 'test/workbook/tc_workbook.rb')
| -rw-r--r-- | test/workbook/tc_workbook.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/workbook/tc_workbook.rb b/test/workbook/tc_workbook.rb index 32b6935a..2a51e4bd 100644 --- a/test/workbook/tc_workbook.rb +++ b/test/workbook/tc_workbook.rb @@ -53,6 +53,11 @@ class TestWorkbook < Test::Unit::TestCase assert_equal(1, @wb.defined_names.size) end + def test_add_view + @wb.add_view visibility: :hidden, window_width: 800 + assert_equal(1, @wb.views.size) + end + def test_shared_strings assert_equal(@wb.use_shared_strings, nil) assert_raise(ArgumentError) {@wb.use_shared_strings = 'bpb'} @@ -116,6 +121,15 @@ class TestWorkbook < Test::Unit::TestCase assert_equal(doc.xpath('//xmlns:workbook/xmlns:definedNames/xmlns:definedName').inner_text, @wb.worksheets[0].auto_filter.defined_name) end + def test_to_xml_string_book_views + @wb.add_worksheet do |sheet| + sheet.add_row [1, "two"] + end + @wb.add_view active_tab: 0, first_sheet: 0 + doc = Nokogiri::XML(@wb.to_xml_string) + assert_equal(1, doc.xpath('//xmlns:workbook/xmlns:bookViews/xmlns:workbookView[@activeTab=0]').size) + end + def test_to_xml_uses_correct_rIds_for_pivotCache ws = @wb.add_worksheet pivot_table = ws.add_pivot_table('G5:G6', 'A1:D5') |
