/var/www/hkosl.com/imusiccircle/webadmin/libraies/phpoffice/phpexcel/unitTests/Classes/PHPExcel/Shared/FontTest.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
<?php


require_once 'testDataFileIterator.php';

class 
FontTest 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 
testGetAutoSizeMethod()
    {
        
$expectedResult PHPExcel_Shared_Font::AUTOSIZE_METHOD_APPROX;

        
$result call_user_func(array('PHPExcel_Shared_Font','getAutoSizeMethod'));
        
$this->assertEquals($expectedResult$result);
    }

    public function 
testSetAutoSizeMethod()
    {
        
$autosizeMethodValues = array(
            
PHPExcel_Shared_Font::AUTOSIZE_METHOD_EXACT,
            
PHPExcel_Shared_Font::AUTOSIZE_METHOD_APPROX,
        );

        foreach(
$autosizeMethodValues as $autosizeMethodValue) {
            
$result call_user_func(array('PHPExcel_Shared_Font','setAutoSizeMethod'),$autosizeMethodValue);
            
$this->assertTrue($result);
        }
    }

    public function 
testSetAutoSizeMethodWithInvalidValue()
    {
        
$unsupportedAutosizeMethod 'guess';

        
$result call_user_func(array('PHPExcel_Shared_Font','setAutoSizeMethod'),$unsupportedAutosizeMethod);
        
$this->assertFalse($result);
    }

    
/**
     * @dataProvider providerFontSizeToPixels
     */
    
public function testFontSizeToPixels()
    {
        
$args func_get_args();
        
$expectedResult array_pop($args);
        
$result call_user_func_array(array('PHPExcel_Shared_Font','fontSizeToPixels'),$args);
        
$this->assertEquals($expectedResult$result);
    }

    public function 
providerFontSizeToPixels()
    {
        return new 
testDataFileIterator('rawTestData/Shared/FontSizeToPixels.data');
    }

    
/**
     * @dataProvider providerInchSizeToPixels
     */
    
public function testInchSizeToPixels()
    {
        
$args func_get_args();
        
$expectedResult array_pop($args);
        
$result call_user_func_array(array('PHPExcel_Shared_Font','inchSizeToPixels'),$args);
        
$this->assertEquals($expectedResult$result);
    }

    public function 
providerInchSizeToPixels()
    {
        return new 
testDataFileIterator('rawTestData/Shared/InchSizeToPixels.data');
    }

    
/**
     * @dataProvider providerCentimeterSizeToPixels
     */
    
public function testCentimeterSizeToPixels()
    {
        
$args func_get_args();
        
$expectedResult array_pop($args);
        
$result call_user_func_array(array('PHPExcel_Shared_Font','centimeterSizeToPixels'),$args);
        
$this->assertEquals($expectedResult$result);
    }

    public function 
providerCentimeterSizeToPixels()
    {
        return new 
testDataFileIterator('rawTestData/Shared/CentimeterSizeToPixels.data');
    }

}