public function testSize() { $d = new Dimension(); $newd = new Dimension(200, 200); $d->setSize($newd); $getD = $d->getSize(); // new dimension $this->assertNotSame($getD, $newd); $this->assertTrue($getD->equals($newd)); }
/** * {@inheritdoc} */ public function create(Dimension $dimension) { $x = $dimension->getWidth(); $y = $dimension->getHeight(); if ($x <= 0 || $y <= 0) { throw new InvalidDimensionException(sprintf("Invalid Dimension %s ", (string) $dimension)); } $handler = @imagecreatetruecolor($x, $y); if (false == $handler) { throw new CanvasCreationException(sprintf('Unable To Create The Canvas "%s"', (string) $this)); } $this->forceDestory(); $this->setHandler($handler); $this->fill(new RGBColor(0, 0, 0, 127)); return $this; }