vendor/phpoffice/phpexcel/unitTests/Classes/PHPExcel/Shared/FontTest.php

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?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');
	}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。