Sha256: 60c8e37076f29503ad2024e792151b391479ee194afc4082bcac64e6b97921a4

Contents?: true

Size: 813 Bytes

Versions: 20

Compression:

Stored size: 813 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 ["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

20 entries across 17 versions & 1 rubygems

Version Path
axlsx-1.0.18 test/drawing/tc_title.rb
axlsx-1.0.17 test/drawing/tc_title.rb
axlsx-1.0.16 test/drawing/tc_title.rb
axlsx-1.0.15 test/drawing/tc_title.rb
axlsx-1.0.14 test/drawing/tc_title.rb
axlsx-1.0.12 test/drawing/tc_title.rb
axlsx-1.0.11 test/drawing/tc_title.rb
axlsx-1.0.10 test/drawing/tc_title.rb
axlsx-1.0.10a test/drawing/tc_title.rb
axlsx-1.0.9 test/drawing/tc_title.rb
axlsx-1.0.8 test/drawing/tc_title.rb
axlsx-1.0.7 test/drawing/tc_series_title.rb~
axlsx-1.0.7 test/drawing/tc_title.rb
axlsx-1.0.6 test/drawing/tc_series_title.rb~
axlsx-1.0.6 test/drawing/tc_title.rb
axlsx-1.0.5 test/drawing/tc_series_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