summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGeremia Taglialatela <[email protected]>2023-04-08 11:53:12 +0200
committerGeremia Taglialatela <[email protected]>2023-04-08 11:53:12 +0200
commit55526805cf28cc91a22df5811b26cd23bdefa8d3 (patch)
tree2cbc6403b385078b0ed5e275c49f0c60522bdd16 /test
parentacf00d356494ef504c3de0e4a0db6b25f2bd7636 (diff)
downloadcaxlsx-55526805cf28cc91a22df5811b26cd23bdefa8d3.tar.gz
caxlsx-55526805cf28cc91a22df5811b26cd23bdefa8d3.zip
Fix space-related offenses
- Layout/SpaceAfterComma - Layout/SpaceAroundEqualsInParameterDefault - Layout/SpaceAroundOperators - Layout/SpaceBeforeBlockBraces - Layout/SpaceInsideBlockBraces - Layout/SpaceInsideHashLiteralBraces - Layout/SpaceInsideParens
Diffstat (limited to 'test')
-rw-r--r--test/benchmark.rb2
-rw-r--r--test/content_type/tc_content_type.rb4
-rw-r--r--test/content_type/tc_default.rb4
-rw-r--r--test/content_type/tc_override.rb4
-rw-r--r--test/doc_props/tc_app.rb2
-rw-r--r--test/doc_props/tc_core.rb2
-rw-r--r--test/drawing/tc_area_series.rb4
-rw-r--r--test/drawing/tc_axis.rb10
-rw-r--r--test/drawing/tc_bar_series.rb6
-rw-r--r--test/drawing/tc_bubble_series.rb6
-rw-r--r--test/drawing/tc_chart.rb8
-rw-r--r--test/drawing/tc_d_lbls.rb16
-rw-r--r--test/drawing/tc_drawing.rb18
-rw-r--r--test/drawing/tc_hyperlink.rb12
-rw-r--r--test/drawing/tc_line_series.rb4
-rw-r--r--test/drawing/tc_marker.rb16
-rw-r--r--test/drawing/tc_num_data.rb4
-rw-r--r--test/drawing/tc_num_val.rb4
-rw-r--r--test/drawing/tc_one_cell_anchor.rb6
-rw-r--r--test/drawing/tc_pic.rb8
-rw-r--r--test/drawing/tc_picture_locking.rb18
-rw-r--r--test/drawing/tc_pie_3D_chart.rb2
-rw-r--r--test/drawing/tc_pie_series.rb4
-rw-r--r--test/drawing/tc_scaling.rb16
-rw-r--r--test/drawing/tc_scatter_series.rb22
-rw-r--r--test/drawing/tc_series.rb4
-rw-r--r--test/drawing/tc_two_cell_anchor.rb4
-rw-r--r--test/drawing/tc_view_3D.rb24
-rw-r--r--test/drawing/tc_vml_drawing.rb2
-rw-r--r--test/profile.rb2
-rw-r--r--test/rels/tc_relationship.rb2
-rw-r--r--test/stylesheet/tc_border.rb8
-rw-r--r--test/stylesheet/tc_border_pr.rb2
-rw-r--r--test/stylesheet/tc_cell_alignment.rb22
-rw-r--r--test/stylesheet/tc_cell_protection.rb4
-rw-r--r--test/stylesheet/tc_cell_style.rb12
-rw-r--r--test/stylesheet/tc_color.rb6
-rw-r--r--test/stylesheet/tc_dxf.rb6
-rw-r--r--test/stylesheet/tc_font.rb2
-rw-r--r--test/stylesheet/tc_gradient_fill.rb2
-rw-r--r--test/stylesheet/tc_gradient_stop.rb4
-rw-r--r--test/stylesheet/tc_pattern_fill.rb2
-rw-r--r--test/stylesheet/tc_styles.rb82
-rw-r--r--test/tc_axlsx.rb20
-rw-r--r--test/tc_package.rb68
-rw-r--r--test/util/tc_simple_typed_list.rb22
-rw-r--r--test/util/tc_validators.rb6
-rw-r--r--test/workbook/tc_shared_strings_table.rb6
-rw-r--r--test/workbook/tc_workbook.rb28
-rw-r--r--test/workbook/tc_workbook_view.rb4
-rw-r--r--test/workbook/worksheet/auto_filter/tc_auto_filter.rb2
-rw-r--r--test/workbook/worksheet/auto_filter/tc_filters.rb2
-rw-r--r--test/workbook/worksheet/tc_border_creator.rb6
-rw-r--r--test/workbook/worksheet/tc_break.rb2
-rw-r--r--test/workbook/worksheet/tc_cell.rb28
-rw-r--r--test/workbook/worksheet/tc_col.rb4
-rw-r--r--test/workbook/worksheet/tc_color_scale.rb14
-rw-r--r--test/workbook/worksheet/tc_comment.rb2
-rw-r--r--test/workbook/worksheet/tc_comments.rb4
-rw-r--r--test/workbook/worksheet/tc_conditional_formatting.rb24
-rw-r--r--test/workbook/worksheet/tc_data_bar.rb8
-rw-r--r--test/workbook/worksheet/tc_data_validation.rb20
-rw-r--r--test/workbook/worksheet/tc_date_time_converter.rb4
-rw-r--r--test/workbook/worksheet/tc_icon_set.rb8
-rw-r--r--test/workbook/worksheet/tc_page_margins.rb2
-rw-r--r--test/workbook/worksheet/tc_page_setup.rb4
-rw-r--r--test/workbook/worksheet/tc_pivot_table.rb54
-rw-r--r--test/workbook/worksheet/tc_pivot_table_cache_definition.rb2
-rw-r--r--test/workbook/worksheet/tc_protected_range.rb4
-rw-r--r--test/workbook/worksheet/tc_rich_text.rb6
-rw-r--r--test/workbook/worksheet/tc_rich_text_run.rb4
-rw-r--r--test/workbook/worksheet/tc_row.rb24
-rw-r--r--test/workbook/worksheet/tc_sheet_format_pr.rb12
-rw-r--r--test/workbook/worksheet/tc_sheet_pr.rb2
-rw-r--r--test/workbook/worksheet/tc_sheet_protection.rb2
-rw-r--r--test/workbook/worksheet/tc_table.rb2
-rw-r--r--test/workbook/worksheet/tc_table_style_info.rb2
-rw-r--r--test/workbook/worksheet/tc_worksheet.rb100
78 files changed, 447 insertions, 447 deletions
diff --git a/test/benchmark.rb b/test/benchmark.rb
index e9f6c22b..3c0ebc95 100644
--- a/test/benchmark.rb
+++ b/test/benchmark.rb
@@ -6,7 +6,7 @@ require 'benchmark'
Axlsx::trust_input = true
row = []
input = (32..126).to_a.pack('U*').chars.to_a
-20.times { row << input.shuffle.join}
+20.times { row << input.shuffle.join }
times = 3000
Benchmark.bmbm(30) do |x|
x.report('axlsx_noautowidth') {
diff --git a/test/content_type/tc_content_type.rb b/test/content_type/tc_content_type.rb
index 278cd67b..f06554c8 100644
--- a/test/content_type/tc_content_type.rb
+++ b/test/content_type/tc_content_type.rb
@@ -8,7 +8,7 @@ class TestContentType < Test::Unit::TestCase
def test_valid_document
schema = Nokogiri::XML::Schema(File.open(Axlsx::CONTENT_TYPES_XSD))
- assert(schema.validate(@doc).map{ |e| puts e.message; e.message }.empty?)
+ assert(schema.validate(@doc).map { |e| puts e.message; e.message }.empty?)
end
def test_pre_built_types
@@ -22,7 +22,7 @@ class TestContentType < Test::Unit::TestCase
assert_equal(node["Extension"], "#{Axlsx::XML_EX}", "xml content type invalid")
node = @doc.xpath(d_path % Axlsx::RELS_CT).first
- assert_equal(node["Extension"],"#{Axlsx::RELS_EX}", "relationships content type invalid")
+ assert_equal(node["Extension"], "#{Axlsx::RELS_EX}", "relationships content type invalid")
#overrride
assert_equal(@doc.xpath("//xmlns:Override").size, 4, "There should be 4 Override types")
diff --git a/test/content_type/tc_default.rb b/test/content_type/tc_default.rb
index 77915ea0..096a117a 100644
--- a/test/content_type/tc_default.rb
+++ b/test/content_type/tc_default.rb
@@ -2,11 +2,11 @@ require 'tc_helper.rb'
class TestDefault < Test::Unit::TestCase
def test_content_type_restriction
- assert_raise(ArgumentError, "raises argument error if invlalid ContentType is") { Axlsx::Default.new :ContentType=>"asdf" }
+ assert_raise(ArgumentError, "raises argument error if invlalid ContentType is") { Axlsx::Default.new :ContentType => "asdf" }
end
def test_to_xml_string
- type = Axlsx::Default.new :Extension=>"xml", :ContentType=>Axlsx::XML_CT
+ type = Axlsx::Default.new :Extension => "xml", :ContentType => Axlsx::XML_CT
doc = Nokogiri::XML(type.to_xml_string)
assert_equal(doc.xpath("Default[@ContentType='#{Axlsx::XML_CT}']").size, 1)
assert_equal(doc.xpath("Default[@Extension='xml']").size, 1)
diff --git a/test/content_type/tc_override.rb b/test/content_type/tc_override.rb
index c21f9f27..952f40d8 100644
--- a/test/content_type/tc_override.rb
+++ b/test/content_type/tc_override.rb
@@ -1,11 +1,11 @@
require 'tc_helper.rb'
class TestOverride < Test::Unit::TestCase
def test_content_type_restriction
- assert_raise(ArgumentError, "requires known content type") { Axlsx::Override.new :ContentType=>"asdf" }
+ assert_raise(ArgumentError, "requires known content type") { Axlsx::Override.new :ContentType => "asdf" }
end
def test_to_xml
- type = Axlsx::Override.new :PartName=>"somechart.xml", :ContentType=>Axlsx::CHART_CT
+ type = Axlsx::Override.new :PartName => "somechart.xml", :ContentType => Axlsx::CHART_CT
doc = Nokogiri::XML(type.to_xml_string)
assert_equal(doc.xpath("Override[@ContentType='#{Axlsx::CHART_CT}']").size, 1)
assert_equal(doc.xpath("Override[@PartName='somechart.xml']").size, 1)
diff --git a/test/doc_props/tc_app.rb b/test/doc_props/tc_app.rb
index 7718a6c2..a7124be1 100644
--- a/test/doc_props/tc_app.rb
+++ b/test/doc_props/tc_app.rb
@@ -38,6 +38,6 @@ class TestApp < Test::Unit::TestCase
schema.validate(doc).each do |error|
errors << error
end
- assert_equal(errors.size, 0, "app.xml invalid" + errors.map{ |e| e.message }.to_s)
+ assert_equal(errors.size, 0, "app.xml invalid" + errors.map { |e| e.message }.to_s)
end
end
diff --git a/test/doc_props/tc_core.rb b/test/doc_props/tc_core.rb
index 6ba01b5f..b225266a 100644
--- a/test/doc_props/tc_core.rb
+++ b/test/doc_props/tc_core.rb
@@ -15,7 +15,7 @@ class TestCore < Test::Unit::TestCase
puts error.message
errors << error
end
- assert_equal(errors.size, 0, "core.xml Invalid" + errors.map{ |e| e.message }.to_s)
+ assert_equal(errors.size, 0, "core.xml Invalid" + errors.map { |e| e.message }.to_s)
end
def test_populates_created
diff --git a/test/drawing/tc_area_series.rb b/test/drawing/tc_area_series.rb
index efe48256..250c6e13 100644
--- a/test/drawing/tc_area_series.rb
+++ b/test/drawing/tc_area_series.rb
@@ -3,10 +3,10 @@ require 'tc_helper.rb'
class TestAreaSeries < Test::Unit::TestCase
def setup
p = Axlsx::Package.new
- @ws = p.workbook.add_worksheet :name=>"hmmm"
+ @ws = p.workbook.add_worksheet :name => "hmmm"
chart = @ws.add_chart Axlsx::AreaChart, :title => "fishery"
@series = chart.add_series(
- :data => [0,1,2],
+ :data => [0, 1, 2],
:labels => ["zero", "one", "two"],
:title => "bob",
:color => "#FF0000",
diff --git a/test/drawing/tc_axis.rb b/test/drawing/tc_axis.rb
index b8be916b..52a066be 100644
--- a/test/drawing/tc_axis.rb
+++ b/test/drawing/tc_axis.rb
@@ -17,7 +17,7 @@ class TestAxis < Test::Unit::TestCase
def test_color
@axis.color = "00FF00"
@axis.cross_axis = Axlsx::CatAxis.new
- str = '<?xml version="1.0" encoding="UTF-8"?>'
+ str = '<?xml version="1.0" encoding="UTF-8"?>'
str << '<c:chartSpace xmlns:c="' << Axlsx::XML_NS_C << '" xmlns:a="' << Axlsx::XML_NS_A << '">'
doc = Nokogiri::XML(@axis.to_xml_string(str))
assert(doc.xpath("//a:srgbClr[@val='00FF00']"))
@@ -25,7 +25,7 @@ class TestAxis < Test::Unit::TestCase
def test_cell_based_axis_title
p = Axlsx::Package.new
- p.workbook.add_worksheet(:name=>'foosheet') do |sheet|
+ p.workbook.add_worksheet(:name => 'foosheet') do |sheet|
sheet.add_row ['battle victories']
sheet.add_row ['bird', 1, 2, 1]
sheet.add_row ['cat', 7, 9, 10]
@@ -60,11 +60,11 @@ class TestAxis < Test::Unit::TestCase
assert_nothing_raised("accepts valid format code") { @axis.format_code = "00.##" }
end
- def create_chart_with_formatting(format_string=nil)
+ def create_chart_with_formatting(format_string = nil)
p = Axlsx::Package.new
p.workbook.add_worksheet(:name => "Formatting Test") do |sheet|
sheet.add_row(['test', 20])
- sheet.add_chart(Axlsx::Bar3DChart, :start_at => [0,5], :end_at => [10, 20], :title => "Test Formatting") do |chart|
+ sheet.add_chart(Axlsx::Bar3DChart, :start_at => [0, 5], :end_at => [10, 20], :title => "Test Formatting") do |chart|
chart.add_series :data => sheet["B1:B1"], :labels => sheet["A1:A1"]
chart.val_axis.format_code = format_string if format_string
doc = Nokogiri::XML(chart.to_xml_string)
@@ -99,7 +99,7 @@ class TestAxis < Test::Unit::TestCase
def test_to_xml_string
@axis.cross_axis = Axlsx::CatAxis.new
- str = '<?xml version="1.0" encoding="UTF-8"?>'
+ str = '<?xml version="1.0" encoding="UTF-8"?>'
str << '<c:chartSpace xmlns:c="' << Axlsx::XML_NS_C << '" xmlns:a="' << Axlsx::XML_NS_A << '">'
doc = Nokogiri::XML(@axis.to_xml_string(str))
assert(doc.xpath('//a:noFill'))
diff --git a/test/drawing/tc_bar_series.rb b/test/drawing/tc_bar_series.rb
index 81b88683..39d39b96 100644
--- a/test/drawing/tc_bar_series.rb
+++ b/test/drawing/tc_bar_series.rb
@@ -3,7 +3,7 @@ require 'tc_helper.rb'
class TestBarSeries < Test::Unit::TestCase
def setup
p = Axlsx::Package.new
- @ws = p.workbook.add_worksheet :name=>"hmmm"
+ @ws = p.workbook.add_worksheet :name => "hmmm"
@chart = @ws.add_chart Axlsx::Bar3DChart, :title => "fishery"
@series = @chart.add_series(
data: [0, 1, 2],
@@ -37,8 +37,8 @@ class TestBarSeries < Test::Unit::TestCase
def test_to_xml_string
doc = Nokogiri::XML(@chart.to_xml_string)
@series.colors.each_with_index do |color, index|
- assert_equal(doc.xpath("//c:dPt/c:idx[@val='#{index}']").size,1)
- assert_equal(doc.xpath("//c:dPt/c:spPr/a:solidFill/a:srgbClr[@val='#{@series.colors[index]}']").size,1)
+ assert_equal(doc.xpath("//c:dPt/c:idx[@val='#{index}']").size, 1)
+ assert_equal(doc.xpath("//c:dPt/c:spPr/a:solidFill/a:srgbClr[@val='#{@series.colors[index]}']").size, 1)
end
assert_equal(doc.xpath('//c:spPr[not(ancestor::c:dPt)]/a:solidFill/a:srgbClr').first.get_attribute('val'), '5A5A5A', 'series color has been applied')
end
diff --git a/test/drawing/tc_bubble_series.rb b/test/drawing/tc_bubble_series.rb
index a784619f..af051d11 100644
--- a/test/drawing/tc_bubble_series.rb
+++ b/test/drawing/tc_bubble_series.rb
@@ -3,9 +3,9 @@ require 'tc_helper.rb'
class TestBubbleSeries < Test::Unit::TestCase
def setup
p = Axlsx::Package.new
- @ws = p.workbook.add_worksheet :name=>"hmmm"
+ @ws = p.workbook.add_worksheet :name => "hmmm"
@chart = @ws.add_chart Axlsx::BubbleChart, :title => "Bubble Chart"
- @series = @chart.add_series :xData=>[1,2,4], :yData=>[1,3,9], :bubbleSize=>[1,5,7], :title=>"GDP", :color => 'FF0000'
+ @series = @chart.add_series :xData => [1, 2, 4], :yData => [1, 3, 9], :bubbleSize => [1, 5, 7], :title => "GDP", :color => 'FF0000'
end
def test_initialize
@@ -14,6 +14,6 @@ class TestBubbleSeries < Test::Unit::TestCase
def test_to_xml_string
doc = Nokogiri::XML(@chart.to_xml_string)
- assert_equal(doc.xpath("//a:srgbClr[@val='#{@series.color}']").size,2)
+ assert_equal(doc.xpath("//a:srgbClr[@val='#{@series.color}']").size, 2)
end
end
diff --git a/test/drawing/tc_chart.rb b/test/drawing/tc_chart.rb
index c322b37a..4f60db17 100644
--- a/test/drawing/tc_chart.rb
+++ b/test/drawing/tc_chart.rb
@@ -14,7 +14,7 @@ class TestChart < Test::Unit::TestCase
end
def test_initialization
- assert_equal(@p.workbook.charts.last,@chart, "the chart is in the workbook")
+ assert_equal(@p.workbook.charts.last, @chart, "the chart is in the workbook")
assert_equal(@chart.title.text, "fishery", "the title option has been applied")
assert((@chart.series.is_a?(Axlsx::SimpleTypedList) && @chart.series.empty?), "The series is initialized and empty")
end
@@ -75,7 +75,7 @@ class TestChart < Test::Unit::TestCase
@chart.start_at @row.cells.first
assert_equal(@chart.graphic_frame.anchor.from.col, 0)
assert_equal(@chart.graphic_frame.anchor.from.row, 0)
- @chart.start_at [5,6]
+ @chart.start_at [5, 6]
assert_equal(@chart.graphic_frame.anchor.from.col, 5)
assert_equal(@chart.graphic_frame.anchor.from.row, 6)
end
@@ -87,13 +87,13 @@ class TestChart < Test::Unit::TestCase
@chart.end_at @row.cells.last
assert_equal(@chart.graphic_frame.anchor.to.col, 2)
assert_equal(@chart.graphic_frame.anchor.to.row, 0)
- @chart.end_at [10,11]
+ @chart.end_at [10, 11]
assert_equal(@chart.graphic_frame.anchor.to.col, 10)
assert_equal(@chart.graphic_frame.anchor.to.row, 11)
end
def test_add_series
- s = @chart.add_series :data=>[0,1,2,3], :labels => ["one", 1, "anything"], :title=>"bob"
+ s = @chart.add_series :data => [0, 1, 2, 3], :labels => ["one", 1, "anything"], :title => "bob"
assert_equal(@chart.series.last, s, "series has been added to chart series collection")
assert_equal(s.title.text, "bob", "series title has been applied")
end
diff --git a/test/drawing/tc_d_lbls.rb b/test/drawing/tc_d_lbls.rb
index ce71a00f..cc96299d 100644
--- a/test/drawing/tc_d_lbls.rb
+++ b/test/drawing/tc_d_lbls.rb
@@ -3,13 +3,13 @@ require 'tc_helper'
class TestDLbls < Test::Unit::TestCase
def setup
@d_lbls = Axlsx::DLbls.new(Axlsx::Pie3DChart)
- @boolean_attributes =[:show_legend_key,
- :show_val,
- :show_cat_name,
- :show_ser_name,
- :show_percent,
- :show_bubble_size,
- :show_leader_lines]
+ @boolean_attributes = [:show_legend_key,
+ :show_val,
+ :show_cat_name,
+ :show_ser_name,
+ :show_percent,
+ :show_bubble_size,
+ :show_leader_lines]
end
def test_initialization
@@ -22,7 +22,7 @@ class TestDLbls < Test::Unit::TestCase
def test_initialization_with_optoins
options_hash = Hash[*[@boolean_attributes.map { |name| [name, true] }]]
- d_lbls = Axlsx::DLbls.new(Axlsx::Pie3DChart, options_hash.merge( { :d_lbl_pos => :t }))
+ d_lbls = Axlsx::DLbls.new(Axlsx::Pie3DChart, options_hash.merge({ :d_lbl_pos => :t }))
@boolean_attributes.each do |attr|
assert_equal(true, d_lbls.send(attr), "boolean attributes set by options")
diff --git a/test/drawing/tc_drawing.rb b/test/drawing/tc_drawing.rb
index 04b6ead6..c5fc98e1 100644
--- a/test/drawing/tc_drawing.rb
+++ b/test/drawing/tc_drawing.rb
@@ -11,19 +11,19 @@ class TestDrawing < Test::Unit::TestCase
end
def test_add_chart
- chart = @ws.add_chart(Axlsx::Pie3DChart, :title=>"bob", :start_at=>[0,0], :end_at=>[1,1])
+ chart = @ws.add_chart(Axlsx::Pie3DChart, :title => "bob", :start_at => [0, 0], :end_at => [1, 1])
assert(chart.is_a?(Axlsx::Pie3DChart), "must create a chart")
assert_equal(@ws.workbook.charts.last, chart, "must be added to workbook charts collection")
assert_equal(@ws.drawing.anchors.last.object.chart, chart, "an anchor has been created and holds a reference to this chart")
anchor = @ws.drawing.anchors.last
- assert_equal([anchor.from.row, anchor.from.col], [0,0], "options for start at are applied")
- assert_equal([anchor.to.row, anchor.to.col], [1,1], "options for start at are applied")
+ assert_equal([anchor.from.row, anchor.from.col], [0, 0], "options for start at are applied")
+ assert_equal([anchor.to.row, anchor.to.col], [1, 1], "options for start at are applied")
assert_equal(chart.title.text, "bob", "option for title is applied")
end
def test_add_image
src = File.dirname(__FILE__) + "/../fixtures/image1.jpeg"
- image = @ws.add_image(:image_src => src, :start_at=>[0,0], :width=>600, :height=>400)
+ image = @ws.add_image(:image_src => src, :start_at => [0, 0], :width => 600, :height => 400)
assert(@ws.drawing.anchors.last.is_a?(Axlsx::OneCellAnchor))
assert(image.is_a?(Axlsx::Pic))
assert_equal(600, image.width)
@@ -32,15 +32,15 @@ class TestDrawing < Test::Unit::TestCase
def test_add_two_cell_anchor_image
src = File.dirname(__FILE__) + "/../fixtures/image1.jpeg"
- image = @ws.add_image(:image_src => src, :start_at=>[0,0], :end_at => [15,0])
+ image = @ws.add_image(:image_src => src, :start_at => [0, 0], :end_at => [15, 0])
assert(@ws.drawing.anchors.last.is_a?(Axlsx::TwoCellAnchor))
assert(image.is_a?(Axlsx::Pic))
end
def test_charts
- chart = @ws.add_chart(Axlsx::Pie3DChart, :title=>"bob", :start_at=>[0,0], :end_at=>[1,1])
+ chart = @ws.add_chart(Axlsx::Pie3DChart, :title => "bob", :start_at => [0, 0], :end_at => [1, 1])
assert_equal(@ws.drawing.charts.last, chart, "add chart is returned")
- chart = @ws.add_chart(Axlsx::Pie3DChart, :title=>"nancy", :start_at=>[1,5], :end_at=>[5,10])
+ chart = @ws.add_chart(Axlsx::Pie3DChart, :title => "nancy", :start_at => [1, 5], :end_at => [5, 10])
assert_equal(@ws.drawing.charts.last, chart, "add chart is returned")
end
@@ -60,9 +60,9 @@ class TestDrawing < Test::Unit::TestCase
end
def test_relationships
- @ws.add_chart(Axlsx::Pie3DChart, :title=>"bob", :start_at=>[0,0], :end_at=>[1,1])
+ @ws.add_chart(Axlsx::Pie3DChart, :title => "bob", :start_at => [0, 0], :end_at => [1, 1])
assert_equal(@ws.drawing.relationships.size, 1, "adding a chart adds a relationship")
- @ws.add_chart(Axlsx::Pie3DChart, :title=>"nancy", :start_at=>[1,5], :end_at=>[5,10])
+ @ws.add_chart(Axlsx::Pie3DChart, :title => "nancy", :start_at => [1, 5], :end_at => [5, 10])
assert_equal(@ws.drawing.relationships.size, 2, "adding a chart adds a relationship")
end
diff --git a/test/drawing/tc_hyperlink.rb b/test/drawing/tc_hyperlink.rb
index ad8299b7..f9deb5b8 100644
--- a/test/drawing/tc_hyperlink.rb
+++ b/test/drawing/tc_hyperlink.rb
@@ -4,7 +4,7 @@ class TestHyperlink < Test::Unit::TestCase
def setup
@p = Axlsx::Package.new
ws = @p.workbook.add_worksheet
- @test_img = File.dirname(__FILE__) + "/../fixtures/image1.jpeg"
+ @test_img = File.dirname(__FILE__) + "/../fixtures/image1.jpeg"
@image = ws.add_image :image_src => @test_img, :hyperlink => "http://axlsx.blogspot.com"
@hyperlink = @image.hyperlink
end
@@ -39,20 +39,20 @@ class TestHyperlink < Test::Unit::TestCase
def test_endSnd
assert_nothing_raised { @hyperlink.endSnd = "true" }
- assert_raise(ArgumentError) {@hyperlink.endSnd = "bob"}
+ assert_raise(ArgumentError) { @hyperlink.endSnd = "bob" }
assert_equal(@hyperlink.endSnd, "true")
end
def test_highlightClick
assert_nothing_raised { @hyperlink.highlightClick = false }
- assert_raise(ArgumentError) {@hyperlink.highlightClick = "bob"}
- assert_equal(@hyperlink.highlightClick, false )
+ assert_raise(ArgumentError) { @hyperlink.highlightClick = "bob" }
+ assert_equal(@hyperlink.highlightClick, false)
end
def test_history
assert_nothing_raised { @hyperlink.history = false }
- assert_raise(ArgumentError) {@hyperlink.history = "bob"}
- assert_equal(@hyperlink.history, false )
+ assert_raise(ArgumentError) { @hyperlink.history = "bob" }
+ assert_equal(@hyperlink.history, false)
end
def test_to_xml_string
diff --git a/test/drawing/tc_line_series.rb b/test/drawing/tc_line_series.rb
index 1327a48f..80643c4e 100644
--- a/test/drawing/tc_line_series.rb
+++ b/test/drawing/tc_line_series.rb
@@ -3,10 +3,10 @@ require 'tc_helper.rb'
class TestLineSeries < Test::Unit::TestCase
def setup
p = Axlsx::Package.new
- @ws = p.workbook.add_worksheet :name=>"hmmm"
+ @ws = p.workbook.add_worksheet :name => "hmmm"
chart = @ws.add_chart Axlsx::Line3DChart, :title => "fishery"
@series = chart.add_series(
- :data => [0,1,2],
+ :data => [0, 1, 2],
:labels => ["zero", "one", "two"],
:title => "bob",
:color => "#FF0000",
diff --git a/test/drawing/tc_marker.rb b/test/drawing/tc_marker.rb
index fdc6d5a1..ccfb76fe 100644
--- a/test/drawing/tc_marker.rb
+++ b/test/drawing/tc_marker.rb
@@ -16,23 +16,23 @@ class TestMarker < Test::Unit::TestCase
end
def test_col
- assert_raise(ArgumentError) { @marker.col = -1}
- assert_nothing_raised {@marker.col = 10}
+ assert_raise(ArgumentError) { @marker.col = -1 }
+ assert_nothing_raised { @marker.col = 10 }
end
def test_colOff
- assert_raise(ArgumentError) { @marker.colOff = "1"}
- assert_nothing_raised {@marker.colOff = -10}
+ assert_raise(ArgumentError) { @marker.colOff = "1" }
+ assert_nothing_raised { @marker.colOff = -10 }
end
def test_row
- assert_raise(ArgumentError) { @marker.row = -1}
- assert_nothing_raised {@marker.row = 10}
+ assert_raise(ArgumentError) { @marker.row = -1 }
+ assert_nothing_raised { @marker.row = 10 }
end
def test_rowOff
- assert_raise(ArgumentError) { @marker.rowOff = "1"}
- assert_nothing_raised {@marker.rowOff = -10}
+ assert_raise(ArgumentError) { @marker.rowOff = "1" }
+ assert_nothing_raised { @marker.rowOff = -10 }
end
def test_coord
diff --git a/test/drawing/tc_num_data.rb b/test/drawing/tc_num_data.rb
index fc5fabee..7e7e12e3 100644
--- a/test/drawing/tc_num_data.rb
+++ b/test/drawing/tc_num_data.rb
@@ -13,8 +13,8 @@ class TestNumData < Test::Unit::TestCase
end
def test_format_code
- assert_raise(ArgumentError) {@num_data.format_code = 7}
- assert_nothing_raised {@num_data.format_code = 'foo_bar'}
+ assert_raise(ArgumentError) { @num_data.format_code = 7 }
+ assert_nothing_raised { @num_data.format_code = 'foo_bar' }
end
def test_to_xml_string
diff --git a/test/drawing/tc_num_val.rb b/test/drawing/tc_num_val.rb
index 9722b434..2123ea92 100644
--- a/test/drawing/tc_num_val.rb
+++ b/test/drawing/tc_num_val.rb
@@ -11,8 +11,8 @@ class TestNumVal < Test::Unit::TestCase
end
def test_format_code
- assert_raise(ArgumentError) {@num_val.format_code = 7}
- assert_nothing_raised {@num_val.format_code = 'foo_bar'}
+ assert_raise(ArgumentError) { @num_val.format_code = 7 }
+ assert_nothing_raised { @num_val.format_code = 'foo_bar' }
end
def test_to_xml_string
diff --git a/test/drawing/tc_one_cell_anchor.rb b/test/drawing/tc_one_cell_anchor.rb
index f9a04492..1b18f12e 100644
--- a/test/drawing/tc_one_cell_anchor.rb
+++ b/test/drawing/tc_one_cell_anchor.rb
@@ -4,7 +4,7 @@ class TestOneCellAnchor < Test::Unit::TestCase
def setup
@p = Axlsx::Package.new
@ws = @p.workbook.add_worksheet
- @test_img = File.dirname(__FILE__) + "/../fixtures/image1.jpeg"
+ @test_img = File.dirname(__FILE__) + "/../fixtures/image1.jpeg"
@image = @ws.add_image :image_src => @test_img
@anchor = @image.anchor
end
@@ -50,8 +50,8 @@ class TestOneCellAnchor < Test::Unit::TestCase
end
def test_options
- assert_raise(ArgumentError, 'invalid start_at') { @ws.add_image :image_src=>@test_img, :start_at=>[1] }
- i = @ws.add_image :image_src=>@test_img, :start_at => [1,2], :width=>100, :height=>200, :name=>"someimage", :descr=>"a neat image"
+ assert_raise(ArgumentError, 'invalid start_at') { @ws.add_image :image_src => @test_img, :start_at => [1] }
+ i = @ws.add_image :image_src => @test_img, :start_at => [1, 2], :width => 100, :height => 200, :name => "someimage", :descr => "a neat image"
assert_equal("a neat image", i.descr)
assert_equal("someimage", i.name)
diff --git a/test/drawing/tc_pic.rb b/test/drawing/tc_pic.rb
index bb81fc00..6760fa58 100644
--- a/test/drawing/tc_pic.rb
+++ b/test/drawing/tc_pic.rb
@@ -4,10 +4,10 @@ class TestPic < Test::Unit::TestCase
def setup
@p = Axlsx::Package.new
ws = @p.workbook.add_worksheet
- @test_img = @test_img_jpg = File.dirname(__FILE__) + "/../fixtures/image1.jpeg"
+ @test_img = @test_img_jpg = File.dirname(__FILE__) + "/../fixtures/image1.jpeg"
@test_img_png = File.dirname(__FILE__) + "/../fixtures/image1.png"
@test_img_gif = File.dirname(__FILE__) + "/../fixtures/image1.gif"
- @test_img_fake = File.dirname(__FILE__) + "/../fixtures/image1_fake.jpg"
+ @test_img_fake = File.dirname(__FILE__) + "/../fixtures/image1_fake.jpg"
@image = ws.add_image :image_src => @test_img, :hyperlink => 'https://github.com/randym', :tooltip => "What's up doc?", :opacity => 5
end
@@ -21,11 +21,11 @@ class TestPic < Test::Unit::TestCase
#swap from one cell to two cell when end_at is specified
assert(@image.anchor.is_a?(Axlsx::OneCellAnchor))
start_at = @image.anchor.from
- @image.end_at 10,5
+ @image.end_at 10, 5
assert(@image.anchor.is_a?(Axlsx::TwoCellAnchor))
assert_equal(start_at.col, @image.anchor.from.col)
assert_equal(start_at.row, @image.anchor.from.row)
- assert_equal(10,@image.anchor.to.col)
+ assert_equal(10, @image.anchor.to.col)
assert_equal(5, @image.anchor.to.row)
#swap from two cell to one cell when width or height are specified
diff --git a/test/drawing/tc_picture_locking.rb b/test/drawing/tc_picture_locking.rb
index 7347a571..6e5de47b 100644
--- a/test/drawing/tc_picture_locking.rb
+++ b/test/drawing/tc_picture_locking.rb
@@ -16,54 +16,54 @@ class TestPictureLocking < Test::Unit::TestCase
def test_noGrp
assert_raise(ArgumentError) { @item.noGrp = -1 }
assert_nothing_raised { @item.noGrp = false }
- assert_equal(@item.noGrp, false )
+ assert_equal(@item.noGrp, false)
end
def test_noRot
assert_raise(ArgumentError) { @item.noRot = -1 }
assert_nothing_raised { @item.noRot = false }
- assert_equal(@item.noRot, false )
+ assert_equal(@item.noRot, false)
end
def test_noChangeAspect
assert_raise(ArgumentError) { @item.noChangeAspect = -1 }
assert_nothing_raised { @item.noChangeAspect = false }
- assert_equal(@item.noChangeAspect, false )
+ assert_equal(@item.noChangeAspect, false)
end
def test_noMove
assert_raise(ArgumentError) { @item.noMove = -1 }
assert_nothing_raised { @item.noMove = false }
- assert_equal(@item.noMove, false )
+ assert_equal(@item.noMove, false)
end
def test_noResize
assert_raise(ArgumentError) { @item.noResize = -1 }
assert_nothing_raised { @item.noResize = false }
- assert_equal(@item.noResize, false )
+ assert_equal(@item.noResize, false)
end
def test_noEditPoints
assert_raise(ArgumentError) { @item.noEditPoints = -1 }
assert_nothing_raised { @item.noEditPoints = false }
- assert_equal(@item.noEditPoints, false )
+ assert_equal(@item.noEditPoints, false)
end
def test_noAdjustHandles
assert_raise(ArgumentError) { @item.noAdjustHandles = -1 }
assert_nothing_raised { @item.noAdjustHandles = false }
- assert_equal(@item.noAdjustHandles, false )
+ assert_equal(@item.noAdjustHandles, false)
end
def test_noChangeArrowheads
assert_raise(ArgumentError) { @item.noChangeArrowheads = -1 }
assert_nothing_raised { @item.noChangeArrowheads = false }
- assert_equal(@item.noChangeArrowheads, false )
+ assert_equal(@item.noChangeArrowheads, false)
end
def test_noChangeShapeType
assert_raise(ArgumentError) { @item.noChangeShapeType = -1 }
assert_nothing_raised { @item.noChangeShapeType = false }
- assert_equal(@item.noChangeShapeType, false )
+ assert_equal(@item.noChangeShapeType, false)
end
end
diff --git a/test/drawing/tc_pie_3D_chart.rb b/test/drawing/tc_pie_3D_chart.rb
index 6eb0dfe5..f536f086 100644
--- a/test/drawing/tc_pie_3D_chart.rb
+++ b/test/drawing/tc_pie_3D_chart.rb
@@ -20,7 +20,7 @@ class TestPie3DChart < Test::Unit::TestCase
def test_to_xml
schema = Nokogiri::XML::Schema(File.open(Axlsx::DRAWING_XSD))
doc = Nokogiri::XML(@chart.to_xml_string)
- errors = schema.validate(doc).map {|error| puts error.message; error }
+ errors = schema.validate(doc).map { |error| puts error.message; error }
assert(errors.empty?, "error free validation")
end
end
diff --git a/test/drawing/tc_pie_series.rb b/test/drawing/tc_pie_series.rb
index 7ab81f46..ce516f83 100644
--- a/test/drawing/tc_pie_series.rb
+++ b/test/drawing/tc_pie_series.rb
@@ -3,9 +3,9 @@ require 'tc_helper.rb'
class TestPieSeries < Test::Unit::TestCase
def setup
p = Axlsx::Package.new
- @ws = p.workbook.add_worksheet :name=>"hmmm"
+ @ws = p.workbook.add_worksheet :name => "hmmm"
chart = @ws.add_chart Axlsx::Pie3DChart, :title => "fishery"
- @series = chart.add_series :data=>[0,1,2], :labels=>["zero", "one", "two"], :title=>"bob", :colors => ["FF0000", "00FF00", "0000FF"]
+ @series = chart.add_series :data => [0, 1, 2], :labels => ["zero", "one", "two"], :title => "bob", :colors => ["FF0000", "00FF00", "0000FF"]
end
def test_initialize
diff --git a/test/drawing/tc_scaling.rb b/test/drawing/tc_scaling.rb
index 909dded5..8f92a024 100644
--- a/test/drawing/tc_scaling.rb
+++ b/test/drawing/tc_scaling.rb
@@ -13,22 +13,22 @@ class TestScaling < Test::Unit::TestCase
end
def test_logBase
- assert_raise(ArgumentError) { @scaling.logBase = 1}
- assert_nothing_raised {@scaling.logBase = 10}
+ assert_raise(ArgumentError) { @scaling.logBase = 1 }
+ assert_nothing_raised { @scaling.logBase = 10 }
end
def test_orientation
- assert_raise(ArgumentError) { @scaling.orientation = "1"}
- assert_nothing_raised {@scaling.orientation = :maxMin}
+ assert_raise(ArgumentError) { @scaling.orientation = "1" }
+ assert_nothing_raised { @scaling.orientation = :maxMin }
end
def test_max
- assert_raise(ArgumentError) { @scaling.max = 1}
- assert_nothing_raised {@scaling.max = 10.5}
+ assert_raise(ArgumentError) { @scaling.max = 1 }
+ assert_nothing_raised { @scaling.max = 10.5 }
end
def test_min
- assert_raise(ArgumentError) { @scaling.min = 1}
- assert_nothing_raised {@scaling.min = 10.5}
+ assert_raise(ArgumentError) { @scaling.min = 1 }
+ assert_nothing_raised { @scaling.min = 10.5 }
end
end
diff --git a/test/drawing/tc_scatter_series.rb b/test/drawing/tc_scatter_series.rb
index fb30dd70..5ca126a2 100644
--- a/test/drawing/tc_scatter_series.rb
+++ b/test/drawing/tc_scatter_series.rb
@@ -3,9 +3,9 @@ require 'tc_helper.rb'
class TestScatterSeries < Test::Unit::TestCase
def setup
p = Axlsx::Package.new
- @ws = p.workbook.add_worksheet :name=>"hmmm"
+ @ws = p.workbook.add_worksheet :name => "hmmm"
@chart = @ws.add_chart Axlsx::ScatterChart, :title => "Scatter Chart"
- @series = @chart.add_series :xData=>[1,2,4], :yData=>[1,3,9], :title=>"exponents", :color => 'FF0000', :smooth => true
+ @series = @chart.add_series :xData => [1, 2, 4], :yData => [1, 3, 9], :title => "exponents", :color => 'FF0000', :smooth => true
end
def test_initialize
@@ -14,31 +14,31 @@ class TestScatterSeries < Test::Unit::TestCase
def test_smoothed_chart_default_smoothing
@chart = @ws.add_chart Axlsx::ScatterChart, :title => "Smooth Chart", :scatter_style => :smoothMarker
- @series = @chart.add_series :xData=>[1,2,4], :yData=>[1,3,9], :title=>"smoothed exponents"
+ @series = @chart.add_series :xData => [1, 2, 4], :yData => [1, 3, 9], :title => "smoothed exponents"
assert(@series.smooth, "series is smooth by default on smooth charts")
end
def test_unsmoothed_chart_default_smoothing
@chart = @ws.add_chart Axlsx::ScatterChart, :title => "Unsmooth Chart", :scatter_style => :line
- @series = @chart.add_series :xData=>[1,2,4], :yData=>[1,3,9], :title=>"unsmoothed exponents"
+ @series = @chart.add_series :xData => [1, 2, 4], :yData => [1, 3, 9], :title => "unsmoothed exponents"
assert([email protected], "series is not smooth by default on non-smooth charts")
end
def test_explicit_smoothing
@chart = @ws.add_chart Axlsx::ScatterChart, :title => "Unsmooth Chart, Smooth Series", :scatter_style => :line
- @series = @chart.add_series :xData=>[1,2,4], :yData=>[1,3,9], :title=>"smoothed exponents", :smooth => true
+ @series = @chart.add_series :xData => [1, 2, 4], :yData => [1, 3, 9], :title => "smoothed exponents", :smooth => true
assert(@series.smooth, "series is smooth when overriding chart default")
end
def test_explicit_unsmoothing
@chart = @ws.add_chart Axlsx::ScatterChart, :title => "Smooth Chart, Unsmooth Series", :scatter_style => :smoothMarker
- @series = @chart.add_series :xData=>[1,2,4], :yData=>[1,3,9], :title=>"unsmoothed exponents", :smooth => false
+ @series = @chart.add_series :xData => [1, 2, 4], :yData => [1, 3, 9], :title => "unsmoothed exponents", :smooth => false
assert([email protected], "series is not smooth when overriding chart default")
end
def test_ln_width
@chart = @ws.add_chart Axlsx::ScatterChart, :title => "ln width", :scatter_style => :line
- @series = @chart.add_series :xData=>[1,2,4], :yData=>[1,3,9], :title=>"ln_width"
+ @series = @chart.add_series :xData => [1, 2, 4], :yData => [1, 3, 9], :title => "ln_width"
@series.ln_width = 12700
assert_equal(@series.ln_width, 12700, 'line width assigment is allowed')
end
@@ -48,25 +48,25 @@ class TestScatterSeries < Test::Unit::TestCase
@series.ln_width = 12700
doc = Nokogiri::XML(@chart.to_xml_string)
assert_equal(12700, @series.ln_width)
- assert_equal(doc.xpath("//a:srgbClr[@val='#{@series.color}']").size,4)
+ assert_equal(doc.xpath("//a:srgbClr[@val='#{@series.color}']").size, 4)
assert_equal(doc.xpath("//a:ln[@w='#{@series.ln_width}']").length, 1)
end
def test_false_show_marker
@chart = @ws.add_chart Axlsx::ScatterChart, :title => 'Smooth Chart', :scatter_style => :smoothMarker
- @series = @chart.add_series :xData=>[1,2,4], :yData=>[1,3,9]
+ @series = @chart.add_series :xData => [1, 2, 4], :yData => [1, 3, 9]
assert(@series.show_marker, 'markers are enabled for marker-related styles')
end
def test_true_show_marker
@chart = @ws.add_chart Axlsx::ScatterChart, :title => 'Line chart', :scatter_style => :line
- @series = @chart.add_series :xData=>[1,2,4], :yData=>[1,3,9]
+ @series = @chart.add_series :xData => [1, 2, 4], :yData => [1, 3, 9]
assert([email protected]_marker, 'markers are disabled for markerless scatter styles')
end
def test_marker_symbol
@chart = @ws.add_chart Axlsx::ScatterChart, :title => 'Line chart', :scatter_style => :line
- @series = @chart.add_series :xData=>[1,2,4], :yData=>[1,3,9], :marker_symbol => :diamond
+ @series = @chart.add_series :xData => [1, 2, 4], :yData => [1, 3, 9], :marker_symbol => :diamond
assert_equal(@series.marker_symbol, :diamond, 'series could have own custom marker symbol')
end
end
diff --git a/test/drawing/tc_series.rb b/test/drawing/tc_series.rb
index fc4d97e3..80f4b7cb 100644
--- a/test/drawing/tc_series.rb
+++ b/test/drawing/tc_series.rb
@@ -3,9 +3,9 @@ require 'tc_helper.rb'
class TestSeries < Test::Unit::TestCase
def setup
p = Axlsx::Package.new
- @ws = p.workbook.add_worksheet :name=>"hmmm"
+ @ws = p.workbook.add_worksheet :name => "hmmm"
chart = @ws.add_chart Axlsx::Chart, :title => "fishery"
- @series = chart.add_series :title=>"bob"
+ @series = chart.add_series :title => "bob"
end
def test_initialize
diff --git a/test/drawing/tc_two_cell_anchor.rb b/test/drawing/tc_two_cell_anchor.rb
index 2c0f32bd..f2067c23 100644
--- a/test/drawing/tc_two_cell_anchor.rb
+++ b/test/drawing/tc_two_cell_anchor.rb
@@ -21,8 +21,8 @@ class TestTwoCellAnchor < Test::Unit::TestCase
end
def test_options
- assert_raise(ArgumentError, 'invalid start_at') { @ws.add_chart Axlsx::Chart, :start_at=>"1" }
- assert_raise(ArgumentError, 'invalid end_at') { @ws.add_chart Axlsx::Chart, :start_at=>[1,2], :end_at => ["a", 4] }
+ assert_raise(ArgumentError, 'invalid start_at') { @ws.add_chart Axlsx::Chart, :start_at => "1" }
+ assert_raise(ArgumentError, 'invalid end_at') { @ws.add_chart Axlsx::Chart, :start_at => [1, 2], :end_at => ["a", 4] }
# this is actually raised in the graphic frame
assert_raise(ArgumentError, 'invalid Chart') { @ws.add_chart Axlsx::TwoCellAnchor }
a = @ws.add_chart Axlsx::Chart, :start_at => [15, 35], :end_at => [90, 45]
diff --git a/test/drawing/tc_view_3D.rb b/test/drawing/tc_view_3D.rb
index 6202d851..9aceb542 100644
--- a/test/drawing/tc_view_3D.rb
+++ b/test/drawing/tc_view_3D.rb
@@ -19,32 +19,32 @@ class TestView3D < Test::Unit::TestCase
end
def test_rot_x
- assert_raise(ArgumentError) {@view.rot_x = "bob"}
- assert_nothing_raised {@view.rot_x = -90}
+ assert_raise(ArgumentError) { @view.rot_x = "bob" }
+ assert_nothing_raised { @view.rot_x = -90 }
end
def test_rot_y
- assert_raise(ArgumentError) {@view.rot_y = "bob"}
- assert_nothing_raised {@view.rot_y = 90}
+ assert_raise(ArgumentError) { @view.rot_y = "bob" }
+ assert_nothing_raised { @view.rot_y = 90 }
end
def test_h_percent
- assert_raise(ArgumentError) {@view.h_percent = "bob"}
- assert_nothing_raised {@view.h_percent = "500%"}
+ assert_raise(ArgumentError) { @view.h_percent = "bob" }
+ assert_nothing_raised { @view.h_percent = "500%" }
end
def test_depth_percent
- assert_raise(ArgumentError) {@view.depth_percent = "bob"}
- assert_nothing_raised {@view.depth_percent = "20%"}
+ assert_raise(ArgumentError) { @view.depth_percent = "bob" }
+ assert_nothing_raised { @view.depth_percent = "20%" }
end
def test_rAngAx
- assert_raise(ArgumentError) {@view.rAngAx = "bob"}
- assert_nothing_raised {@view.rAngAx = true}
+ assert_raise(ArgumentError) { @view.rAngAx = "bob" }
+ assert_nothing_raised { @view.rAngAx = true }
end
def test_perspective
- assert_raise(ArgumentError) {@view.perspective = "bob"}
- assert_nothing_raised {@view.perspective = 30}
+ assert_raise(ArgumentError) { @view.perspective = "bob" }
+ assert_nothing_raised { @view.perspective = 30 }
end
end
diff --git a/test/drawing/tc_vml_drawing.rb b/test/drawing/tc_vml_drawing.rb
index 792384e9..debba561 100644
--- a/test/drawing/tc_vml_drawing.rb
+++ b/test/drawing/tc_vml_drawing.rb
@@ -18,6 +18,6 @@ class TestVmlDrawing < Test::Unit::TestCase
str = @vml_drawing.to_xml_string()
doc = Nokogiri::XML(str)
assert_equal(doc.xpath("//v:shape").size, 2)
- assert(doc.xpath("//o:idmap[@o:data='#{@ws.index+1}']"))
+ assert(doc.xpath("//o:idmap[@o:data='#{@ws.index + 1}']"))
end
end
diff --git a/test/profile.rb b/test/profile.rb
index de00b32b..4805dad8 100644
--- a/test/profile.rb
+++ b/test/profile.rb
@@ -8,7 +8,7 @@ require 'ruby-prof'
row = []
# Taking worst case scenario of all string data
input = (32..126).to_a.pack('U*').chars.to_a
-20.times { row << input.shuffle.join}
+20.times { row << input.shuffle.join }
profile = RubyProf.profile do
p = Axlsx::Package.new
diff --git a/test/rels/tc_relationship.rb b/test/rels/tc_relationship.rb
index afdf5d1f..1a9df27a 100644
--- a/test/rels/tc_relationship.rb
+++ b/test/rels/tc_relationship.rb
@@ -40,7 +40,7 @@ class TestRelationships < Test::Unit::TestCase
def test_target_mode
assert_raise(ArgumentError) { Axlsx::Relationship.new nil, 'type', 'target', :target_mode => "FISH" }
- assert_nothing_raised { Axlsx::Relationship.new( nil, Axlsx::WORKSHEET_R, 'target', :target_mode => :External) }
+ assert_nothing_raised { Axlsx::Relationship.new(nil, Axlsx::WORKSHEET_R, 'target', :target_mode => :External) }
end
def test_ampersand_escaping_in_target
diff --git a/test/stylesheet/tc_border.rb b/test/stylesheet/tc_border.rb
index c2fb0d98..9e29dda4 100644
--- a/test/stylesheet/tc_border.rb
+++ b/test/stylesheet/tc_border.rb
@@ -18,22 +18,22 @@ class TestBorder < Test::Unit::TestCase
def test_diagonalUp
assert_raise(ArgumentError) { @b.diagonalUp = :red }
assert_nothing_raised { @b.diagonalUp = true }
- assert_equal(@b.diagonalUp, true )
+ assert_equal(@b.diagonalUp, true)
end
def test_diagonalDown
assert_raise(ArgumentError) { @b.diagonalDown = :red }
assert_nothing_raised { @b.diagonalDown = true }
- assert_equal(@b.diagonalDown, true )
+ assert_equal(@b.diagonalDown, true)
end
def test_outline
assert_raise(ArgumentError) { @b.outline = :red }
assert_nothing_raised { @b.outline = true }
- assert_equal(@b.outline, true )
+ assert_equal(@b.outline, true)
end
def test_prs
- assert_nothing_raised { @b.prs << Axlsx::BorderPr.new(:name=>:top, :style=>:thin, :color => Axlsx::Color.new(:rgb=>"FF0000FF")) }
+ assert_nothing_raised { @b.prs << Axlsx::BorderPr.new(:name => :top, :style => :thin, :color => Axlsx::Color.new(:rgb => "FF0000FF")) }
end
end
diff --git a/test/stylesheet/tc_border_pr.rb b/test/stylesheet/tc_border_pr.rb
index 1e1c1dcc..3b25575b 100644
--- a/test/stylesheet/tc_border_pr.rb
+++ b/test/stylesheet/tc_border_pr.rb
@@ -16,7 +16,7 @@ class TestBorderPr < Test::Unit::TestCase
def test_color
assert_raise(ArgumentError) { @bpr.color = :red }
- assert_nothing_raised { @bpr.color = Axlsx::Color.new :rgb=>"FF000000" }
+ assert_nothing_raised { @bpr.color = Axlsx::Color.new :rgb => "FF000000" }
assert(@bpr.color.is_a?(Axlsx::Color))
end
diff --git a/test/stylesheet/tc_cell_alignment.rb b/test/stylesheet/tc_cell_alignment.rb
index a61d764f..fe2e9fe4 100644
--- a/test/stylesheet/tc_cell_alignment.rb
+++ b/test/stylesheet/tc_cell_alignment.rb
@@ -15,66 +15,66 @@ class TestCellAlignment < Test::Unit::TestCase
assert_equal(@item.justifyLastLine, nil)
assert_equal(@item.shrinkToFit, nil)
assert_equal(@item.readingOrder, nil)
- options = { :horizontal => :left, :vertical => :top, :textRotation => 3,
+ options = { :horizontal => :left, :vertical => :top, :textRotation => 3,
:wrapText => true, :indent => 2, :relativeIndent => 5,
:justifyLastLine => true, :shrinkToFit => true, :readingOrder => 2 }
ca = Axlsx::CellAlignment.new options
options.each do |key, value|
- assert_equal(ca.send(key.to_sym),value)
+ assert_equal(ca.send(key.to_sym), value)
end
end
def test_horizontal
assert_raise(ArgumentError) { @item.horizontal = :red }
assert_nothing_raised { @item.horizontal = :left }
- assert_equal(@item.horizontal, :left )
+ assert_equal(@item.horizontal, :left)
end
def test_vertical
assert_raise(ArgumentError) { @item.vertical = :red }
assert_nothing_raised { @item.vertical = :top }
- assert_equal(@item.vertical, :top )
+ assert_equal(@item.vertical, :top)
end
def test_textRotation
assert_raise(ArgumentError) { @item.textRotation = -1 }
assert_nothing_raised { @item.textRotation = 5 }
- assert_equal(@item.textRotation, 5 )
+ assert_equal(@item.textRotation, 5)
end
def test_wrapText
assert_raise(ArgumentError) { @item.wrapText = -1 }
assert_nothing_raised { @item.wrapText = false }
- assert_equal(@item.wrapText, false )
+ assert_equal(@item.wrapText, false)
end
def test_indent
assert_raise(ArgumentError) { @item.indent = -1 }
assert_nothing_raised { @item.indent = 5 }
- assert_equal(@item.indent, 5 )
+ assert_equal(@item.indent, 5)
end
def test_relativeIndent
assert_raise(ArgumentError) { @item.relativeIndent = :symbol }
assert_nothing_raised { @item.relativeIndent = 5 }
- assert_equal(@item.relativeIndent, 5 )
+ assert_equal(@item.relativeIndent, 5)
end
def test_justifyLastLine
assert_raise(ArgumentError) { @item.justifyLastLine = -1 }
assert_nothing_raised { @item.justifyLastLine = true }
- assert_equal(@item.justifyLastLine, true )
+ assert_equal(@item.justifyLastLine, true)
end
def test_shrinkToFit
assert_raise(ArgumentError) { @item.shrinkToFit = -1 }
assert_nothing_raised { @item.shrinkToFit = true }
- assert_equal(@item.shrinkToFit, true )
+ assert_equal(@item.shrinkToFit, true)
end
def test_readingOrder
assert_raise(ArgumentError) { @item.readingOrder = -1 }
assert_nothing_raised { @item.readingOrder = 2 }
- assert_equal(@item.readingOrder, 2 )
+ assert_equal(@item.readingOrder, 2)
end
end
diff --git a/test/stylesheet/tc_cell_protection.rb b/test/stylesheet/tc_cell_protection.rb
index a9648745..a1fc59b2 100644
--- a/test/stylesheet/tc_cell_protection.rb
+++ b/test/stylesheet/tc_cell_protection.rb
@@ -16,12 +16,12 @@ class TestCellProtection < Test::Unit::TestCase
def test_hidden
assert_raise(ArgumentError) { @item.hidden = -1 }
assert_nothing_raised { @item.hidden = false }
- assert_equal(@item.hidden, false )
+ assert_equal(@item.hidden, false)
end
def test_locked
assert_raise(ArgumentError) { @item.locked = -1 }
assert_nothing_raised { @item.locked = false }
- assert_equal(@item.locked, false )
+ assert_equal(@item.locked, false)
end
end
diff --git a/test/stylesheet/tc_cell_style.rb b/test/stylesheet/tc_cell_style.rb
index 5e71a698..18e7a1ab 100644
--- a/test/stylesheet/tc_cell_style.rb
+++ b/test/stylesheet/tc_cell_style.rb
@@ -20,36 +20,36 @@ class TestCellStyle < Test::Unit::TestCase
def test_name
assert_raise(ArgumentError) { @item.name = -1 }
assert_nothing_raised { @item.name = "stylin" }
- assert_equal(@item.name, "stylin" )
+ assert_equal(@item.name, "stylin")
end
def test_xfId
assert_raise(ArgumentError) { @item.xfId = -1 }
assert_nothing_raised { @item.xfId = 5 }
- assert_equal(@item.xfId, 5 )
+ assert_equal(@item.xfId, 5)
end
def test_builtinId
assert_raise(ArgumentError) { @item.builtinId = -1 }
assert_nothing_raised { @item.builtinId = 5 }
- assert_equal(@item.builtinId, 5 )
+ assert_equal(@item.builtinId, 5)
end
def test_iLevel
assert_raise(ArgumentError) { @item.iLevel = -1 }
assert_nothing_raised { @item.iLevel = 5 }
- assert_equal(@item.iLevel, 5 )
+ assert_equal(@item.iLevel, 5)
end
def test_hidden
assert_raise(ArgumentError) { @item.hidden = -1 }
assert_nothing_raised { @item.hidden = true }
- assert_equal(@item.hidden, true )
+ assert_equal(@item.hidden, true)
end
def test_customBuiltin
assert_raise(ArgumentError) { @item.customBuiltin = -1 }
assert_nothing_raised { @item.customBuiltin = true }
- assert_equal(@item.customBuiltin, true )
+ assert_equal(@item.customBuiltin, true)
end
end
diff --git a/test/stylesheet/tc_color.rb b/test/stylesheet/tc_color.rb
index 1fff4c3b..8f87111e 100644
--- a/test/stylesheet/tc_color.rb
+++ b/test/stylesheet/tc_color.rb
@@ -17,13 +17,13 @@ class TestColor < Test::Unit::TestCase
def test_auto
assert_raise(ArgumentError) { @item.auto = -1 }
assert_nothing_raised { @item.auto = true }
- assert_equal(@item.auto, true )
+ assert_equal(@item.auto, true)
end
def test_rgb
assert_raise(ArgumentError) { @item.rgb = -1 }
assert_nothing_raised { @item.rgb = "FF00FF00" }
- assert_equal(@item.rgb, "FF00FF00" )
+ assert_equal(@item.rgb, "FF00FF00")
end
def test_rgb_writer_doesnt_mutate_its_argument
@@ -35,6 +35,6 @@ class TestColor < Test::Unit::TestCase
def test_tint
assert_raise(ArgumentError) { @item.tint = -1 }
assert_nothing_raised { @item.tint = -1.0 }
- assert_equal(@item.tint, -1.0 )
+ assert_equal(@item.tint, -1.0)
end
end
diff --git a/test/stylesheet/tc_dxf.rb b/test/stylesheet/tc_dxf.rb
index ffc59dfb..9e87007d 100644
--- a/test/stylesheet/tc_dxf.rb
+++ b/test/stylesheet/tc_dxf.rb
@@ -37,8 +37,8 @@ class TestDxf < Test::Unit::TestCase
end
def test_fill
- assert_raise(ArgumentError) { @item.fill = 1 }
- assert_nothing_raised { @item.fill = Axlsx::Fill.new(Axlsx::PatternFill.new(:patternType =>:solid, :fgColor=> Axlsx::Color.new(:rgb => "FF000000"))) }
+ assert_raise(ArgumentError) { @item.fill = 1 }
+ assert_nothing_raised { @item.fill = Axlsx::Fill.new(Axlsx::PatternFill.new(:patternType => :solid, :fgColor => Axlsx::Color.new(:rgb => "FF000000"))) }
assert @item.fill.is_a? Axlsx::Fill
end
@@ -64,7 +64,7 @@ class TestDxf < Test::Unit::TestCase
def test_many_options_xml
@item.border = Axlsx::Border.new
@item.alignment = Axlsx::CellAlignment.new
- @item.fill = Axlsx::Fill.new(Axlsx::PatternFill.new(:patternType =>:solid, :fgColor=> Axlsx::Color.new(:rgb => "FF000000")))
+ @item.fill = Axlsx::Fill.new(Axlsx::PatternFill.new(:patternType => :solid, :fgColor => Axlsx::Color.new(:rgb => "FF000000")))
@item.font = Axlsx::Font.new
@item.protection = Axlsx::CellProtection.new
@item.numFmt = Axlsx::NumFmt.new
diff --git a/test/stylesheet/tc_font.rb b/test/stylesheet/tc_font.rb
index fb52f846..821e8820 100644
--- a/test/stylesheet/tc_font.rb
+++ b/test/stylesheet/tc_font.rb
@@ -116,7 +116,7 @@ class TestFont < Test::Unit::TestCase
# def color=(v) DataTypeValidator.validate "Font.color", Color, v; @color=v end
def test_color
assert_raise(ArgumentError) { @item.color = -7 }
- assert_nothing_raised { @item.color = Axlsx::Color.new(:rgb=>"00000000") }
+ assert_nothing_raised { @item.color = Axlsx::Color.new(:rgb => "00000000") }
assert(@item.color.is_a?(Axlsx::Color))
end
diff --git a/test/stylesheet/tc_gradient_fill.rb b/test/stylesheet/tc_gradient_fill.rb
index 9ff043cc..3950fcf7 100644
--- a/test/stylesheet/tc_gradient_fill.rb
+++ b/test/stylesheet/tc_gradient_fill.rb
@@ -55,7 +55,7 @@ class TestGradientFill < Test::Unit::TestCase
end
def test_stop
- @item.stop << Axlsx::GradientStop.new(Axlsx::Color.new(:rgb=>"00000000"), 0.5)
+ @item.stop << Axlsx::GradientStop.new(Axlsx::Color.new(:rgb => "00000000"), 0.5)
assert(@item.stop.size == 1)
assert(@item.stop.last.is_a?(Axlsx::GradientStop))
end
diff --git a/test/stylesheet/tc_gradient_stop.rb b/test/stylesheet/tc_gradient_stop.rb
index 2865f12d..6dc140e0 100644
--- a/test/stylesheet/tc_gradient_stop.rb
+++ b/test/stylesheet/tc_gradient_stop.rb
@@ -2,7 +2,7 @@ require 'tc_helper.rb'
class TestGradientStop < Test::Unit::TestCase
def setup
- @item = Axlsx::GradientStop.new(Axlsx::Color.new(:rgb=>"FFFF0000"), 1.0)
+ @item = Axlsx::GradientStop.new(Axlsx::Color.new(:rgb => "FFFF0000"), 1.0)
end
def teardown
@@ -21,7 +21,7 @@ class TestGradientStop < Test::Unit::TestCase
def test_color
assert_raise(ArgumentError) { @item.color = nil }
- color = Axlsx::Color.new(:rgb=>"FF0000FF")
+ color = Axlsx::Color.new(:rgb => "FF0000FF")
@item.color = color
assert_equal(@item.color.rgb, "FF0000FF")
end
diff --git a/test/stylesheet/tc_pattern_fill.rb b/test/stylesheet/tc_pattern_fill.rb
index e22f4de6..1126e919 100644
--- a/test/stylesheet/tc_pattern_fill.rb
+++ b/test/stylesheet/tc_pattern_fill.rb
@@ -33,7 +33,7 @@ class TestPatternFill < Test::Unit::TestCase
end
def test_to_xml_string
- @item = Axlsx::PatternFill.new :bgColor => Axlsx::Color.new(:rgb => "FF0000"), :fgColor => Axlsx::Color.new(:rgb=>"00FF00")
+ @item = Axlsx::PatternFill.new :bgColor => Axlsx::Color.new(:rgb => "FF0000"), :fgColor => Axlsx::Color.new(:rgb => "00FF00")
doc = Nokogiri::XML(@item.to_xml_string)
assert(doc.xpath('//color[@rgb="FFFF0000"]'))
assert(doc.xpath('//color[@rgb="FF00FF00"]'))
diff --git a/test/stylesheet/tc_styles.rb b/test/stylesheet/tc_styles.rb
index 8bb6ff32..78e82354 100644
--- a/test/stylesheet/tc_styles.rb
+++ b/test/stylesheet/tc_styles.rb
@@ -21,10 +21,10 @@ class TestStyles < Test::Unit::TestCase
def test_add_style_border_hash
border_count = @styles.borders.size
- @styles.add_style :border => {:style => :thin, :color => "FFFF0000"}
+ @styles.add_style :border => { :style => :thin, :color => "FFFF0000" }
assert_equal(@styles.borders.size, border_count + 1)
assert_equal(@styles.borders.last.prs.last.color.rgb, "FFFF0000")
- assert_raise(ArgumentError) { @styles.add_style :border => {:color => "FFFF0000"} }
+ assert_raise(ArgumentError) { @styles.add_style :border => { :color => "FFFF0000" } }
assert_equal @styles.borders.last.prs.size, 4
end
@@ -32,23 +32,23 @@ class TestStyles < Test::Unit::TestCase
prev_border_count = @styles.borders.size
borders_array = [
- {:style => :thin, :color => "DDDDDD"},
- {:edges => [:top], :style => :thin, :color => "000000"},
- {:edges => [:bottom], :style => :thick, :color => "FF0000"},
- {:edges => [:left], :style => :dotted, :color => "FFFF00"},
- {:edges => [:right], :style => :dashed, :color => "FFFFFF"},
- {:style => :thick, :color => "CCCCCC"}
+ { :style => :thin, :color => "DDDDDD" },
+ { :edges => [:top], :style => :thin, :color => "000000" },
+ { :edges => [:bottom], :style => :thick, :color => "FF0000" },
+ { :edges => [:left], :style => :dotted, :color => "FFFF00" },
+ { :edges => [:right], :style => :dashed, :color => "FFFFFF" },
+ { :style => :thick, :color => "CCCCCC" }
]
@styles.add_style(border: borders_array)
- assert_equal(@styles.borders.size, (prev_border_count+1))
+ assert_equal(@styles.borders.size, (prev_border_count + 1))
current_border = @styles.borders.last
borders_array.each do |b_opts|
if b_opts[:edges]
- border_pr = current_border.prs.detect{|x| x.name == b_opts[:edges].first }
+ border_pr = current_border.prs.detect { |x| x.name == b_opts[:edges].first }
assert_equal(border_pr.color.rgb, "FF#{b_opts[:color]}")
end
end
@@ -63,39 +63,39 @@ class TestStyles < Test::Unit::TestCase
def test_do_not_alter_options_in_add_style
#This should test all options, but for now - just the bits that we know caused some pain
- options = { :border => { :style => :thin, :color =>"FF000000" } }
+ options = { :border => { :style => :thin, :color => "FF000000" } }
@styles.add_style options
assert_equal options[:border][:style], :thin, 'thin style is stil in option'
assert_equal options[:border][:color], "FF000000", 'color is stil in option'
end
def test_parse_num_fmt
- f_code = {:format_code => "YYYY/MM"}
- num_fmt = {:num_fmt => 5}
+ f_code = { :format_code => "YYYY/MM" }
+ num_fmt = { :num_fmt => 5 }
assert_equal(@styles.parse_num_fmt_options, nil, 'noop if neither :format_code or :num_fmt exist')
- max = @styles.numFmts.map{ |nf| nf.numFmtId }.max
+ max = @styles.numFmts.map { |nf| nf.numFmtId }.max
@styles.parse_num_fmt_options(f_code)
assert_equal(@styles.numFmts.last.numFmtId, max + 1, "new numfmts gets next available id")
assert(@styles.parse_num_fmt_options(num_fmt).is_a?(Integer), "Should return the provided num_fmt if not dxf")
- assert(@styles.parse_num_fmt_options(num_fmt.merge({:type => :dxf})).is_a?(Axlsx::NumFmt), "Makes a new NumFmt if dxf")
+ assert(@styles.parse_num_fmt_options(num_fmt.merge({ :type => :dxf })).is_a?(Axlsx::NumFmt), "Makes a new NumFmt if dxf")
end
def test_parse_border_options_hash_required_keys
assert_raise(ArgumentError, "Require color key") { @styles.parse_border_options(:border => { :style => :thin }) }
assert_raise(ArgumentError, "Require style key") { @styles.parse_border_options(:border => { :color => "FF0d0d0d" }) }
- assert_nothing_raised { @styles.parse_border_options(:border => { :style => :thin, :color => "FF000000"} ) }
+ assert_nothing_raised { @styles.parse_border_options(:border => { :style => :thin, :color => "FF000000" }) }
end
def test_parse_border_basic_options
- b_opts = {:border => { :diagonalUp => 1, :edges => [:left, :right], :color => "FFDADADA", :style => :thick } }
+ b_opts = { :border => { :diagonalUp => 1, :edges => [:left, :right], :color => "FFDADADA", :style => :thick } }
b = @styles.parse_border_options b_opts
assert(b.is_a? Integer)
- assert_equal(@styles.parse_border_options(b_opts.merge({:type => :dxf})).class,Axlsx::Border)
+ assert_equal(@styles.parse_border_options(b_opts.merge({ :type => :dxf })).class, Axlsx::Border)
assert(@styles.borders.last.diagonalUp == 1, "border options are passed in to the initializer")
end
def test_parse_border_options_edges
- b_opts = {:border => { :diagonalUp => 1, :edges => [:left, :right], :color => "FFDADADA", :style => :thick } }
+ b_opts = { :border => { :diagonalUp => 1, :edges => [:left, :right], :color => "FFDADADA", :style => :thick } }
@styles.parse_border_options b_opts
b = @styles.borders.last
left = b.prs.select { |bpr| bpr.name == :left }[0]
@@ -106,10 +106,10 @@ class TestStyles < Test::Unit::TestCase
assert_equal(bottom, nil, "unspecified bottom edge should not be created")
assert(left.is_a?(Axlsx::BorderPr), "specified left edge is set")
assert(right.is_a?(Axlsx::BorderPr), "specified right edge is set")
- assert_equal(left.style,right.style, "edge parts have the same style")
+ assert_equal(left.style, right.style, "edge parts have the same style")
assert_equal(left.style, :thick, "the style is THICK")
- assert_equal(right.color.rgb,left.color.rgb, "edge parts are colors are the same")
- assert_equal(right.color.rgb,"FFDADADA", "edge color rgb is correct")
+ assert_equal(right.color.rgb, left.color.rgb, "edge parts are colors are the same")
+ assert_equal(right.color.rgb, "FFDADADA", "edge color rgb is correct")
end
def test_parse_border_options_noop
@@ -118,11 +118,11 @@ class TestStyles < Test::Unit::TestCase
def test_parse_border_options_integer_xf
assert_equal(@styles.parse_border_options(:border => 1), 1)
- assert_raise(ArgumentError, "unknown border index") {@styles.parse_border_options(:border => 100) }
+ assert_raise(ArgumentError, "unknown border index") { @styles.parse_border_options(:border => 100) }
end
def test_parse_border_options_integer_dxf
- b_opts = { :border => { :edges => [:left, :right], :color => "FFFFFFFF", :style=> :thick } }
+ b_opts = { :border => { :edges => [:left, :right], :color => "FFFFFFFF", :style => :thick } }
b = @styles.parse_border_options(b_opts)
b2 = @styles.parse_border_options(:border => b, :type => :dxf)
assert(b2.is_a?(Axlsx::Border), "Cloned existing border object")
@@ -140,7 +140,7 @@ class TestStyles < Test::Unit::TestCase
original_attributes = Axlsx.instance_values_for(original)
assert_equal(1, created.b)
assert_equal(99, created.sz)
- copied = original_attributes.reject{ |key, value| %w(b sz).include? key }
+ copied = original_attributes.reject { |key, value| %w(b sz).include? key }
instance_vals = Axlsx.instance_values_for(created)
copied.each do |key, value|
assert_equal(instance_vals[key], value)
@@ -162,8 +162,8 @@ class TestStyles < Test::Unit::TestCase
:font_name => "woot font"
}
assert_equal(@styles.parse_font_options {}, nil, "noop if no font keys are set")
- assert(@styles.parse_font_options(:b=>1).is_a?(Integer), "return index of font if not :dxf type")
- assert_equal(@styles.parse_font_options(:b=>1, :type => :dxf).class, Axlsx::Font, "return font object if :dxf type")
+ assert(@styles.parse_font_options(:b => 1).is_a?(Integer), "return index of font if not :dxf type")
+ assert_equal(@styles.parse_font_options(:b => 1, :type => :dxf).class, Axlsx::Font, "return font object if :dxf type")
f = @styles.parse_font_options(options.merge(:type => :dxf))
color = options.delete(:fg_color)
@@ -192,15 +192,15 @@ class TestStyles < Test::Unit::TestCase
font_count = @styles.fonts.size
xf_count = @styles.cellXfs.size
- @styles.add_style :bg_color=>"FF000000", :fg_color=>"FFFFFFFF", :sz=>13, :num_fmt=>Axlsx::NUM_FMT_PERCENT, :alignment=>{:horizontal=>:left}, :border=>Axlsx::STYLE_THIN_BORDER, :hidden=>true, :locked=>true
- assert_equal(@styles.fills.size, fill_count+1)
- assert_equal(@styles.fonts.size, font_count+1)
- assert_equal(@styles.cellXfs.size, xf_count+1)
+ @styles.add_style :bg_color => "FF000000", :fg_color => "FFFFFFFF", :sz => 13, :num_fmt => Axlsx::NUM_FMT_PERCENT, :alignment => { :horizontal => :left }, :border => Axlsx::STYLE_THIN_BORDER, :hidden => true, :locked => true
+ assert_equal(@styles.fills.size, fill_count + 1)
+ assert_equal(@styles.fonts.size, font_count + 1)
+ assert_equal(@styles.cellXfs.size, xf_count + 1)
xf = @styles.cellXfs.last
- assert_equal(xf.fillId, (@styles.fills.size-1), "points to the last created fill")
+ assert_equal(xf.fillId, (@styles.fills.size - 1), "points to the last created fill")
assert_equal(@styles.fills.last.fill_type.fgColor.rgb, "FF000000", "fill created with color")
- assert_equal(xf.fontId, (@styles.fonts.size-1), "points to the last created font")
+ assert_equal(xf.fontId, (@styles.fonts.size - 1), "points to the last created font")
assert_equal(@styles.fonts.last.sz, 13, "font sz applied")
assert_equal(@styles.fonts.last.color.rgb, "FFFFFFFF", "font color applied")
@@ -215,16 +215,16 @@ class TestStyles < Test::Unit::TestCase
assert_equal(xf.applyProtection, true, "protection applied")
assert_equal(xf.applyBorder, true, "border applied")
- assert_equal(xf.applyNumberFormat,true, "number format applied")
+ assert_equal(xf.applyNumberFormat, true, "number format applied")
assert_equal(xf.applyAlignment, true, "alignment applied")
end
def test_basic_add_style_dxf
border_count = @styles.borders.size
- @styles.add_style :border => {:style => :thin, :color => "FFFF0000"}, :type => :dxf
+ @styles.add_style :border => { :style => :thin, :color => "FFFF0000" }, :type => :dxf
assert_equal(@styles.borders.size, border_count, "styles borders not affected")
assert_equal(@styles.dxfs.last.border.prs.last.color.rgb, "FFFF0000")
- assert_raise(ArgumentError) { @styles.add_style :border => {:color => "FFFF0000"}, :type => :dxf }
+ assert_raise(ArgumentError) { @styles.add_style :border => { :color => "FFFF0000" }, :type => :dxf }
assert_equal @styles.borders.last.prs.size, 4
end
@@ -233,8 +233,8 @@ class TestStyles < Test::Unit::TestCase
font_count = @styles.fonts.size
dxf_count = @styles.dxfs.size
- style = @styles.add_style :bg_color=>"FF000000", :fg_color=>"FFFFFFFF", :sz=>13, :alignment=>{:horizontal=>:left}, :border=>{:style => :thin, :color => "FFFF0000"}, :hidden=>true, :locked=>true, :type => :dxf
- assert_equal(@styles.dxfs.size, dxf_count+1)
+ style = @styles.add_style :bg_color => "FF000000", :fg_color => "FFFFFFFF", :sz => 13, :alignment => { :horizontal => :left }, :border => { :style => :thin, :color => "FFFF0000" }, :hidden => true, :locked => true, :type => :dxf
+ assert_equal(@styles.dxfs.size, dxf_count + 1)
assert_equal(0, style, "returns the zero-based dxfId")
dxf = @styles.dxfs.last
@@ -255,9 +255,9 @@ class TestStyles < Test::Unit::TestCase
def test_multiple_dxf
# add a second style
- style = @styles.add_style :bg_color=>"00000000", :fg_color=>"FFFFFFFF", :sz=>13, :alignment=>{:horizontal=>:left}, :border=>{:style => :thin, :color => "FFFF0000"}, :hidden=>true, :locked=>true, :type => :dxf
+ style = @styles.add_style :bg_color => "00000000", :fg_color => "FFFFFFFF", :sz => 13, :alignment => { :horizontal => :left }, :border => { :style => :thin, :color => "FFFF0000" }, :hidden => true, :locked => true, :type => :dxf
assert_equal(0, style, "returns the first dxfId")
- style = @styles.add_style :bg_color=>"FF000000", :fg_color=>"FFFFFFFF", :sz=>13, :alignment=>{:horizontal=>:left}, :border=>{:style => :thin, :color => "FFFF0000"}, :hidden=>true, :locked=>true, :type => :dxf
+ style = @styles.add_style :bg_color => "FF000000", :fg_color => "FFFFFFFF", :sz => 13, :alignment => { :horizontal => :left }, :border => { :style => :thin, :color => "FFFF0000" }, :hidden => true, :locked => true, :type => :dxf
assert_equal(1, style, "returns the second dxfId")
end
@@ -302,7 +302,7 @@ class TestStyles < Test::Unit::TestCase
current_border = @styles.borders.last
- border_pr = current_border.prs.detect{|x| x.name == edge }
+ border_pr = current_border.prs.detect { |x| x.name == edge }
assert_equal(border_pr.color.rgb, "FF#{b_opts[:color]}")
end
end
diff --git a/test/tc_axlsx.rb b/test/tc_axlsx.rb
index fc23cc5f..c214f8e2 100644
--- a/test/tc_axlsx.rb
+++ b/test/tc_axlsx.rb
@@ -64,7 +64,7 @@ class TestAxlsx < Test::Unit::TestCase
def test_name_to_indices
setup_wide
@wide_test_points.each do |key, value|
- assert_equal(Axlsx.name_to_indices(key), [value,2])
+ assert_equal(Axlsx.name_to_indices(key), [value, 2])
end
end
@@ -108,7 +108,7 @@ class TestAxlsx < Test::Unit::TestCase
end
class InstanceValuesSubject
- def initialize(args={})
+ def initialize(args = {})
args.each do |key, v|
instance_variable_set("@#{key}".to_sym, v)
end
@@ -120,23 +120,23 @@ class TestAxlsx < Test::Unit::TestCase
assert_equal({}, Axlsx.instance_values_for(empty), 'should generate with no ivars')
single = InstanceValuesSubject.new(a: 2)
- assert_equal({"a" => 2}, Axlsx.instance_values_for(single), 'should generate for a single ivar')
+ assert_equal({ "a" => 2 }, Axlsx.instance_values_for(single), 'should generate for a single ivar')
double = InstanceValuesSubject.new(a: 2, b: "c")
- assert_equal({"a" => 2, "b" => "c"}, Axlsx.instance_values_for(double), 'should generate for multiple ivars')
+ assert_equal({ "a" => 2, "b" => "c" }, Axlsx.instance_values_for(double), 'should generate for multiple ivars')
inner_obj = Object.new
complex = InstanceValuesSubject.new(obj: inner_obj)
- assert_equal({"obj" => inner_obj}, Axlsx.instance_values_for(complex), 'should pass value of ivar directly')
+ assert_equal({ "obj" => inner_obj }, Axlsx.instance_values_for(complex), 'should pass value of ivar directly')
nil_subject = InstanceValuesSubject.new(nil_obj: nil)
- assert_equal({"nil_obj" => nil}, Axlsx.instance_values_for(nil_subject), 'should return nil ivars')
+ assert_equal({ "nil_obj" => nil }, Axlsx.instance_values_for(nil_subject), 'should return nil ivars')
end
def test_hash_deep_merge
- h1 = {foo: {bar: true}}
- h2 = {foo: {baz: true}}
- assert_equal({foo: {baz: true}}, h1.merge(h2))
- assert_equal({foo: {bar: true, baz: true}}, Axlsx.hash_deep_merge(h1, h2))
+ h1 = { foo: { bar: true } }
+ h2 = { foo: { baz: true } }
+ assert_equal({ foo: { baz: true } }, h1.merge(h2))
+ assert_equal({ foo: { bar: true, baz: true } }, Axlsx.hash_deep_merge(h1, h2))
end
end
diff --git a/test/tc_package.rb b/test/tc_package.rb
index b3ca6810..c8f35211 100644
--- a/test/tc_package.rb
+++ b/test/tc_package.rb
@@ -39,8 +39,8 @@ class TestPackage < Test::Unit::TestCase
vs.add_selection(:bottom_right, { :active_cell => 'I57', :sqref => 'I57' })
end
- ws.add_chart(Axlsx::Pie3DChart, :title => "これは?", :start_at => [0,3]) do |chart|
- chart.add_series :data=>[1,2,3], :labels=>["a", "b", "c"]
+ ws.add_chart(Axlsx::Pie3DChart, :title => "これは?", :start_at => [0, 3]) do |chart|
+ chart.add_series :data => [1, 2, 3], :labels => ["a", "b", "c"]
chart.d_lbls.show_val = true
chart.d_lbls.d_lbl_pos = :outEnd
chart.d_lbls.show_percent = true
@@ -52,33 +52,33 @@ class TestPackage < Test::Unit::TestCase
end
ws.add_chart(Axlsx::Bar3DChart, :title => 'bar chart') do |chart|
- chart.add_series :data => [1,4,5], :labels => %w(A B C)
+ chart.add_series :data => [1, 4, 5], :labels => %w(A B C)
chart.d_lbls.show_percent = true
end
ws.add_chart(Axlsx::ScatterChart, :title => 'scat man') do |chart|
- chart.add_series :xData => [1,2,3,4], :yData => [4,3,2,1]
+ chart.add_series :xData => [1, 2, 3, 4], :yData => [4, 3, 2, 1]
chart.d_lbls.show_val = true
end
ws.add_chart(Axlsx::BubbleChart, :title => 'bubble chart') do |chart|
- chart.add_series :xData => [1,2,3,4], :yData => [1,3,2,4]
+ chart.add_series :xData => [1, 2, 3, 4], :yData => [1, 3, 2, 4]
chart.d_lbls.show_val = true
end
@fname = 'axlsx_test_serialization.xlsx'
img = File.expand_path('../fixtures/image1.jpeg', __FILE__)
- ws.add_image(:image_src => img, :noSelect => true, :noMove => true, :hyperlink=>"http://axlsx.blogspot.com") do |image|
- image.width=720
- image.height=666
+ ws.add_image(:image_src => img, :noSelect => true, :noMove => true, :hyperlink => "http://axlsx.blogspot.com") do |image|
+ image.width = 720
+ image.height = 666
image.hyperlink.tooltip = "Labeled Link"
image.start_at 5, 5
image.end_at 10, 10
end
ws.add_image :image_src => File.expand_path('../fixtures/image1.gif', __FILE__) do |image|
image.start_at 0, 20
- image.width=360
- image.height=333
+ image.width = 360
+ image.height = 333
end
ws.add_image :image_src => File.expand_path('../fixtures/image1.png', __FILE__) do |image|
image.start_at 9, 20
@@ -99,18 +99,18 @@ class TestPackage < Test::Unit::TestCase
def test_core_accessor
assert_equal(@package.core, Axlsx.instance_values_for(@package)["core"])
- assert_raise(NoMethodError) {@package.core = nil }
+ assert_raise(NoMethodError) { @package.core = nil }
end
def test_app_accessor
assert_equal(@package.app, Axlsx.instance_values_for(@package)["app"])
- assert_raise(NoMethodError) {@package.app = nil }
+ assert_raise(NoMethodError) { @package.app = nil }
end
def test_use_shared_strings
assert_equal(@package.use_shared_strings, nil)
- assert_raise(ArgumentError) {@package.use_shared_strings 9}
- assert_nothing_raised {@package.use_shared_strings = true}
+ assert_raise(ArgumentError) { @package.use_shared_strings 9 }
+ assert_nothing_raised { @package.use_shared_strings = true }
assert_equal(@package.use_shared_strings, @package.workbook.use_shared_strings)
end
@@ -177,7 +177,7 @@ class TestPackage < Test::Unit::TestCase
def assert_zip_file_matches_package(fname, package)
zf = Zip::File.open(fname)
- package.send(:parts).each{ |part| zf.get_entry(part[:entry]) }
+ package.send(:parts).each { |part| zf.get_entry(part[:entry]) }
end
def assert_created_with_rubyzip(fname, package)
@@ -250,22 +250,22 @@ class TestPackage < Test::Unit::TestCase
def test_parts
p = @package.send(:parts)
#all parts have an entry
- assert_equal(p.select{ |part| part[:entry] =~ /_rels\/\.rels/ }.size, 1, "rels missing")
- assert_equal(p.select{ |part| part[:entry] =~ /docProps\/core\.xml/ }.size, 1, "core missing")
- assert_equal(p.select{ |part| part[:entry] =~ /docProps\/app\.xml/ }.size, 1, "app missing")
- assert_equal(p.select{ |part| part[:entry] =~ /xl\/_rels\/workbook\.xml\.rels/ }.size, 1, "workbook rels missing")
- assert_equal(p.select{ |part| part[:entry] =~ /xl\/workbook\.xml/ }.size, 1, "workbook missing")
- assert_equal(p.select{ |part| part[:entry] =~ /\[Content_Types\]\.xml/ }.size, 1, "content types missing")
- assert_equal(p.select{ |part| part[:entry] =~ /xl\/styles\.xml/ }.size, 1, "styles missin")
- assert_equal(p.select{ |part| part[:entry] =~ /xl\/drawings\/_rels\/drawing\d\.xml\.rels/ }.size, @package.workbook.drawings.size, "one or more drawing rels missing")
- assert_equal(p.select{ |part| part[:entry] =~ /xl\/drawings\/drawing\d\.xml/ }.size, @package.workbook.drawings.size, "one or more drawings missing")
- assert_equal(p.select{ |part| part[:entry] =~ /xl\/charts\/chart\d\.xml/ }.size, @package.workbook.charts.size, "one or more charts missing")
- assert_equal(p.select{ |part| part[:entry] =~ /xl\/worksheets\/sheet\d\.xml/ }.size, @package.workbook.worksheets.size, "one or more sheet missing")
- assert_equal(p.select{ |part| part[:entry] =~ /xl\/worksheets\/_rels\/sheet\d\.xml\.rels/ }.size, @package.workbook.worksheets.size, "one or more sheet rels missing")
- assert_equal(p.select{ |part| part[:entry] =~ /xl\/comments\d\.xml/ }.size, @package.workbook.worksheets.size, "one or more sheet rels missing")
- assert_equal(p.select{ |part| part[:entry] =~ /xl\/pivotTables\/pivotTable\d\.xml/ }.size, @package.workbook.worksheets.first.pivot_tables.size, "one or more pivot tables missing")
- assert_equal(p.select{ |part| part[:entry] =~ /xl\/pivotTables\/_rels\/pivotTable\d\.xml.rels/ }.size, @package.workbook.worksheets.first.pivot_tables.size, "one or more pivot tables rels missing")
- assert_equal(p.select{ |part| part[:entry] =~ /xl\/pivotCache\/pivotCacheDefinition\d\.xml/ }.size, @package.workbook.worksheets.first.pivot_tables.size, "one or more pivot tables missing")
+ assert_equal(p.select { |part| part[:entry] =~ /_rels\/\.rels/ }.size, 1, "rels missing")
+ assert_equal(p.select { |part| part[:entry] =~ /docProps\/core\.xml/ }.size, 1, "core missing")
+ assert_equal(p.select { |part| part[:entry] =~ /docProps\/app\.xml/ }.size, 1, "app missing")
+ assert_equal(p.select { |part| part[:entry] =~ /xl\/_rels\/workbook\.xml\.rels/ }.size, 1, "workbook rels missing")
+ assert_equal(p.select { |part| part[:entry] =~ /xl\/workbook\.xml/ }.size, 1, "workbook missing")
+ assert_equal(p.select { |part| part[:entry] =~ /\[Content_Types\]\.xml/ }.size, 1, "content types missing")
+ assert_equal(p.select { |part| part[:entry] =~ /xl\/styles\.xml/ }.size, 1, "styles missin")
+ assert_equal(p.select { |part| part[:entry] =~ /xl\/drawings\/_rels\/drawing\d\.xml\.rels/ }.size, @package.workbook.drawings.size, "one or more drawing rels missing")
+ assert_equal(p.select { |part| part[:entry] =~ /xl\/drawings\/drawing\d\.xml/ }.size, @package.workbook.drawings.size, "one or more drawings missing")
+ assert_equal(p.select { |part| part[:entry] =~ /xl\/charts\/chart\d\.xml/ }.size, @package.workbook.charts.size, "one or more charts missing")
+ assert_equal(p.select { |part| part[:entry] =~ /xl\/worksheets\/sheet\d\.xml/ }.size, @package.workbook.worksheets.size, "one or more sheet missing")
+ assert_equal(p.select { |part| part[:entry] =~ /xl\/worksheets\/_rels\/sheet\d\.xml\.rels/ }.size, @package.workbook.worksheets.size, "one or more sheet rels missing")
+ assert_equal(p.select { |part| part[:entry] =~ /xl\/comments\d\.xml/ }.size, @package.workbook.worksheets.size, "one or more sheet rels missing")
+ assert_equal(p.select { |part| part[:entry] =~ /xl\/pivotTables\/pivotTable\d\.xml/ }.size, @package.workbook.worksheets.first.pivot_tables.size, "one or more pivot tables missing")
+ assert_equal(p.select { |part| part[:entry] =~ /xl\/pivotTables\/_rels\/pivotTable\d\.xml.rels/ }.size, @package.workbook.worksheets.first.pivot_tables.size, "one or more pivot tables rels missing")
+ assert_equal(p.select { |part| part[:entry] =~ /xl\/pivotCache\/pivotCacheDefinition\d\.xml/ }.size, @package.workbook.worksheets.first.pivot_tables.size, "one or more pivot tables missing")
#no mystery parts
assert_equal(25, p.size)
@@ -280,7 +280,7 @@ class TestPackage < Test::Unit::TestCase
@package.use_shared_strings = true
@package.to_stream #ensure all cell_serializer paths are hit
p = @package.send(:parts)
- assert_equal(p.select{ |part| part[:entry] =~/xl\/sharedStrings.xml/}.size, 1, "shared strings table missing")
+ assert_equal(p.select { |part| part[:entry] =~ /xl\/sharedStrings.xml/ }.size, 1, "shared strings table missing")
end
def test_workbook_is_a_workbook
@@ -305,8 +305,8 @@ class TestPackage < Test::Unit::TestCase
end
def test_name_to_indices
- assert(Axlsx::name_to_indices('A1') == [0,0])
- assert(Axlsx::name_to_indices('A100') == [0,99], 'needs to axcept rows that contain 0')
+ assert(Axlsx::name_to_indices('A1') == [0, 0])
+ assert(Axlsx::name_to_indices('A100') == [0, 99], 'needs to axcept rows that contain 0')
end
def test_to_stream
diff --git a/test/util/tc_simple_typed_list.rb b/test/util/tc_simple_typed_list.rb
index 88e75a1c..abcacf26 100644
--- a/test/util/tc_simple_typed_list.rb
+++ b/test/util/tc_simple_typed_list.rb
@@ -9,7 +9,7 @@ class TestSimpleTypedList < Test::Unit::TestCase
def test_type_is_a_class_or_array_of_class
assert_nothing_raised { Axlsx::SimpleTypedList.new Integer }
- assert_nothing_raised { Axlsx::SimpleTypedList.new [Integer,String] }
+ assert_nothing_raised { Axlsx::SimpleTypedList.new [Integer, String] }
assert_raise(ArgumentError) { Axlsx::SimpleTypedList.new }
assert_raise(ArgumentError) { Axlsx::SimpleTypedList.new "1" }
assert_raise(ArgumentError) { Axlsx::SimpleTypedList.new [Integer, "Class"] }
@@ -29,20 +29,20 @@ class TestSimpleTypedList < Test::Unit::TestCase
end
def test_concat_should_return_index
- assert( @list.size == 0 )
- assert( @list << 1 == 0 )
- assert( @list << 2 == 1 )
+ assert(@list.size == 0)
+ assert(@list << 1 == 0)
+ assert(@list << 2 == 1)
@list.delete_at 0
- assert( @list << 3 == 1 )
- assert( @list.index(2) == 0 )
+ assert(@list << 3 == 1)
+ assert(@list.index(2) == 0)
end
def test_push_should_return_index
- assert( @list.push(1) == 0 )
- assert( @list.push(2) == 1 )
+ assert(@list.push(1) == 0)
+ assert(@list.push(2) == 1)
@list.delete_at 0
- assert( @list.push(3) == 1 )
- assert( @list.index(2) == 0 )
+ assert(@list.push(3) == 1)
+ assert(@list.index(2) == 0)
end
def test_locking
@@ -72,6 +72,6 @@ class TestSimpleTypedList < Test::Unit::TestCase
def test_equality
@list.push 1
@list.push 2
- assert_equal(@list.to_ary, [1,2])
+ assert_equal(@list.to_ary, [1, 2])
end
end
diff --git a/test/util/tc_validators.rb b/test/util/tc_validators.rb
index 26fb2a89..c0e2e356 100644
--- a/test/util/tc_validators.rb
+++ b/test/util/tc_validators.rb
@@ -10,17 +10,17 @@ class TestValidators < Test::Unit::TestCase
#unsigned_int
assert_nothing_raised { Axlsx.validate_unsigned_int 1 }
assert_nothing_raised { Axlsx.validate_unsigned_int(+1) }
- assert_raise(ArgumentError) { Axlsx.validate_unsigned_int(-1)}
+ assert_raise(ArgumentError) { Axlsx.validate_unsigned_int(-1) }
assert_raise(ArgumentError) { Axlsx.validate_unsigned_int('1') }
#int
assert_nothing_raised { Axlsx.validate_int(1) }
assert_nothing_raised { Axlsx.validate_int(-1) }
- assert_raise(ArgumentError) { Axlsx.validate_int('a')}
+ assert_raise(ArgumentError) { Axlsx.validate_int('a') }
assert_raise(ArgumentError) { Axlsx.validate_int(Array) }
#boolean (as 0 or 1, :true, :false, true, false, or "true," "false")
- [0,1,:true, :false, true, false, "true", "false"].each do |v|
+ [0, 1, :true, :false, true, false, "true", "false"].each do |v|
assert_nothing_raised { Axlsx.validate_boolean 0 }
end
assert_raise(ArgumentError) { Axlsx.validate_boolean 2 }
diff --git a/test/workbook/tc_shared_strings_table.rb b/test/workbook/tc_shared_strings_table.rb
index 7e8fb38e..cb7557c6 100644
--- a/test/workbook/tc_shared_strings_table.rb
+++ b/test/workbook/tc_shared_strings_table.rb
@@ -2,7 +2,7 @@ require 'tc_helper.rb'
class TestSharedStringsTable < Test::Unit::TestCase
def setup
- @p = Axlsx::Package.new :use_shared_strings=>true
+ @p = Axlsx::Package.new :use_shared_strings => true
ws = @p.workbook.add_worksheet
ws.add_row ['a', 1, 'b']
@@ -39,11 +39,11 @@ class TestSharedStringsTable < Test::Unit::TestCase
puts error.message
errors << error
end
- assert_equal(errors.size, 0, "sharedStirngs.xml Invalid" + errors.map{ |e| e.message }.to_s)
+ assert_equal(errors.size, 0, "sharedStirngs.xml Invalid" + errors.map { |e| e.message }.to_s)
end
def test_remove_control_characters_in_xml_serialization
- nasties = "hello\x10\x00\x1C\x1Eworld"
+ nasties = "hello\x10\x00\x1C\x1Eworld"
@p.workbook.worksheets[0].add_row [nasties]
# test that the nasty string was added to the shared strings
diff --git a/test/workbook/tc_workbook.rb b/test/workbook/tc_workbook.rb
index b678a183..c5a72e48 100644
--- a/test/workbook/tc_workbook.rb
+++ b/test/workbook/tc_workbook.rb
@@ -28,26 +28,26 @@ class TestWorkbook < Test::Unit::TestCase
def test_no_autowidth
assert_equal(@wb.use_autowidth, true)
- assert_raise(ArgumentError) {@wb.use_autowidth = 0.1}
- assert_nothing_raised {@wb.use_autowidth = false}
+ assert_raise(ArgumentError) { @wb.use_autowidth = 0.1 }
+ assert_nothing_raised { @wb.use_autowidth = false }
assert_equal(@wb.use_autowidth, false)
end
def test_is_reversed
assert_equal(@wb.is_reversed, nil)
- assert_raise(ArgumentError) {@wb.is_reversed = 0.1}
- assert_nothing_raised {@wb.is_reversed = true }
+ assert_raise(ArgumentError) { @wb.is_reversed = 0.1 }
+ assert_nothing_raised { @wb.is_reversed = true }
assert_equal(@wb.use_autowidth, true)
end
def test_sheet_by_name_retrieval
- @wb.add_worksheet(:name=>'foo')
- @wb.add_worksheet(:name=>'bar')
+ @wb.add_worksheet(:name => 'foo')
+ @wb.add_worksheet(:name => 'bar')
assert_equal('foo', @wb.sheet_by_name('foo').name)
end
def test_worksheet_empty_name
- assert_raise(ArgumentError) {@wb.add_worksheet(:name=>'')}
+ assert_raise(ArgumentError) { @wb.add_worksheet(:name => '') }
end
def test_date1904
@@ -70,13 +70,13 @@ class TestWorkbook < Test::Unit::TestCase
def test_shared_strings
assert_equal(@wb.use_shared_strings, nil)
- assert_raise(ArgumentError) {@wb.use_shared_strings = 'bpb'}
- assert_nothing_raised {@wb.use_shared_strings = :true}
+ assert_raise(ArgumentError) { @wb.use_shared_strings = 'bpb' }
+ assert_nothing_raised { @wb.use_shared_strings = :true }
end
def test_add_worksheet
assert(@wb.worksheets.empty?, "worbook has no worksheets by default")
- ws = @wb.add_worksheet(:name=>"bob")
+ ws = @wb.add_worksheet(:name => "bob")
assert_equal(@wb.worksheets.size, 1, "add_worksheet adds a worksheet!")
assert_equal(@wb.worksheets.first, ws, "the worksheet returned is the worksheet added")
assert_equal(ws.name, "bob", "name option gets passed to worksheet")
@@ -118,10 +118,10 @@ class TestWorkbook < Test::Unit::TestCase
end
def test_range_requires_valid_sheet
- ws = @wb.add_worksheet :name=>'fish'
- ws.add_row [1,2,3]
- ws.add_row [4,5,6]
- assert_raise(ArgumentError, "no sheet name part") { @wb["A1:C2"]}
+ ws = @wb.add_worksheet :name => 'fish'
+ ws.add_row [1, 2, 3]
+ ws.add_row [4, 5, 6]
+ assert_raise(ArgumentError, "no sheet name part") { @wb["A1:C2"] }
assert_equal @wb['fish!A1:C2'].size, 6
end
diff --git a/test/workbook/tc_workbook_view.rb b/test/workbook/tc_workbook_view.rb
index 8280d8d5..6fb300a8 100644
--- a/test/workbook/tc_workbook_view.rb
+++ b/test/workbook/tc_workbook_view.rb
@@ -17,14 +17,14 @@ class TestWorkbookView < Test::Unit::TestCase
def test_boolean_attribute_validation
%w(minimized show_horizontal_scroll show_vertical_scroll show_sheet_tabs auto_filter_date_grouping).each do |attr|
assert_raise(ArgumentError, 'only booleanish allowed in boolean attributes') { @book_view.send("#{attr}=", "banana") }
- assert_nothing_raised { @book_view.send("#{attr}=", false )}
+ assert_nothing_raised { @book_view.send("#{attr}=", false) }
end
end
def test_integer_attribute_validation
%w(tab_ratio first_sheet active_tab x_window y_window window_width window_height).each do |attr|
assert_raise(ArgumentError, 'only integer allowed in integer attributes') { @book_view.send("#{attr}=", "b") }
- assert_nothing_raised { @book_view.send("#{attr}=", 7 )}
+ assert_nothing_raised { @book_view.send("#{attr}=", 7) }
end
end
diff --git a/test/workbook/worksheet/auto_filter/tc_auto_filter.rb b/test/workbook/worksheet/auto_filter/tc_auto_filter.rb
index 60089d22..eb561554 100644
--- a/test/workbook/worksheet/auto_filter/tc_auto_filter.rb
+++ b/test/workbook/worksheet/auto_filter/tc_auto_filter.rb
@@ -3,7 +3,7 @@ require 'tc_helper.rb'
class TestAutoFilter < Test::Unit::TestCase
def setup
ws = Axlsx::Package.new.workbook.add_worksheet
- 3.times { |index| ws.add_row [1*index,2*index,3*index] }
+ 3.times { |index| ws.add_row [1 * index, 2 * index, 3 * index] }
@auto_filter = ws.auto_filter
@auto_filter.range = 'A1:C3'
@auto_filter.add_column 0, :filters, :filter_items => [1]
diff --git a/test/workbook/worksheet/auto_filter/tc_filters.rb b/test/workbook/worksheet/auto_filter/tc_filters.rb
index d1c30446..8e853772 100644
--- a/test/workbook/worksheet/auto_filter/tc_filters.rb
+++ b/test/workbook/worksheet/auto_filter/tc_filters.rb
@@ -3,7 +3,7 @@ require 'tc_helper.rb'
class TestFilters < Test::Unit::TestCase
def setup
@filters = Axlsx::Filters.new(:filter_items => [1, 'a'],
- :date_group_items =>[{ :date_time_grouping => :year, :year => 2011, :month => 11, :day => 11, :hour => 0, :minute => 0, :second => 0 }],
+ :date_group_items => [{ :date_time_grouping => :year, :year => 2011, :month => 11, :day => 11, :hour => 0, :minute => 0, :second => 0 }],
:blank => true)
end
diff --git a/test/workbook/worksheet/tc_border_creator.rb b/test/workbook/worksheet/tc_border_creator.rb
index eb27fe98..c9f3df8f 100644
--- a/test/workbook/worksheet/tc_border_creator.rb
+++ b/test/workbook/worksheet/tc_border_creator.rb
@@ -8,7 +8,7 @@ class TestBorderCreator < Test::Unit::TestCase
end
def test_initialize
- @ws.add_row [1,2,3]
+ @ws.add_row [1, 2, 3]
bc = Axlsx::BorderCreator.new(worksheet: @ws, cells: @ws["A1:B1"])
assert_equal bc.instance_variable_get(:@edges), Axlsx::Border::EDGES
@@ -22,7 +22,7 @@ class TestBorderCreator < Test::Unit::TestCase
end
def test_initialize_edges
- @ws.add_row [1,2,3]
+ @ws.add_row [1, 2, 3]
bc = Axlsx::BorderCreator.new(worksheet: @ws, cells: @ws["A1:B1"], edges: nil)
assert_equal bc.instance_variable_get(:@edges), Axlsx::Border::EDGES
@@ -48,7 +48,7 @@ class TestBorderCreator < Test::Unit::TestCase
def test_draw
5.times do
- @ws.add_row [1,2,3,4,5]
+ @ws.add_row [1, 2, 3, 4, 5]
end
bc = Axlsx::BorderCreator.new(worksheet: @ws, cells: @ws["A1:C3"], edges: ["top", :left], style: :thick, color: "ffffff")
diff --git a/test/workbook/worksheet/tc_break.rb b/test/workbook/worksheet/tc_break.rb
index 884d9e01..2c67fed7 100644
--- a/test/workbook/worksheet/tc_break.rb
+++ b/test/workbook/worksheet/tc_break.rb
@@ -8,7 +8,7 @@ class TestBreak < Test::Unit::TestCase
def test_id
assert_equal(1, @break.id)
assert_raises ArgumentError do
- Axlsx::Break.new(:hoge, {:id => -1})
+ Axlsx::Break.new(:hoge, { :id => -1 })
end
end
diff --git a/test/workbook/worksheet/tc_cell.rb b/test/workbook/worksheet/tc_cell.rb
index af3699ad..a4aab11c 100644
--- a/test/workbook/worksheet/tc_cell.rb
+++ b/test/workbook/worksheet/tc_cell.rb
@@ -4,10 +4,10 @@ class TestCell < Test::Unit::TestCase
def setup
p = Axlsx::Package.new
p.use_shared_strings = true
- @ws = p.workbook.add_worksheet :name=>"hmmm"
- p.workbook.styles.add_style :sz=>20
+ @ws = p.workbook.add_worksheet :name => "hmmm"
+ p.workbook.styles.add_style :sz => 20
@row = @ws.add_row
- @c = @row.add_cell 1, :type=>:float, :style=>1, :escape_formulas=>true
+ @c = @row.add_cell 1, :type => :float, :style => 1, :escape_formulas => true
data = (0..26).map { |index| index }
@ws.add_row data
@cAA = @ws["AA2"]
@@ -47,8 +47,8 @@ class TestCell < Test::Unit::TestCase
end
def test_r_abs
- assert_equal(@c.r_abs,"$A$1", "calculate absolute cell reference")
- assert_equal(@cAA.r_abs,"$AA$2", "needs to accept multi-digit columns")
+ assert_equal(@c.r_abs, "$A$1", "calculate absolute cell reference")
+ assert_equal(@cAA.r_abs, "$AA$2", "needs to accept multi-digit columns")
end
def test_name
@@ -58,7 +58,7 @@ class TestCell < Test::Unit::TestCase
end
def test_autowidth
- style = @c.row.worksheet.workbook.styles.add_style({:alignment => {:horizontal => :center, :vertical => :center, :wrap_text => true}} )
+ style = @c.row.worksheet.workbook.styles.add_style({ :alignment => { :horizontal => :center, :vertical => :center, :wrap_text => true } })
@c.style = style
assert_in_delta(6.6, @c.autowidth, 0.01)
end
@@ -90,8 +90,8 @@ class TestCell < Test::Unit::TestCase
end
def test_style
- assert_raise(ArgumentError, "must reject invalid style indexes") { @[email protected] }
- assert_nothing_raised("must allow valid style index changes") {@c.style=1}
+ assert_raise(ArgumentError, "must reject invalid style indexes") { @c.style = @c.row.worksheet.workbook.styles.cellXfs.size }
+ assert_nothing_raised("must allow valid style index changes") { @c.style = 1 }
assert_equal(@c.style, 1)
end
@@ -99,7 +99,7 @@ class TestCell < Test::Unit::TestCase
assert_raise(ArgumentError, "type must be :string, :integer, :float, :date, :time, :boolean") { @c.type = :array }
assert_nothing_raised("type can be changed") { @c.type = :string }
assert_equal(@c.value, "1.0", "changing type casts the value")
- assert_equal(:float, @row.add_cell(1.0/10**7).type, 'properly identify exponential floats as float type')
+ assert_equal(:float, @row.add_cell(1.0 / 10**7).type, 'properly identify exponential floats as float type')
assert_equal(@row.add_cell(Time.now).type, :time, 'time should be time')
assert_equal(@row.add_cell(Date.today).type, :date, 'date should be date')
assert_equal(@row.add_cell(true).type, :boolean, 'boolean should be boolean')
@@ -133,7 +133,7 @@ class TestCell < Test::Unit::TestCase
assert_equal(@c.send(:cell_type_from_value, -1), :integer)
assert_equal(@c.send(:cell_type_from_value, true), :boolean)
assert_equal(@c.send(:cell_type_from_value, false), :boolean)
- assert_equal(@c.send(:cell_type_from_value, 1.0/10**6), :float)
+ assert_equal(@c.send(:cell_type_from_value, 1.0 / 10**6), :float)
assert_equal(@c.send(:cell_type_from_value, Axlsx::RichText.new), :richtext)
assert_equal(:iso_8601, @c.send(:cell_type_from_value, '2008-08-30T01:45:36.123+09:00'))
end
@@ -255,7 +255,7 @@ class TestCell < Test::Unit::TestCase
assert_raise(ArgumentError) { @c.u = -1.1 }
assert_nothing_raised { @c.u = :single }
assert_equal(@c.u, :single)
- doc = Nokogiri::XML(@c.to_xml_string(1,1))
+ doc = Nokogiri::XML(@c.to_xml_string(1, 1))
assert(doc.xpath('//u[@val="single"]'))
end
@@ -339,13 +339,13 @@ class TestCell < Test::Unit::TestCase
end
def test_to_xml_string
- c_xml = Nokogiri::XML(@c.to_xml_string(1,1))
+ c_xml = Nokogiri::XML(@c.to_xml_string(1, 1))
assert_equal(c_xml.xpath("/c[@s=1]").size, 1)
end
def test_to_xml_string_nil
@c.value = nil
- c_xml = Nokogiri::XML(@c.to_xml_string(1,1))
+ c_xml = Nokogiri::XML(@c.to_xml_string(1, 1))
assert_equal(c_xml.xpath("/c[@s=1]").size, 1)
end
@@ -357,7 +357,7 @@ class TestCell < Test::Unit::TestCase
@c.value = "a"
@c.font_name = 'arial'
@c.color = 'FF0000'
- c_xml = Nokogiri::XML(@c.to_xml_string(1,1))
+ c_xml = Nokogiri::XML(@c.to_xml_string(1, 1))
assert(c_xml.xpath("//b").any?)
end
diff --git a/test/workbook/worksheet/tc_col.rb b/test/workbook/worksheet/tc_col.rb
index 2f31d7a2..80b228d0 100644
--- a/test/workbook/worksheet/tc_col.rb
+++ b/test/workbook/worksheet/tc_col.rb
@@ -6,10 +6,10 @@ class TestCol < Test::Unit::TestCase
end
def test_initialize
- options = { :width => 12, :collapsed => true, :hidden => true, :outline_level => 1, :phonetic => true, :style => 1}
+ options = { :width => 12, :collapsed => true, :hidden => true, :outline_level => 1, :phonetic => true, :style => 1 }
col = Axlsx::Col.new 0, 0, options
- options.each{ |key, value| assert_equal(col.send(key.to_sym), value) }
+ options.each { |key, value| assert_equal(col.send(key.to_sym), value) }
end
def test_min_max_required
diff --git a/test/workbook/worksheet/tc_color_scale.rb b/test/workbook/worksheet/tc_color_scale.rb
index 7f9e5def..073cd71f 100644
--- a/test/workbook/worksheet/tc_color_scale.rb
+++ b/test/workbook/worksheet/tc_color_scale.rb
@@ -21,7 +21,7 @@ class TestColorScale < Test::Unit::TestCase
first = Axlsx::ColorScale.default_cfvos.first
second = Axlsx::ColorScale.default_cfvos.last
assert_equal 'FFFF7128', first[:color]
- assert_equal :min,first[:type]
+ assert_equal :min, first[:type]
assert_equal 0, first[:val]
assert_equal 'FFFFEF9C', second[:color]
@@ -30,7 +30,7 @@ class TestColorScale < Test::Unit::TestCase
end
def test_partial_default_cfvo_override
- first_def = {:type => :percent, :val => "10.0", :color => 'FF00FF00'}
+ first_def = { :type => :percent, :val => "10.0", :color => 'FF00FF00' }
color_scale = Axlsx::ColorScale.new(first_def)
assert_equal color_scale.value_objects.first.val, first_def[:val]
assert_equal color_scale.value_objects.first.type, first_def[:type]
@@ -39,15 +39,15 @@ class TestColorScale < Test::Unit::TestCase
def test_add
@color_scale.add :type => :max, :val => 5, :color => "FFDEDEDE"
- assert_equal(@color_scale.value_objects.size,3)
- assert_equal(@color_scale.colors.size,3)
+ assert_equal(@color_scale.value_objects.size, 3)
+ assert_equal(@color_scale.colors.size, 3)
end
def test_delete_at
@color_scale.add :type => :max, :val => 5, :color => "FFDEDEDE"
- assert_nothing_raised {@color_scale.delete_at 2}
- assert_equal(@color_scale.value_objects.size,2)
- assert_equal(@color_scale.colors.size,2)
+ assert_nothing_raised { @color_scale.delete_at 2 }
+ assert_equal(@color_scale.value_objects.size, 2)
+ assert_equal(@color_scale.colors.size, 2)
end
def test_to_xml_string
diff --git a/test/workbook/worksheet/tc_comment.rb b/test/workbook/worksheet/tc_comment.rb
index 44a637e6..cbd93f01 100644
--- a/test/workbook/worksheet/tc_comment.rb
+++ b/test/workbook/worksheet/tc_comment.rb
@@ -47,7 +47,7 @@ class TestComment < Test::Unit::TestCase
assert_equal(pos[0], @c1.vml_shape.left_column)
assert(@c1.vml_shape.top_row == pos[1])
assert_equal(pos[0] + 2, @c1.vml_shape.right_column)
- assert(@c1.vml_shape.bottom_row == pos[1]+4)
+ assert(@c1.vml_shape.bottom_row == pos[1] + 4)
end
def test_to_xml_string
diff --git a/test/workbook/worksheet/tc_comments.rb b/test/workbook/worksheet/tc_comments.rb
index 6b07b465..276dd3b0 100644
--- a/test/workbook/worksheet/tc_comments.rb
+++ b/test/workbook/worksheet/tc_comments.rb
@@ -19,7 +19,7 @@ class TestComments < Test::Unit::TestCase
assert_raise(ArgumentError) { @ws.comments.add_comment() }
assert_raise(ArgumentError) { @ws.comments.add_comment(:text => 'Yes We Can', :ref => 'A1') }
assert_raise(ArgumentError) { @ws.comments.add_comment(:author => 'bob', :ref => 'A1') }
- assert_raise(ArgumentError) { @ws.comments.add_comment(:author => 'bob', :text => 'Yes We Can')}
+ assert_raise(ArgumentError) { @ws.comments.add_comment(:author => 'bob', :text => 'Yes We Can') }
assert_nothing_raised { @ws.comments.add_comment(:author => 'bob', :text => 'Yes We Can', :ref => 'A1') }
assert_equal(@ws.comments.size, 3)
end
@@ -33,7 +33,7 @@ class TestComments < Test::Unit::TestCase
end
def test_pn
- assert_equal(@ws.comments.pn, Axlsx::COMMENT_PN % (@ws.index+1).to_s)
+ assert_equal(@ws.comments.pn, Axlsx::COMMENT_PN % (@ws.index + 1).to_s)
end
def test_index
diff --git a/test/workbook/worksheet/tc_conditional_formatting.rb b/test/workbook/worksheet/tc_conditional_formatting.rb
index cc885255..dcbb3ca6 100644
--- a/test/workbook/worksheet/tc_conditional_formatting.rb
+++ b/test/workbook/worksheet/tc_conditional_formatting.rb
@@ -3,14 +3,14 @@ require 'tc_helper.rb'
class TestConditionalFormatting < Test::Unit::TestCase
def setup
p = Axlsx::Package.new
- @ws = p.workbook.add_worksheet :name=>"hmmm"
- @cfs = @ws.add_conditional_formatting( "A1:A1", [{ :type => :cellIs, :dxfId => 0, :priority => 1, :operator => :greaterThan, :formula => "0.5" }])
+ @ws = p.workbook.add_worksheet :name => "hmmm"
+ @cfs = @ws.add_conditional_formatting("A1:A1", [{ :type => :cellIs, :dxfId => 0, :priority => 1, :operator => :greaterThan, :formula => "0.5" }])
@cf = @cfs.first
@cfr = @cf.rules.first
end
def test_initialize_with_options
- optioned = Axlsx::ConditionalFormatting.new( :sqref => "AA1:AB100", :rules => [1, 2] )
+ optioned = Axlsx::ConditionalFormatting.new(:sqref => "AA1:AB100", :rules => [1, 2])
assert_equal("AA1:AB100", optioned.sqref)
assert_equal([1, 2], optioned.rules)
end
@@ -25,17 +25,17 @@ class TestConditionalFormatting < Test::Unit::TestCase
data_bar = Axlsx::DataBar.new :color => "FFFF0000"
icon_set = Axlsx::IconSet.new :iconSet => "5Rating"
- cfr = Axlsx::ConditionalFormattingRule.new( { :type => :containsText, :text => "TRUE",
+ cfr = Axlsx::ConditionalFormattingRule.new({ :type => :containsText, :text => "TRUE",
:dxfId => 0, :priority => 1,
:formula => 'NOT(ISERROR(SEARCH("FALSE",AB1)))',
:color_scale => color_scale,
:data_bar => data_bar,
- :icon_set => icon_set})
+ :icon_set => icon_set })
assert(cfr.data_bar.is_a?(Axlsx::DataBar))
assert(cfr.icon_set.is_a?(Axlsx::IconSet))
assert(cfr.color_scale.is_a?(Axlsx::ColorScale))
- cfs = @ws.add_conditional_formatting( "B2:B2", [cfr])
+ cfs = @ws.add_conditional_formatting("B2:B2", [cfr])
doc = Nokogiri::XML.parse(cfs.last.to_xml_string)
assert_equal(1, doc.xpath(".//conditionalFormatting[@sqref='B2:B2']//cfRule[@type='containsText'][@dxfId=0][@priority=1]").size)
assert doc.xpath(".//conditionalFormatting//cfRule[@type='containsText'][@dxfId=0][@priority=1]//formula='NOT(ISERROR(SEARCH(\"FALSE\",AB1)))'")
@@ -68,12 +68,12 @@ class TestConditionalFormatting < Test::Unit::TestCase
data_bar = Axlsx::DataBar.new :color => "FFFF0000"
icon_set = Axlsx::IconSet.new :iconSet => "5Rating"
- cfs = @ws.add_conditional_formatting( "B2:B2", [{ :type => :containsText, :text => "TRUE",
+ cfs = @ws.add_conditional_formatting("B2:B2", [{ :type => :containsText, :text => "TRUE",
:dxfId => 0, :priority => 1,
:formula => 'NOT(ISERROR(SEARCH("FALSE",AB1)))',
:color_scale => color_scale,
:data_bar => data_bar,
- :icon_set => icon_set}])
+ :icon_set => icon_set }])
doc = Nokogiri::XML.parse(cfs.last.to_xml_string)
assert_equal(1, doc.xpath(".//conditionalFormatting[@sqref='B2:B2']//cfRule[@type='containsText'][@dxfId=0][@priority=1]").size)
assert doc.xpath(".//conditionalFormatting//cfRule[@type='containsText'][@dxfId=0][@priority=1]//formula='NOT(ISERROR(SEARCH(\"FALSE\",AB1)))'")
@@ -102,11 +102,11 @@ class TestConditionalFormatting < Test::Unit::TestCase
end
def test_many_options
- cf = Axlsx::ConditionalFormatting.new( :sqref => "B3:B4" )
- cf.add_rule({:type => :cellIs, :aboveAverage => false, :bottom => false, :dxfId => 0,
+ cf = Axlsx::ConditionalFormatting.new(:sqref => "B3:B4")
+ cf.add_rule({ :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"})
+ :formula => "0.0" })
doc = Nokogiri::XML.parse(cf.to_xml_string)
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")
@@ -126,7 +126,7 @@ class TestConditionalFormatting < Test::Unit::TestCase
end
def test_multiple_formulas
- @ws.add_conditional_formatting "B3:B3", { :type => :cellIs, :dxfId => 0, :priority => 1, :operator => :between, :formula => ["1 <> 2","5"] }
+ @ws.add_conditional_formatting "B3:B3", { :type => :cellIs, :dxfId => 0, :priority => 1, :operator => :between, :formula => ["1 <> 2", "5"] }
doc = Nokogiri::XML.parse(@ws.to_xml_string)
assert doc.xpath("//xmlns:worksheet/xmlns:conditionalFormatting//xmlns:cfRule[@type='cellIs'][@dxfId=0][@priority=1][@operator='between']//xmlns:formula='1 <> 2'")
assert doc.xpath("//xmlns:worksheet/xmlns:conditionalFormatting//xmlns:cfRule[@type='cellIs'][@dxfId=0][@priority=1][@operator='between']//xmlns:formula='5'")
diff --git a/test/workbook/worksheet/tc_data_bar.rb b/test/workbook/worksheet/tc_data_bar.rb
index 65995dd2..aa39c48b 100644
--- a/test/workbook/worksheet/tc_data_bar.rb
+++ b/test/workbook/worksheet/tc_data_bar.rb
@@ -12,26 +12,26 @@ class TestDataBar < Test::Unit::TestCase
end
def test_override_default_cfvos
- data_bar = Axlsx::DataBar.new({:color => 'FF00FF00'}, {:type => :min, :val => "20"})
+ data_bar = Axlsx::DataBar.new({ :color => 'FF00FF00' }, { :type => :min, :val => "20" })
assert_equal("20", data_bar.value_objects.first.val)
assert_equal("0", data_bar.value_objects.last.val)
end
def test_minLength
assert_raise(ArgumentError) { @data_bar.minLength = :invalid_type }
- assert_nothing_raised { @data_bar.minLength = 0}
+ assert_nothing_raised { @data_bar.minLength = 0 }
assert_equal(@data_bar.minLength, 0)
end
def test_maxLength
assert_raise(ArgumentError) { @data_bar.maxLength = :invalid_type }
- assert_nothing_raised { @data_bar.maxLength = 0}
+ assert_nothing_raised { @data_bar.maxLength = 0 }
assert_equal(@data_bar.maxLength, 0)
end
def test_showValue
assert_raise(ArgumentError) { @data_bar.showValue = :invalid_type }
- assert_nothing_raised { @data_bar.showValue = false}
+ assert_nothing_raised { @data_bar.showValue = false }
assert_equal(@data_bar.showValue, false)
end
diff --git a/test/workbook/worksheet/tc_data_validation.rb b/test/workbook/worksheet/tc_data_validation.rb
index 0d9a2eb0..59fd34f6 100644
--- a/test/workbook/worksheet/tc_data_validation.rb
+++ b/test/workbook/worksheet/tc_data_validation.rb
@@ -12,7 +12,7 @@ class TestDataValidation < Test::Unit::TestCase
@error_style_option = { :errorStyle => :warning }
@string_options = { :formula1 => 'foo', :formula2 => 'foo', :error => 'foo', :errorTitle => 'foo', :prompt => 'foo', :promptTitle => 'foo', :sqref => 'foo' }
- @symbol_options = { :errorStyle => :warning, :operator => :lessThan, :type => :whole}
+ @symbol_options = { :errorStyle => :warning, :operator => :lessThan, :type => :whole }
@options = @boolean_options.merge(@nil_options).merge(@type_option).merge(@error_style_option)
@@ -163,11 +163,11 @@ class TestDataValidation < Test::Unit::TestCase
def test_whole_decimal_data_time_textLength_to_xml
p = Axlsx::Package.new
- @ws = p.workbook.add_worksheet :name=>"data_validation"
+ @ws = p.workbook.add_worksheet :name => "data_validation"
@ws.add_data_validation("A1", { :type => :whole, :operator => :between, :formula1 => '5', :formula2 => '10',
:showErrorMessage => true, :errorTitle => 'Wrong input', :error => 'Only values between 5 and 10',
:errorStyle => :information, :showInputMessage => true, :promptTitle => 'Be carful!',
- :prompt => 'Only values between 5 and 10'})
+ :prompt => 'Only values between 5 and 10' })
doc = Nokogiri::XML.parse(@ws.to_xml_string)
@@ -192,11 +192,11 @@ class TestDataValidation < Test::Unit::TestCase
def test_list_to_xml
p = Axlsx::Package.new
- @ws = p.workbook.add_worksheet :name=>"data_validation"
+ @ws = p.workbook.add_worksheet :name => "data_validation"
@ws.add_data_validation("A1", { :type => :list, :formula1 => 'A1:A5',
:showErrorMessage => true, :errorTitle => 'Wrong input', :error => 'Only values from list',
:errorStyle => :stop, :showInputMessage => true, :promptTitle => 'Be carful!',
- :prompt => 'Only values from list', :hideDropDown => true})
+ :prompt => 'Only values from list', :hideDropDown => true })
doc = Nokogiri::XML.parse(@ws.to_xml_string)
@@ -216,11 +216,11 @@ class TestDataValidation < Test::Unit::TestCase
def test_custom_to_xml
p = Axlsx::Package.new
- @ws = p.workbook.add_worksheet :name=>"data_validation"
+ @ws = p.workbook.add_worksheet :name => "data_validation"
@ws.add_data_validation("A1", { :type => :custom, :formula1 => '=5/2',
:showErrorMessage => true, :errorTitle => 'Wrong input', :error => 'Only values corresponding formula',
:errorStyle => :stop, :showInputMessage => true, :promptTitle => 'Be carful!',
- :prompt => 'Only values corresponding formula'})
+ :prompt => 'Only values corresponding formula' })
doc = Nokogiri::XML.parse(@ws.to_xml_string)
@@ -239,15 +239,15 @@ class TestDataValidation < Test::Unit::TestCase
def test_multiple_datavalidations_to_xml
p = Axlsx::Package.new
- @ws = p.workbook.add_worksheet :name=>"data_validation"
+ @ws = p.workbook.add_worksheet :name => "data_validation"
@ws.add_data_validation("A1", { :type => :whole, :operator => :between, :formula1 => '5', :formula2 => '10',
:showErrorMessage => true, :errorTitle => 'Wrong input', :error => 'Only values between 5 and 10',
:errorStyle => :information, :showInputMessage => true, :promptTitle => 'Be carful!',
- :prompt => 'Only values between 5 and 10'})
+ :prompt => 'Only values between 5 and 10' })
@ws.add_data_validation("B1", { :type => :list, :formula1 => 'A1:A5',
:showErrorMessage => true, :errorTitle => 'Wrong input', :error => 'Only values from list',
:errorStyle => :stop, :showInputMessage => true, :promptTitle => 'Be carful!',
- :prompt => 'Only values from list', :hideDropDown => true})
+ :prompt => 'Only values from list', :hideDropDown => true })
doc = Nokogiri::XML.parse(@ws.to_xml_string)
diff --git a/test/workbook/worksheet/tc_date_time_converter.rb b/test/workbook/worksheet/tc_date_time_converter.rb
index 393a9d1a..cb139d45 100644
--- a/test/workbook/worksheet/tc_date_time_converter.rb
+++ b/test/workbook/worksheet/tc_date_time_converter.rb
@@ -114,8 +114,8 @@ class TestDateTimeConverter < Test::Unit::TestCase
local = Time.parse "2012-01-01 09:00:00 +0900"
assert_equal local, utc
- assert_equal Axlsx::DateTimeConverter::time_to_serial(local) - local.utc_offset.to_f/86400, Axlsx::DateTimeConverter::time_to_serial(utc)
+ assert_equal Axlsx::DateTimeConverter::time_to_serial(local) - local.utc_offset.to_f / 86400, Axlsx::DateTimeConverter::time_to_serial(utc)
Axlsx::Workbook.date1904 = true
- assert_equal Axlsx::DateTimeConverter::time_to_serial(local) - local.utc_offset.to_f/86400, Axlsx::DateTimeConverter::time_to_serial(utc)
+ assert_equal Axlsx::DateTimeConverter::time_to_serial(local) - local.utc_offset.to_f / 86400, Axlsx::DateTimeConverter::time_to_serial(utc)
end
end
diff --git a/test/workbook/worksheet/tc_icon_set.rb b/test/workbook/worksheet/tc_icon_set.rb
index 483de228..3a4079bf 100644
--- a/test/workbook/worksheet/tc_icon_set.rb
+++ b/test/workbook/worksheet/tc_icon_set.rb
@@ -14,25 +14,25 @@ class TestIconSet < Test::Unit::TestCase
def test_icon_set
assert_raise(ArgumentError) { @icon_set.iconSet = "invalid_value" }
- assert_nothing_raised { @icon_set.iconSet = "5Rating"}
+ assert_nothing_raised { @icon_set.iconSet = "5Rating" }
assert_equal(@icon_set.iconSet, "5Rating")
end
def test_percent
assert_raise(ArgumentError) { @icon_set.percent = :invalid_type }
- assert_nothing_raised { @icon_set.percent = false}
+ assert_nothing_raised { @icon_set.percent = false }
assert_equal(@icon_set.percent, false)
end
def test_showValue
assert_raise(ArgumentError) { @icon_set.showValue = :invalid_type }
- assert_nothing_raised { @icon_set.showValue = false}
+ assert_nothing_raised { @icon_set.showValue = false }
assert_equal(@icon_set.showValue, false)
end
def test_reverse
assert_raise(ArgumentError) { @icon_set.reverse = :invalid_type }
- assert_nothing_raised { @icon_set.reverse = false}
+ assert_nothing_raised { @icon_set.reverse = false }
assert_equal(@icon_set.reverse, false)
end
diff --git a/test/workbook/worksheet/tc_page_margins.rb b/test/workbook/worksheet/tc_page_margins.rb
index c1f2a626..ba532e7f 100644
--- a/test/workbook/worksheet/tc_page_margins.rb
+++ b/test/workbook/worksheet/tc_page_margins.rb
@@ -3,7 +3,7 @@ require 'tc_helper.rb'
class TestPageMargins < Test::Unit::TestCase
def setup
p = Axlsx::Package.new
- ws = p.workbook.add_worksheet :name=>"hmmm"
+ ws = p.workbook.add_worksheet :name => "hmmm"
@pm = ws.page_margins
end
diff --git a/test/workbook/worksheet/tc_page_setup.rb b/test/workbook/worksheet/tc_page_setup.rb
index c7cec18b..b7a36600 100644
--- a/test/workbook/worksheet/tc_page_setup.rb
+++ b/test/workbook/worksheet/tc_page_setup.rb
@@ -132,9 +132,9 @@ class TestPageSetup < Test::Unit::TestCase
fits = @ps.fit_to(:width => 1)
assert_equal([1, 999], fits)
fits = @ps.fit_to :height => 1
- assert_equal(fits, [999,1])
+ assert_equal(fits, [999, 1])
fits = @ps.fit_to :height => 7, :width => 2
assert_equal(fits, [2, 7])
- assert_raise(ArgumentError) { puts @ps.fit_to(:width => true)}
+ assert_raise(ArgumentError) { puts @ps.fit_to(:width => true) }
end
end
diff --git a/test/workbook/worksheet/tc_pivot_table.rb b/test/workbook/worksheet/tc_pivot_table.rb
index 85aa14cd..83f8fce6 100644
--- a/test/workbook/worksheet/tc_pivot_table.rb
+++ b/test/workbook/worksheet/tc_pivot_table.rb
@@ -16,7 +16,7 @@ class TestPivotTable < Test::Unit::TestCase
p = Axlsx::Package.new
@ws = p.workbook.add_worksheet
- @ws << ["Year","Month","Region", "Type", "Sales"]
+ @ws << ["Year", "Month", "Region", "Type", "Sales"]
@ws << [2012, "Nov", "East", "Soda", "12345"]
end
@@ -54,21 +54,21 @@ class TestPivotTable < Test::Unit::TestCase
end
assert_equal(['Year', 'Month'], pivot_table.rows)
assert_equal(['Type'], pivot_table.columns)
- assert_equal([{:ref=>"Sales"}], pivot_table.data)
+ assert_equal([{ :ref => "Sales" }], pivot_table.data)
assert_equal(['Region'], pivot_table.pages)
shared_test_pivot_table_xml_validity(pivot_table)
end
def test_add_pivot_table_with_options_on_data_field
pivot_table = @ws.add_pivot_table('G5:G6', 'A1:D5') do |pt|
- pt.data = [{:ref=>"Sales", :subtotal => 'average'}]
+ pt.data = [{ :ref => "Sales", :subtotal => 'average' }]
end
- assert_equal([{:ref=>"Sales", :subtotal => 'average'}], pivot_table.data)
+ assert_equal([{ :ref => "Sales", :subtotal => 'average' }], pivot_table.data)
end
def test_add_pivot_table_with_style_info
- style_info_data = { :name=>"PivotStyleMedium9", :showRowHeaders=>"1", :showLastColumn=>"0"}
- pivot_table = @ws.add_pivot_table('G5:G6', 'A1:E5', {:style_info=>style_info_data}) do |pt|
+ style_info_data = { :name => "PivotStyleMedium9", :showRowHeaders => "1", :showLastColumn => "0" }
+ pivot_table = @ws.add_pivot_table('G5:G6', 'A1:E5', { :style_info => style_info_data }) do |pt|
pt.rows = ['Year', 'Month']
pt.columns = ['Type']
pt.data = ['Sales']
@@ -79,33 +79,33 @@ class TestPivotTable < Test::Unit::TestCase
end
def test_add_pivot_table_with_row_without_subtotals
- pivot_table = @ws.add_pivot_table('G5:G6', 'A1:D5', {:no_subtotals_on_headers=>['Year']}) do |pt|
+ pivot_table = @ws.add_pivot_table('G5:G6', 'A1:D5', { :no_subtotals_on_headers => ['Year'] }) do |pt|
pt.data = ['Sales']
- pt.rows = ['Year','Month']
+ pt.rows = ['Year', 'Month']
end
assert_equal(['Year'], pivot_table.no_subtotals_on_headers)
end
def test_add_pivot_table_with_months_sorted
- pivot_table = @ws.add_pivot_table('G5:G6', 'A1:E5', {:sort_on_headers=>['Month']}) do |pt|
+ pivot_table = @ws.add_pivot_table('G5:G6', 'A1:E5', { :sort_on_headers => ['Month'] }) do |pt|
pt.data = ['Sales']
- pt.rows = ['Year','Month']
+ pt.rows = ['Year', 'Month']
end
- assert_equal({'Month' => :ascending}, pivot_table.sort_on_headers)
+ assert_equal({ 'Month' => :ascending }, pivot_table.sort_on_headers)
- pivot_table.sort_on_headers = {'Month' => :descending}
- assert_equal({'Month' => :descending}, pivot_table.sort_on_headers)
+ pivot_table.sort_on_headers = { 'Month' => :descending }
+ assert_equal({ 'Month' => :descending }, pivot_table.sort_on_headers)
shared_test_pivot_table_xml_validity(pivot_table)
end
def test_header_indices
pivot_table = @ws.add_pivot_table('G5:G6', 'A1:E5')
- assert_equal(0, pivot_table.header_index_of('Year' ))
- assert_equal(1, pivot_table.header_index_of('Month' ))
- assert_equal(2, pivot_table.header_index_of('Region' ))
- assert_equal(3, pivot_table.header_index_of('Type' ))
- assert_equal(4, pivot_table.header_index_of('Sales' ))
+ assert_equal(0, pivot_table.header_index_of('Year'))
+ assert_equal(1, pivot_table.header_index_of('Month'))
+ assert_equal(2, pivot_table.header_index_of('Region'))
+ 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
@@ -129,7 +129,7 @@ class TestPivotTable < Test::Unit::TestCase
end
def test_to_xml_string
- pivot_table = @ws.add_pivot_table('G5:G6', 'A1:E5', {:no_subtotals_on_headers=>['Year']}) do |pt|
+ pivot_table = @ws.add_pivot_table('G5:G6', 'A1:E5', { :no_subtotals_on_headers => ['Year'] }) do |pt|
pt.rows = ['Year', 'Month']
pt.columns = ['Type']
pt.data = ['Sales']
@@ -140,14 +140,14 @@ class TestPivotTable < Test::Unit::TestCase
def test_to_xml_string_with_options_on_data_field
pivot_table = @ws.add_pivot_table('G5:G6', 'A1:E5') do |pt|
- pt.data = [{:ref=>"Sales", :subtotal => 'average'}]
+ pt.data = [{ :ref => "Sales", :subtotal => 'average' }]
end
shared_test_pivot_table_xml_validity(pivot_table)
end
def test_add_pivot_table_with_format_options_on_data_field
pivot_table = @ws.add_pivot_table('G5:G6', 'A1:E5') do |pt|
- pt.data = [{:ref=>"Sales", :subtotal => 'sum', num_fmt: 4}]
+ pt.data = [{ :ref => "Sales", :subtotal => 'sum', num_fmt: 4 }]
end
doc = Nokogiri::XML(pivot_table.to_xml_string)
assert_equal('4', doc.at_css('dataFields dataField')['numFmtId'], 'adding format options to pivot_table')
@@ -159,9 +159,9 @@ class TestPivotTable < Test::Unit::TestCase
pivot_table = @ws.add_pivot_table('G5:G6', 'A1:E5') do |pt|
pt.rows = ["Date", "Name"]
pt.data = [
- {ref: "Gross amount", num_fmt: 2},
- {ref: "Net amount", num_fmt: 2},
- {ref: "Margin", num_fmt: 2}
+ { ref: "Gross amount", num_fmt: 2 },
+ { ref: "Net amount", num_fmt: 2 },
+ { ref: "Margin", num_fmt: 2 }
]
end
@@ -177,8 +177,8 @@ class TestPivotTable < Test::Unit::TestCase
assert_equal('-2', doc.at_css('colFields field')['x'])
assert_equal('3', doc.at_css('colItems')['count'])
- assert_equal( 3, doc.at_css('colItems').children.size)
- assert_nil( doc.at_css('colItems i')['x'])
+ assert_equal(3, doc.at_css('colItems').children.size)
+ assert_nil(doc.at_css('colItems i')['x'])
assert_equal('1', doc.at_css('colItems i[i=1] x')['v'])
assert_equal('2', doc.at_css('colItems i[i=2] x')['v'])
end
@@ -189,7 +189,7 @@ class TestPivotTable < Test::Unit::TestCase
pivot_table = @ws.add_pivot_table('G5:G6', 'A1:E5') do |pt|
pt.rows = ["Date", "Name"]
pt.data = [
- {ref: "Gross amount", num_fmt: 2}
+ { ref: "Gross amount", num_fmt: 2 }
]
end
diff --git a/test/workbook/worksheet/tc_pivot_table_cache_definition.rb b/test/workbook/worksheet/tc_pivot_table_cache_definition.rb
index 37d7e485..2127c4b3 100644
--- a/test/workbook/worksheet/tc_pivot_table_cache_definition.rb
+++ b/test/workbook/worksheet/tc_pivot_table_cache_definition.rb
@@ -5,7 +5,7 @@ class TestPivotTableCacheDefinition < Test::Unit::TestCase
p = Axlsx::Package.new
@ws = p.workbook.add_worksheet
5.times do
- @ws << ["aa","aa","aa","aa"]
+ @ws << ["aa", "aa", "aa", "aa"]
end
@pivot_table = @ws.add_pivot_table('G5:G6', 'A1:D5')
@cache_definition = @pivot_table.cache_definition
diff --git a/test/workbook/worksheet/tc_protected_range.rb b/test/workbook/worksheet/tc_protected_range.rb
index 52d07d77..6d609097 100644
--- a/test/workbook/worksheet/tc_protected_range.rb
+++ b/test/workbook/worksheet/tc_protected_range.rb
@@ -2,11 +2,11 @@ require 'tc_helper.rb'
class TestProtectedRange < Test::Unit::TestCase
def setup
@p = Axlsx::Package.new
- @ws = @p.workbook.add_worksheet { |sheet| sheet.add_row [1,2,3,4,5,6,7,8,9] }
+ @ws = @p.workbook.add_worksheet { |sheet| sheet.add_row [1, 2, 3, 4, 5, 6, 7, 8, 9] }
end
def test_initialize_options
- assert_nothing_raised {Axlsx::ProtectedRange.new(:sqref => 'A1:B1', :name => "only bob")}
+ assert_nothing_raised { Axlsx::ProtectedRange.new(:sqref => 'A1:B1', :name => "only bob") }
end
def test_range
diff --git a/test/workbook/worksheet/tc_rich_text.rb b/test/workbook/worksheet/tc_rich_text.rb
index 1bd3ec76..34117b1b 100644
--- a/test/workbook/worksheet/tc_rich_text.rb
+++ b/test/workbook/worksheet/tc_rich_text.rb
@@ -8,7 +8,7 @@ class RichText < Test::Unit::TestCase
@rt = Axlsx::RichText.new
b = true
(0..26).each do |r|
- @rt.add_run "run #{r}, ", :b => (b=!b), :i => !b
+ @rt.add_run "run #{r}, ", :b => (b = !b), :i => !b
end
@row = @ws.add_row [@rt]
@c = @row.first
@@ -22,7 +22,7 @@ class RichText < Test::Unit::TestCase
assert_equal(rt_direct.runs.length, 1)
assert_equal(rt_indirect.runs.length, 1)
row = @ws.add_row [rt_direct, rt_indirect]
- assert_equal(row[0].to_xml_string(0,0), row[1].to_xml_string(0,0))
+ assert_equal(row[0].to_xml_string(0, 0), row[1].to_xml_string(0, 0))
end
def test_textruns
@@ -39,6 +39,6 @@ class RichText < Test::Unit::TestCase
row_rt = @ws.add_row [rt]
row_imp = @ws.add_row ['a']
row_imp[0].b = true
- assert_equal(row_rt[0].to_xml_string(0,0), row_imp[0].to_xml_string(0,0))
+ assert_equal(row_rt[0].to_xml_string(0, 0), row_imp[0].to_xml_string(0, 0))
end
end
diff --git a/test/workbook/worksheet/tc_rich_text_run.rb b/test/workbook/worksheet/tc_rich_text_run.rb
index 39919a31..d21329a9 100644
--- a/test/workbook/worksheet/tc_rich_text_run.rb
+++ b/test/workbook/worksheet/tc_rich_text_run.rb
@@ -106,7 +106,7 @@ class RichTextRun < Test::Unit::TestCase
assert_raise(ArgumentError) { @c.u = -1.1 }
assert_nothing_raised { @c.u = :single }
assert_equal(@c.u, :single)
- doc = Nokogiri::XML(@c.to_xml_string(1,1))
+ doc = Nokogiri::XML(@c.to_xml_string(1, 1))
assert(doc.xpath('//u[@val="single"]'))
end
@@ -141,7 +141,7 @@ class RichTextRun < Test::Unit::TestCase
end
def test_multiline_autowidth
- wrap = @p.workbook.styles.add_style({:alignment => {:wrap_text => true}})
+ wrap = @p.workbook.styles.add_style({ :alignment => { :wrap_text => true } })
awtr = Axlsx::RichTextRun.new('I\'m bold' + "\n", :b => true)
rt = Axlsx::RichText.new
rt.runs << awtr
diff --git a/test/workbook/worksheet/tc_row.rb b/test/workbook/worksheet/tc_row.rb
index 900e751e..29c4415b 100644
--- a/test/workbook/worksheet/tc_row.rb
+++ b/test/workbook/worksheet/tc_row.rb
@@ -3,7 +3,7 @@ require 'tc_helper.rb'
class TestRow < Test::Unit::TestCase
def setup
p = Axlsx::Package.new
- @ws = p.workbook.add_worksheet :name=>"hmmm"
+ @ws = p.workbook.add_worksheet :name => "hmmm"
@row = @ws.add_row
end
@@ -15,19 +15,19 @@ class TestRow < Test::Unit::TestCase
end
def test_initialize_with_fixed_height
- row = @ws.add_row([1,2,3,4,5], :height=>40)
+ row = @ws.add_row([1, 2, 3, 4, 5], :height => 40)
assert_equal(40, row.height)
assert(row.custom_height)
end
def test_style
- r = @ws.add_row([1,2,3,4,5])
- r.style=1
- r.cells.each { |c| assert_equal(c.style,1) }
+ r = @ws.add_row([1, 2, 3, 4, 5])
+ r.style = 1
+ r.cells.each { |c| assert_equal(c.style, 1) }
end
def test_color
- r = @ws.add_row([1,2,3,4,5])
+ r = @ws.add_row([1, 2, 3, 4, 5])
r.color = "FF00FF00"
r.cells.each { |c| assert_equal(c.color.rgb, "FF00FF00") }
end
@@ -48,12 +48,12 @@ class TestRow < Test::Unit::TestCase
end
def test_array_to_cells
- r = @ws.add_row [1,2,3], :style=>1, :types=>[:integer, :string, :float]
+ r = @ws.add_row [1, 2, 3], :style => 1, :types => [:integer, :string, :float]
assert_equal(r.cells.size, 3)
r.cells.each do |c|
assert_equal(c.style, 1)
end
- r = @ws.add_row [1,2,3], :style=>[1]
+ r = @ws.add_row [1, 2, 3], :style => [1]
assert_equal(r.cells.first.style, 1, "only apply style to cells with at the same index of of the style array")
assert_equal(r.cells.last.style, 0, "only apply style to cells with at the same index of of the style array")
end
@@ -135,7 +135,7 @@ class TestRow < Test::Unit::TestCase
def test_offsets
offset = 3
- values = [1,2,3,4,5]
+ values = [1, 2, 3, 4, 5]
r = @ws.add_row(values, offset: offset, style: 1)
r.cells.each_with_index do |c, index|
assert_equal(c.style, index < offset ? 0 : 1)
@@ -145,11 +145,11 @@ class TestRow < Test::Unit::TestCase
def test_offsets_with_styles
offset = 3
- values = [1,2,3,4,5]
- styles = (1..5).map{ @ws.workbook.styles.add_style }
+ values = [1, 2, 3, 4, 5]
+ styles = (1..5).map { @ws.workbook.styles.add_style }
r = @ws.add_row(values, offset: offset, style: styles)
r.cells.each_with_index do |c, index|
- assert_equal(c.style, index < offset ? 0 : styles[index-offset])
+ assert_equal(c.style, index < offset ? 0 : styles[index - offset])
assert_equal(c.value, index < offset ? nil : values[index - offset])
end
end
diff --git a/test/workbook/worksheet/tc_sheet_format_pr.rb b/test/workbook/worksheet/tc_sheet_format_pr.rb
index ef4eb0d8..48643bc6 100644
--- a/test/workbook/worksheet/tc_sheet_format_pr.rb
+++ b/test/workbook/worksheet/tc_sheet_format_pr.rb
@@ -45,31 +45,31 @@ class TestSheetFormatPr < Test::Unit::TestCase
def test_default_row_height
assert_raise(ArgumentError) { @sheet_format_pr.default_row_height = :foo }
- assert_nothing_raised { @sheet_format_pr.default_row_height= 1.0 }
+ assert_nothing_raised { @sheet_format_pr.default_row_height = 1.0 }
end
def test_default_col_width
- assert_raise(ArgumentError) { @sheet_format_pr.default_col_width= :foo }
+ assert_raise(ArgumentError) { @sheet_format_pr.default_col_width = :foo }
assert_nothing_raised { @sheet_format_pr.default_col_width = 1.0 }
end
def test_custom_height
- assert_raise(ArgumentError) { @sheet_format_pr.custom_height= :foo }
+ assert_raise(ArgumentError) { @sheet_format_pr.custom_height = :foo }
assert_nothing_raised { @sheet_format_pr.custom_height = true }
end
def test_zero_height
- assert_raise(ArgumentError) { @sheet_format_pr.zero_height= :foo }
+ assert_raise(ArgumentError) { @sheet_format_pr.zero_height = :foo }
assert_nothing_raised { @sheet_format_pr.zero_height = true }
end
def test_thick_top
- assert_raise(ArgumentError) { @sheet_format_pr.thick_top= :foo }
+ assert_raise(ArgumentError) { @sheet_format_pr.thick_top = :foo }
assert_nothing_raised { @sheet_format_pr.thick_top = true }
end
def test_thick_bottom
- assert_raise(ArgumentError) { @sheet_format_pr.thick_bottom= :foo }
+ assert_raise(ArgumentError) { @sheet_format_pr.thick_bottom = :foo }
assert_nothing_raised { @sheet_format_pr.thick_bottom = true }
end
diff --git a/test/workbook/worksheet/tc_sheet_pr.rb b/test/workbook/worksheet/tc_sheet_pr.rb
index f6ffcfdb..70ce0428 100644
--- a/test/workbook/worksheet/tc_sheet_pr.rb
+++ b/test/workbook/worksheet/tc_sheet_pr.rb
@@ -20,7 +20,7 @@ class TestSheetPr < Test::Unit::TestCase
def test_initialization
@options.each do |key, value|
- if key==:tab_color
+ if key == :tab_color
stored_value = @sheet_pr.send(key)
assert_equal Axlsx::Color, stored_value.class
assert_equal value, stored_value.rgb
diff --git a/test/workbook/worksheet/tc_sheet_protection.rb b/test/workbook/worksheet/tc_sheet_protection.rb
index 26297bc4..8d5452cc 100644
--- a/test/workbook/worksheet/tc_sheet_protection.rb
+++ b/test/workbook/worksheet/tc_sheet_protection.rb
@@ -55,7 +55,7 @@ class TestSheetProtection < Test::Unit::TestCase
@sp.password = 'fish' # -> CA3F
doc = Nokogiri::XML(@sp.to_xml_string)
@options.each do |key, value|
- assert(doc.xpath("//sheetProtection[@#{key.to_s.gsub(/_(.)/){ $1.upcase }}='#{value}']"))
+ assert(doc.xpath("//sheetProtection[@#{key.to_s.gsub(/_(.)/) { $1.upcase }}='#{value}']"))
end
end
end
diff --git a/test/workbook/worksheet/tc_table.rb b/test/workbook/worksheet/tc_table.rb
index 1a90f0bc..7a2e5987 100644
--- a/test/workbook/worksheet/tc_table.rb
+++ b/test/workbook/worksheet/tc_table.rb
@@ -5,7 +5,7 @@ class TestTable < Test::Unit::TestCase
p = Axlsx::Package.new
@ws = p.workbook.add_worksheet
40.times do
- @ws << ["aa","aa","aa","aa","aa","aa"]
+ @ws << ["aa", "aa", "aa", "aa", "aa", "aa"]
end
end
diff --git a/test/workbook/worksheet/tc_table_style_info.rb b/test/workbook/worksheet/tc_table_style_info.rb
index 19beaaba..2067959c 100644
--- a/test/workbook/worksheet/tc_table_style_info.rb
+++ b/test/workbook/worksheet/tc_table_style_info.rb
@@ -7,7 +7,7 @@ class TestTableStyleInfo < Test::Unit::TestCase
40.times do
@ws.add_row %w(aa bb cc dd ee ff gg hh ii jj kk)
end
- @table = @ws.add_table(Axlsx::cell_range([@ws.rows.first.cells.first,@ws.rows.last.cells.last], false), :name => 'foo')
+ @table = @ws.add_table(Axlsx::cell_range([@ws.rows.first.cells.first, @ws.rows.last.cells.last], false), :name => 'foo')
@options = { :show_first_column => 1,
:show_last_column => 1,
:show_row_stripes => 1,
diff --git a/test/workbook/worksheet/tc_worksheet.rb b/test/workbook/worksheet/tc_worksheet.rb
index 8475f5aa..bae9f904 100644
--- a/test/workbook/worksheet/tc_worksheet.rb
+++ b/test/workbook/worksheet/tc_worksheet.rb
@@ -29,7 +29,7 @@ class TestWorksheet < Test::Unit::TestCase
end
def test_name_unique
- assert_raise(ArgumentError, "worksheet name must be unique") { n = @ws.name; @ws.workbook.add_worksheet(:name=> n) }
+ assert_raise(ArgumentError, "worksheet name must be unique") { n = @ws.name; @ws.workbook.add_worksheet(:name => n) }
end
def test_name_unique_only_checks_other_worksheet_names
@@ -107,15 +107,15 @@ class TestWorksheet < Test::Unit::TestCase
def test_no_autowidth
@ws.workbook.use_autowidth = false
- @ws.add_row [1,2,3,4]
+ @ws.add_row [1, 2, 3, 4]
assert_equal(@ws.column_info[0].width, nil)
end
def test_initialization_options
- page_margins = {:left => 2, :right => 2, :bottom => 2, :top => 2, :header => 2, :footer => 2}
- page_setup = {:fit_to_height => 1, :fit_to_width => 1, :orientation => :landscape, :paper_width => "210mm", :paper_height => "297mm", :scale => 80}
- print_options = {:grid_lines => true, :headings => true, :horizontal_centered => true, :vertical_centered => true}
- header_footer = {:different_first => false, :different_odd_even => false, :odd_header => 'Header'}
+ page_margins = { :left => 2, :right => 2, :bottom => 2, :top => 2, :header => 2, :footer => 2 }
+ page_setup = { :fit_to_height => 1, :fit_to_width => 1, :orientation => :landscape, :paper_width => "210mm", :paper_height => "297mm", :scale => 80 }
+ print_options = { :grid_lines => true, :headings => true, :horizontal_centered => true, :vertical_centered => true }
+ header_footer = { :different_first => false, :different_odd_even => false, :odd_header => 'Header' }
optioned = @ws.workbook.add_worksheet(:name => 'bob', :page_margins => page_margins, :page_setup => page_setup, :print_options => print_options, :header_footer => header_footer)
page_margins.keys.each do |key|
assert_equal(page_margins[key], optioned.page_margins.send(key))
@@ -175,8 +175,8 @@ class TestWorksheet < Test::Unit::TestCase
range = @ws["A1:C2"]
first_row = @ws[0]
last_row = @ws[1]
- assert_equal(@ws.rows[0],first_row)
- assert_equal(@ws.rows[1],last_row)
+ assert_equal(@ws.rows[0], first_row)
+ assert_equal(@ws.rows[1], last_row)
assert_equal(range.size, 6)
assert_equal(range.first, @ws.rows.first.cells.first)
assert_equal(range.last, @ws.rows.last.cells.last)
@@ -184,7 +184,7 @@ class TestWorksheet < Test::Unit::TestCase
def test_add_row
assert(@ws.rows.empty?, "sheet has no rows by default")
- r = @ws.add_row([1,2,3])
+ r = @ws.add_row([1, 2, 3])
assert_equal(@ws.rows.size, 1, "add_row adds a row")
assert_equal(@ws.rows.first, r, "the row returned is the row added")
end
@@ -227,11 +227,11 @@ class TestWorksheet < Test::Unit::TestCase
end
def test_col_style
- @ws.add_row [1,2,3,4]
- @ws.add_row [1,2,3,4]
- @ws.add_row [1,2,3,4]
- @ws.add_row [1,2,3,4]
- @ws.col_style( (1..2), 1, :row_offset=>1)
+ @ws.add_row [1, 2, 3, 4]
+ @ws.add_row [1, 2, 3, 4]
+ @ws.add_row [1, 2, 3, 4]
+ @ws.add_row [1, 2, 3, 4]
+ @ws.col_style((1..2), 1, :row_offset => 1)
@ws.rows[(1..-1)].each do |r|
assert_equal(r.cells[1].style, 1)
assert_equal(r.cells[2].style, 1)
@@ -241,41 +241,41 @@ class TestWorksheet < Test::Unit::TestCase
end
def test_col_style_with_empty_column
- @ws.add_row [1,2,3,4]
+ @ws.add_row [1, 2, 3, 4]
@ws.add_row [1]
- @ws.add_row [1,2,3,4]
- assert_nothing_raised {@ws.col_style(1, 1)}
+ @ws.add_row [1, 2, 3, 4]
+ assert_nothing_raised { @ws.col_style(1, 1) }
end
def test_cols
- @ws.add_row [1,2,3,4]
- @ws.add_row [1,2,3,4]
- @ws.add_row [1,2,3]
- @ws.add_row [1,2,3,4]
+ @ws.add_row [1, 2, 3, 4]
+ @ws.add_row [1, 2, 3, 4]
+ @ws.add_row [1, 2, 3]
+ @ws.add_row [1, 2, 3, 4]
c = @ws.cols[1]
assert_equal(c.size, 4)
assert_equal(c[0].value, 2)
end
def test_cols_with_block
- @ws.add_row [1,2,3]
+ @ws.add_row [1, 2, 3]
@ws.add_row [1]
- cols = @ws.cols {|row, column| :foo }
+ cols = @ws.cols { |row, column| :foo }
assert_equal(:foo, cols[1][1])
end
def test_row_style
- @ws.add_row [1,2,3,4]
- @ws.add_row [1,2,3,4]
- @ws.add_row [1,2,3,4]
- @ws.add_row [1,2,3,4]
- @ws.row_style 1, 1, :col_offset=>1
+ @ws.add_row [1, 2, 3, 4]
+ @ws.add_row [1, 2, 3, 4]
+ @ws.add_row [1, 2, 3, 4]
+ @ws.add_row [1, 2, 3, 4]
+ @ws.row_style 1, 1, :col_offset => 1
@ws.rows[1].cells[(1..-1)].each do |c|
assert_equal(c.style, 1)
end
assert_equal(@ws.rows[1].cells[0].style, 0)
assert_equal(@ws.rows[2].cells[1].style, 0)
- @ws.row_style( 1..2, 1, :col_offset => 2)
+ @ws.row_style(1..2, 1, :col_offset => 2)
@ws.rows[(1..2)].each do |r|
r.cells[(2..-1)].each do |c|
assert_equal(c.style, 1)
@@ -290,7 +290,7 @@ class TestWorksheet < Test::Unit::TestCase
# end
def test_to_xml_string_dimensions
- @ws.add_row [1,2,3]
+ @ws.add_row [1, 2, 3]
doc = Nokogiri::XML(@ws.to_xml_string)
assert_equal(doc.xpath('//xmlns:worksheet/xmlns:dimension[@ref="A1:C1"]').size, 1)
end
@@ -414,7 +414,7 @@ class TestWorksheet < Test::Unit::TestCase
def test_to_xml_string
schema = Nokogiri::XML::Schema(File.open(Axlsx::SML_XSD))
doc = Nokogiri::XML(@ws.to_xml_string)
- assert(schema.validate(doc).map{ |e| puts e.message; e }.empty?, "error free validation")
+ assert(schema.validate(doc).map { |e| puts e.message; e }.empty?, "error free validation")
end
def test_styles
@@ -424,7 +424,7 @@ class TestWorksheet < Test::Unit::TestCase
def test_to_xml_string_with_illegal_chars
old = Axlsx::trust_input
Axlsx::trust_input = false
- nasties = "\v\u2028\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u001f"
+ nasties = "\v\u2028\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u001f"
@ws.add_row [nasties]
assert_equal(0, @ws.rows.last.cells.last.value.index("\v"))
assert_equal(nil, @ws.to_xml_string.index("\v"))
@@ -455,7 +455,7 @@ class TestWorksheet < Test::Unit::TestCase
end
def test_relationships
- @ws.add_row [1,2,3]
+ @ws.add_row [1, 2, 3]
assert(@ws.relationships.empty?, "No Drawing relationship until you add a chart")
@ws.add_chart Axlsx::Pie3DChart
assert_equal(@ws.relationships.size, 1, "adding a chart creates the relationship")
@@ -529,14 +529,14 @@ class TestWorksheet < Test::Unit::TestCase
def test_protect_range_with_cells
@ws.add_row [1, 2, 3]
- assert_nothing_raised {@ws.protect_range(@ws.rows.first.cells) }
+ assert_nothing_raised { @ws.protect_range(@ws.rows.first.cells) }
assert_equal('A1:C1', @ws.send(:protected_ranges).last.sqref)
end
def test_merge_cells
- @ws.add_row [1,2,3]
- @ws.add_row [4,5,6]
- @ws.add_row [7,8,9]
+ @ws.add_row [1, 2, 3]
+ @ws.add_row [4, 5, 6]
+ @ws.add_row [7, 8, 9]
@ws.merge_cells "A1:A2"
@ws.merge_cells "B2:C3"
@ws.merge_cells @ws.rows.last.cells[(0..1)]
@@ -554,12 +554,12 @@ class TestWorksheet < Test::Unit::TestCase
def test_auto_filter
assert(@ws.auto_filter.range.nil?)
- assert(@wb.defined_names.none?{|defined_name| defined_name.name=='_xlnm._FilterDatabase'})
+ assert(@wb.defined_names.none? { |defined_name| defined_name.name == '_xlnm._FilterDatabase' })
assert_raise(ArgumentError) { @ws.auto_filter = 123 }
@ws.auto_filter.range = "A1:D9"
assert_equal(@ws.auto_filter.range, "A1:D9")
@ws.to_xml_string
- assert(@wb.defined_names.any?{|defined_name| defined_name.name=='_xlnm._FilterDatabase'})
+ assert(@wb.defined_names.any? { |defined_name| defined_name.name == '_xlnm._FilterDatabase' })
end
def test_auto_filter_assign
@@ -567,7 +567,7 @@ class TestWorksheet < Test::Unit::TestCase
assert(@ws.auto_filter.range.nil?)
assert(other_ws.auto_filter.range.nil?)
- assert(@wb.defined_names.none?{|defined_name| defined_name.name=='_xlnm._FilterDatabase'})
+ assert(@wb.defined_names.none? { |defined_name| defined_name.name == '_xlnm._FilterDatabase' })
assert_raise(ArgumentError) { @ws.auto_filter = 123 }
@ws.auto_filter = "A1:D9"
@@ -579,7 +579,7 @@ class TestWorksheet < Test::Unit::TestCase
@ws.to_xml_string
other_ws.to_xml_string
- filter_database = @wb.defined_names.select{|defined_name| defined_name.name=='_xlnm._FilterDatabase'}
+ filter_database = @wb.defined_names.select { |defined_name| defined_name.name == '_xlnm._FilterDatabase' }
assert_equal(2, filter_database.size)
assert_equal(@ws.index, filter_database[0].local_sheet_id)
assert_equal(other_ws.index, filter_database[1].local_sheet_id)
@@ -593,7 +593,7 @@ class TestWorksheet < Test::Unit::TestCase
end
def test_outline_level_rows
- 3.times { @ws.add_row [1,2,3] }
+ 3.times { @ws.add_row [1, 2, 3] }
@ws.outline_level_rows 0, 2
assert_equal(1, @ws.rows[0].outline_level)
assert_equal(true, @ws.rows[2].hidden)
@@ -601,7 +601,7 @@ class TestWorksheet < Test::Unit::TestCase
end
def test_outline_level_columns
- 3.times { @ws.add_row [1,2,3] }
+ 3.times { @ws.add_row [1, 2, 3] }
@ws.outline_level_columns 0, 2
assert_equal(1, @ws.column_info[0].outline_level)
assert_equal(true, @ws.column_info[2].hidden)
@@ -717,16 +717,16 @@ class TestWorksheet < Test::Unit::TestCase
wb.add_worksheet do |sheet|
20.times.each do
- sheet.add_row [1,2,3,4,5]
+ sheet.add_row [1, 2, 3, 4, 5]
end
sheet.add_border "B2:D5"
- sheet.add_border ["C3:C4", "D3:D4", "A2"], {color: "FF00000"}
+ sheet.add_border ["C3:C4", "D3:D4", "A2"], { color: "FF00000" }
sheet.add_border "B10:E10", [:top, :bottom, :left, :right]
sheet.add_border "B12:E12", :all
sheet.add_border "B14:E14", Axlsx::Border::EDGES
- sheet.add_border "B16:E16", {edges: :all, style: :thick}
- sheet.add_border "B18:E18", {edges: [:top], style: :thick, color: "FFFFF00"}
+ sheet.add_border "B16:E16", { edges: :all, style: :thick }
+ sheet.add_border "B18:E18", { edges: [:top], style: :thick, color: "FFFFF00" }
end
wb.apply_styles
@@ -786,7 +786,7 @@ class TestWorksheet < Test::Unit::TestCase
sz: 11,
family: 1
}
- assert_equal b2_cell_style, wb.styles.style_index.values.find{|x| x == b2_cell_style}
+ assert_equal b2_cell_style, wb.styles.style_index.values.find { |x| x == b2_cell_style }
d3_cell_style = {
border: {
@@ -799,7 +799,7 @@ class TestWorksheet < Test::Unit::TestCase
sz: 11,
family: 1
}
- assert_equal d3_cell_style, wb.styles.style_index.values.find{|x| x == d3_cell_style}
+ assert_equal d3_cell_style, wb.styles.style_index.values.find { |x| x == d3_cell_style }
end
def test_mixed_borders_1
@@ -872,7 +872,7 @@ class TestWorksheet < Test::Unit::TestCase
wb.styles.fonts[0].sz = 12
wb.add_worksheet do |sheet|
- sheet.add_row [1,2,3]
+ sheet.add_row [1, 2, 3]
sheet.add_style "A1:C1", { color: "FFFFFF" }
end