This repository has been archived by the owner on Dec 28, 2023. It is now read-only.
/
content_types02.t
64 lines (52 loc) · 2.42 KB
/
content_types02.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
###############################################################################
#
# Tests for Excel::Reader::XLSX::Package::ContentTypes methods.
#
# reverse('(c)'), January 2012, John McNamara, jmcnamara@cpan.org
#
use lib 't/lib';
use TestFunctions qw(_is_deep_diff);
use strict;
use warnings;
use Excel::Reader::XLSX::Package::ContentTypes;
use Test::More tests => 1;
###############################################################################
#
# Tests setup.
#
my $expected;
my $caption;
my $got;
my $reader = Excel::Reader::XLSX::Package::ContentTypes->new();
# Same as content_types01.t except pretty printed.
$reader->_read_filehandle( *DATA );
$reader->_read_all_nodes();
###############################################################################
#
# Test the _files property.
#
$caption = " \tContentTypes: _strings";
$expected = {
'_workbook' => 'xl/workbook.xml',
'_workbook_rels' => 'xl/_rels/workbook.xml.rels',
'_app' => 'docProps/app.xml',
'_styles' => 'xl/styles.xml',
'_worksheets' => [ 'xl/worksheets/sheet1.xml' ],
'_core' => 'docProps/core.xml',
'_shared_strings' => 'xl/sharedStrings.xml'
};
$got = $reader->{_files};
_is_deep_diff( $got, $expected, $caption );
__DATA__
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
<Default Extension="xml" ContentType="application/xml"/>
<Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/>
<Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/>
<Override PartName="/xl/sharedStrings.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"/>
<Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/>
<Override PartName="/xl/theme/theme1.xml" ContentType="application/vnd.openxmlformats-officedocument.theme+xml"/>
<Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/>
<Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>
</Types>