summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJan-Hendrik Hühne <[email protected]>2012-06-06 15:50:40 +0200
committerJan-Hendrik Hühne <[email protected]>2012-06-06 15:50:40 +0200
commita751bf1f34852531caf0b5f80152e44fff020dd4 (patch)
tree16ced2090d9bb582c295def740070db9dc2f6c92
parentac94d6ff30467bdfdfb182bf2f8fcd945fbd748a (diff)
downloadcaxlsx-a751bf1f34852531caf0b5f80152e44fff020dd4.tar.gz
caxlsx-a751bf1f34852531caf0b5f80152e44fff020dd4.zip
New validators and tests.
-rw-r--r--lib/axlsx/util/validators.rb14
-rw-r--r--test/util/tc_validators.rb19
2 files changed, 31 insertions, 2 deletions
diff --git a/lib/axlsx/util/validators.rb b/lib/axlsx/util/validators.rb
index c7c97e78..f76c57ba 100644
--- a/lib/axlsx/util/validators.rb
+++ b/lib/axlsx/util/validators.rb
@@ -248,4 +248,18 @@ module Axlsx
def self.validate_sheet_view_type(v)
RestrictionValidator.validate :sheet_view_type, [:normal, :page_break_preview, :page_layout], v
end
+
+ # Requires that the value is a valid active pane type.
+ # valid types must be one of bottom_left, bottom_right, top_left, top_right
+ # @param [Any] v The value validated
+ def self.validate_active_pane_type(v)
+ RestrictionValidator.validate :active_pane_type, [:bottom_left, :bottom_right, :top_left, :top_right], v
+ end
+
+ # Requires that the value is a valid split state type.
+ # valid types must be one of frozen, frozen_split, split
+ # @param [Any] v The value validated
+ def self.validate_split_state_type(v)
+ RestrictionValidator.validate :split_state_type, [:frozen, :frozen_split, :split], v
+ end
end \ No newline at end of file
diff --git a/test/util/tc_validators.rb b/test/util/tc_validators.rb
index f5e11391..66138c54 100644
--- a/test/util/tc_validators.rb
+++ b/test/util/tc_validators.rb
@@ -141,6 +141,21 @@ class TestValidators < Test::Unit::TestCase
assert_raise(ArgumentError) { Axlsx.validate_data_validation_error_style :other_symbol }
assert_raise(ArgumentError) { Axlsx.validate_data_validation_error_style 'page_layout' }
assert_raise(ArgumentError) { Axlsx.validate_data_validation_error_style 0 }
+
+ #active_pane_type
+ [:bottom_left, :bottom_right, :top_left, :top_right].each do |sym|
+ assert_nothing_raised { Axlsx.validate_active_pane_type sym }
+ end
+ assert_raise(ArgumentError) { Axlsx.validate_active_pane_type :other_symbol }
+ assert_raise(ArgumentError) { Axlsx.validate_active_pane_type 'bottom_left' }
+ assert_raise(ArgumentError) { Axlsx.validate_active_pane_type 0 }
+
+ #split_state_type
+ [:frozen, :frozen_split, :split].each do |sym|
+ assert_nothing_raised { Axlsx.validate_split_state_type sym }
+ end
+ assert_raise(ArgumentError) { Axlsx.validate_split_state_type :other_symbol }
+ assert_raise(ArgumentError) { Axlsx.validate_split_state_type 'frozen_split' }
+ assert_raise(ArgumentError) { Axlsx.validate_split_state_type 0 }
end
-end
-
+end \ No newline at end of file