summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJan-Hendrik Hühne <[email protected]>2012-06-06 17:18:55 +0200
committerJan-Hendrik Hühne <[email protected]>2012-06-06 17:18:55 +0200
commit264c9e55e0b72db341f85588d9ed1481a7cf8888 (patch)
treec76d4bd44df4c29843ac43073eb0ce8273b833e4
parent4e9cab4bc167f1a5c080c616b84860bdf5ebbb6f (diff)
downloadcaxlsx-264c9e55e0b72db341f85588d9ed1481a7cf8888.tar.gz
caxlsx-264c9e55e0b72db341f85588d9ed1481a7cf8888.zip
Changes default value of xSplit and ySplit.
-rw-r--r--lib/axlsx/workbook/worksheet/pane.rb7
-rw-r--r--test/workbook/worksheet/tc_pane.rb10
2 files changed, 12 insertions, 5 deletions
diff --git a/lib/axlsx/workbook/worksheet/pane.rb b/lib/axlsx/workbook/worksheet/pane.rb
index 2a5b4075..bf632c10 100644
--- a/lib/axlsx/workbook/worksheet/pane.rb
+++ b/lib/axlsx/workbook/worksheet/pane.rb
@@ -68,7 +68,7 @@ module Axlsx
# of columns visible in the top pane.
# @see type
# @return [Integer]
- # @default nil
+ # @default 0
attr_reader :x_split
@@ -78,7 +78,7 @@ module Axlsx
# of rows visible in the left pane.
# @see type
# @return [Integer]
- # @default nil
+ # @default 0
attr_reader :y_split
@@ -90,7 +90,8 @@ module Axlsx
# @option options [Integer] y_split Vertical Split Position
def initialize(options={})
#defaults
- @active_pane = @state = @top_left_cell = @x_split = @y_split = nil
+ @active_pane = @state = @top_left_cell = nil
+ @x_split = @y_split = 0
# write options to instance variables
options.each do |o|
diff --git a/test/workbook/worksheet/tc_pane.rb b/test/workbook/worksheet/tc_pane.rb
index 22838095..0c4c19b1 100644
--- a/test/workbook/worksheet/tc_pane.rb
+++ b/test/workbook/worksheet/tc_pane.rb
@@ -4,13 +4,14 @@ require 'tc_helper.rb'
class TestPane < Test::Unit::TestCase
def setup
#inverse defaults for booleans
- @nil_options = { :active_pane => :bottom_left, :state => :frozen, :x_split => 2, :y_split => 2, :top_left_cell => 'A2' }
+ @nil_options = { :active_pane => :bottom_left, :state => :frozen, :top_left_cell => 'A2' }
+ @int_0_options = { :x_split => 2, :y_split => 2 }
@string_options = { :top_left_cell => 'A2' }
@integer_options = { :x_split => 2, :y_split => 2 }
@symbol_options = { :active_pane => :bottom_left, :state => :frozen }
- @options = @nil_options
+ @options = @nil_options.merge(@int_0_options)
@pane = Axlsx::Pane.new(@options)
end
@@ -22,6 +23,11 @@ class TestPane < Test::Unit::TestCase
assert_equal(nil, pane.send(key.to_sym), "initialized default #{key} should be nil")
assert_equal(value, @pane.send(key.to_sym), "initialized options #{key} should be #{value}")
end
+
+ @int_0_options.each do |key, value|
+ assert_equal(0, pane.send(key.to_sym), "initialized default #{key} should be 0")
+ assert_equal(value, @pane.send(key.to_sym), "initialized options #{key} should be #{value}")
+ end
end
def test_string_attribute_validation