Sha256: db619136fd0fb124b6e2e75aae48ec9c33abe9adca6bc248f25474d1d334e9c9

Contents?: true

Size: 787 Bytes

Versions: 7

Compression:

Stored size: 787 Bytes

Contents

require 'tc_helper.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

7 entries across 7 versions & 1 rubygems

Version Path
axlsx-1.1.6 test/drawing/tc_title.rb
axlsx-1.1.5 test/drawing/tc_title.rb
axlsx-1.1.4 test/drawing/tc_title.rb
axlsx-1.1.3 test/drawing/tc_title.rb
axlsx-1.1.2 test/drawing/tc_title.rb
axlsx-1.1.1 test/drawing/tc_title.rb
axlsx-1.1.0 test/drawing/tc_title.rb