From 6e8b4b2d638a9128cf79fa5c5897937af1f06c18 Mon Sep 17 00:00:00 2001 From: Randy Morgan Date: Thu, 16 Feb 2012 16:35:22 +0900 Subject: more specs for cell_alignment cell and chart --- test/drawing/tc_chart.rb | 4 ++-- test/stylesheet/tc_cell_alignment.rb | 11 ++++++++--- test/workbook/worksheet/tc_cell.rb | 9 +++++++++ 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/test/drawing/tc_chart.rb b/test/drawing/tc_chart.rb index f303fab9..474266d5 100644 --- a/test/drawing/tc_chart.rb +++ b/test/drawing/tc_chart.rb @@ -41,9 +41,9 @@ class TestChart < Test::Unit::TestCase end - def end_at + def test_end_at @chart.end_at 25, 90 - assert_equal(@chart.graphic_frame.anchor.from.col, 25) + assert_equal(@chart.graphic_frame.anchor.to.col, 25) assert_equal(@chart.graphic_frame.anchor.to.row, 90) end diff --git a/test/stylesheet/tc_cell_alignment.rb b/test/stylesheet/tc_cell_alignment.rb index a0cb4817..66f95518 100644 --- a/test/stylesheet/tc_cell_alignment.rb +++ b/test/stylesheet/tc_cell_alignment.rb @@ -5,8 +5,7 @@ class TestCellAlignment < Test::Unit::TestCase def setup @item = Axlsx::CellAlignment.new end - def teardown - end + def test_initialiation assert_equal(@item.horizontal, nil) assert_equal(@item.vertical, nil) @@ -17,7 +16,13 @@ class TestCellAlignment < Test::Unit::TestCase assert_equal(@item.justifyLastLine, nil) assert_equal(@item.shrinkToFit, nil) assert_equal(@item.readingOrder, nil) - + options = { :horizontal => :left, :vertical => :top, :textRotation => 3, + :wrapText => true, :indent => 2, :relativeIndent => 5, + :justifyLastLine => true, :shrinkToFit => true, :readingOrder => 2 } + ca = Axlsx::CellAlignment.new options + options.each do |key, value| + assert_equal(ca.send(key.to_sym),value) + end end def test_horizontal diff --git a/test/workbook/worksheet/tc_cell.rb b/test/workbook/worksheet/tc_cell.rb index ed781e0f..91e6559a 100644 --- a/test/workbook/worksheet/tc_cell.rb +++ b/test/workbook/worksheet/tc_cell.rb @@ -24,6 +24,10 @@ class TestCell < Test::Unit::TestCase assert_equal(Axlsx::STYLE_DATE, c.style) end + def test_row + assert_equal(@c.row, @row) + end + def test_index assert_equal(@c.index, @row.cells.index(@c)) end @@ -203,5 +207,10 @@ class TestCell < Test::Unit::TestCase end + def test_ssti + assert_raise(ArgumentError, "ssti must be an unsigned integer!") { @c.send(:ssti=, -1) } + @c.send :ssti=, 1 + assert_equal(@c.ssti, 1) + end end -- cgit v1.2.3