summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2013-09-12 22:13:09 +0900
committerRandy Morgan <[email protected]>2013-09-13 00:08:39 +0900
commitb5a6263ec3ec0a729c9b2bec86c22d1ead33eb65 (patch)
tree4787d30e49eb8425885a37af9008aafa69fb9419 /test
parent923e7b7ff9157bdfe95584b8d311e2f6099ab71d (diff)
downloadcaxlsx-b5a6263ec3ec0a729c9b2bec86c22d1ead33eb65.tar.gz
caxlsx-b5a6263ec3ec0a729c9b2bec86c22d1ead33eb65.zip
repair pivot table data ref populate and bring coverage back up to 100%
Diffstat (limited to 'test')
-rw-r--r--test/drawing/tc_two_cell_anchor.rb6
-rw-r--r--test/tc_package.rb1
-rw-r--r--test/workbook/worksheet/tc_pivot_table.rb3
-rw-r--r--test/workbook/worksheet/tc_worksheet.rb15
4 files changed, 20 insertions, 5 deletions
diff --git a/test/drawing/tc_two_cell_anchor.rb b/test/drawing/tc_two_cell_anchor.rb
index 66f8bd58..db84521d 100644
--- a/test/drawing/tc_two_cell_anchor.rb
+++ b/test/drawing/tc_two_cell_anchor.rb
@@ -10,9 +10,6 @@ class TestTwoCellAnchor < Test::Unit::TestCase
@anchor = chart.graphic_frame.anchor
end
- def teardown
- end
-
def test_initialization
assert(@anchor.from.col == 0)
assert(@anchor.from.row == 0)
@@ -20,6 +17,9 @@ class TestTwoCellAnchor < Test::Unit::TestCase
assert(@anchor.to.row == 10)
end
+ def test_index
+ assert_equal(@anchor.index, @anchor.drawing.anchors.index(@anchor))
+ end
def test_options
assert_raise(ArgumentError, 'invalid start_at') { @ws.add_chart Axlsx::Chart, :start_at=>"1" }
diff --git a/test/tc_package.rb b/test/tc_package.rb
index 4d77b8bd..4df44ea4 100644
--- a/test/tc_package.rb
+++ b/test/tc_package.rb
@@ -59,6 +59,7 @@ class TestPackage < Test::Unit::TestCase
image.height=666
image.hyperlink.tooltip = "Labeled Link"
image.start_at 5, 5
+ image.end_at 10, 10
end
ws.add_image :image_src => File.expand_path('../../examples/image1.gif', __FILE__) do |image|
image.start_at 0, 20
diff --git a/test/workbook/worksheet/tc_pivot_table.rb b/test/workbook/worksheet/tc_pivot_table.rb
index 56ac4bd4..3c42d605 100644
--- a/test/workbook/worksheet/tc_pivot_table.rb
+++ b/test/workbook/worksheet/tc_pivot_table.rb
@@ -47,7 +47,7 @@ class TestPivotTable < Test::Unit::TestCase
end
def test_add_pivot_table_with_config
- pivot_table = @ws.add_pivot_table('G5:G6', 'A1:D5') do |pt|
+ pivot_table = @ws.add_pivot_table('G5:G6', 'A1:E5') do |pt|
pt.rows = ['Year', 'Month']
pt.columns = ['Type']
pt.data = ['Sales']
@@ -57,6 +57,7 @@ class TestPivotTable < Test::Unit::TestCase
assert_equal(['Type'], pivot_table.columns)
assert_equal([{:ref=>"Sales"}], pivot_table.data)
assert_equal(['Region'], pivot_table.pages)
+ shared_test_pivot_table_xml_validity(pivot_table)
end
def test_add_pivot_table_with_options_on_data_field
diff --git a/test/workbook/worksheet/tc_worksheet.rb b/test/workbook/worksheet/tc_worksheet.rb
index f6037f57..3782b215 100644
--- a/test/workbook/worksheet/tc_worksheet.rb
+++ b/test/workbook/worksheet/tc_worksheet.rb
@@ -167,7 +167,7 @@ class TestWorksheet < Test::Unit::TestCase
assert_equal(@ws.workbook.charts.size, 1, "add_chart adds a chart to the workbook")
end
- def test_add_page_break
+ def test_add_page_break_with_string_cell_ref
assert(@ws.row_breaks.empty?)
assert(@ws.col_breaks.empty?)
@ws.add_page_break("B1")
@@ -175,6 +175,19 @@ class TestWorksheet < Test::Unit::TestCase
assert_equal(1, @ws.col_breaks.size)
end
+ def test_add_page_break_with_cell
+ @ws.add_row [1, 2, 3, 4]
+ @ws.add_row [1, 2, 3, 4]
+
+
+ assert(@ws.row_breaks.empty?)
+ assert(@ws.col_breaks.empty?)
+ @ws.add_page_break(@ws.rows.last.cells[1])
+ assert_equal(1, @ws.row_breaks.size)
+ assert_equal(1, @ws.col_breaks.size)
+ end
+
+
def test_drawing
assert @ws.drawing == nil
@ws.add_chart(Axlsx::Pie3DChart)