Sha256: 097b7c95abfe021786a38e5fffc92bbfd370dffa1f83e591f49c29fb6aea1250

Contents?: true

Size: 1.17 KB

Versions: 12

Compression:

Stored size: 1.17 KB

Contents

require 'test/unit'
require 'axlsx.rb'

class TestTwoCellAnchor < Test::Unit::TestCase

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

  def teardown
  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_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

12 entries across 12 versions & 1 rubygems

Version Path
axlsx-1.0.18 test/drawing/tc_two_cell_anchor.rb
axlsx-1.0.17 test/drawing/tc_two_cell_anchor.rb
axlsx-1.0.16 test/drawing/tc_two_cell_anchor.rb
axlsx-1.0.15 test/drawing/tc_two_cell_anchor.rb
axlsx-1.0.14 test/drawing/tc_two_cell_anchor.rb
axlsx-1.0.12 test/drawing/tc_two_cell_anchor.rb
axlsx-1.0.11 test/drawing/tc_two_cell_anchor.rb
axlsx-1.0.10 test/drawing/tc_two_cell_anchor.rb
axlsx-1.0.10a test/drawing/tc_two_cell_anchor.rb
axlsx-1.0.9 test/drawing/tc_two_cell_anchor.rb
axlsx-1.0.8 test/drawing/tc_two_cell_anchor.rb
axlsx-1.0.7 test/drawing/tc_two_cell_anchor.rb