2021-10-21 14:32:05 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Intervention\Image\Tests\Drivers\Imagick;
|
|
|
|
|
|
|
|
use Imagick;
|
|
|
|
use ImagickPixel;
|
|
|
|
use Intervention\Image\Collection;
|
|
|
|
use Intervention\Image\Drivers\Imagick\Frame;
|
|
|
|
use Intervention\Image\Drivers\Imagick\Image;
|
|
|
|
use Intervention\Image\Geometry\Size;
|
|
|
|
use Intervention\Image\Tests\TestCase;
|
|
|
|
|
|
|
|
class ImageTest extends TestCase
|
|
|
|
{
|
|
|
|
protected Image $image;
|
|
|
|
|
|
|
|
protected function setUp(): void
|
|
|
|
{
|
|
|
|
$imagick = new Imagick();
|
|
|
|
$imagick->newImage(3, 2, new ImagickPixel('red'), 'png');
|
|
|
|
|
|
|
|
$this->image = new Image(new Collection([new Frame($imagick)]));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testConstructor(): void
|
|
|
|
{
|
|
|
|
$this->assertInstanceOf(Image::class, $this->image);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testIterator(): void
|
|
|
|
{
|
|
|
|
foreach ($this->image as $frame) {
|
|
|
|
$this->assertInstanceOf(Frame::class, $frame);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testWidth(): void
|
|
|
|
{
|
2021-12-07 11:00:06 +00:00
|
|
|
$this->assertEquals(3, $this->image->getWidth());
|
2021-10-21 14:32:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testHeight(): void
|
|
|
|
{
|
2021-12-07 11:00:06 +00:00
|
|
|
$this->assertEquals(2, $this->image->getHeight());
|
2021-10-21 14:32:05 +02:00
|
|
|
}
|
|
|
|
|
2021-10-30 16:29:05 +00:00
|
|
|
public function testGetSize(): void
|
2021-10-21 14:32:05 +02:00
|
|
|
{
|
2021-10-30 16:29:05 +00:00
|
|
|
$this->assertInstanceOf(Size::class, $this->image->getSize());
|
2021-10-21 14:32:05 +02:00
|
|
|
}
|
|
|
|
}
|