1
0
mirror of https://github.com/Intervention/image.git synced 2025-01-17 20:28:21 +01:00

Add EllipseTest

This commit is contained in:
Oliver Vogel 2024-01-15 11:04:38 +01:00
parent c019afd30c
commit dfd85bda69

View 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());
}
}