File: sub_write_calc_pr.t

package info (click to toggle)
libexcel-writer-xlsx-perl 1.11-1
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 18,096 kB
  • sloc: perl: 22,147; makefile: 41
file content (86 lines) | stat: -rw-r--r-- 2,046 bytes parent folder | download | duplicates (2)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
###############################################################################
#
# Tests for Excel::Writer::XLSX::Workbook methods.
#
# Copyright 2000-2023, John McNamara, jmcnamara@cpan.org
#

use lib 't/lib';
use TestFunctions '_new_workbook';
use strict;
use warnings;

use Test::More tests => 4;


###############################################################################
#
# Tests setup.
#
my $expected;
my $got;
my $caption;
my $workbook;


###############################################################################
#
# Test the _write_calc_pr() method.
#
$caption  = " \tWorkbook: _write_calc_pr()";
$expected = '<calcPr calcId="124519" fullCalcOnLoad="1"/>';

$workbook = _new_workbook(\$got);

$workbook->_write_calc_pr();

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


###############################################################################
#
# Test the _write_calc_pr() method with the calculation mode set to
# auto_except_tables.
#
$caption  = " \tWorkbook: _write_calc_pr()";
$expected = '<calcPr calcId="124519" calcMode="autoNoTable" fullCalcOnLoad="1"/>';

$workbook = _new_workbook(\$got);
$workbook->set_calc_mode('auto_except_tables');

$workbook->_write_calc_pr();

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


###############################################################################
#
# Test the _write_calc_pr() method with the calculation mode set to manual.
#
$caption  = " \tWorkbook: _write_calc_pr()";
$expected = '<calcPr calcId="124519" calcMode="manual" calcOnSave="0"/>';

$workbook = _new_workbook(\$got);
$workbook->set_calc_mode('manual');

$workbook->_write_calc_pr();

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


###############################################################################
#
# Test the _write_calc_pr() method with non-default calc id.
#
$caption  = " \tWorkbook: _write_calc_pr()";
$expected = '<calcPr calcId="12345" fullCalcOnLoad="1"/>';

$workbook = _new_workbook(\$got);
$workbook->set_calc_mode('auto', 12345);

$workbook->_write_calc_pr();

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


__END__