mirror of
https://github.com/Intervention/image.git
synced 2025-01-17 20:28:21 +01:00
Add EllipseTest
This commit is contained in:
parent
c019afd30c
commit
dfd85bda69
56
tests/Geometry/EllipseTest.php
Normal file
56
tests/Geometry/EllipseTest.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace Intervention\Image\Tests\Geometry;
|
||||
|
||||
use Intervention\Image\Geometry\Ellipse;
|
||||
use Intervention\Image\Geometry\Point;
|
||||
use Intervention\Image\Tests\TestCase;
|
||||
|
||||
class EllipseTest extends TestCase
|
||||
{
|
||||
public function testConstructor(): void
|
||||
{
|
||||
$ellipse = new Ellipse(10, 20, new Point(100, 200));
|
||||
$this->assertInstanceOf(Ellipse::class, $ellipse);
|
||||
$this->assertEquals(10, $ellipse->width());
|
||||
$this->assertEquals(20, $ellipse->height());
|
||||
}
|
||||
|
||||
public function testPosition(): void
|
||||
{
|
||||
$ellipse = new Ellipse(10, 20, new Point(100, 200));
|
||||
$this->assertInstanceOf(Point::class, $ellipse->position());
|
||||
$this->assertEquals(100, $ellipse->position()->x());
|
||||
$this->assertEquals(200, $ellipse->position()->y());
|
||||
|
||||
$this->assertInstanceOf(Point::class, $ellipse->pivot());
|
||||
$this->assertEquals(100, $ellipse->pivot()->x());
|
||||
$this->assertEquals(200, $ellipse->pivot()->y());
|
||||
}
|
||||
|
||||
public function testSetSize(): void
|
||||
{
|
||||
$ellipse = new Ellipse(10, 20, new Point(100, 200));
|
||||
$this->assertEquals(10, $ellipse->width());
|
||||
$this->assertEquals(20, $ellipse->height());
|
||||
$result = $ellipse->setSize(100, 200);
|
||||
$this->assertInstanceOf(Ellipse::class, $result);
|
||||
$this->assertEquals(100, $ellipse->width());
|
||||
$this->assertEquals(200, $ellipse->height());
|
||||
}
|
||||
|
||||
public function testSetWidthHeight(): void
|
||||
{
|
||||
$ellipse = new Ellipse(10, 20, new Point(100, 200));
|
||||
$this->assertEquals(10, $ellipse->width());
|
||||
$this->assertEquals(20, $ellipse->height());
|
||||
$result = $ellipse->setWidth(100);
|
||||
$this->assertInstanceOf(Ellipse::class, $result);
|
||||
$this->assertEquals(100, $ellipse->width());
|
||||
$this->assertEquals(20, $ellipse->height());
|
||||
$result = $ellipse->setHeight(200);
|
||||
$this->assertInstanceOf(Ellipse::class, $result);
|
||||
$this->assertEquals(100, $ellipse->width());
|
||||
$this->assertEquals(200, $ellipse->height());
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user