summaryrefslogtreecommitdiffhomepage
path: root/test/workbook/worksheet/tc_pane.rb
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2012-10-14 13:20:29 +0900
committerRandy Morgan <[email protected]>2012-10-14 13:20:29 +0900
commit25ebea9143c136999bdaeb372fb26d2c070ca730 (patch)
tree0916e207715d821d3f4f8de45c9690ca65272633 /test/workbook/worksheet/tc_pane.rb
parent93b70a39999ac4d06e43e495f3fd283e9630d9d2 (diff)
downloadcaxlsx-25ebea9143c136999bdaeb372fb26d2c070ca730.tar.gz
caxlsx-25ebea9143c136999bdaeb372fb26d2c070ca730.zip
Refactored to use options parser, accessors and serialization attributes
Diffstat (limited to 'test/workbook/worksheet/tc_pane.rb')
-rw-r--r--test/workbook/worksheet/tc_pane.rb50
1 files changed, 5 insertions, 45 deletions
diff --git a/test/workbook/worksheet/tc_pane.rb b/test/workbook/worksheet/tc_pane.rb
index b11f6534..fff0bf7a 100644
--- a/test/workbook/worksheet/tc_pane.rb
+++ b/test/workbook/worksheet/tc_pane.rb
@@ -7,61 +7,21 @@ class TestPane < Test::Unit::TestCase
#inverse defaults for booleans
@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.merge(@int_0_options)
-
+ @options = @nil_options.merge(@int_0_options)
@pane = Axlsx::Pane.new(@options)
end
-
- def test_initialize
- pane = Axlsx::Pane.new
-
- @nil_options.each do |key, value|
- 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
- @string_options.each do |key, value|
- assert_raise(ArgumentError, "#{key} must be string") { @pane.send("#{key}=".to_sym, :symbol) }
- assert_nothing_raised { @pane.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") { @pane.send("#{key}=".to_sym, "foo") }
- assert_nothing_raised { @pane.send("#{key}=".to_sym, value) }
- end
- end
-
- def test_integer_attribute_validation
- @integer_options.each do |key, value|
- assert_raise(ArgumentError, "#{key} must be integer") { @pane.send("#{key}=".to_sym, "foo") }
- assert_nothing_raised { @pane.send("#{key}=".to_sym, value) }
- end
- end
-
+
+
def test_active_pane
assert_raise(ArgumentError) { @pane.active_pane = "10" }
assert_nothing_raised { @pane.active_pane = :top_left }
- assert_equal(@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, :frozen_split)
+ assert_equal(@pane.state, "frozenSplit")
end
def test_x_split