diff options
| author | Geremia Taglialatela <[email protected]> | 2023-04-08 11:53:12 +0200 |
|---|---|---|
| committer | Geremia Taglialatela <[email protected]> | 2023-04-08 11:53:12 +0200 |
| commit | 55526805cf28cc91a22df5811b26cd23bdefa8d3 (patch) | |
| tree | 2cbc6403b385078b0ed5e275c49f0c60522bdd16 /test/stylesheet | |
| parent | acf00d356494ef504c3de0e4a0db6b25f2bd7636 (diff) | |
| download | caxlsx-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/stylesheet')
| -rw-r--r-- | test/stylesheet/tc_border.rb | 8 | ||||
| -rw-r--r-- | test/stylesheet/tc_border_pr.rb | 2 | ||||
| -rw-r--r-- | test/stylesheet/tc_cell_alignment.rb | 22 | ||||
| -rw-r--r-- | test/stylesheet/tc_cell_protection.rb | 4 | ||||
| -rw-r--r-- | test/stylesheet/tc_cell_style.rb | 12 | ||||
| -rw-r--r-- | test/stylesheet/tc_color.rb | 6 | ||||
| -rw-r--r-- | test/stylesheet/tc_dxf.rb | 6 | ||||
| -rw-r--r-- | test/stylesheet/tc_font.rb | 2 | ||||
| -rw-r--r-- | test/stylesheet/tc_gradient_fill.rb | 2 | ||||
| -rw-r--r-- | test/stylesheet/tc_gradient_stop.rb | 4 | ||||
| -rw-r--r-- | test/stylesheet/tc_pattern_fill.rb | 2 | ||||
| -rw-r--r-- | test/stylesheet/tc_styles.rb | 82 |
12 files changed, 76 insertions, 76 deletions
diff --git a/test/stylesheet/tc_border.rb b/test/stylesheet/tc_border.rb index c2fb0d98..9e29dda4 100644 --- a/test/stylesheet/tc_border.rb +++ b/test/stylesheet/tc_border.rb @@ -18,22 +18,22 @@ class TestBorder < Test::Unit::TestCase def test_diagonalUp assert_raise(ArgumentError) { @b.diagonalUp = :red } assert_nothing_raised { @b.diagonalUp = true } - assert_equal(@b.diagonalUp, true ) + assert_equal(@b.diagonalUp, true) end def test_diagonalDown assert_raise(ArgumentError) { @b.diagonalDown = :red } assert_nothing_raised { @b.diagonalDown = true } - assert_equal(@b.diagonalDown, true ) + assert_equal(@b.diagonalDown, true) end def test_outline assert_raise(ArgumentError) { @b.outline = :red } assert_nothing_raised { @b.outline = true } - assert_equal(@b.outline, true ) + assert_equal(@b.outline, true) end def test_prs - assert_nothing_raised { @b.prs << Axlsx::BorderPr.new(:name=>:top, :style=>:thin, :color => Axlsx::Color.new(:rgb=>"FF0000FF")) } + assert_nothing_raised { @b.prs << Axlsx::BorderPr.new(:name => :top, :style => :thin, :color => Axlsx::Color.new(:rgb => "FF0000FF")) } end end diff --git a/test/stylesheet/tc_border_pr.rb b/test/stylesheet/tc_border_pr.rb index 1e1c1dcc..3b25575b 100644 --- a/test/stylesheet/tc_border_pr.rb +++ b/test/stylesheet/tc_border_pr.rb @@ -16,7 +16,7 @@ class TestBorderPr < Test::Unit::TestCase def test_color assert_raise(ArgumentError) { @bpr.color = :red } - assert_nothing_raised { @bpr.color = Axlsx::Color.new :rgb=>"FF000000" } + assert_nothing_raised { @bpr.color = Axlsx::Color.new :rgb => "FF000000" } assert(@bpr.color.is_a?(Axlsx::Color)) end diff --git a/test/stylesheet/tc_cell_alignment.rb b/test/stylesheet/tc_cell_alignment.rb index a61d764f..fe2e9fe4 100644 --- a/test/stylesheet/tc_cell_alignment.rb +++ b/test/stylesheet/tc_cell_alignment.rb @@ -15,66 +15,66 @@ class TestCellAlignment < Test::Unit::TestCase assert_equal(@item.justifyLastLine, nil) assert_equal(@item.shrinkToFit, nil) assert_equal(@item.readingOrder, nil) - options = { :horizontal => :left, :vertical => :top, :textRotation => 3, + options = { :horizontal => :left, :vertical => :top, :textRotation => 3, :wrapText => true, :indent => 2, :relativeIndent => 5, :justifyLastLine => true, :shrinkToFit => true, :readingOrder => 2 } ca = Axlsx::CellAlignment.new options options.each do |key, value| - assert_equal(ca.send(key.to_sym),value) + assert_equal(ca.send(key.to_sym), value) end end def test_horizontal assert_raise(ArgumentError) { @item.horizontal = :red } assert_nothing_raised { @item.horizontal = :left } - assert_equal(@item.horizontal, :left ) + assert_equal(@item.horizontal, :left) end def test_vertical assert_raise(ArgumentError) { @item.vertical = :red } assert_nothing_raised { @item.vertical = :top } - assert_equal(@item.vertical, :top ) + assert_equal(@item.vertical, :top) end def test_textRotation assert_raise(ArgumentError) { @item.textRotation = -1 } assert_nothing_raised { @item.textRotation = 5 } - assert_equal(@item.textRotation, 5 ) + assert_equal(@item.textRotation, 5) end def test_wrapText assert_raise(ArgumentError) { @item.wrapText = -1 } assert_nothing_raised { @item.wrapText = false } - assert_equal(@item.wrapText, false ) + assert_equal(@item.wrapText, false) end def test_indent assert_raise(ArgumentError) { @item.indent = -1 } assert_nothing_raised { @item.indent = 5 } - assert_equal(@item.indent, 5 ) + assert_equal(@item.indent, 5) end def test_relativeIndent assert_raise(ArgumentError) { @item.relativeIndent = :symbol } assert_nothing_raised { @item.relativeIndent = 5 } - assert_equal(@item.relativeIndent, 5 ) + assert_equal(@item.relativeIndent, 5) end def test_justifyLastLine assert_raise(ArgumentError) { @item.justifyLastLine = -1 } assert_nothing_raised { @item.justifyLastLine = true } - assert_equal(@item.justifyLastLine, true ) + assert_equal(@item.justifyLastLine, true) end def test_shrinkToFit assert_raise(ArgumentError) { @item.shrinkToFit = -1 } assert_nothing_raised { @item.shrinkToFit = true } - assert_equal(@item.shrinkToFit, true ) + assert_equal(@item.shrinkToFit, true) end def test_readingOrder assert_raise(ArgumentError) { @item.readingOrder = -1 } assert_nothing_raised { @item.readingOrder = 2 } - assert_equal(@item.readingOrder, 2 ) + assert_equal(@item.readingOrder, 2) end end diff --git a/test/stylesheet/tc_cell_protection.rb b/test/stylesheet/tc_cell_protection.rb index a9648745..a1fc59b2 100644 --- a/test/stylesheet/tc_cell_protection.rb +++ b/test/stylesheet/tc_cell_protection.rb @@ -16,12 +16,12 @@ class TestCellProtection < Test::Unit::TestCase def test_hidden assert_raise(ArgumentError) { @item.hidden = -1 } assert_nothing_raised { @item.hidden = false } - assert_equal(@item.hidden, false ) + assert_equal(@item.hidden, false) end def test_locked assert_raise(ArgumentError) { @item.locked = -1 } assert_nothing_raised { @item.locked = false } - assert_equal(@item.locked, false ) + assert_equal(@item.locked, false) end end diff --git a/test/stylesheet/tc_cell_style.rb b/test/stylesheet/tc_cell_style.rb index 5e71a698..18e7a1ab 100644 --- a/test/stylesheet/tc_cell_style.rb +++ b/test/stylesheet/tc_cell_style.rb @@ -20,36 +20,36 @@ class TestCellStyle < Test::Unit::TestCase def test_name assert_raise(ArgumentError) { @item.name = -1 } assert_nothing_raised { @item.name = "stylin" } - assert_equal(@item.name, "stylin" ) + assert_equal(@item.name, "stylin") end def test_xfId assert_raise(ArgumentError) { @item.xfId = -1 } assert_nothing_raised { @item.xfId = 5 } - assert_equal(@item.xfId, 5 ) + assert_equal(@item.xfId, 5) end def test_builtinId assert_raise(ArgumentError) { @item.builtinId = -1 } assert_nothing_raised { @item.builtinId = 5 } - assert_equal(@item.builtinId, 5 ) + assert_equal(@item.builtinId, 5) end def test_iLevel assert_raise(ArgumentError) { @item.iLevel = -1 } assert_nothing_raised { @item.iLevel = 5 } - assert_equal(@item.iLevel, 5 ) + assert_equal(@item.iLevel, 5) end def test_hidden assert_raise(ArgumentError) { @item.hidden = -1 } assert_nothing_raised { @item.hidden = true } - assert_equal(@item.hidden, true ) + assert_equal(@item.hidden, true) end def test_customBuiltin assert_raise(ArgumentError) { @item.customBuiltin = -1 } assert_nothing_raised { @item.customBuiltin = true } - assert_equal(@item.customBuiltin, true ) + assert_equal(@item.customBuiltin, true) end end diff --git a/test/stylesheet/tc_color.rb b/test/stylesheet/tc_color.rb index 1fff4c3b..8f87111e 100644 --- a/test/stylesheet/tc_color.rb +++ b/test/stylesheet/tc_color.rb @@ -17,13 +17,13 @@ class TestColor < Test::Unit::TestCase def test_auto assert_raise(ArgumentError) { @item.auto = -1 } assert_nothing_raised { @item.auto = true } - assert_equal(@item.auto, true ) + assert_equal(@item.auto, true) end def test_rgb assert_raise(ArgumentError) { @item.rgb = -1 } assert_nothing_raised { @item.rgb = "FF00FF00" } - assert_equal(@item.rgb, "FF00FF00" ) + assert_equal(@item.rgb, "FF00FF00") end def test_rgb_writer_doesnt_mutate_its_argument @@ -35,6 +35,6 @@ class TestColor < Test::Unit::TestCase def test_tint assert_raise(ArgumentError) { @item.tint = -1 } assert_nothing_raised { @item.tint = -1.0 } - assert_equal(@item.tint, -1.0 ) + assert_equal(@item.tint, -1.0) end end diff --git a/test/stylesheet/tc_dxf.rb b/test/stylesheet/tc_dxf.rb index ffc59dfb..9e87007d 100644 --- a/test/stylesheet/tc_dxf.rb +++ b/test/stylesheet/tc_dxf.rb @@ -37,8 +37,8 @@ class TestDxf < Test::Unit::TestCase end def test_fill - assert_raise(ArgumentError) { @item.fill = 1 } - assert_nothing_raised { @item.fill = Axlsx::Fill.new(Axlsx::PatternFill.new(:patternType =>:solid, :fgColor=> Axlsx::Color.new(:rgb => "FF000000"))) } + assert_raise(ArgumentError) { @item.fill = 1 } + assert_nothing_raised { @item.fill = Axlsx::Fill.new(Axlsx::PatternFill.new(:patternType => :solid, :fgColor => Axlsx::Color.new(:rgb => "FF000000"))) } assert @item.fill.is_a? Axlsx::Fill end @@ -64,7 +64,7 @@ class TestDxf < Test::Unit::TestCase def test_many_options_xml @item.border = Axlsx::Border.new @item.alignment = Axlsx::CellAlignment.new - @item.fill = Axlsx::Fill.new(Axlsx::PatternFill.new(:patternType =>:solid, :fgColor=> Axlsx::Color.new(:rgb => "FF000000"))) + @item.fill = Axlsx::Fill.new(Axlsx::PatternFill.new(:patternType => :solid, :fgColor => Axlsx::Color.new(:rgb => "FF000000"))) @item.font = Axlsx::Font.new @item.protection = Axlsx::CellProtection.new @item.numFmt = Axlsx::NumFmt.new diff --git a/test/stylesheet/tc_font.rb b/test/stylesheet/tc_font.rb index fb52f846..821e8820 100644 --- a/test/stylesheet/tc_font.rb +++ b/test/stylesheet/tc_font.rb @@ -116,7 +116,7 @@ class TestFont < Test::Unit::TestCase # def color=(v) DataTypeValidator.validate "Font.color", Color, v; @color=v end def test_color assert_raise(ArgumentError) { @item.color = -7 } - assert_nothing_raised { @item.color = Axlsx::Color.new(:rgb=>"00000000") } + assert_nothing_raised { @item.color = Axlsx::Color.new(:rgb => "00000000") } assert(@item.color.is_a?(Axlsx::Color)) end diff --git a/test/stylesheet/tc_gradient_fill.rb b/test/stylesheet/tc_gradient_fill.rb index 9ff043cc..3950fcf7 100644 --- a/test/stylesheet/tc_gradient_fill.rb +++ b/test/stylesheet/tc_gradient_fill.rb @@ -55,7 +55,7 @@ class TestGradientFill < Test::Unit::TestCase end def test_stop - @item.stop << Axlsx::GradientStop.new(Axlsx::Color.new(:rgb=>"00000000"), 0.5) + @item.stop << Axlsx::GradientStop.new(Axlsx::Color.new(:rgb => "00000000"), 0.5) assert(@item.stop.size == 1) assert(@item.stop.last.is_a?(Axlsx::GradientStop)) end diff --git a/test/stylesheet/tc_gradient_stop.rb b/test/stylesheet/tc_gradient_stop.rb index 2865f12d..6dc140e0 100644 --- a/test/stylesheet/tc_gradient_stop.rb +++ b/test/stylesheet/tc_gradient_stop.rb @@ -2,7 +2,7 @@ require 'tc_helper.rb' class TestGradientStop < Test::Unit::TestCase def setup - @item = Axlsx::GradientStop.new(Axlsx::Color.new(:rgb=>"FFFF0000"), 1.0) + @item = Axlsx::GradientStop.new(Axlsx::Color.new(:rgb => "FFFF0000"), 1.0) end def teardown @@ -21,7 +21,7 @@ class TestGradientStop < Test::Unit::TestCase def test_color assert_raise(ArgumentError) { @item.color = nil } - color = Axlsx::Color.new(:rgb=>"FF0000FF") + color = Axlsx::Color.new(:rgb => "FF0000FF") @item.color = color assert_equal(@item.color.rgb, "FF0000FF") end diff --git a/test/stylesheet/tc_pattern_fill.rb b/test/stylesheet/tc_pattern_fill.rb index e22f4de6..1126e919 100644 --- a/test/stylesheet/tc_pattern_fill.rb +++ b/test/stylesheet/tc_pattern_fill.rb @@ -33,7 +33,7 @@ class TestPatternFill < Test::Unit::TestCase end def test_to_xml_string - @item = Axlsx::PatternFill.new :bgColor => Axlsx::Color.new(:rgb => "FF0000"), :fgColor => Axlsx::Color.new(:rgb=>"00FF00") + @item = Axlsx::PatternFill.new :bgColor => Axlsx::Color.new(:rgb => "FF0000"), :fgColor => Axlsx::Color.new(:rgb => "00FF00") doc = Nokogiri::XML(@item.to_xml_string) assert(doc.xpath('//color[@rgb="FFFF0000"]')) assert(doc.xpath('//color[@rgb="FF00FF00"]')) diff --git a/test/stylesheet/tc_styles.rb b/test/stylesheet/tc_styles.rb index 8bb6ff32..78e82354 100644 --- a/test/stylesheet/tc_styles.rb +++ b/test/stylesheet/tc_styles.rb @@ -21,10 +21,10 @@ class TestStyles < Test::Unit::TestCase def test_add_style_border_hash border_count = @styles.borders.size - @styles.add_style :border => {:style => :thin, :color => "FFFF0000"} + @styles.add_style :border => { :style => :thin, :color => "FFFF0000" } assert_equal(@styles.borders.size, border_count + 1) assert_equal(@styles.borders.last.prs.last.color.rgb, "FFFF0000") - assert_raise(ArgumentError) { @styles.add_style :border => {:color => "FFFF0000"} } + assert_raise(ArgumentError) { @styles.add_style :border => { :color => "FFFF0000" } } assert_equal @styles.borders.last.prs.size, 4 end @@ -32,23 +32,23 @@ class TestStyles < Test::Unit::TestCase prev_border_count = @styles.borders.size borders_array = [ - {:style => :thin, :color => "DDDDDD"}, - {:edges => [:top], :style => :thin, :color => "000000"}, - {:edges => [:bottom], :style => :thick, :color => "FF0000"}, - {:edges => [:left], :style => :dotted, :color => "FFFF00"}, - {:edges => [:right], :style => :dashed, :color => "FFFFFF"}, - {:style => :thick, :color => "CCCCCC"} + { :style => :thin, :color => "DDDDDD" }, + { :edges => [:top], :style => :thin, :color => "000000" }, + { :edges => [:bottom], :style => :thick, :color => "FF0000" }, + { :edges => [:left], :style => :dotted, :color => "FFFF00" }, + { :edges => [:right], :style => :dashed, :color => "FFFFFF" }, + { :style => :thick, :color => "CCCCCC" } ] @styles.add_style(border: borders_array) - assert_equal(@styles.borders.size, (prev_border_count+1)) + assert_equal(@styles.borders.size, (prev_border_count + 1)) current_border = @styles.borders.last borders_array.each do |b_opts| if b_opts[:edges] - border_pr = current_border.prs.detect{|x| x.name == b_opts[:edges].first } + border_pr = current_border.prs.detect { |x| x.name == b_opts[:edges].first } assert_equal(border_pr.color.rgb, "FF#{b_opts[:color]}") end end @@ -63,39 +63,39 @@ class TestStyles < Test::Unit::TestCase def test_do_not_alter_options_in_add_style #This should test all options, but for now - just the bits that we know caused some pain - options = { :border => { :style => :thin, :color =>"FF000000" } } + options = { :border => { :style => :thin, :color => "FF000000" } } @styles.add_style options assert_equal options[:border][:style], :thin, 'thin style is stil in option' assert_equal options[:border][:color], "FF000000", 'color is stil in option' end def test_parse_num_fmt - f_code = {:format_code => "YYYY/MM"} - num_fmt = {:num_fmt => 5} + f_code = { :format_code => "YYYY/MM" } + num_fmt = { :num_fmt => 5 } assert_equal(@styles.parse_num_fmt_options, nil, 'noop if neither :format_code or :num_fmt exist') - max = @styles.numFmts.map{ |nf| nf.numFmtId }.max + max = @styles.numFmts.map { |nf| nf.numFmtId }.max @styles.parse_num_fmt_options(f_code) assert_equal(@styles.numFmts.last.numFmtId, max + 1, "new numfmts gets next available id") assert(@styles.parse_num_fmt_options(num_fmt).is_a?(Integer), "Should return the provided num_fmt if not dxf") - assert(@styles.parse_num_fmt_options(num_fmt.merge({:type => :dxf})).is_a?(Axlsx::NumFmt), "Makes a new NumFmt if dxf") + assert(@styles.parse_num_fmt_options(num_fmt.merge({ :type => :dxf })).is_a?(Axlsx::NumFmt), "Makes a new NumFmt if dxf") end def test_parse_border_options_hash_required_keys assert_raise(ArgumentError, "Require color key") { @styles.parse_border_options(:border => { :style => :thin }) } assert_raise(ArgumentError, "Require style key") { @styles.parse_border_options(:border => { :color => "FF0d0d0d" }) } - assert_nothing_raised { @styles.parse_border_options(:border => { :style => :thin, :color => "FF000000"} ) } + assert_nothing_raised { @styles.parse_border_options(:border => { :style => :thin, :color => "FF000000" }) } end def test_parse_border_basic_options - b_opts = {:border => { :diagonalUp => 1, :edges => [:left, :right], :color => "FFDADADA", :style => :thick } } + b_opts = { :border => { :diagonalUp => 1, :edges => [:left, :right], :color => "FFDADADA", :style => :thick } } b = @styles.parse_border_options b_opts assert(b.is_a? Integer) - assert_equal(@styles.parse_border_options(b_opts.merge({:type => :dxf})).class,Axlsx::Border) + assert_equal(@styles.parse_border_options(b_opts.merge({ :type => :dxf })).class, Axlsx::Border) assert(@styles.borders.last.diagonalUp == 1, "border options are passed in to the initializer") end def test_parse_border_options_edges - b_opts = {:border => { :diagonalUp => 1, :edges => [:left, :right], :color => "FFDADADA", :style => :thick } } + b_opts = { :border => { :diagonalUp => 1, :edges => [:left, :right], :color => "FFDADADA", :style => :thick } } @styles.parse_border_options b_opts b = @styles.borders.last left = b.prs.select { |bpr| bpr.name == :left }[0] @@ -106,10 +106,10 @@ class TestStyles < Test::Unit::TestCase assert_equal(bottom, nil, "unspecified bottom edge should not be created") assert(left.is_a?(Axlsx::BorderPr), "specified left edge is set") assert(right.is_a?(Axlsx::BorderPr), "specified right edge is set") - assert_equal(left.style,right.style, "edge parts have the same style") + assert_equal(left.style, right.style, "edge parts have the same style") assert_equal(left.style, :thick, "the style is THICK") - assert_equal(right.color.rgb,left.color.rgb, "edge parts are colors are the same") - assert_equal(right.color.rgb,"FFDADADA", "edge color rgb is correct") + assert_equal(right.color.rgb, left.color.rgb, "edge parts are colors are the same") + assert_equal(right.color.rgb, "FFDADADA", "edge color rgb is correct") end def test_parse_border_options_noop @@ -118,11 +118,11 @@ class TestStyles < Test::Unit::TestCase def test_parse_border_options_integer_xf assert_equal(@styles.parse_border_options(:border => 1), 1) - assert_raise(ArgumentError, "unknown border index") {@styles.parse_border_options(:border => 100) } + assert_raise(ArgumentError, "unknown border index") { @styles.parse_border_options(:border => 100) } end def test_parse_border_options_integer_dxf - b_opts = { :border => { :edges => [:left, :right], :color => "FFFFFFFF", :style=> :thick } } + b_opts = { :border => { :edges => [:left, :right], :color => "FFFFFFFF", :style => :thick } } b = @styles.parse_border_options(b_opts) b2 = @styles.parse_border_options(:border => b, :type => :dxf) assert(b2.is_a?(Axlsx::Border), "Cloned existing border object") @@ -140,7 +140,7 @@ class TestStyles < Test::Unit::TestCase original_attributes = Axlsx.instance_values_for(original) assert_equal(1, created.b) assert_equal(99, created.sz) - copied = original_attributes.reject{ |key, value| %w(b sz).include? key } + copied = original_attributes.reject { |key, value| %w(b sz).include? key } instance_vals = Axlsx.instance_values_for(created) copied.each do |key, value| assert_equal(instance_vals[key], value) @@ -162,8 +162,8 @@ class TestStyles < Test::Unit::TestCase :font_name => "woot font" } assert_equal(@styles.parse_font_options {}, nil, "noop if no font keys are set") - assert(@styles.parse_font_options(:b=>1).is_a?(Integer), "return index of font if not :dxf type") - assert_equal(@styles.parse_font_options(:b=>1, :type => :dxf).class, Axlsx::Font, "return font object if :dxf type") + assert(@styles.parse_font_options(:b => 1).is_a?(Integer), "return index of font if not :dxf type") + assert_equal(@styles.parse_font_options(:b => 1, :type => :dxf).class, Axlsx::Font, "return font object if :dxf type") f = @styles.parse_font_options(options.merge(:type => :dxf)) color = options.delete(:fg_color) @@ -192,15 +192,15 @@ class TestStyles < Test::Unit::TestCase font_count = @styles.fonts.size xf_count = @styles.cellXfs.size - @styles.add_style :bg_color=>"FF000000", :fg_color=>"FFFFFFFF", :sz=>13, :num_fmt=>Axlsx::NUM_FMT_PERCENT, :alignment=>{:horizontal=>:left}, :border=>Axlsx::STYLE_THIN_BORDER, :hidden=>true, :locked=>true - assert_equal(@styles.fills.size, fill_count+1) - assert_equal(@styles.fonts.size, font_count+1) - assert_equal(@styles.cellXfs.size, xf_count+1) + @styles.add_style :bg_color => "FF000000", :fg_color => "FFFFFFFF", :sz => 13, :num_fmt => Axlsx::NUM_FMT_PERCENT, :alignment => { :horizontal => :left }, :border => Axlsx::STYLE_THIN_BORDER, :hidden => true, :locked => true + assert_equal(@styles.fills.size, fill_count + 1) + assert_equal(@styles.fonts.size, font_count + 1) + assert_equal(@styles.cellXfs.size, xf_count + 1) xf = @styles.cellXfs.last - assert_equal(xf.fillId, (@styles.fills.size-1), "points to the last created fill") + assert_equal(xf.fillId, (@styles.fills.size - 1), "points to the last created fill") assert_equal(@styles.fills.last.fill_type.fgColor.rgb, "FF000000", "fill created with color") - assert_equal(xf.fontId, (@styles.fonts.size-1), "points to the last created font") + assert_equal(xf.fontId, (@styles.fonts.size - 1), "points to the last created font") assert_equal(@styles.fonts.last.sz, 13, "font sz applied") assert_equal(@styles.fonts.last.color.rgb, "FFFFFFFF", "font color applied") @@ -215,16 +215,16 @@ class TestStyles < Test::Unit::TestCase assert_equal(xf.applyProtection, true, "protection applied") assert_equal(xf.applyBorder, true, "border applied") - assert_equal(xf.applyNumberFormat,true, "number format applied") + assert_equal(xf.applyNumberFormat, true, "number format applied") assert_equal(xf.applyAlignment, true, "alignment applied") end def test_basic_add_style_dxf border_count = @styles.borders.size - @styles.add_style :border => {:style => :thin, :color => "FFFF0000"}, :type => :dxf + @styles.add_style :border => { :style => :thin, :color => "FFFF0000" }, :type => :dxf assert_equal(@styles.borders.size, border_count, "styles borders not affected") assert_equal(@styles.dxfs.last.border.prs.last.color.rgb, "FFFF0000") - assert_raise(ArgumentError) { @styles.add_style :border => {:color => "FFFF0000"}, :type => :dxf } + assert_raise(ArgumentError) { @styles.add_style :border => { :color => "FFFF0000" }, :type => :dxf } assert_equal @styles.borders.last.prs.size, 4 end @@ -233,8 +233,8 @@ class TestStyles < Test::Unit::TestCase font_count = @styles.fonts.size dxf_count = @styles.dxfs.size - style = @styles.add_style :bg_color=>"FF000000", :fg_color=>"FFFFFFFF", :sz=>13, :alignment=>{:horizontal=>:left}, :border=>{:style => :thin, :color => "FFFF0000"}, :hidden=>true, :locked=>true, :type => :dxf - assert_equal(@styles.dxfs.size, dxf_count+1) + style = @styles.add_style :bg_color => "FF000000", :fg_color => "FFFFFFFF", :sz => 13, :alignment => { :horizontal => :left }, :border => { :style => :thin, :color => "FFFF0000" }, :hidden => true, :locked => true, :type => :dxf + assert_equal(@styles.dxfs.size, dxf_count + 1) assert_equal(0, style, "returns the zero-based dxfId") dxf = @styles.dxfs.last @@ -255,9 +255,9 @@ class TestStyles < Test::Unit::TestCase def test_multiple_dxf # add a second style - style = @styles.add_style :bg_color=>"00000000", :fg_color=>"FFFFFFFF", :sz=>13, :alignment=>{:horizontal=>:left}, :border=>{:style => :thin, :color => "FFFF0000"}, :hidden=>true, :locked=>true, :type => :dxf + style = @styles.add_style :bg_color => "00000000", :fg_color => "FFFFFFFF", :sz => 13, :alignment => { :horizontal => :left }, :border => { :style => :thin, :color => "FFFF0000" }, :hidden => true, :locked => true, :type => :dxf assert_equal(0, style, "returns the first dxfId") - style = @styles.add_style :bg_color=>"FF000000", :fg_color=>"FFFFFFFF", :sz=>13, :alignment=>{:horizontal=>:left}, :border=>{:style => :thin, :color => "FFFF0000"}, :hidden=>true, :locked=>true, :type => :dxf + style = @styles.add_style :bg_color => "FF000000", :fg_color => "FFFFFFFF", :sz => 13, :alignment => { :horizontal => :left }, :border => { :style => :thin, :color => "FFFF0000" }, :hidden => true, :locked => true, :type => :dxf assert_equal(1, style, "returns the second dxfId") end @@ -302,7 +302,7 @@ class TestStyles < Test::Unit::TestCase current_border = @styles.borders.last - border_pr = current_border.prs.detect{|x| x.name == edge } + border_pr = current_border.prs.detect { |x| x.name == edge } assert_equal(border_pr.color.rgb, "FF#{b_opts[:color]}") end end |
