/var/www/hkosl.com/imusiccircle/webadmin/libraies/phpoffice/phpexcel/unitTests/Classes/PHPExcel/Chart/LegendTest.php


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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<?php


class LegendTest extends PHPUnit_Framework_TestCase
{

    public function 
setUp()
    {
        if (!
defined('PHPEXCEL_ROOT'))
        {
            
define('PHPEXCEL_ROOT'APPLICATION_PATH '/');
        }
        require_once(
PHPEXCEL_ROOT 'PHPExcel/Autoloader.php');
    }

    public function 
testSetPosition()
    {
        
$positionValues = array(
            
PHPExcel_Chart_Legend::POSITION_RIGHT,
            
PHPExcel_Chart_Legend::POSITION_LEFT,
            
PHPExcel_Chart_Legend::POSITION_TOP,
            
PHPExcel_Chart_Legend::POSITION_BOTTOM,
            
PHPExcel_Chart_Legend::POSITION_TOPRIGHT,
        );

        
$testInstance = new PHPExcel_Chart_Legend;

        foreach(
$positionValues as $positionValue) {
            
$result $testInstance->setPosition($positionValue);
            
$this->assertTrue($result);
        }
    }

    public function 
testSetInvalidPositionReturnsFalse()
    {
        
$testInstance = new PHPExcel_Chart_Legend;

        
$result $testInstance->setPosition('BottomLeft');
        
$this->assertFalse($result);
        
//    Ensure that value is unchanged
        
$result $testInstance->getPosition();
        
$this->assertEquals(PHPExcel_Chart_Legend::POSITION_RIGHT,$result);
    }

    public function 
testGetPosition()
    {
        
$PositionValue PHPExcel_Chart_Legend::POSITION_BOTTOM;

        
$testInstance = new PHPExcel_Chart_Legend;
        
$setValue $testInstance->setPosition($PositionValue);

        
$result $testInstance->getPosition();
        
$this->assertEquals($PositionValue,$result);
    }

    public function 
testSetPositionXL()
    {
        
$positionValues = array(
            
PHPExcel_Chart_Legend::xlLegendPositionBottom,
            
PHPExcel_Chart_Legend::xlLegendPositionCorner,
            
PHPExcel_Chart_Legend::xlLegendPositionCustom,
            
PHPExcel_Chart_Legend::xlLegendPositionLeft,
            
PHPExcel_Chart_Legend::xlLegendPositionRight,
            
PHPExcel_Chart_Legend::xlLegendPositionTop,
        );

        
$testInstance = new PHPExcel_Chart_Legend;

        foreach(
$positionValues as $positionValue) {
            
$result $testInstance->setPositionXL($positionValue);
            
$this->assertTrue($result);
        }
    }

    public function 
testSetInvalidXLPositionReturnsFalse()
    {
        
$testInstance = new PHPExcel_Chart_Legend;

        
$result $testInstance->setPositionXL(999);
        
$this->assertFalse($result);
        
//    Ensure that value is unchanged
        
$result $testInstance->getPositionXL();
        
$this->assertEquals(PHPExcel_Chart_Legend::xlLegendPositionRight,$result);
    }

    public function 
testGetPositionXL()
    {
        
$PositionValue PHPExcel_Chart_Legend::xlLegendPositionCorner;

        
$testInstance = new PHPExcel_Chart_Legend;
        
$setValue $testInstance->setPositionXL($PositionValue);

        
$result $testInstance->getPositionXL();
        
$this->assertEquals($PositionValue,$result);
    }

    public function 
testSetOverlay()
    {
        
$overlayValues = array(
            
TRUE,
            
FALSE,
        );

        
$testInstance = new PHPExcel_Chart_Legend;

        foreach(
$overlayValues as $overlayValue) {
            
$result $testInstance->setOverlay($overlayValue);
            
$this->assertTrue($result);
        }
    }

    public function 
testSetInvalidOverlayReturnsFalse()
    {
        
$testInstance = new PHPExcel_Chart_Legend;

        
$result $testInstance->setOverlay('INVALID');
        
$this->assertFalse($result);

        
$result $testInstance->getOverlay();
        
$this->assertFalse($result);
    }

    public function 
testGetOverlay()
    {
        
$OverlayValue TRUE;

        
$testInstance = new PHPExcel_Chart_Legend;
        
$setValue $testInstance->setOverlay($OverlayValue);

        
$result $testInstance->getOverlay();
        
$this->assertEquals($OverlayValue,$result);
    }

}