コード例 #1
0
ファイル: DrawingTest.php プロジェクト: hxsam/PHPPresentation
 public function testSetWidthAndHeight()
 {
     $object = new Drawing();
     $valueWidth = rand(1, 100);
     $valueHeight = $valueWidth / 2;
     $object->setResizeProportional(false);
     $object->setWidth($valueWidth);
     $object->setHeight($valueHeight);
     $object->setResizeProportional(true);
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Drawing', $object->setWidthAndHeight($valueHeight, $valueWidth));
     $this->assertEquals($valueHeight, $object->getWidth());
     $this->assertEquals(ceil($valueHeight * ($valueHeight / $valueWidth)), $object->getHeight());
     $object = new Drawing();
     $valueWidth = rand(1, 100);
     $valueHeight = $valueWidth / 2;
     $object->setResizeProportional(false);
     $object->setWidth($valueWidth);
     $object->setHeight($valueHeight);
     $object->setResizeProportional(true);
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Drawing', $object->setWidthAndHeight($valueWidth, $valueHeight));
     $this->assertEquals($valueHeight, $object->getHeight());
     $this->assertEquals(ceil($valueWidth * ($valueHeight / $valueHeight)), $object->getWidth());
 }