diff options
| author | Geremia Taglialatela <[email protected]> | 2023-04-05 17:17:07 +0200 |
|---|---|---|
| committer | Geremia Taglialatela <[email protected]> | 2023-04-06 09:54:44 +0200 |
| commit | 7e90a46d43fefcf5ff7c76c14b29b6998245cfc5 (patch) | |
| tree | 0562b39547ee41e86504bf661390ce0d571ff066 | |
| parent | e9496a58dbf17d4b9bb615f3cb630f1e32574ece (diff) | |
| download | caxlsx-7e90a46d43fefcf5ff7c76c14b29b6998245cfc5.tar.gz caxlsx-7e90a46d43fefcf5ff7c76c14b29b6998245cfc5.zip | |
Remove Layout/TrailingWhitespace offenses
```
rubocop --only Layout/TrailingWhitespace -a
```
60 files changed, 307 insertions, 307 deletions
diff --git a/lib/axlsx/doc_props/core.rb b/lib/axlsx/doc_props/core.rb index bb2da676..e0025f12 100644 --- a/lib/axlsx/doc_props/core.rb +++ b/lib/axlsx/doc_props/core.rb @@ -5,7 +5,7 @@ module Axlsx # @note Packages manage their own core object. # @see Package#core class Core - + # Creates a new Core object. # @option options [String] creator # @option options [Time] created diff --git a/lib/axlsx/drawing/axes.rb b/lib/axlsx/drawing/axes.rb index dff87a9b..6e66dcc0 100644 --- a/lib/axlsx/drawing/axes.rb +++ b/lib/axlsx/drawing/axes.rb @@ -1,5 +1,5 @@ module Axlsx - + # The Axes class creates and manages axis information and # serialization for charts. class Axes @@ -16,7 +16,7 @@ module Axlsx end # [] provides assiciative access to a specic axis store in an axes - # instance. + # instance. # @return [Axis] def [](name) axes.assoc(name)[1] @@ -27,12 +27,12 @@ module Axlsx # @param [Hash] options # @option options ids # If the ids option is specified only the axis identifier is - # serialized. Otherwise, each axis is serialized in full. + # serialized. Otherwise, each axis is serialized in full. def to_xml_string(str = '', options = {}) if options[:ids] # CatAxis must come first in the XML (for Microsoft Excel at least) sorted = axes.sort_by { |name, axis| axis.kind_of?(CatAxis) ? 0 : 1 } - sorted.each { |axis| str << ('<c:axId val="' << axis[1].id.to_s << '"/>') } + sorted.each { |axis| str << ('<c:axId val="' << axis[1].id.to_s << '"/>') } else axes.each { |axis| axis[1].to_xml_string(str) } end diff --git a/lib/axlsx/drawing/axis.rb b/lib/axlsx/drawing/axis.rb index b2bb8fe7..e4bcf9a4 100644 --- a/lib/axlsx/drawing/axis.rb +++ b/lib/axlsx/drawing/axis.rb @@ -83,14 +83,14 @@ module Axlsx # the title for the axis. This can be a cell or a fixed string. attr_reader :title - # The color for this axis. This value is used when rendering the axis line in the chart. + # The color for this axis. This value is used when rendering the axis line in the chart. # colors should be in 6 character rbg format # @return [String] the rbg color assinged. # @see color def color=(color_rgb) @color = color_rgb end - + # The crossing axis for this axis # @param [Axis] axis def cross_axis=(axis) diff --git a/lib/axlsx/drawing/d_lbls.rb b/lib/axlsx/drawing/d_lbls.rb index 0fb3c6ad..0c8185f0 100644 --- a/lib/axlsx/drawing/d_lbls.rb +++ b/lib/axlsx/drawing/d_lbls.rb @@ -7,7 +7,7 @@ module Axlsx class DLbls include Axlsx::Accessors - include Axlsx::OptionsParser + include Axlsx::OptionsParser # creates a new DLbls object def initialize(chart_type, options={}) raise ArgumentError, 'chart_type must inherit from Chart' unless [Chart, LineChart].include?(chart_type.superclass) @@ -18,31 +18,31 @@ module Axlsx # These attributes are all boolean so I'm doing a bit of a hand # waving magic show to set up the attriubte accessors - # @note - # not all charts support all methods! + # @note + # not all charts support all methods! # Bar3DChart and Line3DChart and ScatterChart do not support d_lbl_pos or show_leader_lines - # - boolean_attr_accessor :show_legend_key, - :show_val, - :show_cat_name, - :show_ser_name, - :show_percent, - :show_bubble_size, + # + boolean_attr_accessor :show_legend_key, + :show_val, + :show_cat_name, + :show_ser_name, + :show_percent, + :show_bubble_size, :show_leader_lines # Initialize all the values to false as Excel requires them to # explicitly be disabled or all will show. def initialize_defaults - [:show_legend_key, :show_val, :show_cat_name, - :show_ser_name, :show_percent, :show_bubble_size, + [:show_legend_key, :show_val, :show_cat_name, + :show_ser_name, :show_percent, :show_bubble_size, :show_leader_lines].each do |attr| self.send("#{attr}=", false) end end - # The chart type that is using this data lables instance. + # The chart type that is using this data lables instance. # This affects the xml output as not all chart types support the - # same data label attributes. + # same data label attributes. attr_reader :chart_type # The position of the data labels in the chart @@ -65,7 +65,7 @@ module Axlsx @d_lbl_pos = label_position end - + # serializes the data labels # @return [String] def to_xml_string(str = '') @@ -74,7 +74,7 @@ module Axlsx instance_vals = Axlsx.instance_values_for(self) %w(d_lbl_pos show_legend_key show_val show_cat_name show_ser_name show_percent show_bubble_size show_leader_lines).each do |key| next unless instance_vals.keys.include?(key) && instance_vals[key] != nil - str << "<c:#{Axlsx::camel(key, false)} val='#{instance_vals[key]}' />" + str << "<c:#{Axlsx::camel(key, false)} val='#{instance_vals[key]}' />" end str << '</c:dLbls>' end diff --git a/lib/axlsx/drawing/view_3D.rb b/lib/axlsx/drawing/view_3D.rb index 2223d501..cfb44166 100644 --- a/lib/axlsx/drawing/view_3D.rb +++ b/lib/axlsx/drawing/view_3D.rb @@ -71,7 +71,7 @@ module Axlsx alias :hPercent= :h_percent= # @see rot_y - def rot_y=(v) + def rot_y=(v) RangeValidator.validate "View3D.rot_y", 0, 360, v @rot_y = v end diff --git a/lib/axlsx/package.rb b/lib/axlsx/package.rb index 6baaa173..613c92de 100644 --- a/lib/axlsx/package.rb +++ b/lib/axlsx/package.rb @@ -102,7 +102,7 @@ module Axlsx # File.open('example_streamed.xlsx', 'wb') { |f| f.write(s.read) } def serialize(output, options = {}, secondary_options = nil) if !workbook.styles_applied - workbook.apply_styles + workbook.apply_styles end confirm_valid, zip_command = parse_serialize_options(options, secondary_options) @@ -127,7 +127,7 @@ module Axlsx # @return [StringIO|Boolean] False if confirm_valid and validation errors exist. rewound string IO if not. def to_stream(confirm_valid=false) if !workbook.styles_applied - workbook.apply_styles + workbook.apply_styles end return false unless !confirm_valid || self.validate.empty? diff --git a/lib/axlsx/rels/relationship.rb b/lib/axlsx/rels/relationship.rb index 157f316e..dc7c5307 100644 --- a/lib/axlsx/rels/relationship.rb +++ b/lib/axlsx/rels/relationship.rb @@ -3,7 +3,7 @@ module Axlsx # A relationship defines a reference between package parts. # @note Packages automatically manage relationships. class Relationship - + class << self # Keeps track of relationship ids in use. # @return [Array] @@ -12,27 +12,27 @@ module Axlsx end # Initialize cached ids. - # + # # This should be called before serializing a package (see {Package#serialize} and - # {Package#to_stream}) to make sure that serialization is idempotent (i.e. + # {Package#to_stream}) to make sure that serialization is idempotent (i.e. # Relationship instances are generated with the same IDs everytime the package # is serialized). def initialize_ids_cache Thread.current[:axlsx_relationship_ids_cache] = {} end - + # Clear cached ids. - # + # # This should be called after serializing a package (see {Package#serialize} and # {Package#to_stream}) to free the memory allocated for cache. - # - # Also, calling this avoids memory leaks (cached ids lingering around - # forever). + # + # Also, calling this avoids memory leaks (cached ids lingering around + # forever). def clear_ids_cache Thread.current[:axlsx_relationship_ids_cache] = nil end - - # Generate and return a unique id (eg. `rId123`) Used for setting {#Id}. + + # Generate and return a unique id (eg. `rId123`) Used for setting {#Id}. # # The generated id depends on the number of previously cached ids, so using # {clear_ids_cache} will automatically reset the generated ids, too. @@ -42,12 +42,12 @@ module Axlsx end end - # The id of the relationship (eg. "rId123"). Most instances get their own unique id. + # The id of the relationship (eg. "rId123"). Most instances get their own unique id. # However, some instances need to share the same id – see {#should_use_same_id_as?} # for details. # @return [String] attr_reader :Id - + # The location of the relationship target # @return [String] attr_reader :Target @@ -77,8 +77,8 @@ module Axlsx # The source object the relations belongs to (e.g. a hyperlink, drawing, ...). Needed when # looking up the relationship for a specific object (see {Relationships#for}). attr_reader :source_obj - - # Initializes a new relationship. + + # Initializes a new relationship. # @param [Object] source_obj see {#source_obj} # @param [String] type The type of the relationship # @param [String] target The target for the relationship @@ -108,12 +108,12 @@ module Axlsx str << (h.map { |key, value| '' << key.to_s << '="' << Axlsx::coder.encode(value.to_s) << '"'}.join(' ')) str << '/>' end - + # A key that determines whether this relationship should use already generated id. # # Instances designating the same relationship need to use the same id. We can not simply - # compare the {#Target} attribute, though: `foo/bar.xml`, `../foo/bar.xml`, - # `../../foo/bar.xml` etc. are all different but probably mean the same file (this + # compare the {#Target} attribute, though: `foo/bar.xml`, `../foo/bar.xml`, + # `../../foo/bar.xml` etc. are all different but probably mean the same file (this # is especially an issue for relationships in the context of pivot tables). So lets # just ignore this attribute for now (except when {#TargetMode} is set to `:External` – # then {#Target} will be an absolute URL and thus can safely be compared). @@ -125,6 +125,6 @@ module Axlsx key << self.Target if self.TargetMode == :External key end - + end end diff --git a/lib/axlsx/stylesheet/cell_alignment.rb b/lib/axlsx/stylesheet/cell_alignment.rb index 715a0b3e..f1675141 100644 --- a/lib/axlsx/stylesheet/cell_alignment.rb +++ b/lib/axlsx/stylesheet/cell_alignment.rb @@ -1,16 +1,16 @@ # encoding: UTF-8 module Axlsx - - + + # CellAlignment stores information about the cell alignment of a style Xf Object. # @note Using Styles#add_style is the recommended way to manage cell alignment. # @see Styles#add_style class CellAlignment - + include Axlsx::SerializedAttributes include Axlsx::OptionsParser - + serializable_attributes :horizontal, :vertical, :text_rotation, :wrap_text, :indent, :relative_indent, :justify_last_line, :shrink_to_fit, :reading_order # Create a new cell_alignment object # @option options [Symbol] horizontal diff --git a/lib/axlsx/stylesheet/styles.rb b/lib/axlsx/stylesheet/styles.rb index f6305fa9..188f0960 100644 --- a/lib/axlsx/stylesheet/styles.rb +++ b/lib/axlsx/stylesheet/styles.rb @@ -137,7 +137,7 @@ module Axlsx # @option options [Integer] family The font family to use. # @option options [String] font_name The name of the font to use # @option options [Integer] num_fmt The number format to apply - # @option options [String] format_code The formatting to apply. + # @option options [String] format_code The formatting to apply. # @option options [Integer|Hash] border The border style to use. # borders support style, color and edges options @see parse_border_options # @option options [String] bg_color The background color to apply to the cell @@ -241,8 +241,8 @@ module Axlsx if options[:type] == :xf # Check to see if style in cache already - - font_defaults = {name: @fonts.first.name, sz: @fonts.first.sz, family: @fonts.first.family} + + font_defaults = {name: @fonts.first.name, sz: @fonts.first.sz, family: @fonts.first.family} raw_style = {type: :xf}.merge(font_defaults).merge(options) @@ -349,12 +349,12 @@ module Axlsx # parses Style#add_style options for borders. # @note noop if :border is not specified in options - # @option options [Hash|Integer] A border style definition hash or the index of an existing border. - # Border style definition hashes must include :style and :color key-value entries and - # may include an :edges entry that references an array of symbols identifying which border edges + # @option options [Hash|Integer] A border style definition hash or the index of an existing border. + # Border style definition hashes must include :style and :color key-value entries and + # may include an :edges entry that references an array of symbols identifying which border edges # you wish to apply the style or any other valid Border initializer options. # If the :edges entity is not provided the style is applied to all edges of cells that reference this style. - # Also available :border_top, :border_right, :border_bottom and :border_left options with :style and/or :color + # Also available :border_top, :border_right, :border_bottom and :border_left options with :style and/or :color # key-value entries, which override :border values. # @example # #apply a thick red border to the top and bottom @@ -444,8 +444,8 @@ module Axlsx end border.prs << BorderPr.new({ - :name => edge, - :style => edge_b_opts[:style], + :name => edge, + :style => edge_b_opts[:style], :color => Color.new(:rgb => edge_b_opts[:color]) }, ) end diff --git a/lib/axlsx/util/accessors.rb b/lib/axlsx/util/accessors.rb index a678b041..5062b0d4 100644 --- a/lib/axlsx/util/accessors.rb +++ b/lib/axlsx/util/accessors.rb @@ -51,7 +51,7 @@ module Axlsx # @param [Array] symbols The names of the attributes to create # @param [String] validator The axlsx validation method to use when # validating assignation. - # @see lib/axlsx/util/validators.rb + # @see lib/axlsx/util/validators.rb def validated_attr_accessor(symbols, validator) symbols.each do |symbol| attr_reader symbol diff --git a/lib/axlsx/util/serialized_attributes.rb b/lib/axlsx/util/serialized_attributes.rb index 06d1697a..75712de1 100644 --- a/lib/axlsx/util/serialized_attributes.rb +++ b/lib/axlsx/util/serialized_attributes.rb @@ -11,7 +11,7 @@ module Axlsx # class methods applied to all includers module ClassMethods - # This is the method to be used in inheriting classes to specify + # This is the method to be used in inheriting classes to specify # which of the instance values are serializable def serializable_attributes(*symbols) @xml_attributes = symbols @@ -43,7 +43,7 @@ module Axlsx end end - # serializes the instance values of the defining object based on the + # serializes the instance values of the defining object based on the # list of serializable attributes. # @param [String] str The string instance to append this # serialization to. diff --git a/lib/axlsx/util/simple_typed_list.rb b/lib/axlsx/util/simple_typed_list.rb index 77bed775..5f5dbffa 100644 --- a/lib/axlsx/util/simple_typed_list.rb +++ b/lib/axlsx/util/simple_typed_list.rb @@ -55,7 +55,7 @@ module Axlsx end result end - + # Lock this list at the current size # @return [self] def lock @@ -69,7 +69,7 @@ module Axlsx @locked_at = nil self end - + def to_ary @list end @@ -82,9 +82,9 @@ module Axlsx # one of the allowed types # @return [SimpleTypedList] def +(v) - v.each do |item| + v.each do |item| DataTypeValidator.validate :SimpleTypedList_plus, @allowed_types, item - @list << item + @list << item end end @@ -96,10 +96,10 @@ module Axlsx DataTypeValidator.validate :SimpleTypedList_push, @allowed_types, v @list << v @list.size - 1 - end - + end + alias :push :<< - + # delete the item from the list # @param [Any] v The item to be deleted. @@ -164,7 +164,7 @@ module Axlsx end } end - + def to_xml_string(str = '') classname = @allowed_types[0].name.split('::').last el_name = serialize_as.to_s || (classname[0,1].downcase + classname[1..-1]) diff --git a/lib/axlsx/util/storage.rb b/lib/axlsx/util/storage.rb index 6c16bdcf..b3815dbb 100644 --- a/lib/axlsx/util/storage.rb +++ b/lib/axlsx/util/storage.rb @@ -16,46 +16,46 @@ module Axlsx }.freeze # Creates a byte string for this storage - # @return [String] + # @return [String] def to_s - data = [@name.concat(Array.new([email protected], 0)), - @name_size, - @type, - @color, - @left, - @right, - @child, + data = [@name.concat(Array.new([email protected], 0)), + @name_size, + @type, + @color, + @left, + @right, + @child, @created, - @modified, - @sector, + @modified, + @sector, @size].flatten data.pack(PACKING) end # storage colors COLORS = { - :red=>0, + :red=>0, :black=>1 } # The color of this node in the directory tree. Defaults to black if not specified # @return [Integer] color attr_reader :color - + # Sets the color for this storage # @param [Integer] v Must be one of the COLORS constant hash values def color=(v) - RestrictionValidator.validate :storage_color, COLORS.values, v + RestrictionValidator.validate :storage_color, COLORS.values, v @color = v end # The size of the name for this node. - # interesting to see that office actually uses 'R' for the root directory and lists the size as 2 bytes - thus is it *NOT* null + # interesting to see that office actually uses 'R' for the root directory and lists the size as 2 bytes - thus is it *NOT* null # terminated. I am making this r/w so that I can override the size # @return [Integer] color attr_reader :name_size - # the name of the stream + # the name of the stream attr_reader :name # sets the name of the stream. @@ -87,16 +87,16 @@ module Axlsx # @return [Integer] sector attr_accessor :sector - # The 0 based index in the directoies chain for this the left sibling of this storage. - + # The 0 based index in the directoies chain for this the left sibling of this storage. + # @return [Integer] left - attr_accessor :left + attr_accessor :left - # The 0 based index in the directoies chain for this the right sibling of this storage. + # The 0 based index in the directoies chain for this the right sibling of this storage. # @return [Integer] right - attr_accessor :right + attr_accessor :right - # The 0 based index in the directoies chain for the child of this storage. + # The 0 based index in the directoies chain for the child of this storage. # @return [Integer] child attr_accessor :child @@ -113,14 +113,14 @@ module Axlsx # @return [Integer] type attr_reader :type - # Sets the type for this storage. - # @param [Integer] v the type to specify must be one of the TYPES constant hash values. + # Sets the type for this storage. + # @param [Integer] v the type to specify must be one of the TYPES constant hash values. def type=(v) - RestrictionValidator.validate :storage_type, TYPES.values, v + RestrictionValidator.validate :storage_type, TYPES.values, v @type = v end - # Creates a new storage object. + # Creates a new storage object. # @param [String] name the name of the storage # @option options [Integer] color (black) # @option options [Integer] type (storage) @@ -141,6 +141,6 @@ module Axlsx @type ||= (data.nil? ? TYPES[:storage] : TYPES[:stream]) self.name = name end - + end end diff --git a/lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb b/lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb index 71f08a2f..61957df0 100644 --- a/lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb +++ b/lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb @@ -52,7 +52,7 @@ module Axlsx end # Sets the col_id attribute for this filter column. - # @param [Integer | Cell] column_index The zero based index of the column to which this filter applies. + # @param [Integer | Cell] column_index The zero based index of the column to which this filter applies. # When you specify a cell, the column index will be read off the cell # @return [Integer] def col_id=(column_index) diff --git a/lib/axlsx/workbook/worksheet/auto_filter/filters.rb b/lib/axlsx/workbook/worksheet/auto_filter/filters.rb index faa22374..215b66fe 100644 --- a/lib/axlsx/workbook/worksheet/auto_filter/filters.rb +++ b/lib/axlsx/workbook/worksheet/auto_filter/filters.rb @@ -1,6 +1,6 @@ module Axlsx - # When multiple values are chosen to filter by, or when a group of date values are chosen to filter by, + # When multiple values are chosen to filter by, or when a group of date values are chosen to filter by, # this object groups those criteria together. class Filters include Axlsx::OptionsParser @@ -29,7 +29,7 @@ module Axlsx # @return [Boolean] attr_reader :blank - # Calendar type for date grouped items. + # Calendar type for date grouped items. # Used to interpret the values in dateGroupItem. # This is the calendar type used to evaluate all dates in the filter column, # even when those dates are not using the same calendar system / date formatting. @@ -81,7 +81,7 @@ module Axlsx str << '</filters>' end - # not entirely happy with this. + # not entirely happy with this. # filter_items should be a simple typed list that overrides << etc # to create Filter objects from the inserted values. However this # is most likely so rarely used...(really? do you know that?) @@ -200,7 +200,7 @@ include Axlsx::SerializedAttributes end # The day value for the date group item - # This must be between 1 and 31 + # This must be between 1 and 31 # @note no attempt is made to ensure the date value is valid for any given month def day=(value) RangeValidator.validate "DateGroupItem.day", 0, 31, value diff --git a/lib/axlsx/workbook/worksheet/border_creator.rb b/lib/axlsx/workbook/worksheet/border_creator.rb index bbd30473..2830eaff 100644 --- a/lib/axlsx/workbook/worksheet/border_creator.rb +++ b/lib/axlsx/workbook/worksheet/border_creator.rb @@ -13,7 +13,7 @@ module Axlsx if @edges == :all @edges = Axlsx::Border::EDGES elsif [email protected]_a?(Array) - raise ArgumentError.new("Invalid edges provided, #{@edges}") + raise ArgumentError.new("Invalid edges provided, #{@edges}") else @edges = @edges.map{|x| x&.to_sym}.uniq @@ -26,15 +26,15 @@ module Axlsx def draw if @cells.size == 1 @worksheet.add_style( - first_cell, + first_cell, { border: {style: @style, color: @color, edges: @edges} } ) else - @edges.each do |edge| + @edges.each do |edge| @worksheet.add_style( - border_cells[edge], + border_cells[edge], { border: {style: @style, color: @color, edges: [edge]} } diff --git a/lib/axlsx/workbook/worksheet/cell.rb b/lib/axlsx/workbook/worksheet/cell.rb index 125ca051..301ce22f 100644 --- a/lib/axlsx/workbook/worksheet/cell.rb +++ b/lib/axlsx/workbook/worksheet/cell.rb @@ -104,7 +104,7 @@ module Axlsx self.raw_style = new_style wb = row.worksheet.workbook - + wb.styled_cells << self end diff --git a/lib/axlsx/workbook/worksheet/col_breaks.rb b/lib/axlsx/workbook/worksheet/col_breaks.rb index 2f1ec1b0..c803fc70 100644 --- a/lib/axlsx/workbook/worksheet/col_breaks.rb +++ b/lib/axlsx/workbook/worksheet/col_breaks.rb @@ -1,7 +1,7 @@ module Axlsx # A collection of Brake objects. - # Please do not use this class directly. Instead use + # Please do not use this class directly. Instead use # Worksheet#add_break class ColBreaks < SimpleTypedList @@ -12,7 +12,7 @@ module Axlsx # A column break specific helper for adding a break. # @param [Hash] options A list of options to pass into the Break object - # The max and man options are fixed, however any other valid option for + # The max and man options are fixed, however any other valid option for # Break will be passed to the created break object. # @see Break def add_break(options) diff --git a/lib/axlsx/workbook/worksheet/color_scale.rb b/lib/axlsx/workbook/worksheet/color_scale.rb index 287e6869..127b3e96 100644 --- a/lib/axlsx/workbook/worksheet/color_scale.rb +++ b/lib/axlsx/workbook/worksheet/color_scale.rb @@ -28,7 +28,7 @@ module Axlsx # A builder for three tone color gradient # @example # #this creates a three tone color scale - # color_scale = Axlsx::ColorScale.three_tone + # color_scale = Axlsx::ColorScale.three_tone # @see examples/example.rb conditional formatting examples. def three_tone self.new({:type => :min, :val => 0, :color => 'FFF8696B'}, diff --git a/lib/axlsx/workbook/worksheet/comment.rb b/lib/axlsx/workbook/worksheet/comment.rb index e5dbe41c..5230c940 100644 --- a/lib/axlsx/workbook/worksheet/comment.rb +++ b/lib/axlsx/workbook/worksheet/comment.rb @@ -82,7 +82,7 @@ module Axlsx pos = Axlsx::name_to_indices(ref) @vml_shape = VmlShape.new(:row => pos[1], :column => pos[0], :visible => @visible) do |vml| vml.left_column = vml.column - vml.right_column = vml.column + 2 + vml.right_column = vml.column + 2 vml.top_row = vml.row vml.bottom_row = vml.row + 4 end diff --git a/lib/axlsx/workbook/worksheet/conditional_formatting.rb b/lib/axlsx/workbook/worksheet/conditional_formatting.rb index 7b1783bd..0ed065e6 100644 --- a/lib/axlsx/workbook/worksheet/conditional_formatting.rb +++ b/lib/axlsx/workbook/worksheet/conditional_formatting.rb @@ -7,7 +7,7 @@ module Axlsx class ConditionalFormatting include Axlsx::OptionsParser - + # Creates a new {ConditionalFormatting} object # @option options [Array] rules The rules to apply # @option options [String] sqref The range to apply the rules to diff --git a/lib/axlsx/workbook/worksheet/dimension.rb b/lib/axlsx/workbook/worksheet/dimension.rb index a7f9b792..48b3a1c2 100644 --- a/lib/axlsx/workbook/worksheet/dimension.rb +++ b/lib/axlsx/workbook/worksheet/dimension.rb @@ -1,7 +1,7 @@ module Axlsx # This class manages the dimensions for a worksheet. - # While this node is optional in the specification some readers like + # While this node is optional in the specification some readers like # LibraOffice require this node to render the sheet class Dimension @@ -31,7 +31,7 @@ module Axlsx # @return [String] def sqref "#{first_cell_reference}:#{last_cell_reference}" - end + end # serialize the object # @return [String] diff --git a/lib/axlsx/workbook/worksheet/pane.rb b/lib/axlsx/workbook/worksheet/pane.rb index 2bc77495..321294da 100644 --- a/lib/axlsx/workbook/worksheet/pane.rb +++ b/lib/axlsx/workbook/worksheet/pane.rb @@ -24,16 +24,16 @@ module Axlsx # Active Pane # The pane that is active. - # Options are + # Options are # * bottom_left: Bottom left pane, when both vertical and horizontal # splits are applied. This value is also used when only - # a horizontal split has been applied, dividing the pane - # into upper and lower regions. In that case, this value + # a horizontal split has been applied, dividing the pane + # into upper and lower regions. In that case, this value # specifies the bottom pane. # * bottom_right: Bottom right pane, when both vertical and horizontal # splits are applied. # * top_left: Top left pane, when both vertical and horizontal splits - # are applied. This value is also used when only a horizontal + # are applied. This value is also used when only a horizontal # split has been applied, dividing the pane into upper and lower # regions. In that case, this value specifies the top pane. # This value is also used when only a vertical split has @@ -41,8 +41,8 @@ module Axlsx # regions. In that case, this value specifies the left pane # * top_right: Top right pane, when both vertical and horizontal # splits are applied. This value is also used when only - # a vertical split has been applied, dividing the pane - # into right and left regions. In that case, this value + # a vertical split has been applied, dividing the pane + # into right and left regions. In that case, this value # specifies the right pane. # @see type # @return [Symbol] @@ -51,12 +51,12 @@ module Axlsx # Split State - # Indicates whether the pane has horizontal / vertical + # Indicates whether the pane has horizontal / vertical # splits, and whether those splits are frozen. - # Options are + # Options are # * frozen: Panes are frozen, but were not split being frozen. In # this state, when the panes are unfrozen again, a single - # pane results, with no split. In this state, the split + # pane results, with no split. In this state, the split # bars are not adjustable. # * frozen_split: Panes are frozen and were split before being frozen. In # this state, when the panes are unfrozen again, the split @@ -69,7 +69,7 @@ module Axlsx attr_reader :state # Top Left Visible Cell - # Location of the top left visible cell in the bottom + # Location of the top left visible cell in the bottom # right pane (when in Left-To-Right mode). # @see type # @return [String] @@ -78,7 +78,7 @@ module Axlsx # Horizontal Split Position # Horizontal position of the split, in 1/20th of a point; 0 (zero) - # if none. If the pane is frozen, this value indicates the number + # if none. If the pane is frozen, this value indicates the number # of columns visible in the top pane. # @see type # @return [Integer] @@ -86,7 +86,7 @@ module Axlsx attr_reader :x_split # Vertical Split Position - # Vertical position of the split, in 1/20th of a point; 0 (zero) + # Vertical position of the split, in 1/20th of a point; 0 (zero) # if none. If the pane is frozen, this value indicates the number # of rows visible in the left pane. # @see type diff --git a/lib/axlsx/workbook/worksheet/protected_range.rb b/lib/axlsx/workbook/worksheet/protected_range.rb index e990f1cb..492b2254 100644 --- a/lib/axlsx/workbook/worksheet/protected_range.rb +++ b/lib/axlsx/workbook/worksheet/protected_range.rb @@ -42,6 +42,6 @@ module Axlsx # objects created during serialization def to_xml_string(str="") serialized_tag 'protectedRange', str - end + end end end diff --git a/lib/axlsx/workbook/worksheet/row.rb b/lib/axlsx/workbook/worksheet/row.rb index 63a8d328..62ceb59c 100644 --- a/lib/axlsx/workbook/worksheet/row.rb +++ b/lib/axlsx/workbook/worksheet/row.rb @@ -6,7 +6,7 @@ module Axlsx class Row < SimpleTypedList include SerializedAttributes include Accessors - + # No support is provided for the following attributes # spans # thickTop @@ -64,7 +64,7 @@ module Axlsx # @see Row#s def s=(v) Axlsx.validate_unsigned_numeric(v) - @custom_format = true + @custom_format = true @s = v end @@ -73,7 +73,7 @@ module Axlsx Axlsx.validate_unsigned_numeric(v) @outline_level = v end - + alias :outlineLevel= :outline_level= # The index of this row in the worksheet @@ -126,7 +126,7 @@ module Axlsx @ht = v end end - + # return cells def cells self diff --git a/lib/axlsx/workbook/worksheet/row_breaks.rb b/lib/axlsx/workbook/worksheet/row_breaks.rb index c6ec89a9..0e6e8646 100644 --- a/lib/axlsx/workbook/worksheet/row_breaks.rb +++ b/lib/axlsx/workbook/worksheet/row_breaks.rb @@ -17,7 +17,7 @@ module Axlsx self << Break.new(options.merge(:max => 16383, :man => true)) last end - + # <rowBreaks count="3" manualBreakCount="3"> # <brk id="1" max="16383" man="1"/> # <brk id="7" max="16383" man="1"/> diff --git a/lib/axlsx/workbook/worksheet/selection.rb b/lib/axlsx/workbook/worksheet/selection.rb index fcb06c13..753b3a35 100644 --- a/lib/axlsx/workbook/worksheet/selection.rb +++ b/lib/axlsx/workbook/worksheet/selection.rb @@ -40,16 +40,16 @@ module Axlsx # Pane # The pane to which this selection belongs. - # Options are + # Options are # * bottom_left: Bottom left pane, when both vertical and horizontal # splits are applied. This value is also used when only - # a horizontal split has been applied, dividing the pane - # into upper and lower regions. In that case, this value + # a horizontal split has been applied, dividing the pane + # into upper and lower regions. In that case, this value # specifies the bottom pane. # * bottom_right: Bottom right pane, when both vertical and horizontal # splits are applied. # * top_left: Top left pane, when both vertical and horizontal splits - # are applied. This value is also used when only a horizontal + # are applied. This value is also used when only a horizontal # split has been applied, dividing the pane into upper and lower # regions. In that case, this value specifies the top pane. # This value is also used when only a vertical split has @@ -57,8 +57,8 @@ module Axlsx # regions. In that case, this value specifies the left pane # * top_right: Top right pane, when both vertical and horizontal # splits are applied. This value is also used when only - # a vertical split has been applied, dividing the pane - # into right and left regions. In that case, this value + # a vertical split has been applied, dividing the pane + # into right and left regions. In that case, this value # specifies the right pane. # @see type # @return [Symbol] diff --git a/lib/axlsx/workbook/worksheet/sheet_data.rb b/lib/axlsx/workbook/worksheet/sheet_data.rb index a7b8735b..0b697fbb 100644 --- a/lib/axlsx/workbook/worksheet/sheet_data.rb +++ b/lib/axlsx/workbook/worksheet/sheet_data.rb @@ -9,7 +9,7 @@ module Axlsx raise ArgumentError, "you must provide a worksheet" unless worksheet.is_a?(Worksheet) @worksheet = worksheet end - + attr_reader :worksheet # Serialize the sheet data @@ -17,11 +17,11 @@ module Axlsx # @return [String] def to_xml_string(str = '') str << '<sheetData>' - worksheet.rows.each_with_index do |row, index| - row.to_xml_string(index, str) + worksheet.rows.each_with_index do |row, index| + row.to_xml_string(index, str) end str << '</sheetData>' end - + end end diff --git a/lib/axlsx/workbook/worksheet/sheet_format_pr.rb b/lib/axlsx/workbook/worksheet/sheet_format_pr.rb index 12c2e3b2..f7cff58c 100644 --- a/lib/axlsx/workbook/worksheet/sheet_format_pr.rb +++ b/lib/axlsx/workbook/worksheet/sheet_format_pr.rb @@ -42,7 +42,7 @@ module Axlsx boolean_attr_accessor :custom_height, :zero_height, :thick_top, :thick_bottom - unsigned_int_attr_accessor :base_col_width, :outline_level_row, :outline_level_col + unsigned_int_attr_accessor :base_col_width, :outline_level_row, :outline_level_col # serializes this object to an xml string # @param [String] str The string this objects serialization will be appended to diff --git a/lib/axlsx/workbook/worksheet/sheet_pr.rb b/lib/axlsx/workbook/worksheet/sheet_pr.rb index fd6dad2b..e369cb52 100644 --- a/lib/axlsx/workbook/worksheet/sheet_pr.rb +++ b/lib/axlsx/workbook/worksheet/sheet_pr.rb @@ -62,7 +62,7 @@ module Axlsx def page_setup_pr @page_setup_pr ||= PageSetUpPr.new end - + # The OutlinePr for this sheet pr object # @return [OutlinePr] def outline_pr diff --git a/lib/axlsx/workbook/worksheet/sheet_protection.rb b/lib/axlsx/workbook/worksheet/sheet_protection.rb index c6142be5..b7aa56b6 100644 --- a/lib/axlsx/workbook/worksheet/sheet_protection.rb +++ b/lib/axlsx/workbook/worksheet/sheet_protection.rb @@ -50,9 +50,9 @@ module Axlsx # default nil attr_reader :password - # This block is intended to implement the salt_value, hash_value and spin count as per the ECMA-376 standard. - # However, it does not seem to actually work in EXCEL - instead they are using their old retro algorithm shown below - # defined in the transitional portion of the speck. I am leaving this code in in the hope that someday Ill be able to + # This block is intended to implement the salt_value, hash_value and spin count as per the ECMA-376 standard. + # However, it does not seem to actually work in EXCEL - instead they are using their old retro algorithm shown below + # defined in the transitional portion of the speck. I am leaving this code in in the hope that someday Ill be able to # figure out why it does not work, and if Excel even supports it. # def propper_password=(v) # @algorithm_name = v == nil ? nil : 'SHA-1' diff --git a/lib/axlsx/workbook/worksheet/sheet_view.rb b/lib/axlsx/workbook/worksheet/sheet_view.rb index 434f7b7a..f7b0f7bf 100644 --- a/lib/axlsx/workbook/worksheet/sheet_view.rb +++ b/lib/axlsx/workbook/worksheet/sheet_view.rb @@ -5,7 +5,7 @@ module Axlsx # @note The recommended way to manage the sheet view is via Worksheet#sheet_view # @see Worksheet#sheet_view class SheetView - + include Axlsx::OptionsParser include Axlsx::Accessors include Axlsx::SerializedAttributes @@ -66,11 +66,11 @@ module Axlsx # @return [Hash] attr_reader :selections - # + # # Color Id # Index to the color value for row/column - # text headings and gridlines. This is an - # 'index color value' (ICV) rather than + # text headings and gridlines. This is an + # 'index color value' (ICV) rather than # rgb value. # @see type # @return [Integer] @@ -78,18 +78,18 @@ module Axlsx attr_reader :color_id # Top Left Visible Cell - # Location of the top left visible cell Location + # Location of the top left visible cell Location # of the top left visible cell in the bottom right # pane (when in Left-to-Right mode). # @see type # @return [String] # default nil attr_reader :top_left_cell - - + + # View Type # Indicates the view type. - # Options are + # Options are # * normal: Normal view # * page_break_preview: Page break preview # * page_layout: Page Layout View @@ -99,62 +99,62 @@ module Axlsx attr_reader :view # Workbook View Index - # Zero-based index of this workbook view, pointing + # Zero-based index of this workbook view, pointing # to a workbookView element in the bookViews collection. # @see type - # @return [Integer] + # @return [Integer] # default 0 attr_reader :workbook_view_id # Zoom Scale - # Window zoom magnification for current view + # Window zoom magnification for current view # representing percent values. This attribute - # is restricted to values ranging from 10 to 400. + # is restricted to values ranging from 10 to 400. # Horizontal & Vertical scale together. - # Current view can be Normal, Page Layout, or + # Current view can be Normal, Page Layout, or # Page Break Preview. # @see type - # @return [Integer] + # @return [Integer] # default 100 attr_reader :zoom_scale # Zoom Scale Normal View - # Zoom magnification to use when in normal view, - # representing percent values. This attribute is - # restricted to values ranging from 10 to 400. + # Zoom magnification to use when in normal view, + # representing percent values. This attribute is + # restricted to values ranging from 10 to 400. # Horizontal & Vertical scale together. - # Applies for worksheets only; zero implies the + # Applies for worksheets only; zero implies the # automatic setting. # @see type - # @return [Integer] + # @return [Integer] # default 0 attr_reader :zoom_scale_normal # Zoom Scale Page Layout View - # Zoom magnification to use when in page layout - # view, representing percent values. This attribute - # is restricted to values ranging from 10 to 400. + # Zoom magnification to use when in page layout + # view, representing percent values. This attribute + # is restricted to values ranging from 10 to 400. # Horizontal & Vertical scale together. - # Applies for worksheets only; zero implies + # Applies for worksheets only; zero implies # the automatic setting. # @see type - # @return [Integer] + # @return [Integer] # default 0 attr_reader :zoom_scale_page_layout_view # Zoom Scale Page Break Preview - # Zoom magnification to use when in page break - # preview, representing percent values. This - # attribute is restricted to values ranging + # Zoom magnification to use when in page break + # preview, representing percent values. This + # attribute is restricted to values ranging # from 10 to 400. Horizontal & Vertical scale # together. - # Applies for worksheet only; zero implies + # Applies for worksheet only; zero implies # the automatic setting. # @see type - # @return [Integer] + # @return [Integer] # default 0 attr_reader :zoom_scale_sheet_layout_view @@ -172,7 +172,7 @@ module Axlsx # @see top_left_cell def top_left_cell=(v) cell = (v.class == Axlsx::Cell ? v.r_abs : v) - Axlsx::validate_string(cell) + Axlsx::validate_string(cell) @top_left_cell = cell end diff --git a/lib/axlsx/workbook/worksheet/table.rb b/lib/axlsx/workbook/worksheet/table.rb index 992486d2..881f12e7 100644 --- a/lib/axlsx/workbook/worksheet/table.rb +++ b/lib/axlsx/workbook/worksheet/table.rb @@ -64,7 +64,7 @@ module Axlsx end end - # TableStyleInfo for the table. + # TableStyleInfo for the table. # initialization can be fed via the :style_info option def table_style_info @table_style_info ||= TableStyleInfo.new diff --git a/lib/axlsx/workbook/worksheet/table_style_info.rb b/lib/axlsx/workbook/worksheet/table_style_info.rb index 22d85d41..c4678310 100644 --- a/lib/axlsx/workbook/worksheet/table_style_info.rb +++ b/lib/axlsx/workbook/worksheet/table_style_info.rb @@ -15,7 +15,7 @@ module Axlsx # @option [Boolean] show_column_stripes indicates if column stripes should # be shown # @option [Boolean] show_row_stripes indicates if row stripes should be shown - # @option [String] name The name of the style to apply to your table. + # @option [String] name The name of the style to apply to your table. # Only predefined styles are currently supported. # @see Annex G. (normative) Predefined SpreadsheetML Style Definitions in part 1 of the specification. def initialize(options = {}) diff --git a/lib/axlsx/workbook/worksheet/worksheet_comments.rb b/lib/axlsx/workbook/worksheet/worksheet_comments.rb index f9e4c8cd..c6dd5545 100644 --- a/lib/axlsx/workbook/worksheet/worksheet_comments.rb +++ b/lib/axlsx/workbook/worksheet/worksheet_comments.rb @@ -24,7 +24,7 @@ module Axlsx # @see Comments#add_comment def add_comment(options={}) comments.add_comment(options) - end + end # The relationships defined by this objects comments collection # @return [Relationships] 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 |
