Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 39 additions & 39 deletions packages/image/tests/Image/ImageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ private function jpegWithExifOrientation(int $orientation): string
return substr($jpeg, 0, 2) . $segment . substr($jpeg, 2);
}

public function test_jpeg(): void
public function testJpeg(): void
{
$image = new Image(file_get_contents(__DIR__ . '/../resources/disk-a/kitten-1.jpg') ?: '');
$target = __DIR__ . '/100x100.jpg';
Expand All @@ -69,7 +69,7 @@ public function test_jpeg(): void
unlink($target);
}

public function test_png(): void
public function testPng(): void
{
$image = new Image(file_get_contents(__DIR__ . '/../resources/disk-a/kitten-1.jpg') ?: '');
$target = __DIR__ . '/100x100.png';
Expand All @@ -90,7 +90,7 @@ public function test_png(): void
unlink($target);
}

public function test_crop100x100(): void
public function testCrop100x100(): void
{
$image = new Image(file_get_contents(__DIR__ . '/../resources/disk-a/kitten-1.jpg') ?: '');
$target = __DIR__ . '/100x100.jpg';
Expand All @@ -111,7 +111,7 @@ public function test_crop100x100(): void
unlink($target);
}

public function test_crop_gravity_nw(): void
public function testCropGravityNw(): void
{
$image = new Image(file_get_contents(__DIR__ . '/../resources/disk-a/kitten-1.jpg') ?: '');
$target = __DIR__ . '/NW.jpg';
Expand All @@ -138,7 +138,7 @@ public function test_crop_gravity_nw(): void
unlink($target);
}

public function test_crop_gravity_n(): void
public function testCropGravityN(): void
{
$image = new Image(file_get_contents(__DIR__ . '/../resources/disk-a/kitten-3.gif') ?: '');
$target = __DIR__ . '/N.gif';
Expand All @@ -165,7 +165,7 @@ public function test_crop_gravity_n(): void
unlink($target);
}

public function test_crop_gravity_ne(): void
public function testCropGravityNe(): void
{
$image = new Image(file_get_contents(__DIR__ . '/../resources/disk-a/kitten-1.jpg') ?: '');
$target = __DIR__ . '/NE.jpg';
Expand All @@ -192,7 +192,7 @@ public function test_crop_gravity_ne(): void
unlink($target);
}

public function test_crop_gravity_sw(): void
public function testCropGravitySw(): void
{
$image = new Image(file_get_contents(__DIR__ . '/../resources/disk-a/kitten-1.jpg') ?: '');
$target = __DIR__ . '/SW.jpg';
Expand All @@ -219,7 +219,7 @@ public function test_crop_gravity_sw(): void
unlink($target);
}

public function test_crop_gravity_s(): void
public function testCropGravityS(): void
{
$image = new Image(file_get_contents(__DIR__ . '/../resources/disk-a/kitten-3.gif') ?: '');
$target = __DIR__ . '/S.gif';
Expand All @@ -246,7 +246,7 @@ public function test_crop_gravity_s(): void
unlink($target);
}

public function test_crop_gravity_se(): void
public function testCropGravitySe(): void
{
$image = new Image(file_get_contents(__DIR__ . '/../resources/disk-a/kitten-1.jpg') ?: '');
$target = __DIR__ . '/SE.jpg';
Expand All @@ -273,7 +273,7 @@ public function test_crop_gravity_se(): void
unlink($target);
}

public function test_crop_gravity_c(): void
public function testCropGravityC(): void
{
$image = new Image(file_get_contents(__DIR__ . '/../resources/disk-a/kitten-1.jpg') ?: '');
$target = __DIR__ . '/C.jpg';
Expand All @@ -300,7 +300,7 @@ public function test_crop_gravity_c(): void
unlink($target);
}

public function test_crop_gravity_w(): void
public function testCropGravityW(): void
{
$image = new Image(file_get_contents(__DIR__ . '/../resources/disk-a/kitten-3.gif') ?: '');
$target = __DIR__ . '/W.gif';
Expand All @@ -327,7 +327,7 @@ public function test_crop_gravity_w(): void
unlink($target);
}

public function test_crop_gravity_e(): void
public function testCropGravityE(): void
{
$image = new Image(file_get_contents(__DIR__ . '/../resources/disk-a/kitten-1.jpg') ?: '');
$target = __DIR__ . '/E.jpg';
Expand All @@ -354,7 +354,7 @@ public function test_crop_gravity_e(): void
unlink($target);
}

public function test_crop_gravity_preserves_aspect_ratio(): void
public function testCropGravityPreservesAspectRatio(): void
{
$source = new \Imagick();
$source->newImage(2, 4, 'red', 'png');
Expand Down Expand Up @@ -400,7 +400,7 @@ public static function gravityProvider(): \Iterator
}

