mirror of
https://github.com/Intervention/image.git
synced 2025-01-17 12:18:14 +01:00
Rename method
This commit is contained in:
parent
966ded4d00
commit
aa59a486d8
@ -13,7 +13,7 @@ class ColorspaceAnalyzerTest extends TestCase
|
||||
|
||||
public function testAnalyze(): void
|
||||
{
|
||||
$image = $this->createTestImage('tile.png');
|
||||
$image = $this->readTestImage('tile.png');
|
||||
$analyzer = new ColorspaceAnalyzer();
|
||||
$result = $analyzer->analyze($image);
|
||||
$this->assertInstanceOf(ColorspaceInterface::class, $result);
|
||||
|
@ -12,7 +12,7 @@ class HeightAnalyzerTest extends TestCase
|
||||
|
||||
public function testAnalyze(): void
|
||||
{
|
||||
$image = $this->createTestImage('tile.png');
|
||||
$image = $this->readTestImage('tile.png');
|
||||
$analyzer = new HeightAnalyzer();
|
||||
$result = $analyzer->analyze($image);
|
||||
$this->assertEquals(16, $result);
|
||||
|
@ -13,7 +13,7 @@ class PixelColorAnalyzerTest extends TestCase
|
||||
|
||||
public function testAnalyze(): void
|
||||
{
|
||||
$image = $this->createTestImage('tile.png');
|
||||
$image = $this->readTestImage('tile.png');
|
||||
$analyzer = new PixelColorAnalyzer(0, 0);
|
||||
$result = $analyzer->analyze($image);
|
||||
$this->assertInstanceOf(ColorInterface::class, $result);
|
||||
|
@ -14,7 +14,7 @@ class PixelColorsAnalyzerTest extends TestCase
|
||||
|
||||
public function testAnalyze(): void
|
||||
{
|
||||
$image = $this->createTestImage('tile.png');
|
||||
$image = $this->readTestImage('tile.png');
|
||||
$analyzer = new PixelColorsAnalyzer(0, 0);
|
||||
$result = $analyzer->analyze($image);
|
||||
$this->assertInstanceOf(Collection::class, $result);
|
||||
|
@ -13,7 +13,7 @@ class ResolutionAnalyzerTest extends TestCase
|
||||
|
||||
public function testAnalyze(): void
|
||||
{
|
||||
$image = $this->createTestImage('tile.png');
|
||||
$image = $this->readTestImage('tile.png');
|
||||
$analyzer = new ResolutionAnalyzer();
|
||||
$result = $analyzer->analyze($image);
|
||||
$this->assertInstanceOf(Resolution::class, $result);
|
||||
|
@ -12,7 +12,7 @@ class WidthAnalyzerTest extends TestCase
|
||||
|
||||
public function testAnalyze(): void
|
||||
{
|
||||
$image = $this->createTestImage('tile.png');
|
||||
$image = $this->readTestImage('tile.png');
|
||||
$analyzer = new WidthAnalyzer();
|
||||
$result = $analyzer->analyze($image);
|
||||
$this->assertEquals(16, $result);
|
||||
|
@ -18,7 +18,7 @@ class ImageObjectDecoderTest extends TestCase
|
||||
public function testDecode(): void
|
||||
{
|
||||
$decoder = new ImageObjectDecoder();
|
||||
$result = $decoder->decode($this->createTestImage('blue.gif'));
|
||||
$result = $decoder->decode($this->readTestImage('blue.gif'));
|
||||
$this->assertInstanceOf(Image::class, $result);
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ class GifEncoderTest extends TestCase
|
||||
|
||||
public function testEncodeReduced(): void
|
||||
{
|
||||
$image = $this->createTestImage('gradient.gif');
|
||||
$image = $this->readTestImage('gradient.gif');
|
||||
$gd = $image->core()->native();
|
||||
$this->assertEquals(15, imagecolorstotal($gd));
|
||||
$encoder = new GifEncoder(2);
|
||||
|
@ -38,7 +38,7 @@ class PngEncoderTest extends TestCase
|
||||
|
||||
public function testEncodeReduced(): void
|
||||
{
|
||||
$image = $this->createTestImage('tile.png');
|
||||
$image = $this->readTestImage('tile.png');
|
||||
$gd = $image->core()->native();
|
||||
$this->assertEquals(3, imagecolorstotal($gd));
|
||||
$encoder = new PngEncoder(2);
|
||||
|
@ -16,7 +16,7 @@ class BlurModifierTest extends TestCase
|
||||
|
||||
public function testColorChange(): void
|
||||
{
|
||||
$image = $this->createTestImage('trim.png');
|
||||
$image = $this->readTestImage('trim.png');
|
||||
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
|
||||
$image->modify(new BlurModifier(30));
|
||||
$this->assertEquals('4fa68d', $image->pickColor(14, 14)->toHex());
|
||||
|
@ -16,7 +16,7 @@ class BrightnessModifierTest extends TestCase
|
||||
|
||||
public function testApply(): void
|
||||
{
|
||||
$image = $this->createTestImage('trim.png');
|
||||
$image = $this->readTestImage('trim.png');
|
||||
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
|
||||
$image->modify(new BrightnessModifier(30));
|
||||
$this->assertEquals('4cfaff', $image->pickColor(14, 14)->toHex());
|
||||
|
@ -16,7 +16,7 @@ class ColorizeModifierTest extends TestCase
|
||||
|
||||
public function testModify(): void
|
||||
{
|
||||
$image = $this->createTestImage('tile.png');
|
||||
$image = $this->readTestImage('tile.png');
|
||||
$image = $image->modify(new ColorizeModifier(100, -100, -100));
|
||||
$this->assertColor(255, 0, 0, 255, $image->pickColor(5, 5));
|
||||
$this->assertColor(255, 0, 0, 255, $image->pickColor(15, 15));
|
||||
|
@ -16,7 +16,7 @@ class ContainModifierTest extends TestCase
|
||||
|
||||
public function testModify(): void
|
||||
{
|
||||
$image = $this->createTestImage('blocks.png');
|
||||
$image = $this->readTestImage('blocks.png');
|
||||
$this->assertEquals(640, $image->width());
|
||||
$this->assertEquals(480, $image->height());
|
||||
$image->modify(new ContainModifier(200, 100, 'ff0'));
|
||||
|
@ -16,7 +16,7 @@ class ContrastModifierTest extends TestCase
|
||||
|
||||
public function testApply(): void
|
||||
{
|
||||
$image = $this->createTestImage('trim.png');
|
||||
$image = $this->readTestImage('trim.png');
|
||||
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
|
||||
$image->modify(new ContrastModifier(30));
|
||||
$this->assertEquals('00ceff', $image->pickColor(14, 14)->toHex());
|
||||
|
@ -16,7 +16,7 @@ class CoverModifierTest extends TestCase
|
||||
|
||||
public function testModify(): void
|
||||
{
|
||||
$image = $this->createTestImage('blocks.png');
|
||||
$image = $this->readTestImage('blocks.png');
|
||||
$this->assertEquals(640, $image->width());
|
||||
$this->assertEquals(480, $image->height());
|
||||
$image->modify(new CoverModifier(100, 100, 'center'));
|
||||
|
@ -16,7 +16,7 @@ class CropModifierTest extends TestCase
|
||||
|
||||
public function testModify(): void
|
||||
{
|
||||
$image = $this->createTestImage('blocks.png');
|
||||
$image = $this->readTestImage('blocks.png');
|
||||
$image = $image->modify(new CropModifier(200, 200, 0, 0, 'bottom-right'));
|
||||
$this->assertEquals(200, $image->width());
|
||||
$this->assertEquals(200, $image->height());
|
||||
|
@ -18,7 +18,7 @@ class DrawEllipseModifierTest extends TestCase
|
||||
|
||||
public function testApply(): void
|
||||
{
|
||||
$image = $this->createTestImage('trim.png');
|
||||
$image = $this->readTestImage('trim.png');
|
||||
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
|
||||
$drawable = new Ellipse(10, 10, new Point(14, 14));
|
||||
$drawable->setBackgroundColor('b53717');
|
||||
|
@ -18,7 +18,7 @@ class DrawLineModifierTest extends TestCase
|
||||
|
||||
public function testApply(): void
|
||||
{
|
||||
$image = $this->createTestImage('trim.png');
|
||||
$image = $this->readTestImage('trim.png');
|
||||
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
|
||||
$line = new Line(new Point(0, 0), new Point(10, 0), 4);
|
||||
$line->setBackgroundColor('b53517');
|
||||
|
@ -17,7 +17,7 @@ class DrawPixelModifierTest extends TestCase
|
||||
|
||||
public function testApply(): void
|
||||
{
|
||||
$image = $this->createTestImage('trim.png');
|
||||
$image = $this->readTestImage('trim.png');
|
||||
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
|
||||
$image->modify(new DrawPixelModifier(new Point(14, 14), 'ffffff'));
|
||||
$this->assertEquals('ffffff', $image->pickColor(14, 14)->toHex());
|
||||
|
@ -18,7 +18,7 @@ class DrawPolygonModifierTest extends TestCase
|
||||
|
||||
public function testApply(): void
|
||||
{
|
||||
$image = $this->createTestImage('trim.png');
|
||||
$image = $this->readTestImage('trim.png');
|
||||
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
|
||||
$drawable = new Polygon([new Point(0, 0), new Point(15, 15), new Point(20, 20)]);
|
||||
$drawable->setBackgroundColor('b53717');
|
||||
|
@ -18,7 +18,7 @@ class DrawRectangleModifierTest extends TestCase
|
||||
|
||||
public function testApply(): void
|
||||
{
|
||||
$image = $this->createTestImage('trim.png');
|
||||
$image = $this->readTestImage('trim.png');
|
||||
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
|
||||
$rectangle = new Rectangle(300, 200, new Point(14, 14));
|
||||
$rectangle->setBackgroundColor('ffffff');
|
||||
|
@ -18,7 +18,7 @@ class FillModifierTest extends TestCase
|
||||
|
||||
public function testFloodFillColor(): void
|
||||
{
|
||||
$image = $this->createTestImage('blocks.png');
|
||||
$image = $this->readTestImage('blocks.png');
|
||||
$this->assertEquals('0000ff', $image->pickColor(420, 270)->toHex());
|
||||
$this->assertEquals('ff0000', $image->pickColor(540, 400)->toHex());
|
||||
$image->modify(new FillModifier(new Color(204, 204, 204), new Point(540, 400)));
|
||||
@ -28,7 +28,7 @@ class FillModifierTest extends TestCase
|
||||
|
||||
public function testFillAllColor(): void
|
||||
{
|
||||
$image = $this->createTestImage('blocks.png');
|
||||
$image = $this->readTestImage('blocks.png');
|
||||
$this->assertEquals('0000ff', $image->pickColor(420, 270)->toHex());
|
||||
$this->assertEquals('ff0000', $image->pickColor(540, 400)->toHex());
|
||||
$image->modify(new FillModifier(new Color(204, 204, 204)));
|
||||
|
@ -18,7 +18,7 @@ class FlipFlopModifierTest extends TestCase
|
||||
|
||||
public function testFlipImage(): void
|
||||
{
|
||||
$image = $this->createTestImage('tile.png');
|
||||
$image = $this->readTestImage('tile.png');
|
||||
$this->assertEquals('b4e000', $image->pickColor(0, 0)->toHex());
|
||||
$image->modify(new FlipModifier());
|
||||
$this->assertEquals('00000000', $image->pickColor(0, 0)->toHex());
|
||||
@ -26,7 +26,7 @@ class FlipFlopModifierTest extends TestCase
|
||||
|
||||
public function testFlopImage(): void
|
||||
{
|
||||
$image = $this->createTestImage('tile.png');
|
||||
$image = $this->readTestImage('tile.png');
|
||||
$this->assertEquals('b4e000', $image->pickColor(0, 0)->toHex());
|
||||
$image->modify(new FlopModifier());
|
||||
$this->assertEquals('00000000', $image->pickColor(0, 0)->toHex());
|
||||
|
@ -16,7 +16,7 @@ class GammaModifierTest extends TestCase
|
||||
|
||||
public function testModifier(): void
|
||||
{
|
||||
$image = $this->createTestImage('trim.png');
|
||||
$image = $this->readTestImage('trim.png');
|
||||
$this->assertEquals('00aef0', $image->pickColor(0, 0)->toHex());
|
||||
$image->modify(new GammaModifier(2.1));
|
||||
$this->assertEquals('00d5f8', $image->pickColor(0, 0)->toHex());
|
||||
|
@ -16,7 +16,7 @@ class GreyscaleModifierTest extends TestCase
|
||||
|
||||
public function testColorChange(): void
|
||||
{
|
||||
$image = $this->createTestImage('trim.png');
|
||||
$image = $this->readTestImage('trim.png');
|
||||
$this->assertFalse($image->pickColor(0, 0)->isGreyscale());
|
||||
$image->modify(new GreyscaleModifier());
|
||||
$this->assertTrue($image->pickColor(0, 0)->isGreyscale());
|
||||
|
@ -16,7 +16,7 @@ class InvertModifierTest extends TestCase
|
||||
|
||||
public function testApply(): void
|
||||
{
|
||||
$image = $this->createTestImage('trim.png');
|
||||
$image = $this->readTestImage('trim.png');
|
||||
$this->assertEquals('00aef0', $image->pickColor(0, 0)->toHex());
|
||||
$this->assertEquals('ffa601', $image->pickColor(25, 25)->toHex());
|
||||
$image->modify(new InvertModifier());
|
||||
|
@ -16,7 +16,7 @@ class PixelateModifierTest extends TestCase
|
||||
|
||||
public function testModify(): void
|
||||
{
|
||||
$image = $this->createTestImage('trim.png');
|
||||
$image = $this->readTestImage('trim.png');
|
||||
$this->assertEquals('00aef0', $image->pickColor(0, 0)->toHex());
|
||||
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
|
||||
$image->modify(new PixelateModifier(10));
|
||||
|
@ -16,7 +16,7 @@ class PlaceModifierTest extends TestCase
|
||||
|
||||
public function testColorChange(): void
|
||||
{
|
||||
$image = $this->createTestImage('test.jpg');
|
||||
$image = $this->readTestImage('test.jpg');
|
||||
$this->assertEquals('febc44', $image->pickColor(300, 25)->toHex());
|
||||
$image->modify(new PlaceModifier(__DIR__ . '/../../../images/circle.png', 'top-right', 0, 0));
|
||||
$this->assertEquals('32250d', $image->pickColor(300, 25)->toHex());
|
||||
|
@ -16,7 +16,7 @@ class RemoveAnimationModifierTest extends TestCase
|
||||
|
||||
public function testApply(): void
|
||||
{
|
||||
$image = $this->createTestImage('animation.gif');
|
||||
$image = $this->readTestImage('animation.gif');
|
||||
$this->assertEquals(8, count($image));
|
||||
$result = $image->modify(new RemoveAnimationModifier(2));
|
||||
$this->assertEquals(1, count($image));
|
||||
@ -25,7 +25,7 @@ class RemoveAnimationModifierTest extends TestCase
|
||||
|
||||
public function testApplyPercent(): void
|
||||
{
|
||||
$image = $this->createTestImage('animation.gif');
|
||||
$image = $this->readTestImage('animation.gif');
|
||||
$this->assertEquals(8, count($image));
|
||||
$result = $image->modify(new RemoveAnimationModifier('20%'));
|
||||
$this->assertEquals(1, count($image));
|
||||
|
@ -16,7 +16,7 @@ class ResizeCanvasModifierTest extends TestCase
|
||||
|
||||
public function testModify(): void
|
||||
{
|
||||
$image = $this->createTestImage('tile.png');
|
||||
$image = $this->readTestImage('tile.png');
|
||||
$this->assertEquals(16, $image->width());
|
||||
$this->assertEquals(16, $image->height());
|
||||
$image->modify(new ResizeCanvasModifier(18, 18, 'ff0', 'center'));
|
||||
|
@ -16,7 +16,7 @@ class ResizeCanvasRelativeModifierTest extends TestCase
|
||||
|
||||
public function testModify(): void
|
||||
{
|
||||
$image = $this->createTestImage('tile.png');
|
||||
$image = $this->readTestImage('tile.png');
|
||||
$this->assertEquals(16, $image->width());
|
||||
$this->assertEquals(16, $image->height());
|
||||
$image->modify(new ResizeCanvasRelativeModifier(2, 2, 'ff0', 'center'));
|
||||
|
@ -16,7 +16,7 @@ class ResizeModifierTest extends TestCase
|
||||
|
||||
public function testModify(): void
|
||||
{
|
||||
$image = $this->createTestImage('blocks.png');
|
||||
$image = $this->readTestImage('blocks.png');
|
||||
$this->assertEquals(640, $image->width());
|
||||
$this->assertEquals(480, $image->height());
|
||||
$image->modify(new ResizeModifier(200, 100));
|
||||
|
@ -16,7 +16,7 @@ class ResolutionModifierTest extends TestCase
|
||||
|
||||
public function testResolutionChange(): void
|
||||
{
|
||||
$image = $this->createTestImage('test.jpg');
|
||||
$image = $this->readTestImage('test.jpg');
|
||||
$this->assertEquals(72.0, $image->resolution()->x());
|
||||
$this->assertEquals(72.0, $image->resolution()->y());
|
||||
$image->modify(new ResolutionModifier(1, 2));
|
||||
|
@ -16,7 +16,7 @@ class RotateModifierTest extends TestCase
|
||||
|
||||
public function testRotate(): void
|
||||
{
|
||||
$image = $this->createTestImage('test.jpg');
|
||||
$image = $this->readTestImage('test.jpg');
|
||||
$this->assertEquals(320, $image->width());
|
||||
$this->assertEquals(240, $image->height());
|
||||
$image->modify(new RotateModifier(90, 'fff'));
|
||||
|
@ -16,7 +16,7 @@ class SharpenModifierTest extends TestCase
|
||||
|
||||
public function testModify(): void
|
||||
{
|
||||
$image = $this->createTestImage('trim.png');
|
||||
$image = $this->readTestImage('trim.png');
|
||||
$this->assertEquals('60ab96', $image->pickColor(15, 14)->toHex());
|
||||
$image->modify(new SharpenModifier(10));
|
||||
$this->assertEquals('4daba7', $image->pickColor(15, 14)->toHex());
|
||||
|
@ -13,7 +13,7 @@ class ColorspaceAnalyzerTest extends TestCase
|
||||
|
||||
public function testAnalyze(): void
|
||||
{
|
||||
$image = $this->createTestImage('tile.png');
|
||||
$image = $this->readTestImage('tile.png');
|
||||
$analyzer = new ColorspaceAnalyzer();
|
||||
$result = $analyzer->analyze($image);
|
||||
$this->assertInstanceOf(ColorspaceInterface::class, $result);
|
||||
|
@ -12,7 +12,7 @@ class HeightAnalyzerTest extends TestCase
|
||||
|
||||
public function testAnalyze(): void
|
||||
{
|
||||
$image = $this->createTestImage('tile.png');
|
||||
$image = $this->readTestImage('tile.png');
|
||||
$analyzer = new HeightAnalyzer();
|
||||
$result = $analyzer->analyze($image);
|
||||
$this->assertEquals(16, $result);
|
||||
|
@ -13,7 +13,7 @@ class PixelColorAnalyzerTest extends TestCase
|
||||
|
||||
public function testAnalyze(): void
|
||||
{
|
||||
$image = $this->createTestImage('tile.png');
|
||||
$image = $this->readTestImage('tile.png');
|
||||
$analyzer = new PixelColorAnalyzer(0, 0);
|
||||
$result = $analyzer->analyze($image);
|
||||
$this->assertInstanceOf(ColorInterface::class, $result);
|
||||
|
@ -14,7 +14,7 @@ class PixelColorsAnalyzerTest extends TestCase
|
||||
|
||||
public function testAnalyze(): void
|
||||
{
|
||||
$image = $this->createTestImage('tile.png');
|
||||
$image = $this->readTestImage('tile.png');
|
||||
$analyzer = new PixelColorsAnalyzer(0, 0);
|
||||
$result = $analyzer->analyze($image);
|
||||
$this->assertInstanceOf(Collection::class, $result);
|
||||
|
@ -13,7 +13,7 @@ class ProfleAnalyzerTest extends TestCase
|
||||
|
||||
public function testAnalyze(): void
|
||||
{
|
||||
$image = $this->createTestImage('tile.png');
|
||||
$image = $this->readTestImage('tile.png');
|
||||
$analyzer = new ProfileAnalyzer();
|
||||
$this->expectException(ColorException::class);
|
||||
$analyzer->analyze($image);
|
||||
|
@ -13,7 +13,7 @@ class ResolutionAnalyzerTest extends TestCase
|
||||
|
||||
public function testAnalyze(): void
|
||||
{
|
||||
$image = $this->createTestImage('tile.png');
|
||||
$image = $this->readTestImage('tile.png');
|
||||
$analyzer = new ResolutionAnalyzer();
|
||||
$result = $analyzer->analyze($image);
|
||||
$this->assertInstanceOf(Resolution::class, $result);
|
||||
|
@ -12,7 +12,7 @@ class WidthAnalyzerTest extends TestCase
|
||||
|
||||
public function testAnalyze(): void
|
||||
{
|
||||
$image = $this->createTestImage('tile.png');
|
||||
$image = $this->readTestImage('tile.png');
|
||||
$analyzer = new WidthAnalyzer();
|
||||
$result = $analyzer->analyze($image);
|
||||
$this->assertEquals(16, $result);
|
||||
|
@ -18,7 +18,7 @@ class ImageObjectDecoderTest extends TestCase
|
||||
public function testDecode(): void
|
||||
{
|
||||
$decoder = new ImageObjectDecoder();
|
||||
$result = $decoder->decode($this->createTestImage('blue.gif'));
|
||||
$result = $decoder->decode($this->readTestImage('blue.gif'));
|
||||
$this->assertInstanceOf(Image::class, $result);
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ class BmpEncoderTest extends TestCase
|
||||
|
||||
public function testEncodeReduced(): void
|
||||
{
|
||||
$image = $this->createTestImage('gradient.bmp');
|
||||
$image = $this->readTestImage('gradient.bmp');
|
||||
$imagick = $image->core()->native();
|
||||
$this->assertEquals(15, $imagick->getImageColors());
|
||||
$encoder = new BmpEncoder(2);
|
||||
|
@ -54,7 +54,7 @@ class GifEncoderTest extends TestCase
|
||||
|
||||
public function testEncodeReduced(): void
|
||||
{
|
||||
$image = $this->createTestImage('gradient.gif');
|
||||
$image = $this->readTestImage('gradient.gif');
|
||||
$imagick = $image->core()->native();
|
||||
$this->assertEquals(15, $imagick->getImageColors());
|
||||
$encoder = new GifEncoder(2);
|
||||
|
@ -41,7 +41,7 @@ final class PngEncoderTest extends TestCase
|
||||
|
||||
public function testEncodeReduced(): void
|
||||
{
|
||||
$image = $this->createTestImage('tile.png');
|
||||
$image = $this->readTestImage('tile.png');
|
||||
$imagick = $image->core()->native();
|
||||
$this->assertEquals(3, $imagick->getImageColors());
|
||||
$encoder = new PngEncoder(2);
|
||||
|
@ -16,7 +16,7 @@ class BlurModifierTest extends TestCase
|
||||
|
||||
public function testColorChange(): void
|
||||
{
|
||||
$image = $this->createTestImage('trim.png');
|
||||
$image = $this->readTestImage('trim.png');
|
||||
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
|
||||
$image->modify(new BlurModifier(30));
|
||||
$this->assertEquals('42acb2', $image->pickColor(14, 14)->toHex());
|
||||
|
@ -16,7 +16,7 @@ class BrightnessModifierTest extends TestCase
|
||||
|
||||
public function testApply(): void
|
||||
{
|
||||
$image = $this->createTestImage('trim.png');
|
||||
$image = $this->readTestImage('trim.png');
|
||||
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
|
||||
$image->modify(new BrightnessModifier(30));
|
||||
$this->assertEquals('39c9ff', $image->pickColor(14, 14)->toHex());
|
||||
|
@ -16,7 +16,7 @@ class ColorizeModifierTest extends TestCase
|
||||
|
||||
public function testModify(): void
|
||||
{
|
||||
$image = $this->createTestImage('tile.png');
|
||||
$image = $this->readTestImage('tile.png');
|
||||
$image = $image->modify(new ColorizeModifier(100, -100, -100));
|
||||
$this->assertColor(251, 0, 0, 255, $image->pickColor(5, 5));
|
||||
$this->assertColor(239, 0, 0, 255, $image->pickColor(15, 15));
|
||||
|
@ -16,7 +16,7 @@ class ContainModifierTest extends TestCase
|
||||
|
||||
public function testModify(): void
|
||||
{
|
||||
$image = $this->createTestImage('blocks.png');
|
||||
$image = $this->readTestImage('blocks.png');
|
||||
$this->assertEquals(640, $image->width());
|
||||
$this->assertEquals(480, $image->height());
|
||||
$result = $image->modify(new ContainModifier(200, 100, 'ff0'));
|
||||
|
@ -16,7 +16,7 @@ class ContrastModifierTest extends TestCase
|
||||
|
||||
public function testApply(): void
|
||||
{
|
||||
$image = $this->createTestImage('trim.png');
|
||||
$image = $this->readTestImage('trim.png');
|
||||
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
|
||||
$image->modify(new ContrastModifier(30));
|
||||
$this->assertEquals('00fcff', $image->pickColor(14, 14)->toHex());
|
||||
|
@ -16,7 +16,7 @@ class CoverModifierTest extends TestCase
|
||||
|
||||
public function testModify(): void
|
||||
{
|
||||
$image = $this->createTestImage('blocks.png');
|
||||
$image = $this->readTestImage('blocks.png');
|
||||
$this->assertEquals(640, $image->width());
|
||||
$this->assertEquals(480, $image->height());
|
||||
$image->modify(new CoverModifier(100, 100, 'center'));
|
||||
|
@ -16,7 +16,7 @@ class CropModifierTest extends TestCase
|
||||
|
||||
public function testModify(): void
|
||||
{
|
||||
$image = $this->createTestImage('blocks.png');
|
||||
$image = $this->readTestImage('blocks.png');
|
||||
$image = $image->modify(new CropModifier(200, 200, 0, 0, 'bottom-right'));
|
||||
$this->assertEquals(200, $image->width());
|
||||
$this->assertEquals(200, $image->height());
|
||||
|
@ -14,7 +14,7 @@ class DrawEllipseModifierTest extends TestCase
|
||||
|
||||
public function testApply(): void
|
||||
{
|
||||
$image = $this->createTestImage('trim.png');
|
||||
$image = $this->readTestImage('trim.png');
|
||||
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
|
||||
$drawable = new Ellipse(10, 10, new Point(14, 14));
|
||||
$drawable->setBackgroundColor('b53717');
|
||||
|
@ -14,7 +14,7 @@ class DrawLineModifierTest extends TestCase
|
||||
|
||||
public function testApply(): void
|
||||
{
|
||||
$image = $this->createTestImage('trim.png');
|
||||
$image = $this->readTestImage('trim.png');
|
||||
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
|
||||
$line = new Line(new Point(0, 0), new Point(10, 0), 4);
|
||||
$line->setBackgroundColor('b53517');
|
||||
|
@ -17,7 +17,7 @@ class DrawPixelModifierTest extends TestCase
|
||||
|
||||
public function testApply(): void
|
||||
{
|
||||
$image = $this->createTestImage('trim.png');
|
||||
$image = $this->readTestImage('trim.png');
|
||||
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
|
||||
$image->modify(new DrawPixelModifier(new Point(14, 14), 'ffffff'));
|
||||
$this->assertEquals('ffffff', $image->pickColor(14, 14)->toHex());
|
||||
|
@ -14,7 +14,7 @@ class DrawPolygonModifierTest extends TestCase
|
||||
|
||||
public function testApply(): void
|
||||
{
|
||||
$image = $this->createTestImage('trim.png');
|
||||
$image = $this->readTestImage('trim.png');
|
||||
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
|
||||
$drawable = new Polygon([new Point(0, 0), new Point(15, 15), new Point(20, 20)]);
|
||||
$drawable->setBackgroundColor('b53717');
|
||||
|
@ -14,7 +14,7 @@ class DrawRectangleModifierTest extends TestCase
|
||||
|
||||
public function testApply(): void
|
||||
{
|
||||
$image = $this->createTestImage('trim.png');
|
||||
$image = $this->readTestImage('trim.png');
|
||||
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
|
||||
$rectangle = new Rectangle(300, 200, new Point(14, 14));
|
||||
$rectangle->setBackgroundColor('ffffff');
|
||||
|
@ -18,7 +18,7 @@ class FillModifierTest extends TestCase
|
||||
|
||||
public function testFloodFillColor(): void
|
||||
{
|
||||
$image = $this->createTestImage('blocks.png');
|
||||
$image = $this->readTestImage('blocks.png');
|
||||
$this->assertEquals('0000ff', $image->pickColor(420, 270)->toHex());
|
||||
$this->assertEquals('ff0000', $image->pickColor(540, 400)->toHex());
|
||||
$image->modify(new FillModifier(new Color(204, 204, 204), new Point(540, 400)));
|
||||
@ -28,7 +28,7 @@ class FillModifierTest extends TestCase
|
||||
|
||||
public function testFillAllColor(): void
|
||||
{
|
||||
$image = $this->createTestImage('blocks.png');
|
||||
$image = $this->readTestImage('blocks.png');
|
||||
$this->assertEquals('0000ff', $image->pickColor(420, 270)->toHex());
|
||||
$this->assertEquals('ff0000', $image->pickColor(540, 400)->toHex());
|
||||
$image->modify(new FillModifier(new Color(204, 204, 204)));
|
||||
|
@ -18,7 +18,7 @@ class FlipFlopModifierTest extends TestCase
|
||||
|
||||
public function testFlipImage(): void
|
||||
{
|
||||
$image = $this->createTestImage('tile.png');
|
||||
$image = $this->readTestImage('tile.png');
|
||||
$this->assertEquals('b4e000', $image->pickColor(0, 0)->toHex());
|
||||
$image->modify(new FlipModifier());
|
||||
$this->assertEquals('00000000', $image->pickColor(0, 0)->toHex());
|
||||
@ -26,7 +26,7 @@ class FlipFlopModifierTest extends TestCase
|
||||
|
||||
public function testFlopImage(): void
|
||||
{
|
||||
$image = $this->createTestImage('tile.png');
|
||||
$image = $this->readTestImage('tile.png');
|
||||
$this->assertEquals('b4e000', $image->pickColor(0, 0)->toHex());
|
||||
$image->modify(new FlopModifier());
|
||||
$this->assertEquals('00000000', $image->pickColor(0, 0)->toHex());
|
||||
|
@ -16,7 +16,7 @@ class GammaModifierTest extends TestCase
|
||||
|
||||
public function testModifier(): void
|
||||
{
|
||||
$image = $this->createTestImage('trim.png');
|
||||
$image = $this->readTestImage('trim.png');
|
||||
$this->assertEquals('00aef0', $image->pickColor(0, 0)->toHex());
|
||||
$image->modify(new GammaModifier(2.1));
|
||||
$this->assertEquals('00d5f8', $image->pickColor(0, 0)->toHex());
|
||||
|
@ -16,7 +16,7 @@ class GreyscaleModifierTest extends TestCase
|
||||
|
||||
public function testColorChange(): void
|
||||
{
|
||||
$image = $this->createTestImage('trim.png');
|
||||
$image = $this->readTestImage('trim.png');
|
||||
$this->assertFalse($image->pickColor(0, 0)->isGreyscale());
|
||||
$image->modify(new GreyscaleModifier());
|
||||
$this->assertTrue($image->pickColor(0, 0)->isGreyscale());
|
||||
|
@ -16,7 +16,7 @@ class InvertModifierTest extends TestCase
|
||||
|
||||
public function testApply(): void
|
||||
{
|
||||
$image = $this->createTestImage('trim.png');
|
||||
$image = $this->readTestImage('trim.png');
|
||||
$this->assertEquals('00aef0', $image->pickColor(0, 0)->toHex());
|
||||
$this->assertEquals('ffa601', $image->pickColor(25, 25)->toHex());
|
||||
$image->modify(new InvertModifier());
|
||||
|
@ -16,7 +16,7 @@ class PixelateModifierTest extends TestCase
|
||||
|
||||
public function testModify(): void
|
||||
{
|
||||
$image = $this->createTestImage('trim.png');
|
||||
$image = $this->readTestImage('trim.png');
|
||||
$this->assertEquals('00aef0', $image->pickColor(0, 0)->toHex());
|
||||
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
|
||||
$image->modify(new PixelateModifier(10));
|
||||
|
@ -16,7 +16,7 @@ class PlaceModifierTest extends TestCase
|
||||
|
||||
public function testColorChange(): void
|
||||
{
|
||||
$image = $this->createTestImage('test.jpg');
|
||||
$image = $this->readTestImage('test.jpg');
|
||||
$this->assertEquals('febc44', $image->pickColor(300, 25)->toHex());
|
||||
$image->modify(new PlaceModifier(__DIR__ . '/../../../images/circle.png', 'top-right', 0, 0));
|
||||
$this->assertEquals('33260e', $image->pickColor(300, 25)->toHex());
|
||||
|
@ -16,7 +16,7 @@ class RemoveAnimationModifierTest extends TestCase
|
||||
|
||||
public function testApply(): void
|
||||
{
|
||||
$image = $this->createTestImage('animation.gif');
|
||||
$image = $this->readTestImage('animation.gif');
|
||||
$this->assertEquals(8, count($image));
|
||||
$result = $image->modify(new RemoveAnimationModifier(2));
|
||||
$this->assertEquals(1, count($image));
|
||||
@ -25,7 +25,7 @@ class RemoveAnimationModifierTest extends TestCase
|
||||
|
||||
public function testApplyPercent(): void
|
||||
{
|
||||
$image = $this->createTestImage('animation.gif');
|
||||
$image = $this->readTestImage('animation.gif');
|
||||
$this->assertEquals(8, count($image));
|
||||
$result = $image->modify(new RemoveAnimationModifier('20%'));
|
||||
$this->assertEquals(1, count($image));
|
||||
|
@ -16,7 +16,7 @@ class ResizeCanvasModifierTest extends TestCase
|
||||
|
||||
public function testModify(): void
|
||||
{
|
||||
$image = $this->createTestImage('tile.png');
|
||||
$image = $this->readTestImage('tile.png');
|
||||
$this->assertEquals(16, $image->width());
|
||||
$this->assertEquals(16, $image->height());
|
||||
$image->modify(new ResizeCanvasModifier(18, 18, 'ff0', 'center'));
|
||||
|
@ -16,7 +16,7 @@ class ResizeCanvasRelativeModifierTest extends TestCase
|
||||
|
||||
public function testModify(): void
|
||||
{
|
||||
$image = $this->createTestImage('tile.png');
|
||||
$image = $this->readTestImage('tile.png');
|
||||
$this->assertEquals(16, $image->width());
|
||||
$this->assertEquals(16, $image->height());
|
||||
$image->modify(new ResizeCanvasRelativeModifier(2, 2, 'ff0', 'center'));
|
||||
|
@ -16,7 +16,7 @@ class ResizeModifierTest extends TestCase
|
||||
|
||||
public function testModify(): void
|
||||
{
|
||||
$image = $this->createTestImage('blocks.png');
|
||||
$image = $this->readTestImage('blocks.png');
|
||||
$this->assertEquals(640, $image->width());
|
||||
$this->assertEquals(480, $image->height());
|
||||
$image->modify(new ResizeModifier(200, 100));
|
||||
|
@ -16,7 +16,7 @@ class ResolutionModifierTest extends TestCase
|
||||
|
||||
public function testResolutionChange(): void
|
||||
{
|
||||
$image = $this->createTestImage('test.jpg');
|
||||
$image = $this->readTestImage('test.jpg');
|
||||
$this->assertEquals(72.0, $image->resolution()->x());
|
||||
$this->assertEquals(72.0, $image->resolution()->y());
|
||||
$image->modify(new ResolutionModifier(1, 2));
|
||||
|
@ -16,7 +16,7 @@ class RotateModifierTest extends TestCase
|
||||
|
||||
public function testRotate(): void
|
||||
{
|
||||
$image = $this->createTestImage('test.jpg');
|
||||
$image = $this->readTestImage('test.jpg');
|
||||
$this->assertEquals(320, $image->width());
|
||||
$this->assertEquals(240, $image->height());
|
||||
$image->modify(new RotateModifier(90, 'fff'));
|
||||
|
@ -16,7 +16,7 @@ class SharpenModifierTest extends TestCase
|
||||
|
||||
public function testModify(): void
|
||||
{
|
||||
$image = $this->createTestImage('trim.png');
|
||||
$image = $this->readTestImage('trim.png');
|
||||
$this->assertEquals('60ab96', $image->pickColor(15, 14)->toHex());
|
||||
$image->modify(new SharpenModifier(10));
|
||||
$this->assertEquals('4faca6', $image->pickColor(15, 14)->toHex());
|
||||
|
@ -10,7 +10,7 @@ use Intervention\Image\Image;
|
||||
|
||||
trait CanCreateGdTestImage
|
||||
{
|
||||
public function createTestImage($filename = 'test.jpg'): Image
|
||||
public function readTestImage($filename = 'test.jpg'): Image
|
||||
{
|
||||
return (new FilePathImageDecoder())->handle(
|
||||
$this->getTestImagePath($filename)
|
||||
|
@ -7,7 +7,7 @@ use Intervention\Image\Image;
|
||||
|
||||
trait CanCreateImagickTestImage
|
||||
{
|
||||
public function createTestImage($filename = 'test.jpg'): Image
|
||||
public function readTestImage($filename = 'test.jpg'): Image
|
||||
{
|
||||
return (new FilePathImageDecoder())->handle(
|
||||
sprintf('%s/../images/%s', __DIR__, $filename)
|
||||
|
Loading…
x
Reference in New Issue
Block a user