diff --git a/tests/PhpWord/Tests/Section/MemoryImageTest.php b/tests/PhpWord/Tests/Section/MemoryImageTest.php deleted file mode 100644 index 5dfef076..00000000 --- a/tests/PhpWord/Tests/Section/MemoryImageTest.php +++ /dev/null @@ -1,78 +0,0 @@ -assertInstanceOf('PhpOffice\\PhpWord\\Section\\MemoryImage', $oMemoryImage); - $this->assertEquals($oMemoryImage->getSource(), $src); - $this->assertEquals($oMemoryImage->getMediaId(), md5($src)); - $this->assertEquals($oMemoryImage->getImageCreateFunction(), 'imagecreatefrompng'); - $this->assertEquals($oMemoryImage->getImageFunction(), 'imagepng'); - $this->assertEquals($oMemoryImage->getImageExtension(), 'png'); - $this->assertEquals($oMemoryImage->getImageType(), 'image/png'); - } - - public function testGIF() - { - $src = __DIR__ . "/../_files/images/mario.gif"; - $oMemoryImage = new MemoryImage($src); - - $this->assertInstanceOf('PhpOffice\\PhpWord\\Section\\MemoryImage', $oMemoryImage); - $this->assertEquals($oMemoryImage->getSource(), $src); - $this->assertEquals($oMemoryImage->getMediaId(), md5($src)); - $this->assertEquals($oMemoryImage->getImageCreateFunction(), 'imagecreatefromgif'); - $this->assertEquals($oMemoryImage->getImageFunction(), 'imagegif'); - $this->assertEquals($oMemoryImage->getImageExtension(), 'gif'); - $this->assertEquals($oMemoryImage->getImageType(), 'image/gif'); - } - - public function testJPG() - { - $src = __DIR__ . "/../_files/images/earth.jpg"; - $oMemoryImage = new MemoryImage($src); - - $this->assertInstanceOf('PhpOffice\\PhpWord\\Section\\MemoryImage', $oMemoryImage); - $this->assertEquals($oMemoryImage->getSource(), $src); - $this->assertEquals($oMemoryImage->getMediaId(), md5($src)); - $this->assertEquals($oMemoryImage->getImageCreateFunction(), 'imagecreatefromjpeg'); - $this->assertEquals($oMemoryImage->getImageFunction(), 'imagejpeg'); - $this->assertEquals($oMemoryImage->getImageExtension(), 'jpg'); - $this->assertEquals($oMemoryImage->getImageType(), 'image/jpeg'); - } - - public function testBMP() - { - $oMemoryImage = new MemoryImage(__DIR__ . "/../_files/images/duke_nukem.bmp"); - - $this->assertInstanceOf('PhpOffice\\PhpWord\\Section\\MemoryImage', $oMemoryImage); - $this->assertEquals($oMemoryImage->getImageCreateFunction(), null); - $this->assertEquals($oMemoryImage->getImageFunction(), null); - $this->assertEquals($oMemoryImage->getImageExtension(), null); - $this->assertEquals($oMemoryImage->getImageType(), 'image/x-ms-bmp'); - } - - public function testStyle() - { - $oMemoryImage = new MemoryImage( - __DIR__ . "/../_files/images/earth.jpg", - array('width' => 210, 'height' => 210, 'align' => 'center') - ); - $this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\Image', $oMemoryImage->getStyle()); - } - - public function testRelationID() - { - $oMemoryImage = new MemoryImage(__DIR__ . "/../_files/images/earth.jpg"); - - $iVal = rand(1, 1000); - $oMemoryImage->setRelationId($iVal); - $this->assertEquals($oMemoryImage->getRelationId(), $iVal); - } -} diff --git a/tests/PhpWord/Tests/Style/TableFullTest.php b/tests/PhpWord/Tests/Style/TableFullTest.php deleted file mode 100644 index 0552f357..00000000 --- a/tests/PhpWord/Tests/Style/TableFullTest.php +++ /dev/null @@ -1,130 +0,0 @@ - 'FF0000'); - $styleFirstRow = array('borderBottomSize' => 3); - - $object = new TableFull($styleTable, $styleFirstRow); - $this->assertEquals('FF0000', $object->getBgColor()); - - $firstRow = $object->getFirstRow(); - $this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\TableFull', $firstRow); - $this->assertEquals(3, $firstRow->getBorderBottomSize()); - } - - /** - * Test setting style with normal value - */ - public function testSetGetNormal() - { - $object = new TableFull(); - - $attributes = array( - 'bgColor' => 'FF0000', - 'borderTopSize' => 4, - 'borderTopColor' => 'FF0000', - 'borderLeftSize' => 4, - 'borderLeftColor' => 'FF0000', - 'borderRightSize' => 4, - 'borderRightColor' => 'FF0000', - 'borderBottomSize' => 4, - 'borderBottomColor' => 'FF0000', - 'borderInsideHSize' => 4, - 'borderInsideHColor' => 'FF0000', - 'borderInsideVSize' => 4, - 'borderInsideVColor' => 'FF0000', - 'cellMarginTop' => 240, - 'cellMarginLeft' => 240, - 'cellMarginRight' => 240, - 'cellMarginBottom' => 240, - ); - foreach ($attributes as $key => $value) { - $set = "set{$key}"; - $get = "get{$key}"; - $object->$set($value); - $this->assertEquals($value, $object->$get()); - } - } - - /** - * Test border color - * - * Set border color and test if each part has the same color - * While looping, push values array to be asserted with getBorderColor - */ - public function testBorderColor() - { - $object = new TableFull(); - $parts = array('Top', 'Left', 'Right', 'Bottom', 'InsideH', 'InsideV'); - - $value = 'FF0000'; - $object->setBorderColor($value); - foreach ($parts as $part) { - $get = "getBorder{$part}Color"; - $values[] = $value; - $this->assertEquals($value, $object->$get()); - } - $this->assertEquals($values, $object->getBorderColor()); - } - - /** - * Test border size - * - * Set border size and test if each part has the same size - * While looping, push values array to be asserted with getBorderSize - * Value is in eights of a point, i.e. 4 / 8 = .5pt - */ - public function testBorderSize() - { - $object = new TableFull(); - $parts = array('Top', 'Left', 'Right', 'Bottom', 'InsideH', 'InsideV'); - - $value = 4; - $object->setBorderSize($value); - foreach ($parts as $part) { - $get = "getBorder{$part}Size"; - $values[] = $value; - $this->assertEquals($value, $object->$get()); - } - $this->assertEquals($values, $object->getBorderSize()); - } - - /** - * Test cell margin - * - * Set cell margin and test if each part has the same margin - * While looping, push values array to be asserted with getCellMargin - * Value is in twips - */ - public function testCellMargin() - { - $object = new TableFull(); - $parts = array('Top', 'Left', 'Right', 'Bottom'); - - $value = 240; - $object->setCellMargin($value); - foreach ($parts as $part) { - $get = "getCellMargin{$part}"; - $values[] = $value; - $this->assertEquals($value, $object->$get()); - } - $this->assertEquals($values, $object->getCellMargin()); - } -}