mirror of
https://github.com/Intervention/image.git
synced 2025-09-03 10:53:01 +02:00
Implement __debugInfo() (#1406)
This commit is contained in:
@@ -115,4 +115,13 @@ final class ColorTest extends BaseTestCase
|
||||
$color = new Color(0, 0, 0, 0);
|
||||
$this->assertFalse($color->isClear());
|
||||
}
|
||||
|
||||
public function testDebugInfo(): void
|
||||
{
|
||||
$info = (new Color(10, 20, 30, 40))->__debugInfo();
|
||||
$this->assertEquals(10, $info['cyan']);
|
||||
$this->assertEquals(20, $info['magenta']);
|
||||
$this->assertEquals(30, $info['yellow']);
|
||||
$this->assertEquals(40, $info['key']);
|
||||
}
|
||||
}
|
||||
|
@@ -114,4 +114,12 @@ final class ColorTest extends BaseTestCase
|
||||
$color = new Color(0, 1, 0);
|
||||
$this->assertFalse($color->isClear());
|
||||
}
|
||||
|
||||
public function testDebugInfo(): void
|
||||
{
|
||||
$info = (new Color(10, 20, 30))->__debugInfo();
|
||||
$this->assertEquals(10, $info['hue']);
|
||||
$this->assertEquals(20, $info['saturation']);
|
||||
$this->assertEquals(30, $info['luminance']);
|
||||
}
|
||||
}
|
||||
|
@@ -114,4 +114,12 @@ final class ColorTest extends BaseTestCase
|
||||
$color = new Color(0, 1, 0);
|
||||
$this->assertFalse($color->isClear());
|
||||
}
|
||||
|
||||
public function testDebugInfo(): void
|
||||
{
|
||||
$info = (new Color(10, 20, 30))->__debugInfo();
|
||||
$this->assertEquals(10, $info['hue']);
|
||||
$this->assertEquals(20, $info['saturation']);
|
||||
$this->assertEquals(30, $info['value']);
|
||||
}
|
||||
}
|
||||
|
@@ -176,4 +176,13 @@ final class ColorTest extends BaseTestCase
|
||||
$color = new Color(255, 255, 255, 0);
|
||||
$this->assertTrue($color->isClear());
|
||||
}
|
||||
|
||||
public function testDebugInfo(): void
|
||||
{
|
||||
$info = (new Color(10, 20, 30, 40))->__debugInfo();
|
||||
$this->assertEquals(10, $info['red']);
|
||||
$this->assertEquals(20, $info['green']);
|
||||
$this->assertEquals(30, $info['blue']);
|
||||
$this->assertEquals(40, $info['alpha']);
|
||||
}
|
||||
}
|
||||
|
@@ -108,4 +108,13 @@ final class FrameTest extends BaseTestCase
|
||||
$frame = $this->getTestFrame();
|
||||
$this->assertInstanceOf(Image::class, $frame->toImage(new Driver()));
|
||||
}
|
||||
|
||||
public function testDebugInfo(): void
|
||||
{
|
||||
$info = $this->getTestFrame()->__debugInfo();
|
||||
$this->assertEquals(0, $info['delay']);
|
||||
$this->assertEquals(0, $info['left']);
|
||||
$this->assertEquals(0, $info['top']);
|
||||
$this->assertEquals(1, $info['dispose']);
|
||||
}
|
||||
}
|
||||
|
@@ -390,4 +390,11 @@ final class ImageTest extends GdTestCase
|
||||
$this->assertInstanceOf(ImageInterface::class, $result);
|
||||
$this->assertEquals('4cfaff', $image->pickColor(14, 14)->toHex());
|
||||
}
|
||||
|
||||
public function testDebugInfo(): void
|
||||
{
|
||||
$info = $this->readTestImage('trim.png')->__debugInfo();
|
||||
$this->assertArrayHasKey('width', $info);
|
||||
$this->assertArrayHasKey('height', $info);
|
||||
}
|
||||
}
|
||||
|
@@ -392,4 +392,11 @@ final class ImageTest extends ImagickTestCase
|
||||
$this->assertInstanceOf(ImageInterface::class, $result);
|
||||
$this->assertEquals('39c9ff', $image->pickColor(14, 14)->toHex());
|
||||
}
|
||||
|
||||
public function testDebugInfo(): void
|
||||
{
|
||||
$info = $this->readTestImage('trim.png')->__debugInfo();
|
||||
$this->assertArrayHasKey('width', $info);
|
||||
$this->assertArrayHasKey('height', $info);
|
||||
}
|
||||
}
|
||||
|
@@ -57,4 +57,11 @@ final class EncodedImageTest extends BaseTestCase
|
||||
$image = new EncodedImage($this->getTestResourceData(), 'image/jpeg');
|
||||
$this->assertEquals('image/jpeg', $image->mimetype());
|
||||
}
|
||||
|
||||
public function testDebugInfo(): void
|
||||
{
|
||||
$info = (new EncodedImage('foo', 'image/png'))->__debugInfo();
|
||||
$this->assertEquals('image/png', $info['mimetype']);
|
||||
$this->assertEquals(3, $info['size']);
|
||||
}
|
||||
}
|
||||
|
@@ -325,4 +325,11 @@ final class RectangleTest extends BaseTestCase
|
||||
$this->assertEquals(800, $result->width());
|
||||
$this->assertEquals(600, $result->height());
|
||||
}
|
||||
|
||||
public function testDebugInfo(): void
|
||||
{
|
||||
$info = (new Rectangle(800, 600))->__debugInfo();
|
||||
$this->assertEquals(800, $info['width']);
|
||||
$this->assertEquals(600, $info['height']);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user