#[DataProvider('gravityProvider')]
public function test_crop_gravity_positions(string $gravity, bool $horizontal, string $expectedChannel): void
public function testCropGravityPositions(string $gravity, bool $horizontal, string $expectedChannel): void
{
$source = new \Imagick();
$source->newImage($horizontal ? 6 : 2, $horizontal ? 2 : 6, 'red', 'png');
Expand Down Expand Up @@ -431,7 +431,7 @@ public function test_crop_gravity_positions(string $gravity, bool $horizontal, s
}], $color[$expectedChannel]);
}

public function test_crop100x400(): void
public function testCrop100x400(): void
{
$image = new Image(file_get_contents(__DIR__ . '/../resources/disk-a/kitten-1.jpg') ?: '');
$target = __DIR__ . '/100x400.jpg';
Expand All @@ -452,7 +452,7 @@ public function test_crop100x400(): void
unlink($target);
}

public function test_crop400x100(): void
public function testCrop400x100(): void
{
$image = new Image(file_get_contents(__DIR__ . '/../resources/disk-a/kitten-1.jpg') ?: '');
$target = __DIR__ . '/400x100.jpg';
Expand All @@ -473,7 +473,7 @@ public function test_crop400x100(): void
unlink($target);
}

public function test_crop100x100_webp(): void
public function testCrop100x100Webp(): void
{
$image = new Image(file_get_contents(__DIR__ . '/../resources/disk-a/kitten-1.jpg') ?: '');
$target = __DIR__ . '/100x100.webp';
Expand All @@ -495,7 +495,7 @@ public function test_crop100x100_webp(): void
unlink($target);
}

public function test_crop100x100_webp_quality30(): void
public function testCrop100x100WebpQuality30(): void
{
$image = new Image(file_get_contents(__DIR__ . '/../resources/disk-a/kitten-1.jpg') ?: '');
$target = __DIR__ . '/100x100-q30.webp';
Expand Down Expand Up @@ -525,7 +525,7 @@ public function test_crop100x100_webp_quality30(): void
unlink($target);
}

public function test_webp_blob_output(): void
public function testWebpBlobOutput(): void
{
$image = new Image(file_get_contents(__DIR__ . '/../resources/disk-a/kitten-1.jpg') ?: '');

Expand All @@ -545,7 +545,7 @@ public function test_webp_blob_output(): void
$this->assertContains($probe->getImageFormat(), ['PAM', 'WEBP']);
}

public function test_repeated_output_applies_exif_rotation_once(): void
public function testRepeatedOutputAppliesExifRotationOnce(): void
{
$image = new Image($this->jpegWithExifOrientation(6));

Expand All @@ -565,7 +565,7 @@ public function test_repeated_output_applies_exif_rotation_once(): void
$this->assertSame($first->getImageHeight(), $second->getImageHeight());
}

public function test_save_preserves_image_for_subsequent_exports(): void
public function testSavePreservesImageForSubsequentExports(): void
{
$image = new Image(file_get_contents(__DIR__ . '/../resources/disk-a/kitten-1.jpg') ?: '');
$target = __DIR__ . '/reusable.jpg';
Expand All @@ -587,7 +587,7 @@ public function test_save_preserves_image_for_subsequent_exports(): void
}
}

public function test_save_writes_filename_zero(): void
public function testSaveWritesFilenameZero(): void
{
$cwd = getcwd();
$this->assertIsString($cwd);
Expand All @@ -610,7 +610,7 @@ public function test_save_writes_filename_zero(): void
}
}

public function test_webp_from_webp_input(): void
public function testWebpFromWebpInput(): void
{
$image = new Image(file_get_contents(__DIR__ . '/../resources/resize/100x100.webp') ?: '');
$target = __DIR__ . '/roundtrip.webp';
Expand All @@ -630,7 +630,7 @@ public function test_webp_from_webp_input(): void
unlink($target);
}

public function test_crop100x100_avif(): void
public function testCrop100x100Avif(): void
{
$this->requireEncoder('AVIF');

Expand All @@ -657,7 +657,7 @@ public function test_crop100x100_avif(): void
unlink($target);
}

public function test_crop100x100_avif_quality30(): void
public function testCrop100x100AvifQuality30(): void
{
$this->requireEncoder('AVIF');

Expand All @@ -681,7 +681,7 @@ public function test_crop100x100_avif_quality30(): void
unlink($target);
}

public function test_crop100x100_heic(): void
public function testCrop100x100Heic(): void
{
$this->requireEncoder('HEIC');

Expand Down Expand Up @@ -713,7 +713,7 @@ public function test_crop100x100_heic(): void
unlink($target);
}

public function test_crop100x100_heic_quality30(): void
public function testCrop100x100HeicQuality30(): void
{
$this->requireEncoder('HEIC');

Expand Down Expand Up @@ -745,7 +745,7 @@ public function test_crop100x100_heic_quality30(): void
unlink($target);
}

