Skip to content

Commit

Permalink
Fix for XML encoding in Relationship links. Close #31.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcnamara committed Sep 27, 2012
1 parent 5628ad6 commit ad43369
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Excel/Writer/XLSX/Package/Relationships.pm
Expand Up @@ -187,7 +187,7 @@ sub _write_relationship {

push @attributes, ( 'TargetMode' => $target_mode ) if $target_mode;

$self->xml_empty_tag( 'Relationship', @attributes );
$self->xml_encoded_empty_tag( 'Relationship', @attributes );
}


Expand Down
68 changes: 68 additions & 0 deletions t/regression/escapes04.t
@@ -0,0 +1,68 @@
###############################################################################
#
# Tests the output of Excel::Writer::XLSX against Excel generated files.
#
# reverse('©'), January 2011, John McNamara, jmcnamara@cpan.org
#

use lib 't/lib';
use TestFunctions qw(_compare_xlsx_files _is_deep_diff);
use strict;
use warnings;

use Test::More tests => 1;

###############################################################################
#
# Tests setup.
#
my $filename = 'escapes04.xlsx';
my $dir = 't/regression/';
my $got_filename = $dir . $filename;
my $exp_filename = $dir . 'xlsx_files/' . $filename;

my $ignore_members = [];
my $ignore_elements = { 'xl/workbook.xml' => ['<workbookView'] };


###############################################################################
#
# Test the creation of a simple Excel::Writer::XLSX file.
# Check encoding of rich strings.
#
use Excel::Writer::XLSX;

my $workbook = Excel::Writer::XLSX->new( $got_filename );
my $worksheet = $workbook->add_worksheet();

$worksheet->write_url( 'A1', 'http://www.perl.com/?a=1&b=2' );

$workbook->close();


###############################################################################
#
# Compare the generated and existing Excel files.
#

my ( $got, $expected, $caption ) = _compare_xlsx_files(

$got_filename,
$exp_filename,
$ignore_members,
$ignore_elements,
);

_is_deep_diff( $got, $expected, $caption );


###############################################################################
#
# Cleanup.
#
unlink $got_filename;

__END__
Binary file added t/regression/xlsx_files/escapes04.xlsx
Binary file not shown.

0 comments on commit ad43369

Please sign in to comment.