1###############################################################################
2#
3# Tests for Excel::Writer::XLSX::Package::Core methods.
4#
5# Copyright 2000-2021, John McNamara, jmcnamara@cpan.org
6#
7
8use lib 't/lib';
9use TestFunctions qw(_expected_to_aref _got_to_aref _is_deep_diff _new_object);
10use strict;
11use warnings;
12use Excel::Writer::XLSX::Package::Core;
13
14use Test::More tests => 1;
15
16###############################################################################
17#
18# Tests setup.
19#
20my $expected;
21my $caption;
22my $got;
23my $obj = _new_object( \$got, 'Excel::Writer::XLSX::Package::Core' );
24
25my %properties = (
26    title    => 'This is an example spreadsheet',
27    subject  => 'With document properties',
28    author   => 'John McNamara',
29    manager  => 'Dr. Heinz Doofenshmirtz',
30    company  => 'of Wolves',
31    category => 'Example spreadsheets',
32    keywords => 'Sample, Example, Properties',
33    comments => 'Created with Perl and Excel::Writer::XLSX',
34    status   => 'Quo',
35    created  => [ 15, 45, 19, 6, 3, 111 ],
36);
37
38###############################################################################
39#
40# Test the _assemble_xml_file() method.
41#
42$caption = " \tCore: _assemble_xml_file()";
43
44$obj->_set_properties( \%properties );
45$obj->_assemble_xml_file();
46
47$expected = _expected_to_aref();
48$got      = _got_to_aref( $got );
49
50_is_deep_diff( $got, $expected, $caption );
51
52__DATA__
53<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
54<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
55  <dc:title>This is an example spreadsheet</dc:title>
56  <dc:subject>With document properties</dc:subject>
57  <dc:creator>John McNamara</dc:creator>
58  <cp:keywords>Sample, Example, Properties</cp:keywords>
59  <dc:description>Created with Perl and Excel::Writer::XLSX</dc:description>
60  <cp:lastModifiedBy>John McNamara</cp:lastModifiedBy>
61  <dcterms:created xsi:type="dcterms:W3CDTF">2011-04-06T19:45:15Z</dcterms:created>
62  <dcterms:modified xsi:type="dcterms:W3CDTF">2011-04-06T19:45:15Z</dcterms:modified>
63  <cp:category>Example spreadsheets</cp:category>
64  <cp:contentStatus>Quo</cp:contentStatus>
65</cp:coreProperties>
66