Sha256: 40f73f01973b0d8e5c5ba09a995f69521e27c377c519396c9239c98962eee197

Contents?: true

Size: 1.45 KB

Versions: 32

Compression:

Stored size: 1.45 KB

Contents

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

class TestRegressionShapeConnect01 < Test::Unit::TestCase
  def setup
    setup_dir_var
  end

  def teardown
    File.delete(@xlsx) if File.exist?(@xlsx)
  end

  def test_shape_connect01
    @xlsx = 'shape_connect01.xlsx'
    workbook  = WriteXLSX.new(@xlsx)
    worksheet = workbook.add_worksheet
    format    = workbook.add_format(:font => 'Arial', :size => 8)

    # Add a circle, with centered text
    ellipse = workbook.add_shape(:type => 'ellipse', :text => "Hello\nWorld",
                                 :width => 60, :height => 60, :format => format)
    worksheet.insert_shape('A1', ellipse, 50, 50)

    # Add a plus
    plus = workbook.add_shape(:type => 'plus', :width => 20, :height => 20)
    worksheet.insert_shape('A1', plus, 250, 200)

    # Create a bent connector to link the two shapes
    cxn_shape = workbook.add_shape(:type => 'bentConnector3')

    # Link the connector to the bottom of the circle
    cxn_shape.start = ellipse.id
    cxn_shape.start_index = 4    # 4th connection point, clockwise from top(0)
    cxn_shape.start_side  = 'b'  # r)ight or b)ottom

    # Link the connector to the bottom of the plus sign
    cxn_shape.end = plus.id
    cxn_shape.end_index = 0      # 0 - top connection point
    cxn_shape.end_side  = 't'    # l)eft of t)op

    worksheet.insert_shape('A1', cxn_shape, 0, 0)

    workbook.close
    compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
write_xlsx-0.85.5 test/regression/test_shape_connect01.rb
write_xlsx-0.85.4 test/regression/test_shape_connect01.rb
write_xlsx-0.85.3 test/regression/test_shape_connect01.rb
write_xlsx-0.85.2 test/regression/test_shape_connect01.rb
write_xlsx-0.85.1 test/regression/test_shape_connect01.rb
write_xlsx-0.83.0 test/regression/test_shape_connect01.rb
write_xlsx-0.81.1 test/regression/test_shape_connect01.rb
write_xlsx-0.81.0 test/regression/test_shape_connect01.rb
write_xlsx-0.80.0 test/regression/test_shape_connect01.rb
write_xlsx-0.79.0 test/regression/test_shape_connect01.rb
write_xlsx-0.78.0 test/regression/test_shape_connect01.rb
write_xlsx-0.77.2 test/regression/test_shape_connect01.rb
write_xlsx-0.77.1 test/regression/test_shape_connect01.rb
write_xlsx-0.77.0 test/regression/test_shape_connect01.rb
write_xlsx-0.76.3 test/regression/test_shape_connect01.rb
write_xlsx-0.76.2 test/regression/test_shape_connect01.rb
write_xlsx-0.76.1 test/regression/test_shape_connect01.rb
write_xlsx-0.76.0 test/regression/test_shape_connect01.rb
write_xlsx-0.75.0 test/regression/test_shape_connect01.rb
write_xlsx-0.74.0 test/regression/test_shape_connect01.rb