Sha256: f1463793785742dbd55ba8e53c7be33853a6b96b7a147fbc83ffb291533a3294

Contents?: true

Size: 858 Bytes

Versions: 1

Compression:

Stored size: 858 Bytes

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 :values=>["one", 1, Time.now]
    @title = Axlsx::Title.new
    @chart = ws.add_chart Axlsx::Bar3DChart
    @anchor = @chart.anchor
  end

  def teardown
  end

  def test_initialization
    assert(@title.text == "")
    assert(@title.cell == nil)
  end

  def test_text
    assert_raise(ArgumentError, "text must be a string") { @title.text = 123 }
    @title.cell = @row.cells.first
    @title.text = "bob"    
    assert(@title.cell == nil, "setting title with text clears the cell")
  end

  def test_cell
    assert_raise(ArgumentError, "cell must be a Cell") { @title.cell = "123" }
    @title.cell = @row.cells.first
    assert(@title.text == "one")
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
axlsx-1.0.0 test/drawing/tc_two_cell_anchor.rb~