summaryrefslogtreecommitdiffhomepage
path: root/test/drawing/tc_cat_axis.rb
blob: afecaf3b04ab5f38437e5b73047beb164c2181ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
require 'test/unit'
require 'axlsx.rb'

class TestCatAxis < Test::Unit::TestCase
  def setup    
    @axis = Axlsx::CatAxis.new 12345, 54321
  end
  def teardown
  end

  def test_initialization
    assert_equal(@axis.auto, true, "axis auto default incorrect")
    assert_equal(@axis.lblAlgn, :ctr, "label align default incorrect")
    assert_equal(@axis.lblOffset, "100%", "label offset default incorrect")
  end

  def test_auto
    assert_raise(ArgumentError, "requires valid auto") { @axis.auto = :nowhere }
    assert_nothing_raised("accepts valid auto") { @axis.auto = false }
  end

  def test_lblAlgn
    assert_raise(ArgumentError, "requires valid label alignment") { @axis.lblAlgn = :nowhere }
    assert_nothing_raised("accepts valid label alignment") { @axis.lblAlgn = :r }
  end

  def test_lblOffset
    assert_raise(ArgumentError, "requires valid label offset") { @axis.lblOffset = 100 }
    assert_nothing_raised("accepts valid label offset") { @axis.lblOffset = "20%" }
  end

end