public function test_crop100x100_png(): void
public function testCrop100x100Png(): void
{
$image = new Image(file_get_contents(__DIR__ . '/../resources/disk-a/kitten-1.jpg') ?: '');
$target = __DIR__ . '/100x100.png';
Expand All @@ -770,7 +770,7 @@ public function test_crop100x100_png(): void
unlink($target);
}

public function test_crop100x100_png_quality30(): void
public function testCrop100x100PngQuality30(): void
{
$image = new Image(file_get_contents(__DIR__ . '/../resources/disk-a/kitten-1.jpg') ?: '');
$target = __DIR__ . '/100x100-q30.jpg';
Expand All @@ -795,7 +795,7 @@ public function test_crop100x100_png_quality30(): void
unlink($target);
}

public function test_crop100x100_gif(): void
public function testCrop100x100Gif(): void
{
$image = new Image(file_get_contents(__DIR__ . '/../resources/disk-a/kitten-3.gif') ?: '');
$target = __DIR__ . '/100x100.gif';
Expand All @@ -819,7 +819,7 @@ public function test_crop100x100_gif(): void
unlink($target);
}

public function test_border5_red(): void
public function testBorder5Red(): void
{
$image = new Image(file_get_contents(__DIR__ . '/../resources/disk-a/kitten-1.jpg') ?: '');
$target = __DIR__ . '/border_5_red.jpg';
Expand All @@ -839,7 +839,7 @@ public function test_border5_red(): void
unlink($target);
}

public function test_rotate45(): void
public function testRotate45(): void
{
$image = new Image(file_get_contents(__DIR__ . '/../resources/disk-a/kitten-1.jpg') ?: '');
$target = __DIR__ . '/rotate_45.jpg';
Expand All @@ -861,7 +861,7 @@ public function test_rotate45(): void
unlink($target);
}

public function test_opacity02(): void
public function testOpacity02(): void
{
$image = new Image(file_get_contents(__DIR__ . '/../resources/disk-a/kitten-1.jpg') ?: '');
$target = __DIR__ . '/opacity_0.2.png';
Expand All @@ -881,7 +881,7 @@ public function test_opacity02(): void
unlink($target);
}

public function test_border_radius500(): void
public function testBorderRadius500(): void
{
$image = new Image(file_get_contents(__DIR__ . '/../resources/disk-a/kitten-1.jpg') ?: '');
$target = __DIR__ . '/border_radius_500.png';
Expand All @@ -901,7 +901,7 @@ public function test_border_radius500(): void
unlink($target);
}

public function test_crop100_op05(): void
public function testCrop100Op05(): void
{
$image = new Image(file_get_contents(__DIR__ . '/../resources/disk-a/kitten-1.jpg') ?: '');
$target = __DIR__ . '/100x100_OP_0.5.png';
Expand All @@ -924,7 +924,7 @@ public function test_crop100_op05(): void
unlink($target);
}

public function test_crop100_b_r50(): void
public function testCrop100BR50(): void
{
$image = new Image(file_get_contents(__DIR__ . '/../resources/disk-a/kitten-1.jpg') ?: '');
$target = __DIR__ . '/100x100_BR_50.png';
Expand All @@ -945,7 +945,7 @@ public function test_crop100_b_r50(): void
unlink($target);
}

public function test_gif_small_last_frame(): void
public function testGifSmallLastFrame(): void
{
$image = new Image(file_get_contents(__DIR__ . '/../resources/disk-a/last-frame-1px.gif') ?: '');
$target = __DIR__ . '/last-frame-1px-output.gif';
Expand All @@ -970,7 +970,7 @@ public function test_gif_small_last_frame(): void
* Animated WebP stores delta/partial frames. Cropping without coalesce
* scales those fragments independently and produces ghosting artifacts.
*/
public function test_crop_animated_webp_preserves_frames(): void
public function testCropAnimatedWebpPreservesFrames(): void
{
$source = __DIR__ . '/../resources/disk-a/anim-delta.webp';
$image = new Image(file_get_contents($source) ?: '');
Expand Down Expand Up @@ -1014,7 +1014,7 @@ public function test_crop_animated_webp_preserves_frames(): void
* Consecutive identical frames are hold/pause frames. Cropping must keep
* total playback delay — deconstructImages() + WebP encode can zero it out.
*/
public function test_crop_animated_webp_preserves_hold_frames(): void
public function testCropAnimatedWebpPreservesHoldFrames(): void
{
$sequence = new \Imagick();
foreach (['#ff0000', '#ff0000', '#0000ff'] as $color) {
Expand Down
3 changes: 3 additions & 0 deletions pint.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
"single_quote": true,
"trailing_comma_in_multiline": {
"elements": ["arrays", "arguments", "parameters"]
},
"php_unit_method_casing": {
"case": "camel_case"
}
}
}
Loading