Sha256: 44d470efb7a993b640da87469e995c44a20d497f949a5561284a1302427e4446

Contents?: true

Size: 1.19 KB

Versions: 19

Compression:

Stored size: 1.19 KB

Contents

require 'tc_helper.rb'

class TestTwoCellAnchor < Test::Unit::TestCase

  def setup
    p = Axlsx::Package.new
    @ws = p.workbook.add_worksheet
    @ws.add_row ["one", 1, Time.now]
    chart = @ws.add_chart Axlsx::Bar3DChart
    @anchor = chart.graphic_frame.anchor
  end

  def test_initialization
    assert(@anchor.from.col == 0)
    assert(@anchor.from.row == 0)
    assert(@anchor.to.col == 5)
    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" }
    assert_raise(ArgumentError, 'invalid end_at') { @ws.add_chart Axlsx::Chart, :start_at=>[1,2], :end_at => ["a", 4] }
    # this is actually raised in the graphic frame
    assert_raise(ArgumentError, 'invalid Chart') { @ws.add_chart Axlsx::TwoCellAnchor }
    a = @ws.add_chart Axlsx::Chart, :start_at => [15, 35], :end_at => [90, 45]
    assert_equal(a.graphic_frame.anchor.from.col, 15)
    assert_equal(a.graphic_frame.anchor.from.row, 35)
    assert_equal(a.graphic_frame.anchor.to.col, 90)
    assert_equal(a.graphic_frame.anchor.to.row, 45)
  end

end

Version data entries

19 entries across 19 versions & 6 rubygems

Version Path
caxlsx-3.1.1 test/drawing/tc_two_cell_anchor.rb
caxlsx-3.1.0 test/drawing/tc_two_cell_anchor.rb
bonio-axlsx-2.2.3 test/drawing/tc_two_cell_anchor.rb
caxlsx-3.0.4 test/drawing/tc_two_cell_anchor.rb
caxlsx-3.0.3 test/drawing/tc_two_cell_anchor.rb
caxlsx-3.0.2 test/drawing/tc_two_cell_anchor.rb
caxlsx-2.0.2 test/drawing/tc_two_cell_anchor.rb
caxlsx-3.0.1 test/drawing/tc_two_cell_anchor.rb
caxlsx-3.0.0 test/drawing/tc_two_cell_anchor.rb
axlsx-alt-3.0.1 test/drawing/tc_two_cell_anchor.rb
axlsx-alt-3.0.0 test/drawing/tc_two_cell_anchor.rb
axlsx-3.0.0.pre test/drawing/tc_two_cell_anchor.rb
bonio-axlsx-2.2.2 test/drawing/tc_two_cell_anchor.rb
bonio-axlsx-2.2.1 test/drawing/tc_two_cell_anchor.rb
dg-axlsx-2.1.0 test/drawing/tc_two_cell_anchor.rb
axlsx-2.1.0.pre test/drawing/tc_two_cell_anchor.rb
l_axlsx-2.0.1 test/drawing/tc_two_cell_anchor.rb
axlsx-2.0.1 test/drawing/tc_two_cell_anchor.rb
axlsx-2.0.0 test/drawing/tc_two_cell_anchor.rb