diff options
| author | Jurriaan Pruis <[email protected]> | 2014-04-04 11:39:25 +0200 |
|---|---|---|
| committer | Jurriaan Pruis <[email protected]> | 2014-04-04 11:39:25 +0200 |
| commit | 5ccab460b65f597398f1d8a1b2a5a83039b80a9e (patch) | |
| tree | 6fa3a9e38f81e6f59693acf8861b12938d0030bf /test | |
| parent | c649ee7d5ac699d0fc5a36550f502216f9b7318f (diff) | |
| download | caxlsx-5ccab460b65f597398f1d8a1b2a5a83039b80a9e.tar.gz caxlsx-5ccab460b65f597398f1d8a1b2a5a83039b80a9e.zip | |
Fix boolean values so the output matches Excel and works on Numbers
Use 1 or 0 instead of 'true' or 'false' in the XML output
Diffstat (limited to 'test')
| -rw-r--r-- | test/workbook/tc_defined_name.rb | 2 | ||||
| -rw-r--r-- | test/workbook/tc_workbook_view.rb | 3 | ||||
| -rw-r--r-- | test/workbook/worksheet/auto_filter/tc_filters.rb | 2 | ||||
| -rw-r--r-- | test/workbook/worksheet/tc_break.rb | 2 | ||||
| -rw-r--r-- | test/workbook/worksheet/tc_col.rb | 4 | ||||
| -rw-r--r-- | test/workbook/worksheet/tc_conditional_formatting.rb | 4 | ||||
| -rw-r--r-- | test/workbook/worksheet/tc_data_bar.rb | 2 | ||||
| -rw-r--r-- | test/workbook/worksheet/tc_data_validation.rb | 22 | ||||
| -rw-r--r-- | test/workbook/worksheet/tc_header_footer.rb | 4 | ||||
| -rw-r--r-- | test/workbook/worksheet/tc_icon_set.rb | 2 | ||||
| -rw-r--r-- | test/workbook/worksheet/tc_print_options.rb | 2 | ||||
| -rw-r--r-- | test/workbook/worksheet/tc_row.rb | 2 | ||||
| -rw-r--r-- | test/workbook/worksheet/tc_sheet_calc_pr.rb | 2 | ||||
| -rw-r--r-- | test/workbook/worksheet/tc_sheet_format_pr.rb | 8 | ||||
| -rw-r--r-- | test/workbook/worksheet/tc_sheet_protection.rb | 10 | ||||
| -rw-r--r-- | test/workbook/worksheet/tc_sheet_view.rb | 8 | ||||
| -rw-r--r-- | test/workbook/worksheet/tc_worksheet.rb | 12 |
17 files changed, 47 insertions, 44 deletions
diff --git a/test/workbook/tc_defined_name.rb b/test/workbook/tc_defined_name.rb index 4da31eb8..2d3ff0d9 100644 --- a/test/workbook/tc_defined_name.rb +++ b/test/workbook/tc_defined_name.rb @@ -42,7 +42,7 @@ class TestDefinedNames < Test::Unit::TestCase @dn.hidden = true doc = Nokogiri::XML(@dn.to_xml_string) assert_equal(doc.xpath("//definedName[@name='_xlnm.Print_Titles']").size, 1) - assert_equal(doc.xpath("//definedName[@hidden='true']").size, 1) + assert_equal(doc.xpath("//definedName[@hidden='1']").size, 1) assert_equal('Sheet1!A1:A1', doc.xpath('//definedName').text) end diff --git a/test/workbook/tc_workbook_view.rb b/test/workbook/tc_workbook_view.rb index 73f39a9c..2aa6521a 100644 --- a/test/workbook/tc_workbook_view.rb +++ b/test/workbook/tc_workbook_view.rb @@ -40,6 +40,9 @@ class TestWorkbookView < Test::Unit::TestCase xml = @book_view.to_xml_string doc = Nokogiri::XML(xml) @options.each do |key, value| + if value == true || value == false + value = value ? 1 : 0 + end path = "workbookView[@#{Axlsx.camel(key, false)}='#{value}']" assert_equal(1, doc.xpath(path).size) end diff --git a/test/workbook/worksheet/auto_filter/tc_filters.rb b/test/workbook/worksheet/auto_filter/tc_filters.rb index e755825b..3a8759aa 100644 --- a/test/workbook/worksheet/auto_filter/tc_filters.rb +++ b/test/workbook/worksheet/auto_filter/tc_filters.rb @@ -44,7 +44,7 @@ class TestFilters < Test::Unit::TestCase def test_to_xml_string doc = Nokogiri::XML(@filters.to_xml_string) - assert_equal(1, doc.xpath('//filters[@blank="true"]').size) + assert_equal(1, doc.xpath('//filters[@blank=1]').size) end end diff --git a/test/workbook/worksheet/tc_break.rb b/test/workbook/worksheet/tc_break.rb index cf956ad8..bf440b0b 100644 --- a/test/workbook/worksheet/tc_break.rb +++ b/test/workbook/worksheet/tc_break.rb @@ -44,6 +44,6 @@ class TestBreak < Test::Unit::TestCase def test_to_xml_string doc = Nokogiri::XML(@break.to_xml_string) - assert_equal(doc.xpath('//brk[@id="1"][@min="1"][@max="10"][@pt="false"][@man="true"]').size, 1) + assert_equal(doc.xpath('//brk[@id="1"][@min="1"][@max="10"][@pt=0][@man=1]').size, 1) end end diff --git a/test/workbook/worksheet/tc_col.rb b/test/workbook/worksheet/tc_col.rb index c0c5e64b..5b3dfa57 100644 --- a/test/workbook/worksheet/tc_col.rb +++ b/test/workbook/worksheet/tc_col.rb @@ -61,11 +61,11 @@ class TestCol < Test::Unit::TestCase def test_to_xml_string @col.width = 100 doc = Nokogiri::XML(@col.to_xml_string) - assert_equal(1, doc.xpath("//col [@bestFit='#{@col.best_fit}']").size) + assert_equal(1, doc.xpath("//col [@bestFit='#{@col.best_fit ? 1 : 0}']").size) assert_equal(1, doc.xpath("//col [@max=#{@col.max}]").size) assert_equal(1, doc.xpath("//col [@min=#{@col.min}]").size) assert_equal(1, doc.xpath("//col [@width=#{@col.width}]").size) - assert_equal(1, doc.xpath("//col [@customWidth='#{@col.custom_width}']").size) + assert_equal(1, doc.xpath("//col [@customWidth='#{@col.custom_width ? 1 : 0}']").size) end def test_style diff --git a/test/workbook/worksheet/tc_conditional_formatting.rb b/test/workbook/worksheet/tc_conditional_formatting.rb index 62af8ebe..bbf92e21 100644 --- a/test/workbook/worksheet/tc_conditional_formatting.rb +++ b/test/workbook/worksheet/tc_conditional_formatting.rb @@ -113,8 +113,8 @@ class TestConditionalFormatting < Test::Unit::TestCase :percent => false, :rank => 0, :stdDev => 1, :stopIfTrue => true, :timePeriod => :today, :formula => "0.0"}) doc = Nokogiri::XML.parse(cf.to_xml_string) - assert_equal(1, doc.xpath(".//conditionalFormatting//cfRule[@type='cellIs'][@aboveAverage='false'][@bottom='false'][@dxfId=0][@equalAverage='false'][@priority=2][@operator='lessThan'][@text=''][@percent='false'][@rank=0][@stdDev=1][@stopIfTrue='true'][@timePeriod='today']").size) - assert doc.xpath(".//conditionalFormatting//cfRule[@type='cellIs'][@aboveAverage='false'][@bottom='false'][@dxfId=0][@equalAverage='false'][@priority=2][@operator='lessThan'][@text=''][@percent='false'][@rank=0][@stdDev=1][@stopIfTrue='true'][@timePeriod='today']//formula=0.0") + assert_equal(1, doc.xpath(".//conditionalFormatting//cfRule[@type='cellIs'][@aboveAverage=0][@bottom=0][@dxfId=0][@equalAverage=0][@priority=2][@operator='lessThan'][@text=''][@percent=0][@rank=0][@stdDev=1][@stopIfTrue=1][@timePeriod='today']").size) + assert doc.xpath(".//conditionalFormatting//cfRule[@type='cellIs'][@aboveAverage=0][@bottom=0][@dxfId=0][@equalAverage=0][@priority=2][@operator='lessThan'][@text=''][@percent=0][@rank=0][@stdDev=1][@stopIfTrue=1][@timePeriod='today']//formula=0.0") end def test_to_xml diff --git a/test/workbook/worksheet/tc_data_bar.rb b/test/workbook/worksheet/tc_data_bar.rb index a6194de9..1c460630 100644 --- a/test/workbook/worksheet/tc_data_bar.rb +++ b/test/workbook/worksheet/tc_data_bar.rb @@ -38,7 +38,7 @@ class TestDataBar < Test::Unit::TestCase def test_to_xml_string doc = Nokogiri::XML.parse(@data_bar.to_xml_string) - assert_equal(doc.xpath(".//dataBar[@minLength=10][@maxLength=90][@showValue='true']").size, 1) + assert_equal(doc.xpath(".//dataBar[@minLength=10][@maxLength=90][@showValue=1]").size, 1) assert_equal(doc.xpath(".//dataBar//cfvo").size, 2) assert_equal(doc.xpath(".//dataBar//color").size, 1) end diff --git a/test/workbook/worksheet/tc_data_validation.rb b/test/workbook/worksheet/tc_data_validation.rb index 17622d7d..fbf31682 100644 --- a/test/workbook/worksheet/tc_data_validation.rb +++ b/test/workbook/worksheet/tc_data_validation.rb @@ -160,11 +160,11 @@ class TestDataValidation < Test::Unit::TestCase #test attributes assert_equal(1, doc.xpath("//xmlns:worksheet/xmlns:dataValidations[@count='1']/xmlns:dataValidation[@sqref='A1'] [@promptTitle='Be carful!'][@prompt='Only values between 5 and 10'][@operator='between'][@errorTitle='Wrong input'] - [@error='Only values between 5 and 10'][@showErrorMessage='true'][@allowBlank='true'][@showInputMessage='true'][@type='whole'] + [@error='Only values between 5 and 10'][@showErrorMessage=1][@allowBlank=1][@showInputMessage=1][@type='whole'] [@errorStyle='information']").size) assert doc.xpath("//xmlns:worksheet/xmlns:dataValidations[@count='1']/xmlns:dataValidation[@sqref='A1'] [@promptTitle='Be carful!'][@prompt='Only values between 5 and 10'][@operator='between'][@errorTitle='Wrong input'] - [@error='Only values between 5 and 10'][@showErrorMessage='true'][@allowBlank='true'][@showInputMessage='true'] + [@error='Only values between 5 and 10'][@showErrorMessage=1][@allowBlank=1][@showInputMessage=1] [@type='whole'][@errorStyle='information']") #test forumula1 @@ -189,11 +189,11 @@ class TestDataValidation < Test::Unit::TestCase #test attributes assert_equal(1, doc.xpath("//xmlns:worksheet/xmlns:dataValidations[@count='1']/xmlns:dataValidation[@sqref='A1'] [@promptTitle='Be carful!'][@prompt='Only values from list'][@errorTitle='Wrong input'][@error='Only values from list'] - [@showErrorMessage='true'][@allowBlank='true'][@showInputMessage='true'][@showDropDown='true'][@type='list'] + [@showErrorMessage=1][@allowBlank=1][@showInputMessage=1][@showDropDown=1][@type='list'] [@errorStyle='stop']").size) assert doc.xpath("//xmlns:worksheet/xmlns:dataValidations[@count='1']/xmlns:dataValidation[@sqref='A1'] [@promptTitle='Be carful!'][@prompt='Only values from list'][@errorTitle='Wrong input'][@error='Only values from list'] - [@showErrorMessage='true'][@allowBlank='true'][@showInputMessage='true'][@showDropDown='true'][@type='list'][@errorStyle='stop']") + [@showErrorMessage=1][@allowBlank=1][@showInputMessage=1][@showDropDown=1][@type='list'][@errorStyle='stop']") #test forumula1 assert_equal(1, doc.xpath("//xmlns:worksheet/xmlns:dataValidations/xmlns:dataValidation/xmlns:formula1").size) @@ -212,11 +212,11 @@ class TestDataValidation < Test::Unit::TestCase #test attributes assert_equal(1, doc.xpath("//xmlns:worksheet/xmlns:dataValidations[@count='1']/xmlns:dataValidation[@sqref='A1'][@promptTitle='Be carful!'] - [@prompt='Only values corresponding formula'][@errorTitle='Wrong input'][@error='Only values corresponding formula'][@showErrorMessage='true'] - [@allowBlank='true'][@showInputMessage='true'][@type='custom'][@errorStyle='stop']").size) + [@prompt='Only values corresponding formula'][@errorTitle='Wrong input'][@error='Only values corresponding formula'][@showErrorMessage=1] + [@allowBlank=1][@showInputMessage=1][@type='custom'][@errorStyle='stop']").size) assert doc.xpath("//xmlns:worksheet/xmlns:dataValidations[@count='1']/xmlns:dataValidation[@sqref='A1'][@promptTitle='Be carful!'] [@prompt='Only values corresponding formula'][@errorTitle='Wrong input'][@error='Only values corresponding formula'] - [@showErrorMessage='true'][@allowBlank='true'][@showInputMessage='true'][@type='custom'][@errorStyle='stop']") + [@showErrorMessage=1][@allowBlank=1][@showInputMessage=1][@type='custom'][@errorStyle='stop']") #test forumula1 assert_equal(1, doc.xpath("//xmlns:worksheet/xmlns:dataValidations/xmlns:dataValidation/xmlns:formula1").size) @@ -240,21 +240,21 @@ class TestDataValidation < Test::Unit::TestCase #test attributes assert_equal(1, doc.xpath("//xmlns:worksheet/xmlns:dataValidations[@count='2']/xmlns:dataValidation[@sqref='A1'] [@promptTitle='Be carful!'][@prompt='Only values between 5 and 10'][@operator='between'][@errorTitle='Wrong input'] - [@error='Only values between 5 and 10'][@showErrorMessage='true'][@allowBlank='true'][@showInputMessage='true'][@type='whole'] + [@error='Only values between 5 and 10'][@showErrorMessage=1][@allowBlank=1][@showInputMessage=1][@type='whole'] [@errorStyle='information']").size) assert doc.xpath("//xmlns:worksheet/xmlns:dataValidations[@count='2']/xmlns:dataValidation[@sqref='A1'] [@promptTitle='Be carful!'][@prompt='Only values between 5 and 10'][@operator='between'][@errorTitle='Wrong input'] - [@error='Only values between 5 and 10'][@showErrorMessage='true'][@allowBlank='true'][@showInputMessage='true'] + [@error='Only values between 5 and 10'][@showErrorMessage=1][@allowBlank=1][@showInputMessage=1] [@type='whole'][@errorStyle='information']") #test attributes assert_equal(1, doc.xpath("//xmlns:worksheet/xmlns:dataValidations[@count='2']/xmlns:dataValidation[@sqref='B1'] [@promptTitle='Be carful!'][@prompt='Only values from list'][@errorTitle='Wrong input'][@error='Only values from list'] - [@showErrorMessage='true'][@allowBlank='true'][@showInputMessage='true'][@showDropDown='true'][@type='list'] + [@showErrorMessage=1][@allowBlank=1][@showInputMessage=1][@showDropDown=1][@type='list'] [@errorStyle='stop']").size) assert doc.xpath("//xmlns:worksheet/xmlns:dataValidations[@count='2']/xmlns:dataValidation[@sqref='B1'] [@promptTitle='Be carful!'][@prompt='Only values from list'][@errorTitle='Wrong input'][@error='Only values from list'] - [@showErrorMessage='true'][@allowBlank='true'][@showInputMessage='true'][@showDropDown='true'][@type='list'][@errorStyle='stop']") + [@showErrorMessage=1][@allowBlank=1][@showInputMessage=1][@showDropDown=1][@type='list'][@errorStyle='stop']") end def test_empty_attributes diff --git a/test/workbook/worksheet/tc_header_footer.rb b/test/workbook/worksheet/tc_header_footer.rb index 4d78aa9d..caf1b9df 100644 --- a/test/workbook/worksheet/tc_header_footer.rb +++ b/test/workbook/worksheet/tc_header_footer.rb @@ -109,7 +109,7 @@ class TestHeaderFooter < Test::Unit::TestCase ) doc = Nokogiri::XML.parse(@hf.to_xml_string) - assert_equal(1, doc.xpath(".//headerFooter[@differentFirst='true'][@differentOddEven='true']").size) + assert_equal(1, doc.xpath(".//headerFooter[@differentFirst=1][@differentOddEven=1]").size) assert_equal(1, doc.xpath(".//headerFooter/oddHeader").size) assert_equal('oh', doc.xpath(".//headerFooter/oddHeader").text) @@ -134,7 +134,7 @@ class TestHeaderFooter < Test::Unit::TestCase ) doc = Nokogiri::XML.parse(@hf.to_xml_string) - assert_equal(1, doc.xpath(".//headerFooter[@differentOddEven='false']").size) + assert_equal(1, doc.xpath(".//headerFooter[@differentOddEven=0]").size) assert_equal(0, doc.xpath(".//headerFooter[@differentFirst]").size) assert_equal(1, doc.xpath(".//headerFooter/oddHeader").size) diff --git a/test/workbook/worksheet/tc_icon_set.rb b/test/workbook/worksheet/tc_icon_set.rb index 5c442068..9096625a 100644 --- a/test/workbook/worksheet/tc_icon_set.rb +++ b/test/workbook/worksheet/tc_icon_set.rb @@ -38,7 +38,7 @@ class TestIconSet < Test::Unit::TestCase def test_to_xml_string doc = Nokogiri::XML.parse(@icon_set.to_xml_string) - assert_equal(doc.xpath(".//iconSet[@iconSet='3TrafficLights1'][@percent='true'][@reverse='false'][@showValue='true']").size, 1) + assert_equal(doc.xpath(".//iconSet[@iconSet='3TrafficLights1'][@percent=1][@reverse=0][@showValue=1]").size, 1) assert_equal(doc.xpath(".//iconSet//cfvo").size, 3) end diff --git a/test/workbook/worksheet/tc_print_options.rb b/test/workbook/worksheet/tc_print_options.rb index 37ff7fe5..32af9cd0 100644 --- a/test/workbook/worksheet/tc_print_options.rb +++ b/test/workbook/worksheet/tc_print_options.rb @@ -42,7 +42,7 @@ class TestPrintOptions < Test::Unit::TestCase def test_to_xml @po.set(:grid_lines => true, :headings => true, :horizontal_centered => true, :vertical_centered => true) doc = Nokogiri::XML.parse(@po.to_xml_string) - assert_equal(1, doc.xpath(".//printOptions[@gridLines='true'][@headings='true'][@horizontalCentered='true'][@verticalCentered='true']").size) + assert_equal(1, doc.xpath(".//printOptions[@gridLines=1][@headings=1][@horizontalCentered=1][@verticalCentered=1]").size) end def test_grid_lines diff --git a/test/workbook/worksheet/tc_row.rb b/test/workbook/worksheet/tc_row.rb index 8a057c26..808e0138 100644 --- a/test/workbook/worksheet/tc_row.rb +++ b/test/workbook/worksheet/tc_row.rb @@ -111,7 +111,7 @@ class TestRow < Test::Unit::TestCase @row.add_cell 1 @row.height = 20 r_s_xml = Nokogiri::XML(@row.to_xml_string(0, '')) - assert_equal(r_s_xml.xpath(".//row[@r=1][@ht=20][@customHeight='true']").size, 1) + assert_equal(r_s_xml.xpath(".//row[@r=1][@ht=20][@customHeight=1]").size, 1) end end diff --git a/test/workbook/worksheet/tc_sheet_calc_pr.rb b/test/workbook/worksheet/tc_sheet_calc_pr.rb index 81761155..05b837cf 100644 --- a/test/workbook/worksheet/tc_sheet_calc_pr.rb +++ b/test/workbook/worksheet/tc_sheet_calc_pr.rb @@ -13,6 +13,6 @@ class TestSheetCalcPr < Test::Unit::TestCase def test_to_xml_string doc = Nokogiri::XML(@sheet_calc_pr.to_xml_string) - assert_equal 1, doc.xpath('//sheetCalcPr[@fullCalcOnLoad="false"]').size + assert_equal 1, doc.xpath('//sheetCalcPr[@fullCalcOnLoad=0]').size end end diff --git a/test/workbook/worksheet/tc_sheet_format_pr.rb b/test/workbook/worksheet/tc_sheet_format_pr.rb index 6b19860f..b7d7b929 100644 --- a/test/workbook/worksheet/tc_sheet_format_pr.rb +++ b/test/workbook/worksheet/tc_sheet_format_pr.rb @@ -74,13 +74,13 @@ class TestSheetFormatPr < Test::Unit::TestCase def test_to_xml_string doc = Nokogiri::XML(@sheet_format_pr.to_xml_string) - assert doc.xpath("sheetFormatPr[@thickBottom='true']") + assert doc.xpath("sheetFormatPr[@thickBottom=1]") assert doc.xpath("sheetFormatPr[@baseColWidth=5]") assert doc.xpath("sheetFormatPr[@default_col_width=7.2]") assert doc.xpath("sheetFormatPr[@default_row_height=5.2]") - assert doc.xpath("sheetFormatPr[@custom_height='true']") - assert doc.xpath("sheetFormatPr[@zero_height='false']") - assert doc.xpath("sheetFormatPr[@thick_top='true']") + assert doc.xpath("sheetFormatPr[@custom_height=1]") + assert doc.xpath("sheetFormatPr[@zero_height=0]") + assert doc.xpath("sheetFormatPr[@thick_top=1]") assert doc.xpath("sheetFormatPr[@outline_level_row=0]") assert doc.xpath("sheetFormatPr[@outline_level_col=0]") end diff --git a/test/workbook/worksheet/tc_sheet_protection.rb b/test/workbook/worksheet/tc_sheet_protection.rb index 28185775..0595d2ec 100644 --- a/test/workbook/worksheet/tc_sheet_protection.rb +++ b/test/workbook/worksheet/tc_sheet_protection.rb @@ -2,9 +2,9 @@ require 'tc_helper.rb' # <xsd:complexType name="CT_SheetProtection"> -# <xsd:attribute name="sheet" type="xsd:boolean" use="optional" default="false"/> -# <xsd:attribute name="objects" type="xsd:boolean" use="optional" default="false"/> -# <xsd:attribute name="scenarios" type="xsd:boolean" use="optional" default="false"/> +# <xsd:attribute name="sheet" type="xsd:boolean" use="optional" default=0/> +# <xsd:attribute name="objects" type="xsd:boolean" use="optional" default=0/> +# <xsd:attribute name="scenarios" type="xsd:boolean" use="optional" default=0/> # <xsd:attribute name="formatCells" type="xsd:boolean" use="optional" default="true"/> # <xsd:attribute name="formatColumns" type="xsd:boolean" use="optional" default="true"/> # <xsd:attribute name="formatRows" type="xsd:boolean" use="optional" default="true"/> @@ -13,11 +13,11 @@ require 'tc_helper.rb' # <xsd:attribute name="insertHyperlinks" type="xsd:boolean" use="optional" default="true"/> # <xsd:attribute name="deleteColumns" type="xsd:boolean" use="optional" default="true"/> # <xsd:attribute name="deleteRows" type="xsd:boolean" use="optional" default="true"/> -# <xsd:attribute name="selectLockedCells" type="xsd:boolean" use="optional" default="false"/> +# <xsd:attribute name="selectLockedCells" type="xsd:boolean" use="optional" default=0/> # <xsd:attribute name="sort" type="xsd:boolean" use="optional" default="true"/> # <xsd:attribute name="autoFilter" type="xsd:boolean" use="optional" default="true"/> # <xsd:attribute name="pivotTables" type="xsd:boolean" use="optional" default="true"/> -# <xsd:attribute name="selectUnlockedCells" type="xsd:boolean" use="optional" default="false"/> +# <xsd:attribute name="selectUnlockedCells" type="xsd:boolean" use="optional" default=0/> # <xsd:attribute name="password" type="xsd:string" use="optional" default="nil"/> # </xsd:complexType> diff --git a/test/workbook/worksheet/tc_sheet_view.rb b/test/workbook/worksheet/tc_sheet_view.rb index 1026f69d..3a8e0a06 100644 --- a/test/workbook/worksheet/tc_sheet_view.rb +++ b/test/workbook/worksheet/tc_sheet_view.rb @@ -197,11 +197,11 @@ class TestSheetView < Test::Unit::TestCase doc = Nokogiri::XML.parse(@ws.sheet_view.to_xml_string) - assert_equal(1, doc.xpath("//sheetView[@tabSelected='false']").size) + assert_equal(1, doc.xpath("//sheetView[@tabSelected=0]").size) - assert_equal(1, doc.xpath("//sheetView[@tabSelected='false'][@showWhiteSpace='false'][@showOutlineSymbols='false'][@showFormulas='false'] - [@rightToLeft='false'][@windowProtection='false'][@showZeros='true'][@showRuler='true'] - [@showRowColHeaders='true'][@showGridLines='true'][@defaultGridColor='true'] + assert_equal(1, doc.xpath("//sheetView[@tabSelected=0][@showWhiteSpace=0][@showOutlineSymbols=0][@showFormulas=0] + [@rightToLeft=0][@windowProtection=0][@showZeros=1][@showRuler=1] + [@showRowColHeaders=1][@showGridLines=1][@defaultGridColor=1] [@zoomScale='100'][@workbookViewId='0'][@zoomScaleSheetLayoutView='0'][@zoomScalePageLayoutView='0'] [@zoomScaleNormal='0'][@view='pageBreakPreview']").size) end diff --git a/test/workbook/worksheet/tc_worksheet.rb b/test/workbook/worksheet/tc_worksheet.rb index 574522a2..c7699e12 100644 --- a/test/workbook/worksheet/tc_worksheet.rb +++ b/test/workbook/worksheet/tc_worksheet.rb @@ -269,7 +269,7 @@ class TestWorksheet < Test::Unit::TestCase def test_to_xml_string_fit_to_page @ws.page_setup.fit_to_width = 1 doc = Nokogiri::XML(@ws.to_xml_string) - assert_equal(doc.xpath('//xmlns:worksheet/xmlns:sheetPr/xmlns:pageSetUpPr[@fitToPage="true"]').size, 1) + assert_equal(doc.xpath('//xmlns:worksheet/xmlns:sheetPr/xmlns:pageSetUpPr[@fitToPage=1]').size, 1) end def test_to_xml_string_dimensions @@ -286,13 +286,13 @@ class TestWorksheet < Test::Unit::TestCase def test_to_xml_string_selected @ws.selected = true doc = Nokogiri::XML(@ws.to_xml_string) - assert_equal(doc.xpath('//xmlns:worksheet/xmlns:sheetViews/xmlns:sheetView[@tabSelected="true"]').size, 1) + assert_equal(doc.xpath('//xmlns:worksheet/xmlns:sheetViews/xmlns:sheetView[@tabSelected=1]').size, 1) end def test_to_xml_string_show_gridlines @ws.show_gridlines = false doc = Nokogiri::XML(@ws.to_xml_string) - assert_equal(doc.xpath('//xmlns:worksheet/xmlns:sheetViews/xmlns:sheetView[@showGridLines="false"]').size, 1) + assert_equal(doc.xpath('//xmlns:worksheet/xmlns:sheetViews/xmlns:sheetView[@showGridLines=0]').size, 1) end def test_to_xml_string_auto_fit_data @@ -359,7 +359,7 @@ class TestWorksheet < Test::Unit::TestCase po.horizontal_centered = true end doc = Nokogiri::XML(@ws.to_xml_string) - assert_equal(doc.xpath('//xmlns:worksheet/xmlns:printOptions[@gridLines="true"][@horizontalCentered="true"]').size, 1) + assert_equal(doc.xpath('//xmlns:worksheet/xmlns:printOptions[@gridLines=1][@horizontalCentered=1]').size, 1) end def test_to_xml_string_header_footer @@ -369,7 +369,7 @@ class TestWorksheet < Test::Unit::TestCase hf.odd_header = 'Test Header' end doc = Nokogiri::XML(@ws.to_xml_string) - assert_equal(doc.xpath('//xmlns:worksheet/xmlns:headerFooter[@differentFirst="false"][@differentOddEven="false"]').size, 1) + assert_equal(doc.xpath('//xmlns:worksheet/xmlns:headerFooter[@differentFirst=0][@differentOddEven=0]').size, 1) end def test_to_xml_string_drawing @@ -535,7 +535,7 @@ class TestWorksheet < Test::Unit::TestCase @ws.auto_filter.range = 'A1:D9' @ws.auto_filter.add_column 0, :filters, :filter_items => [1] doc = Nokogiri::XML(@ws.to_xml_string) - assert(doc.xpath('//sheetPr[@filterMode="true"]')) + assert(doc.xpath('//sheetPr[@filterMode=1]')) end def test_outline_level_rows |
