summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGeremia Taglialatela <[email protected]>2023-04-05 17:37:28 +0200
committerGeremia Taglialatela <[email protected]>2023-04-06 09:55:31 +0200
commita802d1d179f5ab56b419e1b47e62885d72b5384d (patch)
tree70e8cc79f12a4e17efb6dc0126cc0ed204669142 /test
parentb5d7a7a1917adb12e3ea04abe261a37f8aff7f56 (diff)
downloadcaxlsx-a802d1d179f5ab56b419e1b47e62885d72b5384d.tar.gz
caxlsx-a802d1d179f5ab56b419e1b47e62885d72b5384d.zip
Fix Layout/EmptyLineBetweenDefs offenses
``` rubocop --only Layout/EmptyLineBetweenDefs -a ```
Diffstat (limited to 'test')
-rw-r--r--test/doc_props/tc_app.rb1
-rw-r--r--test/drawing/tc_cat_axis.rb1
-rw-r--r--test/drawing/tc_d_lbls.rb1
-rw-r--r--test/drawing/tc_drawing.rb2
-rw-r--r--test/drawing/tc_picture_locking.rb1
-rw-r--r--test/drawing/tc_scatter_chart.rb1
-rw-r--r--test/drawing/tc_val_axis.rb1
-rw-r--r--test/drawing/tc_vml_shape.rb2
-rw-r--r--test/stylesheet/tc_border.rb2
-rw-r--r--test/stylesheet/tc_border_pr.rb2
-rw-r--r--test/stylesheet/tc_font.rb1
-rw-r--r--test/stylesheet/tc_styles.rb1
-rw-r--r--test/tc_axlsx.rb1
-rw-r--r--test/util/tc_validators.rb2
-rw-r--r--test/workbook/worksheet/tc_color_scale.rb1
-rw-r--r--test/workbook/worksheet/tc_comment.rb1
-rw-r--r--test/workbook/worksheet/tc_comments.rb2
-rw-r--r--test/workbook/worksheet/tc_conditional_formatting.rb1
-rw-r--r--test/workbook/worksheet/tc_pane.rb1
-rw-r--r--test/workbook/worksheet/tc_sheet_format_pr.rb2
-rw-r--r--test/workbook/worksheet/tc_table_style_info.rb1
-rw-r--r--test/workbook/worksheet/tc_worksheet.rb1
-rw-r--r--test/workbook/worksheet/tc_worksheet_hyperlink.rb1
23 files changed, 30 insertions, 0 deletions
diff --git a/test/doc_props/tc_app.rb b/test/doc_props/tc_app.rb
index 31ab3733..ae0e45ba 100644
--- a/test/doc_props/tc_app.rb
+++ b/test/doc_props/tc_app.rb
@@ -31,6 +31,7 @@ class TestApp < Test::Unit::TestCase
@app = Axlsx::App.new options
end
+
def test_valid_document
schema = Nokogiri::XML::Schema(File.open(Axlsx::APP_XSD))
doc = Nokogiri::XML(@app.to_xml_string)
diff --git a/test/drawing/tc_cat_axis.rb b/test/drawing/tc_cat_axis.rb
index ac690336..b020fc53 100644
--- a/test/drawing/tc_cat_axis.rb
+++ b/test/drawing/tc_cat_axis.rb
@@ -4,6 +4,7 @@ class TestCatAxis < Test::Unit::TestCase
def setup
@axis = Axlsx::CatAxis.new
end
+
def teardown
end
diff --git a/test/drawing/tc_d_lbls.rb b/test/drawing/tc_d_lbls.rb
index d5474131..60efeb7b 100644
--- a/test/drawing/tc_d_lbls.rb
+++ b/test/drawing/tc_d_lbls.rb
@@ -31,6 +31,7 @@ class TestDLbls < Test::Unit::TestCase
end
assert_equal(:t, d_lbls.d_lbl_pos, "d_lbl_pos set by options")
end
+
def test_d_lbl_pos
assert_raise(ArgumentError, 'invlaid label positions are rejected') { @d_lbls.d_lbl_pos = :upside_down }
assert_nothing_raised('accepts valid label position') { @d_lbls.d_lbl_pos = :ctr }
diff --git a/test/drawing/tc_drawing.rb b/test/drawing/tc_drawing.rb
index 05ffee98..bc9fc686 100644
--- a/test/drawing/tc_drawing.rb
+++ b/test/drawing/tc_drawing.rb
@@ -30,12 +30,14 @@ class TestDrawing < Test::Unit::TestCase
assert_equal(600, image.width)
assert_equal(400, image.height)
end
+
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])
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])
assert_equal(@ws.drawing.charts.last, chart, "add chart is returned")
diff --git a/test/drawing/tc_picture_locking.rb b/test/drawing/tc_picture_locking.rb
index 794c8f6a..3714df0b 100644
--- a/test/drawing/tc_picture_locking.rb
+++ b/test/drawing/tc_picture_locking.rb
@@ -4,6 +4,7 @@ class TestPictureLocking < Test::Unit::TestCase
def setup
@item = Axlsx::PictureLocking.new
end
+
def teardown
end
diff --git a/test/drawing/tc_scatter_chart.rb b/test/drawing/tc_scatter_chart.rb
index 15b1f0a0..37748b2f 100644
--- a/test/drawing/tc_scatter_chart.rb
+++ b/test/drawing/tc_scatter_chart.rb
@@ -27,6 +27,7 @@ class TestScatterChart < Test::Unit::TestCase
assert(@chart.scatterStyle == :marker)
assert_raise(ArgumentError) { @chart.scatterStyle = :buckshot }
end
+
def test_initialization
assert_equal(@chart.scatterStyle, :lineMarker, "scatterStyle defualt incorrect")
assert_equal(@chart.series_type, Axlsx::ScatterSeries, "series type incorrect")
diff --git a/test/drawing/tc_val_axis.rb b/test/drawing/tc_val_axis.rb
index aa1cb23a..7fd9d1dd 100644
--- a/test/drawing/tc_val_axis.rb
+++ b/test/drawing/tc_val_axis.rb
@@ -4,6 +4,7 @@ class TestValAxis < Test::Unit::TestCase
def setup
@axis = Axlsx::ValAxis.new
end
+
def teardown
end
diff --git a/test/drawing/tc_vml_shape.rb b/test/drawing/tc_vml_shape.rb
index 94ad6e9f..d8f10b56 100644
--- a/test/drawing/tc_vml_shape.rb
+++ b/test/drawing/tc_vml_shape.rb
@@ -84,12 +84,14 @@ class TestVmlShape < Test::Unit::TestCase
assert(shape.top_row == 3)
assert_raise(ArgumentError) { shape.top_row = [] }
end
+
def test_visible
shape = @comments.first.vml_shape
shape.visible = false
assert(shape.visible == false)
assert_raise(ArgumentError) { shape.visible = 'foo' }
end
+
def test_to_xml_string
str = @comments.vml_drawing.to_xml_string()
doc = Nokogiri::XML(str)
diff --git a/test/stylesheet/tc_border.rb b/test/stylesheet/tc_border.rb
index ae191dd0..c2fb0d98 100644
--- a/test/stylesheet/tc_border.rb
+++ b/test/stylesheet/tc_border.rb
@@ -4,8 +4,10 @@ class TestBorder < Test::Unit::TestCase
def setup
@b = Axlsx::Border.new
end
+
def teardown
end
+
def test_initialiation
assert_equal(@b.diagonalUp, nil)
assert_equal(@b.diagonalDown, nil)
diff --git a/test/stylesheet/tc_border_pr.rb b/test/stylesheet/tc_border_pr.rb
index dc0fa9da..1e1c1dcc 100644
--- a/test/stylesheet/tc_border_pr.rb
+++ b/test/stylesheet/tc_border_pr.rb
@@ -4,8 +4,10 @@ class TestBorderPr < Test::Unit::TestCase
def setup
@bpr = Axlsx::BorderPr.new
end
+
def teardown
end
+
def test_initialiation
assert_equal(@bpr.color, nil)
assert_equal(@bpr.style, nil)
diff --git a/test/stylesheet/tc_font.rb b/test/stylesheet/tc_font.rb
index 58f84b08..106cfce5 100644
--- a/test/stylesheet/tc_font.rb
+++ b/test/stylesheet/tc_font.rb
@@ -31,6 +31,7 @@ class TestFont < Test::Unit::TestCase
assert_nothing_raised { @item.name = "bob" }
assert_equal(@item.name, "bob")
end
+
# def charset=(v) Axlsx::validate_unsigned_int v; @charset = v end
def test_charset
assert_raise(ArgumentError) { @item.charset = -7 }
diff --git a/test/stylesheet/tc_styles.rb b/test/stylesheet/tc_styles.rb
index 9c7d56c9..37dc4fb4 100644
--- a/test/stylesheet/tc_styles.rb
+++ b/test/stylesheet/tc_styles.rb
@@ -4,6 +4,7 @@ class TestStyles < Test::Unit::TestCase
def setup
@styles = Axlsx::Styles.new
end
+
def teardown
end
diff --git a/test/tc_axlsx.rb b/test/tc_axlsx.rb
index 89aaea5f..e9ea0be6 100644
--- a/test/tc_axlsx.rb
+++ b/test/tc_axlsx.rb
@@ -32,6 +32,7 @@ class TestAxlsx < Test::Unit::TestCase
Axlsx.trust_input = old
end
+
def test_cell_range_relative
p = Axlsx::Package.new
ws = p.workbook.add_worksheet
diff --git a/test/util/tc_validators.rb b/test/util/tc_validators.rb
index d6936496..26fb2a89 100644
--- a/test/util/tc_validators.rb
+++ b/test/util/tc_validators.rb
@@ -2,6 +2,7 @@ require 'tc_helper.rb'
class TestValidators < Test::Unit::TestCase
def setup
end
+
def teardown
end
@@ -187,6 +188,7 @@ class TestValidators < Test::Unit::TestCase
assert_raise(ArgumentError) { Axlsx.validate_integerish Axlsx }
[1, 1.4, "a"].each { |test_value| assert_nothing_raised { Axlsx.validate_integerish test_value } }
end
+
def test_validate_family
assert_raise(ArgumentError) { Axlsx.validate_family 0 }
(1..5).each do |item|
diff --git a/test/workbook/worksheet/tc_color_scale.rb b/test/workbook/worksheet/tc_color_scale.rb
index a0d75fab..56afe338 100644
--- a/test/workbook/worksheet/tc_color_scale.rb
+++ b/test/workbook/worksheet/tc_color_scale.rb
@@ -16,6 +16,7 @@ class TestColorScale < Test::Unit::TestCase
assert_equal 2, color_scale.value_objects.size
assert_equal 2, color_scale.colors.size
end
+
def test_default_cfvo
first = Axlsx::ColorScale.default_cfvos.first
second = Axlsx::ColorScale.default_cfvos.last
diff --git a/test/workbook/worksheet/tc_comment.rb b/test/workbook/worksheet/tc_comment.rb
index b736e5c5..b495c0bb 100644
--- a/test/workbook/worksheet/tc_comment.rb
+++ b/test/workbook/worksheet/tc_comment.rb
@@ -32,6 +32,7 @@ class TestComment < Test::Unit::TestCase
assert_equal(false, @c1.visible)
assert_equal(true, @c2.visible)
end
+
def test_ref
assert(@c1.ref == 'A1')
assert(@c2.ref == 'C3')
diff --git a/test/workbook/worksheet/tc_comments.rb b/test/workbook/worksheet/tc_comments.rb
index 68b3ac71..6b07b465 100644
--- a/test/workbook/worksheet/tc_comments.rb
+++ b/test/workbook/worksheet/tc_comments.rb
@@ -23,6 +23,7 @@ class TestComments < Test::Unit::TestCase
assert_nothing_raised { @ws.comments.add_comment(:author => 'bob', :text => 'Yes We Can', :ref => 'A1') }
assert_equal(@ws.comments.size, 3)
end
+
def test_authors
assert_equal(@ws.comments.authors.size, @ws.comments.size)
@ws.add_comment(:text => 'Yes We Can!', :author => 'bob', :ref => 'F1')
@@ -30,6 +31,7 @@ class TestComments < Test::Unit::TestCase
@ws.add_comment(:text => 'Yes We Can!', :author => 'bob', :ref => 'F1')
assert_equal(@ws.comments.authors.size, 3, 'only unique authors are returned')
end
+
def test_pn
assert_equal(@ws.comments.pn, Axlsx::COMMENT_PN % (@ws.index+1).to_s)
end
diff --git a/test/workbook/worksheet/tc_conditional_formatting.rb b/test/workbook/worksheet/tc_conditional_formatting.rb
index d7da55e0..d9652ebf 100644
--- a/test/workbook/worksheet/tc_conditional_formatting.rb
+++ b/test/workbook/worksheet/tc_conditional_formatting.rb
@@ -15,6 +15,7 @@ class TestConditionalFormatting < Test::Unit::TestCase
assert_equal("AA1:AB100", optioned.sqref)
assert_equal([1, 2], optioned.rules)
end
+
def test_add_as_rule
color_scale = Axlsx::ColorScale.new do |cs|
diff --git a/test/workbook/worksheet/tc_pane.rb b/test/workbook/worksheet/tc_pane.rb
index c3998bd4..d5f05933 100644
--- a/test/workbook/worksheet/tc_pane.rb
+++ b/test/workbook/worksheet/tc_pane.rb
@@ -44,6 +44,7 @@ class TestPane < Test::Unit::TestCase
doc = Nokogiri::XML.parse(@pane.to_xml_string)
assert_equal(1, doc.xpath("//pane[@ySplit=2][@xSplit='2'][@topLeftCell='A2'][@state='frozen'][@activePane='bottomLeft']").size)
end
+
def test_to_xml_frozen
pane = Axlsx::Pane.new :state => :frozen, :y_split => 2
doc = Nokogiri::XML(pane.to_xml_string)
diff --git a/test/workbook/worksheet/tc_sheet_format_pr.rb b/test/workbook/worksheet/tc_sheet_format_pr.rb
index b7d7b929..ec98988b 100644
--- a/test/workbook/worksheet/tc_sheet_format_pr.rb
+++ b/test/workbook/worksheet/tc_sheet_format_pr.rb
@@ -63,10 +63,12 @@ class TestSheetFormatPr < Test::Unit::TestCase
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_nothing_raised { @sheet_format_pr.thick_top = true }
end
+
def test_thick_bottom
assert_raise(ArgumentError) { @sheet_format_pr.thick_bottom= :foo }
assert_nothing_raised { @sheet_format_pr.thick_bottom = true }
diff --git a/test/workbook/worksheet/tc_table_style_info.rb b/test/workbook/worksheet/tc_table_style_info.rb
index 276f7aa4..9ba03ea7 100644
--- a/test/workbook/worksheet/tc_table_style_info.rb
+++ b/test/workbook/worksheet/tc_table_style_info.rb
@@ -30,6 +30,7 @@ class TestTableStyleInfo < Test::Unit::TestCase
assert_raises(ArgumentError) { table_style.send(key.to_sym, 'foo') }
end
end
+
def doc
@doc ||= Nokogiri::XML(Axlsx::TableStyleInfo.new(@options).to_xml_string)
end
diff --git a/test/workbook/worksheet/tc_worksheet.rb b/test/workbook/worksheet/tc_worksheet.rb
index e914f320..72fdf556 100644
--- a/test/workbook/worksheet/tc_worksheet.rb
+++ b/test/workbook/worksheet/tc_worksheet.rb
@@ -438,6 +438,7 @@ class TestWorksheet < Test::Unit::TestCase
assert_equal("foo\n\r\nbar", @ws.rows.last.cells.last.value)
assert_not_nil(@ws.to_xml_string.index("foo\n\r\nbar"))
end
+
# Make sure the XML for all optional elements (like pageMargins, autoFilter, ...)
# is generated in correct order.
def test_valid_with_optional_elements
diff --git a/test/workbook/worksheet/tc_worksheet_hyperlink.rb b/test/workbook/worksheet/tc_worksheet_hyperlink.rb
index b456694d..f64dc6b1 100644
--- a/test/workbook/worksheet/tc_worksheet_hyperlink.rb
+++ b/test/workbook/worksheet/tc_worksheet_hyperlink.rb
@@ -29,6 +29,7 @@ class TestWorksheetHyperlink < Test::Unit::TestCase
def test_display
assert_equal(@options[:display], @a.display)
end
+
def test_ref
assert_equal(@options[:ref], @a.ref)
end