@@ -14,36 +14,44 @@ use Tester\Assert;
1414require __DIR__ . '/../bootstrap.php ' ;
1515
1616
17+ function toGd2 ($ image )
18+ {
19+ ob_start ();
20+ imagegd2 ($ image ->getImageResource ());
21+ return ob_get_clean ();
22+ }
23+
24+
1725$ image = Image::fromFile (__DIR__ . '/fixtures.images/alpha1.png ' );
1826$ image ->place (Image::fromFile (__DIR__ . '/fixtures.images/alpha2.png ' ), 0 , 0 , 100 );
19- Assert::same (file_get_contents (__DIR__ . '/expected/Image.alpha2.100.png ' ), $ image-> toString (Image:: PNG , 0 ));
27+ Assert::same (file_get_contents (__DIR__ . '/expected/Image.alpha2.100.gd2 ' ), toGd2 ( $ image ));
2028
2129
2230$ image = Image::fromFile (__DIR__ . '/fixtures.images/alpha1.png ' );
2331$ image ->place (Image::fromFile (__DIR__ . '/fixtures.images/alpha2.png ' ), 0 , 0 , 99 );
24- Assert::same (file_get_contents (__DIR__ . '/expected/Image.alpha2.99.png ' ), $ image-> toString (Image:: PNG , 0 ));
32+ Assert::same (file_get_contents (__DIR__ . '/expected/Image.alpha2.99.gd2 ' ), toGd2 ( $ image ));
2533
2634
2735$ image = Image::fromFile (__DIR__ . '/fixtures.images/alpha1.png ' );
2836$ image ->place (Image::fromFile (__DIR__ . '/fixtures.images/alpha2.png ' ), 0 , 0 , 50 );
29- Assert::same (file_get_contents (__DIR__ . '/expected/Image.alpha2.50.png ' ), $ image-> toString (Image:: PNG , 0 ));
37+ Assert::same (file_get_contents (__DIR__ . '/expected/Image.alpha2.50.gd2 ' ), toGd2 ( $ image ));
3038
3139
3240$ image = Image::fromFile (__DIR__ . '/fixtures.images/alpha1.png ' );
3341$ image ->place (Image::fromFile (__DIR__ . '/fixtures.images/alpha2.png ' ), 0 , 0 , 1 );
34- Assert::same (file_get_contents (__DIR__ . '/expected/Image.alpha2.1.png ' ), $ image-> toString (Image:: PNG , 0 ));
42+ Assert::same (file_get_contents (__DIR__ . '/expected/Image.alpha2.1.gd2 ' ), toGd2 ( $ image ));
3543
3644
3745$ image = Image::fromFile (__DIR__ . '/fixtures.images/alpha1.png ' );
3846$ image ->place (Image::fromFile (__DIR__ . '/fixtures.images/alpha2.png ' ), 0 , 0 , 0 );
39- Assert::same (file_get_contents (__DIR__ . '/expected/Image.alpha2.0.png ' ), $ image-> toString (Image:: PNG , 0 ));
47+ Assert::same (file_get_contents (__DIR__ . '/expected/Image.alpha2.0.gd2 ' ), toGd2 ( $ image ));
4048
4149
4250$ image = Image::fromFile (__DIR__ . '/fixtures.images/alpha1.png ' );
4351$ image ->place (Image::fromFile (__DIR__ . '/fixtures.images/alpha3.gif ' ), 0 , 0 , 100 );
44- Assert::same (file_get_contents (__DIR__ . '/expected/Image.alpha2.100b.png ' ), $ image-> toString (Image:: PNG , 0 ));
52+ Assert::same (file_get_contents (__DIR__ . '/expected/Image.alpha2.100b.gd2 ' ), toGd2 ( $ image ));
4553
4654
4755$ image = Image::fromFile (__DIR__ . '/fixtures.images/alpha1.png ' );
4856$ image ->place (Image::fromFile (__DIR__ . '/fixtures.images/alpha3.gif ' ), 0 , 0 , 50 );
49- Assert::same (file_get_contents (__DIR__ . '/expected/Image.alpha2.50b.png ' ), $ image-> toString (Image:: PNG , 0 ));
57+ Assert::same (file_get_contents (__DIR__ . '/expected/Image.alpha2.50b.gd2 ' ), toGd2 ( $ image ));
0 commit comments