diff --git a/tests/Utils/Image.alpha1.phpt b/tests/Utils/Image.alpha1.phpt index 410526b88..f078d2533 100644 --- a/tests/Utils/Image.alpha1.phpt +++ b/tests/Utils/Image.alpha1.phpt @@ -25,10 +25,9 @@ $image2->place(Image::fromBlank(50, 50, Image::rgb(80, 174, 0)), 75, 25); Assert::same($image2->toString(Image::PNG, 0), $image->toString(Image::PNG, 0)); -ob_start(); - $image = Image::fromBlank(200, 100, Image::rgb(255, 128, 0, 60)); $image->crop(0, 0, '60%', '60%'); -$image->send(Image::PNG, 0); -Assert::same(file_get_contents(__DIR__ . '/expected/Image.alpha1.png'), ob_get_clean()); +ob_start(); +imagegd2($image->getImageResource()); +Assert::same(file_get_contents(__DIR__ . '/expected/Image.alpha1.gd2'), ob_get_clean()); diff --git a/tests/Utils/Image.alpha2.phpt b/tests/Utils/Image.alpha2.phpt index 93ed353f5..a0fdacd8a 100644 --- a/tests/Utils/Image.alpha2.phpt +++ b/tests/Utils/Image.alpha2.phpt @@ -14,36 +14,44 @@ use Tester\Assert; require __DIR__ . '/../bootstrap.php'; +function toGd2($image) +{ + ob_start(); + imagegd2($image->getImageResource()); + return ob_get_clean(); +} + + $image = Image::fromFile(__DIR__ . '/fixtures.images/alpha1.png'); $image->place(Image::fromFile(__DIR__ . '/fixtures.images/alpha2.png'), 0, 0, 100); -Assert::same(file_get_contents(__DIR__ . '/expected/Image.alpha2.100.png'), $image->toString(Image::PNG, 0)); +Assert::same(file_get_contents(__DIR__ . '/expected/Image.alpha2.100.gd2'), toGd2($image)); $image = Image::fromFile(__DIR__ . '/fixtures.images/alpha1.png'); $image->place(Image::fromFile(__DIR__ . '/fixtures.images/alpha2.png'), 0, 0, 99); -Assert::same(file_get_contents(__DIR__ . '/expected/Image.alpha2.99.png'), $image->toString(Image::PNG, 0)); +Assert::same(file_get_contents(__DIR__ . '/expected/Image.alpha2.99.gd2'), toGd2($image)); $image = Image::fromFile(__DIR__ . '/fixtures.images/alpha1.png'); $image->place(Image::fromFile(__DIR__ . '/fixtures.images/alpha2.png'), 0, 0, 50); -Assert::same(file_get_contents(__DIR__ . '/expected/Image.alpha2.50.png'), $image->toString(Image::PNG, 0)); +Assert::same(file_get_contents(__DIR__ . '/expected/Image.alpha2.50.gd2'), toGd2($image)); $image = Image::fromFile(__DIR__ . '/fixtures.images/alpha1.png'); $image->place(Image::fromFile(__DIR__ . '/fixtures.images/alpha2.png'), 0, 0, 1); -Assert::same(file_get_contents(__DIR__ . '/expected/Image.alpha2.1.png'), $image->toString(Image::PNG, 0)); +Assert::same(file_get_contents(__DIR__ . '/expected/Image.alpha2.1.gd2'), toGd2($image)); $image = Image::fromFile(__DIR__ . '/fixtures.images/alpha1.png'); $image->place(Image::fromFile(__DIR__ . '/fixtures.images/alpha2.png'), 0, 0, 0); -Assert::same(file_get_contents(__DIR__ . '/expected/Image.alpha2.0.png'), $image->toString(Image::PNG, 0)); +Assert::same(file_get_contents(__DIR__ . '/expected/Image.alpha2.0.gd2'), toGd2($image)); $image = Image::fromFile(__DIR__ . '/fixtures.images/alpha1.png'); $image->place(Image::fromFile(__DIR__ . '/fixtures.images/alpha3.gif'), 0, 0, 100); -Assert::same(file_get_contents(__DIR__ . '/expected/Image.alpha2.100b.png'), $image->toString(Image::PNG, 0)); +Assert::same(file_get_contents(__DIR__ . '/expected/Image.alpha2.100b.gd2'), toGd2($image)); $image = Image::fromFile(__DIR__ . '/fixtures.images/alpha1.png'); $image->place(Image::fromFile(__DIR__ . '/fixtures.images/alpha3.gif'), 0, 0, 50); -Assert::same(file_get_contents(__DIR__ . '/expected/Image.alpha2.50b.png'), $image->toString(Image::PNG, 0)); +Assert::same(file_get_contents(__DIR__ . '/expected/Image.alpha2.50b.gd2'), toGd2($image)); diff --git a/tests/Utils/Image.drawing.phpt b/tests/Utils/Image.drawing.phpt index fc4df619e..c236e44d6 100644 --- a/tests/Utils/Image.drawing.phpt +++ b/tests/Utils/Image.drawing.phpt @@ -14,6 +14,14 @@ use Tester\Assert; require __DIR__ . '/../bootstrap.php'; +function toGd2($image) +{ + ob_start(); + imagegd2($image->getImageResource()); + return ob_get_clean(); +} + + $size = 300; $image = Image::fromBlank($size, $size); @@ -28,11 +36,11 @@ $image->filledEllipse(187, 125, $radius, $radius, Image::rgb(0, 0, 255, 75)); $image->copyResampled($image, 200, 200, 0, 0, 80, 80, $size, $size); -Assert::same(file_get_contents(__DIR__ . '/expected/Image.drawing.1.png'), $image->toString(Image::PNG, 0)); +Assert::same(file_get_contents(__DIR__ . '/expected/Image.drawing.1.gd2'), toGd2($image)); // palette-based image $image = Image::fromFile(__DIR__ . '/fixtures.images/logo.gif'); $image->filledEllipse(100, 50, 50, 50, Image::rgb(255, 255, 0, 75)); $image->filledEllipse(100, 150, 50, 50, Image::rgb(255, 255, 0, 75)); -Assert::same(file_get_contents(__DIR__ . '/expected/Image.drawing.2.png'), $image->toString(Image::PNG, 0)); +Assert::same(file_get_contents(__DIR__ . '/expected/Image.drawing.2.gd2'), toGd2($image)); diff --git a/tests/Utils/Image.place.phpt b/tests/Utils/Image.place.phpt index 4fec1a48a..0e849158d 100644 --- a/tests/Utils/Image.place.phpt +++ b/tests/Utils/Image.place.phpt @@ -20,7 +20,5 @@ $image = Image::fromBlank(100, 100, Image::rgb(0, 0, 0)); $image->place($rectangle, '37.5%', '50%'); ob_start(); - -$image->send(Image::PNG, 0); - -Assert::same(file_get_contents(__DIR__ . '/expected/Image.place.png'), ob_get_clean()); +imagegd2($image->getImageResource()); +Assert::same(file_get_contents(__DIR__ . '/expected/Image.place.gd2'), ob_get_clean()); diff --git a/tests/Utils/Image.resize.phpt b/tests/Utils/Image.resize.phpt index 6d11d4402..38f77c160 100644 --- a/tests/Utils/Image.resize.phpt +++ b/tests/Utils/Image.resize.phpt @@ -17,6 +17,14 @@ require __DIR__ . '/../bootstrap.php'; $main = Image::fromFile(__DIR__ . '/fixtures.images/logo.gif'); +function toGd2($image) +{ + ob_start(); + imagegd2($image->getImageResource()); + return ob_get_clean(); +} + + test(function () use ($main) { // cropping... $image = clone $main; Assert::same(176, $image->width); @@ -135,19 +143,19 @@ test(function () use ($main) { // rotate test(function () use ($main) { // alpha resize $image = Image::fromFile(__DIR__ . '/fixtures.images/alpha1.png'); $image->resize(20, 20); - Assert::same(file_get_contents(__DIR__ . '/expected/Image.alpha.resize1.png'), $image->toString(Image::PNG, 0)); + Assert::same(file_get_contents(__DIR__ . '/expected/Image.alpha.resize1.gd2'), toGd2($image)); }); test(function () use ($main) { // alpha flip $image = Image::fromFile(__DIR__ . '/fixtures.images/alpha1.png'); $image->resize(-10, -10); - Assert::same(file_get_contents(__DIR__ . '/expected/Image.alpha.flip1.png'), $image->toString(Image::PNG, 0)); + Assert::same(file_get_contents(__DIR__ . '/expected/Image.alpha.flip1.gd2'), toGd2($image)); }); test(function () use ($main) { // palette alpha resize $image = Image::fromFile(__DIR__ . '/fixtures.images/alpha3.gif'); $image->resize(20, 20); - Assert::same(file_get_contents(__DIR__ . '/expected/Image.alpha.resize2.png'), $image->toString(Image::PNG, 0)); + Assert::same(file_get_contents(__DIR__ . '/expected/Image.alpha.resize2.gd2'), toGd2($image)); }); diff --git a/tests/Utils/expected/Image.alpha.flip1.gd2 b/tests/Utils/expected/Image.alpha.flip1.gd2 new file mode 100644 index 000000000..662774279 Binary files /dev/null and b/tests/Utils/expected/Image.alpha.flip1.gd2 differ diff --git a/tests/Utils/expected/Image.alpha.flip1.png b/tests/Utils/expected/Image.alpha.flip1.png deleted file mode 100644 index 824489cbf..000000000 Binary files a/tests/Utils/expected/Image.alpha.flip1.png and /dev/null differ diff --git a/tests/Utils/expected/Image.alpha.resize1.gd2 b/tests/Utils/expected/Image.alpha.resize1.gd2 new file mode 100644 index 000000000..13857719f Binary files /dev/null and b/tests/Utils/expected/Image.alpha.resize1.gd2 differ diff --git a/tests/Utils/expected/Image.alpha.resize1.png b/tests/Utils/expected/Image.alpha.resize1.png deleted file mode 100644 index 0528eb0c9..000000000 Binary files a/tests/Utils/expected/Image.alpha.resize1.png and /dev/null differ diff --git a/tests/Utils/expected/Image.alpha.resize2.gd2 b/tests/Utils/expected/Image.alpha.resize2.gd2 new file mode 100644 index 000000000..077a5ca72 Binary files /dev/null and b/tests/Utils/expected/Image.alpha.resize2.gd2 differ diff --git a/tests/Utils/expected/Image.alpha.resize2.png b/tests/Utils/expected/Image.alpha.resize2.png deleted file mode 100644 index 0e335843a..000000000 Binary files a/tests/Utils/expected/Image.alpha.resize2.png and /dev/null differ diff --git a/tests/Utils/expected/Image.alpha1.gd2 b/tests/Utils/expected/Image.alpha1.gd2 new file mode 100644 index 000000000..3cfdda2fe Binary files /dev/null and b/tests/Utils/expected/Image.alpha1.gd2 differ diff --git a/tests/Utils/expected/Image.alpha1.png b/tests/Utils/expected/Image.alpha1.png deleted file mode 100644 index 60235d824..000000000 Binary files a/tests/Utils/expected/Image.alpha1.png and /dev/null differ diff --git a/tests/Utils/expected/Image.alpha2.0.gd2 b/tests/Utils/expected/Image.alpha2.0.gd2 new file mode 100644 index 000000000..fc7f4698e Binary files /dev/null and b/tests/Utils/expected/Image.alpha2.0.gd2 differ diff --git a/tests/Utils/expected/Image.alpha2.0.png b/tests/Utils/expected/Image.alpha2.0.png deleted file mode 100644 index 90fe26bfa..000000000 Binary files a/tests/Utils/expected/Image.alpha2.0.png and /dev/null differ diff --git a/tests/Utils/expected/Image.alpha2.1.gd2 b/tests/Utils/expected/Image.alpha2.1.gd2 new file mode 100644 index 000000000..5b591356b Binary files /dev/null and b/tests/Utils/expected/Image.alpha2.1.gd2 differ diff --git a/tests/Utils/expected/Image.alpha2.1.png b/tests/Utils/expected/Image.alpha2.1.png deleted file mode 100644 index 590339bd4..000000000 Binary files a/tests/Utils/expected/Image.alpha2.1.png and /dev/null differ diff --git a/tests/Utils/expected/Image.alpha2.100.gd2 b/tests/Utils/expected/Image.alpha2.100.gd2 new file mode 100644 index 000000000..8279b5818 Binary files /dev/null and b/tests/Utils/expected/Image.alpha2.100.gd2 differ diff --git a/tests/Utils/expected/Image.alpha2.100.png b/tests/Utils/expected/Image.alpha2.100.png deleted file mode 100644 index 6f0a38aee..000000000 Binary files a/tests/Utils/expected/Image.alpha2.100.png and /dev/null differ diff --git a/tests/Utils/expected/Image.alpha2.100b.gd2 b/tests/Utils/expected/Image.alpha2.100b.gd2 new file mode 100644 index 000000000..760172118 Binary files /dev/null and b/tests/Utils/expected/Image.alpha2.100b.gd2 differ diff --git a/tests/Utils/expected/Image.alpha2.100b.png b/tests/Utils/expected/Image.alpha2.100b.png deleted file mode 100644 index 758d844db..000000000 Binary files a/tests/Utils/expected/Image.alpha2.100b.png and /dev/null differ diff --git a/tests/Utils/expected/Image.alpha2.50.gd2 b/tests/Utils/expected/Image.alpha2.50.gd2 new file mode 100644 index 000000000..4f13c53f1 Binary files /dev/null and b/tests/Utils/expected/Image.alpha2.50.gd2 differ diff --git a/tests/Utils/expected/Image.alpha2.50.png b/tests/Utils/expected/Image.alpha2.50.png deleted file mode 100644 index c4cf63fd5..000000000 Binary files a/tests/Utils/expected/Image.alpha2.50.png and /dev/null differ diff --git a/tests/Utils/expected/Image.alpha2.50b.gd2 b/tests/Utils/expected/Image.alpha2.50b.gd2 new file mode 100644 index 000000000..15444afb4 Binary files /dev/null and b/tests/Utils/expected/Image.alpha2.50b.gd2 differ diff --git a/tests/Utils/expected/Image.alpha2.50b.png b/tests/Utils/expected/Image.alpha2.50b.png deleted file mode 100644 index 72f200a24..000000000 Binary files a/tests/Utils/expected/Image.alpha2.50b.png and /dev/null differ diff --git a/tests/Utils/expected/Image.alpha2.99.gd2 b/tests/Utils/expected/Image.alpha2.99.gd2 new file mode 100644 index 000000000..1eb622be3 Binary files /dev/null and b/tests/Utils/expected/Image.alpha2.99.gd2 differ diff --git a/tests/Utils/expected/Image.alpha2.99.png b/tests/Utils/expected/Image.alpha2.99.png deleted file mode 100644 index 48fe2d9d2..000000000 Binary files a/tests/Utils/expected/Image.alpha2.99.png and /dev/null differ diff --git a/tests/Utils/expected/Image.drawing.1.gd2 b/tests/Utils/expected/Image.drawing.1.gd2 new file mode 100644 index 000000000..edabbc8a7 Binary files /dev/null and b/tests/Utils/expected/Image.drawing.1.gd2 differ diff --git a/tests/Utils/expected/Image.drawing.1.png b/tests/Utils/expected/Image.drawing.1.png deleted file mode 100644 index 1c672f4ee..000000000 Binary files a/tests/Utils/expected/Image.drawing.1.png and /dev/null differ diff --git a/tests/Utils/expected/Image.drawing.2.gd2 b/tests/Utils/expected/Image.drawing.2.gd2 new file mode 100644 index 000000000..9ae9a9864 Binary files /dev/null and b/tests/Utils/expected/Image.drawing.2.gd2 differ diff --git a/tests/Utils/expected/Image.drawing.2.png b/tests/Utils/expected/Image.drawing.2.png deleted file mode 100644 index 5462a86e9..000000000 Binary files a/tests/Utils/expected/Image.drawing.2.png and /dev/null differ diff --git a/tests/Utils/expected/Image.place.png b/tests/Utils/expected/Image.place.gd2 similarity index 67% rename from tests/Utils/expected/Image.place.png rename to tests/Utils/expected/Image.place.gd2 index a9a6d4f72..906062612 100644 Binary files a/tests/Utils/expected/Image.place.png and b/tests/Utils/expected/Image.place.gd2 differ