Sha256: 45704fec6b69855a95f5fa2fee21bff87e8e9d0d0e461a92d21ab9968b4ae482
Contents?: true
Size: 1.78 KB
Versions: 2
Compression:
Stored size: 1.78 KB
Contents
$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib" require "test/unit" require 'writeexcel' class TC_merge_formats < Test::Unit::TestCase def setup t = Time.now.strftime("%Y%m%d") path = "temp#{t}-#{$$}-#{rand(0x100000000).to_s(36)}" @test_file = File.join(Dir.tmpdir, path) @workbook = WriteExcel.new(@test_file) @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 File.unlink(@test_file) if FileTest.exist?(@test_file) 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
writeexcel-0.3.1 | test/test_02_merge_formats.rb |
writeexcel-0.3.0 | test/test_02_merge_formats.rb |