File: sub_position_object.t

package info (click to toggle)
libexcel-writer-xlsx-perl 0.79-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 11,716 kB
  • ctags: 930
  • sloc: perl: 18,380; makefile: 40
file content (116 lines) | stat: -rw-r--r-- 3,212 bytes parent folder | download | duplicates (3)
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
###############################################################################
#
# Tests for Excel::Writer::XLSX::Worksheet methods.
#
# Tests for the _position_object_emus method used to calcualte the twoCellAnchor
# positions for drawing and chart objects.
#
# reverse ('(c)'), March 2011, John McNamara, jmcnamara@cpan.org
#

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

use Test::More tests => 6;

###############################################################################
#
# Tests setup.
#
my @expected;
my @got;
my $tmp = '';
my $caption;
my $worksheet;


###############################################################################
#
# 1. Test _position_object_emus() for chart vertices.
#
$caption = " \tWorksheet: _position_object_emus()";
@expected = ( 4, 8, 0, 0, 11, 22, 304800, 76200, 2438400, 1524000 );

$worksheet = _new_worksheet( \$tmp );

@got = $worksheet->_position_object_emus( 4, 8, 0, 0, 480, 288 );

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


###############################################################################
#
# 2. Test _position_object_emus() for chart vertices.
#
$caption = " \tWorksheet: _position_object_emus()";
@expected = ( 4, 8, 0, 0, 12, 22, 0, 76200, 2438400, 1524000 );

$worksheet = _new_worksheet( \$tmp );
$worksheet->set_column( 'L:L', 3.86 );

@got = $worksheet->_position_object_emus( 4, 8, 0, 0, 480, 288 );

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


###############################################################################
#
# 3. Test _position_object_emus() for chart vertices.
#
$caption = " \tWorksheet: _position_object_emus()";
@expected = ( 4, 8, 0, 0, 12, 23, 0, 0, 2438400, 1524000 );

$worksheet = _new_worksheet( \$tmp );
$worksheet->set_column( 'L:L', 3.86 );
$worksheet->set_row( 22, 6 );

@got = $worksheet->_position_object_emus( 4, 8, 0, 0, 480, 288 );

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


###############################################################################
#
# 4. Test _position_object_emus() for image vertices.
#
$caption = " \tWorksheet: _position_object_emus()";
@expected = ( 4, 8, 0, 0, 4, 9, 304800, 114300, 2438400, 1524000 );

$worksheet = _new_worksheet( \$tmp );

@got = $worksheet->_position_object_emus( 4, 8, 0, 0, 32, 32 );

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


###############################################################################
#
# 5. Test _position_object_emus() for image vertices.
#
$caption = " \tWorksheet: _position_object_emus()";
@expected = ( 4, 8, 19050, 28575, 5, 11, 95250, 142875, 2457450, 1552575 );

$worksheet = _new_worksheet( \$tmp );

@got = $worksheet->_position_object_emus( 4, 8, 2, 3, 72, 72 );

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


###############################################################################
#
# 6. Test _position_object_emus() for image vertices.
#
$caption = " \tWorksheet: _position_object_emus()";
@expected = ( 5, 1, 19050, 28575, 6, 4, 352425, 114300, 3067050, 219075 );

$worksheet = _new_worksheet( \$tmp );

@got = $worksheet->_position_object_emus( 5, 1, 2, 3, 99, 69 );

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


__END__