Sha256: 0325717816fd695c8a72e86a6bd87a51edfa37d9ae750abb921d28ad846dfb76

Contents?: true

Size: 822 Bytes

Versions: 7

Compression:

Stored size: 822 Bytes

Contents

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

class TestTitle < 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
  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

7 entries across 7 versions & 1 rubygems

Version Path
axlsx-1.0.7 test/drawing/tc_title.rb~
axlsx-1.0.6 test/drawing/tc_title.rb~
axlsx-1.0.5 test/drawing/tc_title.rb~
axlsx-1.0.4 test/drawing/tc_title.rb~
axlsx-1.0.3 test/drawing/tc_title.rb~
axlsx-1.0.1 test/drawing/tc_title.rb~
axlsx-1.0.0 test/drawing/tc_title.rb