Sha256: e3e4c79fcce14188f95b47f913a8f68d4dcd19abcf2905879cc35881b332dcb0

Contents?: true

Size: 1.47 KB

Versions: 9

Compression:

Stored size: 1.47 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

9 entries across 9 versions & 1 rubygems

Version Path
write_xlsx-0.62.0 test/regression/test_shape_connect01.rb
write_xlsx-0.61.0 test/regression/test_shape_connect01.rb
write_xlsx-0.60.0 test/regression/test_shape_connect01.rb
write_xlsx-0.59.0 test/regression/test_shape_connect01.rb
write_xlsx-0.58.0 test/regression/test_shape_connect01.rb
write_xlsx-0.57.0 test/regression/test_shape_connect01.rb
write_xlsx-0.56.0 test/regression/test_shape_connect01.rb
write_xlsx-0.55.0 test/regression/test_shape_connect01.rb
write_xlsx-0.54.0 test/regression/test_shape_connect01.rb