Sha256: 957427c7ece1d4d005f294bd7d0690bb61fa20c8409354fb8e54703f766076c4
Contents?: true
Size: 947 Bytes
Versions: 7
Compression:
Stored size: 947 Bytes
Contents
# -*- coding: utf-8 -*- require 'helper' require 'write_xlsx' require 'stringio' class TestWriteHyperlinks < Test::Unit::TestCase def setup @workbook = WriteXLSX.new(StringIO.new) @worksheet = @workbook.add_worksheet('') end def test_write_hyperlinks @worksheet.instance_variable_set(:@hlink_refs, [[ 1, 0, 0, 1 ]]) @worksheet.__send__('write_hyperlinks') result = @worksheet.instance_variable_get(:@writer).string expected = '<hyperlinks><hyperlink ref="A1" r:id="rId1"/></hyperlinks>' assert_equal(expected, result) end def test_write_hyperlinks_internal @worksheet.instance_variable_set(:@hlink_refs, [[ 2, 0, 0, 'Sheet2!A1', 'Sheet2!A1' ]]) @worksheet.__send__('write_hyperlinks') result = @worksheet.instance_variable_get(:@writer).string expected = '<hyperlinks><hyperlink ref="A1" location="Sheet2!A1" display="Sheet2!A1"/></hyperlinks>' assert_equal(expected, result) end end
Version data entries
7 entries across 7 versions & 1 rubygems