summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGeremia Taglialatela <[email protected]>2023-04-05 17:17:07 +0200
committerGeremia Taglialatela <[email protected]>2023-04-06 09:54:44 +0200
commit7e90a46d43fefcf5ff7c76c14b29b6998245cfc5 (patch)
tree0562b39547ee41e86504bf661390ce0d571ff066 /test
parente9496a58dbf17d4b9bb615f3cb630f1e32574ece (diff)
downloadcaxlsx-7e90a46d43fefcf5ff7c76c14b29b6998245cfc5.tar.gz
caxlsx-7e90a46d43fefcf5ff7c76c14b29b6998245cfc5.zip
Remove Layout/TrailingWhitespace offenses
``` rubocop --only Layout/TrailingWhitespace -a ```
Diffstat (limited to 'test')
-rw-r--r--test/doc_props/tc_app.rb2
-rw-r--r--test/drawing/tc_axis.rb6
-rw-r--r--test/drawing/tc_d_lbls.rb18
-rw-r--r--test/drawing/tc_num_data.rb6
-rw-r--r--test/rels/tc_relationship.rb10
-rw-r--r--test/rels/tc_relationships.rb4
-rw-r--r--test/stylesheet/tc_dxf.rb10
-rw-r--r--test/stylesheet/tc_pattern_fill.rb4
-rw-r--r--test/stylesheet/tc_styles.rb6
-rw-r--r--test/stylesheet/tc_table_style_element.rb2
-rw-r--r--test/tc_axlsx.rb4
-rw-r--r--test/util/tc_simple_typed_list.rb2
-rw-r--r--test/workbook/worksheet/auto_filter/tc_filter_column.rb14
-rw-r--r--test/workbook/worksheet/auto_filter/tc_filters.rb10
-rw-r--r--test/workbook/worksheet/tc_comments.rb2
-rw-r--r--test/workbook/worksheet/tc_data_validation.rb110
-rw-r--r--test/workbook/worksheet/tc_outline_pr.rb2
-rw-r--r--test/workbook/worksheet/tc_pane.rb10
-rw-r--r--test/workbook/worksheet/tc_pivot_table.rb4
-rw-r--r--test/workbook/worksheet/tc_rich_text.rb4
-rw-r--r--test/workbook/worksheet/tc_row.rb4
-rw-r--r--test/workbook/worksheet/tc_sheet_protection.rb8
-rw-r--r--test/workbook/worksheet/tc_table_style_info.rb2
-rw-r--r--test/workbook/worksheet/tc_worksheet.rb14
-rw-r--r--test/workbook/worksheet/tc_worksheet_hyperlink.rb2
25 files changed, 130 insertions, 130 deletions
diff --git a/test/doc_props/tc_app.rb b/test/doc_props/tc_app.rb
index ec862c37..31ab3733 100644
--- a/test/doc_props/tc_app.rb
+++ b/test/doc_props/tc_app.rb
@@ -22,7 +22,7 @@ class TestApp < Test::Unit::TestCase
:'CharactersWithSpaces' => 9,
:'SharedDoc' => false,
:'HyperlinkBase' => 'foo',
- :'HyperlInksChanged' => false,
+ :'HyperlInksChanged' => false,
:'Application' => 'axlsx',
:'AppVersion' => '1.1.5',
:'DocSecurity' => 0
diff --git a/test/drawing/tc_axis.rb b/test/drawing/tc_axis.rb
index 5a9fa5a3..71e5b6b2 100644
--- a/test/drawing/tc_axis.rb
+++ b/test/drawing/tc_axis.rb
@@ -20,7 +20,7 @@ class TestAxis < Test::Unit::TestCase
@axis.cross_axis = Axlsx::CatAxis.new
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))
+ doc = Nokogiri::XML(@axis.to_xml_string(str))
assert(doc.xpath("//a:srgbClr[@val='00FF00']"))
end
@@ -97,12 +97,12 @@ class TestAxis < Test::Unit::TestCase
assert_raise(ArgumentError, "requires valid gridlines") { @axis.gridlines = 'alice' }
assert_nothing_raised("accepts valid crosses") { @axis.gridlines = false }
end
-
+
def test_to_xml_string
@axis.cross_axis = Axlsx::CatAxis.new
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))
+ 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}']"))
diff --git a/test/drawing/tc_d_lbls.rb b/test/drawing/tc_d_lbls.rb
index dddde3a1..d5474131 100644
--- a/test/drawing/tc_d_lbls.rb
+++ b/test/drawing/tc_d_lbls.rb
@@ -4,12 +4,12 @@ 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,
+ @boolean_attributes =[:show_legend_key,
+ :show_val,
+ :show_cat_name,
+ :show_ser_name,
+ :show_percent,
+ :show_bubble_size,
:show_leader_lines]
end
@@ -21,11 +21,11 @@ class TestDLbls < Test::Unit::TestCase
end
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 }))
-
+
@boolean_attributes.each do |attr|
assert_equal(true, d_lbls.send(attr), "boolean attributes set by options")
end
@@ -47,7 +47,7 @@ class TestDLbls < Test::Unit::TestCase
def test_to_xml_string
str = '<?xml version="1.0" encoding="UTF-8"?>'
str << '<c:chartSpace xmlns:c="' << Axlsx::XML_NS_C << '" xmlns:a="' << Axlsx::XML_NS_A << '" xmlns:r="' << Axlsx::XML_NS_R << '">'
- @d_lbls.to_xml_string(str)
+ @d_lbls.to_xml_string(str)
str << '</c:chartSpace>'
doc = Nokogiri::XML(str)
Axlsx.instance_values_for(@d_lbls).each do |name, value|
diff --git a/test/drawing/tc_num_data.rb b/test/drawing/tc_num_data.rb
index 2549af4d..f2ac64b8 100644
--- a/test/drawing/tc_num_data.rb
+++ b/test/drawing/tc_num_data.rb
@@ -9,11 +9,11 @@ class TestNumData < Test::Unit::TestCase
def test_initialize
assert_equal(@num_data.format_code, "General")
end
-
+
def test_formula_based_cell
-
+
end
-
+
def test_format_code
assert_raise(ArgumentError) {@num_data.format_code = 7}
assert_nothing_raised {@num_data.format_code = 'foo_bar'}
diff --git a/test/rels/tc_relationship.rb b/test/rels/tc_relationship.rb
index f47b6a4d..b9674a19 100644
--- a/test/rels/tc_relationship.rb
+++ b/test/rels/tc_relationship.rb
@@ -1,13 +1,13 @@
require 'tc_helper.rb'
class TestRelationships < Test::Unit::TestCase
-
+
def test_instances_with_different_attributes_have_unique_ids
rel_1 = Axlsx::Relationship.new(Object.new, Axlsx::WORKSHEET_R, 'target')
rel_2 = Axlsx::Relationship.new(Object.new, Axlsx::COMMENT_R, 'foobar')
assert_not_equal rel_1.Id, rel_2.Id
end
-
+
def test_instances_with_same_attributes_share_id
source_obj = Object.new
instance = Axlsx::Relationship.new(source_obj, Axlsx::WORKSHEET_R, 'target')
@@ -21,18 +21,18 @@ class TestRelationships < Test::Unit::TestCase
[t1, t2].each(&:join)
assert_not_same(cache1, cache2)
end
-
+
def test_target_is_only_considered_for_same_attributes_check_if_target_mode_is_external
source_obj = Object.new
rel_1 = Axlsx::Relationship.new(source_obj, Axlsx::WORKSHEET_R, 'target')
rel_2 = Axlsx::Relationship.new(source_obj, Axlsx::WORKSHEET_R, '../target')
assert_equal rel_1.Id, rel_2.Id
-
+
rel_3 = Axlsx::Relationship.new(source_obj, Axlsx::HYPERLINK_R, 'target', :target_mode => :External)
rel_4 = Axlsx::Relationship.new(source_obj, Axlsx::HYPERLINK_R, '../target', :target_mode => :External)
assert_not_equal rel_3.Id, rel_4.Id
end
-
+
def test_type
assert_raise(ArgumentError) { Axlsx::Relationship.new nil, 'type', 'target' }
assert_nothing_raised { Axlsx::Relationship.new nil, Axlsx::WORKSHEET_R, 'target' }
diff --git a/test/rels/tc_relationships.rb b/test/rels/tc_relationships.rb
index fe5a1ce5..768570b1 100644
--- a/test/rels/tc_relationships.rb
+++ b/test/rels/tc_relationships.rb
@@ -7,12 +7,12 @@ class TestRelationships < Test::Unit::TestCase
rel_1 = Axlsx::Relationship.new(source_obj_1, Axlsx::WORKSHEET_R, "bar")
rel_2 = Axlsx::Relationship.new(source_obj_2, Axlsx::WORKSHEET_R, "bar")
rels = Axlsx::Relationships.new
- rels << rel_1
+ rels << rel_1
rels << rel_2
assert_equal rel_1, rels.for(source_obj_1)
assert_equal rel_2, rels.for(source_obj_2)
end
-
+
def test_valid_document
@rels = Axlsx::Relationships.new
schema = Nokogiri::XML::Schema(File.open(Axlsx::RELS_XSD))
diff --git a/test/stylesheet/tc_dxf.rb b/test/stylesheet/tc_dxf.rb
index e94a1614..eb5c4014 100644
--- a/test/stylesheet/tc_dxf.rb
+++ b/test/stylesheet/tc_dxf.rb
@@ -4,7 +4,7 @@ class TestDxf < Test::Unit::TestCase
def setup
@item = Axlsx::Dxf.new
- @styles = Axlsx::Styles.new
+ @styles = Axlsx::Styles.new
end
def teardown
@@ -46,7 +46,7 @@ class TestDxf < Test::Unit::TestCase
def test_font
assert_raise(ArgumentError) { @item.font = 1 }
assert_nothing_raised { @item.font = Axlsx::Font.new }
- assert @item.font.is_a? Axlsx::Font
+ assert @item.font.is_a? Axlsx::Font
end
def test_border
@@ -59,7 +59,7 @@ class TestDxf < Test::Unit::TestCase
@item.border = Axlsx::Border.new
doc = Nokogiri::XML.parse(@item.to_xml_string)
assert_equal(1, doc.xpath(".//dxf//border").size)
- assert_equal(0, doc.xpath(".//dxf//font").size)
+ assert_equal(0, doc.xpath(".//dxf//font").size)
end
def test_many_options_xml
@@ -69,13 +69,13 @@ class TestDxf < Test::Unit::TestCase
@item.font = Axlsx::Font.new
@item.protection = Axlsx::CellProtection.new
@item.numFmt = Axlsx::NumFmt.new
-
+
doc = Nokogiri::XML.parse(@item.to_xml_string)
assert_equal(1, doc.xpath(".//dxf//fill//patternFill[@patternType='solid']//fgColor[@rgb='FF000000']").size)
assert_equal(1, doc.xpath(".//dxf//font").size)
assert_equal(1, doc.xpath(".//dxf//protection").size)
assert_equal(1, doc.xpath(".//dxf//numFmt[@numFmtId='0'][@formatCode='']").size)
assert_equal(1, doc.xpath(".//dxf//alignment").size)
- assert_equal(1, doc.xpath(".//dxf//border").size)
+ assert_equal(1, doc.xpath(".//dxf//border").size)
end
end
diff --git a/test/stylesheet/tc_pattern_fill.rb b/test/stylesheet/tc_pattern_fill.rb
index 3895cffb..fef28248 100644
--- a/test/stylesheet/tc_pattern_fill.rb
+++ b/test/stylesheet/tc_pattern_fill.rb
@@ -33,9 +33,9 @@ class TestPatternFill < Test::Unit::TestCase
assert_nothing_raised { @item.patternType = :lightUp }
assert_equal(@item.patternType, :lightUp)
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 503068c0..b9ccfebd 100644
--- a/test/stylesheet/tc_styles.rb
+++ b/test/stylesheet/tc_styles.rb
@@ -44,7 +44,7 @@ class TestStyles < Test::Unit::TestCase
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 }
@@ -289,7 +289,7 @@ class TestStyles < Test::Unit::TestCase
def test_border_top_without_border_regression
### https://github.com/axlsx-styler-gem/axlsx_styler/issues/31
-
+
borders = {
top: { style: :double, color: '0000FF' },
right: { style: :thick, color: 'FF0000' },
@@ -305,6 +305,6 @@ class TestStyles < Test::Unit::TestCase
border_pr = current_border.prs.detect{|x| x.name == edge }
assert_equal(border_pr.color.rgb, "FF#{b_opts[:color]}")
end
-
+
end
end
diff --git a/test/stylesheet/tc_table_style_element.rb b/test/stylesheet/tc_table_style_element.rb
index 9ef54e2f..554636eb 100644
--- a/test/stylesheet/tc_table_style_element.rb
+++ b/test/stylesheet/tc_table_style_element.rb
@@ -36,7 +36,7 @@ class TestTableStyleElement < Test::Unit::TestCase
assert_nothing_raised { @item.dxfId = 7 }
assert_equal(@item.dxfId, 7)
end
-
+
def test_to_xml_string
doc = Nokogiri::XML(@item.to_xml_string)
@item.type = :headerRow
diff --git a/test/tc_axlsx.rb b/test/tc_axlsx.rb
index 3903fc42..35fd5ea5 100644
--- a/test/tc_axlsx.rb
+++ b/test/tc_axlsx.rb
@@ -106,7 +106,7 @@ class TestAxlsx < Test::Unit::TestCase
assert_equal(sanitized_str, legit_str, 'should preserve value')
assert_equal(sanitized_str.object_id, legit_str.object_id, 'should preserve object')
end
-
+
class InstanceValuesSubject
def initialize(args={})
args.each do |key, v|
@@ -130,7 +130,7 @@ class TestAxlsx < Test::Unit::TestCase
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
diff --git a/test/util/tc_simple_typed_list.rb b/test/util/tc_simple_typed_list.rb
index 72bd6246..88e75a1c 100644
--- a/test/util/tc_simple_typed_list.rb
+++ b/test/util/tc_simple_typed_list.rb
@@ -61,7 +61,7 @@ class TestSimpleTypedList < Test::Unit::TestCase
assert_nothing_raised { @list.delete 0 }
assert_nothing_raised { @list.delete 9 }
end
-
+
def test_delete
@list.push 1
assert(@list.size == 1)
diff --git a/test/workbook/worksheet/auto_filter/tc_filter_column.rb b/test/workbook/worksheet/auto_filter/tc_filter_column.rb
index ec74316c..60b726a6 100644
--- a/test/workbook/worksheet/auto_filter/tc_filter_column.rb
+++ b/test/workbook/worksheet/auto_filter/tc_filter_column.rb
@@ -10,10 +10,10 @@ class TestFilterColumn < Test::Unit::TestCase
def test_initialize_col_id
assert_raise ArgumentError do
Axlsx::FilterColumn.new(0, :bobs_house_of_filter)
- end
- assert_raise ArgumentError do
+ end
+ assert_raise ArgumentError do
Axlsx::FilterColumn.new(:penut, :filters)
- end
+ end
end
def test_initailize_filter_type
@@ -44,7 +44,7 @@ class TestFilterColumn < Test::Unit::TestCase
def test_show_button
assert_raise ArgumentError do
- @filter_column.show_button = :foo
+ @filter_column.show_button = :foo
end
assert_nothing_raised { @filter_column.show_button = false }
end
@@ -52,14 +52,14 @@ class TestFilterColumn < Test::Unit::TestCase
def test_hidden_button
assert_raise ArgumentError do
@filter_column.hidden_button = :hoge
- end
+ end
assert_nothing_raised { @filter_column.hidden_button = true }
end
def test_col_id=
- assert_raise ArgumentError do
+ assert_raise ArgumentError do
@filter_column.col_id = :bar
- end
+ end
assert_nothing_raised { @filter_column.col_id = 7 }
end
diff --git a/test/workbook/worksheet/auto_filter/tc_filters.rb b/test/workbook/worksheet/auto_filter/tc_filters.rb
index 3a8759aa..dc0e985c 100644
--- a/test/workbook/worksheet/auto_filter/tc_filters.rb
+++ b/test/workbook/worksheet/auto_filter/tc_filters.rb
@@ -2,8 +2,8 @@ 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 } ] ,
+ @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 } ] ,
:blank => true)
end
@@ -29,15 +29,15 @@ class TestFilters < Test::Unit::TestCase
assert @filters.date_group_items.is_a?(Array)
assert_equal 1, @filters.date_group_items.size
end
-
+
def test_apply_is_false_for_matching_values
keeper = Object.new
- def keeper.value; 'a'; end
+ def keeper.value; 'a'; end
assert_equal false, @filters.apply(keeper)
end
def test_apply_is_true_for_non_matching_values
- hidden = Object.new
+ hidden = Object.new
def hidden.value; 'b'; end
assert_equal true, @filters.apply(hidden)
end
diff --git a/test/workbook/worksheet/tc_comments.rb b/test/workbook/worksheet/tc_comments.rb
index acadf73d..91fb49a2 100644
--- a/test/workbook/worksheet/tc_comments.rb
+++ b/test/workbook/worksheet/tc_comments.rb
@@ -28,7 +28,7 @@ class TestComments < Test::Unit::TestCase
@ws.add_comment(:text => 'Yes We Can!', :author => 'bob', :ref => 'F1')
assert_equal(@ws.comments.authors.size, 3)
@ws.add_comment(:text => 'Yes We Can!', :author => 'bob', :ref => 'F1')
- assert_equal(@ws.comments.authors.size, 3, 'only unique authors are returned')
+ 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)
diff --git a/test/workbook/worksheet/tc_data_validation.rb b/test/workbook/worksheet/tc_data_validation.rb
index 12fee6ef..3263371a 100644
--- a/test/workbook/worksheet/tc_data_validation.rb
+++ b/test/workbook/worksheet/tc_data_validation.rb
@@ -11,114 +11,114 @@ class TestDataValidation < Test::Unit::TestCase
@nil_options = { :formula1 => 'foo', :formula2 => 'foo', :errorTitle => 'foo', :operator => :lessThan, :prompt => 'foo', :promptTitle => 'foo', :sqref => 'foo' }
@type_option = { :type => :whole }
@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}
-
+
@options = @boolean_options.merge(@nil_options).merge(@type_option).merge(@error_style_option)
-
+
@dv = Axlsx::DataValidation.new(@options)
end
-
+
def test_initialize
dv = Axlsx::DataValidation.new
-
+
@boolean_options.each do |key, value|
assert_equal(!value, dv.send(key.to_sym), "initialized default #{key} should be #{!value}")
assert_equal(value, @dv.send(key.to_sym), "initialized options #{key} should be #{value}")
end
-
+
@nil_options.each do |key, value|
assert_equal(nil, dv.send(key.to_sym), "initialized default #{key} should be nil")
assert_equal(value, @dv.send(key.to_sym), "initialized options #{key} should be #{value}")
end
-
+
@type_option.each do |key, value|
assert_equal(:none, dv.send(key.to_sym), "initialized default #{key} should be :none")
assert_equal(value, @dv.send(key.to_sym), "initialized options #{key} should be #{value}")
end
-
+
@error_style_option.each do |key, value|
assert_equal(:stop, dv.send(key.to_sym), "initialized default #{key} should be :stop")
assert_equal(value, @dv.send(key.to_sym), "initialized options #{key} should be #{value}")
end
end
-
+
def test_boolean_attribute_validation
@boolean_options.each do |key, value|
assert_raise(ArgumentError, "#{key} must be boolean") { @dv.send("#{key}=".to_sym, 'A') }
assert_nothing_raised { @dv.send("#{key}=".to_sym, true) }
end
end
-
+
def test_string_attribute_validation
@string_options.each do |key, value|
assert_raise(ArgumentError, "#{key} must be string") { @dv.send("#{key}=".to_sym, :symbol) }
assert_nothing_raised { @dv.send("#{key}=".to_sym, "foo") }
end
end
-
+
def test_symbol_attribute_validation
@symbol_options.each do |key, value|
assert_raise(ArgumentError, "#{key} must be symbol") { @dv.send("#{key}=".to_sym, "foo") }
assert_nothing_raised { @dv.send("#{key}=".to_sym, value) }
end
end
-
+
def test_formula1
assert_raise(ArgumentError) { @dv.formula1 = 10 }
assert_nothing_raised { @dv.formula1 = "=SUM(A1:A1)" }
assert_equal(@dv.formula1, "=SUM(A1:A1)")
end
-
+
def test_formula2
assert_raise(ArgumentError) { @dv.formula2 = 10 }
assert_nothing_raised { @dv.formula2 = "=SUM(A1:A1)" }
assert_equal(@dv.formula2, "=SUM(A1:A1)")
end
-
+
def test_allowBlank
assert_raise(ArgumentError) { @dv.allowBlank = "foo´" }
assert_nothing_raised { @dv.allowBlank = false }
assert_equal(@dv.allowBlank, false)
end
-
+
def test_error
assert_raise(ArgumentError) { @dv.error = :symbol }
assert_nothing_raised { @dv.error = "This is a error message" }
assert_equal(@dv.error, "This is a error message")
end
-
+
def test_errorStyle
assert_raise(ArgumentError) { @dv.errorStyle = "foo" }
assert_nothing_raised { @dv.errorStyle = :information }
assert_equal(@dv.errorStyle, :information)
end
-
+
def test_errorTitle
assert_raise(ArgumentError) { @dv.errorTitle = :symbol }
assert_nothing_raised { @dv.errorTitle = "This is the error title" }
assert_equal(@dv.errorTitle, "This is the error title")
end
-
+
def test_operator
assert_raise(ArgumentError) { @dv.operator = "foo" }
assert_nothing_raised { @dv.operator = :greaterThan }
assert_equal(@dv.operator, :greaterThan)
end
-
+
def test_prompt
assert_raise(ArgumentError) { @dv.prompt = :symbol }
assert_nothing_raised { @dv.prompt = "This is a prompt message" }
assert_equal(@dv.prompt, "This is a prompt message")
end
-
+
def test_promptTitle
assert_raise(ArgumentError) { @dv.promptTitle = :symbol }
assert_nothing_raised { @dv.promptTitle = "This is the prompt title" }
assert_equal(@dv.promptTitle, "This is the prompt title")
end
-
+
def test_showDropDown
warnings = capture_warnings do
assert_raise(ArgumentError) { @dv.showDropDown = "foo´" }
@@ -137,41 +137,41 @@ class TestDataValidation < Test::Unit::TestCase
# As hideDropdown is just an alias for showDropDown, we should test the original value too
assert_equal(@dv.showDropDown, false)
end
-
+
def test_showErrorMessage
assert_raise(ArgumentError) { @dv.showErrorMessage = "foo´" }
assert_nothing_raised { @dv.showErrorMessage = false }
assert_equal(@dv.showErrorMessage, false)
end
-
+
def test_showInputMessage
assert_raise(ArgumentError) { @dv.showInputMessage = "foo´" }
assert_nothing_raised { @dv.showInputMessage = false }
assert_equal(@dv.showInputMessage, false)
end
-
+
def test_sqref
assert_raise(ArgumentError) { @dv.sqref = 10 }
assert_nothing_raised { @dv.sqref = "A1:A1" }
assert_equal(@dv.sqref, "A1:A1")
end
-
+
def test_type
assert_raise(ArgumentError) { @dv.type = "foo" }
assert_nothing_raised { @dv.type = :list }
assert_equal(@dv.type, :list)
end
-
+
def test_whole_decimal_data_time_textLength_to_xml
p = Axlsx::Package.new
@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!',
+ @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'})
-
+
doc = Nokogiri::XML.parse(@ws.to_xml_string)
-
+
#test attributes
assert_equal(1, doc.xpath("//xmlns:worksheet/xmlns:dataValidations[@count='1']/xmlns:dataValidation[@sqref='A1']
[@promptTitle='Be carful!'][@prompt='Only values between 5 and 10'][@operator='between'][@errorTitle='Wrong input']
@@ -181,26 +181,26 @@ class TestDataValidation < Test::Unit::TestCase
[@promptTitle='Be carful!'][@prompt='Only values between 5 and 10'][@operator='between'][@errorTitle='Wrong input']
[@error='Only values between 5 and 10'][@showErrorMessage=1][@allowBlank=1][@showInputMessage=1]
[@type='whole'][@errorStyle='information']")
-
+
#test forumula1
assert_equal(1, doc.xpath("//xmlns:worksheet/xmlns:dataValidations/xmlns:dataValidation/xmlns:formula1").size)
assert doc.xpath("//xmlns:worksheet/xmlns:dataValidations/xmlns:dataValidation/xmlns:formula1='5'")
-
+
#test forumula2
assert_equal(1, doc.xpath("//xmlns:worksheet/xmlns:dataValidations/xmlns:dataValidation/xmlns:formula2").size)
assert doc.xpath("//xmlns:worksheet/xmlns:dataValidations/xmlns:dataValidation/xmlns:formula2='10'")
end
-
+
def test_list_to_xml
p = Axlsx::Package.new
@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!',
+ :showErrorMessage => true, :errorTitle => 'Wrong input', :error => 'Only values from list',
+ :errorStyle => :stop, :showInputMessage => true, :promptTitle => 'Be carful!',
:prompt => 'Only values from list', :hideDropDown => true})
-
+
doc = Nokogiri::XML.parse(@ws.to_xml_string)
-
+
#test attributes
assert_equal(1, doc.xpath("//xmlns:worksheet/xmlns:dataValidations[@count='1']/xmlns:dataValidation[@sqref='A1']
[@promptTitle='Be carful!'][@prompt='Only values from list'][@errorTitle='Wrong input'][@error='Only values from list']
@@ -209,22 +209,22 @@ class TestDataValidation < Test::Unit::TestCase
assert doc.xpath("//xmlns:worksheet/xmlns:dataValidations[@count='1']/xmlns:dataValidation[@sqref='A1']
[@promptTitle='Be carful!'][@prompt='Only values from list'][@errorTitle='Wrong input'][@error='Only values from list']
[@showErrorMessage=1][@allowBlank=1][@showInputMessage=1][@showDropDown=1][@type='list'][@errorStyle='stop']")
-
+
#test forumula1
assert_equal(1, doc.xpath("//xmlns:worksheet/xmlns:dataValidations/xmlns:dataValidation/xmlns:formula1").size)
assert doc.xpath("//xmlns:worksheet/xmlns:dataValidations/xmlns:dataValidation/xmlns:formula1='A1:A5'")
end
-
+
def test_custom_to_xml
p = Axlsx::Package.new
@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!',
+ :showErrorMessage => true, :errorTitle => 'Wrong input', :error => 'Only values corresponding formula',
+ :errorStyle => :stop, :showInputMessage => true, :promptTitle => 'Be carful!',
:prompt => 'Only values corresponding formula'})
-
+
doc = Nokogiri::XML.parse(@ws.to_xml_string)
-
+
#test attributes
assert_equal(1, doc.xpath("//xmlns:worksheet/xmlns:dataValidations[@count='1']/xmlns:dataValidation[@sqref='A1'][@promptTitle='Be carful!']
[@prompt='Only values corresponding formula'][@errorTitle='Wrong input'][@error='Only values corresponding formula'][@showErrorMessage=1]
@@ -232,26 +232,26 @@ class TestDataValidation < Test::Unit::TestCase
assert doc.xpath("//xmlns:worksheet/xmlns:dataValidations[@count='1']/xmlns:dataValidation[@sqref='A1'][@promptTitle='Be carful!']
[@prompt='Only values corresponding formula'][@errorTitle='Wrong input'][@error='Only values corresponding formula']
[@showErrorMessage=1][@allowBlank=1][@showInputMessage=1][@type='custom'][@errorStyle='stop']")
-
+
#test forumula1
assert_equal(1, doc.xpath("//xmlns:worksheet/xmlns:dataValidations/xmlns:dataValidation/xmlns:formula1").size)
assert doc.xpath("//xmlns:worksheet/xmlns:dataValidations/xmlns:dataValidation/xmlns:formula1='=5/2'")
end
-
+
def test_multiple_datavalidations_to_xml
p = Axlsx::Package.new
@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!',
+ @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'})
@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!',
+ :showErrorMessage => true, :errorTitle => 'Wrong input', :error => 'Only values from list',
+ :errorStyle => :stop, :showInputMessage => true, :promptTitle => 'Be carful!',
:prompt => 'Only values from list', :hideDropDown => true})
-
+
doc = Nokogiri::XML.parse(@ws.to_xml_string)
-
+
#test attributes
assert_equal(1, doc.xpath("//xmlns:worksheet/xmlns:dataValidations[@count='2']/xmlns:dataValidation[@sqref='A1']
[@promptTitle='Be carful!'][@prompt='Only values between 5 and 10'][@operator='between'][@errorTitle='Wrong input']
@@ -261,7 +261,7 @@ class TestDataValidation < Test::Unit::TestCase
[@promptTitle='Be carful!'][@prompt='Only values between 5 and 10'][@operator='between'][@errorTitle='Wrong input']
[@error='Only values between 5 and 10'][@showErrorMessage=1][@allowBlank=1][@showInputMessage=1]
[@type='whole'][@errorStyle='information']")
-
+
#test attributes
assert_equal(1, doc.xpath("//xmlns:worksheet/xmlns:dataValidations[@count='2']/xmlns:dataValidation[@sqref='B1']
[@promptTitle='Be carful!'][@prompt='Only values from list'][@errorTitle='Wrong input'][@error='Only values from list']
@@ -271,7 +271,7 @@ class TestDataValidation < Test::Unit::TestCase
[@promptTitle='Be carful!'][@prompt='Only values from list'][@errorTitle='Wrong input'][@error='Only values from list']
[@showErrorMessage=1][@allowBlank=1][@showInputMessage=1][@showDropDown=1][@type='list'][@errorStyle='stop']")
end
-
+
def test_empty_attributes
v = Axlsx::DataValidation.new
assert_equal(nil, v.send(:get_valid_attributes))
diff --git a/test/workbook/worksheet/tc_outline_pr.rb b/test/workbook/worksheet/tc_outline_pr.rb
index 41a2b4ca..a40108b1 100644
--- a/test/workbook/worksheet/tc_outline_pr.rb
+++ b/test/workbook/worksheet/tc_outline_pr.rb
@@ -12,7 +12,7 @@ class TestOutlinePr < Test::Unit::TestCase
def test_summary_right
assert_equal true, @outline_pr.summary_right
end
-
+
def test_apply_styles
assert_equal false, @outline_pr.apply_styles
end
diff --git a/test/workbook/worksheet/tc_pane.rb b/test/workbook/worksheet/tc_pane.rb
index fff0bf7a..3b040778 100644
--- a/test/workbook/worksheet/tc_pane.rb
+++ b/test/workbook/worksheet/tc_pane.rb
@@ -17,31 +17,31 @@ class TestPane < Test::Unit::TestCase
assert_nothing_raised { @pane.active_pane = :top_left }
assert_equal(@pane.active_pane, "topLeft")
end
-
+
def test_state
assert_raise(ArgumentError) { @pane.state = "foo" }
assert_nothing_raised { @pane.state = :frozen_split }
assert_equal(@pane.state, "frozenSplit")
end
-
+
def test_x_split
assert_raise(ArgumentError) { @pane.x_split = "foo´" }
assert_nothing_raised { @pane.x_split = 200 }
assert_equal(@pane.x_split, 200)
end
-
+
def test_y_split
assert_raise(ArgumentError) { @pane.y_split = 'foo' }
assert_nothing_raised { @pane.y_split = 300 }
assert_equal(@pane.y_split, 300)
end
-
+
def test_top_left_cell
assert_raise(ArgumentError) { @pane.top_left_cell = :cell }
assert_nothing_raised { @pane.top_left_cell = "A2" }
assert_equal(@pane.top_left_cell, "A2")
end
-
+
def test_to_xml
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)
diff --git a/test/workbook/worksheet/tc_pivot_table.rb b/test/workbook/worksheet/tc_pivot_table.rb
index f676a72d..f01440ad 100644
--- a/test/workbook/worksheet/tc_pivot_table.rb
+++ b/test/workbook/worksheet/tc_pivot_table.rb
@@ -156,7 +156,7 @@ class TestPivotTable < Test::Unit::TestCase
def test_pivot_table_with_more_than_one_data_row
### https://github.com/caxlsx/caxlsx/issues/110
-
+
pivot_table = @ws.add_pivot_table('G5:G6', 'A1:E5') do |pt|
pt.rows = ["Date", "Name"]
pt.data = [
@@ -187,7 +187,7 @@ class TestPivotTable < Test::Unit::TestCase
def test_pivot_table_with_only_one_data_row
### https://github.com/caxlsx/caxlsx/issues/110
-
+
pivot_table = @ws.add_pivot_table('G5:G6', 'A1:E5') do |pt|
pt.rows = ["Date", "Name"]
pt.data = [
diff --git a/test/workbook/worksheet/tc_rich_text.rb b/test/workbook/worksheet/tc_rich_text.rb
index d79d3021..1bd3ec76 100644
--- a/test/workbook/worksheet/tc_rich_text.rb
+++ b/test/workbook/worksheet/tc_rich_text.rb
@@ -24,7 +24,7 @@ class RichText < Test::Unit::TestCase
row = @ws.add_row [rt_direct, rt_indirect]
assert_equal(row[0].to_xml_string(0,0), row[1].to_xml_string(0,0))
end
-
+
def test_textruns
runs = @rt.runs
assert_equal(runs.length, 27)
@@ -33,7 +33,7 @@ class RichText < Test::Unit::TestCase
assert_equal(runs[1].b, true)
assert_equal(runs[1].i, false)
end
-
+
def test_implicit_richtext
rt = Axlsx::RichText.new('a', :b => true)
row_rt = @ws.add_row [rt]
diff --git a/test/workbook/worksheet/tc_row.rb b/test/workbook/worksheet/tc_row.rb
index 38b13806..3d1a4d4d 100644
--- a/test/workbook/worksheet/tc_row.rb
+++ b/test/workbook/worksheet/tc_row.rb
@@ -140,7 +140,7 @@ class TestRow < Test::Unit::TestCase
offset = 3
values = [1,2,3,4,5]
r = @ws.add_row(values, offset: offset, style: 1)
- r.cells.each_with_index do |c, index|
+ r.cells.each_with_index do |c, index|
assert_equal(c.style, index < offset ? 0 : 1)
assert_equal(c.value, index < offset ? nil : values[index - offset])
end
@@ -151,7 +151,7 @@ class TestRow < Test::Unit::TestCase
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|
+ r.cells.each_with_index do |c, index|
assert_equal(c.style, index < offset ? 0 : styles[index-offset])
assert_equal(c.value, index < offset ? nil : values[index - offset])
end
diff --git a/test/workbook/worksheet/tc_sheet_protection.rb b/test/workbook/worksheet/tc_sheet_protection.rb
index 0595d2ec..6ca5dafd 100644
--- a/test/workbook/worksheet/tc_sheet_protection.rb
+++ b/test/workbook/worksheet/tc_sheet_protection.rb
@@ -20,7 +20,7 @@ require 'tc_helper.rb'
# <xsd:attribute name="selectUnlockedCells" type="xsd:boolean" use="optional" default=0/>
# <xsd:attribute name="password" type="xsd:string" use="optional" default="nil"/>
# </xsd:complexType>
-
+
class TestSheetProtection < Test::Unit::TestCase
def setup
#inverse defaults
@@ -30,9 +30,9 @@ class TestSheetProtection < Test::Unit::TestCase
:sort => false, :auto_filter => false, :pivot_tables => false, :select_unlocked_cells => true }
@string_options = { :password => nil }
-
+
@options = @boolean_options.merge(@string_options)
-
+
@sp = Axlsx::SheetProtection.new(@options)
end
@@ -56,7 +56,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
diff --git a/test/workbook/worksheet/tc_table_style_info.rb b/test/workbook/worksheet/tc_table_style_info.rb
index c0c452c9..f0c6821c 100644
--- a/test/workbook/worksheet/tc_table_style_info.rb
+++ b/test/workbook/worksheet/tc_table_style_info.rb
@@ -4,7 +4,7 @@ class TestTableStyleInfo < Test::Unit::TestCase
def setup
p = Axlsx::Package.new
@ws = p.workbook.add_worksheet
- 40.times do
+ 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')
diff --git a/test/workbook/worksheet/tc_worksheet.rb b/test/workbook/worksheet/tc_worksheet.rb
index 8e0c5696..5a1a870a 100644
--- a/test/workbook/worksheet/tc_worksheet.rb
+++ b/test/workbook/worksheet/tc_worksheet.rb
@@ -838,7 +838,7 @@ class TestWorksheet < Test::Unit::TestCase
sheet.add_border 'B2:D4', style: :medium
sheet.add_style 'D2:D4', border: { style: :thin, color: '000000' }
end
-
+
wb.apply_styles
assert_equal 8, wb.styled_cells.count
@@ -884,15 +884,15 @@ class TestWorksheet < Test::Unit::TestCase
wb.apply_styles
assert_equal 1, wb.styles.style_index.size
-
+
assert_equal(
{
- type: :xf,
- name: "Times New Roman",
- sz: 12,
- family: 1,
+ type: :xf,
+ name: "Times New Roman",
+ sz: 12,
+ family: 1,
color: "FFFFFF",
- },
+ },
wb.styles.style_index.values.first
)
end
diff --git a/test/workbook/worksheet/tc_worksheet_hyperlink.rb b/test/workbook/worksheet/tc_worksheet_hyperlink.rb
index 88a40bc6..2245996a 100644
--- a/test/workbook/worksheet/tc_worksheet_hyperlink.rb
+++ b/test/workbook/worksheet/tc_worksheet_hyperlink.rb
@@ -22,7 +22,7 @@ class TestWorksheetHyperlink < Test::Unit::TestCase
end
def test_target
-
+
assert_equal(@options[:target], Axlsx.instance_values_for(@a)['target'])
end