1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-06 13:56:30 +02:00

Rename method

This commit is contained in:
Oliver Vogel
2023-12-06 18:29:28 +01:00
parent 966ded4d00
commit aa59a486d8
74 changed files with 80 additions and 80 deletions

View File

@@ -13,7 +13,7 @@ class ColorspaceAnalyzerTest extends TestCase
public function testAnalyze(): void public function testAnalyze(): void
{ {
$image = $this->createTestImage('tile.png'); $image = $this->readTestImage('tile.png');
$analyzer = new ColorspaceAnalyzer(); $analyzer = new ColorspaceAnalyzer();
$result = $analyzer->analyze($image); $result = $analyzer->analyze($image);
$this->assertInstanceOf(ColorspaceInterface::class, $result); $this->assertInstanceOf(ColorspaceInterface::class, $result);

View File

@@ -12,7 +12,7 @@ class HeightAnalyzerTest extends TestCase
public function testAnalyze(): void public function testAnalyze(): void
{ {
$image = $this->createTestImage('tile.png'); $image = $this->readTestImage('tile.png');
$analyzer = new HeightAnalyzer(); $analyzer = new HeightAnalyzer();
$result = $analyzer->analyze($image); $result = $analyzer->analyze($image);
$this->assertEquals(16, $result); $this->assertEquals(16, $result);

View File

@@ -13,7 +13,7 @@ class PixelColorAnalyzerTest extends TestCase
public function testAnalyze(): void public function testAnalyze(): void
{ {
$image = $this->createTestImage('tile.png'); $image = $this->readTestImage('tile.png');
$analyzer = new PixelColorAnalyzer(0, 0); $analyzer = new PixelColorAnalyzer(0, 0);
$result = $analyzer->analyze($image); $result = $analyzer->analyze($image);
$this->assertInstanceOf(ColorInterface::class, $result); $this->assertInstanceOf(ColorInterface::class, $result);

View File

@@ -14,7 +14,7 @@ class PixelColorsAnalyzerTest extends TestCase
public function testAnalyze(): void public function testAnalyze(): void
{ {
$image = $this->createTestImage('tile.png'); $image = $this->readTestImage('tile.png');
$analyzer = new PixelColorsAnalyzer(0, 0); $analyzer = new PixelColorsAnalyzer(0, 0);
$result = $analyzer->analyze($image); $result = $analyzer->analyze($image);
$this->assertInstanceOf(Collection::class, $result); $this->assertInstanceOf(Collection::class, $result);

View File

@@ -13,7 +13,7 @@ class ResolutionAnalyzerTest extends TestCase
public function testAnalyze(): void public function testAnalyze(): void
{ {
$image = $this->createTestImage('tile.png'); $image = $this->readTestImage('tile.png');
$analyzer = new ResolutionAnalyzer(); $analyzer = new ResolutionAnalyzer();
$result = $analyzer->analyze($image); $result = $analyzer->analyze($image);
$this->assertInstanceOf(Resolution::class, $result); $this->assertInstanceOf(Resolution::class, $result);

View File

@@ -12,7 +12,7 @@ class WidthAnalyzerTest extends TestCase
public function testAnalyze(): void public function testAnalyze(): void
{ {
$image = $this->createTestImage('tile.png'); $image = $this->readTestImage('tile.png');
$analyzer = new WidthAnalyzer(); $analyzer = new WidthAnalyzer();
$result = $analyzer->analyze($image); $result = $analyzer->analyze($image);
$this->assertEquals(16, $result); $this->assertEquals(16, $result);

View File

@@ -18,7 +18,7 @@ class ImageObjectDecoderTest extends TestCase
public function testDecode(): void public function testDecode(): void
{ {
$decoder = new ImageObjectDecoder(); $decoder = new ImageObjectDecoder();
$result = $decoder->decode($this->createTestImage('blue.gif')); $result = $decoder->decode($this->readTestImage('blue.gif'));
$this->assertInstanceOf(Image::class, $result); $this->assertInstanceOf(Image::class, $result);
} }
} }

View File

@@ -49,7 +49,7 @@ class GifEncoderTest extends TestCase
public function testEncodeReduced(): void public function testEncodeReduced(): void
{ {
$image = $this->createTestImage('gradient.gif'); $image = $this->readTestImage('gradient.gif');
$gd = $image->core()->native(); $gd = $image->core()->native();
$this->assertEquals(15, imagecolorstotal($gd)); $this->assertEquals(15, imagecolorstotal($gd));
$encoder = new GifEncoder(2); $encoder = new GifEncoder(2);

View File

@@ -38,7 +38,7 @@ class PngEncoderTest extends TestCase
public function testEncodeReduced(): void public function testEncodeReduced(): void
{ {
$image = $this->createTestImage('tile.png'); $image = $this->readTestImage('tile.png');
$gd = $image->core()->native(); $gd = $image->core()->native();
$this->assertEquals(3, imagecolorstotal($gd)); $this->assertEquals(3, imagecolorstotal($gd));
$encoder = new PngEncoder(2); $encoder = new PngEncoder(2);

View File

@@ -16,7 +16,7 @@ class BlurModifierTest extends TestCase
public function testColorChange(): void public function testColorChange(): void
{ {
$image = $this->createTestImage('trim.png'); $image = $this->readTestImage('trim.png');
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex()); $this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
$image->modify(new BlurModifier(30)); $image->modify(new BlurModifier(30));
$this->assertEquals('4fa68d', $image->pickColor(14, 14)->toHex()); $this->assertEquals('4fa68d', $image->pickColor(14, 14)->toHex());

View File

@@ -16,7 +16,7 @@ class BrightnessModifierTest extends TestCase
public function testApply(): void public function testApply(): void
{ {
$image = $this->createTestImage('trim.png'); $image = $this->readTestImage('trim.png');
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex()); $this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
$image->modify(new BrightnessModifier(30)); $image->modify(new BrightnessModifier(30));
$this->assertEquals('4cfaff', $image->pickColor(14, 14)->toHex()); $this->assertEquals('4cfaff', $image->pickColor(14, 14)->toHex());

View File

@@ -16,7 +16,7 @@ class ColorizeModifierTest extends TestCase
public function testModify(): void public function testModify(): void
{ {
$image = $this->createTestImage('tile.png'); $image = $this->readTestImage('tile.png');
$image = $image->modify(new ColorizeModifier(100, -100, -100)); $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(5, 5));
$this->assertColor(255, 0, 0, 255, $image->pickColor(15, 15)); $this->assertColor(255, 0, 0, 255, $image->pickColor(15, 15));

View File

@@ -16,7 +16,7 @@ class ContainModifierTest extends TestCase
public function testModify(): void public function testModify(): void
{ {
$image = $this->createTestImage('blocks.png'); $image = $this->readTestImage('blocks.png');
$this->assertEquals(640, $image->width()); $this->assertEquals(640, $image->width());
$this->assertEquals(480, $image->height()); $this->assertEquals(480, $image->height());
$image->modify(new ContainModifier(200, 100, 'ff0')); $image->modify(new ContainModifier(200, 100, 'ff0'));

View File

@@ -16,7 +16,7 @@ class ContrastModifierTest extends TestCase
public function testApply(): void public function testApply(): void
{ {
$image = $this->createTestImage('trim.png'); $image = $this->readTestImage('trim.png');
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex()); $this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
$image->modify(new ContrastModifier(30)); $image->modify(new ContrastModifier(30));
$this->assertEquals('00ceff', $image->pickColor(14, 14)->toHex()); $this->assertEquals('00ceff', $image->pickColor(14, 14)->toHex());

View File

@@ -16,7 +16,7 @@ class CoverModifierTest extends TestCase
public function testModify(): void public function testModify(): void
{ {
$image = $this->createTestImage('blocks.png'); $image = $this->readTestImage('blocks.png');
$this->assertEquals(640, $image->width()); $this->assertEquals(640, $image->width());
$this->assertEquals(480, $image->height()); $this->assertEquals(480, $image->height());
$image->modify(new CoverModifier(100, 100, 'center')); $image->modify(new CoverModifier(100, 100, 'center'));

View File

@@ -16,7 +16,7 @@ class CropModifierTest extends TestCase
public function testModify(): void 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')); $image = $image->modify(new CropModifier(200, 200, 0, 0, 'bottom-right'));
$this->assertEquals(200, $image->width()); $this->assertEquals(200, $image->width());
$this->assertEquals(200, $image->height()); $this->assertEquals(200, $image->height());

View File

@@ -18,7 +18,7 @@ class DrawEllipseModifierTest extends TestCase
public function testApply(): void public function testApply(): void
{ {
$image = $this->createTestImage('trim.png'); $image = $this->readTestImage('trim.png');
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex()); $this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
$drawable = new Ellipse(10, 10, new Point(14, 14)); $drawable = new Ellipse(10, 10, new Point(14, 14));
$drawable->setBackgroundColor('b53717'); $drawable->setBackgroundColor('b53717');

View File

@@ -18,7 +18,7 @@ class DrawLineModifierTest extends TestCase
public function testApply(): void public function testApply(): void
{ {
$image = $this->createTestImage('trim.png'); $image = $this->readTestImage('trim.png');
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex()); $this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
$line = new Line(new Point(0, 0), new Point(10, 0), 4); $line = new Line(new Point(0, 0), new Point(10, 0), 4);
$line->setBackgroundColor('b53517'); $line->setBackgroundColor('b53517');

View File

@@ -17,7 +17,7 @@ class DrawPixelModifierTest extends TestCase
public function testApply(): void public function testApply(): void
{ {
$image = $this->createTestImage('trim.png'); $image = $this->readTestImage('trim.png');
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex()); $this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
$image->modify(new DrawPixelModifier(new Point(14, 14), 'ffffff')); $image->modify(new DrawPixelModifier(new Point(14, 14), 'ffffff'));
$this->assertEquals('ffffff', $image->pickColor(14, 14)->toHex()); $this->assertEquals('ffffff', $image->pickColor(14, 14)->toHex());

View File

@@ -18,7 +18,7 @@ class DrawPolygonModifierTest extends TestCase
public function testApply(): void public function testApply(): void
{ {
$image = $this->createTestImage('trim.png'); $image = $this->readTestImage('trim.png');
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex()); $this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
$drawable = new Polygon([new Point(0, 0), new Point(15, 15), new Point(20, 20)]); $drawable = new Polygon([new Point(0, 0), new Point(15, 15), new Point(20, 20)]);
$drawable->setBackgroundColor('b53717'); $drawable->setBackgroundColor('b53717');

View File

@@ -18,7 +18,7 @@ class DrawRectangleModifierTest extends TestCase
public function testApply(): void public function testApply(): void
{ {
$image = $this->createTestImage('trim.png'); $image = $this->readTestImage('trim.png');
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex()); $this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
$rectangle = new Rectangle(300, 200, new Point(14, 14)); $rectangle = new Rectangle(300, 200, new Point(14, 14));
$rectangle->setBackgroundColor('ffffff'); $rectangle->setBackgroundColor('ffffff');

View File

@@ -18,7 +18,7 @@ class FillModifierTest extends TestCase
public function testFloodFillColor(): void public function testFloodFillColor(): void
{ {
$image = $this->createTestImage('blocks.png'); $image = $this->readTestImage('blocks.png');
$this->assertEquals('0000ff', $image->pickColor(420, 270)->toHex()); $this->assertEquals('0000ff', $image->pickColor(420, 270)->toHex());
$this->assertEquals('ff0000', $image->pickColor(540, 400)->toHex()); $this->assertEquals('ff0000', $image->pickColor(540, 400)->toHex());
$image->modify(new FillModifier(new Color(204, 204, 204), new Point(540, 400))); $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 public function testFillAllColor(): void
{ {
$image = $this->createTestImage('blocks.png'); $image = $this->readTestImage('blocks.png');
$this->assertEquals('0000ff', $image->pickColor(420, 270)->toHex()); $this->assertEquals('0000ff', $image->pickColor(420, 270)->toHex());
$this->assertEquals('ff0000', $image->pickColor(540, 400)->toHex()); $this->assertEquals('ff0000', $image->pickColor(540, 400)->toHex());
$image->modify(new FillModifier(new Color(204, 204, 204))); $image->modify(new FillModifier(new Color(204, 204, 204)));

View File

@@ -18,7 +18,7 @@ class FlipFlopModifierTest extends TestCase
public function testFlipImage(): void public function testFlipImage(): void
{ {
$image = $this->createTestImage('tile.png'); $image = $this->readTestImage('tile.png');
$this->assertEquals('b4e000', $image->pickColor(0, 0)->toHex()); $this->assertEquals('b4e000', $image->pickColor(0, 0)->toHex());
$image->modify(new FlipModifier()); $image->modify(new FlipModifier());
$this->assertEquals('00000000', $image->pickColor(0, 0)->toHex()); $this->assertEquals('00000000', $image->pickColor(0, 0)->toHex());
@@ -26,7 +26,7 @@ class FlipFlopModifierTest extends TestCase
public function testFlopImage(): void public function testFlopImage(): void
{ {
$image = $this->createTestImage('tile.png'); $image = $this->readTestImage('tile.png');
$this->assertEquals('b4e000', $image->pickColor(0, 0)->toHex()); $this->assertEquals('b4e000', $image->pickColor(0, 0)->toHex());
$image->modify(new FlopModifier()); $image->modify(new FlopModifier());
$this->assertEquals('00000000', $image->pickColor(0, 0)->toHex()); $this->assertEquals('00000000', $image->pickColor(0, 0)->toHex());

View File

@@ -16,7 +16,7 @@ class GammaModifierTest extends TestCase
public function testModifier(): void public function testModifier(): void
{ {
$image = $this->createTestImage('trim.png'); $image = $this->readTestImage('trim.png');
$this->assertEquals('00aef0', $image->pickColor(0, 0)->toHex()); $this->assertEquals('00aef0', $image->pickColor(0, 0)->toHex());
$image->modify(new GammaModifier(2.1)); $image->modify(new GammaModifier(2.1));
$this->assertEquals('00d5f8', $image->pickColor(0, 0)->toHex()); $this->assertEquals('00d5f8', $image->pickColor(0, 0)->toHex());

View File

@@ -16,7 +16,7 @@ class GreyscaleModifierTest extends TestCase
public function testColorChange(): void public function testColorChange(): void
{ {
$image = $this->createTestImage('trim.png'); $image = $this->readTestImage('trim.png');
$this->assertFalse($image->pickColor(0, 0)->isGreyscale()); $this->assertFalse($image->pickColor(0, 0)->isGreyscale());
$image->modify(new GreyscaleModifier()); $image->modify(new GreyscaleModifier());
$this->assertTrue($image->pickColor(0, 0)->isGreyscale()); $this->assertTrue($image->pickColor(0, 0)->isGreyscale());

View File

@@ -16,7 +16,7 @@ class InvertModifierTest extends TestCase
public function testApply(): void public function testApply(): void
{ {
$image = $this->createTestImage('trim.png'); $image = $this->readTestImage('trim.png');
$this->assertEquals('00aef0', $image->pickColor(0, 0)->toHex()); $this->assertEquals('00aef0', $image->pickColor(0, 0)->toHex());
$this->assertEquals('ffa601', $image->pickColor(25, 25)->toHex()); $this->assertEquals('ffa601', $image->pickColor(25, 25)->toHex());
$image->modify(new InvertModifier()); $image->modify(new InvertModifier());

View File

@@ -16,7 +16,7 @@ class PixelateModifierTest extends TestCase
public function testModify(): void 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(0, 0)->toHex());
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex()); $this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
$image->modify(new PixelateModifier(10)); $image->modify(new PixelateModifier(10));

View File

@@ -16,7 +16,7 @@ class PlaceModifierTest extends TestCase
public function testColorChange(): void public function testColorChange(): void
{ {
$image = $this->createTestImage('test.jpg'); $image = $this->readTestImage('test.jpg');
$this->assertEquals('febc44', $image->pickColor(300, 25)->toHex()); $this->assertEquals('febc44', $image->pickColor(300, 25)->toHex());
$image->modify(new PlaceModifier(__DIR__ . '/../../../images/circle.png', 'top-right', 0, 0)); $image->modify(new PlaceModifier(__DIR__ . '/../../../images/circle.png', 'top-right', 0, 0));
$this->assertEquals('32250d', $image->pickColor(300, 25)->toHex()); $this->assertEquals('32250d', $image->pickColor(300, 25)->toHex());

View File

@@ -16,7 +16,7 @@ class RemoveAnimationModifierTest extends TestCase
public function testApply(): void public function testApply(): void
{ {
$image = $this->createTestImage('animation.gif'); $image = $this->readTestImage('animation.gif');
$this->assertEquals(8, count($image)); $this->assertEquals(8, count($image));
$result = $image->modify(new RemoveAnimationModifier(2)); $result = $image->modify(new RemoveAnimationModifier(2));
$this->assertEquals(1, count($image)); $this->assertEquals(1, count($image));
@@ -25,7 +25,7 @@ class RemoveAnimationModifierTest extends TestCase
public function testApplyPercent(): void public function testApplyPercent(): void
{ {
$image = $this->createTestImage('animation.gif'); $image = $this->readTestImage('animation.gif');
$this->assertEquals(8, count($image)); $this->assertEquals(8, count($image));
$result = $image->modify(new RemoveAnimationModifier('20%')); $result = $image->modify(new RemoveAnimationModifier('20%'));
$this->assertEquals(1, count($image)); $this->assertEquals(1, count($image));

View File

@@ -16,7 +16,7 @@ class ResizeCanvasModifierTest extends TestCase
public function testModify(): void public function testModify(): void
{ {
$image = $this->createTestImage('tile.png'); $image = $this->readTestImage('tile.png');
$this->assertEquals(16, $image->width()); $this->assertEquals(16, $image->width());
$this->assertEquals(16, $image->height()); $this->assertEquals(16, $image->height());
$image->modify(new ResizeCanvasModifier(18, 18, 'ff0', 'center')); $image->modify(new ResizeCanvasModifier(18, 18, 'ff0', 'center'));

View File

@@ -16,7 +16,7 @@ class ResizeCanvasRelativeModifierTest extends TestCase
public function testModify(): void public function testModify(): void
{ {
$image = $this->createTestImage('tile.png'); $image = $this->readTestImage('tile.png');
$this->assertEquals(16, $image->width()); $this->assertEquals(16, $image->width());
$this->assertEquals(16, $image->height()); $this->assertEquals(16, $image->height());
$image->modify(new ResizeCanvasRelativeModifier(2, 2, 'ff0', 'center')); $image->modify(new ResizeCanvasRelativeModifier(2, 2, 'ff0', 'center'));

View File

@@ -16,7 +16,7 @@ class ResizeModifierTest extends TestCase
public function testModify(): void public function testModify(): void
{ {
$image = $this->createTestImage('blocks.png'); $image = $this->readTestImage('blocks.png');
$this->assertEquals(640, $image->width()); $this->assertEquals(640, $image->width());
$this->assertEquals(480, $image->height()); $this->assertEquals(480, $image->height());
$image->modify(new ResizeModifier(200, 100)); $image->modify(new ResizeModifier(200, 100));

View File

@@ -16,7 +16,7 @@ class ResolutionModifierTest extends TestCase
public function testResolutionChange(): void 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()->x());
$this->assertEquals(72.0, $image->resolution()->y()); $this->assertEquals(72.0, $image->resolution()->y());
$image->modify(new ResolutionModifier(1, 2)); $image->modify(new ResolutionModifier(1, 2));

View File

@@ -16,7 +16,7 @@ class RotateModifierTest extends TestCase
public function testRotate(): void public function testRotate(): void
{ {
$image = $this->createTestImage('test.jpg'); $image = $this->readTestImage('test.jpg');
$this->assertEquals(320, $image->width()); $this->assertEquals(320, $image->width());
$this->assertEquals(240, $image->height()); $this->assertEquals(240, $image->height());
$image->modify(new RotateModifier(90, 'fff')); $image->modify(new RotateModifier(90, 'fff'));

View File

@@ -16,7 +16,7 @@ class SharpenModifierTest extends TestCase
public function testModify(): void public function testModify(): void
{ {
$image = $this->createTestImage('trim.png'); $image = $this->readTestImage('trim.png');
$this->assertEquals('60ab96', $image->pickColor(15, 14)->toHex()); $this->assertEquals('60ab96', $image->pickColor(15, 14)->toHex());
$image->modify(new SharpenModifier(10)); $image->modify(new SharpenModifier(10));
$this->assertEquals('4daba7', $image->pickColor(15, 14)->toHex()); $this->assertEquals('4daba7', $image->pickColor(15, 14)->toHex());

View File

@@ -13,7 +13,7 @@ class ColorspaceAnalyzerTest extends TestCase
public function testAnalyze(): void public function testAnalyze(): void
{ {
$image = $this->createTestImage('tile.png'); $image = $this->readTestImage('tile.png');
$analyzer = new ColorspaceAnalyzer(); $analyzer = new ColorspaceAnalyzer();
$result = $analyzer->analyze($image); $result = $analyzer->analyze($image);
$this->assertInstanceOf(ColorspaceInterface::class, $result); $this->assertInstanceOf(ColorspaceInterface::class, $result);

View File

@@ -12,7 +12,7 @@ class HeightAnalyzerTest extends TestCase
public function testAnalyze(): void public function testAnalyze(): void
{ {
$image = $this->createTestImage('tile.png'); $image = $this->readTestImage('tile.png');
$analyzer = new HeightAnalyzer(); $analyzer = new HeightAnalyzer();
$result = $analyzer->analyze($image); $result = $analyzer->analyze($image);
$this->assertEquals(16, $result); $this->assertEquals(16, $result);

View File

@@ -13,7 +13,7 @@ class PixelColorAnalyzerTest extends TestCase
public function testAnalyze(): void public function testAnalyze(): void
{ {
$image = $this->createTestImage('tile.png'); $image = $this->readTestImage('tile.png');
$analyzer = new PixelColorAnalyzer(0, 0); $analyzer = new PixelColorAnalyzer(0, 0);
$result = $analyzer->analyze($image); $result = $analyzer->analyze($image);
$this->assertInstanceOf(ColorInterface::class, $result); $this->assertInstanceOf(ColorInterface::class, $result);

View File

@@ -14,7 +14,7 @@ class PixelColorsAnalyzerTest extends TestCase
public function testAnalyze(): void public function testAnalyze(): void
{ {
$image = $this->createTestImage('tile.png'); $image = $this->readTestImage('tile.png');
$analyzer = new PixelColorsAnalyzer(0, 0); $analyzer = new PixelColorsAnalyzer(0, 0);
$result = $analyzer->analyze($image); $result = $analyzer->analyze($image);
$this->assertInstanceOf(Collection::class, $result); $this->assertInstanceOf(Collection::class, $result);

View File

@@ -13,7 +13,7 @@ class ProfleAnalyzerTest extends TestCase
public function testAnalyze(): void public function testAnalyze(): void
{ {
$image = $this->createTestImage('tile.png'); $image = $this->readTestImage('tile.png');
$analyzer = new ProfileAnalyzer(); $analyzer = new ProfileAnalyzer();
$this->expectException(ColorException::class); $this->expectException(ColorException::class);
$analyzer->analyze($image); $analyzer->analyze($image);

View File

@@ -13,7 +13,7 @@ class ResolutionAnalyzerTest extends TestCase
public function testAnalyze(): void public function testAnalyze(): void
{ {
$image = $this->createTestImage('tile.png'); $image = $this->readTestImage('tile.png');
$analyzer = new ResolutionAnalyzer(); $analyzer = new ResolutionAnalyzer();
$result = $analyzer->analyze($image); $result = $analyzer->analyze($image);
$this->assertInstanceOf(Resolution::class, $result); $this->assertInstanceOf(Resolution::class, $result);

View File

@@ -12,7 +12,7 @@ class WidthAnalyzerTest extends TestCase
public function testAnalyze(): void public function testAnalyze(): void
{ {
$image = $this->createTestImage('tile.png'); $image = $this->readTestImage('tile.png');
$analyzer = new WidthAnalyzer(); $analyzer = new WidthAnalyzer();
$result = $analyzer->analyze($image); $result = $analyzer->analyze($image);
$this->assertEquals(16, $result); $this->assertEquals(16, $result);

View File

@@ -18,7 +18,7 @@ class ImageObjectDecoderTest extends TestCase
public function testDecode(): void public function testDecode(): void
{ {
$decoder = new ImageObjectDecoder(); $decoder = new ImageObjectDecoder();
$result = $decoder->decode($this->createTestImage('blue.gif')); $result = $decoder->decode($this->readTestImage('blue.gif'));
$this->assertInstanceOf(Image::class, $result); $this->assertInstanceOf(Image::class, $result);
} }
} }

View File

@@ -40,7 +40,7 @@ class BmpEncoderTest extends TestCase
public function testEncodeReduced(): void public function testEncodeReduced(): void
{ {
$image = $this->createTestImage('gradient.bmp'); $image = $this->readTestImage('gradient.bmp');
$imagick = $image->core()->native(); $imagick = $image->core()->native();
$this->assertEquals(15, $imagick->getImageColors()); $this->assertEquals(15, $imagick->getImageColors());
$encoder = new BmpEncoder(2); $encoder = new BmpEncoder(2);

View File

@@ -54,7 +54,7 @@ class GifEncoderTest extends TestCase
public function testEncodeReduced(): void public function testEncodeReduced(): void
{ {
$image = $this->createTestImage('gradient.gif'); $image = $this->readTestImage('gradient.gif');
$imagick = $image->core()->native(); $imagick = $image->core()->native();
$this->assertEquals(15, $imagick->getImageColors()); $this->assertEquals(15, $imagick->getImageColors());
$encoder = new GifEncoder(2); $encoder = new GifEncoder(2);

View File

@@ -41,7 +41,7 @@ final class PngEncoderTest extends TestCase
public function testEncodeReduced(): void public function testEncodeReduced(): void
{ {
$image = $this->createTestImage('tile.png'); $image = $this->readTestImage('tile.png');
$imagick = $image->core()->native(); $imagick = $image->core()->native();
$this->assertEquals(3, $imagick->getImageColors()); $this->assertEquals(3, $imagick->getImageColors());
$encoder = new PngEncoder(2); $encoder = new PngEncoder(2);

View File

@@ -16,7 +16,7 @@ class BlurModifierTest extends TestCase
public function testColorChange(): void public function testColorChange(): void
{ {
$image = $this->createTestImage('trim.png'); $image = $this->readTestImage('trim.png');
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex()); $this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
$image->modify(new BlurModifier(30)); $image->modify(new BlurModifier(30));
$this->assertEquals('42acb2', $image->pickColor(14, 14)->toHex()); $this->assertEquals('42acb2', $image->pickColor(14, 14)->toHex());

View File

@@ -16,7 +16,7 @@ class BrightnessModifierTest extends TestCase
public function testApply(): void public function testApply(): void
{ {
$image = $this->createTestImage('trim.png'); $image = $this->readTestImage('trim.png');
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex()); $this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
$image->modify(new BrightnessModifier(30)); $image->modify(new BrightnessModifier(30));
$this->assertEquals('39c9ff', $image->pickColor(14, 14)->toHex()); $this->assertEquals('39c9ff', $image->pickColor(14, 14)->toHex());

View File

@@ -16,7 +16,7 @@ class ColorizeModifierTest extends TestCase
public function testModify(): void public function testModify(): void
{ {
$image = $this->createTestImage('tile.png'); $image = $this->readTestImage('tile.png');
$image = $image->modify(new ColorizeModifier(100, -100, -100)); $image = $image->modify(new ColorizeModifier(100, -100, -100));
$this->assertColor(251, 0, 0, 255, $image->pickColor(5, 5)); $this->assertColor(251, 0, 0, 255, $image->pickColor(5, 5));
$this->assertColor(239, 0, 0, 255, $image->pickColor(15, 15)); $this->assertColor(239, 0, 0, 255, $image->pickColor(15, 15));

View File

@@ -16,7 +16,7 @@ class ContainModifierTest extends TestCase
public function testModify(): void public function testModify(): void
{ {
$image = $this->createTestImage('blocks.png'); $image = $this->readTestImage('blocks.png');
$this->assertEquals(640, $image->width()); $this->assertEquals(640, $image->width());
$this->assertEquals(480, $image->height()); $this->assertEquals(480, $image->height());
$result = $image->modify(new ContainModifier(200, 100, 'ff0')); $result = $image->modify(new ContainModifier(200, 100, 'ff0'));

View File

@@ -16,7 +16,7 @@ class ContrastModifierTest extends TestCase
public function testApply(): void public function testApply(): void
{ {
$image = $this->createTestImage('trim.png'); $image = $this->readTestImage('trim.png');
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex()); $this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
$image->modify(new ContrastModifier(30)); $image->modify(new ContrastModifier(30));
$this->assertEquals('00fcff', $image->pickColor(14, 14)->toHex()); $this->assertEquals('00fcff', $image->pickColor(14, 14)->toHex());

View File

@@ -16,7 +16,7 @@ class CoverModifierTest extends TestCase
public function testModify(): void public function testModify(): void
{ {
$image = $this->createTestImage('blocks.png'); $image = $this->readTestImage('blocks.png');
$this->assertEquals(640, $image->width()); $this->assertEquals(640, $image->width());
$this->assertEquals(480, $image->height()); $this->assertEquals(480, $image->height());
$image->modify(new CoverModifier(100, 100, 'center')); $image->modify(new CoverModifier(100, 100, 'center'));

View File

@@ -16,7 +16,7 @@ class CropModifierTest extends TestCase
public function testModify(): void 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')); $image = $image->modify(new CropModifier(200, 200, 0, 0, 'bottom-right'));
$this->assertEquals(200, $image->width()); $this->assertEquals(200, $image->width());
$this->assertEquals(200, $image->height()); $this->assertEquals(200, $image->height());

View File

@@ -14,7 +14,7 @@ class DrawEllipseModifierTest extends TestCase
public function testApply(): void public function testApply(): void
{ {
$image = $this->createTestImage('trim.png'); $image = $this->readTestImage('trim.png');
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex()); $this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
$drawable = new Ellipse(10, 10, new Point(14, 14)); $drawable = new Ellipse(10, 10, new Point(14, 14));
$drawable->setBackgroundColor('b53717'); $drawable->setBackgroundColor('b53717');

View File

@@ -14,7 +14,7 @@ class DrawLineModifierTest extends TestCase
public function testApply(): void public function testApply(): void
{ {
$image = $this->createTestImage('trim.png'); $image = $this->readTestImage('trim.png');
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex()); $this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
$line = new Line(new Point(0, 0), new Point(10, 0), 4); $line = new Line(new Point(0, 0), new Point(10, 0), 4);
$line->setBackgroundColor('b53517'); $line->setBackgroundColor('b53517');

View File

@@ -17,7 +17,7 @@ class DrawPixelModifierTest extends TestCase
public function testApply(): void public function testApply(): void
{ {
$image = $this->createTestImage('trim.png'); $image = $this->readTestImage('trim.png');
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex()); $this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
$image->modify(new DrawPixelModifier(new Point(14, 14), 'ffffff')); $image->modify(new DrawPixelModifier(new Point(14, 14), 'ffffff'));
$this->assertEquals('ffffff', $image->pickColor(14, 14)->toHex()); $this->assertEquals('ffffff', $image->pickColor(14, 14)->toHex());

View File

@@ -14,7 +14,7 @@ class DrawPolygonModifierTest extends TestCase
public function testApply(): void public function testApply(): void
{ {
$image = $this->createTestImage('trim.png'); $image = $this->readTestImage('trim.png');
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex()); $this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
$drawable = new Polygon([new Point(0, 0), new Point(15, 15), new Point(20, 20)]); $drawable = new Polygon([new Point(0, 0), new Point(15, 15), new Point(20, 20)]);
$drawable->setBackgroundColor('b53717'); $drawable->setBackgroundColor('b53717');

View File

@@ -14,7 +14,7 @@ class DrawRectangleModifierTest extends TestCase
public function testApply(): void public function testApply(): void
{ {
$image = $this->createTestImage('trim.png'); $image = $this->readTestImage('trim.png');
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex()); $this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
$rectangle = new Rectangle(300, 200, new Point(14, 14)); $rectangle = new Rectangle(300, 200, new Point(14, 14));
$rectangle->setBackgroundColor('ffffff'); $rectangle->setBackgroundColor('ffffff');

View File

@@ -18,7 +18,7 @@ class FillModifierTest extends TestCase
public function testFloodFillColor(): void public function testFloodFillColor(): void
{ {
$image = $this->createTestImage('blocks.png'); $image = $this->readTestImage('blocks.png');
$this->assertEquals('0000ff', $image->pickColor(420, 270)->toHex()); $this->assertEquals('0000ff', $image->pickColor(420, 270)->toHex());
$this->assertEquals('ff0000', $image->pickColor(540, 400)->toHex()); $this->assertEquals('ff0000', $image->pickColor(540, 400)->toHex());
$image->modify(new FillModifier(new Color(204, 204, 204), new Point(540, 400))); $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 public function testFillAllColor(): void
{ {
$image = $this->createTestImage('blocks.png'); $image = $this->readTestImage('blocks.png');
$this->assertEquals('0000ff', $image->pickColor(420, 270)->toHex()); $this->assertEquals('0000ff', $image->pickColor(420, 270)->toHex());
$this->assertEquals('ff0000', $image->pickColor(540, 400)->toHex()); $this->assertEquals('ff0000', $image->pickColor(540, 400)->toHex());
$image->modify(new FillModifier(new Color(204, 204, 204))); $image->modify(new FillModifier(new Color(204, 204, 204)));

View File

@@ -18,7 +18,7 @@ class FlipFlopModifierTest extends TestCase
public function testFlipImage(): void public function testFlipImage(): void
{ {
$image = $this->createTestImage('tile.png'); $image = $this->readTestImage('tile.png');
$this->assertEquals('b4e000', $image->pickColor(0, 0)->toHex()); $this->assertEquals('b4e000', $image->pickColor(0, 0)->toHex());
$image->modify(new FlipModifier()); $image->modify(new FlipModifier());
$this->assertEquals('00000000', $image->pickColor(0, 0)->toHex()); $this->assertEquals('00000000', $image->pickColor(0, 0)->toHex());
@@ -26,7 +26,7 @@ class FlipFlopModifierTest extends TestCase
public function testFlopImage(): void public function testFlopImage(): void
{ {
$image = $this->createTestImage('tile.png'); $image = $this->readTestImage('tile.png');
$this->assertEquals('b4e000', $image->pickColor(0, 0)->toHex()); $this->assertEquals('b4e000', $image->pickColor(0, 0)->toHex());
$image->modify(new FlopModifier()); $image->modify(new FlopModifier());
$this->assertEquals('00000000', $image->pickColor(0, 0)->toHex()); $this->assertEquals('00000000', $image->pickColor(0, 0)->toHex());

View File

@@ -16,7 +16,7 @@ class GammaModifierTest extends TestCase
public function testModifier(): void public function testModifier(): void
{ {
$image = $this->createTestImage('trim.png'); $image = $this->readTestImage('trim.png');
$this->assertEquals('00aef0', $image->pickColor(0, 0)->toHex()); $this->assertEquals('00aef0', $image->pickColor(0, 0)->toHex());
$image->modify(new GammaModifier(2.1)); $image->modify(new GammaModifier(2.1));
$this->assertEquals('00d5f8', $image->pickColor(0, 0)->toHex()); $this->assertEquals('00d5f8', $image->pickColor(0, 0)->toHex());

View File

@@ -16,7 +16,7 @@ class GreyscaleModifierTest extends TestCase
public function testColorChange(): void public function testColorChange(): void
{ {
$image = $this->createTestImage('trim.png'); $image = $this->readTestImage('trim.png');
$this->assertFalse($image->pickColor(0, 0)->isGreyscale()); $this->assertFalse($image->pickColor(0, 0)->isGreyscale());
$image->modify(new GreyscaleModifier()); $image->modify(new GreyscaleModifier());
$this->assertTrue($image->pickColor(0, 0)->isGreyscale()); $this->assertTrue($image->pickColor(0, 0)->isGreyscale());

View File

@@ -16,7 +16,7 @@ class InvertModifierTest extends TestCase
public function testApply(): void public function testApply(): void
{ {
$image = $this->createTestImage('trim.png'); $image = $this->readTestImage('trim.png');
$this->assertEquals('00aef0', $image->pickColor(0, 0)->toHex()); $this->assertEquals('00aef0', $image->pickColor(0, 0)->toHex());
$this->assertEquals('ffa601', $image->pickColor(25, 25)->toHex()); $this->assertEquals('ffa601', $image->pickColor(25, 25)->toHex());
$image->modify(new InvertModifier()); $image->modify(new InvertModifier());

View File

@@ -16,7 +16,7 @@ class PixelateModifierTest extends TestCase
public function testModify(): void 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(0, 0)->toHex());
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex()); $this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
$image->modify(new PixelateModifier(10)); $image->modify(new PixelateModifier(10));

View File

@@ -16,7 +16,7 @@ class PlaceModifierTest extends TestCase
public function testColorChange(): void public function testColorChange(): void
{ {
$image = $this->createTestImage('test.jpg'); $image = $this->readTestImage('test.jpg');
$this->assertEquals('febc44', $image->pickColor(300, 25)->toHex()); $this->assertEquals('febc44', $image->pickColor(300, 25)->toHex());
$image->modify(new PlaceModifier(__DIR__ . '/../../../images/circle.png', 'top-right', 0, 0)); $image->modify(new PlaceModifier(__DIR__ . '/../../../images/circle.png', 'top-right', 0, 0));
$this->assertEquals('33260e', $image->pickColor(300, 25)->toHex()); $this->assertEquals('33260e', $image->pickColor(300, 25)->toHex());

View File

@@ -16,7 +16,7 @@ class RemoveAnimationModifierTest extends TestCase
public function testApply(): void public function testApply(): void
{ {
$image = $this->createTestImage('animation.gif'); $image = $this->readTestImage('animation.gif');
$this->assertEquals(8, count($image)); $this->assertEquals(8, count($image));
$result = $image->modify(new RemoveAnimationModifier(2)); $result = $image->modify(new RemoveAnimationModifier(2));
$this->assertEquals(1, count($image)); $this->assertEquals(1, count($image));
@@ -25,7 +25,7 @@ class RemoveAnimationModifierTest extends TestCase
public function testApplyPercent(): void public function testApplyPercent(): void
{ {
$image = $this->createTestImage('animation.gif'); $image = $this->readTestImage('animation.gif');
$this->assertEquals(8, count($image)); $this->assertEquals(8, count($image));
$result = $image->modify(new RemoveAnimationModifier('20%')); $result = $image->modify(new RemoveAnimationModifier('20%'));
$this->assertEquals(1, count($image)); $this->assertEquals(1, count($image));

View File

@@ -16,7 +16,7 @@ class ResizeCanvasModifierTest extends TestCase
public function testModify(): void public function testModify(): void
{ {
$image = $this->createTestImage('tile.png'); $image = $this->readTestImage('tile.png');
$this->assertEquals(16, $image->width()); $this->assertEquals(16, $image->width());
$this->assertEquals(16, $image->height()); $this->assertEquals(16, $image->height());
$image->modify(new ResizeCanvasModifier(18, 18, 'ff0', 'center')); $image->modify(new ResizeCanvasModifier(18, 18, 'ff0', 'center'));

View File

@@ -16,7 +16,7 @@ class ResizeCanvasRelativeModifierTest extends TestCase
public function testModify(): void public function testModify(): void
{ {
$image = $this->createTestImage('tile.png'); $image = $this->readTestImage('tile.png');
$this->assertEquals(16, $image->width()); $this->assertEquals(16, $image->width());
$this->assertEquals(16, $image->height()); $this->assertEquals(16, $image->height());
$image->modify(new ResizeCanvasRelativeModifier(2, 2, 'ff0', 'center')); $image->modify(new ResizeCanvasRelativeModifier(2, 2, 'ff0', 'center'));

View File

@@ -16,7 +16,7 @@ class ResizeModifierTest extends TestCase
public function testModify(): void public function testModify(): void
{ {
$image = $this->createTestImage('blocks.png'); $image = $this->readTestImage('blocks.png');
$this->assertEquals(640, $image->width()); $this->assertEquals(640, $image->width());
$this->assertEquals(480, $image->height()); $this->assertEquals(480, $image->height());
$image->modify(new ResizeModifier(200, 100)); $image->modify(new ResizeModifier(200, 100));

View File

@@ -16,7 +16,7 @@ class ResolutionModifierTest extends TestCase
public function testResolutionChange(): void 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()->x());
$this->assertEquals(72.0, $image->resolution()->y()); $this->assertEquals(72.0, $image->resolution()->y());
$image->modify(new ResolutionModifier(1, 2)); $image->modify(new ResolutionModifier(1, 2));

View File

@@ -16,7 +16,7 @@ class RotateModifierTest extends TestCase
public function testRotate(): void public function testRotate(): void
{ {
$image = $this->createTestImage('test.jpg'); $image = $this->readTestImage('test.jpg');
$this->assertEquals(320, $image->width()); $this->assertEquals(320, $image->width());
$this->assertEquals(240, $image->height()); $this->assertEquals(240, $image->height());
$image->modify(new RotateModifier(90, 'fff')); $image->modify(new RotateModifier(90, 'fff'));

View File

@@ -16,7 +16,7 @@ class SharpenModifierTest extends TestCase
public function testModify(): void public function testModify(): void
{ {
$image = $this->createTestImage('trim.png'); $image = $this->readTestImage('trim.png');
$this->assertEquals('60ab96', $image->pickColor(15, 14)->toHex()); $this->assertEquals('60ab96', $image->pickColor(15, 14)->toHex());
$image->modify(new SharpenModifier(10)); $image->modify(new SharpenModifier(10));
$this->assertEquals('4faca6', $image->pickColor(15, 14)->toHex()); $this->assertEquals('4faca6', $image->pickColor(15, 14)->toHex());

View File

@@ -10,7 +10,7 @@ use Intervention\Image\Image;
trait CanCreateGdTestImage trait CanCreateGdTestImage
{ {
public function createTestImage($filename = 'test.jpg'): Image public function readTestImage($filename = 'test.jpg'): Image
{ {
return (new FilePathImageDecoder())->handle( return (new FilePathImageDecoder())->handle(
$this->getTestImagePath($filename) $this->getTestImagePath($filename)

View File

@@ -7,7 +7,7 @@ use Intervention\Image\Image;
trait CanCreateImagickTestImage trait CanCreateImagickTestImage
{ {
public function createTestImage($filename = 'test.jpg'): Image public function readTestImage($filename = 'test.jpg'): Image
{ {
return (new FilePathImageDecoder())->handle( return (new FilePathImageDecoder())->handle(
sprintf('%s/../images/%s', __DIR__, $filename) sprintf('%s/../images/%s', __DIR__, $filename)