|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * This file is part of PHPWord - A pure PHP library for reading and writing |
| 4 | + * word processing documents. |
| 5 | + * |
| 6 | + * PHPWord is free software distributed under the terms of the GNU Lesser |
| 7 | + * General Public License version 3 as published by the Free Software Foundation. |
| 8 | + * |
| 9 | + * For the full copyright and license information, please read the LICENSE |
| 10 | + * file that was distributed with this source code. For the full list of |
| 11 | + * contributors, visit https://github.com/PHPOffice/PHPWord/contributors. |
| 12 | + * |
| 13 | + * @link https://github.com/PHPOffice/PHPWord |
| 14 | + * @copyright 2010-2016 PHPWord contributors |
| 15 | + * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3 |
| 16 | + */ |
| 17 | + |
| 18 | +namespace PhpOffice\PhpWord\Style; |
| 19 | + |
| 20 | +use PhpOffice\PhpWord\PhpWord; |
| 21 | +use PhpOffice\PhpWord\TestHelperDOCX; |
| 22 | + |
| 23 | +/** |
| 24 | + * Test class for PhpOffice\PhpWord\Style\Paper |
| 25 | + * |
| 26 | + * @runTestsInSeparateProcesses |
| 27 | + */ |
| 28 | +class PaperTest extends \PHPUnit_Framework_TestCase |
| 29 | +{ |
| 30 | + /** |
| 31 | + * Tear down after each test |
| 32 | + */ |
| 33 | + public function tearDown() |
| 34 | + { |
| 35 | + TestHelperDOCX::clear(); |
| 36 | + } |
| 37 | + |
| 38 | + /** |
| 39 | + * Test initiation for paper |
| 40 | + */ |
| 41 | + public function testInitiation() |
| 42 | + { |
| 43 | + $object = new Paper(); |
| 44 | + |
| 45 | + $this->assertEquals('A4', $object->getSize()); |
| 46 | + } |
| 47 | + |
| 48 | + /** |
| 49 | + * Test paper size for B5 format |
| 50 | + */ |
| 51 | + public function testB5Size() |
| 52 | + { |
| 53 | + $object = new Paper('B5'); |
| 54 | + |
| 55 | + $this->assertEquals('B5', $object->getSize()); |
| 56 | + $this->assertEquals(9977.9527559055, $object->getWidth(), '', 0.000000001); |
| 57 | + $this->assertEquals(14173.228346457, $object->getHeight(), '', 0.000000001); |
| 58 | + } |
| 59 | + |
| 60 | + /** |
| 61 | + * Test paper size for Folio format |
| 62 | + */ |
| 63 | + public function testFolioSize() |
| 64 | + { |
| 65 | + $object = new Paper(); |
| 66 | + $object->setSize('Folio'); |
| 67 | + |
| 68 | + $this->assertEquals('Folio', $object->getSize()); |
| 69 | + $this->assertEquals(12240, $object->getWidth(), '', 0.1); |
| 70 | + $this->assertEquals(18720, $object->getHeight(), '', 0.1); |
| 71 | + } |
| 72 | +} |
0 commit comments