From fefd38be5c0c615a830d4de510e4a778ec809f33 Mon Sep 17 00:00:00 2001 From: Darin Kotter Date: Wed, 20 Nov 2024 11:15:43 -0700 Subject: [PATCH] Add unit test for a custom image size --- tests/unit/test-safe-svg.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/unit/test-safe-svg.php b/tests/unit/test-safe-svg.php index 1864474..a7b4c56 100644 --- a/tests/unit/test-safe-svg.php +++ b/tests/unit/test-safe-svg.php @@ -208,6 +208,7 @@ public function test_one_pixel_fix() { 'return_in_order' => array( __DIR__ . '/files/svgCleanOne.svg', __DIR__ . '/files/svgNoDimensions.svg', + __DIR__ . '/files/svgCleanOne.svg', ), ) ); @@ -298,6 +299,19 @@ public function test_one_pixel_fix() { ), $image_sizes ); + + // Test Custom Dimensions + $image_sizes = $this->instance->one_pixel_fix( array(), 1, [ 500, 500 ], false ); + if ( ! empty( $image_sizes ) ) { + $image_sizes = array_map( 'intval', $image_sizes ); + } + $this->assertSame( + array( + 1 => 500, + 2 => 500, + ), + $image_sizes + ); } /**