diff options
| author | Jonathan Tron <[email protected]> | 2015-07-04 11:55:35 +0200 |
|---|---|---|
| committer | Jonathan Tron <[email protected]> | 2015-07-04 11:55:35 +0200 |
| commit | 0c0d9d6e6efa95cf9e4ce1cb562345d9c5be2526 (patch) | |
| tree | e3bc414a75b2a56ae08287759a17e6d1821ae74c /test/workbook/worksheet/tc_sheet_pr.rb | |
| parent | 69bcb479a3a3f279a8f395e02f7191ba2bd4152d (diff) | |
| download | caxlsx-0c0d9d6e6efa95cf9e4ce1cb562345d9c5be2526.tar.gz caxlsx-0c0d9d6e6efa95cf9e4ce1cb562345d9c5be2526.zip | |
Add test, fix example with tab color generation and fix a but due to a typo
Diffstat (limited to 'test/workbook/worksheet/tc_sheet_pr.rb')
| -rw-r--r-- | test/workbook/worksheet/tc_sheet_pr.rb | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/test/workbook/worksheet/tc_sheet_pr.rb b/test/workbook/worksheet/tc_sheet_pr.rb index 43f2941d..be45438b 100644 --- a/test/workbook/worksheet/tc_sheet_pr.rb +++ b/test/workbook/worksheet/tc_sheet_pr.rb @@ -5,23 +5,45 @@ class TestSheetPr < Test::Unit::TestCase def setup worksheet = Axlsx::Package.new.workbook.add_worksheet - @options = { + @options = { :sync_horizontal => false, :sync_vertical => false, - :transtion_evaluation => true, + :transition_evaluation => true, :transition_entry => true, :published => false, :filter_mode => true, :enable_format_conditions_calculation => false, :code_name => '007', - :sync_ref => 'foo' + :sync_ref => 'foo', + :tab_color => 'FFFF6666' } @sheet_pr = Axlsx::SheetPr.new(worksheet, @options) end def test_initialization @options.each do |key, value| - assert_equal value, @sheet_pr.send(key) + if key==:tab_color + stored_value = @sheet_pr.send(key) + assert_equal Axlsx::Color, stored_value.class + assert_equal value, stored_value.rgb + else + assert_equal value, @sheet_pr.send(key) + end end end + + def test_to_xml_string + doc = Nokogiri::XML(@sheet_pr.to_xml_string) + assert_equal(doc.xpath("//sheetPr[@syncHorizontal='0']").size, 1) + assert_equal(doc.xpath("//sheetPr[@syncVertical='0']").size, 1) + assert_equal(doc.xpath("//sheetPr[@transitionEvaluation='1']").size, 1) + assert_equal(doc.xpath("//sheetPr[@transitionEntry='1']").size, 1) + assert_equal(doc.xpath("//sheetPr[@published='0']").size, 1) + assert_equal(doc.xpath("//sheetPr[@filterMode='1']").size, 1) + assert_equal(doc.xpath("//sheetPr[@enableFormatConditionsCalculation='0']").size, 1) + assert_equal(doc.xpath("//sheetPr[@codeName='007']").size, 1) + assert_equal(doc.xpath("//sheetPr[@syncRef='foo']").size, 1) + assert_equal(doc.xpath("//sheetPr/tabColor[@rgb='FFFF6666']").size, 1) + assert_equal(doc.xpath("//sheetPr/pageSetUpPr[@fitToPage='0']").size, 1) + end end |
