mirror of
https://github.com/Intervention/image.git
synced 2025-08-23 22:12:51 +02:00
Add tests
This commit is contained in:
@@ -5,6 +5,7 @@ namespace Intervention\Image\Tests\Drivers\Gd;
|
||||
use GdImage;
|
||||
use Intervention\Image\Drivers\Gd\Core;
|
||||
use Intervention\Image\Drivers\Gd\Frame;
|
||||
use Intervention\Image\Exceptions\AnimationException;
|
||||
use Intervention\Image\Tests\TestCase;
|
||||
|
||||
class CoreTest extends TestCase
|
||||
@@ -46,6 +47,8 @@ class CoreTest extends TestCase
|
||||
]);
|
||||
$this->assertInstanceOf(Frame::class, $core->frame(0));
|
||||
$this->assertInstanceOf(Frame::class, $core->frame(1));
|
||||
$this->expectException(AnimationException::class);
|
||||
$core->frame(10);
|
||||
}
|
||||
|
||||
public function testSetGetLoops(): void
|
||||
@@ -59,4 +62,15 @@ class CoreTest extends TestCase
|
||||
$this->assertInstanceOf(Core::class, $result);
|
||||
$this->assertEquals(12, $core->loops());
|
||||
}
|
||||
|
||||
public function testLast(): void
|
||||
{
|
||||
$core = new Core([
|
||||
new Frame(imagecreatetruecolor(3, 2)),
|
||||
new Frame(imagecreatetruecolor(3, 2)),
|
||||
]);
|
||||
|
||||
$result = $core->last();
|
||||
$this->assertInstanceOf(Frame::class, $result);
|
||||
}
|
||||
}
|
||||
|
@@ -139,4 +139,25 @@ class CoreTest extends TestCase
|
||||
$this->assertEquals(2, $core->count());
|
||||
$this->assertEquals(2, $result->count());
|
||||
}
|
||||
|
||||
public function testLast(): void
|
||||
{
|
||||
$imagick = new Imagick();
|
||||
|
||||
$im = new Imagick();
|
||||
$im->newImage(10, 10, new ImagickPixel('red'));
|
||||
$imagick->addImage($im);
|
||||
|
||||
$im = new Imagick();
|
||||
$im->newImage(10, 10, new ImagickPixel('green'));
|
||||
$imagick->addImage($im);
|
||||
|
||||
$im = new Imagick();
|
||||
$im->newImage(10, 10, new ImagickPixel('blue'));
|
||||
$imagick->addImage($im);
|
||||
|
||||
$core = new Core($imagick);
|
||||
$result = $core->last();
|
||||
$this->assertInstanceOf(Frame::class, $result);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user