summaryrefslogtreecommitdiffhomepage
path: root/test/drawing
diff options
context:
space:
mode:
authorGeremia Taglialatela <[email protected]>2023-04-13 13:09:14 +0200
committerGeremia Taglialatela <[email protected]>2023-05-03 16:05:17 +0200
commite81036b76e734ab03fac31faafb9732f6b3b2928 (patch)
tree4a5944faddeac7aa574a26955d41f4901fccc038 /test/drawing
parent194e852d4f61d7c1acf4cd79df86bee43d84028a (diff)
downloadcaxlsx-e81036b76e734ab03fac31faafb9732f6b3b2928.tar.gz
caxlsx-e81036b76e734ab03fac31faafb9732f6b3b2928.zip
Fix offenses to non-production code
- Lint/AmbiguousBlockAssociation - Lint/AmbiguousOperatorPrecedence - Lint/EmptyBlock - Lint/RedundantSplatExpansion - Lint/RedundantStringCoercion - Lint/SymbolConversion - Lint/UnusedBlockArgument - Style/BlockDelimiters - Style/CommentAnnotation - Style/EachForSimpleLoop - Style/EmptyMethod - Style/ExpandPathArguments - Style/FileWrite - Style/GlobalStdStream (UNSAFE) - Style/HashEachMethods (UNSAFE) - Style/NestedParenthesizedCalls - Style/NilComparison - Style/NumericLiteralPrefix (manually fixed) - Style/ParallelAssignment - Style/PreferredHashMethods (UNSAFE) - Style/RedundantInterpolation (UNSAFE) - Style/RedundantParentheses (UNSAFE) - Style/RegexpLiteral - Style/RescueStandardError - Style/SpecialGlobalVars (UNSAFE) - Style/SymbolProc (UNSAFE) - Style/ZeroLengthPredicate (UNSAFE)
Diffstat (limited to 'test/drawing')
-rw-r--r--test/drawing/tc_area_chart.rb3
-rw-r--r--test/drawing/tc_axis.rb6
-rw-r--r--test/drawing/tc_bar_3D_chart.rb3
-rw-r--r--test/drawing/tc_bar_chart.rb3
-rw-r--r--test/drawing/tc_bar_series.rb2
-rw-r--r--test/drawing/tc_bubble_chart.rb3
-rw-r--r--test/drawing/tc_cat_axis.rb3
-rw-r--r--test/drawing/tc_chart.rb3
-rw-r--r--test/drawing/tc_d_lbls.rb2
-rw-r--r--test/drawing/tc_graphic_frame.rb3
-rw-r--r--test/drawing/tc_hyperlink.rb3
-rw-r--r--test/drawing/tc_line_3d_chart.rb3
-rw-r--r--test/drawing/tc_line_chart.rb3
-rw-r--r--test/drawing/tc_marker.rb3
-rw-r--r--test/drawing/tc_num_data.rb3
-rw-r--r--test/drawing/tc_one_cell_anchor.rb3
-rw-r--r--test/drawing/tc_picture_locking.rb3
-rw-r--r--test/drawing/tc_pie_3D_chart.rb3
-rw-r--r--test/drawing/tc_pie_series.rb2
-rw-r--r--test/drawing/tc_scaling.rb3
-rw-r--r--test/drawing/tc_scatter_chart.rb3
-rw-r--r--test/drawing/tc_ser_axis.rb3
-rw-r--r--test/drawing/tc_series_title.rb7
-rw-r--r--test/drawing/tc_title.rb7
-rw-r--r--test/drawing/tc_val_axis.rb3
-rw-r--r--test/drawing/tc_view_3D.rb3
-rw-r--r--test/drawing/tc_vml_drawing.rb2
-rw-r--r--test/drawing/tc_vml_shape.rb2
28 files changed, 34 insertions, 56 deletions
diff --git a/test/drawing/tc_area_chart.rb b/test/drawing/tc_area_chart.rb
index fc928db9..490df25a 100644
--- a/test/drawing/tc_area_chart.rb
+++ b/test/drawing/tc_area_chart.rb
@@ -8,8 +8,7 @@ class TestAreaChart < Test::Unit::TestCase
@chart = ws.add_chart Axlsx::AreaChart, :title => "fishery"
end
- def teardown
- end
+ def teardown; end
def test_initialization
assert_equal(@chart.grouping, :standard, "grouping defualt incorrect")
diff --git a/test/drawing/tc_axis.rb b/test/drawing/tc_axis.rb
index 0f7108eb..0b3bddc0 100644
--- a/test/drawing/tc_axis.rb
+++ b/test/drawing/tc_axis.rb
@@ -103,9 +103,9 @@ class TestAxis < Test::Unit::TestCase
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'))
- assert(doc.xpath("//c:crosses[@val='#{@axis.crosses.to_s}']"))
- assert(doc.xpath("//c:crossAx[@val='#{@axis.cross_axis.to_s}']"))
- assert(doc.xpath("//a:bodyPr[@rot='#{@axis.label_rotation.to_s}']"))
+ assert(doc.xpath("//c:crosses[@val='#{@axis.crosses}']"))
+ assert(doc.xpath("//c:crossAx[@val='#{@axis.cross_axis}']"))
+ assert(doc.xpath("//a:bodyPr[@rot='#{@axis.label_rotation}']"))
assert(doc.xpath("//a:t[text()='Foo']"))
end
end
diff --git a/test/drawing/tc_bar_3D_chart.rb b/test/drawing/tc_bar_3D_chart.rb
index 3c22e191..178ee65a 100644
--- a/test/drawing/tc_bar_3D_chart.rb
+++ b/test/drawing/tc_bar_3D_chart.rb
@@ -8,8 +8,7 @@ class TestBar3DChart < Test::Unit::TestCase
@chart = ws.add_chart Axlsx::Bar3DChart, :title => "fishery"
end
- def teardown
- end
+ def teardown; end
def test_initialization
assert_equal(@chart.grouping, :clustered, "grouping defualt incorrect")
diff --git a/test/drawing/tc_bar_chart.rb b/test/drawing/tc_bar_chart.rb
index 5106d266..62927bc7 100644
--- a/test/drawing/tc_bar_chart.rb
+++ b/test/drawing/tc_bar_chart.rb
@@ -8,8 +8,7 @@ class TestBarChart < Test::Unit::TestCase
@chart = ws.add_chart Axlsx::BarChart, :title => "fishery"
end
- def teardown
- end
+ def teardown; end
def test_initialization
assert_equal(@chart.grouping, :clustered, "grouping defualt incorrect")
diff --git a/test/drawing/tc_bar_series.rb b/test/drawing/tc_bar_series.rb
index 39d39b96..a1f98f64 100644
--- a/test/drawing/tc_bar_series.rb
+++ b/test/drawing/tc_bar_series.rb
@@ -36,7 +36,7 @@ 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|
+ @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)
end
diff --git a/test/drawing/tc_bubble_chart.rb b/test/drawing/tc_bubble_chart.rb
index 02745f92..eb07afee 100644
--- a/test/drawing/tc_bubble_chart.rb
+++ b/test/drawing/tc_bubble_chart.rb
@@ -21,8 +21,7 @@ class TestBubbleChart < Test::Unit::TestCase
end
end
- def teardown
- end
+ def teardown; end
def test_initialization
assert_equal(@chart.series_type, Axlsx::BubbleSeries, "series type incorrect")
diff --git a/test/drawing/tc_cat_axis.rb b/test/drawing/tc_cat_axis.rb
index 79c0f8db..2cb029cc 100644
--- a/test/drawing/tc_cat_axis.rb
+++ b/test/drawing/tc_cat_axis.rb
@@ -5,8 +5,7 @@ class TestCatAxis < Test::Unit::TestCase
@axis = Axlsx::CatAxis.new
end
- def teardown
- end
+ def teardown; end
def test_initialization
assert_equal(@axis.auto, 1, "axis auto default incorrect")
diff --git a/test/drawing/tc_chart.rb b/test/drawing/tc_chart.rb
index 4f60db17..c39bdc11 100644
--- a/test/drawing/tc_chart.rb
+++ b/test/drawing/tc_chart.rb
@@ -10,8 +10,7 @@ class TestChart < Test::Unit::TestCase
@chart = ws.add_chart Axlsx::Bar3DChart, :title => "fishery", :bg_color => "000000"
end
- def teardown
- end
+ def teardown; end
def test_initialization
assert_equal(@p.workbook.charts.last, @chart, "the chart is in the workbook")
diff --git a/test/drawing/tc_d_lbls.rb b/test/drawing/tc_d_lbls.rb
index a8647f9c..7f4f77e5 100644
--- a/test/drawing/tc_d_lbls.rb
+++ b/test/drawing/tc_d_lbls.rb
@@ -20,7 +20,7 @@ class TestDLbls < Test::Unit::TestCase
end
def test_initialization_with_optoins
- options_hash = Hash[*[@boolean_attributes.map { |name| [name, true] }]]
+ options_hash = @boolean_attributes.map { |name| [name, true] }.to_h
d_lbls = Axlsx::DLbls.new(Axlsx::Pie3DChart, options_hash.merge({ :d_lbl_pos => :t }))
diff --git a/test/drawing/tc_graphic_frame.rb b/test/drawing/tc_graphic_frame.rb
index eb638489..c57c4d96 100644
--- a/test/drawing/tc_graphic_frame.rb
+++ b/test/drawing/tc_graphic_frame.rb
@@ -8,8 +8,7 @@ class TestGraphicFrame < Test::Unit::TestCase
@frame = @chart.graphic_frame
end
- def teardown
- end
+ def teardown; end
def test_initialization
assert(@frame.anchor.is_a?(Axlsx::TwoCellAnchor))
diff --git a/test/drawing/tc_hyperlink.rb b/test/drawing/tc_hyperlink.rb
index f9deb5b8..dd27d084 100644
--- a/test/drawing/tc_hyperlink.rb
+++ b/test/drawing/tc_hyperlink.rb
@@ -9,8 +9,7 @@ class TestHyperlink < Test::Unit::TestCase
@hyperlink = @image.hyperlink
end
- def teardown
- end
+ def teardown; end
def test_href
assert_nothing_raised { @hyperlink.href = "http://axlsx.blogspot.com" }
diff --git a/test/drawing/tc_line_3d_chart.rb b/test/drawing/tc_line_3d_chart.rb
index c91e9216..64603b11 100644
--- a/test/drawing/tc_line_3d_chart.rb
+++ b/test/drawing/tc_line_3d_chart.rb
@@ -8,8 +8,7 @@ class TestLine3DChart < Test::Unit::TestCase
@chart = ws.add_chart Axlsx::Line3DChart, :title => "fishery"
end
- def teardown
- end
+ def teardown; end
def test_initialization
assert_equal(@chart.grouping, :standard, "grouping defualt incorrect")
diff --git a/test/drawing/tc_line_chart.rb b/test/drawing/tc_line_chart.rb
index 113ef844..4a96af44 100644
--- a/test/drawing/tc_line_chart.rb
+++ b/test/drawing/tc_line_chart.rb
@@ -8,8 +8,7 @@ class TestLineChart < Test::Unit::TestCase
@chart = ws.add_chart Axlsx::LineChart, :title => "fishery"
end
- def teardown
- end
+ def teardown; end
def test_initialization
assert_equal(@chart.grouping, :standard, "grouping defualt incorrect")
diff --git a/test/drawing/tc_marker.rb b/test/drawing/tc_marker.rb
index ccfb76fe..bc801965 100644
--- a/test/drawing/tc_marker.rb
+++ b/test/drawing/tc_marker.rb
@@ -5,8 +5,7 @@ class TestMarker < Test::Unit::TestCase
@marker = Axlsx::Marker.new
end
- def teardown
- end
+ def teardown; end
def test_initialization
assert(@marker.col == 0)
diff --git a/test/drawing/tc_num_data.rb b/test/drawing/tc_num_data.rb
index 7e7e12e3..10e35785 100644
--- a/test/drawing/tc_num_data.rb
+++ b/test/drawing/tc_num_data.rb
@@ -9,8 +9,7 @@ class TestNumData < Test::Unit::TestCase
assert_equal(@num_data.format_code, "General")
end
- def test_formula_based_cell
- end
+ def test_formula_based_cell; end
def test_format_code
assert_raise(ArgumentError) { @num_data.format_code = 7 }
diff --git a/test/drawing/tc_one_cell_anchor.rb b/test/drawing/tc_one_cell_anchor.rb
index 1b18f12e..e0f9da43 100644
--- a/test/drawing/tc_one_cell_anchor.rb
+++ b/test/drawing/tc_one_cell_anchor.rb
@@ -9,8 +9,7 @@ class TestOneCellAnchor < Test::Unit::TestCase
@anchor = @image.anchor
end
- def teardown
- end
+ def teardown; end
def test_initialization
assert(@anchor.from.col == 0)
diff --git a/test/drawing/tc_picture_locking.rb b/test/drawing/tc_picture_locking.rb
index 6e5de47b..2543b1ca 100644
--- a/test/drawing/tc_picture_locking.rb
+++ b/test/drawing/tc_picture_locking.rb
@@ -5,8 +5,7 @@ class TestPictureLocking < Test::Unit::TestCase
@item = Axlsx::PictureLocking.new
end
- def teardown
- end
+ def teardown; end
def test_initialiation
assert_equal(Axlsx.instance_values_for(@item).size, 1)
diff --git a/test/drawing/tc_pie_3D_chart.rb b/test/drawing/tc_pie_3D_chart.rb
index f536f086..9692ccc4 100644
--- a/test/drawing/tc_pie_3D_chart.rb
+++ b/test/drawing/tc_pie_3D_chart.rb
@@ -8,8 +8,7 @@ class TestPie3DChart < Test::Unit::TestCase
@chart = ws.add_chart Axlsx::Pie3DChart, :title => "fishery"
end
- def teardown
- end
+ def teardown; end
def test_initialization
assert_equal(@chart.view_3D.rot_x, 30, "view 3d default rot_x incorrect")
diff --git a/test/drawing/tc_pie_series.rb b/test/drawing/tc_pie_series.rb
index c3f5bb3a..2c897fd2 100644
--- a/test/drawing/tc_pie_series.rb
+++ b/test/drawing/tc_pie_series.rb
@@ -27,5 +27,5 @@ class TestPieSeries < Test::Unit::TestCase
doc = Nokogiri::XML(@series.to_xml_string)
assert(doc.xpath("//srgbClr[@val='#{@series.colors[0]}']"))
end
- # TODO test unique serialization parts
+ # TODO: test unique serialization parts
end
diff --git a/test/drawing/tc_scaling.rb b/test/drawing/tc_scaling.rb
index 8f92a024..1cd1538b 100644
--- a/test/drawing/tc_scaling.rb
+++ b/test/drawing/tc_scaling.rb
@@ -5,8 +5,7 @@ class TestScaling < Test::Unit::TestCase
@scaling = Axlsx::Scaling.new
end
- def teardown
- end
+ def teardown; end
def test_initialization
assert(@scaling.orientation == :minMax)
diff --git a/test/drawing/tc_scatter_chart.rb b/test/drawing/tc_scatter_chart.rb
index 359f7206..42d4a773 100644
--- a/test/drawing/tc_scatter_chart.rb
+++ b/test/drawing/tc_scatter_chart.rb
@@ -19,8 +19,7 @@ class TestScatterChart < Test::Unit::TestCase
end
end
- def teardown
- end
+ def teardown; end
def test_scatter_style
@chart.scatterStyle = :marker
diff --git a/test/drawing/tc_ser_axis.rb b/test/drawing/tc_ser_axis.rb
index 4b498a12..80800fb5 100644
--- a/test/drawing/tc_ser_axis.rb
+++ b/test/drawing/tc_ser_axis.rb
@@ -5,8 +5,7 @@ class TestSerAxis < Test::Unit::TestCase
@axis = Axlsx::SerAxis.new
end
- def teardown
- end
+ def teardown; end
def test_options
a = Axlsx::SerAxis.new(:tick_lbl_skip => 9, :tick_mark_skip => 7)
diff --git a/test/drawing/tc_series_title.rb b/test/drawing/tc_series_title.rb
index b85aece3..a304802b 100644
--- a/test/drawing/tc_series_title.rb
+++ b/test/drawing/tc_series_title.rb
@@ -9,19 +9,18 @@ class TestSeriesTitle < Test::Unit::TestCase
@chart = ws.add_chart Axlsx::Bar3DChart
end
- def teardown
- end
+ def teardown; end
def test_initialization
assert(@title.text == "")
- assert(@title.cell == nil)
+ assert(@title.cell.nil?)
end
def test_text
assert_raise(ArgumentError, "text must be a string") { @title.text = 123 }
@title.cell = @row.cells.first
@title.text = "bob"
- assert(@title.cell == nil, "setting title with text clears the cell")
+ assert(@title.cell.nil?, "setting title with text clears the cell")
end
def test_cell
diff --git a/test/drawing/tc_title.rb b/test/drawing/tc_title.rb
index eb549b35..f26c307e 100644
--- a/test/drawing/tc_title.rb
+++ b/test/drawing/tc_title.rb
@@ -11,12 +11,11 @@ class TestTitle < Test::Unit::TestCase
@chart = ws.add_chart Axlsx::Bar3DChart
end
- def teardown
- end
+ def teardown; end
def test_initialization
assert(@title.text == "")
- assert(@title.cell == nil)
+ assert(@title.cell.nil?)
end
def test_initialize_title_size
@@ -28,7 +27,7 @@ class TestTitle < Test::Unit::TestCase
assert_raise(ArgumentError, "text must be a string") { @title.text = 123 }
@title.cell = @row.cells.first
@title.text = "bob"
- assert(@title.cell == nil, "setting title with text clears the cell")
+ assert(@title.cell.nil?, "setting title with text clears the cell")
end
def test_cell
diff --git a/test/drawing/tc_val_axis.rb b/test/drawing/tc_val_axis.rb
index a607ddb1..cc67f448 100644
--- a/test/drawing/tc_val_axis.rb
+++ b/test/drawing/tc_val_axis.rb
@@ -5,8 +5,7 @@ class TestValAxis < Test::Unit::TestCase
@axis = Axlsx::ValAxis.new
end
- def teardown
- end
+ def teardown; end
def test_initialization
assert_equal(@axis.cross_between, :between, "axis crossBetween default incorrect")
diff --git a/test/drawing/tc_view_3D.rb b/test/drawing/tc_view_3D.rb
index 43116023..6d59c219 100644
--- a/test/drawing/tc_view_3D.rb
+++ b/test/drawing/tc_view_3D.rb
@@ -5,8 +5,7 @@ class TestView3D < Test::Unit::TestCase
@view = Axlsx::View3D.new
end
- def teardown
- end
+ def teardown; end
def test_options
v = Axlsx::View3D.new :rot_x => 10, :rot_y => 5, :h_percent => "30%", :depth_percent => "45%", :r_ang_ax => false, :perspective => 10
diff --git a/test/drawing/tc_vml_drawing.rb b/test/drawing/tc_vml_drawing.rb
index debba561..1e2132af 100644
--- a/test/drawing/tc_vml_drawing.rb
+++ b/test/drawing/tc_vml_drawing.rb
@@ -15,7 +15,7 @@ class TestVmlDrawing < Test::Unit::TestCase
end
def test_to_xml_string
- str = @vml_drawing.to_xml_string()
+ 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}']"))
diff --git a/test/drawing/tc_vml_shape.rb b/test/drawing/tc_vml_shape.rb
index b8344a92..f93ea48d 100644
--- a/test/drawing/tc_vml_shape.rb
+++ b/test/drawing/tc_vml_shape.rb
@@ -92,7 +92,7 @@ class TestVmlShape < Test::Unit::TestCase
end
def test_to_xml_string
- str = @comments.vml_drawing.to_xml_string()
+ str = @comments.vml_drawing.to_xml_string
doc = Nokogiri::XML(str)
assert_equal(doc.xpath("//v:shape").size, 2)
assert_equal(1, doc.xpath("//x:Visible").size, 'ClientData/x:Visible element rendering')