summaryrefslogtreecommitdiffhomepage
path: root/test/drawing
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/drawing
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/drawing')
-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
23 files changed, 109 insertions, 109 deletions
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