From 6932311b84142bc1c3567e0adb12ce77b4d127e3 Mon Sep 17 00:00:00 2001 From: Randy Morgan Date: Mon, 4 Jun 2012 12:40:50 +0900 Subject: The spec indicates that the percent sign should be included but MS Excel chokes on it. --- lib/axlsx/drawing/cat_axis.rb | 4 ++-- test/drawing/tc_cat_axis.rb | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/axlsx/drawing/cat_axis.rb b/lib/axlsx/drawing/cat_axis.rb index 8f93766b..2e200bda 100644 --- a/lib/axlsx/drawing/cat_axis.rb +++ b/lib/axlsx/drawing/cat_axis.rb @@ -28,7 +28,7 @@ module Axlsx # regex for validating label offset - LBL_OFFSET_REGEX = /0*(([0-9])|([1-9][0-9])|([1-9][0-9][0-9])|1000)%/ + LBL_OFFSET_REGEX = /0*(([0-9])|([1-9][0-9])|([1-9][0-9][0-9])|1000)/ # Creates a new CatAxis object # @param [Integer] axId the id of this axis. Inherited @@ -46,7 +46,7 @@ module Axlsx @tickMarkSkip = 1 self.auto = 1 self.lblAlgn = :ctr - self.lblOffset = "100%" + self.lblOffset = "100" super(axId, crossAx, options) end diff --git a/test/drawing/tc_cat_axis.rb b/test/drawing/tc_cat_axis.rb index a4f25a1c..6529b45d 100644 --- a/test/drawing/tc_cat_axis.rb +++ b/test/drawing/tc_cat_axis.rb @@ -10,7 +10,7 @@ class TestCatAxis < Test::Unit::TestCase def test_initialization assert_equal(@axis.auto, 1, "axis auto default incorrect") assert_equal(@axis.lblAlgn, :ctr, "label align default incorrect") - assert_equal(@axis.lblOffset, "100%", "label offset default incorrect") + assert_equal(@axis.lblOffset, "100", "label offset default incorrect") end def test_auto @@ -24,8 +24,8 @@ class TestCatAxis < Test::Unit::TestCase end def test_lblOffset - assert_raise(ArgumentError, "requires valid label offset") { @axis.lblOffset = 100 } - assert_nothing_raised("accepts valid label offset") { @axis.lblOffset = "20%" } + assert_raise(ArgumentError, "requires valid label offset") { @axis.lblOffset = 'foo' } + assert_nothing_raised("accepts valid label offset") { @axis.lblOffset = "20" } end end -- cgit v1.2.3