diff --git a/Classes/PHPWord/Shared/XMLWriter.php b/Classes/PHPWord/Shared/XMLWriter.php index 2795083e..ae4fa160 100755 --- a/Classes/PHPWord/Shared/XMLWriter.php +++ b/Classes/PHPWord/Shared/XMLWriter.php @@ -57,7 +57,7 @@ class PHPWord_Shared_XMLWriter private $_tempFileName = ''; /** - * Create a new PHPPowerPoint_Shared_XMLWriter instance + * Create a new PHPWord_Shared_XMLWriter instance * * @param int $pTemporaryStorage Temporary storage location * @param string $pTemporaryStorageFolder Temporary storage folder diff --git a/Classes/PHPWord/Writer/ODText.php b/Classes/PHPWord/Writer/ODText.php index 3414179d..3421da8f 100755 --- a/Classes/PHPWord/Writer/ODText.php +++ b/Classes/PHPWord/Writer/ODText.php @@ -212,7 +212,7 @@ class PHPWord_Writer_ODText implements PHPWord_Writer_IWriter * * @param PHPWord $pPHPWord PHPWord object * @throws Exception - * @return PHPWord_Writer_PowerPoint2007 + * @return PHPWord_Writer_ODText */ public function setPHPWord(PHPWord $pPHPWord = null) { @@ -261,7 +261,7 @@ class PHPWord_Writer_ODText implements PHPWord_Writer_IWriter * @param boolean $pValue * @param string $pDirectory Disk caching directory * @throws Exception Exception when directory does not exist - * @return PHPWord_Writer_PowerPoint2007 + * @return PHPWord_Writer_ODText */ public function setUseDiskCaching($pValue = false, $pDirectory = null) { diff --git a/Classes/PHPWord/Writer/RTF.php b/Classes/PHPWord/Writer/RTF.php index 12400907..14f56318 100755 --- a/Classes/PHPWord/Writer/RTF.php +++ b/Classes/PHPWord/Writer/RTF.php @@ -117,7 +117,7 @@ class PHPWord_Writer_RTF implements PHPWord_Writer_IWriter * * @param PHPWord $pPHPWord PHPWord object * @throws Exception - * @return PHPWord_Writer_PowerPoint2007 + * @return PHPWord_Writer_RTF */ public function setPHPWord(PHPWord $pPHPWord = null) { diff --git a/Classes/PHPWord/Writer/Word2007/ContentTypes.php b/Classes/PHPWord/Writer/Word2007/ContentTypes.php index 0c8da192..b17bdae3 100755 --- a/Classes/PHPWord/Writer/Word2007/ContentTypes.php +++ b/Classes/PHPWord/Writer/Word2007/ContentTypes.php @@ -172,7 +172,7 @@ class PHPWord_Writer_Word2007_ContentTypes extends PHPWord_Writer_Word2007_Write /** * Write Override content type * - * @param PHPPowerPoint_Shared_XMLWriter $objWriter XML Writer + * @param PHPWord_Shared_XMLWriter $objWriter XML Writer * @param string $pPartname Part name * @param string $pContentType Content type * @throws Exception diff --git a/Tests/PHPWord/Shared/DrawingTest.php b/Tests/PHPWord/Shared/DrawingTest.php new file mode 100644 index 00000000..cfebad34 --- /dev/null +++ b/Tests/PHPWord/Shared/DrawingTest.php @@ -0,0 +1,69 @@ +assertEquals(round($value * 9525), $result); + + $result = PHPWord_Shared_Drawing::EMUToPixels($value); + $this->assertEquals(round($value / 9525), $result); + + $result = PHPWord_Shared_Drawing::pixelsToPoints($value); + $this->assertEquals($value * 0.67777777, $result); + + $result = PHPWord_Shared_Drawing::pointsToPixels($value); + $this->assertEquals($value * 1.333333333, $result); + + $result = PHPWord_Shared_Drawing::degreesToAngle($value); + $this->assertEquals((int)round($value * 60000), $result); + + $result = PHPWord_Shared_Drawing::angleToDegrees($value); + $this->assertEquals(round($value / 60000), $result); + + $result = PHPWord_Shared_Drawing::pixelsToCentimeters($value); + $this->assertEquals($value * 0.028, $result); + + $result = PHPWord_Shared_Drawing::centimetersToPixels($value); + $this->assertEquals($value / 0.028, $result); + } + } + + /** + * Test htmlToRGB() + */ + public function testHtmlToRGB() + { + // Prepare test values [ original, expected ] + $values[] = array('#FF99DD', array(255, 153, 221)); // With # + $values[] = array('FF99DD', array(255, 153, 221)); // 6 characters + $values[] = array('F9D', array(255, 153, 221)); // 3 characters + $values[] = array('0F9D', false); // 4 characters + // Conduct test + foreach ($values as $value) { + $result = PHPWord_Shared_Drawing::htmlToRGB($value[0]); + $this->assertEquals($value[1], $result); + } + } + +} \ No newline at end of file diff --git a/Tests/PHPWord/Shared/FileTest.php b/Tests/PHPWord/Shared/FileTest.php new file mode 100644 index 00000000..fb7a8bd6 --- /dev/null +++ b/Tests/PHPWord/Shared/FileTest.php @@ -0,0 +1,41 @@ +assertTrue(PHPWord_Shared_File::file_exists('blank.docx')); + } + + /** + * Test realpath() + */ + public function testRealpath() + { + $dir = join(DIRECTORY_SEPARATOR, + array(PHPWORD_TESTS_DIR_ROOT, '_files', 'templates')); + chdir($dir); + $file = 'blank.docx'; + $expected = $dir . DIRECTORY_SEPARATOR . $file; + $this->assertEquals($expected, PHPWord_Shared_File::realpath($file)); + } + +} diff --git a/Tests/PHPWord/Shared/StringTest.php b/Tests/PHPWord/Shared/StringTest.php new file mode 100644 index 00000000..9bb0d63b --- /dev/null +++ b/Tests/PHPWord/Shared/StringTest.php @@ -0,0 +1,45 @@ + 'mb_convert_encoding', + 'iconv' => 'iconv', + ); + foreach ($features as $key => $val) { + $expected = function_exists($val); + $get = "getIs{$key}Enabled"; + $firstResult = PHPWord_Shared_String::$get(); + $this->assertEquals($expected, $firstResult); + $secondResult = PHPWord_Shared_String::$get(); + $this->assertEquals($firstResult, $secondResult); + } + } + + /** + * Test FormatNumber() + */ + public function testFormatNumber() + { + $expected = '1022.12'; + $returned = PHPWord_Shared_String::FormatNumber('1022.1234'); + $this->assertEquals($expected, $returned); + } + +}