Sha256: c25cdb889ec88c2f56bb395149382b0307d6a084641862a83e54872430b5223e

Contents?: true

Size: 1.54 KB

Versions: 5

Compression:

Stored size: 1.54 KB

Contents

# -*- coding: utf-8 -*-
require 'helper'
require 'stringio'

class TC_merge_formats < Test::Unit::TestCase

  def setup
    @workbook            = WriteExcel.new(StringIO.new)
    @worksheet           = @workbook.add_worksheet
    @merged_format       = @workbook.add_format(:bold => 1)
    @non_merged_format   = @workbook.add_format(:bold => 1)

    @worksheet.set_row(    5,    nil, @merged_format)
    @worksheet.set_column('G:G', nil, @merged_format)
  end

  def teardown
    @workbook.close
  end

  def test_some
    # Test 1   Normal usage.
    assert_nothing_raised { @worksheet.write('A1',    'Test', @non_merged_format) }
    assert_nothing_raised { @worksheet.write('A3:B4', 'Test', @merged_format) }

    # Test 2   Non merge format in merged cells.
    assert_nothing_raised {
      @worksheet.merge_range('D3:E4', 'Test', @non_merged_format)
    }

    # Test 3   Merge format in column.
    assert_nothing_raised { @worksheet.write('G1', 'Test') }

    # Test 4   Merge format in row.
    assert_nothing_raised { @worksheet.write('A6', 'Test') }

    # Test 5   Merge format in column and row.
    assert_nothing_raised { @worksheet.write('G6', 'Test') }

    # Test 6   No merge format in column and row.
    assert_nothing_raised { @worksheet.write('H7', 'Test') }

    # Test 7   Normal usage again.
    assert_nothing_raised {
      @worksheet.write('A1',    'Test', @non_merged_format)
    }
    assert_nothing_raised {
      @worksheet.merge_range('A3:B4', 'Test', @merged_format)
    }
  end


end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
writeexcel-0.5.0 test/test_02_merge_formats.rb
writeexcel-0.4.3 test/test_02_merge_formats.rb
writeexcel-0.4.2 test/test_02_merge_formats.rb
writeexcel-0.4.1 test/test_02_merge_formats.rb
writeexcel-0.4.0 test/test_02_merge_formats.rb