diff --git a/t/regression/quote_name05.t b/t/regression/quote_name05.t new file mode 100644 index 00000000..4bee641d --- /dev/null +++ b/t/regression/quote_name05.t @@ -0,0 +1,91 @@ +############################################################################### +# +# Tests the output of Excel::Writer::XLSX against Excel generated files. +# +# Copyright 2000-2024, John McNamara, jmcnamara@cpan.org +# +# SPDX-License-Identifier: Artistic-1.0-Perl OR GPL-1.0-or-later +# + +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 = 'quote_name05.xlsx'; +my $dir = 't/regression/'; +my $got_filename = $dir . "ewx_$filename"; +my $exp_filename = $dir . 'xlsx_files/' . $filename; + +my $ignore_members = []; + +my $ignore_elements = {}; + + +############################################################################### +# +# Test the creation of a simple Excel::Writer::XLSX file. +# +use Excel::Writer::XLSX; + +my $workbook = Excel::Writer::XLSX->new( $got_filename ); +my $worksheet = $workbook->add_worksheet(); +my $chart = $workbook->add_chart( type => 'column', embedded => 1 ); + +# For testing, copy the randomly generated axis ids in the target xlsx file. +$chart->{_axis_ids} = [ 54437760, 59195776 ]; + +my $data = [ + [ 1, 2, 3, 4, 5 ], + [ 2, 4, 6, 8, 10 ], + [ 3, 6, 9, 12, 15 ], + +]; + +$worksheet->write( 'A1', $data ); +$worksheet->repeat_rows( 0, 1 ); +$worksheet->set_portrait(); +$worksheet->{_vertical_dpi} = 200; + +$chart->add_series( values => [ 'Sheet1', 0, 4, 0, 0 ] ); +$chart->add_series( values => [ 'Sheet1', 0, 4, 1, 1 ] ); +$chart->add_series( values => [ 'Sheet1', 0, 4, 2, 2 ] ); + +$worksheet->insert_chart( 'E9', $chart ); + +$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__ + + + diff --git a/t/regression/quote_name06.t b/t/regression/quote_name06.t new file mode 100644 index 00000000..821263a8 --- /dev/null +++ b/t/regression/quote_name06.t @@ -0,0 +1,91 @@ +############################################################################### +# +# Tests the output of Excel::Writer::XLSX against Excel generated files. +# +# Copyright 2000-2024, John McNamara, jmcnamara@cpan.org +# +# SPDX-License-Identifier: Artistic-1.0-Perl OR GPL-1.0-or-later +# + +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 = 'quote_name06.xlsx'; +my $dir = 't/regression/'; +my $got_filename = $dir . "ewx_$filename"; +my $exp_filename = $dir . 'xlsx_files/' . $filename; + +my $ignore_members = []; + +my $ignore_elements = {}; + + +############################################################################### +# +# Test the creation of a simple Excel::Writer::XLSX file. +# +use Excel::Writer::XLSX; + +my $workbook = Excel::Writer::XLSX->new( $got_filename ); +my $worksheet = $workbook->add_worksheet(q{Sheet-1}); +my $chart = $workbook->add_chart( type => 'column', embedded => 1 ); + +# For testing, copy the randomly generated axis ids in the target xlsx file. +$chart->{_axis_ids} = [ 62284544, 83429248 ]; + +my $data = [ + [ 1, 2, 3, 4, 5 ], + [ 2, 4, 6, 8, 10 ], + [ 3, 6, 9, 12, 15 ], + +]; + +$worksheet->write( 'A1', $data ); +$worksheet->repeat_rows( 0, 1 ); +$worksheet->set_portrait(); +$worksheet->{_vertical_dpi} = 200; + +$chart->add_series( values => [ q{Sheet-1}, 0, 4, 0, 0 ] ); +$chart->add_series( values => [ q{Sheet-1}, 0, 4, 1, 1 ] ); +$chart->add_series( values => [ q{Sheet-1}, 0, 4, 2, 2 ] ); + +$worksheet->insert_chart( 'E9', $chart ); + +$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__ + + + diff --git a/t/regression/quote_name07.t b/t/regression/quote_name07.t new file mode 100644 index 00000000..31bb02e2 --- /dev/null +++ b/t/regression/quote_name07.t @@ -0,0 +1,91 @@ +############################################################################### +# +# Tests the output of Excel::Writer::XLSX against Excel generated files. +# +# Copyright 2000-2024, John McNamara, jmcnamara@cpan.org +# +# SPDX-License-Identifier: Artistic-1.0-Perl OR GPL-1.0-or-later +# + +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 = 'quote_name07.xlsx'; +my $dir = 't/regression/'; +my $got_filename = $dir . "ewx_$filename"; +my $exp_filename = $dir . 'xlsx_files/' . $filename; + +my $ignore_members = []; + +my $ignore_elements = {}; + + +############################################################################### +# +# Test the creation of a simple Excel::Writer::XLSX file. +# +use Excel::Writer::XLSX; + +my $workbook = Excel::Writer::XLSX->new( $got_filename ); +my $worksheet = $workbook->add_worksheet(q{Sheet'1}); +my $chart = $workbook->add_chart( type => 'column', embedded => 1 ); + +# For testing, copy the randomly generated axis ids in the target xlsx file. +$chart->{_axis_ids} = [ 48135552, 54701056 ]; + +my $data = [ + [ 1, 2, 3, 4, 5 ], + [ 2, 4, 6, 8, 10 ], + [ 3, 6, 9, 12, 15 ], + +]; + +$worksheet->write( 'A1', $data ); +$worksheet->repeat_rows( 0, 1 ); +$worksheet->set_portrait(); +$worksheet->{_vertical_dpi} = 200; + +$chart->add_series( values => [ q{Sheet'1}, 0, 4, 0, 0 ] ); +$chart->add_series( values => [ q{Sheet'1}, 0, 4, 1, 1 ] ); +$chart->add_series( values => [ q{Sheet'1}, 0, 4, 2, 2 ] ); + +$worksheet->insert_chart( 'E9', $chart ); + +$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__ + + + diff --git a/t/regression/xlsx_files/quote_name05.xlsx b/t/regression/xlsx_files/quote_name05.xlsx new file mode 100644 index 00000000..dc059265 Binary files /dev/null and b/t/regression/xlsx_files/quote_name05.xlsx differ diff --git a/t/regression/xlsx_files/quote_name06.xlsx b/t/regression/xlsx_files/quote_name06.xlsx new file mode 100644 index 00000000..1b49fd8d Binary files /dev/null and b/t/regression/xlsx_files/quote_name06.xlsx differ diff --git a/t/regression/xlsx_files/quote_name07.xlsx b/t/regression/xlsx_files/quote_name07.xlsx new file mode 100644 index 00000000..2277fce0 Binary files /dev/null and b/t/regression/xlsx_files/quote_name07.xlsx differ